@codemation/core-nodes 0.10.0 → 0.10.2

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 CHANGED
@@ -1,5 +1,32 @@
1
1
  # @codemation/core-nodes
2
2
 
3
+ ## 0.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#209](https://github.com/MadeRelevant/codemation/pull/209) [`681f5a4`](https://github.com/MadeRelevant/codemation/commit/681f5a4bfcfe4496206dda1de4fcf5eeec27e0ec) Thanks [@cblokland90](https://github.com/cblokland90)! - fix(core-nodes): HttpRequest body kind:"json" encodes data exactly once
8
+
9
+ `HttpBodyBuilder` always ran `JSON.stringify(data)`, so callers that passed an
10
+ already-stringified string (`JSON.stringify({...})`) shipped a double-encoded
11
+ `"\"...\""` payload. The `kind:"json"` `data` field is now typed `object` (a bare
12
+ string/primitive is a compile-time error), with a runtime guard that throws a clear
13
+ message if a string still reaches the builder (e.g. via `unknown`/`as` or a resolved
14
+ expression). Six examples that passed pre-stringified data are fixed to pass the object
15
+ directly: node-istestrun, node-webhooktrigger, activate-with-credentials,
16
+ file-upload-ocr-drive, hitl-cp-inbox-approval, scenario-invoice-scan-and-post.
17
+
18
+ - [#210](https://github.com/MadeRelevant/codemation/pull/210) [`d4c7aca`](https://github.com/MadeRelevant/codemation/commit/d4c7aca5248352b82313efb16d5792cc24875005) Thanks [@cblokland90](https://github.com/cblokland90)! - AgentToolFactory.asTool() now accepts a per-binding `onRejected` ("halt" | "return"). Setting it marks that tool binding as human-in-the-loop and takes precedence over any `humanApprovalToolBehavior` default carried by the backing node, so two tools backed by the same node can reject differently without cloning the node config.
19
+
20
+ - Updated dependencies [[`3317947`](https://github.com/MadeRelevant/codemation/commit/33179472db68b2f4fc1a15961ac389df25d8cb6f), [`d4c7aca`](https://github.com/MadeRelevant/codemation/commit/d4c7aca5248352b82313efb16d5792cc24875005)]:
21
+ - @codemation/core@0.13.2
22
+
23
+ ## 0.10.1
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [[`2fcb715`](https://github.com/MadeRelevant/codemation/commit/2fcb7153d9c732b2f846b8a8d1cc5626b4363fa6)]:
28
+ - @codemation/core@0.13.1
29
+
3
30
  ## 0.10.0
4
31
 
5
32
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -525,10 +525,13 @@ var HttpRequestExecutor = class {
525
525
  var HttpBodyBuilder = class {
526
526
  async build(spec, item, ctx) {
527
527
  if (!spec || spec.kind === "none") return;
528
- if (spec.kind === "json") return {
529
- body: JSON.stringify(spec.data),
530
- contentType: "application/json"
531
- };
528
+ if (spec.kind === "json") {
529
+ 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(...)).");
530
+ return {
531
+ body: JSON.stringify(spec.data),
532
+ contentType: "application/json"
533
+ };
534
+ }
532
535
  if (spec.kind === "form") {
533
536
  const params = new URLSearchParams();
534
537
  for (const [key, value] of Object.entries(spec.data)) params.append(key, value);
@@ -6570,14 +6573,17 @@ let AIAgentNode = class AIAgentNode$1 {
6570
6573
  });
6571
6574
  }
6572
6575
  /**
6573
- * Detects whether a tool config is backed by a `defineHumanApprovalNode` marker
6574
- * and returns the HITL behavior config, or `undefined` when not a HITL tool.
6576
+ * Resolves the HITL behavior for a tool binding, or `undefined` when it is not a HITL tool.
6577
+ * A binding is HITL if either the backing node carries a `defineHumanApprovalNode` marker or the
6578
+ * binding sets a per-binding `onRejected` via `asTool(..., { onRejected })`. The per-binding value
6579
+ * wins over the node marker, so two tools backed by the same node can reject differently.
6575
6580
  */
6576
6581
  resolveHumanApprovalBehavior(config$1) {
6577
6582
  if (!this.isNodeBackedToolConfig(config$1)) return void 0;
6578
6583
  const marker = config$1.node.humanApprovalToolBehavior;
6579
- if (marker === void 0) return void 0;
6580
- return { onRejected: marker.onRejected ?? "return" };
6584
+ const perBinding = config$1.onRejected;
6585
+ if (marker === void 0 && perBinding === void 0) return void 0;
6586
+ return { onRejected: perBinding ?? marker?.onRejected ?? "return" };
6581
6587
  }
6582
6588
  /**
6583
6589
  * Invoke a text turn using the merged tool set from item-scoped tools (coordinator-managed)