@vicary/pi-subagents 0.85.0 → 0.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +2 -2
- package/bundle/{chunk-O7CPL6H4.js → chunk-2D2DQGC2.js} +9 -9
- package/bundle/{chunk-KZ34KQQH.js → chunk-2NY5PCKQ.js} +11 -5
- package/bundle/{chunk-PVIVCDG2.js → chunk-3CVOAS77.js} +2 -2
- package/bundle/{chunk-N7B2KD74.js → chunk-6O7YH2QV.js} +1 -1
- package/bundle/{chunk-B3OOJJA6.js → chunk-75LVXBSA.js} +194 -94
- package/bundle/{chunk-H2NLFTC5.js → chunk-BFF6YDK6.js} +1 -1
- package/bundle/{chunk-UX4SCV5N.js → chunk-C3KWLXDH.js} +159 -98
- package/bundle/{chunk-GCSLVFCX.js → chunk-C5QWQSSM.js} +1 -1
- package/bundle/{chunk-KDMFBYFM.js → chunk-ESWW6XSX.js} +1 -1
- package/bundle/{chunk-CS4O36CZ.js → chunk-HDICKROY.js} +5 -5
- package/bundle/{chunk-JHBQ7N2L.js → chunk-HTI7DD5D.js} +2 -2
- package/bundle/{chunk-L2ENOFVZ.js → chunk-LZKVUWIY.js} +66 -26
- package/bundle/{chunk-RV5OGHLO.js → chunk-M2VBGET6.js} +2 -2
- package/bundle/{chunk-QZL2ZZPM.js → chunk-NJTSXIMG.js} +12 -12
- package/bundle/{chunk-YZBCREP5.js → chunk-NMYBVCGP.js} +39 -34
- package/bundle/{chunk-A7VJ5XXE.js → chunk-O7A26O6B.js} +8 -6
- package/bundle/{chunk-HFTBF7SG.js → chunk-OOE3R7IQ.js} +1 -1
- package/bundle/{chunk-LGMILZNE.js → chunk-PGU4TZV3.js} +79 -32
- package/bundle/{chunk-VEZMZDTW.js → chunk-PUSTU4Q7.js} +80 -37
- package/bundle/{chunk-KEY3UQMQ.js → chunk-SIAQXPJ4.js} +6 -8
- package/bundle/{chunk-QO75KJBT.js → chunk-USRX7QXD.js} +2 -2
- package/bundle/{chunk-7MAE3DJV.js → chunk-VFUFOZBU.js} +1 -1
- package/bundle/{chunk-NF7IEKBH.js → chunk-W2BZS6UC.js} +27 -13
- package/bundle/{chunk-T5V5BRCL.js → chunk-W52LJANO.js} +1 -1
- package/bundle/{chunk-PHZP3KHB.js → chunk-XSDYTXHF.js} +18 -11
- package/bundle/{chunk-LTPH2DXH.js → chunk-XV7RTWTS.js} +3 -3
- package/bundle/{chunk-JO67XSKD.js → chunk-YEXKJJVS.js} +12 -7
- package/bundle/{chunk-HS4WPO6B.js → chunk-Z4TR7MK6.js} +5 -5
- 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 +9 -3
- package/docs/configuration.md +14 -6
- package/docs/extension-api.md +2 -0
- package/docs/models.md +6 -2
- package/docs/tool-reference.md +3 -0
- package/package.json +2 -2
- package/skills/pi-subagents/SKILL.md +7 -4
- package/skills/pi-subagents/references/prompting-and-roles.md +1 -0
- package/src/agents/agent-management.js +10 -6
- package/src/agents/agent-serializer.d.ts +2 -0
- package/src/agents/agent-serializer.js +1 -1
- package/src/agents/agents.js +37 -12
- package/src/api/preflight.d.ts +3 -1
- package/src/api/preflight.js +2 -0
- package/src/extension/index.js +4 -2
- package/src/extension/schemas.d.ts +2 -0
- package/src/extension/schemas.js +1 -0
- package/src/extension/tool-activation.js +10 -1
- package/src/extension/tool-description.d.ts +1 -1
- package/src/extension/tool-description.js +8 -8
- package/src/runs/background/async-execution.d.ts +2 -1
- package/src/runs/background/async-execution.js +4 -2
- package/src/runs/background/run-status.js +5 -4
- package/src/runs/background/runner-aliases.js +15 -0
- package/src/runs/background/subagent-runner.js +6 -6
- package/src/runs/background/wait-subscriptions.js +124 -12
- 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.js +1 -0
- package/src/runs/foreground/subagent-executor.d.ts +1 -0
- package/src/runs/foreground/subagent-executor.js +51 -8
- package/src/runs/shared/acceptance.js +69 -26
- package/src/runs/shared/child-session.d.ts +5 -4
- package/src/runs/shared/child-session.js +43 -33
- 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/herdr-placed-run.js +3 -2
- package/src/runs/shared/mcp-config-sources.d.ts +2 -1
- package/src/runs/shared/mcp-config-sources.js +1 -1
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +0 -1
- package/src/runs/shared/mcp-direct-tool-allowlist.js +5 -6
- package/src/runs/shared/model-resolution.d.ts +19 -4
- package/src/runs/shared/model-resolution.js +50 -51
- package/src/runs/shared/structured-output.js +10 -3
- package/src/shared/artifacts.js +25 -13
- package/src/shared/pruned-fork.js +2 -2
- package/src/shared/types.d.ts +71 -48
- package/src/tui/render.js +83 -22
- package/src/watchdog/model-selection.js +2 -2
- package/src/watchdog/review.js +2 -2
- package/src/workflows/scripted-workflow.d.ts +2 -0
- package/src/workflows/scripted-workflow.js +103 -39
- package/src/workflows/structured-workflow-scripts.d.ts +4 -3
- package/src/workflows/structured-workflow-scripts.js +32 -11
- 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 +1 -1
- package/src/workflows/workflow-resume.d.ts +1 -1
- package/src/workflows/workflow-resume.js +3 -1
|
@@ -10,4 +10,4 @@ export declare function stopAsyncRun(state: SubagentState, runId: string | undef
|
|
|
10
10
|
asyncDir: string | null;
|
|
11
11
|
resolvedId?: string;
|
|
12
12
|
reattachedRunId?: string;
|
|
13
|
-
}, childId?: string): AgentToolResult<Details> | null;
|
|
13
|
+
}, childId?: string, drain?: boolean): AgentToolResult<Details> | null;
|
|
@@ -130,7 +130,7 @@ export function deliverAsyncRunStop(input) {
|
|
|
130
130
|
if (pausedWholeRun)
|
|
131
131
|
return sealPausedRun(delivery.asyncDir, status, resultsDir);
|
|
132
132
|
}
|
|
133
|
-
export function stopAsyncRun(state, runId, kill, location, childId) {
|
|
133
|
+
export function stopAsyncRun(state, runId, kill, location, childId, drain) {
|
|
134
134
|
const target = getAsyncStopTarget(state, runId, location);
|
|
135
135
|
// An async workflow runs in this process: it has no runner to read a stop request, so stop it through its controller.
|
|
136
136
|
const workflowRunId = target?.asyncId ?? runId;
|
|
@@ -139,6 +139,14 @@ export function stopAsyncRun(state, runId, kill, location, childId) {
|
|
|
139
139
|
const workflowStatus = workflowAsyncDir ? readStatus(workflowAsyncDir) : undefined;
|
|
140
140
|
// Controllers outlive a session switch; a workflow owned by another session falls through to the ownership check below.
|
|
141
141
|
const foreignWorkflow = Boolean(state.currentSessionId && workflowStatus && workflowStatus.sessionId !== state.currentSessionId);
|
|
142
|
+
if (drain) {
|
|
143
|
+
const drained = workflowController && workflowRunId && !foreignWorkflow && !workflowController.signal.aborted ? state.workflowDrains?.get(workflowRunId)?.() : undefined;
|
|
144
|
+
if (!drained)
|
|
145
|
+
return { content: [{ type: "text", text: `drain applies only to live async workflows in this session; '${runId ?? "current"}' is not one.` }], isError: true, details: { mode: "management", results: [] } };
|
|
146
|
+
if (!drained.ok)
|
|
147
|
+
return { content: [{ type: "text", text: `Could not save the drain request for '${workflowRunId}'; nothing was stopped. Retry, or use stop without drain.` }], isError: true, details: { mode: "management", results: [] } };
|
|
148
|
+
return { content: [{ type: "text", text: `Drain requested for async workflow ${workflowRunId}: no new children will start; ${drained.started} started child(ren) will finish.` }], details: { mode: "management", results: [] } };
|
|
149
|
+
}
|
|
142
150
|
if (workflowController && workflowRunId && !foreignWorkflow) {
|
|
143
151
|
if (workflowStatus)
|
|
144
152
|
stopStoppableAsyncStatusChildren(workflowStatus, state.workflowChildStops?.get(workflowRunId), "Workflow stopped.");
|
|
@@ -1796,6 +1796,7 @@ async function runSyncCompletionInner(runtimeCwd, agents, agentName, task, optio
|
|
|
1796
1796
|
scope: options.modelScope,
|
|
1797
1797
|
primaryModelFromParent: options.modelOverrideFromParent,
|
|
1798
1798
|
origin: options.modelOrigin ?? (options.modelOverrideFromParent ? "inherited" : "configured"),
|
|
1799
|
+
knownProviders: options.knownProviders,
|
|
1799
1800
|
});
|
|
1800
1801
|
try {
|
|
1801
1802
|
const model = applyThinkingSuffix(selectedModel, options.thinkingOverride ?? agent.thinking, options.thinkingOverride !== undefined);
|
|
@@ -24,7 +24,7 @@ import { commandAction } from "./command-action.js";
|
|
|
24
24
|
import { handleWatchdogToolAction, WATCHDOG_TOOL_ACTIONS } from "../../watchdog/tool-actions.js";
|
|
25
25
|
import { applyWatchdogLaunchRules } from "../../watchdog/rules.js";
|
|
26
26
|
import { childWatchdogProgressForModel } from "../../watchdog/child-status.js";
|
|
27
|
-
import { normalizeParentModel, resolveEffectiveSubagentModel, resolveModelOrigin, scopedModelIdsFromContext } from "../shared/model-resolution.js";
|
|
27
|
+
import { knownModelProviders, normalizeParentModel, resolveEffectiveSubagentModel, resolveModelOrigin, scopedModelIdsFromContext } from "../shared/model-resolution.js";
|
|
28
28
|
import { projectChainOutputSchemas, resolveEffectiveOutputSchema } from "../shared/child-launch-plan.js";
|
|
29
29
|
import { formatRetainedChildren, listRetainedChildren } from "../background/retained-children.js";
|
|
30
30
|
import { resolveModelScopesForAgent } from "../shared/model-scope.js";
|
|
@@ -1063,6 +1063,7 @@ function appendStepToAsyncChain(input) {
|
|
|
1063
1063
|
parentProviderRegistry: input.ctx.modelRegistry,
|
|
1064
1064
|
currentModel: parentModel,
|
|
1065
1065
|
scopedModelIds: scopedModelIdsFromContext(input.ctx),
|
|
1066
|
+
knownProviders: knownModelProviders(input.ctx.modelRegistry),
|
|
1066
1067
|
modelScope: discoveredForAppend.modelScope,
|
|
1067
1068
|
modelResponseAliases: input.deps.config.modelResponseAliases,
|
|
1068
1069
|
interactive: input.ctx.hasUI,
|
|
@@ -1551,6 +1552,7 @@ async function resumeExternalJobFollowUp(input) {
|
|
|
1551
1552
|
parentProviderRegistry: input.ctx.modelRegistry,
|
|
1552
1553
|
currentModel: parentModel,
|
|
1553
1554
|
scopedModelIds: scopedModelIdsFromContext(input.ctx),
|
|
1555
|
+
knownProviders: knownModelProviders(input.ctx.modelRegistry),
|
|
1554
1556
|
modelScope: input.modelScope,
|
|
1555
1557
|
modelResponseAliases: input.deps.config.modelResponseAliases,
|
|
1556
1558
|
interactive: input.ctx.hasUI,
|
|
@@ -1855,6 +1857,7 @@ async function resumeAsyncRun(input) {
|
|
|
1855
1857
|
parentProviderRegistry: input.ctx.modelRegistry,
|
|
1856
1858
|
currentModel: parentModel,
|
|
1857
1859
|
scopedModelIds: scopedModelIdsFromContext(input.ctx),
|
|
1860
|
+
knownProviders: knownModelProviders(input.ctx.modelRegistry),
|
|
1858
1861
|
modelScope,
|
|
1859
1862
|
modelResponseAliases: input.deps.config.modelResponseAliases,
|
|
1860
1863
|
runnerLaunchers: input.deps.config.runnerLaunchers,
|
|
@@ -1998,6 +2001,7 @@ async function resumeAsyncRun(input) {
|
|
|
1998
2001
|
parentProviderRegistry: input.ctx.modelRegistry,
|
|
1999
2002
|
currentModel: parentModel,
|
|
2000
2003
|
scopedModelIds: scopedModelIdsFromContext(input.ctx),
|
|
2004
|
+
knownProviders: knownModelProviders(input.ctx.modelRegistry),
|
|
2001
2005
|
modelScope,
|
|
2002
2006
|
// Absence in the retained contract is meaningful; never acquire current aliases.
|
|
2003
2007
|
modelResponseAliases: recoveryDescriptor ? recoveryDescriptor.modelResponseAliases : foregroundContract?.modelResponseAliases,
|
|
@@ -2862,7 +2866,7 @@ function resolveStaticLaunchSummary(input) {
|
|
|
2862
2866
|
const modelScopes = resolveModelScopesForAgent(input.modelScope, input.agent, input.parentModel, input.scopedModelIds);
|
|
2863
2867
|
const model = externalRunner
|
|
2864
2868
|
? undefined
|
|
2865
|
-
: resolveEffectiveSubagentModel(input.explicitModel, agentConfig?.model, input.parentModel, input.availableModels, agentConfig?.modelProvider ?? input.currentProvider,
|
|
2869
|
+
: resolveEffectiveSubagentModel(input.explicitModel, agentConfig?.model, input.parentModel, input.availableModels, agentConfig?.modelProvider ?? input.currentProvider, { scope: modelScopes, knownProviders: input.knownProviders });
|
|
2866
2870
|
const thinkingOverride = externalRunner ? undefined : input.thinkingOverrideForTask();
|
|
2867
2871
|
const thinking = externalRunner ? undefined : resolveEffectiveThinking(model, thinkingOverride ?? agentConfig?.thinking);
|
|
2868
2872
|
return {
|
|
@@ -2880,6 +2884,7 @@ function collectStaticLaunchSummaries(input) {
|
|
|
2880
2884
|
parentModel: input.parentModel,
|
|
2881
2885
|
scopedModelIds: input.scopedModelIds,
|
|
2882
2886
|
availableModels: input.availableModels,
|
|
2887
|
+
knownProviders: input.knownProviders,
|
|
2883
2888
|
currentProvider: input.currentProvider,
|
|
2884
2889
|
modelScope: input.modelScope,
|
|
2885
2890
|
thinkingOverrideForTask: input.thinkingOverrideForTask,
|
|
@@ -3159,6 +3164,7 @@ async function runAsyncPath(data, deps) {
|
|
|
3159
3164
|
parentProviderRegistry: ctx.modelRegistry,
|
|
3160
3165
|
currentModel: parentModel,
|
|
3161
3166
|
scopedModelIds: data.scopedModelIds,
|
|
3167
|
+
knownProviders: knownModelProviders(ctx.modelRegistry),
|
|
3162
3168
|
modelScope: data.modelScope,
|
|
3163
3169
|
modelResponseAliases: deps.config.modelResponseAliases,
|
|
3164
3170
|
runnerLaunchers: deps.config.runnerLaunchers,
|
|
@@ -3203,8 +3209,9 @@ async function runAsyncPath(data, deps) {
|
|
|
3203
3209
|
const modelOverride = a.runner?.type === "external-cli" || a.runner?.type === "external-job"
|
|
3204
3210
|
? params.model ?? (externalRunnerWithoutExplicitModel ? undefined : a.model)
|
|
3205
3211
|
: resolveEffectiveSubagentModel(params.model, a.model, parentModel, availableModels, a.modelProvider ?? currentProvider, {
|
|
3206
|
-
|
|
3212
|
+
scope: modelScopes,
|
|
3207
3213
|
source: modelOrigin === "explicit" ? "explicit" : "inherited",
|
|
3214
|
+
knownProviders: asyncCtx.knownProviders,
|
|
3208
3215
|
});
|
|
3209
3216
|
const modelOverrideFromParent = modelOrigin === "inherited";
|
|
3210
3217
|
const launchRuleError = applyWatchdogLaunchRules({ cwd: effectiveCwd, agent: a.name, model: modelOverride ?? (parentModel && `${parentModel.provider}/${parentModel.id}`), warn: (violation) => deps.watchdog?.displayRuleWarning(violation) });
|
|
@@ -3632,6 +3639,7 @@ async function runSinglePath(data, deps) {
|
|
|
3632
3639
|
const parentModel = data.parentModel;
|
|
3633
3640
|
const currentProvider = parentModel?.provider;
|
|
3634
3641
|
const availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo);
|
|
3642
|
+
const knownProviders = knownModelProviders(ctx.modelRegistry);
|
|
3635
3643
|
const modelScopes = resolveModelScopesForAgent(data.modelScope, agentConfig.name, parentModel, data.scopedModelIds);
|
|
3636
3644
|
let task = typeof params.task === "string" ? params.task : "";
|
|
3637
3645
|
const modelOrigin = resolveModelOrigin({
|
|
@@ -3641,8 +3649,9 @@ async function runSinglePath(data, deps) {
|
|
|
3641
3649
|
parentModel,
|
|
3642
3650
|
});
|
|
3643
3651
|
let modelOverride = resolveEffectiveSubagentModel(params.model, agentConfig.model, parentModel, availableModels, agentConfig.modelProvider ?? currentProvider, {
|
|
3644
|
-
|
|
3652
|
+
scope: modelScopes,
|
|
3645
3653
|
source: modelOrigin === "explicit" ? "explicit" : "inherited",
|
|
3654
|
+
knownProviders,
|
|
3646
3655
|
});
|
|
3647
3656
|
const modelOverrideFromParent = modelOrigin === "inherited";
|
|
3648
3657
|
const launchRuleError = applyWatchdogLaunchRules({ cwd: effectiveCwd, agent: agentConfig.name, model: modelOverride ?? (parentModel && `${parentModel.provider}/${parentModel.id}`), warn: (violation) => deps.watchdog?.displayRuleWarning(violation) });
|
|
@@ -3890,6 +3899,7 @@ async function runSinglePath(data, deps) {
|
|
|
3890
3899
|
thinkingCeiling: agentConfig.maxThinking,
|
|
3891
3900
|
extensionBindings: params.extensionBindings,
|
|
3892
3901
|
availableModels,
|
|
3902
|
+
knownProviders,
|
|
3893
3903
|
modelResponseAliases,
|
|
3894
3904
|
preferredModelProvider: currentProvider,
|
|
3895
3905
|
modelScope: modelScopes,
|
|
@@ -5167,6 +5177,7 @@ export function createSubagentExecutor(deps) {
|
|
|
5167
5177
|
const controller = new AbortController();
|
|
5168
5178
|
deps.state.workflowControllers ??= new Map();
|
|
5169
5179
|
deps.state.workflowChildStops ??= new Map();
|
|
5180
|
+
deps.state.workflowDrains ??= new Map();
|
|
5170
5181
|
deps.state.workflowControllers.set(workflowRunId, controller);
|
|
5171
5182
|
workflowCapacity?.markWorkflowStarted();
|
|
5172
5183
|
if (workflowCapacity)
|
|
@@ -5797,6 +5808,36 @@ export function createSubagentExecutor(deps) {
|
|
|
5797
5808
|
else
|
|
5798
5809
|
deps.state.workflowChildStops?.delete(workflowRunId);
|
|
5799
5810
|
},
|
|
5811
|
+
registerDrain: (drain) => {
|
|
5812
|
+
if (!drain)
|
|
5813
|
+
deps.state.workflowDrains?.delete(workflowRunId);
|
|
5814
|
+
else
|
|
5815
|
+
deps.state.workflowDrains?.set(workflowRunId, () => {
|
|
5816
|
+
if (workflowRunEvidence.drainRequestedAt === undefined) {
|
|
5817
|
+
// The marker must be on disk before anything is stopped: without it a reload during the drain would resume the run.
|
|
5818
|
+
const previousWorkflow = status.workflow;
|
|
5819
|
+
workflowRunEvidence.drainRequestedAt = Date.now();
|
|
5820
|
+
status.workflow = { ...(previousWorkflow ?? { trace: [], emits: [], console: [] }), drainRequestedAt: workflowRunEvidence.drainRequestedAt };
|
|
5821
|
+
let saved = false;
|
|
5822
|
+
try {
|
|
5823
|
+
persist();
|
|
5824
|
+
saved = runPersistence.pendingCount() === 0;
|
|
5825
|
+
}
|
|
5826
|
+
catch (error) {
|
|
5827
|
+
console.error(`Failed to save the drain request for async workflow '${workflowRunId}':`, error);
|
|
5828
|
+
}
|
|
5829
|
+
if (!saved) {
|
|
5830
|
+
delete workflowRunEvidence.drainRequestedAt;
|
|
5831
|
+
status.workflow = previousWorkflow;
|
|
5832
|
+
// Replaces a queued write that still carries the marker.
|
|
5833
|
+
persist({ tolerateStatusWriteFailure: true });
|
|
5834
|
+
return { ok: false };
|
|
5835
|
+
}
|
|
5836
|
+
}
|
|
5837
|
+
// Deferred so a full stop that stops the last running child aborts with its own reason first.
|
|
5838
|
+
return { ok: true, started: drain(() => queueMicrotask(() => controller.abort(new Error("Workflow drained: started children finished; no new children were started.")))) };
|
|
5839
|
+
});
|
|
5840
|
+
},
|
|
5800
5841
|
...(workflowState ? { state: workflowState } : {}),
|
|
5801
5842
|
onTrace: updateTrace,
|
|
5802
5843
|
onChildSettled: (notification) => {
|
|
@@ -6139,8 +6180,7 @@ export function createSubagentExecutor(deps) {
|
|
|
6139
6180
|
const workflowOutput = typeof workflowChildDefaults.output === "string" || typeof workflowChildDefaults.output === "boolean" ? workflowChildDefaults.output : undefined;
|
|
6140
6181
|
const configuredOutputBaseDir = resolveConfiguredSingleRunOutputBaseDir(deps);
|
|
6141
6182
|
const workflowAggregateOutputPath = resolveSingleOutputPath(workflowOutput, ctx.cwd, workflowCwd, resolveSingleRunOutputBaseDir(deps, workflowArtifactsDir, foregroundWorkflowRunId));
|
|
6142
|
-
//
|
|
6143
|
-
// within artifact retention, which only removes top-level files.
|
|
6183
|
+
// Outside outputs/ so it cannot overwrite a child's report.
|
|
6144
6184
|
const workflowFullResultPath = path.join(workflowArtifactsDir, `${sanitizeRunPathSegment(foregroundWorkflowRunId)}_workflow-result.md`);
|
|
6145
6185
|
const claimedOutputPaths = new Map();
|
|
6146
6186
|
const childOutputOverrides = new Map();
|
|
@@ -7027,6 +7067,8 @@ export function createSubagentExecutor(deps) {
|
|
|
7027
7067
|
}
|
|
7028
7068
|
if (action === "stop") {
|
|
7029
7069
|
const targetRunId = paramsWithResolvedCwd.runId ?? paramsWithResolvedCwd.id;
|
|
7070
|
+
if (paramsWithResolvedCwd.drain && paramsWithResolvedCwd.childId !== undefined)
|
|
7071
|
+
return { content: [{ type: "text", text: "action='stop' drain applies to a whole workflow; omit childId." }], isError: true, details: { mode: "management", results: [] } };
|
|
7030
7072
|
// Whole-workflow stops reach stopAsyncRun below, which stops a live workflow in-process.
|
|
7031
7073
|
const workflowRunId = targetRunId && paramsWithResolvedCwd.childId !== undefined ? resolveLiveWorkflowRunId(deps, targetRunId) : undefined;
|
|
7032
7074
|
if (workflowRunId && paramsWithResolvedCwd.childId !== undefined) {
|
|
@@ -7073,7 +7115,7 @@ export function createSubagentExecutor(deps) {
|
|
|
7073
7115
|
if (paramsWithResolvedCwd.dir) {
|
|
7074
7116
|
try {
|
|
7075
7117
|
const location = resolveAsyncRunLocation(paramsWithResolvedCwd, DIRS.async, DIRS.results);
|
|
7076
|
-
const stopResult = stopAsyncRun(deps.state, location.resolvedId ?? targetRunId ?? path.basename(location.asyncDir ?? paramsWithResolvedCwd.dir), deps.kill, location, paramsWithResolvedCwd.childId);
|
|
7118
|
+
const stopResult = stopAsyncRun(deps.state, location.resolvedId ?? targetRunId ?? path.basename(location.asyncDir ?? paramsWithResolvedCwd.dir), deps.kill, location, paramsWithResolvedCwd.childId, paramsWithResolvedCwd.drain);
|
|
7077
7119
|
return stopResult ?? { content: [{ type: "text", text: `No running or queued async run was found for '${targetRunId ?? paramsWithResolvedCwd.dir}'.` }], isError: true, details: { mode: "management", results: [] } };
|
|
7078
7120
|
}
|
|
7079
7121
|
catch (error) {
|
|
@@ -7094,7 +7136,7 @@ export function createSubagentExecutor(deps) {
|
|
|
7094
7136
|
return { content: [{ type: "text", text: "action='stop' supports current-session top-level async runs only." }], isError: true, details: { mode: "management", results: [] } };
|
|
7095
7137
|
if (resolved?.kind === "foreground")
|
|
7096
7138
|
return { content: [{ type: "text", text: "action='stop' supports async runs only. Use action='interrupt' for foreground runs." }], isError: true, details: { mode: "management", results: [] } };
|
|
7097
|
-
const stopResult = stopAsyncRun(deps.state, resolved?.kind === "async" ? resolved.id : targetRunId, deps.kill, resolved?.kind === "async" ? resolved.location : undefined, paramsWithResolvedCwd.childId);
|
|
7139
|
+
const stopResult = stopAsyncRun(deps.state, resolved?.kind === "async" ? resolved.id : targetRunId, deps.kill, resolved?.kind === "async" ? resolved.location : undefined, paramsWithResolvedCwd.childId, paramsWithResolvedCwd.drain);
|
|
7098
7140
|
if (stopResult)
|
|
7099
7141
|
return stopResult;
|
|
7100
7142
|
return {
|
|
@@ -7643,6 +7685,7 @@ export function createSubagentExecutor(deps) {
|
|
|
7643
7685
|
parentModel: requestParentModel,
|
|
7644
7686
|
scopedModelIds: scopedModelIdsFromContext(ctx),
|
|
7645
7687
|
availableModels: ctx.modelRegistry.getAvailable().map(toModelInfo),
|
|
7688
|
+
knownProviders: knownModelProviders(ctx.modelRegistry),
|
|
7646
7689
|
currentProvider: requestParentModel?.provider,
|
|
7647
7690
|
modelScope,
|
|
7648
7691
|
thinkingOverrideForTask,
|
|
@@ -1149,13 +1149,34 @@ function verifyRedactionEnv(env) {
|
|
|
1149
1149
|
return value.length >= 4 && SENSITIVE_ENV_KEY_PATTERN.test(key);
|
|
1150
1150
|
}));
|
|
1151
1151
|
}
|
|
1152
|
-
function
|
|
1152
|
+
function verifySecrets(env) {
|
|
1153
|
+
return [...new Set(Object.values(verifyRedactionEnv(env)).filter(Boolean))].sort((left, right) => right.length - left.length);
|
|
1154
|
+
}
|
|
1155
|
+
function redactSecrets(value, secrets) {
|
|
1153
1156
|
let redacted = value;
|
|
1154
|
-
const secrets = [...new Set(Object.values(verifyRedactionEnv(env)).filter(Boolean))].sort((left, right) => right.length - left.length);
|
|
1155
1157
|
for (const secret of secrets)
|
|
1156
1158
|
redacted = redacted.replaceAll(secret, "[REDACTED]");
|
|
1157
1159
|
return redacted;
|
|
1158
1160
|
}
|
|
1161
|
+
function redactVerifyEnv(value, env) {
|
|
1162
|
+
return redactSecrets(value, verifySecrets(env));
|
|
1163
|
+
}
|
|
1164
|
+
/** Numbers are matched on their source text: parsing rounds or respells them (12345678901234567890, 1.50), which would hide a secret. */
|
|
1165
|
+
function parseRedactedVerifyValue(text, secrets) {
|
|
1166
|
+
return JSON.parse(text, (_key, value, context) => {
|
|
1167
|
+
if (typeof value === "string")
|
|
1168
|
+
return redactSecrets(value, secrets);
|
|
1169
|
+
if (typeof value === "number" && secrets.length > 0) {
|
|
1170
|
+
// Node 22+ and Bun pass the source text; without it, fail closed.
|
|
1171
|
+
const source = context?.source;
|
|
1172
|
+
return source !== undefined && redactSecrets(source, secrets) === source ? value : "[REDACTED]";
|
|
1173
|
+
}
|
|
1174
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
1175
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [redactSecrets(key, secrets), item]));
|
|
1176
|
+
}
|
|
1177
|
+
return value;
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1159
1180
|
function uniqueStrings(items) {
|
|
1160
1181
|
return unique(items.map((item) => item?.trim()).filter((item) => Boolean(item)));
|
|
1161
1182
|
}
|
|
@@ -1223,34 +1244,49 @@ const TYPED_VERIFY_OUTPUT_MAX_BYTES = 12_000;
|
|
|
1223
1244
|
* A passing `output: "json"` command must print one JSON document on stdout.
|
|
1224
1245
|
* The parsed value becomes the run's structured output; anything else turns
|
|
1225
1246
|
* the passing run into a failed one so acceptance rejects rather than
|
|
1226
|
-
* silently dropping the verdict.
|
|
1227
|
-
*
|
|
1247
|
+
* silently dropping the verdict. The raw stdout is parsed, because the stored
|
|
1248
|
+
* stdout is redacted and redaction can hit JSON syntax (`true` in KDE_FULL_SESSION).
|
|
1249
|
+
* The schema checks the raw value so a redacted string cannot fail a correct
|
|
1250
|
+
* gate. Error messages quote parts of their input (a parse error quotes ~10
|
|
1251
|
+
* chars, schema paths escape `/` and `~`), so each one is built from the
|
|
1252
|
+
* redacted text or value, never the raw one.
|
|
1228
1253
|
*/
|
|
1229
|
-
async function applyTypedVerifyOutput(command, run) {
|
|
1254
|
+
async function applyTypedVerifyOutput(command, run, rawStdout) {
|
|
1230
1255
|
if (run.status !== "passed")
|
|
1231
1256
|
return;
|
|
1232
|
-
const
|
|
1257
|
+
const secrets = verifySecrets(command.env);
|
|
1258
|
+
const stdout = rawStdout.trim();
|
|
1233
1259
|
const fail = (message) => {
|
|
1234
1260
|
run.status = "failed";
|
|
1235
|
-
run.structuredOutputError = message;
|
|
1261
|
+
run.structuredOutputError = redactSecrets(message, secrets);
|
|
1236
1262
|
};
|
|
1237
|
-
if (!stdout
|
|
1263
|
+
if (!stdout)
|
|
1238
1264
|
return fail("output: \"json\" command printed nothing on stdout.");
|
|
1239
|
-
if (stdout.
|
|
1265
|
+
if (stdout.length > TYPED_VERIFY_OUTPUT_MAX_BYTES)
|
|
1240
1266
|
return fail(`output: "json" stdout exceeded ${TYPED_VERIFY_OUTPUT_MAX_BYTES} characters and was truncated.`);
|
|
1241
1267
|
let value;
|
|
1242
1268
|
try {
|
|
1243
1269
|
value = JSON.parse(stdout);
|
|
1244
1270
|
}
|
|
1245
|
-
catch
|
|
1246
|
-
|
|
1271
|
+
catch {
|
|
1272
|
+
let reason = "parse failed";
|
|
1273
|
+
try {
|
|
1274
|
+
JSON.parse(redactSecrets(stdout, secrets));
|
|
1275
|
+
}
|
|
1276
|
+
catch (error) {
|
|
1277
|
+
reason = error instanceof Error ? error.message : String(error);
|
|
1278
|
+
}
|
|
1279
|
+
return fail(`output: "json" stdout is not valid JSON: ${reason}`);
|
|
1247
1280
|
}
|
|
1281
|
+
const redactedValue = parseRedactedVerifyValue(stdout, secrets);
|
|
1248
1282
|
if (command.schema) {
|
|
1249
1283
|
const validation = await validateStructuredOutputValue(command.schema, value);
|
|
1250
|
-
if (validation.status === "invalid")
|
|
1251
|
-
|
|
1284
|
+
if (validation.status === "invalid") {
|
|
1285
|
+
const redactedValidation = await validateStructuredOutputValue(command.schema, redactedValue);
|
|
1286
|
+
return fail(`output: "json" stdout does not match gate.schema${redactedValidation.status === "invalid" ? `: ${redactedValidation.message}` : "."}`);
|
|
1287
|
+
}
|
|
1252
1288
|
}
|
|
1253
|
-
run.structuredOutput =
|
|
1289
|
+
run.structuredOutput = redactedValue;
|
|
1254
1290
|
}
|
|
1255
1291
|
/** The first typed verify result on a ledger, if any command produced one. */
|
|
1256
1292
|
export function typedVerifyOutput(ledger) {
|
|
@@ -1258,6 +1294,13 @@ export function typedVerifyOutput(ledger) {
|
|
|
1258
1294
|
return run ? { value: run.structuredOutput } : undefined;
|
|
1259
1295
|
}
|
|
1260
1296
|
async function runMemoizedVerifyCommand(command, defaultCwd, options = {}) {
|
|
1297
|
+
// Typed gates read inputs (a report file, a log) that can change without
|
|
1298
|
+
// the tracked tree changing, so their verdicts are never reused.
|
|
1299
|
+
if (command.output === "json") {
|
|
1300
|
+
const { run, rawStdout } = await runVerifyCommand(command, defaultCwd, options);
|
|
1301
|
+
await applyTypedVerifyOutput(command, run, rawStdout);
|
|
1302
|
+
return run;
|
|
1303
|
+
}
|
|
1261
1304
|
const cwd = command.cwd ? path.resolve(defaultCwd, command.cwd) : defaultCwd;
|
|
1262
1305
|
let workspaceState;
|
|
1263
1306
|
try {
|
|
@@ -1266,10 +1309,8 @@ async function runMemoizedVerifyCommand(command, defaultCwd, options = {}) {
|
|
|
1266
1309
|
catch {
|
|
1267
1310
|
workspaceState = undefined;
|
|
1268
1311
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
if (!workspaceState || !options.artifactsDir || !options.runId || command.output === "json") {
|
|
1272
|
-
return runVerifyCommand(command, defaultCwd, options);
|
|
1312
|
+
if (!workspaceState || !options.artifactsDir || !options.runId) {
|
|
1313
|
+
return (await runVerifyCommand(command, defaultCwd, options)).run;
|
|
1273
1314
|
}
|
|
1274
1315
|
const envKeys = Object.keys(command.env ?? {}).sort();
|
|
1275
1316
|
const envHash = hash(JSON.stringify(Object.fromEntries(Object.entries(effectiveVerifyEnv(command.env)).sort(([left], [right]) => left.localeCompare(right)))));
|
|
@@ -1295,7 +1336,7 @@ async function runMemoizedVerifyCommand(command, defaultCwd, options = {}) {
|
|
|
1295
1336
|
catch {
|
|
1296
1337
|
// A cache miss or unreadable artifact must not prevent host verification.
|
|
1297
1338
|
}
|
|
1298
|
-
const result = await runVerifyCommand(command, defaultCwd, options);
|
|
1339
|
+
const { run: result } = await runVerifyCommand(command, defaultCwd, options);
|
|
1299
1340
|
const evidenced = { ...result, artifactPath, cacheKey, memoized: false, envKeys, envHash, workspaceState };
|
|
1300
1341
|
try {
|
|
1301
1342
|
fs.mkdirSync(path.dirname(artifactPath), { recursive: true });
|
|
@@ -1363,6 +1404,7 @@ export function quoteExecutableForShell(command, platform = process.platform) {
|
|
|
1363
1404
|
}
|
|
1364
1405
|
return command;
|
|
1365
1406
|
}
|
|
1407
|
+
/** `rawStdout` is unredacted and never stored; only typed output parsing reads it. */
|
|
1366
1408
|
function runVerifyCommand(command, defaultCwd, options = {}) {
|
|
1367
1409
|
return new Promise((resolve) => {
|
|
1368
1410
|
const startedAt = Date.now();
|
|
@@ -1388,11 +1430,14 @@ function runVerifyCommand(command, defaultCwd, options = {}) {
|
|
|
1388
1430
|
clearTimeout(hardKill);
|
|
1389
1431
|
options.signal?.removeEventListener("abort", abortVerification);
|
|
1390
1432
|
resolve({
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1433
|
+
run: {
|
|
1434
|
+
id: command.id,
|
|
1435
|
+
command: command.command,
|
|
1436
|
+
cwd,
|
|
1437
|
+
durationMs: Date.now() - startedAt,
|
|
1438
|
+
...result,
|
|
1439
|
+
},
|
|
1440
|
+
rawStdout: stdout,
|
|
1396
1441
|
});
|
|
1397
1442
|
};
|
|
1398
1443
|
const abortVerification = () => {
|
|
@@ -1531,8 +1576,6 @@ export async function evaluateAcceptance(input) {
|
|
|
1531
1576
|
artifactsDir: input.artifactsDir,
|
|
1532
1577
|
runId: input.runId,
|
|
1533
1578
|
});
|
|
1534
|
-
if (command.output === "json")
|
|
1535
|
-
await applyTypedVerifyOutput(command, run);
|
|
1536
1579
|
ledger.verifyRuns.push(run);
|
|
1537
1580
|
if (input.signal?.aborted)
|
|
1538
1581
|
break;
|
|
@@ -122,9 +122,9 @@ export interface ChildSession {
|
|
|
122
122
|
};
|
|
123
123
|
/** Event-updated pane-native status; reading it performs no network work. */
|
|
124
124
|
readonly placementSnapshot?: unknown;
|
|
125
|
-
/** Set by the foreground host once the run detached;
|
|
125
|
+
/** Set by the foreground host once the run detached; factory disposal leaves such children running. */
|
|
126
126
|
detached?: boolean;
|
|
127
|
-
/** Set by
|
|
127
|
+
/** Set by factory disposal before it aborts the child, so the host can report the stop truthfully. */
|
|
128
128
|
shutDown?: boolean;
|
|
129
129
|
}
|
|
130
130
|
export declare function childSessionHasQueuedMessages(session: ChildSession | undefined): boolean;
|
|
@@ -132,6 +132,8 @@ export interface ChildSessionFactory {
|
|
|
132
132
|
create(launch: ChildSessionLaunch): Promise<ChildSession>;
|
|
133
133
|
/** Abort and dispose every live attached child; detached children keep running and hold the shared runtime. */
|
|
134
134
|
dispose(): Promise<void>;
|
|
135
|
+
/** `dispose()` for only the children `parentSessionFile`'s session launched (undefined: sessions without a file); pi-web shuts sessions down one at a time. */
|
|
136
|
+
disposeForParent(parentSessionFile: string | undefined): Promise<void>;
|
|
135
137
|
}
|
|
136
138
|
export type PiCodingAgentModule = typeof import("@earendil-works/pi-coding-agent");
|
|
137
139
|
export interface DefaultChildSessionFactoryOptions {
|
|
@@ -175,6 +177,5 @@ export declare function setChildSessionFactory(factory: ChildSessionFactory | un
|
|
|
175
177
|
*/
|
|
176
178
|
export declare function childSessionFactoryModule(): string | undefined;
|
|
177
179
|
export declare function setChildSessionFactoryModule(modulePath: string | undefined): void;
|
|
178
|
-
|
|
179
|
-
export declare function disposeChildSessions(): Promise<void>;
|
|
180
|
+
export declare function disposeChildSessionsForParent(parentSessionFile: string | undefined): Promise<void>;
|
|
180
181
|
export {};
|
|
@@ -387,12 +387,15 @@ export function createDefaultChildSessionFactory(options = {}) {
|
|
|
387
387
|
const loadPiCodingAgent = options.loadPiCodingAgent ?? loadHostPiCodingAgent;
|
|
388
388
|
const shutdownTimeoutMs = options.shutdownTimeoutMs ?? 5_000;
|
|
389
389
|
let runtime;
|
|
390
|
-
const live = new
|
|
390
|
+
const live = new Map();
|
|
391
391
|
/** Extension shutdowns still running for disposed children; `dispose()` waits for them. */
|
|
392
392
|
const shutdowns = new Set();
|
|
393
393
|
/** Launches still waiting for their MCP tools; `dispose()` ends the wait and waits for their shutdown. */
|
|
394
394
|
const mcpWaits = new Map();
|
|
395
|
-
let
|
|
395
|
+
let globalDisposals = 0;
|
|
396
|
+
/** Per-parent disposal epochs: a child's launch aborts only when its own parent's scope (or the whole process) was disposed while it started. */
|
|
397
|
+
const parentDisposals = new Map();
|
|
398
|
+
const parentDisposalEpoch = (parent) => parentDisposals.get(parent) ?? 0;
|
|
396
399
|
const sharedRuntime = async (pi) => {
|
|
397
400
|
runtime ??= pi.ModelRuntime.create().catch((error) => {
|
|
398
401
|
runtime = undefined;
|
|
@@ -400,9 +403,32 @@ export function createDefaultChildSessionFactory(options = {}) {
|
|
|
400
403
|
});
|
|
401
404
|
return runtime;
|
|
402
405
|
};
|
|
406
|
+
const disposeMatching = async (matches) => {
|
|
407
|
+
for (const [cancel, wait] of mcpWaits)
|
|
408
|
+
if (matches(wait.parent))
|
|
409
|
+
cancel.abort();
|
|
410
|
+
const children = [...live.keys()].filter((child) => !child.detached && matches(live.get(child)));
|
|
411
|
+
for (const child of children)
|
|
412
|
+
child.shutDown = true;
|
|
413
|
+
await Promise.allSettled(children.map((child) => child.abort()));
|
|
414
|
+
for (const child of children) {
|
|
415
|
+
try {
|
|
416
|
+
void child.dispose();
|
|
417
|
+
}
|
|
418
|
+
catch { /* best effort */ }
|
|
419
|
+
}
|
|
420
|
+
await Promise.allSettled([
|
|
421
|
+
...shutdowns,
|
|
422
|
+
...[...mcpWaits.values()].filter((wait) => matches(wait.parent)).map((wait) => wait.ready),
|
|
423
|
+
]);
|
|
424
|
+
if (live.size === 0)
|
|
425
|
+
runtime = undefined;
|
|
426
|
+
};
|
|
403
427
|
return {
|
|
404
428
|
async create(launch) {
|
|
405
|
-
const
|
|
429
|
+
const globalDisposalsAtStart = globalDisposals;
|
|
430
|
+
const parentEpochAtStart = parentDisposalEpoch(launch.parentSessionFile);
|
|
431
|
+
const disposedSinceStart = () => globalDisposals !== globalDisposalsAtStart || parentDisposalEpoch(launch.parentSessionFile) !== parentEpochAtStart;
|
|
406
432
|
const pi = await loadPiCodingAgent();
|
|
407
433
|
const builtinMcpTools = launch.builtinMcpTools ?? [];
|
|
408
434
|
let readinessTool;
|
|
@@ -603,12 +629,12 @@ export function createDefaultChildSessionFactory(options = {}) {
|
|
|
603
629
|
if (builtinMcp) {
|
|
604
630
|
const cancel = new AbortController();
|
|
605
631
|
const signal = launch.signal ? AbortSignal.any([cancel.signal, launch.signal]) : cancel.signal;
|
|
606
|
-
if (
|
|
632
|
+
if (disposedSinceStart())
|
|
607
633
|
cancel.abort();
|
|
608
634
|
const ready = (async () => {
|
|
609
635
|
try {
|
|
610
636
|
await builtinMcp.waitForTools(signal, () => loader.getExtensions().errors.find(({ path }) => path === "builtin:mcp")?.error);
|
|
611
|
-
if (
|
|
637
|
+
if (disposedSinceStart())
|
|
612
638
|
throw new Error("The child session factory was disposed while the child waited for its MCP tools.");
|
|
613
639
|
if (signal.aborted)
|
|
614
640
|
throw new Error("The child launch was cancelled while waiting for its MCP tools.");
|
|
@@ -621,7 +647,7 @@ export function createDefaultChildSessionFactory(options = {}) {
|
|
|
621
647
|
throw error;
|
|
622
648
|
}
|
|
623
649
|
})();
|
|
624
|
-
mcpWaits.set(cancel, ready);
|
|
650
|
+
mcpWaits.set(cancel, { ready, parent: launch.parentSessionFile });
|
|
625
651
|
try {
|
|
626
652
|
await ready;
|
|
627
653
|
}
|
|
@@ -656,26 +682,16 @@ export function createDefaultChildSessionFactory(options = {}) {
|
|
|
656
682
|
get virtualModelId() { return session.model?.api === "pi-virtual" ? `${session.model.provider}/${session.model.id}` : undefined; },
|
|
657
683
|
get contextWindow() { return session.model?.contextWindow; },
|
|
658
684
|
};
|
|
659
|
-
live.
|
|
685
|
+
live.set(child, launch.parentSessionFile);
|
|
660
686
|
return child;
|
|
661
687
|
},
|
|
662
688
|
async dispose() {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
await Promise.allSettled(children.map((child) => child.abort()));
|
|
670
|
-
for (const child of children) {
|
|
671
|
-
try {
|
|
672
|
-
void child.dispose();
|
|
673
|
-
}
|
|
674
|
-
catch { /* best effort */ }
|
|
675
|
-
}
|
|
676
|
-
await Promise.allSettled([...shutdowns, ...mcpWaits.values()]);
|
|
677
|
-
if (live.size === 0)
|
|
678
|
-
runtime = undefined;
|
|
689
|
+
globalDisposals += 1;
|
|
690
|
+
await disposeMatching(() => true);
|
|
691
|
+
},
|
|
692
|
+
async disposeForParent(parentSessionFile) {
|
|
693
|
+
parentDisposals.set(parentSessionFile, parentDisposalEpoch(parentSessionFile) + 1);
|
|
694
|
+
await disposeMatching((parent) => parent === parentSessionFile);
|
|
679
695
|
},
|
|
680
696
|
};
|
|
681
697
|
}
|
|
@@ -691,10 +707,8 @@ function createLazyPlacementFactory(local) {
|
|
|
691
707
|
const factory = async () => placed ??= (await import("./herdr-placed-run.js")).createPlacementAwareChildSessionFactory(local);
|
|
692
708
|
return {
|
|
693
709
|
async create(launch) { return launch.machine ? (await factory()).create(launch) : local.create(launch); },
|
|
694
|
-
async dispose() {
|
|
695
|
-
|
|
696
|
-
else
|
|
697
|
-
await local.dispose(); },
|
|
710
|
+
async dispose() { await (placed ?? local).dispose(); },
|
|
711
|
+
async disposeForParent(parentSessionFile) { await (placed ?? local).disposeForParent(parentSessionFile); },
|
|
698
712
|
};
|
|
699
713
|
}
|
|
700
714
|
/** Default factory including pane-native placement; detached runners use the same boundary. */
|
|
@@ -719,10 +733,6 @@ export function childSessionFactoryModule() {
|
|
|
719
733
|
export function setChildSessionFactoryModule(modulePath) {
|
|
720
734
|
activeFactoryModule = modulePath;
|
|
721
735
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
const factory = activeFactory;
|
|
725
|
-
if (!factory)
|
|
726
|
-
return;
|
|
727
|
-
await factory.dispose();
|
|
736
|
+
export async function disposeChildSessionsForParent(parentSessionFile) {
|
|
737
|
+
await activeFactory?.disposeForParent(parentSessionFile);
|
|
728
738
|
}
|
|
@@ -12,6 +12,55 @@ export declare function validateCodeOwnedProfileRunner(agent: {
|
|
|
12
12
|
adapter?: string;
|
|
13
13
|
};
|
|
14
14
|
}): string | undefined;
|
|
15
|
+
export declare const EXTERNAL_CLI_ADAPTER_SAFETY: {
|
|
16
|
+
readonly "codex-exec": {
|
|
17
|
+
readonly sandbox: "read-only";
|
|
18
|
+
readonly approvalPolicy: "never";
|
|
19
|
+
readonly ephemeral: true;
|
|
20
|
+
};
|
|
21
|
+
readonly "codex-exec-writer": {
|
|
22
|
+
readonly access: "workspace-write";
|
|
23
|
+
readonly sandbox: "workspace-write";
|
|
24
|
+
readonly approvalPolicy: "never";
|
|
25
|
+
readonly ephemeral: true;
|
|
26
|
+
};
|
|
27
|
+
readonly "claude-code": {
|
|
28
|
+
readonly access: "read-only";
|
|
29
|
+
readonly authentication: "existing-cli-required";
|
|
30
|
+
readonly permissionMode: "plan";
|
|
31
|
+
readonly tools: "none";
|
|
32
|
+
readonly mcp: "empty-strict";
|
|
33
|
+
readonly settingSources: "user";
|
|
34
|
+
readonly userSettingsTrust: "required";
|
|
35
|
+
readonly sessionPersistence: false;
|
|
36
|
+
};
|
|
37
|
+
readonly "claude-code-writer": {
|
|
38
|
+
readonly access: "workspace-write";
|
|
39
|
+
readonly authentication: "existing-cli-required";
|
|
40
|
+
readonly permissionMode: "acceptEdits";
|
|
41
|
+
readonly tools: "Read,Write,Edit,Glob,Grep";
|
|
42
|
+
readonly mcp: "empty-strict";
|
|
43
|
+
readonly settingSources: "user";
|
|
44
|
+
readonly userSettingsTrust: "required";
|
|
45
|
+
readonly sessionPersistence: false;
|
|
46
|
+
};
|
|
47
|
+
readonly "cursor-agent": {
|
|
48
|
+
readonly access: "read-only";
|
|
49
|
+
readonly authentication: "cursor-api-key-or-existing-login";
|
|
50
|
+
readonly mode: "ask";
|
|
51
|
+
readonly sandbox: "enabled";
|
|
52
|
+
readonly workspaceTrust: "existing-required";
|
|
53
|
+
readonly sessionReuse: false;
|
|
54
|
+
};
|
|
55
|
+
readonly "cursor-agent-writer": {
|
|
56
|
+
readonly access: "workspace-write";
|
|
57
|
+
readonly authentication: "cursor-api-key-or-existing-login";
|
|
58
|
+
readonly mode: "print";
|
|
59
|
+
readonly sandbox: "enabled";
|
|
60
|
+
readonly workspaceTrust: "existing-required";
|
|
61
|
+
readonly sessionReuse: false;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
15
64
|
export declare function parseExternalCliCapabilityNarrowing(value: unknown, label: string): ExternalCliCapabilityNarrowing | undefined;
|
|
16
65
|
export declare function resolveExternalCliRunnerStatus(input: {
|
|
17
66
|
adapter?: CodeOwnedExternalCliAdapterId;
|