@loka1/pi-orchestra 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README.md +159 -81
- package/config/orchestra.json.example +4 -4
- package/extensions/lib/commands.ts +3 -0
- package/extensions/lib/config.ts +17 -0
- package/extensions/lib/format.ts +27 -1
- package/extensions/lib/state.ts +108 -5
- package/extensions/lib/types.ts +16 -1
- package/extensions/orchestra.ts +180 -43
- package/package.json +1 -1
- package/skills/orchestra/SKILL.md +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,10 +7,61 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.6.0] - 2026-12-02
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **`widget` mode: `auto` (default), `always`, `off`.** In `auto` the always-on
|
|
15
|
+
widget body is mounted only while a worker is starting, running, waiting on a
|
|
16
|
+
question or orphaned, and is unmounted as soon as the last one settles — the
|
|
17
|
+
one-line status bar stays. `off` removes the widget *and* the status line;
|
|
18
|
+
`always` keeps the old "mounted whenever there is a run" behaviour.
|
|
19
|
+
- **`/orchestra hide` and `/orchestra show [auto|always|off]`.** The choice is
|
|
20
|
+
stored per project (`state.json` → `ui.widget`) and wins over the config key, so
|
|
21
|
+
a new session in that directory stays quiet without editing any file.
|
|
22
|
+
- **`/orchestra reset` (alias `clean`).** Asks for confirmation, stops the
|
|
23
|
+
session's workers, copies `state.json` to `state.<ts>.bak.json` and clears runs,
|
|
24
|
+
tasks, dispatches and gates. Logs, prompts and mail stay on disk for `prune`.
|
|
25
|
+
The tool action `reset` now shares the same code path.
|
|
26
|
+
- **`staleRunHours` (default `12`).** A run whose workers are all terminal (an
|
|
27
|
+
`orphaned` process is not terminal) and whose last activity is older than the
|
|
28
|
+
window stops being the current run, so a fresh session starts with no run and
|
|
29
|
+
new work creates a new one instead of appending to yesterday's. `0` restores the
|
|
30
|
+
previous behaviour.
|
|
31
|
+
- `state.ui` in `state.json`: `widget` (the hide/show preference) and
|
|
32
|
+
`pinnedRunId` (set by `/orchestra use`, so reopening an old run on purpose does
|
|
33
|
+
not get hidden again).
|
|
34
|
+
- `/orchestra status` in a session with no current run points at the earlier runs
|
|
35
|
+
that are kept on disk.
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
|
|
39
|
+
- **The widget no longer shows another session's work.** `refreshUI` renders the
|
|
40
|
+
current run only: with no run (a new directory, or only stale/older runs) the
|
|
41
|
+
status line and the widget are both cleared instead of counting every dispatch
|
|
42
|
+
in the store. The widget's animation timer keeps its 500 ms dirty-check.
|
|
43
|
+
- `/orchestra use <run>` (and `o` in the browser) pins the run it switches to, and
|
|
44
|
+
creating a new run releases the pin.
|
|
45
|
+
- The staleness window also applies to `runOf()`, so `task_create` / `worker_start`
|
|
46
|
+
in a new session never attach to a finished run from days ago.
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
50
|
+
- A run that ended days ago no longer reappears on screen in a new session — the
|
|
51
|
+
cause was `activeRun()` always falling back to the newest run, plus terminal
|
|
52
|
+
`timeout` rows that the widget never collapsed, so it could not unmount.
|
|
53
|
+
- `state.ui` survives a reset: hiding the widget is a choice about the terminal,
|
|
54
|
+
not about the data. The `use` pin does not survive it.
|
|
55
|
+
|
|
10
56
|
## [0.5.0] - 2026-11-30
|
|
11
57
|
|
|
12
58
|
### Added
|
|
13
59
|
|
|
60
|
+
- **Published to npm.** `@loka1/pi-orchestra@0.5.0` is on the registry
|
|
61
|
+
(`pi install npm:@loka1/pi-orchestra`), with `repository`/`homepage`/`bugs`
|
|
62
|
+
metadata linking it back to this repo and the docs site. Tagged releases publish
|
|
63
|
+
themselves: the release workflow uses `NPM_TOKEN` with `--provenance` and falls
|
|
64
|
+
back to OIDC trusted publishing when no token is set.
|
|
14
65
|
- **Docs site.** `wiki/` is built into a GitHub Pages site
|
|
15
66
|
(<https://loka1.github.io/pi-orchestra/>) by `docs.yml` on every change:
|
|
16
67
|
`scripts/wiki-site.mjs` rewrites GitHub-wiki `[[Page]]` links to plain markdown
|
|
@@ -51,6 +102,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
51
102
|
|
|
52
103
|
### Fixed
|
|
53
104
|
|
|
105
|
+
- **A stopped worker no longer reports as settled.** `worker_stop` set the status
|
|
106
|
+
and the stop reason after killing the process, so the exit handler's finalize
|
|
107
|
+
ran first and the wake-up said "settled" for a deliberate stop. The reason is
|
|
108
|
+
now recorded before the abort, and the report and glyph treat a `stopReason:
|
|
109
|
+
"user"` dispatch as `stopped` even if the race is lost.
|
|
54
110
|
- **Page, home/end and top/bottom keys now work in the browser.** Page keys were
|
|
55
111
|
forwarded to `SelectList` and only matched the default binding, `home`/`end`
|
|
56
112
|
were documented but never implemented, and terminals sending modifier variants
|
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# pi-orchestra
|
|
2
2
|
|
|
3
3
|
[](https://github.com/loka1?tab=repositories&q=pi-&type=source)
|
|
4
|
-
[](https://www.npmjs.com/package/@loka1/pi-orchestra)
|
|
5
|
+
[](https://www.npmjs.com/package/@loka1/pi-orchestra)
|
|
5
6
|
[](https://github.com/loka1/pi-orchestra/releases)
|
|
6
7
|
[](https://loka1.github.io/pi-orchestra/)
|
|
7
8
|
|
|
@@ -11,7 +12,7 @@ A [pi](https://github.com/earendil-works/pi-mono) extension that **lets one pi s
|
|
|
11
12
|
|
|
12
13
|
<img src="assets/preview.png" alt="pi-orchestra: the worker widget above the editor and the /orchestra browse list" width="100%">
|
|
13
14
|
|
|
14
|
-
*The always-on widget stays small; `/orchestra browse` is where you search,
|
|
15
|
+
*The always-on widget stays small; `/orchestra browse` is where you search, read a transcript, join a worker or stop one.*
|
|
15
16
|
|
|
16
17
|
```
|
|
17
18
|
you (coordinator) worker (pi --mode rpc)
|
|
@@ -31,31 +32,34 @@ you (coordinator) worker (pi --mode rpc)
|
|
|
31
32
|
- **Questions and gates.** A worker calls `orchestra_ask`; the coordinator answers with `orchestra_answer`. The question shows up as a message, and a gate is recorded in state.
|
|
32
33
|
- **Steering and follow-ups.** `orchestra_send` steers a running worker mid-task, hands a settled one new work, or broadcasts one decision to every live worker at once.
|
|
33
34
|
- **Resume and repair.** `worker_resume` reopens a worker's own session (no context lost); `worker_start retryOf=<id>` starts a fresh worker with the failed attempt and its evidence in the brief.
|
|
35
|
+
- **Runs in the background.** Ending the turn is the normal move: workers keep going for hours (`timeoutMode: "idle"` restarts their clock on every event) and you are woken with the report.
|
|
34
36
|
- **Budgets and a stall watchdog.** Cost and wall-clock ceilings per worker and per run, plus detection of a worker that stopped emitting events — distinct from the hard timeout that kills a long task.
|
|
35
|
-
- **
|
|
37
|
+
- **Searchable, measurable.** `action=search` (and `/orchestra grep`) greps every worker log, `action=metrics` shows cost and turns per worker with a spend timeline, and `action=export` / `action=report` write JSONL or a markdown run report.
|
|
36
38
|
- **Joinable.** `/orchestra join <id>` (or `j` in the browser) opens one worker's conversation full-screen: what you asked, what it replied, thinking and tool calls, with a composer that steers a live worker or hands a settled one follow-up work. `esc` returns to the browser, `ctrl+g` to your own session.
|
|
37
39
|
- **Reviewable.** Every dispatch records the git commit it started from, so `D` in the browser (or `action=diff`) shows exactly what that worker changed, and `action=report` writes a markdown run report for a PR.
|
|
38
40
|
- **Self-correcting.** Dependency cycles are refused instead of deadlocking a run, `retries` re-dispatches a failed worker with the failure in the brief, and a coordinator restart tells orphaned processes (still alive) apart from lost ones — and can stop them.
|
|
39
|
-
- **Live status.** A compact, width-aware widget ordered by what needs you (questions → running → failed/timeout → ready → settled), plus `/orchestra browse`: a scrollable, searchable list of tasks, workers and runs with detail, message, stop and follow actions.
|
|
41
|
+
- **Live status.** A compact, width-aware widget ordered by what needs you (questions → running → failed/timeout → ready → settled), mounted only while work is live, plus `/orchestra browse`: a scrollable, searchable list of tasks, workers and runs with detail, message, stop and follow actions.
|
|
40
42
|
- **Durable, local, private.** One JSON state file, one JSONL log per worker, all under `.pi/orchestra/` (git-ignored by the extension itself). Nothing leaves the machine except the model calls you already make.
|
|
41
43
|
- **Isolated by default.** Workers start with `--no-extensions` plus this extension only: no MCP servers, no interactive permission gates, no recursion into more workers.
|
|
42
44
|
|
|
43
45
|
## Install
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
[the registry](https://www.npmjs.com/package/@loka1/pi-orchestra)):
|
|
47
|
+
From npm (or from git, which tracks `main` before a version is released):
|
|
47
48
|
|
|
48
49
|
```bash
|
|
49
|
-
pi install git:github.com/loka1/pi-orchestra
|
|
50
|
-
# or, once the version is on npm
|
|
51
50
|
pi install npm:@loka1/pi-orchestra
|
|
51
|
+
# or
|
|
52
|
+
pi install git:github.com/loka1/pi-orchestra
|
|
52
53
|
```
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
The npm package carries the `repository`, `homepage` and `bugs` links, so its page
|
|
56
|
+
points back here and at the [docs site](https://loka1.github.io/pi-orchestra/).
|
|
57
|
+
|
|
58
|
+
Every release attaches the same tarball, if you would rather pin a file:
|
|
55
59
|
|
|
56
60
|
```bash
|
|
57
|
-
gh release download
|
|
58
|
-
pi install ./loka1-pi-orchestra
|
|
61
|
+
gh release download --pattern '*.tgz' # newest release
|
|
62
|
+
pi install ./loka1-pi-orchestra-*.tgz
|
|
59
63
|
```
|
|
60
64
|
|
|
61
65
|
Try it without installing:
|
|
@@ -75,7 +79,7 @@ Give pi one instruction:
|
|
|
75
79
|
```
|
|
76
80
|
Create the run goal "add input validation", then three tasks: audit the API handlers,
|
|
77
81
|
write the validators, and update the tests (depending on the audit). Start a worker for
|
|
78
|
-
each ready task,
|
|
82
|
+
each ready task, then report per task as they settle, with the evidence.
|
|
79
83
|
```
|
|
80
84
|
|
|
81
85
|
Or drive it tool by tool:
|
|
@@ -86,7 +90,7 @@ orchestra action=task_create title="Audit handlers"
|
|
|
86
90
|
orchestra action=task_create title="Write validators" deps=["<audit task id>"]
|
|
87
91
|
orchestra action=worker_start taskId="<audit task id>"
|
|
88
92
|
orchestra action=worker_start spec="Review src/api for missing validation and report a list."
|
|
89
|
-
|
|
93
|
+
# end the turn here — each worker wakes you with its report when it settles
|
|
90
94
|
cat .pi/orchestra/logs/<dispatch id>.jsonl # or: /orchestra watch <id>
|
|
91
95
|
```
|
|
92
96
|
|
|
@@ -108,37 +112,58 @@ cat .pi/orchestra/logs/<dispatch id>.jsonl # or: /orchestra watch <id>
|
|
|
108
112
|
Tab completes after `/orchestra`: the subcommand first, then the live argument
|
|
109
113
|
(dispatch, task, run or template ids, matched on id, status and title).
|
|
110
114
|
|
|
115
|
+
**Look at the run**
|
|
116
|
+
|
|
111
117
|
```text
|
|
112
|
-
/orchestra
|
|
118
|
+
/orchestra the browser in TUI mode, the run summary elsewhere
|
|
113
119
|
/orchestra browse [query] browser pre-filtered with `query`
|
|
114
|
-
/orchestra
|
|
115
|
-
/orchestra
|
|
116
|
-
/orchestra
|
|
117
|
-
/orchestra
|
|
118
|
-
/orchestra
|
|
119
|
-
/orchestra
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
/orchestra open <id> detail of
|
|
126
|
-
/orchestra
|
|
127
|
-
/orchestra
|
|
128
|
-
/orchestra
|
|
129
|
-
/orchestra status summary of the active run (tasks + workers + usage)
|
|
130
|
-
/orchestra tasks task list with readiness and dispatch ids
|
|
131
|
-
/orchestra workers worker table: status, turns, tools, cost
|
|
132
|
-
/orchestra read <id> compact transcript of a worker (tool calls + replies)
|
|
120
|
+
/orchestra status summary, task table and worker table of the active run
|
|
121
|
+
/orchestra runs runs, newest first (→ marks the active one)
|
|
122
|
+
/orchestra use <id> make a run the active one
|
|
123
|
+
/orchestra tasks tasks with readiness and dispatch ids
|
|
124
|
+
/orchestra workers workers with status, turns, tools and cost
|
|
125
|
+
/orchestra questions pending questions and gates
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Work with one worker**
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
/orchestra open <id> detail of a task, worker or run, with transcript tail
|
|
132
|
+
/orchestra read <id> compact transcript (tool calls and replies)
|
|
133
|
+
/orchestra join <id> joined chat: read it and type into it
|
|
134
|
+
/orchestra chat <id> the same conversation as plain text
|
|
133
135
|
/orchestra watch <id> live transcript in the widget (tail)
|
|
134
136
|
/orchestra unwatch stop watching
|
|
135
137
|
/orchestra stop <id> abort and stop a worker
|
|
136
|
-
/orchestra
|
|
137
|
-
/orchestra
|
|
138
|
-
/orchestra
|
|
139
|
-
/orchestra
|
|
138
|
+
/orchestra retry <id> [note] repair a failure: same spec, failure prepended
|
|
139
|
+
/orchestra resume <id> [msg] reopen the worker's own session
|
|
140
|
+
/orchestra diff <id> what it changed since it started (git diff)
|
|
141
|
+
/orchestra broadcast <msg> one message to every live worker
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Cost, search and reports**
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
/orchestra metrics cost and turns per worker, spend timeline, delta vs the last run
|
|
148
|
+
/orchestra report markdown run report → .pi/orchestra/exports/<run>.md
|
|
149
|
+
/orchestra export [json] the run's cost/turn timeline → .pi/orchestra/exports/
|
|
150
|
+
/orchestra budget [usd] show spend, or raise the run's cost ceiling
|
|
151
|
+
/orchestra grep <text> search every worker transcript
|
|
152
|
+
/orchestra find <query> filter tasks, workers and runs
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Setup and upkeep**
|
|
156
|
+
|
|
157
|
+
```text
|
|
158
|
+
/orchestra templates list run templates
|
|
159
|
+
/orchestra template <name> create a run from a template
|
|
140
160
|
/orchestra config state dir, config sources, effective config
|
|
141
|
-
/orchestra
|
|
161
|
+
/orchestra hide hide the widget and status line in this project
|
|
162
|
+
/orchestra show [mode] bring them back (`auto`, `always`, `off`)
|
|
163
|
+
/orchestra reset archive this project's state and start clean
|
|
164
|
+
/orchestra archive [keep] move finished runs to .pi/orchestra/archive/
|
|
165
|
+
/orchestra prune [days] delete archived runs and orphaned files older than N days
|
|
166
|
+
/orchestra back leave a joined chat (inside it: /back, /exit)
|
|
142
167
|
```
|
|
143
168
|
|
|
144
169
|
→ [Commands](https://loka1.github.io/pi-orchestra/Commands.html): complete command and action reference.
|
|
@@ -147,13 +172,23 @@ Tab completes after `/orchestra`: the subcommand first, then the live argument
|
|
|
147
172
|
|
|
148
173
|
| Tool | Purpose |
|
|
149
174
|
|---|---|
|
|
150
|
-
| `orchestra` | Control plane:
|
|
151
|
-
| `orchestra_wait` | Block until
|
|
152
|
-
| `orchestra_send` | Steer a running worker,
|
|
153
|
-
| `orchestra_answer` | Answer a blocking question
|
|
154
|
-
| `orchestra_ask` | *Worker side only.* Ask the coordinator
|
|
175
|
+
| `orchestra` | Control plane: one `action` per call (listed below). |
|
|
176
|
+
| `orchestra_wait` | Block until a dispatch (or every live worker) settles, a question arrives, or the timeout fires. |
|
|
177
|
+
| `orchestra_send` | Steer a running worker, give a settled one follow-up work, or `dispatch="*"` to message every live worker. |
|
|
178
|
+
| `orchestra_answer` | Answer a blocking question; the worker resumes as soon as it is written. |
|
|
179
|
+
| `orchestra_ask` | *Worker side only.* Ask the coordinator and block until it answers. |
|
|
155
180
|
|
|
156
|
-
|
|
181
|
+
`orchestra` actions, by area:
|
|
182
|
+
|
|
183
|
+
```text
|
|
184
|
+
runs run_create, run_list, run_use
|
|
185
|
+
tasks task_create, task_list, task_update
|
|
186
|
+
workers worker_start, worker_resume, worker_list, worker_show, worker_read,
|
|
187
|
+
worker_stop, worker_keep_open, worker_send
|
|
188
|
+
flow wait, answer, gate_list
|
|
189
|
+
inspect status, search, chat, diff, metrics, report, export
|
|
190
|
+
upkeep budget, prune, archive, templates, reset
|
|
191
|
+
```
|
|
157
192
|
|
|
158
193
|
## Browsing
|
|
159
194
|
|
|
@@ -161,26 +196,33 @@ A widget cannot take keyboard focus, so the interactive surface is `/orchestra`
|
|
|
161
196
|
(or `/orchestra browse`), which opens a full-screen list in TUI mode. Print and
|
|
162
197
|
RPC modes get the same content as text.
|
|
163
198
|
|
|
199
|
+
**Navigation**
|
|
200
|
+
|
|
164
201
|
| Key | Action |
|
|
165
202
|
| --- | --- |
|
|
166
|
-
| `↑` `↓` | move |
|
|
167
|
-
| `PgUp` `PgDn
|
|
168
|
-
|
|
|
169
|
-
| `space` | mark the row (▣) for bulk actions |
|
|
170
|
-
| `D` | diff of what that worker changed since it started |
|
|
171
|
-
| `s` / `t` | sort by cost / by time (default: urgency) |
|
|
172
|
-
| `esc` | clear the search, then close |
|
|
203
|
+
| `↑` `↓` | move one row |
|
|
204
|
+
| `PgUp` `PgDn` / `ctrl+d` `ctrl+u` | page / half page |
|
|
205
|
+
| `home` `end` / `g` `G` | first and last row |
|
|
173
206
|
| `tab` | switch scope: tasks → workers → runs |
|
|
174
|
-
|
|
|
175
|
-
| `
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
207
|
+
| `/`, then type | search over title, id, agent, meta and status (field terms below) |
|
|
208
|
+
| `enter` | detail: metadata, report and transcript tail |
|
|
209
|
+
| `esc` | clear the search, then close |
|
|
210
|
+
| `q` | close |
|
|
211
|
+
|
|
212
|
+
**Actions**
|
|
213
|
+
|
|
214
|
+
| Key | Action |
|
|
215
|
+
| --- | --- |
|
|
216
|
+
| `space` | mark the row (▣); `x`, `r` and `c` then apply to every mark |
|
|
217
|
+
| `x` / `r` | stop / retry the highlighted worker, or every marked one |
|
|
218
|
+
| `m` | message the worker (opens the editor) |
|
|
178
219
|
| `c` | put the marked (or current) dispatch ids in the editor |
|
|
179
|
-
| `j` | join the worker's chat
|
|
180
|
-
| `d` | full transcript
|
|
220
|
+
| `j` | join the worker's chat |
|
|
221
|
+
| `d` | full transcript, tail-following |
|
|
222
|
+
| `D` | diff of what the worker changed since it started |
|
|
181
223
|
| `f` | follow the worker in the widget |
|
|
182
|
-
| `o` | make the highlighted run active |
|
|
183
|
-
| `
|
|
224
|
+
| `o` | make the highlighted run the active one |
|
|
225
|
+
| `s` / `t` | sort by cost / by time (default: urgency) |
|
|
184
226
|
|
|
185
227
|
Search understands fields, not just words: `status:failed`, `agent:reviewer`,
|
|
186
228
|
`kind:worker`, `run:ab12`, `cost:>0.1`, `turns:>=8`, combined with free text
|
|
@@ -188,16 +230,35 @@ Search understands fields, not just words: `status:failed`, `agent:reviewer`,
|
|
|
188
230
|
`filter` and in the non-TUI `/orchestra find`.
|
|
189
231
|
|
|
190
232
|
The detail pane scrolls, and its transcript tails live: opening a log pager
|
|
191
|
-
starts at the end and keeps following (`f` toggles
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
233
|
+
starts at the end and keeps following (`f` toggles inside the pager, scrolling
|
|
234
|
+
pins it).
|
|
235
|
+
|
|
236
|
+
Rows are sorted by urgency by default, so a worker waiting on a question is
|
|
237
|
+
always the first thing on screen; `s` and `t` re-sort by spend and recency.
|
|
238
|
+
Status comes from the dispatch whenever one exists: a task whose worker settled
|
|
239
|
+
never shows a failure glyph, and a timeout keeps its `⏱ n m` marker.
|
|
196
240
|
|
|
197
241
|
The always-on widget is deliberately small: it renders the top
|
|
198
242
|
`widgetMaxLines` rows plus `+N more · /orchestra browse`, and collapses settled
|
|
199
243
|
tasks into a counter unless `widgetShowSettled` is on.
|
|
200
244
|
|
|
245
|
+
### Keeping the widget quiet
|
|
246
|
+
|
|
247
|
+
The widget body only costs viewport space while it earns it. With the default
|
|
248
|
+
`widget: "auto"`, it mounts while workers are starting, running, waiting on a
|
|
249
|
+
question or orphaned, and disappears once the last one settles — the one-line
|
|
250
|
+
status bar stays, so `3 done · 1 question` is still visible. `/orchestra hide`
|
|
251
|
+
turns both off for this project (persisted in `state.json`, so a new session in
|
|
252
|
+
the same directory stays quiet); `/orchestra show` brings them back, and
|
|
253
|
+
`/orchestra show always` pins the widget on even when nothing is running.
|
|
254
|
+
|
|
255
|
+
`.pi/orchestra/state.json` is per directory and outlives sessions on purpose, so
|
|
256
|
+
a finished run does not vanish from `/orchestra runs`. It does stop being
|
|
257
|
+
*current*: once nothing in it has moved for `staleRunHours` (12 by default) the
|
|
258
|
+
next session starts with no run and no widget instead of yesterday's screen.
|
|
259
|
+
Nothing is deleted — `/orchestra use <run>` reopens it and pins it, and
|
|
260
|
+
`/orchestra reset` archives the whole store and starts from zero.
|
|
261
|
+
|
|
201
262
|
→ [Browsing](https://loka1.github.io/pi-orchestra/Browsing.html): keys, detail view, bulk actions.
|
|
202
263
|
|
|
203
264
|
## Joining a worker
|
|
@@ -208,7 +269,7 @@ that worker's conversation:
|
|
|
208
269
|
```text
|
|
209
270
|
⤷ joined 9c4e7a10bd · worker · running
|
|
210
271
|
● running 3m · 4 turns · 12 tools · $0.07 of $2.00
|
|
211
|
-
|
|
272
|
+
anthropic/claude-sonnet-4-5 · live
|
|
212
273
|
|
|
213
274
|
▶ you
|
|
214
275
|
Port the JSONL backend, keep the header format.
|
|
@@ -350,7 +411,7 @@ nothing the worker learned is lost.
|
|
|
350
411
|
|
|
351
412
|
→ [Configuration](https://loka1.github.io/pi-orchestra/Configuration.html): every setting and default.
|
|
352
413
|
|
|
353
|
-
##
|
|
414
|
+
## Dependencies, retention and cleanup
|
|
354
415
|
|
|
355
416
|
`task_create deps=` and `task_update deps=` refuse a dependency loop and print
|
|
356
417
|
the path (`A -> C -> B -> A`), so a typo cannot silently deadlock a run; a cycle
|
|
@@ -361,7 +422,7 @@ than the window — live state is never touched.
|
|
|
361
422
|
|
|
362
423
|
→ [Configuration](https://loka1.github.io/pi-orchestra/Configuration.html): every setting and default.
|
|
363
424
|
|
|
364
|
-
##
|
|
425
|
+
## Broadcasting, search and redaction
|
|
365
426
|
|
|
366
427
|
`orchestra_send dispatch="*"` (or `/orchestra broadcast <msg>`) delivers one
|
|
367
428
|
message to every live worker and reports per-worker success — the cheap way to
|
|
@@ -439,11 +500,14 @@ Merged from JSON files (project wins over global):
|
|
|
439
500
|
"defaultAgent": "worker",
|
|
440
501
|
"inheritModel": true,
|
|
441
502
|
"timeoutMs": 900000,
|
|
442
|
-
"
|
|
503
|
+
"timeoutMode": "total",
|
|
504
|
+
"keepOpen": false,
|
|
443
505
|
"notifyOnSettle": true,
|
|
444
506
|
"workerIsolation": true,
|
|
445
507
|
"widgetMaxLines": 8,
|
|
446
508
|
"widgetShowSettled": false,
|
|
509
|
+
"widget": "auto",
|
|
510
|
+
"staleRunHours": 12,
|
|
447
511
|
"providerExtensions": [],
|
|
448
512
|
"sessionMode": "no-session",
|
|
449
513
|
"budgetUsdPerWorker": 0,
|
|
@@ -456,7 +520,7 @@ Merged from JSON files (project wins over global):
|
|
|
456
520
|
"retries": 0,
|
|
457
521
|
"retryBackoffMs": 2000,
|
|
458
522
|
"agents": {
|
|
459
|
-
"reviewer": { "model": "
|
|
523
|
+
"reviewer": { "model": "claude-sonnet-4-5", "thinking": "high", "tools": ["read", "grep", "ls"] }
|
|
460
524
|
}
|
|
461
525
|
}
|
|
462
526
|
```
|
|
@@ -469,7 +533,7 @@ Merged from JSON files (project wins over global):
|
|
|
469
533
|
| `providerExtensions` | `[]` | Extra extension files (or `npm:`/`git:` specs) an isolated worker should load, typically a provider package. Usually discovered automatically. |
|
|
470
534
|
| `timeoutMs` | `900000` | Hard limit per worker; it is stopped (and marked `timeout`) after this. `0` disables it; overridable per dispatch with `worker_start timeoutMs=`. |
|
|
471
535
|
| `timeoutMode` | `"total"` | How `timeoutMs` is measured. `"idle"` restarts the clock on every worker event, so only silence that long stops it — use it for multi-hour jobs. |
|
|
472
|
-
| `keepOpen` | `
|
|
536
|
+
| `keepOpen` | `false` | Keep a settled worker's process alive so `orchestra_send` can hand it follow-up work. `false` reaps it on settle; the error then points at `worker_resume` (needs `sessionMode: "session"`) or a fresh dispatch. |
|
|
473
537
|
| `notifyOnSettle` | `true` | Wake the coordinator when a worker settles or asks a question. |
|
|
474
538
|
| `workerIsolation` | `true` | Start workers with `--no-extensions -e <this extension>` (no MCP, no interactive gates). |
|
|
475
539
|
| `sessionMode` | `"no-session"` | `"session"` keeps worker sessions on disk so `worker_resume` can reopen one. |
|
|
@@ -486,14 +550,16 @@ Merged from JSON files (project wins over global):
|
|
|
486
550
|
| `stateDir` | `.pi/orchestra` | Where state, logs and prompts live. |
|
|
487
551
|
| `widgetMaxLines` | `8` | Rows in the always-on widget before `+N more` (hint row excluded). |
|
|
488
552
|
| `widgetShowSettled` | `false` | Show settled rows instead of collapsing them into a counter. |
|
|
553
|
+
| `widget` | `"auto"` | `auto` mounts the widget only while work is live, `always` keeps it whenever there is a run, `off` removes widget and status line. `/orchestra hide|show` overrides it per project. |
|
|
554
|
+
| `staleRunHours` | `12` | A finished run older than this stops being the current run in a new session (0 = never). It stays in `/orchestra runs`. |
|
|
489
555
|
| `agents` | `{}` | Per-agent overrides of model/thinking/tools. |
|
|
490
556
|
|
|
491
557
|
### Which model does a worker run?
|
|
492
558
|
|
|
493
|
-
A worker gets an explicit `{provider, id}` pair, never a bare slash id: pi
|
|
494
|
-
`provider/id`
|
|
495
|
-
|
|
496
|
-
model.
|
|
559
|
+
A worker gets an explicit `{provider, id}` pair, never a bare slash id: pi splits
|
|
560
|
+
`provider/id` out of `--model`, so a model whose real id is `acme/fast-1` has to be
|
|
561
|
+
passed as `--provider acme --model acme/fast-1`, otherwise pi looks for `fast-1` on
|
|
562
|
+
the `acme` provider and quietly lands on a different model.
|
|
497
563
|
|
|
498
564
|
1. `provider`/`model` given to `worker_start`, else
|
|
499
565
|
2. the agent's frontmatter (`provider:`, `model:`) or its `agents.<name>` override, else
|
|
@@ -516,15 +582,14 @@ warning instead of silently running something else. `worker_start`, `worker_show
|
|
|
516
582
|
|
|
517
583
|
## Agents
|
|
518
584
|
|
|
519
|
-
Workers use the same agent definitions as pi's bundled subagent example — markdown with YAML frontmatter:
|
|
585
|
+
Workers use the same agent definitions as pi's bundled subagent example — markdown with YAML frontmatter. `name` and `description` are required; `tools`, `model`, `provider` and `thinking` are optional and fall back to the config and the coordinator:
|
|
520
586
|
|
|
521
587
|
```markdown
|
|
522
588
|
---
|
|
523
589
|
name: reviewer
|
|
524
590
|
description: Read-only code review
|
|
525
591
|
tools: read, grep, find, ls, bash
|
|
526
|
-
model:
|
|
527
|
-
provider: commandcode
|
|
592
|
+
model: claude-sonnet-4-5 # or provider/model, see below
|
|
528
593
|
thinking: high
|
|
529
594
|
---
|
|
530
595
|
You review code and report findings ordered by severity. You do not edit files.
|
|
@@ -537,12 +602,13 @@ Locations: `~/.pi/agent/agents/*.md` (user) and `.pi/agents/*.md` (project, over
|
|
|
537
602
|
## How it works
|
|
538
603
|
|
|
539
604
|
1. `worker_start` creates a dispatch in `.pi/orchestra/state.json`, writes the agent prompt to `.pi/orchestra/prompts/<id>.md`, and spawns
|
|
540
|
-
`pi --mode rpc --no-session --no-extensions -e orchestra.ts [--model …] [--thinking …] [--tools …]
|
|
605
|
+
`pi --mode rpc --no-session --no-extensions -e orchestra.ts [--model …] [--thinking …] [--tools …]`
|
|
606
|
+
(`--session-id` instead of `--no-session` when `sessionMode: "session"`).
|
|
541
607
|
2. The worker gets a preamble with its task and the `orchestra_ask` tool. It works autonomously.
|
|
542
608
|
3. Its stdout events are appended to `.pi/orchestra/logs/<id>.jsonl`; the coordinator tracks turns, tool calls, tokens and cost from them.
|
|
543
609
|
4. On `agent_settled` the coordinator records the final text, closes the task, refreshes dependents and wakes you with a report.
|
|
544
610
|
5. Questions travel as files under `.pi/orchestra/mail/<dispatch>/`: the worker blocks on `orchestra_ask`, the coordinator polls once a second, surfaces the question, and `orchestra_answer` writes the answer file that unblocks it.
|
|
545
|
-
6. On session shutdown
|
|
611
|
+
6. On session shutdown the workers this session started are aborted and stopped (SIGTERM, then SIGKILL after five seconds). A process that survives a crash is rebuilt on load as `orphaned` (live pid, still stoppable and resumable) or `lost` (pid gone) — a dispatch is authoritative for what actually happened.
|
|
546
612
|
|
|
547
613
|
No ports, no daemon, no external state store. The only requirement is a working `pi` on `PATH` (or `workerCommand`).
|
|
548
614
|
|
|
@@ -559,8 +625,20 @@ No ports, no daemon, no external state store. The only requirement is a working
|
|
|
559
625
|
|
|
560
626
|
## Documentation
|
|
561
627
|
|
|
562
|
-
|
|
563
|
-
|
|
628
|
+
The pages live in `wiki/` and are published to two places on every change:
|
|
629
|
+
|
|
630
|
+
- **Docs site** — <https://loka1.github.io/pi-orchestra/> (GitHub Pages, built by the `Docs site` workflow from `scripts/wiki-site.mjs`)
|
|
631
|
+
- **GitHub wiki** — <https://github.com/loka1/pi-orchestra/wiki> (mirrored there by the `Sync wiki` workflow)
|
|
632
|
+
|
|
633
|
+
| Page | What it covers |
|
|
634
|
+
| --- | --- |
|
|
635
|
+
| [Installation](https://loka1.github.io/pi-orchestra/Installation.html) | install, upgrade, requirements |
|
|
636
|
+
| [Configuration](https://loka1.github.io/pi-orchestra/Configuration.html) | every setting, defaults, agents, long jobs |
|
|
637
|
+
| [Commands](https://loka1.github.io/pi-orchestra/Commands.html) | `/orchestra`, the tools, actions and filters |
|
|
638
|
+
| [Browsing](https://loka1.github.io/pi-orchestra/Browsing.html) | the list, detail view, joining a worker |
|
|
639
|
+
| [Workers](https://loka1.github.io/pi-orchestra/Workers.html) | processes, lifecycle, background work, isolation |
|
|
640
|
+
|
|
641
|
+
`README.md` stays the overview; the wiki pages are the reference.
|
|
564
642
|
|
|
565
643
|
## Limitations
|
|
566
644
|
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
"notifyOnSettle": true,
|
|
9
9
|
"widgetMaxLines": 8,
|
|
10
10
|
"widgetShowSettled": false,
|
|
11
|
+
"widget": "auto",
|
|
12
|
+
"staleRunHours": 12,
|
|
11
13
|
"providerExtensions": [],
|
|
12
14
|
"sessionMode": "session",
|
|
13
15
|
"budgetUsdPerWorker": 2,
|
|
@@ -21,14 +23,12 @@
|
|
|
21
23
|
"retryBackoffMs": 5000,
|
|
22
24
|
"agents": {
|
|
23
25
|
"reviewer": {
|
|
24
|
-
"
|
|
25
|
-
"model": "deepseek/deepseek-v4.1-flash",
|
|
26
|
+
"model": "claude-sonnet-4-5",
|
|
26
27
|
"thinking": "high",
|
|
27
28
|
"tools": ["read", "grep", "find", "ls", "bash"]
|
|
28
29
|
},
|
|
29
30
|
"scout": {
|
|
30
|
-
"
|
|
31
|
-
"model": "deepseek/deepseek-v4.1-flash",
|
|
31
|
+
"model": "claude-haiku-4-5",
|
|
32
32
|
"tools": ["read", "grep", "find", "ls"]
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -28,6 +28,8 @@ export const ORCHESTRA_COMMANDS: OrchestraCommand[] = [
|
|
|
28
28
|
{ name: "read", description: "Worker transcript (tail)", takes: "dispatch" },
|
|
29
29
|
{ name: "watch", description: "Pin a worker's transcript into the widget", takes: "dispatch" },
|
|
30
30
|
{ name: "unwatch", description: "Unpin the transcript", takes: "none" },
|
|
31
|
+
{ name: "hide", description: "Hide the widget and status line in this project", takes: "none" },
|
|
32
|
+
{ name: "show", description: "Bring the widget back (or force it with always/off)", takes: "free" },
|
|
31
33
|
{ name: "stop", description: "Stop a worker", takes: "dispatch" },
|
|
32
34
|
{ name: "retry", description: "Repair dispatch seeded with the failure", takes: "dispatch" },
|
|
33
35
|
{ name: "resume", description: "Continue a worker in its own session", takes: "dispatch" },
|
|
@@ -44,6 +46,7 @@ export const ORCHESTRA_COMMANDS: OrchestraCommand[] = [
|
|
|
44
46
|
{ name: "export", description: "Export the run as JSONL or JSON", takes: "free" },
|
|
45
47
|
{ name: "budget", description: "Lift a pause and set the run budget", takes: "free" },
|
|
46
48
|
{ name: "prune", description: "Delete old runs, logs and archives", takes: "free" },
|
|
49
|
+
{ name: "reset", description: "Archive and clear this project's runs, tasks and workers", takes: "none" },
|
|
47
50
|
{ name: "archive", description: "Archive finished runs", takes: "free" },
|
|
48
51
|
{ name: "questions", description: "Pending gates", takes: "none" },
|
|
49
52
|
{ name: "config", description: "Show the resolved configuration", takes: "none" },
|
package/extensions/lib/config.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { existsSync, readFileSync } from "node:fs";
|
|
11
11
|
import { homedir } from "node:os";
|
|
12
12
|
import { join, resolve } from "node:path";
|
|
13
|
+
import type { WidgetMode } from "./types.ts";
|
|
13
14
|
|
|
14
15
|
export type SessionMode = "no-session" | "session";
|
|
15
16
|
|
|
@@ -75,6 +76,18 @@ export interface OrchestraConfig {
|
|
|
75
76
|
widgetMaxLines: number;
|
|
76
77
|
/** Show settled/done rows in the widget instead of collapsing them into a counter. */
|
|
77
78
|
widgetShowSettled: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* How much of the UI is mounted: `auto` (default) shows the widget only while
|
|
81
|
+
* work is live, `always` keeps it whenever there is a run, `off` removes both the
|
|
82
|
+
* widget and the status line. `/orchestra hide|show` overrides this per project.
|
|
83
|
+
*/
|
|
84
|
+
widget: WidgetMode;
|
|
85
|
+
/**
|
|
86
|
+
* A run whose work is finished stops being the current run once nothing in it has
|
|
87
|
+
* moved for this many hours (0 = never). The run itself is kept — `/orchestra runs`
|
|
88
|
+
* and `/orchestra use <run>` still reach it.
|
|
89
|
+
*/
|
|
90
|
+
staleRunHours: number;
|
|
78
91
|
/**
|
|
79
92
|
* Extra extension files (or `npm:`/`git:` package specs) an isolated worker
|
|
80
93
|
* should load — typically a provider package. Discovered automatically when
|
|
@@ -106,6 +119,8 @@ export const DEFAULT_CONFIG: OrchestraConfig = {
|
|
|
106
119
|
retryBackoffMs: 2000,
|
|
107
120
|
widgetMaxLines: 8,
|
|
108
121
|
widgetShowSettled: false,
|
|
122
|
+
widget: "auto",
|
|
123
|
+
staleRunHours: 12,
|
|
109
124
|
providerExtensions: [],
|
|
110
125
|
agents: {},
|
|
111
126
|
};
|
|
@@ -166,6 +181,8 @@ function coerce(base: OrchestraConfig, patch: Record<string, unknown>): Orchestr
|
|
|
166
181
|
next.widgetMaxLines = Math.floor(patch.widgetMaxLines);
|
|
167
182
|
}
|
|
168
183
|
if (typeof patch.widgetShowSettled === "boolean") next.widgetShowSettled = patch.widgetShowSettled;
|
|
184
|
+
if (patch.widget === "auto" || patch.widget === "always" || patch.widget === "off") next.widget = patch.widget;
|
|
185
|
+
if (typeof patch.staleRunHours === "number" && patch.staleRunHours >= 0) next.staleRunHours = patch.staleRunHours;
|
|
169
186
|
if (Array.isArray(patch.providerExtensions)) {
|
|
170
187
|
next.providerExtensions = patch.providerExtensions.filter((entry): entry is string => typeof entry === "string");
|
|
171
188
|
}
|
package/extensions/lib/format.ts
CHANGED
|
@@ -134,6 +134,9 @@ export function statusLabel(status: string, since?: string): string {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
export function dispatchGlyph(dispatch: Dispatch): string {
|
|
137
|
+
// A deliberate stop stays "stopped" even when the exit handler set "settled"
|
|
138
|
+
// first, so the glyph and the report never disagree.
|
|
139
|
+
if (dispatch.stopReason === "user" && dispatch.status === "settled") return statusGlyph("stopped");
|
|
137
140
|
return statusGlyph(dispatch.status);
|
|
138
141
|
}
|
|
139
142
|
|
|
@@ -183,6 +186,26 @@ export interface WidgetOptions {
|
|
|
183
186
|
now?: number;
|
|
184
187
|
}
|
|
185
188
|
|
|
189
|
+
/**
|
|
190
|
+
* True while something is actually *running* in this run: a worker starting, running
|
|
191
|
+
* or waiting on an answer, an orphaned process still alive, or a task that is running
|
|
192
|
+
* or blocked. Ready/pending tasks alone do not count — they wait for the coordinator,
|
|
193
|
+
* and the status line already says how many there are.
|
|
194
|
+
*
|
|
195
|
+
* The widget's `auto` mode mounts only when this is true, so a settled run leaves the
|
|
196
|
+
* viewport alone instead of holding eight rows of finished history.
|
|
197
|
+
*/
|
|
198
|
+
export function hasLiveWork(state: OrchestraState, run?: Run): boolean {
|
|
199
|
+
if (!run) return false;
|
|
200
|
+
const dispatches = listDispatches(state, run.id);
|
|
201
|
+
// `orphaned` counts: the process may still be alive and its task is stuck until you decide.
|
|
202
|
+
if (dispatches.some((dispatch) => isLiveStatus(dispatch.status) || dispatch.status === "orphaned")) return true;
|
|
203
|
+
return listTasks(state, run.id).some((task) => {
|
|
204
|
+
const status = effectiveTask(state, task).status;
|
|
205
|
+
return status === "running" || status === "blocked";
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
186
209
|
interface Row {
|
|
187
210
|
priority: number;
|
|
188
211
|
created: string;
|
|
@@ -577,7 +600,10 @@ export function workersTable(state: OrchestraState, runId?: string, options: Pag
|
|
|
577
600
|
export function dispatchReport(dispatch: Dispatch, task?: Task, body?: string): string {
|
|
578
601
|
const title = task?.title ?? dispatch.spec.split("\n")[0]?.slice(0, 80) ?? dispatch.agent;
|
|
579
602
|
const lines: string[] = [];
|
|
580
|
-
|
|
603
|
+
// A deliberate stop must never read as "settled", even if the exit handler won
|
|
604
|
+
// the race against the status update.
|
|
605
|
+
const status = dispatch.status === "settled" && dispatch.stopReason === "user" ? "stopped" : dispatch.status;
|
|
606
|
+
lines.push(`${dispatchGlyph(dispatch)} Worker ${shortId(dispatch.id)} (${dispatch.agent}) — ${status}`);
|
|
581
607
|
lines.push(`Task: ${title}`);
|
|
582
608
|
lines.push(`Model: ${formatModel(dispatch)}`);
|
|
583
609
|
if (dispatch.error) lines.push(`Error: ${dispatch.error}`);
|