@bastani/atomic 0.8.21 → 0.8.22
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 +66 -9
- package/dist/builtin/intercom/broker/broker.ts +3 -3
- package/dist/builtin/intercom/config.ts +3 -3
- package/dist/builtin/intercom/index.ts +1 -1
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/ui/compose.ts +2 -2
- package/dist/builtin/mcp/host-html-template.ts +0 -3
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +20 -4
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +9 -9
- package/dist/builtin/subagents/agents/debugger.md +6 -6
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/prompts/parallel-handoff-plan.md +1 -1
- package/dist/builtin/subagents/skills/browser-use/SKILL.md +234 -0
- package/dist/builtin/subagents/skills/browser-use/references/cdp-python.md +76 -0
- package/dist/builtin/subagents/skills/browser-use/references/multi-session.md +92 -0
- package/dist/builtin/subagents/skills/subagent/SKILL.md +4 -4
- package/dist/builtin/subagents/src/agents/skills.ts +19 -1
- package/dist/builtin/subagents/src/extension/index.ts +24 -22
- package/dist/builtin/subagents/src/intercom/intercom-bridge.ts +7 -1
- package/dist/builtin/subagents/src/runs/background/async-execution.ts +23 -7
- package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +98 -3
- package/dist/builtin/subagents/src/runs/background/async-status.ts +3 -1
- package/dist/builtin/subagents/src/runs/background/run-status.ts +1 -1
- package/dist/builtin/subagents/src/runs/background/stale-run-reconciler.ts +3 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +37 -12
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify.ts +15 -15
- package/dist/builtin/subagents/src/runs/foreground/execution.ts +26 -2
- package/dist/builtin/subagents/src/runs/shared/nested-render.ts +1 -1
- package/dist/builtin/subagents/src/runs/shared/parallel-utils.ts +7 -0
- package/dist/builtin/subagents/src/runs/shared/pi-args.ts +28 -1
- package/dist/builtin/subagents/src/shared/fast-mode.ts +80 -0
- package/dist/builtin/subagents/src/shared/formatters.ts +4 -2
- package/dist/builtin/subagents/src/shared/types.ts +4 -2
- package/dist/builtin/subagents/src/shared/utils.ts +3 -61
- package/dist/builtin/subagents/src/tui/render.ts +303 -157
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +113 -35
- package/dist/builtin/workflows/README.md +228 -41
- package/dist/builtin/workflows/builtin/deep-research-codebase.ts +535 -541
- package/dist/builtin/workflows/builtin/goal.ts +39 -25
- package/dist/builtin/workflows/builtin/open-claude-design.ts +66 -69
- package/dist/builtin/workflows/builtin/ralph.ts +21 -21
- package/dist/builtin/workflows/package.json +6 -5
- package/dist/builtin/workflows/skills/research-codebase/SKILL.md +1 -1
- package/dist/builtin/workflows/src/extension/background-ui-adapter.ts +2 -2
- package/dist/builtin/workflows/src/extension/discovery.ts +25 -146
- package/dist/builtin/workflows/src/extension/dispatcher.ts +72 -24
- package/dist/builtin/workflows/src/extension/hil-answer-notifications.ts +363 -0
- package/dist/builtin/workflows/src/extension/index.ts +690 -352
- package/dist/builtin/workflows/src/extension/lifecycle-notifications.ts +99 -62
- package/dist/builtin/workflows/src/extension/render-call.ts +2 -1
- package/dist/builtin/workflows/src/extension/render-result.ts +9 -3
- package/dist/builtin/workflows/src/extension/renderers.ts +5 -3
- package/dist/builtin/workflows/src/extension/runtime.ts +68 -33
- package/dist/builtin/workflows/src/extension/status-writer.ts +1 -1
- package/dist/builtin/workflows/src/extension/wiring.ts +34 -13
- package/dist/builtin/workflows/src/extension/workflow-module-loader.ts +142 -0
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +4 -4
- package/dist/builtin/workflows/src/index.ts +2 -0
- package/dist/builtin/workflows/src/intercom/result-intercom.ts +1 -1
- package/dist/builtin/workflows/src/runs/background/runner.ts +6 -4
- package/dist/builtin/workflows/src/runs/background/status.ts +45 -21
- package/dist/builtin/workflows/src/runs/foreground/executor.ts +624 -52
- package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +80 -24
- package/dist/builtin/workflows/src/runs/shared/validate-inputs.ts +61 -24
- package/dist/builtin/workflows/src/runs/shared/workflow-runner.ts +32 -10
- package/dist/builtin/workflows/src/sdk-surface.ts +6 -0
- package/dist/builtin/workflows/src/shared/expanded-workflow-graph.ts +178 -0
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +92 -12
- package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +21 -3
- package/dist/builtin/workflows/src/shared/render-inputs-schema.ts +1 -2
- package/dist/builtin/workflows/src/shared/run-visibility.ts +9 -0
- package/dist/builtin/workflows/src/shared/schema-introspection.ts +121 -0
- package/dist/builtin/workflows/src/shared/serializable.ts +132 -0
- package/dist/builtin/workflows/src/shared/stage-ui-broker.ts +91 -9
- package/dist/builtin/workflows/src/shared/store-types.ts +31 -3
- package/dist/builtin/workflows/src/shared/store.ts +58 -14
- package/dist/builtin/workflows/src/shared/types.ts +105 -40
- package/dist/builtin/workflows/src/tui/chat-surface-message.ts +129 -13
- package/dist/builtin/workflows/src/tui/chat-surface.ts +6 -1
- package/dist/builtin/workflows/src/tui/dispatch-confirm.ts +3 -2
- package/dist/builtin/workflows/src/tui/graph-canvas.ts +1 -1
- package/dist/builtin/workflows/src/tui/graph-view.ts +91 -65
- package/dist/builtin/workflows/src/tui/inline-form-card.ts +1 -1
- package/dist/builtin/workflows/src/tui/inline-form-overlay.ts +3 -2
- package/dist/builtin/workflows/src/tui/inputs-overlay.ts +3 -2
- package/dist/builtin/workflows/src/tui/inputs-picker.ts +8 -7
- package/dist/builtin/workflows/src/tui/keybindings-adapter.ts +2 -0
- package/dist/builtin/workflows/src/tui/node-card.ts +34 -8
- package/dist/builtin/workflows/src/tui/overlay-adapter.ts +4 -11
- package/dist/builtin/workflows/src/tui/prompt-card.ts +98 -50
- package/dist/builtin/workflows/src/tui/session-list.ts +7 -2
- package/dist/builtin/workflows/src/tui/session-picker.ts +2 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +226 -55
- package/dist/builtin/workflows/src/tui/status-helpers.ts +2 -0
- package/dist/builtin/workflows/src/tui/store-widget-installer.ts +37 -158
- package/dist/builtin/workflows/src/tui/toast.ts +2 -2
- package/dist/builtin/workflows/src/tui/widget.ts +53 -12
- package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +270 -19
- package/dist/builtin/workflows/src/tui/workflow-notice-card.ts +184 -0
- package/dist/builtin/workflows/src/workflows/define-workflow.ts +138 -43
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +45 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +27 -9
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +196 -17
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +2 -2
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/codex-fast-mode.d.ts +36 -0
- package/dist/core/codex-fast-mode.d.ts.map +1 -0
- package/dist/core/codex-fast-mode.js +117 -0
- package/dist/core/codex-fast-mode.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +1 -1
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/index.d.ts +4 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -0
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +7 -2
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +23 -8
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/reactive-widget.d.ts +58 -0
- package/dist/core/extensions/reactive-widget.d.ts.map +1 -0
- package/dist/core/extensions/reactive-widget.js +182 -0
- package/dist/core/extensions/reactive-widget.js.map +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +26 -12
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +8 -2
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-registry.d.ts +4 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +11 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/resource-loader.d.ts +9 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +49 -21
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +22 -13
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +7 -5
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +5 -3
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +16 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +64 -5
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +7 -4
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/ask-user-question/ask-user-question.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/ask-user-question.js +2 -2
- package/dist/core/tools/ask-user-question/ask-user-question.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +12 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/chat-input-actions.d.ts.map +1 -1
- package/dist/modes/interactive/chat-input-actions.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js +0 -1
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/fast-mode-selector.d.ts +27 -0
- package/dist/modes/interactive/components/fast-mode-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/fast-mode-selector.js +105 -0
- package/dist/modes/interactive/components/fast-mode-selector.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +7 -12
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +4 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +132 -30
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +53 -6
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +3 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/docs/compaction.md +1 -1
- package/docs/custom-provider.md +2 -2
- package/docs/development.md +2 -2
- package/docs/docs.json +2 -2
- package/docs/extensions.md +18 -13
- package/docs/providers.md +5 -1
- package/docs/quickstart.md +5 -3
- package/docs/rpc.md +5 -5
- package/docs/sdk.md +12 -12
- package/docs/settings.md +18 -0
- package/docs/themes.md +6 -6
- package/docs/tui.md +20 -18
- package/docs/usage.md +2 -0
- package/docs/workflows.md +403 -39
- package/examples/extensions/qna.ts +2 -2
- package/package.json +4 -4
- package/dist/builtin/subagents/skills/playwright-cli/SKILL.md +0 -392
- package/dist/builtin/subagents/skills/playwright-cli/references/element-attributes.md +0 -23
- package/dist/builtin/subagents/skills/playwright-cli/references/playwright-tests.md +0 -39
- package/dist/builtin/subagents/skills/playwright-cli/references/request-mocking.md +0 -87
- package/dist/builtin/subagents/skills/playwright-cli/references/running-code.md +0 -241
- package/dist/builtin/subagents/skills/playwright-cli/references/session-management.md +0 -225
- package/dist/builtin/subagents/skills/playwright-cli/references/spec-driven-testing.md +0 -305
- package/dist/builtin/subagents/skills/playwright-cli/references/storage-state.md +0 -275
- package/dist/builtin/subagents/skills/playwright-cli/references/test-generation.md +0 -134
- package/dist/builtin/subagents/skills/playwright-cli/references/tracing.md +0 -139
- package/dist/builtin/subagents/skills/playwright-cli/references/video-recording.md +0 -143
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
6
|
import * as fs from "node:fs";
|
|
7
|
-
import * as os from "node:os";
|
|
8
7
|
import * as path from "node:path";
|
|
9
8
|
import { fileURLToPath } from "node:url";
|
|
10
9
|
import { createRequire } from "node:module";
|
|
@@ -19,6 +18,11 @@ import { buildSkillInjection, normalizeSkillInput, resolveSkillsWithFallback } f
|
|
|
19
18
|
import { resolveChildCwd } from "../../shared/utils.ts";
|
|
20
19
|
import { buildModelCandidates, resolveModelCandidate, type AvailableModelInfo } from "../shared/model-fallback.ts";
|
|
21
20
|
import { resolveEffectiveThinking } from "../../shared/model-info.ts";
|
|
21
|
+
import {
|
|
22
|
+
getSubagentCodexFastModeSettings,
|
|
23
|
+
resolveSubagentCodexFastModeScope,
|
|
24
|
+
resolveSubagentModelFastModeMetadata,
|
|
25
|
+
} from "../../shared/fast-mode.ts";
|
|
22
26
|
import { resolveExpectedWorktreeAgentCwd } from "../shared/worktree.ts";
|
|
23
27
|
import {
|
|
24
28
|
type ArtifactConfig,
|
|
@@ -254,6 +258,7 @@ export function executeAsyncChain(
|
|
|
254
258
|
const resultMode = params.resultMode ?? "chain";
|
|
255
259
|
const chainSkills = params.chainSkills ?? [];
|
|
256
260
|
const availableModels = params.availableModels;
|
|
261
|
+
const fastModeScope = resolveSubagentCodexFastModeScope(workflowStageSubagentGuard);
|
|
257
262
|
const runnerCwd = resolveChildCwd(ctx.cwd, cwd);
|
|
258
263
|
const firstStep = chain[0];
|
|
259
264
|
const originalTask = params.task ?? (firstStep
|
|
@@ -329,15 +334,20 @@ export function executeAsyncChain(
|
|
|
329
334
|
|
|
330
335
|
const primaryModel = resolveModelCandidate(behavior.model ?? a.model, availableModels, ctx.currentModelProvider);
|
|
331
336
|
const model = applyThinkingSuffix(primaryModel, a.thinking);
|
|
337
|
+
const modelCandidates = buildModelCandidates(behavior.model ?? a.model, a.fallbackModels, availableModels, ctx.currentModelProvider, ctx.currentModel)
|
|
338
|
+
.map((candidate) => applyThinkingSuffix(candidate, a.thinking))
|
|
339
|
+
.filter((candidate): candidate is string => typeof candidate === "string");
|
|
340
|
+
const fastModeSettings = getSubagentCodexFastModeSettings(stepCwd);
|
|
332
341
|
return {
|
|
333
342
|
agent: s.agent,
|
|
334
343
|
task,
|
|
335
344
|
cwd: stepCwd,
|
|
336
345
|
model,
|
|
337
346
|
thinking: resolveEffectiveThinking(model, a.thinking),
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
347
|
+
...resolveSubagentModelFastModeMetadata({ model, modelCandidates, cwd: stepCwd, settings: fastModeSettings, scope: fastModeScope }),
|
|
348
|
+
modelCandidates,
|
|
349
|
+
codexFastModeSettings: fastModeSettings,
|
|
350
|
+
codexFastModeScope: fastModeScope,
|
|
341
351
|
tools: a.tools,
|
|
342
352
|
extensions: a.extensions,
|
|
343
353
|
mcpDirectTools: a.mcpDirectTools,
|
|
@@ -602,6 +612,11 @@ export function executeAsyncSingle(
|
|
|
602
612
|
resolveModelCandidate(params.modelOverride ?? agentConfig.model, availableModels, ctx.currentModelProvider),
|
|
603
613
|
agentConfig.thinking,
|
|
604
614
|
);
|
|
615
|
+
const modelCandidates = buildModelCandidates(params.modelOverride ?? agentConfig.model, agentConfig.fallbackModels, availableModels, ctx.currentModelProvider, ctx.currentModel)
|
|
616
|
+
.map((candidate) => applyThinkingSuffix(candidate, agentConfig.thinking))
|
|
617
|
+
.filter((candidate): candidate is string => typeof candidate === "string");
|
|
618
|
+
const fastModeSettings = getSubagentCodexFastModeSettings(runnerCwd);
|
|
619
|
+
const fastModeScope = resolveSubagentCodexFastModeScope(workflowStageSubagentGuard);
|
|
605
620
|
let spawnResult: { pid?: number; error?: string } = {};
|
|
606
621
|
try {
|
|
607
622
|
spawnResult = spawnRunner(
|
|
@@ -614,9 +629,10 @@ export function executeAsyncSingle(
|
|
|
614
629
|
cwd: runnerCwd,
|
|
615
630
|
model,
|
|
616
631
|
thinking: resolveEffectiveThinking(model, agentConfig.thinking),
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
632
|
+
...resolveSubagentModelFastModeMetadata({ model, modelCandidates, cwd: runnerCwd, settings: fastModeSettings, scope: fastModeScope }),
|
|
633
|
+
modelCandidates,
|
|
634
|
+
codexFastModeSettings: fastModeSettings,
|
|
635
|
+
codexFastModeScope: fastModeScope,
|
|
620
636
|
tools: agentConfig.tools,
|
|
621
637
|
extensions: agentConfig.extensions,
|
|
622
638
|
mcpDirectTools: agentConfig.mcpDirectTools,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
SUBAGENT_CONTROL_INTERCOM_EVENT,
|
|
15
15
|
} from "../../shared/types.ts";
|
|
16
16
|
import { readStatus } from "../../shared/utils.ts";
|
|
17
|
+
import { listAsyncRuns, type AsyncRunSummary } from "./async-status.ts";
|
|
17
18
|
import { normalizeParallelGroups } from "./parallel-groups.ts";
|
|
18
19
|
import { reconcileAsyncRun, reconcileNestedAsyncDescendants } from "./stale-run-reconciler.ts";
|
|
19
20
|
import { hasLiveNestedDescendants, updateAsyncJobNestedProjection } from "../shared/nested-events.ts";
|
|
@@ -26,18 +27,77 @@ interface AsyncJobTrackerOptions {
|
|
|
26
27
|
now?: () => number;
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
const ACTIVE_HYDRATION_STATES: Array<AsyncRunSummary["state"]> = ["queued", "running"];
|
|
31
|
+
|
|
32
|
+
function cwdMatches(summaryCwd: string | undefined, currentCwd: string | undefined): boolean {
|
|
33
|
+
return Boolean(summaryCwd && currentCwd && path.resolve(summaryCwd) === path.resolve(currentCwd));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function shouldHydrateRunForCurrentUi(summary: AsyncRunSummary, currentSessionId: string | null, currentCwd: string | undefined): boolean {
|
|
37
|
+
if (summary.sessionId && currentSessionId) return summary.sessionId === currentSessionId;
|
|
38
|
+
return cwdMatches(summary.cwd, currentCwd);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function asyncRunSummaryToJobState(summary: AsyncRunSummary, existing?: AsyncJobState): AsyncJobState {
|
|
42
|
+
const chainStepCount = summary.chainStepCount ?? summary.steps.length;
|
|
43
|
+
const groups = normalizeParallelGroups(summary.parallelGroups, summary.steps.length, chainStepCount);
|
|
44
|
+
const activeGroup = summary.currentStep !== undefined
|
|
45
|
+
? groups.find((group) => summary.currentStep! >= group.start && summary.currentStep! < group.start + group.count)
|
|
46
|
+
: undefined;
|
|
47
|
+
const steps = activeGroup
|
|
48
|
+
? summary.steps.slice(activeGroup.start, activeGroup.start + activeGroup.count).map((step, index) => ({ ...step, index: activeGroup.start + index }))
|
|
49
|
+
: summary.steps.map((step, index) => ({ ...step, index: step.index ?? index }));
|
|
50
|
+
const agents = steps.map((step) => step.agent);
|
|
51
|
+
const stepsTotal = steps.length > 0 ? steps.length : existing?.stepsTotal ?? (agents.length > 0 ? agents.length : undefined);
|
|
52
|
+
const completedSteps = summary.state === "complete"
|
|
53
|
+
? steps.length
|
|
54
|
+
: steps.filter((step) => step.status === "complete" || step.status === "completed").length;
|
|
55
|
+
return {
|
|
56
|
+
...existing,
|
|
57
|
+
asyncId: summary.id,
|
|
58
|
+
asyncDir: summary.asyncDir,
|
|
59
|
+
status: summary.state,
|
|
60
|
+
sessionId: summary.sessionId ?? existing?.sessionId,
|
|
61
|
+
activityState: summary.activityState,
|
|
62
|
+
lastActivityAt: summary.lastActivityAt,
|
|
63
|
+
currentTool: summary.currentTool,
|
|
64
|
+
currentToolStartedAt: summary.currentToolStartedAt,
|
|
65
|
+
currentPath: summary.currentPath,
|
|
66
|
+
turnCount: summary.turnCount,
|
|
67
|
+
toolCount: summary.toolCount,
|
|
68
|
+
mode: summary.mode,
|
|
69
|
+
agents: agents.length > 0 ? agents : existing?.agents,
|
|
70
|
+
currentStep: summary.currentStep,
|
|
71
|
+
chainStepCount: summary.chainStepCount ?? existing?.chainStepCount,
|
|
72
|
+
parallelGroups: groups,
|
|
73
|
+
steps: steps.length > 0 ? steps : existing?.steps,
|
|
74
|
+
stepsTotal,
|
|
75
|
+
runningSteps: steps.filter((step) => step.status === "running").length,
|
|
76
|
+
completedSteps,
|
|
77
|
+
hasParallelGroups: groups.length > 0,
|
|
78
|
+
activeParallelGroup: Boolean(activeGroup),
|
|
79
|
+
startedAt: summary.startedAt,
|
|
80
|
+
updatedAt: summary.lastUpdate ?? summary.startedAt,
|
|
81
|
+
sessionDir: summary.sessionDir ?? existing?.sessionDir,
|
|
82
|
+
outputFile: summary.outputFile ?? existing?.outputFile,
|
|
83
|
+
totalTokens: summary.totalTokens,
|
|
84
|
+
sessionFile: summary.sessionFile ?? existing?.sessionFile,
|
|
85
|
+
nestedChildren: summary.nestedChildren,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
29
89
|
export function createAsyncJobTracker(pi: Pick<ExtensionAPI, "events">, state: SubagentState, asyncDirRoot: string, options: AsyncJobTrackerOptions = {}): {
|
|
30
90
|
ensurePoller: () => void;
|
|
31
91
|
handleStarted: (data: unknown) => void;
|
|
32
92
|
handleComplete: (data: unknown) => void;
|
|
33
93
|
resetJobs: (ctx?: ExtensionContext) => void;
|
|
94
|
+
hydrateActiveJobs: (ctx?: ExtensionContext) => void;
|
|
34
95
|
} {
|
|
35
96
|
const completionRetentionMs = options.completionRetentionMs ?? 10000;
|
|
36
97
|
const pollIntervalMs = options.pollIntervalMs ?? POLL_INTERVAL_MS;
|
|
37
98
|
const resultsDir = options.resultsDir ?? RESULTS_DIR;
|
|
38
99
|
const rerenderWidget = (ctx: ExtensionContext, jobs = Array.from(state.asyncJobs.values())) => {
|
|
39
100
|
renderWidget(ctx, jobs);
|
|
40
|
-
ctx.ui.requestRender?.();
|
|
41
101
|
};
|
|
42
102
|
const cancelCleanup = (asyncId: string) => {
|
|
43
103
|
const existingTimer = state.cleanupTimers.get(asyncId);
|
|
@@ -233,12 +293,47 @@ export function createAsyncJobTracker(pi: Pick<ExtensionAPI, "events">, state: S
|
|
|
233
293
|
state.poller.unref?.();
|
|
234
294
|
};
|
|
235
295
|
|
|
296
|
+
const hydrateActiveJobs = (ctx?: ExtensionContext) => {
|
|
297
|
+
if (ctx?.hasUI) state.lastUiContext = ctx;
|
|
298
|
+
const renderCtx = state.lastUiContext?.hasUI ? state.lastUiContext : undefined;
|
|
299
|
+
const currentCwd = (ctx?.cwd ?? state.lastUiContext?.cwd ?? state.baseCwd) || undefined;
|
|
300
|
+
let summaries: AsyncRunSummary[];
|
|
301
|
+
try {
|
|
302
|
+
summaries = listAsyncRuns(asyncDirRoot, {
|
|
303
|
+
states: ACTIVE_HYDRATION_STATES,
|
|
304
|
+
resultsDir,
|
|
305
|
+
kill: options.kill,
|
|
306
|
+
now: options.now,
|
|
307
|
+
});
|
|
308
|
+
} catch (error) {
|
|
309
|
+
console.error(`Failed to hydrate active async jobs from '${asyncDirRoot}':`, error);
|
|
310
|
+
if (renderCtx) rerenderWidget(renderCtx);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
for (const summary of summaries) {
|
|
315
|
+
if (!shouldHydrateRunForCurrentUi(summary, state.currentSessionId, currentCwd)) continue;
|
|
316
|
+
cancelCleanup(summary.id);
|
|
317
|
+
state.asyncJobs.set(summary.id, asyncRunSummaryToJobState(summary, state.asyncJobs.get(summary.id)));
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (state.asyncJobs.size > 0) ensurePoller();
|
|
321
|
+
if (renderCtx) rerenderWidget(renderCtx);
|
|
322
|
+
};
|
|
323
|
+
|
|
236
324
|
const handleStarted = (data: unknown) => {
|
|
237
325
|
const info = data as AsyncStartedEvent;
|
|
238
326
|
if (!info.id) return;
|
|
239
327
|
const now = Date.now();
|
|
240
328
|
const asyncDir = info.asyncDir ?? path.join(asyncDirRoot, info.id);
|
|
241
|
-
|
|
329
|
+
let rawAgents: string[] | undefined;
|
|
330
|
+
if (info.agents?.length) {
|
|
331
|
+
rawAgents = info.agents;
|
|
332
|
+
} else if (info.chain && info.chain.length > 0) {
|
|
333
|
+
rawAgents = info.chain;
|
|
334
|
+
} else if (info.agent) {
|
|
335
|
+
rawAgents = [info.agent];
|
|
336
|
+
}
|
|
242
337
|
const validParallelGroups = normalizeParallelGroups(info.parallelGroups, Number.MAX_SAFE_INTEGER, info.chainStepCount ?? Number.MAX_SAFE_INTEGER);
|
|
243
338
|
const firstGroup = validParallelGroups.find((group) => group.start === 0);
|
|
244
339
|
const firstGroupCount = firstGroup?.count;
|
|
@@ -306,5 +401,5 @@ export function createAsyncJobTracker(pi: Pick<ExtensionAPI, "events">, state: S
|
|
|
306
401
|
}
|
|
307
402
|
};
|
|
308
403
|
|
|
309
|
-
return { ensurePoller, handleStarted, handleComplete, resetJobs };
|
|
404
|
+
return { ensurePoller, handleStarted, handleComplete, resetJobs, hydrateActiveJobs };
|
|
310
405
|
}
|
|
@@ -28,6 +28,7 @@ interface AsyncRunStepSummary {
|
|
|
28
28
|
skills?: string[];
|
|
29
29
|
model?: string;
|
|
30
30
|
thinking?: string;
|
|
31
|
+
fastMode?: boolean;
|
|
31
32
|
attemptedModels?: string[];
|
|
32
33
|
error?: string;
|
|
33
34
|
children?: NestedRunSummary[];
|
|
@@ -155,6 +156,7 @@ function statusToSummary(asyncDir: string, status: AsyncStatus & { cwd?: string
|
|
|
155
156
|
...(step.skills ? { skills: step.skills } : {}),
|
|
156
157
|
...(step.model ? { model: step.model } : {}),
|
|
157
158
|
...(step.thinking ? { thinking: step.thinking } : {}),
|
|
159
|
+
...(step.fastMode !== undefined ? { fastMode: step.fastMode } : {}),
|
|
158
160
|
...(step.attemptedModels ? { attemptedModels: step.attemptedModels } : {}),
|
|
159
161
|
...(step.error ? { error: step.error } : {}),
|
|
160
162
|
...(step.children?.length ? { children: step.children } : {}),
|
|
@@ -262,7 +264,7 @@ function formatStepLine(step: AsyncRunStepSummary): string {
|
|
|
262
264
|
const parts = [`${step.index + 1}. ${step.agent}`, step.status];
|
|
263
265
|
const activity = formatActivityFacts(step);
|
|
264
266
|
if (activity) parts.push(activity);
|
|
265
|
-
const modelThinking = formatModelThinking(step.model, step.thinking);
|
|
267
|
+
const modelThinking = formatModelThinking(step.model, step.thinking, step.fastMode);
|
|
266
268
|
if (modelThinking) parts.push(modelThinking);
|
|
267
269
|
if (step.durationMs !== undefined) parts.push(formatDuration(step.durationMs));
|
|
268
270
|
if (step.tokens) parts.push(`${formatTokens(step.tokens.total)} tok`);
|
|
@@ -213,7 +213,7 @@ export function inspectSubagentStatus(params: RunStatusParams, deps: RunStatusDe
|
|
|
213
213
|
].filter((line): line is string => Boolean(line));
|
|
214
214
|
for (const [index, step] of (status.steps ?? []).entries()) {
|
|
215
215
|
const stepActivityText = step.status === "running" ? formatActivityLabel(step.lastActivityAt, step.activityState) : undefined;
|
|
216
|
-
const modelThinking = formatModelThinking(step.model, step.thinking);
|
|
216
|
+
const modelThinking = formatModelThinking(step.model, step.thinking, step.fastMode);
|
|
217
217
|
const modelText = modelThinking ? ` (${modelThinking})` : "";
|
|
218
218
|
const errorText = step.error ? `, error: ${step.error}` : "";
|
|
219
219
|
lines.push(`${stepLineLabel(status, index)}: ${step.agent} ${step.status}${modelText}${stepActivityText ? `, ${stepActivityText}` : ""}${errorText}`);
|
|
@@ -79,6 +79,7 @@ interface ResultChildOutcome {
|
|
|
79
79
|
error?: string;
|
|
80
80
|
sessionFile?: string;
|
|
81
81
|
model?: string;
|
|
82
|
+
fastMode?: boolean;
|
|
82
83
|
attemptedModels?: string[];
|
|
83
84
|
modelAttempts?: NonNullable<AsyncStatus["steps"]>[number]["modelAttempts"];
|
|
84
85
|
}
|
|
@@ -123,6 +124,7 @@ function terminalStatusFromResult(status: AsyncStatus, resultPath: string, now:
|
|
|
123
124
|
error: state === "failed" ? step.error ?? child?.error : step.error,
|
|
124
125
|
sessionFile: step.sessionFile ?? child?.sessionFile,
|
|
125
126
|
model: step.model ?? child?.model,
|
|
127
|
+
fastMode: step.fastMode ?? child?.fastMode,
|
|
126
128
|
attemptedModels: step.attemptedModels ?? child?.attemptedModels,
|
|
127
129
|
modelAttempts: step.modelAttempts ?? child?.modelAttempts,
|
|
128
130
|
};
|
|
@@ -205,6 +207,7 @@ function buildFailedRepair(status: AsyncStatus, asyncDir: string, now: number, r
|
|
|
205
207
|
error: step.status === "complete" || step.status === "completed" ? undefined : step.error ?? message,
|
|
206
208
|
success: step.status === "complete" || step.status === "completed",
|
|
207
209
|
model: step.model,
|
|
210
|
+
fastMode: step.fastMode,
|
|
208
211
|
attemptedModels: step.attemptedModels,
|
|
209
212
|
modelAttempts: step.modelAttempts,
|
|
210
213
|
sessionFile: step.sessionFile,
|
|
@@ -108,6 +108,7 @@ interface StepResult {
|
|
|
108
108
|
sessionFile?: string;
|
|
109
109
|
intercomTarget?: string;
|
|
110
110
|
model?: string;
|
|
111
|
+
fastMode?: boolean;
|
|
111
112
|
attemptedModels?: string[];
|
|
112
113
|
modelAttempts?: ModelAttempt[];
|
|
113
114
|
artifactPaths?: ArtifactPaths;
|
|
@@ -166,6 +167,14 @@ function resetStepLiveDetail(step: RunnerStatusStep): void {
|
|
|
166
167
|
step.recentOutput = [];
|
|
167
168
|
}
|
|
168
169
|
|
|
170
|
+
function fastModeForStepAttempt(step: SubagentStep, model: string | undefined): boolean | undefined {
|
|
171
|
+
if (model && step.modelFastModes && Object.prototype.hasOwnProperty.call(step.modelFastModes, model)) {
|
|
172
|
+
return step.modelFastModes[model];
|
|
173
|
+
}
|
|
174
|
+
if (model === undefined || model === step.model) return step.fastMode;
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
|
|
169
178
|
interface ChildEventContext {
|
|
170
179
|
eventsPath: string;
|
|
171
180
|
runId: string;
|
|
@@ -565,7 +574,7 @@ interface SingleStepContext {
|
|
|
565
574
|
childIntercomTarget?: string;
|
|
566
575
|
orchestratorIntercomTarget?: string;
|
|
567
576
|
nestedRoute?: NestedRouteInfo;
|
|
568
|
-
onAttemptStart?: (attempt: { model?: string; thinking?: string }) => void;
|
|
577
|
+
onAttemptStart?: (attempt: { model?: string; thinking?: string; fastMode?: boolean }) => void;
|
|
569
578
|
onChildEvent?: (event: ChildEvent) => void;
|
|
570
579
|
workflowStageSubagentGuard?: boolean;
|
|
571
580
|
}
|
|
@@ -580,6 +589,7 @@ async function runSingleStep(
|
|
|
580
589
|
exitCode: number | null;
|
|
581
590
|
error?: string;
|
|
582
591
|
model?: string;
|
|
592
|
+
fastMode?: boolean;
|
|
583
593
|
attemptedModels?: string[];
|
|
584
594
|
modelAttempts?: ModelAttempt[];
|
|
585
595
|
artifactPaths?: ArtifactPaths;
|
|
@@ -613,12 +623,14 @@ async function runSingleStep(
|
|
|
613
623
|
const attemptNotes: string[] = [];
|
|
614
624
|
const eventsPath = path.join(path.dirname(ctx.outputFile), "events.jsonl");
|
|
615
625
|
let finalResult: RunPiStreamingResult | undefined;
|
|
626
|
+
let finalFastMode: boolean | undefined;
|
|
616
627
|
let finalOutputSnapshot: SingleOutputSnapshot | undefined;
|
|
617
628
|
let completionGuardTriggeredFinal = false;
|
|
618
629
|
|
|
619
630
|
for (let index = 0; index < candidates.length; index++) {
|
|
620
631
|
const candidate = candidates[index];
|
|
621
|
-
|
|
632
|
+
const attemptFastMode = fastModeForStepAttempt(step, candidate);
|
|
633
|
+
ctx.onAttemptStart?.({ model: candidate, thinking: resolveEffectiveThinking(candidate, step.thinking), fastMode: attemptFastMode ? true : undefined });
|
|
622
634
|
const outputSnapshot = captureSingleOutputSnapshot(step.outputPath);
|
|
623
635
|
const { args, env, tempDir } = buildPiArgs({
|
|
624
636
|
baseArgs: ["--mode", "json", "-p"],
|
|
@@ -645,6 +657,8 @@ async function runSingleStep(
|
|
|
645
657
|
parentControlInbox: ctx.nestedRoute?.controlInbox,
|
|
646
658
|
parentRootRunId: ctx.nestedRoute?.rootRunId,
|
|
647
659
|
parentCapabilityToken: ctx.nestedRoute?.capabilityToken,
|
|
660
|
+
codexFastModeSettings: step.codexFastModeSettings,
|
|
661
|
+
codexFastModeScope: step.codexFastModeScope,
|
|
648
662
|
});
|
|
649
663
|
const run = await runPiStreaming(
|
|
650
664
|
args,
|
|
@@ -698,6 +712,7 @@ async function runSingleStep(
|
|
|
698
712
|
modelAttempts.push(attempt);
|
|
699
713
|
if (candidate) attemptedModels.push(candidate);
|
|
700
714
|
completionGuardTriggeredFinal = completionGuardTriggered;
|
|
715
|
+
finalFastMode = attemptFastMode;
|
|
701
716
|
finalOutputSnapshot = outputSnapshot;
|
|
702
717
|
finalResult = { ...run, exitCode: effectiveExitCode, model: candidate ?? run.model, error };
|
|
703
718
|
if (attempt.success || completionGuardTriggered) break;
|
|
@@ -739,6 +754,7 @@ async function runSingleStep(
|
|
|
739
754
|
task,
|
|
740
755
|
exitCode: finalResult?.exitCode,
|
|
741
756
|
model: finalResult?.model,
|
|
757
|
+
...(finalFastMode ? { fastMode: true } : {}),
|
|
742
758
|
attemptedModels: attemptedModels.length > 0 ? attemptedModels : undefined,
|
|
743
759
|
modelAttempts,
|
|
744
760
|
skills: step.skills,
|
|
@@ -757,6 +773,7 @@ async function runSingleStep(
|
|
|
757
773
|
sessionFile: step.sessionFile,
|
|
758
774
|
intercomTarget: ctx.childIntercomTarget,
|
|
759
775
|
model: finalResult?.model,
|
|
776
|
+
...(finalFastMode ? { fastMode: true } : {}),
|
|
760
777
|
attemptedModels: attemptedModels.length > 0 ? attemptedModels : undefined,
|
|
761
778
|
modelAttempts,
|
|
762
779
|
artifactPaths,
|
|
@@ -944,6 +961,7 @@ async function runSubagent(config: SubagentRunConfig): Promise<void> {
|
|
|
944
961
|
skills: step.skills,
|
|
945
962
|
model: step.model,
|
|
946
963
|
thinking: step.thinking,
|
|
964
|
+
...(step.fastMode ? { fastMode: true } : {}),
|
|
947
965
|
attemptedModels: step.modelCandidates && step.modelCandidates.length > 0 ? step.modelCandidates : step.model ? [step.model] : undefined,
|
|
948
966
|
recentTools: [],
|
|
949
967
|
recentOutput: [],
|
|
@@ -1065,11 +1083,12 @@ async function runSubagent(config: SubagentRunConfig): Promise<void> {
|
|
|
1065
1083
|
appendControlEvent(event);
|
|
1066
1084
|
return true;
|
|
1067
1085
|
};
|
|
1068
|
-
const updateStepModel = (flatIndex: number, model: string | undefined, thinking: string | undefined, now = Date.now()): void => {
|
|
1086
|
+
const updateStepModel = (flatIndex: number, model: string | undefined, thinking: string | undefined, fastMode: boolean | undefined, now = Date.now()): void => {
|
|
1069
1087
|
const step = statusPayload.steps[flatIndex];
|
|
1070
1088
|
if (!step) return;
|
|
1071
1089
|
step.model = model;
|
|
1072
1090
|
step.thinking = thinking;
|
|
1091
|
+
step.fastMode = fastMode ? true : undefined;
|
|
1073
1092
|
statusPayload.lastUpdate = now;
|
|
1074
1093
|
writeStatusPayload();
|
|
1075
1094
|
};
|
|
@@ -1399,7 +1418,7 @@ async function runSubagent(config: SubagentRunConfig): Promise<void> {
|
|
|
1399
1418
|
registerInterrupt: (interrupt) => {
|
|
1400
1419
|
activeChildInterrupt = interrupt;
|
|
1401
1420
|
},
|
|
1402
|
-
onAttemptStart: (attempt) => updateStepModel(fi, attempt.model, attempt.thinking),
|
|
1421
|
+
onAttemptStart: (attempt) => updateStepModel(fi, attempt.model, attempt.thinking, attempt.fastMode),
|
|
1403
1422
|
onChildEvent: (event) => updateStepFromChildEvent(fi, event),
|
|
1404
1423
|
workflowStageSubagentGuard: config.workflowStageSubagentGuard,
|
|
1405
1424
|
});
|
|
@@ -1416,6 +1435,7 @@ async function runSubagent(config: SubagentRunConfig): Promise<void> {
|
|
|
1416
1435
|
statusPayload.steps[fi].exitCode = singleResult.exitCode;
|
|
1417
1436
|
statusPayload.steps[fi].model = singleResult.model;
|
|
1418
1437
|
statusPayload.steps[fi].thinking = resolveEffectiveThinking(singleResult.model, statusPayload.steps[fi].thinking);
|
|
1438
|
+
statusPayload.steps[fi].fastMode = singleResult.fastMode ? true : undefined;
|
|
1419
1439
|
statusPayload.steps[fi].attemptedModels = singleResult.attemptedModels;
|
|
1420
1440
|
statusPayload.steps[fi].modelAttempts = singleResult.modelAttempts;
|
|
1421
1441
|
statusPayload.steps[fi].error = singleResult.error;
|
|
@@ -1476,6 +1496,7 @@ async function runSubagent(config: SubagentRunConfig): Promise<void> {
|
|
|
1476
1496
|
sessionFile: pr.sessionFile,
|
|
1477
1497
|
intercomTarget: pr.intercomTarget,
|
|
1478
1498
|
model: pr.model,
|
|
1499
|
+
fastMode: pr.fastMode,
|
|
1479
1500
|
attemptedModels: pr.attemptedModels,
|
|
1480
1501
|
modelAttempts: pr.modelAttempts,
|
|
1481
1502
|
artifactPaths: pr.artifactPaths,
|
|
@@ -1484,13 +1505,14 @@ async function runSubagent(config: SubagentRunConfig): Promise<void> {
|
|
|
1484
1505
|
|
|
1485
1506
|
previousOutput = aggregateParallelOutputs(
|
|
1486
1507
|
parallelResults.map((r) => ({
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1508
|
+
agent: r.agent,
|
|
1509
|
+
output: r.output,
|
|
1510
|
+
exitCode: r.exitCode,
|
|
1511
|
+
error: r.error,
|
|
1512
|
+
model: r.model,
|
|
1513
|
+
fastMode: r.fastMode,
|
|
1514
|
+
attemptedModels: r.attemptedModels,
|
|
1515
|
+
})),
|
|
1494
1516
|
);
|
|
1495
1517
|
previousOutput = appendParallelWorktreeSummary(previousOutput, worktreeSetup, asyncDir, stepIndex, group);
|
|
1496
1518
|
|
|
@@ -1546,7 +1568,7 @@ async function runSubagent(config: SubagentRunConfig): Promise<void> {
|
|
|
1546
1568
|
registerInterrupt: (interrupt) => {
|
|
1547
1569
|
activeChildInterrupt = interrupt;
|
|
1548
1570
|
},
|
|
1549
|
-
onAttemptStart: (attempt) => updateStepModel(flatIndex, attempt.model, attempt.thinking),
|
|
1571
|
+
onAttemptStart: (attempt) => updateStepModel(flatIndex, attempt.model, attempt.thinking, attempt.fastMode),
|
|
1550
1572
|
onChildEvent: (event) => updateStepFromChildEvent(flatIndex, event),
|
|
1551
1573
|
workflowStageSubagentGuard: config.workflowStageSubagentGuard,
|
|
1552
1574
|
});
|
|
@@ -1563,6 +1585,7 @@ async function runSubagent(config: SubagentRunConfig): Promise<void> {
|
|
|
1563
1585
|
sessionFile: singleResult.sessionFile,
|
|
1564
1586
|
intercomTarget: singleResult.intercomTarget,
|
|
1565
1587
|
model: singleResult.model,
|
|
1588
|
+
fastMode: singleResult.fastMode,
|
|
1566
1589
|
attemptedModels: singleResult.attemptedModels,
|
|
1567
1590
|
modelAttempts: singleResult.modelAttempts,
|
|
1568
1591
|
artifactPaths: singleResult.artifactPaths,
|
|
@@ -1596,6 +1619,7 @@ async function runSubagent(config: SubagentRunConfig): Promise<void> {
|
|
|
1596
1619
|
statusPayload.steps[flatIndex].exitCode = singleResult.exitCode;
|
|
1597
1620
|
statusPayload.steps[flatIndex].model = singleResult.model;
|
|
1598
1621
|
statusPayload.steps[flatIndex].thinking = resolveEffectiveThinking(singleResult.model, statusPayload.steps[flatIndex].thinking);
|
|
1622
|
+
statusPayload.steps[flatIndex].fastMode = singleResult.fastMode ? true : undefined;
|
|
1599
1623
|
statusPayload.steps[flatIndex].attemptedModels = singleResult.attemptedModels;
|
|
1600
1624
|
statusPayload.steps[flatIndex].modelAttempts = singleResult.modelAttempts;
|
|
1601
1625
|
statusPayload.steps[flatIndex].error = singleResult.error;
|
|
@@ -1753,6 +1777,7 @@ async function runSubagent(config: SubagentRunConfig): Promise<void> {
|
|
|
1753
1777
|
sessionFile: r.sessionFile,
|
|
1754
1778
|
intercomTarget: r.intercomTarget,
|
|
1755
1779
|
model: r.model,
|
|
1780
|
+
fastMode: r.fastMode,
|
|
1756
1781
|
attemptedModels: r.attemptedModels,
|
|
1757
1782
|
modelAttempts: r.modelAttempts,
|
|
1758
1783
|
artifactPaths: r.artifactPaths,
|
|
@@ -340,10 +340,10 @@ export class ChainClarifyComponent implements Component {
|
|
|
340
340
|
? rawAgentName.slice(0, maxAgentLen - 1) + "…"
|
|
341
341
|
: rawAgentName;
|
|
342
342
|
// Use mode-appropriate terminology
|
|
343
|
-
const stepLabel = this.mode === 'single'
|
|
344
|
-
? agentName
|
|
345
|
-
: this.mode === 'parallel'
|
|
346
|
-
? `Task ${this.editingStep! + 1}: ${agentName}`
|
|
343
|
+
const stepLabel = this.mode === 'single'
|
|
344
|
+
? agentName
|
|
345
|
+
: this.mode === 'parallel'
|
|
346
|
+
? `Task ${this.editingStep! + 1}: ${agentName}`
|
|
347
347
|
: `Step ${this.editingStep! + 1}: ${agentName}`;
|
|
348
348
|
const headerText = ` Editing ${fieldName} (${stepLabel}) `;
|
|
349
349
|
lines.push(this.renderHeader(headerText));
|
|
@@ -859,7 +859,7 @@ export class ChainClarifyComponent implements Component {
|
|
|
859
859
|
// Check all downstream steps (steps that come after the changed step)
|
|
860
860
|
for (let i = changedStepIndex + 1; i < this.agentConfigs.length; i++) {
|
|
861
861
|
const behavior = this.getEffectiveBehavior(i);
|
|
862
|
-
|
|
862
|
+
|
|
863
863
|
// Skip if reads is disabled or empty
|
|
864
864
|
if (behavior.reads === false || !behavior.reads || behavior.reads.length === 0) {
|
|
865
865
|
continue;
|
|
@@ -868,7 +868,7 @@ export class ChainClarifyComponent implements Component {
|
|
|
868
868
|
// Check if this step reads the old output file
|
|
869
869
|
const readsArray = behavior.reads;
|
|
870
870
|
const oldIndex = readsArray.indexOf(oldOutput);
|
|
871
|
-
|
|
871
|
+
|
|
872
872
|
if (oldIndex !== -1) {
|
|
873
873
|
// Replace old filename with new filename in reads
|
|
874
874
|
const newReads = [...readsArray];
|
|
@@ -906,10 +906,10 @@ export class ChainClarifyComponent implements Component {
|
|
|
906
906
|
|
|
907
907
|
// Header (mode-aware terminology)
|
|
908
908
|
const agentName = this.agentConfigs[this.editingStep!]?.name ?? "unknown";
|
|
909
|
-
const stepLabel = this.mode === 'single'
|
|
910
|
-
? agentName
|
|
911
|
-
: this.mode === 'parallel'
|
|
912
|
-
? `Task ${this.editingStep! + 1}: ${agentName}`
|
|
909
|
+
const stepLabel = this.mode === 'single'
|
|
910
|
+
? agentName
|
|
911
|
+
: this.mode === 'parallel'
|
|
912
|
+
? `Task ${this.editingStep! + 1}: ${agentName}`
|
|
913
913
|
: `Step ${this.editingStep! + 1}: ${agentName}`;
|
|
914
914
|
const headerText = ` Select Model (${stepLabel}) `;
|
|
915
915
|
lines.push(this.renderHeader(headerText));
|
|
@@ -980,10 +980,10 @@ export class ChainClarifyComponent implements Component {
|
|
|
980
980
|
const lines: string[] = [];
|
|
981
981
|
|
|
982
982
|
const agentName = this.agentConfigs[this.editingStep!]?.name ?? "unknown";
|
|
983
|
-
const stepLabel = this.mode === 'single'
|
|
984
|
-
? agentName
|
|
985
|
-
: this.mode === 'parallel'
|
|
986
|
-
? `Task ${this.editingStep! + 1}: ${agentName}`
|
|
983
|
+
const stepLabel = this.mode === 'single'
|
|
984
|
+
? agentName
|
|
985
|
+
: this.mode === 'parallel'
|
|
986
|
+
? `Task ${this.editingStep! + 1}: ${agentName}`
|
|
987
987
|
: `Step ${this.editingStep! + 1}: ${agentName}`;
|
|
988
988
|
const headerText = ` Thinking Level (${stepLabel}) `;
|
|
989
989
|
lines.push(this.renderHeader(headerText));
|
|
@@ -1301,7 +1301,7 @@ export class ChainClarifyComponent implements Component {
|
|
|
1301
1301
|
|
|
1302
1302
|
if (progressEnabled) {
|
|
1303
1303
|
const isFirstStep = i === 0;
|
|
1304
|
-
const progressAction = isFirstStep
|
|
1304
|
+
const progressAction = isFirstStep
|
|
1305
1305
|
? th.fg("success", "writes progress.md")
|
|
1306
1306
|
: th.fg("accent", "reads progress.md");
|
|
1307
1307
|
const progressLabel = th.fg("dim", "progress: ");
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
import type { Message } from "@earendil-works/pi-ai";
|
|
8
|
+
import type { CodexFastModeResolvedSettings, CodexFastModeScope } from "@bastani/atomic";
|
|
8
9
|
import type { AgentConfig } from "../../agents/agents.ts";
|
|
9
10
|
import {
|
|
10
11
|
ensureArtifactsDir,
|
|
@@ -63,6 +64,11 @@ import {
|
|
|
63
64
|
shouldEscalateMutatingFailures,
|
|
64
65
|
summarizeRecentMutatingFailures,
|
|
65
66
|
} from "../shared/long-running-guard.ts";
|
|
67
|
+
import {
|
|
68
|
+
getSubagentCodexFastModeSettings,
|
|
69
|
+
resolveSubagentCodexFastModeScope,
|
|
70
|
+
resolveSubagentModelFastMode,
|
|
71
|
+
} from "../../shared/fast-mode.ts";
|
|
66
72
|
|
|
67
73
|
const artifactOutputByResult = new WeakMap<SingleResult, string>();
|
|
68
74
|
|
|
@@ -133,9 +139,18 @@ async function runSingleAttempt(
|
|
|
133
139
|
artifactPaths?: ArtifactPaths;
|
|
134
140
|
attemptNotes: string[];
|
|
135
141
|
outputSnapshot?: SingleOutputSnapshot;
|
|
142
|
+
fastModeSettings: CodexFastModeResolvedSettings;
|
|
143
|
+
fastModeScope: CodexFastModeScope;
|
|
136
144
|
},
|
|
137
145
|
): Promise<SingleResult> {
|
|
138
146
|
const modelArg = applyThinkingSuffix(model, agent.thinking);
|
|
147
|
+
const runCwd = options.cwd ?? runtimeCwd;
|
|
148
|
+
const fastMode = resolveSubagentModelFastMode({
|
|
149
|
+
model: modelArg,
|
|
150
|
+
cwd: runCwd,
|
|
151
|
+
settings: shared.fastModeSettings,
|
|
152
|
+
scope: shared.fastModeScope,
|
|
153
|
+
});
|
|
139
154
|
const { args, env: sharedEnv, tempDir } = buildPiArgs({
|
|
140
155
|
baseArgs: ["--mode", "json", "-p"],
|
|
141
156
|
task,
|
|
@@ -151,7 +166,7 @@ async function runSingleAttempt(
|
|
|
151
166
|
extensions: agent.extensions,
|
|
152
167
|
systemPrompt: shared.systemPrompt,
|
|
153
168
|
mcpDirectTools: agent.mcpDirectTools,
|
|
154
|
-
cwd:
|
|
169
|
+
cwd: runCwd,
|
|
155
170
|
promptFileStem: agent.name,
|
|
156
171
|
intercomSessionName: options.intercomSessionName,
|
|
157
172
|
orchestratorIntercomTarget: options.orchestratorIntercomTarget,
|
|
@@ -162,6 +177,8 @@ async function runSingleAttempt(
|
|
|
162
177
|
parentControlInbox: options.nestedRoute?.controlInbox,
|
|
163
178
|
parentRootRunId: options.nestedRoute?.rootRunId,
|
|
164
179
|
parentCapabilityToken: options.nestedRoute?.capabilityToken,
|
|
180
|
+
codexFastModeSettings: shared.fastModeSettings,
|
|
181
|
+
codexFastModeScope: shared.fastModeScope,
|
|
165
182
|
});
|
|
166
183
|
|
|
167
184
|
const result: SingleResult = {
|
|
@@ -171,6 +188,7 @@ async function runSingleAttempt(
|
|
|
171
188
|
messages: [],
|
|
172
189
|
usage: emptyUsage(),
|
|
173
190
|
model: modelArg,
|
|
191
|
+
...(fastMode ? { fastMode } : {}),
|
|
174
192
|
artifactPaths: shared.artifactPaths,
|
|
175
193
|
skills: shared.resolvedSkillNames,
|
|
176
194
|
skillsWarning: shared.skillsWarning,
|
|
@@ -215,7 +233,7 @@ async function runSingleAttempt(
|
|
|
215
233
|
const exitCode = await new Promise<number>((resolve) => {
|
|
216
234
|
const spawnSpec = getPiSpawnCommand(args);
|
|
217
235
|
const proc = spawn(spawnSpec.command, spawnSpec.args, {
|
|
218
|
-
cwd:
|
|
236
|
+
cwd: runCwd,
|
|
219
237
|
env: spawnEnv,
|
|
220
238
|
stdio: ["ignore", "pipe", "pipe"],
|
|
221
239
|
windowsHide: true,
|
|
@@ -797,6 +815,9 @@ export async function runSync(
|
|
|
797
815
|
options.preferredModelProvider,
|
|
798
816
|
options.currentModel,
|
|
799
817
|
);
|
|
818
|
+
const fastModeCwd = options.cwd ?? runtimeCwd;
|
|
819
|
+
const fastModeSettings = getSubagentCodexFastModeSettings(fastModeCwd);
|
|
820
|
+
const fastModeScope = resolveSubagentCodexFastModeScope(options.workflowStageSubagentGuard);
|
|
800
821
|
const attemptedModels: string[] = [];
|
|
801
822
|
const modelAttempts: ModelAttempt[] = [];
|
|
802
823
|
const aggregateUsage = emptyUsage();
|
|
@@ -832,6 +853,8 @@ export async function runSync(
|
|
|
832
853
|
artifactPaths: artifactPathsResult,
|
|
833
854
|
attemptNotes,
|
|
834
855
|
outputSnapshot,
|
|
856
|
+
fastModeSettings,
|
|
857
|
+
fastModeScope,
|
|
835
858
|
});
|
|
836
859
|
lastResult = result;
|
|
837
860
|
sumUsage(aggregateUsage, result.usage);
|
|
@@ -892,6 +915,7 @@ export async function runSync(
|
|
|
892
915
|
exitCode: result.exitCode,
|
|
893
916
|
usage: result.usage,
|
|
894
917
|
model: result.model,
|
|
918
|
+
fastMode: result.fastMode,
|
|
895
919
|
attemptedModels: result.attemptedModels,
|
|
896
920
|
modelAttempts: result.modelAttempts,
|
|
897
921
|
durationMs: result.progressSummary?.durationMs,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formatDuration, formatTokens, shortenPath } from "../../shared/formatters.ts";
|
|
2
2
|
import { formatActivityLabel } from "../../shared/status-format.ts";
|
|
3
|
-
import type { ActivityState, NestedRunSummary
|
|
3
|
+
import type { ActivityState, NestedRunSummary } from "../../shared/types.ts";
|
|
4
4
|
|
|
5
5
|
export interface NestedRunCounts {
|
|
6
6
|
total: number;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import type { CodexFastModeResolvedSettings, CodexFastModeScope } from "@bastani/atomic";
|
|
2
|
+
|
|
1
3
|
export interface RunnerSubagentStep {
|
|
2
4
|
agent: string;
|
|
3
5
|
task: string;
|
|
4
6
|
cwd?: string;
|
|
5
7
|
model?: string;
|
|
6
8
|
thinking?: string;
|
|
9
|
+
fastMode?: boolean;
|
|
10
|
+
modelFastModes?: Record<string, boolean>;
|
|
7
11
|
modelCandidates?: string[];
|
|
12
|
+
codexFastModeSettings?: CodexFastModeResolvedSettings;
|
|
13
|
+
codexFastModeScope?: CodexFastModeScope;
|
|
8
14
|
tools?: string[];
|
|
9
15
|
extensions?: string[];
|
|
10
16
|
mcpDirectTools?: string[];
|
|
@@ -75,6 +81,7 @@ export interface ParallelTaskResult {
|
|
|
75
81
|
exitCode: number | null;
|
|
76
82
|
error?: string;
|
|
77
83
|
model?: string;
|
|
84
|
+
fastMode?: boolean;
|
|
78
85
|
attemptedModels?: string[];
|
|
79
86
|
outputTargetPath?: string;
|
|
80
87
|
outputTargetExists?: boolean;
|