@llblab/pi-actors 0.40.1 → 0.41.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.
@@ -13,6 +13,7 @@ import {
13
13
  existsSync,
14
14
  mkdirSync,
15
15
  readFileSync,
16
+ readdirSync,
16
17
  statSync,
17
18
  } from "node:fs";
18
19
  import { dirname, join, relative } from "node:path";
@@ -31,8 +32,11 @@ async function importRuntimeModule(name) {
31
32
  );
32
33
  }
33
34
 
34
- const { appendRecipeContextToPiArgs, materializePiPrintPromptArg } =
35
- await importRuntimeModule("recipes-context");
35
+ const {
36
+ appendRecipeContextToPiArgs,
37
+ attachPiSessionDir,
38
+ materializePiPrintPromptArg,
39
+ } = await importRuntimeModule("recipes-context");
36
40
  const { buildReviewPreflightDiagnostic, formatReviewPreflightDiagnostic } =
37
41
  await importRuntimeModule("preflight-diagnostics");
38
42
  const { execCommandTemplate } = await importRuntimeModule("command-templates");
@@ -126,11 +130,24 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
126
130
  });
127
131
  }
128
132
 
133
+ function commandSessionFiles(sessionDir) {
134
+ if (!sessionDir) return [];
135
+ try {
136
+ return readdirSync(sessionDir, { withFileTypes: true })
137
+ .filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl"))
138
+ .map((entry) => relative(stateDir, join(sessionDir, entry.name)))
139
+ .sort();
140
+ } catch {
141
+ return [];
142
+ }
143
+ }
144
+
129
145
  function commandEvidenceStartRecord({
130
146
  commandDetail,
131
147
  commandId,
132
148
  materialized,
133
149
  options,
150
+ sessionDir,
134
151
  stage,
135
152
  occurrence,
136
153
  }) {
@@ -155,6 +172,7 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
155
172
  ...(materialized.promptBytes
156
173
  ? { prompt_bytes: materialized.promptBytes }
157
174
  : {}),
175
+ ...(sessionDir ? { session_dir: relative(stateDir, sessionDir) } : {}),
158
176
  attempts: [],
159
177
  semantic_acceptance:
160
178
  options?.evidenceContext?.acceptOutput === "review_evidence" ||
@@ -172,6 +190,7 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
172
190
  options,
173
191
  result,
174
192
  rawExitCode,
193
+ sessionDir,
175
194
  stage,
176
195
  occurrence,
177
196
  startedAt,
@@ -234,6 +253,10 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
234
253
  ...(materialized.promptBytes
235
254
  ? { prompt_bytes: materialized.promptBytes }
236
255
  : {}),
256
+ ...(sessionDir ? { session_dir: relative(stateDir, sessionDir) } : {}),
257
+ ...(commandSessionFiles(sessionDir).length > 0
258
+ ? { session_files: commandSessionFiles(sessionDir) }
259
+ : {}),
237
260
  attempts,
238
261
  exit_code: rawExitCode ?? result.code,
239
262
  effective_exit_code: result.code,
@@ -301,21 +324,26 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
301
324
  }
302
325
 
303
326
  async function observedExec(command, args, options) {
327
+ captureCounter += 1;
328
+ const commandId = `command-${String(captureCounter).padStart(3, "0")}`;
304
329
  const contextArgs = appendRecipeContextToPiArgs(
305
330
  command,
306
331
  args,
307
332
  meta.recipe_context_records,
308
333
  options?.actorRecipeContext,
309
334
  );
310
- const materialized = materializePiPrintPromptArg(
335
+ const session = attachPiSessionDir(
311
336
  command,
312
337
  contextArgs,
338
+ join(stateDir, "sessions", commandId),
339
+ );
340
+ const materialized = materializePiPrintPromptArg(
341
+ command,
342
+ session.args,
313
343
  promptFilePath,
314
344
  );
315
345
  const execArgs = materialized.args;
316
346
  const commandDetail = formatCommandDetail(command, execArgs);
317
- captureCounter += 1;
318
- const commandId = `command-${String(captureCounter).padStart(3, "0")}`;
319
347
  const stage =
320
348
  options?.actorRecipeContext?.alias ||
321
349
  options?.actorRecipeContext?.name ||
@@ -346,6 +374,7 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
346
374
  commandId,
347
375
  materialized,
348
376
  options,
377
+ sessionDir: session.sessionDir,
349
378
  stage,
350
379
  occurrence,
351
380
  });
@@ -357,6 +386,7 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
357
386
  command: commandDetail,
358
387
  ...(materialized.promptFile ? { prompt_file: materialized.promptFile } : {}),
359
388
  ...(materialized.promptBytes ? { prompt_bytes: materialized.promptBytes } : {}),
389
+ ...(session.sessionDir ? { session_dir: relative(stateDir, session.sessionDir) } : {}),
360
390
  });
361
391
  progressRunning();
362
392
  const captureDir = join(stateDir, "captures", commandId);
@@ -400,6 +430,7 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
400
430
  options,
401
431
  result,
402
432
  rawExitCode: rawResult.code,
433
+ sessionDir: session.sessionDir,
403
434
  stage,
404
435
  occurrence,
405
436
  startedAt: startedEvidence.started_at,
@@ -426,6 +457,10 @@ export async function runAsyncRunner(stateDir = process.argv[2]) {
426
457
  ...captureDetails(result),
427
458
  ...(materialized.promptFile ? { prompt_file: materialized.promptFile } : {}),
428
459
  ...(materialized.promptBytes ? { prompt_bytes: materialized.promptBytes } : {}),
460
+ ...(session.sessionDir ? { session_dir: relative(stateDir, session.sessionDir) } : {}),
461
+ ...(commandSessionFiles(session.sessionDir).length > 0
462
+ ? { session_files: commandSessionFiles(session.sessionDir) }
463
+ : {}),
429
464
  ...(preflightDiagnostic ? { preflight: preflightDiagnostic } : {}),
430
465
  });
431
466
  outbox(
@@ -238,14 +238,24 @@ function terminateProcessGroup(child, signal) {
238
238
  }
239
239
  }
240
240
 
241
- function runPi(prompt, model, thinking, ttlMs = 0) {
241
+ function sessionKey(value) {
242
+ return String(value).replaceAll(/[^A-Za-z0-9_.-]+/g, "-");
243
+ }
244
+
245
+ function runPi(prompt, model, thinking, ttlMs = 0, sessionDir, ownerSessionId) {
242
246
  return new Promise((resolve) => {
243
247
  const args = [
244
248
  "--tools",
245
249
  "inspect,message",
246
250
  "--no-context-files",
247
251
  "--no-skills",
248
- "--no-session",
252
+ ...(sessionDir
253
+ ? [
254
+ "--session-dir",
255
+ sessionDir,
256
+ ...(ownerSessionId ? ["--session-id", ownerSessionId] : []),
257
+ ]
258
+ : ["--no-session"]),
249
259
  ];
250
260
  if (model) {
251
261
  args.push("--model", model);
@@ -346,7 +356,14 @@ async function synthesize(config, locker) {
346
356
  }
347
357
  const transcript = await readRoomTranscript(config);
348
358
  const prompt = `Synthesize this transcript into a concise Markdown artifact. Mission: ${config.mission}. Include: Title, Consensus, Roles, Protocol, Final Artifact Shape, Next Actions, Open Questions. Use only the transcript evidence below.\n\nTRANSCRIPT:\n${transcript.slice(-24000)}`;
349
- const result = await runPi(prompt, config.model, config.thinking, config.subagentTtlMs);
359
+ const result = await runPi(
360
+ prompt,
361
+ config.model,
362
+ config.thinking,
363
+ config.subagentTtlMs,
364
+ `${runStateDir(config.runId)}/sessions/coordinator-synthesis`,
365
+ config.ownerSessionId,
366
+ );
350
367
  const output = result.stdout.trim();
351
368
  const diagnostics = config.stats
352
369
  ? `\n\n## Diagnostics\n\nparticipant_attempts=${config.stats.participantAttempts}\nparticipant_success=${config.stats.participantSuccess}\nparticipant_failures=${config.stats.participantFailures}\nsynthesis_code=${result.code}\ntranscript_messages=${transcript.trim() ? transcript.split("\n").length : 0}\n`
@@ -443,7 +460,7 @@ async function updateInboxMessagesStatus(runId, branchName, ids, status) {
443
460
  });
444
461
  }
445
462
 
446
- async function executeParticipantPrompt(role, basePrompt, config) {
463
+ async function executeParticipantPrompt(role, basePrompt, config, phase) {
447
464
  const branchName = role.name;
448
465
  const queuedMessages = await claimQueuedInboxMessages(
449
466
  config.runId,
@@ -469,7 +486,14 @@ async function executeParticipantPrompt(role, basePrompt, config) {
469
486
  finalPrompt += inboxSection;
470
487
  }
471
488
 
472
- const result = await runPi(finalPrompt, config.model, config.thinking, config.subagentTtlMs);
489
+ const result = await runPi(
490
+ finalPrompt,
491
+ config.model,
492
+ config.thinking,
493
+ config.subagentTtlMs,
494
+ `${runStateDir(config.runId)}/sessions/${sessionKey(`${role.name}-${phase}`)}`,
495
+ config.ownerSessionId,
496
+ );
473
497
 
474
498
  if (claimedIds.length > 0) {
475
499
  const finalStatus = result.code === 0 ? "handled" : "failed";
@@ -488,7 +512,7 @@ async function participantRound(role, round, config) {
488
512
  const displayName = role.name;
489
513
  const address = `branch:${config.runId}/${role.name}`;
490
514
  const prompt = `You are ${displayName} (${address}), ${role.persona}. Mission: ${config.mission}. Round ${round}/${config.rounds}. First call inspect target=${config.room} view=previews lines=30 and inspect target=${config.room} view=contacts. Then call message once to ${config.room} from ${address} type=chat.message. Body: 2-4 sentences that react to a named participant, propose the next coordination step, and refine the shared artifact. Use contacts for peer names and addresses. End stdout with summary <=160 chars.`;
491
- const result = await executeParticipantPrompt(role, prompt, config);
515
+ const result = await executeParticipantPrompt(role, prompt, config, `round-${round}`);
492
516
  if (config.stats) {
493
517
  config.stats.participantAttempts += 1;
494
518
  if (result.code === 0) config.stats.participantSuccess += 1;
@@ -506,14 +530,28 @@ async function participantJoin(role, config) {
506
530
  const displayName = role.name;
507
531
  const address = `branch:${config.runId}/${role.name}`;
508
532
  const joinPrompt = `You are ${displayName}, ${role.persona}. Mission: ${config.mission}. Call tool message exactly once with to=${shellQuote(config.room)}, from=${shellQuote(address)}, type='actor.join', summary='${displayName} joined', body JSON {"role":${JSON.stringify(role.persona)},"display":${JSON.stringify(displayName)},"caps":["coordination","synthesis"],"claim":"coordinate on mission"}. Then print one short line.`;
509
- await runPi(joinPrompt, config.model, config.thinking, config.subagentTtlMs);
533
+ await runPi(
534
+ joinPrompt,
535
+ config.model,
536
+ config.thinking,
537
+ config.subagentTtlMs,
538
+ `${runStateDir(config.runId)}/sessions/${sessionKey(`${role.name}-join`)}`,
539
+ config.ownerSessionId,
540
+ );
510
541
  }
511
542
 
512
543
  async function participantLeave(role, config) {
513
544
  const displayName = role.name;
514
545
  const address = `branch:${config.runId}/${role.name}`;
515
546
  const leavePrompt = `Call tool message exactly once with to=${shellQuote(config.room)}, from=${shellQuote(address)}, type='actor.leave', summary='${displayName} left', body='finished coordinated work'. Then print goodbye.`;
516
- await runPi(leavePrompt, config.model, config.thinking, config.subagentTtlMs);
547
+ await runPi(
548
+ leavePrompt,
549
+ config.model,
550
+ config.thinking,
551
+ config.subagentTtlMs,
552
+ `${runStateDir(config.runId)}/sessions/${sessionKey(`${role.name}-leave`)}`,
553
+ config.ownerSessionId,
554
+ );
517
555
  }
518
556
 
519
557
  // 1. consensus / swarm mode: iterative chat in a room
@@ -601,7 +639,12 @@ async function runPool(config, locker) {
601
639
 
602
640
  const taskId = assignedTask.task;
603
641
  const prompt = `You are ${role.name}, ${role.persona}. You have been assigned task ${taskId}: "${assignedTask.task}". Solve it as part of the overall mission: ${config.mission}. End your response with a clear summary.`;
604
- const result = await executeParticipantPrompt(role, prompt, config);
642
+ const result = await executeParticipantPrompt(
643
+ role,
644
+ prompt,
645
+ config,
646
+ `task-${taskId}`,
647
+ );
605
648
 
606
649
  process.stdout.write(
607
650
  `[${role.name} completed ${taskId}] code=${result.code}\n${result.stdout}\n`,
@@ -711,6 +754,9 @@ if (!config.model) {
711
754
  process.exit(2);
712
755
  }
713
756
  config.room = `room:${config.runId}`;
757
+ config.ownerSessionId = String(
758
+ (await readJsonFile(`${runStateDir(config.runId)}/run.json`)).ownerId ?? "",
759
+ );
714
760
 
715
761
  const failures = [];
716
762
  const locker = await startLocker(config);
@@ -2,7 +2,7 @@
2
2
  name: actors
3
3
  description: Required practical guide for non-trivial pi-actors use, including parallel actor launches, subagent fanout, and autonomous coordinator workflows. Read before using or changing spawn, message, inspect, actor runs, tools, recipes, command templates, async lifecycle, mailboxes, artifacts, and local orchestration mechanics.
4
4
  metadata:
5
- version: 0.40.1
5
+ version: 0.41.1
6
6
  ---
7
7
 
8
8
  # Actors (pi-actors)
@@ -125,21 +125,13 @@ Views:
125
125
  - `artifacts`: declared artifact paths/status plus the same bounded owned review-evidence manifest when present.
126
126
  - `recipes` target: registry summary for active, shadowed, invalid, disabled, and diagnostic recipe entries.
127
127
 
128
- Actor inspector commands:
129
-
130
- - `/actors-inspector-toggle [rows]`: open/close the compact table or set row count; default is 12 log rows when no size is supplied.
131
- - `/actors-inspector-filter all|room|direct|broadcast|unread|branch <name>|current-branch <name>|mention <text>`: narrow table previews without changing room/run state.
132
- - `/actors-inspect <number>`: open one visible row as a full-message view.
133
-
134
- The table is compact and optimistic by default: bounded body previews, capped noisy room rows, branch-local inbox previews, stable event ids in selected-message details, and an inline roster summary in the form `name/role` that wraps only when needed. Use `unread` for queued branch inbox work and `branch <name>` / `current-branch <name>` for one branch's room/direct/inbox traffic. Rows with `metadata.requires_response=true` show a `!` attention marker. `/actors-inspect <number>` marks that row read for the current session filter. Active roster members use the target color; members that sent `actor.leave` stay visible as inactive/muted participants from the current run. Actor display names come from `actor.join` bodies (`display`) or branch addresses, keeping debugger output plain and name-driven.
135
-
136
- Let terminal notifications arrive. They queue through Pi's follow-up delivery mode, so a busy coordinator finishes its current work before receiving concurrently completed actor results; the host's `followUpMode` controls whether queued results arrive together or one at a time. When a deferred actor result gates the next step, wait for that terminal follow-up instead of scheduling continuation loops, repeatedly inspecting, or mutating the actor's reviewed scope. Idle coordinators still start a normal turn through `triggerTurn: true`. Inspect early only for an operator request, a meaningful actor event, or diagnosis of an overdue or stuck run.
128
+ Let terminal notifications arrive. They queue through Pi's follow-up delivery mode, so a busy coordinator finishes its current work before receiving concurrently completed actor results; the host's `followUpMode` controls whether queued results arrive together or one at a time. File watching accelerates delivery, while a bounded ten-second terminal-only reconciliation pass recovers missed or failed watcher activity without replaying outbox traffic; watcher degradation and rearm remain visible diagnostics. When a deferred actor result gates the next step, wait for that terminal follow-up instead of scheduling continuation loops, repeatedly inspecting, or mutating the actor's reviewed scope. Idle coordinators still start a normal turn through `triggerTurn: true`. Inspect early only for an operator request, a meaningful actor event, or diagnosis of an overdue or stuck run.
137
129
 
138
130
  ## Runtime Communication Rules
139
131
 
140
132
  - Keep one public communication model: `spawn` creates actors, `message` sends typed envelopes, and `inspect` observes. Avoid adding public side channels or storage nouns when a normal actor address/view can express the operation.
141
133
  - Keep route and semantic type separate. Direct, room, coordinator, and session messages may share `type`; delivery behavior comes from `to`.
142
- - Treat inspector-visible communication logs as recipe evidence. Use `inspect room:<run> view=messages|previews`, `inspect run:<id> view=communication`, and the actor inspector table/full-message views to improve mailbox/artifact conventions after real runs.
134
+ - Treat persisted communication logs as recipe evidence. Use `inspect room:<run> view=messages|previews` and `inspect run:<id> view=communication` to improve mailbox/artifact conventions after real runs.
143
135
  - Any UI, summary, or aggregate view that scans run directories must apply coordinator/session ownership filters before exposing summaries or body previews.
144
136
  - Treat `communication.json` as visible actor context, not a global mutable truth table. Run-level snapshots should identify the run actor; branch-local snapshots should identify the branch actor.
145
137
  - Prefer same-run provenance checks on lateral actor routes. If `from` is accepted for room or branch routes, validate that it belongs to the addressed run.
@@ -166,6 +158,8 @@ Controls:
166
158
  - `repeat`: repeated node expansion.
167
159
  - `output`: output behavior selection.
168
160
  - Command stdout/stderr use bounded tails plus complete spill files; tool/run diagnostics expose byte counts, truncation, and spill paths, while pipelines fail with `incomplete pipeline stdin` rather than consuming a partial tail.
161
+ - Detached child `pi -p` commands receive isolated session storage under `sessions/command-NNN` in their owned run state, and command evidence records any resulting JSONL files. Coordinator-managed room/swarm participants use role/phase-scoped directories under the same run-local `sessions/` root so their turns remain discoverable too. Explicit `--no-session`, `--session`, `--session-id`, `--session-dir`, or `--fork` policy remains caller-owned and is never replaced.
162
+ - Persisted child-session inspection follows the latest JSONL entry branch, correlates tool results by call id, bounds previews, and redacts common secret-bearing fields/text. Thinking content is evidence only when Pi persisted an explicit `thinking` block; never infer or advertise hidden reasoning.
169
163
 
170
164
  Placeholders:
171
165
 
@@ -2,7 +2,7 @@
2
2
  name: swarm
3
3
  description: Subagent and actor orchestration with scoped locks, fanout, and quorum consensus. Use before launching multiple parallel actors or subagents for independent implementation, artifact generation, review, delegated audit, coordinated execution, or any workflow that needs autonomous coordinator decomposition and integration.
4
4
  metadata:
5
- version: 0.40.1
5
+ version: 0.41.1
6
6
  ---
7
7
 
8
8
  # Swarm
package/docs/README.md CHANGED
@@ -9,6 +9,7 @@ Living index of all documentation in the `/docs` directory.
9
9
  - [template-recipes.md](./template-recipes.md) — Saved JSON/Markdown recipe standard, imports, and reusable command-template graph composition
10
10
  - [async-runs.md](./async-runs.md) — Detached run lifecycle, state files, actor messages, cancellation, and ambient indicators
11
11
  - [actor-messages.md](./actor-messages.md) — Actor/message protocol for symmetric communication primitives
12
+ - [actor-inspector.md](./actor-inspector.md) — Manual owned-run navigation across communication and persisted subagent turns
12
13
  - [tool-registry.md](./tool-registry.md) — Local `pi-actors` registry storage and `register_tool` adaptation
13
14
  - [recipe-library.md](./recipe-library.md) — Packaged standard recipe library such as async subagents, coordinator pipelines, utilities, and music playback
14
15
  - [task-first-recipes.md](./task-first-recipes.md) — Task-first design map for deriving high-level recipes and missing component cells
@@ -0,0 +1,77 @@
1
+ # Actor Inspector
2
+
3
+ The actor inspector is a manually opened, read-only TUI navigator for owned actor runs. It keeps communication evidence and persisted subagent execution evidence in one hierarchy without merging their meanings.
4
+
5
+ ```text
6
+ owned run
7
+ → messages | turns
8
+ → filtered timeline
9
+ → bounded detail
10
+ ```
11
+
12
+ ## Navigation
13
+
14
+ `/actors-inspector` opens one centered overlay and remains the only command to remember. The latest run owned by the current Pi session becomes active automatically; an empty session still exposes functional tabs and filters.
15
+
16
+ The overlay exposes an explicit focus hierarchy:
17
+
18
+ ```text
19
+ Run ←/→ chooses the previous/next owned run, Enter opens runs, ↓ enters tabs
20
+ Tabs ←/→ chooses Messages or Turns, Enter opens filter parameters
21
+ Filters ↑/↓ chooses Channel/State or Subagent, Enter opens values to the right
22
+ Values ↑/↓ hovers, Enter applies, Escape returns one menu level
23
+ List ↑/↓ chooses, Enter/→ opens detail
24
+ Detail ↑/↓ scroll, Enter/→ opens readable transcript, Escape/← returns
25
+ Readable ↑/↓ scroll, Escape/← returns to evidence detail
26
+ Escape Close (or cancel the active options popup)
27
+ ```
28
+
29
+ Navigation stays bounded by available actions. `↑` on Run does nothing because no higher control exists. `↓` on Tabs enters the timeline only when it contains rows. Empty timelines therefore never receive focus.
30
+
31
+ Selection and focus remain separate visual states. Accent-blue text marks the current tab, active filter popup, and applied option. The Run control uses `← … →` markers plus a light neutral background to show both focus and horizontal cycling; menus and timeline rows retain the single `▶` focus marker, while selected tabs retain brackets. Opening a popup keeps its parent filter blue so the relationship remains visible. The footer uses accent color only for key names and arrows; descriptions remain muted.
32
+
33
+ The top Run control aligns vertically with the tab labels, names the selected owned run, and colors its textual lifecycle status semantically. ←/→ cycles owned runs directly with wraparound, while Enter opens the complete owned-run list immediately beneath the control. That run list starts one cell farther left than the filter menus so its border aligns with the Run control rather than the tab/filter grid. It still overlays the tab row rather than leaving a detached gap. The timeline no longer renders run metadata as a data row.
34
+
35
+ Filters live behind their tab rather than occupying a permanent row. Non-default filters remain visible as compact parenthesized suffixes in the tab label, so hidden state never silently changes the timeline. Enter on Messages opens `Channel: <current>`, `State: <current>`, and `From: <current>`; `From` draws its values from the selected run's roster and limits rows to one actor. Enter on Turns opens `Subagent: <current>`. Enter on a parameter opens its alternative values as a second menu to the right while the parent and current value remain visible. Parent and child share their touching border rather than leaving or doubling a spacer column. Escape returns one level at a time. Moving focus never applies a value.
36
+
37
+ Nested menus overlay rather than replace the timeline. Only rows and columns containing menu borders or values occlude underlying cells. When adjacent menus have different heights, the unused corner remains transparent and preserves the separator, striped background, and timeline data beneath it. Every run, filter, and nested value menu is viewport-bounded: ↑/↓ moves through the complete option set, the visible window follows focus, and `↑`/`↓` border markers disclose hidden options above or below without growing past the available inspector rows.
38
+
39
+ The overlay uses most of the available terminal width and height and reduces its content/menu viewport on shorter terminals. The bordered header keeps both tabs visible, while the list body shows the selected run and its current status above the evidence rows. Run, Message, and Turn lists place the newest retained item directly below their control; a newly opened Inspector therefore selects the latest owned run, and ↓ moves backward in time toward older entries. Run options, Messages, and Turns all use compact descending `#N` labels, providing one timestamp-free time axis without repeating type words on every row. Evidence rows retain stable alternating backgrounds based on their absolute timeline position, including while scrolling: even rows keep the dark overlay background, while odd rows use the neutral `customMessageBg` stripe. Unused viewport padding stays on the plain overlay background instead of drawing fake striped rows beneath the last item. The footer exposes the active keys. Messages retain attention markers and unread filtering and open into bounded detail without leaving the overlay. The overlay refreshes while visible and distinguishes true empty timelines from filtered-empty results; filtered-empty copy points back to Enter on the active tab without moving focus.
40
+
41
+ ## Communication Timeline
42
+
43
+ The communication timeline reads run-local room, direct, branch-inbox, and coordinator/session message evidence. Rows display their stable `#N` sequence in newest-first order. It preserves channel/sender filters, unread state, attention markers, roster-derived sender options, and bounded body previews. Unread remains filterable but does not consume a row column with a separate dot marker.
44
+
45
+ Communication evidence describes messages between actors. It does not prove model execution.
46
+
47
+ ## Turns Timeline
48
+
49
+ Detached child `pi -p` commands receive isolated session storage under their owned run state:
50
+
51
+ ```text
52
+ <run-state>/sessions/command-NNN/*.jsonl
53
+ ```
54
+
55
+ The runner records direct command-template session files in `review-evidence.json`. Coordinator-managed room/swarm participants also persist role/phase-scoped directories under the same `sessions/` root; the inspector discovers those owned files even though the coordinator, rather than the command-template runner, launched them. Explicit caller session policy (`--no-session`, `--session`, `--session-id`, `--session-dir`, or `--fork`) remains authoritative and is not replaced. A command may therefore have no inspector-visible session.
56
+
57
+ The turns timeline follows the latest persisted entry branch in each recorded Pi session and displays numbered turns newest-first. Each list row begins with compact `#N`, then a humanized `Subagent N` derived from the internal `command-NNN` session owner, followed by an optional parenthesized semantic stage such as `(reviewer)`. The internal command id remains available in evidence detail for provenance but no longer acts as the unexplained primary list label. The visible model column shows only the model id, not its provider. Tool activity appears as a compact parenthesized action summary such as `(read)`, `(read, bash)`, or `(3 tools)`; `(error)` appears only when the turn or a tool result failed.
58
+
59
+ Each turn groups:
60
+
61
+ - User input associated with the response;
62
+ - Assistant text and host-persisted thinking blocks;
63
+ - Model, stop reason, usage, and error metadata;
64
+ - Tool calls in assistant source order;
65
+ - Tool results correlated by `toolCallId`, regardless of completion order.
66
+
67
+ Enter/→ opens the selected turn as structured evidence inside the overlay. A compact `Subagent N` heading with an optional meaningful role leads into meaning-first sections: User, persisted Thinking, Assistant, Tools, Execution, and Diagnostics. A final Provenance section retains session/prompt paths, truncation state, and recipe context without making transport metadata the first screen. Generic internal stages such as `command` and `subagent` stay hidden; technical `command-NNN` provenance remains available through the session and prompt paths without producing a redundant `Command / command-NNN (command)` block. Secondary qualifiers use parentheses rather than centered-dot separators. Long text, paths, and structured values wrap to subsequent terminal rows instead of receiving visual ellipsis; lines that already fit the available inner width remain intact, leading indentation is reserved before wrapping long unbroken paths so it cannot become a whitespace-only row, and every section plus all of its explicit or wrapped continuations keeps one background stripe. Blank-only source lines and trailing line breaks are omitted from both evidence and readable rendering. Section boundaries change the stripe without inserting separator rows, so the next heading follows the previous value immediately. ↑/↓ scrolls the resulting visual-row document while the footer remains visible. Source evidence remains bounded by the persisted session reader, but the detail view no longer truncates that retained evidence to one terminal row per field.
68
+
69
+ Enter/→ once more opens a plain readable transcript of the same turn. This second level removes provenance, model, usage, ids, and other evidence metadata, retaining only User, Thinking when persisted, Assistant, Tool input/result, and Error content in execution order. When Pi persisted the user prompt as one `<file name="…">…</file>` transport wrapper, readable mode removes that wrapper and shows only its actual prompt text. Structured values render as indented key/value text rather than one-line JSON. Escape/← returns from transcript to evidence detail, then from evidence detail to the Turns list.
70
+
71
+ ## Evidence And Privacy Boundary
72
+
73
+ The inspector reads file-backed evidence; it does not reconstruct hidden provider reasoning or claim access to data Pi did not persist. When no explicit thinking block exists, Execution reports `thinking: not persisted`.
74
+
75
+ Session text, communication bodies, and structured values remain bounded. Common secret-bearing keys, camelCase/private-key credentials, serialized JSON credentials, and inline credential patterns are redacted before rendering. Malformed JSONL lines, missing parents, cycles, missing sessions, and incomplete tool correlation remain diagnostic states rather than inferred data.
76
+
77
+ Ownership filtering happens before run summaries, communication previews, roster data, or session evidence become visible. Selection and read state reset across Pi sessions. Manifest session paths must resolve canonically beneath the selected owned run's `sessions/` directory; absolute paths, traversal, and symlink escapes remain invisible. The inspector never scans another coordinator session's run state into the current view.
@@ -218,7 +218,7 @@ Runtime wake notifications are now modeled separately from durable queues. Messa
218
218
 
219
219
  The launching coordinator should not busy-poll long-running async runs. The extension watches run state directories and queues terminal `done`/`failed`/unhandled `killed`/`exited` transitions back to the owning session through Pi's `followUp` delivery mode with `triggerTurn: true`; a busy coordinator finishes its current work before queued actor results arrive, while an idle coordinator starts a normal turn without a racy manual idle check. Pi's configured `followUpMode` determines whether concurrently queued results arrive together or one at a time. Script-authored `notify`/`followup` actor messages still follow their declared outbox delivery policy. Terminal notifications include recipe-level named `artifacts` when declared. The generic runner also emits compact `command.done` actor messages for completed leaf commands; recipe authors declare that capability in `mailbox.emits` rather than configuring a separate delivery policy. Failures and in-flight parallel branch completions can bubble according to outbox policy, while successful final leaf completions stay diagnostic to avoid flooding long sequential pipelines. Intentional `control.kill` and recipe-local stop commands stay out of coordinator context because the initiating message already returns synchronously or is handled by actor-local policy. If a notification asks for direction, answer with `message` rather than starting a polling loop. Use explicit `inspect` only when a delivered notification requests inspection, a real decision depends on state, or a suspected stuck run needs diagnosis — never merely because a timeout elapsed.
220
220
 
221
- Ambient status indicators may refresh while work is active, but coordinator attention is driven from run-state changes rather than a coordinator agent loop. This lets the coordinator continue other work after `spawn`; the run signals back through lifecycle state, results, and actor messages. An owned terminal run without `terminal-handled.json` remains retry-eligible during same-runtime and extension/session replacement reconciliation; the marker is written only after successful follow-up delivery, and initial reconciliation does not replay historical outbox traffic. This is an at-least-once contract: a process crash after send but before marker persistence can produce a duplicate notification, while a failed send remains durably retryable. The ambient triangle count represents active async work units: each running async run contributes at least one triangle, and a run with multiple active parallel command/subagent branches contributes the reported active branch count. If a coordinator starts one parent run with four active parallel branches, four triangles are shown; if the same coordinator starts five independent single-branch runs, five triangles are shown.
221
+ Ambient status indicators may refresh while work is active, but coordinator attention is driven from run-state changes rather than a coordinator agent loop. This lets the coordinator continue other work after `spawn`; the run signals back through lifecycle state, results, and actor messages. File-system watchers accelerate live discovery, while a bounded ten-second terminal-only reconciliation pass scans owned unhandled terminal state without reading or replaying outbox traffic. Failed root or run-directory watcher attachment, runtime errors, error-driven watcher removal, and successful rearm remain available as bounded runtime diagnostics; normal run-directory deletion stays quiet; reconciliation rearms degraded watchers but does not depend on them. An owned terminal run without `terminal-handled.json` remains retry-eligible during same-runtime and extension/session replacement reconciliation; the marker is written only after successful follow-up delivery, and initial reconciliation does not replay historical outbox traffic. Watch-triggered and periodic delivery share an in-flight guard so one live runtime sends one follow-up when both paths race. This is an at-least-once contract: a process crash after send but before marker persistence can produce a duplicate notification, while a failed send remains durably retryable. The ambient triangle count represents active async work units: each running async run contributes at least one triangle, and a run with multiple active parallel command/subagent branches contributes the reported active branch count. If a coordinator starts one parent run with four active parallel branches, four triangles are shown; if the same coordinator starts five independent single-branch runs, five triangles are shown.
222
222
 
223
223
  ## Run Actor Messages
224
224