@n8n/instance-ai 1.1.0 → 1.2.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 (373) hide show
  1. package/dist/agent/instance-agent.js +17 -45
  2. package/dist/agent/instance-agent.js.map +1 -1
  3. package/dist/agent/register-with-mastra.d.ts +1 -1
  4. package/dist/agent/register-with-mastra.js +5 -9
  5. package/dist/agent/register-with-mastra.js.map +1 -1
  6. package/dist/agent/sub-agent-briefing.d.ts +20 -0
  7. package/dist/agent/sub-agent-briefing.js +39 -0
  8. package/dist/agent/sub-agent-briefing.js.map +1 -0
  9. package/dist/agent/sub-agent-debriefing.d.ts +71 -0
  10. package/dist/agent/sub-agent-debriefing.js +39 -0
  11. package/dist/agent/sub-agent-debriefing.js.map +1 -0
  12. package/dist/agent/sub-agent-factory.d.ts +1 -1
  13. package/dist/agent/sub-agent-factory.js +15 -3
  14. package/dist/agent/sub-agent-factory.js.map +1 -1
  15. package/dist/agent/system-prompt.d.ts +1 -0
  16. package/dist/agent/system-prompt.js +67 -43
  17. package/dist/agent/system-prompt.js.map +1 -1
  18. package/dist/agent/tool-access.d.ts +2 -0
  19. package/dist/agent/tool-access.js +28 -0
  20. package/dist/agent/tool-access.js.map +1 -0
  21. package/dist/build.tsbuildinfo +1 -1
  22. package/dist/domain-access/domain-gating.d.ts +1 -0
  23. package/dist/domain-access/domain-gating.js +3 -0
  24. package/dist/domain-access/domain-gating.js.map +1 -1
  25. package/dist/index.d.ts +5 -3
  26. package/dist/index.js +13 -4
  27. package/dist/index.js.map +1 -1
  28. package/dist/memory/memory-config.js +1 -3
  29. package/dist/memory/memory-config.js.map +1 -1
  30. package/dist/parsers/structured-file-parser.d.ts +56 -0
  31. package/dist/parsers/structured-file-parser.js +354 -0
  32. package/dist/parsers/structured-file-parser.js.map +1 -0
  33. package/dist/planned-tasks/planned-task-service.js +6 -0
  34. package/dist/planned-tasks/planned-task-service.js.map +1 -1
  35. package/dist/runtime/background-task-manager.d.ts +2 -1
  36. package/dist/runtime/background-task-manager.js +13 -1
  37. package/dist/runtime/background-task-manager.js.map +1 -1
  38. package/dist/runtime/resumable-stream-executor.d.ts +6 -3
  39. package/dist/runtime/resumable-stream-executor.js +66 -119
  40. package/dist/runtime/resumable-stream-executor.js.map +1 -1
  41. package/dist/runtime/stream-runner.d.ts +2 -2
  42. package/dist/runtime/stream-runner.js +4 -25
  43. package/dist/runtime/stream-runner.js.map +1 -1
  44. package/dist/stream/consume-with-hitl.d.ts +4 -1
  45. package/dist/stream/consume-with-hitl.js +11 -2
  46. package/dist/stream/consume-with-hitl.js.map +1 -1
  47. package/dist/stream/map-chunk.d.ts +1 -1
  48. package/dist/stream/map-chunk.js +20 -15
  49. package/dist/stream/map-chunk.js.map +1 -1
  50. package/dist/stream/work-summary-accumulator.d.ts +63 -0
  51. package/dist/stream/work-summary-accumulator.js +66 -0
  52. package/dist/stream/work-summary-accumulator.js.map +1 -0
  53. package/dist/tools/attachments/parse-file.tool.d.ts +90 -0
  54. package/dist/tools/attachments/parse-file.tool.js +135 -0
  55. package/dist/tools/attachments/parse-file.tool.js.map +1 -0
  56. package/dist/tools/best-practices/get-best-practices.tool.d.ts +6 -9
  57. package/dist/tools/best-practices/get-best-practices.tool.js +7 -5
  58. package/dist/tools/best-practices/get-best-practices.tool.js.map +1 -1
  59. package/dist/tools/best-practices/index.js +5 -29
  60. package/dist/tools/best-practices/index.js.map +1 -1
  61. package/dist/tools/best-practices/techniques.d.ts +1 -20
  62. package/dist/tools/best-practices/techniques.js +3 -36
  63. package/dist/tools/best-practices/techniques.js.map +1 -1
  64. package/dist/tools/credentials/delete-credential.tool.d.ts +13 -14
  65. package/dist/tools/credentials/delete-credential.tool.js +18 -11
  66. package/dist/tools/credentials/delete-credential.tool.js.map +1 -1
  67. package/dist/tools/credentials/get-credential.tool.d.ts +8 -2
  68. package/dist/tools/credentials/get-credential.tool.js +13 -7
  69. package/dist/tools/credentials/get-credential.tool.js.map +1 -1
  70. package/dist/tools/credentials/list-credentials.tool.d.ts +13 -3
  71. package/dist/tools/credentials/list-credentials.tool.js +50 -8
  72. package/dist/tools/credentials/list-credentials.tool.js.map +1 -1
  73. package/dist/tools/credentials/search-credential-types.tool.d.ts +7 -3
  74. package/dist/tools/credentials/search-credential-types.tool.js +7 -5
  75. package/dist/tools/credentials/search-credential-types.tool.js.map +1 -1
  76. package/dist/tools/credentials/setup-credentials.tool.d.ts +40 -44
  77. package/dist/tools/credentials/setup-credentials.tool.js +37 -31
  78. package/dist/tools/credentials/setup-credentials.tool.js.map +1 -1
  79. package/dist/tools/credentials/test-credential.tool.d.ts +7 -4
  80. package/dist/tools/credentials/test-credential.tool.js +5 -3
  81. package/dist/tools/credentials/test-credential.tool.js.map +1 -1
  82. package/dist/tools/data-tables/add-data-table-column.tool.d.ts +15 -19
  83. package/dist/tools/data-tables/add-data-table-column.tool.js +16 -9
  84. package/dist/tools/data-tables/add-data-table-column.tool.js.map +1 -1
  85. package/dist/tools/data-tables/create-data-table.tool.d.ts +26 -24
  86. package/dist/tools/data-tables/create-data-table.tool.js +49 -22
  87. package/dist/tools/data-tables/create-data-table.tool.js.map +1 -1
  88. package/dist/tools/data-tables/delete-data-table-column.tool.d.ts +13 -14
  89. package/dist/tools/data-tables/delete-data-table-column.tool.js +15 -8
  90. package/dist/tools/data-tables/delete-data-table-column.tool.js.map +1 -1
  91. package/dist/tools/data-tables/delete-data-table-rows.tool.d.ts +49 -15
  92. package/dist/tools/data-tables/delete-data-table-rows.tool.js +25 -9
  93. package/dist/tools/data-tables/delete-data-table-rows.tool.js.map +1 -1
  94. package/dist/tools/data-tables/delete-data-table.tool.d.ts +11 -14
  95. package/dist/tools/data-tables/delete-data-table.tool.js +17 -9
  96. package/dist/tools/data-tables/delete-data-table.tool.js.map +1 -1
  97. package/dist/tools/data-tables/get-data-table-schema.tool.d.ts +7 -8
  98. package/dist/tools/data-tables/get-data-table-schema.tool.js +5 -3
  99. package/dist/tools/data-tables/get-data-table-schema.tool.js.map +1 -1
  100. package/dist/tools/data-tables/insert-data-table-rows.tool.d.ts +14 -15
  101. package/dist/tools/data-tables/insert-data-table-rows.tool.js +22 -12
  102. package/dist/tools/data-tables/insert-data-table-rows.tool.js.map +1 -1
  103. package/dist/tools/data-tables/list-data-tables.tool.d.ts +7 -3
  104. package/dist/tools/data-tables/list-data-tables.tool.js +8 -6
  105. package/dist/tools/data-tables/list-data-tables.tool.js.map +1 -1
  106. package/dist/tools/data-tables/query-data-table-rows.tool.d.ts +49 -8
  107. package/dist/tools/data-tables/query-data-table-rows.tool.js +14 -12
  108. package/dist/tools/data-tables/query-data-table-rows.tool.js.map +1 -1
  109. package/dist/tools/data-tables/rename-data-table-column.tool.d.ts +15 -14
  110. package/dist/tools/data-tables/rename-data-table-column.tool.js +16 -9
  111. package/dist/tools/data-tables/rename-data-table-column.tool.js.map +1 -1
  112. package/dist/tools/data-tables/update-data-table-rows.tool.d.ts +51 -14
  113. package/dist/tools/data-tables/update-data-table-rows.tool.js +19 -9
  114. package/dist/tools/data-tables/update-data-table-rows.tool.js.map +1 -1
  115. package/dist/tools/executions/debug-execution.tool.d.ts +8 -2
  116. package/dist/tools/executions/debug-execution.tool.js +5 -3
  117. package/dist/tools/executions/debug-execution.tool.js.map +1 -1
  118. package/dist/tools/executions/get-execution.tool.d.ts +8 -2
  119. package/dist/tools/executions/get-execution.tool.js +5 -3
  120. package/dist/tools/executions/get-execution.tool.js.map +1 -1
  121. package/dist/tools/executions/get-node-output.tool.d.ts +14 -2
  122. package/dist/tools/executions/get-node-output.tool.js +14 -17
  123. package/dist/tools/executions/get-node-output.tool.js.map +1 -1
  124. package/dist/tools/executions/list-executions.tool.d.ts +11 -3
  125. package/dist/tools/executions/list-executions.tool.js +16 -14
  126. package/dist/tools/executions/list-executions.tool.js.map +1 -1
  127. package/dist/tools/executions/run-workflow.tool.d.ts +17 -15
  128. package/dist/tools/executions/run-workflow.tool.js +35 -25
  129. package/dist/tools/executions/run-workflow.tool.js.map +1 -1
  130. package/dist/tools/executions/stop-execution.tool.d.ts +7 -4
  131. package/dist/tools/executions/stop-execution.tool.js +8 -3
  132. package/dist/tools/executions/stop-execution.tool.js.map +1 -1
  133. package/dist/tools/filesystem/create-tools-from-mcp-server.js +2 -1
  134. package/dist/tools/filesystem/create-tools-from-mcp-server.js.map +1 -1
  135. package/dist/tools/index.d.ts +67 -2380
  136. package/dist/tools/index.js +9 -15
  137. package/dist/tools/index.js.map +1 -1
  138. package/dist/tools/nodes/explore-node-resources.tool.d.ts +23 -10
  139. package/dist/tools/nodes/explore-node-resources.tool.js +27 -25
  140. package/dist/tools/nodes/explore-node-resources.tool.js.map +1 -1
  141. package/dist/tools/nodes/get-node-description.tool.d.ts +7 -20
  142. package/dist/tools/nodes/get-node-description.tool.js +5 -3
  143. package/dist/tools/nodes/get-node-description.tool.js.map +1 -1
  144. package/dist/tools/nodes/get-node-type-definition.tool.d.ts +29 -6
  145. package/dist/tools/nodes/get-node-type-definition.tool.js +9 -7
  146. package/dist/tools/nodes/get-node-type-definition.tool.js.map +1 -1
  147. package/dist/tools/nodes/get-suggested-nodes.tool.d.ts +7 -12
  148. package/dist/tools/nodes/get-suggested-nodes.tool.js +9 -7
  149. package/dist/tools/nodes/get-suggested-nodes.tool.js.map +1 -1
  150. package/dist/tools/nodes/list-nodes.tool.d.ts +7 -3
  151. package/dist/tools/nodes/list-nodes.tool.js +8 -6
  152. package/dist/tools/nodes/list-nodes.tool.js.map +1 -1
  153. package/dist/tools/nodes/node-search-engine.d.ts +1 -0
  154. package/dist/tools/nodes/node-search-engine.js +12 -9
  155. package/dist/tools/nodes/node-search-engine.js.map +1 -1
  156. package/dist/tools/nodes/search-nodes.tool.d.ts +12 -24
  157. package/dist/tools/nodes/search-nodes.tool.js +21 -17
  158. package/dist/tools/nodes/search-nodes.tool.js.map +1 -1
  159. package/dist/tools/orchestration/add-plan-item.tool.d.ts +5 -0
  160. package/dist/tools/orchestration/add-plan-item.tool.js +91 -0
  161. package/dist/tools/orchestration/add-plan-item.tool.js.map +1 -0
  162. package/dist/tools/orchestration/blueprint-accumulator.d.ts +50 -0
  163. package/dist/tools/orchestration/blueprint-accumulator.js +215 -0
  164. package/dist/tools/orchestration/blueprint-accumulator.js.map +1 -0
  165. package/dist/tools/orchestration/blueprint.schema.d.ts +271 -0
  166. package/dist/tools/orchestration/blueprint.schema.js +61 -0
  167. package/dist/tools/orchestration/blueprint.schema.js.map +1 -0
  168. package/dist/tools/orchestration/browser-credential-setup.tool.d.ts +15 -12
  169. package/dist/tools/orchestration/browser-credential-setup.tool.js +26 -21
  170. package/dist/tools/orchestration/browser-credential-setup.tool.js.map +1 -1
  171. package/dist/tools/orchestration/build-workflow-agent.prompt.d.ts +1 -1
  172. package/dist/tools/orchestration/build-workflow-agent.prompt.js +43 -149
  173. package/dist/tools/orchestration/build-workflow-agent.prompt.js.map +1 -1
  174. package/dist/tools/orchestration/build-workflow-agent.tool.d.ts +11 -4
  175. package/dist/tools/orchestration/build-workflow-agent.tool.js +50 -82
  176. package/dist/tools/orchestration/build-workflow-agent.tool.js.map +1 -1
  177. package/dist/tools/orchestration/cancel-background-task.tool.d.ts +7 -3
  178. package/dist/tools/orchestration/cancel-background-task.tool.js +5 -3
  179. package/dist/tools/orchestration/cancel-background-task.tool.js.map +1 -1
  180. package/dist/tools/orchestration/correct-background-task.tool.d.ts +9 -3
  181. package/dist/tools/orchestration/correct-background-task.tool.js +8 -6
  182. package/dist/tools/orchestration/correct-background-task.tool.js.map +1 -1
  183. package/dist/tools/orchestration/data-table-agent.prompt.d.ts +1 -1
  184. package/dist/tools/orchestration/data-table-agent.prompt.js +20 -0
  185. package/dist/tools/orchestration/data-table-agent.prompt.js.map +1 -1
  186. package/dist/tools/orchestration/data-table-agent.tool.d.ts +9 -4
  187. package/dist/tools/orchestration/data-table-agent.tool.js +22 -25
  188. package/dist/tools/orchestration/data-table-agent.tool.js.map +1 -1
  189. package/dist/tools/orchestration/delegate.schemas.d.ts +12 -0
  190. package/dist/tools/orchestration/delegate.schemas.js +17 -0
  191. package/dist/tools/orchestration/delegate.schemas.js.map +1 -1
  192. package/dist/tools/orchestration/delegate.tool.d.ts +1 -10
  193. package/dist/tools/orchestration/delegate.tool.js +40 -41
  194. package/dist/tools/orchestration/delegate.tool.js.map +1 -1
  195. package/dist/tools/orchestration/plan-agent-prompt.d.ts +1 -0
  196. package/dist/tools/orchestration/plan-agent-prompt.js +76 -0
  197. package/dist/tools/orchestration/plan-agent-prompt.js.map +1 -0
  198. package/dist/tools/orchestration/plan-with-agent.tool.d.ts +2 -0
  199. package/dist/tools/orchestration/plan-with-agent.tool.js +277 -0
  200. package/dist/tools/orchestration/plan-with-agent.tool.js.map +1 -0
  201. package/dist/tools/orchestration/plan.tool.d.ts +7 -39
  202. package/dist/tools/orchestration/plan.tool.js +15 -13
  203. package/dist/tools/orchestration/plan.tool.js.map +1 -1
  204. package/dist/tools/orchestration/report-verification-verdict.tool.d.ts +23 -3
  205. package/dist/tools/orchestration/report-verification-verdict.tool.js +27 -28
  206. package/dist/tools/orchestration/report-verification-verdict.tool.js.map +1 -1
  207. package/dist/tools/orchestration/research-with-agent.tool.d.ts +11 -4
  208. package/dist/tools/orchestration/research-with-agent.tool.js +25 -21
  209. package/dist/tools/orchestration/research-with-agent.tool.js.map +1 -1
  210. package/dist/tools/orchestration/submit-plan.tool.d.ts +3 -0
  211. package/dist/tools/orchestration/submit-plan.tool.js +81 -0
  212. package/dist/tools/orchestration/submit-plan.tool.js.map +1 -0
  213. package/dist/tools/orchestration/update-tasks.tool.d.ts +1 -9
  214. package/dist/tools/orchestration/update-tasks.tool.js.map +1 -1
  215. package/dist/tools/orchestration/verify-built-workflow.tool.d.ts +13 -7
  216. package/dist/tools/orchestration/verify-built-workflow.tool.js +14 -15
  217. package/dist/tools/orchestration/verify-built-workflow.tool.js.map +1 -1
  218. package/dist/tools/shared/ask-user.tool.d.ts +42 -31
  219. package/dist/tools/shared/ask-user.tool.js +16 -15
  220. package/dist/tools/shared/ask-user.tool.js.map +1 -1
  221. package/dist/tools/templates/search-template-parameters.tool.d.ts +14 -7
  222. package/dist/tools/templates/search-template-parameters.tool.js +17 -15
  223. package/dist/tools/templates/search-template-parameters.tool.js.map +1 -1
  224. package/dist/tools/templates/search-template-structures.tool.d.ts +11 -8
  225. package/dist/tools/templates/search-template-structures.tool.js +13 -11
  226. package/dist/tools/templates/search-template-structures.tool.js.map +1 -1
  227. package/dist/tools/web-research/fetch-url.tool.d.ts +9 -23
  228. package/dist/tools/web-research/fetch-url.tool.js +30 -14
  229. package/dist/tools/web-research/fetch-url.tool.js.map +1 -1
  230. package/dist/tools/web-research/web-search.tool.d.ts +12 -2
  231. package/dist/tools/web-research/web-search.tool.js +20 -18
  232. package/dist/tools/web-research/web-search.tool.js.map +1 -1
  233. package/dist/tools/workflows/apply-workflow-credentials.tool.d.ts +11 -5
  234. package/dist/tools/workflows/apply-workflow-credentials.tool.js +7 -5
  235. package/dist/tools/workflows/apply-workflow-credentials.tool.js.map +1 -1
  236. package/dist/tools/workflows/build-workflow.tool.d.ts +26 -5
  237. package/dist/tools/workflows/build-workflow.tool.js +23 -20
  238. package/dist/tools/workflows/build-workflow.tool.js.map +1 -1
  239. package/dist/tools/workflows/delete-workflow.tool.d.ts +13 -14
  240. package/dist/tools/workflows/delete-workflow.tool.js +15 -11
  241. package/dist/tools/workflows/delete-workflow.tool.js.map +1 -1
  242. package/dist/tools/workflows/get-workflow-as-code.tool.d.ts +6 -10
  243. package/dist/tools/workflows/get-workflow-as-code.tool.js +5 -3
  244. package/dist/tools/workflows/get-workflow-as-code.tool.js.map +1 -1
  245. package/dist/tools/workflows/get-workflow-version.tool.d.ts +8 -16
  246. package/dist/tools/workflows/get-workflow-version.tool.js +6 -4
  247. package/dist/tools/workflows/get-workflow-version.tool.js.map +1 -1
  248. package/dist/tools/workflows/get-workflow.tool.d.ts +7 -15
  249. package/dist/tools/workflows/get-workflow.tool.js +5 -3
  250. package/dist/tools/workflows/get-workflow.tool.js.map +1 -1
  251. package/dist/tools/workflows/list-workflow-versions.tool.d.ts +11 -3
  252. package/dist/tools/workflows/list-workflow-versions.tool.js +13 -11
  253. package/dist/tools/workflows/list-workflow-versions.tool.js.map +1 -1
  254. package/dist/tools/workflows/list-workflows.tool.d.ts +9 -10
  255. package/dist/tools/workflows/list-workflows.tool.js +12 -10
  256. package/dist/tools/workflows/list-workflows.tool.js.map +1 -1
  257. package/dist/tools/workflows/materialize-node-type.tool.d.ts +29 -11
  258. package/dist/tools/workflows/materialize-node-type.tool.js +9 -7
  259. package/dist/tools/workflows/materialize-node-type.tool.js.map +1 -1
  260. package/dist/tools/workflows/publish-workflow.tool.d.ts +6 -20
  261. package/dist/tools/workflows/publish-workflow.tool.js +29 -24
  262. package/dist/tools/workflows/publish-workflow.tool.js.map +1 -1
  263. package/dist/tools/workflows/restore-workflow-version.tool.d.ts +13 -15
  264. package/dist/tools/workflows/restore-workflow-version.tool.js +15 -8
  265. package/dist/tools/workflows/restore-workflow-version.tool.js.map +1 -1
  266. package/dist/tools/workflows/setup-workflow.service.d.ts +0 -1
  267. package/dist/tools/workflows/setup-workflow.service.js +23 -6
  268. package/dist/tools/workflows/setup-workflow.service.js.map +1 -1
  269. package/dist/tools/workflows/setup-workflow.tool.d.ts +7 -144
  270. package/dist/tools/workflows/setup-workflow.tool.js +10 -14
  271. package/dist/tools/workflows/setup-workflow.tool.js.map +1 -1
  272. package/dist/tools/workflows/submit-workflow.tool.d.ts +12 -9
  273. package/dist/tools/workflows/submit-workflow.tool.js +15 -17
  274. package/dist/tools/workflows/submit-workflow.tool.js.map +1 -1
  275. package/dist/tools/workflows/unpublish-workflow.tool.d.ts +13 -15
  276. package/dist/tools/workflows/unpublish-workflow.tool.js +15 -11
  277. package/dist/tools/workflows/unpublish-workflow.tool.js.map +1 -1
  278. package/dist/tools/workflows/update-workflow-version.tool.d.ts +13 -3
  279. package/dist/tools/workflows/update-workflow-version.tool.js +12 -10
  280. package/dist/tools/workflows/update-workflow-version.tool.js.map +1 -1
  281. package/dist/tools/workflows/write-sandbox-file.tool.d.ts +9 -9
  282. package/dist/tools/workflows/write-sandbox-file.tool.js +8 -6
  283. package/dist/tools/workflows/write-sandbox-file.tool.js.map +1 -1
  284. package/dist/tools/workspace/cleanup-test-executions.tool.d.ts +15 -14
  285. package/dist/tools/workspace/cleanup-test-executions.tool.js +19 -15
  286. package/dist/tools/workspace/cleanup-test-executions.tool.js.map +1 -1
  287. package/dist/tools/workspace/create-folder.tool.d.ts +15 -16
  288. package/dist/tools/workspace/create-folder.tool.js +25 -12
  289. package/dist/tools/workspace/create-folder.tool.js.map +1 -1
  290. package/dist/tools/workspace/delete-folder.tool.d.ts +19 -14
  291. package/dist/tools/workspace/delete-folder.tool.js +24 -17
  292. package/dist/tools/workspace/delete-folder.tool.js.map +1 -1
  293. package/dist/tools/workspace/list-folders.tool.d.ts +7 -3
  294. package/dist/tools/workspace/list-folders.tool.js +5 -3
  295. package/dist/tools/workspace/list-folders.tool.js.map +1 -1
  296. package/dist/tools/workspace/list-projects.tool.d.ts +3 -3
  297. package/dist/tools/workspace/list-projects.tool.js +3 -1
  298. package/dist/tools/workspace/list-projects.tool.js.map +1 -1
  299. package/dist/tools/workspace/list-tags.tool.d.ts +3 -6
  300. package/dist/tools/workspace/list-tags.tool.js +3 -1
  301. package/dist/tools/workspace/list-tags.tool.js.map +1 -1
  302. package/dist/tools/workspace/move-workflow-to-folder.tool.d.ts +17 -14
  303. package/dist/tools/workspace/move-workflow-to-folder.tool.js +20 -16
  304. package/dist/tools/workspace/move-workflow-to-folder.tool.js.map +1 -1
  305. package/dist/tools/workspace/tag-workflow.tool.d.ts +15 -14
  306. package/dist/tools/workspace/tag-workflow.tool.js +16 -12
  307. package/dist/tools/workspace/tag-workflow.tool.js.map +1 -1
  308. package/dist/tracing/langsmith-tracing.d.ts +1 -0
  309. package/dist/tracing/langsmith-tracing.js +47 -57
  310. package/dist/tracing/langsmith-tracing.js.map +1 -1
  311. package/dist/types.d.ts +24 -50
  312. package/dist/utils/eval-agents.d.ts +10 -0
  313. package/dist/utils/eval-agents.js +54 -0
  314. package/dist/utils/eval-agents.js.map +1 -0
  315. package/dist/workflow-builder/sdk-prompt-sections.d.ts +1 -4
  316. package/dist/workflow-builder/sdk-prompt-sections.js +5 -513
  317. package/dist/workflow-builder/sdk-prompt-sections.js.map +1 -1
  318. package/dist/workflow-loop/guidance.js +3 -5
  319. package/dist/workflow-loop/guidance.js.map +1 -1
  320. package/dist/workspace/daytona-filesystem.js +15 -1
  321. package/dist/workspace/daytona-filesystem.js.map +1 -1
  322. package/package.json +15 -9
  323. package/dist/memory/working-memory-template.d.ts +0 -1
  324. package/dist/memory/working-memory-template.js +0 -25
  325. package/dist/memory/working-memory-template.js.map +0 -1
  326. package/dist/runtime/working-memory-tracing.d.ts +0 -19
  327. package/dist/runtime/working-memory-tracing.js +0 -111
  328. package/dist/runtime/working-memory-tracing.js.map +0 -1
  329. package/dist/tools/best-practices/guides/chatbot.d.ts +0 -1
  330. package/dist/tools/best-practices/guides/chatbot.js +0 -111
  331. package/dist/tools/best-practices/guides/chatbot.js.map +0 -1
  332. package/dist/tools/best-practices/guides/content-generation.d.ts +0 -1
  333. package/dist/tools/best-practices/guides/content-generation.js +0 -108
  334. package/dist/tools/best-practices/guides/content-generation.js.map +0 -1
  335. package/dist/tools/best-practices/guides/data-extraction.d.ts +0 -1
  336. package/dist/tools/best-practices/guides/data-extraction.js +0 -115
  337. package/dist/tools/best-practices/guides/data-extraction.js.map +0 -1
  338. package/dist/tools/best-practices/guides/data-persistence.d.ts +0 -1
  339. package/dist/tools/best-practices/guides/data-persistence.js +0 -198
  340. package/dist/tools/best-practices/guides/data-persistence.js.map +0 -1
  341. package/dist/tools/best-practices/guides/data-transformation.d.ts +0 -1
  342. package/dist/tools/best-practices/guides/data-transformation.js +0 -139
  343. package/dist/tools/best-practices/guides/data-transformation.js.map +0 -1
  344. package/dist/tools/best-practices/guides/document-processing.d.ts +0 -1
  345. package/dist/tools/best-practices/guides/document-processing.js +0 -326
  346. package/dist/tools/best-practices/guides/document-processing.js.map +0 -1
  347. package/dist/tools/best-practices/guides/form-input.d.ts +0 -1
  348. package/dist/tools/best-practices/guides/form-input.js +0 -166
  349. package/dist/tools/best-practices/guides/form-input.js.map +0 -1
  350. package/dist/tools/best-practices/guides/notification.d.ts +0 -1
  351. package/dist/tools/best-practices/guides/notification.js +0 -128
  352. package/dist/tools/best-practices/guides/notification.js.map +0 -1
  353. package/dist/tools/best-practices/guides/scheduling.d.ts +0 -1
  354. package/dist/tools/best-practices/guides/scheduling.js +0 -145
  355. package/dist/tools/best-practices/guides/scheduling.js.map +0 -1
  356. package/dist/tools/best-practices/guides/scraping-and-research.d.ts +0 -1
  357. package/dist/tools/best-practices/guides/scraping-and-research.js +0 -151
  358. package/dist/tools/best-practices/guides/scraping-and-research.js.map +0 -1
  359. package/dist/tools/best-practices/guides/triage.d.ts +0 -1
  360. package/dist/tools/best-practices/guides/triage.js +0 -142
  361. package/dist/tools/best-practices/guides/triage.js.map +0 -1
  362. package/dist/tools/filesystem/get-file-tree.tool.d.ts +0 -22
  363. package/dist/tools/filesystem/get-file-tree.tool.js +0 -64
  364. package/dist/tools/filesystem/get-file-tree.tool.js.map +0 -1
  365. package/dist/tools/filesystem/list-files.tool.d.ts +0 -30
  366. package/dist/tools/filesystem/list-files.tool.js +0 -100
  367. package/dist/tools/filesystem/list-files.tool.js.map +0 -1
  368. package/dist/tools/filesystem/read-file.tool.d.ts +0 -25
  369. package/dist/tools/filesystem/read-file.tool.js +0 -83
  370. package/dist/tools/filesystem/read-file.tool.js.map +0 -1
  371. package/dist/tools/filesystem/search-files.tool.d.ts +0 -31
  372. package/dist/tools/filesystem/search-files.tool.js +0 -96
  373. package/dist/tools/filesystem/search-files.tool.js.map +0 -1
@@ -0,0 +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- Be terse. You report to a parent orchestrator, not a human.\n- Do NOT produce code, node names, node configurations, or step-by-step node wiring.\n- Do NOT narrate (\"I'll search for...\", \"Let me look up\"). Just do the work.\n- No emojis, no filler, no markdown formatting in your reasoning.\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 `list-credentials`, `list-data-tables`, `get-best-practices` instead.\n - **Never ask about implementation details** \u2014 trigger types, node choices, schedule times, column names. Pick sensible defaults.\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 - **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 - **List your assumptions** on your first `add-plan-item` call. The user reviews the plan before execution and can reject/correct.\n\n2. **Discover** (3-6 tool calls) \u2014 check what exists and learn best practices:\n - `get-best-practices` for each relevant technique (e.g. \"form_input\", \"scheduling\", \"data_persistence\"). Call with \"list\" first to see available techniques, then fetch relevant ones. **This is important** \u2014 best practices inform your design decisions.\n - `get-suggested-nodes` for the relevant categories\n - `list-data-tables` to check for existing tables\n - `list-credentials` 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 ai_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 ai_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- **Call `add-plan-item` for each item as you design it.** Data tables first, then workflows. 3-6 discovery tool calls then start emitting items.\n- **Always call `submit-plan` after your last `add-plan-item`.** Never end without submitting.\n- **On rejection, be surgical.** Only change what the user asked for. Do NOT re-add items that are already correct.\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 produced by workflows A and B, it must depend on A and B.\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). Only use `delegate` kind for tasks that don't fit the other categories \u2014 never use `delegate` for data table operations.\n- **Data-table-only plans are valid.** If the request is purely about creating, populating, modifying, or deleting data tables \u2014 with no automation triggers, schedules, or integrations \u2014 use only `data-table` kind items. Do NOT wrap table operations in a `workflow` or `delegate` item.\n- **`data-table` kind supports any table operation.** For creation, include `columns`. For deletion, modification, or other operations, omit `columns` and describe the operation in `purpose`.\n- **Include seed data instructions in the `purpose` field.** When the user wants sample or initial rows, describe them in the data table item's `purpose` (e.g. \"Seed with 3 rows: ...\"). The data-table agent handles insertion.\n- **Each item's `purpose` must only describe what THAT item does.** Do not reference actions handled by other plan items. Each task is executed by an independent agent that only sees its own spec \u2014 cross-task context causes agents to perform work outside their scope.\n- Never fabricate node names \u2014 if unsure whether a node exists, search first.";
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PLANNER_AGENT_PROMPT = void 0;
4
+ const node_selection_1 = require("@n8n/workflow-sdk/prompts/node-selection");
5
+ exports.PLANNER_AGENT_PROMPT = `You are the n8n Workflow Planner — you design solution architectures. You do NOT build workflows.
6
+
7
+ You receive the recent conversation between the user and the orchestrator. Read it to understand what the user wants, then design the blueprint.
8
+
9
+ ## Output Discipline
10
+ - Be terse. You report to a parent orchestrator, not a human.
11
+ - Do NOT produce code, node names, node configurations, or step-by-step node wiring.
12
+ - Do NOT narrate ("I'll search for...", "Let me look up"). Just do the work.
13
+ - No emojis, no filler, no markdown formatting in your reasoning.
14
+
15
+ ## Method
16
+
17
+ 1. **Prefer assumptions over questions.** The user is waiting for a plan, and they can reject it if your assumptions are wrong — so default to making reasonable choices rather than asking.
18
+ - **Never ask about things you can discover** — call \`list-credentials\`, \`list-data-tables\`, \`get-best-practices\` instead.
19
+ - **Never ask about implementation details** — trigger types, node choices, schedule times, column names. Pick sensible defaults.
20
+ - **Never default resource identifiers** the user didn't mention (Slack channels, calendars, spreadsheets, folders, etc.) — leave them for the builder to resolve at build time.
21
+ - **Do ask when the answer would significantly change the plan** — e.g. the user's goal is ambiguous ("build me a CRM" — for sales? support? recruiting?), or a business rule must come from the user ("what should happen when payment fails?").
22
+ - **List your assumptions** on your first \`add-plan-item\` call. The user reviews the plan before execution and can reject/correct.
23
+
24
+ 2. **Discover** (3-6 tool calls) — check what exists and learn best practices:
25
+ - \`get-best-practices\` for each relevant technique (e.g. "form_input", "scheduling", "data_persistence"). Call with "list" first to see available techniques, then fetch relevant ones. **This is important** — best practices inform your design decisions.
26
+ - \`get-suggested-nodes\` for the relevant categories
27
+ - \`list-data-tables\` to check for existing tables
28
+ - \`list-credentials\` if the request involves external services
29
+ - Skip searches for nodes you already know exist (webhooks, schedule triggers, data tables, code, set, filter, etc.)
30
+
31
+ ## Node Selection Reference
32
+
33
+ Use these references when designing your plan — they help you pick the right trigger, prefer native nodes over Code, and correctly scope AI workflows.
34
+
35
+ ### AI Node Selection
36
+ ${node_selection_1.AI_NODE_SELECTION}
37
+
38
+ ### Node Selection by Use Case
39
+ ${node_selection_1.NODE_SELECTION_PATTERNS}
40
+
41
+ ### Trigger Selection
42
+ ${node_selection_1.TRIGGER_SELECTION}
43
+
44
+ ### Native Node Preference
45
+ ${node_selection_1.NATIVE_NODE_PREFERENCE}
46
+
47
+ 3. **Build incrementally** — call \`add-plan-item\` for each item:
48
+ - 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.
49
+ - Set \`summary\` and \`assumptions\` on your first call
50
+ - Each call makes the item visible to the user immediately
51
+ - \`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.
52
+ - \`triggerDescription\`: a few words describing trigger type (e.g. "Webhook POST", "Schedule daily"), no resource identifiers
53
+ - \`integrations\`: service names only (e.g. "Slack", "Google Calendar"), no resource identifiers or qualifiers
54
+ - \`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.
55
+ - \`columns\`: name and type only — no descriptions
56
+ - \`assumptions\`: design decisions only, no resource identifiers (channels, calendars, etc.)
57
+ - 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.
58
+ - After all items are added, call \`submit-plan\` to request user approval.
59
+
60
+ 4. **Handle approval** — \`submit-plan\` returns the user's decision:
61
+ - If \`approved: true\`: reply with "Plan approved." and stop.
62
+ - 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.
63
+
64
+ ## Critical Rules
65
+
66
+ - **Call \`add-plan-item\` for each item as you design it.** Data tables first, then workflows. 3-6 discovery tool calls then start emitting items.
67
+ - **Always call \`submit-plan\` after your last \`add-plan-item\`.** Never end without submitting.
68
+ - **On rejection, be surgical.** Only change what the user asked for. Do NOT re-add items that are already correct.
69
+ - **Dependencies are mandatory.** Every workflow MUST list the data table IDs it reads from or writes to in \`dependsOn\`. If workflow C needs data produced by workflows A and B, it must depend on A and B.
70
+ - **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). Only use \`delegate\` kind for tasks that don't fit the other categories — never use \`delegate\` for data table operations.
71
+ - **Data-table-only plans are valid.** If the request is purely about creating, populating, modifying, or deleting data tables — with no automation triggers, schedules, or integrations — use only \`data-table\` kind items. Do NOT wrap table operations in a \`workflow\` or \`delegate\` item.
72
+ - **\`data-table\` kind supports any table operation.** For creation, include \`columns\`. For deletion, modification, or other operations, omit \`columns\` and describe the operation in \`purpose\`.
73
+ - **Include seed data instructions in the \`purpose\` field.** When the user wants sample or initial rows, describe them in the data table item's \`purpose\` (e.g. "Seed with 3 rows: ..."). The data-table agent handles insertion.
74
+ - **Each item's \`purpose\` must only describe what THAT item does.** Do not reference actions handled by other plan items. Each task is executed by an independent agent that only sees its own spec — cross-task context causes agents to perform work outside their scope.
75
+ - Never fabricate node names — if unsure whether a node exists, search first.`;
76
+ //# sourceMappingURL=plan-agent-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-agent-prompt.js","sourceRoot":"","sources":["../../../src/tools/orchestration/plan-agent-prompt.ts"],"names":[],"mappings":";;;AAAA,6EAKkD;AAErC,QAAA,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BlC,kCAAiB;;;EAGjB,wCAAuB;;;EAGvB,kCAAiB;;;EAGjB,uCAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8EA8BsD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { OrchestrationContext } from '../../types';
2
+ 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>;
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPlanWithAgentTool = createPlanWithAgentTool;
4
+ const agent_1 = require("@mastra/core/agent");
5
+ const tools_1 = require("@mastra/core/tools");
6
+ const nanoid_1 = require("nanoid");
7
+ const zod_1 = require("zod");
8
+ const add_plan_item_tool_1 = require("./add-plan-item.tool");
9
+ const blueprint_accumulator_1 = require("./blueprint-accumulator");
10
+ const display_utils_1 = require("./display-utils");
11
+ const plan_agent_prompt_1 = require("./plan-agent-prompt");
12
+ const submit_plan_tool_1 = require("./submit-plan.tool");
13
+ const tracing_utils_1 = require("./tracing-utils");
14
+ const register_with_mastra_1 = require("../../agent/register-with-mastra");
15
+ const resumable_stream_executor_1 = require("../../runtime/resumable-stream-executor");
16
+ const consume_with_hitl_1 = require("../../stream/consume-with-hitl");
17
+ const langsmith_tracing_1 = require("../../tracing/langsmith-tracing");
18
+ const PLANNER_MAX_STEPS = 30;
19
+ const MESSAGE_HISTORY_COUNT = 5;
20
+ const PLANNER_DOMAIN_TOOL_NAMES = [
21
+ 'search-nodes',
22
+ 'get-suggested-nodes',
23
+ 'get-best-practices',
24
+ 'list-credentials',
25
+ 'list-data-tables',
26
+ 'get-data-table-schema',
27
+ 'list-workflows',
28
+ 'ask-user',
29
+ ];
30
+ const PLANNER_RESEARCH_TOOL_NAMES = ['web-search', 'fetch-url'];
31
+ function extractTextFromMemoryContent(content) {
32
+ if (typeof content === 'string')
33
+ return content;
34
+ if (isStructuredContent(content)) {
35
+ return extractTextParts(content.parts);
36
+ }
37
+ if (Array.isArray(content)) {
38
+ return extractTextParts(content);
39
+ }
40
+ return typeof content === 'object' && content !== null ? JSON.stringify(content) : '';
41
+ }
42
+ function isStructuredContent(value) {
43
+ return (typeof value === 'object' &&
44
+ value !== null &&
45
+ 'parts' in value &&
46
+ Array.isArray(value.parts));
47
+ }
48
+ function extractTextParts(parts) {
49
+ return parts
50
+ .filter((c) => typeof c === 'object' && c !== null && 'text' in c)
51
+ .map((c) => c.text)
52
+ .join('\n');
53
+ }
54
+ async function getRecentMessages(context, count) {
55
+ const messages = [];
56
+ if (context.memory) {
57
+ try {
58
+ const result = await context.memory.recall({
59
+ threadId: context.threadId,
60
+ perPage: count,
61
+ });
62
+ for (const m of result.messages) {
63
+ const role = m.role;
64
+ const content = extractTextFromMemoryContent(m.content);
65
+ if ((role === 'user' || role === 'assistant') && content.length > 0) {
66
+ messages.push({ role, content });
67
+ }
68
+ }
69
+ }
70
+ catch {
71
+ }
72
+ }
73
+ if (context.currentUserMessage) {
74
+ messages.push({ role: 'user', content: context.currentUserMessage });
75
+ }
76
+ return messages;
77
+ }
78
+ function formatMessagesForBriefing(messages, guidance) {
79
+ const parts = [];
80
+ if (messages.length > 0) {
81
+ parts.push('## Recent conversation');
82
+ for (const m of messages) {
83
+ const label = m.role === 'user' ? 'User' : 'Assistant';
84
+ const content = m.content.length > 2000 ? m.content.slice(0, 2000) + '...' : m.content;
85
+ parts.push(`**${label}:** ${content}`);
86
+ }
87
+ }
88
+ if (guidance) {
89
+ parts.push(`\n## Orchestrator guidance\n${guidance}`);
90
+ }
91
+ parts.push('\nDesign the solution blueprint based on the conversation above.');
92
+ return parts.join('\n\n');
93
+ }
94
+ function publishClearingEvent(context) {
95
+ context.eventBus.publish(context.threadId, {
96
+ type: 'tasks-update',
97
+ runId: context.runId,
98
+ agentId: context.orchestratorAgentId,
99
+ payload: { tasks: { tasks: [] }, planItems: [] },
100
+ });
101
+ }
102
+ async function clearDraftChecklist(context) {
103
+ try {
104
+ await context.taskStorage.save(context.threadId, { tasks: [] });
105
+ }
106
+ catch {
107
+ }
108
+ }
109
+ function createPlanWithAgentTool(context) {
110
+ return (0, tools_1.createTool)({
111
+ id: 'plan',
112
+ description: 'Design and execute a multi-step plan. Spawns a planner agent that reads ' +
113
+ 'the conversation history, discovers available credentials, data tables, ' +
114
+ 'and best practices, designs the architecture, and shows it to the user ' +
115
+ 'for approval. Use when the request requires 2 or more tasks with ' +
116
+ 'dependencies. When this tool returns, the plan is already approved ' +
117
+ 'and tasks are dispatched — just acknowledge briefly and end your turn.',
118
+ inputSchema: zod_1.z.object({
119
+ guidance: zod_1.z
120
+ .string()
121
+ .optional()
122
+ .describe('Optional steering note for the planner — use ONLY when the conversation ' +
123
+ 'history alone is ambiguous about what to build. The planner reads the ' +
124
+ 'last 5 messages directly, so do NOT rewrite the user request here.'),
125
+ }),
126
+ outputSchema: zod_1.z.object({
127
+ result: zod_1.z.string(),
128
+ }),
129
+ execute: async (input) => {
130
+ const plannerTools = {};
131
+ for (const name of PLANNER_DOMAIN_TOOL_NAMES) {
132
+ if (name in context.domainTools) {
133
+ plannerTools[name] = context.domainTools[name];
134
+ }
135
+ }
136
+ for (const name of PLANNER_RESEARCH_TOOL_NAMES) {
137
+ if (name in context.domainTools) {
138
+ plannerTools[name] = context.domainTools[name];
139
+ }
140
+ }
141
+ const accumulator = new blueprint_accumulator_1.BlueprintAccumulator();
142
+ plannerTools['add-plan-item'] = (0, add_plan_item_tool_1.createAddPlanItemTool)(accumulator, context);
143
+ plannerTools['remove-plan-item'] = (0, add_plan_item_tool_1.createRemovePlanItemTool)(accumulator, context);
144
+ plannerTools['submit-plan'] = (0, submit_plan_tool_1.createSubmitPlanTool)(accumulator, context);
145
+ const messages = await getRecentMessages(context, MESSAGE_HISTORY_COUNT);
146
+ const briefing = formatMessagesForBriefing(messages, input.guidance);
147
+ const subAgentId = `agent-planner-${(0, nanoid_1.nanoid)(6)}`;
148
+ const subtitle = input.guidance ?? messages.find((m) => m.role === 'user')?.content ?? 'Planning...';
149
+ context.eventBus.publish(context.threadId, {
150
+ type: 'agent-spawned',
151
+ runId: context.runId,
152
+ agentId: subAgentId,
153
+ payload: {
154
+ parentId: context.orchestratorAgentId,
155
+ role: 'planner',
156
+ tools: Object.keys(plannerTools),
157
+ kind: 'planner',
158
+ title: 'Planning',
159
+ subtitle: (0, display_utils_1.truncateLabel)(subtitle),
160
+ goal: briefing,
161
+ },
162
+ });
163
+ const traceRun = await (0, tracing_utils_1.startSubAgentTrace)(context, {
164
+ agentId: subAgentId,
165
+ role: 'planner',
166
+ kind: 'planner',
167
+ inputs: {
168
+ guidance: input.guidance,
169
+ messageCount: messages.length,
170
+ },
171
+ });
172
+ const tracedPlannerTools = (0, tracing_utils_1.traceSubAgentTools)(context, plannerTools, 'planner');
173
+ try {
174
+ const subAgent = new agent_1.Agent({
175
+ id: subAgentId,
176
+ name: 'Workflow Planner Agent',
177
+ instructions: {
178
+ role: 'system',
179
+ content: plan_agent_prompt_1.PLANNER_AGENT_PROMPT,
180
+ providerOptions: {
181
+ anthropic: { cacheControl: { type: 'ephemeral' } },
182
+ },
183
+ },
184
+ model: context.modelId,
185
+ tools: tracedPlannerTools,
186
+ });
187
+ (0, register_with_mastra_1.registerWithMastra)(subAgentId, subAgent, context.storage);
188
+ const resultText = await (0, tracing_utils_1.withTraceRun)(context, traceRun, async () => {
189
+ const traceParent = (0, langsmith_tracing_1.getTraceParentRun)();
190
+ return await (0, langsmith_tracing_1.withTraceParentContext)(traceParent, async () => {
191
+ const llmStepTraceHooks = (0, resumable_stream_executor_1.createLlmStepTraceHooks)(traceParent);
192
+ const stream = await subAgent.stream(briefing, {
193
+ maxSteps: PLANNER_MAX_STEPS,
194
+ abortSignal: context.abortSignal,
195
+ providerOptions: {
196
+ anthropic: { cacheControl: { type: 'ephemeral' } },
197
+ },
198
+ ...(llmStepTraceHooks?.executionOptions ?? {}),
199
+ });
200
+ const result = await (0, consume_with_hitl_1.consumeStreamWithHitl)({
201
+ agent: subAgent,
202
+ stream: stream,
203
+ runId: context.runId,
204
+ agentId: subAgentId,
205
+ eventBus: context.eventBus,
206
+ logger: context.logger,
207
+ threadId: context.threadId,
208
+ abortSignal: context.abortSignal,
209
+ waitForConfirmation: context.waitForConfirmation,
210
+ llmStepTraceHooks,
211
+ maxSteps: PLANNER_MAX_STEPS,
212
+ });
213
+ return await result.text;
214
+ });
215
+ });
216
+ await (0, tracing_utils_1.finishTraceRun)(context, traceRun, {
217
+ outputs: {
218
+ result: resultText,
219
+ agentId: subAgentId,
220
+ role: 'planner',
221
+ hasItems: !accumulator.isEmpty(),
222
+ itemCount: accumulator.getTaskItemsForEvent().length,
223
+ },
224
+ });
225
+ context.eventBus.publish(context.threadId, {
226
+ type: 'agent-completed',
227
+ runId: context.runId,
228
+ agentId: subAgentId,
229
+ payload: {
230
+ role: 'planner',
231
+ result: resultText,
232
+ },
233
+ });
234
+ if (accumulator.isApproved()) {
235
+ if (context.schedulePlannedTasks) {
236
+ await context.schedulePlannedTasks();
237
+ }
238
+ const taskCount = accumulator.getTaskList().length;
239
+ return {
240
+ result: `Plan approved and ${taskCount} task${taskCount === 1 ? '' : 's'} dispatched.`,
241
+ };
242
+ }
243
+ publishClearingEvent(context);
244
+ await clearDraftChecklist(context);
245
+ if (!accumulator.isEmpty()) {
246
+ return {
247
+ result: `Planner added ${accumulator.getTaskList().length} items but did not submit the plan for approval. The plan was not executed.`,
248
+ };
249
+ }
250
+ return {
251
+ result: `Planner finished without producing a plan. Agent output: ${resultText}`,
252
+ };
253
+ }
254
+ catch (error) {
255
+ const errorMessage = error instanceof Error ? error.message : String(error);
256
+ await (0, tracing_utils_1.failTraceRun)(context, traceRun, error, {
257
+ agent_id: subAgentId,
258
+ agent_role: 'planner',
259
+ });
260
+ context.eventBus.publish(context.threadId, {
261
+ type: 'agent-completed',
262
+ runId: context.runId,
263
+ agentId: subAgentId,
264
+ payload: {
265
+ role: 'planner',
266
+ result: '',
267
+ error: errorMessage,
268
+ },
269
+ });
270
+ publishClearingEvent(context);
271
+ await clearDraftChecklist(context);
272
+ return { result: `Planner error: ${errorMessage}` };
273
+ }
274
+ },
275
+ });
276
+ }
277
+ //# sourceMappingURL=plan-with-agent.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-with-agent.tool.js","sourceRoot":"","sources":["../../../src/tools/orchestration/plan-with-agent.tool.ts"],"names":[],"mappings":";;AAyLA,0DA4MC;AAvXD,8CAA2C;AAE3C,8CAAgD;AAChD,mCAAgC;AAChC,6BAAwB;AAExB,6DAAuF;AACvF,mEAA+D;AAC/D,mDAAgD;AAChD,2DAA2D;AAC3D,yDAA0D;AAC1D,mDAMyB;AACzB,2EAAsE;AACtE,uFAAkF;AAClF,sEAAuE;AACvE,uEAA4F;AAG5F,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAG7B,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAGhC,MAAM,yBAAyB,GAAG;IACjC,cAAc;IACd,qBAAqB;IACrB,oBAAoB;IACpB,kBAAkB;IAClB,kBAAkB;IAClB,uBAAuB;IACvB,gBAAgB;IAChB,UAAU;CACV,CAAC;AAGF,MAAM,2BAA2B,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;AAYhE,SAAS,4BAA4B,CAAC,OAAgB;IACrD,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IAGhD,IAAI,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,OAAO,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAGD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,O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,EAAE,iBAAiB;oBACvB,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,OAAO,EAAE,UAAU;oBACnB,OAAO,EAAE;wBACR,IAAI,EAAE,SAAS;wBACf,MAAM,EAAE,EAAE;wBACV,KAAK,EAAE,YAAY;qBACnB;iBACD,CAAC,CAAC;gBAGH,oBAAoB,CAAC,OAAO,CAAC,CAAC;gBAC9B,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;gBAEnC,OAAO,EAAE,MAAM,EAAE,kBAAkB,YAAY,EAAE,EAAE,CAAC;YACrD,CAAC;QACF,CAAC;KACD,CAAC,CAAC;AACJ,CAAC"}
@@ -1,45 +1,13 @@
1
+ import { z } from 'zod';
1
2
  import type { OrchestrationContext } from '../../types';
2
- export declare function createPlanTool(context: OrchestrationContext): import("@mastra/core/tools").Tool<{
3
- tasks: {
4
- id: string;
5
- title: string;
6
- kind: "delegate" | "build-workflow" | "manage-data-tables" | "research";
7
- spec: string;
8
- deps: string[];
9
- workflowId?: string | undefined;
10
- tools?: string[] | undefined;
11
- }[];
12
- }, {
13
- result: string;
14
- taskCount: number;
15
- }, {
16
- message: string;
17
- requestId: string;
18
- severity: "info";
19
- inputType: "plan-review";
20
- tasks: {
21
- tasks: {
22
- status: "cancelled" | "failed" | "todo" | "in_progress" | "done";
23
- id: string;
24
- description: string;
25
- }[];
26
- };
27
- }, {
3
+ export declare const planResumeSchema: z.ZodObject<{
4
+ approved: z.ZodBoolean;
5
+ userInput: z.ZodOptional<z.ZodString>;
6
+ }, "strip", z.ZodTypeAny, {
28
7
  approved: boolean;
29
8
  userInput?: string | undefined;
30
- }, import("@mastra/core/tools").ToolExecutionContext<{
31
- message: string;
32
- requestId: string;
33
- severity: "info";
34
- inputType: "plan-review";
35
- tasks: {
36
- tasks: {
37
- status: "cancelled" | "failed" | "todo" | "in_progress" | "done";
38
- id: string;
39
- description: string;
40
- }[];
41
- };
42
9
  }, {
43
10
  approved: boolean;
44
11
  userInput?: string | undefined;
45
- }, unknown>, "plan", unknown>;
12
+ }>;
13
+ export declare function createPlanTool(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>, "create-tasks", unknown>;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.planResumeSchema = void 0;
3
4
  exports.createPlanTool = createPlanTool;
4
5
  const tools_1 = require("@mastra/core/tools");
5
6
  const api_types_1 = require("@n8n/api-types");
@@ -27,15 +28,18 @@ const planOutputSchema = zod_1.z.object({
27
28
  result: zod_1.z.string(),
28
29
  taskCount: zod_1.z.number(),
29
30
  });
31
+ exports.planResumeSchema = zod_1.z.object({
32
+ approved: zod_1.z.boolean(),
33
+ userInput: zod_1.z.string().optional(),
34
+ });
30
35
  function createPlanTool(context) {
31
36
  return (0, tools_1.createTool)({
32
- id: 'plan',
33
- description: 'Persist a dependency-aware task plan for detached multi-step execution. ' +
34
- 'Use ONLY when the work requires 2 or more tasks with dependencies ' +
35
- '(e.g. data table setup + multiple workflows, parallel builds + consolidation). ' +
36
- 'Do NOT use for single workflow builds call build-workflow-with-agent directly instead. ' +
37
- 'The plan is shown to the user for approval before execution starts. ' +
38
- 'After calling plan, reply briefly and end your turn.',
37
+ id: 'create-tasks',
38
+ description: 'Submit a pre-built task list for detached multi-step execution. ' +
39
+ 'Use ONLY for replanning after a failure when you already have the task context ' +
40
+ 'and do not need resource discovery. For initial planning, call `plan` instead. ' +
41
+ 'The task list is shown to the user for approval before execution starts. ' +
42
+ 'After calling create-tasks, reply briefly and end your turn.',
39
43
  inputSchema: planInputSchema,
40
44
  outputSchema: planOutputSchema,
41
45
  suspendSchema: zod_1.z.object({
@@ -45,10 +49,7 @@ function createPlanTool(context) {
45
49
  inputType: zod_1.z.literal('plan-review'),
46
50
  tasks: api_types_1.taskListSchema,
47
51
  }),
48
- resumeSchema: zod_1.z.object({
49
- approved: zod_1.z.boolean(),
50
- userInput: zod_1.z.string().optional(),
51
- }),
52
+ resumeSchema: exports.planResumeSchema,
52
53
  execute: async (input, ctx) => {
53
54
  if (!context.plannedTaskService || !context.schedulePlannedTasks) {
54
55
  return {
@@ -56,7 +57,8 @@ function createPlanTool(context) {
56
57
  taskCount: 0,
57
58
  };
58
59
  }
59
- const { resumeData, suspend } = ctx?.agent ?? {};
60
+ const resumeData = ctx?.agent?.resumeData;
61
+ const suspend = ctx?.agent?.suspend;
60
62
  if (resumeData === undefined || resumeData === null) {
61
63
  await context.plannedTaskService.createPlan(context.threadId, input.tasks, {
62
64
  planRunId: context.runId,
@@ -90,7 +92,7 @@ function createPlanTool(context) {
90
92
  };
91
93
  }
92
94
  return {
93
- result: `User requested changes: ${resumeData.userInput ?? 'No feedback provided'}. Revise the plan and call plan() again.`,
95
+ result: `User requested changes: ${resumeData.userInput ?? 'No feedback provided'}. Revise the tasks and call create-tasks again.`,
94
96
  taskCount: 0,
95
97
  };
96
98
  },
@@ -1 +1 @@
1
- {"version":3,"file":"plan.tool.js","sourceRoot":"","sources":["../../../src/tools/orchestration/plan.tool.ts"],"names":[],"mappings":";;AAkCA,wCAqFC;AAvHD,8CAAgD;AAChD,8CAAgD;AAChD,mCAAgC;AAChC,6BAAwB;AAIxB,MAAM,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iDAAiD,CAAC;IAC1E,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAC1D,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,UAAU,CAAC,CAAC;IAC9E,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;I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,CAAC"}
@@ -1,5 +1,16 @@
1
+ import { z } from 'zod';
1
2
  import type { OrchestrationContext } from '../../types';
2
- export declare function createReportVerificationVerdictTool(context: OrchestrationContext): import("@mastra/core/tools").Tool<{
3
+ export declare const reportVerificationVerdictInputSchema: z.ZodObject<{
4
+ workItemId: z.ZodString;
5
+ workflowId: z.ZodString;
6
+ executionId: z.ZodOptional<z.ZodString>;
7
+ verdict: z.ZodEnum<["verified", "needs_patch", "needs_rebuild", "trigger_only", "needs_user_input", "failed_terminal"]>;
8
+ failureSignature: z.ZodOptional<z.ZodString>;
9
+ failedNodeName: z.ZodOptional<z.ZodString>;
10
+ diagnosis: z.ZodOptional<z.ZodString>;
11
+ patch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
12
+ summary: z.ZodString;
13
+ }, "strip", z.ZodTypeAny, {
3
14
  workItemId: string;
4
15
  workflowId: string;
5
16
  summary: string;
@@ -10,5 +21,14 @@ export declare function createReportVerificationVerdictTool(context: Orchestrati
10
21
  failureSignature?: string | undefined;
11
22
  failedNodeName?: string | undefined;
12
23
  }, {
13
- guidance: string;
14
- }, unknown, unknown, import("@mastra/core/tools").ToolExecutionContext<unknown, unknown, unknown>, "report-verification-verdict", unknown>;
24
+ workItemId: string;
25
+ workflowId: string;
26
+ summary: string;
27
+ verdict: "trigger_only" | "verified" | "needs_patch" | "needs_rebuild" | "needs_user_input" | "failed_terminal";
28
+ diagnosis?: string | undefined;
29
+ patch?: Record<string, unknown> | undefined;
30
+ executionId?: string | undefined;
31
+ failureSignature?: string | undefined;
32
+ failedNodeName?: string | undefined;
33
+ }>;
34
+ export declare function createReportVerificationVerdictTool(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>, "report-verification-verdict", unknown>;