@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
@@ -138,43 +138,43 @@ function chatModel(options = {}) {
138
138
  }
139
139
 
140
140
  //#endregion
141
- //#region src/contracts/itemValue.ts
142
- const ITEM_VALUE_BRAND = Symbol.for("codemation.itemValue");
143
- function itemValue(fn) {
141
+ //#region src/contracts/itemExpr.ts
142
+ const ITEM_EXPR_BRAND = Symbol.for("codemation.itemExpr");
143
+ function itemExpr(fn) {
144
144
  return {
145
- [ITEM_VALUE_BRAND]: true,
145
+ [ITEM_EXPR_BRAND]: true,
146
146
  fn
147
147
  };
148
148
  }
149
- function isItemValue(value) {
149
+ function isItemExpr(value) {
150
150
  if (typeof value !== "object" || value === null) return false;
151
151
  const v = value;
152
- if (v[ITEM_VALUE_BRAND] === true) return true;
152
+ if (v[ITEM_EXPR_BRAND] === true) return true;
153
153
  const keys = Object.keys(v);
154
154
  if (keys.length === 1 && keys[0] === "fn" && typeof v.fn === "function") return true;
155
- for (const sym of Object.getOwnPropertySymbols(v)) if (sym.description === "codemation.itemValue" && v[sym] === true) return true;
155
+ for (const sym of Object.getOwnPropertySymbols(v)) if (sym.description === "codemation.itemExpr" && v[sym] === true) return true;
156
156
  return false;
157
157
  }
158
- function containsItemValueInUnknown(value, seen = /* @__PURE__ */ new WeakSet()) {
159
- if (isItemValue(value)) return true;
158
+ function containsItemExprInUnknown(value, seen = /* @__PURE__ */ new WeakSet()) {
159
+ if (isItemExpr(value)) return true;
160
160
  if (value === null || typeof value !== "object") return false;
161
161
  if (seen.has(value)) return false;
162
162
  seen.add(value);
163
- if (Array.isArray(value)) return value.some((entry) => containsItemValueInUnknown(entry, seen));
164
- for (const entry of Object.values(value)) if (containsItemValueInUnknown(entry, seen)) return true;
163
+ if (Array.isArray(value)) return value.some((entry) => containsItemExprInUnknown(entry, seen));
164
+ for (const entry of Object.values(value)) if (containsItemExprInUnknown(entry, seen)) return true;
165
165
  return false;
166
166
  }
167
167
  /**
168
- * Deep-resolves {@link itemValue} leaves. Returns a new graph (does not mutate the original config object).
168
+ * Deep-resolves {@link itemExpr} leaves. Returns a new graph (does not mutate the original config object).
169
169
  */
170
- async function resolveItemValuesInUnknown(value, args, seen = /* @__PURE__ */ new WeakSet()) {
171
- if (isItemValue(value)) return await Promise.resolve(value.fn(args));
170
+ async function resolveItemExprsInUnknown(value, args, seen = /* @__PURE__ */ new WeakSet()) {
171
+ if (isItemExpr(value)) return await Promise.resolve(value.fn(args));
172
172
  if (value === null || typeof value !== "object") return value;
173
173
  if (seen.has(value)) return value;
174
174
  seen.add(value);
175
175
  if (Array.isArray(value)) {
176
176
  const out$1 = [];
177
- for (let i = 0; i < value.length; i++) out$1.push(await resolveItemValuesInUnknown(value[i], args, seen));
177
+ for (let i = 0; i < value.length; i++) out$1.push(await resolveItemExprsInUnknown(value[i], args, seen));
178
178
  return out$1;
179
179
  }
180
180
  const rec = value;
@@ -182,14 +182,14 @@ async function resolveItemValuesInUnknown(value, args, seen = /* @__PURE__ */ ne
182
182
  const proto = Object.getPrototypeOf(value);
183
183
  if (proto !== Object.prototype && proto !== null && entries.length === 0) return value;
184
184
  const out = Object.create(proto);
185
- for (const [k, v] of entries) out[k] = await resolveItemValuesInUnknown(v, args, seen);
185
+ for (const [k, v] of entries) out[k] = await resolveItemExprsInUnknown(v, args, seen);
186
186
  return out;
187
187
  }
188
188
  /**
189
- * Clones runnable config (best-effort) so per-item {@link itemValue} resolution never mutates shared instances.
189
+ * Clones runnable config (best-effort) so per-item {@link itemExpr} resolution never mutates shared instances.
190
190
  */
191
- async function resolveItemValuesForExecution(config, nodeCtx, item, itemIndex, items) {
192
- const ivArgs = {
191
+ async function resolveItemExprsForExecution(config, nodeCtx, item, itemIndex, items) {
192
+ const exprArgs = {
193
193
  item,
194
194
  itemIndex,
195
195
  items,
@@ -201,8 +201,8 @@ async function resolveItemValuesForExecution(config, nodeCtx, item, itemIndex, i
201
201
  data: nodeCtx.data
202
202
  }
203
203
  };
204
- if (!containsItemValueInUnknown(config)) return;
205
- return await resolveItemValuesInUnknown(config, ivArgs);
204
+ if (!containsItemExprInUnknown(config)) return;
205
+ return await resolveItemExprsInUnknown(config, exprArgs);
206
206
  }
207
207
 
208
208
  //#endregion
@@ -914,14 +914,14 @@ var InProcessRetryRunner = class InProcessRetryRunner {
914
914
  };
915
915
 
916
916
  //#endregion
917
- //#region src/execution/ItemValueResolver.ts
917
+ //#region src/execution/ItemExprResolver.ts
918
918
  /**
919
- * Resolves {@link import("../contracts/itemValue").ItemValue} leaves on runnable config before {@link RunnableNode.execute}.
919
+ * Resolves {@link import("../contracts/itemExpr").ItemExpr} leaves on runnable config before {@link RunnableNode.execute}.
920
920
  */
921
- var ItemValueResolver = class {
921
+ var ItemExprResolver = class {
922
922
  async resolveConfigForItem(ctx, item, itemIndex, items) {
923
- if (!ctx) throw new Error("ItemValueResolver.resolveConfigForItem: ctx is required");
924
- const resolvedConfig = await resolveItemValuesForExecution(ctx.config, ctx, item, itemIndex, items);
923
+ if (!ctx) throw new Error("ItemExprResolver.resolveConfigForItem: ctx is required");
924
+ const resolvedConfig = await resolveItemExprsForExecution(ctx.config, ctx, item, itemIndex, items);
925
925
  const merged = resolvedConfig !== void 0 && resolvedConfig !== null ? resolvedConfig : ctx.config;
926
926
  if (merged === void 0 || merged === null) return ctx;
927
927
  return {
@@ -1104,12 +1104,12 @@ var NodeActivationRequestComposer = class {
1104
1104
  var NodeExecutor = class {
1105
1105
  fanInMerger = new FanInMergeByOriginMerger();
1106
1106
  outputNormalizer = new NodeOutputNormalizer();
1107
- itemValueResolver;
1107
+ itemExprResolver;
1108
1108
  outputBehaviorResolver;
1109
- constructor(nodeInstanceFactory, retryRunner, itemValueResolver, outputBehaviorResolver) {
1109
+ constructor(nodeInstanceFactory, retryRunner, itemExprResolver, outputBehaviorResolver) {
1110
1110
  this.nodeInstanceFactory = nodeInstanceFactory;
1111
1111
  this.retryRunner = retryRunner;
1112
- this.itemValueResolver = itemValueResolver ?? new ItemValueResolver();
1112
+ this.itemExprResolver = itemExprResolver ?? new ItemExprResolver();
1113
1113
  this.outputBehaviorResolver = outputBehaviorResolver ?? new RunnableOutputBehaviorResolver();
1114
1114
  }
1115
1115
  async execute(request) {
@@ -1180,7 +1180,7 @@ var NodeExecutor = class {
1180
1180
  const syntheticItem = { json: {} };
1181
1181
  const parsed = inputSchema.parse(syntheticItem.json);
1182
1182
  const runnableCtx = request.ctx;
1183
- const resolvedCtx = await this.itemValueResolver.resolveConfigForItem(runnableCtx, syntheticItem, 0, inputBatch);
1183
+ const resolvedCtx = await this.itemExprResolver.resolveConfigForItem(runnableCtx, syntheticItem, 0, inputBatch);
1184
1184
  const args = {
1185
1185
  input: parsed,
1186
1186
  item: syntheticItem,
@@ -1201,7 +1201,7 @@ var NodeExecutor = class {
1201
1201
  this.assertItemJsonNotTopLevelArray(request.nodeId, item);
1202
1202
  const parsed = inputSchema.parse(item.json);
1203
1203
  const runnableCtx = request.ctx;
1204
- const resolvedCtx = await this.itemValueResolver.resolveConfigForItem(runnableCtx, item, i, inputBatch);
1204
+ const resolvedCtx = await this.itemExprResolver.resolveConfigForItem(runnableCtx, item, i, inputBatch);
1205
1205
  const ctx = this.pickExecutionContext(runnableCtx, resolvedCtx);
1206
1206
  const args = {
1207
1207
  input: parsed,
@@ -4880,5 +4880,5 @@ var WorkflowRepositoryWebhookTriggerMatcherFactory = class {
4880
4880
  };
4881
4881
 
4882
4882
  //#endregion
4883
- export { chatModel as $, NodeExecutor as A, DefaultAsyncSleeper as B, RunPolicySnapshotFactory as C, PersistedWorkflowTokenRegistry as D, WorkflowSnapshotCodec as E, isPortsEmission as F, NodeEventPublisher as G, getOriginIndexFromItem as H, isUnbrandedPortsEmissionShape as I, ConnectionNodeIdFactory as J, WorkflowExecutableNodeClassifierFactory as K, ItemValueResolver as L, RunnableOutputBehaviorResolver as M, NodeOutputNormalizer as N, MissingRuntimeTriggerToken as O, emitPorts as P, resolveItemValuesInUnknown as Q, InProcessRetryRunner as R, ConfigDrivenOffloadPolicy as S, NodeInstanceFactory as T, DefaultExecutionBinaryService as U, CredentialResolverFactory as V, UnavailableBinaryStorage as W, itemValue as X, isItemValue as Y, resolveItemValuesForExecution as Z, EngineExecutionLimitsPolicy as _, CoreTokens as _t, InMemoryLiveWorkflowRepository as a, StackTraceCallSitePathResolver as at, HintOnlyOffloadPolicy as b, EngineFactory as c, delay as ct, InMemoryRunDataFactory as d, injectable as dt, getPersistedRuntimeTypeMetadata as et, InMemoryBinaryStorage as f, instanceCachingFactory as ft, ENGINE_EXECUTION_LIMITS_DEFAULTS as g, singleton as gt, RunTerminalPersistenceCoordinator as h, registry as ht, RunIntentService as i, PersistedRuntimeTypeMetadataStore as it, InProcessRetryRunnerFactory as j, NodeExecutorFactory as k, Engine as l, inject as lt, WorkflowPolicyErrorServices as m, predicateAwareClassFactory as mt, WorkflowRepositoryWebhookTriggerMatcher as n, tool as nt, EngineWorkflowRunnerServiceFactory as o, PersistedRuntimeTypeNameResolver as ot, WorkflowStoragePolicyEvaluator as p, instancePerContainerCachingFactory as pt, WorkflowExecutableNodeClassifier as q, RunIntentServiceFactory as r, InjectableRuntimeDecoratorComposer as rt, EngineWorkflowRunnerService as s, container$1 as st, WorkflowRepositoryWebhookTriggerMatcherFactory as t, node as tt, RunFinishedAtFactory as u, injectAll as ut, LocalOnlyScheduler as v, NodeInstanceFactoryFactory as w, DefaultDrivingScheduler as x, InlineDrivingScheduler as y, DefaultExecutionContextFactory as z };
4884
- //# sourceMappingURL=runtime-7Xh9z3dw.js.map
4883
+ export { chatModel as $, NodeExecutor as A, DefaultAsyncSleeper as B, RunPolicySnapshotFactory as C, PersistedWorkflowTokenRegistry as D, WorkflowSnapshotCodec as E, isPortsEmission as F, NodeEventPublisher as G, getOriginIndexFromItem as H, isUnbrandedPortsEmissionShape as I, ConnectionNodeIdFactory as J, WorkflowExecutableNodeClassifierFactory as K, ItemExprResolver as L, RunnableOutputBehaviorResolver as M, NodeOutputNormalizer as N, MissingRuntimeTriggerToken as O, emitPorts as P, resolveItemExprsInUnknown as Q, InProcessRetryRunner as R, ConfigDrivenOffloadPolicy as S, NodeInstanceFactory as T, DefaultExecutionBinaryService as U, CredentialResolverFactory as V, UnavailableBinaryStorage as W, itemExpr as X, isItemExpr as Y, resolveItemExprsForExecution as Z, EngineExecutionLimitsPolicy as _, CoreTokens as _t, InMemoryLiveWorkflowRepository as a, StackTraceCallSitePathResolver as at, HintOnlyOffloadPolicy as b, EngineFactory as c, delay as ct, InMemoryRunDataFactory as d, injectable as dt, getPersistedRuntimeTypeMetadata as et, InMemoryBinaryStorage as f, instanceCachingFactory as ft, ENGINE_EXECUTION_LIMITS_DEFAULTS as g, singleton as gt, RunTerminalPersistenceCoordinator as h, registry as ht, RunIntentService as i, PersistedRuntimeTypeMetadataStore as it, InProcessRetryRunnerFactory as j, NodeExecutorFactory as k, Engine as l, inject as lt, WorkflowPolicyErrorServices as m, predicateAwareClassFactory as mt, WorkflowRepositoryWebhookTriggerMatcher as n, tool as nt, EngineWorkflowRunnerServiceFactory as o, PersistedRuntimeTypeNameResolver as ot, WorkflowStoragePolicyEvaluator as p, instancePerContainerCachingFactory as pt, WorkflowExecutableNodeClassifier as q, RunIntentServiceFactory as r, InjectableRuntimeDecoratorComposer as rt, EngineWorkflowRunnerService as s, container$1 as st, WorkflowRepositoryWebhookTriggerMatcherFactory as t, node as tt, RunFinishedAtFactory as u, injectAll as ut, LocalOnlyScheduler as v, NodeInstanceFactoryFactory as w, DefaultDrivingScheduler as x, InlineDrivingScheduler as y, DefaultExecutionContextFactory as z };
4884
+ //# sourceMappingURL=runtime-CJnObwsU.js.map