@codemation/core-nodes-ocr 0.2.4 → 0.2.6

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.
@@ -277,6 +277,15 @@ interface AppConfig {
277
277
  readonly repoRoot: string;
278
278
  readonly env: Readonly<NodeJS.ProcessEnv>;
279
279
  readonly workflowSources: ReadonlyArray<string>;
280
+ /**
281
+ * The discovery directories from `workflowDiscovery.directories` (or the `workflowsDir`
282
+ * shorthand). Stored here so the runtime can re-scan on demand in `serve` mode without
283
+ * needing the raw `CodemationConfig`.
284
+ *
285
+ * Absent or empty when no directory-based discovery is configured (i.e. workflows are
286
+ * provided only via the explicit `workflows` array).
287
+ */
288
+ readonly workflowDiscoveryDirectories?: ReadonlyArray<string>;
280
289
  readonly workflows: ReadonlyArray<WorkflowDefinition>;
281
290
  readonly containerRegistrations: ReadonlyArray<CodemationContainerRegistration<unknown>>;
282
291
  readonly credentialTypes: ReadonlyArray<AnyCredentialType>;
@@ -217,6 +217,15 @@ interface AppConfig {
217
217
  readonly repoRoot: string;
218
218
  readonly env: Readonly<NodeJS.ProcessEnv>;
219
219
  readonly workflowSources: ReadonlyArray<string>;
220
+ /**
221
+ * The discovery directories from `workflowDiscovery.directories` (or the `workflowsDir`
222
+ * shorthand). Stored here so the runtime can re-scan on demand in `serve` mode without
223
+ * needing the raw `CodemationConfig`.
224
+ *
225
+ * Absent or empty when no directory-based discovery is configured (i.e. workflows are
226
+ * provided only via the explicit `workflows` array).
227
+ */
228
+ readonly workflowDiscoveryDirectories?: ReadonlyArray<string>;
220
229
  readonly workflows: ReadonlyArray<WorkflowDefinition>;
221
230
  readonly containerRegistrations: ReadonlyArray<CodemationContainerRegistration<unknown>>;
222
231
  readonly credentialTypes: ReadonlyArray<AnyCredentialType>;
@@ -499,10 +499,13 @@ var HttpRequestExecutor = class {
499
499
  var HttpBodyBuilder = class {
500
500
  async build(spec, item, ctx) {
501
501
  if (!spec || spec.kind === "none") return;
502
- if (spec.kind === "json") return {
503
- body: JSON.stringify(spec.data),
504
- contentType: "application/json"
505
- };
502
+ if (spec.kind === "json") {
503
+ if (typeof spec.data === "string") throw new Error("HttpRequest body kind:\"json\" expects a serializable object for \"data\", but received a string. Pass the object directly (e.g. { a: 1 }), not a pre-stringified JSON string (JSON.stringify(...)).");
504
+ return {
505
+ body: JSON.stringify(spec.data),
506
+ contentType: "application/json"
507
+ };
508
+ }
506
509
  if (spec.kind === "form") {
507
510
  const params = new URLSearchParams();
508
511
  for (const [key, value] of Object.entries(spec.data)) params.append(key, value);
@@ -15744,14 +15747,17 @@ let AIAgentNode = class AIAgentNode$1 {
15744
15747
  });
15745
15748
  }
15746
15749
  /**
15747
- * Detects whether a tool config is backed by a `defineHumanApprovalNode` marker
15748
- * and returns the HITL behavior config, or `undefined` when not a HITL tool.
15750
+ * Resolves the HITL behavior for a tool binding, or `undefined` when it is not a HITL tool.
15751
+ * A binding is HITL if either the backing node carries a `defineHumanApprovalNode` marker or the
15752
+ * binding sets a per-binding `onRejected` via `asTool(..., { onRejected })`. The per-binding value
15753
+ * wins over the node marker, so two tools backed by the same node can reject differently.
15749
15754
  */
15750
15755
  resolveHumanApprovalBehavior(config) {
15751
15756
  if (!this.isNodeBackedToolConfig(config)) return void 0;
15752
15757
  const marker$3 = config.node.humanApprovalToolBehavior;
15753
- if (marker$3 === void 0) return void 0;
15754
- return { onRejected: marker$3.onRejected ?? "return" };
15758
+ const perBinding = config.onRejected;
15759
+ if (marker$3 === void 0 && perBinding === void 0) return void 0;
15760
+ return { onRejected: perBinding ?? marker$3?.onRejected ?? "return" };
15755
15761
  }
15756
15762
  /**
15757
15763
  * Invoke a text turn using the merged tool set from item-scoped tools (coordinator-managed)