@bastani/atomic 0.9.14-alpha.4 → 0.9.14-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/schemas.ts +5 -0
- package/dist/builtin/subagents/src/runs/shared/long-running-guard.ts +3 -1
- package/dist/builtin/subagents/src/runs/shared/progress-trend.ts +69 -0
- package/dist/builtin/subagents/src/runs/shared/subagent-control.ts +12 -1
- package/dist/builtin/subagents/src/shared/types-results.ts +2 -0
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +41 -1
- package/dist/builtin/workflows/README.md +6 -5
- package/dist/builtin/workflows/builtin/adversarial-verification-prompts.ts +13 -5
- package/dist/builtin/workflows/builtin/adversarial-verification-runner.ts +376 -89
- package/dist/builtin/workflows/builtin/adversarial-verification.d.ts +30 -6
- package/dist/builtin/workflows/builtin/adversarial-verification.ts +14 -9
- package/dist/builtin/workflows/builtin/generate-and-filter-prompts.ts +26 -3
- package/dist/builtin/workflows/builtin/generate-and-filter-runner.ts +18 -14
- package/dist/builtin/workflows/builtin/goal-artifacts.ts +9 -8
- package/dist/builtin/workflows/builtin/goal-convergence.ts +87 -0
- package/dist/builtin/workflows/builtin/goal-ledger.ts +4 -0
- package/dist/builtin/workflows/builtin/goal-prompts.ts +2 -0
- package/dist/builtin/workflows/builtin/goal-reducer.ts +6 -1
- package/dist/builtin/workflows/builtin/goal-reverify.ts +305 -0
- package/dist/builtin/workflows/builtin/goal-runner.ts +75 -10
- package/dist/builtin/workflows/builtin/goal-schemas.ts +7 -0
- package/dist/builtin/workflows/builtin/goal-types.ts +6 -0
- package/dist/builtin/workflows/builtin/loop-until-done-runner.ts +94 -6
- package/dist/builtin/workflows/builtin/loop-until-done.d.ts +8 -0
- package/dist/builtin/workflows/builtin/loop-until-done.ts +15 -0
- package/dist/builtin/workflows/builtin/progress-scoring.ts +230 -0
- package/dist/builtin/workflows/builtin/ralph-core.ts +11 -0
- package/dist/builtin/workflows/builtin/ralph-review-gate.ts +1 -0
- package/dist/builtin/workflows/builtin/ralph-reviewer-prompt.ts +2 -0
- package/dist/builtin/workflows/builtin/ralph-runner.ts +60 -10
- package/dist/builtin/workflows/builtin/selection-math.ts +156 -0
- package/dist/builtin/workflows/builtin/shared-prompts.ts +5 -0
- package/dist/builtin/workflows/builtin/tournament-prompts.ts +57 -75
- package/dist/builtin/workflows/builtin/tournament-runner.ts +384 -178
- package/dist/builtin/workflows/builtin/tournament.d.ts +46 -17
- package/dist/builtin/workflows/builtin/tournament.ts +66 -32
- package/dist/builtin/workflows/builtin/verification-criteria.ts +330 -0
- package/dist/builtin/workflows/builtin/verification-prompts.ts +206 -0
- package/dist/builtin/workflows/builtin/verification-usage.ts +44 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/skills/create-spec/SKILL.md +90 -30
- package/dist/builtin/workflows/skills/show-me/LICENSE.txt +21 -0
- package/dist/builtin/workflows/skills/show-me/SKILL.md +143 -0
- package/dist/builtin/workflows/src/authoring/workflow.ts +8 -0
- package/dist/builtin/workflows/src/authoring.d.ts +1 -1
- package/dist/builtin/workflows/src/durable/completed-catalog.ts +5 -2
- package/dist/builtin/workflows/src/durable/dbos-envelope.ts +1 -1
- package/dist/builtin/workflows/src/durable/resume-eligibility.ts +5 -3
- package/dist/builtin/workflows/src/durable/run-timing.ts +41 -10
- package/dist/builtin/workflows/src/durable/tool-primitive.ts +24 -2
- package/dist/builtin/workflows/src/engine/options.ts +1 -0
- package/dist/builtin/workflows/src/engine/primitives/workflow.ts +12 -3
- package/dist/builtin/workflows/src/engine/run-budget.ts +308 -0
- package/dist/builtin/workflows/src/engine/run-returned-status.ts +8 -0
- package/dist/builtin/workflows/src/engine/run-tool-node-lifecycle.ts +6 -0
- package/dist/builtin/workflows/src/engine/run.ts +124 -2
- package/dist/builtin/workflows/src/engine/runtime.ts +9 -0
- package/dist/builtin/workflows/src/extension/config-file-loader.ts +6 -0
- package/dist/builtin/workflows/src/extension/config-loader.ts +24 -1
- package/dist/builtin/workflows/src/extension/dispatcher.ts +6 -5
- package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +2 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +2975 -843
- package/dist/builtin/workflows/src/extension/lifecycle-notifications.ts +51 -4
- package/dist/builtin/workflows/src/extension/public-types.ts +3 -1
- package/dist/builtin/workflows/src/extension/runtime-durable-resume.ts +7 -1
- package/dist/builtin/workflows/src/extension/runtime.ts +22 -10
- package/dist/builtin/workflows/src/extension/workflow-module-loader.ts +5 -0
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +1 -0
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +16 -0
- package/dist/builtin/workflows/src/extension/workflow-status-summary.ts +44 -1
- package/dist/builtin/workflows/src/extension/workflow-tool-content.ts +10 -1
- package/dist/builtin/workflows/src/extension/workflow-tool-control.ts +21 -9
- package/dist/builtin/workflows/src/runs/foreground/executor-continuation.ts +14 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-lifecycle.ts +15 -4
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +62 -5
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +4 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-types.ts +2 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +3 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +10 -1
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +1 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +1 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +7 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +7 -0
- package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +1 -0
- package/dist/builtin/workflows/src/shared/budget-meter.ts +34 -0
- package/dist/builtin/workflows/src/shared/budget.d.ts +67 -0
- package/dist/builtin/workflows/src/shared/budget.ts +127 -0
- package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +92 -8
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +11 -1
- package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +15 -3
- package/dist/builtin/workflows/src/shared/returned-run-status.ts +35 -2
- package/dist/builtin/workflows/src/shared/store-public-types.ts +4 -1
- package/dist/builtin/workflows/src/shared/store-run-methods.ts +8 -1
- package/dist/builtin/workflows/src/shared/store-stage-methods.ts +1 -0
- package/dist/builtin/workflows/src/shared/store-types.ts +24 -0
- package/dist/builtin/workflows/src/shared/types.ts +3 -0
- package/dist/builtin/workflows/src/shared/workflow-artifacts.ts +1 -0
- package/dist/builtin/workflows/src/shared/workflow-authoring-types.d.ts +3 -0
- package/dist/builtin/workflows/src/shared/workflow-authoring-types.ts +3 -0
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +1 -0
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/extensions/ui-types.d.ts +13 -3
- package/dist/core/extensions/ui-types.d.ts.map +1 -1
- package/dist/core/extensions/ui-types.js +15 -3
- package/dist/core/extensions/ui-types.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +33 -3
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/main-deferred-startup.d.ts.map +1 -1
- package/dist/main-deferred-startup.js +6 -2
- package/dist/main-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +4 -0
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-tui.js +19 -1
- package/dist/modes/interactive/interactive-tui.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +7 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +94 -37
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +1 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +15 -2
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-input-scheduler.d.ts +3 -2
- package/dist/modes/rpc/rpc-input-scheduler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-input-scheduler.js +5 -2
- package/dist/modes/rpc/rpc-input-scheduler.js.map +1 -1
- package/docs/extensions.md +1 -1
- package/docs/quickstart.md +1 -0
- package/docs/skills.md +4 -0
- package/docs/workflows.md +74 -10
- package/npm-shrinkwrap.json +29 -29
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { validateWorkflowBudget } from "../shared/budget.js";
|
|
1
2
|
import type { ConfigDiagnostic, WorkflowExtensionConfig } from "./config-loader.js";
|
|
2
3
|
import { WORKFLOW_LIFECYCLE_NOTICE_KINDS, type WorkflowLifecycleNoticeKind } from "./lifecycle-notifications.js";
|
|
3
4
|
|
|
@@ -63,6 +64,11 @@ function validateConfig(value: unknown): string | null {
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
if ("budget" in c) {
|
|
68
|
+
const reason = validateWorkflowBudget(c.budget, "budget");
|
|
69
|
+
if (reason !== null) return reason;
|
|
70
|
+
}
|
|
71
|
+
|
|
66
72
|
if ("workflowNotifications" in c) {
|
|
67
73
|
const value = c.workflowNotifications;
|
|
68
74
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import { isAbsolute, join } from "node:path";
|
|
20
20
|
import { CONFIG_DIR_NAME, CONFIG_DIR_NAMES, getAgentDir, getAgentDirs, getProjectConfigPaths } from "@bastani/atomic";
|
|
21
|
+
import { type EffectiveBudget, resolve_budget, type WorkflowBudget } from "../shared/budget.js";
|
|
21
22
|
import { loadConfigFile } from "./config-file-loader.js";
|
|
22
23
|
import type { WorkflowLifecycleNoticeKind } from "./lifecycle-notifications.js";
|
|
23
24
|
|
|
@@ -49,6 +50,8 @@ export interface WorkflowWorktreeConfig {
|
|
|
49
50
|
export interface WorkflowExtensionConfig {
|
|
50
51
|
/** Explicit named workflows to register by module path. */
|
|
51
52
|
readonly workflows?: Readonly<Record<string, WorkflowConfigEntry>>;
|
|
53
|
+
/** Default budget for every workflow run. Each `0` disables its dimension. */
|
|
54
|
+
readonly budget?: WorkflowBudget;
|
|
52
55
|
/** Maximum workflow recursion depth. Default: 4. */
|
|
53
56
|
readonly maxDepth?: number;
|
|
54
57
|
/** Default stage concurrency. Default: 4. */
|
|
@@ -135,6 +138,7 @@ export interface LoadWorkflowConfigOpts {
|
|
|
135
138
|
function mergeConfigs(base: WorkflowExtensionConfig, override: WorkflowExtensionConfig): WorkflowExtensionConfig {
|
|
136
139
|
const workflows =
|
|
137
140
|
base.workflows || override.workflows ? { ...(base.workflows ?? {}), ...(override.workflows ?? {}) } : undefined;
|
|
141
|
+
const budget = base.budget || override.budget ? { ...(base.budget ?? {}), ...(override.budget ?? {}) } : undefined;
|
|
138
142
|
|
|
139
143
|
return {
|
|
140
144
|
...(base.maxDepth !== undefined || override.maxDepth !== undefined
|
|
@@ -163,6 +167,7 @@ function mergeConfigs(base: WorkflowExtensionConfig, override: WorkflowExtension
|
|
|
163
167
|
...(base.worktree !== undefined || override.worktree !== undefined
|
|
164
168
|
? { worktree: { ...(base.worktree ?? {}), ...(override.worktree ?? {}) } }
|
|
165
169
|
: {}),
|
|
170
|
+
...(budget !== undefined ? { budget } : {}),
|
|
166
171
|
...(workflows !== undefined ? { workflows } : {}),
|
|
167
172
|
};
|
|
168
173
|
}
|
|
@@ -184,9 +189,25 @@ export const WORKFLOW_CONFIG_DEFAULTS = {
|
|
|
184
189
|
persistRuns: true,
|
|
185
190
|
statusFile: false,
|
|
186
191
|
resumeInFlight: "ask" as const,
|
|
192
|
+
budget: {
|
|
193
|
+
maxDurationMs: 0,
|
|
194
|
+
maxTokens: 0,
|
|
195
|
+
maxCost: 0,
|
|
196
|
+
warnAtPercent: 80,
|
|
197
|
+
},
|
|
187
198
|
workflowNotifications: {
|
|
188
199
|
enabled: true,
|
|
189
|
-
notifyOn: [
|
|
200
|
+
notifyOn: [
|
|
201
|
+
"started",
|
|
202
|
+
"completed",
|
|
203
|
+
"failed",
|
|
204
|
+
"blocked",
|
|
205
|
+
"budget_warning",
|
|
206
|
+
"awaiting_input",
|
|
207
|
+
"paused",
|
|
208
|
+
"quit",
|
|
209
|
+
"resumed",
|
|
210
|
+
] as const,
|
|
190
211
|
},
|
|
191
212
|
worktree: {
|
|
192
213
|
symlinkDirectories: ["node_modules"] as readonly string[],
|
|
@@ -203,6 +224,7 @@ export interface WorkflowEffectiveConfig {
|
|
|
203
224
|
readonly persistRuns: boolean;
|
|
204
225
|
readonly statusFile: boolean;
|
|
205
226
|
readonly resumeInFlight: "ask" | "auto" | "never";
|
|
227
|
+
readonly budget: EffectiveBudget;
|
|
206
228
|
readonly workflowNotifications: {
|
|
207
229
|
readonly enabled: boolean;
|
|
208
230
|
readonly notifyOn: readonly WorkflowLifecycleNoticeKind[];
|
|
@@ -226,6 +248,7 @@ export function withWorkflowDefaults(config: WorkflowExtensionConfig): WorkflowE
|
|
|
226
248
|
persistRuns: config.persistRuns ?? WORKFLOW_CONFIG_DEFAULTS.persistRuns,
|
|
227
249
|
statusFile: config.statusFile ?? WORKFLOW_CONFIG_DEFAULTS.statusFile,
|
|
228
250
|
resumeInFlight: config.resumeInFlight ?? WORKFLOW_CONFIG_DEFAULTS.resumeInFlight,
|
|
251
|
+
budget: resolve_budget({ config: config.budget ?? WORKFLOW_CONFIG_DEFAULTS.budget }),
|
|
229
252
|
workflowNotifications: {
|
|
230
253
|
enabled: config.workflowNotifications?.enabled ?? WORKFLOW_CONFIG_DEFAULTS.workflowNotifications.enabled,
|
|
231
254
|
notifyOn: config.workflowNotifications?.notifyOn ?? WORKFLOW_CONFIG_DEFAULTS.workflowNotifications.notifyOn,
|
|
@@ -13,6 +13,7 @@ import { jobTracker as defaultJobTracker, type JobTracker } from "../runs/backgr
|
|
|
13
13
|
import { launchDetachedUntilStartup, workflowStartupFailureMessage } from "../runs/background/startup-admission.js";
|
|
14
14
|
import { resolveAndValidateInputs } from "../runs/foreground/executor.js";
|
|
15
15
|
import type { StageAdapters } from "../runs/foreground/stage-runner.js";
|
|
16
|
+
import { resolve_budget } from "../shared/budget.js";
|
|
16
17
|
import { effectiveRunStatus } from "../shared/returned-run-status.js";
|
|
17
18
|
import { deriveInputFields, schemaIsRequired } from "../shared/schema-introspection.js";
|
|
18
19
|
import { store as defaultStore, type Store } from "../shared/store.js";
|
|
@@ -163,13 +164,12 @@ export async function dispatch(args: WorkflowToolArgs, opts: DispatcherOpts): Pr
|
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
const policy = opts.policy ?? INTERACTIVE_WORKFLOW_POLICY;
|
|
166
|
-
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
// background promise — silently from the caller's perspective. Catch
|
|
170
|
-
// it here so the dispatch result names what's missing.
|
|
167
|
+
// Pre-validate inputs and budget declarations. The executor would otherwise
|
|
168
|
+
// reject them deep in the background promise, silently from the caller's
|
|
169
|
+
// perspective. Catch errors here so the dispatch result names the problem.
|
|
171
170
|
try {
|
|
172
171
|
resolveAndValidateInputs(def.inputs, inputs, `workflow "${def.name}"`);
|
|
172
|
+
resolve_budget({ config: opts.config?.budget, definition: def.budget, run: args.budget });
|
|
173
173
|
} catch (err) {
|
|
174
174
|
return failedRunResult(def.name, "", err instanceof Error ? err.message : String(err));
|
|
175
175
|
}
|
|
@@ -186,6 +186,7 @@ export async function dispatch(args: WorkflowToolArgs, opts: DispatcherOpts): Pr
|
|
|
186
186
|
persistence: opts.persistence,
|
|
187
187
|
mcp: opts.mcp,
|
|
188
188
|
config: opts.config,
|
|
189
|
+
budget: args.budget,
|
|
189
190
|
models: opts.models,
|
|
190
191
|
executionMode: policy.mode,
|
|
191
192
|
cwd: opts.cwd,
|
|
@@ -127,6 +127,7 @@ export function createWorkflowExtensionRuntimeState(
|
|
|
127
127
|
persistRuns: WORKFLOW_CONFIG_DEFAULTS.persistRuns,
|
|
128
128
|
statusFile: WORKFLOW_CONFIG_DEFAULTS.statusFile,
|
|
129
129
|
resumeInFlight: WORKFLOW_CONFIG_DEFAULTS.resumeInFlight,
|
|
130
|
+
budget: withWorkflowDefaults({}).budget,
|
|
130
131
|
worktree: WORKFLOW_CONFIG_DEFAULTS.worktree,
|
|
131
132
|
},
|
|
132
133
|
};
|
|
@@ -355,6 +356,7 @@ export function createWorkflowExtensionRuntimeState(
|
|
|
355
356
|
persistRuns: effectiveConfig.persistRuns,
|
|
356
357
|
statusFile: effectiveConfig.statusFile,
|
|
357
358
|
resumeInFlight: effectiveConfig.resumeInFlight,
|
|
359
|
+
budget: effectiveConfig.budget,
|
|
358
360
|
worktree: effectiveConfig.worktree,
|
|
359
361
|
};
|
|
360
362
|
lifecycleNotificationConfigRef.current = effectiveConfig.workflowNotifications;
|