intentdna 1.8.6 → 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/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/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
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { AttemptId, AttemptIdentity, AttemptRecord, ClaimToken, EventId, HandoffBinding, ResultId, RetryPolicy, RunId, StepId, StepPacket, TaskClaim, WorkerSessionId } from "./run-contracts.js";
|
|
2
|
+
import type { ExecutionProvider } from "./execution-provider.js";
|
|
3
|
+
import { HandoffResolver, type QuoteHandoffRequest } from "./handoff-resolver.js";
|
|
4
|
+
import { DurableRunStore, type RunRecord, type RunStoreSnapshot } from "./run-store.js";
|
|
5
|
+
import { executeWorkerAttempt, type WorkerExecutorOptions } from "./worker-executor.js";
|
|
6
|
+
type SourceWithoutResultId = {
|
|
7
|
+
readonly step_id: StepId;
|
|
8
|
+
readonly output_name: string;
|
|
9
|
+
};
|
|
10
|
+
interface ControllerHandoffBase {
|
|
11
|
+
readonly binding_id: string;
|
|
12
|
+
readonly input_name: string;
|
|
13
|
+
readonly required: boolean;
|
|
14
|
+
readonly description: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ControllerReferenceHandoff extends ControllerHandoffBase {
|
|
17
|
+
readonly mode: "reference";
|
|
18
|
+
readonly source: SourceWithoutResultId;
|
|
19
|
+
}
|
|
20
|
+
export interface ControllerQuoteHandoff extends ControllerHandoffBase {
|
|
21
|
+
readonly mode: "quote";
|
|
22
|
+
readonly source: SourceWithoutResultId;
|
|
23
|
+
readonly selection: QuoteHandoffRequest["selection"];
|
|
24
|
+
}
|
|
25
|
+
export interface ControllerStructuredHandoff extends ControllerHandoffBase {
|
|
26
|
+
readonly mode: "structured";
|
|
27
|
+
readonly source: SourceWithoutResultId;
|
|
28
|
+
readonly schema_ref: string | null;
|
|
29
|
+
}
|
|
30
|
+
export interface ControllerNoHandoff extends ControllerHandoffBase {
|
|
31
|
+
readonly mode: "none";
|
|
32
|
+
readonly required: false;
|
|
33
|
+
readonly reason: string | null;
|
|
34
|
+
}
|
|
35
|
+
export type ControllerHandoffDeclaration = ControllerReferenceHandoff | ControllerQuoteHandoff | ControllerStructuredHandoff | ControllerNoHandoff;
|
|
36
|
+
export interface MaterializeStepPacketInput extends AttemptIdentity {
|
|
37
|
+
readonly attempt_number: number;
|
|
38
|
+
readonly input_bindings: readonly HandoffBinding[];
|
|
39
|
+
readonly retry_policy: RetryPolicy;
|
|
40
|
+
readonly created_at: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* M1-S06 owns adapting compiled workflow Steps into these declarations and the
|
|
44
|
+
* packet materializer. The Controller consumes them without compiling workflow
|
|
45
|
+
* syntax or adding undeclared inputs.
|
|
46
|
+
*/
|
|
47
|
+
export interface ControllerStepDefinition {
|
|
48
|
+
readonly step_id: StepId;
|
|
49
|
+
readonly dependencies: readonly StepId[];
|
|
50
|
+
readonly initially_skipped?: boolean;
|
|
51
|
+
readonly retry_policy: RetryPolicy;
|
|
52
|
+
readonly handoffs: readonly ControllerHandoffDeclaration[];
|
|
53
|
+
materialize_packet(input: MaterializeStepPacketInput): StepPacket;
|
|
54
|
+
}
|
|
55
|
+
export type ReconciledAttemptState = "live" | "dead" | "unknown";
|
|
56
|
+
export type AttemptReconciler = (attempt: AttemptRecord, claim: TaskClaim) => Promise<ReconciledAttemptState>;
|
|
57
|
+
export interface RunControllerOptions {
|
|
58
|
+
readonly run_store: DurableRunStore;
|
|
59
|
+
readonly handoff_resolver?: HandoffResolver;
|
|
60
|
+
readonly steps: readonly ControllerStepDefinition[];
|
|
61
|
+
readonly provider_for_step: (definition: ControllerStepDefinition) => ExecutionProvider;
|
|
62
|
+
readonly max_concurrency: number;
|
|
63
|
+
readonly lease_duration_ms: number;
|
|
64
|
+
readonly lease_heartbeat_ms?: number;
|
|
65
|
+
readonly scheduler_poll_ms?: number;
|
|
66
|
+
readonly owner_id?: string;
|
|
67
|
+
readonly reconcile_attempt?: AttemptReconciler;
|
|
68
|
+
readonly execute_attempt?: typeof executeWorkerAttempt;
|
|
69
|
+
readonly worker_options?: Omit<WorkerExecutorOptions, "cancellationSignal" | "cancellationReason" | "now">;
|
|
70
|
+
readonly now?: () => Date;
|
|
71
|
+
readonly create_attempt_id?: () => AttemptId;
|
|
72
|
+
readonly create_worker_session_id?: () => WorkerSessionId;
|
|
73
|
+
readonly create_claim_token?: () => ClaimToken;
|
|
74
|
+
readonly create_result_id?: () => ResultId;
|
|
75
|
+
readonly create_event_id?: () => EventId;
|
|
76
|
+
}
|
|
77
|
+
export interface CreateControllerRunInput {
|
|
78
|
+
readonly run: RunRecord;
|
|
79
|
+
}
|
|
80
|
+
export interface ClaimedStep {
|
|
81
|
+
readonly definition: ControllerStepDefinition;
|
|
82
|
+
readonly attempt: AttemptRecord;
|
|
83
|
+
readonly claim: TaskClaim;
|
|
84
|
+
readonly snapshot: RunStoreSnapshot;
|
|
85
|
+
}
|
|
86
|
+
export type RunControllerErrorCode = "invalid_configuration" | "invalid_definition" | "invalid_packet" | "claim_lost" | "run_cancelling" | "scheduler_stalled";
|
|
87
|
+
export declare class RunControllerError extends Error {
|
|
88
|
+
readonly code: RunControllerErrorCode;
|
|
89
|
+
constructor(code: RunControllerErrorCode, message: string, options?: ErrorOptions);
|
|
90
|
+
}
|
|
91
|
+
export declare class RunController {
|
|
92
|
+
private readonly store;
|
|
93
|
+
private readonly resolver;
|
|
94
|
+
private readonly definitions;
|
|
95
|
+
private readonly definitionByStep;
|
|
96
|
+
private readonly providerForStep;
|
|
97
|
+
private readonly maxConcurrency;
|
|
98
|
+
private readonly leaseDurationMs;
|
|
99
|
+
private readonly leaseHeartbeatMs;
|
|
100
|
+
private readonly schedulerPollMs;
|
|
101
|
+
private readonly ownerId;
|
|
102
|
+
private readonly reconcileAttempt;
|
|
103
|
+
private readonly executeAttempt;
|
|
104
|
+
private readonly workerOptions;
|
|
105
|
+
private readonly now;
|
|
106
|
+
private readonly createAttemptId;
|
|
107
|
+
private readonly createWorkerSessionId;
|
|
108
|
+
private readonly createClaimToken;
|
|
109
|
+
private readonly createResultId;
|
|
110
|
+
private readonly createEventId;
|
|
111
|
+
private readonly active;
|
|
112
|
+
constructor(options: RunControllerOptions);
|
|
113
|
+
private validateDefinitions;
|
|
114
|
+
private events;
|
|
115
|
+
createRun(input: CreateControllerRunInput): Promise<RunStoreSnapshot>;
|
|
116
|
+
inspect(runId: RunId): Promise<RunStoreSnapshot>;
|
|
117
|
+
private dependenciesFor;
|
|
118
|
+
/**
|
|
119
|
+
* A dependency is satisfied only by a succeeded task whose referenced result
|
|
120
|
+
* is present in the immutable committed-result collection.
|
|
121
|
+
*/
|
|
122
|
+
refreshDependencyReadiness(runId: RunId): Promise<RunStoreSnapshot>;
|
|
123
|
+
private readyAt;
|
|
124
|
+
claimNextReady(runId: RunId): Promise<ClaimedStep | null>;
|
|
125
|
+
private assertCurrentClaim;
|
|
126
|
+
renewClaim(claim: TaskClaim): Promise<TaskClaim>;
|
|
127
|
+
private markRunning;
|
|
128
|
+
private handoffRequest;
|
|
129
|
+
private persistResolvedHandoffs;
|
|
130
|
+
private materializePacket;
|
|
131
|
+
private finalizeAttempt;
|
|
132
|
+
private syntheticExecution;
|
|
133
|
+
private reclaimDeadAttempt;
|
|
134
|
+
/**
|
|
135
|
+
* Resume never infers death from lease expiry alone. Reclaim is allowed only
|
|
136
|
+
* after the injected reconciler explicitly confirms the owned worker is dead.
|
|
137
|
+
*/
|
|
138
|
+
resume(runId: RunId): Promise<RunStoreSnapshot>;
|
|
139
|
+
requestCancellation(runId: RunId, reason?: string | null): Promise<RunStoreSnapshot>;
|
|
140
|
+
private finalizeRunIfTerminal;
|
|
141
|
+
private launchClaimed;
|
|
142
|
+
/**
|
|
143
|
+
* Runs scheduling until durable terminal state. Every successful claim creates
|
|
144
|
+
* a fresh attempt and worker session; this Controller never gives a worker a
|
|
145
|
+
* second Step.
|
|
146
|
+
*/
|
|
147
|
+
runUntilTerminal(runId: RunId): Promise<RunStoreSnapshot>;
|
|
148
|
+
}
|
|
149
|
+
export {};
|