@codemation/core 0.0.15 → 0.0.18

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 ADDED
@@ -0,0 +1,7 @@
1
+ # @codemation/core
2
+
3
+ ## 0.0.18
4
+
5
+ ### Patch Changes
6
+
7
+ - f0c6878: Introduce Changesets, a single CI status check for branch protection, and the Codemation pre-stable license across published packages.
package/LICENSE ADDED
@@ -0,0 +1,37 @@
1
+ Codemation Pre-Stable License
2
+
3
+ Copyright (c) Made Relevant B.V. All rights reserved.
4
+
5
+ 1. Definitions
6
+
7
+ "Software" means the Codemation source code, documentation, and artifacts in this repository and any published npm packages in the Codemation monorepo.
8
+
9
+ "Stable Version" means the first published release of the package `@codemation/core` on the public npm registry with version 1.0.0 or higher.
10
+
11
+ 2. Permitted use (before Stable Version)
12
+
13
+ Until a Stable Version exists, you may use, copy, modify, and distribute the Software only for non-commercial purposes, including personal learning, research, evaluation, and internal use within your organization that does not charge third parties for access to the Software or a product or service whose primary value is the Software.
14
+
15
+ 3. Restrictions (before Stable Version)
16
+
17
+ Until a Stable Version exists, you must not:
18
+
19
+ a) Sell, rent, lease, or sublicense the Software or a derivative work for a fee;
20
+
21
+ b) Offer the Software or a derivative work as part of a paid product or service (including hosting, support, or consulting) where the Software is a material part of the offering;
22
+
23
+ c) Use the Software or a derivative work primarily to generate revenue or commercial advantage for you or others.
24
+
25
+ These restrictions apply to all versions published before a Stable Version, even if a later Stable Version is released under different terms.
26
+
27
+ 4. After Stable Version
28
+
29
+ The maintainers may publish a Stable Version under different license terms. If they do, those terms apply only to that Stable Version and subsequent releases they designate; they do not automatically apply to earlier pre-stable versions.
30
+
31
+ 5. No warranty
32
+
33
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34
+
35
+ 6. Third-party components
36
+
37
+ The Software may include third-party components under their own licenses. Those licenses govern those components.
@@ -1,99 +1,8 @@
1
- import { createHash } from "node:crypto";
2
1
  import "reflect-metadata";
3
2
  import { container, delay, inject, injectAll, injectable, instanceCachingFactory, instancePerContainerCachingFactory, predicateAwareClassFactory, registry, singleton } from "tsyringe";
3
+ import { createHash } from "node:crypto";
4
4
  import { ReadableStream } from "node:stream/web";
5
5
 
6
- //#region src/workflow/definition/ConnectionNodeIdFactory.ts
7
- /**
8
- * Deterministic ids for workflow connection-owned child nodes (LLM slot, tools, etc.).
9
- * These are stable across loads.
10
- */
11
- var ConnectionNodeIdFactory = class {
12
- static connectionSegment = "__conn__";
13
- static languageModelConnectionNodeId(parentNodeId) {
14
- return `${parentNodeId}${this.connectionSegment}llm`;
15
- }
16
- static toolConnectionNodeId(parentNodeId, toolName) {
17
- const normalized = this.normalizeToolName(toolName);
18
- return `${parentNodeId}${this.connectionSegment}tool${this.connectionSegment}${normalized}`;
19
- }
20
- static isLanguageModelConnectionNodeId(nodeId) {
21
- return nodeId.endsWith(`${this.connectionSegment}llm`);
22
- }
23
- static isToolConnectionNodeId(nodeId) {
24
- return nodeId.includes(`${this.connectionSegment}tool${this.connectionSegment}`);
25
- }
26
- /** True when `nodeId` is a connection-owned child of `parentNodeId` (LLM or tool slot). */
27
- static isConnectionOwnedDescendantOf(parentNodeId, nodeId) {
28
- return nodeId.startsWith(`${parentNodeId}${this.connectionSegment}`);
29
- }
30
- /** Normalizes a tool display name to a stable id segment. */
31
- static normalizeToolName(toolName) {
32
- return toolName.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "tool";
33
- }
34
- };
35
-
36
- //#endregion
37
- //#region src/workflow/definition/WorkflowExecutableNodeClassifier.ts
38
- /**
39
- * Derives which workflow nodes participate in the main execution graph vs connection-only children.
40
- */
41
- var WorkflowExecutableNodeClassifier = class {
42
- connectionOwnedIds;
43
- constructor(workflow) {
44
- this.connectionOwnedIds = this.collectConnectionOwnedIds(workflow);
45
- }
46
- isConnectionOwnedNodeId(nodeId) {
47
- return this.connectionOwnedIds.has(nodeId);
48
- }
49
- isExecutableNodeId(nodeId) {
50
- return !this.connectionOwnedIds.has(nodeId);
51
- }
52
- filterExecutableNodeDefinitions(nodes) {
53
- return nodes.filter((n) => this.isExecutableNodeId(n.id));
54
- }
55
- collectConnectionOwnedIds(workflow) {
56
- const ids = /* @__PURE__ */ new Set();
57
- for (const connection of workflow.connections ?? []) for (const childId of connection.childNodeIds) ids.add(childId);
58
- return ids;
59
- }
60
- /**
61
- * Resolves the default start node: first trigger, else first executable node with no incoming edges from executable nodes.
62
- */
63
- findDefaultExecutableStartNodeId(workflow) {
64
- const firstTrigger = workflow.nodes.find((n) => n.kind === "trigger" && this.isExecutableNodeId(n.id))?.id;
65
- if (firstTrigger) return firstTrigger;
66
- const incoming = /* @__PURE__ */ new Map();
67
- for (const n of workflow.nodes) if (this.isExecutableNodeId(n.id)) incoming.set(n.id, 0);
68
- for (const e of workflow.edges) {
69
- if (!this.isExecutableNodeId(e.from.nodeId) || !this.isExecutableNodeId(e.to.nodeId)) continue;
70
- incoming.set(e.to.nodeId, (incoming.get(e.to.nodeId) ?? 0) + 1);
71
- }
72
- return workflow.nodes.find((n) => this.isExecutableNodeId(n.id) && (incoming.get(n.id) ?? 0) === 0)?.id ?? workflow.nodes.find((n) => this.isExecutableNodeId(n.id))?.id ?? (() => {
73
- throw new Error(`Workflow ${workflow.id} has no executable nodes`);
74
- })();
75
- }
76
- firstExecutableNodeIdInDefinitionOrder(workflow) {
77
- return workflow.nodes.find((n) => this.isExecutableNodeId(n.id))?.id;
78
- }
79
- lastExecutableNodeIdInDefinitionOrder(workflow) {
80
- for (let i = workflow.nodes.length - 1; i >= 0; i--) {
81
- const n = workflow.nodes[i];
82
- if (this.isExecutableNodeId(n.id)) return n.id;
83
- }
84
- throw new Error(`Workflow ${workflow.id} has no executable nodes`);
85
- }
86
- };
87
-
88
- //#endregion
89
- //#region src/workflow/definition/WorkflowExecutableNodeClassifierFactory.ts
90
- var WorkflowExecutableNodeClassifierFactory = class {
91
- static create(workflow) {
92
- return new WorkflowExecutableNodeClassifier(workflow);
93
- }
94
- };
95
-
96
- //#endregion
97
6
  //#region src/di/CoreTokens.ts
98
7
  const CoreTokens = {
99
8
  PersistedWorkflowTokenRegistry: Symbol.for("codemation.core.PersistedWorkflowTokenRegistry"),
@@ -118,26 +27,6 @@ const CoreTokens = {
118
27
  WorkflowActivationPolicy: Symbol.for("codemation.core.WorkflowActivationPolicy")
119
28
  };
120
29
 
121
- //#endregion
122
- //#region src/events/NodeEventPublisher.ts
123
- /** Publishes node lifecycle snapshots onto the run {@link RunEventBus}. */
124
- var NodeEventPublisher = class {
125
- constructor(eventBus) {
126
- this.eventBus = eventBus;
127
- }
128
- async publish(kind, snapshot) {
129
- if (!this.eventBus) return;
130
- await this.eventBus.publish({
131
- kind,
132
- runId: snapshot.runId,
133
- workflowId: snapshot.workflowId,
134
- parent: snapshot.parent,
135
- at: snapshot.updatedAt,
136
- snapshot
137
- });
138
- }
139
- };
140
-
141
30
  //#endregion
142
31
  //#region src/runtime-types/persistedRuntimeTypeModelRegistry.ts
143
32
  /** Shared metadata key used to attach persisted runtime-type information to decorated classes. */
@@ -247,6 +136,117 @@ function chatModel(options = {}) {
247
136
  return InjectableRuntimeDecoratorComposer.compose("chatModel", options, import.meta.url);
248
137
  }
249
138
 
139
+ //#endregion
140
+ //#region src/workflow/definition/ConnectionNodeIdFactory.ts
141
+ /**
142
+ * Deterministic ids for workflow connection-owned child nodes (LLM slot, tools, etc.).
143
+ * These are stable across loads.
144
+ */
145
+ var ConnectionNodeIdFactory = class {
146
+ static connectionSegment = "__conn__";
147
+ static languageModelConnectionNodeId(parentNodeId) {
148
+ return `${parentNodeId}${this.connectionSegment}llm`;
149
+ }
150
+ static toolConnectionNodeId(parentNodeId, toolName) {
151
+ const normalized = this.normalizeToolName(toolName);
152
+ return `${parentNodeId}${this.connectionSegment}tool${this.connectionSegment}${normalized}`;
153
+ }
154
+ static isLanguageModelConnectionNodeId(nodeId) {
155
+ return nodeId.endsWith(`${this.connectionSegment}llm`);
156
+ }
157
+ static isToolConnectionNodeId(nodeId) {
158
+ return nodeId.includes(`${this.connectionSegment}tool${this.connectionSegment}`);
159
+ }
160
+ /** True when `nodeId` is a connection-owned child of `parentNodeId` (LLM or tool slot). */
161
+ static isConnectionOwnedDescendantOf(parentNodeId, nodeId) {
162
+ return nodeId.startsWith(`${parentNodeId}${this.connectionSegment}`);
163
+ }
164
+ /** Normalizes a tool display name to a stable id segment. */
165
+ static normalizeToolName(toolName) {
166
+ return toolName.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "tool";
167
+ }
168
+ };
169
+
170
+ //#endregion
171
+ //#region src/workflow/definition/WorkflowExecutableNodeClassifier.ts
172
+ /**
173
+ * Derives which workflow nodes participate in the main execution graph vs connection-only children.
174
+ */
175
+ var WorkflowExecutableNodeClassifier = class {
176
+ connectionOwnedIds;
177
+ constructor(workflow) {
178
+ this.connectionOwnedIds = this.collectConnectionOwnedIds(workflow);
179
+ }
180
+ isConnectionOwnedNodeId(nodeId) {
181
+ return this.connectionOwnedIds.has(nodeId);
182
+ }
183
+ isExecutableNodeId(nodeId) {
184
+ return !this.connectionOwnedIds.has(nodeId);
185
+ }
186
+ filterExecutableNodeDefinitions(nodes) {
187
+ return nodes.filter((n) => this.isExecutableNodeId(n.id));
188
+ }
189
+ collectConnectionOwnedIds(workflow) {
190
+ const ids = /* @__PURE__ */ new Set();
191
+ for (const connection of workflow.connections ?? []) for (const childId of connection.childNodeIds) ids.add(childId);
192
+ return ids;
193
+ }
194
+ /**
195
+ * Resolves the default start node: first trigger, else first executable node with no incoming edges from executable nodes.
196
+ */
197
+ findDefaultExecutableStartNodeId(workflow) {
198
+ const firstTrigger = workflow.nodes.find((n) => n.kind === "trigger" && this.isExecutableNodeId(n.id))?.id;
199
+ if (firstTrigger) return firstTrigger;
200
+ const incoming = /* @__PURE__ */ new Map();
201
+ for (const n of workflow.nodes) if (this.isExecutableNodeId(n.id)) incoming.set(n.id, 0);
202
+ for (const e of workflow.edges) {
203
+ if (!this.isExecutableNodeId(e.from.nodeId) || !this.isExecutableNodeId(e.to.nodeId)) continue;
204
+ incoming.set(e.to.nodeId, (incoming.get(e.to.nodeId) ?? 0) + 1);
205
+ }
206
+ return workflow.nodes.find((n) => this.isExecutableNodeId(n.id) && (incoming.get(n.id) ?? 0) === 0)?.id ?? workflow.nodes.find((n) => this.isExecutableNodeId(n.id))?.id ?? (() => {
207
+ throw new Error(`Workflow ${workflow.id} has no executable nodes`);
208
+ })();
209
+ }
210
+ firstExecutableNodeIdInDefinitionOrder(workflow) {
211
+ return workflow.nodes.find((n) => this.isExecutableNodeId(n.id))?.id;
212
+ }
213
+ lastExecutableNodeIdInDefinitionOrder(workflow) {
214
+ for (let i = workflow.nodes.length - 1; i >= 0; i--) {
215
+ const n = workflow.nodes[i];
216
+ if (this.isExecutableNodeId(n.id)) return n.id;
217
+ }
218
+ throw new Error(`Workflow ${workflow.id} has no executable nodes`);
219
+ }
220
+ };
221
+
222
+ //#endregion
223
+ //#region src/workflow/definition/WorkflowExecutableNodeClassifierFactory.ts
224
+ var WorkflowExecutableNodeClassifierFactory = class {
225
+ static create(workflow) {
226
+ return new WorkflowExecutableNodeClassifier(workflow);
227
+ }
228
+ };
229
+
230
+ //#endregion
231
+ //#region src/events/NodeEventPublisher.ts
232
+ /** Publishes node lifecycle snapshots onto the run {@link RunEventBus}. */
233
+ var NodeEventPublisher = class {
234
+ constructor(eventBus) {
235
+ this.eventBus = eventBus;
236
+ }
237
+ async publish(kind, snapshot) {
238
+ if (!this.eventBus) return;
239
+ await this.eventBus.publish({
240
+ kind,
241
+ runId: snapshot.runId,
242
+ workflowId: snapshot.workflowId,
243
+ parent: snapshot.parent,
244
+ at: snapshot.updatedAt,
245
+ snapshot
246
+ });
247
+ }
248
+ };
249
+
250
250
  //#endregion
251
251
  //#region src/binaries/DefaultNodeBinaryAttachmentServiceFactory.ts
252
252
  var DefaultNodeBinaryAttachmentService = class DefaultNodeBinaryAttachmentService {
@@ -3132,5 +3132,5 @@ var RunIntentService = class {
3132
3132
  };
3133
3133
 
3134
3134
  //#endregion
3135
- export { instancePerContainerCachingFactory as $, InProcessRetryRunnerFactory as A, node as B, PersistedWorkflowTokenRegistry as C, NodeExecutorFactory as D, MissingRuntimeExecutionMarker as E, ActivationEnqueueService as F, PersistedRuntimeTypeNameResolver as G, InjectableRuntimeDecoratorComposer as H, DefaultExecutionBinaryService as I, delay as J, NodeEventPublisher as K, UnavailableBinaryStorage as L, DefaultExecutionContextFactory as M, DefaultAsyncSleeper as N, NodeExecutor as O, CredentialResolverFactory as P, instanceCachingFactory as Q, chatModel as R, WorkflowSnapshotResolver as S, MissingRuntimeTriggerToken as T, PersistedRuntimeTypeMetadataStore as U, tool as V, StackTraceCallSitePathResolver as W, injectAll as X, inject as Y, injectable as Z, RunStateSemantics as _, ENGINE_EXECUTION_LIMITS_DEFAULTS as a, WorkflowExecutableNodeClassifier as at, NodeInstanceFactoryFactory as b, InlineDrivingScheduler as c, ConfigDrivenOffloadPolicy as d, predicateAwareClassFactory as et, RunStartService as f, WorkflowRunExecutionContextFactory as g, WorkflowTopology as h, InMemoryBinaryStorage as i, WorkflowExecutableNodeClassifierFactory as it, InProcessRetryRunner as j, NodeActivationRequestComposer as k, HintOnlyOffloadPolicy as l, RunContinuationService as m, RunFinishedAtFactory as n, singleton as nt, EngineExecutionLimitsPolicy as o, ConnectionNodeIdFactory as ot, RunPolicySnapshotFactory as p, container as q, InMemoryRunDataFactory as r, CoreTokens as rt, LocalOnlyScheduler as s, RunIntentService as t, registry as tt, DefaultDrivingScheduler as u, PersistedRunStateTerminalBuilder as v, MissingRuntimeFallbacks as w, NodeInstanceFactory as x, NodeRunStateWriterFactory as y, getPersistedRuntimeTypeMetadata as z };
3136
- //# sourceMappingURL=RunIntentService-CYnn140t.js.map
3135
+ export { injectAll as $, InProcessRetryRunnerFactory as A, WorkflowExecutableNodeClassifier as B, PersistedWorkflowTokenRegistry as C, NodeExecutorFactory as D, MissingRuntimeExecutionMarker as E, ActivationEnqueueService as F, tool as G, chatModel as H, DefaultExecutionBinaryService as I, StackTraceCallSitePathResolver as J, InjectableRuntimeDecoratorComposer as K, UnavailableBinaryStorage as L, DefaultExecutionContextFactory as M, DefaultAsyncSleeper as N, NodeExecutor as O, CredentialResolverFactory as P, inject as Q, NodeEventPublisher as R, WorkflowSnapshotResolver as S, MissingRuntimeTriggerToken as T, getPersistedRuntimeTypeMetadata as U, ConnectionNodeIdFactory as V, node as W, container as X, PersistedRuntimeTypeNameResolver as Y, delay as Z, RunStateSemantics as _, ENGINE_EXECUTION_LIMITS_DEFAULTS as a, singleton as at, NodeInstanceFactoryFactory as b, InlineDrivingScheduler as c, ConfigDrivenOffloadPolicy as d, injectable as et, RunStartService as f, WorkflowRunExecutionContextFactory as g, WorkflowTopology as h, InMemoryBinaryStorage as i, registry as it, InProcessRetryRunner as j, NodeActivationRequestComposer as k, HintOnlyOffloadPolicy as l, RunContinuationService as m, RunFinishedAtFactory as n, instancePerContainerCachingFactory as nt, EngineExecutionLimitsPolicy as o, CoreTokens as ot, RunPolicySnapshotFactory as p, PersistedRuntimeTypeMetadataStore as q, InMemoryRunDataFactory as r, predicateAwareClassFactory as rt, LocalOnlyScheduler as s, RunIntentService as t, instanceCachingFactory as tt, DefaultDrivingScheduler as u, PersistedRunStateTerminalBuilder as v, MissingRuntimeFallbacks as w, NodeInstanceFactory as x, NodeRunStateWriterFactory as y, WorkflowExecutableNodeClassifierFactory as z };
3136
+ //# sourceMappingURL=RunIntentService-BB4nqX3-.js.map