@n8n/instance-ai 1.7.2 → 1.8.1

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 (363) hide show
  1. package/dist/agent/instance-agent.d.ts +1 -1
  2. package/dist/agent/instance-agent.js +88 -75
  3. package/dist/agent/instance-agent.js.map +1 -1
  4. package/dist/agent/mcp-tool-name-validation.d.ts +4 -2
  5. package/dist/agent/mcp-tool-name-validation.js +2 -2
  6. package/dist/agent/mcp-tool-name-validation.js.map +1 -1
  7. package/dist/agent/runtime-workspace.d.ts +6 -0
  8. package/dist/agent/runtime-workspace.js +14 -0
  9. package/dist/agent/runtime-workspace.js.map +1 -0
  10. package/dist/agent/sanitize-mcp-schemas.d.ts +4 -3
  11. package/dist/agent/sanitize-mcp-schemas.js +53 -24
  12. package/dist/agent/sanitize-mcp-schemas.js.map +1 -1
  13. package/dist/agent/sub-agent-debriefing.d.ts +2 -2
  14. package/dist/agent/sub-agent-factory.d.ts +7 -4
  15. package/dist/agent/sub-agent-factory.js +24 -13
  16. package/dist/agent/sub-agent-factory.js.map +1 -1
  17. package/dist/agent/system-prompt.js +18 -15
  18. package/dist/agent/system-prompt.js.map +1 -1
  19. package/dist/build.tsbuildinfo +1 -1
  20. package/dist/constants/max-steps.d.ts +1 -1
  21. package/dist/constants/max-steps.js +1 -1
  22. package/dist/constants/max-steps.js.map +1 -1
  23. package/dist/domain-access/domain-gating.d.ts +2 -2
  24. package/dist/error-formatting.d.ts +1 -0
  25. package/dist/error-formatting.js +159 -0
  26. package/dist/error-formatting.js.map +1 -0
  27. package/dist/index.d.ts +65 -24
  28. package/dist/index.js +96 -52
  29. package/dist/index.js.map +1 -1
  30. package/dist/mcp/mcp-client-manager.d.ts +5 -4
  31. package/dist/mcp/mcp-client-manager.js +42 -17
  32. package/dist/mcp/mcp-client-manager.js.map +1 -1
  33. package/dist/memory/title-utils.d.ts +4 -1
  34. package/dist/memory/title-utils.js +10 -2
  35. package/dist/memory/title-utils.js.map +1 -1
  36. package/dist/parsers/structured-file-parser.d.ts +5 -2
  37. package/dist/parsers/structured-file-parser.js +9 -2
  38. package/dist/parsers/structured-file-parser.js.map +1 -1
  39. package/dist/planned-tasks/planned-task-permissions.js +3 -5
  40. package/dist/planned-tasks/planned-task-permissions.js.map +1 -1
  41. package/dist/planned-tasks/planned-task-service.d.ts +1 -0
  42. package/dist/planned-tasks/planned-task-service.js +8 -0
  43. package/dist/planned-tasks/planned-task-service.js.map +1 -1
  44. package/dist/runtime/background-task-manager.d.ts +9 -2
  45. package/dist/runtime/background-task-manager.js +7 -2
  46. package/dist/runtime/background-task-manager.js.map +1 -1
  47. package/dist/runtime/liveness-policy.js +4 -3
  48. package/dist/runtime/liveness-policy.js.map +1 -1
  49. package/dist/runtime/resumable-stream-executor.d.ts +4 -24
  50. package/dist/runtime/resumable-stream-executor.js +103 -1318
  51. package/dist/runtime/resumable-stream-executor.js.map +1 -1
  52. package/dist/runtime/run-state-registry.d.ts +8 -2
  53. package/dist/runtime/run-state-registry.js +19 -1
  54. package/dist/runtime/run-state-registry.js.map +1 -1
  55. package/dist/runtime/stream-runner.d.ts +4 -4
  56. package/dist/runtime/stream-runner.js +11 -25
  57. package/dist/runtime/stream-runner.js.map +1 -1
  58. package/dist/skills/materialize-runtime-skills.d.ts +62 -0
  59. package/dist/skills/materialize-runtime-skills.js +467 -0
  60. package/dist/skills/materialize-runtime-skills.js.map +1 -0
  61. package/dist/skills/runtime-skills.d.ts +4 -0
  62. package/dist/skills/runtime-skills.js +17 -0
  63. package/dist/skills/runtime-skills.js.map +1 -0
  64. package/dist/source-map-filter.d.ts +17 -0
  65. package/dist/source-map-filter.js +39 -0
  66. package/dist/source-map-filter.js.map +1 -0
  67. package/dist/storage/agent-tree-snapshot.d.ts +2 -0
  68. package/dist/storage/index.d.ts +3 -3
  69. package/dist/storage/index.js +8 -7
  70. package/dist/storage/index.js.map +1 -1
  71. package/dist/storage/planned-task-storage.d.ts +3 -3
  72. package/dist/storage/planned-task-storage.js +3 -8
  73. package/dist/storage/planned-task-storage.js.map +1 -1
  74. package/dist/storage/terminal-outcome-storage.d.ts +4 -4
  75. package/dist/storage/terminal-outcome-storage.js +1 -1
  76. package/dist/storage/terminal-outcome-storage.js.map +1 -1
  77. package/dist/storage/{mastra-iteration-log-storage.d.ts → thread-iteration-log-storage.d.ts} +3 -3
  78. package/dist/storage/{mastra-iteration-log-storage.js → thread-iteration-log-storage.js} +5 -5
  79. package/dist/storage/thread-iteration-log-storage.js.map +1 -0
  80. package/dist/storage/thread-patch.d.ts +16 -10
  81. package/dist/storage/thread-patch.js +37 -36
  82. package/dist/storage/thread-patch.js.map +1 -1
  83. package/dist/storage/{mastra-task-storage.d.ts → thread-task-storage.d.ts} +3 -3
  84. package/dist/storage/{mastra-task-storage.js → thread-task-storage.js} +5 -5
  85. package/dist/storage/thread-task-storage.js.map +1 -0
  86. package/dist/storage/workflow-loop-storage.d.ts +28 -28
  87. package/dist/storage/workflow-loop-storage.js +1 -1
  88. package/dist/storage/workflow-loop-storage.js.map +1 -1
  89. package/dist/stream/consume-with-hitl.d.ts +11 -11
  90. package/dist/stream/consume-with-hitl.js +27 -15
  91. package/dist/stream/consume-with-hitl.js.map +1 -1
  92. package/dist/stream/map-chunk.d.ts +1 -1
  93. package/dist/stream/map-chunk.js +153 -36
  94. package/dist/stream/map-chunk.js.map +1 -1
  95. package/dist/tool-registry.d.ts +8 -0
  96. package/dist/tool-registry.js +45 -0
  97. package/dist/tool-registry.js.map +1 -0
  98. package/dist/tools/attachments/parse-file.tool.d.ts +42 -45
  99. package/dist/tools/attachments/parse-file.tool.js +140 -97
  100. package/dist/tools/attachments/parse-file.tool.js.map +1 -1
  101. package/dist/tools/credentials.tool.d.ts +5 -5
  102. package/dist/tools/credentials.tool.js +31 -34
  103. package/dist/tools/credentials.tool.js.map +1 -1
  104. package/dist/tools/data-tables.tool.d.ts +3 -2
  105. package/dist/tools/data-tables.tool.js +99 -100
  106. package/dist/tools/data-tables.tool.js.map +1 -1
  107. package/dist/tools/evals/apply-pin-data.service.d.ts +3 -0
  108. package/dist/tools/evals/apply-pin-data.service.js +19 -0
  109. package/dist/tools/evals/apply-pin-data.service.js.map +1 -0
  110. package/dist/tools/evals/column-ref-utils.d.ts +3 -0
  111. package/dist/tools/evals/column-ref-utils.js +205 -48
  112. package/dist/tools/evals/column-ref-utils.js.map +1 -1
  113. package/dist/tools/evals/detect-agent-named-refs.service.js +20 -4
  114. package/dist/tools/evals/detect-agent-named-refs.service.js.map +1 -1
  115. package/dist/tools/evals/ensure-eval-data-table.service.d.ts +15 -0
  116. package/dist/tools/evals/ensure-eval-data-table.service.js +83 -0
  117. package/dist/tools/evals/ensure-eval-data-table.service.js.map +1 -0
  118. package/dist/tools/evals/eval-data-requirements.service.d.ts +1 -0
  119. package/dist/tools/evals/eval-data-requirements.service.js +23 -4
  120. package/dist/tools/evals/eval-data-requirements.service.js.map +1 -1
  121. package/dist/tools/evals/evals.tool.d.ts +2 -0
  122. package/dist/tools/evals/evals.tool.js +452 -0
  123. package/dist/tools/evals/evals.tool.js.map +1 -0
  124. package/dist/tools/evals/extract-rows-from-history.service.d.ts +17 -0
  125. package/dist/tools/evals/extract-rows-from-history.service.js +103 -0
  126. package/dist/tools/evals/extract-rows-from-history.service.js.map +1 -0
  127. package/dist/tools/evals/format-eval-setup-task.d.ts +16 -0
  128. package/dist/tools/evals/format-eval-setup-task.js +167 -0
  129. package/dist/tools/evals/format-eval-setup-task.js.map +1 -0
  130. package/dist/tools/evals/generate-sample-rows.service.d.ts +35 -0
  131. package/dist/tools/evals/generate-sample-rows.service.js +278 -0
  132. package/dist/tools/evals/generate-sample-rows.service.js.map +1 -0
  133. package/dist/tools/evals/generate-tool-ref-pin-data.service.d.ts +11 -0
  134. package/dist/tools/evals/generate-tool-ref-pin-data.service.js +125 -0
  135. package/dist/tools/evals/generate-tool-ref-pin-data.service.js.map +1 -0
  136. package/dist/tools/evals/metric-catalog.d.ts +10 -4
  137. package/dist/tools/evals/metric-catalog.js.map +1 -1
  138. package/dist/tools/executions.tool.d.ts +1 -1
  139. package/dist/tools/executions.tool.js +25 -34
  140. package/dist/tools/executions.tool.js.map +1 -1
  141. package/dist/tools/filesystem/create-tools-from-mcp-server.d.ts +2 -3
  142. package/dist/tools/filesystem/create-tools-from-mcp-server.js +129 -67
  143. package/dist/tools/filesystem/create-tools-from-mcp-server.js.map +1 -1
  144. package/dist/tools/index.d.ts +4 -16
  145. package/dist/tools/index.js +102 -92
  146. package/dist/tools/index.js.map +1 -1
  147. package/dist/tools/nodes.tool.d.ts +1 -1
  148. package/dist/tools/nodes.tool.js +31 -33
  149. package/dist/tools/nodes.tool.js.map +1 -1
  150. package/dist/tools/orchestration/add-plan-item.tool.d.ts +2 -2
  151. package/dist/tools/orchestration/add-plan-item.tool.js +45 -49
  152. package/dist/tools/orchestration/add-plan-item.tool.js.map +1 -1
  153. package/dist/tools/orchestration/agent-persistence.d.ts +14 -0
  154. package/dist/tools/orchestration/agent-persistence.js +43 -0
  155. package/dist/tools/orchestration/agent-persistence.js.map +1 -0
  156. package/dist/tools/orchestration/blueprint-accumulator.d.ts +4 -8
  157. package/dist/tools/orchestration/blueprint-accumulator.js +11 -78
  158. package/dist/tools/orchestration/blueprint-accumulator.js.map +1 -1
  159. package/dist/tools/orchestration/blueprint.schema.d.ts +13 -147
  160. package/dist/tools/orchestration/blueprint.schema.js +4 -23
  161. package/dist/tools/orchestration/blueprint.schema.js.map +1 -1
  162. package/dist/tools/orchestration/browser-credential-setup.nudge.d.ts +2 -4
  163. package/dist/tools/orchestration/browser-credential-setup.nudge.js +1 -1
  164. package/dist/tools/orchestration/browser-credential-setup.nudge.js.map +1 -1
  165. package/dist/tools/orchestration/browser-credential-setup.tool.d.ts +10 -2
  166. package/dist/tools/orchestration/browser-credential-setup.tool.js +299 -270
  167. package/dist/tools/orchestration/browser-credential-setup.tool.js.map +1 -1
  168. package/dist/tools/orchestration/build-workflow-agent.prompt.d.ts +7 -1
  169. package/dist/tools/orchestration/build-workflow-agent.prompt.js +46 -20
  170. package/dist/tools/orchestration/build-workflow-agent.prompt.js.map +1 -1
  171. package/dist/tools/orchestration/build-workflow-agent.tool.d.ts +50 -5
  172. package/dist/tools/orchestration/build-workflow-agent.tool.js +748 -605
  173. package/dist/tools/orchestration/build-workflow-agent.tool.js.map +1 -1
  174. package/dist/tools/orchestration/builder-memory-compaction.d.ts +6 -2
  175. package/dist/tools/orchestration/builder-memory-compaction.js +32 -46
  176. package/dist/tools/orchestration/builder-memory-compaction.js.map +1 -1
  177. package/dist/tools/orchestration/complete-checkpoint.tool.d.ts +1 -1
  178. package/dist/tools/orchestration/complete-checkpoint.tool.js +46 -47
  179. package/dist/tools/orchestration/complete-checkpoint.tool.js.map +1 -1
  180. package/dist/tools/orchestration/delegate.tool.d.ts +1 -1
  181. package/dist/tools/orchestration/delegate.tool.js +170 -166
  182. package/dist/tools/orchestration/delegate.tool.js.map +1 -1
  183. package/dist/tools/orchestration/eval-data-agent.tool.d.ts +2 -0
  184. package/dist/tools/orchestration/eval-data-agent.tool.js +183 -0
  185. package/dist/tools/orchestration/eval-data-agent.tool.js.map +1 -0
  186. package/dist/tools/orchestration/eval-setup-agent.prompt.d.ts +1 -0
  187. package/dist/tools/orchestration/eval-setup-agent.prompt.js +238 -0
  188. package/dist/tools/orchestration/eval-setup-agent.prompt.js.map +1 -0
  189. package/dist/tools/orchestration/eval-setup-agent.tool.d.ts +31 -0
  190. package/dist/tools/orchestration/eval-setup-agent.tool.js +204 -0
  191. package/dist/tools/orchestration/eval-setup-agent.tool.js.map +1 -0
  192. package/dist/tools/orchestration/plan-agent-prompt.d.ts +1 -1
  193. package/dist/tools/orchestration/plan-agent-prompt.js +9 -9
  194. package/dist/tools/orchestration/plan-with-agent.tool.d.ts +1 -1
  195. package/dist/tools/orchestration/plan-with-agent.tool.js +210 -179
  196. package/dist/tools/orchestration/plan-with-agent.tool.js.map +1 -1
  197. package/dist/tools/orchestration/plan.tool.d.ts +5 -2
  198. package/dist/tools/orchestration/plan.tool.js +125 -105
  199. package/dist/tools/orchestration/plan.tool.js.map +1 -1
  200. package/dist/tools/orchestration/report-verification-verdict.tool.d.ts +3 -3
  201. package/dist/tools/orchestration/report-verification-verdict.tool.js +65 -66
  202. package/dist/tools/orchestration/report-verification-verdict.tool.js.map +1 -1
  203. package/dist/tools/orchestration/submit-plan.tool.d.ts +1 -1
  204. package/dist/tools/orchestration/submit-plan.tool.js +83 -66
  205. package/dist/tools/orchestration/submit-plan.tool.js.map +1 -1
  206. package/dist/tools/orchestration/tracing-utils.d.ts +3 -2
  207. package/dist/tools/orchestration/tracing-utils.js +58 -39
  208. package/dist/tools/orchestration/tracing-utils.js.map +1 -1
  209. package/dist/tools/orchestration/verify-built-workflow.tool.d.ts +5 -5
  210. package/dist/tools/orchestration/verify-built-workflow.tool.js +166 -166
  211. package/dist/tools/orchestration/verify-built-workflow.tool.js.map +1 -1
  212. package/dist/tools/research.tool.d.ts +1 -1
  213. package/dist/tools/research.tool.js +59 -27
  214. package/dist/tools/research.tool.js.map +1 -1
  215. package/dist/tools/shared/ask-user.tool.d.ts +3 -2
  216. package/dist/tools/shared/ask-user.tool.js +61 -63
  217. package/dist/tools/shared/ask-user.tool.js.map +1 -1
  218. package/dist/tools/task-control.tool.d.ts +1 -1
  219. package/dist/tools/task-control.tool.js +15 -16
  220. package/dist/tools/task-control.tool.js.map +1 -1
  221. package/dist/tools/templates.tool.d.ts +1 -1
  222. package/dist/tools/templates.tool.js +6 -7
  223. package/dist/tools/templates.tool.js.map +1 -1
  224. package/dist/tools/tool-ids.d.ts +40 -0
  225. package/dist/tools/tool-ids.js +62 -0
  226. package/dist/tools/tool-ids.js.map +1 -0
  227. package/dist/tools/workflows/apply-workflow-credentials.tool.d.ts +3 -3
  228. package/dist/tools/workflows/apply-workflow-credentials.tool.js +72 -73
  229. package/dist/tools/workflows/apply-workflow-credentials.tool.js.map +1 -1
  230. package/dist/tools/workflows/build-workflow.tool.d.ts +3 -3
  231. package/dist/tools/workflows/build-workflow.tool.js +113 -114
  232. package/dist/tools/workflows/build-workflow.tool.js.map +1 -1
  233. package/dist/tools/workflows/materialize-node-type.tool.d.ts +6 -6
  234. package/dist/tools/workflows/materialize-node-type.tool.js +64 -65
  235. package/dist/tools/workflows/materialize-node-type.tool.js.map +1 -1
  236. package/dist/tools/workflows/resolve-credentials.d.ts +3 -5
  237. package/dist/tools/workflows/resolve-credentials.js +15 -6
  238. package/dist/tools/workflows/resolve-credentials.js.map +1 -1
  239. package/dist/tools/workflows/setup-workflow.schema.d.ts +2 -2
  240. package/dist/tools/workflows/submit-workflow-identity.d.ts +8 -9
  241. package/dist/tools/workflows/submit-workflow-identity.js +41 -27
  242. package/dist/tools/workflows/submit-workflow-identity.js.map +1 -1
  243. package/dist/tools/workflows/submit-workflow.tool.d.ts +10 -7
  244. package/dist/tools/workflows/submit-workflow.tool.js +224 -191
  245. package/dist/tools/workflows/submit-workflow.tool.js.map +1 -1
  246. package/dist/tools/workflows/validate-workflow.service.d.ts +15 -0
  247. package/dist/tools/workflows/validate-workflow.service.js +289 -0
  248. package/dist/tools/workflows/validate-workflow.service.js.map +1 -0
  249. package/dist/tools/workflows/write-sandbox-file.tool.d.ts +2 -2
  250. package/dist/tools/workflows/write-sandbox-file.tool.js +29 -30
  251. package/dist/tools/workflows/write-sandbox-file.tool.js.map +1 -1
  252. package/dist/tools/workflows.tool.d.ts +5 -2
  253. package/dist/tools/workflows.tool.js +184 -85
  254. package/dist/tools/workflows.tool.js.map +1 -1
  255. package/dist/tools/workspace.tool.d.ts +1 -1
  256. package/dist/tools/workspace.tool.js +49 -65
  257. package/dist/tools/workspace.tool.js.map +1 -1
  258. package/dist/tracing/langsmith-tracing.d.ts +17 -18
  259. package/dist/tracing/langsmith-tracing.js +941 -677
  260. package/dist/tracing/langsmith-tracing.js.map +1 -1
  261. package/dist/tracing/trace-labels.d.ts +5 -0
  262. package/dist/tracing/trace-labels.js +36 -0
  263. package/dist/tracing/trace-labels.js.map +1 -0
  264. package/dist/tracing/trace-payloads.d.ts +23 -0
  265. package/dist/tracing/trace-payloads.js +1008 -0
  266. package/dist/tracing/trace-payloads.js.map +1 -0
  267. package/dist/types.d.ts +57 -25
  268. package/dist/types.js +3 -0
  269. package/dist/types.js.map +1 -1
  270. package/dist/utils/eval-agents.js +1 -1
  271. package/dist/utils/eval-agents.js.map +1 -1
  272. package/dist/utils/scrub-secrets.js +1 -1
  273. package/dist/utils/scrub-secrets.js.map +1 -1
  274. package/dist/utils/stream-helpers.d.ts +2 -5
  275. package/dist/utils/stream-helpers.js +12 -1
  276. package/dist/utils/stream-helpers.js.map +1 -1
  277. package/dist/workflow-loop/workflow-loop-state.d.ts +18 -18
  278. package/dist/workspace/builder-templates-service.d.ts +54 -0
  279. package/dist/workspace/builder-templates-service.js +442 -0
  280. package/dist/workspace/builder-templates-service.js.map +1 -0
  281. package/dist/workspace/create-workspace.d.ts +16 -3
  282. package/dist/workspace/create-workspace.js +45 -21
  283. package/dist/workspace/create-workspace.js.map +1 -1
  284. package/dist/workspace/daytona-auth-manager.d.ts +26 -0
  285. package/dist/workspace/daytona-auth-manager.js +90 -0
  286. package/dist/workspace/daytona-auth-manager.js.map +1 -0
  287. package/dist/workspace/daytona-filesystem.d.ts +5 -4
  288. package/dist/workspace/daytona-filesystem.js +25 -15
  289. package/dist/workspace/daytona-filesystem.js.map +1 -1
  290. package/dist/workspace/daytona-sandbox.d.ts +65 -0
  291. package/dist/workspace/daytona-sandbox.js +314 -0
  292. package/dist/workspace/daytona-sandbox.js.map +1 -0
  293. package/dist/workspace/lazy-daytona.d.ts +2 -0
  294. package/dist/workspace/lazy-daytona.js +12 -0
  295. package/dist/workspace/lazy-daytona.js.map +1 -0
  296. package/dist/workspace/lazy-runtime-workspace.d.ts +8 -0
  297. package/dist/workspace/lazy-runtime-workspace.js +246 -0
  298. package/dist/workspace/lazy-runtime-workspace.js.map +1 -0
  299. package/dist/workspace/local-filesystem.d.ts +48 -0
  300. package/dist/workspace/local-filesystem.js +250 -0
  301. package/dist/workspace/local-filesystem.js.map +1 -0
  302. package/dist/workspace/local-sandbox.d.ts +28 -0
  303. package/dist/workspace/local-sandbox.js +121 -0
  304. package/dist/workspace/local-sandbox.js.map +1 -0
  305. package/dist/workspace/n8n-sandbox-filesystem.d.ts +3 -3
  306. package/dist/workspace/n8n-sandbox-filesystem.js +3 -3
  307. package/dist/workspace/n8n-sandbox-filesystem.js.map +1 -1
  308. package/dist/workspace/n8n-sandbox-sandbox.d.ts +12 -3
  309. package/dist/workspace/n8n-sandbox-sandbox.js +54 -10
  310. package/dist/workspace/n8n-sandbox-sandbox.js.map +1 -1
  311. package/dist/workspace/sandbox-fs.d.ts +35 -4
  312. package/dist/workspace/sandbox-fs.js +1 -1
  313. package/dist/workspace/sandbox-fs.js.map +1 -1
  314. package/dist/workspace/sandbox-setup.d.ts +13 -4
  315. package/dist/workspace/sandbox-setup.js +250 -36
  316. package/dist/workspace/sandbox-setup.js.map +1 -1
  317. package/dist/workspace/scoped-workspace.d.ts +2 -0
  318. package/dist/workspace/scoped-workspace.js +141 -0
  319. package/dist/workspace/scoped-workspace.js.map +1 -0
  320. package/dist/workspace/snapshot-manager.d.ts +11 -5
  321. package/dist/workspace/snapshot-manager.js +64 -17
  322. package/dist/workspace/snapshot-manager.js.map +1 -1
  323. package/dist/workspace/template-telemetry.d.ts +4 -4
  324. package/dist/workspace/template-telemetry.js +18 -6
  325. package/dist/workspace/template-telemetry.js.map +1 -1
  326. package/package.json +12 -15
  327. package/skills/data-table-manager/SKILL.md +119 -0
  328. package/skills/data-table-manager/references/data-table-playbook.md +212 -0
  329. package/dist/agent/register-with-mastra.d.ts +0 -3
  330. package/dist/agent/register-with-mastra.js +0 -15
  331. package/dist/agent/register-with-mastra.js.map +0 -1
  332. package/dist/compaction/compaction-helper.d.ts +0 -9
  333. package/dist/compaction/compaction-helper.js +0 -58
  334. package/dist/compaction/compaction-helper.js.map +0 -1
  335. package/dist/compaction/index.d.ts +0 -2
  336. package/dist/compaction/index.js +0 -6
  337. package/dist/compaction/index.js.map +0 -1
  338. package/dist/memory/memory-config.d.ts +0 -3
  339. package/dist/memory/memory-config.js +0 -27
  340. package/dist/memory/memory-config.js.map +0 -1
  341. package/dist/runtime/builder-sandbox-session-registry.d.ts +0 -47
  342. package/dist/runtime/builder-sandbox-session-registry.js +0 -166
  343. package/dist/runtime/builder-sandbox-session-registry.js.map +0 -1
  344. package/dist/storage/mastra-iteration-log-storage.js.map +0 -1
  345. package/dist/storage/mastra-task-storage.js.map +0 -1
  346. package/dist/tools/orchestration/data-table-agent.prompt.d.ts +0 -1
  347. package/dist/tools/orchestration/data-table-agent.prompt.js +0 -47
  348. package/dist/tools/orchestration/data-table-agent.prompt.js.map +0 -1
  349. package/dist/tools/orchestration/data-table-agent.tool.d.ts +0 -26
  350. package/dist/tools/orchestration/data-table-agent.tool.js +0 -174
  351. package/dist/tools/orchestration/data-table-agent.tool.js.map +0 -1
  352. package/dist/tools/orchestration/research-agent-prompt.d.ts +0 -1
  353. package/dist/tools/orchestration/research-agent-prompt.js +0 -26
  354. package/dist/tools/orchestration/research-agent-prompt.js.map +0 -1
  355. package/dist/tools/orchestration/research-with-agent.tool.d.ts +0 -30
  356. package/dist/tools/orchestration/research-with-agent.tool.js +0 -179
  357. package/dist/tools/orchestration/research-with-agent.tool.js.map +0 -1
  358. package/dist/workspace/builder-sandbox-factory.d.ts +0 -30
  359. package/dist/workspace/builder-sandbox-factory.js +0 -289
  360. package/dist/workspace/builder-sandbox-factory.js.map +0 -1
  361. package/dist/workspace/guarded-filesystem.d.ts +0 -10
  362. package/dist/workspace/guarded-filesystem.js +0 -136
  363. package/dist/workspace/guarded-filesystem.js.map +0 -1
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.evalSetupAgentInputSchema = void 0;
4
+ exports.buildEvalSetupTools = buildEvalSetupTools;
5
+ exports.startEvalSetupAgentTask = startEvalSetupAgentTask;
6
+ exports.createEvalSetupAgentTool = createEvalSetupAgentTool;
7
+ const agents_1 = require("@n8n/agents");
8
+ const nanoid_1 = require("nanoid");
9
+ const zod_1 = require("zod");
10
+ const agent_persistence_1 = require("./agent-persistence");
11
+ const display_utils_1 = require("./display-utils");
12
+ const eval_setup_agent_prompt_1 = require("./eval-setup-agent.prompt");
13
+ const tracing_utils_1 = require("./tracing-utils");
14
+ const sub_agent_briefing_1 = require("../../agent/sub-agent-briefing");
15
+ const max_steps_1 = require("../../constants/max-steps");
16
+ const consume_with_hitl_1 = require("../../stream/consume-with-hitl");
17
+ const tool_registry_1 = require("../../tool-registry");
18
+ const langsmith_tracing_1 = require("../../tracing/langsmith-tracing");
19
+ const workflows_tool_1 = require("../workflows.tool");
20
+ const EVAL_SETUP_TOOL_NAMES = ['workflows', 'nodes'];
21
+ const EVAL_SETUP_WORKFLOW_ACTIONS = [
22
+ 'get-json',
23
+ 'update',
24
+ ];
25
+ function buildEvalSetupTools(context) {
26
+ const tools = (0, tool_registry_1.createToolRegistry)();
27
+ for (const name of EVAL_SETUP_TOOL_NAMES) {
28
+ const tool = context.domainTools.get(name);
29
+ if (tool) {
30
+ tools.set(name, tool);
31
+ }
32
+ }
33
+ const domainContext = context.domainContext;
34
+ const parentPermissions = domainContext?.permissions;
35
+ if (domainContext &&
36
+ parentPermissions &&
37
+ parentPermissions.updateWorkflow !== 'blocked' &&
38
+ tools.has('workflows')) {
39
+ tools.set('workflows', (0, workflows_tool_1.createWorkflowsTool)({
40
+ ...domainContext,
41
+ permissions: { ...parentPermissions, updateWorkflow: 'always_allow' },
42
+ }, { allowedActions: EVAL_SETUP_WORKFLOW_ACTIONS }));
43
+ }
44
+ return tools;
45
+ }
46
+ function startEvalSetupAgentTask(context, input) {
47
+ const evalSetupTools = buildEvalSetupTools(context);
48
+ if (!evalSetupTools.has('workflows')) {
49
+ return { result: 'Error: workflows tool not available.', taskId: '', agentId: '' };
50
+ }
51
+ if (!context.spawnBackgroundTask) {
52
+ return { result: 'Error: background task support not available.', taskId: '', agentId: '' };
53
+ }
54
+ const subAgentId = input.agentId ?? `agent-evalsetup-${(0, nanoid_1.nanoid)(6)}`;
55
+ const taskId = input.taskId ?? `evalsetup-${(0, nanoid_1.nanoid)(8)}`;
56
+ const createTraceContext = (0, tracing_utils_1.createDetachedSubAgentTraceFactory)(context, {
57
+ agentId: subAgentId,
58
+ role: 'eval-setup',
59
+ kind: 'eval-setup',
60
+ taskId,
61
+ plannedTaskId: input.plannedTaskId,
62
+ inputs: {
63
+ workflowId: input.workflowId,
64
+ task: input.task,
65
+ conversationContext: input.conversationContext,
66
+ },
67
+ });
68
+ const tracedEvalSetupTools = (0, tracing_utils_1.traceSubAgentTools)(context, evalSetupTools, 'eval-setup');
69
+ const spawnOutcome = context.spawnBackgroundTask({
70
+ taskId,
71
+ threadId: context.threadId,
72
+ agentId: subAgentId,
73
+ role: 'eval-setup',
74
+ createTraceContext,
75
+ plannedTaskId: input.plannedTaskId,
76
+ dedupeKey: {
77
+ role: 'eval-setup',
78
+ workflowId: input.workflowId,
79
+ plannedTaskId: input.plannedTaskId,
80
+ },
81
+ parentCheckpointId: context.isCheckpointFollowUp === true ? context.checkpointTaskId : undefined,
82
+ run: async (signal, drainCorrections, waitForCorrection, { traceContext }) => {
83
+ return await (0, tracing_utils_1.withTraceContextActor)(traceContext, async () => {
84
+ const subAgent = new agents_1.Agent('Eval Setup Agent')
85
+ .model(context.modelId)
86
+ .instructions(eval_setup_agent_prompt_1.EVAL_SETUP_AGENT_PROMPT, {
87
+ providerOptions: {
88
+ anthropic: { cacheControl: { type: 'ephemeral' } },
89
+ },
90
+ })
91
+ .tool((0, tool_registry_1.toolRegistryValues)(tracedEvalSetupTools))
92
+ .checkpoint(context.checkpointStore ?? 'memory');
93
+ const telemetry = traceContext?.getTelemetry?.({
94
+ agentRole: 'eval-setup',
95
+ functionId: 'instance-ai.subagent.eval-setup',
96
+ executionMode: 'background_subagent',
97
+ metadata: { agent_id: subAgentId, task_id: taskId },
98
+ });
99
+ if (telemetry) {
100
+ subAgent.telemetry(telemetry);
101
+ }
102
+ (0, langsmith_tracing_1.mergeTraceRunInputs)(traceContext?.actorRun, (0, langsmith_tracing_1.buildAgentTraceInputs)({
103
+ systemPrompt: eval_setup_agent_prompt_1.EVAL_SETUP_AGENT_PROMPT,
104
+ tools: tracedEvalSetupTools,
105
+ modelId: context.modelId,
106
+ }));
107
+ const briefing = await (0, sub_agent_briefing_1.buildSubAgentBriefing)({
108
+ task: input.task,
109
+ conversationContext: input.conversationContext,
110
+ runningTasks: context.getRunningTaskSummaries?.(),
111
+ });
112
+ const persistence = await (0, agent_persistence_1.createSubAgentPersistence)(context, { agentKind: 'eval-setup' });
113
+ const stream = await subAgent.stream(briefing, {
114
+ maxIterations: max_steps_1.MAX_STEPS.EVAL_SETUP,
115
+ abortSignal: signal,
116
+ persistence,
117
+ providerOptions: {
118
+ anthropic: { cacheControl: { type: 'ephemeral' } },
119
+ },
120
+ });
121
+ const hitlResult = await (0, consume_with_hitl_1.consumeStreamWithHitl)({
122
+ agent: subAgent,
123
+ stream,
124
+ runId: context.runId,
125
+ agentId: subAgentId,
126
+ eventBus: context.eventBus,
127
+ logger: context.logger,
128
+ threadId: context.threadId,
129
+ abortSignal: signal,
130
+ waitForConfirmation: context.waitForConfirmation,
131
+ drainCorrections,
132
+ waitForCorrection,
133
+ maxIterations: max_steps_1.MAX_STEPS.EVAL_SETUP,
134
+ persistence,
135
+ });
136
+ return await (0, consume_with_hitl_1.requireCompletedHitlText)(hitlResult, 'Eval setup sub-agent');
137
+ });
138
+ },
139
+ });
140
+ if (spawnOutcome.status === 'duplicate') {
141
+ return {
142
+ result: `Eval setup already in progress (task: ${spawnOutcome.existing.taskId}). Wait for the planned-task-follow-up — do not dispatch again.`,
143
+ taskId: spawnOutcome.existing.taskId,
144
+ agentId: spawnOutcome.existing.agentId,
145
+ };
146
+ }
147
+ if (spawnOutcome.status === 'limit-reached') {
148
+ return {
149
+ result: 'Could not start eval setup: concurrent background-task limit reached. Wait for an existing task to finish and try again.',
150
+ taskId: '',
151
+ agentId: '',
152
+ };
153
+ }
154
+ context.eventBus.publish(context.threadId, {
155
+ type: 'agent-spawned',
156
+ runId: context.runId,
157
+ agentId: subAgentId,
158
+ payload: {
159
+ parentId: context.orchestratorAgentId,
160
+ role: 'eval-setup',
161
+ tools: (0, tool_registry_1.toolRegistryKeys)(evalSetupTools),
162
+ taskId,
163
+ kind: 'eval-setup',
164
+ title: 'Setting up evaluations',
165
+ subtitle: (0, display_utils_1.truncateLabel)(input.task),
166
+ goal: input.task,
167
+ targetResource: { type: 'workflow', id: input.workflowId },
168
+ },
169
+ });
170
+ return {
171
+ result: `Eval setup started (task: ${taskId}). Reply with one short sentence. Do NOT summarize the plan or list details.`,
172
+ taskId,
173
+ agentId: subAgentId,
174
+ };
175
+ }
176
+ exports.evalSetupAgentInputSchema = zod_1.z.object({
177
+ workflowId: zod_1.z.string().describe('ID of the workflow to add evaluations to'),
178
+ task: zod_1.z
179
+ .string()
180
+ .describe('Full task description for the eval setup agent: includes dataset choice, output columns, metrics to configure, and detected AI agent nodes. Pass the exact string returned by `evals(action="propose")` — do not rephrase.'),
181
+ conversationContext: zod_1.z
182
+ .string()
183
+ .optional()
184
+ .describe("Summary of the thread so far, especially the user's original workflow request. The sub-agent uses this to anchor the domain for dataset design."),
185
+ });
186
+ function createEvalSetupAgentTool(context) {
187
+ return new agents_1.Tool('eval-setup-with-agent')
188
+ .description('Set up evaluations for a workflow containing AI agents. ' +
189
+ 'Adds EvaluationTrigger + Evaluation nodes with a checkIfEvaluating gate that isolates ' +
190
+ 'side-effect nodes during eval runs. The DataTable is always created upstream by `propose` ' +
191
+ 'and passed in via the task spec. ' +
192
+ 'Use only after `evals(action="propose")` returned shouldDelegateToEvalSetupAgent=true.')
193
+ .input(exports.evalSetupAgentInputSchema)
194
+ .output(zod_1.z.object({
195
+ result: zod_1.z.string(),
196
+ taskId: zod_1.z.string(),
197
+ }))
198
+ .handler(async (input) => {
199
+ const result = startEvalSetupAgentTask(context, input);
200
+ return await Promise.resolve({ result: result.result, taskId: result.taskId });
201
+ })
202
+ .build();
203
+ }
204
+ //# sourceMappingURL=eval-setup-agent.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eval-setup-agent.tool.js","sourceRoot":"","sources":["../../../src/tools/orchestration/eval-setup-agent.tool.ts"],"names":[],"mappings":";;;AA+CA,kDA6BC;AAiBD,0DAmJC;AAiBD,4DAqBC;AA1QD,wCAA0C;AAC1C,mCAAgC;AAChC,6BAAwB;AAExB,2DAAgE;AAChE,mDAAgD;AAChD,uEAAoE;AACpE,mDAIyB;AACzB,uEAAuE;AACvE,yDAAsD;AACtD,sEAAiG;AACjG,uDAA+F;AAC/F,uEAA6F;AAE7F,sDAA6E;AAE7E,MAAM,qBAAqB,GAAG,CAAC,WAAW,EAAE,OAAO,CAAU,CAAC;AAC9D,MAAM,2BAA2B,GAAG;IACnC,UAAU;IACV,QAAQ;CACqC,CAAC;AAW/C,SAAgB,mBAAmB,CAAC,OAA6B;IAChE,MAAM,KAAK,GAAG,IAAA,kCAAkB,GAAE,CAAC;IACnC,KAAK,MAAM,IAAI,IAAI,qBAAqB,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,IAAI,EAAE,CAAC;YACV,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACvB,CAAC;IACF,CAAC;IAED,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAC5C,MAAM,iBAAiB,GAAG,aAAa,EAAE,WAAW,CAAC;IACrD,IACC,aAAa;QACb,iBAAiB;QACjB,iBAAiB,CAAC,cAAc,KAAK,SAAS;QAC9C,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,EACrB,CAAC;QACF,KAAK,CAAC,GAAG,CACR,WAAW,EACX,IAA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E;QACzH,MAAM;QACN,OAAO,EAAE,UAAU;KACnB,CAAC;AACH,CAAC;AAEY,QAAA,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;IAC3E,IAAI,EAAE,OAAC;SACL,MAAM,EAAE;SACR,QAAQ,CACR,4NAA4N,CAC5N;IACF,mBAAmB,EAAE,OAAC;SACpB,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACR,iJAAiJ,CACjJ;CACF,CAAC,CAAC;AAEH,SAAgB,wBAAwB,CAAC,OAA6B;IACrE,OAAO,IAAI,aAAI,CAAC,uBAAuB,CAAC;SACtC,WAAW,CACX,0DAA0D;QACzD,wFAAwF;QACxF,4FAA4F;QAC5F,mCAAmC;QACnC,wFAAwF,CACzF;SACA,KAAK,CAAC,iCAAyB,CAAC;SAChC,MAAM,CACN,OAAC,CAAC,MAAM,CAAC;QACR,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;QAClB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;KAClB,CAAC,CACF;SACA,OAAO,CAAC,KAAK,EAAE,KAAgD,EAAE,EAAE;QACnE,MAAM,MAAM,GAAG,uBAAuB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACvD,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAChF,CAAC,CAAC;SACD,KAAK,EAAE,CAAC;AACX,CAAC"}
@@ -1 +1 @@
1
- export declare const PLANNER_AGENT_PROMPT = "You are the n8n Workflow Planner \u2014 you design solution architectures. You do NOT build workflows.\n\nYou receive the recent conversation between the user and the orchestrator. Read it to understand what the user wants, then design the blueprint.\n\n## Output Discipline\n- You report to a parent agent, not a human. Be terse.\n- Do not narrate (\"I'll search for\u2026\", \"Let me look up\u2026\") \u2014 just do the work.\n- No emojis, filler phrases, or markdown headers in your text output.\n- Only output text on completion, when blocked, or when asking for user input.\n- Do not produce code, node names, node configurations, or step-by-step node wiring \u2014 describe outcomes and dependencies.\n\n## Method\n\n1. **Prefer assumptions over questions.** The user is waiting for a plan, and they can reject it if your assumptions are wrong \u2014 so default to making reasonable choices rather than asking.\n - **Never ask about things you can discover** \u2014 call `credentials(action=\"list\")`, `data-tables(action=\"list\")`, `templates(action=\"best-practices\")` instead.\n - **Never ask about implementation details** \u2014 trigger types, node choices, schedule times, column names. Pick sensible defaults.\n - **Never ask for the user's timezone when `<user-timezone>` is present** \u2014 use `<current-datetime>` / `<user-timezone>`. Only ask if timezone is missing and a date or schedule cannot be interpreted safely.\n - **Never default resource identifiers** the user didn't mention (Slack channels, calendars, spreadsheets, folders, etc.) \u2014 leave them for the builder to resolve at build time.\n - **Trust already-collected briefing context** \u2014 if the briefing includes an Already-collected answers or Already-discovered resources section, treat those entries as authoritative. Do not ask again for purpose, trigger, integrations, schedule, model, resource, or credential choices already listed there.\n - **Do ask when the answer would significantly change the plan** \u2014 e.g. the user's goal is ambiguous (\"build me a CRM\" \u2014 for sales? support? recruiting?), or a business rule must come from the user (\"what should happen when payment fails?\").\n - **Handle credentials without blocking planning.** Call `credentials(action=\"list\")` for external services, then apply these cases:\n - If the user already named a credential in their request, use it directly and record the credential name in `assumptions`.\n - If there is exactly one matching credential for a required type, auto-select it, do not ask, and record the credential name in `assumptions`.\n - If there are no matching credentials, do not ask; plan normally and note that the builder will use a mocked or unresolved credential and route setup after verification. Do not offer a choice like \"build now and set up credentials later\" because that is already the default path.\n - If there is more than one credential of the same required type and the user did not name one, ask once with a single-select because the choice cannot be discovered, only chosen. Record the chosen credential name in `assumptions`.\n - **Use credential-backed resource investigation only when it changes the plan.** You may call `credentials(action=\"list\")` so a later resource lookup can validate a resource that affects the architecture (for example checking whether a named Slack channel exists). Do not turn that into a credential-choice question unless the multiple-credentials rule above applies.\n - **List your assumptions** on your first `add-plan-item` call. The user reviews the plan before execution and can reject/correct.\n\n2. **Discover** \u2014 check what exists and learn best practices. Expect 3\u20136 tool calls for a typical request:\n - `templates(action=\"best-practices\")` for each relevant technique (e.g. \"form_input\", \"scheduling\", \"data_persistence\", \"web_app\"). Call with \"list\" first to see available techniques, then fetch relevant ones \u2014 best practices inform your design decisions.\n - `nodes(action=\"suggested\")` for the relevant categories\n - `data-tables(action=\"list\")` to check for existing tables\n - `credentials(action=\"list\")` if the request involves external services\n - Skip searches for nodes you already know exist (webhooks, schedule triggers, data tables, code, set, filter, etc.)\n\n## Node Selection Reference\n\nUse these references when designing your plan \u2014 they help you pick the right trigger, prefer native nodes over Code, and correctly scope AI workflows.\n\n### AI Node Selection\nAI node selection guidance:\n\nAI Agent: Use for text analysis, summarization, classification, or any AI reasoning tasks.\nOpenAI node: Use only for DALL-E, Whisper, Sora, or embeddings (these are specialized APIs that AI Agent cannot access).\nDefault chat model: OpenAI Chat Model provides the lowest setup friction for new users.\nTool nodes (ending in \"Tool\"): Connect to AI Agent via tool() for agent-controlled actions.\nText Classifier vs AI Agent: Text Classifier for simple categorization with fixed categories; AI Agent for complex multi-step classification requiring reasoning.\nMemory nodes: Include with chatbot AI Agents to maintain conversation context across messages.\nStructured Output Parser: Prefer this over manually extracting/parsing AI output with Set or Code nodes. Define the desired schema and the LLM handles parsing automatically. Use for classification, data extraction, or any workflow where AI output feeds into database storage, API calls, or Switch routing.\n\nMulti-agent systems:\nAI Agent Tool (@n8n/n8n-nodes-langchain.agentTool) contains an embedded AI Agent \u2014 it's a complete sub-agent that the main agent can call through tool(). Each AgentTool needs its own Chat Model. Node selection: 1 AI Agent + N AgentTools + (N+1) Chat Models.\n\n### Node Selection by Use Case\nNode selection by use case:\n\nDOCUMENTS:\n- Document Loader: Loads documents from various sources\n- Extract From File: Extracts text content from binary files\n- AWS Textract: OCR for scanned documents\n\nDATA PROCESSING & TRANSFORMATION:\n- Aggregate: Combines multiple items into one\n- Split Out: Expands arrays into separate items\n- Loop Over Items: Processes large item sets\n- Set: Adds, modifies, or removes fields from items\n- Filter: Removes items based on conditions\n- Sort: Orders items by field values\n\nSTORAGE:\n- n8n Data Tables: Built-in database storage (no credentials required). Recommend as the default storage option.\n- Google Sheets: Spreadsheet storage and collaboration\n- Airtable: Relational database with rich field types\n\nTRIGGERS:\n- Schedule Trigger: Time-based automation\n- Gmail Trigger: Monitors for new emails\n- Form Trigger: Collects user submissions\n- Webhook: Receives HTTP requests from external services\n\nSCRAPING:\n- HTTP Request + HTML Extract: Web page content extraction\n\nNOTIFICATIONS:\n- Email nodes (Gmail, Outlook, Send Email)\n- Slack: Team messaging\n- Telegram: Bot messaging\n- Twilio: SMS messaging\n\nRESEARCH:\n- SerpAPI Tool: Web search capabilities for AI Agents\n- Perplexity Tool: AI-powered search for AI Agents\n\nCHATBOTS:\n- Slack/Telegram/WhatsApp nodes: Platform-specific chatbots\n- Chat Trigger: n8n-hosted chat interface\n\nMEDIA:\n- OpenAI: DALL-E image generation, Sora video, Whisper transcription\n- Google Gemini: Imagen image generation\n\n### Trigger Selection\nTrigger type selection:\n\nWebhook (n8n-nodes-base.webhook): External systems calling your workflow via HTTP POST/GET.\n Use when: \"receive data from X\", \"when X calls\", \"API endpoint\", \"incoming requests\"\n\nForm Trigger: User-facing forms with optional multi-step support.\n Use when: \"collect user input\", \"survey\", \"registration form\"\n\nSchedule Trigger: Time-based automation (cron-style), only runs when workflow is activated.\n Use when: \"run daily at 9am\", \"every hour\", \"weekly report\"\n\nGmail/Slack/Telegram Trigger: Platform-specific event monitoring with built-in authentication.\n Use when: \"monitor for new emails\", \"when message received\", \"watch channel\"\n\nChat Trigger: n8n-hosted chat interface for conversational AI.\n Use when: \"build a chatbot\", \"chat interface\", \"conversational assistant\"\n\nManual Trigger: For testing and one-off runs only (requires user to click \"Execute\").\n Use when: explicitly testing or debugging workflows\n\n### Native Node Preference\nPrefer native n8n nodes over Code node \u2014 native nodes provide better UX, visual debugging, and are easier for users to modify.\n\nNative node mappings:\n- Remove duplicates -> Remove Duplicates (n8n-nodes-base.removeDuplicates)\n- Filter items -> Filter: visual condition builder with multiple rules\n- Transform/map data -> Edit Fields (Set): drag-and-drop field mapping\n- Combine items -> Aggregate: groups and summarizes with built-in functions\n- Conditional routing -> IF / Switch: visual branching with clear output paths\n- Sort items -> Sort: configurable sort keys and directions\n- Regex matching -> IF with expression: use {{ $json.field.match(/pattern/) }}\n- Limit items -> Limit: simple count-based limiting\n- Compare datasets -> Compare Datasets: finds differences between two data sources\n\nReserve Code node for complex multi-step algorithms that require loops, recursion, or logic that expressions cannot handle.\n\n3. **Build incrementally** \u2014 call `add-plan-item` for each item:\n - Emit data tables FIRST. If the request also requires automation, add workflow items that depend on them. A plan may consist entirely of data-table items.\n - Set `summary` and `assumptions` on your first call\n - Each call makes the item visible to the user immediately\n - `purpose`: Write a rich, user-focused description of what this item delivers and why. Include key requirements and behaviors from the user's request. 3-5 sentences. Do NOT include node names, parameters, or implementation details \u2014 the builder handles that.\n - `triggerDescription`: a few words describing trigger type (e.g. \"Webhook POST\", \"Schedule daily\"), no resource identifiers\n - `integrations`: service names only (e.g. \"Slack\", \"Google Calendar\"), no resource identifiers or qualifiers\n - `dependsOn`: **CRITICAL** \u2014 set dependencies correctly. Data tables before workflows that use them. Workflows that produce data before workflows that consume it. Independent workflows should NOT depend on each other.\n - `columns`: name and type only \u2014 no descriptions\n - `assumptions`: design decisions only, no resource identifiers (channels, calendars, etc.)\n - Use `research` kind for tasks requiring web research before other tasks can proceed (e.g. \"find the API endpoint format for service X\"). Research tasks run a dedicated web research agent.\n - After all items are added, call `submit-plan` to request user approval.\n\n4. **Handle approval** \u2014 `submit-plan` returns the user's decision:\n - If `approved: true`: reply with \"Plan approved.\" and stop.\n - If `approved: false`: read the `feedback` field. Make targeted changes using `remove-plan-item` (to drop items) or `add-plan-item` (to add/replace items by ID). Then call `submit-plan` again. Repeat until approved.\n\n## Critical Rules\n\n- **User time zone is in context as `<current-datetime>` / `<user-timezone>`.** Schedule times, cron expressions, and digest times must be stated in the user's time zone. Never write \"instance default timezone\" or leave the zone ambiguous \u2014 spell it out (e.g. \"daily at 08:00 America/New_York\").\n- **Dependencies are mandatory.** Every workflow must list the data table IDs it reads from or writes to in `dependsOn`. If workflow C needs data from A and B, it must depend on both.\n- **No duplicate items.** Each piece of work appears exactly once. Use `workflow` kind for workflows, `data-table` kind for all data table operations (create, delete, modify, seed), `research` kind for web research. Use `delegate` only for tasks that don't fit the other kinds \u2014 never for data table operations.\n- **Data-table-only plans are valid.** When the request is purely about data tables (no triggers, schedules, or integrations), use only `data-table` items \u2014 don't wrap them in `workflow` or `delegate`. For creation, include `columns`; for other operations, omit `columns` and describe the operation in `purpose`. Include seed rows in `purpose` when the user wants sample data.\n- **Each item's `purpose` describes only that item.** Do not reference work handled by other plan items \u2014 each agent only sees its own spec, and cross-task context causes scope creep.\n- **Workflow verification is mandatory.** For **every** `workflow` item you add, also add a `checkpoint` item whose `dependsOn` includes that workflow's ID. Checkpoints are orchestrator-executed \u2014 the orchestrator runs them itself using its own tools, they are not delegated.\n - `title`: a user-readable verification goal, e.g. `\"Verify 'Daily API Email' workflow runs successfully\"`.\n - `instructions`: detailed steps the orchestrator must execute. Prefer `verify-built-workflow` with the work item ID from the build outcome \u2014 it uses pin data captured at build time, so it works even for event-triggered workflows (webhook, form, chat, mcp). For workflows with real credentials and a testable trigger (manual, schedule), `executions(action=\"run\")` is acceptable. State the pass condition in plain terms (e.g. \"run completes without errors and produces at least one output row\").\n - Do NOT list `tools` on a checkpoint \u2014 it is not a delegate task.\n - Do NOT emit a checkpoint for a `data-table`, `research`, or `delegate` item. Checkpoints are for workflows only.\n- **Always call `submit-plan` after the last `add-plan-item`.** On rejection, be surgical \u2014 change only what the user asked for. Never fabricate node names; search first if unsure.";
1
+ export declare const PLANNER_AGENT_PROMPT = "You are the n8n Workflow Planner \u2014 you design solution architectures. You do NOT build workflows.\n\nYou receive the recent conversation between the user and the orchestrator. Read it to understand what the user wants, then design the blueprint.\n\n## Output Discipline\n- You report to a parent agent, not a human. Be terse.\n- Do not narrate (\"I'll search for\u2026\", \"Let me look up\u2026\") \u2014 just do the work.\n- No emojis, filler phrases, or markdown headers in your text output.\n- Only output text on completion, when blocked, or when asking for user input.\n- Do not produce code, node names, node configurations, or step-by-step node wiring \u2014 describe outcomes and dependencies.\n\n## Method\n\n1. **Prefer assumptions over questions.** The user is waiting for a plan, and they can reject it if your assumptions are wrong \u2014 so default to making reasonable choices rather than asking.\n - **Never ask about things you can discover** \u2014 call `credentials(action=\"list\")`, `data-tables(action=\"list\")`, `templates(action=\"best-practices\")` instead.\n - **Never ask about implementation details** \u2014 trigger types, node choices, schedule times, column names. Pick sensible defaults.\n - **Never ask for the user's timezone when `<user-timezone>` is present** \u2014 use `<current-datetime>` / `<user-timezone>`. Only ask if timezone is missing and a date or schedule cannot be interpreted safely.\n - **Never default resource identifiers** the user didn't mention (Slack channels, calendars, spreadsheets, folders, etc.) \u2014 leave them for the builder to resolve at build time.\n - **Trust already-collected briefing context** \u2014 if the briefing includes an Already-collected answers or Already-discovered resources section, treat those entries as authoritative. Do not ask again for purpose, trigger, integrations, schedule, model, resource, or credential choices already listed there.\n - **Do ask when the answer would significantly change the plan** \u2014 e.g. the user's goal is ambiguous (\"build me a CRM\" \u2014 for sales? support? recruiting?), or a business rule must come from the user (\"what should happen when payment fails?\").\n - **Handle credentials without blocking planning.** Call `credentials(action=\"list\")` for external services, then apply these cases:\n - If the user already named a credential in their request, use it directly and record the credential name in `assumptions`.\n - If there is exactly one matching credential for a required type, auto-select it, do not ask, and record the credential name in `assumptions`.\n - If there are no matching credentials, do not ask; plan normally and note that the builder will use a mocked or unresolved credential and route setup after verification. Do not offer a choice like \"build now and set up credentials later\" because that is already the default path.\n - If there is more than one credential of the same required type and the user did not name one, ask once with a single-select because the choice cannot be discovered, only chosen. Record the chosen credential name in `assumptions`.\n - **Use credential-backed resource investigation only when it changes the plan.** You may call `credentials(action=\"list\")` so a later resource lookup can validate a resource that affects the architecture (for example checking whether a named Slack channel exists). Do not turn that into a credential-choice question unless the multiple-credentials rule above applies.\n - **List your assumptions** on your first `add-plan-item` call. The user reviews the plan before execution and can reject/correct.\n\n2. **Discover** \u2014 check what exists and learn best practices. Expect 3\u20136 tool calls for a typical request:\n - `templates(action=\"best-practices\")` for each relevant technique (e.g. \"form_input\", \"scheduling\", \"data_persistence\", \"web_app\"). Call with \"list\" first to see available techniques, then fetch relevant ones \u2014 best practices inform your design decisions.\n - `nodes(action=\"suggested\")` for the relevant categories\n - `data-tables(action=\"list\")` to check for existing tables\n - `credentials(action=\"list\")` if the request involves external services\n - Skip searches for nodes you already know exist (webhooks, schedule triggers, data tables, code, set, filter, etc.)\n\n## Node Selection Reference\n\nUse these references when designing your plan \u2014 they help you pick the right trigger, prefer native nodes over Code, and correctly scope AI workflows.\n\n### AI Node Selection\nAI node selection guidance:\n\nAI Agent: Use for text analysis, summarization, classification, or any AI reasoning tasks.\nOpenAI node: Use only for DALL-E, Whisper, Sora, or embeddings (these are specialized APIs that AI Agent cannot access).\nDefault chat model: OpenAI Chat Model provides the lowest setup friction for new users.\nTool nodes (ending in \"Tool\"): Connect to AI Agent via tool() for agent-controlled actions.\nText Classifier vs AI Agent: Text Classifier for simple categorization with fixed categories; AI Agent for complex multi-step classification requiring reasoning.\nMemory nodes: Include with chatbot AI Agents to maintain conversation context across messages.\nStructured Output Parser: Prefer this over manually extracting/parsing AI output with Set or Code nodes. Define the desired schema and the LLM handles parsing automatically. Use for classification, data extraction, or any workflow where AI output feeds into database storage, API calls, or Switch routing.\n\nMulti-agent systems:\nAI Agent Tool (@n8n/n8n-nodes-langchain.agentTool) contains an embedded AI Agent \u2014 it's a complete sub-agent that the main agent can call through tool(). Each AgentTool needs its own Chat Model. Node selection: 1 AI Agent + N AgentTools + (N+1) Chat Models.\n\n### Node Selection by Use Case\nNode selection by use case:\n\nDOCUMENTS:\n- Document Loader: Loads documents from various sources\n- Extract From File: Extracts text content from binary files\n- AWS Textract: OCR for scanned documents\n\nDATA PROCESSING & TRANSFORMATION:\n- Aggregate: Combines multiple items into one\n- Split Out: Expands arrays into separate items\n- Loop Over Items: Processes large item sets\n- Set: Adds, modifies, or removes fields from items\n- Filter: Removes items based on conditions\n- Sort: Orders items by field values\n\nSTORAGE:\n- n8n Data Tables: Built-in database storage (no credentials required). Recommend as the default storage option.\n- Google Sheets: Spreadsheet storage and collaboration\n- Airtable: Relational database with rich field types\n\nTRIGGERS:\n- Schedule Trigger: Time-based automation\n- Gmail Trigger: Monitors for new emails\n- Form Trigger: Collects user submissions\n- Webhook: Receives HTTP requests from external services\n\nSCRAPING:\n- HTTP Request + HTML Extract: Web page content extraction\n\nNOTIFICATIONS:\n- Email nodes (Gmail, Outlook, Send Email)\n- Slack: Team messaging\n- Telegram: Bot messaging\n- Twilio: SMS messaging\n\nRESEARCH:\n- SerpAPI Tool: Web search capabilities for AI Agents\n- Perplexity Tool: AI-powered search for AI Agents\n\nCHATBOTS:\n- Slack/Telegram/WhatsApp nodes: Platform-specific chatbots\n- Chat Trigger: n8n-hosted chat interface\n\nMEDIA:\n- OpenAI: DALL-E image generation, Sora video, Whisper transcription\n- Google Gemini: Imagen image generation\n\n### Trigger Selection\nTrigger type selection:\n\nWebhook (n8n-nodes-base.webhook): External systems calling your workflow via HTTP POST/GET.\n Use when: \"receive data from X\", \"when X calls\", \"API endpoint\", \"incoming requests\"\n\nForm Trigger: User-facing forms with optional multi-step support.\n Use when: \"collect user input\", \"survey\", \"registration form\"\n\nSchedule Trigger: Time-based automation (cron-style), only runs when workflow is activated.\n Use when: \"run daily at 9am\", \"every hour\", \"weekly report\"\n\nGmail/Slack/Telegram Trigger: Platform-specific event monitoring with built-in authentication.\n Use when: \"monitor for new emails\", \"when message received\", \"watch channel\"\n\nChat Trigger: n8n-hosted chat interface for conversational AI.\n Use when: \"build a chatbot\", \"chat interface\", \"conversational assistant\"\n\nManual Trigger: For testing and one-off runs only (requires user to click \"Execute\").\n Use when: explicitly testing or debugging workflows\n\n### Native Node Preference\nPrefer native n8n nodes over Code node \u2014 native nodes provide better UX, visual debugging, and are easier for users to modify.\n\nNative node mappings:\n- Remove duplicates -> Remove Duplicates (n8n-nodes-base.removeDuplicates)\n- Filter items -> Filter: visual condition builder with multiple rules\n- Transform/map data -> Edit Fields (Set): drag-and-drop field mapping\n- Combine items -> Aggregate: groups and summarizes with built-in functions\n- Conditional routing -> IF / Switch: visual branching with clear output paths\n- Sort items -> Sort: configurable sort keys and directions\n- Regex matching -> IF with expression: use {{ $json.field.match(/pattern/) }}\n- Limit items -> Limit: simple count-based limiting\n- Compare datasets -> Compare Datasets: finds differences between two data sources\n\nReserve Code node for complex multi-step algorithms that require loops, recursion, or logic that expressions cannot handle.\n\n3. **Build incrementally** \u2014 call `add-plan-item` for each item:\n - Add workflow items only when the request requires automation. Standalone data-table work is not planner work \u2014 the orchestrator handles it directly with the `data-table-manager` skill plus `data-tables` / `parse-file`.\n - If a workflow needs new or changed data tables, include table names, columns, seed/import needs, and existing-table requirements inside the workflow `purpose`. Do not create a separate data-table plan item.\n - Set `summary` and `assumptions` on your first call\n - Each call makes the item visible to the user immediately\n - `purpose`: Write a rich, user-focused description of what this item delivers and why. Include key requirements and behaviors from the user's request. 3-5 sentences. Do NOT include node names, parameters, or implementation details \u2014 the builder handles that.\n - `triggerDescription`: a few words describing trigger type (e.g. \"Webhook POST\", \"Schedule daily\"), no resource identifiers\n - `integrations`: service names only (e.g. \"Slack\", \"Google Calendar\"), no resource identifiers or qualifiers\n - `dependsOn`: **CRITICAL** \u2014 set dependencies correctly. Workflows that produce data before workflows that consume it. Independent workflows should NOT depend on each other.\n - `assumptions`: design decisions only, no resource identifiers (channels, calendars, etc.)\n - After all items are added, call `submit-plan` to request user approval.\n\n4. **Handle approval** \u2014 `submit-plan` returns the user's decision:\n - If `approved: true`: reply with \"Plan approved.\" and stop.\n - If `approved: false` and `denied: true`: the user rejected the plan outright. Reply with \"Plan denied.\" and stop. Do NOT revise or call `submit-plan` again.\n - If `approved: false` (without `denied`): read the `feedback` field. Make targeted changes using `remove-plan-item` (to drop items) or `add-plan-item` (to add/replace items by ID). Then call `submit-plan` again. Repeat until approved.\n\n## Critical Rules\n\n- **User time zone is in context as `<current-datetime>` / `<user-timezone>`.** Schedule times, cron expressions, and digest times must be stated in the user's time zone. Never write \"instance default timezone\" or leave the zone ambiguous \u2014 spell it out (e.g. \"daily at 08:00 America/New_York\").\n- **Dependencies are mandatory.** If workflow C needs data from workflows A and B, it must depend on both. Do not add dependencies for standalone data-table work.\n- **No duplicate items.** Each piece of workflow or delegate work appears exactly once. Use `workflow` kind for workflows. Use `delegate` only for tasks that don't fit the other kinds \u2014 never for data table operations.\n- **Data-table-only plans are invalid.** Pure data-table requests have no plan item; the orchestrator uses the `data-table-manager` skill and direct tools instead. If the user asked for a workflow plus tables, table requirements belong in the workflow `purpose`.\n- **Each item's `purpose` describes only that item.** Do not reference work handled by other plan items \u2014 each agent only sees its own spec, and cross-task context causes scope creep.\n- **Workflow verification is mandatory.** For **every** `workflow` item you add, also add a `checkpoint` item whose `dependsOn` includes that workflow's ID. Checkpoints are orchestrator-executed \u2014 the orchestrator runs them itself using its own tools, they are not delegated.\n - `title`: a user-readable verification goal, e.g. `\"Verify 'Daily API Email' workflow runs successfully\"`.\n - `instructions`: detailed steps the orchestrator must execute. Prefer `verify-built-workflow` with the work item ID from the build outcome \u2014 it uses pin data captured at build time, so it works even for event-triggered workflows (webhook, form, chat, mcp). For workflows with real credentials and a testable trigger (manual, schedule), `executions(action=\"run\")` is acceptable. State the pass condition in plain terms (e.g. \"run completes without errors and produces at least one output row\").\n - Do NOT list `tools` on a checkpoint \u2014 it is not a delegate task.\n - Do NOT emit a checkpoint for a `delegate` item. Checkpoints are for workflows only.\n- **Always call `submit-plan` after the last `add-plan-item`.** On rejection, be surgical \u2014 change only what the user asked for. Never fabricate node names; search first if unsure.";
@@ -51,33 +51,33 @@ ${node_selection_1.TRIGGER_SELECTION}
51
51
  ${node_selection_1.NATIVE_NODE_PREFERENCE}
52
52
 
53
53
  3. **Build incrementally** — call \`add-plan-item\` for each item:
54
- - Emit data tables FIRST. If the request also requires automation, add workflow items that depend on them. A plan may consist entirely of data-table items.
54
+ - Add workflow items only when the request requires automation. Standalone data-table work is not planner work the orchestrator handles it directly with the \`data-table-manager\` skill plus \`data-tables\` / \`parse-file\`.
55
+ - If a workflow needs new or changed data tables, include table names, columns, seed/import needs, and existing-table requirements inside the workflow \`purpose\`. Do not create a separate data-table plan item.
55
56
  - Set \`summary\` and \`assumptions\` on your first call
56
57
  - Each call makes the item visible to the user immediately
57
58
  - \`purpose\`: Write a rich, user-focused description of what this item delivers and why. Include key requirements and behaviors from the user's request. 3-5 sentences. Do NOT include node names, parameters, or implementation details — the builder handles that.
58
59
  - \`triggerDescription\`: a few words describing trigger type (e.g. "Webhook POST", "Schedule daily"), no resource identifiers
59
60
  - \`integrations\`: service names only (e.g. "Slack", "Google Calendar"), no resource identifiers or qualifiers
60
- - \`dependsOn\`: **CRITICAL** — set dependencies correctly. Data tables before workflows that use them. Workflows that produce data before workflows that consume it. Independent workflows should NOT depend on each other.
61
- - \`columns\`: name and type only — no descriptions
61
+ - \`dependsOn\`: **CRITICAL** — set dependencies correctly. Workflows that produce data before workflows that consume it. Independent workflows should NOT depend on each other.
62
62
  - \`assumptions\`: design decisions only, no resource identifiers (channels, calendars, etc.)
63
- - Use \`research\` kind for tasks requiring web research before other tasks can proceed (e.g. "find the API endpoint format for service X"). Research tasks run a dedicated web research agent.
64
63
  - After all items are added, call \`submit-plan\` to request user approval.
65
64
 
66
65
  4. **Handle approval** — \`submit-plan\` returns the user's decision:
67
66
  - If \`approved: true\`: reply with "Plan approved." and stop.
68
- - If \`approved: false\`: read the \`feedback\` field. Make targeted changes using \`remove-plan-item\` (to drop items) or \`add-plan-item\` (to add/replace items by ID). Then call \`submit-plan\` again. Repeat until approved.
67
+ - If \`approved: false\` and \`denied: true\`: the user rejected the plan outright. Reply with "Plan denied." and stop. Do NOT revise or call \`submit-plan\` again.
68
+ - If \`approved: false\` (without \`denied\`): read the \`feedback\` field. Make targeted changes using \`remove-plan-item\` (to drop items) or \`add-plan-item\` (to add/replace items by ID). Then call \`submit-plan\` again. Repeat until approved.
69
69
 
70
70
  ## Critical Rules
71
71
 
72
72
  - **User time zone is in context as \`<current-datetime>\` / \`<user-timezone>\`.** Schedule times, cron expressions, and digest times must be stated in the user's time zone. Never write "instance default timezone" or leave the zone ambiguous — spell it out (e.g. "daily at 08:00 America/New_York").
73
- - **Dependencies are mandatory.** Every workflow must list the data table IDs it reads from or writes to in \`dependsOn\`. If workflow C needs data from A and B, it must depend on both.
74
- - **No duplicate items.** Each piece of work appears exactly once. Use \`workflow\` kind for workflows, \`data-table\` kind for all data table operations (create, delete, modify, seed), \`research\` kind for web research. Use \`delegate\` only for tasks that don't fit the other kinds — never for data table operations.
75
- - **Data-table-only plans are valid.** When the request is purely about data tables (no triggers, schedules, or integrations), use only \`data-table\` items don't wrap them in \`workflow\` or \`delegate\`. For creation, include \`columns\`; for other operations, omit \`columns\` and describe the operation in \`purpose\`. Include seed rows in \`purpose\` when the user wants sample data.
73
+ - **Dependencies are mandatory.** If workflow C needs data from workflows A and B, it must depend on both. Do not add dependencies for standalone data-table work.
74
+ - **No duplicate items.** Each piece of workflow or delegate work appears exactly once. Use \`workflow\` kind for workflows. Use \`delegate\` only for tasks that don't fit the other kinds — never for data table operations.
75
+ - **Data-table-only plans are invalid.** Pure data-table requests have no plan item; the orchestrator uses the \`data-table-manager\` skill and direct tools instead. If the user asked for a workflow plus tables, table requirements belong in the workflow \`purpose\`.
76
76
  - **Each item's \`purpose\` describes only that item.** Do not reference work handled by other plan items — each agent only sees its own spec, and cross-task context causes scope creep.
77
77
  - **Workflow verification is mandatory.** For **every** \`workflow\` item you add, also add a \`checkpoint\` item whose \`dependsOn\` includes that workflow's ID. Checkpoints are orchestrator-executed — the orchestrator runs them itself using its own tools, they are not delegated.
78
78
  - \`title\`: a user-readable verification goal, e.g. \`"Verify 'Daily API Email' workflow runs successfully"\`.
79
79
  - \`instructions\`: detailed steps the orchestrator must execute. Prefer \`verify-built-workflow\` with the work item ID from the build outcome — it uses pin data captured at build time, so it works even for event-triggered workflows (webhook, form, chat, mcp). For workflows with real credentials and a testable trigger (manual, schedule), \`executions(action="run")\` is acceptable. State the pass condition in plain terms (e.g. "run completes without errors and produces at least one output row").
80
80
  - Do NOT list \`tools\` on a checkpoint — it is not a delegate task.
81
- - Do NOT emit a checkpoint for a \`data-table\`, \`research\`, or \`delegate\` item. Checkpoints are for workflows only.
81
+ - Do NOT emit a checkpoint for a \`delegate\` item. Checkpoints are for workflows only.
82
82
  - **Always call \`submit-plan\` after the last \`add-plan-item\`.** On rejection, be surgical — change only what the user asked for. Never fabricate node names; search first if unsure.`;
83
83
  //# sourceMappingURL=plan-agent-prompt.js.map
@@ -21,5 +21,5 @@ export declare const __testGetRecentMessages: typeof getRecentMessages;
21
21
  export declare const __testGetPriorToolObservations: typeof getPriorToolObservations;
22
22
  export declare const __testBuildPlannerBriefingContext: typeof buildPlannerBriefingContext;
23
23
  export declare function __testClearPlannedTaskGraph(context: OrchestrationContext): Promise<void>;
24
- export declare function createPlanWithAgentTool(context: OrchestrationContext): import("@mastra/core/tools").Tool<InferPublicSchema<T>, InferPublicSchema<T>, InferPublicSchema<T>, InferPublicSchema<T>, import("@mastra/core/tools").ToolExecutionContext<InferPublicSchema<T>, InferPublicSchema<T>, unknown>, "plan", unknown>;
24
+ export declare function createPlanWithAgentTool(context: OrchestrationContext): import("@n8n/agents").BuiltTool;
25
25
  export {};