@n8n/instance-ai 1.12.2 → 1.12.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n8n/instance-ai",
3
- "version": "1.12.2",
3
+ "version": "1.12.4",
4
4
  "main": "dist/index.js",
5
5
  "module": "src/index.ts",
6
6
  "types": "dist/index.d.ts",
@@ -52,12 +52,12 @@
52
52
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz",
53
53
  "zod": "3.25.67",
54
54
  "zod-from-json-schema-v3": "npm:zod-from-json-schema@^0.0.5",
55
- "@n8n/agents": "0.12.1",
55
+ "@n8n/api-types": "1.27.2",
56
56
  "@n8n/mcp-browser": "0.10.0",
57
- "@n8n/api-types": "1.27.0",
57
+ "@n8n/agents": "0.12.2",
58
58
  "@n8n/utils": "1.35.0",
59
- "@n8n/workflow-sdk": "0.20.0",
60
- "n8n-workflow": "2.27.0"
59
+ "@n8n/workflow-sdk": "0.20.2",
60
+ "n8n-workflow": "2.27.2"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@ai-sdk/anthropic": "^3.0.81",
@@ -70,9 +70,9 @@
70
70
  "tsx": "^4.19.3",
71
71
  "vitest": "^4.1.1",
72
72
  "vitest-mock-extended": "^3.1.0",
73
- "@n8n/ai-workflow-builder": "1.27.1",
74
- "@n8n/typescript-config": "1.6.0",
75
- "@n8n/vitest-config": "1.15.0"
73
+ "@n8n/ai-workflow-builder": "1.27.3",
74
+ "@n8n/vitest-config": "1.15.0",
75
+ "@n8n/typescript-config": "1.6.1"
76
76
  },
77
77
  "license": "SEE LICENSE IN LICENSE.md",
78
78
  "homepage": "https://n8n.io",
@@ -175,7 +175,12 @@ effect-specific gating, list itemization, and Code-node safety.
175
175
  task's final deliverable.
176
176
  7. Trace wiring before declaring done. For IF, Switch, Merge, AI-agent, loop, or
177
177
  multi-workflow wiring, trace each branch from source to target. Confirm IF
178
- outputs use `.onTrue()` and `.onFalse()`, Switch outputs use zero-based
178
+ branches are wired on the workflow builder (`.to(ifNode).onTrue(...).onFalse(...)`
179
+ or `.to(ifNode.onTrue(...).onFalse(...))`), not as standalone calls on the IF
180
+ node variable after `export default`. Confirm branch action nodes appear in the
181
+ saved graph — not just trigger → middle nodes → IF. Confirm the IF node has
182
+ connections on both outputs (true and false). For escalation flows, confirm
183
+ every requested side effect is on a wired branch. Switch outputs use zero-based
179
184
  `.onCase(index, target)`, Merge modes match the data shape, and sub-nodes are
180
185
  attached to the correct parent.
181
186
  8. Fix errors. If `build-workflow` returns errors, repair with targeted patches
@@ -376,6 +381,9 @@ column names.
376
381
  Code node, even when the user asks to fetch inside a Code node.
377
382
 
378
383
  - Use `@n8n/workflow-sdk`.
384
+ - `export default workflow(...)...` must be the last statement in the file, with
385
+ all wiring composed inside that chain. Statements after it (e.g.
386
+ `ifNode.onTrue(...)`) do not reach the builder and their nodes are dropped.
379
387
  - Do not specify node positions. They are auto-calculated by the layout engine.
380
388
  - Use `expr('{{ $json.field }}')` for n8n expressions. Variables must be inside
381
389
  `{{ }}`. `$json` is only the current item from the immediate predecessor.
@@ -458,7 +466,8 @@ Follow these rules strictly when generating workflows:
458
466
  feeding the per-item work and looping back via `nextBatch`.
459
467
  - Drop items that do not match a predicate: `filter`.
460
468
  - Two mutually exclusive paths that both do real work: IF with `.onTrue()`
461
- and `.onFalse()`.
469
+ and `.onFalse()` wired on the workflow builder — never as standalone
470
+ statements on the IF node variable.
462
471
  - Many mutually exclusive paths keyed off a value: Switch with
463
472
  `.onCase(index, target)`.
464
473
  - An outcome that must happen even when zero items remain: a node that
@@ -587,7 +596,11 @@ export default workflow('id', 'name')
587
596
  .to(processResults);
588
597
  ```
589
598
 
590
- For IF:
599
+ For IF, each branch is a complete processing path. Wire branches on the workflow
600
+ builder, not as standalone calls on the IF node variable. Chain steps inside a
601
+ branch with `.to()`, or pass an array for parallel fan-out.
602
+ Never call `.onFalse()` more than once (same for `.onTrue()`); each repeat
603
+ overwrites the previous target.
591
604
 
592
605
  ```ts
593
606
  const isImportant = ifElse({
@@ -606,12 +619,29 @@ const isImportant = ifElse({
606
619
  },
607
620
  });
608
621
 
609
- source.to(isImportant);
610
- isImportant.onTrue(handleImportant);
611
- isImportant.onFalse(ignore);
622
+ export default workflow('id', 'name')
623
+ .add(startTrigger)
624
+ .to(isImportant)
625
+ .onTrue(handleImportant) // single step
626
+ .onFalse(sendHolding.to(createTicket.to(alertSlack))); // chained multi-step
627
+ // Equivalent inline form: .to(isImportant.onTrue(a).onFalse(b))
628
+ // Parallel fan-out on a branch: .onFalse([a, b, c])
629
+ ```
630
+
631
+ Do NOT wire branches as standalone statements.
632
+ Then branch nodes are omitted from the saved graph, and repeated `.onFalse()`
633
+ calls keep only the last target.
634
+
635
+ ```ts
636
+ // WRONG
637
+ export default workflow('id', 'name').add(startTrigger).to(isImportant);
638
+ isImportant.onTrue(handleImportant); // never reaches the builder
639
+ isImportant.onFalse(sendHolding); // overwritten
640
+ isImportant.onFalse(alertSlack); // only this one would wire
612
641
  ```
613
642
 
614
- For Switch, use zero-based `.onCase(index, target)` for each rule output.
643
+ For Switch, wire cases the same way — `.to(switchNode).onCase(0, a).onCase(1, b)`
644
+ or inline — using zero-based `.onCase(index, target)` for each rule output.
615
645
 
616
646
  For Split in Batches, use it for per-item side effects and loop back with
617
647
  `nextBatch`. Do not add a separate IF gate just to check whether items exist.