pi-subagents 0.84.0 → 0.86.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 +83 -0
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +2 -2
- package/bundle/{chunk-JG4QKI5M.js → chunk-2IYBCYFU.js} +214 -97
- package/bundle/{chunk-V2BZYLEP.js → chunk-374MZFF4.js} +7 -2
- package/bundle/{chunk-4E7BKDTX.js → chunk-3RKFH2UZ.js} +11 -156
- package/bundle/{chunk-F4ASL6OV.js → chunk-5H4BICQZ.js} +1 -1
- package/bundle/{chunk-PALJGGYC.js → chunk-6VD7BGIC.js} +6 -3
- package/bundle/{chunk-C5P5CHYK.js → chunk-77ASNIEM.js} +1 -1
- package/bundle/{chunk-XDQORLZ5.js → chunk-7ADDXUGF.js} +15 -6
- package/bundle/{chunk-PV63UFUR.js → chunk-7QA7ZA46.js} +183 -28
- package/bundle/{chunk-NKQ6JNAS.js → chunk-7ZUFN6ME.js} +2 -1
- package/bundle/{chunk-SSG7IEP5.js → chunk-A637IMAO.js} +2 -2
- package/bundle/{chunk-L3WFKBEI.js → chunk-BGXEAYUM.js} +247 -153
- package/bundle/{chunk-J5YL7LYR.js → chunk-BU6PFPVX.js} +59 -27
- package/bundle/{chunk-DZDETGRJ.js → chunk-BWC2LVII.js} +259 -216
- package/bundle/{chunk-CGN2TVE7.js → chunk-GJGTMLPE.js} +322 -18
- package/bundle/{chunk-D3JAFGMO.js → chunk-GRJHIXYF.js} +1 -1
- package/bundle/chunk-HXRB42AF.js +108 -0
- package/bundle/{chunk-LFDBD4PW.js → chunk-LGINOOY5.js} +2 -2
- package/bundle/{chunk-G2Z6ZH26.js → chunk-NAFLUJ26.js} +1 -1
- package/bundle/{chunk-235AWJUQ.js → chunk-O3YH7XIY.js} +324 -111
- package/bundle/{chunk-2DHZTCOL.js → chunk-PYOAIN3V.js} +2 -2
- package/bundle/{chunk-LNRJCP2Y.js → chunk-QGO6HXHG.js} +417 -242
- package/bundle/{chunk-VQVVHSY6.js → chunk-QM3JGE4W.js} +22 -11
- package/bundle/{chunk-2S4K53MV.js → chunk-S2Q75LP3.js} +1 -1
- package/bundle/{chunk-NENDSQUY.js → chunk-UR7OW5S7.js} +9 -6
- package/bundle/{chunk-AKOIVLA5.js → chunk-WN2E5XHN.js} +135 -77
- package/bundle/{chunk-2D52JFLF.js → chunk-YK3QYNLE.js} +41 -117
- package/bundle/{chunk-7BWGNDNK.js → chunk-ZJJCPV3L.js} +190 -1177
- package/bundle/chunk-ZPY5QZCS.js +1067 -0
- package/bundle/control-channel.js +2 -2
- package/bundle/index.js +1 -1
- package/bundle/intercom-bridge.js +2 -2
- package/bundle/preflight.js +8 -8
- package/bundle/project-panes.js +3 -3
- package/docs/agents.md +23 -2
- package/docs/configuration.md +4 -4
- package/docs/extension-api.md +16 -1
- package/docs/tool-reference.md +2 -0
- package/docs/workflows.md +30 -2
- package/package.json +1 -1
- package/src/agents/agent-management.js +27 -11
- package/src/agents/agent-memory.d.ts +1 -4
- package/src/agents/agent-memory.js +1 -4
- package/src/agents/agents.d.ts +1 -3
- package/src/agents/agents.js +7 -6
- package/src/agents/frontmatter.js +1 -8
- package/src/agents/global-npm-root.d.ts +1 -0
- package/src/agents/global-npm-root.js +11 -3
- package/src/agents/skills.d.ts +0 -3
- package/src/agents/skills.js +0 -3
- package/src/extension/config.js +7 -1
- package/src/extension/herdr-pi-bridge.js +10 -2
- package/src/extension/index.d.ts +0 -13
- package/src/extension/index.js +43 -32
- package/src/extension/public-execution.d.ts +1 -0
- package/src/extension/public-execution.js +4 -0
- package/src/extension/reply-workflow-script.js +24 -4
- package/src/extension/schemas.d.ts +8 -3
- package/src/extension/schemas.js +5 -3
- package/src/extension/session-switch.d.ts +25 -0
- package/src/extension/session-switch.js +138 -0
- package/src/extension/subagent-guide.d.ts +1 -1
- package/src/extension/subagent-guide.js +1 -1
- package/src/extension/subagent-launch-tool.d.ts +25 -0
- package/src/extension/subagent-launch-tool.js +48 -0
- package/src/extension/tool-activation.js +35 -12
- package/src/extension/tool-description.d.ts +1 -1
- package/src/extension/tool-description.js +14 -8
- package/src/inspectors/herdr/actions.d.ts +0 -1
- package/src/inspectors/herdr/actions.js +0 -1
- package/src/inspectors/session-roots-codec.d.ts +0 -1
- package/src/inspectors/session-roots-codec.js +0 -1
- package/src/inspectors/tmux/actions.d.ts +0 -1
- package/src/inspectors/tmux/actions.js +0 -1
- package/src/integrations/herdr-status.js +3 -8
- package/src/intercom/native-supervisor-channel.js +65 -9
- package/src/runs/background/async-execution.d.ts +5 -9
- package/src/runs/background/async-execution.js +62 -27
- package/src/runs/background/async-job-tracker.js +12 -0
- package/src/runs/background/async-resume.d.ts +2 -1
- package/src/runs/background/async-resume.js +112 -39
- package/src/runs/background/async-retention.js +6 -1
- package/src/runs/background/auto-drain.js +2 -1
- package/src/runs/background/boot-id.d.ts +1 -3
- package/src/runs/background/boot-id.js +1 -3
- package/src/runs/background/completion-batcher.d.ts +3 -4
- package/src/runs/background/completion-batcher.js +2 -3
- package/src/runs/background/control-channel.d.ts +0 -6
- package/src/runs/background/control-channel.js +0 -6
- package/src/runs/background/fleet-view.js +2 -3
- package/src/runs/background/notify.d.ts +0 -2
- package/src/runs/background/notify.js +0 -2
- package/src/runs/background/result-watcher.d.ts +1 -0
- package/src/runs/background/result-watcher.js +59 -29
- package/src/runs/background/resume-guidance.js +4 -2
- package/src/runs/background/retained-children.js +2 -1
- package/src/runs/background/run-child-session.d.ts +0 -1
- package/src/runs/background/run-child-session.js +1 -1
- package/src/runs/background/run-status.js +9 -7
- package/src/runs/background/scheduled-runs.d.ts +3 -1
- package/src/runs/background/scheduled-runs.js +13 -16
- package/src/runs/background/subagent-runner.d.ts +2 -4
- package/src/runs/background/subagent-runner.js +15 -12
- package/src/runs/background/subagent-wait.js +12 -15
- package/src/runs/background/wait-config.d.ts +2 -0
- package/src/runs/background/wait-config.js +17 -3
- package/src/runs/background/wait-tool.js +4 -2
- package/src/runs/background/workflow-terminal-proof.d.ts +0 -1
- package/src/runs/background/workflow-terminal-proof.js +0 -1
- package/src/runs/foreground/execution.d.ts +0 -3
- package/src/runs/foreground/execution.js +17 -9
- package/src/runs/foreground/subagent-executor.d.ts +3 -2
- package/src/runs/foreground/subagent-executor.js +107 -26
- package/src/runs/shared/acceptance.js +69 -26
- package/src/runs/shared/child-commands.js +15 -2
- package/src/runs/shared/child-hooks.d.ts +1 -7
- package/src/runs/shared/child-hooks.js +13 -5
- package/src/runs/shared/child-launch.js +6 -2
- package/src/runs/shared/child-runtime-config.d.ts +0 -1
- package/src/runs/shared/child-session.d.ts +1 -1
- package/src/runs/shared/child-session.js +21 -2
- package/src/runs/shared/child-tool-plan.d.ts +0 -1
- package/src/runs/shared/child-tool-plan.js +0 -1
- package/src/runs/shared/claude-code-adapter.js +11 -0
- package/src/runs/shared/external-cli-contract.d.ts +49 -0
- package/src/runs/shared/external-cli-contract.js +18 -13
- package/src/runs/shared/external-cli-runner.js +26 -6
- package/src/runs/shared/herdr-connection.js +2 -1
- package/src/runs/shared/herdr-pane-host.d.ts +2 -2
- package/src/runs/shared/herdr-pane-host.js +17 -1
- package/src/runs/shared/herdr-placed-run.js +48 -22
- package/src/runs/shared/lane-metadata.d.ts +0 -1
- package/src/runs/shared/lane-metadata.js +0 -1
- package/src/runs/shared/mcp-direct-tool-grant.js +8 -1
- package/src/runs/shared/model-resolution-diagnostic.d.ts +0 -1
- package/src/runs/shared/model-resolution.d.ts +2 -2
- package/src/runs/shared/model-resolution.js +7 -1
- package/src/runs/shared/model-scope.d.ts +1 -5
- package/src/runs/shared/model-scope.js +1 -5
- package/src/runs/shared/mutation-evidence.d.ts +1 -1
- package/src/runs/shared/mutation-evidence.js +52 -7
- package/src/runs/shared/nested-events.d.ts +1 -0
- package/src/runs/shared/nested-events.js +1 -1
- package/src/runs/shared/parallel-utils.d.ts +0 -1
- package/src/runs/shared/permissions.js +5 -3
- package/src/runs/shared/placement-host.d.ts +5 -1
- package/src/runs/shared/rex-pane-host.d.ts +0 -1
- package/src/runs/shared/rex-pane-host.js +0 -2
- package/src/runs/shared/run-launch-folder.d.ts +12 -0
- package/src/runs/shared/run-launch-folder.js +21 -0
- package/src/runs/shared/runner-launcher.d.ts +12 -1
- package/src/runs/shared/runner-launcher.js +16 -0
- package/src/runs/shared/single-output.d.ts +3 -3
- package/src/runs/shared/single-output.js +5 -3
- package/src/runs/shared/structured-output.d.ts +8 -0
- package/src/runs/shared/structured-output.js +40 -5
- package/src/runs/shared/subagent-prompt-runtime.d.ts +0 -1
- package/src/runs/shared/subagent-prompt-runtime.js +4 -2
- package/src/runs/shared/tool-timeout.js +2 -1
- package/src/runs/shared/worktree-cleanup-plan.d.ts +0 -1
- package/src/runs/shared/worktree-cleanup-plan.js +0 -1
- package/src/runs/shared/worktree.d.ts +3 -0
- package/src/runs/shared/worktree.js +20 -0
- package/src/shared/capacity-resilient-json.d.ts +1 -1
- package/src/shared/child-cache-retention.d.ts +1 -2
- package/src/shared/child-cache-retention.js +1 -2
- package/src/shared/fleet-transcript-reader.d.ts +51 -0
- package/src/shared/fleet-transcript-reader.js +333 -0
- package/src/shared/formatters.d.ts +0 -18
- package/src/shared/formatters.js +0 -18
- package/src/shared/session-succession.d.ts +16 -1
- package/src/shared/session-succession.js +41 -2
- package/src/shared/session-warnings.d.ts +7 -0
- package/src/shared/session-warnings.js +26 -0
- package/src/shared/settings.d.ts +0 -23
- package/src/shared/settings.js +3 -35
- package/src/shared/types.d.ts +85 -59
- package/src/shared/types.js +0 -12
- package/src/shared/utils.d.ts +0 -14
- package/src/shared/utils.js +0 -22
- package/src/shared/wait-tool-name.d.ts +8 -0
- package/src/shared/wait-tool-name.js +13 -0
- package/src/slash/slash-commands.js +2 -1
- package/src/slash/subagent-cost.d.ts +3 -2
- package/src/slash/subagent-cost.js +22 -3
- package/src/slash/subagents-admin.js +0 -1
- package/src/tui/fleet-status.d.ts +0 -5
- package/src/tui/fleet-status.js +4 -24
- package/src/tui/fleet-transcript.d.ts +1 -44
- package/src/tui/fleet-transcript.js +1 -327
- package/src/tui/fleet.js +6 -4
- package/src/tui/render.d.ts +0 -9
- package/src/tui/render.js +161 -66
- package/src/tui/subagent-messages.js +3 -2
- package/src/watchdog/register-child.d.ts +2 -3
- package/src/watchdog/register-child.js +2 -3
- package/src/watchdog/turn-delta.js +2 -1
- package/src/workflows/scripted-workflow.js +241 -20
- package/src/workflows/workflow-launch-record.d.ts +15 -6
- package/src/workflows/workflow-launch-record.js +30 -12
- package/src/workflows/workflow-receipt.js +36 -53
- package/src/workflows/workflow-resume-claim.js +2 -2
- package/src/workflows/workflow-resume.d.ts +1 -1
- package/src/workflows/workflow-resume.js +11 -8
- package/src/workflows/workflow-script-worker.d.ts +13 -0
- package/src/workflows/workflow-script-worker.js +79 -0
- package/workflow-script-process.cjs +36 -0
- package/workflow-script-worker.cjs +4 -1
|
@@ -1,40 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getLivePromptAudit,
|
|
3
3
|
handleInspectorAction,
|
|
4
|
+
objectValue,
|
|
4
5
|
readFleetTranscript,
|
|
5
|
-
renderFleetTranscript,
|
|
6
6
|
resolveWorkflowForegroundSteeringTarget,
|
|
7
|
+
safeTranscriptEvent,
|
|
7
8
|
steerAsyncRun,
|
|
8
9
|
steerWorkflowForegroundTarget
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3RKFH2UZ.js";
|
|
10
11
|
import {
|
|
11
12
|
FLEET_STATUS_WIDGET_KEY,
|
|
12
|
-
reportFleetWarning,
|
|
13
13
|
runningTone,
|
|
14
14
|
stepTaskSummary
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WN2E5XHN.js";
|
|
16
16
|
import {
|
|
17
17
|
foregroundChildStateLabel,
|
|
18
18
|
formatAsyncRunTranscript,
|
|
19
19
|
stopAsyncRun
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-UR7OW5S7.js";
|
|
21
21
|
import {
|
|
22
22
|
contextModeBadge,
|
|
23
23
|
contextModeLabel,
|
|
24
24
|
decodeUtf8Tail,
|
|
25
25
|
listAsyncRuns
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import
|
|
28
|
-
|
|
26
|
+
} from "./chunk-BGXEAYUM.js";
|
|
27
|
+
import {
|
|
28
|
+
reportSessionWarning
|
|
29
|
+
} from "./chunk-HXRB42AF.js";
|
|
30
|
+
import "./chunk-GJGTMLPE.js";
|
|
31
|
+
import "./chunk-5H4BICQZ.js";
|
|
29
32
|
import "./chunk-NIXWDZZV.js";
|
|
30
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-77ASNIEM.js";
|
|
31
34
|
import "./chunk-7F6RKT6W.js";
|
|
32
35
|
import "./chunk-CTPAE36Y.js";
|
|
33
36
|
import "./chunk-7J4ZXMY7.js";
|
|
34
37
|
import {
|
|
35
38
|
getArtifactPaths,
|
|
36
39
|
getArtifactsDir
|
|
37
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-GRJHIXYF.js";
|
|
38
41
|
import {
|
|
39
42
|
snapshotExternalRuns
|
|
40
43
|
} from "./chunk-UKG4V45O.js";
|
|
@@ -46,18 +49,20 @@ import {
|
|
|
46
49
|
formatTokens,
|
|
47
50
|
readStatus,
|
|
48
51
|
shortenPath
|
|
49
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-QGO6HXHG.js";
|
|
50
53
|
import {
|
|
51
54
|
DIRS
|
|
52
55
|
} from "./chunk-JEZOSEWG.js";
|
|
53
|
-
import
|
|
56
|
+
import {
|
|
57
|
+
safeTerminalText
|
|
58
|
+
} from "./chunk-YFCK7H2S.js";
|
|
54
59
|
import "./chunk-QXASAHIA.js";
|
|
55
60
|
|
|
56
61
|
// src/tui/fleet.ts
|
|
57
62
|
import * as fs from "node:fs";
|
|
58
63
|
import * as path from "node:path";
|
|
59
64
|
import { getMarkdownTheme } from "@earendil-works/pi-coding-agent";
|
|
60
|
-
import { matchesKey, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
65
|
+
import { matchesKey, truncateToWidth as truncateToWidth2, visibleWidth as visibleWidth2, wrapTextWithAnsi as wrapTextWithAnsi2 } from "@earendil-works/pi-tui";
|
|
61
66
|
|
|
62
67
|
// src/tui/fleet-layout.ts
|
|
63
68
|
function fleetLayout(width, rows, selected, items) {
|
|
@@ -116,6 +121,156 @@ var FleetViewport = class {
|
|
|
116
121
|
}
|
|
117
122
|
};
|
|
118
123
|
|
|
124
|
+
// src/tui/fleet-transcript.ts
|
|
125
|
+
import { getLanguageFromPath, highlightCode } from "@earendil-works/pi-coding-agent";
|
|
126
|
+
import { Markdown, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
127
|
+
var TOOL_PREVIEW_LINES = 7;
|
|
128
|
+
function statusGlyph(event, theme) {
|
|
129
|
+
if (event.status === "running") return theme.fg("warning", "\u25CF");
|
|
130
|
+
if (event.status === "error") return theme.fg("error", "\u2717");
|
|
131
|
+
return theme.fg("success", "\u2713");
|
|
132
|
+
}
|
|
133
|
+
function jsonScalar(value) {
|
|
134
|
+
if (typeof value === "string" && value.trim()) return value;
|
|
135
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
136
|
+
return void 0;
|
|
137
|
+
}
|
|
138
|
+
function parseToolArgs(event) {
|
|
139
|
+
if (!event.argsPayload) return void 0;
|
|
140
|
+
try {
|
|
141
|
+
return objectValue(JSON.parse(event.argsPayload));
|
|
142
|
+
} catch {
|
|
143
|
+
return void 0;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function toolDuration(event) {
|
|
147
|
+
if (event.startedAt === void 0 || event.endedAt === void 0) return void 0;
|
|
148
|
+
return `${((event.endedAt - event.startedAt) / 1e3).toFixed(1)}s`;
|
|
149
|
+
}
|
|
150
|
+
function renderExpandedTool(event, width, theme) {
|
|
151
|
+
const lines = [];
|
|
152
|
+
const args = parseToolArgs(event);
|
|
153
|
+
const glyph = statusGlyph(event, theme);
|
|
154
|
+
const output = event.output ?? event.error;
|
|
155
|
+
const outputColor = event.status === "error" ? "error" : "toolOutput";
|
|
156
|
+
if (event.name === "bash") {
|
|
157
|
+
const command = jsonScalar(args?.command) ?? event.args ?? "(unknown command)";
|
|
158
|
+
lines.push(railLine(`${glyph} ${theme.fg("toolTitle", theme.bold(`$ ${command}`))}`, width, theme));
|
|
159
|
+
if (output) {
|
|
160
|
+
for (const outputLine of output.replace(/\s+$/, "").split(/\r?\n/)) {
|
|
161
|
+
for (const wrapped of renderWrapped(theme.fg(outputColor, outputLine), Math.max(1, width - 4))) {
|
|
162
|
+
lines.push(railLine(` ${wrapped}`, width, theme));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const duration = toolDuration(event);
|
|
167
|
+
if (duration) lines.push(railLine(theme.fg("dim", ` Took ${duration}`), width, theme));
|
|
168
|
+
return lines;
|
|
169
|
+
}
|
|
170
|
+
if (event.name === "read") {
|
|
171
|
+
const filePath = jsonScalar(args?.path ?? args?.file_path);
|
|
172
|
+
const language = filePath ? getLanguageFromPath(filePath) : void 0;
|
|
173
|
+
const rendered = !output ? [] : event.status === "error" ? output.split("\n").map((line) => theme.fg("error", line)) : language ? highlightCode(output, language) : output.split("\n");
|
|
174
|
+
lines.push(railLine(`${glyph} ${theme.fg("toolTitle", theme.bold(`read ${filePath ?? event.args ?? ""}`))}`, width, theme));
|
|
175
|
+
for (const line of rendered) {
|
|
176
|
+
for (const wrapped of renderWrapped(line, Math.max(1, width - 4))) lines.push(railLine(` ${wrapped}`, width, theme));
|
|
177
|
+
}
|
|
178
|
+
return lines;
|
|
179
|
+
}
|
|
180
|
+
lines.push(railLine(`${glyph} ${theme.fg("toolTitle", theme.bold(event.name))}`, width, theme));
|
|
181
|
+
if (event.argsPayload) {
|
|
182
|
+
lines.push(railLine(theme.fg("dim", " args"), width, theme));
|
|
183
|
+
for (const argLine of event.argsPayload.split(/\r?\n/)) {
|
|
184
|
+
for (const wrapped of renderWrapped(theme.fg("muted", argLine), Math.max(1, width - 4))) lines.push(railLine(` ${wrapped}`, width, theme));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (output) {
|
|
188
|
+
lines.push(railLine(theme.fg(event.status === "error" ? "error" : "dim", event.status === "error" ? " error" : " output"), width, theme));
|
|
189
|
+
for (const outputLine of output.split(/\r?\n/)) {
|
|
190
|
+
for (const wrapped of renderWrapped(theme.fg(outputColor, outputLine), Math.max(1, width - 4))) lines.push(railLine(` ${wrapped}`, width, theme));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return lines;
|
|
194
|
+
}
|
|
195
|
+
function bounded(text, width) {
|
|
196
|
+
return truncateToWidth(text, Math.max(0, width));
|
|
197
|
+
}
|
|
198
|
+
function railLine(content, width, theme) {
|
|
199
|
+
return bounded(`${theme.fg("borderMuted", "\u2502")} ${content}`, width);
|
|
200
|
+
}
|
|
201
|
+
function renderWrapped(text, width) {
|
|
202
|
+
return wrapTextWithAnsi(text, Math.max(1, width));
|
|
203
|
+
}
|
|
204
|
+
function renderFleetTranscript(transcript, width, theme, markdownTheme, options = {}) {
|
|
205
|
+
if (width <= 0) return [];
|
|
206
|
+
const lines = [];
|
|
207
|
+
if (transcript.truncated) lines.push(bounded(theme.fg("dim", "\u2191 Earlier activity omitted"), width));
|
|
208
|
+
if (transcript.warning) {
|
|
209
|
+
for (const line of renderWrapped(safeTerminalText(transcript.warning), Math.max(1, width - 2))) {
|
|
210
|
+
lines.push(bounded(`${theme.fg("warning", "!")} ${theme.fg("warning", line)}`, width));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
for (const rawEvent of transcript.events) {
|
|
214
|
+
const event = safeTranscriptEvent(rawEvent);
|
|
215
|
+
if (event.kind === "tool") {
|
|
216
|
+
if (options.expandedTools && (event.output || event.argsPayload || event.error)) {
|
|
217
|
+
lines.push(...renderExpandedTool(event, width, theme));
|
|
218
|
+
lines.push(railLine(theme.fg("dim", " x to collapse"), width, theme));
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
const title = theme.fg("toolTitle", theme.bold(event.name));
|
|
222
|
+
const args = event.args ? ` ${theme.fg("dim", event.args)}` : "";
|
|
223
|
+
const suffix = event.status === "running" ? theme.fg("warning", " running") : "";
|
|
224
|
+
lines.push(bounded(`${theme.fg("borderMuted", "\u251C\u2500")} ${statusGlyph(event, theme)} ${title}${args}${suffix}`, width));
|
|
225
|
+
if (event.output && event.status !== "error" && event.name === "bash") {
|
|
226
|
+
const outputLines = event.output.replace(/\s+$/, "").split(/\r?\n/);
|
|
227
|
+
const visible = outputLines.slice(-TOOL_PREVIEW_LINES);
|
|
228
|
+
const hidden = Math.max(0, outputLines.length - visible.length);
|
|
229
|
+
for (const outputLine of visible) {
|
|
230
|
+
for (const wrapped of renderWrapped(theme.fg("toolOutput", outputLine), Math.max(1, width - 4))) {
|
|
231
|
+
lines.push(railLine(` ${wrapped}`, width, theme));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (hidden > 0) lines.push(railLine(theme.fg("dim", ` \u2026 ${hidden} earlier lines \xB7 x to expand`), width, theme));
|
|
235
|
+
const duration = toolDuration(event);
|
|
236
|
+
lines.push(railLine(theme.fg("dim", ` Took${duration ? ` ${duration}` : ""}`), width, theme));
|
|
237
|
+
} else if (event.output && event.status !== "error") {
|
|
238
|
+
const summary = truncateToWidth(event.output.replace(/\s+/g, " ").trim(), Math.max(1, width - 18), "\u2026");
|
|
239
|
+
if (summary) lines.push(railLine(theme.fg("dim", ` ${summary} \xB7 x to expand`), width, theme));
|
|
240
|
+
}
|
|
241
|
+
if (event.error) {
|
|
242
|
+
for (const errorLine of renderWrapped(event.error, Math.max(1, width - 4))) {
|
|
243
|
+
lines.push(railLine(theme.fg("error", ` ${errorLine}`), width, theme));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (event.kind === "notice") {
|
|
249
|
+
const color = event.tone === "error" ? "error" : event.tone === "warning" ? "warning" : "dim";
|
|
250
|
+
for (const noticeLine of renderWrapped(event.text, Math.max(1, width - 2))) {
|
|
251
|
+
lines.push(railLine(theme.fg(color, noticeLine), width, theme));
|
|
252
|
+
}
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
const assistant = event.kind === "assistant";
|
|
256
|
+
const label = assistant ? "Assistant" : "Supervisor";
|
|
257
|
+
const marker = assistant ? theme.fg("accent", "\u25C6") : theme.fg("warning", "\u25C7");
|
|
258
|
+
const model = assistant && event.model ? theme.fg("dim", ` \xB7 ${event.model}`) : "";
|
|
259
|
+
lines.push(bounded(`${marker} ${theme.bold(label)}${model}`, width));
|
|
260
|
+
if (assistant) {
|
|
261
|
+
const rendered = new Markdown(event.text, 0, 0, markdownTheme).render(Math.max(1, width - 2));
|
|
262
|
+
for (const markdownLine of rendered) lines.push(railLine(markdownLine, width, theme));
|
|
263
|
+
} else {
|
|
264
|
+
for (const userLine of renderWrapped(event.text, Math.max(1, width - 2))) {
|
|
265
|
+
lines.push(railLine(userLine, width, theme));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
lines.push(theme.fg("borderMuted", "\u2502"));
|
|
269
|
+
}
|
|
270
|
+
while (lines.length > 0 && visibleWidth(lines.at(-1) ?? "") === 1) lines.pop();
|
|
271
|
+
return lines;
|
|
272
|
+
}
|
|
273
|
+
|
|
119
274
|
// src/tui/fleet.ts
|
|
120
275
|
var REFRESH_MS = 750;
|
|
121
276
|
var MIN_REFRESH_MS = 250;
|
|
@@ -303,7 +458,7 @@ function collectFleetSnapshot(state, options = {}) {
|
|
|
303
458
|
entryLimit: MAX_FLEET_HISTORY_CANDIDATES,
|
|
304
459
|
resultsDir: options.resultsDir ?? DIRS.results,
|
|
305
460
|
reconcile: false,
|
|
306
|
-
onCorruptStatus: (warning) =>
|
|
461
|
+
onCorruptStatus: (warning) => reportSessionWarning(state, warning)
|
|
307
462
|
}).filter((run) => !trackedIds.has(run.id));
|
|
308
463
|
runs = [...trackedRuns, ...history];
|
|
309
464
|
} else {
|
|
@@ -317,7 +472,7 @@ function collectFleetSnapshot(state, options = {}) {
|
|
|
317
472
|
}
|
|
318
473
|
if (state.currentSessionId) {
|
|
319
474
|
try {
|
|
320
|
-
for (const run of snapshotExternalRuns(state.currentSessionId, { ignoreMalformed: true, onMalformedRecord: (message) =>
|
|
475
|
+
for (const run of snapshotExternalRuns(state.currentSessionId, { ignoreMalformed: true, onMalformedRecord: (message) => reportSessionWarning(state, `Removed ${message}`) })) {
|
|
321
476
|
items.push({
|
|
322
477
|
key: `external:${run.id}`,
|
|
323
478
|
kind: "external",
|
|
@@ -384,7 +539,7 @@ function fleetItemThinkingLevel(item) {
|
|
|
384
539
|
return void 0;
|
|
385
540
|
}
|
|
386
541
|
}
|
|
387
|
-
function
|
|
542
|
+
function statusGlyph2(item, theme) {
|
|
388
543
|
if (item.state === "running") return runningTone(theme, fleetItemThinkingLevel(item))("\u25CF");
|
|
389
544
|
if (item.state === "queued" || item.state === "pending") return theme.fg("muted", "\u25E6");
|
|
390
545
|
if (item.state === "complete" || item.state === "completed") return theme.fg("success", "\u2713");
|
|
@@ -402,7 +557,7 @@ function promptAuditString(value) {
|
|
|
402
557
|
function authoredPromptSummary(text) {
|
|
403
558
|
if (typeof text !== "string") return void 0;
|
|
404
559
|
const summary = text.replace(/\s+/g, " ").trim();
|
|
405
|
-
return summary ?
|
|
560
|
+
return summary ? truncateToWidth2(summary, PROMPT_AUDIT_SUMMARY_WIDTH, "\u2026") : void 0;
|
|
406
561
|
}
|
|
407
562
|
function foregroundAuthoredPromptSummary(item, state) {
|
|
408
563
|
if (!state.currentSessionId || item.control.sessionId !== state.currentSessionId) return void 0;
|
|
@@ -740,7 +895,7 @@ function itemStats(item) {
|
|
|
740
895
|
}
|
|
741
896
|
function structuredHeader(item, width, theme, conversationState, promptSummary) {
|
|
742
897
|
const lines = [];
|
|
743
|
-
lines.push(rightAligned(` ${
|
|
898
|
+
lines.push(rightAligned(` ${statusGlyph2(item, theme)} ${theme.bold(item.agent)}`, theme.fg("dim", item.state), width));
|
|
744
899
|
const child = "index" in item && item.index !== void 0 ? ` \xB7 child ${item.index + 1}` : "";
|
|
745
900
|
const context = itemContext(item);
|
|
746
901
|
const identity = `${itemSource(item)} \xB7 ${item.runId.slice(0, 8)}${child} \xB7 ${itemMode(item)}${context ? ` ${context}` : ""}`;
|
|
@@ -749,14 +904,14 @@ function structuredHeader(item, width, theme, conversationState, promptSummary)
|
|
|
749
904
|
if (stats.length) lines.push(` ${theme.fg("muted", stats.join(" \xB7 "))}`);
|
|
750
905
|
if (promptSummary) lines.push(` ${theme.fg("muted", `Task: ${promptSummary}`)}`);
|
|
751
906
|
lines.push(`${theme.fg("accent", "Conversation")} ${theme.fg("dim", `\xB7 ${conversationState}`)}`);
|
|
752
|
-
return lines.map((line) =>
|
|
907
|
+
return lines.map((line) => truncateToWidth2(line, width));
|
|
753
908
|
}
|
|
754
909
|
function fit(text, width) {
|
|
755
|
-
const clipped =
|
|
756
|
-
return clipped + " ".repeat(Math.max(0, width -
|
|
910
|
+
const clipped = truncateToWidth2(text, Math.max(0, width));
|
|
911
|
+
return clipped + " ".repeat(Math.max(0, width - visibleWidth2(clipped)));
|
|
757
912
|
}
|
|
758
913
|
function rightAligned(left, right, width) {
|
|
759
|
-
const rightWidth =
|
|
914
|
+
const rightWidth = visibleWidth2(right);
|
|
760
915
|
const leftWidth = Math.max(0, width - rightWidth - 1);
|
|
761
916
|
return fit(left, leftWidth) + " ".repeat(Math.max(1, width - leftWidth - rightWidth)) + fit(right, rightWidth);
|
|
762
917
|
}
|
|
@@ -1190,7 +1345,7 @@ var SubagentFleetComponent = class {
|
|
|
1190
1345
|
const name = task && item.kind === "async" && item.step ? item.step.agent : item.agent;
|
|
1191
1346
|
const agent = index === this.selected ? this.theme.bold(name) : name;
|
|
1192
1347
|
const identity = task ?? item.runId.slice(0, 8);
|
|
1193
|
-
const left = `${marker} ${
|
|
1348
|
+
const left = `${marker} ${statusGlyph2(item, this.theme)} ${agent}${context} ${this.theme.fg("dim", `\xB7 ${identity}`)}`;
|
|
1194
1349
|
return rightAligned(left, this.theme.fg("dim", item.state), layout.roster.width);
|
|
1195
1350
|
});
|
|
1196
1351
|
}
|
|
@@ -1230,7 +1385,7 @@ var SubagentFleetComponent = class {
|
|
|
1230
1385
|
this.theme.fg("accent", viewLabel),
|
|
1231
1386
|
promptText
|
|
1232
1387
|
];
|
|
1233
|
-
const body = raw.filter((line) => line !== void 0).flatMap((line) =>
|
|
1388
|
+
const body = raw.filter((line) => line !== void 0).flatMap((line) => wrapTextWithAnsi2(line, Math.max(1, width)));
|
|
1234
1389
|
return { header: [], body: this.withActionLines(body) };
|
|
1235
1390
|
}
|
|
1236
1391
|
wrappedDetail(width) {
|
|
@@ -1256,7 +1411,7 @@ var SubagentFleetComponent = class {
|
|
|
1256
1411
|
const lines = [];
|
|
1257
1412
|
for (const line of raw) {
|
|
1258
1413
|
const styled = /^(Run|State|Mode|Source|Child|Agent|Model|Task):/.test(line) ? this.theme.bold(line) : /^(Transcript|Result transcript tail)/.test(line) ? this.theme.fg("accent", line) : /^(Output|Session|Transcript file|Artifacts):/.test(line) ? this.theme.fg("muted", line) : /^Transcript preview warning:/.test(line) ? this.theme.fg("warning", line) : line;
|
|
1259
|
-
const wrapped =
|
|
1414
|
+
const wrapped = wrapTextWithAnsi2(styled, Math.max(1, width));
|
|
1260
1415
|
lines.push(...wrapped.length ? wrapped : [""]);
|
|
1261
1416
|
}
|
|
1262
1417
|
return { header: [], body: this.withActionLines(lines) };
|
|
@@ -1264,7 +1419,7 @@ var SubagentFleetComponent = class {
|
|
|
1264
1419
|
render(width) {
|
|
1265
1420
|
const layout = fleetLayout(width, this.tui.terminal?.rows ?? 32, this.selected, this.snapshot.items);
|
|
1266
1421
|
this.renderedLayout = layout;
|
|
1267
|
-
if (!layout) return [
|
|
1422
|
+
if (!layout) return [truncateToWidth2("Subagent fleet needs at least 36 columns. Esc closes.", width)];
|
|
1268
1423
|
const innerWidth = width - 2;
|
|
1269
1424
|
const { bodyHeight } = layout;
|
|
1270
1425
|
const rosterWidth = layout.roster.width;
|
|
@@ -1280,7 +1435,7 @@ var SubagentFleetComponent = class {
|
|
|
1280
1435
|
const lines = [this.theme.fg("border", `\u256D${"\u2500".repeat(innerWidth)}\u256E`)];
|
|
1281
1436
|
const selected = this.snapshot.items[this.selected];
|
|
1282
1437
|
const title = selected?.kind === "external" ? ` ${this.theme.bold("Fleet inspector")} ${this.theme.fg("dim", "\xB7 external display-only")}` : ` ${this.theme.bold("Subagent fleet inspector")} ${this.theme.fg("dim", "\xB7 live controls")}`;
|
|
1283
|
-
const selectedStatus = selected ? `${
|
|
1438
|
+
const selectedStatus = selected ? `${statusGlyph2(selected, this.theme)} ${selected.agent} \xB7 ${selected.state} ` : this.theme.fg("dim", "no children ");
|
|
1284
1439
|
lines.push(this.theme.fg("border", "\u2502") + rightAligned(title, selectedStatus, innerWidth) + this.theme.fg("border", "\u2502"));
|
|
1285
1440
|
lines.push(this.theme.fg("border", `\u251C${"\u2500".repeat(rosterWidth)}\u252C${"\u2500".repeat(detailWidth)}\u2524`));
|
|
1286
1441
|
for (let index = 0; index < bodyHeight; index++) {
|
|
@@ -1293,7 +1448,7 @@ var SubagentFleetComponent = class {
|
|
|
1293
1448
|
const footer = this.promptAuditOpen ? ` j/k child \xB7 1/2/3 view \xB7 g redo with guidance \xB7 c copy \xB7 Esc close Prompt Audit \xB7 ${position}` : selected?.kind === "external" ? ` ${bindingLabel(this.keybindings, "selectUp")}/${bindingLabel(this.keybindings, "selectDown")} job \xB7 display-only \xB7 ${bindingLabel(this.keybindings, "refresh")} refresh \xB7 ${bindingLabel(this.keybindings, "close")} close \xB7 ${position}` : ` ${bindingLabel(this.keybindings, "selectUp")}/${bindingLabel(this.keybindings, "selectDown")} agent \xB7 p Prompt Audit \xB7 ${bindingLabel(this.keybindings, "inspect")} Inspect \xB7 ${bindingLabel(this.keybindings, "steer")} steer \xB7 ${bindingLabel(this.keybindings, "stop")} stop \xB7 ${bindingLabel(this.keybindings, "toggleTools")} tools \xB7 ${bindingLabel(this.keybindings, "refresh")} refresh \xB7 ${bindingLabel(this.keybindings, "close")} close \xB7 ${position}`;
|
|
1294
1449
|
lines.push(this.theme.fg("border", "\u2502") + fit(this.theme.fg("dim", footer), innerWidth) + this.theme.fg("border", "\u2502"));
|
|
1295
1450
|
lines.push(this.theme.fg("border", `\u2570${"\u2500".repeat(innerWidth)}\u256F`));
|
|
1296
|
-
return lines.map((line) =>
|
|
1451
|
+
return lines.map((line) => truncateToWidth2(line, width));
|
|
1297
1452
|
}
|
|
1298
1453
|
invalidate() {
|
|
1299
1454
|
this.renderedLayout = void 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "pi-subagents",
|
|
4
|
-
version: "0.
|
|
4
|
+
version: "0.86.0",
|
|
5
5
|
private: true,
|
|
6
6
|
description: "Pi extension for single-agent delegation and scripted multi-agent workflows",
|
|
7
7
|
author: "Nico Bailon",
|
|
@@ -51,6 +51,7 @@ var package_default = {
|
|
|
51
51
|
"src/**/*.ts",
|
|
52
52
|
"*.mjs",
|
|
53
53
|
"workflow-script-worker.cjs",
|
|
54
|
+
"workflow-script-process.cjs",
|
|
54
55
|
"agents/",
|
|
55
56
|
"skills/**/*",
|
|
56
57
|
"prompts/**/*",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
appendAgentRefinementOverlay
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LGINOOY5.js";
|
|
4
4
|
import {
|
|
5
5
|
buildAgentMemoryInjection,
|
|
6
6
|
buildSkillInjection
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QGO6HXHG.js";
|
|
8
8
|
|
|
9
9
|
// src/runs/shared/effective-system-prompt.ts
|
|
10
10
|
function appendSection(prompt, section) {
|