@xzzpig/pi-subagents 0.7.0 → 0.8.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 +13 -4
- package/README.md +1 -1
- package/agents/reviewer.md +12 -2
- package/docs/agents.md +4 -4
- package/docs/configuration.md +6 -6
- package/docs/extension-api.md +14 -4
- package/docs/models.md +47 -6
- package/docs/observability.md +14 -3
- package/docs/tool-reference.md +21 -6
- package/docs/workflows.md +7 -1
- package/index.ts +10 -1
- package/package.json +3 -3
- package/prompts/council.md +19 -7
- package/prompts/parallel-review.md +5 -1
- package/prompts/review-loop.md +9 -5
- package/skills/council-mode/SKILL.md +50 -26
- package/skills/pi-subagents/SKILL.md +5 -1
- package/skills/pi-subagents/references/constraints-and-recipes.md +16 -1
- package/skills/pi-subagents/references/execution-controls.md +13 -4
- package/skills/pi-subagents/references/multi-lane-orchestration.md +3 -3
- package/skills/pi-subagents/references/prompting-and-roles.md +14 -7
- package/src/agents/agent-management.ts +115 -14
- package/src/agents/agent-serializer.ts +4 -2
- package/src/agents/agents.ts +226 -48
- package/src/api/external-job-provider.ts +10 -1
- package/src/api/preflight.ts +52 -19
- package/src/api/project-panes.ts +2 -0
- package/src/extension/doctor.ts +10 -0
- package/src/extension/fanout-child.ts +3 -2
- package/src/extension/index.ts +24 -4
- package/src/extension/public-execution.ts +12 -9
- package/src/extension/rpc.ts +77 -3
- package/src/extension/schemas.ts +7 -1
- package/src/extension/tool-description.ts +9 -6
- package/src/extension/tool-result.ts +19 -0
- package/src/inspectors/herdr/client.ts +3 -3
- package/src/inspectors/herdr/focus.ts +55 -0
- package/src/inspectors/herdr/project-panes.ts +228 -44
- package/src/integrations/herdr-status.ts +26 -4
- package/src/runs/background/async-execution.ts +146 -17
- package/src/runs/background/async-job-tracker.ts +33 -14
- package/src/runs/background/async-resume.ts +23 -2
- package/src/runs/background/async-retention.ts +1 -1
- package/src/runs/background/async-status.ts +10 -0
- package/src/runs/background/chain-root-attachment.ts +5 -0
- package/src/runs/background/control-channel.ts +98 -10
- package/src/runs/background/notify.ts +62 -1
- package/src/runs/background/result-watcher.ts +4 -3
- package/src/runs/background/run-status.ts +15 -1
- package/src/runs/background/stale-run-reconciler.ts +3 -0
- package/src/runs/background/subagent-runner.ts +333 -48
- package/src/runs/background/wait-completions.ts +2 -0
- package/src/runs/background/wait-tool.ts +4 -3
- package/src/runs/foreground/async-stop-action.ts +23 -2
- package/src/runs/foreground/execution.ts +148 -13
- package/src/runs/foreground/foreground-history.ts +3 -2
- package/src/runs/foreground/subagent-executor.ts +417 -50
- package/src/runs/foreground/workflow-detach-reconcile.ts +18 -6
- package/src/runs/shared/acceptance.ts +11 -5
- package/src/runs/shared/agent-contract.ts +1 -1
- package/src/runs/shared/child-identity.ts +36 -0
- package/src/runs/shared/completion-guard.ts +52 -2
- package/src/runs/shared/dynamic-fanout.ts +1 -1
- package/src/runs/shared/extension-bindings.ts +78 -0
- package/src/runs/shared/external-cli-runner.ts +2 -0
- package/src/runs/shared/external-job-bridge.ts +53 -37
- package/src/runs/shared/external-job-runner.ts +126 -23
- package/src/runs/shared/fast-mode-extension.ts +10 -0
- package/src/runs/shared/model-exclusions.ts +2 -1
- package/src/runs/shared/model-fallback.ts +48 -22
- package/src/runs/shared/model-scope.ts +106 -39
- package/src/runs/shared/mutation-evidence.ts +145 -0
- package/src/runs/shared/orca-progress-tabs.ts +71 -9
- package/src/runs/shared/parallel-utils.ts +15 -0
- package/src/runs/shared/pi-args.ts +78 -1
- package/src/runs/shared/structured-output.ts +18 -4
- package/src/runs/shared/subagent-prompt-runtime.ts +48 -15
- package/src/runs/shared/tool-availability.ts +1 -3
- package/src/shared/launch-contract.ts +12 -5
- package/src/shared/settings.ts +6 -1
- package/src/shared/thinking-ceiling.ts +52 -0
- package/src/shared/types.ts +120 -5
- package/src/tui/fleet-status.ts +66 -13
- package/src/tui/render.ts +5 -4
- package/src/watchdog/permission-arbiter.ts +59 -52
- package/src/workflows/scripted-workflow.ts +156 -12
|
@@ -9,7 +9,7 @@ const MAX_FAILURE_MESSAGE_LENGTH = 4_096;
|
|
|
9
9
|
const MAX_URL_LENGTH = 4_096;
|
|
10
10
|
|
|
11
11
|
export type ExternalJobState = "queued" | "running" | "completed" | "failed" | "stopped" | "blocked";
|
|
12
|
-
export type ExternalJobOperation = "start" | "status" | "result" | "reattach";
|
|
12
|
+
export type ExternalJobOperation = "start" | "follow-up" | "status" | "result" | "reattach";
|
|
13
13
|
|
|
14
14
|
export type ExternalJobOptions = Record<string, unknown>;
|
|
15
15
|
|
|
@@ -24,6 +24,14 @@ export interface ExternalJobStartInput {
|
|
|
24
24
|
sessionId?: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
export interface ExternalJobFollowUpInput extends ExternalJobStartInput {
|
|
28
|
+
sourceRunId: string;
|
|
29
|
+
sourceStepIndex: number;
|
|
30
|
+
parentProviderJobId: string;
|
|
31
|
+
requestId: string;
|
|
32
|
+
requestDigest: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
export interface ExternalJobHandle {
|
|
28
36
|
providerJobId: string;
|
|
29
37
|
state: ExternalJobState;
|
|
@@ -42,6 +50,7 @@ export interface ExternalJobResult extends ExternalJobHandle {
|
|
|
42
50
|
export interface ExternalJobProvider {
|
|
43
51
|
name: string;
|
|
44
52
|
start(input: ExternalJobStartInput): Promise<ExternalJobHandle> | ExternalJobHandle;
|
|
53
|
+
followUp?(input: ExternalJobFollowUpInput): Promise<ExternalJobHandle> | ExternalJobHandle;
|
|
45
54
|
status(providerJobId: string): Promise<ExternalJobHandle> | ExternalJobHandle;
|
|
46
55
|
result(providerJobId: string): Promise<ExternalJobResult> | ExternalJobResult;
|
|
47
56
|
reattach(providerJobId: string): Promise<ExternalJobHandle> | ExternalJobHandle;
|
package/src/api/preflight.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import * as fs from "node:fs";
|
|
3
2
|
import * as path from "node:path";
|
|
4
3
|
import { fileURLToPath } from "node:url";
|
|
@@ -7,23 +6,27 @@ import { resolveExecutionAgentScope } from "../agents/agent-scope.ts";
|
|
|
7
6
|
import { buildSkillInjection, normalizeSkillInput, resolveSkillsWithFallback } from "../agents/skills.ts";
|
|
8
7
|
import { buildAgentMemoryInjection } from "../agents/agent-memory.ts";
|
|
9
8
|
import { buildModelCandidates, inheritsParentModel, resolveEffectiveSubagentModel, type AvailableModelInfo, type ParentModel } from "../runs/shared/model-fallback.ts";
|
|
9
|
+
import { resolveModelScopesForAgent } from "../runs/shared/model-scope.ts";
|
|
10
10
|
import { applyThinkingSuffix, resolvePiLaunchToolPlan, type PiLaunchToolPlan } from "../runs/shared/pi-args.ts";
|
|
11
11
|
import { injectOutputPathSystemPrompt, normalizeSingleOutputOverride, resolveSingleOutputPath } from "../runs/shared/single-output.ts";
|
|
12
12
|
import { getArtifactPaths, getArtifactsDir } from "../shared/artifacts.ts";
|
|
13
13
|
import { resolveEffectiveThinking } from "../shared/model-info.ts";
|
|
14
|
+
import { assertThinkingWithinCeiling, decodeThinkingCeiling, intersectThinkingCeilings, SUBAGENT_THINKING_CEILING_ENV, type ThinkingLevel } from "../shared/thinking-ceiling.ts";
|
|
14
15
|
import { SUBAGENT_LIFECYCLE_ARTIFACT_VERSION, type ArtifactDirPreference, type ArtifactPaths, type JsonSchemaObject, type OutputMode } from "../shared/types.ts";
|
|
15
16
|
import { capabilityCeilingAgentRestrictionMessage, intersectSubagentCapabilityCeilings, type ResolvedSubagentCapabilityCeiling, type SubagentCapabilityAudit } from "../runs/shared/capability-ceiling.ts";
|
|
16
17
|
import { appendTurnBudgetSystemPrompt } from "../runs/shared/turn-budget.ts";
|
|
18
|
+
import { resolvePermissionRules } from "../runs/shared/permissions.ts";
|
|
17
19
|
import type { ResolvedTurnBudget } from "../shared/types.ts";
|
|
18
20
|
import type { ResolvedMcpDirectToolSelection } from "../runs/shared/mcp-direct-tool-allowlist.ts";
|
|
19
21
|
import { resolveStepBehavior } from "../shared/settings.ts";
|
|
20
22
|
import { canPreferForkFromSnapshot, resolveSubagentLaunchContext } from "../shared/fork-context.ts";
|
|
21
23
|
import { loadConfig } from "../extension/config.ts";
|
|
22
|
-
import { agentDefinitionDigest, AGENT_DEFINITION_PROJECTION_VERSION, launchBindingDigest } from "../shared/launch-contract.ts";
|
|
24
|
+
import { agentDefinitionDigest, AGENT_DEFINITION_PROJECTION_VERSION, launchBindingDigest, stableJsonDigest } from "../shared/launch-contract.ts";
|
|
23
25
|
import { DIRS, TEMP_ROOT_DIR } from "../shared/types.ts";
|
|
24
26
|
import { processTerminalCandidatePath, processTerminalPath } from "../runs/background/process-terminal.ts";
|
|
25
27
|
import { resultFilePath } from "../runs/background/result-files.ts";
|
|
26
28
|
import { nestedResultsPath } from "../runs/shared/nested-events.ts";
|
|
29
|
+
import { normalizeExtensionBindings, type ExtensionBindings } from "../runs/shared/extension-bindings.ts";
|
|
27
30
|
|
|
28
31
|
export const SUBAGENT_LAUNCH_CONTRACT_VERSION = 2 as const;
|
|
29
32
|
|
|
@@ -35,7 +38,9 @@ export type SubagentLaunchContractReasonCode =
|
|
|
35
38
|
| "invalid_artifact_dir"
|
|
36
39
|
| "invalid_cwd"
|
|
37
40
|
| "unsupported_mode"
|
|
38
|
-
| "restricted_agent"
|
|
41
|
+
| "restricted_agent"
|
|
42
|
+
| "thinking_ceiling"
|
|
43
|
+
| "invalid_extension_bindings";
|
|
39
44
|
|
|
40
45
|
export interface SubagentLaunchContractDiagnostic {
|
|
41
46
|
code: SubagentLaunchContractReasonCode | "host_required" | "snapshot_warning";
|
|
@@ -50,7 +55,10 @@ export interface SubagentLaunchContractInput {
|
|
|
50
55
|
agentScope?: AgentScope;
|
|
51
56
|
context?: "fresh" | "fork";
|
|
52
57
|
model?: string;
|
|
58
|
+
fast?: boolean;
|
|
53
59
|
thinking?: string | false;
|
|
60
|
+
thinkingCeiling?: ThinkingLevel;
|
|
61
|
+
inheritedThinkingCeiling?: ThinkingLevel;
|
|
54
62
|
parentModel?: ParentModel;
|
|
55
63
|
availableModels?: ReadonlyArray<AvailableModelInfo | { provider: string; id: string; fullId?: string; reasoning?: boolean }>;
|
|
56
64
|
preferredProvider?: string;
|
|
@@ -58,6 +66,7 @@ export interface SubagentLaunchContractInput {
|
|
|
58
66
|
output?: string | boolean;
|
|
59
67
|
outputMode?: OutputMode;
|
|
60
68
|
outputSchema?: JsonSchemaObject;
|
|
69
|
+
extensionBindings?: ExtensionBindings;
|
|
61
70
|
turnBudget?: ResolvedTurnBudget;
|
|
62
71
|
artifacts?: boolean;
|
|
63
72
|
artifactDir?: ArtifactDirPreference;
|
|
@@ -145,6 +154,7 @@ export interface SubagentLaunchContract {
|
|
|
145
154
|
model?: string;
|
|
146
155
|
modelCandidates: string[];
|
|
147
156
|
thinking?: string;
|
|
157
|
+
thinkingCeiling?: ThinkingLevel;
|
|
148
158
|
systemPromptMode: AgentConfig["systemPromptMode"];
|
|
149
159
|
inheritProjectContext: boolean;
|
|
150
160
|
inheritSkills: boolean;
|
|
@@ -178,20 +188,8 @@ function packageVersion(): string {
|
|
|
178
188
|
}
|
|
179
189
|
}
|
|
180
190
|
|
|
181
|
-
function stableJson(value: unknown): string {
|
|
182
|
-
if (Array.isArray(value)) return `[${value.map(stableJson).join(",")}]`;
|
|
183
|
-
if (value && typeof value === "object") {
|
|
184
|
-
return `{${Object.entries(value as Record<string, unknown>)
|
|
185
|
-
.filter(([, entry]) => entry !== undefined)
|
|
186
|
-
.sort(([a], [b]) => a.localeCompare(b))
|
|
187
|
-
.map(([key, entry]) => `${JSON.stringify(key)}:${stableJson(entry)}`)
|
|
188
|
-
.join(",")}}`;
|
|
189
|
-
}
|
|
190
|
-
return JSON.stringify(value);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
191
|
function digestContract(contract: Omit<SubagentLaunchContract, "digest">): string {
|
|
194
|
-
return
|
|
192
|
+
return stableJsonDigest(contract);
|
|
195
193
|
}
|
|
196
194
|
|
|
197
195
|
function normalizeAvailableModels(models: SubagentLaunchContractInput["availableModels"]): AvailableModelInfo[] {
|
|
@@ -260,6 +258,15 @@ export async function resolveSubagentLaunchContract(input: SubagentLaunchContrac
|
|
|
260
258
|
return { ok: false, code: "missing_agent", message: `Unknown agent: ${input.agent}`, diagnostics };
|
|
261
259
|
}
|
|
262
260
|
const agent = resolvedAgent.agent;
|
|
261
|
+
let extensionBindings: ExtensionBindings | undefined;
|
|
262
|
+
try {
|
|
263
|
+
extensionBindings = normalizeExtensionBindings(input.extensionBindings)?.value;
|
|
264
|
+
} catch (error) {
|
|
265
|
+
return { ok: false, code: "invalid_extension_bindings", message: error instanceof Error ? error.message : String(error), diagnostics };
|
|
266
|
+
}
|
|
267
|
+
if (extensionBindings !== undefined && (agent.runner?.type === "external-cli" || agent.runner?.type === "external-job")) {
|
|
268
|
+
return { ok: false, code: "unsupported_mode", message: `extensionBindings is not supported for runner.type='${agent.runner.type}'.`, diagnostics };
|
|
269
|
+
}
|
|
263
270
|
const context = resolveLaunchContractContext(input, agent);
|
|
264
271
|
if (context === "fork") {
|
|
265
272
|
diagnostics.push({ code: "host_required", severity: "host-required", message: "Exact fork session branching and fork-thinking downgrade checks require Pi host session and model-registry snapshots." });
|
|
@@ -291,20 +298,39 @@ export async function resolveSubagentLaunchContract(input: SubagentLaunchContrac
|
|
|
291
298
|
|
|
292
299
|
const externalRunner = agent.runner?.type === "external-cli" || agent.runner?.type === "external-job";
|
|
293
300
|
const availableModels = normalizeAvailableModels(input.availableModels);
|
|
294
|
-
const preferredProvider = input.preferredProvider ?? input.parentModel?.provider;
|
|
301
|
+
const preferredProvider = agent.modelProvider ?? input.preferredProvider ?? input.parentModel?.provider;
|
|
302
|
+
const modelScopes = resolveModelScopesForAgent(discovered.modelScope, agent.name, input.parentModel);
|
|
295
303
|
const primaryModel = externalRunner
|
|
296
304
|
? undefined
|
|
297
|
-
: resolveEffectiveSubagentModel(input.model, agent.model, input.parentModel, availableModels, preferredProvider, { scope:
|
|
305
|
+
: resolveEffectiveSubagentModel(input.model, agent.model, input.parentModel, availableModels, preferredProvider, { scope: modelScopes });
|
|
298
306
|
const effectiveThinkingConfig = input.thinking !== undefined ? input.thinking : agent.thinking;
|
|
307
|
+
const thinkingCeiling = externalRunner ? undefined : intersectThinkingCeilings(
|
|
308
|
+
discovered.maxThinking,
|
|
309
|
+
input.thinkingCeiling,
|
|
310
|
+
input.inheritedThinkingCeiling,
|
|
311
|
+
decodeThinkingCeiling(process.env[SUBAGENT_THINKING_CEILING_ENV]),
|
|
312
|
+
);
|
|
299
313
|
const model = externalRunner ? undefined : applyThinkingSuffix(primaryModel, effectiveThinkingConfig, input.thinking !== undefined);
|
|
300
314
|
const modelCandidates = externalRunner
|
|
301
315
|
? []
|
|
302
316
|
: buildModelCandidates(primaryModel, agent.fallbackModels, availableModels, preferredProvider, {
|
|
303
|
-
scope:
|
|
317
|
+
scope: modelScopes,
|
|
304
318
|
primaryModelFromParent: inheritsParentModel(input.model, agent.model, input.parentModel),
|
|
305
319
|
})
|
|
306
320
|
.map((candidate) => applyThinkingSuffix(candidate, effectiveThinkingConfig, input.thinking !== undefined) ?? candidate);
|
|
321
|
+
if (!externalRunner) {
|
|
322
|
+
try {
|
|
323
|
+
assertThinkingWithinCeiling({ model, configThinking: effectiveThinkingConfig, ceiling: thinkingCeiling, agent: agent.name, runId });
|
|
324
|
+
for (const candidate of modelCandidates) assertThinkingWithinCeiling({ model: candidate, configThinking: effectiveThinkingConfig, ceiling: thinkingCeiling, agent: agent.name, runId });
|
|
325
|
+
} catch (error) {
|
|
326
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
327
|
+
diagnostics.push({ code: "thinking_ceiling", severity: "error", message });
|
|
328
|
+
return { ok: false, code: "thinking_ceiling", message, diagnostics };
|
|
329
|
+
}
|
|
330
|
+
}
|
|
307
331
|
let toolPlan: PiLaunchToolPlan;
|
|
332
|
+
const permissionRules = resolvePermissionRules(loadConfig().permissions, agent.permissions);
|
|
333
|
+
const fast = input.fast ?? agent.fast;
|
|
308
334
|
try {
|
|
309
335
|
toolPlan = resolvePiLaunchToolPlan({
|
|
310
336
|
tools: agent.tools,
|
|
@@ -314,8 +340,12 @@ export async function resolveSubagentLaunchContract(input: SubagentLaunchContrac
|
|
|
314
340
|
cwd: effectiveCwd,
|
|
315
341
|
requireReadTool: resolvedSkills.resolved.length > 0,
|
|
316
342
|
structuredOutput: Boolean(input.outputSchema),
|
|
343
|
+
fast,
|
|
344
|
+
model,
|
|
345
|
+
modelCandidates,
|
|
317
346
|
capabilityCeiling: effectiveCapabilityCeiling,
|
|
318
347
|
agentName: agent.name,
|
|
348
|
+
permissionRules,
|
|
319
349
|
});
|
|
320
350
|
} catch (error) {
|
|
321
351
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -371,6 +401,7 @@ export async function resolveSubagentLaunchContract(input: SubagentLaunchContrac
|
|
|
371
401
|
...(model ? { model } : {}),
|
|
372
402
|
modelCandidates,
|
|
373
403
|
...(resolveEffectiveThinking(model, effectiveThinkingConfig) ? { thinking: resolveEffectiveThinking(model, effectiveThinkingConfig) } : {}),
|
|
404
|
+
...(thinkingCeiling ? { thinkingCeiling } : {}),
|
|
374
405
|
systemPromptMode: agent.systemPromptMode,
|
|
375
406
|
inheritProjectContext: agent.inheritProjectContext,
|
|
376
407
|
inheritSkills: agent.inheritSkills,
|
|
@@ -423,6 +454,7 @@ export async function resolveSubagentLaunchContract(input: SubagentLaunchContrac
|
|
|
423
454
|
definitionDigest,
|
|
424
455
|
...(model ? { model } : {}),
|
|
425
456
|
modelCandidates,
|
|
457
|
+
...(fast !== undefined ? { fast } : {}),
|
|
426
458
|
...(resolveEffectiveThinking(model, effectiveThinkingConfig) ? { thinking: resolveEffectiveThinking(model, effectiveThinkingConfig) } : {}),
|
|
427
459
|
systemPrompt: effectiveSystemPrompt,
|
|
428
460
|
systemPromptMode: agent.systemPromptMode,
|
|
@@ -435,6 +467,7 @@ export async function resolveSubagentLaunchContract(input: SubagentLaunchContrac
|
|
|
435
467
|
...(outputPath ? { outputPath } : {}),
|
|
436
468
|
outputMode: behavior.outputMode,
|
|
437
469
|
...(input.outputSchema ? { structuredOutputSchema: input.outputSchema } : {}),
|
|
470
|
+
...(extensionBindings ? { extensionBindings } : {}),
|
|
438
471
|
}),
|
|
439
472
|
};
|
|
440
473
|
return { ok: true, contract: { ...contractBase, digest: digestContract(contractBase) } };
|
package/src/api/project-panes.ts
CHANGED
|
@@ -10,6 +10,7 @@ export {
|
|
|
10
10
|
createProjectPaneManager,
|
|
11
11
|
openProjectPane,
|
|
12
12
|
getProjectPaneStatus,
|
|
13
|
+
focusProjectPane,
|
|
13
14
|
closeProjectPane,
|
|
14
15
|
readProjectPaneBinding,
|
|
15
16
|
projectPaneBindingPath,
|
|
@@ -21,6 +22,7 @@ export {
|
|
|
21
22
|
type CloseProjectPaneOptions,
|
|
22
23
|
type OpenProjectPaneData,
|
|
23
24
|
type ProjectPaneStatusData,
|
|
25
|
+
type FocusProjectPaneData,
|
|
24
26
|
type CloseProjectPaneData,
|
|
25
27
|
type ProjectPaneRuntime,
|
|
26
28
|
type ProjectPaneError,
|
package/src/extension/doctor.ts
CHANGED
|
@@ -235,6 +235,13 @@ function formatPermissionSystemSection(): string[] {
|
|
|
235
235
|
return lines;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
function formatWorkflowScriptSection(): string[] {
|
|
239
|
+
return [
|
|
240
|
+
"- helpers: runs.run, runs.all, runs.steer, runs.status, runs.ref/refs, emit, console",
|
|
241
|
+
"- recovery: if runs.all is missing, reload or update pi-subagents; await Promise.all([runs.run(...)]) is also supported",
|
|
242
|
+
];
|
|
243
|
+
}
|
|
244
|
+
|
|
238
245
|
export function buildDoctorReport(input: DoctorReportInput): string {
|
|
239
246
|
const paths = input.paths ?? defaultPaths();
|
|
240
247
|
const deps = { ...DEFAULT_DEPS, ...input.deps };
|
|
@@ -264,6 +271,9 @@ export function buildDoctorReport(input: DoctorReportInput): string {
|
|
|
264
271
|
"Active async capacity",
|
|
265
272
|
...formatActiveAsyncCapacitySection(input),
|
|
266
273
|
"",
|
|
274
|
+
"Workflow script",
|
|
275
|
+
...formatWorkflowScriptSection(),
|
|
276
|
+
"",
|
|
267
277
|
"Permission system",
|
|
268
278
|
...formatPermissionSystemSection(),
|
|
269
279
|
"",
|
|
@@ -11,6 +11,7 @@ import { readNestedControlRequests, resolveNestedRouteFromEnv, type NestedRoute,
|
|
|
11
11
|
import { deliverSubagentIntercomMessageEvent } from "../intercom/result-intercom.ts";
|
|
12
12
|
import { resolveSubagentIntercomTarget } from "../intercom/intercom-bridge.ts";
|
|
13
13
|
import { createSubagentParamsSchema } from "./schemas.ts";
|
|
14
|
+
import { finalizeToolResult } from "./tool-result.ts";
|
|
14
15
|
import { loadConfig, resolveAsyncByDefault } from "./config.ts";
|
|
15
16
|
import { type Details, type SubagentState } from "../shared/types.ts";
|
|
16
17
|
|
|
@@ -181,8 +182,8 @@ export default function registerFanoutChildSubagentExtension(pi: ExtensionAPI):
|
|
|
181
182
|
"Mutating management actions (create, update, delete, eject, disable, enable, reset, grant-spawn-budget) are blocked in this mode.",
|
|
182
183
|
].join("\n"),
|
|
183
184
|
parameters: params,
|
|
184
|
-
execute(id, params, signal, onUpdate, ctx) {
|
|
185
|
-
return executor.executePublic(id, params as SubagentParamsLike, signal ?? new AbortController().signal, onUpdate, ctx);
|
|
185
|
+
async execute(id, params, signal, onUpdate, ctx) {
|
|
186
|
+
return finalizeToolResult(await executor.executePublic(id, params as SubagentParamsLike, signal ?? new AbortController().signal, onUpdate, ctx));
|
|
186
187
|
},
|
|
187
188
|
};
|
|
188
189
|
|
package/src/extension/index.ts
CHANGED
|
@@ -44,6 +44,7 @@ import { registerMainWatchdog } from "../watchdog/register-main.ts";
|
|
|
44
44
|
import { registerSlashSubagentBridge } from "../slash/slash-bridge.ts";
|
|
45
45
|
import { createNativeSupervisorChannel } from "../intercom/native-supervisor-channel.ts";
|
|
46
46
|
import { registerHerdrStatusBridge, type HerdrStatusRun } from "../integrations/herdr-status.ts";
|
|
47
|
+
import { listHerdrProjectPaneRoots, restoreHerdrProjectPaneSnapshots } from "../inspectors/herdr/project-panes.ts";
|
|
47
48
|
import { registerSubagentRpcBridge } from "./rpc.ts";
|
|
48
49
|
import { clearSlashSnapshots, getSlashRenderableSnapshot, resolveSlashMessageDetails, restoreSlashFinalSnapshots, type SlashMessageDetails } from "../slash/slash-live-state.ts";
|
|
49
50
|
import { inspectSubagentStatus } from "../runs/background/run-status.ts";
|
|
@@ -59,6 +60,7 @@ import { formatDuration, shortenPath } from "../shared/formatters.ts";
|
|
|
59
60
|
import { loadConfig, resolveAsyncByDefault, resolveScheduledStoreRoot } from "./config.ts";
|
|
60
61
|
import { applyInjectionBlock, renderInjectionBlock, resolveInjectableAgents, SUBAGENT_INJECTION_MARKER } from "./context-injection.ts";
|
|
61
62
|
import { buildSubagentToolDescription, buildSubagentToolPromptMetadata } from "./tool-description.ts";
|
|
63
|
+
import { finalizeToolResult } from "./tool-result.ts";
|
|
62
64
|
import { collectGoalContinuationNotices } from "../missions/goal-driver.ts";
|
|
63
65
|
import { restoreForegroundRunHistory } from "../runs/foreground/foreground-history.ts";
|
|
64
66
|
import { resolveMissionStoreLocation } from "../missions/store.ts";
|
|
@@ -437,6 +439,7 @@ export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
|
437
439
|
grantHistory: [],
|
|
438
440
|
},
|
|
439
441
|
activeAsyncCapacity: { used: 0, limit: resolveMaxActiveAsyncRunsPerSession(config.maxActiveAsyncRunsPerSession) ?? 0 },
|
|
442
|
+
herdrProjectPanes: new Map(),
|
|
440
443
|
asyncJobs: new Map(),
|
|
441
444
|
fleetJobs: new Map(),
|
|
442
445
|
foregroundRuns: new Map(),
|
|
@@ -502,7 +505,12 @@ export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
|
502
505
|
...all.user,
|
|
503
506
|
...all.project,
|
|
504
507
|
];
|
|
505
|
-
|
|
508
|
+
const merged = mergeRuntimeAgents(pi, discovered, configuredAgents);
|
|
509
|
+
if (discovered.maxThinking === undefined) return merged;
|
|
510
|
+
return {
|
|
511
|
+
...merged,
|
|
512
|
+
agents: merged.agents.map((agent) => agent.maxThinking === discovered.maxThinking ? agent : { ...agent, maxThinking: discovered.maxThinking }),
|
|
513
|
+
};
|
|
506
514
|
};
|
|
507
515
|
const { ensurePoller, refreshWidget, handleStarted, handleComplete, resetJobs, restoreActiveJobs, dispose: disposeAsyncJobTracker } = createAsyncJobTracker(pi, state, DIRS.async, {
|
|
508
516
|
widgetEnabled: asyncWidgetEnabled,
|
|
@@ -519,7 +527,7 @@ export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
|
519
527
|
observedCompletionRunIds: () => scheduledRunManager.observedCompletionRunIds(),
|
|
520
528
|
hasDeliveryDemand: hasResultDeliveryDemand,
|
|
521
529
|
deliverIntercomResults: config.intercomBridge?.resultDelivery === true,
|
|
522
|
-
resultScanLogging: config.resultScanLogging
|
|
530
|
+
resultScanLogging: config.resultScanLogging,
|
|
523
531
|
},
|
|
524
532
|
);
|
|
525
533
|
const { startResultWatcher, primeExistingResults, stopResultWatcher } = resultWatcher;
|
|
@@ -601,6 +609,15 @@ export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
|
601
609
|
const expandKey = keyText("app.tools.expand");
|
|
602
610
|
text += `\n ${theme.fg("dim", `${expandKey} full notification`)}`;
|
|
603
611
|
}
|
|
612
|
+
if (details.workflowRunId) {
|
|
613
|
+
text += `\n ${theme.fg("muted", `workflow: ${details.workflowRunId}`)}`;
|
|
614
|
+
}
|
|
615
|
+
if (details.childRuns?.length) {
|
|
616
|
+
text += `\n ${theme.fg("muted", `children: ${details.childRuns.map((child) => `${child.workflowKey ?? child.agent ?? "child"}=${child.runId}`).join(", ")}`)}`;
|
|
617
|
+
}
|
|
618
|
+
if (details.reconciledFromDetachedChild) {
|
|
619
|
+
text += `\n ${theme.fg("muted", `reconciled child: ${details.reconciledFromDetachedChild}`)}`;
|
|
620
|
+
}
|
|
604
621
|
if (details.sessionLabel && details.sessionValue) {
|
|
605
622
|
text += `\n ${theme.fg("muted", `${details.sessionLabel}: ${shortenPath(details.sessionValue)}`)}`;
|
|
606
623
|
}
|
|
@@ -660,8 +677,8 @@ export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
|
660
677
|
...buildSubagentToolPromptMetadata(config),
|
|
661
678
|
parameters,
|
|
662
679
|
|
|
663
|
-
execute(id, params, signal, onUpdate, ctx) {
|
|
664
|
-
return executeSubagentCollapsed(id, params as SubagentParamsLike, signal ?? new AbortController().signal, onUpdate, ctx);
|
|
680
|
+
async execute(id, params, signal, onUpdate, ctx) {
|
|
681
|
+
return finalizeToolResult(await executeSubagentCollapsed(id, params as SubagentParamsLike, signal ?? new AbortController().signal, onUpdate, ctx));
|
|
665
682
|
},
|
|
666
683
|
|
|
667
684
|
renderCall(args, theme) {
|
|
@@ -733,6 +750,7 @@ export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
|
733
750
|
const herdrStatusBridge = registerHerdrStatusBridge({
|
|
734
751
|
events: pi.events,
|
|
735
752
|
getRuns: activeHerdrRuns,
|
|
753
|
+
getProjectPaneCount: () => [...(state.herdrProjectPanes?.values() ?? [])].filter((pane) => pane.state === "open").length,
|
|
736
754
|
async runHerdr(args) {
|
|
737
755
|
await pi.exec(process.env.HERDR_BIN || "herdr", [...args], { timeout: 5_000 });
|
|
738
756
|
},
|
|
@@ -841,6 +859,8 @@ export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
|
841
859
|
granted: 0,
|
|
842
860
|
grantHistory: [],
|
|
843
861
|
};
|
|
862
|
+
const projectPaneOwnerRoot = path.resolve(ctx.cwd);
|
|
863
|
+
restoreHerdrProjectPaneSnapshots(state, [...new Set([...(state.herdrProjectPanes?.keys() ?? []), ...listHerdrProjectPaneRoots(projectPaneOwnerRoot), projectPaneOwnerRoot])]);
|
|
844
864
|
// Set PI_SUBAGENT_PARENT_SESSION for permission-system forwarding.
|
|
845
865
|
// Only set in the root session (the interactive UI session), not in
|
|
846
866
|
// child subagent processes — children inherit the parent's value
|
|
@@ -17,6 +17,12 @@ export interface PublicSubagentExecutionParams {
|
|
|
17
17
|
output?: unknown;
|
|
18
18
|
resume?: unknown;
|
|
19
19
|
clarify?: unknown;
|
|
20
|
+
workflowParentRunId?: unknown;
|
|
21
|
+
workflowKey?: unknown;
|
|
22
|
+
workflowChildAsyncId?: unknown;
|
|
23
|
+
workflowAwaitAsync?: unknown;
|
|
24
|
+
workflowParentDeadlineAt?: unknown;
|
|
25
|
+
suppressRoutineResultIntercom?: unknown;
|
|
20
26
|
runFanoutBudget?: unknown;
|
|
21
27
|
runFanoutAdmitted?: unknown;
|
|
22
28
|
}
|
|
@@ -46,6 +52,9 @@ export function normalizePublicSubagentExecution<T extends PublicSubagentExecuti
|
|
|
46
52
|
if (params.runFanoutBudget !== undefined || params.runFanoutAdmitted !== undefined) {
|
|
47
53
|
return { ok: false, error: "Public execution does not accept internal run fan-out fields.", mode: params.workflowScript !== undefined ? "workflow" : "management" };
|
|
48
54
|
}
|
|
55
|
+
if (params.workflowParentRunId !== undefined || params.workflowKey !== undefined || params.workflowChildAsyncId !== undefined || params.workflowAwaitAsync !== undefined || params.workflowParentDeadlineAt !== undefined || params.suppressRoutineResultIntercom !== undefined) {
|
|
56
|
+
return { ok: false, error: "Public execution does not accept internal workflow child fields.", mode: params.workflowScript !== undefined ? "workflow" : "management" };
|
|
57
|
+
}
|
|
49
58
|
const action = params.action;
|
|
50
59
|
if (action !== undefined && (typeof action !== "string" || !action.trim())) {
|
|
51
60
|
return { ok: false, error: "action must be a non-empty management/control action, or omit action and use workflowScript.", mode: "management" };
|
|
@@ -111,18 +120,12 @@ export function normalizePublicSubagentExecution<T extends PublicSubagentExecuti
|
|
|
111
120
|
if (params.task !== undefined && typeof params.task !== "string") {
|
|
112
121
|
return { ok: false, error: "Structured single-child task must be a string when provided.", mode: "workflow" };
|
|
113
122
|
}
|
|
114
|
-
const { agent: _agent, task: _task, output, ...workflowDefaults } = params;
|
|
115
|
-
const child = {
|
|
116
|
-
agent: params.agent.trim(),
|
|
117
|
-
...(params.task !== undefined ? { task: params.task } : {}),
|
|
118
|
-
output: output === undefined ? true : output,
|
|
119
|
-
};
|
|
120
123
|
return {
|
|
121
124
|
ok: true,
|
|
122
125
|
params: {
|
|
123
|
-
...
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
...params,
|
|
127
|
+
agent: params.agent.trim(),
|
|
128
|
+
output: params.output === undefined ? true : params.output,
|
|
126
129
|
} as T,
|
|
127
130
|
};
|
|
128
131
|
}
|
package/src/extension/rpc.ts
CHANGED
|
@@ -13,14 +13,17 @@ import {
|
|
|
13
13
|
type SubagentState,
|
|
14
14
|
DIRS,
|
|
15
15
|
SUBAGENT_ASYNC_COMPLETE_EVENT,
|
|
16
|
+
SUBAGENT_CHILD_STATUS_EVENT,
|
|
16
17
|
SUBAGENT_PROCESS_TERMINAL_EVENT,
|
|
17
18
|
SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
|
|
19
|
+
type SubagentChildStatusEvent,
|
|
18
20
|
} from "../shared/types.ts";
|
|
19
21
|
import { sanitizeDisplayText, truncateDisplayText } from "../shared/display-text.ts";
|
|
20
22
|
import { readStatus } from "../shared/utils.ts";
|
|
21
23
|
import { SubagentParams } from "./schemas.ts";
|
|
22
24
|
import { normalizePublicSubagentExecution } from "./public-execution.ts";
|
|
23
25
|
import { ASYNC_STATUS_SNAPSHOT_KIND, ASYNC_STATUS_SNAPSHOT_VERSION, buildAsyncStatusSnapshotForState } from "../runs/background/async-status-snapshot.ts";
|
|
26
|
+
import { isStoppableAsyncStatusStep, resolveAsyncStatusChild, type ResolvedAsyncStatusChild } from "../runs/shared/child-identity.ts";
|
|
24
27
|
|
|
25
28
|
export const SUBAGENT_RPC_PROTOCOL_VERSION = 1;
|
|
26
29
|
export const SUBAGENT_RPC_REQUEST_EVENT = "subagents:rpc:v1:request";
|
|
@@ -405,6 +408,7 @@ function pingData(ctx: ExtensionContext | null) {
|
|
|
405
408
|
request: SUBAGENT_RPC_REQUEST_EVENT,
|
|
406
409
|
replyPrefix: SUBAGENT_RPC_REPLY_EVENT_PREFIX,
|
|
407
410
|
asyncComplete: SUBAGENT_ASYNC_COMPLETE_EVENT,
|
|
411
|
+
childStatus: SUBAGENT_CHILD_STATUS_EVENT,
|
|
408
412
|
processTerminal: SUBAGENT_PROCESS_TERMINAL_EVENT,
|
|
409
413
|
},
|
|
410
414
|
session: sessionData(ctx),
|
|
@@ -500,8 +504,14 @@ function stopAsyncRun(
|
|
|
500
504
|
params: unknown,
|
|
501
505
|
options: RegisterSubagentRpcBridgeOptions,
|
|
502
506
|
ctx: ExtensionContext,
|
|
503
|
-
): { runId: string; asyncDir: string; previousState: string; state: "stopping"; message: string } {
|
|
504
|
-
const
|
|
507
|
+
): { runId: string; asyncDir: string; previousState: string; state: "stopping"; message: string; childId?: string } {
|
|
508
|
+
const input = assertRecordParams(params, "stop");
|
|
509
|
+
const rawChildId = input.childId;
|
|
510
|
+
if (rawChildId !== undefined && (typeof rawChildId !== "string" || !rawChildId.trim() || /[\r\n]/.test(rawChildId) || rawChildId.length > 256)) {
|
|
511
|
+
throw new SubagentRpcError("invalid_params", "RPC stop childId must be a non-empty string without newlines and at most 256 characters.");
|
|
512
|
+
}
|
|
513
|
+
const childId = typeof rawChildId === "string" ? rawChildId : undefined;
|
|
514
|
+
const target = normalizeTargetParams(input, "stop");
|
|
505
515
|
assertSubagentParams({ action: "status", ...target }, "RPC stop target params");
|
|
506
516
|
const asyncDirRoot = options.asyncDirRoot ?? DIRS.async;
|
|
507
517
|
const resultsDir = options.resultsDir ?? DIRS.results;
|
|
@@ -523,7 +533,60 @@ function stopAsyncRun(
|
|
|
523
533
|
throw new SubagentRpcError("not_found", `Async run '${initialRunId}' was not found in the active session.`);
|
|
524
534
|
}
|
|
525
535
|
|
|
536
|
+
let child: ResolvedAsyncStatusChild | undefined;
|
|
537
|
+
const emitChildStopping = (runId: string, asyncDir: string, stoppedChild: ResolvedAsyncStatusChild, ts = options.now?.() ?? Date.now()): void => {
|
|
538
|
+
options.events.emit(SUBAGENT_CHILD_STATUS_EVENT, {
|
|
539
|
+
type: "subagent.child-status",
|
|
540
|
+
version: 1,
|
|
541
|
+
runId,
|
|
542
|
+
childId: stoppedChild.id,
|
|
543
|
+
status: "stopping",
|
|
544
|
+
ts,
|
|
545
|
+
reason: "user",
|
|
546
|
+
source: "rpc",
|
|
547
|
+
asyncDir,
|
|
548
|
+
stepIndex: stoppedChild.index,
|
|
549
|
+
agent: stoppedChild.step.agent,
|
|
550
|
+
...(stoppedChild.step.runId ? { childRunId: stoppedChild.step.runId } : {}),
|
|
551
|
+
...(stoppedChild.step.workflowKey ? { workflowKey: stoppedChild.step.workflowKey } : {}),
|
|
552
|
+
...(stoppedChild.step.phase ? { phase: stoppedChild.step.phase } : {}),
|
|
553
|
+
...(stoppedChild.step.label ? { label: stoppedChild.step.label } : {}),
|
|
554
|
+
} satisfies SubagentChildStatusEvent);
|
|
555
|
+
};
|
|
556
|
+
if (childId !== undefined) {
|
|
557
|
+
const resolution = resolveAsyncStatusChild(initialStatus, childId);
|
|
558
|
+
if (!resolution.ok) throw new SubagentRpcError(resolution.code === "not_found" ? "not_found" : "invalid_params", resolution.message);
|
|
559
|
+
child = resolution.child;
|
|
560
|
+
if (!isStoppableAsyncStatusStep(child.step)) {
|
|
561
|
+
throw new SubagentRpcError("invalid_state", `Child '${childId}' in async run '${initialRunId}' is ${child.step.status}; stop only supports pending or running children.`);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
526
564
|
if (initialStatus.mode === "workflow" && initialStatus.state === "running") {
|
|
565
|
+
if (child) {
|
|
566
|
+
const stopChild = options.state?.workflowChildStops?.get(initialRunId);
|
|
567
|
+
if (!stopChild) throw new SubagentRpcError("invalid_state", `Workflow ${initialRunId} is not controlled by this extension runtime; child stop is unavailable.`);
|
|
568
|
+
if (!stopChild(child.id, `Workflow child '${child.id}' stopped by RPC.`)) throw new SubagentRpcError("invalid_state", `Child '${childId}' in workflow ${initialRunId} is not available to stop.`);
|
|
569
|
+
emitChildStopping(initialRunId, location.asyncDir, child);
|
|
570
|
+
return {
|
|
571
|
+
runId: initialRunId,
|
|
572
|
+
asyncDir: location.asyncDir,
|
|
573
|
+
previousState: initialStatus.state,
|
|
574
|
+
state: "stopping",
|
|
575
|
+
childId: child.id,
|
|
576
|
+
message: `Stop requested for child ${child.id} in async run ${initialRunId}.`,
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
const workflowController = options.state?.workflowControllers?.get(initialRunId);
|
|
580
|
+
if (workflowController) {
|
|
581
|
+
workflowController.abort(new Error("Workflow stopped by RPC."));
|
|
582
|
+
return {
|
|
583
|
+
runId: initialRunId,
|
|
584
|
+
asyncDir: location.asyncDir,
|
|
585
|
+
previousState: initialStatus.state,
|
|
586
|
+
state: "stopping",
|
|
587
|
+
message: `Stop requested for async run ${initialRunId}.`,
|
|
588
|
+
};
|
|
589
|
+
}
|
|
527
590
|
throw new SubagentRpcError("invalid_state", `Workflow ${initialRunId} is not controlled by this extension runtime; reload recovery cannot stop it safely.`);
|
|
528
591
|
}
|
|
529
592
|
|
|
@@ -541,6 +604,14 @@ function stopAsyncRun(
|
|
|
541
604
|
if (status.state !== "running") {
|
|
542
605
|
throw new SubagentRpcError("invalid_state", `Async run ${runId} is ${status.state}; stop only supports running async runs.`);
|
|
543
606
|
}
|
|
607
|
+
if (childId !== undefined) {
|
|
608
|
+
const resolution = resolveAsyncStatusChild(status, childId);
|
|
609
|
+
if (!resolution.ok) throw new SubagentRpcError(resolution.code === "not_found" ? "not_found" : "invalid_params", resolution.message);
|
|
610
|
+
child = resolution.child;
|
|
611
|
+
if (!isStoppableAsyncStatusStep(child.step)) {
|
|
612
|
+
throw new SubagentRpcError("invalid_state", `Child '${childId}' in async run '${runId}' is ${child.step.status}; stop only supports pending or running children.`);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
544
615
|
|
|
545
616
|
try {
|
|
546
617
|
deliverStopRequest({
|
|
@@ -549,17 +620,20 @@ function stopAsyncRun(
|
|
|
549
620
|
kill: options.kill,
|
|
550
621
|
now: options.now,
|
|
551
622
|
source: "rpc-stop",
|
|
623
|
+
...(child ? { targetIndex: child.index, childId: child.id } : {}),
|
|
552
624
|
});
|
|
553
625
|
} catch (error) {
|
|
554
626
|
throw new SubagentRpcError("execution_failed", error instanceof Error ? error.message : String(error));
|
|
555
627
|
}
|
|
628
|
+
if (child) emitChildStopping(runId, location.asyncDir, child);
|
|
556
629
|
|
|
557
630
|
return {
|
|
558
631
|
runId,
|
|
559
632
|
asyncDir: location.asyncDir,
|
|
560
633
|
previousState: status.state,
|
|
561
634
|
state: "stopping",
|
|
562
|
-
|
|
635
|
+
...(child ? { childId: child.id } : {}),
|
|
636
|
+
message: child ? `Stop requested for child ${child.id} in async run ${runId}.` : `Stop requested for async run ${runId}.`,
|
|
563
637
|
};
|
|
564
638
|
}
|
|
565
639
|
|
package/src/extension/schemas.ts
CHANGED
|
@@ -145,6 +145,7 @@ export const ParallelTaskSchema = Type.Object({
|
|
|
145
145
|
progress: Type.Optional(Type.Boolean({ description: "Enable progress.md tracking in {chain_dir}" })),
|
|
146
146
|
skill: Type.Optional(SkillOverride),
|
|
147
147
|
model: Type.Optional(Type.String({ description: "Override model for this task" })),
|
|
148
|
+
fast: Type.Optional(Type.Boolean({ description: "Opt into priority service tier for supported native OpenAI-Codex child models. This can increase quota or cost." })),
|
|
148
149
|
toolBudget: Type.Optional(ToolBudgetOverride),
|
|
149
150
|
acceptance: Type.Optional(AcceptanceOverride),
|
|
150
151
|
agentContract: Type.Optional(AgentContractOverride),
|
|
@@ -175,6 +176,7 @@ export const DynamicParallelTemplateSchema = Type.Object({
|
|
|
175
176
|
progress: Type.Optional(Type.Boolean({ description: "Enable progress.md tracking in {chain_dir}" })),
|
|
176
177
|
skill: Type.Optional(SkillOverride),
|
|
177
178
|
model: Type.Optional(Type.String({ description: "Override model for this task" })),
|
|
179
|
+
fast: Type.Optional(Type.Boolean({ description: "Opt into priority service tier for supported native OpenAI-Codex child models. This can increase quota or cost." })),
|
|
178
180
|
toolBudget: Type.Optional(ToolBudgetOverride),
|
|
179
181
|
acceptance: Type.Optional(AcceptanceOverride),
|
|
180
182
|
agentContract: Type.Optional(AgentContractOverride),
|
|
@@ -203,6 +205,7 @@ export const ChainItem = Type.Object({
|
|
|
203
205
|
progress: Type.Optional(Type.Boolean({ description: "Enable progress.md tracking in {chain_dir}" })),
|
|
204
206
|
skill: Type.Optional(SkillOverride),
|
|
205
207
|
model: Type.Optional(Type.String({ description: "Override model for this step" })),
|
|
208
|
+
fast: Type.Optional(Type.Boolean({ description: "Opt into priority service tier for supported native OpenAI-Codex child models. This can increase quota or cost." })),
|
|
206
209
|
toolBudget: Type.Optional(ToolBudgetOverride),
|
|
207
210
|
acceptance: Type.Optional(AcceptanceOverride),
|
|
208
211
|
agentContract: Type.Optional(AgentContractOverride),
|
|
@@ -255,6 +258,7 @@ const ControlOverrides = Type.Object({
|
|
|
255
258
|
const SubagentParamProperties = {
|
|
256
259
|
agent: Type.Optional(Type.String({ description: "Agent for one-child execution, or target for agent management actions." })),
|
|
257
260
|
task: Type.Optional(Type.String({ description: "Optional one-child task. Requires agent; cannot combine with action or workflowScript." })),
|
|
261
|
+
extensionBindings: Type.Optional(Type.Unsafe({ type: "object", maxProperties: 16, additionalProperties: true, description: "Namespaced, bounded plain-JSON metadata delivered only to the child runtime. Namespace keys use package.name/1 syntax." })),
|
|
258
262
|
// Management action (when present, tool operates in management mode)
|
|
259
263
|
action: Type.Optional(Type.String({ minLength: 1,
|
|
260
264
|
description: "Optional management/control action. Omit this field for structured single-child or workflowScript execution; use it only for management/control actions."
|
|
@@ -271,6 +275,7 @@ const SubagentParamProperties = {
|
|
|
271
275
|
})),
|
|
272
276
|
handoffPath: Type.Optional(Type.String({ description: "worktree.discard manifest." })),
|
|
273
277
|
index: Type.Optional(Type.Integer({ minimum: 0, description: "Zero-based child index for actions that target a specific child or transcript." })),
|
|
278
|
+
childId: Type.Optional(Type.String({ minLength: 1, maxLength: 256, description: "Stable child identity for child-scoped stop requests." })),
|
|
274
279
|
view: Type.Optional(Type.String({
|
|
275
280
|
enum: ["fleet", "transcript"],
|
|
276
281
|
description: "Optional status view. Use view='fleet' for a read-only active foreground/async fleet surface, or view='transcript' with id/dir (and optional index) to tail a run transcript.",
|
|
@@ -307,7 +312,7 @@ const SubagentParamProperties = {
|
|
|
307
312
|
],
|
|
308
313
|
description: "Agent config for create/update. Object or JSON string."
|
|
309
314
|
})),
|
|
310
|
-
workflowScript: Type.Optional(Type.String({ minLength: 1, description: "Trusted inline JavaScript statement body. Normally async unless asyncByDefault:false; set async:true when async matters. Use async:false only when the parent must block until completion, never for reviews or gates. Use explicit return for output. Use top-level await, plain helper functions, or explicit Promise chains; nested async function, arrow, and method helpers are rejected. Use await runs.run(key, {agent, task, worktree?, gate?}) or runs.run(key, {resume, task}), where resume is a retained run id or {workflowRunId,key,latest:true} from a durable async workflow receipt. Use runs.all([...]), await runs.steer(key, message, {mode?, index?, ackTimeoutMs?}), runs.status(id), runs.ref(s), emit(value), console, and return. For ordinary parallel fanout, use await runs.all([{key, agent, task}, ...]);
|
|
315
|
+
workflowScript: Type.Optional(Type.String({ minLength: 1, description: "Trusted inline JavaScript statement body. Normally async unless asyncByDefault:false; set async:true when async matters. Use async:false only when the parent must block until completion, never for reviews or gates. Use explicit return for output. Use top-level await, plain helper functions, or explicit Promise chains; nested async function, arrow, and method helpers are rejected. Use await runs.run(key, {agent, task, worktree?, gate?}) or runs.run(key, {resume, task}), where resume is a retained run id or {workflowRunId,key,latest:true} from a durable async workflow receipt. Use runs.all([...]), await runs.steer(key, message, {mode?, index?, ackTimeoutMs?}), runs.status(id), runs.ref(s), emit(value), console, and return. For ordinary parallel fanout, use await runs.all([{key, agent, task}, ...]); it resolves to an ordered array, not a key map, so use results[0], destructuring, or results.map(...), not results.<key>. Do not read .output from unawaited runs.run launches. Stored runs.run promises are only for advanced rolling fanout, and each must later be observed with direct await, Promise.race, or Promise.all. runs.steer targets a prior stable child key, never a raw run id, and must be awaited or returned. Mission workflows also have async state.get(key) and state.set(key, JSONValue). Compose sequential and parallel phases dynamically. Set worktree:true at workflow or child level for a separate managed worktree; child fields override workflow defaults. gate is one host-run command and cannot be combined with acceptance. runs.run accepts one child only. No filesystem, shell, Pi tools, or host globals." })),
|
|
311
316
|
chatProgress: Type.Optional(Type.String({ enum: ["auto", "off", "live-card"], description: "WorkflowScript chat progress projection. auto shows a live in-chat card only for watched foreground workflows in the same Git repository; it is off otherwise. Explicit live-card requires same-repository async:false; async workflows should omit chatProgress or use auto/off." })),
|
|
312
317
|
isolation: Type.Optional(Type.String({ enum: ["none", "worktree"], description: "Workflow child isolation. none runs in the shared cwd; worktree requires managed git worktree isolation." })),
|
|
313
318
|
worktree: Type.Optional(Type.Boolean({ description: "Managed child isolation. true gives each workflow child a separate git worktree; an individual runs.run/runs.all item can override a workflow default with worktree:false." })),
|
|
@@ -342,6 +347,7 @@ const SubagentParamProperties = {
|
|
|
342
347
|
outputMode: Type.Optional(OutputModeOverride),
|
|
343
348
|
skill: Type.Optional(SkillOverride),
|
|
344
349
|
model: Type.Optional(Type.String({ description: "Default child model override. Full provider/id values are accepted; bare ids resolve from the active registry." })),
|
|
350
|
+
fast: Type.Optional(Type.Boolean({ description: "Opt into priority service tier for supported native OpenAI-Codex child models. Default false. This can increase quota or cost." })),
|
|
345
351
|
outputSchema: Type.Optional(JsonSchemaObject),
|
|
346
352
|
agentContract: Type.Optional(AgentContractOverride),
|
|
347
353
|
acceptance: Type.Optional(AcceptanceOverride),
|