pi-subagents 0.31.0 → 0.32.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 +48 -0
- package/README.md +170 -8
- package/package.json +1 -1
- package/skills/pi-subagents/SKILL.md +6 -1
- package/src/agents/agent-management.ts +6 -1
- package/src/agents/agents.ts +55 -11
- package/src/extension/companion-suggestions.ts +359 -0
- package/src/extension/config.ts +27 -4
- package/src/extension/doctor.ts +2 -0
- package/src/extension/fanout-child.ts +1 -0
- package/src/extension/index.ts +69 -4
- package/src/extension/schemas.ts +2 -2
- package/src/intercom/intercom-bridge.ts +25 -1
- package/src/profiles/profiles.ts +637 -0
- package/src/runs/background/async-execution.ts +138 -33
- package/src/runs/background/async-job-tracker.ts +77 -1
- package/src/runs/background/async-resume.ts +11 -13
- package/src/runs/background/async-status.ts +41 -9
- package/src/runs/background/chain-root-attachment.ts +34 -4
- package/src/runs/background/control-channel.ts +227 -0
- package/src/runs/background/run-status.ts +1 -0
- package/src/runs/background/stale-run-reconciler.ts +28 -1
- package/src/runs/background/subagent-runner.ts +459 -113
- package/src/runs/foreground/chain-execution.ts +29 -7
- package/src/runs/foreground/execution.ts +24 -6
- package/src/runs/foreground/subagent-executor.ts +240 -44
- package/src/runs/shared/acceptance.ts +45 -22
- package/src/runs/shared/dynamic-fanout.ts +1 -1
- package/src/runs/shared/model-fallback.ts +4 -0
- package/src/runs/shared/nested-events.ts +58 -0
- package/src/runs/shared/parallel-utils.ts +49 -1
- package/src/runs/shared/pi-args.ts +5 -3
- package/src/runs/shared/pi-spawn.ts +52 -20
- package/src/runs/shared/single-output.ts +2 -0
- package/src/runs/shared/subagent-prompt-runtime.ts +3 -2
- package/src/runs/shared/worktree.ts +28 -5
- package/src/shared/artifacts.ts +15 -1
- package/src/shared/fork-context.ts +133 -22
- package/src/shared/types.ts +82 -3
- package/src/shared/utils.ts +99 -14
- package/src/slash/slash-commands.ts +726 -40
- package/src/tui/render.ts +16 -4
package/src/tui/render.ts
CHANGED
|
@@ -236,6 +236,15 @@ function formatToolUseStat(count: number): string {
|
|
|
236
236
|
return `${count} tool use${count === 1 ? "" : "s"}`;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
function formatTotalCostStat(totalCost: Details["totalCost"] | undefined): string {
|
|
240
|
+
if (!totalCost || (totalCost.inputTokens === 0 && totalCost.outputTokens === 0 && totalCost.costUsd === 0)) return "";
|
|
241
|
+
const parts: string[] = [];
|
|
242
|
+
if (totalCost.inputTokens) parts.push(`in:${formatTokens(totalCost.inputTokens)}`);
|
|
243
|
+
if (totalCost.outputTokens) parts.push(`out:${formatTokens(totalCost.outputTokens)}`);
|
|
244
|
+
if (totalCost.costUsd) parts.push(`$${totalCost.costUsd.toFixed(4)}`);
|
|
245
|
+
return parts.join(" ");
|
|
246
|
+
}
|
|
247
|
+
|
|
239
248
|
function formatProgressStats(theme: Theme, progress: Pick<AgentProgress, "toolCount" | "tokens" | "durationMs"> | undefined, includeDuration = true): string {
|
|
240
249
|
if (!progress) return "";
|
|
241
250
|
const parts: string[] = [];
|
|
@@ -1315,7 +1324,7 @@ function renderMultiCompact(d: Details, theme: Theme, frame?: number): Component
|
|
|
1315
1324
|
}
|
|
1316
1325
|
const multiLabel = buildMultiProgressLabel(d, hasRunning);
|
|
1317
1326
|
const itemTitle = multiLabel.itemTitle;
|
|
1318
|
-
const stats = statJoin(theme, [multiLabel.headerLabel, formatProgressStats(theme, totalSummary)]);
|
|
1327
|
+
const stats = statJoin(theme, [multiLabel.headerLabel, formatProgressStats(theme, totalSummary), formatTotalCostStat(d.totalCost)]);
|
|
1319
1328
|
const glyph = hasRunning
|
|
1320
1329
|
? theme.fg("accent", runningGlyph(frame !== undefined ? (runningSeed(progressRunningSeed(totalSummary), d.currentStepIndex) ?? 0) + frame : runningSeed(progressRunningSeed(totalSummary), d.currentStepIndex)))
|
|
1321
1330
|
: failed
|
|
@@ -1547,10 +1556,13 @@ export function renderSubagentResult(
|
|
|
1547
1556
|
{ toolCount: 0, tokens: 0, durationMs: 0 },
|
|
1548
1557
|
);
|
|
1549
1558
|
|
|
1550
|
-
const
|
|
1559
|
+
const summaryParts = [
|
|
1551
1560
|
totalSummary.toolCount || totalSummary.tokens
|
|
1552
|
-
?
|
|
1553
|
-
: ""
|
|
1561
|
+
? `${totalSummary.toolCount} tools, ${formatTokens(totalSummary.tokens)} tok, ${formatDuration(totalSummary.durationMs)}`
|
|
1562
|
+
: "",
|
|
1563
|
+
formatTotalCostStat(d.totalCost),
|
|
1564
|
+
].filter(Boolean);
|
|
1565
|
+
const summaryStr = summaryParts.length ? ` | ${summaryParts.join(", ")}` : "";
|
|
1554
1566
|
|
|
1555
1567
|
const modeLabel = d.mode;
|
|
1556
1568
|
const contextBadge = d.context === "fork" ? theme.fg("warning", " [fork]") : "";
|