@xzzpig/pi-subagents 0.24.1 → 0.25.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 +28 -0
- package/bundle/agent-management.js +4 -4
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +2 -2
- package/bundle/chunk-34TUUBRN.js +1107 -0
- package/bundle/{chunk-SW2VMNIU.js → chunk-5OD3OWTE.js} +2 -2
- package/bundle/{chunk-ZWXU5SPQ.js → chunk-5YEOWNSD.js} +371 -135
- package/bundle/{chunk-EUPJB4S7.js → chunk-5Z7JAORM.js} +196 -1219
- package/bundle/{chunk-LCDJWBVM.js → chunk-66JNFRFS.js} +1 -1
- package/bundle/{chunk-6BJUEES3.js → chunk-6MNRKUHY.js} +23 -12
- package/bundle/{chunk-ED55MIC2.js → chunk-CGFF4WA3.js} +42 -19
- package/bundle/{chunk-TMHVDPYW.js → chunk-DLVPMML3.js} +263 -154
- package/bundle/chunk-HXRB42AF.js +108 -0
- package/bundle/{chunk-355ECEP2.js → chunk-IH7LQVEE.js} +29 -14
- package/bundle/{chunk-SLNMBXLL.js → chunk-IJWITCC6.js} +411 -249
- package/bundle/{chunk-RU522D5W.js → chunk-IKFKH5EL.js} +369 -50
- package/bundle/{chunk-Z6TFJ6BR.js → chunk-INWSUNI6.js} +1 -1
- package/bundle/{chunk-JEA2ZKUA.js → chunk-IUDEI6FJ.js} +35 -200
- package/bundle/{chunk-WW76JRIX.js → chunk-JAXVBXGF.js} +1 -1
- package/bundle/{chunk-ICNYIALB.js → chunk-JH5H4CYJ.js} +784 -474
- package/bundle/{chunk-35GII5EF.js → chunk-JWFLPSTP.js} +41 -117
- package/bundle/{chunk-LMGQAJ3O.js → chunk-KCJFGKVK.js} +350 -123
- package/bundle/{chunk-RB4GELQA.js → chunk-LPJEKHOY.js} +1 -1
- package/bundle/chunk-LYKG4FKH.js +523 -0
- package/bundle/{chunk-X6LOM3Z4.js → chunk-LZ3HBDTR.js} +161 -78
- package/bundle/{chunk-FG6SQJAR.js → chunk-OGPOCGWX.js} +24 -6
- package/bundle/{chunk-Y6H2G6KX.js → chunk-OSVXFWPG.js} +67 -30
- package/bundle/{chunk-FJWI64H7.js → chunk-RMSABUN3.js} +27 -13
- package/bundle/{chunk-H36HBZB2.js → chunk-SJPABBZG.js} +2 -2
- package/bundle/{chunk-3U633XDZ.js → chunk-U3ZDUUTM.js} +11 -3
- package/bundle/{chunk-LVWU2HOO.js → chunk-ULGMXABL.js} +16 -7
- package/bundle/{chunk-WPW4V6HM.js → chunk-W7ZA6TYD.js} +2 -2
- package/bundle/{chunk-V2KFIGFH.js → chunk-XAC2XNAP.js} +503 -304
- package/bundle/{chunk-TGLFTQWJ.js → chunk-YWXILP5N.js} +5 -4
- package/bundle/control-channel.js +2 -2
- package/bundle/index.js +1 -1
- package/bundle/intercom-bridge.js +2 -2
- package/bundle/preflight.js +12 -10
- package/bundle/project-panes.js +3 -3
- package/bundle/workflow-resources.js +1 -1
- package/docs/agents.md +27 -6
- package/docs/configuration.md +20 -8
- package/docs/extension-api.md +18 -1
- package/docs/models.md +6 -2
- package/docs/observability.md +2 -0
- package/docs/tool-reference.md +7 -1
- package/docs/workflows.md +30 -2
- package/node_modules/@xzzpig/pi-components/CHANGELOG.md +12 -0
- package/node_modules/@xzzpig/pi-components/README.md +94 -0
- package/node_modules/@xzzpig/pi-components/dist/src/transcript-presenter.d.ts +186 -0
- package/node_modules/@xzzpig/pi-components/dist/src/transcript-presenter.js +693 -0
- package/node_modules/@xzzpig/pi-components/package.json +5 -1
- package/package.json +4 -4
- package/skills/pi-subagents/SKILL.md +15 -6
- package/skills/pi-subagents/references/prompting-and-roles.md +1 -0
- package/src/agents/agent-management.d.ts +1 -0
- package/src/agents/agent-management.js +46 -18
- package/src/agents/agent-memory.d.ts +1 -4
- package/src/agents/agent-memory.js +1 -4
- package/src/agents/agent-serializer.d.ts +2 -0
- package/src/agents/agent-serializer.js +1 -1
- package/src/agents/agents.d.ts +2 -3
- package/src/agents/agents.js +46 -20
- 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/api/preflight.d.ts +3 -1
- package/src/api/preflight.js +2 -0
- package/src/extension/config.d.ts +1 -0
- package/src/extension/config.js +13 -1
- package/src/extension/herdr-pi-bridge.js +10 -2
- package/src/extension/index.d.ts +0 -13
- package/src/extension/index.js +51 -37
- 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 +12 -3
- package/src/extension/schemas.js +7 -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 +55 -15
- 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 +7 -10
- package/src/runs/background/async-execution.js +66 -29
- 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 +114 -40
- package/src/runs/background/async-retention.d.ts +0 -2
- package/src/runs/background/async-retention.js +17 -6
- package/src/runs/background/async-status.d.ts +2 -0
- package/src/runs/background/async-status.js +4 -0
- 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 +2 -3
- package/src/runs/background/run-child-session.js +5 -8
- package/src/runs/background/run-status.js +9 -7
- package/src/runs/background/runner-aliases.js +15 -0
- package/src/runs/background/scheduled-runs.d.ts +3 -1
- package/src/runs/background/scheduled-runs.js +13 -16
- package/src/runs/background/steering.d.ts +2 -11
- package/src/runs/background/steering.js +11 -6
- package/src/runs/background/subagent-runner.d.ts +2 -6
- package/src/runs/background/subagent-runner.js +88 -70
- 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-subscriptions.js +124 -12
- 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/async-steering-action.js +24 -9
- package/src/runs/foreground/async-stop-action.d.ts +1 -1
- package/src/runs/foreground/async-stop-action.js +9 -1
- package/src/runs/foreground/execution.d.ts +0 -3
- package/src/runs/foreground/execution.js +56 -24
- package/src/runs/foreground/prompt-audit.js +1 -0
- package/src/runs/foreground/subagent-executor.d.ts +5 -10
- package/src/runs/foreground/subagent-executor.js +164 -49
- package/src/runs/shared/acceptance.js +69 -26
- package/src/runs/shared/async-status-projection.d.ts +2 -0
- package/src/runs/shared/async-status-projection.js +10 -0
- 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 +6 -5
- package/src/runs/shared/child-session.js +85 -38
- 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 +51 -24
- package/src/runs/shared/lane-metadata.d.ts +0 -1
- package/src/runs/shared/lane-metadata.js +0 -1
- package/src/runs/shared/mcp-config-sources.d.ts +4 -1
- package/src/runs/shared/mcp-config-sources.js +1 -1
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +0 -3
- package/src/runs/shared/mcp-direct-tool-allowlist.js +26 -17
- 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 +20 -5
- package/src/runs/shared/model-resolution.js +55 -50
- 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 +18 -4
- package/src/runs/shared/supervisor-wait-timer.d.ts +16 -0
- package/src/runs/shared/supervisor-wait-timer.js +61 -0
- 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/artifacts.d.ts +1 -0
- package/src/shared/artifacts.js +132 -22
- 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/pruned-fork.js +2 -2
- package/src/shared/reported-progress.d.ts +1 -0
- package/src/shared/reported-progress.js +12 -0
- 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/status-format.d.ts +1 -0
- package/src/shared/status-format.js +1 -1
- package/src/shared/types.d.ts +108 -59
- package/src/shared/types.js +0 -12
- package/src/shared/utils.d.ts +3 -15
- package/src/shared/utils.js +4 -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.js +6 -4
- package/src/tui/render.d.ts +0 -9
- package/src/tui/render.js +194 -68
- package/src/tui/subagent-messages.js +3 -2
- package/src/watchdog/model-selection.js +2 -2
- package/src/watchdog/permission-arbiter.js +1 -0
- package/src/watchdog/register-child.d.ts +2 -3
- package/src/watchdog/register-child.js +2 -3
- package/src/watchdog/review.d.ts +0 -5
- package/src/watchdog/review.js +4 -3
- package/src/watchdog/turn-delta.js +2 -1
- package/src/workflows/scripted-workflow.d.ts +2 -0
- package/src/workflows/scripted-workflow.js +344 -59
- package/src/workflows/structured-workflow-scripts.d.ts +4 -3
- package/src/workflows/structured-workflow-scripts.js +32 -11
- 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-resources.js +4 -4
- package/src/workflows/workflow-resume-claim.d.ts +2 -0
- package/src/workflows/workflow-resume-claim.js +3 -3
- package/src/workflows/workflow-resume.d.ts +1 -1
- package/src/workflows/workflow-resume.js +13 -8
- package/src/workflows/workflow-script-worker.d.ts +13 -0
- package/src/workflows/workflow-script-worker.js +81 -0
- package/workflow-script-process.cjs +36 -0
- package/workflow-script-worker.cjs +4 -1
- package/bundle/chunk-U4ODUYAG.js +0 -235
|
@@ -2,10 +2,10 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { discoverAgents, findBlockingAgentDiagnostic, formatAvailableAgentLines, formatUnknownAgentError, resolveAgentName, suggestAgentName, unknownAgentDiagnosticContext } from "../../agents/agents.js";
|
|
5
|
-
import { getArtifactsDir, getProjectArtifactPackagingWarning, getProjectSubagentsDir } from "../../shared/artifacts.js";
|
|
5
|
+
import { getArtifactsDir, getProjectArtifactPackagingWarning, getProjectSubagentsDir, missingForkCopyNote } from "../../shared/artifacts.js";
|
|
6
6
|
import { writeAtomicJson } from "../../shared/atomic-json.js";
|
|
7
7
|
import { createCapacityResilientJsonWriter } from "../../shared/capacity-resilient-json.js";
|
|
8
|
-
import {
|
|
8
|
+
import { reportSessionWarning } from "../../shared/session-warnings.js";
|
|
9
9
|
import { resolveEffectiveThinking, toModelInfo } from "../../shared/model-info.js";
|
|
10
10
|
import { beginForegroundChild, finishForegroundChild, foregroundSchedulingSettled, settleForegroundSchedulingOwner, updateForegroundChild, } from "./foreground-control.js";
|
|
11
11
|
import { getLivePromptAudit, rewritePromptWithGuidance, updateLiveEffectivePrompt } from "./prompt-audit.js";
|
|
@@ -15,6 +15,7 @@ import { handleManagementAction } from "../../agents/agent-management.js";
|
|
|
15
15
|
import { handleRefinementAction } from "../../agents/agent-refinements.js";
|
|
16
16
|
import { buildDoctorReport } from "../../extension/doctor.js";
|
|
17
17
|
import { readSubagentGuide } from "../../extension/subagent-guide.js";
|
|
18
|
+
import { approveWorkflowChildLaunch } from "../../extension/subagent-launch-tool.js";
|
|
18
19
|
import { isWorkflowScriptPath, normalizePublicSubagentExecution, validateWorkflowCapacityOverrides } from "../../extension/public-execution.js";
|
|
19
20
|
import { readReplyWorkflowScript } from "../../extension/reply-workflow-script.js";
|
|
20
21
|
import { disabledFeatureNotice, disabledFeatureSectionNotice, disabledFeatureUseError, resolveDisabledFeatureSurface } from "../../shared/disabled-features.js";
|
|
@@ -23,7 +24,7 @@ import { commandAction } from "./command-action.js";
|
|
|
23
24
|
import { handleWatchdogToolAction, WATCHDOG_TOOL_ACTIONS } from "../../watchdog/tool-actions.js";
|
|
24
25
|
import { applyWatchdogLaunchRules } from "../../watchdog/rules.js";
|
|
25
26
|
import { childWatchdogProgressForModel } from "../../watchdog/child-status.js";
|
|
26
|
-
import { normalizeParentModel, resolveEffectiveSubagentModel, resolveModelOrigin, scopedModelIdsFromContext } from "../shared/model-resolution.js";
|
|
27
|
+
import { knownModelProviders, normalizeParentModel, resolveEffectiveSubagentModel, resolveModelOrigin, scopedModelIdsFromContext } from "../shared/model-resolution.js";
|
|
27
28
|
import { projectScopedProfileTrustError } from "../shared/sandbox-profile-guard.js";
|
|
28
29
|
import { projectChainOutputSchemas, resolveEffectiveOutputSchema } from "../shared/child-launch-plan.js";
|
|
29
30
|
import { formatRetainedChildren, listRetainedChildren } from "../background/retained-children.js";
|
|
@@ -38,12 +39,13 @@ import { isScheduledRunAction } from "../background/scheduled-runs.js";
|
|
|
38
39
|
import { encodeIndexSegment } from "../background/index-segment.js";
|
|
39
40
|
import { enqueueChainAppendRequest, readPendingChainAppendRequests, runnerStepOutputNames } from "../background/chain-append.js";
|
|
40
41
|
import { ChainOutputValidationError, validateChainOutputBindingsWithContext } from "../shared/chain-outputs.js";
|
|
41
|
-
import { acceptanceHasTypedVerify, normalizeGateAcceptance, resolveAcceptanceReportMode, TYPED_VERIFY_OUTPUT_SCHEMA_CONFLICT, validateAcceptanceInput, validateExecutionAcceptance, validateExecutionAcceptancePolicy } from "../shared/acceptance.js";
|
|
42
|
+
import { acceptanceHasTypedVerify, normalizeAcceptanceInput, normalizeGateAcceptance, resolveAcceptanceReportMode, TYPED_VERIFY_OUTPUT_SCHEMA_CONFLICT, validateAcceptanceInput, validateExecutionAcceptance, validateExecutionAcceptancePolicy } from "../shared/acceptance.js";
|
|
42
43
|
import { canPreferFork, createForkContextResolver, resolveSubagentLaunchContext } from "../../shared/fork-context.js";
|
|
43
44
|
import { createPrunedForkSessionWriter } from "../../shared/pruned-fork.js";
|
|
44
45
|
import { resolveCurrentSessionId } from "../../shared/session-identity.js";
|
|
45
46
|
import { currentCompletionOwnerId } from "../../shared/completion-owner.js";
|
|
46
47
|
import { SUBAGENT_ASYNC_COMPLETE_EVENT } from "../../shared/types.js";
|
|
48
|
+
import { resolveConfigDefaultTimeoutMs } from "../../extension/config.js";
|
|
47
49
|
import { applyIntercomBridgeToAgent, INTERCOM_BRIDGE_MARKER, resolveIntercomBridge, resolveIntercomSessionTarget, resolveSubagentIntercomTarget } from "../../intercom/intercom-bridge.js";
|
|
48
50
|
import { formatControlIntercomMessage, formatControlNoticeMessage, resolveControlConfig, shouldNotifyControlEvent } from "../shared/subagent-control.js";
|
|
49
51
|
import { formatSpawnBudget, getSpawnBudgetSnapshot, grantSpawnBudget, preflightSpawnBudget, preflightSpawnBudgetGrant, reserveSpawnBudget } from "../shared/spawn-budget.js";
|
|
@@ -85,7 +87,7 @@ import { getExternalJobProvider } from "../../api/external-job-provider.js";
|
|
|
85
87
|
import { externalJobFollowUpRequestDigest, externalJobFollowUpRequestId, externalJobFollowUpRunId, externalJobPromptDigest, externalJobStableJson } from "../shared/external-job-runner.js";
|
|
86
88
|
import { externalCliReceiptMetadata, normalizeExternalCliRunnerStatus } from "../shared/external-cli-contract.js";
|
|
87
89
|
import { formatHerdrMachineRunnerUnsupported, resolveMachinePlacement } from "../shared/herdr-machine.js";
|
|
88
|
-
import { lookupRunnerLauncher, resolveAgentRunnerLauncher } from "../shared/runner-launcher.js";
|
|
90
|
+
import { checkRequiredRunnerLauncher, lookupRunnerLauncher, REQUIRE_LAUNCHER_SHAPE_ERROR, resolveAgentRunnerLauncher } from "../shared/runner-launcher.js";
|
|
89
91
|
import { applyForceTopLevelAsyncOverride } from "../background/top-level-async.js";
|
|
90
92
|
import { handleMissionAction, MISSION_ACTIONS } from "../../missions/actions.js";
|
|
91
93
|
import { attachMissionToLaunchResult, missionAcceptanceStatus, prepareMissionLaunch, writeMissionAsyncBinding } from "../../missions/lifecycle.js";
|
|
@@ -112,13 +114,14 @@ import { annotateWorkflowPreflightTrace, formatWorkflowPreflight, formatWorkflow
|
|
|
112
114
|
import { authorizeWorkflowResourceHost, claimWorkflowChildPermit, consumeWorkflowResourcePermit, validateWorkflowChildPermitRoot, } from "../../shared/workflow-child-permit.js";
|
|
113
115
|
import { deepFreezeWorkflowArgs, normalizeWorkflowArgs, resolveStructuredWorkflowResource, resolveWorkflowResource } from "../../workflows/workflow-resources.js";
|
|
114
116
|
import { writeWorkflowLaunchRecord } from "../../workflows/workflow-launch-record.js";
|
|
115
|
-
import { stableJsonDigest } from "../../shared/launch-contract.js";
|
|
117
|
+
import { agentDefinitionDigest, stableJsonDigest } from "../../shared/launch-contract.js";
|
|
116
118
|
import { cleanupWorktrees, createWorktrees, preflightWorktreeSource, withWorktreeTransaction, diffWorktrees, formatWorktreeDiffSummary, } from "../shared/worktree.js";
|
|
117
119
|
import { applyReviewedCleanupPlan, formatCleanupReceipt, loadReviewedCleanupPlan } from "../shared/worktree-cleanup-apply.js";
|
|
118
120
|
import { createWorktreeCleanupPlan, formatWorktreeCleanupPlan } from "../shared/worktree-cleanup-plan.js";
|
|
119
121
|
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";
|
|
120
122
|
import { deriveChildSessionName } from "../../shared/child-session-name.js";
|
|
121
123
|
import { editDistance, hasSingleAdjacentTransposition } from "../../shared/edit-distance.js";
|
|
124
|
+
import { waitToolName } from "../../shared/wait-tool-name.js";
|
|
122
125
|
const MUTATING_MANAGEMENT_ACTIONS = new Set(["command.yield", "command.cancel", "create", "update", "delete", "eject", "disable", "enable", "reset", "grant-spawn-budget", "watchdog.configure", "mission.create", "mission.update", "mission.resolve-decision", "mission.attach-run", "mission.close", "inspector.open", "inspector.close", "project.open", "project.close", "worktree.discard", "worktree.cleanup", "lane.recordMerge", "lane.recordSupersession", "refine", "refine.rollback", "dismiss", "schedule.create", "schedule.pause", "schedule.resume", "schedule.run", "schedule.run-due", "schedule.delete"]);
|
|
123
126
|
const DESTRUCTIVE_MANAGEMENT_ACTIONS = new Set(["command.cancel", "delete", "eject", "disable", "reset", "mission.close", "worktree.discard", "refine.rollback", "inspector.close", "project.close", "stop", "interrupt", "schedule.delete"]);
|
|
124
127
|
function resolveSteerDeliveryMode(mode) {
|
|
@@ -178,6 +181,47 @@ function inheritedRunFanoutBudget(deps) {
|
|
|
178
181
|
function resolveRequestedCwd(runtimeCwd, requestedCwd) {
|
|
179
182
|
return requestedCwd ? path.resolve(runtimeCwd, requestedCwd) : runtimeCwd;
|
|
180
183
|
}
|
|
184
|
+
function workflowChildLaunchArgs(workflowRunId, key, request, scriptAgent, ctxCwd, discoverAgents) {
|
|
185
|
+
// prepareWorkflowLaunchParams turns a retained resume into { action: "resume", id, message }.
|
|
186
|
+
const resume = request.action === "resume" && typeof request.id === "string" ? request.id : undefined;
|
|
187
|
+
const agent = request.agent ?? scriptAgent;
|
|
188
|
+
const task = resume !== undefined ? request.message : request.task;
|
|
189
|
+
// cwd is where execute runs a fresh local child. A resumed child keeps its retained directory, and a
|
|
190
|
+
// placed child's cwd names a directory on its machine, so neither gets a local cwd here.
|
|
191
|
+
const scope = resolveExecutionAgentScope(request.agentScope);
|
|
192
|
+
const findAgent = (dir) => typeof agent === "string" ? resolveAgentName(agent, discoverAgents(dir, scope).agents).agent : undefined;
|
|
193
|
+
const ctxAgent = request.machine === undefined ? findAgent(ctxCwd) : undefined;
|
|
194
|
+
const placed = request.machine !== undefined || ctxAgent?.machine !== undefined;
|
|
195
|
+
const runCwd = resolveRequestedCwd(ctxCwd, request.cwd);
|
|
196
|
+
const cwd = resume === undefined && !placed ? runCwd : undefined;
|
|
197
|
+
// Mirrors applySingleAgentLaunchDefaults: the agent's defaultAcceptance applies only to a fresh launch with no
|
|
198
|
+
// acceptance (gate is already acceptance here). A resume's retained commands were in the call that first launched it.
|
|
199
|
+
const acceptanceInput = request.acceptance !== undefined || resume !== undefined
|
|
200
|
+
? request.acceptance
|
|
201
|
+
: (placed || runCwd === ctxCwd ? ctxAgent ?? findAgent(ctxCwd) : findAgent(runCwd))?.defaultAcceptance;
|
|
202
|
+
// An invalid acceptance fails the launch before anything runs. Verify commands run only at level
|
|
203
|
+
// "verified", which no inferred level reaches.
|
|
204
|
+
const acceptance = acceptanceInput !== undefined && validateAcceptanceInput(acceptanceInput).length === 0 ? normalizeAcceptanceInput(acceptanceInput) : undefined;
|
|
205
|
+
const commands = acceptance?.level === "verified" ? (acceptance.verify ?? []).map((verify) => ({
|
|
206
|
+
command: verify.command,
|
|
207
|
+
...(cwd !== undefined ? { cwd: verify.cwd ? path.resolve(cwd, verify.cwd) : cwd } : {}),
|
|
208
|
+
...(verify.env !== undefined ? { env: verify.env } : {}),
|
|
209
|
+
})) : [];
|
|
210
|
+
const output = resolveSingleOutputPath(request.output, ctxCwd);
|
|
211
|
+
return {
|
|
212
|
+
workflowRunId,
|
|
213
|
+
key,
|
|
214
|
+
...(typeof agent === "string" ? { agent } : {}),
|
|
215
|
+
...(typeof task === "string" ? { task } : {}),
|
|
216
|
+
...(cwd !== undefined ? { cwd } : {}),
|
|
217
|
+
...(typeof request.model === "string" ? { model: request.model } : {}),
|
|
218
|
+
...(typeof request.async === "boolean" ? { async: request.async } : {}),
|
|
219
|
+
...(typeof request.worktree === "boolean" ? { worktree: request.worktree } : {}),
|
|
220
|
+
...(resume !== undefined ? { resume } : {}),
|
|
221
|
+
...(commands.length > 0 ? { commands } : {}),
|
|
222
|
+
...(output !== undefined ? { output } : {}),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
181
225
|
function readWorkflowScriptFile(requestedPath, requestedCwd, runtimeCwd) {
|
|
182
226
|
const scriptPath = path.resolve(resolveRequestedCwd(runtimeCwd, requestedCwd), requestedPath);
|
|
183
227
|
let script;
|
|
@@ -677,7 +721,7 @@ function resolveForegroundResumeTarget(params, state, options = {}) {
|
|
|
677
721
|
throw new Error(`Ambiguous foreground run id prefix '${requested}' matched: ${matches.map((run) => run.runId).join(", ")}. Provide a longer id.`);
|
|
678
722
|
const run = matches[0];
|
|
679
723
|
if (run.children.some((child) => child.status === "detached"))
|
|
680
|
-
throw new Error(`Foreground run '${run.runId}' is detached for intercom coordination and cannot be revived safely while any child may still be live. Reply to the supervisor request first, then wait with
|
|
724
|
+
throw new Error(`Foreground run '${run.runId}' is detached for intercom coordination and cannot be revived safely while any child may still be live. Reply to the supervisor request first, then wait with ${waitToolName()}({ id: "${run.runId}" }); use status to recover the result and do not launch a replacement while it remains detached.`);
|
|
681
725
|
if (run.children.length > 1 && params.index === undefined)
|
|
682
726
|
throw new Error(`Foreground run '${run.runId}' has ${run.children.length} children. Provide index to choose one.`);
|
|
683
727
|
const index = params.index ?? 0;
|
|
@@ -692,7 +736,7 @@ function resolveForegroundResumeTarget(params, state, options = {}) {
|
|
|
692
736
|
throw new Error(`Foreground run '${run.runId}' child ${index} session file must be a .jsonl file: ${child.sessionFile}`);
|
|
693
737
|
const sessionFile = path.resolve(child.sessionFile);
|
|
694
738
|
if (!fs.existsSync(sessionFile))
|
|
695
|
-
throw new Error(`Foreground run '${run.runId}' child ${index} session file does not exist: ${child.sessionFile}`);
|
|
739
|
+
throw new Error(`Foreground run '${run.runId}' child ${index} session file does not exist: ${child.sessionFile}${missingForkCopyNote(sessionFile)}`);
|
|
696
740
|
return {
|
|
697
741
|
runId: run.runId,
|
|
698
742
|
mode: run.mode,
|
|
@@ -830,9 +874,8 @@ function persistAsyncWorkflowControlEvent(input) {
|
|
|
830
874
|
fs.appendFileSync(path.join(input.job.asyncDir, "events.jsonl"), `${JSON.stringify(record)}\n`, "utf-8");
|
|
831
875
|
}
|
|
832
876
|
catch (error) {
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
console.error("Failed to append async workflow control event while storage is full:", error);
|
|
877
|
+
// Called from the child's 1 s activity timer, where a throw would exit Pi; the notice itself is still sent.
|
|
878
|
+
reportSessionWarning(input.state, `Failed to record a control event for workflow ${input.job.asyncId}: ${error instanceof Error ? error.message : String(error)}`, "async-workflow-control-event");
|
|
836
879
|
}
|
|
837
880
|
}
|
|
838
881
|
function emitControlNotification(input) {
|
|
@@ -1057,6 +1100,7 @@ function appendStepToAsyncChain(input) {
|
|
|
1057
1100
|
parentProviderRegistry: input.ctx.modelRegistry,
|
|
1058
1101
|
currentModel: parentModel,
|
|
1059
1102
|
scopedModelIds: scopedModelIdsFromContext(input.ctx),
|
|
1103
|
+
knownProviders: knownModelProviders(input.ctx.modelRegistry),
|
|
1060
1104
|
modelScope: discoveredForAppend.modelScope,
|
|
1061
1105
|
projectTrusted: currentProjectTrusted(input.ctx),
|
|
1062
1106
|
...(trustedProjectCwd(input.ctx) ? { trustedProjectCwd: trustedProjectCwd(input.ctx) } : {}),
|
|
@@ -1185,7 +1229,7 @@ function validateNestedSessionFile(run, trustedSessionRoots, resolveSource, visi
|
|
|
1185
1229
|
if (!path.isAbsolute(sessionFile))
|
|
1186
1230
|
throw new Error(`Nested run '${run.id}' session file must be absolute: ${sessionFile}`);
|
|
1187
1231
|
if (!fs.existsSync(resolved))
|
|
1188
|
-
throw new Error(`Nested run '${run.id}' session file does not exist: ${sessionFile}`);
|
|
1232
|
+
throw new Error(`Nested run '${run.id}' session file does not exist: ${sessionFile}${missingForkCopyNote(resolved)}`);
|
|
1189
1233
|
const stat = fs.lstatSync(resolved);
|
|
1190
1234
|
if (!stat.isFile() || stat.isSymbolicLink())
|
|
1191
1235
|
throw new Error(`Nested run '${run.id}' session file is not a regular file: ${sessionFile}`);
|
|
@@ -1218,8 +1262,8 @@ function validateNestedSessionFile(run, trustedSessionRoots, resolveSource, visi
|
|
|
1218
1262
|
}
|
|
1219
1263
|
return realSessionFile;
|
|
1220
1264
|
}
|
|
1221
|
-
export function readNestedRecoveryDescriptor(
|
|
1222
|
-
const recoveryDescriptor = readAsyncRecoveryDescriptor(
|
|
1265
|
+
export function readNestedRecoveryDescriptor(rootRunId, runId, agent) {
|
|
1266
|
+
const recoveryDescriptor = readAsyncRecoveryDescriptor(nestedRunScope(rootRunId).asyncDirRoot, runId);
|
|
1223
1267
|
if (!recoveryDescriptor)
|
|
1224
1268
|
return undefined;
|
|
1225
1269
|
if (recoveryDescriptor.sourceRunId !== runId)
|
|
@@ -1239,7 +1283,7 @@ function resolveNestedResumeTarget(match, trustedSessionRoots, resolveSource) {
|
|
|
1239
1283
|
throw new Error(`Could not determine child agent for nested run '${run.id}'.`);
|
|
1240
1284
|
const state = run.state === "complete" || run.state === "failed" || run.state === "paused" ? run.state : "failed";
|
|
1241
1285
|
const asyncDir = resolveNestedAsyncDir(match.match.rootRunId, run);
|
|
1242
|
-
const recoveryDescriptor = readNestedRecoveryDescriptor(
|
|
1286
|
+
const recoveryDescriptor = asyncDir ? readNestedRecoveryDescriptor(match.match.rootRunId, run.id, agent) : undefined;
|
|
1243
1287
|
return compactOptional({
|
|
1244
1288
|
kind: "revive",
|
|
1245
1289
|
source: "nested",
|
|
@@ -1548,6 +1592,7 @@ async function resumeExternalJobFollowUp(input) {
|
|
|
1548
1592
|
parentProviderRegistry: input.ctx.modelRegistry,
|
|
1549
1593
|
currentModel: parentModel,
|
|
1550
1594
|
scopedModelIds: scopedModelIdsFromContext(input.ctx),
|
|
1595
|
+
knownProviders: knownModelProviders(input.ctx.modelRegistry),
|
|
1551
1596
|
modelScope: input.modelScope,
|
|
1552
1597
|
modelResponseAliases: input.deps.config.modelResponseAliases,
|
|
1553
1598
|
interactive: input.ctx.hasUI,
|
|
@@ -1727,6 +1772,20 @@ async function resumeAsyncRun(input) {
|
|
|
1727
1772
|
details: { mode: "management", results: [] },
|
|
1728
1773
|
};
|
|
1729
1774
|
}
|
|
1775
|
+
// Before any worktree protection or chain attachment: a launch that required a launcher and agent definition
|
|
1776
|
+
// resumes only while both still hold.
|
|
1777
|
+
const requiredLauncher = recoveryDescriptor?.requiredLauncher;
|
|
1778
|
+
if (requiredLauncher) {
|
|
1779
|
+
const refuse = (text) => ({ content: [{ type: "text", text }], isError: true, details: { mode: "management", results: [] } });
|
|
1780
|
+
if (attachChain)
|
|
1781
|
+
return refuse(`Cannot attach a chain to run '${target.runId}': it was launched with requireLauncher, and appended steps would run inside its runner unchecked.`);
|
|
1782
|
+
const currentDigest = discoveredAgentConfig ? agentDefinitionDigest(discoveredAgentConfig) : undefined;
|
|
1783
|
+
const now = !discoveredAgentConfig ? "is missing"
|
|
1784
|
+
: recoveryDescriptor.launcher !== requiredLauncher.name || discoveredAgentConfig.launcher !== requiredLauncher.name ? `uses launcher '${discoveredAgentConfig.launcher ?? "none"}'`
|
|
1785
|
+
: currentDigest !== requiredLauncher.definitionDigest ? `has digest ${currentDigest}` : undefined;
|
|
1786
|
+
if (now)
|
|
1787
|
+
return refuse(`Cannot resume: run '${target.runId}' was launched requiring launcher '${requiredLauncher.name}' and agent definition ${requiredLauncher.definitionDigest}; agent '${target.agent}' now ${now}.`);
|
|
1788
|
+
}
|
|
1730
1789
|
if (target.source === "async" && target.runner?.type === "external-cli") {
|
|
1731
1790
|
const runner = normalizeExternalCliRunnerStatus(target.runner);
|
|
1732
1791
|
const message = runner
|
|
@@ -1737,7 +1796,8 @@ async function resumeAsyncRun(input) {
|
|
|
1737
1796
|
if (input.params.baseRef !== undefined && "managedWorktree" in target && target.managedWorktree === true) {
|
|
1738
1797
|
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: [] } };
|
|
1739
1798
|
}
|
|
1740
|
-
|
|
1799
|
+
// Without a handoff the resume runs in the worktree the descriptor recorded; there is no cleanup record to mark preserved.
|
|
1800
|
+
if (target.source === "async" && target.managedWorktree && target.asyncDir && fs.existsSync(parallelHandoffPath(target.asyncDir))) {
|
|
1741
1801
|
try {
|
|
1742
1802
|
const protectedCwd = await protectRetainedWorktreeForResume(parallelHandoffPath(target.asyncDir), target.runId, target.index, input.signal);
|
|
1743
1803
|
if (path.resolve(protectedCwd) !== path.resolve(effectiveCwd))
|
|
@@ -1837,6 +1897,7 @@ async function resumeAsyncRun(input) {
|
|
|
1837
1897
|
parentProviderRegistry: input.ctx.modelRegistry,
|
|
1838
1898
|
currentModel: parentModel,
|
|
1839
1899
|
scopedModelIds: scopedModelIdsFromContext(input.ctx),
|
|
1900
|
+
knownProviders: knownModelProviders(input.ctx.modelRegistry),
|
|
1840
1901
|
modelScope,
|
|
1841
1902
|
projectTrusted: currentProjectTrusted(input.ctx),
|
|
1842
1903
|
...(trustedProjectCwd(input.ctx) ? { trustedProjectCwd: trustedProjectCwd(input.ctx) } : {}),
|
|
@@ -1904,8 +1965,8 @@ async function resumeAsyncRun(input) {
|
|
|
1904
1965
|
if (target.source === "nested" && !target.recoveryDescriptor) {
|
|
1905
1966
|
return { content: [{ type: "text", text: `Nested child '${target.runId}' is missing its required recovery identity. Start a new run instead.` }], isError: true, details: { mode: "management", results: [] } };
|
|
1906
1967
|
}
|
|
1907
|
-
//
|
|
1908
|
-
const recoveryAgentConfig = recoveryDescriptor ? applySteeringRecoveryAgentConfig(baseAgentConfig, recoveryDescriptor) :
|
|
1968
|
+
// Without a recovery descriptor nothing records how the run was wrapped, so the agent file's launcher applies.
|
|
1969
|
+
const recoveryAgentConfig = recoveryDescriptor ? applySteeringRecoveryAgentConfig(baseAgentConfig, recoveryDescriptor) : baseAgentConfig;
|
|
1909
1970
|
const agentConfig = intercomBridge.active ? applyIntercomBridgeToAgent(recoveryAgentConfig, intercomBridge) : recoveryAgentConfig;
|
|
1910
1971
|
const foregroundContract = target.source === "foreground" ? target.resumeContract : undefined;
|
|
1911
1972
|
const outputSchema = Object.hasOwn(input.params, "outputSchema")
|
|
@@ -1924,7 +1985,7 @@ async function resumeAsyncRun(input) {
|
|
|
1924
1985
|
}
|
|
1925
1986
|
// Refuse before capacity moves so the retained run stays resumable once the config is fixed.
|
|
1926
1987
|
if (agentConfig.launcher !== undefined && !lookupRunnerLauncher(input.deps.config.runnerLaunchers, agentConfig.launcher)) {
|
|
1927
|
-
return { content: [{ type: "text", text: `Cannot resume: run '${target.runId}'
|
|
1988
|
+
return { content: [{ type: "text", text: `Cannot resume: run '${target.runId}' uses launcher '${agentConfig.launcher}', which is no longer defined in runnerLaunchers in the user subagent config.` }], isError: true, details: { mode: "management", results: [] } };
|
|
1928
1989
|
}
|
|
1929
1990
|
const runId = randomUUID();
|
|
1930
1991
|
const topLevelResume = depth === 0 && !inheritedNestedRoute(input.deps) && !input.params.workflowParentRunId;
|
|
@@ -1971,6 +2032,7 @@ async function resumeAsyncRun(input) {
|
|
|
1971
2032
|
agentConfig,
|
|
1972
2033
|
recoveryAgentConfig,
|
|
1973
2034
|
...(recoveryDescriptor?.sandbox ?? ("sandbox" in target ? target.sandbox : undefined) ? { sandbox: recoveryDescriptor?.sandbox ?? ("sandbox" in target ? target.sandbox : undefined) } : {}),
|
|
2035
|
+
carriedRequiredLauncher: recoveryDescriptor?.requiredLauncher,
|
|
1974
2036
|
ctx: compactOptional({
|
|
1975
2037
|
pi: input.deps.pi,
|
|
1976
2038
|
cwd: input.requestCwd,
|
|
@@ -1981,6 +2043,7 @@ async function resumeAsyncRun(input) {
|
|
|
1981
2043
|
parentProviderRegistry: input.ctx.modelRegistry,
|
|
1982
2044
|
currentModel: parentModel,
|
|
1983
2045
|
scopedModelIds: scopedModelIdsFromContext(input.ctx),
|
|
2046
|
+
knownProviders: knownModelProviders(input.ctx.modelRegistry),
|
|
1984
2047
|
modelScope,
|
|
1985
2048
|
projectTrusted: currentProjectTrusted(input.ctx),
|
|
1986
2049
|
...(trustedProjectCwd(input.ctx) ? { trustedProjectCwd: trustedProjectCwd(input.ctx) } : {}),
|
|
@@ -2159,6 +2222,7 @@ function createForegroundControlNotifier(data, deps) {
|
|
|
2159
2222
|
const enriched = workflowKey && !event.workflowKey ? { ...event, workflowKey } : event;
|
|
2160
2223
|
if (asyncWorkflow) {
|
|
2161
2224
|
persistAsyncWorkflowControlEvent({
|
|
2225
|
+
state: deps.state,
|
|
2162
2226
|
job: asyncWorkflow,
|
|
2163
2227
|
event: enriched,
|
|
2164
2228
|
controlConfig: data.controlConfig,
|
|
@@ -2691,18 +2755,6 @@ function timerDelayOverflowError(name, value) {
|
|
|
2691
2755
|
? `${name} must be a positive integer no larger than ${MAX_TIMER_DELAY_MS}.`
|
|
2692
2756
|
: undefined;
|
|
2693
2757
|
}
|
|
2694
|
-
/**
|
|
2695
|
-
* Resolve the optional global default runtime deadline from extension config
|
|
2696
|
-
* (`config.timeoutMs`). Returns undefined for unset or invalid values so callers
|
|
2697
|
-
* fall back to the built-in defaults. "Invalid" covers non-positive-integer
|
|
2698
|
-
* values and values above `MAX_TIMER_DELAY_MS`; the latter would overflow the
|
|
2699
|
-
* Node.js timer and expire the run almost immediately instead of running long.
|
|
2700
|
-
*/
|
|
2701
|
-
export function resolveConfigDefaultTimeoutMs(raw) {
|
|
2702
|
-
if (typeof raw !== "number" || !Number.isInteger(raw) || raw <= 0 || raw > MAX_TIMER_DELAY_MS)
|
|
2703
|
-
return undefined;
|
|
2704
|
-
return raw;
|
|
2705
|
-
}
|
|
2706
2758
|
export function resolveForegroundTimeout(params, defaultTimeoutMs) {
|
|
2707
2759
|
const rawTimeout = params.timeoutMs;
|
|
2708
2760
|
const rawMaxRuntime = params.maxRuntimeMs;
|
|
@@ -2857,7 +2909,7 @@ function resolveStaticLaunchSummary(input) {
|
|
|
2857
2909
|
const modelScopes = resolveModelScopesForAgent(input.modelScope, input.agent, input.parentModel, input.scopedModelIds);
|
|
2858
2910
|
const model = externalRunner
|
|
2859
2911
|
? undefined
|
|
2860
|
-
: resolveEffectiveSubagentModel(input.explicitModel, agentConfig?.model, input.parentModel, input.availableModels, agentConfig?.modelProvider ?? input.currentProvider,
|
|
2912
|
+
: resolveEffectiveSubagentModel(input.explicitModel, agentConfig?.model, input.parentModel, input.availableModels, agentConfig?.modelProvider ?? input.currentProvider, { scope: modelScopes, knownProviders: input.knownProviders });
|
|
2861
2913
|
const thinkingOverride = externalRunner ? undefined : input.thinkingOverrideForTask();
|
|
2862
2914
|
const thinking = externalRunner ? undefined : resolveEffectiveThinking(model, thinkingOverride ?? agentConfig?.thinking);
|
|
2863
2915
|
return {
|
|
@@ -2876,6 +2928,7 @@ function collectStaticLaunchSummaries(input) {
|
|
|
2876
2928
|
parentModel: input.parentModel,
|
|
2877
2929
|
scopedModelIds: input.scopedModelIds,
|
|
2878
2930
|
availableModels: input.availableModels,
|
|
2931
|
+
knownProviders: input.knownProviders,
|
|
2879
2932
|
currentProvider: input.currentProvider,
|
|
2880
2933
|
modelScope: input.modelScope,
|
|
2881
2934
|
thinkingOverrideForTask: input.thinkingOverrideForTask,
|
|
@@ -3156,6 +3209,7 @@ async function runAsyncPath(data, deps) {
|
|
|
3156
3209
|
parentProviderRegistry: ctx.modelRegistry,
|
|
3157
3210
|
currentModel: parentModel,
|
|
3158
3211
|
scopedModelIds: data.scopedModelIds,
|
|
3212
|
+
knownProviders: knownModelProviders(ctx.modelRegistry),
|
|
3159
3213
|
modelScope: data.modelScope,
|
|
3160
3214
|
projectTrusted: currentProjectTrusted(ctx),
|
|
3161
3215
|
...(trustedProjectCwd(ctx) ? { trustedProjectCwd: trustedProjectCwd(ctx) } : {}),
|
|
@@ -3213,8 +3267,9 @@ async function runAsyncPath(data, deps) {
|
|
|
3213
3267
|
const modelOverride = a.runner?.type === "external-cli" || a.runner?.type === "external-job"
|
|
3214
3268
|
? params.model ?? (externalRunnerWithoutExplicitModel ? undefined : a.model)
|
|
3215
3269
|
: resolveEffectiveSubagentModel(params.model, a.model, parentModel, availableModels, a.modelProvider ?? currentProvider, {
|
|
3216
|
-
|
|
3270
|
+
scope: modelScopes,
|
|
3217
3271
|
source: modelOrigin === "explicit" ? "explicit" : "inherited",
|
|
3272
|
+
knownProviders: asyncCtx.knownProviders,
|
|
3218
3273
|
});
|
|
3219
3274
|
const modelOverrideFromParent = modelOrigin === "inherited";
|
|
3220
3275
|
const launchRuleError = applyWatchdogLaunchRules({ cwd: effectiveCwd, agent: a.name, model: modelOverride ?? (parentModel && `${parentModel.provider}/${parentModel.id}`), warn: (violation) => deps.watchdog?.displayRuleWarning(violation) });
|
|
@@ -3234,6 +3289,7 @@ async function runAsyncPath(data, deps) {
|
|
|
3234
3289
|
requestedCwd: data.requestedCwd,
|
|
3235
3290
|
machine: params.machine,
|
|
3236
3291
|
machineCwd: params.machineCwd,
|
|
3292
|
+
requireLauncher: params.requireLauncher,
|
|
3237
3293
|
maxOutput: params.maxOutput,
|
|
3238
3294
|
artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
|
|
3239
3295
|
artifactConfig,
|
|
@@ -3659,6 +3715,7 @@ async function runSinglePath(data, deps) {
|
|
|
3659
3715
|
const parentModel = data.parentModel;
|
|
3660
3716
|
const currentProvider = parentModel?.provider;
|
|
3661
3717
|
const availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo);
|
|
3718
|
+
const knownProviders = knownModelProviders(ctx.modelRegistry);
|
|
3662
3719
|
const modelScopes = resolveModelScopesForAgent(data.modelScope, agentConfig.name, parentModel, data.scopedModelIds);
|
|
3663
3720
|
let task = typeof params.task === "string" ? params.task : "";
|
|
3664
3721
|
const modelOrigin = resolveModelOrigin({
|
|
@@ -3668,8 +3725,9 @@ async function runSinglePath(data, deps) {
|
|
|
3668
3725
|
parentModel,
|
|
3669
3726
|
});
|
|
3670
3727
|
let modelOverride = resolveEffectiveSubagentModel(params.model, agentConfig.model, parentModel, availableModels, agentConfig.modelProvider ?? currentProvider, {
|
|
3671
|
-
|
|
3728
|
+
scope: modelScopes,
|
|
3672
3729
|
source: modelOrigin === "explicit" ? "explicit" : "inherited",
|
|
3730
|
+
knownProviders,
|
|
3673
3731
|
});
|
|
3674
3732
|
const modelOverrideFromParent = modelOrigin === "inherited";
|
|
3675
3733
|
const launchRuleError = applyWatchdogLaunchRules({ cwd: effectiveCwd, agent: agentConfig.name, model: modelOverride ?? (parentModel && `${parentModel.provider}/${parentModel.id}`), warn: (violation) => deps.watchdog?.displayRuleWarning(violation) });
|
|
@@ -3764,7 +3822,7 @@ async function runSinglePath(data, deps) {
|
|
|
3764
3822
|
? `[Read from: ${readPaths.join(", ")}]\n\n`
|
|
3765
3823
|
: "";
|
|
3766
3824
|
task = readsInstruction + task;
|
|
3767
|
-
task = injectSingleOutputInstruction(task, outputPath, agentConfig);
|
|
3825
|
+
task = injectSingleOutputInstruction(task, outputPath, agentConfig, foregroundMachine);
|
|
3768
3826
|
let effectiveSkills;
|
|
3769
3827
|
if (skillOverride === false) {
|
|
3770
3828
|
effectiveSkills = [];
|
|
@@ -3917,6 +3975,7 @@ async function runSinglePath(data, deps) {
|
|
|
3917
3975
|
suppressUnchangedDelegationUpdates,
|
|
3918
3976
|
controlConfig,
|
|
3919
3977
|
onControlEvent,
|
|
3978
|
+
onWarning: (message, key) => reportSessionWarning(deps.state, message, key),
|
|
3920
3979
|
intercomSessionName: childIntercomTarget,
|
|
3921
3980
|
orchestratorIntercomTarget: childBridgeActive ? data.intercomBridge.orchestratorTarget : undefined,
|
|
3922
3981
|
nestedRoute: foregroundControl?.nestedRoute,
|
|
@@ -3929,6 +3988,7 @@ async function runSinglePath(data, deps) {
|
|
|
3929
3988
|
thinkingCeiling: agentConfig.maxThinking,
|
|
3930
3989
|
extensionBindings: params.extensionBindings,
|
|
3931
3990
|
availableModels,
|
|
3991
|
+
knownProviders,
|
|
3932
3992
|
modelResponseAliases,
|
|
3933
3993
|
preferredModelProvider: currentProvider,
|
|
3934
3994
|
modelScope: modelScopes,
|
|
@@ -4105,11 +4165,11 @@ async function runSinglePath(data, deps) {
|
|
|
4105
4165
|
const worktreeSuffix = worktreeHandoff?.suffix ? `\n\n${worktreeHandoff.suffix}` : "";
|
|
4106
4166
|
if (r.detached) {
|
|
4107
4167
|
const statusRecovery = `subagent({ action: "status", id: "${runId}" }) to recover the result; do not resume or launch a replacement while it remains detached.`;
|
|
4108
|
-
const blockingRecovery =
|
|
4168
|
+
const blockingRecovery = `${waitToolName()}({ id: "${runId}" }). Use ${statusRecovery}`;
|
|
4109
4169
|
const message = r.detachedReason === "intercom coordination"
|
|
4110
4170
|
? `Detached for intercom coordination: ${params.agent}. Reply to the supervisor request first, then wait with ${blockingRecovery}`
|
|
4111
4171
|
: r.detachedReason === "user request"
|
|
4112
|
-
? `Detached at user request: ${params.agent}. The child continues independently. Register a completion wake-up with
|
|
4172
|
+
? `Detached at user request: ${params.agent}. The child continues independently. Register a completion wake-up with ${waitToolName()}({ id: "${runId}", nonBlocking: true }), or use ${statusRecovery}`
|
|
4113
4173
|
: `Detached before task completion: ${params.agent}. Wait with ${blockingRecovery}`;
|
|
4114
4174
|
return {
|
|
4115
4175
|
content: [{ type: "text", text: `${message}${worktreeSuffix}` }],
|
|
@@ -4589,6 +4649,9 @@ export async function preflightWorkflowWorktrees(input) {
|
|
|
4589
4649
|
input.signal.throwIfAborted();
|
|
4590
4650
|
}
|
|
4591
4651
|
export function prepareWorkflowLaunchParams(workflowDefaults, childParams, parentWorkflowRunId, workflowKey, options = {}) {
|
|
4652
|
+
// Before the resume branch below, which rebuilds params field by field and would drop the requirement.
|
|
4653
|
+
if (childParams.requireLauncher !== undefined || workflowDefaults.requireLauncher !== undefined)
|
|
4654
|
+
throw new Error(REQUIRE_LAUNCHER_SHAPE_ERROR);
|
|
4592
4655
|
const { globalConcurrencyLimit: _globalConcurrencyLimit, maxSubagentSpawnsPerRun: _maxSubagentSpawnsPerRun, ...workflowDefaultsWithoutCapacity } = workflowDefaults;
|
|
4593
4656
|
const { globalConcurrencyLimit: _childGlobalConcurrencyLimit, maxSubagentSpawnsPerRun: _childMaxSubagentSpawnsPerRun, ...childParamsWithoutCapacity } = childParams;
|
|
4594
4657
|
workflowDefaults = workflowDefaultsWithoutCapacity;
|
|
@@ -4867,11 +4930,12 @@ function savedWorkflowLaunchParams(params) {
|
|
|
4867
4930
|
const { reuseFrom: _reuseFrom, scheduleOrigin: _scheduleOrigin, resumeOrigin: _resumeOrigin, ...saved } = params;
|
|
4868
4931
|
return saved;
|
|
4869
4932
|
}
|
|
4870
|
-
function workflowLaunchRecord(launch, cwd, scriptDigest) {
|
|
4871
|
-
|
|
4872
|
-
|
|
4933
|
+
function workflowLaunchRecord(launch, cwd, scriptDigest, sessionId, ceiling) {
|
|
4934
|
+
const owner = { version: 2, scriptDigest, sessionId, ...(ceiling ? { admissionCapabilityCeiling: ceiling } : {}) };
|
|
4935
|
+
if (launch.source === "structured" || launch.source === "internal")
|
|
4936
|
+
return { ...owner, source: launch.source };
|
|
4873
4937
|
// The resolved cwd is saved: a relative one would resolve against a later session's cwd.
|
|
4874
|
-
return {
|
|
4938
|
+
return { ...owner, source: launch.source, params: { ...launch.params, cwd } };
|
|
4875
4939
|
}
|
|
4876
4940
|
export function createSubagentExecutor(deps) {
|
|
4877
4941
|
const executorDeps = deps;
|
|
@@ -5194,8 +5258,8 @@ export function createSubagentExecutor(deps) {
|
|
|
5194
5258
|
try {
|
|
5195
5259
|
fs.mkdirSync(asyncDir, { recursive: true });
|
|
5196
5260
|
writeRunFanoutBudgetDescriptor(asyncDir, workflowFanoutBudget);
|
|
5197
|
-
if (topLevelAsyncWorkflow
|
|
5198
|
-
writeWorkflowLaunchRecord(
|
|
5261
|
+
if (topLevelAsyncWorkflow)
|
|
5262
|
+
writeWorkflowLaunchRecord(DIRS.async, workflowRunId, workflowLaunchRecord(publicWorkflowLaunch ?? { source: "internal" }, workflowCwd, workflowScriptSourceDigest, currentSessionId, workflowCapabilityCeiling));
|
|
5199
5263
|
fs.mkdirSync(DIRS.results, { recursive: true });
|
|
5200
5264
|
}
|
|
5201
5265
|
catch (error) {
|
|
@@ -5204,6 +5268,7 @@ export function createSubagentExecutor(deps) {
|
|
|
5204
5268
|
const controller = new AbortController();
|
|
5205
5269
|
deps.state.workflowControllers ??= new Map();
|
|
5206
5270
|
deps.state.workflowChildStops ??= new Map();
|
|
5271
|
+
deps.state.workflowDrains ??= new Map();
|
|
5207
5272
|
deps.state.workflowControllers.set(workflowRunId, controller);
|
|
5208
5273
|
workflowCapacity?.markWorkflowStarted();
|
|
5209
5274
|
if (workflowCapacity)
|
|
@@ -5835,6 +5900,36 @@ export function createSubagentExecutor(deps) {
|
|
|
5835
5900
|
else
|
|
5836
5901
|
deps.state.workflowChildStops?.delete(workflowRunId);
|
|
5837
5902
|
},
|
|
5903
|
+
registerDrain: (drain) => {
|
|
5904
|
+
if (!drain)
|
|
5905
|
+
deps.state.workflowDrains?.delete(workflowRunId);
|
|
5906
|
+
else
|
|
5907
|
+
deps.state.workflowDrains?.set(workflowRunId, () => {
|
|
5908
|
+
if (workflowRunEvidence.drainRequestedAt === undefined) {
|
|
5909
|
+
// The marker must be on disk before anything is stopped: without it a reload during the drain would resume the run.
|
|
5910
|
+
const previousWorkflow = status.workflow;
|
|
5911
|
+
workflowRunEvidence.drainRequestedAt = Date.now();
|
|
5912
|
+
status.workflow = { ...(previousWorkflow ?? { trace: [], emits: [], console: [] }), drainRequestedAt: workflowRunEvidence.drainRequestedAt };
|
|
5913
|
+
let saved = false;
|
|
5914
|
+
try {
|
|
5915
|
+
persist();
|
|
5916
|
+
saved = runPersistence.pendingCount() === 0;
|
|
5917
|
+
}
|
|
5918
|
+
catch (error) {
|
|
5919
|
+
console.error(`Failed to save the drain request for async workflow '${workflowRunId}':`, error);
|
|
5920
|
+
}
|
|
5921
|
+
if (!saved) {
|
|
5922
|
+
delete workflowRunEvidence.drainRequestedAt;
|
|
5923
|
+
status.workflow = previousWorkflow;
|
|
5924
|
+
// Replaces a queued write that still carries the marker.
|
|
5925
|
+
persist({ tolerateStatusWriteFailure: true });
|
|
5926
|
+
return { ok: false };
|
|
5927
|
+
}
|
|
5928
|
+
}
|
|
5929
|
+
// Deferred so a full stop that stops the last running child aborts with its own reason first.
|
|
5930
|
+
return { ok: true, started: drain(() => queueMicrotask(() => controller.abort(new Error("Workflow drained: started children finished; no new children were started.")))) };
|
|
5931
|
+
});
|
|
5932
|
+
},
|
|
5838
5933
|
...(workflowState ? { state: workflowState } : {}),
|
|
5839
5934
|
onTrace: updateTrace,
|
|
5840
5935
|
onChildSettled: (notification) => {
|
|
@@ -5956,9 +6051,12 @@ export function createSubagentExecutor(deps) {
|
|
|
5956
6051
|
heartbeat: { status: "running", ...(childPhase ? { phase: childPhase } : {}) },
|
|
5957
6052
|
});
|
|
5958
6053
|
let preparedChildParams;
|
|
5959
|
-
const result = await runMissionWorkflowChild(missionBinding, workflowRunId, key, childPhase, () => {
|
|
6054
|
+
const result = await runMissionWorkflowChild(missionBinding, workflowRunId, key, childPhase, async () => {
|
|
5960
6055
|
const childRequest = bindMissionWorkflowChildAsyncLaunch({ ...prepareWorkflowChildLaunchParams({ workflowDefaults: workflowChildDefaults, childParams, parentWorkflowRunId: workflowRunId, workflowKey: key, ctxCwd: parentCwd, workflowCwd, artifactsDir: workflowArtifactsDir, aggregateOutputPath: workflowAggregateOutputPath, configuredOutputBaseDir, discoverAgents: discoverWorkflowAgents, agents: workflowAgents, workflowAgentScope: workflowChildDefaults.agentScope, outputOverride: childOutputOverrides.get(key), outputClaimPath: childOutputClaimPaths.get(key), options: { missionDetached: detachWorkflowChildMissions, awaitDetachedChild: true, runFanoutBudget: workflowFanoutBudget, parentDeadlineAt: workflowDeadlineAt, capabilityCeiling: workflowCapabilityCeiling } }), runFanoutAdmitted: admission.admitted }, missionBinding, deps.asyncByDefault, undefined, inheritedNestedRoute(deps)?.rootRunId);
|
|
5961
6056
|
preparedChildParams = childRequest;
|
|
6057
|
+
const launchRefusal = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(workflowRunId, key, childRequest, childParams.agent, parentCwd, discoverWorkflowAgents), workflowSignal);
|
|
6058
|
+
if (launchRefusal)
|
|
6059
|
+
return buildRequestedModeError(childRequest, launchRefusal);
|
|
5962
6060
|
if (workflowUsageBudget.budget)
|
|
5963
6061
|
workflowOwnedUsageBudgets.set(childRequest, workflowUsageBudget.budget);
|
|
5964
6062
|
if (workflowRequiredExtensions)
|
|
@@ -5995,6 +6093,8 @@ export function createSubagentExecutor(deps) {
|
|
|
5995
6093
|
step.currentToolArgs = progress.currentToolArgs;
|
|
5996
6094
|
step.currentToolStartedAt = progress.currentToolStartedAt;
|
|
5997
6095
|
step.currentPath = progress.currentPath;
|
|
6096
|
+
step.progressText = progress.progressText;
|
|
6097
|
+
step.progressUpdatedAt = progress.progressUpdatedAt;
|
|
5998
6098
|
step.recentTools = progress.recentTools.map((tool) => ({ ...tool }));
|
|
5999
6099
|
step.recentOutput = [...progress.recentOutput];
|
|
6000
6100
|
step.turnCount = progress.turnCount;
|
|
@@ -6174,8 +6274,7 @@ export function createSubagentExecutor(deps) {
|
|
|
6174
6274
|
const workflowOutput = typeof workflowChildDefaults.output === "string" || typeof workflowChildDefaults.output === "boolean" ? workflowChildDefaults.output : undefined;
|
|
6175
6275
|
const configuredOutputBaseDir = resolveConfiguredSingleRunOutputBaseDir(deps);
|
|
6176
6276
|
const workflowAggregateOutputPath = resolveSingleOutputPath(workflowOutput, ctx.cwd, workflowCwd, resolveSingleRunOutputBaseDir(deps, workflowArtifactsDir, foregroundWorkflowRunId));
|
|
6177
|
-
//
|
|
6178
|
-
// within artifact retention, which only removes top-level files.
|
|
6277
|
+
// Outside outputs/ so it cannot overwrite a child's report.
|
|
6179
6278
|
const workflowFullResultPath = path.join(workflowArtifactsDir, `${sanitizeRunPathSegment(foregroundWorkflowRunId)}_workflow-result.md`);
|
|
6180
6279
|
const claimedOutputPaths = new Map();
|
|
6181
6280
|
const childOutputOverrides = new Map();
|
|
@@ -6283,9 +6382,12 @@ export function createSubagentExecutor(deps) {
|
|
|
6283
6382
|
heartbeat: { status: "running", ...(childPhase ? { phase: childPhase } : {}) },
|
|
6284
6383
|
});
|
|
6285
6384
|
let preparedChildParams;
|
|
6286
|
-
const result = await runMissionWorkflowChild(missionBinding, foregroundWorkflowRunId, key, childPhase, () => {
|
|
6385
|
+
const result = await runMissionWorkflowChild(missionBinding, foregroundWorkflowRunId, key, childPhase, async () => {
|
|
6287
6386
|
const childRequest = bindMissionWorkflowChildAsyncLaunch({ ...prepareWorkflowChildLaunchParams({ workflowDefaults: workflowChildDefaults, childParams: delegatedWorkflowPermit ? { ...childParams, async: false } : childParams, parentWorkflowRunId: foregroundWorkflowRunId, workflowKey: key, ctxCwd: ctx.cwd, workflowCwd, artifactsDir: workflowArtifactsDir, aggregateOutputPath: workflowAggregateOutputPath, configuredOutputBaseDir, discoverAgents: discoverWorkflowAgents, agents: workflowAgents, workflowAgentScope: workflowChildDefaults.agentScope, outputOverride: childOutputOverrides.get(key), outputClaimPath: childOutputClaimPaths.get(key), options: { missionDetached: detachWorkflowChildMissions, suppressRoutineResultIntercom: chatProgress.mode === "live-card", runFanoutBudget: workflowFanoutBudget, parentDeadlineAt: workflowDeadlineAt, capabilityCeiling: workflowCapabilityCeiling } }), runFanoutAdmitted: admission.admitted }, missionBinding, deps.asyncByDefault, undefined, inheritedNestedRoute(deps)?.rootRunId);
|
|
6288
6387
|
preparedChildParams = childRequest;
|
|
6388
|
+
const launchRefusal = await approveWorkflowChildLaunch(ctx, () => workflowChildLaunchArgs(foregroundWorkflowRunId, key, childRequest, childParams.agent, ctx.cwd, discoverWorkflowAgents), workflowSignal);
|
|
6389
|
+
if (launchRefusal)
|
|
6390
|
+
return buildRequestedModeError(childRequest, launchRefusal);
|
|
6289
6391
|
if (workflowUsageBudget.budget)
|
|
6290
6392
|
workflowOwnedUsageBudgets.set(childRequest, workflowUsageBudget.budget);
|
|
6291
6393
|
if (workflowRequiredExtensions)
|
|
@@ -7059,6 +7161,8 @@ export function createSubagentExecutor(deps) {
|
|
|
7059
7161
|
}
|
|
7060
7162
|
if (action === "stop") {
|
|
7061
7163
|
const targetRunId = paramsWithResolvedCwd.runId ?? paramsWithResolvedCwd.id;
|
|
7164
|
+
if (paramsWithResolvedCwd.drain && paramsWithResolvedCwd.childId !== undefined)
|
|
7165
|
+
return { content: [{ type: "text", text: "action='stop' drain applies to a whole workflow; omit childId." }], isError: true, details: { mode: "management", results: [] } };
|
|
7062
7166
|
// Whole-workflow stops reach stopAsyncRun below, which stops a live workflow in-process.
|
|
7063
7167
|
const workflowRunId = targetRunId && paramsWithResolvedCwd.childId !== undefined ? resolveLiveWorkflowRunId(deps, targetRunId) : undefined;
|
|
7064
7168
|
if (workflowRunId && paramsWithResolvedCwd.childId !== undefined) {
|
|
@@ -7105,7 +7209,7 @@ export function createSubagentExecutor(deps) {
|
|
|
7105
7209
|
if (paramsWithResolvedCwd.dir) {
|
|
7106
7210
|
try {
|
|
7107
7211
|
const location = resolveAsyncRunLocation(paramsWithResolvedCwd, DIRS.async, DIRS.results);
|
|
7108
|
-
const stopResult = stopAsyncRun(deps.state, location.resolvedId ?? targetRunId ?? path.basename(location.asyncDir ?? paramsWithResolvedCwd.dir), deps.kill, location, paramsWithResolvedCwd.childId);
|
|
7212
|
+
const stopResult = stopAsyncRun(deps.state, location.resolvedId ?? targetRunId ?? path.basename(location.asyncDir ?? paramsWithResolvedCwd.dir), deps.kill, location, paramsWithResolvedCwd.childId, paramsWithResolvedCwd.drain);
|
|
7109
7213
|
return stopResult ?? { content: [{ type: "text", text: `No running or queued async run was found for '${targetRunId ?? paramsWithResolvedCwd.dir}'.` }], isError: true, details: { mode: "management", results: [] } };
|
|
7110
7214
|
}
|
|
7111
7215
|
catch (error) {
|
|
@@ -7126,7 +7230,7 @@ export function createSubagentExecutor(deps) {
|
|
|
7126
7230
|
return { content: [{ type: "text", text: "action='stop' supports current-session top-level async runs only." }], isError: true, details: { mode: "management", results: [] } };
|
|
7127
7231
|
if (resolved?.kind === "foreground")
|
|
7128
7232
|
return { content: [{ type: "text", text: "action='stop' supports async runs only. Use action='interrupt' for foreground runs." }], isError: true, details: { mode: "management", results: [] } };
|
|
7129
|
-
const stopResult = stopAsyncRun(deps.state, resolved?.kind === "async" ? resolved.id : targetRunId, deps.kill, resolved?.kind === "async" ? resolved.location : undefined, paramsWithResolvedCwd.childId);
|
|
7233
|
+
const stopResult = stopAsyncRun(deps.state, resolved?.kind === "async" ? resolved.id : targetRunId, deps.kill, resolved?.kind === "async" ? resolved.location : undefined, paramsWithResolvedCwd.childId, paramsWithResolvedCwd.drain);
|
|
7130
7234
|
if (stopResult)
|
|
7131
7235
|
return stopResult;
|
|
7132
7236
|
return {
|
|
@@ -7353,6 +7457,16 @@ export function createSubagentExecutor(deps) {
|
|
|
7353
7457
|
if (launcherError)
|
|
7354
7458
|
return buildRequestedModeError(effectiveParams, launcherError);
|
|
7355
7459
|
}
|
|
7460
|
+
// Refused here, before admission; executeAsyncSingle checks again on the exact agent and launcher it spawns.
|
|
7461
|
+
if (effectiveParams.requireLauncher !== undefined) {
|
|
7462
|
+
if (!effectiveParams.requireLauncher || typeof effectiveParams.requireLauncher !== "object")
|
|
7463
|
+
return buildRequestedModeError(effectiveParams, "requireLauncher must be { name, definitionDigest }.");
|
|
7464
|
+
if (!hasSingle || effectiveParams.resume !== undefined || effectiveParams.workflowParentRunId !== undefined)
|
|
7465
|
+
return buildRequestedModeError(effectiveParams, REQUIRE_LAUNCHER_SHAPE_ERROR);
|
|
7466
|
+
const required = selectedAgents[0] ? checkRequiredRunnerLauncher(selectedAgents[0], selectedAgents[0].launcher, effectiveParams.requireLauncher) : undefined;
|
|
7467
|
+
if (required?.error)
|
|
7468
|
+
return buildRequestedModeError(effectiveParams, required.error);
|
|
7469
|
+
}
|
|
7356
7470
|
if (effectiveAsync && hasSingle && effectiveParams.resume === undefined && effectiveParams.worktree === true) {
|
|
7357
7471
|
try {
|
|
7358
7472
|
await preflightWorktreeSource(effectiveCwd, { signal });
|
|
@@ -7662,6 +7776,7 @@ export function createSubagentExecutor(deps) {
|
|
|
7662
7776
|
parentModel: requestParentModel,
|
|
7663
7777
|
scopedModelIds: scopedModelIdsFromContext(ctx),
|
|
7664
7778
|
availableModels: ctx.modelRegistry.getAvailable().map(toModelInfo),
|
|
7779
|
+
knownProviders: knownModelProviders(ctx.modelRegistry),
|
|
7665
7780
|
currentProvider: requestParentModel?.provider,
|
|
7666
7781
|
modelScope,
|
|
7667
7782
|
thinkingOverrideForTask,
|