pi-subagents 0.75.0 → 0.76.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 +62 -0
- package/docs/agents.md +1 -1
- package/docs/configuration.md +4 -2
- package/docs/extension-api.md +3 -3
- package/docs/missions.md +12 -2
- package/docs/tool-reference.md +21 -6
- package/docs/workflows.md +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +5 -0
- package/index.js.map +1 -1
- package/package.json +3 -1
- package/src/agents/agent-memory.js +3 -3
- package/src/agents/agent-memory.js.map +1 -1
- package/src/agents/agent-serializer.d.ts.map +1 -1
- package/src/agents/agent-serializer.js +8 -1
- package/src/agents/agent-serializer.js.map +1 -1
- package/src/agents/agents.d.ts.map +1 -1
- package/src/agents/agents.js +101 -121
- package/src/agents/agents.js.map +1 -1
- package/src/extension/doctor.d.ts +3 -1
- package/src/extension/doctor.d.ts.map +1 -1
- package/src/extension/doctor.js +3 -9
- package/src/extension/doctor.js.map +1 -1
- package/src/extension/index.d.ts.map +1 -1
- package/src/extension/index.js +55 -11
- package/src/extension/index.js.map +1 -1
- package/src/extension/reply-workflow-script.d.ts.map +1 -1
- package/src/extension/reply-workflow-script.js +20 -11
- package/src/extension/reply-workflow-script.js.map +1 -1
- package/src/extension/schemas.d.ts +1 -1
- package/src/extension/schemas.js +8 -8
- package/src/extension/schemas.js.map +1 -1
- package/src/extension/tool-description.js +1 -1
- package/src/extension/tool-description.js.map +1 -1
- package/src/integrations/herdr-status.d.ts +0 -1
- package/src/integrations/herdr-status.d.ts.map +1 -1
- package/src/integrations/herdr-status.js +18 -52
- package/src/integrations/herdr-status.js.map +1 -1
- package/src/intercom/native-supervisor-channel.d.ts +1 -0
- package/src/intercom/native-supervisor-channel.d.ts.map +1 -1
- package/src/intercom/native-supervisor-channel.js +1 -1
- package/src/intercom/native-supervisor-channel.js.map +1 -1
- package/src/intercom/result-intercom.d.ts.map +1 -1
- package/src/intercom/result-intercom.js +2 -1
- package/src/intercom/result-intercom.js.map +1 -1
- package/src/profiles/profiles.d.ts.map +1 -1
- package/src/profiles/profiles.js +25 -22
- package/src/profiles/profiles.js.map +1 -1
- package/src/runs/background/active-async-capacity.d.ts +15 -1
- package/src/runs/background/active-async-capacity.d.ts.map +1 -1
- package/src/runs/background/active-async-capacity.js +51 -6
- package/src/runs/background/active-async-capacity.js.map +1 -1
- package/src/runs/background/async-job-tracker.d.ts +3 -2
- package/src/runs/background/async-job-tracker.d.ts.map +1 -1
- package/src/runs/background/async-job-tracker.js +2 -1
- package/src/runs/background/async-job-tracker.js.map +1 -1
- package/src/runs/background/calendar-schedule.d.ts +27 -0
- package/src/runs/background/calendar-schedule.d.ts.map +1 -0
- package/src/runs/background/calendar-schedule.js +94 -0
- package/src/runs/background/calendar-schedule.js.map +1 -0
- package/src/runs/background/notify.d.ts +13 -2
- package/src/runs/background/notify.d.ts.map +1 -1
- package/src/runs/background/notify.js +48 -5
- package/src/runs/background/notify.js.map +1 -1
- package/src/runs/background/result-files.d.ts +2 -0
- package/src/runs/background/result-files.d.ts.map +1 -1
- package/src/runs/background/result-files.js +4 -0
- package/src/runs/background/result-files.js.map +1 -1
- package/src/runs/background/result-watcher.d.ts +5 -1
- package/src/runs/background/result-watcher.d.ts.map +1 -1
- package/src/runs/background/result-watcher.js +44 -7
- package/src/runs/background/result-watcher.js.map +1 -1
- package/src/runs/background/run-child-session.d.ts +2 -0
- package/src/runs/background/run-child-session.d.ts.map +1 -1
- package/src/runs/background/run-child-session.js +12 -1
- package/src/runs/background/run-child-session.js.map +1 -1
- package/src/runs/background/scheduled-runs.d.ts +3 -1
- package/src/runs/background/scheduled-runs.d.ts.map +1 -1
- package/src/runs/background/scheduled-runs.js +184 -47
- package/src/runs/background/scheduled-runs.js.map +1 -1
- package/src/runs/background/subagent-runner.d.ts +1 -0
- package/src/runs/background/subagent-runner.d.ts.map +1 -1
- package/src/runs/background/subagent-runner.js +14 -6
- package/src/runs/background/subagent-runner.js.map +1 -1
- package/src/runs/background/wait-completions.d.ts.map +1 -1
- package/src/runs/background/wait-completions.js +1 -0
- package/src/runs/background/wait-completions.js.map +1 -1
- package/src/runs/background/workflow-terminal-proof.d.ts +14 -1
- package/src/runs/background/workflow-terminal-proof.d.ts.map +1 -1
- package/src/runs/background/workflow-terminal-proof.js +41 -28
- package/src/runs/background/workflow-terminal-proof.js.map +1 -1
- package/src/runs/foreground/async-stop-action.d.ts.map +1 -1
- package/src/runs/foreground/async-stop-action.js +30 -11
- package/src/runs/foreground/async-stop-action.js.map +1 -1
- package/src/runs/foreground/execution.d.ts.map +1 -1
- package/src/runs/foreground/execution.js +33 -13
- package/src/runs/foreground/execution.js.map +1 -1
- package/src/runs/foreground/foreground-history.d.ts.map +1 -1
- package/src/runs/foreground/foreground-history.js +1 -0
- package/src/runs/foreground/foreground-history.js.map +1 -1
- package/src/runs/foreground/subagent-executor.d.ts +2 -1
- package/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/src/runs/foreground/subagent-executor.js +54 -11
- package/src/runs/foreground/subagent-executor.js.map +1 -1
- package/src/runs/shared/child-session.d.ts.map +1 -1
- package/src/runs/shared/child-session.js +10 -2
- package/src/runs/shared/child-session.js.map +1 -1
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts.map +1 -1
- package/src/runs/shared/mcp-direct-tool-allowlist.js +5 -3
- package/src/runs/shared/mcp-direct-tool-allowlist.js.map +1 -1
- package/src/runs/shared/parallel-handoff.d.ts +10 -4
- package/src/runs/shared/parallel-handoff.d.ts.map +1 -1
- package/src/runs/shared/parallel-handoff.js +53 -6
- package/src/runs/shared/parallel-handoff.js.map +1 -1
- package/src/runs/shared/partial-output.d.ts +18 -0
- package/src/runs/shared/partial-output.d.ts.map +1 -0
- package/src/runs/shared/partial-output.js +29 -0
- package/src/runs/shared/partial-output.js.map +1 -0
- package/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
- package/src/runs/shared/subagent-prompt-runtime.js +4 -3
- package/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
- package/src/runs/shared/worktree-cleanup-apply.d.ts +37 -0
- package/src/runs/shared/worktree-cleanup-apply.d.ts.map +1 -0
- package/src/runs/shared/worktree-cleanup-apply.js +179 -0
- package/src/runs/shared/worktree-cleanup-apply.js.map +1 -0
- package/src/runs/shared/worktree-cleanup-plan.d.ts +7 -0
- package/src/runs/shared/worktree-cleanup-plan.d.ts.map +1 -1
- package/src/runs/shared/worktree-cleanup-plan.js +41 -19
- package/src/runs/shared/worktree-cleanup-plan.js.map +1 -1
- package/src/runs/shared/worktree-lock.d.ts +6 -0
- package/src/runs/shared/worktree-lock.d.ts.map +1 -0
- package/src/runs/shared/worktree-lock.js +41 -0
- package/src/runs/shared/worktree-lock.js.map +1 -0
- package/src/runs/shared/worktree.d.ts +3 -0
- package/src/runs/shared/worktree.d.ts.map +1 -1
- package/src/runs/shared/worktree.js +9 -1
- package/src/runs/shared/worktree.js.map +1 -1
- package/src/shared/file-lease.d.ts +5 -0
- package/src/shared/file-lease.d.ts.map +1 -0
- package/src/shared/file-lease.js +101 -0
- package/src/shared/file-lease.js.map +1 -0
- package/src/shared/package-version.d.ts +3 -0
- package/src/shared/package-version.d.ts.map +1 -0
- package/src/shared/package-version.js +15 -0
- package/src/shared/package-version.js.map +1 -0
- package/src/shared/parent-wake.d.ts +18 -0
- package/src/shared/parent-wake.d.ts.map +1 -0
- package/src/shared/parent-wake.js +47 -0
- package/src/shared/parent-wake.js.map +1 -0
- package/src/shared/settings-file-lease.d.ts +5 -0
- package/src/shared/settings-file-lease.d.ts.map +1 -0
- package/src/shared/settings-file-lease.js +39 -0
- package/src/shared/settings-file-lease.js.map +1 -0
- package/src/shared/types.d.ts +10 -0
- package/src/shared/types.d.ts.map +1 -1
- package/src/shared/types.js.map +1 -1
- package/src/tui/render.d.ts.map +1 -1
- package/src/tui/render.js +7 -2
- package/src/tui/render.js.map +1 -1
- package/src/watchdog/diff-tool.js +2 -2
- package/src/watchdog/diff-tool.js.map +1 -1
- package/src/watchdog/register-main.js +1 -2
- package/src/watchdog/register-main.js.map +1 -1
- package/src/watchdog/runtime.d.ts +3 -3
- package/src/watchdog/runtime.d.ts.map +1 -1
- package/src/watchdog/runtime.js +7 -3
- package/src/watchdog/runtime.js.map +1 -1
- package/src/watchdog/settings.d.ts.map +1 -1
- package/src/watchdog/settings.js +22 -17
- package/src/watchdog/settings.js.map +1 -1
|
@@ -59,7 +59,7 @@ import { assertRequiredChildExtensionsAdmitted, hasMandatoryRequiredChildExtensi
|
|
|
59
59
|
import { finalizeSingleOutput, injectSingleOutputInstruction, normalizeSingleOutputOverride, outputPathMappingFromTask, resolveSingleOutputPath, validateFileOnlyOutputMode } from "../shared/single-output.js";
|
|
60
60
|
import { assertJsonSchemaObject, cleanupStructuredOutputRuntime, createStructuredOutputRuntime } from "../shared/structured-output.js";
|
|
61
61
|
import { compactForegroundDetails, getSingleResultOutput, PROMPT_REDACTED, readStatus, resolveChildCwd, sumResultsCost, sumResultsUsage, toAgentToolUsage } from "../../shared/utils.js";
|
|
62
|
-
import { discardPreservedWorktrees, formatParallelHandoffError, formatParallelHandoffReference, formatStoredParallelHandoffCleanup, parallelHandoffPath, readParallelHandoffManifest, recordParallelHandoffMerge, recordParallelHandoffSupersession, writeParallelHandoffGroup, writeWorktreeSetupHandoff } from "../shared/parallel-handoff.js";
|
|
62
|
+
import { discardPreservedWorktrees, formatParallelHandoffError, formatParallelHandoffReference, protectRetainedWorktreeForResume, formatStoredParallelHandoffCleanup, parallelHandoffPath, readParallelHandoffManifest, recordParallelHandoffMerge, recordParallelHandoffSupersession, writeParallelHandoffGroup, writeWorktreeSetupHandoff } from "../shared/parallel-handoff.js";
|
|
63
63
|
import { summarizeContextModes } from "../shared/context-mode.js";
|
|
64
64
|
import { attachNestedChildrenToResultChildren, buildSubagentResultIntercomPayload, deliverSubagentResultIntercomEvent, formatSubagentResultReceipt, resolveSubagentResultStatus, stripDetailsOutputsForIntercomReceipt, } from "../../intercom/result-intercom.js";
|
|
65
65
|
import { applySteeringRecoveryAgentConfig, asyncReviveRequiresRecoveryDescriptor, buildRevivedAsyncTask, readAsyncRecoveryDescriptor, resolveAsyncResumeTarget, resolveAsyncRunLocation } from "../background/async-resume.js";
|
|
@@ -107,6 +107,7 @@ import { authorizeWorkflowResourceHost, claimWorkflowChildPermit, consumeWorkflo
|
|
|
107
107
|
import { deepFreezeWorkflowArgs, normalizeWorkflowArgs, resolveStructuredWorkflowResource, resolveWorkflowResource } from "../../workflows/workflow-resources.js";
|
|
108
108
|
import { stableJsonDigest } from "../../shared/launch-contract.js";
|
|
109
109
|
import { cleanupWorktrees, createWorktrees, preflightWorktreeSource, withWorktreeTransaction, diffWorktrees, formatWorktreeDiffSummary, } from "../shared/worktree.js";
|
|
110
|
+
import { applyReviewedCleanupPlan, formatCleanupReceipt, loadReviewedCleanupPlan } from "../shared/worktree-cleanup-apply.js";
|
|
110
111
|
import { createWorktreeCleanupPlan, formatWorktreeCleanupPlan } from "../shared/worktree-cleanup-plan.js";
|
|
111
112
|
import { DIRS, DEFAULT_ARTIFACT_CONFIG, DEFAULT_MAX_OUTPUT, DEFAULT_FORK_PREAMBLE, SUBAGENT_ACTIONS, SUBAGENT_ASYNC_STARTED_EVENT, SUBAGENT_CHILD_STATUS_EVENT, SUBAGENT_CONTROL_EVENT, SUBAGENT_CONTROL_INTERCOM_EVENT, SUBAGENT_FOREGROUND_COMPLETE_EVENT, SUBAGENT_LIFECYCLE_ARTIFACT_VERSION, checkSubagentDepth, resolveChildMaxSubagentDepth, resolveCurrentMaxSubagentDepth, resolveMaxSubagentSpawnsPerRun, truncateOutput, wrapForkTask, } from "../../shared/types.js";
|
|
112
113
|
import { deriveChildSessionName } from "../../shared/child-session-name.js";
|
|
@@ -465,6 +466,7 @@ function rememberForegroundRun(state, input) {
|
|
|
465
466
|
...(result.error ? { error: result.error } : {}),
|
|
466
467
|
...(result.finalOutput ? { finalOutput: result.finalOutput } : {}),
|
|
467
468
|
...(result.outputState ? { outputState: result.outputState } : {}),
|
|
469
|
+
...(result.outputPartial ? { outputPartial: true } : {}),
|
|
468
470
|
...(result.outputMode ? { outputMode: result.outputMode } : {}),
|
|
469
471
|
...(result.savedOutputPath ? { savedOutputPath: result.savedOutputPath } : {}),
|
|
470
472
|
...(result.outputSaveError ? { outputSaveError: result.outputSaveError } : {}),
|
|
@@ -549,6 +551,7 @@ function updateRememberedForegroundChild(state, input) {
|
|
|
549
551
|
...(input.result.error ? { error: input.result.error } : {}),
|
|
550
552
|
...(input.result.finalOutput ? { finalOutput: input.result.finalOutput } : {}),
|
|
551
553
|
outputState: input.result.outputState,
|
|
554
|
+
outputPartial: input.result.outputPartial,
|
|
552
555
|
outputMode: input.result.outputMode,
|
|
553
556
|
savedOutputPath: input.result.savedOutputPath,
|
|
554
557
|
outputSaveError: input.result.outputSaveError,
|
|
@@ -1645,6 +1648,19 @@ async function resumeAsyncRun(input) {
|
|
|
1645
1648
|
: "External runners do not persist Pi sessions and cannot be resumed.";
|
|
1646
1649
|
return { content: [{ type: "text", text: message }], isError: true, details: { mode: "management", results: [] } };
|
|
1647
1650
|
}
|
|
1651
|
+
if (input.params.baseRef !== undefined && "managedWorktree" in target && target.managedWorktree === true) {
|
|
1652
|
+
return { content: [{ type: "text", text: "Cannot resume with baseRef: retained managed-worktree children continue in their existing worktree. Start a new worktree run from that base ref instead." }], isError: true, details: { mode: "management", results: [] } };
|
|
1653
|
+
}
|
|
1654
|
+
if (target.source === "async" && target.managedWorktree && target.asyncDir) {
|
|
1655
|
+
try {
|
|
1656
|
+
const protectedCwd = await protectRetainedWorktreeForResume(parallelHandoffPath(target.asyncDir), target.runId, target.index, input.signal);
|
|
1657
|
+
if (path.resolve(protectedCwd) !== path.resolve(effectiveCwd))
|
|
1658
|
+
throw new Error("Retained worktree cwd changed during resume admission.");
|
|
1659
|
+
}
|
|
1660
|
+
catch (error) {
|
|
1661
|
+
return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true, details: { mode: "management", results: [] } };
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1648
1664
|
if (target.source === "async" && target.runner?.type === "external-job") {
|
|
1649
1665
|
if (attachChain)
|
|
1650
1666
|
return { content: [{ type: "text", text: "External-job follow-up does not support chain attachment. Use action='resume' with message instead." }], isError: true, details: { mode: "management", results: [] } };
|
|
@@ -1792,9 +1808,6 @@ async function resumeAsyncRun(input) {
|
|
|
1792
1808
|
if (!revivalSessionFile) {
|
|
1793
1809
|
return { content: [{ type: "text", text: `Async run '${target.runId}' child ${target.index} does not have a persisted session file to resume from.` }], isError: true, details: { mode: "management", results: [] } };
|
|
1794
1810
|
}
|
|
1795
|
-
if (input.params.baseRef !== undefined && "managedWorktree" in target && target.managedWorktree === true) {
|
|
1796
|
-
return { content: [{ type: "text", text: "Cannot resume with baseRef: retained managed-worktree children continue in their existing worktree. Start a new worktree run from that base ref instead." }], isError: true, details: { mode: "management", results: [] } };
|
|
1797
|
-
}
|
|
1798
1811
|
if (target.source === "async" && asyncReviveRequiresRecoveryDescriptor(target)) {
|
|
1799
1812
|
return { content: [{ type: "text", text: `Async child '${target.runId}' is missing its required run fan-out recovery identity. Start a new run instead.` }], isError: true, details: { mode: "management", results: [] } };
|
|
1800
1813
|
}
|
|
@@ -2080,6 +2093,7 @@ async function emitForegroundResultIntercom(input) {
|
|
|
2080
2093
|
...(result.sessionName ? { sessionName: result.sessionName } : {}),
|
|
2081
2094
|
status: foregroundResultIntercomStatus(result),
|
|
2082
2095
|
outputState: result.outputState ?? "unknown",
|
|
2096
|
+
...(result.outputPartial ? { outputPartial: true } : {}),
|
|
2083
2097
|
summary: resultSummaryForIntercom(result),
|
|
2084
2098
|
index,
|
|
2085
2099
|
artifactPath: result.artifactPaths?.outputPath,
|
|
@@ -4971,7 +4985,7 @@ export function createSubagentExecutor(deps) {
|
|
|
4971
4985
|
if (deps.state.currentSessionId !== currentSessionId || deps.state.completionOwnerId !== completionOwnerId)
|
|
4972
4986
|
return false;
|
|
4973
4987
|
try {
|
|
4974
|
-
deps.pi.sendMessage({
|
|
4988
|
+
(deps.parentWake ?? deps.pi).sendMessage({
|
|
4975
4989
|
customType: "subagent-workflow-result-write-failed",
|
|
4976
4990
|
content: message,
|
|
4977
4991
|
display: true,
|
|
@@ -5523,7 +5537,7 @@ export function createSubagentExecutor(deps) {
|
|
|
5523
5537
|
workflowRunning: notification.workflowRunning,
|
|
5524
5538
|
});
|
|
5525
5539
|
try {
|
|
5526
|
-
deps.pi.sendMessage({
|
|
5540
|
+
(deps.parentWake ?? deps.pi).sendMessage({
|
|
5527
5541
|
customType: "subagent-incremental-child-notify",
|
|
5528
5542
|
content: formatIncrementalChildCompletion(notification),
|
|
5529
5543
|
display: notification.outcome !== "completed",
|
|
@@ -6122,11 +6136,35 @@ export function createSubagentExecutor(deps) {
|
|
|
6122
6136
|
if (deps.allowMutatingManagementActions === false) {
|
|
6123
6137
|
return { content: [{ type: "text", text: "Action 'worktree.cleanup' is not available from child-safe subagent fanout mode." }], isError: true, details: { mode: "management", results: [] } };
|
|
6124
6138
|
}
|
|
6139
|
+
if (paramsWithResolvedCwd.mode === "apply") {
|
|
6140
|
+
try {
|
|
6141
|
+
if (!paramsWithResolvedCwd.repo?.trim() || !paramsWithResolvedCwd.planId?.trim() || paramsWithResolvedCwd.handoffPath !== undefined)
|
|
6142
|
+
throw new Error("worktree.cleanup apply requires explicit repo and planId, without handoffPath.");
|
|
6143
|
+
const repo = path.resolve(requestCwd, paramsWithResolvedCwd.repo);
|
|
6144
|
+
const plan = loadReviewedCleanupPlan(repo, paramsWithResolvedCwd.planId);
|
|
6145
|
+
const decision = resolveAuthorityDecision({ action: "discardWorktree", ...(deps.config.authorityPolicy === undefined ? {} : { policy: deps.config.authorityPolicy }) });
|
|
6146
|
+
if (decision === "forbid")
|
|
6147
|
+
throw new Error("Authority policy forbids worktree cleanup.");
|
|
6148
|
+
if (decision === "confirm") {
|
|
6149
|
+
if (!ctx.hasUI)
|
|
6150
|
+
throw new Error("Authority policy requires interactive confirmation for worktree cleanup.");
|
|
6151
|
+
if (!await ctx.ui.confirm("Apply reviewed worktree cleanup?", `Repository: ${plan.repoRoot}\nPlan: ${plan.planId}\nRemove up to ${plan.entries.filter((entry) => entry.decision === "remove").length} eligible worktrees. All local branches are retained.`))
|
|
6152
|
+
return { content: [{ type: "text", text: "Worktree cleanup canceled." }], details: { mode: "management", results: [] } };
|
|
6153
|
+
}
|
|
6154
|
+
const applied = await applyReviewedCleanupPlan({ repo: plan.repoRoot, planId: plan.planId, authorized: true, signal,
|
|
6155
|
+
foregroundRunOwnership: (runId) => deps.state.foregroundControls.has(runId) ? "active" : (deps.state.foregroundRuns?.get(runId)?.children.length && deps.state.foregroundRuns.get(runId).children.every((child) => child.status !== "detached")) ? "terminal" : "unknown",
|
|
6156
|
+
});
|
|
6157
|
+
return { content: [{ type: "text", text: formatCleanupReceipt(applied) }], details: { mode: "management", results: [] } };
|
|
6158
|
+
}
|
|
6159
|
+
catch (error) {
|
|
6160
|
+
return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true, details: { mode: "management", results: [] } };
|
|
6161
|
+
}
|
|
6162
|
+
}
|
|
6125
6163
|
if (paramsWithResolvedCwd.mode !== "plan") {
|
|
6126
|
-
return { content: [{ type: "text", text: "worktree.cleanup
|
|
6164
|
+
return { content: [{ type: "text", text: "worktree.cleanup requires mode='plan' or mode='apply'." }], isError: true, details: { mode: "management", results: [] } };
|
|
6127
6165
|
}
|
|
6128
6166
|
if (paramsWithResolvedCwd.planId !== undefined) {
|
|
6129
|
-
return { content: [{ type: "text", text: "worktree.cleanup plan mode does not accept planId
|
|
6167
|
+
return { content: [{ type: "text", text: "worktree.cleanup plan mode does not accept planId." }], isError: true, details: { mode: "management", results: [] } };
|
|
6130
6168
|
}
|
|
6131
6169
|
try {
|
|
6132
6170
|
const created = createWorktreeCleanupPlan({
|
|
@@ -6395,10 +6433,13 @@ export function createSubagentExecutor(deps) {
|
|
|
6395
6433
|
if (action === "doctor") {
|
|
6396
6434
|
let currentSessionFile = null;
|
|
6397
6435
|
let currentSessionId = deps.state.currentSessionId;
|
|
6436
|
+
let budgetSessionId = deps.state.currentSessionId;
|
|
6398
6437
|
let sessionError;
|
|
6399
6438
|
try {
|
|
6400
6439
|
currentSessionFile = ctx.sessionManager.getSessionFile() ?? null;
|
|
6401
6440
|
currentSessionId = ctx.sessionManager.getSessionId();
|
|
6441
|
+
// Launch admission's key (resolveCurrentSessionId) without its throw for an unbound session.
|
|
6442
|
+
budgetSessionId = currentSessionFile ?? currentSessionId;
|
|
6402
6443
|
}
|
|
6403
6444
|
catch (error) {
|
|
6404
6445
|
sessionError = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
@@ -6411,9 +6452,9 @@ export function createSubagentExecutor(deps) {
|
|
|
6411
6452
|
if (!sessionError)
|
|
6412
6453
|
sessionError = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
6413
6454
|
}
|
|
6414
|
-
const spawnBudget = getSpawnBudgetSnapshot(deps.state, deps.config,
|
|
6415
|
-
const activeAsyncCapacity =
|
|
6416
|
-
? getActiveAsyncCapacitySnapshot(
|
|
6455
|
+
const spawnBudget = getSpawnBudgetSnapshot(deps.state, deps.config, budgetSessionId);
|
|
6456
|
+
const activeAsyncCapacity = budgetSessionId
|
|
6457
|
+
? getActiveAsyncCapacitySnapshot(budgetSessionId, resolveMaxActiveAsyncRunsPerSession(deps.config.maxActiveAsyncRunsPerSession), { liveWorkflowRunIds: new Set(deps.state.workflowControllers?.keys() ?? []), abandonedSlotReleaseAfterMs: resolveAbandonedSlotReleaseAfterMs(deps.config.capacity?.abandonedSlotReleaseAfterMs) })
|
|
6417
6458
|
: { used: 0, limit: resolveMaxActiveAsyncRunsPerSession(deps.config.maxActiveAsyncRunsPerSession) ?? 0 };
|
|
6418
6459
|
deps.state.activeAsyncCapacity = activeAsyncCapacity;
|
|
6419
6460
|
return {
|
|
@@ -6427,6 +6468,8 @@ export function createSubagentExecutor(deps) {
|
|
|
6427
6468
|
requestedSessionDir: paramsWithResolvedCwd.sessionDir,
|
|
6428
6469
|
currentSessionFile,
|
|
6429
6470
|
currentSessionId,
|
|
6471
|
+
spawnBudget,
|
|
6472
|
+
activeAsyncCapacity,
|
|
6430
6473
|
orchestratorTarget,
|
|
6431
6474
|
sessionError,
|
|
6432
6475
|
expandTilde: deps.expandTilde,
|