@n8n/instance-ai 1.18.0 → 1.19.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 (80) hide show
  1. package/dist/agent/shared-prompts.d.ts +1 -1
  2. package/dist/agent/shared-prompts.js +1 -1
  3. package/dist/agent/shared-prompts.js.map +1 -1
  4. package/dist/agent/sub-agent-factory.d.ts +1 -1
  5. package/dist/build.tsbuildinfo +1 -1
  6. package/dist/debug/run-debug-buffer.d.ts +8 -7
  7. package/dist/debug/run-debug-buffer.js +7 -6
  8. package/dist/debug/run-debug-buffer.js.map +1 -1
  9. package/dist/runtime/run-state-registry.d.ts +3 -2
  10. package/dist/runtime/run-state-registry.js +5 -2
  11. package/dist/runtime/run-state-registry.js.map +1 -1
  12. package/dist/storage/workflow-loop-storage.d.ts +87 -0
  13. package/dist/stream/map-chunk.d.ts +1 -2
  14. package/dist/stream/map-chunk.js +38 -21
  15. package/dist/stream/map-chunk.js.map +1 -1
  16. package/dist/tools/nodes/node-search-engine.js +7 -0
  17. package/dist/tools/nodes/node-search-engine.js.map +1 -1
  18. package/dist/tools/nodes/node-search-engine.types.d.ts +3 -0
  19. package/dist/tools/nodes/node-search-engine.types.js.map +1 -1
  20. package/dist/tools/orchestration/agent-target-binding.d.ts +18 -2
  21. package/dist/tools/orchestration/agent-target-binding.js +56 -25
  22. package/dist/tools/orchestration/agent-target-binding.js.map +1 -1
  23. package/dist/tools/orchestration/build-agent.tool.js +179 -91
  24. package/dist/tools/orchestration/build-agent.tool.js.map +1 -1
  25. package/dist/tools/orchestration/verification/analyze-result.d.ts +4 -0
  26. package/dist/tools/orchestration/verification/analyze-result.js +1 -0
  27. package/dist/tools/orchestration/verification/analyze-result.js.map +1 -1
  28. package/dist/tools/orchestration/verification/prepare-run.d.ts +2 -1
  29. package/dist/tools/orchestration/verification/prepare-run.js +6 -3
  30. package/dist/tools/orchestration/verification/prepare-run.js.map +1 -1
  31. package/dist/tools/orchestration/verification/scripted-gate-run.d.ts +23 -0
  32. package/dist/tools/orchestration/verification/scripted-gate-run.js +91 -0
  33. package/dist/tools/orchestration/verification/scripted-gate-run.js.map +1 -0
  34. package/dist/tools/orchestration/verify-built-workflow.tool.js +33 -13
  35. package/dist/tools/orchestration/verify-built-workflow.tool.js.map +1 -1
  36. package/dist/tools/workflows/build-workflow.tool.js +20 -7
  37. package/dist/tools/workflows/build-workflow.tool.js.map +1 -1
  38. package/dist/tools/workflows/plan-verification-simulation.d.ts +2 -1
  39. package/dist/tools/workflows/plan-verification-simulation.js +5 -1
  40. package/dist/tools/workflows/plan-verification-simulation.js.map +1 -1
  41. package/dist/tools/workflows/preserve-node-positions.d.ts +3 -0
  42. package/dist/tools/workflows/preserve-node-positions.js +148 -0
  43. package/dist/tools/workflows/preserve-node-positions.js.map +1 -0
  44. package/dist/tools/workflows/resolve-credentials.js +52 -18
  45. package/dist/tools/workflows/resolve-credentials.js.map +1 -1
  46. package/dist/tools/workflows/setup-workflow.service.d.ts +10 -2
  47. package/dist/tools/workflows/setup-workflow.service.js +57 -5
  48. package/dist/tools/workflows/setup-workflow.service.js.map +1 -1
  49. package/dist/tools/workflows/wait-gate-script.d.ts +9 -0
  50. package/dist/tools/workflows/wait-gate-script.js +223 -0
  51. package/dist/tools/workflows/wait-gate-script.js.map +1 -0
  52. package/dist/tools/workflows/workflow-build-telemetry.d.ts +5 -0
  53. package/dist/tools/workflows/workflow-build-telemetry.js +15 -0
  54. package/dist/tools/workflows/workflow-build-telemetry.js.map +1 -1
  55. package/dist/tools/workflows/workflow-source-compiler.js +5 -0
  56. package/dist/tools/workflows/workflow-source-compiler.js.map +1 -1
  57. package/dist/tools/workflows/workflow-validation-warnings.d.ts +4 -1
  58. package/dist/tools/workflows/workflow-validation-warnings.js +3 -16
  59. package/dist/tools/workflows/workflow-validation-warnings.js.map +1 -1
  60. package/dist/tools/workflows.tool.js +3 -1
  61. package/dist/tools/workflows.tool.js.map +1 -1
  62. package/dist/types.d.ts +9 -1
  63. package/dist/types.js.map +1 -1
  64. package/dist/utils/quota-error.d.ts +2 -0
  65. package/dist/utils/quota-error.js +44 -0
  66. package/dist/utils/quota-error.js.map +1 -0
  67. package/dist/workflow-loop/workflow-loop-state.d.ts +109 -0
  68. package/dist/workflow-loop/workflow-loop-state.js +10 -1
  69. package/dist/workflow-loop/workflow-loop-state.js.map +1 -1
  70. package/dist/workspace/builder-templates-service.js +2 -4
  71. package/dist/workspace/builder-templates-service.js.map +1 -1
  72. package/dist/workspace/sandbox-fs.js +2 -2
  73. package/dist/workspace/sandbox-fs.js.map +1 -1
  74. package/dist/workspace/snapshot-manager.js +2 -4
  75. package/dist/workspace/snapshot-manager.js.map +1 -1
  76. package/dist/workspace/workspace-files.js +16 -1
  77. package/dist/workspace/workspace-files.js.map +1 -1
  78. package/knowledge-base/reference/workflow-builder-guardrails.md +9 -20
  79. package/package.json +15 -15
  80. package/skills/workflow-builder/SKILL.md +74 -70
@@ -17,7 +17,7 @@ const SANDBOX_IO_RETRY_BACKOFF_CAP_MS = 5_000;
17
17
  function ioResourceLabel(options) {
18
18
  return options?.resourceLabel ?? 'Sandbox file';
19
19
  }
20
- async function sleep(ms, abortSignal) {
20
+ async function sleepUntilAbort(ms, abortSignal) {
21
21
  (0, agents_1.throwIfAborted)(abortSignal);
22
22
  await new Promise((resolve, reject) => {
23
23
  const timer = setTimeout(() => {
@@ -52,7 +52,7 @@ async function retryTransientSandboxIo(op, filePath, options) {
52
52
  attempt,
53
53
  error: (0, error_formatting_1.formatErrorForLog)(error),
54
54
  });
55
- await sleep(Math.min(baseMs * 2 ** (attempt - 1), SANDBOX_IO_RETRY_BACKOFF_CAP_MS), options?.abortSignal);
55
+ await sleepUntilAbort(Math.min(baseMs * 2 ** (attempt - 1), SANDBOX_IO_RETRY_BACKOFF_CAP_MS), options?.abortSignal);
56
56
  }
57
57
  }
58
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sandbox-fs.js","sourceRoot":"","sources":["../../src/workspace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AC,CAAC;QAElD,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,IAAI,uBAAuB,EAAE,CAAC;YAC7E,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,CAAC,CAAC;YAClE,MAAM,eAAe,CAAC,gBAAgB,KAAK,SAAS,eAAe,GAAG,CAAC,CAAC;QACzE,CAAC;QAKD,MAAM,eAAe,CACpB,cAAc,eAAe,QAAQ,kBAAkB,CAAC,QAAQ,CAAC,oBAAoB,eAAe,aAAa,CACjH,CAAC;IACH,CAAC,EACD,QAAQ,EACR,OAAO,CACP,CAAC;AACH,CAAC;AAOM,KAAK,6BACX,SAA+B,EAC/B,QAAgB,EAChB,OAA+B;IAE/B,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAC3C,KAAK,IAAI,EAAE,CACV,MAAM,YAAY,CAAC,SAAS,EAAE,QAAQ,kBAAkB,CAAC,QAAQ,CAAC,eAAe,EAAE;QAClF,WAAW,EAAE,OAAO,EAAE,WAAW;KACjC,CAAC,EACH,QAAQ,EACR,OAAO,CACP,CAAC;IACF,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO,MAAM,CAAC,MAAM,CAAC;AACtB,CAAC;AAMD,4BAAmC,CAAS;IAC3C,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACjC,CAAC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SnapshotManager = void 0;
4
4
  const sandbox_1 = require("@n8n/agents/sandbox");
5
+ const sleep_1 = require("@n8n/utils/sleep");
5
6
  const materialize_knowledge_base_1 = require("../knowledge-base/materialize-knowledge-base");
6
7
  const builder_templates_service_1 = require("./builder-templates-service");
7
8
  const sandbox_setup_1 = require("./sandbox-setup");
@@ -13,9 +14,6 @@ const SNAPSHOT_WORKSPACE_LAYOUT_DIRS = ['src', 'chunks', 'node-types'];
13
14
  const SNAPSHOT_BUILDING_STATES = new Set(['building', 'pending', 'pulling']);
14
15
  const SNAPSHOT_VERIFY_POLL_MS = 5_000;
15
16
  const DEFAULT_SNAPSHOT_VERIFY_TIMEOUT_S = 1_800;
16
- async function sleep(ms) {
17
- await new Promise((resolve) => setTimeout(resolve, ms));
18
- }
19
17
  function isAlreadyExistsError(error) {
20
18
  const { DaytonaError } = (0, sandbox_1.loadDaytona)();
21
19
  if (!(error instanceof DaytonaError))
@@ -114,7 +112,7 @@ class SnapshotManager {
114
112
  name,
115
113
  state: snapshot.state,
116
114
  });
117
- await sleep(SNAPSHOT_VERIFY_POLL_MS);
115
+ await (0, sleep_1.sleep)(SNAPSHOT_VERIFY_POLL_MS);
118
116
  }
119
117
  }
120
118
  snapshotName() {
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot-manager.js","sourceRoot":"","sources":["../../src/workspace/snapshot-manager.ts"],"names":[],"mappings":";;;AAgBA,iDAA0E;AAE1E,6FAGsD;AAEtD,2EAGqC;AACrC,mDAAyE;AACzE,qEAAuE;AACvE,qFAAwF;AACxF,6DAA4E;AAO5E,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AAC9D,MAAM,8BAA8B,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAU,CAAC;AAChF,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAC7E,MAAM,uBAAuB,GAAG,KAAK,CAAC;AACtC,MAAM,iCAAiC,GAAG,KAAK,CAAC;AAEhD,KAAK,UAAU,KAAK,CAAC,EAAU;IAC9B,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AACzD,CAAC;AACD,SAAS,oBAAoB,CAAC,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C,CAAC,CAAC;QACtF,MAAM,eAAe,GAAG,MAAM,gBAAgB,CAAC,SAAS,EAAE,CAAC;QAE3D,OAAO,MAAM,IAAA,8DAAiC,EAAC;YAC9C,IAAI,EAAE,gCAAsB;YAC5B,gBAAgB,EAAE,eAAe,CAAC,OAAO;YACzC,MAAM,EAAE,IAAI,CAAC,MAAM;SACnB,CAAC,CAAC;IACJ,CAAC;IAOD,UAAU;QACT,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;QACtC,IAAI,CAAC,0BAA0B,GAAG,IAAI,CAAC;IACxC,CAAC;CACD"}
@@ -3,14 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readWorkspaceFile = readWorkspaceFile;
4
4
  exports.writeWorkspaceFile = writeWorkspaceFile;
5
5
  exports.writeWorkspaceFileMap = writeWorkspaceFileMap;
6
+ const agents_1 = require("@n8n/agents");
6
7
  const error_formatting_1 = require("../error-formatting");
7
8
  const sandbox_fs_1 = require("./sandbox-fs");
9
+ const quota_error_1 = require("../utils/quota-error");
8
10
  function resourceLabel(options) {
9
11
  return options?.resourceLabel ?? 'Workspace file';
10
12
  }
11
13
  function decodeWorkspaceFileContent(content) {
12
14
  return Buffer.isBuffer(content) ? content.toString('utf-8') : content;
13
15
  }
16
+ function selectWriteFailureCause(writeError, fallbackError) {
17
+ if ((0, quota_error_1.isQuotaExhaustedError)(writeError))
18
+ return writeError;
19
+ if ((0, quota_error_1.isQuotaExhaustedError)(fallbackError))
20
+ return fallbackError;
21
+ return writeError;
22
+ }
14
23
  async function readWorkspaceFile(workspace, filePath, options) {
15
24
  const filesystem = workspace.filesystem;
16
25
  const readFile = filesystem?.readFile;
@@ -60,6 +69,8 @@ async function writeWorkspaceFile(workspace, filePath, content, options) {
60
69
  return;
61
70
  }
62
71
  catch (error) {
72
+ if ((0, agents_1.isAbortError)(error))
73
+ throw error;
63
74
  try {
64
75
  await (0, sandbox_fs_1.writeFileViaSandbox)(workspace, filePath, content, options);
65
76
  options?.logger.warn(`${label} filesystem write failed; used command fallback`, {
@@ -69,7 +80,9 @@ async function writeWorkspaceFile(workspace, filePath, content, options) {
69
80
  return;
70
81
  }
71
82
  catch (fallbackError) {
72
- throw new Error(`Failed to write ${label.toLowerCase()} "${filePath}": ${(0, error_formatting_1.formatErrorForLog)(error)}; command fallback failed: ${(0, error_formatting_1.formatErrorForLog)(fallbackError)}`, { cause: fallbackError });
83
+ if ((0, agents_1.isAbortError)(fallbackError))
84
+ throw fallbackError;
85
+ throw new Error(`Failed to write ${label.toLowerCase()} "${filePath}": ${(0, error_formatting_1.formatErrorForLog)(error)}; command fallback failed: ${(0, error_formatting_1.formatErrorForLog)(fallbackError)}`, { cause: selectWriteFailureCause(error, fallbackError) });
73
86
  }
74
87
  }
75
88
  }
@@ -77,6 +90,8 @@ async function writeWorkspaceFile(workspace, filePath, content, options) {
77
90
  await (0, sandbox_fs_1.writeFileViaSandbox)(workspace, filePath, content, options);
78
91
  }
79
92
  catch (error) {
93
+ if ((0, agents_1.isAbortError)(error))
94
+ throw error;
80
95
  throw new Error(`Failed to write ${label.toLowerCase()} "${filePath}": ${(0, error_formatting_1.formatErrorForLog)(error)}`, { cause: error });
81
96
  }
82
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-files.js","sourceRoot":"","sources":["../../src/workspace/workspace-files.ts"],"names":[],"mappings":";;;;;AAAA,0DAAwD;AAExD,6CAMsB;AA0BtB,SAAS,aAAa,CAAC,OAA8B;IACpD,OAAO,OAAO,EAAE,aAAa,IAAI,gBAAgB,CAAC;AACnD,CAAC;AAED,SAAS,0BAA0B,CAAC,OAAwB;IAC3D,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC;AAMM,KAAK,4BACX,SAA8B,EAC9B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AAK,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,EAAE;QAC/C,MAAM,kBAAkB,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC,CAAC,CACF,CAAC;AACH,CAAC"}
@@ -4,8 +4,10 @@ Use these guardrails for workflow builds with multiple external systems,
4
4
  multiple requested effects, digests or reports, non-trivial branching, or Code
5
5
  nodes. They are a runtime checklist, not extra user-facing output.
6
6
 
7
- Do not add sticky notes unless the user explicitly asks for them. Prefer chat
8
- explanations over canvas stickies.
7
+ Code-node runtime limits (no network, forbidden imports, nested template
8
+ literals) and unsolicited stickies are enforced by `workflow-sdk validate` —
9
+ fix those findings before `build-workflow`. Prefer built-in nodes for simple
10
+ split, map, filter, merge, and aggregate work.
9
11
 
10
12
  ## Preserve Source Data
11
13
 
@@ -116,22 +118,9 @@ node after a side-effect needs the original data, reference it by node name
116
118
  (`$('Compute Change').item.json.status`) or wire it in parallel from the
117
119
  data-producing node instead of chaining through the send.
118
120
 
119
- ## Keep Code Nodes Parseable
121
+ ## Code Nodes
120
122
 
121
- Prefer built-in nodes for simple split, map, filter, merge, and aggregate work.
122
- When a Code node is necessary, use real n8n item APIs such as `$input.all()` and
123
- return explicit `json` objects.
124
-
125
- Code nodes run in a restricted runtime. Do not `require()` or `import`
126
- unavailable modules such as `luxon` or `openai`; use JavaScript `Date`, `Intl`,
127
- `$now`, `$today`, existing workflow data, or dedicated AI nodes.
128
-
129
- Code nodes have no network access. `fetch()`, `axios`, `XMLHttpRequest`, and
130
- `require` of http modules all fail at runtime, in JavaScript and Python alike.
131
- Make every HTTP/API call with the HTTP Request node and transform its output in
132
- the Code node, even when the user asks to fetch inside a Code node.
133
-
134
- Keep embedded Code node source parseable after saving. Avoid nested template
135
- literals, raw newlines inside quoted strings, and escape-heavy regex literals.
136
- Prefer arrays joined with a runtime separator such as
137
- `const LF = String.fromCharCode(10);`.
123
+ When a Code node is necessary, use real n8n item APIs such as `$input.all()` /
124
+ `$input.item` and return explicit `json` objects. Prefer arrays joined with a
125
+ runtime separator (e.g. `const LF = String.fromCharCode(10);`) over escape-heavy
126
+ multi-line string construction.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n8n/instance-ai",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "src/index.ts",
6
6
  "types": "dist/index.d.ts",
@@ -36,9 +36,9 @@
36
36
  "@joplin/turndown-plugin-gfm": "1.0.64",
37
37
  "@langchain/anthropic": "1.3.27",
38
38
  "@mozilla/readability": "^0.6.0",
39
- "@opentelemetry/api": "^1.9.0",
39
+ "@opentelemetry/api": "1.9.1",
40
40
  "@thednp/dommatrix": "^2.0.12",
41
- "ai": "^6.0.197",
41
+ "ai": "^7.0.37",
42
42
  "csv-parse": "6.2.1",
43
43
  "fast-glob": "3.3.3",
44
44
  "flatted": "3.4.2",
@@ -54,18 +54,18 @@
54
54
  "turndown": "^7.2.2",
55
55
  "undici": "^7.28.0",
56
56
  "@e965/xlsx": "0.20.3",
57
- "zod": "3.25.67",
57
+ "zod": "3.25.76",
58
58
  "zod-from-json-schema-v3": "npm:zod-from-json-schema@^0.0.5",
59
- "@n8n/agents": "0.18.0",
60
- "@n8n/ai-utilities": "0.26.0",
61
- "@n8n/utils": "1.41.0",
62
- "@n8n/api-types": "1.33.0",
63
- "@n8n/mcp-browser": "0.15.0",
64
- "@n8n/workflow-sdk": "0.26.0",
65
- "n8n-workflow": "2.33.0"
59
+ "@n8n/agents": "0.19.0",
60
+ "@n8n/ai-utilities": "0.27.0",
61
+ "@n8n/api-types": "1.34.0",
62
+ "@n8n/utils": "1.42.0",
63
+ "@n8n/mcp-browser": "0.16.0",
64
+ "n8n-workflow": "2.34.0",
65
+ "@n8n/workflow-sdk": "0.27.0"
66
66
  },
67
67
  "devDependencies": {
68
- "@ai-sdk/anthropic": "^3.0.81",
68
+ "@ai-sdk/anthropic": "^4.0.20",
69
69
  "@langchain/core": "1.2.0",
70
70
  "@types/luxon": "3.2.0",
71
71
  "@types/psl": "1.1.3",
@@ -76,8 +76,8 @@
76
76
  "vite": "^8.0.2",
77
77
  "vitest": "^4.1.9",
78
78
  "vitest-mock-extended": "^3.1.0",
79
- "@n8n/vitest-config": "1.19.0",
80
- "@n8n/typescript-config": "1.9.0"
79
+ "@n8n/typescript-config": "1.9.0",
80
+ "@n8n/vitest-config": "1.19.0"
81
81
  },
82
82
  "license": "SEE LICENSE IN LICENSE.md",
83
83
  "homepage": "https://n8n.io",
@@ -102,7 +102,7 @@
102
102
  "lint": "eslint . --quiet",
103
103
  "lint:fix": "eslint . --fix",
104
104
  "eval:instance-ai": "tsx evaluations/cli/index.ts",
105
- "eval:agents": "tsx evaluations/cli/index.ts --tier agents",
105
+ "eval:agents": "tsx evaluations/cli/index.ts --source langtracer --suite agents --tier agents",
106
106
  "eval:build-mcp-manifest": "tsx evaluations/cli/build-mcp-manifest.ts",
107
107
  "eval:langtracer-push": "tsx evaluations/cli/langtracer-push.ts",
108
108
  "eval:pairwise": "tsx evaluations/cli/pairwise.ts",
@@ -3,15 +3,17 @@ name: workflow-builder
3
3
  description: >-
4
4
  Load before calling build-workflow. Default path for all single-workflow
5
5
  work: new one-off workflows, existing-workflow edits, verification repairs,
6
- and workflow-local data tables. Write or edit a workspace source file, then
7
- call build-workflow with filePath. When the workflow creates or writes Data
8
- Tables, load data-table-manager first, then this skill. Do not load planning
9
- or create-tasks first. Load planning only when multiple coordinated workflows
6
+ and workflow-local data tables. Write or edit a workspace source file, run
7
+ workflow-sdk validate via workspace_execute_command, then call build-workflow
8
+ with filePath. When the workflow creates or writes Data Tables, load
9
+ data-table-manager first, then this skill. Do not load planning or
10
+ create-tasks first. Load planning only when multiple coordinated workflows
10
11
  or shared cross-task data tables require a dependency-aware task graph.
11
12
  recommended_tools:
12
13
  - read_file
13
14
  - write_file
14
15
  - edit_file
16
+ - execute_command
15
17
  - build-workflow
16
18
  - workflows
17
19
  - nodes
@@ -32,13 +34,12 @@ You are an expert n8n workflow builder. You generate complete, valid
32
34
  TypeScript code using `@n8n/workflow-sdk` for new workflows and for existing
33
35
  saved workflow changes.
34
36
 
35
- For new single-workflow requests, build directly with
36
- `build-workflow({ filePath, sourceCode })` — the complete TypeScript SDK
37
- source in `sourceCode`; the tool writes the file and builds in one call. For
37
+ Always write the complete TypeScript SDK source with
38
+ `workspace_write_file` first, then call `build-workflow({ filePath })`. For
38
39
  existing saved workflow edits, call `workflows(action="get-as-code",
39
- workflowId)`, apply the edit to the returned code, then call
40
- `build-workflow({ filePath, workflowId, sourceCode })` the first time — all
41
- edits go through a workspace source file and `build-workflow`. Do not load
40
+ workflowId)`, apply the edit to the returned code, write it to the file, then
41
+ call `build-workflow({ filePath, workflowId })` the first time — all edits go
42
+ through a workspace source file and `build-workflow`. Do not load
42
43
  `planning` or call `create-tasks` first; `planning` is only for coordinated
43
44
  multi-artifact work per the orchestrator routing rules. Do not create a plan
44
45
  just for verification.
@@ -60,16 +61,14 @@ editing anything — never guess at the cause or change the node on a hunch.
60
61
  When called with failure details for an existing workflow, start from the
61
62
  workspace source file if one is available in the conversation or tool output. If
62
63
  you only have a saved n8n workflow ID, use `workflows(action="get-as-code")`,
63
- make the smallest requested edit to the returned code, then call
64
- `build-workflow` once with `filePath` (a stable
65
- `src/workflows/<name>.workflow.ts` path), `workflowId`, and the full edited
66
- code as `sourceCode`. Later repairs should reuse the same `filePath`;
64
+ make the smallest requested edit to the returned code, write it to a stable
65
+ `src/workflows/<name>.workflow.ts` path, then call `build-workflow` once with
66
+ `filePath` and `workflowId`. Later repairs should reuse the same `filePath`;
67
67
  `build-workflow` remembers the bound workflow ID.
68
68
 
69
69
  For repairs, prefer editing the workspace file directly with file tools
70
70
  (`workspace_str_replace_file`) and calling `build-workflow` again with the same
71
- `filePath` alone — cheaper than resending full source. `sourceCode` must always
72
- be the complete source when used; never send string patches or fragments.
71
+ `filePath`.
73
72
 
74
73
  ## Escalation
75
74
 
@@ -78,7 +77,11 @@ If the service or workflow shape is clear, never stop before the first
78
77
  resources, credentials, channel IDs, or timezone; use placeholders or unresolved
79
78
  `newCredential()` calls. Before the first successful `build-workflow` call, use
80
79
  `ask-user` only when a missing choice changes the workflow's intent or topology
81
- (e.g. which destination service). Setup details recipients, accounts,
80
+ (e.g. which destination service). But when that choice is which service to use
81
+ for a capability the user did not name,
82
+ discover coverage first and use an n8n credits–covered node instead of asking
83
+ when the user has no credential for a comparable tool (see n8n credits
84
+ Preference). Setup details — recipients, accounts,
82
85
  resources, channels, credentials, timezone — belong in placeholders or
83
86
  unresolved `newCredential()` calls until post-build setup. After the first
84
87
  build, use `ask-user` when stuck or genuinely ambiguous; do not retry the same
@@ -134,7 +137,7 @@ For workflows with multiple external systems, multiple requested effects,
134
137
  digests or reports, non-trivial branching, or Code nodes, read
135
138
  `knowledge-base/reference/workflow-builder-guardrails.md` before writing code.
136
139
  Use it as the build checklist for source preservation, fan-out/fan-in,
137
- effect-specific gating, list itemization, and Code-node safety.
140
+ effect-specific gating, and list itemization.
138
141
 
139
142
  When mapping downstream fields from an OpenAI node, read
140
143
  `knowledge-base/reference/open-ai-output-shape.md` (v2+ text/response uses
@@ -180,12 +183,9 @@ build → publish → assign steps. Do not create one before the user opts in.
180
183
  `workflows(action="get-as-code", workflowId)`, apply your edit to the
181
184
  returned code, and pass the n8n `workflowId` only on the first
182
185
  `build-workflow` call.
183
- 6. Produce complete TypeScript SDK code. For a new or fully rewritten source
184
- file, do NOT write it with `workspace_write_file` pass it directly as
185
- `sourceCode` on the `build-workflow` call (the tool writes `filePath` and
186
- builds in one step; a separate write call wastes a full round-trip). Use
187
- file tools only to selectively edit an existing `.workflow.ts` for
188
- follow-up changes and repairs. Do not put secrets in the source file.
186
+ 6. Produce complete TypeScript SDK code and write it with
187
+ `workspace_write_file` (new/full rewrite) or `workspace_str_replace_file`
188
+ (targeted edit). Do not put secrets in the source file.
189
189
  Before building, decide whether verification needs branch fixtures. When a
190
190
  live or nondeterministic upstream node (such as HTTP Request, search/list
191
191
  lookups, weather feeds, or AI classifiers) feeds IF/Switch logic and
@@ -194,12 +194,21 @@ build → publish → assign steps. Do not create one before the user opts in.
194
194
  and later `fixtureOverrides` can exercise those scenarios. Do not simulate
195
195
  every external read by default; use this when branch coverage or deterministic
196
196
  proof depends on controlling the upstream data.
197
- 7. Call `build-workflow` with `filePath` (plus `sourceCode` for new or fully
198
- rewritten source).
197
+ 7. Before the first `build-workflow` (and again after substantive edits), run
198
+ SDK validation on the workspace source file via
199
+ `workspace_execute_command`:
200
+ `node --import tsx node_modules/@n8n/workflow-sdk/dist/cli/index.js validate <filePath>`
201
+ Output is lint-style (`line severity code message`); fix every `error`
202
+ row. Warnings do not block the save and the command may still exit 0, but
203
+ they flag defects that surface at run time — resolve or consciously dismiss
204
+ each one. A clean validate run does not guarantee `build-workflow` will
205
+ succeed (no full node-type registry in the sandbox CLI), so still call
206
+ `build-workflow`.
207
+ 8. Call `build-workflow` with the `filePath` you wrote.
199
208
  For planned build follow-ups where `buildTask.isSupportingWorkflow === true`,
200
209
  pass `isSupportingWorkflow: true`; that saved supporting workflow is the
201
210
  task's final deliverable.
202
- 8. Trace wiring before declaring done. For IF, Switch, Merge, AI-agent, loop, or
211
+ 9. Trace wiring before declaring done. For IF, Switch, Merge, AI-agent, loop, or
203
212
  multi-workflow wiring, trace each branch from source to target. Confirm IF
204
213
  branches are wired on the workflow builder (`.to(ifNode).onTrue(...).onFalse(...)`
205
214
  or `.to(ifNode.onTrue(...).onFalse(...))`), not as standalone calls on the IF
@@ -209,15 +218,15 @@ build → publish → assign steps. Do not create one before the user opts in.
209
218
  every requested side effect is on a wired branch. Switch outputs use zero-based
210
219
  `.onCase(index, target)`, Merge modes match the data shape, and sub-nodes are
211
220
  attached to the correct parent.
212
- 9. Fix errors by editing the same workspace source file and calling
213
- `build-workflow` again with the same `filePath`. Save again before any
214
- verification step.
215
- 10. Modify existing workflows by editing the workspace `.workflow.ts` source
221
+ 10. Fix errors by editing the same workspace source file, re-running
222
+ `workflow-sdk validate` on that file, then calling `build-workflow` again
223
+ with the same `filePath`. Save again before any verification step.
224
+ 11. Modify existing workflows by editing the workspace `.workflow.ts` source
216
225
  file. If the file was created from `workflows(action="get-as-code")`, pass
217
226
  the real n8n `workflowId` on the first `build-workflow` call so the file is
218
227
  bound to the saved workflow. Never pass local SDK workflow IDs as n8n
219
228
  workflow IDs.
220
- 11. After a successful direct `build-workflow` result, if the tool output
229
+ 12. After a successful direct `build-workflow` result, if the tool output
221
230
  contains `postBuildFlow.required: true`, follow the inlined
222
231
  `postBuildFlow.instructions` from that output (do not load `post-build-flow`
223
232
  separately) before verification, setup, error-workflow follow-up,
@@ -331,8 +340,18 @@ scraping nodes can run with no API key required on the user's side.
331
340
  **Discovery (while building):** `nodes(action="search")` and
332
341
  `nodes(action="describe")` results carry an `aiGateway` field on covered nodes
333
342
  — no separate lookup needed. When `aiGateway.supported === true`, prefer that
334
- node over comparable alternatives *when the user has not named a specific
335
- tool*, and respect the constraints it reports:
343
+ node over comparable alternatives *when the user has not named a specific tool
344
+ and has no usable credential for a comparable one* — it runs with no API key.
345
+ Keep your normal `suggested`/search pick when the user already has a credential
346
+ for a comparable tool.
347
+
348
+ The `suggested` list and search *rank* don't prioritize n8n credits coverage
349
+ (individual search results still flag it). When the user asks for a capability
350
+ they have no usable credential for, search that
351
+ capability — or run `nodes(action="list", n8nConnectOnly=true)` — before
352
+ committing, and prefer a covered result.
353
+
354
+ Respect the constraints it reports:
336
355
  - Set `typeVersion >= aiGateway.minVersion` when present.
337
356
  - Constrain `resource` / `operation` to entries in `aiGateway.operations` —
338
357
  a `Record<resource, operation[]>` map; nodes without a resource dimension
@@ -418,33 +437,30 @@ never from `$now.weekday == N`, which silently no-ops on other days.
418
437
 
419
438
  ## SDK Code Rules
420
439
 
440
+ `workflow-sdk validate` (step 7 in the build loop) enforces common SDK and
441
+ Code-node defects: network calls / forbidden imports in Code nodes, nested
442
+ template literals in `jsCode`, TypeScript-only syntax such as `as const`,
443
+ statements after `export default`, `placeholder()` wrapped in `expr()`,
444
+ unsolicited `sticky()`, forbidden builder constructs (e.g. `.map()`), and
445
+ repeated `.onTrue()` / `.onFalse()` overwrites on the same IF variable. Fix
446
+ every reported error and warning before calling `build-workflow`.
447
+
448
+ - Code nodes need not always be necessary. You can use other n8n nodes to do the same thing.
421
449
  - SDK builder code is a restricted subset of TypeScript that builds a static
422
- graph; it is not a Code node and does not run. Only SDK builder methods chain
423
- on SDK objects. Native array/string methods (`.join()`, `.map()`), loops, arrow
424
- functions, `new`, and globals like `Math`, `Date`, and `Object` are
425
- unavailable. Build strings with template literals or explicit lines; do runtime
426
- joining, aggregation, or transforms in a Code node or an n8n expression
427
- (`expr()`). Full allowed/forbidden list:
450
+ graph; it is not a Code node and does not run. Build strings with template
451
+ literals; do runtime joining, aggregation, or transforms in a Code node or
452
+ `expr()`. Full allowed/forbidden list:
428
453
  `knowledge-base/reference/workflow-sdk-language.md`.
429
-
430
- - Code nodes have NO network access at runtime: `fetch()`, `axios`,
431
- `XMLHttpRequest`, and `require` of http modules all fail in the sandbox. Make
432
- every HTTP/API call with the HTTP Request node and transform its output in a
433
- Code node, even when the user asks to fetch inside a Code node.
434
-
435
454
  - Use `@n8n/workflow-sdk`.
436
- - `export default workflow(...)...` must be the last statement in the file, with
437
- all wiring composed inside that chain. Statements after it (e.g.
438
- `ifNode.onTrue(...)`) do not reach the builder and their nodes are dropped.
439
455
  - Do not specify node positions. They are auto-calculated by the layout engine.
440
456
  - Use `expr('{{ $json.field }}')` for n8n expressions. Variables must be inside
441
457
  `{{ }}`. `$json` is only the current item from the immediate predecessor.
442
- - Do not use TypeScript-only syntax that the workflow parser cannot interpret,
443
- such as `as const`.
444
458
  - Use string values directly for discriminator fields like `resource` and
445
459
  `operation`, for example `resource: 'message'`.
446
- - When editing a pre-loaded workflow, remove `position` arrays from node
447
- configs; they are auto-calculated.
460
+ - When editing a pre-loaded workflow, remove every `position` array from node
461
+ configs and from `sticky()` options alike. Positions are auto-calculated, and
462
+ the saved workflow's own layout is restored on save, so nothing you drop here
463
+ is lost. Leaving some in place is worse than dropping all of them.
448
464
  - Use `placeholder('hint')` directly as the parameter value. Do not wrap
449
465
  placeholders in `expr()`, objects, or arrays unless the node definition
450
466
  explicitly expects an object and the placeholder is the direct value of one
@@ -563,12 +579,6 @@ Follow these rules strictly when generating workflows:
563
579
  match time units broadly (day/days, week/weeks…), and give every classifier
564
580
  an explicit fallback bucket — a one-phrasing regex silently misroutes every
565
581
  other phrasing.
566
- 7. Do not add sticky notes (`sticky(...)` / `n8n-nodes-base.stickyNote`) unless
567
- the user explicitly asks for canvas notes. They add visual noise and are
568
- often poorly positioned. Put explanations in your chat reply instead. Even
569
- when the SDK language reference documents `sticky()`, do not use it by
570
- default. When editing a workflow, do not add or reintroduce stickies unless the user
571
- explicitly asks for them.
572
582
 
573
583
  ## Tool Naming Rules
574
584
 
@@ -671,8 +681,6 @@ export default workflow('id', 'name')
671
681
  For IF, each branch is a complete processing path. Wire branches on the workflow
672
682
  builder, not as standalone calls on the IF node variable. Chain steps inside a
673
683
  branch with `.to()`, or pass an array for parallel fan-out.
674
- Never call `.onFalse()` more than once (same for `.onTrue()`); each repeat
675
- overwrites the previous target.
676
684
 
677
685
  ```ts
678
686
  const isImportant = ifElse({
@@ -700,16 +708,14 @@ export default workflow('id', 'name')
700
708
  // Parallel fan-out on a branch: .onFalse([a, b, c])
701
709
  ```
702
710
 
703
- Do NOT wire branches as standalone statements.
704
- Then branch nodes are omitted from the saved graph, and repeated `.onFalse()`
705
- calls keep only the last target.
711
+ Do NOT wire branches as standalone statements after `export default` — those
712
+ calls never reach the builder (`workflow-sdk validate` flags this).
706
713
 
707
714
  ```ts
708
715
  // WRONG
709
716
  export default workflow('id', 'name').add(startTrigger).to(isImportant);
710
717
  isImportant.onTrue(handleImportant); // never reaches the builder
711
- isImportant.onFalse(sendHolding); // overwritten
712
- isImportant.onFalse(alertSlack); // only this one would wire
718
+ isImportant.onFalse(sendHolding);
713
719
  ```
714
720
 
715
721
  For Switch, wire cases the same way — `.to(switchNode).onCase(0, a).onCase(1, b)`
@@ -729,10 +735,8 @@ For AI Agent workflows:
729
735
 
730
736
  ## Additional SDK Functions
731
737
 
732
- - `placeholder('hint')`: marks a parameter value for user input.
733
- - `sticky('content', nodes?, config?)`: opt-in only when the user explicitly
734
- asks for a sticky note on the canvas. Do not import or call it otherwise.
735
- When used, it must still be added to the workflow.
738
+ - `placeholder('hint')`: marks a parameter value for user input (use directly as
739
+ the parameter value; `workflow-sdk validate` flags wrapping it in `expr()`).
736
740
  - `.output(n)`: selects a zero-based output index.
737
741
  - `.onError(handler)`: connects a node's error output to a handler. Requires
738
742
  `onError: 'continueErrorOutput'` in the node config.