@codemation/core 0.11.0 → 0.12.0
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 +16 -0
- package/dist/CostCatalogContract-DD7fQ4FF.d.cts +19 -0
- package/dist/{EngineRuntimeRegistration.types-MPYWsEM0.d.cts → EngineRuntimeRegistration.types-DTV5_7Jw.d.cts} +3 -2
- package/dist/{EngineRuntimeRegistration.types-BZ_1XWAJ.d.ts → EngineRuntimeRegistration.types-Dl92Hdoi.d.ts} +2 -2
- package/dist/InMemoryRunDataFactory-qMiYjhCK.d.cts +202 -0
- package/dist/{InMemoryRunEventBusRegistry-sM4z4n_i.js → InMemoryRunEventBusRegistry-Bwunvt1T.js} +1 -1
- package/dist/{InMemoryRunEventBusRegistry-sM4z4n_i.js.map → InMemoryRunEventBusRegistry-Bwunvt1T.js.map} +1 -1
- package/dist/{InMemoryRunEventBusRegistry-VM3OWnHo.cjs → InMemoryRunEventBusRegistry-Sa86VxuV.cjs} +1 -1
- package/dist/{InMemoryRunEventBusRegistry-VM3OWnHo.cjs.map → InMemoryRunEventBusRegistry-Sa86VxuV.cjs.map} +1 -1
- package/dist/ItemsInputNormalizer-BhuxvZh5.js +36 -0
- package/dist/ItemsInputNormalizer-BhuxvZh5.js.map +1 -0
- package/dist/ItemsInputNormalizer-C09a7iFP.d.ts +321 -0
- package/dist/ItemsInputNormalizer-DLaD6rTl.d.cts +407 -0
- package/dist/ItemsInputNormalizer-Div-fb6a.cjs +43 -0
- package/dist/ItemsInputNormalizer-Div-fb6a.cjs.map +1 -0
- package/dist/RunIntentService-BOSGwmqn.d.ts +299 -0
- package/dist/RunIntentService-CWMMrAP4.d.cts +220 -0
- package/dist/{RunIntentService-MUHJ1bhO.d.cts → agentMcpTypes-DUmniLOY.d.cts} +183 -206
- package/dist/bootstrap/index.cjs +4 -2
- package/dist/bootstrap/index.d.cts +63 -5
- package/dist/bootstrap/index.d.ts +5 -4
- package/dist/bootstrap/index.js +4 -2
- package/dist/{bootstrap-Dgzsjoj7.js → bootstrap-CKTMMNmL.js} +174 -3
- package/dist/bootstrap-CKTMMNmL.js.map +1 -0
- package/dist/{bootstrap-dVmpU1ju.cjs → bootstrap-D460dCgS.cjs} +209 -36
- package/dist/bootstrap-D460dCgS.cjs.map +1 -0
- package/dist/browser.cjs +17 -0
- package/dist/browser.d.cts +4 -0
- package/dist/browser.d.ts +3 -0
- package/dist/browser.js +4 -0
- package/dist/contracts-CK0x6w_G.cjs +74 -0
- package/dist/contracts-CK0x6w_G.cjs.map +1 -0
- package/dist/contracts-DXdfTdpW.js +50 -0
- package/dist/contracts-DXdfTdpW.js.map +1 -0
- package/dist/contracts.cjs +6 -0
- package/dist/contracts.d.cts +5 -0
- package/dist/contracts.d.ts +2 -0
- package/dist/contracts.js +3 -0
- package/dist/di-DdsgWfVy.js +405 -0
- package/dist/di-DdsgWfVy.js.map +1 -0
- package/dist/di-tO6R7VJV.cjs +524 -0
- package/dist/di-tO6R7VJV.cjs.map +1 -0
- package/dist/executionPersistenceContracts-DenJJK2T.d.cts +275 -0
- package/dist/{index-Bes88mxT.d.ts → index-BZDhEQ6W.d.ts} +278 -415
- package/dist/{RunIntentService-BrEq6Jm6.d.ts → index-CSKKuK60.d.ts} +441 -286
- package/dist/index.cjs +97 -250
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +395 -803
- package/dist/index.d.ts +5 -3
- package/dist/index.js +58 -224
- package/dist/index.js.map +1 -1
- package/dist/params-DqRvku2h.d.cts +44 -0
- package/dist/{runtime-Duf3ClPw.js → runtime-BPZgnZ9G.js} +591 -382
- package/dist/runtime-BPZgnZ9G.js.map +1 -0
- package/dist/{runtime-vH0EeZzH.cjs → runtime-CyW9c9XM.cjs} +651 -500
- package/dist/runtime-CyW9c9XM.cjs.map +1 -0
- package/dist/testing.cjs +23 -21
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +3 -2
- package/dist/testing.d.ts +3 -2
- package/dist/testing.js +5 -3
- package/dist/testing.js.map +1 -1
- package/package.json +9 -5
- package/src/ai/AgentConnectionNodeCollector.ts +1 -1
- package/src/authoring/defineHumanApprovalNode.types.ts +379 -0
- package/src/authoring/index.ts +6 -0
- package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +29 -0
- package/src/contracts/CodemationTelemetryAttributeNames.ts +10 -0
- package/src/contracts/credentialTypes.ts +10 -0
- package/src/contracts/hitlSeamTypes.ts +34 -0
- package/src/contracts/humanTaskStoreTypes.ts +48 -0
- package/src/contracts/inboxChannelTypes.ts +58 -0
- package/src/contracts/index.ts +3 -0
- package/src/contracts/runTypes.ts +61 -3
- package/src/contracts/runtimeTypes.ts +112 -0
- package/src/credentials/CredentialMaterialProvider.types.ts +61 -0
- package/src/credentials/ManagedCredentialMaterialWriteError.ts +14 -0
- package/src/credentials/ManagedMaterialFetchError.ts +16 -0
- package/src/execution/ActivationEnqueueService.ts +16 -0
- package/src/execution/DefaultExecutionContextFactory.ts +11 -0
- package/src/execution/NodeExecutionSnapshotFactory.ts +7 -1
- package/src/execution/NodeExecutor.ts +60 -1
- package/src/execution/NodeExecutorFactory.ts +12 -2
- package/src/execution/NodeSuspensionHandler.ts +220 -0
- package/src/execution/PersistedRunStateTerminalBuilder.ts +5 -2
- package/src/execution/RunStateSemantics.ts +5 -0
- package/src/execution/RunSuspendedError.ts +21 -0
- package/src/index.ts +40 -0
- package/src/orchestration/Engine.ts +12 -2
- package/src/orchestration/EngineWaiters.ts +1 -1
- package/src/orchestration/NodeExecutionRequestHandlerService.ts +25 -2
- package/src/orchestration/RunContinuationService.ts +226 -2
- package/src/orchestration/TestSuiteOrchestrator.ts +5 -4
- package/src/runtime/RunIntentService.ts +3 -0
- package/src/workflow/dsl/ChainCursorResolver.ts +36 -0
- package/tsdown.config.ts +1 -1
- package/dist/InMemoryRunDataFactory-hmkh0lzR.d.cts +0 -138
- package/dist/bootstrap-Dgzsjoj7.js.map +0 -1
- package/dist/bootstrap-dVmpU1ju.cjs.map +0 -1
- package/dist/runtime-Duf3ClPw.js.map +0 -1
- package/dist/runtime-vH0EeZzH.cjs.map +0 -1
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { $t as PersistedRunState, Ar as RunId, Bt as CurrentStateExecutionRequest, Di as LiveWorkflowRepository, Dr as PersistedRunPolicySnapshot, Er as ParentExecutionRef, Gi as ResumeContext, Hn as EngineExecutionLimitsPolicyConfig, Hr as WorkflowErrorHandlerSpec, Ii as NodeExecutionRequest, Jr as WorkflowStoragePolicyDecisionArgs, Kr as WorkflowPolicyRuntimeDefaults, Kt as NodeInputsByPort, Li as NodeExecutionRequestHandler, Oo as WorkflowId, Sr as NodeOutputs, To as NodeId, Vi as NodeResolver, Vn as EngineExecutionLimitsPolicy, Vr as WorkflowErrorHandler, ca as WorkflowSnapshotResolver, cn as RunExecutionOptions, dr as NodeActivationId, fa as WebhookInvocationMatch, fn as RunResult, fr as NodeConfigBase, gr as NodeErrorHandlerSpec, hn as RunStopCondition, ia as WorkflowRepository, ir as Items, ki as NodeActivationContinuation, la as HttpMethod, ma as WebhookTriggerResolution, mr as NodeErrorHandler, nn as PersistedWorkflowSnapshotNode, on as RunCurrentState, pa as WebhookTriggerMatcher, rn as PersistedWorkflowTokenRegistryLike, tn as PersistedWorkflowSnapshot, vn as WebhookRunResult, xn as WorkflowExecutionRepository, zr as WorkflowDefinition } from "./index-CSKKuK60.js";
|
|
2
|
+
|
|
3
|
+
//#region src/orchestration/Engine.d.ts
|
|
4
|
+
interface EngineTriggerRuntime {
|
|
5
|
+
startTriggers(): Promise<void>;
|
|
6
|
+
stop(): Promise<void>;
|
|
7
|
+
syncWorkflowTriggersForActivation(workflowId: WorkflowId): Promise<void>;
|
|
8
|
+
createTriggerTestItems(args: {
|
|
9
|
+
workflow: WorkflowDefinition;
|
|
10
|
+
nodeId: NodeId;
|
|
11
|
+
}): Promise<Items | undefined>;
|
|
12
|
+
}
|
|
13
|
+
interface EngineRunStartService {
|
|
14
|
+
runWorkflow(wf: WorkflowDefinition, startAt: NodeId, items: Items, parent?: ParentExecutionRef, executionOptions?: RunExecutionOptions, persistedStateOverrides?: Readonly<{
|
|
15
|
+
workflowSnapshot?: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["workflowSnapshot"];
|
|
16
|
+
mutableState?: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["mutableState"];
|
|
17
|
+
}>): Promise<RunResult>;
|
|
18
|
+
runWorkflowFromState(request: CurrentStateExecutionRequest): Promise<RunResult>;
|
|
19
|
+
}
|
|
20
|
+
interface EngineRunContinuationService {
|
|
21
|
+
markNodeRunning(args: {
|
|
22
|
+
runId: RunId;
|
|
23
|
+
activationId: NodeActivationId;
|
|
24
|
+
nodeId: NodeId;
|
|
25
|
+
inputsByPort: NodeInputsByPort;
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
resumeFromNodeResult(args: {
|
|
28
|
+
runId: RunId;
|
|
29
|
+
activationId: NodeActivationId;
|
|
30
|
+
nodeId: NodeId;
|
|
31
|
+
outputs: NodeOutputs;
|
|
32
|
+
}): Promise<RunResult>;
|
|
33
|
+
resumeFromNodeError(args: {
|
|
34
|
+
runId: RunId;
|
|
35
|
+
activationId: NodeActivationId;
|
|
36
|
+
nodeId: NodeId;
|
|
37
|
+
error: Error;
|
|
38
|
+
}): Promise<RunResult>;
|
|
39
|
+
resumeFromStepResult(args: {
|
|
40
|
+
runId: RunId;
|
|
41
|
+
activationId: NodeActivationId;
|
|
42
|
+
nodeId: NodeId;
|
|
43
|
+
outputs: NodeOutputs;
|
|
44
|
+
}): Promise<RunResult>;
|
|
45
|
+
resumeFromStepError(args: {
|
|
46
|
+
runId: RunId;
|
|
47
|
+
activationId: NodeActivationId;
|
|
48
|
+
nodeId: NodeId;
|
|
49
|
+
error: Error;
|
|
50
|
+
}): Promise<RunResult>;
|
|
51
|
+
waitForCompletion(runId: RunId): Promise<Extract<RunResult, {
|
|
52
|
+
status: "completed" | "failed" | "halted";
|
|
53
|
+
}>>;
|
|
54
|
+
waitForWebhookResponse(runId: RunId): Promise<WebhookRunResult>;
|
|
55
|
+
resumeRun(args: {
|
|
56
|
+
runId: RunId;
|
|
57
|
+
taskId: string;
|
|
58
|
+
resumeContext: ResumeContext;
|
|
59
|
+
}): Promise<RunResult>;
|
|
60
|
+
}
|
|
61
|
+
interface EngineNodeExecutionRequestHandler {
|
|
62
|
+
handleNodeExecutionRequest(request: NodeExecutionRequest): Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
interface EngineFacadeDeps {
|
|
65
|
+
liveWorkflowRepository: LiveWorkflowRepository;
|
|
66
|
+
tokenRegistry: PersistedWorkflowTokenRegistryLike;
|
|
67
|
+
webhookTriggerMatcher: WebhookTriggerMatcher;
|
|
68
|
+
workflowSnapshotResolver: WorkflowSnapshotResolver;
|
|
69
|
+
triggerRuntime: EngineTriggerRuntime;
|
|
70
|
+
runStartService: EngineRunStartService;
|
|
71
|
+
runContinuationService: EngineRunContinuationService;
|
|
72
|
+
nodeExecutionRequestHandler: EngineNodeExecutionRequestHandler;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Runtime facade for orchestration, continuation, triggers, and webhook routing.
|
|
76
|
+
* Prefer {@link import("../intents/RunIntentService").RunIntentService} for host/HTTP invocation boundaries.
|
|
77
|
+
* The class token is exported from `@codemation/core/bootstrap` (not the main `@codemation/core` barrel).
|
|
78
|
+
*/
|
|
79
|
+
declare class Engine implements NodeActivationContinuation, NodeExecutionRequestHandler {
|
|
80
|
+
private readonly deps;
|
|
81
|
+
constructor(deps: EngineFacadeDeps);
|
|
82
|
+
loadWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void;
|
|
83
|
+
getTokenRegistry(): EngineFacadeDeps["tokenRegistry"];
|
|
84
|
+
resolveWorkflowSnapshot(args: {
|
|
85
|
+
workflowId: WorkflowId;
|
|
86
|
+
workflowSnapshot?: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["workflowSnapshot"];
|
|
87
|
+
}): WorkflowDefinition | undefined;
|
|
88
|
+
startTriggers(): Promise<void>;
|
|
89
|
+
syncWorkflowTriggersForActivation(workflowId: WorkflowId): Promise<void>;
|
|
90
|
+
start(workflows: WorkflowDefinition[]): Promise<void>;
|
|
91
|
+
stop(): Promise<void>;
|
|
92
|
+
resolveWebhookTrigger(args: {
|
|
93
|
+
endpointPath: string;
|
|
94
|
+
method: HttpMethod;
|
|
95
|
+
}): WebhookTriggerResolution;
|
|
96
|
+
createTriggerTestItems(args: {
|
|
97
|
+
workflow: WorkflowDefinition;
|
|
98
|
+
nodeId: NodeId;
|
|
99
|
+
}): Promise<Items | undefined>;
|
|
100
|
+
runWorkflow(wf: WorkflowDefinition, startAt: NodeId, items: Items, parent?: ParentExecutionRef, executionOptions?: RunExecutionOptions, persistedStateOverrides?: Readonly<{
|
|
101
|
+
workflowSnapshot?: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["workflowSnapshot"];
|
|
102
|
+
mutableState?: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["mutableState"];
|
|
103
|
+
}>): Promise<RunResult>;
|
|
104
|
+
runWorkflowFromState(request: CurrentStateExecutionRequest): Promise<RunResult>;
|
|
105
|
+
markNodeRunning(args: {
|
|
106
|
+
runId: RunId;
|
|
107
|
+
activationId: NodeActivationId;
|
|
108
|
+
nodeId: NodeId;
|
|
109
|
+
inputsByPort: NodeInputsByPort;
|
|
110
|
+
}): Promise<void>;
|
|
111
|
+
resumeFromNodeResult(args: {
|
|
112
|
+
runId: RunId;
|
|
113
|
+
activationId: NodeActivationId;
|
|
114
|
+
nodeId: NodeId;
|
|
115
|
+
outputs: NodeOutputs;
|
|
116
|
+
}): Promise<RunResult>;
|
|
117
|
+
resumeFromNodeError(args: {
|
|
118
|
+
runId: RunId;
|
|
119
|
+
activationId: NodeActivationId;
|
|
120
|
+
nodeId: NodeId;
|
|
121
|
+
error: Error;
|
|
122
|
+
}): Promise<RunResult>;
|
|
123
|
+
resumeFromStepResult(args: {
|
|
124
|
+
runId: RunId;
|
|
125
|
+
activationId: NodeActivationId;
|
|
126
|
+
nodeId: NodeId;
|
|
127
|
+
outputs: NodeOutputs;
|
|
128
|
+
}): Promise<RunResult>;
|
|
129
|
+
resumeFromStepError(args: {
|
|
130
|
+
runId: RunId;
|
|
131
|
+
activationId: NodeActivationId;
|
|
132
|
+
nodeId: NodeId;
|
|
133
|
+
error: Error;
|
|
134
|
+
}): Promise<RunResult>;
|
|
135
|
+
waitForCompletion(runId: RunId): Promise<Extract<RunResult, {
|
|
136
|
+
status: "completed" | "failed" | "halted";
|
|
137
|
+
}>>;
|
|
138
|
+
waitForWebhookResponse(runId: RunId): Promise<WebhookRunResult>;
|
|
139
|
+
/**
|
|
140
|
+
* Re-activate a suspended run item with a human decision (HITL).
|
|
141
|
+
* The HTTP resume endpoint calls this; this method exposes the engine primitive.
|
|
142
|
+
*/
|
|
143
|
+
resumeRun(args: {
|
|
144
|
+
runId: RunId;
|
|
145
|
+
taskId: string;
|
|
146
|
+
resumeContext: ResumeContext;
|
|
147
|
+
}): Promise<RunResult>;
|
|
148
|
+
handleNodeExecutionRequest(request: NodeExecutionRequest): Promise<void>;
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/policies/storage/WorkflowStoragePolicyEvaluator.d.ts
|
|
152
|
+
declare class WorkflowStoragePolicyEvaluator {
|
|
153
|
+
private readonly nodeResolver;
|
|
154
|
+
constructor(nodeResolver: NodeResolver);
|
|
155
|
+
shouldPersist(workflow: WorkflowDefinition, snapshot: PersistedRunPolicySnapshot | undefined, args: WorkflowStoragePolicyDecisionArgs): Promise<boolean>;
|
|
156
|
+
private modeMatches;
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/policies/storage/RunTerminalPersistenceCoordinator.d.ts
|
|
160
|
+
declare class RunTerminalPersistenceCoordinator {
|
|
161
|
+
private readonly runRepository;
|
|
162
|
+
private readonly storageEvaluator;
|
|
163
|
+
constructor(runRepository: WorkflowExecutionRepository, storageEvaluator: WorkflowStoragePolicyEvaluator);
|
|
164
|
+
maybeDeleteAfterTerminalState(args: {
|
|
165
|
+
workflow: WorkflowDefinition;
|
|
166
|
+
state: PersistedRunState;
|
|
167
|
+
finalStatus: "completed" | "failed";
|
|
168
|
+
finishedAt: string;
|
|
169
|
+
}): Promise<void>;
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/policies/WorkflowPolicyErrorServices.d.ts
|
|
173
|
+
declare class WorkflowPolicyErrorServices {
|
|
174
|
+
private readonly nodeResolver;
|
|
175
|
+
constructor(nodeResolver: NodeResolver);
|
|
176
|
+
resolveNodeErrorHandler(spec: NodeErrorHandlerSpec | undefined): NodeErrorHandler | undefined;
|
|
177
|
+
resolveWorkflowErrorHandler(spec: WorkflowErrorHandlerSpec | undefined): WorkflowErrorHandler | undefined;
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/policies/executionLimits/EngineExecutionLimitsPolicyFactory.d.ts
|
|
181
|
+
/**
|
|
182
|
+
* Builds {@link EngineExecutionLimitsPolicy} by merging {@link ENGINE_EXECUTION_LIMITS_DEFAULTS} with optional `overrides` (e.g. host `runtime.engineExecutionLimits`).
|
|
183
|
+
*/
|
|
184
|
+
declare class EngineExecutionLimitsPolicyFactory {
|
|
185
|
+
create(overrides?: Partial<EngineExecutionLimitsPolicyConfig>): EngineExecutionLimitsPolicy;
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/policies/storage/RunPolicySnapshotFactory.d.ts
|
|
189
|
+
declare class RunPolicySnapshotFactory {
|
|
190
|
+
static create(workflow: WorkflowDefinition, defaults?: WorkflowPolicyRuntimeDefaults): PersistedRunPolicySnapshot;
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/workflowSnapshots/WorkflowSnapshotCodec.d.ts
|
|
194
|
+
declare class WorkflowSnapshotCodec {
|
|
195
|
+
private readonly tokenRegistry;
|
|
196
|
+
constructor(tokenRegistry: PersistedWorkflowTokenRegistryLike);
|
|
197
|
+
create(workflow: WorkflowDefinition): PersistedWorkflowSnapshot;
|
|
198
|
+
hydrate(snapshotNode: PersistedWorkflowSnapshotNode, liveConfig: NodeConfigBase): NodeConfigBase;
|
|
199
|
+
private serializeConfig;
|
|
200
|
+
/**
|
|
201
|
+
* Safely call `config.inspectorSummary()` and return a plain JSON-safe array, or undefined.
|
|
202
|
+
* Returns undefined if the method is absent, throws, or produces no valid rows.
|
|
203
|
+
*/
|
|
204
|
+
private safeInspectorSummary;
|
|
205
|
+
private injectTokenIds;
|
|
206
|
+
private mergeValue;
|
|
207
|
+
private mergeNestedValue;
|
|
208
|
+
private restoreNonSerializableProperties;
|
|
209
|
+
private restoreTypeProperty;
|
|
210
|
+
private resolveTokenId;
|
|
211
|
+
private resolveTokenName;
|
|
212
|
+
private asTypeToken;
|
|
213
|
+
private asRecord;
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/runtime/EngineWorkflowRunnerService.d.ts
|
|
217
|
+
declare class EngineWorkflowRunnerService {
|
|
218
|
+
private readonly engine;
|
|
219
|
+
private readonly workflowRepository;
|
|
220
|
+
constructor(engine: Engine, workflowRepository: WorkflowRepository);
|
|
221
|
+
runById(args: {
|
|
222
|
+
workflowId: WorkflowId;
|
|
223
|
+
startAt?: NodeId;
|
|
224
|
+
items: Items;
|
|
225
|
+
parent?: ParentExecutionRef;
|
|
226
|
+
}): Promise<RunResult>;
|
|
227
|
+
private findDefaultStartNodeId;
|
|
228
|
+
}
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/runtime/InMemoryLiveWorkflowRepository.d.ts
|
|
231
|
+
declare class InMemoryLiveWorkflowRepository implements LiveWorkflowRepository {
|
|
232
|
+
private readonly workflowsById;
|
|
233
|
+
setWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void;
|
|
234
|
+
list(): ReadonlyArray<WorkflowDefinition>;
|
|
235
|
+
get(workflowId: WorkflowId): WorkflowDefinition | undefined;
|
|
236
|
+
}
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/runtime/RunIntentService.d.ts
|
|
239
|
+
type StartWorkflowIntent = {
|
|
240
|
+
workflow: WorkflowDefinition;
|
|
241
|
+
startAt?: string;
|
|
242
|
+
items: Items;
|
|
243
|
+
synthesizeTriggerItems?: boolean;
|
|
244
|
+
parent?: CurrentStateExecutionRequest["parent"];
|
|
245
|
+
executionOptions?: RunExecutionOptions;
|
|
246
|
+
workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
|
|
247
|
+
mutableState?: CurrentStateExecutionRequest["mutableState"];
|
|
248
|
+
currentState?: RunCurrentState;
|
|
249
|
+
stopCondition?: RunStopCondition;
|
|
250
|
+
reset?: CurrentStateExecutionRequest["reset"];
|
|
251
|
+
};
|
|
252
|
+
type RerunFromNodeIntent = {
|
|
253
|
+
workflow: WorkflowDefinition;
|
|
254
|
+
nodeId: NodeId;
|
|
255
|
+
currentState: RunCurrentState;
|
|
256
|
+
items?: Items;
|
|
257
|
+
synthesizeTriggerItems?: boolean;
|
|
258
|
+
parent?: CurrentStateExecutionRequest["parent"];
|
|
259
|
+
executionOptions?: RunExecutionOptions;
|
|
260
|
+
workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
|
|
261
|
+
mutableState?: CurrentStateExecutionRequest["mutableState"];
|
|
262
|
+
};
|
|
263
|
+
type MatchedWebhookRunIntent = {
|
|
264
|
+
endpointPath: string;
|
|
265
|
+
method: HttpMethod;
|
|
266
|
+
requestItem: Items[number];
|
|
267
|
+
};
|
|
268
|
+
type WebhookMatchRunIntent = {
|
|
269
|
+
match: WebhookInvocationMatch;
|
|
270
|
+
requestItem: Items[number];
|
|
271
|
+
};
|
|
272
|
+
declare class RunIntentService {
|
|
273
|
+
private readonly engine;
|
|
274
|
+
private readonly workflowRepository;
|
|
275
|
+
constructor(engine: Engine, workflowRepository: WorkflowRepository);
|
|
276
|
+
startWorkflow(args: StartWorkflowIntent): Promise<RunResult>;
|
|
277
|
+
rerunFromNode(args: RerunFromNodeIntent): Promise<RunResult>;
|
|
278
|
+
private resolveStartWorkflowItems;
|
|
279
|
+
private resolveRerunItems;
|
|
280
|
+
private resolveStartWorkflowTriggerNodeId;
|
|
281
|
+
private resolveRerunTriggerNodeId;
|
|
282
|
+
private firstTriggerNodeId;
|
|
283
|
+
private isTriggerNode;
|
|
284
|
+
private hasNonEmptyItems;
|
|
285
|
+
resolveWebhookTrigger(args: {
|
|
286
|
+
endpointPath: string;
|
|
287
|
+
method: HttpMethod;
|
|
288
|
+
}): WebhookTriggerResolution;
|
|
289
|
+
runMatchedWebhook(args: MatchedWebhookRunIntent): Promise<WebhookRunResult>;
|
|
290
|
+
runWebhookMatch(args: WebhookMatchRunIntent): Promise<WebhookRunResult>;
|
|
291
|
+
/**
|
|
292
|
+
* Webhook-triggered runs always force inline execution first.
|
|
293
|
+
* This is the highest-precedence scheduler override: it wins over node hints and container defaults.
|
|
294
|
+
*/
|
|
295
|
+
private createWebhookExecutionOptions;
|
|
296
|
+
}
|
|
297
|
+
//#endregion
|
|
298
|
+
export { RunPolicySnapshotFactory as a, RunTerminalPersistenceCoordinator as c, WorkflowSnapshotCodec as i, WorkflowStoragePolicyEvaluator as l, InMemoryLiveWorkflowRepository as n, EngineExecutionLimitsPolicyFactory as o, EngineWorkflowRunnerService as r, WorkflowPolicyErrorServices as s, RunIntentService as t, Engine as u };
|
|
299
|
+
//# sourceMappingURL=RunIntentService-BOSGwmqn.d.ts.map
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { Ar as HttpMethod, D as RunCurrentState, Fr as WebhookTriggerResolution, H as WorkflowExecutionRepository, I as RunStopCondition, Jn as LiveWorkflowRepository, Ki as NodeId, Mt as NodeActivationId, N as RunResult, Nr as WebhookInvocationMatch, Pr as WebhookTriggerMatcher, Tr as WorkflowRepository, Tt as Items, Ut as NodeOutputs, Xn as NodeActivationContinuation, Yi as WorkflowId, Zt as RunId, fr as ResumeContext, ir as NodeExecutionRequestHandler, k as RunExecutionOptions, kr as WorkflowSnapshotResolver, on as WorkflowDefinition, p as NodeInputsByPort, qt as ParentExecutionRef, rr as NodeExecutionRequest, s as CurrentStateExecutionRequest, w as PersistedWorkflowTokenRegistryLike, z as WebhookRunResult } from "./agentMcpTypes-DUmniLOY.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/orchestration/Engine.d.ts
|
|
4
|
+
interface EngineTriggerRuntime {
|
|
5
|
+
startTriggers(): Promise<void>;
|
|
6
|
+
stop(): Promise<void>;
|
|
7
|
+
syncWorkflowTriggersForActivation(workflowId: WorkflowId): Promise<void>;
|
|
8
|
+
createTriggerTestItems(args: {
|
|
9
|
+
workflow: WorkflowDefinition;
|
|
10
|
+
nodeId: NodeId;
|
|
11
|
+
}): Promise<Items | undefined>;
|
|
12
|
+
}
|
|
13
|
+
interface EngineRunStartService {
|
|
14
|
+
runWorkflow(wf: WorkflowDefinition, startAt: NodeId, items: Items, parent?: ParentExecutionRef, executionOptions?: RunExecutionOptions, persistedStateOverrides?: Readonly<{
|
|
15
|
+
workflowSnapshot?: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["workflowSnapshot"];
|
|
16
|
+
mutableState?: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["mutableState"];
|
|
17
|
+
}>): Promise<RunResult>;
|
|
18
|
+
runWorkflowFromState(request: CurrentStateExecutionRequest): Promise<RunResult>;
|
|
19
|
+
}
|
|
20
|
+
interface EngineRunContinuationService {
|
|
21
|
+
markNodeRunning(args: {
|
|
22
|
+
runId: RunId;
|
|
23
|
+
activationId: NodeActivationId;
|
|
24
|
+
nodeId: NodeId;
|
|
25
|
+
inputsByPort: NodeInputsByPort;
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
resumeFromNodeResult(args: {
|
|
28
|
+
runId: RunId;
|
|
29
|
+
activationId: NodeActivationId;
|
|
30
|
+
nodeId: NodeId;
|
|
31
|
+
outputs: NodeOutputs;
|
|
32
|
+
}): Promise<RunResult>;
|
|
33
|
+
resumeFromNodeError(args: {
|
|
34
|
+
runId: RunId;
|
|
35
|
+
activationId: NodeActivationId;
|
|
36
|
+
nodeId: NodeId;
|
|
37
|
+
error: Error;
|
|
38
|
+
}): Promise<RunResult>;
|
|
39
|
+
resumeFromStepResult(args: {
|
|
40
|
+
runId: RunId;
|
|
41
|
+
activationId: NodeActivationId;
|
|
42
|
+
nodeId: NodeId;
|
|
43
|
+
outputs: NodeOutputs;
|
|
44
|
+
}): Promise<RunResult>;
|
|
45
|
+
resumeFromStepError(args: {
|
|
46
|
+
runId: RunId;
|
|
47
|
+
activationId: NodeActivationId;
|
|
48
|
+
nodeId: NodeId;
|
|
49
|
+
error: Error;
|
|
50
|
+
}): Promise<RunResult>;
|
|
51
|
+
waitForCompletion(runId: RunId): Promise<Extract<RunResult, {
|
|
52
|
+
status: "completed" | "failed" | "halted";
|
|
53
|
+
}>>;
|
|
54
|
+
waitForWebhookResponse(runId: RunId): Promise<WebhookRunResult>;
|
|
55
|
+
resumeRun(args: {
|
|
56
|
+
runId: RunId;
|
|
57
|
+
taskId: string;
|
|
58
|
+
resumeContext: ResumeContext;
|
|
59
|
+
}): Promise<RunResult>;
|
|
60
|
+
}
|
|
61
|
+
interface EngineNodeExecutionRequestHandler {
|
|
62
|
+
handleNodeExecutionRequest(request: NodeExecutionRequest): Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
interface EngineFacadeDeps {
|
|
65
|
+
liveWorkflowRepository: LiveWorkflowRepository;
|
|
66
|
+
tokenRegistry: PersistedWorkflowTokenRegistryLike;
|
|
67
|
+
webhookTriggerMatcher: WebhookTriggerMatcher;
|
|
68
|
+
workflowSnapshotResolver: WorkflowSnapshotResolver;
|
|
69
|
+
triggerRuntime: EngineTriggerRuntime;
|
|
70
|
+
runStartService: EngineRunStartService;
|
|
71
|
+
runContinuationService: EngineRunContinuationService;
|
|
72
|
+
nodeExecutionRequestHandler: EngineNodeExecutionRequestHandler;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Runtime facade for orchestration, continuation, triggers, and webhook routing.
|
|
76
|
+
* Prefer {@link import("../intents/RunIntentService").RunIntentService} for host/HTTP invocation boundaries.
|
|
77
|
+
* The class token is exported from `@codemation/core/bootstrap` (not the main `@codemation/core` barrel).
|
|
78
|
+
*/
|
|
79
|
+
declare class Engine implements NodeActivationContinuation, NodeExecutionRequestHandler {
|
|
80
|
+
private readonly deps;
|
|
81
|
+
constructor(deps: EngineFacadeDeps);
|
|
82
|
+
loadWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void;
|
|
83
|
+
getTokenRegistry(): EngineFacadeDeps["tokenRegistry"];
|
|
84
|
+
resolveWorkflowSnapshot(args: {
|
|
85
|
+
workflowId: WorkflowId;
|
|
86
|
+
workflowSnapshot?: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["workflowSnapshot"];
|
|
87
|
+
}): WorkflowDefinition | undefined;
|
|
88
|
+
startTriggers(): Promise<void>;
|
|
89
|
+
syncWorkflowTriggersForActivation(workflowId: WorkflowId): Promise<void>;
|
|
90
|
+
start(workflows: WorkflowDefinition[]): Promise<void>;
|
|
91
|
+
stop(): Promise<void>;
|
|
92
|
+
resolveWebhookTrigger(args: {
|
|
93
|
+
endpointPath: string;
|
|
94
|
+
method: HttpMethod;
|
|
95
|
+
}): WebhookTriggerResolution;
|
|
96
|
+
createTriggerTestItems(args: {
|
|
97
|
+
workflow: WorkflowDefinition;
|
|
98
|
+
nodeId: NodeId;
|
|
99
|
+
}): Promise<Items | undefined>;
|
|
100
|
+
runWorkflow(wf: WorkflowDefinition, startAt: NodeId, items: Items, parent?: ParentExecutionRef, executionOptions?: RunExecutionOptions, persistedStateOverrides?: Readonly<{
|
|
101
|
+
workflowSnapshot?: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["workflowSnapshot"];
|
|
102
|
+
mutableState?: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["mutableState"];
|
|
103
|
+
}>): Promise<RunResult>;
|
|
104
|
+
runWorkflowFromState(request: CurrentStateExecutionRequest): Promise<RunResult>;
|
|
105
|
+
markNodeRunning(args: {
|
|
106
|
+
runId: RunId;
|
|
107
|
+
activationId: NodeActivationId;
|
|
108
|
+
nodeId: NodeId;
|
|
109
|
+
inputsByPort: NodeInputsByPort;
|
|
110
|
+
}): Promise<void>;
|
|
111
|
+
resumeFromNodeResult(args: {
|
|
112
|
+
runId: RunId;
|
|
113
|
+
activationId: NodeActivationId;
|
|
114
|
+
nodeId: NodeId;
|
|
115
|
+
outputs: NodeOutputs;
|
|
116
|
+
}): Promise<RunResult>;
|
|
117
|
+
resumeFromNodeError(args: {
|
|
118
|
+
runId: RunId;
|
|
119
|
+
activationId: NodeActivationId;
|
|
120
|
+
nodeId: NodeId;
|
|
121
|
+
error: Error;
|
|
122
|
+
}): Promise<RunResult>;
|
|
123
|
+
resumeFromStepResult(args: {
|
|
124
|
+
runId: RunId;
|
|
125
|
+
activationId: NodeActivationId;
|
|
126
|
+
nodeId: NodeId;
|
|
127
|
+
outputs: NodeOutputs;
|
|
128
|
+
}): Promise<RunResult>;
|
|
129
|
+
resumeFromStepError(args: {
|
|
130
|
+
runId: RunId;
|
|
131
|
+
activationId: NodeActivationId;
|
|
132
|
+
nodeId: NodeId;
|
|
133
|
+
error: Error;
|
|
134
|
+
}): Promise<RunResult>;
|
|
135
|
+
waitForCompletion(runId: RunId): Promise<Extract<RunResult, {
|
|
136
|
+
status: "completed" | "failed" | "halted";
|
|
137
|
+
}>>;
|
|
138
|
+
waitForWebhookResponse(runId: RunId): Promise<WebhookRunResult>;
|
|
139
|
+
/**
|
|
140
|
+
* Re-activate a suspended run item with a human decision (HITL).
|
|
141
|
+
* The HTTP resume endpoint calls this; this method exposes the engine primitive.
|
|
142
|
+
*/
|
|
143
|
+
resumeRun(args: {
|
|
144
|
+
runId: RunId;
|
|
145
|
+
taskId: string;
|
|
146
|
+
resumeContext: ResumeContext;
|
|
147
|
+
}): Promise<RunResult>;
|
|
148
|
+
handleNodeExecutionRequest(request: NodeExecutionRequest): Promise<void>;
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/runtime/InMemoryLiveWorkflowRepository.d.ts
|
|
152
|
+
declare class InMemoryLiveWorkflowRepository implements LiveWorkflowRepository {
|
|
153
|
+
private readonly workflowsById;
|
|
154
|
+
setWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void;
|
|
155
|
+
list(): ReadonlyArray<WorkflowDefinition>;
|
|
156
|
+
get(workflowId: WorkflowId): WorkflowDefinition | undefined;
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/runtime/RunIntentService.d.ts
|
|
160
|
+
type StartWorkflowIntent = {
|
|
161
|
+
workflow: WorkflowDefinition;
|
|
162
|
+
startAt?: string;
|
|
163
|
+
items: Items;
|
|
164
|
+
synthesizeTriggerItems?: boolean;
|
|
165
|
+
parent?: CurrentStateExecutionRequest["parent"];
|
|
166
|
+
executionOptions?: RunExecutionOptions;
|
|
167
|
+
workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
|
|
168
|
+
mutableState?: CurrentStateExecutionRequest["mutableState"];
|
|
169
|
+
currentState?: RunCurrentState;
|
|
170
|
+
stopCondition?: RunStopCondition;
|
|
171
|
+
reset?: CurrentStateExecutionRequest["reset"];
|
|
172
|
+
};
|
|
173
|
+
type RerunFromNodeIntent = {
|
|
174
|
+
workflow: WorkflowDefinition;
|
|
175
|
+
nodeId: NodeId;
|
|
176
|
+
currentState: RunCurrentState;
|
|
177
|
+
items?: Items;
|
|
178
|
+
synthesizeTriggerItems?: boolean;
|
|
179
|
+
parent?: CurrentStateExecutionRequest["parent"];
|
|
180
|
+
executionOptions?: RunExecutionOptions;
|
|
181
|
+
workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
|
|
182
|
+
mutableState?: CurrentStateExecutionRequest["mutableState"];
|
|
183
|
+
};
|
|
184
|
+
type MatchedWebhookRunIntent = {
|
|
185
|
+
endpointPath: string;
|
|
186
|
+
method: HttpMethod;
|
|
187
|
+
requestItem: Items[number];
|
|
188
|
+
};
|
|
189
|
+
type WebhookMatchRunIntent = {
|
|
190
|
+
match: WebhookInvocationMatch;
|
|
191
|
+
requestItem: Items[number];
|
|
192
|
+
};
|
|
193
|
+
declare class RunIntentService {
|
|
194
|
+
private readonly engine;
|
|
195
|
+
private readonly workflowRepository;
|
|
196
|
+
constructor(engine: Engine, workflowRepository: WorkflowRepository);
|
|
197
|
+
startWorkflow(args: StartWorkflowIntent): Promise<RunResult>;
|
|
198
|
+
rerunFromNode(args: RerunFromNodeIntent): Promise<RunResult>;
|
|
199
|
+
private resolveStartWorkflowItems;
|
|
200
|
+
private resolveRerunItems;
|
|
201
|
+
private resolveStartWorkflowTriggerNodeId;
|
|
202
|
+
private resolveRerunTriggerNodeId;
|
|
203
|
+
private firstTriggerNodeId;
|
|
204
|
+
private isTriggerNode;
|
|
205
|
+
private hasNonEmptyItems;
|
|
206
|
+
resolveWebhookTrigger(args: {
|
|
207
|
+
endpointPath: string;
|
|
208
|
+
method: HttpMethod;
|
|
209
|
+
}): WebhookTriggerResolution;
|
|
210
|
+
runMatchedWebhook(args: MatchedWebhookRunIntent): Promise<WebhookRunResult>;
|
|
211
|
+
runWebhookMatch(args: WebhookMatchRunIntent): Promise<WebhookRunResult>;
|
|
212
|
+
/**
|
|
213
|
+
* Webhook-triggered runs always force inline execution first.
|
|
214
|
+
* This is the highest-precedence scheduler override: it wins over node hints and container defaults.
|
|
215
|
+
*/
|
|
216
|
+
private createWebhookExecutionOptions;
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
export { InMemoryLiveWorkflowRepository as n, Engine as r, RunIntentService as t };
|
|
220
|
+
//# sourceMappingURL=RunIntentService-CWMMrAP4.d.cts.map
|