@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
@@ -12,6 +12,7 @@ const create_tools_from_mcp_server_1 = require("../tools/filesystem/create-tools
12
12
  const langsmith_tracing_1 = require("../tracing/langsmith-tracing");
13
13
  const sanitize_mcp_schemas_1 = require("./sanitize-mcp-schemas");
14
14
  const system_prompt_1 = require("./system-prompt");
15
+ const tool_access_1 = require("./tool-access");
15
16
  function buildMcpServers(configs) {
16
17
  const servers = {};
17
18
  for (const server of configs) {
@@ -28,21 +29,21 @@ let cachedMcpTools = null;
28
29
  let cachedMcpServersKey = '';
29
30
  let cachedBrowserMcpTools = null;
30
31
  let cachedBrowserMcpKey = '';
31
- let cachedToolSearchProcessor = null;
32
- let cachedToolSearchKey = '';
33
32
  let cachedMastra = null;
34
33
  let cachedMastraStorageKey = '';
35
- const ALWAYS_LOADED_TOOLS = new Set(['plan', 'delegate', 'ask-user', 'web-search', 'fetch-url']);
34
+ const ALWAYS_LOADED_TOOLS = new Set([
35
+ 'plan',
36
+ 'create-tasks',
37
+ 'delegate',
38
+ 'ask-user',
39
+ 'web-search',
40
+ 'fetch-url',
41
+ ]);
36
42
  function getOrCreateToolSearchProcessor(tools) {
37
- const key = JSON.stringify(Object.keys(tools).sort());
38
- if (cachedToolSearchProcessor && cachedToolSearchKey === key)
39
- return cachedToolSearchProcessor;
40
- cachedToolSearchProcessor = new processors_1.ToolSearchProcessor({
43
+ return new processors_1.ToolSearchProcessor({
41
44
  tools: tools,
42
45
  search: { topK: 5 },
43
46
  });
44
- cachedToolSearchKey = key;
45
- return cachedToolSearchProcessor;
46
47
  }
47
48
  async function getMcpTools(mcpServers) {
48
49
  const key = JSON.stringify(mcpServers);
@@ -77,46 +78,16 @@ async function getBrowserMcpTools(config) {
77
78
  }
78
79
  function ensureMastraRegistered(agent, storage) {
79
80
  const key = storage.id ?? 'default';
80
- if (cachedMastra && cachedMastraStorageKey === key) {
81
- agent.__registerMastra(cachedMastra);
82
- return;
81
+ if (!cachedMastra || cachedMastraStorageKey !== key) {
82
+ cachedMastra = new mastra_1.Mastra({ storage });
83
+ cachedMastraStorageKey = key;
83
84
  }
84
- cachedMastra = new mastra_1.Mastra({
85
- agents: { 'n8n-instance-agent': agent },
86
- storage,
87
- });
88
- cachedMastraStorageKey = key;
85
+ agent.__registerMastra(cachedMastra);
89
86
  }
90
87
  async function createInstanceAgent(options) {
91
88
  const { modelId, context, orchestrationContext, mcpServers = [], memoryConfig, disableDeferredTools = false, } = options;
92
89
  const domainTools = (0, tools_1.createAllTools)(context);
93
- const BUILDER_ONLY_TOOLS = new Set([
94
- 'search-nodes',
95
- 'list-nodes',
96
- 'get-node-type-definition',
97
- 'get-node-description',
98
- 'get-best-practices',
99
- 'search-template-structures',
100
- 'search-template-parameters',
101
- 'build-workflow',
102
- 'get-workflow-as-code',
103
- ]);
104
- const DATA_TABLE_WRITE_TOOLS = new Set([
105
- 'create-data-table',
106
- 'delete-data-table',
107
- 'add-data-table-column',
108
- 'delete-data-table-column',
109
- 'rename-data-table-column',
110
- 'insert-data-table-rows',
111
- 'update-data-table-rows',
112
- 'delete-data-table-rows',
113
- ]);
114
- const orchestratorDomainTools = {};
115
- for (const [name, tool] of Object.entries(domainTools)) {
116
- if (!BUILDER_ONLY_TOOLS.has(name) && !DATA_TABLE_WRITE_TOOLS.has(name)) {
117
- orchestratorDomainTools[name] = tool;
118
- }
119
- }
90
+ const orchestratorDomainTools = (0, tool_access_1.getOrchestratorDomainTools)(domainTools);
120
91
  const mcpTools = await getMcpTools(mcpServers);
121
92
  const browserMcpTools = await getBrowserMcpTools(orchestrationContext?.browserMcpConfig);
122
93
  const browserToolNames = new Set([
@@ -177,12 +148,13 @@ async function createInstanceAgent(options) {
177
148
  const systemPrompt = (0, system_prompt_1.getSystemPrompt)({
178
149
  researchMode: orchestrationContext?.researchMode,
179
150
  webhookBaseUrl: orchestrationContext?.webhookBaseUrl,
180
- filesystemAccess: !!(context.localMcpServer ?? context.filesystemService),
151
+ filesystemAccess: (context.localMcpServer?.getToolsByCategory('filesystem').length ?? 0) > 0,
181
152
  localGateway: context.localGatewayStatus,
182
153
  toolSearchEnabled: hasDeferrableTools,
183
154
  licenseHints: context.licenseHints,
184
155
  timeZone: options.timeZone,
185
156
  browserAvailable: browserToolNames.size > 0,
157
+ branchReadOnly: context.branchReadOnly,
186
158
  });
187
159
  const agent = new agent_1.Agent({
188
160
  id: 'n8n-instance-agent',
@@ -1 +1 @@
1
- {"version":3,"file":"instance-agent.js","sourceRoot":"","sources":["../../src/agent/instance-agent.ts"],"names":[],"mappings":";;AAwHA,kDAoLC;AA3SD,8CAA2C;AAC3C,gDAA6C;AAC7C,wDAA+F;AAE/F,qCAAwC;AACxC,mCAAgC;AAEhC,2DAAuD;AACvD,oCAAoE;AACpE,mGAAiG;AACjG,oEAA0F;AAE1F,iEAAgE;AAChE,mDAAkD;AAElD,SAAS,eAAe,CACvB,OAA0B;IAK1B,MAAM,OAAO,GAGT,EAAE,CAAC;IACP,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC9B,IAAI,MAAM,CAAC,GAAG,EAAE,CAAC;YAChB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;QACrD,CAAC;aAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YAC3B,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC;QACxF,CAAC;IACF,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAID,IAAI,cAAc,GAAsB,IAAI,CAAC;AAC7C,IAAI,mBAAmB,GAAG,EAAE,CAAC;AAE7B,IAAI,qBAAqB,GAAsB,IAAI,CAAC;AACpD,IAAI,mBAAmB,GAAG,EAAE,CAAC;AAE7B,IAAI,yBAAyB,GAA+B,IAAI,CAAC;AACjE,IAAI,mBAAmB,GAAG,EAAE,CAAC;AAE7B,IAAI,YAAY,GAAkB,IAAI,CAAC;AACvC,IAAI,sBAAsB,GAA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C,CAAC,SAAS;KAC1E,CAAC,CACF,CAAC;IAGF,sBAAsB,CAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAEpD,OAAO,KAAK,CAAC;AACd,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { Agent } from '@mastra/core/agent';
2
2
  import type { MastraCompositeStore } from '@mastra/core/storage';
3
- export declare function registerWithMastra(agentId: string, agent: Agent, storage: MastraCompositeStore): void;
3
+ export declare function registerWithMastra(_agentId: string, agent: Agent, storage: MastraCompositeStore): void;
@@ -4,16 +4,12 @@ exports.registerWithMastra = registerWithMastra;
4
4
  const mastra_1 = require("@mastra/core/mastra");
5
5
  let cachedSubAgentMastra = null;
6
6
  let cachedSubAgentStorageKey = '';
7
- function registerWithMastra(agentId, agent, storage) {
7
+ function registerWithMastra(_agentId, agent, storage) {
8
8
  const key = storage.id ?? 'default';
9
- if (cachedSubAgentMastra && cachedSubAgentStorageKey === key) {
10
- agent.__registerMastra(cachedSubAgentMastra);
11
- return;
9
+ if (!cachedSubAgentMastra || cachedSubAgentStorageKey !== key) {
10
+ cachedSubAgentMastra = new mastra_1.Mastra({ storage });
11
+ cachedSubAgentStorageKey = key;
12
12
  }
13
- cachedSubAgentMastra = new mastra_1.Mastra({
14
- agents: { [agentId]: agent },
15
- storage,
16
- });
17
- cachedSubAgentStorageKey = key;
13
+ agent.__registerMastra(cachedSubAgentMastra);
18
14
  }
19
15
  //# sourceMappingURL=register-with-mastra.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-with-mastra.js","sourceRoot":"","sources":["../../src/agent/register-with-mastra.ts"],"names":[],"mappings":";;AAgBA,gDAeC;AArBD,gDAA6C;AAG7C,IAAI,oBAAoB,GAAkB,IAAI,CAAC;AAC/C,IAAI,wBAAwB,GAAG,EAAE,CAAC;AAElC,SAAgB,kBAAkB,CAAC,OAAe,EAAE,KAAY,EAAE,OAA6B;IAC9F,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE,IAAI,SAAS,CAAC;IAEpC,IAAI,oBAAoB,IAAI,wBAAwB,KAAK,GAAG,EAAE,CAAC;QAG9D,KAAK,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;QAC7C,OAAO;IACR,CAAC;IAED,oBAAoB,GAAG,IAAI,eAAM,CAAC;QACjC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE;QAC5B,OAAO;KACP,CAAC,CAAC;IACH,wBAAwB,GAAG,GAAG,CAAC;AAChC,CAAC"}
1
+ {"version":3,"file":"register-with-mastra.js","sourceRoot":"","sources":["../../src/agent/register-with-mastra.ts"],"names":[],"mappings":";;AAkBA,gDAYC;AAlBD,gDAA6C;AAG7C,IAAI,oBAAoB,GAAkB,IAAI,CAAC;AAC/C,IAAI,wBAAwB,GAAG,EAAE,CAAC;AAElC,SAAgB,kBAAkB,CAAC,QAAgB,EAAE,KAAY,EAAE,OAA6B;IAC/F,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE,IAAI,SAAS,CAAC;IAEpC,IAAI,CAAC,oBAAoB,IAAI,wBAAwB,KAAK,GAAG,EAAE,CAAC;QAI/D,oBAAoB,GAAG,IAAI,eAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAC/C,wBAAwB,GAAG,GAAG,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type IterationLog } from '../storage/iteration-log';
2
+ export interface RunningTaskSummary {
3
+ taskId: string;
4
+ role: string;
5
+ goal?: string;
6
+ }
7
+ export interface SubAgentBriefingInput {
8
+ task: string;
9
+ conversationContext?: string;
10
+ artifacts?: Record<string, unknown>;
11
+ additionalContext?: string;
12
+ requirements?: string;
13
+ iteration?: {
14
+ log: IterationLog;
15
+ threadId: string;
16
+ taskKey: string;
17
+ };
18
+ runningTasks?: RunningTaskSummary[];
19
+ }
20
+ export declare function buildSubAgentBriefing(input: SubAgentBriefingInput): Promise<string>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildSubAgentBriefing = buildSubAgentBriefing;
4
+ const iteration_log_1 = require("../storage/iteration-log");
5
+ async function buildSubAgentBriefing(input) {
6
+ const parts = [];
7
+ parts.push(`<task>\n${input.task}\n</task>`);
8
+ if (input.conversationContext) {
9
+ parts.push(`<conversation-context>\n${input.conversationContext}\n</conversation-context>`);
10
+ }
11
+ if (input.artifacts && Object.keys(input.artifacts).length > 0) {
12
+ parts.push(`<artifacts>\n${JSON.stringify(input.artifacts)}\n</artifacts>`);
13
+ }
14
+ if (input.additionalContext) {
15
+ parts.push(input.additionalContext);
16
+ }
17
+ if (input.requirements) {
18
+ parts.push(input.requirements);
19
+ }
20
+ if (input.runningTasks && input.runningTasks.length > 0) {
21
+ const taskLines = input.runningTasks
22
+ .map((t) => ` <running-task taskId="${t.taskId}" role="${t.role}">${t.goal ?? ''}</running-task>`)
23
+ .join('\n');
24
+ parts.push(`<thread-state>\n${taskLines}\n</thread-state>`);
25
+ }
26
+ if (input.iteration) {
27
+ try {
28
+ const entries = await input.iteration.log.getForTask(input.iteration.threadId, input.iteration.taskKey);
29
+ const formatted = (0, iteration_log_1.formatPreviousAttempts)(entries);
30
+ if (formatted) {
31
+ parts.push(formatted);
32
+ }
33
+ }
34
+ catch {
35
+ }
36
+ }
37
+ return parts.join('\n\n');
38
+ }
39
+ //# sourceMappingURL=sub-agent-briefing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sub-agent-briefing.js","sourceRoot":"","sources":["../../src/agent/sub-agent-briefing.ts"],"names":[],"mappings":";;AAwCA,sDAsDC;AA9FD,4DAAqF;AAwC9E,KAAK,UAAU,qBAAqB,CAAC,KAA4B;IACvE,MAAM,KAAK,GAAa,EAAE,CAAC;IAG3B,KAAK,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,IAAI,WAAW,CAAC,CAAC;IAG7C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S,GAAG,IAAA,sCAAsB,EAAC,OAAO,CAAC,CAAC;YAClD,IAAI,SAAS,EAAE,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACvB,CAAC;QACF,CAAC;QAAC,MAAM,CAAC;QAET,CAAC;IACF,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,71 @@
1
+ import { z } from 'zod';
2
+ import type { WorkSummary } from '../stream/work-summary-accumulator';
3
+ export declare const subAgentDebriefingSchema: z.ZodObject<{
4
+ agentId: z.ZodString;
5
+ role: z.ZodString;
6
+ status: z.ZodEnum<["completed", "failed", "cancelled"]>;
7
+ result: z.ZodString;
8
+ toolCallCount: z.ZodNumber;
9
+ toolErrorCount: z.ZodNumber;
10
+ toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
11
+ toolCallId: z.ZodString;
12
+ toolName: z.ZodString;
13
+ succeeded: z.ZodBoolean;
14
+ errorSummary: z.ZodOptional<z.ZodString>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ succeeded: boolean;
17
+ toolCallId: string;
18
+ toolName: string;
19
+ errorSummary?: string | undefined;
20
+ }, {
21
+ succeeded: boolean;
22
+ toolCallId: string;
23
+ toolName: string;
24
+ errorSummary?: string | undefined;
25
+ }>, "many">>;
26
+ durationMs: z.ZodOptional<z.ZodNumber>;
27
+ stoppingReason: z.ZodOptional<z.ZodString>;
28
+ blockers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ result: string;
31
+ status: "completed" | "failed" | "cancelled";
32
+ role: string;
33
+ agentId: string;
34
+ toolCallCount: number;
35
+ toolErrorCount: number;
36
+ toolCalls?: {
37
+ succeeded: boolean;
38
+ toolCallId: string;
39
+ toolName: string;
40
+ errorSummary?: string | undefined;
41
+ }[] | undefined;
42
+ durationMs?: number | undefined;
43
+ blockers?: string[] | undefined;
44
+ stoppingReason?: string | undefined;
45
+ }, {
46
+ result: string;
47
+ status: "completed" | "failed" | "cancelled";
48
+ role: string;
49
+ agentId: string;
50
+ toolCallCount: number;
51
+ toolErrorCount: number;
52
+ toolCalls?: {
53
+ succeeded: boolean;
54
+ toolCallId: string;
55
+ toolName: string;
56
+ errorSummary?: string | undefined;
57
+ }[] | undefined;
58
+ durationMs?: number | undefined;
59
+ blockers?: string[] | undefined;
60
+ stoppingReason?: string | undefined;
61
+ }>;
62
+ export type SubAgentDebriefing = z.infer<typeof subAgentDebriefingSchema>;
63
+ export interface BuildDebriefingInput {
64
+ agentId: string;
65
+ role: string;
66
+ result: string;
67
+ workSummary: WorkSummary;
68
+ startTime: number;
69
+ error?: string;
70
+ }
71
+ export declare function buildDebriefing(input: BuildDebriefingInput): SubAgentDebriefing;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subAgentDebriefingSchema = void 0;
4
+ exports.buildDebriefing = buildDebriefing;
5
+ const zod_1 = require("zod");
6
+ const work_summary_accumulator_1 = require("../stream/work-summary-accumulator");
7
+ exports.subAgentDebriefingSchema = zod_1.z.object({
8
+ agentId: zod_1.z.string(),
9
+ role: zod_1.z.string(),
10
+ status: zod_1.z.enum(['completed', 'failed', 'cancelled']),
11
+ result: zod_1.z.string(),
12
+ toolCallCount: zod_1.z.number().int().min(0),
13
+ toolErrorCount: zod_1.z.number().int().min(0),
14
+ toolCalls: zod_1.z.array(work_summary_accumulator_1.toolCallSummarySchema).optional(),
15
+ durationMs: zod_1.z.number().optional(),
16
+ stoppingReason: zod_1.z.string().optional(),
17
+ blockers: zod_1.z.array(zod_1.z.string()).optional(),
18
+ });
19
+ function buildDebriefing(input) {
20
+ const { agentId, role, result, workSummary, startTime, error } = input;
21
+ const status = error ? 'failed' : 'completed';
22
+ const durationMs = Date.now() - startTime;
23
+ const blockers = workSummary.toolCalls
24
+ .filter((c) => !c.succeeded && c.errorSummary)
25
+ .map((c) => `${c.toolName}: ${c.errorSummary}`);
26
+ return {
27
+ agentId,
28
+ role,
29
+ status,
30
+ result,
31
+ toolCallCount: workSummary.totalToolCalls,
32
+ toolErrorCount: workSummary.totalToolErrors,
33
+ ...(workSummary.toolCalls.length > 0 ? { toolCalls: workSummary.toolCalls } : {}),
34
+ durationMs,
35
+ ...(error ? { stoppingReason: error } : {}),
36
+ ...(blockers.length > 0 ? { blockers } : {}),
37
+ };
38
+ }
39
+ //# sourceMappingURL=sub-agent-debriefing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sub-agent-debriefing.js","sourceRoot":"","sources":["../../src/agent/sub-agent-debriefing.ts"],"names":[],"mappings":";;;AAsDA,0CAuBC;AA7ED,6BAAwB;AAExB,iFAA2E;AAK9D,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAEhD,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IAEnB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAEhB,MAAM,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAEpD,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAIlB,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEtC,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEvC,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,gDAAqB,CAAC,CAAC,QAAQ,EAAE;IAIpD,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAIjC,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAErC,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACxC,CA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output Protocol (MANDATORY)\nYou are reporting to a parent agent, NOT a human user. Your output is machine-consumed.\n- Return ONLY structured data: IDs, statuses, errors, counts.\n- NO prose, NO narration, NO emojis, NO markdown headers (## or **bold**), NO filler phrases.\n- Do NOT describe what you are about to do or what you did. Just return the facts.\n- One tool call at a time unless truly independent. Minimum tool calls needed.\n- You cannot delegate to other agents or create plans.\n- If you are stuck or need information only a human can provide, use the ask-user tool.\n- Do NOT retry the same failing approach more than twice \u2014 ask the user instead.";
12
+ declare const SUB_AGENT_PROTOCOL = "## Output Protocol (MANDATORY)\nYou are reporting to a parent agent, NOT a human user. Your output is machine-consumed.\n\n### Structured Result (required)\nReturn a concise result summary: IDs created, statuses, counts, errors encountered.\nNo emojis, no markdown headers, no filler phrases.\n\n### Diagnostic Context (when relevant)\nIf you encountered errors, retried operations, or made non-obvious decisions, add a brief\ndiagnostic section at the end explaining:\n- What approaches you tried and why they failed\n- What blockers remain (missing credentials, permissions, API errors)\n- What assumptions you made\n\nKeep diagnostics to 2-3 sentences maximum. Omit entirely when the task succeeded cleanly.\n\n### Rules\n- One tool call at a time unless truly independent. Minimum tool calls needed.\n- You cannot delegate to other agents or create plans.\n- If you are stuck or need information only a human can provide, use the ask-user tool.\n- Do NOT retry the same failing approach more than twice \u2014 ask the user instead.";
13
13
  export { SUB_AGENT_PROTOCOL };
14
14
  export declare function createSubAgent(options: SubAgentOptions): Agent;
@@ -6,9 +6,21 @@ const agent_1 = require("@mastra/core/agent");
6
6
  const langsmith_tracing_1 = require("../tracing/langsmith-tracing");
7
7
  const SUB_AGENT_PROTOCOL = `## Output Protocol (MANDATORY)
8
8
  You are reporting to a parent agent, NOT a human user. Your output is machine-consumed.
9
- - Return ONLY structured data: IDs, statuses, errors, counts.
10
- - NO prose, NO narration, NO emojis, NO markdown headers (## or **bold**), NO filler phrases.
11
- - Do NOT describe what you are about to do or what you did. Just return the facts.
9
+
10
+ ### Structured Result (required)
11
+ Return a concise result summary: IDs created, statuses, counts, errors encountered.
12
+ No emojis, no markdown headers, no filler phrases.
13
+
14
+ ### Diagnostic Context (when relevant)
15
+ If you encountered errors, retried operations, or made non-obvious decisions, add a brief
16
+ diagnostic section at the end explaining:
17
+ - What approaches you tried and why they failed
18
+ - What blockers remain (missing credentials, permissions, API errors)
19
+ - What assumptions you made
20
+
21
+ Keep diagnostics to 2-3 sentences maximum. Omit entirely when the task succeeded cleanly.
22
+
23
+ ### Rules
12
24
  - One tool call at a time unless truly independent. Minimum tool calls needed.
13
25
  - You cannot delegate to other agents or create plans.
14
26
  - If you are stuck or need information only a human can provide, use the ask-user tool.
@@ -1 +1 @@
1
- {"version":3,"file":"sub-agent-factory.js","sourceRoot":"","sources":["../../src/agent/sub-agent-factory.ts"],"names":[],"mappings":";;;AA2CA,wCA6BC;AAxED,8CAA2C;AAG3C,oEAA0F;AAmB1F,MAAM,kBAAkB,GAAG;;;;;;;;iFAQsD,CAAC;AAEzE,gDAAkB;AAE3B,SAAS,mBAAmB,CAAC,IAAY,EAAE,YAAoB;IAC9D,OAAO,GAAG,kBAAkB;;qCAEQ,IAAI;;;EAGvC,YAAY,EAAE,CAAC;AACjB,CAAC;AAED,SAAgB,cAAc,CAAC,OAAwB;IACtD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE1E,MAAM,YAAY,GAAG,mBAAmB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAE7D,MAAM,KAAK,GAAG,IAAI,aAAK,CAAC;QACvB,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,cAAc,IAAI,EAAE;QAC1B,YAAY,EAAE;YACb,IAAI,EAAE,QAAiB;YACvB,OAAO,EAAE,YAAY;YACrB,eAAe,EAAE;gBAChB,SAAS,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE;aAClD;SACD;QACD,KAAK,EAAE,OAAO;QACd,KAAK;KACL,CAAC,CAAC;IAEH,IAAA,uCAAmB,EAClB,QAAQ,EACR,IAAA,yCAAqB,EAAC;QACrB,YAAY;QACZ,KAAK;QACL,OAAO;KACP,CAAC,CACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACd,CAAC"}
1
+ {"version":3,"file":"sub-agent-factory.js","sourceRoot":"","sources":["../../src/agent/sub-agent-factory.ts"],"names":[],"mappings":";;;AAuDA,wCA6BC;AApFD,8CAA2C;AAG3C,oEAA0F;AAmB1F,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;iFAoBsD,CAAC;AAEzE,gDAAkB;AAE3B,SAAS,mBAAmB,CAAC,IAAY,EAAE,YAAoB;IAC9D,OAAO,GAAG,kBAAkB;;qCAEQ,IAAI;;;EAGvC,YAAY,EAAE,CAAC;AACjB,CAAC;AAED,SAAgB,cAAc,CAAC,OAAwB;IACtD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE1E,MAAM,YAAY,GAAG,mBAAmB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAE7D,MAAM,KAAK,GAAG,IAAI,aAAK,CAAC;QACvB,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,cAAc,IAAI,EAAE;QAC1B,YAAY,EAAE;YACb,IAAI,EAAE,QAAiB;YACvB,OAAO,EAAE,YAAY;YACrB,eAAe,EAAE;gBAChB,SAAS,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE;aAClD;SACD;QACD,KAAK,EAAE,OAAO;QACd,KAAK;KACL,CAAC,CAAC;IAEH,IAAA,uCAAmB,EAClB,QAAQ,EACR,IAAA,yCAAqB,EAAC;QACrB,YAAY;QACZ,KAAK;QACL,OAAO;KACP,CAAC,CACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACd,CAAC"}
@@ -8,6 +8,7 @@ interface SystemPromptOptions {
8
8
  licenseHints?: string[];
9
9
  timeZone?: string;
10
10
  browserAvailable?: boolean;
11
+ branchReadOnly?: boolean;
11
12
  }
12
13
  export declare function getSystemPrompt(options?: SystemPromptOptions): string;
13
14
  export {};