intentdna 1.8.5 → 1.8.7
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -0
- package/dist/cli/commands/run-lifecycle.d.ts +73 -0
- package/dist/cli/commands/run-lifecycle.js +240 -0
- package/dist/cli/commands/run.d.ts +22 -40
- package/dist/cli/commands/run.js +674 -392
- package/dist/cli/commands/sync.js +9 -4
- package/dist/cli/commands/verify.js +1 -1
- package/dist/cli/index.js +87 -2
- package/dist/compiler/workflow.js +3 -2
- package/dist/hooks/cli.d.ts +1 -2
- package/dist/hooks/cli.js +119 -80
- package/dist/hooks/enforce.d.ts +2 -0
- package/dist/hooks/enforce.js +56 -27
- package/dist/hooks/enforcement-boundary.d.ts +13 -0
- package/dist/hooks/enforcement-boundary.js +33 -0
- package/dist/hooks/index.d.ts +3 -2
- package/dist/hooks/index.js +3 -2
- package/dist/hooks/protocol.d.ts +12 -4
- package/dist/hooks/protocol.js +20 -14
- package/dist/hooks/schema.d.ts +2 -1
- package/dist/hooks/schema.js +6 -2
- package/dist/hooks/state-manager.d.ts +5 -5
- package/dist/hooks/state-manager.js +26 -24
- package/dist/hooks/state.d.ts +19 -3
- package/dist/hooks/state.js +327 -80
- package/dist/mcp/index.js +0 -0
- package/dist/runtime/claude-sync-target.js +8 -3
- package/dist/runtime/diagnosis-contract-verifier.d.ts +11 -0
- package/dist/runtime/diagnosis-contract-verifier.js +417 -0
- package/dist/runtime/execution-provider.d.ts +40 -0
- package/dist/runtime/execution-provider.js +138 -0
- package/dist/runtime/handoff-resolver.d.ts +61 -0
- package/dist/runtime/handoff-resolver.js +167 -0
- package/dist/runtime/index.d.ts +24 -0
- package/dist/runtime/index.js +13 -0
- package/dist/runtime/process-tree.d.ts +47 -0
- package/dist/runtime/process-tree.js +402 -0
- package/dist/runtime/providers/claude.d.ts +9 -0
- package/dist/runtime/providers/claude.js +64 -0
- package/dist/runtime/providers/codex.d.ts +8 -0
- package/dist/runtime/providers/codex.js +72 -0
- package/dist/runtime/result-store.d.ts +32 -0
- package/dist/runtime/result-store.js +130 -0
- package/dist/runtime/run-contracts.d.ts +290 -0
- package/dist/runtime/run-contracts.js +58 -0
- package/dist/runtime/run-controller.d.ts +149 -0
- package/dist/runtime/run-controller.js +1108 -0
- package/dist/runtime/run-store.d.ts +96 -0
- package/dist/runtime/run-store.js +725 -0
- package/dist/runtime/worker-executor.d.ts +19 -0
- package/dist/runtime/worker-executor.js +194 -0
- package/dist/runtime/workflow-plan-adapter.d.ts +26 -0
- package/dist/runtime/workflow-plan-adapter.js +416 -0
- package/dist/runtime/workflow-runner.d.ts +15 -3
- package/dist/runtime/workflow-runner.js +13 -1
- package/dist/runtime/workspace-isolation.d.ts +103 -0
- package/dist/runtime/workspace-isolation.js +373 -0
- package/dist/schema/types.d.ts +1 -0
- package/dist/schema/validate.js +64 -6
- package/dist/schema/yaml-parser.js +7 -2
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
{
|
|
10
10
|
"name": "intentdna",
|
|
11
11
|
"description": "Declarative policy layer for AI agent behavior with plugin-managed hook runtime for Claude Code.",
|
|
12
|
-
"version": "1.8.
|
|
12
|
+
"version": "1.8.7",
|
|
13
13
|
"author": {
|
|
14
14
|
"name": "Samuel"
|
|
15
15
|
},
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
]
|
|
26
26
|
}
|
|
27
27
|
],
|
|
28
|
-
"version": "1.8.
|
|
28
|
+
"version": "1.8.7"
|
|
29
29
|
}
|
package/README.md
CHANGED
|
@@ -181,6 +181,7 @@ Trusted cloud ingestion may increase persistence and visibility, but it does not
|
|
|
181
181
|
|
|
182
182
|
- [docs/README.md](docs/README.md) - living docs map and two-state documentation rule.
|
|
183
183
|
- [docs/quickstart.md](docs/quickstart.md) - local developer quickstart.
|
|
184
|
+
- [docs/foundation-runtime.md](docs/foundation-runtime.md) - durable `dna run` Controller, lifecycle, handoff, isolation, and recovery guide.
|
|
184
185
|
- [docs/product/milestone-review-protocol.md](docs/product/milestone-review-protocol.md) - lightweight P-stage review protocol.
|
|
185
186
|
- [docs/product/online-product-spec.md](docs/product/online-product-spec.md) - Online IA, K5 boundary, forbidden copy, and acceptance.
|
|
186
187
|
- [docs/decisions/ADR-001-product-reset.md](docs/decisions/ADR-001-product-reset.md) - product reset decision record.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { JsonValue, RunId, TaskState } from "../../runtime/run-contracts.js";
|
|
2
|
+
import type { RunController } from "../../runtime/run-controller.js";
|
|
3
|
+
import type { DurableRunStore, RunRecord, RunStatus, RunStoreSnapshot } from "../../runtime/run-store.js";
|
|
4
|
+
export type RunLifecycleAction = "start" | "status" | "inspect" | "resume" | "cancel";
|
|
5
|
+
interface LifecycleOutputOptions {
|
|
6
|
+
readonly json?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface RunLifecycleStartOptions extends LifecycleOutputOptions {
|
|
9
|
+
readonly controller: RunController;
|
|
10
|
+
readonly run: RunRecord;
|
|
11
|
+
}
|
|
12
|
+
export interface RunLifecycleStatusOptions extends LifecycleOutputOptions {
|
|
13
|
+
readonly run_store: DurableRunStore;
|
|
14
|
+
readonly run_id: RunId;
|
|
15
|
+
}
|
|
16
|
+
export interface RunLifecycleInspectOptions extends LifecycleOutputOptions {
|
|
17
|
+
readonly run_store: DurableRunStore;
|
|
18
|
+
readonly run_id: RunId;
|
|
19
|
+
}
|
|
20
|
+
export interface RunLifecycleResumeOptions extends LifecycleOutputOptions {
|
|
21
|
+
readonly controller: RunController;
|
|
22
|
+
readonly run_id: RunId;
|
|
23
|
+
}
|
|
24
|
+
export interface RunLifecycleCancelOptions extends LifecycleOutputOptions {
|
|
25
|
+
readonly controller: RunController;
|
|
26
|
+
readonly run_id: RunId;
|
|
27
|
+
readonly reason?: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface RunStatusProjection {
|
|
30
|
+
readonly schema_version: "intentdna.run_status.v1";
|
|
31
|
+
readonly run_id: RunId;
|
|
32
|
+
readonly workflow_id: string;
|
|
33
|
+
readonly workflow_version: string | null;
|
|
34
|
+
readonly status: RunStatus;
|
|
35
|
+
readonly record_version: number;
|
|
36
|
+
readonly task_counts: Readonly<Record<TaskState, number>>;
|
|
37
|
+
readonly attempt_count: number;
|
|
38
|
+
readonly result_count: number;
|
|
39
|
+
readonly cancellation: RunRecord["cancellation"];
|
|
40
|
+
readonly terminal: RunRecord["terminal"];
|
|
41
|
+
readonly created_at: string;
|
|
42
|
+
readonly updated_at: string;
|
|
43
|
+
}
|
|
44
|
+
export interface DurableHandoffInspection {
|
|
45
|
+
readonly event_id: string;
|
|
46
|
+
readonly sequence: number;
|
|
47
|
+
readonly run_id: RunId;
|
|
48
|
+
readonly step_id: string;
|
|
49
|
+
readonly attempt_id: string;
|
|
50
|
+
readonly worker_session_id: string;
|
|
51
|
+
readonly result_id: string | null;
|
|
52
|
+
readonly occurred_at: string;
|
|
53
|
+
readonly binding: JsonValue;
|
|
54
|
+
}
|
|
55
|
+
export interface RunInspectionProjection {
|
|
56
|
+
readonly schema_version: "intentdna.run_inspection.v1";
|
|
57
|
+
readonly record_version: number;
|
|
58
|
+
readonly run: RunRecord;
|
|
59
|
+
readonly tasks: RunStoreSnapshot["tasks"];
|
|
60
|
+
readonly attempts: RunStoreSnapshot["attempts"];
|
|
61
|
+
readonly claims: RunStoreSnapshot["claims"];
|
|
62
|
+
readonly handoffs: readonly DurableHandoffInspection[];
|
|
63
|
+
readonly events: RunStoreSnapshot["events"];
|
|
64
|
+
readonly results: RunStoreSnapshot["results"];
|
|
65
|
+
readonly ledger_created_at: string;
|
|
66
|
+
readonly ledger_updated_at: string;
|
|
67
|
+
}
|
|
68
|
+
export declare function runLifecycleStart(options: RunLifecycleStartOptions): Promise<number>;
|
|
69
|
+
export declare function runLifecycleStatus(options: RunLifecycleStatusOptions): Promise<number>;
|
|
70
|
+
export declare function runLifecycleInspect(options: RunLifecycleInspectOptions): Promise<number>;
|
|
71
|
+
export declare function runLifecycleResume(options: RunLifecycleResumeOptions): Promise<number>;
|
|
72
|
+
export declare function runLifecycleCancel(options: RunLifecycleCancelOptions): Promise<number>;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
class LifecycleUsageError extends Error {
|
|
2
|
+
constructor(message) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = "LifecycleUsageError";
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
const TASK_STATES = [
|
|
8
|
+
"dependency_blocked",
|
|
9
|
+
"ready",
|
|
10
|
+
"claimed",
|
|
11
|
+
"running",
|
|
12
|
+
"succeeded",
|
|
13
|
+
"failed",
|
|
14
|
+
"skipped",
|
|
15
|
+
"cancelled",
|
|
16
|
+
];
|
|
17
|
+
function requireText(value, label) {
|
|
18
|
+
if (!value.trim()) {
|
|
19
|
+
throw new LifecycleUsageError(`${label} is required`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function requireRunId(runId) {
|
|
23
|
+
requireText(runId, "run_id");
|
|
24
|
+
}
|
|
25
|
+
function validateStartRun(run) {
|
|
26
|
+
requireRunId(run.run_id);
|
|
27
|
+
requireText(run.workflow_id, "workflow_id");
|
|
28
|
+
requireText(run.plan_digest, "plan_digest");
|
|
29
|
+
requireText(run.created_at, "created_at");
|
|
30
|
+
requireText(run.updated_at, "updated_at");
|
|
31
|
+
if (run.status !== "active"
|
|
32
|
+
|| run.cancellation !== null
|
|
33
|
+
|| run.terminal !== null) {
|
|
34
|
+
throw new LifecycleUsageError("start requires an active run without cancellation or terminal state");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function statusProjection(snapshot) {
|
|
38
|
+
const taskCounts = Object.fromEntries(TASK_STATES.map((state) => [state, 0]));
|
|
39
|
+
for (const task of snapshot.tasks) {
|
|
40
|
+
taskCounts[task.state] += 1;
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
schema_version: "intentdna.run_status.v1",
|
|
44
|
+
run_id: snapshot.run.run_id,
|
|
45
|
+
workflow_id: snapshot.run.workflow_id,
|
|
46
|
+
workflow_version: snapshot.run.workflow_version,
|
|
47
|
+
status: snapshot.run.status,
|
|
48
|
+
record_version: snapshot.record_version,
|
|
49
|
+
task_counts: taskCounts,
|
|
50
|
+
attempt_count: snapshot.attempts.length,
|
|
51
|
+
result_count: snapshot.results.length,
|
|
52
|
+
cancellation: snapshot.run.cancellation,
|
|
53
|
+
terminal: snapshot.run.terminal,
|
|
54
|
+
created_at: snapshot.run.created_at,
|
|
55
|
+
updated_at: snapshot.run.updated_at,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function durableHandoffs(snapshot) {
|
|
59
|
+
return snapshot.events.flatMap((event) => {
|
|
60
|
+
if (event.type !== "handoff_resolved"
|
|
61
|
+
|| event.step_id === null
|
|
62
|
+
|| event.attempt_id === null
|
|
63
|
+
|| event.worker_session_id === null) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
return [{
|
|
67
|
+
event_id: event.event_id,
|
|
68
|
+
sequence: event.sequence,
|
|
69
|
+
run_id: event.run_id,
|
|
70
|
+
step_id: event.step_id,
|
|
71
|
+
attempt_id: event.attempt_id,
|
|
72
|
+
worker_session_id: event.worker_session_id,
|
|
73
|
+
result_id: event.result_id,
|
|
74
|
+
occurred_at: event.occurred_at,
|
|
75
|
+
binding: event.payload,
|
|
76
|
+
}];
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function inspectionProjection(snapshot) {
|
|
80
|
+
return {
|
|
81
|
+
schema_version: "intentdna.run_inspection.v1",
|
|
82
|
+
record_version: snapshot.record_version,
|
|
83
|
+
run: snapshot.run,
|
|
84
|
+
tasks: snapshot.tasks,
|
|
85
|
+
attempts: snapshot.attempts,
|
|
86
|
+
claims: snapshot.claims,
|
|
87
|
+
handoffs: durableHandoffs(snapshot),
|
|
88
|
+
events: snapshot.events,
|
|
89
|
+
results: snapshot.results,
|
|
90
|
+
ledger_created_at: snapshot.created_at,
|
|
91
|
+
ledger_updated_at: snapshot.updated_at,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function writeJson(value) {
|
|
95
|
+
process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
|
|
96
|
+
}
|
|
97
|
+
function nonZeroTaskCounts(counts) {
|
|
98
|
+
const summary = TASK_STATES
|
|
99
|
+
.filter((state) => counts[state] > 0)
|
|
100
|
+
.map((state) => `${state}=${counts[state]}`)
|
|
101
|
+
.join(", ");
|
|
102
|
+
return summary || "none";
|
|
103
|
+
}
|
|
104
|
+
function writeHumanStatus(status, action) {
|
|
105
|
+
if (action)
|
|
106
|
+
process.stdout.write(`Action: ${action}\n`);
|
|
107
|
+
process.stdout.write(`Run: ${status.run_id}\n`);
|
|
108
|
+
process.stdout.write(`Workflow: ${status.workflow_id}\n`);
|
|
109
|
+
process.stdout.write(`Status: ${status.status}\n`);
|
|
110
|
+
process.stdout.write(`Ledger version: ${status.record_version}\n`);
|
|
111
|
+
process.stdout.write(`Tasks: ${nonZeroTaskCounts(status.task_counts)}\n`);
|
|
112
|
+
process.stdout.write(`Attempts: ${status.attempt_count}; results: ${status.result_count}\n`);
|
|
113
|
+
if (status.cancellation) {
|
|
114
|
+
process.stdout.write(`Cancellation: ${status.cancellation.requested_at}`
|
|
115
|
+
+ `${status.cancellation.reason ? ` (${status.cancellation.reason})` : ""}\n`);
|
|
116
|
+
}
|
|
117
|
+
if (status.terminal) {
|
|
118
|
+
process.stdout.write(`Terminal: ${status.terminal.status} at ${status.terminal.completed_at}`
|
|
119
|
+
+ `${status.terminal.reason ? ` (${status.terminal.reason})` : ""}\n`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function writeInspection(snapshot, json) {
|
|
123
|
+
const projection = inspectionProjection(snapshot);
|
|
124
|
+
if (json) {
|
|
125
|
+
writeJson(projection);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
writeHumanStatus(statusProjection(snapshot));
|
|
129
|
+
process.stdout.write("\nAttempts:\n");
|
|
130
|
+
if (projection.attempts.length === 0) {
|
|
131
|
+
process.stdout.write(" (none)\n");
|
|
132
|
+
}
|
|
133
|
+
for (const attempt of projection.attempts) {
|
|
134
|
+
process.stdout.write(` ${attempt.attempt_id} step=${attempt.step_id}`
|
|
135
|
+
+ ` worker=${attempt.worker_session_id} phase=${attempt.phase}`
|
|
136
|
+
+ ` pid=${attempt.process_id ?? "-"}`
|
|
137
|
+
+ ` outcome=${attempt.terminal_outcome?.kind ?? "none"}\n`);
|
|
138
|
+
}
|
|
139
|
+
process.stdout.write("\nResolved handoffs:\n");
|
|
140
|
+
if (projection.handoffs.length === 0) {
|
|
141
|
+
process.stdout.write(" (none)\n");
|
|
142
|
+
}
|
|
143
|
+
for (const handoff of projection.handoffs) {
|
|
144
|
+
process.stdout.write(` attempt=${handoff.attempt_id} worker=${handoff.worker_session_id}`
|
|
145
|
+
+ ` binding=${JSON.stringify(handoff.binding)}\n`);
|
|
146
|
+
}
|
|
147
|
+
process.stdout.write("\nCommitted results:\n");
|
|
148
|
+
if (projection.results.length === 0) {
|
|
149
|
+
process.stdout.write(" (none)\n");
|
|
150
|
+
}
|
|
151
|
+
for (const result of projection.results) {
|
|
152
|
+
process.stdout.write(` ${result.result_id} attempt=${result.attempt_id}`
|
|
153
|
+
+ ` worker=${result.worker_session_id}`
|
|
154
|
+
+ ` outputs=${JSON.stringify(result.outputs)}\n`);
|
|
155
|
+
}
|
|
156
|
+
process.stdout.write("\nEvents:\n");
|
|
157
|
+
if (projection.events.length === 0) {
|
|
158
|
+
process.stdout.write(" (none)\n");
|
|
159
|
+
}
|
|
160
|
+
for (const event of projection.events) {
|
|
161
|
+
process.stdout.write(` ${event.sequence} ${event.type}`
|
|
162
|
+
+ ` step=${event.step_id ?? "-"} attempt=${event.attempt_id ?? "-"}`
|
|
163
|
+
+ ` worker=${event.worker_session_id ?? "-"}`
|
|
164
|
+
+ ` payload=${JSON.stringify(event.payload)}\n`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function writeOperation(action, snapshot, json) {
|
|
168
|
+
const status = statusProjection(snapshot);
|
|
169
|
+
if (json) {
|
|
170
|
+
writeJson({
|
|
171
|
+
schema_version: "intentdna.run_lifecycle_operation.v1",
|
|
172
|
+
action,
|
|
173
|
+
status,
|
|
174
|
+
});
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
writeHumanStatus(status, action);
|
|
178
|
+
}
|
|
179
|
+
function operationExitCode(snapshot) {
|
|
180
|
+
return snapshot.run.status === "failed" ? 1 : 0;
|
|
181
|
+
}
|
|
182
|
+
async function handle(operation) {
|
|
183
|
+
try {
|
|
184
|
+
return await operation();
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
const prefix = error instanceof LifecycleUsageError ? "Usage error" : "Error";
|
|
188
|
+
process.stderr.write(`${prefix}: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
189
|
+
return error instanceof LifecycleUsageError ? 2 : 1;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
export async function runLifecycleStart(options) {
|
|
193
|
+
return handle(async () => {
|
|
194
|
+
validateStartRun(options.run);
|
|
195
|
+
await options.controller.createRun({ run: options.run });
|
|
196
|
+
const snapshot = await options.controller.runUntilTerminal(options.run.run_id);
|
|
197
|
+
writeOperation("start", snapshot, options.json === true);
|
|
198
|
+
return operationExitCode(snapshot);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
export async function runLifecycleStatus(options) {
|
|
202
|
+
return handle(async () => {
|
|
203
|
+
requireRunId(options.run_id);
|
|
204
|
+
const snapshot = await options.run_store.requireRun(options.run_id);
|
|
205
|
+
const projection = statusProjection(snapshot);
|
|
206
|
+
if (options.json === true)
|
|
207
|
+
writeJson(projection);
|
|
208
|
+
else
|
|
209
|
+
writeHumanStatus(projection);
|
|
210
|
+
return 0;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
export async function runLifecycleInspect(options) {
|
|
214
|
+
return handle(async () => {
|
|
215
|
+
requireRunId(options.run_id);
|
|
216
|
+
const snapshot = await options.run_store.requireRun(options.run_id);
|
|
217
|
+
writeInspection(snapshot, options.json === true);
|
|
218
|
+
return 0;
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
export async function runLifecycleResume(options) {
|
|
222
|
+
return handle(async () => {
|
|
223
|
+
requireRunId(options.run_id);
|
|
224
|
+
const snapshot = await options.controller.runUntilTerminal(options.run_id);
|
|
225
|
+
writeOperation("resume", snapshot, options.json === true);
|
|
226
|
+
return operationExitCode(snapshot);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
export async function runLifecycleCancel(options) {
|
|
230
|
+
return handle(async () => {
|
|
231
|
+
requireRunId(options.run_id);
|
|
232
|
+
const reason = options.reason ?? null;
|
|
233
|
+
if (reason !== null && !reason.trim()) {
|
|
234
|
+
throw new LifecycleUsageError("reason must not be empty");
|
|
235
|
+
}
|
|
236
|
+
const snapshot = await options.controller.requestCancellation(options.run_id, reason);
|
|
237
|
+
writeOperation("cancel", snapshot, options.json === true);
|
|
238
|
+
return 0;
|
|
239
|
+
});
|
|
240
|
+
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Intent DNA
|
|
2
|
+
* Intent DNA - canonical dna run command.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The CLI compiles one workflow into Controller definitions, persists one
|
|
5
|
+
* durable run ledger, and launches one disposable provider session per Step
|
|
6
|
+
* attempt. Cross-Step inputs come only from committed results.
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
9
|
-
import type
|
|
8
|
+
import type { TransitionRule } from "../../schema/types.js";
|
|
9
|
+
import { type RunLifecycleAction } from "./run-lifecycle.js";
|
|
10
|
+
export type RunProviderKind = "claude" | "codex";
|
|
10
11
|
export interface RunOptions {
|
|
12
|
+
action?: RunLifecycleAction;
|
|
13
|
+
runId?: string;
|
|
11
14
|
dnaFiles: string[];
|
|
12
|
-
workflowName
|
|
13
|
-
taskId
|
|
15
|
+
workflowName?: string;
|
|
16
|
+
taskId?: string;
|
|
14
17
|
context?: string;
|
|
15
18
|
vars?: Record<string, string>;
|
|
16
19
|
dryRun?: boolean;
|
|
@@ -20,46 +23,25 @@ export interface RunOptions {
|
|
|
20
23
|
agentsDir?: string;
|
|
21
24
|
hooksDir?: string;
|
|
22
25
|
projectDir?: string;
|
|
26
|
+
provider?: RunProviderKind;
|
|
27
|
+
providerExecutable?: string;
|
|
28
|
+
maxConcurrency?: number;
|
|
29
|
+
timeoutMs?: number | null;
|
|
30
|
+
cancellationGraceMs?: number;
|
|
31
|
+
reason?: string | null;
|
|
32
|
+
json?: boolean;
|
|
23
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Retained as a source-compatible result shape for callers that only use the
|
|
36
|
+
* pure legacy routing helper below. Canonical execution truth is RunStoreSnapshot.
|
|
37
|
+
*/
|
|
24
38
|
export interface StepResult {
|
|
25
39
|
stepId: string;
|
|
26
40
|
status: "pass" | "fail" | "skipped";
|
|
27
41
|
durationMs: number;
|
|
28
42
|
resultFile?: string;
|
|
29
43
|
}
|
|
30
|
-
interface StepExecOptions {
|
|
31
|
-
agentPrefix: string;
|
|
32
|
-
maxBudget: number;
|
|
33
|
-
permissionMode: string;
|
|
34
|
-
logDir: string;
|
|
35
|
-
projectDir: string;
|
|
36
|
-
workflowName: string;
|
|
37
|
-
workflowAsset?: string;
|
|
38
|
-
inputs: Record<string, string>;
|
|
39
|
-
ir: Pick<ConstraintIR, "verifier_policy">;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Replace {{var}} placeholders in a template string.
|
|
43
|
-
* Unmatched placeholders are preserved as-is.
|
|
44
|
-
*/
|
|
45
44
|
export declare function substituteTemplate(template: string, vars: Record<string, string>): string;
|
|
46
|
-
/**
|
|
47
|
-
* Evaluate a run_if condition against the current round.
|
|
48
|
-
* Returns true if the step should execute.
|
|
49
|
-
*/
|
|
50
45
|
export declare function evaluateRunIf(condition: string | null, round: number): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Execute a single workflow step via `claude -p --agent`.
|
|
53
|
-
* Returns StepResult with pass/fail status.
|
|
54
|
-
*/
|
|
55
|
-
export declare function executeStep(step: WorkflowStep, vars: Record<string, string>, opts: StepExecOptions, iteration?: number): Promise<StepResult>;
|
|
56
|
-
/**
|
|
57
|
-
* Execute a parallel group of steps.
|
|
58
|
-
*/
|
|
59
|
-
export declare function executeGroup(group: ParallelGroup, allSteps: WorkflowStep[], round: number, vars: Record<string, string>, opts: StepExecOptions): Promise<StepResult[]>;
|
|
60
|
-
/**
|
|
61
|
-
* Check if any transition requires retry.
|
|
62
|
-
*/
|
|
63
46
|
export declare function checkRetryNeeded(stepResults: Map<string, StepResult>, transitions: TransitionRule[]): boolean;
|
|
64
47
|
export declare function runRun(opts: RunOptions): Promise<number>;
|
|
65
|
-
export {};
|