@codemation/core-nodes-ocr 0.2.5 → 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.
@@ -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)