@bastani/atomic 0.8.19 → 0.8.20
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 +19 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/CHANGELOG.md +10 -0
- package/dist/builtin/mcp/package.json +2 -2
- package/dist/builtin/subagents/CHANGELOG.md +17 -2
- package/dist/builtin/subagents/agents/code-simplifier.md +1 -1
- package/dist/builtin/subagents/agents/codebase-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/debugger.md +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/subagent/SKILL.md +12 -12
- package/dist/builtin/subagents/src/agents/agent-management.ts +16 -11
- package/dist/builtin/subagents/src/agents/skills.ts +13 -1
- package/dist/builtin/subagents/src/extension/index.ts +14 -3
- package/dist/builtin/subagents/src/runs/background/async-execution.ts +8 -0
- package/dist/builtin/subagents/src/runs/background/run-status.ts +2 -3
- package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +11 -1
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify.ts +2 -2
- package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +31 -23
- package/dist/builtin/subagents/src/runs/foreground/execution.ts +13 -7
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +160 -93
- package/dist/builtin/subagents/src/runs/shared/parallel-utils.ts +1 -0
- package/dist/builtin/subagents/src/runs/shared/run-history.ts +1 -1
- package/dist/builtin/subagents/src/shared/settings.ts +1 -0
- package/dist/builtin/subagents/src/shared/types.ts +78 -4
- package/dist/builtin/subagents/src/tui/render.ts +203 -19
- package/dist/builtin/web-access/CHANGELOG.md +10 -0
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +25 -0
- package/dist/builtin/workflows/README.md +22 -3
- package/dist/builtin/workflows/builtin/deep-research-codebase.ts +1 -1
- package/dist/builtin/workflows/builtin/open-claude-design.ts +12 -4
- package/dist/builtin/workflows/builtin/ralph.ts +2 -2
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/config-loader.ts +68 -0
- package/dist/builtin/workflows/src/extension/index.ts +246 -55
- package/dist/builtin/workflows/src/extension/lifecycle-notifications.ts +372 -0
- package/dist/builtin/workflows/src/extension/render-call.ts +1 -1
- package/dist/builtin/workflows/src/extension/wiring.ts +32 -3
- package/dist/builtin/workflows/src/runs/background/status.ts +14 -74
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +5 -3
- package/dist/builtin/workflows/src/tui/chat-surface-message.ts +3 -13
- package/dist/builtin/workflows/src/tui/inline-form-overlay.ts +2 -10
- package/dist/builtin/workflows/src/tui/overlay-adapter.ts +5 -5
- package/dist/builtin/workflows/src/tui/session-confirm.ts +6 -7
- package/dist/builtin/workflows/src/tui/session-picker.ts +18 -14
- package/dist/builtin/workflows/src/tui/status-list.ts +2 -2
- package/dist/builtin/workflows/src/tui/store-widget-installer.ts +125 -30
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +4 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -1
- 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 +3 -2
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +6 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +13 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +63 -17
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js +29 -0
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/sdk.d.ts +3 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +1 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +1 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +46 -13
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/pi-user-agent.d.ts.map +1 -1
- package/dist/utils/pi-user-agent.js +2 -1
- package/dist/utils/pi-user-agent.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +1 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +3 -5
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/models.md +52 -52
- package/docs/quickstart.md +2 -2
- package/docs/workflows.md +22 -5
- package/package.json +9 -9
|
@@ -61,6 +61,23 @@ import {
|
|
|
61
61
|
import { resolveModelCandidate } from "../shared/model-fallback.ts";
|
|
62
62
|
import { validateFileOnlyOutputMode } from "../shared/single-output.ts";
|
|
63
63
|
|
|
64
|
+
type RunSyncDependency = typeof runSync;
|
|
65
|
+
|
|
66
|
+
type ChainForegroundControl = {
|
|
67
|
+
updatedAt: number;
|
|
68
|
+
currentAgent?: string;
|
|
69
|
+
currentIndex?: number;
|
|
70
|
+
currentActivityState?: ActivityState;
|
|
71
|
+
lastActivityAt?: number;
|
|
72
|
+
currentTool?: string;
|
|
73
|
+
currentToolStartedAt?: number;
|
|
74
|
+
currentPath?: string;
|
|
75
|
+
turnCount?: number;
|
|
76
|
+
tokens?: number;
|
|
77
|
+
toolCount?: number;
|
|
78
|
+
interrupt?: () => boolean;
|
|
79
|
+
};
|
|
80
|
+
|
|
64
81
|
interface ChainExecutionDetailsInput {
|
|
65
82
|
results: SingleResult[];
|
|
66
83
|
includeProgress?: boolean;
|
|
@@ -98,23 +115,16 @@ interface ParallelChainRunInput {
|
|
|
98
115
|
controlConfig: ResolvedControlConfig;
|
|
99
116
|
childIntercomTarget?: (agent: string, index: number) => string | undefined;
|
|
100
117
|
orchestratorIntercomTarget?: string;
|
|
101
|
-
foregroundControl?:
|
|
102
|
-
updatedAt: number;
|
|
103
|
-
currentAgent?: string;
|
|
104
|
-
currentIndex?: number;
|
|
105
|
-
currentActivityState?: ActivityState;
|
|
106
|
-
lastActivityAt?: number;
|
|
107
|
-
currentTool?: string;
|
|
108
|
-
currentToolStartedAt?: number;
|
|
109
|
-
interrupt?: () => boolean;
|
|
110
|
-
};
|
|
118
|
+
foregroundControl?: ChainForegroundControl;
|
|
111
119
|
results: SingleResult[];
|
|
112
120
|
allProgress: AgentProgress[];
|
|
113
121
|
chainAgents: string[];
|
|
114
122
|
totalSteps: number;
|
|
115
123
|
worktreeSetup?: WorktreeSetup;
|
|
116
124
|
maxSubagentDepth: number;
|
|
125
|
+
workflowStageSubagentGuard?: boolean;
|
|
117
126
|
nestedRoute?: NestedRouteInfo;
|
|
127
|
+
runSync: RunSyncDependency;
|
|
118
128
|
}
|
|
119
129
|
|
|
120
130
|
function buildChainExecutionDetails(input: ChainExecutionDetailsInput): Details {
|
|
@@ -227,7 +237,7 @@ async function runParallelChainTasks(input: ParallelChainRunInput): Promise<Sing
|
|
|
227
237
|
};
|
|
228
238
|
}
|
|
229
239
|
|
|
230
|
-
const result = await runSync(input.ctx.cwd, input.agents, task.agent, taskStr, {
|
|
240
|
+
const result = await input.runSync(input.ctx.cwd, input.agents, task.agent, taskStr, {
|
|
231
241
|
cwd: taskCwd,
|
|
232
242
|
signal: input.signal,
|
|
233
243
|
interruptSignal: interruptController.signal,
|
|
@@ -243,6 +253,7 @@ async function runParallelChainTasks(input: ParallelChainRunInput): Promise<Sing
|
|
|
243
253
|
outputPath,
|
|
244
254
|
outputMode: behavior.outputMode,
|
|
245
255
|
maxSubagentDepth,
|
|
256
|
+
workflowStageSubagentGuard: input.workflowStageSubagentGuard,
|
|
246
257
|
controlConfig: input.controlConfig,
|
|
247
258
|
onControlEvent: input.onControlEvent,
|
|
248
259
|
intercomSessionName: input.childIntercomTarget?.(task.agent, input.globalTaskIndex + taskIndex),
|
|
@@ -323,22 +334,15 @@ interface ChainExecutionParams {
|
|
|
323
334
|
controlConfig: ResolvedControlConfig;
|
|
324
335
|
childIntercomTarget?: (agent: string, index: number) => string | undefined;
|
|
325
336
|
orchestratorIntercomTarget?: string;
|
|
326
|
-
foregroundControl?:
|
|
327
|
-
updatedAt: number;
|
|
328
|
-
currentAgent?: string;
|
|
329
|
-
currentIndex?: number;
|
|
330
|
-
currentActivityState?: ActivityState;
|
|
331
|
-
lastActivityAt?: number;
|
|
332
|
-
currentTool?: string;
|
|
333
|
-
currentToolStartedAt?: number;
|
|
334
|
-
interrupt?: () => boolean;
|
|
335
|
-
};
|
|
337
|
+
foregroundControl?: ChainForegroundControl;
|
|
336
338
|
chainSkills?: string[];
|
|
337
339
|
chainDir?: string;
|
|
338
340
|
maxSubagentDepth: number;
|
|
341
|
+
workflowStageSubagentGuard?: boolean;
|
|
339
342
|
nestedRoute?: NestedRouteInfo;
|
|
340
343
|
worktreeSetupHook?: string;
|
|
341
344
|
worktreeSetupHookTimeoutMs?: number;
|
|
345
|
+
runSync?: RunSyncDependency;
|
|
342
346
|
}
|
|
343
347
|
|
|
344
348
|
interface ChainExecutionResult {
|
|
@@ -356,6 +360,7 @@ interface ChainExecutionResult {
|
|
|
356
360
|
* Execute a chain of subagent steps
|
|
357
361
|
*/
|
|
358
362
|
export async function executeChain(params: ChainExecutionParams): Promise<ChainExecutionResult> {
|
|
363
|
+
const executeRunSync = params.runSync ?? runSync;
|
|
359
364
|
const {
|
|
360
365
|
chain: chainSteps,
|
|
361
366
|
agents,
|
|
@@ -402,9 +407,9 @@ export async function executeChain(params: ChainExecutionParams): Promise<ChainE
|
|
|
402
407
|
const shouldClarify = clarify !== false && ctx.hasUI && !hasParallelSteps;
|
|
403
408
|
let tuiBehaviorOverrides: (BehaviorOverride | undefined)[] | undefined;
|
|
404
409
|
const availableModels: ModelInfo[] = ctx.modelRegistry.getAvailable().map(toModelInfo);
|
|
405
|
-
const availableSkills = discoverAvailableSkills(cwd ?? ctx.cwd);
|
|
406
410
|
|
|
407
411
|
if (shouldClarify) {
|
|
412
|
+
const availableSkills = discoverAvailableSkills(cwd ?? ctx.cwd);
|
|
408
413
|
const seqSteps = chainSteps as SequentialStep[];
|
|
409
414
|
const agentConfigs: AgentConfig[] = [];
|
|
410
415
|
for (const step of seqSteps) {
|
|
@@ -600,6 +605,8 @@ export async function executeChain(params: ChainExecutionParams): Promise<ChainE
|
|
|
600
605
|
nestedRoute: params.nestedRoute,
|
|
601
606
|
worktreeSetup,
|
|
602
607
|
maxSubagentDepth: params.maxSubagentDepth,
|
|
608
|
+
workflowStageSubagentGuard: params.workflowStageSubagentGuard,
|
|
609
|
+
runSync: executeRunSync,
|
|
603
610
|
});
|
|
604
611
|
globalTaskIndex += step.parallel.length;
|
|
605
612
|
|
|
@@ -780,7 +787,7 @@ export async function executeChain(params: ChainExecutionParams): Promise<ChainE
|
|
|
780
787
|
};
|
|
781
788
|
}
|
|
782
789
|
|
|
783
|
-
const r = await
|
|
790
|
+
const r = await executeRunSync(ctx.cwd, agents, seqStep.agent, stepTask, {
|
|
784
791
|
cwd: resolveChildCwd(cwd ?? ctx.cwd, seqStep.cwd),
|
|
785
792
|
signal,
|
|
786
793
|
interruptSignal: interruptController.signal,
|
|
@@ -796,6 +803,7 @@ export async function executeChain(params: ChainExecutionParams): Promise<ChainE
|
|
|
796
803
|
outputPath,
|
|
797
804
|
outputMode: behavior.outputMode,
|
|
798
805
|
maxSubagentDepth,
|
|
806
|
+
workflowStageSubagentGuard: params.workflowStageSubagentGuard,
|
|
799
807
|
controlConfig,
|
|
800
808
|
onControlEvent,
|
|
801
809
|
intercomSessionName: childIntercomTarget?.(seqStep.agent, globalTaskIndex),
|
|
@@ -203,7 +203,13 @@ async function runSingleAttempt(
|
|
|
203
203
|
lastActivityAt: startTime,
|
|
204
204
|
};
|
|
205
205
|
result.progress = progress;
|
|
206
|
-
const spawnEnv = {
|
|
206
|
+
const spawnEnv = {
|
|
207
|
+
...process.env,
|
|
208
|
+
...sharedEnv,
|
|
209
|
+
...getSubagentDepthEnv(options.maxSubagentDepth, {
|
|
210
|
+
workflowStageSubagentGuard: options.workflowStageSubagentGuard,
|
|
211
|
+
}),
|
|
212
|
+
};
|
|
207
213
|
let observedMutationAttempt = false;
|
|
208
214
|
|
|
209
215
|
const exitCode = await new Promise<number>((resolve) => {
|
|
@@ -405,7 +411,7 @@ async function runSingleAttempt(
|
|
|
405
411
|
const fireUpdate = () => {
|
|
406
412
|
if (!options.onUpdate || processClosed) return;
|
|
407
413
|
progress.durationMs = Date.now() - startTime;
|
|
408
|
-
emitUpdateSnapshot(getFinalOutput(result.messages) || "(running...)");
|
|
414
|
+
emitUpdateSnapshot(getFinalOutput(result.messages ?? []) || "(running...)");
|
|
409
415
|
};
|
|
410
416
|
|
|
411
417
|
const processLine = (line: string) => {
|
|
@@ -458,7 +464,7 @@ async function runSingleAttempt(
|
|
|
458
464
|
}
|
|
459
465
|
|
|
460
466
|
if (evt.type === "message_end" && evt.message) {
|
|
461
|
-
result.messages
|
|
467
|
+
result.messages?.push(evt.message);
|
|
462
468
|
if (evt.message.role === "assistant") {
|
|
463
469
|
result.usage.turns++;
|
|
464
470
|
progress.turnCount = result.usage.turns;
|
|
@@ -490,7 +496,7 @@ async function runSingleAttempt(
|
|
|
490
496
|
}
|
|
491
497
|
|
|
492
498
|
if (evt.type === "tool_result_end" && evt.message) {
|
|
493
|
-
result.messages
|
|
499
|
+
result.messages?.push(evt.message);
|
|
494
500
|
const resultText = extractTextFromContent(evt.message.content);
|
|
495
501
|
appendRecentOutput(progress, resultText.split("\n").slice(-10));
|
|
496
502
|
const toolSnapshot = pendingToolResult;
|
|
@@ -647,7 +653,7 @@ async function runSingleAttempt(
|
|
|
647
653
|
result.exitCode = 1;
|
|
648
654
|
}
|
|
649
655
|
if (result.exitCode === 0 && !result.error) {
|
|
650
|
-
const errInfo = detectSubagentError(result.messages);
|
|
656
|
+
const errInfo = detectSubagentError(result.messages ?? []);
|
|
651
657
|
if (errInfo.hasError) {
|
|
652
658
|
result.exitCode = errInfo.exitCode ?? 1;
|
|
653
659
|
result.error = errInfo.details
|
|
@@ -671,12 +677,12 @@ async function runSingleAttempt(
|
|
|
671
677
|
durationMs: progress.durationMs,
|
|
672
678
|
};
|
|
673
679
|
|
|
674
|
-
let fullOutput = getFinalOutput(result.messages);
|
|
680
|
+
let fullOutput = getFinalOutput(result.messages ?? []);
|
|
675
681
|
const completionGuard = result.exitCode === 0 && !result.error && agent.completionGuard !== false
|
|
676
682
|
? evaluateCompletionMutationGuard({
|
|
677
683
|
agent: agent.name,
|
|
678
684
|
task,
|
|
679
|
-
messages: result.messages,
|
|
685
|
+
messages: result.messages ?? [],
|
|
680
686
|
tools: agent.tools,
|
|
681
687
|
mcpDirectTools: agent.mcpDirectTools,
|
|
682
688
|
})
|