@codemation/core 0.10.2 → 0.11.1
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 +183 -0
- package/dist/CostCatalogContract-DZgcUBE4.d.cts +19 -0
- package/dist/{EngineRuntimeRegistration.types-ClLuY1FG.d.ts → EngineRuntimeRegistration.types-BQbS9_gs.d.ts} +2 -2
- package/dist/{EngineRuntimeRegistration.types-BryWi2mA.d.cts → EngineRuntimeRegistration.types-Cggm5GVY.d.cts} +8 -2
- package/dist/{InMemoryRunDataFactory-DeXNJt1O.d.cts → InMemoryRunDataFactory-C7YItvHG.d.cts} +9 -19
- 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-C_dpn76M.d.cts +407 -0
- package/dist/ItemsInputNormalizer-CwdOhSAK.cjs +43 -0
- package/dist/ItemsInputNormalizer-CwdOhSAK.cjs.map +1 -0
- package/dist/ItemsInputNormalizer-D-MH8MBs.js +36 -0
- package/dist/ItemsInputNormalizer-D-MH8MBs.js.map +1 -0
- package/dist/ItemsInputNormalizer-_Mfcd3YU.d.ts +321 -0
- package/dist/RunIntentService-BVur7x9n.d.ts +285 -0
- package/dist/RunIntentService-CEF-sFfI.d.cts +206 -0
- package/dist/{RunIntentService-BqNjrksF.d.cts → agentMcpTypes-ZiNbNsEi.d.cts} +1717 -1809
- package/dist/bootstrap/index.cjs +4 -2
- package/dist/bootstrap/index.d.cts +8 -3
- package/dist/bootstrap/index.d.ts +6 -4
- package/dist/bootstrap/index.js +4 -2
- package/dist/{bootstrap-DtjQtuvi.cjs → bootstrap-BxuTFTLB.cjs} +41 -34
- package/dist/bootstrap-BxuTFTLB.cjs.map +1 -0
- package/dist/{bootstrap-BfFKGzyj.js → bootstrap-D_Yyi0wL.js} +9 -2
- package/dist/bootstrap-D_Yyi0wL.js.map +1 -0
- package/dist/browser.cjs +16 -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-0Wop7z1y.js +376 -0
- package/dist/di-0Wop7z1y.js.map +1 -0
- package/dist/di-BlEKdoZS.cjs +489 -0
- package/dist/di-BlEKdoZS.cjs.map +1 -0
- package/dist/executionPersistenceContracts-BgZMRsTa.d.cts +275 -0
- package/dist/{index-CJQtTY_M.d.ts → index-62Ba9f7D.d.ts} +114 -320
- package/dist/{RunIntentService-CI-F8qQ7.d.ts → index-zWGtEhrf.d.ts} +1811 -1914
- package/dist/index.cjs +76 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -656
- package/dist/index.d.ts +5 -3
- package/dist/index.js +52 -50
- package/dist/index.js.map +1 -1
- package/dist/params-B5SENSzZ.d.cts +44 -0
- package/dist/{runtime-_ywksLa6.cjs → runtime-DBzq5YBi.cjs} +125 -489
- package/dist/runtime-DBzq5YBi.cjs.map +1 -0
- package/dist/{runtime-DbMjpb5d.js → runtime-cxmUkk0l.js} +117 -369
- package/dist/runtime-cxmUkk0l.js.map +1 -0
- package/dist/testing.cjs +23 -21
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +4 -3
- package/dist/testing.d.ts +3 -2
- package/dist/testing.js +5 -3
- package/dist/testing.js.map +1 -1
- package/package.json +12 -17
- package/src/ai/AgentConnectionNodeCollector.ts +47 -5
- package/src/authoring/defineNode.types.ts +21 -1
- package/src/authoring/definePollingTrigger.types.ts +20 -0
- package/src/binaries/UnavailableBinaryStorage.ts +6 -0
- package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +9 -0
- package/src/browser.ts +1 -0
- package/src/contracts/AgentBindError.ts +11 -0
- package/src/contracts/CodemationTelemetryAttributeNames.ts +4 -0
- package/src/contracts/NoOpAgentMcpIntegration.ts +13 -0
- package/src/contracts/agentMcpTypes.ts +64 -0
- package/src/contracts/index.ts +4 -0
- package/src/contracts/mcpTypes.ts +29 -0
- package/src/contracts/runTypes.ts +8 -0
- package/src/contracts/runtimeTypes.ts +4 -0
- package/src/contracts/workflowTypes.ts +21 -0
- package/src/contracts.ts +3 -0
- package/src/credentials/OAuthFlowExecutor.types.ts +45 -0
- package/src/di/CoreTokens.ts +7 -0
- package/src/execution/InProcessRetryRunner.ts +31 -5
- package/src/execution/NodeExecutor.ts +27 -7
- package/src/execution/NodeRunStateWriter.ts +2 -0
- package/src/index.ts +10 -0
- package/src/orchestration/RunContinuationService.ts +6 -2
- package/src/runStorage/InMemoryBinaryStorageRegistry.ts +10 -0
- package/src/scheduler/InlineDrivingScheduler.ts +26 -22
- package/src/types/index.ts +1 -0
- package/src/validation/WorkflowEdgePortError.types.ts +16 -0
- package/src/validation/WorkflowEdgePortValidator.ts +52 -0
- package/src/workflow/definition/ConnectionInvocationIdFactory.ts +4 -3
- package/src/workflow/definition/ConnectionNodeIdFactory.ts +25 -0
- package/src/workflow/definition/NodeIterationIdFactory.ts +5 -3
- package/src/workflowSnapshots/WorkflowSnapshotCodec.ts +42 -10
- package/tsdown.config.ts +1 -1
- package/dist/bootstrap-BfFKGzyj.js.map +0 -1
- package/dist/bootstrap-DtjQtuvi.cjs.map +0 -1
- package/dist/runtime-DbMjpb5d.js.map +0 -1
- package/dist/runtime-_ywksLa6.cjs.map +0 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { A as RunResult, Bn as LiveWorkflowRepository, Bt as NodeOutputs, Cr as WebhookInvocationMatch, D as RunExecutionOptions, Hn as NodeActivationContinuation, I as WebhookRunResult, Ii as NodeId, Jt as RunId, N as RunStopCondition, S as PersistedWorkflowTokenRegistryLike, St as Items, T as RunCurrentState, Tr as WebhookTriggerResolution, Wt as ParentExecutionRef, Xn as NodeExecutionRequestHandler, Yn as NodeExecutionRequest, br as HttpMethod, hr as WorkflowRepository, kt as NodeActivationId, p as NodeInputsByPort, rn as WorkflowDefinition, s as CurrentStateExecutionRequest, wr as WebhookTriggerMatcher, yr as WorkflowSnapshotResolver, z as WorkflowExecutionRepository, zi as WorkflowId } from "./agentMcpTypes-ZiNbNsEi.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";
|
|
53
|
+
}>>;
|
|
54
|
+
waitForWebhookResponse(runId: RunId): Promise<WebhookRunResult>;
|
|
55
|
+
}
|
|
56
|
+
interface EngineNodeExecutionRequestHandler {
|
|
57
|
+
handleNodeExecutionRequest(request: NodeExecutionRequest): Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
interface EngineFacadeDeps {
|
|
60
|
+
liveWorkflowRepository: LiveWorkflowRepository;
|
|
61
|
+
tokenRegistry: PersistedWorkflowTokenRegistryLike;
|
|
62
|
+
webhookTriggerMatcher: WebhookTriggerMatcher;
|
|
63
|
+
workflowSnapshotResolver: WorkflowSnapshotResolver;
|
|
64
|
+
triggerRuntime: EngineTriggerRuntime;
|
|
65
|
+
runStartService: EngineRunStartService;
|
|
66
|
+
runContinuationService: EngineRunContinuationService;
|
|
67
|
+
nodeExecutionRequestHandler: EngineNodeExecutionRequestHandler;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Runtime facade for orchestration, continuation, triggers, and webhook routing.
|
|
71
|
+
* Prefer {@link import("../intents/RunIntentService").RunIntentService} for host/HTTP invocation boundaries.
|
|
72
|
+
* The class token is exported from `@codemation/core/bootstrap` (not the main `@codemation/core` barrel).
|
|
73
|
+
*/
|
|
74
|
+
declare class Engine implements NodeActivationContinuation, NodeExecutionRequestHandler {
|
|
75
|
+
private readonly deps;
|
|
76
|
+
constructor(deps: EngineFacadeDeps);
|
|
77
|
+
loadWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void;
|
|
78
|
+
getTokenRegistry(): EngineFacadeDeps["tokenRegistry"];
|
|
79
|
+
resolveWorkflowSnapshot(args: {
|
|
80
|
+
workflowId: WorkflowId;
|
|
81
|
+
workflowSnapshot?: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["workflowSnapshot"];
|
|
82
|
+
}): WorkflowDefinition | undefined;
|
|
83
|
+
startTriggers(): Promise<void>;
|
|
84
|
+
syncWorkflowTriggersForActivation(workflowId: WorkflowId): Promise<void>;
|
|
85
|
+
start(workflows: WorkflowDefinition[]): Promise<void>;
|
|
86
|
+
stop(): Promise<void>;
|
|
87
|
+
resolveWebhookTrigger(args: {
|
|
88
|
+
endpointPath: string;
|
|
89
|
+
method: HttpMethod;
|
|
90
|
+
}): WebhookTriggerResolution;
|
|
91
|
+
createTriggerTestItems(args: {
|
|
92
|
+
workflow: WorkflowDefinition;
|
|
93
|
+
nodeId: NodeId;
|
|
94
|
+
}): Promise<Items | undefined>;
|
|
95
|
+
runWorkflow(wf: WorkflowDefinition, startAt: NodeId, items: Items, parent?: ParentExecutionRef, executionOptions?: RunExecutionOptions, persistedStateOverrides?: Readonly<{
|
|
96
|
+
workflowSnapshot?: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["workflowSnapshot"];
|
|
97
|
+
mutableState?: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["mutableState"];
|
|
98
|
+
}>): Promise<RunResult>;
|
|
99
|
+
runWorkflowFromState(request: CurrentStateExecutionRequest): Promise<RunResult>;
|
|
100
|
+
markNodeRunning(args: {
|
|
101
|
+
runId: RunId;
|
|
102
|
+
activationId: NodeActivationId;
|
|
103
|
+
nodeId: NodeId;
|
|
104
|
+
inputsByPort: NodeInputsByPort;
|
|
105
|
+
}): Promise<void>;
|
|
106
|
+
resumeFromNodeResult(args: {
|
|
107
|
+
runId: RunId;
|
|
108
|
+
activationId: NodeActivationId;
|
|
109
|
+
nodeId: NodeId;
|
|
110
|
+
outputs: NodeOutputs;
|
|
111
|
+
}): Promise<RunResult>;
|
|
112
|
+
resumeFromNodeError(args: {
|
|
113
|
+
runId: RunId;
|
|
114
|
+
activationId: NodeActivationId;
|
|
115
|
+
nodeId: NodeId;
|
|
116
|
+
error: Error;
|
|
117
|
+
}): Promise<RunResult>;
|
|
118
|
+
resumeFromStepResult(args: {
|
|
119
|
+
runId: RunId;
|
|
120
|
+
activationId: NodeActivationId;
|
|
121
|
+
nodeId: NodeId;
|
|
122
|
+
outputs: NodeOutputs;
|
|
123
|
+
}): Promise<RunResult>;
|
|
124
|
+
resumeFromStepError(args: {
|
|
125
|
+
runId: RunId;
|
|
126
|
+
activationId: NodeActivationId;
|
|
127
|
+
nodeId: NodeId;
|
|
128
|
+
error: Error;
|
|
129
|
+
}): Promise<RunResult>;
|
|
130
|
+
waitForCompletion(runId: RunId): Promise<Extract<RunResult, {
|
|
131
|
+
status: "completed" | "failed";
|
|
132
|
+
}>>;
|
|
133
|
+
waitForWebhookResponse(runId: RunId): Promise<WebhookRunResult>;
|
|
134
|
+
handleNodeExecutionRequest(request: NodeExecutionRequest): Promise<void>;
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/runtime/InMemoryLiveWorkflowRepository.d.ts
|
|
138
|
+
declare class InMemoryLiveWorkflowRepository implements LiveWorkflowRepository {
|
|
139
|
+
private readonly workflowsById;
|
|
140
|
+
setWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void;
|
|
141
|
+
list(): ReadonlyArray<WorkflowDefinition>;
|
|
142
|
+
get(workflowId: WorkflowId): WorkflowDefinition | undefined;
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/runtime/RunIntentService.d.ts
|
|
146
|
+
type StartWorkflowIntent = {
|
|
147
|
+
workflow: WorkflowDefinition;
|
|
148
|
+
startAt?: string;
|
|
149
|
+
items: Items;
|
|
150
|
+
synthesizeTriggerItems?: boolean;
|
|
151
|
+
parent?: CurrentStateExecutionRequest["parent"];
|
|
152
|
+
executionOptions?: RunExecutionOptions;
|
|
153
|
+
workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
|
|
154
|
+
mutableState?: CurrentStateExecutionRequest["mutableState"];
|
|
155
|
+
currentState?: RunCurrentState;
|
|
156
|
+
stopCondition?: RunStopCondition;
|
|
157
|
+
reset?: CurrentStateExecutionRequest["reset"];
|
|
158
|
+
};
|
|
159
|
+
type RerunFromNodeIntent = {
|
|
160
|
+
workflow: WorkflowDefinition;
|
|
161
|
+
nodeId: NodeId;
|
|
162
|
+
currentState: RunCurrentState;
|
|
163
|
+
items?: Items;
|
|
164
|
+
synthesizeTriggerItems?: boolean;
|
|
165
|
+
parent?: CurrentStateExecutionRequest["parent"];
|
|
166
|
+
executionOptions?: RunExecutionOptions;
|
|
167
|
+
workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
|
|
168
|
+
mutableState?: CurrentStateExecutionRequest["mutableState"];
|
|
169
|
+
};
|
|
170
|
+
type MatchedWebhookRunIntent = {
|
|
171
|
+
endpointPath: string;
|
|
172
|
+
method: HttpMethod;
|
|
173
|
+
requestItem: Items[number];
|
|
174
|
+
};
|
|
175
|
+
type WebhookMatchRunIntent = {
|
|
176
|
+
match: WebhookInvocationMatch;
|
|
177
|
+
requestItem: Items[number];
|
|
178
|
+
};
|
|
179
|
+
declare class RunIntentService {
|
|
180
|
+
private readonly engine;
|
|
181
|
+
private readonly workflowRepository;
|
|
182
|
+
constructor(engine: Engine, workflowRepository: WorkflowRepository);
|
|
183
|
+
startWorkflow(args: StartWorkflowIntent): Promise<RunResult>;
|
|
184
|
+
rerunFromNode(args: RerunFromNodeIntent): Promise<RunResult>;
|
|
185
|
+
private resolveStartWorkflowItems;
|
|
186
|
+
private resolveRerunItems;
|
|
187
|
+
private resolveStartWorkflowTriggerNodeId;
|
|
188
|
+
private resolveRerunTriggerNodeId;
|
|
189
|
+
private firstTriggerNodeId;
|
|
190
|
+
private isTriggerNode;
|
|
191
|
+
private hasNonEmptyItems;
|
|
192
|
+
resolveWebhookTrigger(args: {
|
|
193
|
+
endpointPath: string;
|
|
194
|
+
method: HttpMethod;
|
|
195
|
+
}): WebhookTriggerResolution;
|
|
196
|
+
runMatchedWebhook(args: MatchedWebhookRunIntent): Promise<WebhookRunResult>;
|
|
197
|
+
runWebhookMatch(args: WebhookMatchRunIntent): Promise<WebhookRunResult>;
|
|
198
|
+
/**
|
|
199
|
+
* Webhook-triggered runs always force inline execution first.
|
|
200
|
+
* This is the highest-precedence scheduler override: it wins over node hints and container defaults.
|
|
201
|
+
*/
|
|
202
|
+
private createWebhookExecutionOptions;
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
export { InMemoryLiveWorkflowRepository as n, Engine as r, RunIntentService as t };
|
|
206
|
+
//# sourceMappingURL=RunIntentService-CEF-sFfI.d.cts.map
|