pi-subagents 0.78.0 → 0.79.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/docs/agents.md +4 -2
- package/docs/configuration.md +4 -4
- package/docs/extension-api.md +4 -0
- package/docs/observability.md +11 -3
- package/docs/tool-reference.md +12 -1
- package/docs/workflows.md +6 -4
- package/package.json +1 -1
- package/skills/pi-subagents/SKILL.md +1 -0
- package/skills/pi-subagents/references/execution-controls.md +2 -0
- package/src/extension/declaration-pinning.d.ts.map +1 -1
- package/src/extension/declaration-pinning.js +15 -1
- package/src/extension/declaration-pinning.js.map +1 -1
- package/src/extension/index.d.ts.map +1 -1
- package/src/extension/index.js +19 -4
- package/src/extension/index.js.map +1 -1
- package/src/extension/public-execution.d.ts +1 -0
- package/src/extension/public-execution.d.ts.map +1 -1
- package/src/extension/public-execution.js +3 -0
- package/src/extension/public-execution.js.map +1 -1
- package/src/extension/rpc.d.ts.map +1 -1
- package/src/extension/rpc.js +5 -3
- package/src/extension/rpc.js.map +1 -1
- package/src/extension/schemas.d.ts +2 -0
- package/src/extension/schemas.d.ts.map +1 -1
- package/src/extension/schemas.js +1 -0
- package/src/extension/schemas.js.map +1 -1
- package/src/extension/tool-activation.d.ts +1 -0
- package/src/extension/tool-activation.d.ts.map +1 -1
- package/src/extension/tool-activation.js +57 -18
- package/src/extension/tool-activation.js.map +1 -1
- package/src/extension/upgrade-notice.d.ts.map +1 -1
- package/src/extension/upgrade-notice.js +7 -1
- package/src/extension/upgrade-notice.js.map +1 -1
- package/src/intercom/native-supervisor-channel.d.ts +2 -1
- package/src/intercom/native-supervisor-channel.d.ts.map +1 -1
- package/src/intercom/native-supervisor-channel.js +117 -9
- package/src/intercom/native-supervisor-channel.js.map +1 -1
- package/src/runs/background/async-execution.d.ts.map +1 -1
- package/src/runs/background/async-execution.js +13 -16
- package/src/runs/background/async-execution.js.map +1 -1
- package/src/runs/background/async-job-tracker.d.ts.map +1 -1
- package/src/runs/background/async-job-tracker.js +8 -0
- package/src/runs/background/async-job-tracker.js.map +1 -1
- package/src/runs/background/async-resume.d.ts.map +1 -1
- package/src/runs/background/async-resume.js +2 -1
- package/src/runs/background/async-resume.js.map +1 -1
- package/src/runs/background/async-status-snapshot.d.ts.map +1 -1
- package/src/runs/background/async-status-snapshot.js +4 -2
- package/src/runs/background/async-status-snapshot.js.map +1 -1
- package/src/runs/background/async-status.d.ts.map +1 -1
- package/src/runs/background/async-status.js +16 -8
- package/src/runs/background/async-status.js.map +1 -1
- package/src/runs/background/inspect-rpc.d.ts +5 -0
- package/src/runs/background/inspect-rpc.d.ts.map +1 -1
- package/src/runs/background/inspect-rpc.js +20 -3
- package/src/runs/background/inspect-rpc.js.map +1 -1
- package/src/runs/background/result-delivery-ownership.d.ts +0 -2
- package/src/runs/background/result-delivery-ownership.d.ts.map +1 -1
- package/src/runs/background/result-delivery-ownership.js +5 -21
- package/src/runs/background/result-delivery-ownership.js.map +1 -1
- package/src/runs/background/result-files.d.ts +5 -3
- package/src/runs/background/result-files.d.ts.map +1 -1
- package/src/runs/background/result-files.js +10 -6
- package/src/runs/background/result-files.js.map +1 -1
- package/src/runs/background/result-watcher.d.ts.map +1 -1
- package/src/runs/background/result-watcher.js +15 -8
- package/src/runs/background/result-watcher.js.map +1 -1
- package/src/runs/background/resume-guidance.d.ts.map +1 -1
- package/src/runs/background/resume-guidance.js +3 -2
- package/src/runs/background/resume-guidance.js.map +1 -1
- package/src/runs/background/run-child-session.d.ts.map +1 -1
- package/src/runs/background/run-child-session.js +7 -4
- package/src/runs/background/run-child-session.js.map +1 -1
- package/src/runs/background/run-status.d.ts.map +1 -1
- package/src/runs/background/run-status.js +11 -4
- package/src/runs/background/run-status.js.map +1 -1
- package/src/runs/background/stale-run-reconciler.d.ts.map +1 -1
- package/src/runs/background/stale-run-reconciler.js +53 -5
- package/src/runs/background/stale-run-reconciler.js.map +1 -1
- package/src/runs/background/subagent-runner.d.ts.map +1 -1
- package/src/runs/background/subagent-runner.js +15 -5
- package/src/runs/background/subagent-runner.js.map +1 -1
- package/src/runs/background/workflow-terminal-proof.d.ts +18 -1
- package/src/runs/background/workflow-terminal-proof.d.ts.map +1 -1
- package/src/runs/background/workflow-terminal-proof.js +27 -0
- package/src/runs/background/workflow-terminal-proof.js.map +1 -1
- package/src/runs/foreground/async-dismiss-action.d.ts.map +1 -1
- package/src/runs/foreground/async-dismiss-action.js +2 -1
- package/src/runs/foreground/async-dismiss-action.js.map +1 -1
- package/src/runs/foreground/async-steering-action.d.ts.map +1 -1
- package/src/runs/foreground/async-steering-action.js +3 -2
- package/src/runs/foreground/async-steering-action.js.map +1 -1
- package/src/runs/foreground/async-stop-action.d.ts +1 -0
- package/src/runs/foreground/async-stop-action.d.ts.map +1 -1
- package/src/runs/foreground/async-stop-action.js +3 -1
- package/src/runs/foreground/async-stop-action.js.map +1 -1
- package/src/runs/foreground/command-action.d.ts.map +1 -1
- package/src/runs/foreground/command-action.js +2 -1
- package/src/runs/foreground/command-action.js.map +1 -1
- package/src/runs/foreground/execution.d.ts.map +1 -1
- package/src/runs/foreground/execution.js +18 -7
- package/src/runs/foreground/execution.js.map +1 -1
- package/src/runs/foreground/subagent-executor.d.ts +2 -0
- package/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/src/runs/foreground/subagent-executor.js +98 -32
- package/src/runs/foreground/subagent-executor.js.map +1 -1
- package/src/runs/shared/async-status-projection.d.ts +4 -0
- package/src/runs/shared/async-status-projection.d.ts.map +1 -1
- package/src/runs/shared/async-status-projection.js +23 -1
- package/src/runs/shared/async-status-projection.js.map +1 -1
- package/src/runs/shared/child-commands.d.ts +2 -0
- package/src/runs/shared/child-commands.d.ts.map +1 -1
- package/src/runs/shared/child-commands.js +4 -0
- package/src/runs/shared/child-commands.js.map +1 -1
- package/src/runs/shared/child-runtime-config.d.ts +6 -0
- package/src/runs/shared/child-runtime-config.d.ts.map +1 -1
- package/src/runs/shared/child-runtime-config.js +6 -0
- package/src/runs/shared/child-runtime-config.js.map +1 -1
- package/src/runs/shared/child-session.d.ts +6 -6
- package/src/runs/shared/child-session.d.ts.map +1 -1
- package/src/runs/shared/child-session.js +111 -51
- package/src/runs/shared/child-session.js.map +1 -1
- package/src/runs/shared/long-running-guard.d.ts +3 -1
- package/src/runs/shared/long-running-guard.d.ts.map +1 -1
- package/src/runs/shared/long-running-guard.js +75 -17
- package/src/runs/shared/long-running-guard.js.map +1 -1
- package/src/runs/shared/model-resolution.d.ts +5 -1
- package/src/runs/shared/model-resolution.d.ts.map +1 -1
- package/src/runs/shared/model-resolution.js +8 -1
- package/src/runs/shared/model-resolution.js.map +1 -1
- package/src/runs/shared/nested-events.d.ts.map +1 -1
- package/src/runs/shared/nested-events.js +2 -0
- package/src/runs/shared/nested-events.js.map +1 -1
- package/src/runs/shared/pi-spawn.d.ts +5 -1
- package/src/runs/shared/pi-spawn.d.ts.map +1 -1
- package/src/runs/shared/pi-spawn.js +86 -30
- package/src/runs/shared/pi-spawn.js.map +1 -1
- package/src/runs/shared/run-ownership.d.ts +4 -0
- package/src/runs/shared/run-ownership.d.ts.map +1 -0
- package/src/runs/shared/run-ownership.js +9 -0
- package/src/runs/shared/run-ownership.js.map +1 -0
- package/src/runs/shared/subagent-control.d.ts +1 -0
- package/src/runs/shared/subagent-control.d.ts.map +1 -1
- package/src/runs/shared/subagent-control.js +2 -1
- package/src/runs/shared/subagent-control.js.map +1 -1
- package/src/runs/shared/subagent-prompt-runtime.d.ts +45 -18
- package/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
- package/src/runs/shared/subagent-prompt-runtime.js +160 -59
- package/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
- package/src/shared/file-lease.d.ts +7 -1
- package/src/shared/file-lease.d.ts.map +1 -1
- package/src/shared/file-lease.js +8 -2
- package/src/shared/file-lease.js.map +1 -1
- package/src/shared/fork-context.d.ts +3 -1
- package/src/shared/fork-context.d.ts.map +1 -1
- package/src/shared/fork-context.js +23 -13
- package/src/shared/fork-context.js.map +1 -1
- package/src/shared/session-succession.d.ts +5 -0
- package/src/shared/session-succession.d.ts.map +1 -0
- package/src/shared/session-succession.js +25 -0
- package/src/shared/session-succession.js.map +1 -0
- package/src/shared/types.d.ts +15 -1
- package/src/shared/types.d.ts.map +1 -1
- package/src/shared/types.js +3 -0
- package/src/shared/types.js.map +1 -1
- package/src/shared/utils.d.ts +11 -0
- package/src/shared/utils.d.ts.map +1 -1
- package/src/shared/utils.js +17 -0
- package/src/shared/utils.js.map +1 -1
- package/src/slash/slash-commands.d.ts.map +1 -1
- package/src/slash/slash-commands.js +2 -2
- package/src/slash/slash-commands.js.map +1 -1
- package/src/watchdog/register-main.js +2 -2
- package/src/watchdog/register-main.js.map +1 -1
- package/src/watchdog/runtime.d.ts.map +1 -1
- package/src/watchdog/runtime.js +3 -5
- package/src/watchdog/runtime.js.map +1 -1
- package/src/workflows/scripted-workflow.d.ts +1 -1
- package/src/workflows/scripted-workflow.d.ts.map +1 -1
- package/src/workflows/workflow-child-summary.d.ts +5 -0
- package/src/workflows/workflow-child-summary.d.ts.map +1 -1
- package/src/workflows/workflow-child-summary.js +10 -0
- package/src/workflows/workflow-child-summary.js.map +1 -1
- package/src/workflows/workflow-reuse.d.ts +6 -1
- package/src/workflows/workflow-reuse.d.ts.map +1 -1
- package/src/workflows/workflow-reuse.js +22 -1
- package/src/workflows/workflow-reuse.js.map +1 -1
|
@@ -29,12 +29,13 @@ import { runSetupCommand } from "../shared/worktree-setup-command.js";
|
|
|
29
29
|
import { DEFAULT_MAX_OUTPUT, SUBAGENT_LIFECYCLE_ARTIFACT_VERSION, truncateOutput, } from "../../shared/types.js";
|
|
30
30
|
import { DEFAULT_CONTROL_CONFIG, buildControlEvent, deriveActivityState, claimControlNotification, formatControlIntercomMessage, formatControlNoticeMessage, shouldEmitOpenToolAttention, } from "../shared/subagent-control.js";
|
|
31
31
|
import { isDynamicRunnerGroup, isParallelGroup, flattenSteps, mapConcurrent, aggregateParallelOutputs, MAX_PARALLEL_CONCURRENCY, DEFAULT_GLOBAL_CONCURRENCY_LIMIT, Semaphore, } from "../shared/parallel-utils.js";
|
|
32
|
-
import { applyThinkingSuffix, projectLaunchResolvedChildExtensions, resolvePiLaunchToolPlan } from "../shared/child-tool-plan.js";
|
|
32
|
+
import { applyThinkingSuffix, projectLaunchResolvedChildExtensions, resolvePiLaunchToolPlan, supervisorChannelDir } from "../shared/child-tool-plan.js";
|
|
33
|
+
import { retainsChildCommand } from "../shared/child-commands.js";
|
|
33
34
|
import { buildRunnerChildLaunch } from "./runner-child-launch.js";
|
|
34
35
|
import { normalizeExtensionBindings } from "../shared/extension-bindings.js";
|
|
35
36
|
import { runChildSession } from "./run-child-session.js";
|
|
36
37
|
import { loadRunnerChildSessionFactory } from "./runner-child-sessions.js";
|
|
37
|
-
import { SUBAGENT_CHILD_ENV } from "../shared/child-runtime-config.js";
|
|
38
|
+
import { SUBAGENT_CHILD_ENV, SUBAGENT_RUNNER_PID_ENV } from "../shared/child-runtime-config.js";
|
|
38
39
|
import { deriveChildSessionName } from "../../shared/child-session-name.js";
|
|
39
40
|
import { alignForkedSessionCwd } from "../../shared/fork-session-cwd.js";
|
|
40
41
|
import { outputEntryFromAsyncResult, resolveOutputReferences } from "../shared/chain-outputs.js";
|
|
@@ -85,6 +86,7 @@ const INTERCOM_DETACH_RECEIPT = "Detached for intercom coordination before task
|
|
|
85
86
|
// into one of them must register nothing; the variable marks the process as a
|
|
86
87
|
// child host.
|
|
87
88
|
process.env[SUBAGENT_CHILD_ENV] = "1";
|
|
89
|
+
process.env[SUBAGENT_RUNNER_PID_ENV] = String(process.pid);
|
|
88
90
|
function persistStepArtifacts(input) {
|
|
89
91
|
const errors = {};
|
|
90
92
|
if (input.artifactConfig?.includeOutput !== false) {
|
|
@@ -1689,6 +1691,7 @@ export async function runSubagent(config, childSessions) {
|
|
|
1689
1691
|
...(config.launchResolvedExtensions ? { launchResolvedExtensions: config.launchResolvedExtensions } : {}),
|
|
1690
1692
|
...(config.capabilityCeiling ? { capabilityCeiling: config.capabilityCeiling } : {}),
|
|
1691
1693
|
...(config.runFanoutBudget ? { runFanoutBudget: getRunFanoutBudgetSnapshot(config.runFanoutBudget) } : {}),
|
|
1694
|
+
...(config.revivalLease ? { revivedFrom: config.revivalLease.sourceRunId } : {}),
|
|
1692
1695
|
...(config.parentWorkflowRunId ? { parentWorkflowRunId: config.parentWorkflowRunId } : {}),
|
|
1693
1696
|
...(config.workflowKey ? { workflowKey: config.workflowKey } : {}),
|
|
1694
1697
|
...(config.lane ? { lane: config.lane } : {}),
|
|
@@ -2469,6 +2472,7 @@ export async function runSubagent(config, childSessions) {
|
|
|
2469
2472
|
step.activityState = "needs_attention";
|
|
2470
2473
|
statusPayload.activityState = "needs_attention";
|
|
2471
2474
|
const toolDurationMs = Math.max(0, now - target.startedAt);
|
|
2475
|
+
const toolCallId = target.key.startsWith("id:") ? target.key.slice(3) : undefined;
|
|
2472
2476
|
appendControlEvent(buildControlEvent(omitUndefinedProperties({
|
|
2473
2477
|
type: "needs_attention",
|
|
2474
2478
|
from: previous,
|
|
@@ -2483,7 +2487,8 @@ export async function runSubagent(config, childSessions) {
|
|
|
2483
2487
|
tokens: step.tokens?.total,
|
|
2484
2488
|
toolCount: step.toolCount,
|
|
2485
2489
|
currentTool: target.tool,
|
|
2486
|
-
toolCallId
|
|
2490
|
+
toolCallId,
|
|
2491
|
+
hasCommandController: Boolean(toolCallId && retainsChildCommand(supervisorChannelDir(id, step.agent, flatIndex), toolCallId)),
|
|
2487
2492
|
currentToolDurationMs: toolDurationMs,
|
|
2488
2493
|
currentPath: target.path,
|
|
2489
2494
|
})));
|
|
@@ -2861,14 +2866,16 @@ export async function runSubagent(config, childSessions) {
|
|
|
2861
2866
|
const resultToolName = event.message.toolName;
|
|
2862
2867
|
const blockedTool = (typeof resultToolName === "string" && resultToolName.length > 0 ? resultToolName : undefined) ?? toolSnapshot?.tool;
|
|
2863
2868
|
const configuredToolBudget = flatSteps[flatIndex]?.toolBudget;
|
|
2864
|
-
|
|
2869
|
+
const budgetBlocked = configuredToolBudget !== undefined && isToolBudgetBlockedMessage(configuredToolBudget, resultText, blockedTool);
|
|
2870
|
+
if (budgetBlocked) {
|
|
2865
2871
|
step.toolBudget = toolBudgetState(configuredToolBudget, step.toolCount ?? 0, blockedTool);
|
|
2866
2872
|
step.toolBudgetBlocked = true;
|
|
2867
2873
|
statusPayload.toolBudget = step.toolBudget;
|
|
2868
2874
|
statusPayload.toolBudgetBlocked = true;
|
|
2869
2875
|
}
|
|
2870
2876
|
appendRecentStepOutput(step, resultText.split("\n").slice(-10));
|
|
2871
|
-
|
|
2877
|
+
// A budget block has its own signal; it is not a failing mutation.
|
|
2878
|
+
if (toolSnapshot?.mutates && !budgetBlocked && didMutatingToolFail(event.message)) {
|
|
2872
2879
|
const state = mutatingFailureStates[flatIndex];
|
|
2873
2880
|
recordMutatingFailure(state, omitUndefinedProperties({
|
|
2874
2881
|
tool: toolSnapshot.tool,
|
|
@@ -2918,6 +2925,9 @@ export async function runSubagent(config, childSessions) {
|
|
|
2918
2925
|
step.model = observedModel;
|
|
2919
2926
|
}
|
|
2920
2927
|
}
|
|
2928
|
+
const { provider, model } = event.message;
|
|
2929
|
+
if (typeof provider === "string" && provider && typeof model === "string" && model)
|
|
2930
|
+
step.resolvedModel = { provider, model };
|
|
2921
2931
|
const usage = event.message.usage;
|
|
2922
2932
|
if (config.usageBudget) {
|
|
2923
2933
|
const known = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0;
|