@codemation/core 0.0.19 → 0.2.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/EngineRuntimeRegistration.types-0sgV2XL2.d.ts +42 -0
  3. package/dist/EngineWorkflowRunnerService-Dx7bJsJR.d.cts +73 -0
  4. package/dist/InMemoryRunDataFactory-qIYQEar7.d.cts +94 -0
  5. package/dist/{InMemoryLiveWorkflowRepository-DxoualoC.d.ts → RunIntentService-BCvGdOSY.d.ts} +438 -9
  6. package/dist/{RunIntentService-C1nu_YwM.js → RunIntentService-BFA48UpH.js} +252 -67
  7. package/dist/RunIntentService-BFA48UpH.js.map +1 -0
  8. package/dist/{InMemoryLiveWorkflowRepository-orY1VsWG.d.cts → RunIntentService-CV8izV8t.d.cts} +214 -7
  9. package/dist/{RunIntentService-ZkjpY7MS.cjs → RunIntentService-DcxXf_AM.cjs} +262 -65
  10. package/dist/RunIntentService-DcxXf_AM.cjs.map +1 -0
  11. package/dist/bootstrap/index.cjs +14 -1135
  12. package/dist/bootstrap/index.d.cts +7 -60
  13. package/dist/bootstrap/index.d.ts +4 -40
  14. package/dist/bootstrap/index.js +3 -1122
  15. package/dist/bootstrap-D67Sf2BF.js +1136 -0
  16. package/dist/bootstrap-D67Sf2BF.js.map +1 -0
  17. package/dist/bootstrap-DoQHAEQJ.cjs +1203 -0
  18. package/dist/bootstrap-DoQHAEQJ.cjs.map +1 -0
  19. package/dist/{index-BIewO9-9.d.ts → index-BHmrZIHp.d.ts} +32 -260
  20. package/dist/index.cjs +98 -223
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +196 -6
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +92 -218
  25. package/dist/index.js.map +1 -1
  26. package/dist/testing.cjs +329 -3
  27. package/dist/testing.cjs.map +1 -1
  28. package/dist/testing.d.cts +181 -4
  29. package/dist/testing.d.ts +181 -3
  30. package/dist/testing.js +319 -2
  31. package/dist/testing.js.map +1 -1
  32. package/dist/workflowActivationPolicy-B8HzTk3o.js +201 -0
  33. package/dist/workflowActivationPolicy-B8HzTk3o.js.map +1 -0
  34. package/dist/workflowActivationPolicy-BzyzXLa_.cjs +231 -0
  35. package/dist/workflowActivationPolicy-BzyzXLa_.cjs.map +1 -0
  36. package/package.json +1 -1
  37. package/src/ai/AgentConnectionNodeCollector.ts +99 -0
  38. package/src/ai/AgentToolFactory.ts +38 -2
  39. package/src/ai/AiHost.ts +1 -1
  40. package/src/browser.ts +11 -0
  41. package/src/contracts/executionPersistenceContracts.ts +186 -0
  42. package/src/contracts/index.ts +1 -0
  43. package/src/contracts/runFinishedAtFactory.ts +5 -2
  44. package/src/contracts/runTypes.ts +10 -0
  45. package/src/contracts/runtimeTypes.ts +6 -2
  46. package/src/contracts/workflowTypes.ts +3 -2
  47. package/src/events/EventPublishingWorkflowExecutionRepository.ts +5 -0
  48. package/src/execution/ActivationEnqueueService.ts +8 -8
  49. package/src/execution/PersistedRunStateTerminalBuilder.ts +3 -0
  50. package/src/index.ts +6 -0
  51. package/src/orchestration/NodeExecutionRequestHandlerService.ts +11 -6
  52. package/src/orchestration/RunContinuationService.ts +94 -24
  53. package/src/runStorage/InMemoryWorkflowExecutionRepository.ts +14 -1
  54. package/src/scheduler/DefaultDrivingScheduler.ts +21 -11
  55. package/src/scheduler/InlineDrivingScheduler.ts +17 -21
  56. package/src/testing/CapturingScheduler.ts +15 -0
  57. package/src/testing/EngineTestKitRunIdFactory.ts +24 -0
  58. package/src/testing/InMemoryTriggerSetupStateRepository.ts +21 -0
  59. package/src/testing/PrefixedSequentialIdGenerator.ts +17 -0
  60. package/src/testing/RegistrarEngineTestKit.types.ts +76 -0
  61. package/src/testing/RegistrarEngineTestKitFactory.ts +154 -0
  62. package/src/testing/SubWorkflowRunnerTestNode.ts +83 -0
  63. package/src/testing/WorkflowTestHarnessManualTrigger.ts +39 -0
  64. package/src/testing/WorkflowTestKit.types.ts +9 -0
  65. package/src/testing/WorkflowTestKitBuilder.ts +77 -0
  66. package/src/testing/WorkflowTestKitNodeRegistrationContextFactory.ts +17 -0
  67. package/src/testing/WorkflowTestKitRunNodeWorkflowFactory.ts +26 -0
  68. package/src/testing.ts +19 -0
  69. package/src/types/index.ts +1 -0
  70. package/src/workflow/definition/ConnectionNodeIdFactory.ts +28 -0
  71. package/dist/InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs +0 -151
  72. package/dist/InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs.map +0 -1
  73. package/dist/InMemoryLiveWorkflowRepository-BoLNnVLg.js +0 -139
  74. package/dist/InMemoryLiveWorkflowRepository-BoLNnVLg.js.map +0 -1
  75. package/dist/RunIntentService-C1nu_YwM.js.map +0 -1
  76. package/dist/RunIntentService-DjbxzBBP.d.cts +0 -288
  77. package/dist/RunIntentService-ZkjpY7MS.cjs.map +0 -1
  78. package/dist/WorkflowSnapshotCodec-DSEzKyt3.d.cts +0 -22
  79. package/dist/bootstrap/index.cjs.map +0 -1
  80. package/dist/bootstrap/index.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { A as ExecutionMode, An as WebhookTriggerRoutingDiagnostics, Ct as WorkflowPolicyRuntimeDefaults, Dn as WebhookInvocationMatch, K as NodeErrorHandlerSpec, Ln as EngineRunCounters, Mn as WorkflowActivationPolicy, Mr as EngineExecutionLimitsPolicy, Nr as EngineExecutionLimitsPolicyConfig, On as WebhookTriggerMatcher, P as Items, Q as NodeSchedulerDecision, Qt as NodeActivationRequest, Tt as WorkflowStoragePolicyDecisionArgs, U as NodeDefinition, V as NodeConfigBase, Vt as EngineDeps, W as NodeErrorHandler, X as NodeOutputs, Xt as NodeActivationContinuation, Y as NodeOffloadPolicy, Yn as PersistedWorkflowSnapshotNode, Zt as NodeActivationReceipt, _t as WorkflowErrorHandler, an as NodeExecutionScheduler, cn as NodeResolver, cr as RunSummary, dr as WorkflowExecutionPruneRepository, en as NodeActivationScheduler, fr as WorkflowExecutionRepository, ht as WorkflowDefinition, ir as RunResult, jr as ENGINE_EXECUTION_LIMITS_DEFAULTS, mr as DependencyContainer, nr as RunPruneCandidate, nt as PersistedRunPolicySnapshot, ot as RunId, pn as TriggerRuntimeDiagnostics, q as NodeId, qn as PersistedRunState, rn as NodeExecutionRequest, rt as PersistedTokenId, t as InMemoryLiveWorkflowRepository, tt as ParentExecutionRef, ur as WorkflowExecutionListingRepository, vn as WorkflowNodeInstanceFactory, vt as WorkflowErrorHandlerSpec, wn as HttpMethod, xt as WorkflowId, yn as WorkflowRepository, yr as TypeToken } from "../InMemoryLiveWorkflowRepository-orY1VsWG.cjs";
2
- import { a as UnavailableBinaryStorage, c as DefaultAsyncSleeper, d as Engine, i as DefaultExecutionBinaryService, l as AsyncSleeper, n as InMemoryRunDataFactory, o as InProcessRetryRunner, r as InMemoryBinaryStorage, s as DefaultExecutionContextFactory, t as RunIntentService, u as CredentialResolverFactory } from "../RunIntentService-DjbxzBBP.cjs";
3
- import { t as WorkflowSnapshotCodec } from "../WorkflowSnapshotCodec-DSEzKyt3.cjs";
1
+ import { $n as PersistedWorkflowSnapshotNode, An as WebhookInvocationMatch, Bn as EngineRunCounters, Cr as TypeToken, Ct as WorkflowId, Dn as HttpMethod, Dt as WorkflowStoragePolicyDecisionArgs, Fn as WorkflowActivationPolicy, Fr as ENGINE_EXECUTION_LIMITS_DEFAULTS, G as NodeDefinition, Ir as EngineExecutionLimitsPolicy, J as NodeErrorHandlerSpec, K as NodeErrorHandler, Lr as EngineExecutionLimitsPolicyConfig, M as ExecutionMode, Nn as WebhookTriggerRoutingDiagnostics, Q as NodeOutputs, Qt as NodeActivationContinuation, Sn as WorkflowRepository, Tt as WorkflowPolicyRuntimeDefaults, U as NodeConfigBase, Ut as EngineDeps, Xn as PersistedRunSchedulingState, Y as NodeId, Z as NodeOffloadPolicy, Zn as PersistedRunState, _t as WorkflowDefinition, an as NodeExecutionRequest, at as PersistedTokenId, bt as WorkflowErrorHandlerSpec, ct as RunId, en as NodeActivationRequest, et as NodeSchedulerDecision, fn as PreparedNodeActivationDispatch, fr as RunSummary, gr as WorkflowExecutionRepository, hr as WorkflowExecutionPruneRepository, it as PersistedRunPolicySnapshot, jn as WebhookTriggerMatcher, mr as WorkflowExecutionListingRepository, n as InMemoryLiveWorkflowRepository, nn as NodeActivationScheduler, or as RunPruneCandidate, r as Engine, rt as ParentExecutionRef, sn as NodeExecutionScheduler, t as RunIntentService, un as NodeResolver, vr as DependencyContainer, xn as WorkflowNodeInstanceFactory, yt as WorkflowErrorHandler } from "../RunIntentService-CV8izV8t.cjs";
2
+ import { a as WorkflowSnapshotCodec, i as WebhookTriggerMatcherProvider, n as EngineRuntimeRegistrationOptions, r as TriggerRuntimeDiagnosticsProvider, t as EngineWorkflowRunnerService } from "../EngineWorkflowRunnerService-Dx7bJsJR.cjs";
3
+ import { a as InProcessRetryRunner, c as AsyncSleeper, i as UnavailableBinaryStorage, l as CredentialResolverFactory, n as InMemoryBinaryStorage, o as DefaultExecutionContextFactory, r as DefaultExecutionBinaryService, s as DefaultAsyncSleeper, t as InMemoryRunDataFactory } from "../InMemoryRunDataFactory-qIYQEar7.cjs";
4
4
 
5
5
  //#region src/workflowSnapshots/MissingRuntimeFallbacksFactory.d.ts
6
6
  declare class MissingRuntimeFallbacks {
@@ -27,43 +27,6 @@ declare class EngineFactory {
27
27
  create(deps: EngineCompositionDeps): Engine;
28
28
  }
29
29
  //#endregion
30
- //#region src/bootstrap/runtime/EngineRuntimeRegistration.types.d.ts
31
- /**
32
- * Creates the webhook route matcher used by {@link import("../api/Engine").Engine}.
33
- * Hosts may supply logging/diagnostics; tests often use the default factory without diagnostics.
34
- */
35
- interface WebhookTriggerMatcherProvider {
36
- createMatcher(container: DependencyContainer): WebhookTriggerMatcher;
37
- }
38
- /**
39
- * Supplies optional trigger-runtime logging (inactive workflow skips, activation sync).
40
- */
41
- interface TriggerRuntimeDiagnosticsProvider {
42
- create(container: DependencyContainer): TriggerRuntimeDiagnostics | undefined;
43
- }
44
- interface EngineRuntimeRegistrationOptions {
45
- /**
46
- * Static limits merged into the factory when the policy token is first resolved.
47
- * Prefer {@link resolveEngineExecutionLimits} when limits can change after registration (e.g. host `useRuntimeConfig`).
48
- */
49
- engineExecutionLimits?: Partial<EngineExecutionLimitsPolicyConfig>;
50
- /**
51
- * Called when the limits policy is first resolved; overrides {@link engineExecutionLimits} when both are set.
52
- * Use this for host wiring so `runtime.engineExecutionLimits` applied after `registerCoreInfrastructure` is honored.
53
- */
54
- resolveEngineExecutionLimits?: () => Partial<EngineExecutionLimitsPolicyConfig> | undefined;
55
- /**
56
- * When {@link webhookTriggerMatcherProvider} is omitted, the registrar builds
57
- * {@link import("../../runtime/WorkflowRepositoryWebhookTriggerMatcher").WorkflowRepositoryWebhookTriggerMatcher}
58
- * using this optional routing diagnostics surface.
59
- */
60
- webhookTriggerRoutingDiagnostics?: WebhookTriggerRoutingDiagnostics;
61
- /** Overrides default webhook matcher construction (e.g. host-injected loggers). */
62
- webhookTriggerMatcherProvider?: WebhookTriggerMatcherProvider;
63
- /** Overrides default trigger diagnostics (undefined when omitted). */
64
- triggerRuntimeDiagnosticsProvider?: TriggerRuntimeDiagnosticsProvider;
65
- }
66
- //#endregion
67
30
  //#region src/bootstrap/runtime/EngineRuntimeRegistrar.d.ts
68
31
  /**
69
32
  * Container-first entry: call on a host/test container **after** workflow, run, node, and credential
@@ -159,6 +122,7 @@ declare class InMemoryWorkflowExecutionRepository implements WorkflowExecutionRe
159
122
  engineCounters?: EngineRunCounters;
160
123
  }): Promise<void>;
161
124
  load(runId: RunId): Promise<PersistedRunState | undefined>;
125
+ loadSchedulingState(runId: RunId): Promise<PersistedRunSchedulingState | undefined>;
162
126
  save(state: PersistedRunState): Promise<void>;
163
127
  deleteRun(runId: RunId): Promise<void>;
164
128
  listRuns(args?: Readonly<{
@@ -177,20 +141,6 @@ declare class RunSummaryMapper {
177
141
  static fromPersistedState(state: PersistedRunState): RunSummary;
178
142
  }
179
143
  //#endregion
180
- //#region src/runtime/EngineWorkflowRunnerService.d.ts
181
- declare class EngineWorkflowRunnerService {
182
- private readonly engine;
183
- private readonly workflowRepository;
184
- constructor(engine: Engine, workflowRepository: WorkflowRepository);
185
- runById(args: {
186
- workflowId: WorkflowId;
187
- startAt?: NodeId;
188
- items: Items;
189
- parent?: ParentExecutionRef;
190
- }): Promise<RunResult>;
191
- private findDefaultStartNodeId;
192
- }
193
- //#endregion
194
144
  //#region src/runtime/WorkflowRepositoryWebhookTriggerMatcher.d.ts
195
145
  /**
196
146
  * Resolves webhook HTTP routes from the live workflow repository (no trigger setup / registration).
@@ -235,11 +185,9 @@ declare class InlineDrivingScheduler implements NodeActivationScheduler {
235
185
  private readonly drainingRuns;
236
186
  private readonly queuesByRunId;
237
187
  private readonly scheduledRuns;
238
- private seq;
239
188
  constructor(nodeExecutor: NodeExecutor);
240
189
  setContinuation(continuation: NodeActivationContinuation): void;
241
- enqueue(request: NodeActivationRequest): Promise<NodeActivationReceipt>;
242
- notifyPendingStatePersisted(runId: RunId): void;
190
+ prepareDispatch(request: NodeActivationRequest): Promise<PreparedNodeActivationDispatch>;
243
191
  private drainRun;
244
192
  private scheduleDrain;
245
193
  private resumeAfterExecutionResult;
@@ -256,8 +204,7 @@ declare class DefaultDrivingScheduler implements NodeActivationScheduler {
256
204
  private readonly inline;
257
205
  constructor(offloadPolicy: NodeOffloadPolicy, workerScheduler: NodeExecutionScheduler, inline: InlineDrivingScheduler);
258
206
  setContinuation(continuation: NodeActivationContinuation): void;
259
- enqueue(request: NodeActivationRequest): Promise<NodeActivationReceipt>;
260
- notifyPendingStatePersisted(runId: string): void;
207
+ prepareDispatch(request: NodeActivationRequest): Promise<PreparedNodeActivationDispatch>;
261
208
  /**
262
209
  * Scheduler precedence is explicit:
263
210
  * 1. run-intent override (`executionOptions.localOnly`)
@@ -266,7 +213,7 @@ declare class DefaultDrivingScheduler implements NodeActivationScheduler {
266
213
  */
267
214
  private selectScheduler;
268
215
  private hasNodeSchedulingPreference;
269
- private enqueueInline;
216
+ private prepareInlineDispatch;
270
217
  }
271
218
  //#endregion
272
219
  //#region src/scheduler/HintOnlyOffloadPolicy.d.ts
@@ -1,45 +1,9 @@
1
- import { Jn as WebhookTriggerRoutingDiagnostics, Kn as WebhookTriggerMatcher, Lr as TypeToken, Mr as DependencyContainer, Nt as WorkflowDefinition, Xr as EngineExecutionLimitsPolicy, Yr as ENGINE_EXECUTION_LIMITS_DEFAULTS, Zr as EngineExecutionLimitsPolicyConfig, jn as TriggerRuntimeDiagnostics, t as InMemoryLiveWorkflowRepository, xt as PersistedTokenId } from "../InMemoryLiveWorkflowRepository-DxoualoC.js";
2
- import { At as InProcessRetryRunner, It as EngineCompositionDeps, Lt as EngineFactory, Mt as DefaultAsyncSleeper, Nt as AsyncSleeper, Ot as NodeInstanceFactory, Pt as CredentialResolverFactory, Rt as Engine, _ as EngineExecutionLimitsPolicyFactory, a as ConfigDrivenOffloadPolicy, c as EngineWorkflowRunnerService, d as InMemoryRunDataFactory, f as InMemoryBinaryStorage, g as RunPolicySnapshotFactory, h as WorkflowStoragePolicyEvaluator, i as InlineDrivingScheduler, jt as DefaultExecutionContextFactory, kt as NodeExecutor, l as RunSummaryMapper, m as RunTerminalPersistenceCoordinator, n as HintOnlyOffloadPolicy, o as WorkflowRepositoryWebhookTriggerMatcher, p as WorkflowPolicyErrorServices, r as DefaultDrivingScheduler, s as RunIntentService, t as LocalOnlyScheduler, u as InMemoryWorkflowExecutionRepository, v as DefaultExecutionBinaryService, y as UnavailableBinaryStorage } from "../index-BIewO9-9.js";
1
+ import { Ci as ENGINE_EXECUTION_LIMITS_DEFAULTS, Ti as EngineExecutionLimitsPolicyConfig, a as RunTerminalPersistenceCoordinator, an as WorkflowDefinition, c as EngineExecutionLimitsPolicyFactory, di as TypeToken, i as WorkflowPolicyErrorServices, n as InMemoryLiveWorkflowRepository, o as WorkflowStoragePolicyEvaluator, oi as DependencyContainer, qt as PersistedTokenId, r as EngineWorkflowRunnerService, s as RunPolicySnapshotFactory, t as RunIntentService, u as Engine, wi as EngineExecutionLimitsPolicy } from "../RunIntentService-BCvGdOSY.js";
2
+ import { At as AsyncSleeper, Dt as InProcessRetryRunner, Et as NodeExecutor, Nt as EngineCompositionDeps, Ot as DefaultExecutionContextFactory, Pt as EngineFactory, Tt as NodeInstanceFactory, a as ConfigDrivenOffloadPolicy, c as InMemoryWorkflowExecutionRepository, d as DefaultExecutionBinaryService, f as UnavailableBinaryStorage, i as InlineDrivingScheduler, jt as CredentialResolverFactory, kt as DefaultAsyncSleeper, l as InMemoryRunDataFactory, n as HintOnlyOffloadPolicy, o as WorkflowRepositoryWebhookTriggerMatcher, r as DefaultDrivingScheduler, s as RunSummaryMapper, t as LocalOnlyScheduler, u as InMemoryBinaryStorage } from "../index-BHmrZIHp.js";
3
+ import { n as TriggerRuntimeDiagnosticsProvider, r as WebhookTriggerMatcherProvider, t as EngineRuntimeRegistrationOptions } from "../EngineRuntimeRegistration.types-0sgV2XL2.js";
3
4
 
4
- //#region src/bootstrap/runtime/EngineRuntimeRegistration.types.d.ts
5
-
6
- /**
7
- * Creates the webhook route matcher used by {@link import("../api/Engine").Engine}.
8
- * Hosts may supply logging/diagnostics; tests often use the default factory without diagnostics.
9
- */
10
- interface WebhookTriggerMatcherProvider {
11
- createMatcher(container: DependencyContainer): WebhookTriggerMatcher;
12
- }
13
- /**
14
- * Supplies optional trigger-runtime logging (inactive workflow skips, activation sync).
15
- */
16
- interface TriggerRuntimeDiagnosticsProvider {
17
- create(container: DependencyContainer): TriggerRuntimeDiagnostics | undefined;
18
- }
19
- interface EngineRuntimeRegistrationOptions {
20
- /**
21
- * Static limits merged into the factory when the policy token is first resolved.
22
- * Prefer {@link resolveEngineExecutionLimits} when limits can change after registration (e.g. host `useRuntimeConfig`).
23
- */
24
- engineExecutionLimits?: Partial<EngineExecutionLimitsPolicyConfig>;
25
- /**
26
- * Called when the limits policy is first resolved; overrides {@link engineExecutionLimits} when both are set.
27
- * Use this for host wiring so `runtime.engineExecutionLimits` applied after `registerCoreInfrastructure` is honored.
28
- */
29
- resolveEngineExecutionLimits?: () => Partial<EngineExecutionLimitsPolicyConfig> | undefined;
30
- /**
31
- * When {@link webhookTriggerMatcherProvider} is omitted, the registrar builds
32
- * {@link import("../../runtime/WorkflowRepositoryWebhookTriggerMatcher").WorkflowRepositoryWebhookTriggerMatcher}
33
- * using this optional routing diagnostics surface.
34
- */
35
- webhookTriggerRoutingDiagnostics?: WebhookTriggerRoutingDiagnostics;
36
- /** Overrides default webhook matcher construction (e.g. host-injected loggers). */
37
- webhookTriggerMatcherProvider?: WebhookTriggerMatcherProvider;
38
- /** Overrides default trigger diagnostics (undefined when omitted). */
39
- triggerRuntimeDiagnosticsProvider?: TriggerRuntimeDiagnosticsProvider;
40
- }
41
- //#endregion
42
5
  //#region src/bootstrap/runtime/EngineRuntimeRegistrar.d.ts
6
+
43
7
  /**
44
8
  * Container-first entry: call on a host/test container **after** workflow, run, node, and credential
45
9
  * ports are registered. The registrar owns the default inline scheduler, engine binding,