pi-dev-flow 0.75.0 โ†’ 0.76.1

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 CHANGED
@@ -4,6 +4,21 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.76.1] - 2026-11-03
8
+
9
+ **pi-web workers read Running while they run.** Since 0.75.0 a `flow_stage` worker's Agents-menu row read *Interrupted* for its whole run, and its label repeated the slug.
10
+
11
+ ### Fixed
12
+ - While a `flow_stage` worker runs, its pi-web Agents row now reads running. pi-web shows a persisted `running` as interrupted unless it can confirm the run is alive in-process, so the worker now registers itself in pi-web's live run map for the run and leaves it only after its result entry is written. Plain pi is unchanged. Stop/steer from the Agents menu still answer "not running"; the driving session's Stop aborts the worker.
13
+ - Worker labels read `<glyph> <slug> <what>`: a `label` that repeats the slug is trimmed (`๐Ÿ” flow-list-widget ยท flow-list-widget review` โ†’ `๐Ÿ” flow-list-widget review`), and with no label the op names the run.
14
+
15
+ ## [0.76.0] - 2026-11-03
16
+
17
+ **The status bar now lists the flows.** In pi-web the footer was text โ€” nothing to click, and no way to see what was in flight without asking the agent.
18
+
19
+ ### Added
20
+ - In pi-web, dev-flow carries a collapsible flow-list widget beside the footer: a `dev-flow` chip in the status shelf whose panel shows one line per unfinished flow โ€” `โ†’` marks the session's bound flow, the stage word is spelled out, footer markers (`โšก ๐Ÿ“š ๐ŸŽฑ ๐Ÿ’ฌ`) and `โš ๏ธ` on failing checks read exactly as in the footer. It repaints at session start, at every run start and after every gate, and hides while nothing is open. The terminal keeps the footer as its only surface.
21
+
7
22
  ## [0.75.0] - 2026-11-03
8
23
 
9
24
  **`flow_stage` workers are now visible in pi-web.** A delegated worker used to be a session pi-web never mentioned โ€” the operator watched the driving session go quiet.
@@ -17,7 +17,7 @@ While a feature is active, the extension intercepts every tool call:
17
17
  - **Shell calls can't hang forever**: pi kills a shell command only when the model passed a `timeout` โ€” it omits one in ~75% of calls, so a `gh` waiting on a prompt or a dead `curl` froze sessions for hours. In an initiated repo (`.dev-flow/project.md` exists) every shell call without one therefore gets the class default armed silently (30s quick inspection ยท 120s local git and unknown ยท 180s network ยท 300s containers/services ยท 900s builds/tests/installs ยท 1,200s watchers like `gh run watch`), and absurd explicit values clamp to 1,800s. A project that wants the timeout visible on every call line sets `bashTimeout = require` in `## global` โ€” then a call without one is refused, naming the value it would have armed (each refusal costs a turn, which is why it is no longer the default). Uninitiated folders hear nothing at all: without the playbook dev-flow enforces no rules.
18
18
  - **Compact-aware**: dev-flow paces compaction the way pi counts it: the self-compaction trigger uses the *effective* `reserveTokens` (settings and per-model overrides, not the built-in default) and is checked at every turn end, not only when a run settles. When pi force-compacts on its threshold anyway โ€” the chat-only states (open tier-2 dialog, plan discussion not yet in `plan/`) refuse to self-compact by design โ€” dev-flow takes the compaction over and redoes it with flow-aware summary instructions (overflow recovery keeps pi's compact-and-retry and is left alone). Auto-compaction turned off in settings is honored.
19
19
  - The active stage is injected into the model's context every turn; the bundled `dev-flow` skill is the agent's playbook, including the recommended sequences: pre-release โ€” review (`/flow-review`) โ†’ fixes โ†’ docs โ†’ changelog/version bump; release โ€” PR โ†’ merge โ†’ tag โ†’ `release-done`. The package also bundles the review skills themselves โ€” `/flow-review` (a change, read against its `plan/plan.md`), `/flow-audit` (the whole repo) and `/flow-simplify` (the operative cut: deletes dead and duplicated code, one verified commit at a time) โ€” and injects a built-in senior-discipline guidance at implement stage unless the playbook sets its own `prose.implement`.
20
- - **Status bar**: an initiated repo (`.dev-flow/project.md` exists) always carries the dev-flow footer; while the session **is bound** to a feature it shows `<stage glyph> <slug>` plus mode markers โ€” stages ๐Ÿ“ plan, ๐Ÿ”จ implement, ๐Ÿ” pre-release, ๐Ÿš€ release; markers โšก patch, ๐Ÿ“š docs, ๐ŸŽฑ yolo, `๐Ÿ’ฌ` while a checkpoint (Approve?/Verified?/Release?/Finish?) still waits on the operator's word โ€” the legend's "operator, your turn" glyph, the same one stage lines open with โ€” and `โš ๏ธ` while a check of the bound feature fails (emoji render in their own color, so the footer carries no theme coloring). An **unbound** session never sees a slug โ€” it shows `๐Ÿ’ฌ N flow(s) open` (unfinished-feature count only, no warning marker) or `๐Ÿ’ฌ no flows` when nothing is in flight: the pre-flow glyph, because an unbound session is parked on the operator by definition; a session binds only via `flow start`/`flow use`, never by opening. The footer repaints at session start, at the start of every agent run (the earliest a late-attaching web client is listening) and after every gate; an uninitiated folder gets no footer at all. `flow status` is the spelled-out surface: `stage=implement`, the per-feature mode tags (`[ui]`, `[yolo]`, `[no-version]`), the `๐Ÿ’ฌ <word>` marker of a checkpoint the operator has not answered, and the `flow=<ver>` stamp of the build that started the feature.
20
+ - **Status bar**: an initiated repo (`.dev-flow/project.md` exists) always carries the dev-flow footer; while the session **is bound** to a feature it shows `<stage glyph> <slug>` plus mode markers โ€” stages ๐Ÿ“ plan, ๐Ÿ”จ implement, ๐Ÿ” pre-release, ๐Ÿš€ release; markers โšก patch, ๐Ÿ“š docs, ๐ŸŽฑ yolo, `๐Ÿ’ฌ` while a checkpoint (Approve?/Verified?/Release?/Finish?) still waits on the operator's word โ€” the legend's "operator, your turn" glyph, the same one stage lines open with โ€” and `โš ๏ธ` while a check of the bound feature fails (emoji render in their own color, so the footer carries no theme coloring). An **unbound** session never sees a slug โ€” it shows `๐Ÿ’ฌ N flow(s) open` (unfinished-feature count only, no warning marker) or `๐Ÿ’ฌ no flows` when nothing is in flight: the pre-flow glyph, because an unbound session is parked on the operator by definition; a session binds only via `flow start`/`flow use`, never by opening. In **pi-web** the footer text is not clickable, so an initiated repo also carries a `dev-flow` widget there: a chip in the status shelf whose panel expands (click again to collapse) to one lean line per unfinished flow โ€” `โ†’` marks the session's bound flow, the stage word is spelled out, markers and `โš ๏ธ` follow the footer vocabulary โ€” and no chip appears while nothing is open. The TUI never shows it: a widget there is an always-present block, and in a terminal the footer stays the legend. The footer repaints at session start, at the start of every agent run (the earliest a late-attaching web client is listening) and after every gate; an uninitiated folder gets no footer at all. `flow status` is the spelled-out surface: `stage=implement`, the per-feature mode tags (`[ui]`, `[yolo]`, `[no-version]`), the `๐Ÿ’ฌ <word>` marker of a checkpoint the operator has not answered, and the `flow=<ver>` stamp of the build that started the feature.
21
21
 
22
22
  ## Limitations (deliberate, v1)
23
23
 
@@ -109,6 +109,7 @@ import {
109
109
  validSlug,
110
110
  verifyGate,
111
111
  versionTagGate,
112
+ widgetLines,
112
113
  writeGuard,
113
114
  mainCheckoutRoot,
114
115
  buildWorkerBrief,
@@ -206,7 +207,7 @@ function copyWarning(): string | null {
206
207
  }
207
208
  /** Test seam: the smoke suite cannot load a second copy of this module, so it plants registry
208
209
  * entries and asserts the warnings the real duplicate would print. */
209
- export const testSeams = { copies: COPIES, skillCore: { value: undefined as string | null | undefined }, piweb: { meta: piwebWorkerMeta, stamp: piwebStamp } };
210
+ export const testSeams = { copies: COPIES, skillCore: { value: undefined as string | null | undefined }, piweb: { meta: piwebWorkerMeta, stamp: piwebStamp, liveClaim: piwebLiveClaim, workerName } };
210
211
 
211
212
  interface Ui {
212
213
  hasUI: boolean;
@@ -1919,7 +1920,8 @@ const WORKER_TOOLS: Record<WorkerOp, string[]> = { implement: ["read", "bash", "
1919
1920
  * readSubagentRun, fed by lib/session-reader.ts). Two placement rules the reader enforces:
1920
1921
  * the meta entry must be the file's FIRST data entry (the scanner reads header + one line and
1921
1922
  * calls anything else a fork), and a persisted `running` the host cannot prove live displays as
1922
- * `interrupted` โ€” so the final result entry is what the menu really rests on.
1923
+ * `interrupted` โ€” so while a worker runs it also claims a slot in pi-web's live run map
1924
+ * (piwebLiveClaim), and the final result entry settles the row after.
1923
1925
  * Unknown entry types are inert in plain pi, so stamping is unconditional. */
1924
1926
  const PIWEB_SUBAGENT = { meta: "pi-web:subagent", status: "pi-web:subagent-status", result: "pi-web:subagent-result" } as const;
1925
1927
 
@@ -1955,6 +1957,43 @@ function piwebStamp(target: { appendCustomEntry?(customType: string, data?: unkn
1955
1957
  try { target?.appendCustomEntry?.(customType, data); } catch { /* visibility only */ }
1956
1958
  }
1957
1959
 
1960
+ /** pi-web proves a subagent live only from its own in-process tables (rpc-manager.ts
1961
+ * subagentDisplayStatus: its session registry, or globalThis.__piSubagentRuns); anything else with
1962
+ * a persisted `running` reads `interrupted`. pi-web hosts extensions in its server process, so the
1963
+ * worker claims a slot in that map for the run โ€” pi-web's private global, used only when pi-web
1964
+ * created it (never created here: plain pi stays untouched, and a pi-web without it keeps the old
1965
+ * mid-run `interrupted`). Side effects: the driver counts as having an unsettled subagent while the
1966
+ * tool call runs (it is mid-call anyway); Stop/steer from the Agents menu still answer "not running",
1967
+ * since pi-web holds no wrapper for this child โ€” the driver's Stop aborts it. Returns an idempotent
1968
+ * release that drops the slot only if it still holds this claim (pi-web's dropSubagentRun rule). */
1969
+ function piwebLiveClaim(sm: { getSessionId?(): string; getSessionFile?(): string | undefined } | undefined, m: WorkerSubagentMeta): (status: string) => void {
1970
+ try {
1971
+ const runs = (globalThis as { __piSubagentRuns?: unknown }).__piSubagentRuns;
1972
+ const sessionId = sm?.getSessionId?.();
1973
+ if (!(runs instanceof Map) || !sessionId) return () => {};
1974
+ let settle: (run: unknown) => void = () => {};
1975
+ const run = { sessionId, sessionPath: sm?.getSessionFile?.() ?? "", parentSessionId: m.parentId, parentToolCallId: m.toolCallId, profile: m.profile, description: m.description, task: m.task, runInBackground: false, status: "running", createdAt: now() };
1976
+ const stored = { run, completion: new Promise((resolve) => { settle = resolve; }), abortRequested: false, dispatchedAt: Date.now() };
1977
+ runs.set(sessionId, stored);
1978
+ let released = false;
1979
+ return (status) => {
1980
+ if (released) return;
1981
+ released = true;
1982
+ try { if (runs.get(sessionId) === stored) runs.delete(sessionId); settle({ ...run, status, completedAt: now() }); } catch { /* visibility only */ }
1983
+ };
1984
+ } catch { return () => {}; }
1985
+ }
1986
+
1987
+ /** The worker's display name โ€” the Agents row and the session name: `<glyph> <slug> <what>`. The
1988
+ * model's label often repeats the slug ("flow-list-widget review"), so the slug and stray separators
1989
+ * are cut from it; with nothing left the op names the run. */
1990
+ function workerName(glyph: string, slug: string, op: string, label: unknown): string {
1991
+ const esc = slug.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1992
+ const what = String(label ?? "").replace(/[\r\n]+/g, " ").replace(new RegExp(esc, "gi"), " ")
1993
+ .replace(/^[\sยท:|/,-]+|[\sยท:|/,-]+$/g, "").replace(/\s{2,}/g, " ").slice(0, 40).trim();
1994
+ return `${glyph} ${slug} ${what || op}`;
1995
+ }
1996
+
1958
1997
  /** Seam that spawns a worker as a real pi session โ€” tests replace `.run`. With the driver's session
1959
1998
  * file and directory known, the worker's header links back to the driver (`parentSession`), so pi's
1960
1999
  * picker nests it under the driver, and the pi-web meta lands as the file's first data entry. */
@@ -2025,15 +2064,22 @@ function tail(out: string, n = 15): string {
2025
2064
 
2026
2065
  /** Compact footer: bound flow = stage glyph, slug, mode markers, โš ๏ธ on its failing checks; unbound = the
2027
2066
  * unfinished-flow count, or `๐Ÿ’ฌ no flows` โ€” an initiated repo always carries the footer. An uninitiated
2028
- * folder gets nothing: the status is cleared. Pure read โ€” rendering never binds or claims anything. */
2067
+ * folder gets nothing: the status is cleared. In pi-web the footer text is not clickable, so the same
2068
+ * snapshot also feeds a flow-list widget (a `dev-flow` chip whose panel lists every open flow, one lean
2069
+ * line each). Pure read โ€” rendering never binds or claims anything. */
2029
2070
  function refreshStatus(ctx: ExtensionContext, root: string): void {
2030
2071
  if (!ctx.hasUI) return;
2031
2072
  if (!initiated(root)) {
2032
2073
  ctx.ui.setStatus("dev-flow", undefined);
2074
+ if (ctx.mode !== "tui") ctx.ui.setWidget("dev-flow", undefined);
2033
2075
  return;
2034
2076
  }
2035
- const s = statusFor(boundFeature(root, sessionKey(ctx)), unfinishedStates(root).length);
2036
- ctx.ui.setStatus("dev-flow", s.text);
2077
+ const un = unfinishedStates(root);
2078
+ const bound = boundFeature(root, sessionKey(ctx));
2079
+ ctx.ui.setStatus("dev-flow", statusFor(bound, un.length).text);
2080
+ // TUI keeps the footer as its only surface: a lines-widget there is an always-present block above the
2081
+ // editor (no click to collapse), which competes with "the footer is the legend". pi-web gets the chip.
2082
+ if (ctx.mode !== "tui") ctx.ui.setWidget("dev-flow", un.length ? widgetLines(bound, un) : undefined);
2037
2083
  }
2038
2084
 
2039
2085
 
@@ -2164,7 +2210,7 @@ export default function devFlow(pi: ExtensionAPI) {
2164
2210
  name: "flow_stage",
2165
2211
  label: "Stage worker",
2166
2212
  description:
2167
- 'Optional: hand a slice of work to a fresh pi session so this conversation stays lean. op "implement" (stage implement) โ€” the worker edits and commits a slice on the feature branch; op "review" (implement or pre-release) โ€” a fresh read-only reviewer that returns findings and a PASS/FAIL verdict (advisory: no gate depends on it). The plan path, branch, commits so far and the project checks are added to the brief automatically โ€” `note` is just the slice: what to do, operator answers and decisions the worker cannot see. The worker holds no flow tool; gates and checkpoints stay with you. Small work and small fixes are fine to do inline. In pi-web the worker appears in the session\'s Agents menu as a subagent; the row carries its final status, the opened transcript its report.',
2213
+ 'Optional: hand a slice of work to a fresh pi session so this conversation stays lean. op "implement" (stage implement) โ€” the worker edits and commits a slice on the feature branch; op "review" (implement or pre-release) โ€” a fresh read-only reviewer that returns findings and a PASS/FAIL verdict (advisory: no gate depends on it). The plan path, branch, commits so far and the project checks are added to the brief automatically โ€” `note` is just the slice: what to do, operator answers and decisions the worker cannot see. The worker holds no flow tool; gates and checkpoints stay with you. Small work and small fixes are fine to do inline. In pi-web the worker appears in the session\'s Agents menu as a subagent (running while it works, then its final status); the opened transcript holds its report.',
2168
2214
  promptSnippet: 'flow_stage(op: "implement"|"review", note, label?) โ€” optional fresh-session worker for a big implement slice, or an independent review; gates stay with you; in pi-web workers show up as subagents in the Agents menu',
2169
2215
  parameters: Type.Object({
2170
2216
  op: Type.String({ description: '"implement" (a worker edits + commits a slice) or "review" (read-only reviewer, findings + verdict)' }),
@@ -2189,9 +2235,8 @@ export default function devFlow(pi: ExtensionAPI) {
2189
2235
  runningWorkers.add(key);
2190
2236
  const cfg = loadProject(dfDir(root)).cfg;
2191
2237
  const budgetMin = clampBudgetMin(params.budgetMin, wop);
2192
- const label = String(params.label ?? "").replace(/[\r\n]+/g, " ").trim().slice(0, 40);
2193
2238
  const glyph = wop === "implement" ? "๐Ÿ”จ" : "๐Ÿ”";
2194
- const name = `${glyph} ${st.slug}${label ? ` ยท ${label}` : ""}`;
2239
+ const name = workerName(glyph, st.slug, wop, params.label);
2195
2240
  const started = Date.now();
2196
2241
  const git = async (cmd: string) => { const r = await sh(cmd, work); return r.ok ? r.out : ""; };
2197
2242
  const headBefore = (await git("git rev-parse HEAD")).trim();
@@ -2218,9 +2263,13 @@ export default function devFlow(pi: ExtensionAPI) {
2218
2263
  const timer = setTimeout(() => { timedOut = true; abortChild(); }, budgetMin * 60_000);
2219
2264
  signal?.addEventListener("abort", abortChild);
2220
2265
  let unsub: (() => void) | undefined;
2266
+ let releaseLive: (status: string) => void = () => {};
2221
2267
  try {
2222
2268
  child = await stageWorkerSpawn.run({ work, model: ctx.model, name: `โณ ${name}`, tools: WORKER_TOOLS[wop], parent: lineage.file, dir: lineage.dir, subagent });
2223
- if (subagent) piwebStamp(child.sessionManager, PIWEB_SUBAGENT.status, { version: 1, status: "running" });
2269
+ if (subagent) {
2270
+ piwebStamp(child.sessionManager, PIWEB_SUBAGENT.status, { version: 1, status: "running" });
2271
+ releaseLive = piwebLiveClaim(child.sessionManager, subagent);
2272
+ }
2224
2273
  unsub = child.subscribe((ev: unknown) => {
2225
2274
  const e = ev as { type?: string; toolName?: string };
2226
2275
  if (e.type === "tool_execution_start") {
@@ -2253,14 +2302,18 @@ export default function devFlow(pi: ExtensionAPI) {
2253
2302
  // cannot prove live displays as `interrupted`); a no-REPORT run is a failure, not a โœ“.
2254
2303
  if (subagent) {
2255
2304
  const doneAt = now();
2256
- piwebStamp(child?.sessionManager, PIWEB_SUBAGENT.result, crash
2305
+ const final = crash
2257
2306
  ? { version: 1, status: "failed", completedAt: doneAt, error: crash }
2258
2307
  : timedOut || signal?.aborted
2259
2308
  ? { version: 1, status: "aborted", completedAt: doneAt }
2260
2309
  : report.found
2261
2310
  ? { version: 1, status: "completed", completedAt: doneAt, result: report.body }
2262
- : { version: 1, status: "failed", completedAt: doneAt, error: `ended without REPORT after ${nudges} nudge(s)`, result: report.body });
2311
+ : { version: 1, status: "failed", completedAt: doneAt, error: `ended without REPORT after ${nudges} nudge(s)`, result: report.body };
2312
+ piwebStamp(child?.sessionManager, PIWEB_SUBAGENT.result, final);
2313
+ // leave the live map only once the result entry is down: the row is never neither
2314
+ releaseLive(final.status);
2263
2315
  }
2316
+ releaseLive("failed"); // idempotent guard: a throw between claim and result must not leave a live row
2264
2317
  try { if (child) workerSessions.delete(child.sessionManager.getSessionId()); } catch { /* id-less session: nothing was registered */ }
2265
2318
  try { child?.setSessionName(`${report.found && !crash && !timedOut && !signal?.aborted ? "โœ“" : "โœ—"} ${name}${report.verdict ? ` ยท ${report.verdict}` : ""}`); } catch { /* visibility only */ }
2266
2319
  const parts = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-dev-flow",
3
- "version": "0.75.0",
3
+ "version": "0.76.1",
4
4
  "description": "Enforced feature workflow for Pi: plan โ†’ implement โ†’ pre-release โ†’ release, gated checkpoints, self-improvement reflections, one git worktree per feature, changelog + publish as part of the release",
5
5
  "type": "module",
6
6
  "keywords": [
package/src/core.ts CHANGED
@@ -1440,6 +1440,18 @@ export function statusFor(bound: FlowState | null, openCount: number): { text: s
1440
1440
  return { text: `๐Ÿ’ฌ ${openCount} flow${openCount === 1 ? "" : "s"} open` };
1441
1441
  }
1442
1442
 
1443
+ /** The pi-web widget panel's lines: one lean line per unfinished flow โ€” `โ†’` marks this session's bound
1444
+ * flow, glyph + markers ride on statusCompact so the panel and the footer never drift in vocabulary โ€”
1445
+ * plus the spelled-out stage word and the `โš ๏ธ` on failing checks the compact footer cannot show. The
1446
+ * panel is the glance surface; `flow status` stays the detailed one. Empty in, empty out (the caller
1447
+ * clears the widget โ€” no chip with nothing to expand). */
1448
+ export function widgetLines(bound: FlowState | null, states: FlowState[]): string[] {
1449
+ return states.map((st) => {
1450
+ const { text, failed } = statusCompact(st);
1451
+ return `${st.slug === bound?.slug ? "โ†’" : " "} ${text} ยท ${st.stage}${failed ? " โš ๏ธ" : ""}`;
1452
+ });
1453
+ }
1454
+
1443
1455
  /** `- [ ]` checklist items of a markdown document (reflections.md and roadmap.md share the format). */
1444
1456
  export function openChecklistItems(text: string): string[] {
1445
1457
  return text.split("\n").map((l) => l.trim()).filter((l) => l.startsWith("- [ ] "));