intentdna 1.8.7 → 1.9.0-rc.2
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/dist/cli/commands/candidate-promotion.d.ts +15 -0
- package/dist/cli/commands/candidate-promotion.js +197 -0
- package/dist/cli/commands/run-lifecycle.js +1 -0
- package/dist/cli/commands/run.js +76 -42
- package/dist/cli/commands/setup.d.ts +10 -0
- package/dist/cli/commands/setup.js +129 -36
- package/dist/cli/commands/source-assets.d.ts +32 -0
- package/dist/cli/commands/source-assets.js +154 -0
- package/dist/cli/commands/sync.js +52 -12
- package/dist/cli/commands/templates.js +59 -37
- package/dist/cli/index.js +161 -5
- package/dist/compiler/cascade.js +1 -1
- package/dist/hooks/cli.d.ts +6 -0
- package/dist/hooks/cli.js +118 -10
- package/dist/hooks/enforcement-boundary.d.ts +1 -1
- package/dist/hooks/protocol.d.ts +1 -1
- package/dist/hooks/state.d.ts +5 -0
- package/dist/hooks/state.js +21 -6
- package/dist/mcp/tools-state.js +251 -15
- package/dist/runtime/claude-sync-target.d.ts +2 -0
- package/dist/runtime/claude-sync-target.js +1 -1
- package/dist/runtime/evaluator.d.ts +13 -0
- package/dist/runtime/evaluator.js +46 -0
- package/dist/runtime/index.d.ts +8 -4
- package/dist/runtime/index.js +4 -2
- package/dist/runtime/plugin-adapter.d.ts +14 -1
- package/dist/runtime/plugin-adapter.js +23 -9
- package/dist/runtime/run-contracts.d.ts +5 -3
- package/dist/runtime/run-contracts.js +11 -1
- package/dist/runtime/run-controller.d.ts +15 -1
- package/dist/runtime/run-controller.js +235 -94
- package/dist/runtime/skill-adapter.js +24 -53
- package/dist/runtime/verifier.js +101 -2
- package/dist/runtime/workflow-plan-adapter.d.ts +2 -1
- package/dist/runtime/workflow-plan-adapter.js +78 -11
- package/dist/runtime/workflow-runtime-manifest.d.ts +48 -0
- package/dist/runtime/workflow-runtime-manifest.js +196 -0
- package/dist/runtime/workflow-variable-scopes.d.ts +12 -0
- package/dist/runtime/workflow-variable-scopes.js +55 -0
- package/dist/schema/types.d.ts +9 -0
- package/dist/schema/validate.js +29 -1
- package/dist/sources/authoring-packet.d.ts +8 -0
- package/dist/sources/authoring-packet.js +85 -0
- package/dist/sources/discovery.d.ts +7 -0
- package/dist/sources/discovery.js +150 -0
- package/dist/sources/license.d.ts +5 -0
- package/dist/sources/license.js +94 -0
- package/dist/sources/manifest.d.ts +11 -0
- package/dist/sources/manifest.js +84 -0
- package/dist/sources/skill-markdown.d.ts +6 -0
- package/dist/sources/skill-markdown.js +174 -0
- package/dist/sources/types.d.ts +125 -0
- package/dist/sources/types.js +1 -0
- package/dist/templates/asset-refinery.dna.yaml +192 -0
- package/dist/templates/flutter-behavior-lock.dna.yaml +17 -0
- package/dist/templates/flutter-refactoring-rescue.dna.yaml +11 -0
- package/dist/templates/flutter-rewrite.dna.yaml +154 -28
- package/dist/templates/metadata.js +2 -0
- package/dist/templates/multi-agent-handoff-coordination.dna.yaml +102 -37
- package/dist/templates/persistent-executor.dna.yaml +61 -3
- package/dist/templates/research-improvement.dna.yaml +295 -0
- package/dist/templates/subagent-parallel.dna.yaml +90 -17
- package/dist/templates/workflow-evidence-review.dna.yaml +8 -0
- package/dist/workflow/candidate-projection.d.ts +33 -0
- package/dist/workflow/candidate-projection.js +70 -0
- package/package.json +3 -1
- package/scripts/sync-release-plugin.cjs +87 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export const MAX_EVALUATOR_RESULT_BYTES = 65_536;
|
|
2
|
+
export class EvaluatorResultError extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "EvaluatorResultError";
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
function evaluatorError(message) {
|
|
9
|
+
return new EvaluatorResultError(message);
|
|
10
|
+
}
|
|
11
|
+
export function parseEvaluatorResult(raw, options = {}) {
|
|
12
|
+
const maxBytes = options.max_bytes ?? MAX_EVALUATOR_RESULT_BYTES;
|
|
13
|
+
if (!Number.isSafeInteger(maxBytes)
|
|
14
|
+
|| maxBytes < 1) {
|
|
15
|
+
throw evaluatorError("Evaluator result max_bytes must be a positive safe integer.");
|
|
16
|
+
}
|
|
17
|
+
if (Buffer.byteLength(raw, "utf8") > maxBytes) {
|
|
18
|
+
throw evaluatorError(`Evaluator output exceeds the ${maxBytes}-byte limit.`);
|
|
19
|
+
}
|
|
20
|
+
let parsed;
|
|
21
|
+
try {
|
|
22
|
+
parsed = JSON.parse(raw);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
throw evaluatorError("Evaluator output must be valid JSON with required boolean pass and optional numeric score.");
|
|
26
|
+
}
|
|
27
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
28
|
+
throw evaluatorError("Evaluator output must be a JSON object.");
|
|
29
|
+
}
|
|
30
|
+
const result = parsed;
|
|
31
|
+
if (typeof result.pass !== "boolean") {
|
|
32
|
+
throw evaluatorError("Evaluator output must include boolean pass.");
|
|
33
|
+
}
|
|
34
|
+
if (result.score !== undefined
|
|
35
|
+
&& (typeof result.score !== "number"
|
|
36
|
+
|| !Number.isFinite(result.score))) {
|
|
37
|
+
throw evaluatorError("Evaluator output score must be finite numeric when provided.");
|
|
38
|
+
}
|
|
39
|
+
if (options.require_score === true && result.score === undefined) {
|
|
40
|
+
throw evaluatorError("Evaluator output numeric score is required.");
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
pass: result.pass,
|
|
44
|
+
...(result.score === undefined ? {} : { score: result.score }),
|
|
45
|
+
};
|
|
46
|
+
}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export { compileRoleToAgentMD, compileAllRolesToAgentMD, writeAgentMDFiles, remo
|
|
|
4
4
|
export type { AgentMDOptions, AgentMDResult } from "./agent-md.js";
|
|
5
5
|
export { compileWorkflowToShell, writeWorkflowScript, removeWorkflowScripts, } from "./workflow-runner.js";
|
|
6
6
|
export type { WorkflowShellOptions, WorkflowShellResult } from "./workflow-runner.js";
|
|
7
|
-
export { createCompiledIR, writeCompiledIR, loadCompiledIR, removeCompiledIR, } from "./plugin-adapter.js";
|
|
8
|
-
export type { CompiledIRFile } from "./plugin-adapter.js";
|
|
7
|
+
export { createCompiledIR, writeCompiledIR, loadCompiledIR, loadCompiledIRResult, removeCompiledIR, } from "./plugin-adapter.js";
|
|
8
|
+
export type { CompiledIRFile, CompiledIRLoadResult } from "./plugin-adapter.js";
|
|
9
9
|
export { compilePluginSettings, detectEnabledEvents, } from "./settings-adapter.js";
|
|
10
10
|
export { CODEX_ADAPTER_MINIMUM_VERSION, CODEX_NATIVE_HOOK_EVENTS, appendCodexRuntimeDecisionEvent, buildCodexDispatcherCommand, buildCodexHookTrustState, codexHookTrustedHash, codexInstallModeSemantics, codexTrustStateToml, compileCodexAdapterArtifacts, compileCodexHooksConfig, compileCodexInstructionArtifact, compileCodexPluginManifest, compileCodexPolicyMapArtifact, mapCodexDecisionEvent, mergeCodexFallbackHooks, mergeCodexTrustStateConfig, normalizeCodexHookInput, probeCodexRuntime, runCodexExecDogfood, removeCodexAdapterArtifacts, removeCodexFallbackHooks, removeCodexTrustStateConfig, runCodexHook, withCodexDogfoodEvidence, verifyCodexHookTrust, writeCodexAdapterArtifacts, } from "./codex-adapter.js";
|
|
11
11
|
export type { CodexAdapterArtifacts, CodexAdapterEvidence, CodexAdapterSupportStatus, CodexCommandHook, CodexDecisionMappingInput, CodexDogfoodResult, CodexEvidenceClassification, CodexExecJsonEvent, CodexHookGroup, CodexHookInput, CodexHookInstallMode, CodexHookRunnerOptions, CodexHookRunnerResult, CodexHookTrustState, CodexHooksConfig, CodexInstallModeSemantics, CodexInstructionArtifact, CodexNativeHookEvent, CodexPluginManifest, CodexPolicyMap, CodexPolicyMapArtifact, CodexPolicyMapEntry, CodexRuntimeProbe, CodexTrustVerification, RunCodexDogfoodOptions, CodexTrustVerificationInput, CompileCodexAdapterOptions, } from "./codex-adapter.js";
|
|
@@ -34,8 +34,12 @@ export type { ProcessTerminationReason, ProcessTreeRunOptions, ProcessTreeRunRes
|
|
|
34
34
|
export { executeWorkerAttempt } from "./worker-executor.js";
|
|
35
35
|
export type { WorkerExecutorOptions, WorkerExecutionWithEvents, } from "./worker-executor.js";
|
|
36
36
|
export { RunControllerError, RunController, } from "./run-controller.js";
|
|
37
|
-
export type { ControllerReferenceHandoff, ControllerQuoteHandoff, ControllerStructuredHandoff, ControllerNoHandoff, ControllerHandoffDeclaration, MaterializeStepPacketInput, ControllerStepDefinition, ReconciledAttemptState, AttemptReconciler, RunControllerOptions, CreateControllerRunInput, ClaimedStep, RunControllerErrorCode, } from "./run-controller.js";
|
|
38
|
-
export { WorkflowPlanAdapterError, adaptWorkflowPlan, } from "./workflow-plan-adapter.js";
|
|
37
|
+
export type { ControllerReferenceHandoff, ControllerQuoteHandoff, ControllerStructuredHandoff, ControllerNoHandoff, ControllerHandoffDeclaration, MaterializeStepPacketInput, ControllerStepDefinition, WorkflowRetryLoopPolicy, ReconciledAttemptState, AttemptReconciler, RunControllerOptions, CreateControllerRunInput, ClaimedStep, RunControllerErrorCode, } from "./run-controller.js";
|
|
38
|
+
export { WorkflowPlanAdapterError, adaptWorkflowPlan, adaptWorkflowRetryLoop, } from "./workflow-plan-adapter.js";
|
|
39
39
|
export type { WorkflowPlanAdapterErrorCode, WorkflowPlanAdapterOptions, } from "./workflow-plan-adapter.js";
|
|
40
40
|
export { WorkspaceIsolationError, planAttemptWorkspace, allocateAttemptWorkspace, inspectAttemptWorkspace, applyWorkspaceLifecycleDecision, defaultWorktreeRoot, describeWorkspace, } from "./workspace-isolation.js";
|
|
41
41
|
export type { WorkspaceIsolation, WorkspaceIsolationErrorCode, AttemptWorkspaceRequest, SharedWorkspacePlan, IsolatedWorkspacePlan, AttemptWorkspacePlan, SharedWorkspaceAllocation, IsolatedWorkspaceAllocation, AttemptWorkspaceAllocation, WorkspaceInspection, WorkspacePreservationReason, WorkspaceLifecycleDecision, WorkspaceLifecycleResult, } from "./workspace-isolation.js";
|
|
42
|
+
export { MAX_EVALUATOR_RESULT_BYTES, EvaluatorResultError, parseEvaluatorResult, } from "./evaluator.js";
|
|
43
|
+
export type { EvaluatorResult, ParseEvaluatorResultOptions, } from "./evaluator.js";
|
|
44
|
+
export { runCompletionVerifier, runCheckpointVerifier, } from "./verifier.js";
|
|
45
|
+
export type { VerifierRuntimeContext, VerifierCheckResult, } from "./verifier.js";
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { compileForClaude } from "./claude-sdk.js";
|
|
2
2
|
export { compileRoleToAgentMD, compileAllRolesToAgentMD, writeAgentMDFiles, removeAgentMDFiles, toKebabCase, } from "./agent-md.js";
|
|
3
3
|
export { compileWorkflowToShell, writeWorkflowScript, removeWorkflowScripts, } from "./workflow-runner.js";
|
|
4
|
-
export { createCompiledIR, writeCompiledIR, loadCompiledIR, removeCompiledIR, } from "./plugin-adapter.js";
|
|
4
|
+
export { createCompiledIR, writeCompiledIR, loadCompiledIR, loadCompiledIRResult, removeCompiledIR, } from "./plugin-adapter.js";
|
|
5
5
|
export { compilePluginSettings, detectEnabledEvents, } from "./settings-adapter.js";
|
|
6
6
|
export { CODEX_ADAPTER_MINIMUM_VERSION, CODEX_NATIVE_HOOK_EVENTS, appendCodexRuntimeDecisionEvent, buildCodexDispatcherCommand, buildCodexHookTrustState, codexHookTrustedHash, codexInstallModeSemantics, codexTrustStateToml, compileCodexAdapterArtifacts, compileCodexHooksConfig, compileCodexInstructionArtifact, compileCodexPluginManifest, compileCodexPolicyMapArtifact, mapCodexDecisionEvent, mergeCodexFallbackHooks, mergeCodexTrustStateConfig, normalizeCodexHookInput, probeCodexRuntime, runCodexExecDogfood, removeCodexAdapterArtifacts, removeCodexFallbackHooks, removeCodexTrustStateConfig, runCodexHook, withCodexDogfoodEvidence, verifyCodexHookTrust, writeCodexAdapterArtifacts, } from "./codex-adapter.js";
|
|
7
7
|
export { codexSyncDispatcherCommand, createCodexSyncTargetPlan, executeCodexSyncTargetPlan, formatCodexSyncTargetPlanSummary, removeCodexSyncTargetArtifacts, } from "./codex-sync-target.js";
|
|
@@ -18,5 +18,7 @@ export { createCodexExecutionProvider } from "./providers/codex.js";
|
|
|
18
18
|
export { runProcessTree, runProcessTreeWithTimeout, } from "./process-tree.js";
|
|
19
19
|
export { executeWorkerAttempt } from "./worker-executor.js";
|
|
20
20
|
export { RunControllerError, RunController, } from "./run-controller.js";
|
|
21
|
-
export { WorkflowPlanAdapterError, adaptWorkflowPlan, } from "./workflow-plan-adapter.js";
|
|
21
|
+
export { WorkflowPlanAdapterError, adaptWorkflowPlan, adaptWorkflowRetryLoop, } from "./workflow-plan-adapter.js";
|
|
22
22
|
export { WorkspaceIsolationError, planAttemptWorkspace, allocateAttemptWorkspace, inspectAttemptWorkspace, applyWorkspaceLifecycleDecision, defaultWorktreeRoot, describeWorkspace, } from "./workspace-isolation.js";
|
|
23
|
+
export { MAX_EVALUATOR_RESULT_BYTES, EvaluatorResultError, parseEvaluatorResult, } from "./evaluator.js";
|
|
24
|
+
export { runCompletionVerifier, runCheckpointVerifier, } from "./verifier.js";
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* This is the bridge between compile-time (dna sync) and runtime (hook execution).
|
|
8
8
|
*/
|
|
9
9
|
import type { CompiledProvenanceManifest, ConstraintIR, RoleDef } from "../schema/types.js";
|
|
10
|
+
import type { WorkflowRuntimeManifest } from "./workflow-runtime-manifest.js";
|
|
10
11
|
/** Wrapper around ConstraintIR with versioning metadata */
|
|
11
12
|
export interface CompiledIRFile {
|
|
12
13
|
/** Schema version for forward compatibility */
|
|
@@ -23,11 +24,22 @@ export interface CompiledIRFile {
|
|
|
23
24
|
compiled_ir_hash?: string;
|
|
24
25
|
/** Cascade and source provenance used by enterprise evidence */
|
|
25
26
|
provenance?: CompiledProvenanceManifest;
|
|
27
|
+
/** Deterministic workflow runtime bindings used to initialize workflow state. */
|
|
28
|
+
workflow_runtime?: WorkflowRuntimeManifest;
|
|
26
29
|
}
|
|
30
|
+
export type CompiledIRLoadResult = {
|
|
31
|
+
status: "loaded";
|
|
32
|
+
compiled: CompiledIRFile;
|
|
33
|
+
} | {
|
|
34
|
+
status: "missing";
|
|
35
|
+
} | {
|
|
36
|
+
status: "invalid";
|
|
37
|
+
reason: string;
|
|
38
|
+
};
|
|
27
39
|
/**
|
|
28
40
|
* Create a CompiledIRFile wrapper around a ConstraintIR.
|
|
29
41
|
*/
|
|
30
|
-
export declare function createCompiledIR(ir: ConstraintIR, roles?: Record<string, RoleDef
|
|
42
|
+
export declare function createCompiledIR(ir: ConstraintIR, roles?: Record<string, RoleDef>, workflowRuntime?: WorkflowRuntimeManifest): CompiledIRFile;
|
|
31
43
|
/**
|
|
32
44
|
* Write compiled IR to .dna/compiled/ir.json.
|
|
33
45
|
* Creates the directory if needed.
|
|
@@ -39,6 +51,7 @@ export declare function writeCompiledIR(projectDir: string, compiled: CompiledIR
|
|
|
39
51
|
* Returns null if not found or invalid.
|
|
40
52
|
*/
|
|
41
53
|
export declare function loadCompiledIR(irPath: string): Promise<CompiledIRFile | null>;
|
|
54
|
+
export declare function loadCompiledIRResult(irPath: string): Promise<CompiledIRLoadResult>;
|
|
42
55
|
/**
|
|
43
56
|
* Remove compiled IR file.
|
|
44
57
|
* Returns true if removed, false if not found.
|
|
@@ -13,7 +13,7 @@ import { atomicWrite } from "../hooks/state.js";
|
|
|
13
13
|
/**
|
|
14
14
|
* Create a CompiledIRFile wrapper around a ConstraintIR.
|
|
15
15
|
*/
|
|
16
|
-
export function createCompiledIR(ir, roles) {
|
|
16
|
+
export function createCompiledIR(ir, roles, workflowRuntime) {
|
|
17
17
|
return {
|
|
18
18
|
ir_version: 1,
|
|
19
19
|
compiled_at: ir.compiled_at,
|
|
@@ -22,6 +22,7 @@ export function createCompiledIR(ir, roles) {
|
|
|
22
22
|
roles: roles && Object.keys(roles).length > 0 ? roles : undefined,
|
|
23
23
|
compiled_ir_hash: ir.compiled_ir_hash,
|
|
24
24
|
provenance: ir.provenance,
|
|
25
|
+
...(workflowRuntime ? { workflow_runtime: workflowRuntime } : {}),
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
@@ -41,26 +42,39 @@ export async function writeCompiledIR(projectDir, compiled) {
|
|
|
41
42
|
* Returns null if not found or invalid.
|
|
42
43
|
*/
|
|
43
44
|
export async function loadCompiledIR(irPath) {
|
|
45
|
+
const result = await loadCompiledIRResult(irPath);
|
|
46
|
+
return result.status === "loaded" ? result.compiled : null;
|
|
47
|
+
}
|
|
48
|
+
export async function loadCompiledIRResult(irPath) {
|
|
44
49
|
try {
|
|
45
50
|
const raw = await readFile(irPath, "utf-8");
|
|
46
51
|
const data = JSON.parse(raw);
|
|
47
52
|
// Validate wrapper format
|
|
48
53
|
if (data.ir_version === 1 && data.ir && data.compiled_at) {
|
|
49
|
-
return data;
|
|
54
|
+
return { status: "loaded", compiled: data };
|
|
50
55
|
}
|
|
51
56
|
// Maybe it's a raw ConstraintIR (backward compat)
|
|
52
57
|
if (data.compiled_at && data.source_dna_ids) {
|
|
53
58
|
return {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
status: "loaded",
|
|
60
|
+
compiled: {
|
|
61
|
+
ir_version: 1,
|
|
62
|
+
compiled_at: data.compiled_at,
|
|
63
|
+
source_dna_ids: data.source_dna_ids,
|
|
64
|
+
ir: data,
|
|
65
|
+
},
|
|
58
66
|
};
|
|
59
67
|
}
|
|
60
|
-
return
|
|
68
|
+
return { status: "invalid", reason: "compiled IR has an unsupported shape" };
|
|
61
69
|
}
|
|
62
|
-
catch {
|
|
63
|
-
|
|
70
|
+
catch (error) {
|
|
71
|
+
const code = error && typeof error === "object" && "code" in error ? error.code : undefined;
|
|
72
|
+
if (code === "ENOENT")
|
|
73
|
+
return { status: "missing" };
|
|
74
|
+
return {
|
|
75
|
+
status: "invalid",
|
|
76
|
+
reason: error instanceof Error ? error.message : "compiled IR cannot be read",
|
|
77
|
+
};
|
|
64
78
|
}
|
|
65
79
|
}
|
|
66
80
|
/**
|
|
@@ -31,7 +31,7 @@ export interface AttemptIdentity extends TaskKey {
|
|
|
31
31
|
readonly attempt_id: AttemptId;
|
|
32
32
|
readonly worker_session_id: WorkerSessionId;
|
|
33
33
|
}
|
|
34
|
-
export declare const TASK_STATE_VALUES: readonly ["dependency_blocked", "ready", "claimed", "running", "succeeded", "failed", "skipped", "cancelled"];
|
|
34
|
+
export declare const TASK_STATE_VALUES: readonly ["dependency_blocked", "ready", "claimed", "running", "round_succeeded", "succeeded", "failed", "skipped", "cancelled"];
|
|
35
35
|
export type TaskState = typeof TASK_STATE_VALUES[number];
|
|
36
36
|
export type TerminalTaskState = Extract<TaskState, "succeeded" | "failed" | "skipped" | "cancelled">;
|
|
37
37
|
/**
|
|
@@ -42,7 +42,8 @@ export declare const TASK_STATE_TRANSITIONS: {
|
|
|
42
42
|
readonly dependency_blocked: readonly ["ready", "skipped", "cancelled"];
|
|
43
43
|
readonly ready: readonly ["claimed", "skipped", "cancelled"];
|
|
44
44
|
readonly claimed: readonly ["ready", "running", "cancelled"];
|
|
45
|
-
readonly running: readonly ["ready", "succeeded", "failed", "cancelled"];
|
|
45
|
+
readonly running: readonly ["ready", "round_succeeded", "succeeded", "failed", "cancelled"];
|
|
46
|
+
readonly round_succeeded: readonly ["dependency_blocked", "ready", "succeeded", "skipped", "cancelled"];
|
|
46
47
|
readonly succeeded: readonly [];
|
|
47
48
|
readonly failed: readonly [];
|
|
48
49
|
readonly skipped: readonly [];
|
|
@@ -170,6 +171,7 @@ export type StepOutput = {
|
|
|
170
171
|
export interface StepPacket extends AttemptIdentity {
|
|
171
172
|
readonly packet_version: 1;
|
|
172
173
|
readonly attempt_number: number;
|
|
174
|
+
readonly workflow_round: number;
|
|
173
175
|
readonly role: string;
|
|
174
176
|
readonly constraints: readonly string[];
|
|
175
177
|
readonly standalone_prompt: string;
|
|
@@ -272,7 +274,7 @@ export interface CommittedStepResult extends ProviderExecutionResult {
|
|
|
272
274
|
readonly commit_status: "committed";
|
|
273
275
|
readonly committed_at: string;
|
|
274
276
|
}
|
|
275
|
-
export declare const RUNTIME_EVENT_TYPE_VALUES: readonly ["run_created", "run_cancel_requested", "run_terminal", "task_state_changed", "task_claimed", "task_lease_renewed", "task_claim_released", "attempt_started", "attempt_terminal", "handoff_resolved", "result_committed"];
|
|
277
|
+
export declare const RUNTIME_EVENT_TYPE_VALUES: readonly ["run_created", "run_cancel_requested", "run_terminal", "task_state_changed", "task_claimed", "task_lease_renewed", "task_claim_released", "attempt_started", "attempt_terminal", "handoff_resolved", "result_committed", "workflow_round_advanced", "workflow_round_completed"];
|
|
276
278
|
export type RuntimeEventType = typeof RUNTIME_EVENT_TYPE_VALUES[number];
|
|
277
279
|
export interface RuntimeEvent {
|
|
278
280
|
readonly event_id: EventId;
|
|
@@ -10,6 +10,7 @@ export const TASK_STATE_VALUES = [
|
|
|
10
10
|
"ready",
|
|
11
11
|
"claimed",
|
|
12
12
|
"running",
|
|
13
|
+
"round_succeeded",
|
|
13
14
|
"succeeded",
|
|
14
15
|
"failed",
|
|
15
16
|
"skipped",
|
|
@@ -23,7 +24,14 @@ export const TASK_STATE_TRANSITIONS = {
|
|
|
23
24
|
dependency_blocked: ["ready", "skipped", "cancelled"],
|
|
24
25
|
ready: ["claimed", "skipped", "cancelled"],
|
|
25
26
|
claimed: ["ready", "running", "cancelled"],
|
|
26
|
-
running: ["ready", "succeeded", "failed", "cancelled"],
|
|
27
|
+
running: ["ready", "round_succeeded", "succeeded", "failed", "cancelled"],
|
|
28
|
+
round_succeeded: [
|
|
29
|
+
"dependency_blocked",
|
|
30
|
+
"ready",
|
|
31
|
+
"succeeded",
|
|
32
|
+
"skipped",
|
|
33
|
+
"cancelled",
|
|
34
|
+
],
|
|
27
35
|
succeeded: [],
|
|
28
36
|
failed: [],
|
|
29
37
|
skipped: [],
|
|
@@ -55,4 +63,6 @@ export const RUNTIME_EVENT_TYPE_VALUES = [
|
|
|
55
63
|
"attempt_terminal",
|
|
56
64
|
"handoff_resolved",
|
|
57
65
|
"result_committed",
|
|
66
|
+
"workflow_round_advanced",
|
|
67
|
+
"workflow_round_completed",
|
|
58
68
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AttemptId, AttemptIdentity, AttemptRecord, ClaimToken, EventId, HandoffBinding, ResultId, RetryPolicy, RunId, StepId, StepPacket, TaskClaim, WorkerSessionId } from "./run-contracts.js";
|
|
1
|
+
import type { AttemptId, AttemptIdentity, AttemptRecord, ClaimToken, EventId, HandoffBinding, ResultId, RetryBackoff, RetryPolicy, RunId, StepId, StepPacket, TaskClaim, WorkerSessionId } from "./run-contracts.js";
|
|
2
2
|
import type { ExecutionProvider } from "./execution-provider.js";
|
|
3
3
|
import { HandoffResolver, type QuoteHandoffRequest } from "./handoff-resolver.js";
|
|
4
4
|
import { DurableRunStore, type RunRecord, type RunStoreSnapshot } from "./run-store.js";
|
|
@@ -35,6 +35,7 @@ export interface ControllerNoHandoff extends ControllerHandoffBase {
|
|
|
35
35
|
export type ControllerHandoffDeclaration = ControllerReferenceHandoff | ControllerQuoteHandoff | ControllerStructuredHandoff | ControllerNoHandoff;
|
|
36
36
|
export interface MaterializeStepPacketInput extends AttemptIdentity {
|
|
37
37
|
readonly attempt_number: number;
|
|
38
|
+
readonly workflow_round: number;
|
|
38
39
|
readonly input_bindings: readonly HandoffBinding[];
|
|
39
40
|
readonly retry_policy: RetryPolicy;
|
|
40
41
|
readonly created_at: string;
|
|
@@ -52,12 +53,22 @@ export interface ControllerStepDefinition {
|
|
|
52
53
|
readonly handoffs: readonly ControllerHandoffDeclaration[];
|
|
53
54
|
materialize_packet(input: MaterializeStepPacketInput): StepPacket;
|
|
54
55
|
}
|
|
56
|
+
export interface WorkflowRetryLoopPolicy {
|
|
57
|
+
readonly retry_from: StepId;
|
|
58
|
+
readonly step_ids: readonly StepId[];
|
|
59
|
+
readonly completion_step: StepId;
|
|
60
|
+
readonly max_retries: number;
|
|
61
|
+
readonly backoff: RetryBackoff;
|
|
62
|
+
readonly initial_delay_ms: number;
|
|
63
|
+
readonly max_delay_ms: number | null;
|
|
64
|
+
}
|
|
55
65
|
export type ReconciledAttemptState = "live" | "dead" | "unknown";
|
|
56
66
|
export type AttemptReconciler = (attempt: AttemptRecord, claim: TaskClaim) => Promise<ReconciledAttemptState>;
|
|
57
67
|
export interface RunControllerOptions {
|
|
58
68
|
readonly run_store: DurableRunStore;
|
|
59
69
|
readonly handoff_resolver?: HandoffResolver;
|
|
60
70
|
readonly steps: readonly ControllerStepDefinition[];
|
|
71
|
+
readonly workflow_retry_loop?: WorkflowRetryLoopPolicy | null;
|
|
61
72
|
readonly provider_for_step: (definition: ControllerStepDefinition) => ExecutionProvider;
|
|
62
73
|
readonly max_concurrency: number;
|
|
63
74
|
readonly lease_duration_ms: number;
|
|
@@ -93,6 +104,8 @@ export declare class RunController {
|
|
|
93
104
|
private readonly resolver;
|
|
94
105
|
private readonly definitions;
|
|
95
106
|
private readonly definitionByStep;
|
|
107
|
+
private readonly workflowRetryLoop;
|
|
108
|
+
private readonly workflowRetrySteps;
|
|
96
109
|
private readonly providerForStep;
|
|
97
110
|
private readonly maxConcurrency;
|
|
98
111
|
private readonly leaseDurationMs;
|
|
@@ -111,6 +124,7 @@ export declare class RunController {
|
|
|
111
124
|
private readonly active;
|
|
112
125
|
constructor(options: RunControllerOptions);
|
|
113
126
|
private validateDefinitions;
|
|
127
|
+
private validateWorkflowRetryLoop;
|
|
114
128
|
private events;
|
|
115
129
|
createRun(input: CreateControllerRunInput): Promise<RunStoreSnapshot>;
|
|
116
130
|
inspect(runId: RunId): Promise<RunStoreSnapshot>;
|