@codemation/core 0.2.3 → 0.4.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 (82) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +2 -0
  3. package/dist/{EngineRuntimeRegistration.types-Bjeo7Sfq.d.ts → EngineRuntimeRegistration.types-DU6MsjU9.d.ts} +2 -2
  4. package/dist/{EngineWorkflowRunnerService-Dd4yD31l.d.cts → EngineWorkflowRunnerService-BBkL4VQF.d.cts} +2 -2
  5. package/dist/{InMemoryRunDataFactory-OUzDmAHt.d.cts → InMemoryRunDataFactory-CsYEMJK2.d.cts} +11 -3
  6. package/dist/{RunIntentService-Bkg4oYrM.d.cts → RunIntentService-BvlTpmEb.d.cts} +224 -237
  7. package/dist/{RunIntentService-BAKikN8h.d.ts → RunIntentService-zbTchO9T.d.ts} +305 -259
  8. package/dist/bootstrap/index.cjs +2 -2
  9. package/dist/bootstrap/index.d.cts +19 -7
  10. package/dist/bootstrap/index.d.ts +3 -3
  11. package/dist/bootstrap/index.js +2 -2
  12. package/dist/{bootstrap-DwS5S7s9.cjs → bootstrap-DHH2uo-W.cjs} +4 -2
  13. package/dist/bootstrap-DHH2uo-W.cjs.map +1 -0
  14. package/dist/{bootstrap-BD6CobHl.js → bootstrap-DbUlOl11.js} +4 -2
  15. package/dist/bootstrap-DbUlOl11.js.map +1 -0
  16. package/dist/{index-BDHCiN22.d.ts → index-CUt13qs1.d.ts} +85 -16
  17. package/dist/index.cjs +74 -12
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +131 -24
  20. package/dist/index.d.ts +3 -3
  21. package/dist/index.js +64 -13
  22. package/dist/index.js.map +1 -1
  23. package/dist/{runtime-Cy-3FTI_.js → runtime-BdH94eBR.js} +502 -123
  24. package/dist/runtime-BdH94eBR.js.map +1 -0
  25. package/dist/{runtime-ZJUpWmPH.cjs → runtime-feFn8OmG.cjs} +561 -122
  26. package/dist/runtime-feFn8OmG.cjs.map +1 -0
  27. package/dist/testing.cjs +40 -36
  28. package/dist/testing.cjs.map +1 -1
  29. package/dist/testing.d.cts +17 -26
  30. package/dist/testing.d.ts +17 -26
  31. package/dist/testing.js +40 -36
  32. package/dist/testing.js.map +1 -1
  33. package/dist/{workflowActivationPolicy-BzyzXLa_.cjs → workflowActivationPolicy-6V3OJD3N.cjs} +65 -19
  34. package/dist/workflowActivationPolicy-6V3OJD3N.cjs.map +1 -0
  35. package/dist/{workflowActivationPolicy-B8HzTk3o.js → workflowActivationPolicy-Td9HTOuD.js} +65 -19
  36. package/dist/workflowActivationPolicy-Td9HTOuD.js.map +1 -0
  37. package/package.json +2 -1
  38. package/src/ai/AgentConfigInspectorFactory.ts +4 -0
  39. package/src/ai/AgentMessageConfigNormalizerFactory.ts +7 -0
  40. package/src/ai/AgentToolFactory.ts +2 -2
  41. package/src/ai/AiHost.ts +11 -10
  42. package/src/ai/NodeBackedToolConfig.ts +1 -1
  43. package/src/authoring/defineNode.types.ts +144 -25
  44. package/src/authoring/index.ts +3 -1
  45. package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +8 -0
  46. package/src/contracts/emitPorts.ts +27 -0
  47. package/src/contracts/index.ts +3 -0
  48. package/src/contracts/itemMeta.ts +11 -0
  49. package/src/contracts/itemValue.ts +147 -0
  50. package/src/contracts/runtimeTypes.ts +39 -22
  51. package/src/contracts/workflowTypes.ts +26 -56
  52. package/src/execution/FanInMergeByOriginMerger.ts +67 -0
  53. package/src/execution/ItemValueResolver.ts +27 -0
  54. package/src/execution/NodeActivationRequestComposer.ts +25 -0
  55. package/src/execution/NodeActivationRequestInputPreparer.ts +57 -25
  56. package/src/execution/NodeExecutor.ts +199 -30
  57. package/src/execution/NodeOutputNormalizer.ts +90 -0
  58. package/src/execution/index.ts +2 -0
  59. package/src/index.ts +2 -0
  60. package/src/orchestration/NodeExecutionRequestHandlerService.ts +39 -18
  61. package/src/orchestration/RunContinuationService.ts +11 -17
  62. package/src/planning/CurrentStateFrontierPlanner.ts +20 -20
  63. package/src/planning/RunQueuePlanner.ts +56 -19
  64. package/src/planning/WorkflowTopologyPlanner.ts +57 -33
  65. package/src/testing/ItemHarnessNode.ts +4 -10
  66. package/src/testing/ItemHarnessNodeConfig.ts +7 -16
  67. package/src/testing/RegistrarEngineTestKitFactory.ts +2 -0
  68. package/src/testing/SubWorkflowRunnerTestNode.ts +28 -43
  69. package/src/testing/SwitchHarnessNode.ts +54 -0
  70. package/src/types/index.ts +3 -0
  71. package/src/workflow/dsl/ChainCursorResolver.ts +68 -23
  72. package/src/workflow/dsl/WorkflowBuilder.ts +3 -5
  73. package/src/workflow/dsl/workflowBuilderTypes.ts +5 -8
  74. package/src/workflowSnapshots/MissingRuntimeNode.ts +4 -4
  75. package/src/workflowSnapshots/MissingRuntimeNodeConfig.ts +2 -2
  76. package/src/workflowSnapshots/WorkflowSnapshotCodec.ts +16 -7
  77. package/dist/bootstrap-BD6CobHl.js.map +0 -1
  78. package/dist/bootstrap-DwS5S7s9.cjs.map +0 -1
  79. package/dist/runtime-Cy-3FTI_.js.map +0 -1
  80. package/dist/runtime-ZJUpWmPH.cjs.map +0 -1
  81. package/dist/workflowActivationPolicy-B8HzTk3o.js.map +0 -1
  82. package/dist/workflowActivationPolicy-BzyzXLa_.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @codemation/core
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#54](https://github.com/MadeRelevant/codemation/pull/54) [`35b78bb`](https://github.com/MadeRelevant/codemation/commit/35b78bb4d8c7ee2998a8b8e51e5ffc3fd901e4c7) Thanks [@cblokland90](https://github.com/cblokland90)! - **Breaking change:** `defineNode(...)` now follows the per-item pipeline: implement **`execute(args, context)`** (optional **`inputSchema`**, **`mapInput`**, and **`TWireJson`** on the generated runnable config). Add **`defineBatchNode(...)`** with **`run(items, context)`** for plugin nodes that still require batch **`run`** semantics.
8
+
9
+ Built-in nodes and workflow DSL (`split` / `filter` / `aggregate` on the fluent chain, Switch routing, execution normalization) align with the unified runnable model.
10
+
11
+ Align documentation (site guides, repo **`AGENTS.md`**, **`strict-oop-di`** skill, **`packages/core/docs/item-node-execution.md`**) and the **plugin** starter **`AGENTS.md`** with **config** for static wiring (credentials, retry, presentation) vs **inputs** / wire JSON for per-item behavior.
12
+
13
+ - [#56](https://github.com/MadeRelevant/codemation/pull/56) [`eb97e53`](https://github.com/MadeRelevant/codemation/commit/eb97e5376f4f620099c32c14d7797ed3039bf7bb) Thanks [@cblokland90](https://github.com/cblokland90)! - Add fluent workflow authoring support for port routing and core nodes.
14
+ - `workflow()` DSL: add `route(...)`, `merge(...)`, and `switch(...)` helpers so multi-port graphs can be expressed without manual `edges`.
15
+ - `Callback`: allow returning `emitPorts(...)` and configuring declared output ports and error handling options.
16
+ - Next host: fix execution inspector tree nesting by preferring `snapshot.parent.nodeId` when available (nested agent/tool invocations).
17
+
18
+ ## 0.3.0
19
+
20
+ ### Minor Changes
21
+
22
+ - [#52](https://github.com/MadeRelevant/codemation/pull/52) [`bb2b3b8`](https://github.com/MadeRelevant/codemation/commit/bb2b3b89069697c6aa36aac1de7124c5eea65c3e) Thanks [@cblokland90](https://github.com/cblokland90)! - **Breaking change:** `defineNode(...)` now follows the per-item pipeline: implement **`executeOne(args, context)`** (optional **`inputSchema`**, **`mapInput`**, and **`TWireJson`** on the generated runnable config). Add **`defineBatchNode(...)`** with **`run(items, context)`** for plugin nodes that still require legacy batch **`Node.execute`** semantics.
23
+
24
+ Align documentation (site guides, repo **`AGENTS.md`**, **`strict-oop-di`** skill, **`packages/core/docs/item-node-execution.md`**) and the **plugin** starter **`AGENTS.md`** with **config** for static wiring (credentials, retry, presentation) vs **inputs** / wire JSON for per-item behavior.
25
+
3
26
  ## 0.2.3
4
27
 
5
28
  ### Patch Changes
package/README.md CHANGED
@@ -14,6 +14,8 @@ npm install @codemation/core@^0.0.0
14
14
 
15
15
  Use this package when you define workflows, implement **custom nodes** (config classes + `Node` implementations), or integrate with the engine in TypeScript. Consumer apps and node packages should depend on `@codemation/core`; they should not pull host or infrastructure code into engine-shaped modules.
16
16
 
17
+ Plugin-style helpers: **`defineNode(...)`** generates an **`ItemNode`** — implement **`executeOne`**. Use **`defineBatchNode(...)`** for legacy batch **`run(items, ...)`**. See **`docs/item-node-execution.md`** in this package.
18
+
17
19
  ## Usage
18
20
 
19
21
  Main entry:
@@ -1,4 +1,4 @@
1
- import { Dr as WebhookTriggerRoutingDiagnostics, Tr as WebhookTriggerMatcher, fi as DependencyContainer, ji as EngineExecutionLimitsPolicyConfig, ur as TriggerRuntimeDiagnostics } from "./RunIntentService-BAKikN8h.js";
1
+ import { Sr as WebhookTriggerRoutingDiagnostics, Xi as EngineExecutionLimitsPolicyConfig, ar as TriggerRuntimeDiagnostics, br as WebhookTriggerMatcher, ji as DependencyContainer } from "./RunIntentService-zbTchO9T.js";
2
2
 
3
3
  //#region src/bootstrap/runtime/EngineRuntimeRegistration.types.d.ts
4
4
 
@@ -39,4 +39,4 @@ interface EngineRuntimeRegistrationOptions {
39
39
  }
40
40
  //#endregion
41
41
  export { TriggerRuntimeDiagnosticsProvider as n, WebhookTriggerMatcherProvider as r, EngineRuntimeRegistrationOptions as t };
42
- //# sourceMappingURL=EngineRuntimeRegistration.types-Bjeo7Sfq.d.ts.map
42
+ //# sourceMappingURL=EngineRuntimeRegistration.types-DU6MsjU9.d.ts.map
@@ -1,4 +1,4 @@
1
- import { Dt as WorkflowId, K as NodeConfigBase, Ln as WebhookTriggerMatcher, On as WorkflowRepository, Q as NodeId, Sn as TriggerRuntimeDiagnostics, Ur as EngineExecutionLimitsPolicyConfig, ar as PersistedWorkflowSnapshotNode, ir as PersistedWorkflowSnapshot, mr as RunResult, or as PersistedWorkflowTokenRegistryLike, ot as ParentExecutionRef, r as Engine, wr as DependencyContainer, xt as WorkflowDefinition, z as Items, zn as WebhookTriggerRoutingDiagnostics } from "./RunIntentService-Bkg4oYrM.cjs";
1
+ import { D as NodeId, Er as DependencyContainer, F as ParentExecutionRef, Gr as EngineExecutionLimitsPolicyConfig, In as PersistedWorkflowSnapshot, Kn as RunResult, Ln as PersistedWorkflowSnapshotNode, Rn as PersistedWorkflowTokenRegistryLike, Y as WorkflowDefinition, _n as WebhookTriggerRoutingDiagnostics, en as TriggerRuntimeDiagnostics, f as Items, hn as WebhookTriggerMatcher, on as WorkflowRepository, r as Engine, tt as WorkflowId, x as NodeConfigBase } from "./RunIntentService-BvlTpmEb.cjs";
2
2
 
3
3
  //#region src/workflowSnapshots/WorkflowSnapshotCodec.d.ts
4
4
  declare class WorkflowSnapshotCodec {
@@ -70,4 +70,4 @@ declare class EngineWorkflowRunnerService {
70
70
  }
71
71
  //#endregion
72
72
  export { WorkflowSnapshotCodec as a, WebhookTriggerMatcherProvider as i, EngineRuntimeRegistrationOptions as n, TriggerRuntimeDiagnosticsProvider as r, EngineWorkflowRunnerService as t };
73
- //# sourceMappingURL=EngineWorkflowRunnerService-Dd4yD31l.d.cts.map
73
+ //# sourceMappingURL=EngineWorkflowRunnerService-BBkL4VQF.d.cts.map
@@ -1,4 +1,4 @@
1
- import { $t as ExecutionContextFactory, Dt as WorkflowId, G as NodeActivationId, Gt as BinaryStorageStatResult, Ht as BinaryBody, Q as NodeId, Qt as ExecutionContext, Ut as BinaryStorage, W as MutableRunData, Wt as BinaryStorageReadResult, Xr as RetryPolicySpec, Zt as ExecutionBinaryService, b as CredentialSessionService, dt as RunId, k as BinaryAttachment, ln as NodeBinaryAttachmentService, lt as RunDataFactory, mn as NodeExecutionStatePublisher, ot as ParentExecutionRef, qt as BinaryStorageWriteResult, tt as NodeOutputs, un as NodeExecutionContext, ut as RunDataSnapshot } from "./RunIntentService-Bkg4oYrM.cjs";
1
+ import { A as NodeOutputs, At as ExecutionContextFactory, B as RunId, Bt as NodeExecutionContext, D as NodeId, F as ParentExecutionRef, H as RunnableNodeConfig, Ot as ExecutionBinaryService, R as RunDataFactory, St as BinaryStorageStatResult, Wt as NodeExecutionStatePublisher, _r as CredentialSessionService, _t as RetryPolicySpec, a as BinaryAttachment, b as NodeActivationId, bt as BinaryStorage, kt as ExecutionContext, tt as WorkflowId, u as Item, wt as BinaryStorageWriteResult, xt as BinaryStorageReadResult, y as MutableRunData, yt as BinaryBody, z as RunDataSnapshot, zt as NodeBinaryAttachmentService } from "./RunIntentService-BvlTpmEb.cjs";
2
2
 
3
3
  //#region src/execution/CredentialResolverFactory.d.ts
4
4
  declare class CredentialResolverFactory {
@@ -47,6 +47,14 @@ declare class InProcessRetryRunner {
47
47
  private static assertMultiplier;
48
48
  }
49
49
  //#endregion
50
+ //#region src/execution/ItemValueResolver.d.ts
51
+ /**
52
+ * Resolves {@link import("../contracts/itemValue").ItemValue} leaves on runnable config before {@link RunnableNode.execute}.
53
+ */
54
+ declare class ItemValueResolver {
55
+ resolveConfigForItem<TConfig extends RunnableNodeConfig<any, any>>(ctx: NodeExecutionContext<TConfig>, item: Item, itemIndex: number, items: ReadonlyArray<Item>): Promise<NodeExecutionContext<TConfig>>;
56
+ }
57
+ //#endregion
50
58
  //#region src/binaries/UnavailableBinaryStorage.d.ts
51
59
  declare class UnavailableBinaryStorage implements BinaryStorage {
52
60
  readonly driverName = "unavailable";
@@ -90,5 +98,5 @@ declare class InMemoryRunDataFactory implements RunDataFactory {
90
98
  create(initial?: Record<NodeId, NodeOutputs>): MutableRunData;
91
99
  }
92
100
  //#endregion
93
- export { InProcessRetryRunner as a, AsyncSleeper as c, UnavailableBinaryStorage as i, CredentialResolverFactory as l, InMemoryBinaryStorage as n, DefaultExecutionContextFactory as o, DefaultExecutionBinaryService as r, DefaultAsyncSleeper as s, InMemoryRunDataFactory as t };
94
- //# sourceMappingURL=InMemoryRunDataFactory-OUzDmAHt.d.cts.map
101
+ export { ItemValueResolver as a, DefaultAsyncSleeper as c, UnavailableBinaryStorage as i, AsyncSleeper as l, InMemoryBinaryStorage as n, InProcessRetryRunner as o, DefaultExecutionBinaryService as r, DefaultExecutionContextFactory as s, InMemoryRunDataFactory as t, CredentialResolverFactory as u };
102
+ //# sourceMappingURL=InMemoryRunDataFactory-CsYEMJK2.d.cts.map