@loka1/pi-orchestra 0.0.0-stage → 0.5.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 ADDED
@@ -0,0 +1,257 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.5.0] - 2026-11-30
11
+
12
+ ### Added
13
+
14
+ - **Docs site.** `wiki/` is built into a GitHub Pages site
15
+ (<https://loka1.github.io/pi-orchestra/>) by `docs.yml` on every change:
16
+ `scripts/wiki-site.mjs` rewrites GitHub-wiki `[[Page]]` links to plain markdown
17
+ and turns `Home.md` into the landing page. The GitHub wiki mirror still exists,
18
+ but GitHub only creates `<repo>.wiki.git` after a page is saved once in the web
19
+ UI, so the site is the surface that always publishes.
20
+
21
+ - **Joined worker chat.** `/orchestra join <dispatch>` (or `j` in the browser)
22
+ opens one worker's conversation full-screen and lets you type into it: a steer
23
+ while it runs, a follow-up turn once it has settled. Header shows status, model,
24
+ turns, spend vs budget; `ctrl+t` toggles thinking, `ctrl+o` expands tool output,
25
+ `ctrl+e` opens the editor, `esc` returns to the browser and `ctrl+g` to your own
26
+ session. `/stop`, `/retry`, `/resume`, `/diff`, `/open`, `/back`, `/exit` and
27
+ `/help` work from the composer.
28
+ - `action=chat dispatch=<id> [includeThinking=true]` and `/orchestra chat <id>`
29
+ render the same conversation as text, for print/RPC modes.
30
+ - `extensions/lib/chat.ts` maps the worker event stream into conversation blocks
31
+ (brief, assistant, thinking, tool, result, error), folding the dispatch
32
+ preamble down to its task.
33
+ - **`/orchestra runs` and `/orchestra use <run>`.** List runs newest-first (the
34
+ active one is marked) and switch the active run from the prompt, matching the
35
+ `run_list` / `run_use` tool actions.
36
+ - **`/orchestra` argument completion.** Tab after `/orchestra` completes the
37
+ subcommand (with a one-line description), and a second tab completes live
38
+ dispatch, task, run and template ids where a command takes one.
39
+ - **`timeoutMode`.** `"idle"` restarts the worker's wall-clock timer on every
40
+ event, so a busy worker is never stopped mid-job — only silence for `timeoutMs`
41
+ is. `timeoutMs: 0` removes the limit, and `worker_start timeoutMs=` /
42
+ `timeoutMode=` override it per dispatch (repairs and resumes inherit it).
43
+
44
+ ### Changed
45
+
46
+ - The coordinator is told to **end its turn** after `worker_start` instead of
47
+ blocking in `orchestra_wait`: it is woken on settle or question, so the user can
48
+ keep working in the same session. `wait` stays for "nothing else can proceed".
49
+ - `j` joins the highlighted worker in the browser; `k`/`j` no longer move the
50
+ cursor (arrows, page keys, `Home`/`End` and `g`/`G` do).
51
+
52
+ ### Fixed
53
+
54
+ - **Page, home/end and top/bottom keys now work in the browser.** Page keys were
55
+ forwarded to `SelectList` and only matched the default binding, `home`/`end`
56
+ were documented but never implemented, and terminals sending modifier variants
57
+ (`\x1b[5;2~`, `\x1b[6;5~`) did nothing. Both the list and the detail pane now
58
+ accept `PgUp`/`PgDn` in every common encoding, `Home`/`End`, `g`/`G` and
59
+ `ctrl+d`/`ctrl+u`.
60
+
61
+ ## [0.4.0] - 2026-11-30
62
+
63
+ The review-and-recovery release: a run can now be inspected, repaired and
64
+ cleaned up without leaving the session.
65
+
66
+ ### Added
67
+
68
+ - **Diff review.** Every dispatch records the git commit it started from;
69
+ `action=diff dispatch=<id>` and `D` in the browser show the base, stat,
70
+ untracked files and patch of what that worker changed.
71
+ - **Markdown run report.** `action=report` (and `/orchestra report`) writes
72
+ `exports/<runId>.md`: goal, task table, each report, failures with errors,
73
+ diff stats, cost totals and the regression line.
74
+ - **Cost regression.** Runs keep the template they came from, and metrics/report
75
+ compare against the previous run of the same template or name: cost, turns,
76
+ tool calls and wall time deltas.
77
+ - **Automatic retries.** `retries`/`retryBackoffMs` (config and `worker_start`)
78
+ queue a repair dispatch on failure with exponential backoff, attempt tracking
79
+ and no retry for deliberate stops, resumed sessions or exhausted budgets.
80
+ - **Orphan recovery.** A coordinator restart probes the pid: live processes
81
+ become `⚡ orphaned` (stoppable with `worker_stop` via SIGTERM, resumable) and
82
+ only dead ones are `lost`.
83
+ - **Budget pause.** `budgetAction: "ask"` pauses a run at its ceiling instead of
84
+ killing workers; `action=budget budgetUsd=<n>` raises it and resumes.
85
+ - **Retention.** `action=prune days=<n> dryRun=<bool>` deletes archived runs and
86
+ orphaned logs/prompts/mail/exports by age, never touching live state.
87
+ - **Structured filters.** `status:`, `agent:`, `kind:`, `run:`, `id:`, `task:`,
88
+ `model:`, `cost:` and `turns:` terms with comparisons, shared by the browser
89
+ search, `task_list`/`worker_list` and `/orchestra find`.
90
+
91
+ ### Changed
92
+
93
+ - `task_create`/`task_update` validate dependencies: unknown ids, self-deps and
94
+ cycles are refused with the path, and a cycle already on disk is shown as
95
+ `⊘ blocked · dependency cycle: A -> C -> B -> A` until fixed.
96
+ - `task_update` can now replace `deps` as well as set a status.
97
+
98
+ ## [0.3.0] - 2026-11-30
99
+
100
+ The toolbox release: a run can now be bounded, repaired, searched and audited
101
+ without leaving the session.
102
+
103
+ ### Added
104
+
105
+ - **Budgets.** `budgetUsdPerWorker`, `budgetUsdPerRun`, `budgetMsPerWorker`,
106
+ `budgetGraceMs`, overridable per dispatch (`worker_start budgetUsd=/budgetMs=`)
107
+ and per run (`run_create budgetUsd=`). Cost is checked on every event; a run
108
+ over its ceiling stops its workers and refuses new ones. A time budget asks the
109
+ worker to wrap up first and only then stops it, unlike the hard `timeoutMs`.
110
+ - **Stall watchdog.** `stallMs` (default 10 min) flags a worker that produced no
111
+ events — distinct from a timeout — as `⚠ stalled 12m` in the widget and status
112
+ line, with a message; `stallAction: "abort"` stops it.
113
+ - **`worker_resume`.** With `sessionMode: "session"`, a dispatch keeps its pi
114
+ session id and can be reopened later on the same session (linked with
115
+ `resumedFrom`, continuation prompt only). `/orchestra resume <id> [msg]`.
116
+ - **Repair dispatch.** `worker_start retryOf=<id>` reuses the failed attempt's
117
+ spec, agent, tools and model, and leads the prompt with its status, error, last
118
+ tool and report. `/orchestra retry <id>`.
119
+ - **Broadcast.** `orchestra_send dispatch="*"` and `/orchestra broadcast <msg>`
120
+ deliver one message to every live worker and report per-worker results.
121
+ - **Transcript search.** `action=search filter=…` and `/orchestra grep <text>` over
122
+ every `.pi/orchestra/logs/*.jsonl`, with dispatch, line numbers and redacted text.
123
+ - **Metrics and export.** `action=metrics` / the run detail pane show cost, turns,
124
+ tool calls, tokens, duration and a spend sparkline per worker; `action=export`
125
+ writes `.pi/orchestra/exports/<runId>.jsonl` (run header, worker rows, timeline
126
+ points with cumulative cost and turns).
127
+ - **Browser: bulk and sort.** `space` marks rows, `x`/`r`/`c` act on the mark set
128
+ (stop, retry, copy ids into the editor), `s`/`t` sort by cost/time, and `d` opens
129
+ the full transcript.
130
+
131
+ ### Changed
132
+
133
+ - The detail pane tails live: a log pager opens at the end, follows new events and
134
+ stops following as soon as you scroll (`f` toggles).
135
+ - Stopping a worker from the browser and `worker_stop` share one path, so the task
136
+ returns to `pending` and its budget timers are cleared either way.
137
+ - `worker_show` reports the last event time, `⚠ stalled since …` and the budgets.
138
+
139
+ ## [0.2.1] - 2026-11-30
140
+
141
+ ### Fixed
142
+
143
+ - **Workers no longer change model behind your back.** With `workerIsolation`, a
144
+ provider contributed by an extension package (e.g. `commandcode`) was not
145
+ registered in the worker, and the bare `--model deepseek/deepseek-v4.1-flash`
146
+ was read as `provider/id`, silently running `(deepseek) deepseek-v4-pro`.
147
+
148
+ ### Fixed (CI)
149
+
150
+ - The **Sync wiki** workflow no longer fails when the wiki has not been initialised
151
+ or `WIKI_TOKEN` is missing. It validates every page first (H1 title, linked from
152
+ `Home`, `[[links]]` resolve), then warns and skips the push. GitHub only creates
153
+ `<repo>.wiki.git` after the first page is saved in the web UI, so the old job
154
+ failed with `repository not found` until then.
155
+
156
+ ### Changed
157
+
158
+ - Workers are started with an explicit `--provider <name> --model <id>` pair,
159
+ resolved from `worker_start` params → agent frontmatter/`agents` override →
160
+ the coordinator's model. The provider is looked up in the coordinator's
161
+ catalogue, preferring its own provider when an id exists on several.
162
+ - Isolated workers load the extension that registers their provider, found
163
+ among the packages already installed in pi (`settings.json` → `packages`).
164
+ Nothing new to install; `providerExtensions` covers what discovery cannot see.
165
+ - Before spawning, the worker's own model list is probed
166
+ (`pi … --list-models <provider>/<id>`, one spawn per model, cached). When the
167
+ model is missing the worker falls back to the **coordinator's** model and
168
+ records `modelNote` instead of running a fuzzy match.
169
+ - `worker_start` accepts `provider`; agent frontmatter accepts `provider`;
170
+ `agents.<name>` overrides accept `provider`. The start banner, `worker_show`,
171
+ transcripts, reports and the browser print `(provider) model`.
172
+
173
+ ## [0.2.0] - 2026-11-30
174
+
175
+ ### Added
176
+
177
+ - **`/orchestra browse`** — an interactive list of tasks, workers and runs:
178
+ fuzzy search, `tab` to switch scope, `enter` for a detail view with the
179
+ worker report and transcript tail, `m` to message, `x` to stop, `f` to
180
+ follow, `o` to switch the active run. `/orchestra` opens it in TUI mode;
181
+ print and RPC modes print the same data as text.
182
+ - **`/orchestra open <id>`** and **`/orchestra find <query>`** for scripted use.
183
+ - `task_list` and `worker_list` take `filter`, `limit` (default 20) and
184
+ `offset`, and end with `showing 1–20 of 24 — offset=20` instead of dumping
185
+ every row into the model's context.
186
+ - `widgetMaxLines` (default 8) and `widgetShowSettled` (default false) config
187
+ keys.
188
+
189
+ ### Changed
190
+
191
+ - **The widget is a component now**, so it knows the viewport width: rows are
192
+ truncated with `…` instead of being clipped by pi, they are ordered by
193
+ urgency (`question` → `running` → `timeout`/`failed` → `ready` → settled)
194
+ and capped with `+N more · /orchestra browse`. Settled rows collapse into a
195
+ counter.
196
+ - Timeouts render as `⏱ timeout 15m` with their age instead of looking like a
197
+ generic failure, and the widget reports how many workers timed out.
198
+ - Task status now defers to its dispatch, on write and again when state is
199
+ reloaded. A task whose worker settled can no longer keep a `✗` glyph, and a
200
+ stopped worker returns its task to `pending` deterministically.
201
+
202
+ ### Fixed
203
+
204
+ - Widget rows were emitted in creation order with no width awareness, so long
205
+ titles were cut mid-word and pi printed `... (widget truncated)`.
206
+ - `statusLine`/widget counters disagreed with the worker rows after a restart
207
+ (e.g. `0 running` while two tasks showed `◌` ready).
208
+
209
+ ## [0.1.1] - 2026-11-29
210
+
211
+ ### Changed
212
+
213
+ - **Docs and examples now configure the reviewer agent with
214
+ `deepseek/deepseek-v4.1-flash` at `thinking: high`** (provider `commandcode`),
215
+ read-only tools (`read`, `grep`, `find`, `ls`, `bash`), in line with the
216
+ recommended review setup.
217
+ - Documented that model ids should use pi's `defaultModel` form, and that under
218
+ `workerIsolation` the bare id is the right choice because workers do not load
219
+ provider extensions.
220
+
221
+ ### Fixed
222
+
223
+ - The release workflow no longer references `secrets` in a step `if`, which made
224
+ GitHub reject the workflow file before running any job.
225
+
226
+ ## [0.1.0] - 2026-11-29
227
+
228
+ ### Added
229
+
230
+ - **Orchestration without an external runtime.** One pi session coordinates
231
+ other pi sessions. No daemon, no socket, no database file to manage.
232
+ - **Runs, tasks and dispatches.** Tasks carry `deps`; readiness (`pending` →
233
+ `ready` → `blocked`) is recomputed when a worker finishes, so a fan-out graph
234
+ can be drained task by task.
235
+ - **Worker processes over RPC.** Each dispatch is a real `pi --mode rpc` process
236
+ with its own context window, tools, model, thinking level and JSONL event log.
237
+ Events are parsed strictly by LF and correlated by request id.
238
+ - **Wake-ups instead of polling.** `agent_settled` in a worker turns into a
239
+ coordinator message with the final report and usage. `orchestra_wait` blocks,
240
+ and returns early when a worker is blocked on a question.
241
+ - **Questions and gates.** `orchestra_ask` in a worker blocks on a file in
242
+ `.pi/orchestra/mail/<dispatch>/`; `orchestra_answer` writes the reply and the
243
+ worker resumes. Pending questions are tracked as gates in state.
244
+ - **Steering and follow-up work.** `orchestra_send` steers a running worker or
245
+ continues a settled one, reopening its task.
246
+ - **Live UI.** Footer status line, task/worker widget, `/orchestra` subcommands
247
+ (`status`, `tasks`, `workers`, `read`, `watch`, `unwatch`, `stop`,
248
+ `questions`, `config`), and message renderers for worker reports and questions.
249
+ - **Isolated workers by default** (`workerIsolation`): `--no-extensions` plus
250
+ this extension only, so no MCP servers, no interactive gates and no recursive
251
+ dispatch. Interactive dialogs are auto-cancelled when isolation is off.
252
+ - **Agent definitions** shared with pi's subagent convention
253
+ (`~/.pi/agent/agents/*.md`, `.pi/agents/*.md`) and per-agent overrides in
254
+ config.
255
+ - **Durable state** in `.pi/orchestra/state.json` (atomic writes, git-ignored
256
+ automatically), one transcript log per dispatch, and a `reset` action that
257
+ archives the previous state instead of deleting it.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 loka1
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.