@codemation/core 0.6.0 → 0.7.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 (51) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{EngineRuntimeRegistration.types-Dm129RJ6.d.ts → EngineRuntimeRegistration.types-_M7KFD3D.d.ts} +2 -2
  3. package/dist/{EngineWorkflowRunnerService-Bf88QtwB.d.cts → EngineWorkflowRunnerService-D0Cwngv7.d.cts} +2 -2
  4. package/dist/{InMemoryRunDataFactory-Dyl4p2s8.d.cts → InMemoryRunDataFactory-BIWx6e02.d.cts} +6 -6
  5. package/dist/{RunIntentService-B1Y3v1H6.d.cts → RunIntentService-5k0p-J67.d.cts} +8 -4
  6. package/dist/{RunIntentService-BDiodxhf.d.ts → RunIntentService-CuXAIO6_.d.ts} +29 -20
  7. package/dist/bootstrap/index.cjs +2 -2
  8. package/dist/bootstrap/index.d.cts +5 -5
  9. package/dist/bootstrap/index.d.ts +3 -3
  10. package/dist/bootstrap/index.js +2 -2
  11. package/dist/{bootstrap-DdeiJ8cd.js → bootstrap-BhYxSivA.js} +3 -3
  12. package/dist/bootstrap-BhYxSivA.js.map +1 -0
  13. package/dist/{bootstrap-DVL2ue5v.cjs → bootstrap-D-TDU9Lu.cjs} +3 -3
  14. package/dist/bootstrap-D-TDU9Lu.cjs.map +1 -0
  15. package/dist/{index-C2af8ssM.d.ts → index-BnJ7_IrO.d.ts} +11 -10
  16. package/dist/index.cjs +16 -10
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +27 -21
  19. package/dist/index.d.ts +3 -3
  20. package/dist/index.js +11 -6
  21. package/dist/index.js.map +1 -1
  22. package/dist/{runtime-DVBwxFvX.cjs → runtime-3YVDd2vY.cjs} +42 -42
  23. package/dist/runtime-3YVDd2vY.cjs.map +1 -0
  24. package/dist/{runtime-7Xh9z3dw.js → runtime-CJnObwsU.js} +33 -33
  25. package/dist/runtime-CJnObwsU.js.map +1 -0
  26. package/dist/testing.cjs +2 -2
  27. package/dist/testing.d.cts +2 -2
  28. package/dist/testing.d.ts +2 -2
  29. package/dist/testing.js +2 -2
  30. package/package.json +1 -1
  31. package/src/ai/AgentConfigInspectorFactory.ts +2 -2
  32. package/src/ai/AgentMessageConfigNormalizerFactory.ts +3 -3
  33. package/src/ai/AiHost.ts +2 -2
  34. package/src/authoring/defineNode.types.ts +35 -9
  35. package/src/authoring/index.ts +1 -0
  36. package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +3 -3
  37. package/src/contracts/index.ts +2 -1
  38. package/src/contracts/{itemValue.ts → itemExpr.ts} +31 -32
  39. package/src/contracts/params.ts +10 -0
  40. package/src/contracts/workflowTypes.ts +11 -2
  41. package/src/execution/{ItemValueResolver.ts → ItemExprResolver.ts} +5 -5
  42. package/src/execution/NodeExecutor.ts +6 -6
  43. package/src/execution/index.ts +1 -1
  44. package/src/index.ts +1 -1
  45. package/src/runStorage/InMemoryRunData.ts +9 -5
  46. package/src/types/index.ts +2 -1
  47. package/src/workflowSnapshots/WorkflowSnapshotCodec.ts +1 -1
  48. package/dist/bootstrap-DVL2ue5v.cjs.map +0 -1
  49. package/dist/bootstrap-DdeiJ8cd.js.map +0 -1
  50. package/dist/runtime-7Xh9z3dw.js.map +0 -1
  51. package/dist/runtime-DVBwxFvX.cjs.map +0 -1
@@ -165,43 +165,43 @@ function chatModel(options = {}) {
165
165
  }
166
166
 
167
167
  //#endregion
168
- //#region src/contracts/itemValue.ts
169
- const ITEM_VALUE_BRAND = Symbol.for("codemation.itemValue");
170
- function itemValue(fn) {
168
+ //#region src/contracts/itemExpr.ts
169
+ const ITEM_EXPR_BRAND = Symbol.for("codemation.itemExpr");
170
+ function itemExpr(fn) {
171
171
  return {
172
- [ITEM_VALUE_BRAND]: true,
172
+ [ITEM_EXPR_BRAND]: true,
173
173
  fn
174
174
  };
175
175
  }
176
- function isItemValue(value) {
176
+ function isItemExpr(value) {
177
177
  if (typeof value !== "object" || value === null) return false;
178
178
  const v = value;
179
- if (v[ITEM_VALUE_BRAND] === true) return true;
179
+ if (v[ITEM_EXPR_BRAND] === true) return true;
180
180
  const keys = Object.keys(v);
181
181
  if (keys.length === 1 && keys[0] === "fn" && typeof v.fn === "function") return true;
182
- for (const sym of Object.getOwnPropertySymbols(v)) if (sym.description === "codemation.itemValue" && v[sym] === true) return true;
182
+ for (const sym of Object.getOwnPropertySymbols(v)) if (sym.description === "codemation.itemExpr" && v[sym] === true) return true;
183
183
  return false;
184
184
  }
185
- function containsItemValueInUnknown(value, seen = /* @__PURE__ */ new WeakSet()) {
186
- if (isItemValue(value)) return true;
185
+ function containsItemExprInUnknown(value, seen = /* @__PURE__ */ new WeakSet()) {
186
+ if (isItemExpr(value)) return true;
187
187
  if (value === null || typeof value !== "object") return false;
188
188
  if (seen.has(value)) return false;
189
189
  seen.add(value);
190
- if (Array.isArray(value)) return value.some((entry) => containsItemValueInUnknown(entry, seen));
191
- for (const entry of Object.values(value)) if (containsItemValueInUnknown(entry, seen)) return true;
190
+ if (Array.isArray(value)) return value.some((entry) => containsItemExprInUnknown(entry, seen));
191
+ for (const entry of Object.values(value)) if (containsItemExprInUnknown(entry, seen)) return true;
192
192
  return false;
193
193
  }
194
194
  /**
195
- * Deep-resolves {@link itemValue} leaves. Returns a new graph (does not mutate the original config object).
195
+ * Deep-resolves {@link itemExpr} leaves. Returns a new graph (does not mutate the original config object).
196
196
  */
197
- async function resolveItemValuesInUnknown(value, args, seen = /* @__PURE__ */ new WeakSet()) {
198
- if (isItemValue(value)) return await Promise.resolve(value.fn(args));
197
+ async function resolveItemExprsInUnknown(value, args, seen = /* @__PURE__ */ new WeakSet()) {
198
+ if (isItemExpr(value)) return await Promise.resolve(value.fn(args));
199
199
  if (value === null || typeof value !== "object") return value;
200
200
  if (seen.has(value)) return value;
201
201
  seen.add(value);
202
202
  if (Array.isArray(value)) {
203
203
  const out$1 = [];
204
- for (let i = 0; i < value.length; i++) out$1.push(await resolveItemValuesInUnknown(value[i], args, seen));
204
+ for (let i = 0; i < value.length; i++) out$1.push(await resolveItemExprsInUnknown(value[i], args, seen));
205
205
  return out$1;
206
206
  }
207
207
  const rec = value;
@@ -209,14 +209,14 @@ async function resolveItemValuesInUnknown(value, args, seen = /* @__PURE__ */ ne
209
209
  const proto = Object.getPrototypeOf(value);
210
210
  if (proto !== Object.prototype && proto !== null && entries.length === 0) return value;
211
211
  const out = Object.create(proto);
212
- for (const [k, v] of entries) out[k] = await resolveItemValuesInUnknown(v, args, seen);
212
+ for (const [k, v] of entries) out[k] = await resolveItemExprsInUnknown(v, args, seen);
213
213
  return out;
214
214
  }
215
215
  /**
216
- * Clones runnable config (best-effort) so per-item {@link itemValue} resolution never mutates shared instances.
216
+ * Clones runnable config (best-effort) so per-item {@link itemExpr} resolution never mutates shared instances.
217
217
  */
218
- async function resolveItemValuesForExecution(config, nodeCtx, item, itemIndex, items) {
219
- const ivArgs = {
218
+ async function resolveItemExprsForExecution(config, nodeCtx, item, itemIndex, items) {
219
+ const exprArgs = {
220
220
  item,
221
221
  itemIndex,
222
222
  items,
@@ -228,8 +228,8 @@ async function resolveItemValuesForExecution(config, nodeCtx, item, itemIndex, i
228
228
  data: nodeCtx.data
229
229
  }
230
230
  };
231
- if (!containsItemValueInUnknown(config)) return;
232
- return await resolveItemValuesInUnknown(config, ivArgs);
231
+ if (!containsItemExprInUnknown(config)) return;
232
+ return await resolveItemExprsInUnknown(config, exprArgs);
233
233
  }
234
234
 
235
235
  //#endregion
@@ -941,14 +941,14 @@ var InProcessRetryRunner = class InProcessRetryRunner {
941
941
  };
942
942
 
943
943
  //#endregion
944
- //#region src/execution/ItemValueResolver.ts
944
+ //#region src/execution/ItemExprResolver.ts
945
945
  /**
946
- * Resolves {@link import("../contracts/itemValue").ItemValue} leaves on runnable config before {@link RunnableNode.execute}.
946
+ * Resolves {@link import("../contracts/itemExpr").ItemExpr} leaves on runnable config before {@link RunnableNode.execute}.
947
947
  */
948
- var ItemValueResolver = class {
948
+ var ItemExprResolver = class {
949
949
  async resolveConfigForItem(ctx, item, itemIndex, items) {
950
- if (!ctx) throw new Error("ItemValueResolver.resolveConfigForItem: ctx is required");
951
- const resolvedConfig = await resolveItemValuesForExecution(ctx.config, ctx, item, itemIndex, items);
950
+ if (!ctx) throw new Error("ItemExprResolver.resolveConfigForItem: ctx is required");
951
+ const resolvedConfig = await resolveItemExprsForExecution(ctx.config, ctx, item, itemIndex, items);
952
952
  const merged = resolvedConfig !== void 0 && resolvedConfig !== null ? resolvedConfig : ctx.config;
953
953
  if (merged === void 0 || merged === null) return ctx;
954
954
  return {
@@ -1131,12 +1131,12 @@ var NodeActivationRequestComposer = class {
1131
1131
  var NodeExecutor = class {
1132
1132
  fanInMerger = new FanInMergeByOriginMerger();
1133
1133
  outputNormalizer = new NodeOutputNormalizer();
1134
- itemValueResolver;
1134
+ itemExprResolver;
1135
1135
  outputBehaviorResolver;
1136
- constructor(nodeInstanceFactory, retryRunner, itemValueResolver, outputBehaviorResolver) {
1136
+ constructor(nodeInstanceFactory, retryRunner, itemExprResolver, outputBehaviorResolver) {
1137
1137
  this.nodeInstanceFactory = nodeInstanceFactory;
1138
1138
  this.retryRunner = retryRunner;
1139
- this.itemValueResolver = itemValueResolver ?? new ItemValueResolver();
1139
+ this.itemExprResolver = itemExprResolver ?? new ItemExprResolver();
1140
1140
  this.outputBehaviorResolver = outputBehaviorResolver ?? new RunnableOutputBehaviorResolver();
1141
1141
  }
1142
1142
  async execute(request) {
@@ -1207,7 +1207,7 @@ var NodeExecutor = class {
1207
1207
  const syntheticItem = { json: {} };
1208
1208
  const parsed = inputSchema.parse(syntheticItem.json);
1209
1209
  const runnableCtx = request.ctx;
1210
- const resolvedCtx = await this.itemValueResolver.resolveConfigForItem(runnableCtx, syntheticItem, 0, inputBatch);
1210
+ const resolvedCtx = await this.itemExprResolver.resolveConfigForItem(runnableCtx, syntheticItem, 0, inputBatch);
1211
1211
  const args = {
1212
1212
  input: parsed,
1213
1213
  item: syntheticItem,
@@ -1228,7 +1228,7 @@ var NodeExecutor = class {
1228
1228
  this.assertItemJsonNotTopLevelArray(request.nodeId, item);
1229
1229
  const parsed = inputSchema.parse(item.json);
1230
1230
  const runnableCtx = request.ctx;
1231
- const resolvedCtx = await this.itemValueResolver.resolveConfigForItem(runnableCtx, item, i, inputBatch);
1231
+ const resolvedCtx = await this.itemExprResolver.resolveConfigForItem(runnableCtx, item, i, inputBatch);
1232
1232
  const ctx = this.pickExecutionContext(runnableCtx, resolvedCtx);
1233
1233
  const args = {
1234
1234
  input: parsed,
@@ -5039,10 +5039,10 @@ Object.defineProperty(exports, 'InlineDrivingScheduler', {
5039
5039
  return InlineDrivingScheduler;
5040
5040
  }
5041
5041
  });
5042
- Object.defineProperty(exports, 'ItemValueResolver', {
5042
+ Object.defineProperty(exports, 'ItemExprResolver', {
5043
5043
  enumerable: true,
5044
5044
  get: function () {
5045
- return ItemValueResolver;
5045
+ return ItemExprResolver;
5046
5046
  }
5047
5047
  });
5048
5048
  Object.defineProperty(exports, 'LocalOnlyScheduler', {
@@ -5231,10 +5231,10 @@ Object.defineProperty(exports, 'getPersistedRuntimeTypeMetadata', {
5231
5231
  return getPersistedRuntimeTypeMetadata;
5232
5232
  }
5233
5233
  });
5234
- Object.defineProperty(exports, 'isItemValue', {
5234
+ Object.defineProperty(exports, 'isItemExpr', {
5235
5235
  enumerable: true,
5236
5236
  get: function () {
5237
- return isItemValue;
5237
+ return isItemExpr;
5238
5238
  }
5239
5239
  });
5240
5240
  Object.defineProperty(exports, 'isPortsEmission', {
@@ -5249,10 +5249,10 @@ Object.defineProperty(exports, 'isUnbrandedPortsEmissionShape', {
5249
5249
  return isUnbrandedPortsEmissionShape;
5250
5250
  }
5251
5251
  });
5252
- Object.defineProperty(exports, 'itemValue', {
5252
+ Object.defineProperty(exports, 'itemExpr', {
5253
5253
  enumerable: true,
5254
5254
  get: function () {
5255
- return itemValue;
5255
+ return itemExpr;
5256
5256
  }
5257
5257
  });
5258
5258
  Object.defineProperty(exports, 'node', {
@@ -5261,16 +5261,16 @@ Object.defineProperty(exports, 'node', {
5261
5261
  return node;
5262
5262
  }
5263
5263
  });
5264
- Object.defineProperty(exports, 'resolveItemValuesForExecution', {
5264
+ Object.defineProperty(exports, 'resolveItemExprsForExecution', {
5265
5265
  enumerable: true,
5266
5266
  get: function () {
5267
- return resolveItemValuesForExecution;
5267
+ return resolveItemExprsForExecution;
5268
5268
  }
5269
5269
  });
5270
- Object.defineProperty(exports, 'resolveItemValuesInUnknown', {
5270
+ Object.defineProperty(exports, 'resolveItemExprsInUnknown', {
5271
5271
  enumerable: true,
5272
5272
  get: function () {
5273
- return resolveItemValuesInUnknown;
5273
+ return resolveItemExprsInUnknown;
5274
5274
  }
5275
5275
  });
5276
5276
  Object.defineProperty(exports, 'tool', {
@@ -5279,4 +5279,4 @@ Object.defineProperty(exports, 'tool', {
5279
5279
  return tool;
5280
5280
  }
5281
5281
  });
5282
- //# sourceMappingURL=runtime-DVBwxFvX.cjs.map
5282
+ //# sourceMappingURL=runtime-3YVDd2vY.cjs.map