Skip to content

Commit 76a49dc

Browse files
authored
Merge pull request #46 from edgehero/docs/dashboard-guide
docs: how to add flows/triggers and manage quiet hours from /dispatch
2 parents 4819a0d + d545006 commit 76a49dc

1 file changed

Lines changed: 78 additions & 16 deletions

File tree

README.md

Lines changed: 78 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ The admin surface — the dashboard and command transcript shown at the top of t
197197
extension** in [`admin/`](admin/) that loads into *your own* interactive pi session — no daemon, no web
198198
app, **no network port at all**.
199199

200-
**Install it through pi** — the published package, then open the panel:
200+
**Install it through pi** — the published package (the extension **and** the `operate-pi-dispatch` skill, so
201+
your AI can drive the deployment too — see [Operating pi-dispatch from your AI](#operating-pi-dispatch-from-your-ai)),
202+
then open the panel:
201203

202204
```bash
203205
pi install npm:@edgehero/pi-dispatch-admin # then, in pi: /dispatch
@@ -213,8 +215,9 @@ deployment.
213215
Bare `/dispatch` opens the live dashboard overlay — one snapshot per second, `p`/`r` to pause/resume the
214216
queue in place, ``/`` to move across the triggers and runs, `Enter` to drill into either. **Triggers are
215217
editable in place**: `Enter` on a trigger shows its trust model, `e` edits its flow, `x` deletes it, `a`
216-
adds one (guided, kind-first), and `s` edits a limit — every write is operator-typed, validated, atomic, and
217-
**reloaded live** by the worker/receiver (no restart). `Enter` on a run opens its full PII-free record:
218+
adds one (guided, kind-first), `s` edits a limit, and `w` manages scheduled pause windows — every write is
219+
operator-typed, validated, atomic, and **reloaded live** by the worker/receiver (no restart). `Enter` on a
220+
run opens its full PII-free record:
218221

219222
![The RUN_DETAIL drill-in — a colored post-mortem of one run's PII-free record: outcome, target, timing with duration, turns/exit/budget slot, tokens and cost, and a chain line naming spawned children](docs/images/dispatch-run-detail.svg)
220223

@@ -234,15 +237,24 @@ reads only queue counts, run records, and the settings overlay — none of which
234237

235238
### Operating pi-dispatch from your AI
236239

237-
The extension is AI-operable, so your assistant can drive it — but **every change asks you to confirm
238-
first**. The model-callable tools are: reads (`status`, `runs`, `triggers`); on/off (`pause`/`resume`, no
239-
confirm — reversible and money-safe); the gated `dispatch_run` enqueue; and the **confirm-gated writes**
240-
`dispatch_set` (change a limit) and `dispatch_trigger_add`/`_edit`/`_delete`. A write tool applies its
241-
change **only after you approve a dialog showing the exact before→after**, and **refuses — writing nothing —
242-
when no interactive operator is present** (so a prompt-injected session can't raise your cap or add a paid
243-
trigger; the model emits the call, only your keypress approves it). The bundled `operate-pi-dispatch` skill
244-
tells the model how to use those gates: state the change plainly, and accept a decline. `CONST-BUDGET-BEFORE-TOKENS`
245-
and `CONST-TRIGGER-AUTHOR-GATE` are unchanged — the confirm is the human approval.
240+
Installing `@edgehero/pi-dispatch-admin` gives your AI more than the panel: the package **also ships the
241+
`operate-pi-dispatch` skill** (via its `pi.skills` manifest), so once it's installed your assistant knows this
242+
deployment's tools and how to use their gates — **you can just ask, in plain language**: *"raise the daily cap
243+
to 30", "add a nightly `tidy` trigger for `/srv/site`", "quiet-hours for `acme/web` 22:00–06:00 Amsterdam"*.
244+
Everything the panel does is model-callable, so **setting it up can be driven entirely by the AI** — with your
245+
confirmation on every change that costs money or config:
246+
247+
- **Read** (no confirm): `dispatch_status`, `dispatch_runs`, `dispatch_triggers`, `dispatch_pauses`.
248+
- **Turn on/off** (no confirm — reversible, money-safe): `dispatch_pause` / `dispatch_resume`.
249+
- **Change config — each behind a confirm you approve**: `dispatch_set` (a limit/setting), the triggers
250+
`dispatch_trigger_add` / `_edit` / `_delete`, and the quiet-hours `dispatch_pause_add` / `_edit` / `_delete`.
251+
- **Start a paid run**: `dispatch_run` (gated — see below).
252+
253+
A confirm-gated write applies its change **only after you approve a dialog showing the exact before→after**,
254+
and **refuses — writing nothing — when no interactive operator is present** (so a prompt-injected session
255+
can't raise your cap or add a paid trigger; the model emits the call, only your keypress approves it). The
256+
`operate-pi-dispatch` skill tells the model how to use those gates: state the change plainly, and accept a
257+
decline. `CONST-BUDGET-BEFORE-TOKENS` and `CONST-TRIGGER-AUTHOR-GATE` are unchanged — the confirm is the human approval.
246258

247259
`dispatch_run` is the one model-callable tool that is **not money-safe**: unlike the others, it enqueues a
248260
**PAID** agent run that edits a folder in place with **no undo** — and unlike the confirm-gated writes, it
@@ -274,6 +286,32 @@ because that raw stream can contain issue and comment text (PII). Both files sta
274286
mounted into the job container, and are gitignored. A boot-time sweep prunes anything older than
275287
`PI_LOG_RETENTION_DAYS` (default 30; `0` keeps them forever).
276288

289+
## Flows: the custom prompt a trigger runs
290+
291+
A **flow** is the recipe the agent follows — a pi **skill** committed to the target repo/folder at
292+
`.pi/skills/<flow>/SKILL.md`. **That file *is* the custom prompt**: the frontmatter names the flow, the body is
293+
the standing instructions the agent runs. A trigger (or `pi-dispatch run --flow <name>`) only *names* which
294+
flow to run; the flow lives with the project, so different repos can define the same flow name their own way.
295+
296+
```markdown
297+
<!-- .pi/skills/tidy/SKILL.md -->
298+
---
299+
name: tidy
300+
description: Format, fix lint, and tighten types across the repo.
301+
ai-trigger: allow # opt-in required for GitHub/AI triggers; omit for CLI/cron-only flows (default deny)
302+
---
303+
304+
Run the formatter and linter and fix what they report; tighten obvious type holes.
305+
Keep the diff minimal and open a PR titled "tidy: <what changed>". Do not change behavior.
306+
```
307+
308+
Two things reach the agent: the **flow** (this SKILL.md — the standing instructions) and the **task** (the
309+
one-off ask for a single run). You set the task explicitly for a CLI/cron run (`--task "…"`, or the trigger's
310+
`task`); for a GitHub trigger the issue/comment/PR text *is* the task. Flows are read from your
311+
**default-branch** commit, read-only — so **commit and merge a flow before a trigger can use it**; a PR branch
312+
can neither add one nor alter it. `ai-trigger: allow` in the frontmatter is what lets a label/comment/PR — or
313+
an AI tool — run that flow at all (default **deny**).
314+
277315
## Triggers: cron, labels, comments, pull requests
278316

279317
Every standing trigger — cron schedules and GitHub triggers alike — lives in one unified
@@ -294,6 +332,21 @@ cron off), the receiver requires it.
294332
The `on × run` matrix is the trust boundary, enforced fail-loud at load: a `cron` trigger must run
295333
`local` (it has no webhook delivery, issue/PR number, or body), and every webhook trigger runs `github`.
296334

335+
### Add a trigger from the panel
336+
337+
You can edit `triggers.json` by hand, or add one from `/dispatch` without touching the file: press **`a`** and
338+
answer the **kind-first** prompts. The panel writes a validated entry and both services reload it live:
339+
340+
- **cron**`id` · `pattern` (5–6 field cron) · `folder` (absolute host path) · `flow` · `task`, then the
341+
optional `model` / `provider` / `maxTurns` (blank = the deployment default).
342+
- **label**`labels` (space-separated, any-of) · `flow`. The issue text is the task.
343+
- **comment** → trigger `phrase` (e.g. `@pi`) · `flow`. The comment/issue text is the task.
344+
- **pull_request**`action`s (`labeled opened synchronize reopened`) · `labels` (for `labeled`) · `flow`.
345+
346+
To change an existing trigger, `Enter` on it → **`e`** edits which flow it runs, **`x`** deletes it (with a
347+
confirm). An AI assistant can propose the same edits via `dispatch_trigger_add`/`_edit`/`_delete`, but each
348+
write waits on your confirmation.
349+
297350
### Scheduling recurring jobs
298351

299352
A cron trigger runs a local folder through a flow on a cron pattern — `pattern` is a 5- or 6-field cron
@@ -332,10 +385,19 @@ it at boot and live-reloads edits:
332385
```
333386

334387
`scope` is a repo `"owner/name"`, a local folder path, or `"*"` for all; `from > to` is an overnight window;
335-
`days`/`dateFrom`/`dateTo` gate the day the window starts. Manage windows by editing the file, in the panel
336-
(`/dispatch``w` → add / edit / delete), or through the confirm-gated
337-
`dispatch_pause_add`/`_edit`/`_delete` tools. Full field reference
338-
and more examples: **[`docs/pause-windows.md`](docs/pause-windows.md)**.
388+
`days`/`dateFrom`/`dateTo` gate the day the window starts.
389+
390+
**Manage windows from the panel:** in `/dispatch`, press **`w`** and choose *Add*, *Edit*, or *Delete*
391+
validated and live, no restart.
392+
393+
- **Add** prompts `scope → from → to → tz → days → dateFrom → dateTo`; leave an optional field blank to omit it
394+
(blank `tz` = UTC, blank `days` = every day).
395+
- **Edit** lets you pick a window and re-type only what changes — a blank answer keeps the current value.
396+
- **Delete** picks a window and confirms.
397+
398+
The **PAUSES** pane shows each window as ● paused (with a resume countdown) or ○ open. Editing the file
399+
directly and the confirm-gated `dispatch_pause_add`/`_edit`/`_delete` tools do the same thing. Full field
400+
reference and more examples: **[`docs/pause-windows.md`](docs/pause-windows.md)**.
339401

340402
## GitHub automation
341403

0 commit comments

Comments
 (0)