@llblab/pi-actors 0.40.0 → 0.41.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/AGENTS.md +3 -3
- package/BACKLOG.md +22 -1
- package/CHANGELOG.md +31 -0
- package/README.md +5 -4
- package/dist/index.js +30 -51
- package/dist/lib/inspector-overlay.d.ts +84 -0
- package/dist/lib/inspector-overlay.js +627 -0
- package/dist/lib/inspector.d.ts +17 -33
- package/dist/lib/inspector.js +98 -151
- package/dist/lib/limits.d.ts +3 -0
- package/dist/lib/limits.js +3 -0
- package/dist/lib/observability.d.ts +1 -1
- package/dist/lib/observability.js +2 -2
- package/dist/lib/pi.d.ts +1 -1
- package/dist/lib/pi.js +2 -2
- package/dist/lib/prompts.d.ts +1 -1
- package/dist/lib/prompts.js +3 -3
- package/dist/lib/recipes-context.d.ts +5 -0
- package/dist/lib/recipes-context.js +15 -0
- package/dist/lib/session-evidence.d.ts +45 -0
- package/dist/lib/session-evidence.js +204 -0
- package/dist/lib/tools-response.d.ts +3 -0
- package/dist/lib/tools-response.js +31 -0
- package/dist/scripts/async-runner.mjs +40 -5
- package/dist/scripts/coordinator.mjs +55 -9
- package/dist/skills/actors/SKILL.md +10 -9
- package/dist/skills/swarm/SKILL.md +4 -2
- package/docs/README.md +1 -0
- package/docs/actor-inspector.md +72 -0
- package/docs/async-runs.md +2 -2
- package/index.ts +32 -63
- package/lib/inspector-overlay.ts +735 -0
- package/lib/inspector.ts +132 -204
- package/lib/limits.ts +3 -0
- package/lib/observability.ts +3 -3
- package/lib/pi.ts +3 -3
- package/lib/prompts.ts +3 -3
- package/lib/recipes-context.ts +25 -0
- package/lib/session-evidence.ts +302 -0
- package/lib/tools-response.ts +33 -0
- package/package.json +1 -1
- package/scripts/async-runner.mjs +40 -5
- package/scripts/coordinator.mjs +55 -9
- package/skills/actors/SKILL.md +10 -9
- package/skills/swarm/SKILL.md +4 -2
package/AGENTS.md
CHANGED
|
@@ -43,7 +43,7 @@ Pi host
|
|
|
43
43
|
- `recipes-references.ts`, `recipes-discovery.ts`, `recipes-usage.ts`: recipe graph, discovery, and usage metadata.
|
|
44
44
|
- `async-runs.ts`: detached run lifecycle facade; `runs-*` subdomains own artifacts, start guards, status, indexes, inbox/outbox, delivery, process control, and retention internals.
|
|
45
45
|
- `runtime-notifier.ts`, `mailbox-loop.ts`: wake notifications and reusable run/branch mailbox worker loops.
|
|
46
|
-
- `messages.ts`, `rooms.ts`, `recipes-context.ts`, `inspector.ts`, `observability.ts`: addressed message protocol, rooms, recipe prompt context,
|
|
46
|
+
- `messages.ts`, `rooms.ts`, `recipes-context.ts`, `session-evidence.ts`, `inspector.ts`, `inspector-overlay.ts`, `observability.ts`: addressed message protocol, rooms, recipe prompt context, bounded/redacted child-session turns, inspector evidence/navigation, keyboard-driven overlay UI, and ambient run status.
|
|
47
47
|
- `prompts.ts`, `temp.ts`: LLM-facing copy and temp cleanup.
|
|
48
48
|
- `tools.ts`: public tool family composition and reserved tool names.
|
|
49
49
|
- `tools-message.ts`: public `message` tool behavior, including run controls, branch/room routing, tool actor invocation, and delivery feedback.
|
|
@@ -107,8 +107,8 @@ Pi host
|
|
|
107
107
|
- Preserve node controls: `when`, positive `timeout`, `delay`, bounded `retry`, `failure`, and `recover` cleanup.
|
|
108
108
|
- Persist every async command's complete byte-exact stdout/stderr under command- and retry-specific run-state paths while keeping returned tails bounded and pipeline stdin complete.
|
|
109
109
|
- Keep async run state under `~/.pi/agent/tmp/pi-actors/runs` with injected `{run_id}` and `{state_dir}` values.
|
|
110
|
-
- Preserve event-driven observability: durable retrying terminal
|
|
111
|
-
- When a deferred actor result gates the next step, wait for its terminal
|
|
110
|
+
- Preserve event-driven observability: durable retrying terminal follow-up notifications, coordinator-bound outbox messages, branch-aware triangles, process-tree expansion, and bounded body previews. Queue coordinator context through Pi follow-up delivery rather than steering so current work finishes before async results arrive and host follow-up batching policy can combine concurrent completions. Terminal delivery is at-least-once across the unavoidable send/handled-marker crash window.
|
|
111
|
+
- When a deferred actor result gates the next step, wait for its terminal follow-up. Do not schedule continuation loops, repeatedly inspect, or mutate its reviewed scope while it runs; inspect early only on operator request, meaningful actor event, or diagnosis of an overdue/stuck run.
|
|
112
112
|
- Do not restore busy-polling examples, duplicate terminal notifications, or duplicate notifications for handled `cancel`, `kill`, or control-stop actions.
|
|
113
113
|
|
|
114
114
|
## Recipes And Registry
|
package/BACKLOG.md
CHANGED
|
@@ -39,7 +39,28 @@ Non-goals:
|
|
|
39
39
|
|
|
40
40
|
## Open Work
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
### Manual draft-memory consolidation
|
|
43
|
+
|
|
44
|
+
- [ ] Add a manually invoked command that launches an agent-led consolidation cycle over `~/.pi/agent/recipes/drafts`. The cycle must inventory and classify every draft, propose a complete `promote`, `merge`, or `discard` plan, require explicit operator confirmation before mutations, normalize approved reusable capabilities into active recipe-backed tools under `~/.pi/agent/recipes`, and remove every handled source so the drafts directory finishes empty. It must never run automatically or promote tools silently; preserve evidence for each decision and add regressions for plan-only, confirmation, promotion, merge, discard, failure recovery, and empty-directory completion.
|
|
45
|
+
|
|
46
|
+
### Overlay actor inspector
|
|
47
|
+
|
|
48
|
+
- [ ] Replace the command-driven inspector workflow with one large keyboard-driven overlay while preserving the compact striped information design. Stop conditions: `/actors-inspector-toggle` only toggles the overlay; an operator can select an owned run and subagent, switch `Messages` / `Turns` tabs, navigate rows, open/close detail, scroll bounded content, and understand keys/current scope without entering subcommands.
|
|
49
|
+
- [x] Close the dogfood security prerequisites: reset selection across Pi sessions, revalidate ownership before every selected-run read, contain session evidence beneath the owned run state, broaden structured/text redaction, and add regressions.
|
|
50
|
+
- [x] Build the centered responsive overlay shell with bordered header/footer, tabs, owned-run/subagent selector, active-scope summary, empty/loading/error states, and Escape close.
|
|
51
|
+
- [x] Move compact striped Messages rows, filters, unread filtering/attention markers, roster context, and row detail into keyboard navigation.
|
|
52
|
+
- [x] Move Turns rows and full bounded provenance/tool detail into keyboard navigation with scrolling and explicit persisted/unavailable reasoning labels.
|
|
53
|
+
- [x] Remove the subcommand grammar and below-editor widget lifecycle, retain only the toggle command, and document discoverable key hints plus responsive behavior.
|
|
54
|
+
- [ ] Run full package, conformance, and context validation, then close this item. Component input/render/width/scroll/tab/ownership/live-refresh regressions and iterative manual TUI dogfood now cover the accepted visual interaction contract.
|
|
55
|
+
|
|
56
|
+
### Inspector execution observability
|
|
57
|
+
|
|
58
|
+
- [x] Consolidate the actor inspector into one manually opened, navigable operator surface for communication and execution evidence. Stop conditions: an operator can choose an owned run/subagent, switch between communication and turn timelines, open one bounded detail view, and inspect every persisted user/assistant/tool-result turn in source order without exposing another session or claiming unavailable hidden reasoning.
|
|
59
|
+
- [x] Persist deterministic Pi session provenance for each child `pi -p` command under its owned run state, without overriding an explicitly supplied session policy; record the session path in command evidence and tolerate commands that never create a session.
|
|
60
|
+
- [x] Add a resilient, bounded session-evidence reader that follows the active JSONL entry branch, groups assistant responses with correlated tool calls/results into turns, preserves model/usage/error metadata, redacts sensitive argument/content fields, and reports malformed or incomplete evidence honestly.
|
|
61
|
+
- [x] Replace communication-specific inspector controller state with a shared navigation model: run selector → `communication` or `turns` timeline → numbered detail, with stable back/toggle/filter behavior and useful empty states for actors that never send messages.
|
|
62
|
+
- [x] Render compact turn rows and bounded manual detail views for effective prompt/context references, assistant text, host-exposed thinking blocks, tool arguments/results, model/usage, and source-file provenance; label missing reasoning as unavailable rather than inferred.
|
|
63
|
+
- [x] Add ownership, truncation, redaction, malformed JSONL, active-branch ordering, tool correlation, parallel tool completion, terminal run, coordinator-launched subagent, and communication-navigation regressions; update the Actors skill and inspector documentation after the interaction contract stabilizes.
|
|
43
64
|
|
|
44
65
|
## Backlog Curation Rules
|
|
45
66
|
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.41.0: Actor Inspector Overlay and Execution Observability
|
|
6
|
+
|
|
7
|
+
- `[Inspector Menu Alignment]` Shifted value submenus one cell left so adjacent levels share a border, aligned Run and tab labels to one vertical grid, and made the Run dropdown begin immediately below Run by overlaying the tab row. Impact: nested menus read as one connected hierarchy and every top-level control follows the same anchored dropdown rhythm.
|
|
8
|
+
- `[Inspector UX Polish]` Applied the shared focus treatment (`▶`, accent text, neutral background) to timeline rows, exposed non-default filters as compact tab-label suffixes, gave run lifecycle status semantic text color, and split true-empty from filtered-empty guidance. Impact: focus no longer changes visual language between controls and data, hidden filter state stays visible, and empty results explain whether data or the current query is absent.
|
|
9
|
+
- `[Inspector Detail Navigation]` Made Enter/→ open a focused timeline row and Escape/← return from detail; horizontal arrows no longer switch tabs from list focus. Updated contextual footer hints accordingly. Impact: nested list/detail navigation follows the same forward/backward key model as menus, while tab switching remains scoped to tab focus.
|
|
10
|
+
- `[Inspector Message Sender Filter]` Added `From: <actor>` to the Messages filter menu, populated from the selected run's roster, with `all` as the default. Impact: operators can isolate communication emitted by one actor while seeing the current sender scope before opening its values.
|
|
11
|
+
- `[Inspector Nested Menu Context]` Added current values to parent filter items (`Channel: value`, `State: value`, `Subagent: value`) and made unused corners between differently sized parent/value menus transparent to the striped timeline beneath. Impact: operators see filter state before opening alternatives, and nested overlays occlude only useful menu cells.
|
|
12
|
+
- `[Inspector Run And Filter Menus]` Added a top-level owned-run selector with live status, removed run metadata from timeline rows, and moved filters behind Enter on each tab. Filter parameters now open a second value submenu to the right while preserving the parent menu and one-level Escape navigation. Impact: run context stays explicit, the permanent filter row disappears, and Messages/Turns gain compact graphical two-level settings menus.
|
|
13
|
+
- `[Inspector Selection Markers]` Use stable blue brackets for selected Run/tab controls and reserve `▶` for focused menus, values, and timeline rows. Added a direct regression that verifies even timeline rows stay on the dark overlay surface while odd rows receive the neutral stripe background. Impact: selection and focus remain distinct without layout shifts or color-only meaning.
|
|
14
|
+
- `[Inspector List Navigation]` Restored stable even/odd striping by absolute timeline position, made Enter/→ open row detail, and made Escape/← return to the list, with contextual footer hints. Impact: row grouping remains visually stable while scrolling and horizontal navigation follows the same forward/back model as nested menus.
|
|
15
|
+
- `[Inspector Visual Contract]` Stabilized the dogfooded interaction model around top-bounded tabs, availability-aware filter/list navigation, blue current values, neutral focus backgrounds, key-colored footer hints, and filter-anchored nested option overlays that preserve underlying separator and timeline cells outside their rectangle. Impact: the TUI now behaves like a compact graphical tab/filter/select surface instead of a command panel.
|
|
16
|
+
- `[Inspector Naming]` Renamed the `Communications` tab to `Messages`. Impact: the tab now describes its concrete contents with a shorter label that balances visually with `Turns`.
|
|
17
|
+
- `[Inspector Filter UI]` Removed the permanent filter bar in favor of compact tab-anchored parameter/value menus that show current values, preserve the striped timeline beneath unused cells, and expose active non-default filters in the tab label. Impact: filtering stays visible and keyboard-driven without consuming a permanent content row.
|
|
18
|
+
- `[Inspector Turns UI]` Moved turn browsing and detail into the overlay with scrolling viewports, all/single-subagent scope, compact model/tool-count rows, and Enter-opened bounded provenance, prompt/context, user/assistant, persisted-thinking, usage/error, tool argument/result, truncation, and diagnostic evidence. Impact: operators can follow one subagent's complete persisted execution path without commands or leaving the overlay.
|
|
19
|
+
- `[Inspector Messages UI]` Moved message browsing into the overlay with compact striped routes/types/body previews, attention markers, unread/channel/sender filters, roster-derived From options, and bounded detail. Impact: actor communication investigation stays keyboard-driven and discoverable without consuming a row for unread dots or command grammar.
|
|
20
|
+
- `[Inspector Focus Navigation]` Added explicit Run/Tabs/Menu/List/Detail focus zones with availability-aware boundaries, blue selected values, brackets for top-level selection, triangles for focused rows, and contextual key hints. Impact: navigation always has one visible owner and moving focus never mutates filter state.
|
|
21
|
+
- `[Inspector Overlay Integrity]` Normalized persisted tabs and line breaks before every component row is handed to the overlay compositor. Impact: multiline actor messages, prompts, and turn text can no longer escape their assigned row and corrupt the underlying terminal layout during tab navigation.
|
|
22
|
+
- `[Inspector Overlay]` Replaced inspector subcommand handling with `/actors-inspector-toggle`, which opens a centered responsive overlay featuring Run selection, Messages/Turns tabs, nested filters, compact alternating rows, live refresh, distinct empty states, bounded detail, footer key hints, and Escape close. Removed the superseded command controller and below-editor widget lifecycle. Impact: operators can browse execution evidence without memorizing command grammar, and runtime state now has one authoritative UI path.
|
|
23
|
+
- `[Inspector Security]` Reset inspector selection/read state at every Pi session start, revalidate selected-run ownership before turn or roster reads, reject absolute/traversing/symlinked session evidence outside the owned run, and broaden structured/text plus communication-body redaction for common camelCase/private-key credentials. Impact: the upcoming overlay cannot inherit another session's selected evidence or escape its run boundary through mutable manifests.
|
|
24
|
+
- `[Coordinator Turn Provenance]` Replaced coordinator-managed room/swarm subagents' `--no-session` launches with isolated role/phase session directories under the owned run and made the inspector discover those JSONL files alongside command evidence. Impact: manual turn navigation covers coordinator-spawned participants and synthesis actors, not only direct recipe `pi -p` leaves.
|
|
25
|
+
- `[Inspector Turn Detail]` Added bounded manual turn detail for command/stage identity, session and prompt provenance, recipe context, user/assistant text, persisted thinking, stop reason, usage, errors, correlated tool arguments/results, unmatched results, truncation, and parse diagnostics. Impact: operators can inspect what each subagent actually received, produced, and called while missing reasoning stays explicitly unavailable and secret-bearing values remain redacted.
|
|
26
|
+
- `[Turn Evidence]` Added a resilient bounded reader for persisted child Pi sessions that follows the latest JSONL entry branch, groups assistant responses with correlated tool calls/results, retains model/usage/error and host-visible thinking metadata, redacts common secret-bearing fields/text, and diagnoses malformed or incomplete evidence. Impact: inspector navigation can consume one tested turn model instead of parsing raw session files or implying access to unavailable reasoning.
|
|
27
|
+
- `[Execution Observability]` Give every child `pi -p` command an isolated session directory under its owned run state unless the recipe already supplies explicit session policy, and record any resulting JSONL files in command events and review evidence. Impact: the inspector can attribute future turn/tool timelines to exact subagent commands without guessing from global session directories, while `--no-session`, resume, fork, and caller-owned session storage remain authoritative.
|
|
28
|
+
- `[Tool Output]` Separate every pi-actors tool result and thrown error from its rendered tool-call header with one blank line, including core `spawn`, `message`, `inspect`, `register_tool`, and recipe-backed tools. Impact: successful and failed calls remain visually scannable instead of running into the header.
|
|
29
|
+
|
|
30
|
+
## 0.40.1: Follow-up Delivery Hotfix
|
|
31
|
+
|
|
32
|
+
- `[Coordinator Delivery]` Queue terminal and coordinator-bound actor notifications through Pi's `followUp` delivery mode instead of `steer`, while retaining `triggerTurn: true` for idle sessions. Impact: active coordinators finish their current work before actor results arrive, and Pi can apply its configured follow-up batching policy to concurrently completed runs instead of injecting each result between tool calls.
|
|
33
|
+
- `[Agent Autonomy]` Clarified in the injected prompt and bundled Actors skill that command-template strings execute directly without shell evaluation, so `&&`, pipes, redirects, and `cd` do not provide shell composition. Strengthened both skill descriptions and added explicit Swarm activation for multiple parallel actors, independent artifact generation, implementation fanout, and review; the coordinator now receives a compact preflight contract for disjoint scopes, stable run ids, artifacts, launch correctness, integration, and final validation. Impact: agents avoid malformed launches such as `cd <dir> && pi ...` and autonomously load the right orchestration guidance before multi-actor work.
|
|
34
|
+
- `[CI Stability]` Wait for the detached runner process to exit before removing the large-review-evidence fixture directory, and wait for the terminal evidence manifest instead of racing its final write. Impact: Linux CI cleanup no longer intermittently fails with `ENOTEMPTY` after the assertions pass.
|
|
35
|
+
|
|
5
36
|
## 0.40.0: Durable Review and Runtime Hardening
|
|
6
37
|
|
|
7
38
|
- `[Runtime]` Collapsed every natural-language positional fragment in child `pi -p` launches into one inspectable prompt file while preserving Pi options and intentional `@file` attachments, so review stages receive one authoritative user turn and preflight diagnostics resolve the concrete stage.
|
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ Use actors instead of ad hoc shell backgrounding when work is long-running, stat
|
|
|
65
65
|
Start an actor:
|
|
66
66
|
|
|
67
67
|
```text
|
|
68
|
-
spawn template="sleep 30
|
|
68
|
+
spawn template="sleep 30" as=run:demo
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
Inspect it when you need evidence:
|
|
@@ -125,13 +125,13 @@ Routing comes from `to`, actor ownership, and runtime policy. `type` describes i
|
|
|
125
125
|
| --- | --- | --- |
|
|
126
126
|
| Command templates | Portable command graphs with placeholders, defaults, guards, retries, parallel nodes, recovery, and timeouts | Wrap a trusted local executable without writing a bespoke tool |
|
|
127
127
|
| Recipes | JSON/Markdown capability specs with metadata, args, defaults, imports, mailbox contracts, artifacts, and async mode | Save a known-good local workflow as reusable muscle memory |
|
|
128
|
-
| Async runs | File-backed detached lifecycle, logs, progress, output, cancellation, artifacts, and durable terminal
|
|
128
|
+
| Async runs | File-backed detached lifecycle, logs, progress, output, cancellation, artifacts, and durable terminal follow-up notifications | Let model work, media jobs, services, or pipelines continue after the turn |
|
|
129
129
|
| Message protocol | Typed envelopes across run, tool, branch, room, coordinator, and session targets | Continue, approve, kill, or route work without restarting actors |
|
|
130
130
|
| Rooms and rosters | Run-local group timeline with actor join/leave, contacts, previews, and branch-aware delivery | Coordinate multiple subagents under one visible run |
|
|
131
131
|
| Registry and recipe doctor | Discovered tools, overrides, drafts, invalid recipes, and advisory risk labels | Audit local capability memory before using or promoting it |
|
|
132
132
|
| Draft promotion | Captured ad hoc spawn patterns can become explicit recipes after operator approval | Turn successful improvisation into durable local tools |
|
|
133
133
|
| Review/swarm recipes | Maintained packaged pipelines with preflight, marked semantic evidence, quorum knobs, model/thinking inheritance, one-turn prompt-file transport, and diagnostics | Delegate reviews without rebuilding fanout commands |
|
|
134
|
-
| Actor inspector |
|
|
134
|
+
| Actor inspector | One manual `Messages or Turns → filtered timeline → detail` overlay for owned actor messages and persisted subagent sessions, with bounded/redacted prompt, model, thinking, tool, result, usage, and provenance evidence | Follow actor traffic and every persisted subagent turn without exposing another session or inventing hidden reasoning |
|
|
135
135
|
| Packaged recipe QA | Installed-package-safe checks for helper paths, mailbox contracts, platform scope, artifacts, and recipe structure | Keep shipped actor components executable and diagnosable |
|
|
136
136
|
|
|
137
137
|
## Golden path: from local workflow to actor memory
|
|
@@ -275,7 +275,7 @@ Packaged recipes are building blocks. Use `spawn file=<recipe>` for maintained p
|
|
|
275
275
|
| A useful output that should survive context compression | Artifacts |
|
|
276
276
|
| A repeated local workflow | Recipe/tool memory |
|
|
277
277
|
|
|
278
|
-
When a directly spawned inline/ad hoc actor or a recipe outside the user recipe root completes successfully, `pi-actors` may include a promotion suggestion in its terminal
|
|
278
|
+
When a directly spawned inline/ad hoc actor or a recipe outside the user recipe root completes successfully, `pi-actors` may include a promotion suggestion in its terminal follow-up notification. The agent should ask first and never auto-save.
|
|
279
279
|
|
|
280
280
|
## Platform support
|
|
281
281
|
|
|
@@ -340,6 +340,7 @@ Core docs:
|
|
|
340
340
|
- [Template recipes](./docs/template-recipes.md)
|
|
341
341
|
- [Async runs](./docs/async-runs.md)
|
|
342
342
|
- [Actor messages](./docs/actor-messages.md)
|
|
343
|
+
- [Actor inspector](./docs/actor-inspector.md)
|
|
343
344
|
- [Tool registry](./docs/tool-registry.md)
|
|
344
345
|
- [Recipe library](./docs/recipe-library.md)
|
|
345
346
|
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as AsyncRuns from "./lib/async-runs.js";
|
|
8
8
|
import * as CommandTemplates from "./lib/command-templates.js";
|
|
9
|
-
import * as
|
|
9
|
+
import * as InspectorOverlay from "./lib/inspector-overlay.js";
|
|
10
10
|
import * as Observability from "./lib/observability.js";
|
|
11
11
|
import * as Paths from "./lib/paths.js";
|
|
12
12
|
import * as Pi from "./lib/pi.js";
|
|
@@ -14,13 +14,13 @@ import * as Prompts from "./lib/prompts.js";
|
|
|
14
14
|
import * as Runtime from "./lib/runtime.js";
|
|
15
15
|
import * as Temp from "./lib/temp.js";
|
|
16
16
|
import * as Tools from "./lib/tools.js";
|
|
17
|
+
import * as ToolsResponse from "./lib/tools-response.js";
|
|
17
18
|
export default function toolRegistryExtension(pi) {
|
|
18
19
|
let runsAnimationInterval;
|
|
19
20
|
let runsNotifyTimeout;
|
|
20
21
|
let activeRunContext;
|
|
21
22
|
const runUi = Observability.createRunUiObservationState();
|
|
22
23
|
const retirementAttempts = new Set();
|
|
23
|
-
const actorInspector = Inspector.createActorInspectorControllerState();
|
|
24
24
|
const getRunOwnerId = Pi.getSessionId;
|
|
25
25
|
const retireCandidateRuns = (ctx, summary) => {
|
|
26
26
|
void Observability.executeRunRetirements(summary, {
|
|
@@ -34,28 +34,6 @@ export default function toolRegistryExtension(pi) {
|
|
|
34
34
|
const ownerId = getRunOwnerId(ctx);
|
|
35
35
|
const snapshot = Observability.readRunUiSnapshot(runUi, ownerId);
|
|
36
36
|
ctx.ui.setStatus("zz-pi-actors-runs", snapshot.status ? ctx.ui.theme.fg("dim", snapshot.status) : undefined);
|
|
37
|
-
ctx.ui.setWidget("zz-pi-actors-comms", actorInspector.visible
|
|
38
|
-
? () => ({
|
|
39
|
-
invalidate() { },
|
|
40
|
-
render(width) {
|
|
41
|
-
return Inspector.renderActorInspectorPanel({
|
|
42
|
-
stateRoot: Paths.EXTENSION_RUNTIME_PATHS.runStateRoot,
|
|
43
|
-
state: actorInspector,
|
|
44
|
-
ownerId,
|
|
45
|
-
width,
|
|
46
|
-
style: {
|
|
47
|
-
actor: (text) => ctx.ui.theme.fg("accent", text),
|
|
48
|
-
muted: (text) => ctx.ui.theme.fg("dim", text),
|
|
49
|
-
preview: (text) => ctx.ui.theme.fg("text", text),
|
|
50
|
-
stripe: (text) => text,
|
|
51
|
-
stripeAlt: (text) => ctx.ui.theme.bg("customMessageBg", text),
|
|
52
|
-
target: (text) => ctx.ui.theme.fg("success", text),
|
|
53
|
-
type: (text) => ctx.ui.theme.fg("warning", text),
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
|
-
})
|
|
58
|
-
: undefined, { placement: "belowEditor" });
|
|
59
37
|
if (!notify)
|
|
60
38
|
return;
|
|
61
39
|
const notificationSink = Pi.createNotificationSink(pi, ctx);
|
|
@@ -92,7 +70,7 @@ export default function toolRegistryExtension(pi) {
|
|
|
92
70
|
const execute = definition.execute;
|
|
93
71
|
return {
|
|
94
72
|
...definition,
|
|
95
|
-
execute: (...args) => {
|
|
73
|
+
execute: async (...args) => {
|
|
96
74
|
const nextArgs = [...args];
|
|
97
75
|
const ctx = nextArgs[4];
|
|
98
76
|
if (ctx && typeof ctx === "object") {
|
|
@@ -101,7 +79,12 @@ export default function toolRegistryExtension(pi) {
|
|
|
101
79
|
getThinkingLevel: () => pi.getThinkingLevel(),
|
|
102
80
|
};
|
|
103
81
|
}
|
|
104
|
-
|
|
82
|
+
try {
|
|
83
|
+
return ToolsResponse.spaceToolResult(await execute(...nextArgs));
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
throw ToolsResponse.spaceToolError(error);
|
|
87
|
+
}
|
|
105
88
|
},
|
|
106
89
|
};
|
|
107
90
|
};
|
|
@@ -125,6 +108,8 @@ export default function toolRegistryExtension(pi) {
|
|
|
125
108
|
return { skillPaths };
|
|
126
109
|
});
|
|
127
110
|
pi.on("session_start", async (_event, ctx) => {
|
|
111
|
+
// Clear the pre-overlay widget after hot reloads from older pi-actors builds.
|
|
112
|
+
ctx.ui.setWidget("zz-pi-actors-comms", undefined);
|
|
128
113
|
activeRunContext = ctx;
|
|
129
114
|
await Temp.prepareExtensionTempDir(Paths.EXTENSION_RUNTIME_PATHS.tempDir);
|
|
130
115
|
runtime.loadTools(ctx);
|
|
@@ -147,31 +132,25 @@ export default function toolRegistryExtension(pi) {
|
|
|
147
132
|
recipeReload.close();
|
|
148
133
|
});
|
|
149
134
|
pi.registerCommand("actors-inspector-toggle", {
|
|
150
|
-
description:
|
|
151
|
-
handler: async (
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
handler: async (args, ctx) => {
|
|
170
|
-
const previews = Inspector.readActorInspectorPreviews(Paths.EXTENSION_RUNTIME_PATHS.runStateRoot, actorInspector.rows, Inspector.getActorInspectorPreviewOptions(actorInspector, getRunOwnerId(ctx)));
|
|
171
|
-
const result = Inspector.handleActorInspectorInspect(actorInspector, args, previews);
|
|
172
|
-
if (result.update)
|
|
173
|
-
updateRunUi(ctx);
|
|
174
|
-
ctx.ui.notify(result.notify, result.type);
|
|
135
|
+
description: "Toggle the keyboard-driven actor inspector overlay",
|
|
136
|
+
handler: async (_args, ctx) => {
|
|
137
|
+
ctx.ui.setWidget("zz-pi-actors-comms", undefined);
|
|
138
|
+
await ctx.ui.custom((tui, theme, _keybindings, done) => new InspectorOverlay.ActorInspectorOverlay({
|
|
139
|
+
done,
|
|
140
|
+
ownerId: getRunOwnerId(ctx),
|
|
141
|
+
stateRoot: Paths.EXTENSION_RUNTIME_PATHS.runStateRoot,
|
|
142
|
+
theme,
|
|
143
|
+
tui,
|
|
144
|
+
}), {
|
|
145
|
+
overlay: true,
|
|
146
|
+
overlayOptions: {
|
|
147
|
+
anchor: "center",
|
|
148
|
+
width: "94%",
|
|
149
|
+
minWidth: 72,
|
|
150
|
+
maxHeight: "94%",
|
|
151
|
+
margin: 1,
|
|
152
|
+
},
|
|
153
|
+
});
|
|
175
154
|
},
|
|
176
155
|
});
|
|
177
156
|
pi.on("before_agent_start", async (event) => ({
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard-driven actor inspector overlay.
|
|
3
|
+
* Zones: overlay shell, tabs, owned-run/subagent selection, compact striped rows
|
|
4
|
+
* Owns interactive TUI navigation; evidence parsing remains in inspector/session domains.
|
|
5
|
+
*/
|
|
6
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { type TUI } from "@earendil-works/pi-tui";
|
|
8
|
+
export type ActorInspectorOverlayTab = "communications" | "turns";
|
|
9
|
+
export interface ActorInspectorOverlayOptions {
|
|
10
|
+
done: () => void;
|
|
11
|
+
ownerId: string;
|
|
12
|
+
stateRoot: string;
|
|
13
|
+
theme: Theme;
|
|
14
|
+
tui: TUI;
|
|
15
|
+
}
|
|
16
|
+
export declare class ActorInspectorOverlay {
|
|
17
|
+
private readonly done;
|
|
18
|
+
private readonly ownerId;
|
|
19
|
+
private readonly stateRoot;
|
|
20
|
+
private readonly theme;
|
|
21
|
+
private readonly tui;
|
|
22
|
+
private readonly refreshTimer;
|
|
23
|
+
private runIndex;
|
|
24
|
+
private communicationChannel;
|
|
25
|
+
private communicationFrom;
|
|
26
|
+
private communicationUnread;
|
|
27
|
+
private contentStripeIndices;
|
|
28
|
+
private detailCommunication?;
|
|
29
|
+
private detailOpen;
|
|
30
|
+
private detailScroll;
|
|
31
|
+
private detailTurn?;
|
|
32
|
+
private readonly readKeys;
|
|
33
|
+
private focus;
|
|
34
|
+
private filterControlIndex;
|
|
35
|
+
private menuLevel;
|
|
36
|
+
private selectorIndex;
|
|
37
|
+
private rowIndex;
|
|
38
|
+
private selectedRun?;
|
|
39
|
+
private subagentIndex;
|
|
40
|
+
private tab;
|
|
41
|
+
constructor(options: ActorInspectorOverlayOptions);
|
|
42
|
+
handleInput(data: string): void;
|
|
43
|
+
render(width: number): string[];
|
|
44
|
+
invalidate(): void;
|
|
45
|
+
dispose(): void;
|
|
46
|
+
private runs;
|
|
47
|
+
private ensureSelectedRun;
|
|
48
|
+
private listItemCount;
|
|
49
|
+
private selectorAnchor;
|
|
50
|
+
private renderKeyHints;
|
|
51
|
+
private renderRunControl;
|
|
52
|
+
private activeMessageFilters;
|
|
53
|
+
private renderTabs;
|
|
54
|
+
private renderRunSelector;
|
|
55
|
+
private renderTimeline;
|
|
56
|
+
private communicationPreviews;
|
|
57
|
+
private communicationActorLabel;
|
|
58
|
+
private communicationFromOptions;
|
|
59
|
+
private communicationRows;
|
|
60
|
+
private renderDetail;
|
|
61
|
+
private turnItems;
|
|
62
|
+
private turnRows;
|
|
63
|
+
private subagents;
|
|
64
|
+
private valueOptions;
|
|
65
|
+
private filterOptions;
|
|
66
|
+
private menuOptions;
|
|
67
|
+
private backMenu;
|
|
68
|
+
private openRunMenu;
|
|
69
|
+
private openFilterMenu;
|
|
70
|
+
private applyMenuOption;
|
|
71
|
+
private filterValue;
|
|
72
|
+
private currentFilterValue;
|
|
73
|
+
private renderMenuBox;
|
|
74
|
+
private renderFilterMenus;
|
|
75
|
+
private openDetail;
|
|
76
|
+
private closeDetail;
|
|
77
|
+
private border;
|
|
78
|
+
private stripeBackground;
|
|
79
|
+
private stripedRow;
|
|
80
|
+
private row;
|
|
81
|
+
private takeVisiblePrefix;
|
|
82
|
+
private dropVisiblePrefix;
|
|
83
|
+
private fit;
|
|
84
|
+
}
|