@bastani/atomic 0.8.21-0 → 0.8.22-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 +46 -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 +13 -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 +101 -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
|
@@ -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;
|
|
@@ -2,7 +2,13 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as os from "node:os";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
APP_NAME,
|
|
7
|
+
ENV_CODEX_FAST_MODE,
|
|
8
|
+
getEnvValue,
|
|
9
|
+
type CodexFastModeResolvedSettings,
|
|
10
|
+
type CodexFastModeScope,
|
|
11
|
+
} from "@bastani/atomic";
|
|
6
12
|
import { encodeNestedPathEnv, parseNestedPathEnv, type NestedPathEntry } from "./nested-path.ts";
|
|
7
13
|
import { resolveMcpDirectToolNames } from "./mcp-direct-tool-allowlist.ts";
|
|
8
14
|
|
|
@@ -60,6 +66,8 @@ interface BuildPiArgsInput {
|
|
|
60
66
|
parentDepth?: number;
|
|
61
67
|
parentPath?: NestedPathEntry[];
|
|
62
68
|
parentCapabilityToken?: string;
|
|
69
|
+
codexFastModeSettings?: CodexFastModeResolvedSettings;
|
|
70
|
+
codexFastModeScope?: CodexFastModeScope;
|
|
63
71
|
}
|
|
64
72
|
|
|
65
73
|
interface BuildPiArgsResult {
|
|
@@ -75,6 +83,20 @@ export function applyThinkingSuffix(model: string | undefined, thinking: string
|
|
|
75
83
|
return `${model}:${thinking}`;
|
|
76
84
|
}
|
|
77
85
|
|
|
86
|
+
function serializeChildCodexFastModeSettings(settings: CodexFastModeResolvedSettings): string {
|
|
87
|
+
return `chat=${settings.chat ? "1" : "0"};workflow=${settings.workflow ? "1" : "0"}`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function mapChildCodexFastModeSettings(
|
|
91
|
+
settings: CodexFastModeResolvedSettings,
|
|
92
|
+
scope: CodexFastModeScope,
|
|
93
|
+
): CodexFastModeResolvedSettings {
|
|
94
|
+
return {
|
|
95
|
+
chat: settings[scope],
|
|
96
|
+
workflow: settings.workflow,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
78
100
|
export function buildPiArgs(input: BuildPiArgsInput): BuildPiArgsResult {
|
|
79
101
|
const args = [...input.baseArgs];
|
|
80
102
|
|
|
@@ -155,6 +177,11 @@ export function buildPiArgs(input: BuildPiArgsInput): BuildPiArgsResult {
|
|
|
155
177
|
const env: Record<string, string | undefined> = {};
|
|
156
178
|
env[SUBAGENT_CHILD_ENV] = "1";
|
|
157
179
|
env[SUBAGENT_FANOUT_CHILD_ENV] = fanoutAuthorized ? "1" : "0";
|
|
180
|
+
if (input.codexFastModeSettings) {
|
|
181
|
+
env[ENV_CODEX_FAST_MODE] = serializeChildCodexFastModeSettings(
|
|
182
|
+
mapChildCodexFastModeSettings(input.codexFastModeSettings, input.codexFastModeScope ?? "chat"),
|
|
183
|
+
);
|
|
184
|
+
}
|
|
158
185
|
const parentEventSinkEnv = getEnvValue(SUBAGENT_PARENT_EVENT_SINK_ENV);
|
|
159
186
|
const parentControlInboxEnv = getEnvValue(SUBAGENT_PARENT_CONTROL_INBOX_ENV);
|
|
160
187
|
const parentRootRunIdEnv = getEnvValue(SUBAGENT_PARENT_ROOT_RUN_ID_ENV);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SettingsManager,
|
|
3
|
+
isCodexFastModeCandidateModelId,
|
|
4
|
+
shouldApplyCodexFastModeForScope,
|
|
5
|
+
type CodexFastModeResolvedSettings,
|
|
6
|
+
type CodexFastModeScope,
|
|
7
|
+
} from "@bastani/atomic";
|
|
8
|
+
import { splitKnownThinkingSuffix } from "./model-info.ts";
|
|
9
|
+
|
|
10
|
+
export interface ResolveSubagentModelFastModeInput {
|
|
11
|
+
model?: string;
|
|
12
|
+
cwd: string;
|
|
13
|
+
settings?: CodexFastModeResolvedSettings;
|
|
14
|
+
scope?: CodexFastModeScope;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ResolveSubagentModelFastModeMapInput {
|
|
18
|
+
models: readonly (string | undefined)[];
|
|
19
|
+
cwd: string;
|
|
20
|
+
settings?: CodexFastModeResolvedSettings;
|
|
21
|
+
scope?: CodexFastModeScope;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ResolveSubagentModelFastModeMetadataInput {
|
|
25
|
+
model?: string;
|
|
26
|
+
modelCandidates: readonly (string | undefined)[];
|
|
27
|
+
cwd: string;
|
|
28
|
+
settings?: CodexFastModeResolvedSettings;
|
|
29
|
+
scope?: CodexFastModeScope;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface SubagentModelFastModeMetadata {
|
|
33
|
+
fastMode?: true;
|
|
34
|
+
modelFastModes: Record<string, boolean>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function getSubagentCodexFastModeSettings(cwd: string): CodexFastModeResolvedSettings {
|
|
38
|
+
try {
|
|
39
|
+
return SettingsManager.create(cwd).getCodexFastModeSettings();
|
|
40
|
+
} catch {
|
|
41
|
+
return { chat: false, workflow: false };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function providerFromModelId(model: string | undefined): string | undefined {
|
|
46
|
+
if (!model) return undefined;
|
|
47
|
+
const { baseModel } = splitKnownThinkingSuffix(model);
|
|
48
|
+
if (!isCodexFastModeCandidateModelId(baseModel)) return undefined;
|
|
49
|
+
return baseModel.split("/", 1)[0];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function resolveSubagentCodexFastModeScope(workflowStageSubagentGuard: boolean | undefined): CodexFastModeScope {
|
|
53
|
+
return workflowStageSubagentGuard ? "workflow" : "chat";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function resolveSubagentModelFastMode(input: ResolveSubagentModelFastModeInput): boolean {
|
|
57
|
+
const provider = providerFromModelId(input.model);
|
|
58
|
+
if (!provider) return false;
|
|
59
|
+
const settings = input.settings ?? getSubagentCodexFastModeSettings(input.cwd);
|
|
60
|
+
return shouldApplyCodexFastModeForScope({ provider }, settings, input.scope ?? "chat");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function resolveSubagentModelFastModeMap(input: ResolveSubagentModelFastModeMapInput): Record<string, boolean> {
|
|
64
|
+
const settings = input.settings ?? getSubagentCodexFastModeSettings(input.cwd);
|
|
65
|
+
const fastModes: Record<string, boolean> = {};
|
|
66
|
+
for (const model of input.models) {
|
|
67
|
+
if (!model || Object.prototype.hasOwnProperty.call(fastModes, model)) continue;
|
|
68
|
+
fastModes[model] = resolveSubagentModelFastMode({ model, cwd: input.cwd, settings, scope: input.scope });
|
|
69
|
+
}
|
|
70
|
+
return fastModes;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function resolveSubagentModelFastModeMetadata(input: ResolveSubagentModelFastModeMetadataInput): SubagentModelFastModeMetadata {
|
|
74
|
+
const settings = input.settings ?? getSubagentCodexFastModeSettings(input.cwd);
|
|
75
|
+
const fastMode = resolveSubagentModelFastMode({ model: input.model, cwd: input.cwd, settings, scope: input.scope });
|
|
76
|
+
return {
|
|
77
|
+
...(fastMode ? { fastMode: true as const } : {}),
|
|
78
|
+
modelFastModes: resolveSubagentModelFastModeMap({ models: input.modelCandidates, cwd: input.cwd, settings, scope: input.scope }),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -16,7 +16,7 @@ export function formatTokens(n: number): string {
|
|
|
16
16
|
return n < 1000 ? String(n) : n < 10000 ? `${(n / 1000).toFixed(1)}k` : `${Math.round(n / 1000)}k`;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export function formatModelThinking(model?: string, thinking?: string): string {
|
|
19
|
+
export function formatModelThinking(model?: string, thinking?: string, fastMode?: boolean): string {
|
|
20
20
|
const parsed = model ? splitKnownThinkingSuffix(model) : undefined;
|
|
21
21
|
let displayModel = parsed?.baseModel ?? model;
|
|
22
22
|
const explicitThinking = THINKING_LEVELS.find((level) => level === thinking?.trim());
|
|
@@ -25,7 +25,9 @@ export function formatModelThinking(model?: string, thinking?: string): string {
|
|
|
25
25
|
const slashIdx = displayModel.lastIndexOf("/");
|
|
26
26
|
if (slashIdx !== -1) displayModel = displayModel.slice(slashIdx + 1);
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
const parts = [displayModel, displayThinking ? `thinking ${displayThinking}` : undefined].filter(Boolean);
|
|
29
|
+
if (fastMode && parts.length > 0) parts.push("fast");
|
|
30
|
+
return parts.join(" · ");
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
/**
|
|
@@ -211,6 +211,7 @@ export interface SingleResult {
|
|
|
211
211
|
messages?: Message[];
|
|
212
212
|
usage: Usage;
|
|
213
213
|
model?: string;
|
|
214
|
+
fastMode?: boolean;
|
|
214
215
|
attemptedModels?: string[];
|
|
215
216
|
modelAttempts?: ModelAttempt[];
|
|
216
217
|
controlEvents?: ControlEvent[];
|
|
@@ -416,6 +417,7 @@ export interface AsyncStatus {
|
|
|
416
417
|
skills?: string[];
|
|
417
418
|
model?: string;
|
|
418
419
|
thinking?: string;
|
|
420
|
+
fastMode?: boolean;
|
|
419
421
|
attemptedModels?: string[];
|
|
420
422
|
modelAttempts?: ModelAttempt[];
|
|
421
423
|
error?: string;
|
|
@@ -522,8 +524,8 @@ export interface SubagentState {
|
|
|
522
524
|
// Display
|
|
523
525
|
// ============================================================================
|
|
524
526
|
|
|
525
|
-
export type DisplayItem =
|
|
526
|
-
| { type: "text"; text: string }
|
|
527
|
+
export type DisplayItem =
|
|
528
|
+
| { type: "text"; text: string }
|
|
527
529
|
| { type: "tool"; name: string; args: Record<string, unknown> };
|
|
528
530
|
|
|
529
531
|
// ============================================================================
|