@codemation/core 0.13.2 → 0.15.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 (212) hide show
  1. package/CHANGELOG.md +167 -0
  2. package/dist/{CostCatalogContract-Dxq1BTyi.d.cts → CostCatalogContract-Dwo-ZamG.d.cts} +2 -2
  3. package/dist/EngineRuntimeRegistration.types-BiNasx3G.d.cts +54 -0
  4. package/dist/EngineRuntimeRegistration.types-Dq4ucrdo.d.ts +21 -0
  5. package/dist/{InMemoryRunDataFactory-Csy2evr_.d.cts → InMemoryRunDataFactory-D2U9azmZ.d.cts} +4 -20
  6. package/dist/{InMemoryRunEventBusRegistry-Sa86VxuV.cjs → InMemoryRunEventBusRegistry-DO0WM9Lw.cjs} +1 -1
  7. package/dist/{InMemoryRunEventBusRegistry-Sa86VxuV.cjs.map → InMemoryRunEventBusRegistry-DO0WM9Lw.cjs.map} +1 -1
  8. package/dist/{InMemoryRunEventBusRegistry-Bwunvt1T.js → InMemoryRunEventBusRegistry-Layt2xgm.js} +1 -1
  9. package/dist/{InMemoryRunEventBusRegistry-Bwunvt1T.js.map → InMemoryRunEventBusRegistry-Layt2xgm.js.map} +1 -1
  10. package/dist/{ItemsInputNormalizer-Bi8m-Ijs.d.cts → ItemsInputNormalizer-A5txcOWX.d.cts} +3 -98
  11. package/dist/{ItemsInputNormalizer-BbQTSEkZ.cjs → ItemsInputNormalizer-C1fv3sMW.cjs} +2 -2
  12. package/dist/ItemsInputNormalizer-C1fv3sMW.cjs.map +1 -0
  13. package/dist/{ItemsInputNormalizer-BYljnXU0.d.ts → ItemsInputNormalizer-D2vrMrX1.d.ts} +2 -62
  14. package/dist/{ItemsInputNormalizer-CSZGMgl3.js → ItemsInputNormalizer-fUYo4GLV.js} +2 -2
  15. package/dist/ItemsInputNormalizer-fUYo4GLV.js.map +1 -0
  16. package/dist/{RunIntentService-BitgkKaT.d.cts → RunIntentService-DKxuHTUz.d.cts} +2 -15
  17. package/dist/{RunIntentService-DYpqfu6D.d.ts → RunIntentService-DrpKli2k.d.ts} +2 -22
  18. package/dist/{agentMcpTypes-DGIwk6Ue.d.cts → agentMcpTypes-BHX4RQCC.d.cts} +25 -518
  19. package/dist/bootstrap/index.cjs +9 -5
  20. package/dist/bootstrap/index.d.cts +32 -106
  21. package/dist/bootstrap/index.d.ts +18 -17
  22. package/dist/bootstrap/index.js +6 -5
  23. package/dist/{bootstrap-DIv-vloi.cjs → bootstrap-CTB53rEF.cjs} +9 -60
  24. package/dist/bootstrap-CTB53rEF.cjs.map +1 -0
  25. package/dist/{bootstrap-Bkd-Nfbn.js → bootstrap-DmqKheCI.js} +6 -57
  26. package/dist/bootstrap-DmqKheCI.js.map +1 -0
  27. package/dist/browser.cjs +12 -11
  28. package/dist/browser.d.cts +4 -4
  29. package/dist/browser.d.ts +3 -3
  30. package/dist/browser.js +3 -2
  31. package/dist/contracts-7L1wJHdk.cjs +569 -0
  32. package/dist/contracts-7L1wJHdk.cjs.map +1 -0
  33. package/dist/contracts-CjJ5CZ7N.js +447 -0
  34. package/dist/contracts-CjJ5CZ7N.js.map +1 -0
  35. package/dist/contracts.cjs +9 -2
  36. package/dist/contracts.d.cts +5 -5
  37. package/dist/contracts.d.ts +2 -2
  38. package/dist/contracts.js +3 -2
  39. package/dist/{executionPersistenceContracts-CN9d7AnL.d.cts → deploymentManifestTypes-B8CDmZZK.d.cts} +65 -81
  40. package/dist/di-C6Ubf9o5.cjs +179 -0
  41. package/dist/di-C6Ubf9o5.cjs.map +1 -0
  42. package/dist/di-Cjiil7U-.js +114 -0
  43. package/dist/di-Cjiil7U-.js.map +1 -0
  44. package/dist/{index-rllWL4r-.d.ts → index-CRv3_pY3.d.ts} +112 -808
  45. package/dist/{index-BSQ2LoIh.d.ts → index-mnLS0iQl.d.ts} +39 -372
  46. package/dist/index.cjs +53 -111
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.cts +50 -438
  49. package/dist/index.d.ts +5 -5
  50. package/dist/index.js +28 -94
  51. package/dist/index.js.map +1 -1
  52. package/dist/{params-DRUr0F5v.d.cts → params-CrK4iuG1.d.cts} +3 -13
  53. package/dist/{runtime-CWPdvJpC.js → runtime-CBFDpmiz.js} +112 -648
  54. package/dist/runtime-CBFDpmiz.js.map +1 -0
  55. package/dist/{runtime-_VdHwGkJ.cjs → runtime-Due-FOZ2.cjs} +137 -717
  56. package/dist/runtime-Due-FOZ2.cjs.map +1 -0
  57. package/dist/testing.cjs +8 -40
  58. package/dist/testing.cjs.map +1 -1
  59. package/dist/testing.d.cts +3 -32
  60. package/dist/testing.d.ts +3 -32
  61. package/dist/testing.js +6 -38
  62. package/dist/testing.js.map +1 -1
  63. package/dist/{di-LP2qSHkY.cjs → workflowTypes-BW6Hhee7.cjs} +4 -230
  64. package/dist/workflowTypes-BW6Hhee7.cjs.map +1 -0
  65. package/dist/{di-tom0pM2h.js → workflowTypes-DZtBTmKf.js} +3 -163
  66. package/dist/workflowTypes-DZtBTmKf.js.map +1 -0
  67. package/package.json +1 -1
  68. package/src/ai/AgentConnectionNodeCollector.ts +0 -4
  69. package/src/ai/AgentMessageConfigNormalizerFactory.ts +0 -4
  70. package/src/ai/AiHost.ts +0 -38
  71. package/src/ai/CallableToolConfig.ts +0 -9
  72. package/src/ai/CallableToolKindToken.ts +0 -4
  73. package/src/authoring/callableTool.types.ts +0 -3
  74. package/src/authoring/defineCollection.types.ts +0 -11
  75. package/src/authoring/defineHumanApprovalNode.types.ts +0 -116
  76. package/src/authoring/defineNode.types.ts +18 -32
  77. package/src/authoring/definePollingTrigger.types.ts +36 -155
  78. package/src/authoring/definePollingTriggerInternals.ts +0 -4
  79. package/src/authoring/index.ts +1 -0
  80. package/src/authoring/nodeBaseOptions.types.ts +4 -0
  81. package/src/binaries/boundedReadBinary.types.ts +0 -16
  82. package/src/bootstrap/index.ts +8 -2
  83. package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +0 -5
  84. package/src/bootstrap/runtime/EngineRuntimeRegistration.types.ts +0 -23
  85. package/src/browser.ts +0 -3
  86. package/src/contracts/AgentBindError.ts +0 -5
  87. package/src/contracts/Clock.ts +0 -1
  88. package/src/contracts/CodemationTelemetryAttributeNames.ts +0 -10
  89. package/src/contracts/NoOpAgentMcpIntegration.ts +0 -6
  90. package/src/contracts/NoOpTelemetrySpanScope.ts +0 -7
  91. package/src/contracts/RetryPolicy.ts +0 -2
  92. package/src/contracts/agentMcpTypes.ts +0 -34
  93. package/src/contracts/assertionTypes.ts +0 -33
  94. package/src/contracts/baseTypes.ts +0 -6
  95. package/src/contracts/collectionTypes.ts +0 -25
  96. package/src/contracts/credentialTypes.ts +13 -60
  97. package/src/contracts/deploymentManifestTypes.ts +158 -0
  98. package/src/contracts/dispatchTypes.ts +29 -0
  99. package/src/contracts/executionPersistenceContracts.ts +0 -33
  100. package/src/contracts/hitlSeamTypes.ts +0 -14
  101. package/src/contracts/humanTaskStoreTypes.ts +0 -2
  102. package/src/contracts/inboxChannelTypes.ts +0 -9
  103. package/src/contracts/index.ts +3 -0
  104. package/src/contracts/itemExpr.ts +7 -21
  105. package/src/contracts/itemMeta.ts +0 -3
  106. package/src/contracts/mcpTypes.ts +0 -16
  107. package/src/contracts/retryPolicySpec.types.ts +0 -10
  108. package/src/contracts/runFinishedAtFactory.ts +0 -1
  109. package/src/contracts/runTypes.ts +0 -74
  110. package/src/contracts/runtimeTypes.ts +4 -131
  111. package/src/contracts/telemetryTypes.ts +0 -7
  112. package/src/contracts/testTriggerTypes.ts +0 -43
  113. package/src/contracts/triggerInvokerTypes.ts +6 -0
  114. package/src/contracts/webhookTypes.ts +0 -8
  115. package/src/contracts/workflowActivationPolicy.ts +0 -5
  116. package/src/contracts/workflowTypes.ts +5 -80
  117. package/src/contracts/workspaceFileTypes.ts +10 -42
  118. package/src/contracts.ts +18 -10
  119. package/src/credentials/CredentialMaterialProvider.types.ts +0 -28
  120. package/src/credentials/ManagedCredentialMaterialWriteError.ts +0 -6
  121. package/src/credentials/ManagedMaterialFetchError.ts +0 -6
  122. package/src/credentials/OAuthFlowExecutor.types.ts +0 -15
  123. package/src/di/CoreTokens.ts +2 -6
  124. package/src/events/ConnectionInvocationEventPublisher.ts +0 -7
  125. package/src/events/NodeEventPublisher.ts +0 -1
  126. package/src/events/runEvents.ts +0 -8
  127. package/src/execution/ActivationEnqueueService.ts +0 -10
  128. package/src/execution/ChildExecutionScopeFactory.ts +0 -13
  129. package/src/execution/FanInMergeByOriginMerger.ts +0 -11
  130. package/src/execution/InProcessRetryRunner.ts +0 -1
  131. package/src/execution/ItemExprResolver.ts +0 -3
  132. package/src/execution/NodeActivationRequestComposer.ts +0 -3
  133. package/src/execution/NodeActivationRequestInputPreparer.ts +0 -5
  134. package/src/execution/NodeExecutionSnapshotFactory.ts +0 -1
  135. package/src/execution/NodeExecutor.ts +1 -17
  136. package/src/execution/NodeOutputNormalizer.ts +8 -1
  137. package/src/execution/NodeSuspensionHandler.ts +1 -39
  138. package/src/execution/PersistedRunStateTerminalBuilder.ts +0 -5
  139. package/src/execution/RunSuspendedError.ts +0 -10
  140. package/src/execution/RunnableOutputBehaviorResolver.ts +12 -0
  141. package/src/execution/WorkflowRunExecutionContextFactory.ts +0 -3
  142. package/src/index.ts +10 -2
  143. package/src/orchestration/AbortControllerFactory.ts +0 -4
  144. package/src/orchestration/Engine.ts +0 -9
  145. package/src/orchestration/NodeExecutionRequestHandlerService.ts +3 -4
  146. package/src/orchestration/RunContinuationService.ts +7 -39
  147. package/src/orchestration/RunStartService.ts +0 -7
  148. package/src/orchestration/TestSuiteOrchestrator.ts +0 -18
  149. package/src/orchestration/TestSuiteRunIdFactory.ts +0 -4
  150. package/src/orchestration/TriggerRuntimeService.ts +3 -2
  151. package/src/planning/CurrentStateFrontierPlanner.ts +0 -1
  152. package/src/planning/RunQueuePlanner.ts +0 -6
  153. package/src/policies/executionLimits/EngineExecutionLimitsPolicy.ts +0 -8
  154. package/src/policies/executionLimits/EngineExecutionLimitsPolicyFactory.ts +0 -3
  155. package/src/runStorage/RunSummaryMapper.ts +0 -1
  156. package/src/runtime/EngineFactory.ts +6 -11
  157. package/src/runtime/RunIntentService.ts +0 -4
  158. package/src/runtime/WorkflowRepositoryWebhookTriggerMatcher.ts +0 -4
  159. package/src/runtime-types/InjectableRuntimeDecoratorComposerRegistry.ts +0 -4
  160. package/src/runtime-types/PersistedRuntimeTypeMetadataStoreRegistry.ts +0 -4
  161. package/src/runtime-types/PersistedRuntimeTypeNameResolver.ts +0 -1
  162. package/src/runtime-types/persistedRuntimeTypeModelRegistry.ts +0 -4
  163. package/src/runtime-types/runtimeTypeDecorators.types.ts +0 -12
  164. package/src/scheduler/ConfigDrivenOffloadPolicy.ts +0 -1
  165. package/src/scheduler/DefaultDrivingScheduler.ts +0 -6
  166. package/src/scheduler/InlineDrivingScheduler.ts +0 -13
  167. package/src/serialization/ItemsInputNormalizer.ts +0 -5
  168. package/src/testing/CapturingScheduler.ts +0 -3
  169. package/src/testing/EngineTestKitRunIdFactory.ts +0 -3
  170. package/src/testing/ItemHarnessNode.ts +0 -3
  171. package/src/testing/ItemHarnessNodeConfig.ts +0 -4
  172. package/src/testing/PrefixedSequentialIdGenerator.ts +0 -3
  173. package/src/testing/RegistrarEngineTestKit.types.ts +0 -2
  174. package/src/testing/RejectingCredentialSessionService.ts +0 -4
  175. package/src/testing/SubWorkflowRunnerTestNode.ts +0 -3
  176. package/src/testing/WorkflowTestHarnessManualTrigger.ts +0 -3
  177. package/src/testing/WorkflowTestKitBuilder.ts +0 -4
  178. package/src/testing/WorkflowTestKitRunNodeWorkflowFactory.ts +0 -3
  179. package/src/testing.ts +0 -3
  180. package/src/triggers/polling/PollingTriggerDedupWindow.ts +0 -4
  181. package/src/triggers/polling/PollingTriggerLogger.ts +0 -5
  182. package/src/triggers/polling/PollingTriggerRuntime.ts +0 -5
  183. package/src/types/index.ts +0 -6
  184. package/src/validation/WorkflowEdgePortValidator.ts +0 -5
  185. package/src/workflow/definition/ConnectionInvocationIdFactory.ts +0 -7
  186. package/src/workflow/definition/ConnectionNodeIdFactory.ts +0 -6
  187. package/src/workflow/definition/NodeIterationIdFactory.ts +0 -13
  188. package/src/workflow/definition/WorkflowExecutableNodeClassifier.ts +0 -6
  189. package/src/workflow/dsl/ChainCursorResolver.ts +8 -15
  190. package/src/workflow/dsl/NodeIdSlugifier.ts +0 -9
  191. package/src/workflow/dsl/WhenBuilder.ts +49 -2
  192. package/src/workflow/dsl/WorkflowDefinitionError.ts +0 -9
  193. package/src/workflow/dsl/workflowBuilderTypes.ts +5 -0
  194. package/src/workflowSnapshots/MissingRuntimeParityGuard.ts +24 -0
  195. package/src/workflowSnapshots/PersistedWorkflowTokenRegistry.ts +0 -6
  196. package/src/workflowSnapshots/WorkflowParityMismatchError.ts +18 -0
  197. package/src/workflowSnapshots/WorkflowSnapshotCodec.ts +1 -5
  198. package/src/workflowSnapshots/index.ts +3 -0
  199. package/dist/EngineRuntimeRegistration.types-CqcTWexS.d.cts +0 -81
  200. package/dist/EngineRuntimeRegistration.types-Cr75cSfL.d.ts +0 -44
  201. package/dist/ItemsInputNormalizer-BbQTSEkZ.cjs.map +0 -1
  202. package/dist/ItemsInputNormalizer-CSZGMgl3.js.map +0 -1
  203. package/dist/bootstrap-Bkd-Nfbn.js.map +0 -1
  204. package/dist/bootstrap-DIv-vloi.cjs.map +0 -1
  205. package/dist/contracts-CK0x6w_G.cjs +0 -74
  206. package/dist/contracts-CK0x6w_G.cjs.map +0 -1
  207. package/dist/contracts-DXdfTdpW.js +0 -50
  208. package/dist/contracts-DXdfTdpW.js.map +0 -1
  209. package/dist/di-LP2qSHkY.cjs.map +0 -1
  210. package/dist/di-tom0pM2h.js.map +0 -1
  211. package/dist/runtime-CWPdvJpC.js.map +0 -1
  212. package/dist/runtime-_VdHwGkJ.cjs.map +0 -1
@@ -21,10 +21,6 @@ import { TestSuiteRunIdFactory } from "./TestSuiteRunIdFactory";
21
21
 
22
22
  const DEFAULT_CONCURRENCY = 4;
23
23
 
24
- /**
25
- * Engine-facade subset the orchestrator needs. Kept narrow on purpose so unit tests can
26
- * substitute a fake without depending on the full Engine wiring.
27
- */
28
24
  export interface TestSuiteOrchestratorEngine {
29
25
  runWorkflow(
30
26
  wf: WorkflowDefinition,
@@ -61,15 +57,6 @@ export interface RunTestSuiteArgs {
61
57
  readonly signal?: AbortSignal;
62
58
  }
63
59
 
64
- /**
65
- * Drives a {@link TestTriggerNodeConfig.generateItems} iterable into one workflow run per item,
66
- * with bounded concurrency. Pure engine logic — no persistence, no HTTP, no UI. Hosts adapt by
67
- * subscribing to {@link RunEventBus} and writing rows on `testSuite*` / `testCase*` / `nodeCompleted`.
68
- *
69
- * Cancellation: the supplied `AbortSignal` aborts the source iterable (so credentialed pulls bail)
70
- * and stops scheduling further cases. In-flight cases are awaited; engine-level cancellation of
71
- * an already-dispatched run is not yet wired (Phase 2).
72
- */
73
60
  export class TestSuiteOrchestrator {
74
61
  constructor(
75
62
  private readonly engine: TestSuiteOrchestratorEngine,
@@ -282,10 +269,6 @@ export class TestSuiteOrchestrator {
282
269
  terminal = await this.engine.waitForCompletion(runId);
283
270
  }
284
271
 
285
- // RunResult.status from the engine narrows to "completed" | "failed" | "halted" here; widening to
286
- // "errored" / "cancelled" happens outside this code path (tracker downgrade for assertion
287
- // failures; outer abort handling for cancelled). Halted runs are treated as "failed" for
288
- // test case status purposes.
289
272
  const status: TestCaseRunStatus = terminal.status === "completed" ? "succeeded" : "failed";
290
273
  await this.publish({
291
274
  kind: "testCaseCompleted",
@@ -331,7 +314,6 @@ export class TestSuiteOrchestrator {
331
314
  return this.currentDate().toISOString();
332
315
  }
333
316
 
334
- /** Defensive label resolver — author-supplied callbacks throw / return non-strings; we tolerate both. */
335
317
  private resolveCaseLabel(config: TestTriggerNodeConfig<unknown>, item: Item<unknown>): string | undefined {
336
318
  if (typeof config.caseLabel !== "function") return undefined;
337
319
  try {
@@ -1,9 +1,5 @@
1
1
  import type { TestSuiteRunId } from "../contracts/testTriggerTypes";
2
2
 
3
- /**
4
- * Mints unique TestSuiteRun identifiers. Separated from {@link import("../types").RunIdFactory}
5
- * so suite ids and per-case workflow run ids never alias.
6
- */
7
3
  export class TestSuiteRunIdFactory {
8
4
  makeTestSuiteRunId(): TestSuiteRunId {
9
5
  return `tsr_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
@@ -26,7 +26,7 @@ import type { NodeRunStateWriterFactory } from "../execution/NodeRunStateWriterF
26
26
  import type { EngineExecutionLimitsPolicy } from "../policies/executionLimits/EngineExecutionLimitsPolicy";
27
27
  import type { PollingTriggerRuntime } from "../triggers/polling/PollingTriggerRuntime";
28
28
  import type { PollingTriggerDedupWindow } from "../triggers/polling/PollingTriggerDedupWindow";
29
- import type { PollingTriggerHandle } from "../contracts/runtimeTypes";
29
+ import type { PollingTriggerHandle, TriggerPollingPort } from "../contracts/runtimeTypes";
30
30
 
31
31
  export interface TriggerEmitHandler {
32
32
  emit(workflow: WorkflowDefinition, triggerNodeId: NodeId, items: Items): Promise<void>;
@@ -268,7 +268,7 @@ export class TriggerRuntimeService {
268
268
 
269
269
  private buildPollingHandle(trigger: TriggerInstanceId, emit: (items: Items) => Promise<void>): PollingTriggerHandle {
270
270
  const runtime = this.pollingTriggerRuntime;
271
- return {
271
+ const handle: PollingTriggerHandle = {
272
272
  dedup: this.pollingTriggerDedupWindow,
273
273
  start: async (args) => {
274
274
  this.registerTriggerCleanupHandle(trigger, {
@@ -279,6 +279,7 @@ export class TriggerRuntimeService {
279
279
  return runtime.start({ trigger, emit, ...args });
280
280
  },
281
281
  };
282
+ return handle satisfies TriggerPollingPort;
282
283
  }
283
284
 
284
285
  private isTestableTriggerNode(node: TriggerNode): node is TestableTriggerNode<TriggerNodeConfig> {
@@ -19,7 +19,6 @@ import { WorkflowTopology } from "./WorkflowTopologyPlanner";
19
19
  export class CurrentStateFrontierPlanner {
20
20
  constructor(private readonly topology: WorkflowTopology) {}
21
21
 
22
- /** Composition-root-friendly factory (avoids `new` at orchestration call sites under ESLint manual-DI rules). */
23
22
  static createFromTopology(topology: WorkflowTopology): CurrentStateFrontierPlanner {
24
23
  return new CurrentStateFrontierPlanner(topology);
25
24
  }
@@ -150,12 +150,6 @@ export class RunQueuePlanner {
150
150
  }
151
151
  }
152
152
 
153
- /**
154
- * Matches `CurrentStateFrontierPlanner.buildFrontierQueue`: anything that is not exactly one input
155
- * port named `in` participates in multi-port collect (Merge after `If` branches, etc.). Routing must
156
- * not depend solely on `nodeInstances.get(toNodeId)?.executeMulti`, or a Merge can be enqueued as a
157
- * single-input job and `NodeExecutor` will call `execute` on a multi-input-only implementation.
158
- */
159
153
  private usesTopologyCollectMerge(toNodeId: NodeId): boolean {
160
154
  const expectedInputs = this.topology.expectedInputsByNode.get(toNodeId) ?? [];
161
155
  if (expectedInputs.length !== 1 || expectedInputs[0] !== "in") {
@@ -7,7 +7,6 @@ export interface EngineExecutionLimitsPolicyConfig {
7
7
  readonly hardMaxSubworkflowDepth: number;
8
8
  }
9
9
 
10
- /** Framework defaults for {@link EngineExecutionLimitsPolicy} (merged with host `runtime.engineExecutionLimits`). */
11
10
  export const ENGINE_EXECUTION_LIMITS_DEFAULTS: EngineExecutionLimitsPolicyConfig = {
12
11
  defaultMaxNodeActivations: 100_000,
13
12
  hardMaxNodeActivations: 100_000,
@@ -15,16 +14,9 @@ export const ENGINE_EXECUTION_LIMITS_DEFAULTS: EngineExecutionLimitsPolicyConfig
15
14
  hardMaxSubworkflowDepth: 32,
16
15
  };
17
16
 
18
- /**
19
- * Resolves per-run execution limits: defaults, hard ceilings, and subworkflow depth for new runs.
20
- */
21
17
  export class EngineExecutionLimitsPolicy {
22
18
  constructor(private readonly config: EngineExecutionLimitsPolicyConfig = ENGINE_EXECUTION_LIMITS_DEFAULTS) {}
23
19
 
24
- /**
25
- * Effective options for a new root run (depth 0): defaults merged with engine ceilings.
26
- * Replaces a separate one-method factory for root-run bootstrap.
27
- */
28
20
  createRootExecutionOptions(): RunExecutionOptions {
29
21
  return this.mergeExecutionOptionsForNewRun(undefined, undefined);
30
22
  }
@@ -4,9 +4,6 @@ import {
4
4
  type EngineExecutionLimitsPolicyConfig,
5
5
  } from "./EngineExecutionLimitsPolicy";
6
6
 
7
- /**
8
- * Builds {@link EngineExecutionLimitsPolicy} by merging {@link ENGINE_EXECUTION_LIMITS_DEFAULTS} with optional `overrides` (e.g. host `runtime.engineExecutionLimits`).
9
- */
10
7
  export class EngineExecutionLimitsPolicyFactory {
11
8
  create(overrides?: Partial<EngineExecutionLimitsPolicyConfig>): EngineExecutionLimitsPolicy {
12
9
  return new EngineExecutionLimitsPolicy({ ...ENGINE_EXECUTION_LIMITS_DEFAULTS, ...overrides });
@@ -1,7 +1,6 @@
1
1
  import { RunFinishedAtFactory } from "../contracts/runFinishedAtFactory";
2
2
  import type { PersistedRunState, RunSummary } from "../types";
3
3
 
4
- /** Maps persisted run state to API run summaries for listings. */
5
4
  export class RunSummaryMapper {
6
5
  static fromPersistedState(state: PersistedRunState): RunSummary {
7
6
  return {
@@ -5,6 +5,7 @@ import { PollingTriggerRuntime } from "../triggers/polling/PollingTriggerRuntime
5
5
  import { NoOpPollingTriggerLogger } from "../triggers/polling/PollingTriggerLogger";
6
6
  import { MissingRuntimeFallbacks } from "../workflowSnapshots/MissingRuntimeFallbacksFactory";
7
7
  import { MissingRuntimeExecutionMarker } from "../workflowSnapshots/MissingRuntimeExecutionMarker";
8
+ import { MissingRuntimeParityGuard } from "../workflowSnapshots/MissingRuntimeParityGuard";
8
9
  import { WorkflowSnapshotCodec } from "../workflowSnapshots/WorkflowSnapshotCodec";
9
10
  import { WorkflowSnapshotResolver } from "../workflowSnapshots/WorkflowSnapshotResolver";
10
11
  import { ActivationEnqueueService } from "../execution/ActivationEnqueueService";
@@ -28,22 +29,12 @@ import { Engine } from "../orchestration/Engine";
28
29
  import { CredentialResolverFactory } from "../execution/CredentialResolverFactory";
29
30
  import { NodeRunStateWriterFactory } from "../execution/NodeRunStateWriterFactory";
30
31
 
31
- /**
32
- * {@link EngineDeps} plus optional overrides for workflow-snapshot materialization.
33
- * Overrides keep default construction in this factory while allowing tests or advanced wiring to inject instances.
34
- */
35
32
  export type EngineCompositionDeps = EngineDeps & {
36
33
  workflowSnapshotCodec?: WorkflowSnapshotCodec;
37
34
  missingRuntimeFallbacks?: MissingRuntimeFallbacks;
38
- /** When set, used for run-start, trigger, and continuation limit defaults. */
39
35
  executionLimitsPolicy?: EngineExecutionLimitsPolicy;
40
36
  };
41
37
 
42
- /**
43
- * Composes the {@link Engine} graph from {@link EngineCompositionDeps}. Production wiring usually goes through
44
- * {@link import("../bootstrap/runtime/EngineRuntimeRegistrar").EngineRuntimeRegistrar}; this factory remains for tests and custom composition.
45
- * Exported from `@codemation/core/bootstrap` (not the main `@codemation/core` barrel).
46
- */
47
38
  export class EngineFactory {
48
39
  create(deps: EngineCompositionDeps): Engine {
49
40
  const waiters = new EngineWaiters();
@@ -65,7 +56,9 @@ export class EngineFactory {
65
56
  missingRuntimeFallbacks,
66
57
  );
67
58
 
68
- const semantics = new RunStateSemantics(new MissingRuntimeExecutionMarker());
59
+ const missingRuntimeExecutionMarker = new MissingRuntimeExecutionMarker();
60
+ const semantics = new RunStateSemantics(missingRuntimeExecutionMarker);
61
+ const parityGuard = new MissingRuntimeParityGuard(missingRuntimeExecutionMarker);
69
62
  const nodeActivationRequestInputPreparer = new NodeActivationRequestInputPreparer(deps.workflowNodeInstanceFactory);
70
63
  const activationEnqueueService = new ActivationEnqueueService(
71
64
  deps.activationScheduler,
@@ -124,6 +117,7 @@ export class EngineFactory {
124
117
  policyErrorServices,
125
118
  terminalPersistence,
126
119
  executionLimitsPolicy,
120
+ parityGuard,
127
121
  );
128
122
  const nodeExecutionRequestHandler = new NodeExecutionRequestHandlerService(
129
123
  deps.workflowExecutionRepository,
@@ -135,6 +129,7 @@ export class EngineFactory {
135
129
  deps.nodeExecutor,
136
130
  runContinuationService,
137
131
  executionLimitsPolicy,
132
+ parityGuard,
138
133
  );
139
134
 
140
135
  const pollingTriggerLogger = deps.pollingTriggerLogger ?? new NoOpPollingTriggerLogger();
@@ -219,10 +219,6 @@ export class RunIntentService {
219
219
  ]);
220
220
  }
221
221
 
222
- /**
223
- * Webhook-triggered runs always force inline execution first.
224
- * This is the highest-precedence scheduler override: it wins over node hints and container defaults.
225
- */
226
222
  private createWebhookExecutionOptions(): RunExecutionOptions {
227
223
  return {
228
224
  localOnly: true,
@@ -12,10 +12,6 @@ import type {
12
12
  WorkflowRepository,
13
13
  } from "../types";
14
14
 
15
- /**
16
- * Resolves webhook HTTP routes from the live workflow repository (no trigger setup / registration).
17
- * Maintains an in-memory index keyed by user-defined endpoint path for O(1) lookups after reload.
18
- */
19
15
  export class WorkflowRepositoryWebhookTriggerMatcher implements WebhookTriggerMatcher {
20
16
  private readonly routeByPath = new Map<string, WebhookInvocationMatch>();
21
17
  private engineRoutesActive = false;
@@ -7,10 +7,6 @@ import type {
7
7
  PersistedRuntimeTypeKind,
8
8
  } from "./persistedRuntimeTypeModelRegistry";
9
9
 
10
- /**
11
- * Applies both tsyringe injectability and persisted runtime metadata in one decorator.
12
- * This keeps runtime-type decorators thin while still recording enough data for snapshot hydration.
13
- */
14
10
  export class InjectableRuntimeDecoratorComposer {
15
11
  static compose(
16
12
  kind: PersistedRuntimeTypeKind,
@@ -9,10 +9,6 @@ import {
9
9
  import { PersistedRuntimeTypeNameResolver } from "./PersistedRuntimeTypeNameResolver";
10
10
  import { StackTraceCallSitePathResolver } from "./StackTraceCallSitePathResolver";
11
11
 
12
- /**
13
- * Defines and retrieves persisted runtime metadata on decorated classes.
14
- * The metadata is attached as a non-enumerable property so runtime objects stay serializable.
15
- */
16
12
  export class PersistedRuntimeTypeMetadataStore {
17
13
  static define(
18
14
  target: DecoratedRuntimeType,
@@ -1,6 +1,5 @@
1
1
  import type { DecoratedRuntimeType } from "./persistedRuntimeTypeModelRegistry";
2
2
 
3
- /** Resolves the persisted type name from either an explicit override or the class name itself. */
4
3
  export class PersistedRuntimeTypeNameResolver {
5
4
  static resolve(target: DecoratedRuntimeType, override: string | undefined): string {
6
5
  const resolved = override ?? target.name;
@@ -1,9 +1,7 @@
1
- /** Shared metadata key used to attach persisted runtime-type information to decorated classes. */
2
1
  export const persistedRuntimeTypeMetadataKey = Symbol.for("codemation.core.persistedRuntimeTypeMetadata");
3
2
 
4
3
  export type DecoratedRuntimeType = Readonly<{ name?: string }> & object;
5
4
 
6
- /** Categories of runtime classes that can be discovered and rehydrated from persisted snapshots. */
7
5
  export type PersistedRuntimeTypeKind = "node" | "tool" | "chatModel";
8
6
 
9
7
  export interface PersistedRuntimeTypeDecoratorOptions {
@@ -12,7 +10,6 @@ export interface PersistedRuntimeTypeDecoratorOptions {
12
10
  readonly moduleUrl?: string;
13
11
  }
14
12
 
15
- /** Serialized metadata attached to a decorated runtime type. */
16
13
  export interface PersistedRuntimeTypeMetadata {
17
14
  readonly persistedName: string;
18
15
  readonly kind: PersistedRuntimeTypeKind;
@@ -20,7 +17,6 @@ export interface PersistedRuntimeTypeMetadata {
20
17
  readonly sourceHint?: string;
21
18
  }
22
19
 
23
- /** Normalizes decorator options so persistence metadata has stable defaults. */
24
20
  export class PersistedRuntimeTypeDecoratorDefaults {
25
21
  static readonly appPackageName = "app";
26
22
 
@@ -6,36 +6,24 @@ import type {
6
6
  import { InjectableRuntimeDecoratorComposer } from "./InjectableRuntimeDecoratorComposerRegistry";
7
7
  import { PersistedRuntimeTypeMetadataStore } from "./PersistedRuntimeTypeMetadataStoreRegistry";
8
8
 
9
- /**
10
- * Public decorator entry points for runtime-discoverable classes.
11
- *
12
- * These exports intentionally stay as plain decorator factory functions because TypeScript's
13
- * `@decorator()` syntax expects callable values rather than instance methods. The helpers below
14
- * attach DI metadata and persisted-name metadata in one step so hosts can discover nodes, tools,
15
- * and chat models without duplicating registration boilerplate.
16
- */
17
9
  export type {
18
10
  PersistedRuntimeTypeDecoratorOptions,
19
11
  PersistedRuntimeTypeKind,
20
12
  PersistedRuntimeTypeMetadata,
21
13
  } from "./persistedRuntimeTypeModelRegistry";
22
14
 
23
- /** Reads persisted runtime metadata from a decorated class or object. */
24
15
  export function getPersistedRuntimeTypeMetadata(target: unknown): PersistedRuntimeTypeMetadata | undefined {
25
16
  return PersistedRuntimeTypeMetadataStore.get(target);
26
17
  }
27
18
 
28
- /** Marks a class as a persisted node runtime type and an injectable tsyringe service. */
29
19
  export function node(options: PersistedRuntimeTypeDecoratorOptions = {}): ClassDecorator {
30
20
  return InjectableRuntimeDecoratorComposer.compose("node", options, import.meta.url);
31
21
  }
32
22
 
33
- /** Marks a class as a persisted tool runtime type and an injectable tsyringe service. */
34
23
  export function tool(options: PersistedRuntimeTypeDecoratorOptions = {}): ClassDecorator {
35
24
  return InjectableRuntimeDecoratorComposer.compose("tool", options, import.meta.url);
36
25
  }
37
26
 
38
- /** Marks a class as a persisted chat-model runtime type and an injectable tsyringe service. */
39
27
  export function chatModel(options: PersistedRuntimeTypeDecoratorOptions = {}): ClassDecorator {
40
28
  return InjectableRuntimeDecoratorComposer.compose("chatModel", options, import.meta.url);
41
29
  }
@@ -20,7 +20,6 @@ export class ConfigDrivenOffloadPolicy implements NodeOffloadPolicy {
20
20
  if (hint === "local") return { mode: "local" };
21
21
  if (hint === "worker") return { mode: "worker", queue };
22
22
 
23
- // If a queue is specified, treat it as an implicit worker hint.
24
23
  if (queue) return { mode: "worker", queue };
25
24
 
26
25
  return { mode: this.defaultMode };
@@ -60,12 +60,6 @@ export class DefaultDrivingScheduler implements NodeActivationScheduler {
60
60
  return await this.prepareInlineDispatch(request);
61
61
  }
62
62
 
63
- /**
64
- * Scheduler precedence is explicit:
65
- * 1. run-intent override (`executionOptions.localOnly`)
66
- * 2. node-level execution hint / queue policy
67
- * 3. container-default scheduler policy fallback
68
- */
69
63
  private async selectScheduler(request: NodeActivationRequest): Promise<SchedulerSelection> {
70
64
  if (request.executionOptions?.localOnly) {
71
65
  return {
@@ -24,14 +24,6 @@ export class InlineDrivingScheduler implements NodeActivationScheduler {
24
24
  this.continuation = continuation;
25
25
  }
26
26
 
27
- /**
28
- * Prevents new drain cycles from being scheduled and waits for all currently-running
29
- * drains to complete. Call before closing the DB connection or rolling back test transactions
30
- * to ensure no in-flight writes hit a closed/rolled-back connection.
31
- *
32
- * Bounded: only the drains already in-flight at call time are awaited. Runs that keep
33
- * re-scheduling will not schedule new work once stopped is set.
34
- */
35
27
  async stop(): Promise<void> {
36
28
  this.stopped = true;
37
29
  if (this.activeDrainPromises.size > 0) {
@@ -58,9 +50,6 @@ export class InlineDrivingScheduler implements NodeActivationScheduler {
58
50
  this.scheduledRuns.delete(runId);
59
51
  try {
60
52
  const q = this.queuesByRunId.get(runId) ?? [];
61
- // Process exactly one activation per drain so the event loop gets a full cycle
62
- // (poll phase → I/O) between activations. Synchronous SQLite writes otherwise
63
- // block HTTP responses and WS frames for the entire run duration.
64
53
  if (q.length === 0) return;
65
54
  const next = q.shift()!;
66
55
  const { request } = next;
@@ -98,8 +87,6 @@ export class InlineDrivingScheduler implements NodeActivationScheduler {
98
87
  return;
99
88
  }
100
89
  this.scheduledRuns.add(runId);
101
- // Use setImmediate so the activation fires in the check phase (after poll/I/O),
102
- // giving queued HTTP writes and WS frames a chance to flush between activations.
103
90
  setImmediate(() => {
104
91
  this.scheduledRuns.delete(runId);
105
92
  if (this.stopped) return;
@@ -1,11 +1,6 @@
1
1
  import type { Item, Items } from "../contracts/workflowTypes";
2
2
  import { injectable } from "../di";
3
3
 
4
- /**
5
- * Normalizes external inputs into the engine's canonical `Items` shape.
6
- * Used at host and builder boundaries where callers may provide either a raw value,
7
- * a single item-like object, or an array of item-like values.
8
- */
9
4
  @injectable()
10
5
  export class ItemsInputNormalizer {
11
6
  normalize(raw: unknown): Items {
@@ -1,8 +1,5 @@
1
1
  import type { NodeExecutionRequest, NodeExecutionScheduler } from "../types";
2
2
 
3
- /**
4
- * Test scheduler that records enqueue requests without executing a real queue.
5
- */
6
3
  export class CapturingScheduler implements NodeExecutionScheduler {
7
4
  lastRequest: NodeExecutionRequest | undefined;
8
5
  requests: NodeExecutionRequest[] = [];
@@ -1,8 +1,5 @@
1
1
  import type { RunIdFactory } from "../types";
2
2
 
3
- /**
4
- * @internal Test harness id factory shared by registrar kit wiring.
5
- */
6
3
  export class EngineTestKitRunIdFactory implements RunIdFactory {
7
4
  private runCounter = 0;
8
5
  private activationCounter = 0;
@@ -2,9 +2,6 @@ import type { Item, RunnableNode, RunnableNodeExecuteArgs } from "../types";
2
2
 
3
3
  import type { ItemHarnessNodeConfig } from "./ItemHarnessNodeConfig";
4
4
 
5
- /**
6
- * Item-mode harness node for engine tests (see {@link ItemHarnessNodeConfig}).
7
- */
8
5
  export class ItemHarnessNode implements RunnableNode<ItemHarnessNodeConfig<any, any>> {
9
6
  readonly kind = "node" as const;
10
7
  readonly outputPorts = ["main"] as const;
@@ -5,10 +5,6 @@ import type { Item, Items, NodeExecutionContext, RunnableNodeConfig } from "../t
5
5
 
6
6
  import { ItemHarnessNode } from "./ItemHarnessNode";
7
7
 
8
- /**
9
- * Item-mode harness node config for engine tests: engine applies {@link RunnableNodeConfig.inputSchema},
10
- * then {@link ItemHarnessNode.execute} per item.
11
- */
12
8
  export class ItemHarnessNodeConfig<TIn = unknown, TOut = unknown> implements RunnableNodeConfig<TIn, TOut> {
13
9
  readonly kind = "node" as const;
14
10
  readonly type: TypeToken<unknown> = ItemHarnessNode;
@@ -1,6 +1,3 @@
1
- /**
2
- * Deterministic `run_1`, `act_1`-style ids for test harness factories.
3
- */
4
1
  export class PrefixedSequentialIdGenerator {
5
2
  private n = 0;
6
3
 
@@ -39,12 +39,10 @@ export type EngineTestKitOptions = Partial<{
39
39
  makeRunId: () => string;
40
40
  makeActivationId: () => string;
41
41
  workflowRunner: EngineWorkflowRunnerService;
42
- /** Passed to engine factory so integration tests can assert host-configured limits propagate. */
43
42
  executionLimitsPolicy: EngineExecutionLimitsPolicy;
44
43
  }>;
45
44
 
46
45
  export type RegistrarEngineTestKitOptions = EngineTestKitOptions & {
47
- /** Passed to {@link EngineRuntimeRegistrar.register}. */
48
46
  registrarOptions?: EngineRuntimeRegistrationOptions;
49
47
  };
50
48
 
@@ -1,9 +1,5 @@
1
1
  import type { CredentialSessionService } from "../contracts/credentialTypes";
2
2
 
3
- /**
4
- * Test harness default: rejects any credential lookup so missing bindings fail loudly.
5
- * Prefer registering a real {@link CredentialSessionService} in integration scenarios.
6
- */
7
3
  export class RejectingCredentialSessionService implements CredentialSessionService {
8
4
  async getSession<TSession = unknown>(
9
5
  args: Readonly<{ workflowId: string; nodeId: string; slotKey: string }>,
@@ -4,9 +4,6 @@ import type { TypeToken } from "../di";
4
4
  import type { Item, NodeId, RunnableNode, RunnableNodeConfig, RunnableNodeExecuteArgs, WorkflowId } from "../types";
5
5
  import { emitPorts } from "../contracts/emitPorts";
6
6
 
7
- /**
8
- * Test harness subworkflow runner (mirrors integration patterns; lives under {@link "@codemation/core/testing"}).
9
- */
10
7
  export class SubWorkflowRunnerConfig<TInputJson = unknown, TOutputJson = unknown> implements RunnableNodeConfig<
11
8
  TInputJson,
12
9
  TOutputJson
@@ -9,9 +9,6 @@ import type {
9
9
  TriggerSetupContext,
10
10
  } from "../types";
11
11
 
12
- /**
13
- * Minimal pass-through manual trigger for {@link WorkflowTestKit.runNode}; emits input items unchanged.
14
- */
15
12
  export class WorkflowTestHarnessManualTriggerConfig implements TriggerNodeConfig<unknown> {
16
13
  readonly kind = "trigger" as const;
17
14
  readonly type: TypeToken<unknown> = WorkflowTestHarnessManualTriggerNode;
@@ -41,10 +41,6 @@ export class WorkflowTestKit {
41
41
  return this.handle.runStore;
42
42
  }
43
43
 
44
- /**
45
- * Registers {@link import("../authoring/defineNode.types").DefinedNode} implementations on the same DI container used by the engine
46
- * (same pattern as `plugin.register({ registerNode })` in the host).
47
- */
48
44
  registerDefinedNodes(definitions: ReadonlyArray<DefinedNodeRegistration>): void {
49
45
  const ctx = this.nodeRegistrationContextFactory.create(this.handle.dependencyContainer);
50
46
  for (const def of definitions) {
@@ -6,9 +6,6 @@ import { WorkflowTestHarnessManualTriggerConfig } from "./WorkflowTestHarnessMan
6
6
  const defaultInlineWorkflowId = "codemation.testing.workflowkit.inline" as WorkflowId;
7
7
  const defaultInlineWorkflowName = "WorkflowTestKit inline";
8
8
 
9
- /**
10
- * Builds the minimal trigger → runnable workflow used by {@link import("./WorkflowTestKit").WorkflowTestKit.runNode}.
11
- */
12
9
  export class WorkflowTestKitRunNodeWorkflowFactory {
13
10
  build(args: { node: RunnableNodeConfig; workflowId?: WorkflowId; workflowName?: string }): WorkflowDefinition {
14
11
  const workflowId = args.workflowId ?? defaultInlineWorkflowId;
package/src/testing.ts CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- * Test-only adapters and helpers. Not part of the supported production public API.
3
- */
4
1
  export { InMemoryLiveWorkflowRepository } from "./runtime/InMemoryLiveWorkflowRepository";
5
2
  export { WorkflowSnapshotCodec as PersistedWorkflowSnapshotFactory } from "./workflowSnapshots/WorkflowSnapshotCodec";
6
3
  export { RejectingCredentialSessionService } from "./testing/RejectingCredentialSessionService";
@@ -1,7 +1,3 @@
1
- /**
2
- * Merges processed-ID windows for polling triggers, capping the total to avoid unbounded growth.
3
- * Plugin code receives an instance of this class via {@link PollingTriggerHandle.dedup}.
4
- */
5
1
  export class PollingTriggerDedupWindow {
6
2
  static readonly defaultCapN = 2000;
7
3
 
@@ -1,8 +1,3 @@
1
- /**
2
- * Minimal logger surface for the polling-trigger runtime.
3
- * Hosts supply this via {@link EngineDeps.pollingTriggerLogger};
4
- * when absent the runtime is silent.
5
- */
6
1
  export interface PollingTriggerLogger {
7
2
  info(message: string): void;
8
3
  warn(message: string): void;
@@ -19,11 +19,6 @@ export interface PollingTriggerStartArgs<TState, TItem> {
19
19
  emit: (items: Items) => Promise<void>;
20
20
  }
21
21
 
22
- /**
23
- * Generic polling-trigger runtime. Owns the set-interval loop, overlap guard, and persistence.
24
- * Constructed by {@link import("../../runtime/EngineFactory").EngineFactory} and exposed to plugin
25
- * authors via {@link import("../../contracts/runtimeTypes").TriggerSetupContext}.polling.
26
- */
27
22
  export class PollingTriggerRuntime {
28
23
  private readonly activeTriggers = new Set<string>();
29
24
  private readonly intervalsByTrigger = new Map<string, ReturnType<typeof setInterval>>();
@@ -1,9 +1,7 @@
1
- // Re-export pure-type contracts first (available via @codemation/core/contracts subpath)
2
1
  export * from "../contracts";
3
2
  export * from "../contracts/mcpTypes";
4
3
  export type { CollectionStore, CollectionsContext } from "../contracts/collectionTypes";
5
4
 
6
- // Additional runtime exports not included in contracts (factory classes, DSL builders, etc.)
7
5
  export * from "../contracts/emitPorts";
8
6
  export * from "../contracts/itemMeta";
9
7
  export * from "../contracts/itemExpr";
@@ -17,10 +15,6 @@ export * from "../contracts/NoOpCostTrackingTelemetryFactory";
17
15
  export * from "../contracts/NoOpExecutionTelemetryFactory";
18
16
  export * from "../contracts/runFinishedAtFactory";
19
17
  export * from "../contracts/workflowActivationPolicy";
20
- // telemetryTypes and workflowTypes also have runtime exports (No-Op telemetry classes,
21
- // attribute-name registries, `nodeRef` factory, unique-symbol type tags) — `contracts.ts`
22
- // already re-exports them with `export type *` for the slim subpath; re-export with the
23
- // full `export *` here so back-compat for `@codemation/core` (root) consumers is preserved.
24
18
  export * from "../contracts/telemetryTypes";
25
19
  export * from "../contracts/workflowTypes";
26
20
  export * from "../workflow";
@@ -34,10 +34,6 @@ export class WorkflowEdgePortValidator {
34
34
  return { valid: errors.length === 0, errors };
35
35
  }
36
36
 
37
- /**
38
- * Returns the declared output ports for a node, or null if the node is
39
- * unknown / has no declared ports (legacy nodes — treat as unconstrained).
40
- */
41
37
  private allowedOutputPorts(node: NodeDefinition | undefined): ReadonlyArray<string> | null {
42
38
  if (!node) {
43
39
  return null;
@@ -46,7 +42,6 @@ export class WorkflowEdgePortValidator {
46
42
  if (declared && declared.length > 0) {
47
43
  return declared as string[];
48
44
  }
49
- // No declared ports — treat as unconstrained (legacy nodes default to "main").
50
45
  return null;
51
46
  }
52
47
  }
@@ -1,17 +1,10 @@
1
1
  import type { NodeId } from "../../types";
2
2
 
3
- /**
4
- * Unique ids for persisted connection invocation history rows (LLM/tool calls under an owning node).
5
- *
6
- * Uses Web Crypto's `randomUUID` so this module is safe in browser-bundle contexts —
7
- * paired with `NodeIterationIdFactory` which had the same `node:crypto` regression.
8
- */
9
3
  export class ConnectionInvocationIdFactory {
10
4
  static create(): string {
11
5
  return `cinv_${globalThis.crypto.randomUUID()}`;
12
6
  }
13
7
 
14
- /** Deterministic id for tests when a stable sequence is needed. */
15
8
  static createForTest(runId: string, connectionNodeId: NodeId, sequence: number): string {
16
9
  return `cinv_${runId}_${connectionNodeId}_${sequence}`;
17
10
  }