@codemation/core 0.8.0 → 0.10.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 (103) hide show
  1. package/CHANGELOG.md +390 -0
  2. package/dist/{EngineRuntimeRegistration.types-BP6tsaNP.d.ts → EngineRuntimeRegistration.types-D1fyApMI.d.ts} +2 -2
  3. package/dist/{EngineWorkflowRunnerService-DzOCa1BW.d.cts → EngineRuntimeRegistration.types-pB3FnzqR.d.cts} +17 -17
  4. package/dist/{InMemoryRunDataFactory-1iz7_SnO.d.cts → InMemoryRunDataFactory-Xw7v4-sj.d.cts} +31 -29
  5. package/dist/InMemoryRunEventBusRegistry-VM3OWnHo.cjs +47 -0
  6. package/dist/InMemoryRunEventBusRegistry-VM3OWnHo.cjs.map +1 -0
  7. package/dist/InMemoryRunEventBusRegistry-sM4z4n_i.js +41 -0
  8. package/dist/InMemoryRunEventBusRegistry-sM4z4n_i.js.map +1 -0
  9. package/dist/{RunIntentService-BqhmdoA1.d.ts → RunIntentService-BE9CAkbf.d.ts} +966 -471
  10. package/dist/{RunIntentService-S-1lW-gS.d.cts → RunIntentService-siBSjaaY.d.cts} +859 -493
  11. package/dist/bootstrap/index.cjs +5 -2
  12. package/dist/bootstrap/index.d.cts +212 -135
  13. package/dist/bootstrap/index.d.ts +4 -4
  14. package/dist/bootstrap/index.js +3 -3
  15. package/dist/{bootstrap-BaN6hZ5I.cjs → bootstrap-Cm5ruQxx.cjs} +263 -12
  16. package/dist/bootstrap-Cm5ruQxx.cjs.map +1 -0
  17. package/dist/bootstrap-D3r505ko.js +454 -0
  18. package/dist/bootstrap-D3r505ko.js.map +1 -0
  19. package/dist/{index-CVs9rVhl.d.ts → index-DeLl1Tne.d.ts} +632 -230
  20. package/dist/index.cjs +323 -176
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +544 -91
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +299 -166
  25. package/dist/index.js.map +1 -1
  26. package/dist/{runtime-DUW6tIJ1.js → runtime-BGNbRnqs.js} +934 -75
  27. package/dist/runtime-BGNbRnqs.js.map +1 -0
  28. package/dist/{runtime-Dvo2ru5A.cjs → runtime-DKXJwTNv.cjs} +1028 -73
  29. package/dist/runtime-DKXJwTNv.cjs.map +1 -0
  30. package/dist/testing.cjs +5 -5
  31. package/dist/testing.cjs.map +1 -1
  32. package/dist/testing.d.cts +2 -2
  33. package/dist/testing.d.ts +2 -2
  34. package/dist/testing.js +4 -4
  35. package/dist/testing.js.map +1 -1
  36. package/package.json +7 -2
  37. package/src/ai/AiHost.ts +42 -14
  38. package/src/authoring/DefinedCollectionRegistry.ts +17 -0
  39. package/src/authoring/defineCollection.types.ts +181 -0
  40. package/src/authoring/definePollingTrigger.types.ts +396 -0
  41. package/src/authoring/definePollingTriggerInternals.ts +74 -0
  42. package/src/authoring/index.ts +19 -0
  43. package/src/bootstrap/index.ts +9 -0
  44. package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +21 -14
  45. package/src/browser.ts +1 -0
  46. package/src/contracts/CodemationTelemetryAttributeNames.ts +6 -0
  47. package/src/contracts/NoOpNodeExecutionTelemetry.ts +2 -11
  48. package/src/contracts/NoOpTelemetrySpanScope.ts +46 -10
  49. package/src/contracts/assertionTypes.ts +63 -0
  50. package/src/contracts/baseTypes.ts +12 -0
  51. package/src/contracts/collectionTypes.ts +44 -0
  52. package/src/contracts/credentialTypes.ts +23 -1
  53. package/src/contracts/executionPersistenceContracts.ts +30 -0
  54. package/src/contracts/index.ts +4 -0
  55. package/src/contracts/runTypes.ts +37 -1
  56. package/src/contracts/runtimeTypes.ts +42 -0
  57. package/src/contracts/telemetryTypes.ts +8 -0
  58. package/src/contracts/testTriggerTypes.ts +66 -0
  59. package/src/contracts/workflowTypes.ts +36 -7
  60. package/src/contracts.ts +59 -0
  61. package/src/events/ConnectionInvocationEventPublisher.ts +46 -0
  62. package/src/events/index.ts +1 -0
  63. package/src/events/runEvents.ts +74 -0
  64. package/src/execution/ChildExecutionScopeFactory.ts +55 -0
  65. package/src/execution/DefaultExecutionContextFactory.ts +6 -0
  66. package/src/execution/ExecutionTelemetryCostTrackingDecoratorFactory.ts +18 -0
  67. package/src/execution/NodeExecutor.ts +10 -2
  68. package/src/execution/NodeInstanceFactory.ts +13 -1
  69. package/src/execution/NodeInstantiationError.ts +16 -0
  70. package/src/execution/NodeRunStateWriter.ts +7 -0
  71. package/src/execution/NodeRunStateWriterFactory.ts +7 -0
  72. package/src/execution/WorkflowRunExecutionContextFactory.ts +3 -0
  73. package/src/execution/index.ts +2 -0
  74. package/src/index.ts +8 -0
  75. package/src/orchestration/AbortControllerFactory.ts +9 -0
  76. package/src/orchestration/NodeExecutionRequestHandlerService.ts +1 -0
  77. package/src/orchestration/RunContinuationService.ts +3 -0
  78. package/src/orchestration/RunStartService.ts +122 -3
  79. package/src/orchestration/TestSuiteOrchestrator.ts +350 -0
  80. package/src/orchestration/TestSuiteRunIdFactory.ts +11 -0
  81. package/src/orchestration/TriggerRuntimeService.ts +34 -7
  82. package/src/orchestration/index.ts +9 -0
  83. package/src/runtime/EngineFactory.ts +12 -0
  84. package/src/testing/WorkflowTestKitNodeRegistrationContextFactory.ts +1 -3
  85. package/src/triggers/polling/PollingTriggerDedupWindow.ts +23 -0
  86. package/src/triggers/polling/PollingTriggerLogger.ts +18 -0
  87. package/src/triggers/polling/PollingTriggerRuntime.ts +122 -0
  88. package/src/triggers/polling/index.ts +5 -0
  89. package/src/types/index.ts +12 -9
  90. package/src/workflow/definition/NodeIterationIdFactory.ts +26 -0
  91. package/src/workflow/dsl/NodeIdSlugifier.ts +18 -0
  92. package/src/workflow/dsl/WorkflowBuilder.ts +71 -3
  93. package/src/workflow/dsl/WorkflowDefinitionError.ts +15 -0
  94. package/src/workflow/index.ts +3 -0
  95. package/dist/InMemoryRunEventBusRegistry-B0_C4OnP.cjs +0 -262
  96. package/dist/InMemoryRunEventBusRegistry-B0_C4OnP.cjs.map +0 -1
  97. package/dist/InMemoryRunEventBusRegistry-C2U83Hmv.js +0 -238
  98. package/dist/InMemoryRunEventBusRegistry-C2U83Hmv.js.map +0 -1
  99. package/dist/bootstrap-BaN6hZ5I.cjs.map +0 -1
  100. package/dist/bootstrap-d_BMaDT4.js +0 -221
  101. package/dist/bootstrap-d_BMaDT4.js.map +0 -1
  102. package/dist/runtime-DUW6tIJ1.js.map +0 -1
  103. package/dist/runtime-Dvo2ru5A.cjs.map +0 -1
@@ -0,0 +1,47 @@
1
+
2
+ //#region src/events/InMemoryRunEventSubscription.ts
3
+ var InMemoryRunEventSubscription = class {
4
+ constructor(onClose) {
5
+ this.onClose = onClose;
6
+ }
7
+ async close() {
8
+ this.onClose();
9
+ }
10
+ };
11
+
12
+ //#endregion
13
+ //#region src/events/InMemoryRunEventBusRegistry.ts
14
+ var InMemoryRunEventBus = class {
15
+ globalListeners = /* @__PURE__ */ new Set();
16
+ listenersByWorkflowId = /* @__PURE__ */ new Map();
17
+ async publish(event) {
18
+ for (const listener of this.globalListeners) listener(event);
19
+ for (const listener of this.listenersByWorkflowId.get(event.workflowId) ?? []) listener(event);
20
+ }
21
+ async subscribe(onEvent) {
22
+ this.globalListeners.add(onEvent);
23
+ return new InMemoryRunEventSubscription(() => {
24
+ this.globalListeners.delete(onEvent);
25
+ });
26
+ }
27
+ async subscribeToWorkflow(workflowId, onEvent) {
28
+ const existing = this.listenersByWorkflowId.get(workflowId) ?? /* @__PURE__ */ new Set();
29
+ existing.add(onEvent);
30
+ this.listenersByWorkflowId.set(workflowId, existing);
31
+ return new InMemoryRunEventSubscription(() => {
32
+ const listeners = this.listenersByWorkflowId.get(workflowId);
33
+ if (!listeners) return;
34
+ listeners.delete(onEvent);
35
+ if (listeners.size === 0) this.listenersByWorkflowId.delete(workflowId);
36
+ });
37
+ }
38
+ };
39
+
40
+ //#endregion
41
+ Object.defineProperty(exports, 'InMemoryRunEventBus', {
42
+ enumerable: true,
43
+ get: function () {
44
+ return InMemoryRunEventBus;
45
+ }
46
+ });
47
+ //# sourceMappingURL=InMemoryRunEventBusRegistry-VM3OWnHo.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InMemoryRunEventBusRegistry-VM3OWnHo.cjs","names":["onClose: () => void"],"sources":["../src/events/InMemoryRunEventSubscription.ts","../src/events/InMemoryRunEventBusRegistry.ts"],"sourcesContent":["import type { RunEventSubscription } from \"./runEvents\";\n\nexport class InMemoryRunEventSubscription implements RunEventSubscription {\n constructor(private readonly onClose: () => void) {}\n\n async close(): Promise<void> {\n this.onClose();\n }\n}\n","import type { WorkflowId } from \"../types\";\n\nimport type { RunEvent, RunEventBus, RunEventSubscription } from \"./runEvents\";\n\nimport { InMemoryRunEventSubscription } from \"./InMemoryRunEventSubscription\";\n\nexport class InMemoryRunEventBus implements RunEventBus {\n private readonly globalListeners = new Set<(event: RunEvent) => void>();\n private readonly listenersByWorkflowId = new Map<WorkflowId, Set<(event: RunEvent) => void>>();\n\n async publish(event: RunEvent): Promise<void> {\n for (const listener of this.globalListeners) listener(event);\n for (const listener of this.listenersByWorkflowId.get(event.workflowId) ?? []) listener(event);\n }\n\n async subscribe(onEvent: (event: RunEvent) => void): Promise<RunEventSubscription> {\n this.globalListeners.add(onEvent);\n return new InMemoryRunEventSubscription(() => {\n this.globalListeners.delete(onEvent);\n });\n }\n\n async subscribeToWorkflow(workflowId: WorkflowId, onEvent: (event: RunEvent) => void): Promise<RunEventSubscription> {\n const existing = this.listenersByWorkflowId.get(workflowId) ?? new Set<(event: RunEvent) => void>();\n existing.add(onEvent);\n this.listenersByWorkflowId.set(workflowId, existing);\n\n return new InMemoryRunEventSubscription(() => {\n const listeners = this.listenersByWorkflowId.get(workflowId);\n if (!listeners) return;\n listeners.delete(onEvent);\n if (listeners.size === 0) this.listenersByWorkflowId.delete(workflowId);\n });\n }\n}\n\nexport { InMemoryRunEventSubscription } from \"./InMemoryRunEventSubscription\";\n"],"mappings":";;AAEA,IAAa,+BAAb,MAA0E;CACxE,YAAY,AAAiBA,SAAqB;EAArB;;CAE7B,MAAM,QAAuB;AAC3B,OAAK,SAAS;;;;;;ACAlB,IAAa,sBAAb,MAAwD;CACtD,AAAiB,kCAAkB,IAAI,KAAgC;CACvE,AAAiB,wCAAwB,IAAI,KAAiD;CAE9F,MAAM,QAAQ,OAAgC;AAC5C,OAAK,MAAM,YAAY,KAAK,gBAAiB,UAAS,MAAM;AAC5D,OAAK,MAAM,YAAY,KAAK,sBAAsB,IAAI,MAAM,WAAW,IAAI,EAAE,CAAE,UAAS,MAAM;;CAGhG,MAAM,UAAU,SAAmE;AACjF,OAAK,gBAAgB,IAAI,QAAQ;AACjC,SAAO,IAAI,mCAAmC;AAC5C,QAAK,gBAAgB,OAAO,QAAQ;IACpC;;CAGJ,MAAM,oBAAoB,YAAwB,SAAmE;EACnH,MAAM,WAAW,KAAK,sBAAsB,IAAI,WAAW,oBAAI,IAAI,KAAgC;AACnG,WAAS,IAAI,QAAQ;AACrB,OAAK,sBAAsB,IAAI,YAAY,SAAS;AAEpD,SAAO,IAAI,mCAAmC;GAC5C,MAAM,YAAY,KAAK,sBAAsB,IAAI,WAAW;AAC5D,OAAI,CAAC,UAAW;AAChB,aAAU,OAAO,QAAQ;AACzB,OAAI,UAAU,SAAS,EAAG,MAAK,sBAAsB,OAAO,WAAW;IACvE"}
@@ -0,0 +1,41 @@
1
+ //#region src/events/InMemoryRunEventSubscription.ts
2
+ var InMemoryRunEventSubscription = class {
3
+ constructor(onClose) {
4
+ this.onClose = onClose;
5
+ }
6
+ async close() {
7
+ this.onClose();
8
+ }
9
+ };
10
+
11
+ //#endregion
12
+ //#region src/events/InMemoryRunEventBusRegistry.ts
13
+ var InMemoryRunEventBus = class {
14
+ globalListeners = /* @__PURE__ */ new Set();
15
+ listenersByWorkflowId = /* @__PURE__ */ new Map();
16
+ async publish(event) {
17
+ for (const listener of this.globalListeners) listener(event);
18
+ for (const listener of this.listenersByWorkflowId.get(event.workflowId) ?? []) listener(event);
19
+ }
20
+ async subscribe(onEvent) {
21
+ this.globalListeners.add(onEvent);
22
+ return new InMemoryRunEventSubscription(() => {
23
+ this.globalListeners.delete(onEvent);
24
+ });
25
+ }
26
+ async subscribeToWorkflow(workflowId, onEvent) {
27
+ const existing = this.listenersByWorkflowId.get(workflowId) ?? /* @__PURE__ */ new Set();
28
+ existing.add(onEvent);
29
+ this.listenersByWorkflowId.set(workflowId, existing);
30
+ return new InMemoryRunEventSubscription(() => {
31
+ const listeners = this.listenersByWorkflowId.get(workflowId);
32
+ if (!listeners) return;
33
+ listeners.delete(onEvent);
34
+ if (listeners.size === 0) this.listenersByWorkflowId.delete(workflowId);
35
+ });
36
+ }
37
+ };
38
+
39
+ //#endregion
40
+ export { InMemoryRunEventBus as t };
41
+ //# sourceMappingURL=InMemoryRunEventBusRegistry-sM4z4n_i.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InMemoryRunEventBusRegistry-sM4z4n_i.js","names":["onClose: () => void"],"sources":["../src/events/InMemoryRunEventSubscription.ts","../src/events/InMemoryRunEventBusRegistry.ts"],"sourcesContent":["import type { RunEventSubscription } from \"./runEvents\";\n\nexport class InMemoryRunEventSubscription implements RunEventSubscription {\n constructor(private readonly onClose: () => void) {}\n\n async close(): Promise<void> {\n this.onClose();\n }\n}\n","import type { WorkflowId } from \"../types\";\n\nimport type { RunEvent, RunEventBus, RunEventSubscription } from \"./runEvents\";\n\nimport { InMemoryRunEventSubscription } from \"./InMemoryRunEventSubscription\";\n\nexport class InMemoryRunEventBus implements RunEventBus {\n private readonly globalListeners = new Set<(event: RunEvent) => void>();\n private readonly listenersByWorkflowId = new Map<WorkflowId, Set<(event: RunEvent) => void>>();\n\n async publish(event: RunEvent): Promise<void> {\n for (const listener of this.globalListeners) listener(event);\n for (const listener of this.listenersByWorkflowId.get(event.workflowId) ?? []) listener(event);\n }\n\n async subscribe(onEvent: (event: RunEvent) => void): Promise<RunEventSubscription> {\n this.globalListeners.add(onEvent);\n return new InMemoryRunEventSubscription(() => {\n this.globalListeners.delete(onEvent);\n });\n }\n\n async subscribeToWorkflow(workflowId: WorkflowId, onEvent: (event: RunEvent) => void): Promise<RunEventSubscription> {\n const existing = this.listenersByWorkflowId.get(workflowId) ?? new Set<(event: RunEvent) => void>();\n existing.add(onEvent);\n this.listenersByWorkflowId.set(workflowId, existing);\n\n return new InMemoryRunEventSubscription(() => {\n const listeners = this.listenersByWorkflowId.get(workflowId);\n if (!listeners) return;\n listeners.delete(onEvent);\n if (listeners.size === 0) this.listenersByWorkflowId.delete(workflowId);\n });\n }\n}\n\nexport { InMemoryRunEventSubscription } from \"./InMemoryRunEventSubscription\";\n"],"mappings":";AAEA,IAAa,+BAAb,MAA0E;CACxE,YAAY,AAAiBA,SAAqB;EAArB;;CAE7B,MAAM,QAAuB;AAC3B,OAAK,SAAS;;;;;;ACAlB,IAAa,sBAAb,MAAwD;CACtD,AAAiB,kCAAkB,IAAI,KAAgC;CACvE,AAAiB,wCAAwB,IAAI,KAAiD;CAE9F,MAAM,QAAQ,OAAgC;AAC5C,OAAK,MAAM,YAAY,KAAK,gBAAiB,UAAS,MAAM;AAC5D,OAAK,MAAM,YAAY,KAAK,sBAAsB,IAAI,MAAM,WAAW,IAAI,EAAE,CAAE,UAAS,MAAM;;CAGhG,MAAM,UAAU,SAAmE;AACjF,OAAK,gBAAgB,IAAI,QAAQ;AACjC,SAAO,IAAI,mCAAmC;AAC5C,QAAK,gBAAgB,OAAO,QAAQ;IACpC;;CAGJ,MAAM,oBAAoB,YAAwB,SAAmE;EACnH,MAAM,WAAW,KAAK,sBAAsB,IAAI,WAAW,oBAAI,IAAI,KAAgC;AACnG,WAAS,IAAI,QAAQ;AACrB,OAAK,sBAAsB,IAAI,YAAY,SAAS;AAEpD,SAAO,IAAI,mCAAmC;GAC5C,MAAM,YAAY,KAAK,sBAAsB,IAAI,WAAW;AAC5D,OAAI,CAAC,UAAW;AAChB,aAAU,OAAO,QAAQ;AACzB,OAAI,UAAU,SAAS,EAAG,MAAK,sBAAsB,OAAO,WAAW;IACvE"}