@ai-setting/roy-agent-core 1.7.52 → 1.7.55

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 (367) hide show
  1. package/dist/config/config-component.d.ts +346 -0
  2. package/dist/config/config-parser.d.ts +45 -0
  3. package/dist/config/env-key.d.ts +97 -0
  4. package/dist/config/env-source.d.ts +113 -0
  5. package/dist/config/file-source.d.ts +90 -0
  6. package/dist/config/index.d.ts +4 -0
  7. package/dist/config/protocol-resolver.d.ts +94 -0
  8. package/dist/env/agent/agent-component.d.ts +646 -0
  9. package/dist/env/agent/agent-config-registration.d.ts +18 -0
  10. package/dist/env/agent/agent-registry.d.ts +500 -0
  11. package/dist/env/agent/index.d.ts +9 -0
  12. package/dist/env/agent/index.js +3 -3
  13. package/dist/env/agent/summary-agent.d.ts +44 -0
  14. package/dist/env/agent/types.d.ts +503 -0
  15. package/dist/env/commands/commands-component.d.ts +97 -0
  16. package/dist/env/commands/commands-config-registration.d.ts +19 -0
  17. package/dist/env/commands/index.d.ts +7 -0
  18. package/dist/env/commands/parser.d.ts +18 -0
  19. package/dist/env/commands/types.d.ts +133 -0
  20. package/dist/env/component.d.ts +186 -0
  21. package/dist/env/constants.d.ts +112 -0
  22. package/dist/env/context/env-context.d.ts +420 -0
  23. package/dist/env/context/env-event.d.ts +144 -0
  24. package/dist/env/context/index.d.ts +13 -0
  25. package/dist/env/debug/debug-component.d.ts +160 -0
  26. package/dist/env/debug/formatters/index.d.ts +8 -0
  27. package/dist/env/debug/formatters/repl-formatter.d.ts +80 -0
  28. package/dist/env/debug/formatters/trace-formatter.d.ts +43 -0
  29. package/dist/env/debug/formatters/tree-formatter.d.ts +72 -0
  30. package/dist/env/debug/index.d.ts +15 -0
  31. package/dist/env/debug/index.js +1 -1
  32. package/dist/env/debug/parser/regex-parser.d.ts +49 -0
  33. package/dist/env/debug/parser/span-builder.d.ts +79 -0
  34. package/dist/env/debug/reader/log-reader.d.ts +55 -0
  35. package/dist/env/debug/reader/span-db-reader.d.ts +70 -0
  36. package/dist/env/debug/types.d.ts +145 -0
  37. package/dist/env/environment.d.ts +185 -0
  38. package/dist/env/error-reply.d.ts +184 -0
  39. package/dist/env/errors.d.ts +120 -0
  40. package/dist/env/event-source/bounty-cli-handler.d.ts +42 -0
  41. package/dist/env/event-source/bounty-im-handler.d.ts +232 -0
  42. package/dist/env/event-source/event-source-component.d.ts +177 -0
  43. package/dist/env/event-source/event-source-config-registration.d.ts +18 -0
  44. package/dist/env/event-source/event-source-handlers.d.ts +472 -0
  45. package/dist/env/event-source/event-store.d.ts +110 -0
  46. package/dist/env/event-source/idempotency-key.d.ts +19 -0
  47. package/dist/env/event-source/index.d.ts +15 -0
  48. package/dist/env/event-source/index.js +6 -6
  49. package/dist/env/event-source/timer-handler.d.ts +74 -0
  50. package/dist/env/event-source/types.d.ts +803 -0
  51. package/dist/env/hook/global-hook-manager.d.ts +73 -0
  52. package/dist/env/hook/hook-manager.d.ts +139 -0
  53. package/dist/env/hook/index.d.ts +9 -0
  54. package/dist/env/hook/types.d.ts +107 -0
  55. package/dist/env/index.d.ts +24 -0
  56. package/dist/env/index.js +18 -18
  57. package/dist/env/interface.d.ts +156 -0
  58. package/dist/env/lark-mention-utils.d.ts +59 -0
  59. package/dist/env/llm/adapter-ai-sdk.d.ts +10 -0
  60. package/dist/env/llm/adapter-pi-ai.d.ts +184 -0
  61. package/dist/env/llm/adapter.d.ts +100 -0
  62. package/dist/env/llm/factory.d.ts +13 -0
  63. package/dist/env/llm/hooks.d.ts +150 -0
  64. package/dist/env/llm/index.d.ts +16 -0
  65. package/dist/env/llm/index.js +2 -2
  66. package/dist/env/llm/invoke.d.ts +304 -0
  67. package/dist/env/llm/llm-cache.d.ts +38 -0
  68. package/dist/env/llm/llm.d.ts +263 -0
  69. package/dist/env/llm/opencode-session.d.ts +79 -0
  70. package/dist/env/llm/provider.d.ts +40 -0
  71. package/dist/env/llm/reasoning-defense.d.ts +104 -0
  72. package/dist/env/llm/tool-args-parser.d.ts +77 -0
  73. package/dist/env/llm/tool-schema.d.ts +54 -0
  74. package/dist/env/llm/transform.d.ts +57 -0
  75. package/dist/env/llm/types.d.ts +844 -0
  76. package/dist/env/log-trace/decorator.d.ts +88 -0
  77. package/dist/env/log-trace/index.d.ts +14 -0
  78. package/dist/env/log-trace/log-trace-component.d.ts +268 -0
  79. package/dist/env/log-trace/log-trace-config-registration.d.ts +25 -0
  80. package/dist/env/log-trace/logger.d.ts +83 -0
  81. package/dist/env/log-trace/opentelemetry/cli-propagation.d.ts +105 -0
  82. package/dist/env/log-trace/opentelemetry/mod.d.ts +24 -0
  83. package/dist/env/log-trace/opentelemetry/propagation-env.d.ts +81 -0
  84. package/dist/env/log-trace/opentelemetry/propagation.d.ts +79 -0
  85. package/dist/env/log-trace/opentelemetry/tracer-provider.d.ts +157 -0
  86. package/dist/env/log-trace/span-storage.d.ts +37 -0
  87. package/dist/env/log-trace/trace-context.d.ts +28 -0
  88. package/dist/env/log-trace/types.d.ts +127 -0
  89. package/dist/env/mcp/command-resolver.d.ts +12 -0
  90. package/dist/env/mcp/config.d.ts +103 -0
  91. package/dist/env/mcp/index.d.ts +13 -0
  92. package/dist/env/mcp/loader.d.ts +78 -0
  93. package/dist/env/mcp/mcp-component.d.ts +54 -0
  94. package/dist/env/mcp/mcp-config-registration.d.ts +19 -0
  95. package/dist/env/mcp/npm-prefix/index.d.ts +17 -0
  96. package/dist/env/mcp/scanner.d.ts +38 -0
  97. package/dist/env/mcp/tool/adapter.d.ts +32 -0
  98. package/dist/env/mcp/tool/index.d.ts +4 -0
  99. package/dist/env/mcp/types.d.ts +131 -0
  100. package/dist/env/memory/built-in/index.d.ts +41 -0
  101. package/dist/env/memory/built-in/recall-memory.d.ts +29 -0
  102. package/dist/env/memory/built-in/record-memory.d.ts +44 -0
  103. package/dist/env/memory/index.d.ts +10 -0
  104. package/dist/env/memory/memory-component.d.ts +114 -0
  105. package/dist/env/memory/memory-config-registration.d.ts +18 -0
  106. package/dist/env/memory/memory-config.d.ts +18 -0
  107. package/dist/env/memory/plugin/index.d.ts +16 -0
  108. package/dist/env/memory/plugin/memory-agent.d.ts +126 -0
  109. package/dist/env/memory/plugin/memory-manager.d.ts +71 -0
  110. package/dist/env/memory/plugin/memory-plugin.d.ts +103 -0
  111. package/dist/env/memory/plugin/recall-memory.d.ts +16 -0
  112. package/dist/env/memory/plugin/types.d.ts +75 -0
  113. package/dist/env/memory/tools/memory-agent-tools.d.ts +109 -0
  114. package/dist/env/memory/types.d.ts +80 -0
  115. package/dist/env/paths.d.ts +46 -0
  116. package/dist/env/plugin/bounty-cli-notification-channel.d.ts +60 -0
  117. package/dist/env/plugin/event-bus-notification-channel.d.ts +50 -0
  118. package/dist/env/plugin/index.d.ts +13 -0
  119. package/dist/env/plugin/lark-cli-notification-channel.d.ts +61 -0
  120. package/dist/env/plugin/notification-channel.d.ts +143 -0
  121. package/dist/env/plugin/plugin-component.d.ts +232 -0
  122. package/dist/env/plugin/types.d.ts +146 -0
  123. package/dist/env/prompt/index.d.ts +7 -0
  124. package/dist/env/prompt/index.js +2 -2
  125. package/dist/env/prompt/prompt-component.d.ts +194 -0
  126. package/dist/env/prompt/prompt-config-registration.d.ts +18 -0
  127. package/dist/env/prompt/prompt-store.d.ts +26 -0
  128. package/dist/env/prompt/prompts-index.d.ts +146 -0
  129. package/dist/env/prompt/renderer.d.ts +21 -0
  130. package/dist/env/prompt/types.d.ts +176 -0
  131. package/dist/env/session/hooks.d.ts +14 -0
  132. package/dist/env/session/index.d.ts +19 -0
  133. package/dist/env/session/index.js +4 -4
  134. package/dist/env/session/search-query-parser.d.ts +41 -0
  135. package/dist/env/session/session-component.d.ts +464 -0
  136. package/dist/env/session/session-config-registration.d.ts +18 -0
  137. package/dist/env/session/session-id.d.ts +26 -0
  138. package/dist/env/session/session-message-converter.d.ts +142 -0
  139. package/dist/env/session/session-store.d.ts +188 -0
  140. package/dist/env/session/storage/index.d.ts +5 -0
  141. package/dist/env/session/storage/index.js +3 -3
  142. package/dist/env/session/storage/memory.d.ts +119 -0
  143. package/dist/env/session/storage/sqlite.d.ts +108 -0
  144. package/dist/env/session/types.d.ts +705 -0
  145. package/dist/env/session-tree-stopper.d.ts +79 -0
  146. package/dist/env/skill/config.d.ts +13 -0
  147. package/dist/env/skill/index.d.ts +6 -0
  148. package/dist/env/skill/parser.d.ts +9 -0
  149. package/dist/env/skill/scanner.d.ts +25 -0
  150. package/dist/env/skill/skill-component.d.ts +89 -0
  151. package/dist/env/skill/skill-config-registration.d.ts +18 -0
  152. package/dist/env/skill/tool/index.d.ts +1 -0
  153. package/dist/env/skill/tool/skill-tool.d.ts +15 -0
  154. package/dist/env/skill/types.d.ts +61 -0
  155. package/dist/env/task/backend/index.d.ts +24 -0
  156. package/dist/env/task/backend/index.js +702 -0
  157. package/dist/env/task/backend/roy-sidecar-task-port.d.ts +148 -0
  158. package/dist/env/task/backend/sqlite-task-port.d.ts +28 -0
  159. package/dist/env/task/backend/task-store-backend.d.ts +107 -0
  160. package/dist/env/task/backend/types.d.ts +282 -0
  161. package/dist/env/task/delegate/bg-task-id-storage.d.ts +9 -0
  162. package/dist/env/task/delegate/delegate-tool.d.ts +681 -0
  163. package/dist/env/task/delegate/index.d.ts +8 -0
  164. package/dist/env/task/delegate/index.js +2 -2
  165. package/dist/env/task/delegate/process-registry.d.ts +58 -0
  166. package/dist/env/task/delegate/stop-tool.d.ts +12 -0
  167. package/dist/env/task/delegate/subagent-resolver.d.ts +25 -0
  168. package/dist/env/task/events/index.d.ts +7 -0
  169. package/dist/env/task/events/task-event-payloads.d.ts +101 -0
  170. package/dist/env/task/events/task-event-types.d.ts +23 -0
  171. package/dist/env/task/hooks/contexts.d.ts +191 -0
  172. package/dist/env/task/hooks/index.d.ts +7 -0
  173. package/dist/env/task/hooks/task-hook-points.d.ts +42 -0
  174. package/dist/env/task/index.d.ts +7 -0
  175. package/dist/env/task/index.js +3 -3
  176. package/dist/env/task/plugins/auto-task-plugin.d.ts +38 -0
  177. package/dist/env/task/plugins/card-chat-routing.d.ts +88 -0
  178. package/dist/env/task/plugins/fake-user-message-helper.d.ts +90 -0
  179. package/dist/env/task/plugins/index.d.ts +8 -0
  180. package/dist/env/task/plugins/index.js +4 -4
  181. package/dist/env/task/plugins/lark-card-action-handler.d.ts +166 -0
  182. package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +600 -0
  183. package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +231 -0
  184. package/dist/env/task/plugins/max-iteration-reminder-plugin.d.ts +112 -0
  185. package/dist/env/task/plugins/per-task-group-chat-plugin.d.ts +561 -0
  186. package/dist/env/task/plugins/task-tag-plugin.d.ts +70 -0
  187. package/dist/env/task/plugins/workflow-extractor-agent.d.ts +43 -0
  188. package/dist/env/task/registry-hook-installer.d.ts +43 -0
  189. package/dist/env/task/storage/index.d.ts +5 -0
  190. package/dist/env/task/storage/migrations/001_add_project_path_context.d.ts +14 -0
  191. package/dist/env/task/storage/migrations/002_add_task_type.d.ts +14 -0
  192. package/dist/env/task/storage/migrations/003_add_process_description.d.ts +20 -0
  193. package/dist/env/task/storage/migrations/004_rename_action_to_milestone.d.ts +37 -0
  194. package/dist/env/task/storage/migrations/005_convert_blob_description_to_text.d.ts +51 -0
  195. package/dist/env/task/storage/sqlite-task-store.d.ts +241 -0
  196. package/dist/env/task/tag-service.d.ts +138 -0
  197. package/dist/env/task/task-child-context.d.ts +70 -0
  198. package/dist/env/task/task-component.d.ts +270 -0
  199. package/dist/env/task/task-config-registration.d.ts +19 -0
  200. package/dist/env/task/task-creation-registry.d.ts +181 -0
  201. package/dist/env/task/task-reuse-context.d.ts +52 -0
  202. package/dist/env/task/task-reuse-registry.d.ts +31 -0
  203. package/dist/env/task/tools/batch-archive-tool.d.ts +9 -0
  204. package/dist/env/task/tools/batch-delete-tool.d.ts +9 -0
  205. package/dist/env/task/tools/complete-tool.d.ts +12 -0
  206. package/dist/env/task/tools/create-tool.d.ts +6 -0
  207. package/dist/env/task/tools/delete-tool.d.ts +6 -0
  208. package/dist/env/task/tools/get-tool.d.ts +6 -0
  209. package/dist/env/task/tools/index.d.ts +13 -0
  210. package/dist/env/task/tools/list-tool.d.ts +6 -0
  211. package/dist/env/task/tools/operation/create-tool.d.ts +12 -0
  212. package/dist/env/task/tools/operation/delete-tool.d.ts +6 -0
  213. package/dist/env/task/tools/operation/get-tool.d.ts +6 -0
  214. package/dist/env/task/tools/operation/index.d.ts +8 -0
  215. package/dist/env/task/tools/operation/list-tool.d.ts +6 -0
  216. package/dist/env/task/tools/operation/operation-types.d.ts +225 -0
  217. package/dist/env/task/tools/operation/update-tool.d.ts +6 -0
  218. package/dist/env/task/tools/search-tool.d.ts +9 -0
  219. package/dist/env/task/tools/task-tree-tool.d.ts +65 -0
  220. package/dist/env/task/tools/task-types.d.ts +255 -0
  221. package/dist/env/task/tools/update-tool.d.ts +6 -0
  222. package/dist/env/task/types.d.ts +290 -0
  223. package/dist/env/tool/built-in/bash-effect.d.ts +36 -0
  224. package/dist/env/tool/built-in/bash.d.ts +16 -0
  225. package/dist/env/tool/built-in/echo.d.ts +7 -0
  226. package/dist/env/tool/built-in/edit-file.d.ts +6 -0
  227. package/dist/env/tool/built-in/glob.d.ts +6 -0
  228. package/dist/env/tool/built-in/grep.d.ts +6 -0
  229. package/dist/env/tool/built-in/index.d.ts +39 -0
  230. package/dist/env/tool/built-in/query-background-process-tool.d.ts +113 -0
  231. package/dist/env/tool/built-in/read-file.d.ts +5 -0
  232. package/dist/env/tool/built-in/understand-image.d.ts +59 -0
  233. package/dist/env/tool/built-in/write-file.d.ts +5 -0
  234. package/dist/env/tool/index.d.ts +16 -0
  235. package/dist/env/tool/registry.d.ts +61 -0
  236. package/dist/env/tool/tool-component.d.ts +242 -0
  237. package/dist/env/tool/tool-config-registration.d.ts +18 -0
  238. package/dist/env/tool/types.d.ts +274 -0
  239. package/dist/env/tool/validator.d.ts +14 -0
  240. package/dist/env/types.d.ts +184 -0
  241. package/dist/env/workflow/decorators/decorator-node.d.ts +76 -0
  242. package/dist/env/workflow/decorators/edge.d.ts +42 -0
  243. package/dist/env/workflow/decorators/index.d.ts +13 -0
  244. package/dist/env/workflow/decorators/node-as.d.ts +40 -0
  245. package/dist/env/workflow/decorators/workflow.d.ts +30 -0
  246. package/dist/env/workflow/engine/dag-manager.d.ts +176 -0
  247. package/dist/env/workflow/engine/engine.d.ts +440 -0
  248. package/dist/env/workflow/engine/event-bus.d.ts +54 -0
  249. package/dist/env/workflow/engine/executor.d.ts +122 -0
  250. package/dist/env/workflow/engine/index.d.ts +15 -0
  251. package/dist/env/workflow/engine/index.js +2 -2
  252. package/dist/env/workflow/engine/node-registry.d.ts +159 -0
  253. package/dist/env/workflow/engine/scheduler.d.ts +164 -0
  254. package/dist/env/workflow/extractor/workflow-converter.d.ts +55 -0
  255. package/dist/env/workflow/fixtures.d.ts +401 -0
  256. package/dist/env/workflow/hooks/index.d.ts +4 -0
  257. package/dist/env/workflow/hooks/workflow-hook-points.d.ts +161 -0
  258. package/dist/env/workflow/index.d.ts +30 -0
  259. package/dist/env/workflow/index.js +9 -9
  260. package/dist/env/workflow/metadata/keys.d.ts +6 -0
  261. package/dist/env/workflow/nodes/agent-component-adapter.d.ts +175 -0
  262. package/dist/env/workflow/nodes/agent-node.d.ts +206 -0
  263. package/dist/env/workflow/nodes/ask-user-node.d.ts +66 -0
  264. package/dist/env/workflow/nodes/condition-node.d.ts +39 -0
  265. package/dist/env/workflow/nodes/index.d.ts +8 -0
  266. package/dist/env/workflow/nodes/index.js +1 -1
  267. package/dist/env/workflow/nodes/merge-node.d.ts +40 -0
  268. package/dist/env/workflow/nodes/python-call-node.d.ts +95 -0
  269. package/dist/env/workflow/nodes/skill-node.d.ts +29 -0
  270. package/dist/env/workflow/nodes/tool-node.d.ts +64 -0
  271. package/dist/env/workflow/nodes/workflow-node.d.ts +118 -0
  272. package/dist/env/workflow/plugins/index.d.ts +6 -0
  273. package/dist/env/workflow/plugins/index.js +2 -2
  274. package/dist/env/workflow/plugins/lark-cli-workflow-notify-plugin.d.ts +107 -0
  275. package/dist/env/workflow/plugins/workflow-json-output-plugin.d.ts +166 -0
  276. package/dist/env/workflow/runtime/runtime-cancellation-scope.d.ts +121 -0
  277. package/dist/env/workflow/service/index.d.ts +9 -0
  278. package/dist/env/workflow/service/registry.d.ts +37 -0
  279. package/dist/env/workflow/service/workflow-service.d.ts +422 -0
  280. package/dist/env/workflow/storage/index.d.ts +11 -0
  281. package/dist/env/workflow/storage/mock-repositories.d.ts +106 -0
  282. package/dist/env/workflow/storage/safe-json.d.ts +62 -0
  283. package/dist/env/workflow/storage/sqlite.d.ts +57 -0
  284. package/dist/env/workflow/storage/tag-repo.d.ts +65 -0
  285. package/dist/env/workflow/storage/workflow-repo.d.ts +161 -0
  286. package/dist/env/workflow/tools/ask-user-tool.d.ts +35 -0
  287. package/dist/env/workflow/tools/index.d.ts +16 -0
  288. package/dist/env/workflow/tools/index.js +6 -6
  289. package/dist/env/workflow/tools/run-workflow.d.ts +130 -0
  290. package/dist/env/workflow/tools/submit-json-output-tool.d.ts +38 -0
  291. package/dist/env/workflow/tools/workflow-add-tool.d.ts +47 -0
  292. package/dist/env/workflow/tools/workflow-get-tool.d.ts +29 -0
  293. package/dist/env/workflow/tools/workflow-list-tool.d.ts +55 -0
  294. package/dist/env/workflow/tools/workflow-run-status-tool.d.ts +26 -0
  295. package/dist/env/workflow/tools/workflow-run-stop-tool.d.ts +29 -0
  296. package/dist/env/workflow/tools/workflow-search-tool.d.ts +33 -0
  297. package/dist/env/workflow/tools/workflow-tag-list-tool.d.ts +59 -0
  298. package/dist/env/workflow/tools/workflow-validate-tool.d.ts +69 -0
  299. package/dist/env/workflow/types/context.d.ts +17 -0
  300. package/dist/env/workflow/types/decorators-types.d.ts +182 -0
  301. package/dist/env/workflow/types/edge.d.ts +33 -0
  302. package/dist/env/workflow/types/event.d.ts +869 -0
  303. package/dist/env/workflow/types/index.d.ts +16 -0
  304. package/dist/env/workflow/types/run.d.ts +254 -0
  305. package/dist/env/workflow/types/workflow-error.d.ts +79 -0
  306. package/dist/env/workflow/types/workflow-hil.d.ts +57 -0
  307. package/dist/env/workflow/types/workflow-message.d.ts +193 -0
  308. package/dist/env/workflow/types/workflow-session.d.ts +17 -0
  309. package/dist/env/workflow/types/workflow.d.ts +654 -0
  310. package/dist/env/workflow/types_compat.d.ts +10 -0
  311. package/dist/env/workflow/utils/agent-session-metadata.d.ts +48 -0
  312. package/dist/env/workflow/utils/build-agent-node-output.d.ts +11 -0
  313. package/dist/env/workflow/utils/create-workflow.d.ts +35 -0
  314. package/dist/env/workflow/utils/dependency-prescan.d.ts +67 -0
  315. package/dist/env/workflow/utils/execution-state.d.ts +46 -0
  316. package/dist/env/workflow/utils/extract-agent-json-output.d.ts +6 -0
  317. package/dist/env/workflow/utils/index.d.ts +14 -0
  318. package/dist/env/workflow/utils/index.js +1 -1
  319. package/dist/env/workflow/utils/json-schema-to-zod.d.ts +23 -0
  320. package/dist/env/workflow/utils/node-id-utils.d.ts +20 -0
  321. package/dist/env/workflow/utils/node-output-contracts.d.ts +137 -0
  322. package/dist/env/workflow/utils/node-registry-helper.d.ts +36 -0
  323. package/dist/env/workflow/utils/output-schema-hint.d.ts +7 -0
  324. package/dist/env/workflow/utils/parse-agent-output-config.d.ts +9 -0
  325. package/dist/env/workflow/utils/recovery-validator.d.ts +30 -0
  326. package/dist/env/workflow/utils/redact-command-secrets.d.ts +70 -0
  327. package/dist/env/workflow/utils/sensitive-redact.d.ts +37 -0
  328. package/dist/env/workflow/utils/session-parser.d.ts +23 -0
  329. package/dist/env/workflow/utils/session-recovery.d.ts +122 -0
  330. package/dist/env/workflow/utils/shell-dialect-lint.d.ts +75 -0
  331. package/dist/env/workflow/utils/template-contract-validator.d.ts +87 -0
  332. package/dist/env/workflow/utils/template-resolver.d.ts +285 -0
  333. package/dist/env/workflow/utils/validate-workflow-definition.d.ts +79 -0
  334. package/dist/env/workflow/utils/validation-rules.d.ts +103 -0
  335. package/dist/env/workflow/utils/workflow-message-metadata.d.ts +20 -0
  336. package/dist/env/workflow/utils/workflow-sanitize.d.ts +51 -0
  337. package/dist/env/workflow/workflow-component.d.ts +138 -0
  338. package/dist/index.d.ts +59 -0
  339. package/dist/index.js +21 -21
  340. package/dist/shared/@ai-setting/{roy-agent-core-stnddvx9.js → roy-agent-core-12d2xap8.js} +1 -1
  341. package/dist/shared/@ai-setting/{roy-agent-core-pk1b3kvf.js → roy-agent-core-2b8jtv7m.js} +1 -1
  342. package/dist/shared/@ai-setting/{roy-agent-core-x8n1r7h4.js → roy-agent-core-2bscfrr1.js} +188 -7
  343. package/dist/shared/@ai-setting/{roy-agent-core-gdsqp6j8.js → roy-agent-core-6masakz4.js} +45 -0
  344. package/dist/shared/@ai-setting/{roy-agent-core-vvxb9522.js → roy-agent-core-6qxh4xrm.js} +67 -6
  345. package/dist/shared/@ai-setting/{roy-agent-core-h93v6p6y.js → roy-agent-core-7qy3nffr.js} +2 -2
  346. package/dist/shared/@ai-setting/{roy-agent-core-s214vmmd.js → roy-agent-core-8eqngasy.js} +2 -2
  347. package/dist/shared/@ai-setting/{roy-agent-core-brwzs8wf.js → roy-agent-core-9h72sk1n.js} +1 -1
  348. package/dist/shared/@ai-setting/{roy-agent-core-na73mym1.js → roy-agent-core-a4vzsn0g.js} +212 -1
  349. package/dist/shared/@ai-setting/{roy-agent-core-35s1w7tc.js → roy-agent-core-aer5kw1j.js} +142 -70
  350. package/dist/shared/@ai-setting/{roy-agent-core-j8e92gj8.js → roy-agent-core-b5ew8t0k.js} +0 -59
  351. package/dist/shared/@ai-setting/{roy-agent-core-rcfewbzr.js → roy-agent-core-cd62e9p1.js} +1 -1
  352. package/dist/shared/@ai-setting/{roy-agent-core-39xejr39.js → roy-agent-core-e2z1etk4.js} +1 -1
  353. package/dist/shared/@ai-setting/{roy-agent-core-pkpkctvf.js → roy-agent-core-g36jevrk.js} +14 -183
  354. package/dist/shared/@ai-setting/{roy-agent-core-ezgsem94.js → roy-agent-core-j2nvedt6.js} +465 -128
  355. package/dist/shared/@ai-setting/{roy-agent-core-p2r27era.js → roy-agent-core-mxdc756a.js} +1 -1
  356. package/dist/shared/@ai-setting/{roy-agent-core-p8ak03s0.js → roy-agent-core-w527pcpe.js} +293 -42
  357. package/dist/shared/@ai-setting/{roy-agent-core-3tv1q6f2.js → roy-agent-core-ytr2w0vb.js} +2 -2
  358. package/dist/shared/@ai-setting/{roy-agent-core-yd21n6c7.js → roy-agent-core-zvemdfx5.js} +1 -1
  359. package/dist/test-utils/child-process-mock.d.ts +73 -0
  360. package/dist/util/process/process-tree-killer.d.ts +67 -0
  361. package/dist/utils/id.d.ts +11 -0
  362. package/dist/utils/loose-json.d.ts +30 -0
  363. package/dist/utils/media.d.ts +70 -0
  364. package/dist/utils/temp-file-manager/index.d.ts +99 -0
  365. package/package.json +5 -3
  366. /package/dist/shared/@ai-setting/{roy-agent-core-zy3hqfwg.js → roy-agent-core-0hq21px2.js} +0 -0
  367. /package/dist/shared/@ai-setting/{roy-agent-core-0cfaqnz9.js → roy-agent-core-k25gv86p.js} +0 -0
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @fileoverview TagRepository
3
+ *
4
+ * Owns the `workflow_tags` table:
5
+ * - name TEXT PRIMARY KEY
6
+ * - usage_count INTEGER NOT NULL DEFAULT 0
7
+ * - created_at TEXT NOT NULL
8
+ * - updated_at TEXT NOT NULL
9
+ *
10
+ * - `upsertMany(names)` inserts new tags (with count=1) or increments existing ones by 1
11
+ * - `decrementMany(names)` clamps usage_count at 0 (rows are NOT deleted)
12
+ * - `list()` returns tags sorted by usage_count DESC, name ASC
13
+ * - `get(name)` returns single tag info or undefined
14
+ *
15
+ * Concurrency: All write methods use prepared statements. Callers may wrap
16
+ * multiple operations in an outer `db.transaction(...)` to make them atomic.
17
+ */
18
+ export interface TagInfo {
19
+ name: string;
20
+ usage_count: number;
21
+ created_at: string;
22
+ updated_at: string;
23
+ }
24
+ /**
25
+ * v3: Extended list options for TagRepository.list().
26
+ *
27
+ * - `sortBy`: "usage_count" (default), "name", or "created_at"
28
+ * - `order`: "desc" (default) or "asc"
29
+ * - `limit`: optional cap on number of rows returned
30
+ */
31
+ export interface ListTagsOptions {
32
+ sortBy?: "usage_count" | "name" | "created_at";
33
+ order?: "asc" | "desc";
34
+ limit?: number;
35
+ }
36
+ export declare class TagRepository {
37
+ private db;
38
+ constructor(db: any);
39
+ /**
40
+ * Static helper to create the workflow_tags table (and its usage index).
41
+ * Safe to call multiple times (idempotent).
42
+ */
43
+ static createTable(db: any): void;
44
+ /**
45
+ * Insert new tags with count=1, or increment existing tags by 1.
46
+ * Empty input is a no-op.
47
+ */
48
+ upsertMany(names: string[]): void;
49
+ /**
50
+ * Decrement usage_count for each given tag by 1, clamped at 0.
51
+ * Rows are NEVER deleted (preserve history).
52
+ * Non-existent tags are silently ignored.
53
+ */
54
+ decrementMany(names: string[]): void;
55
+ /**
56
+ * List all tags with v3 sort/limit options.
57
+ *
58
+ * Default: usage_count DESC, name ASC (backward compatible).
59
+ */
60
+ list(options?: ListTagsOptions): TagInfo[];
61
+ /**
62
+ * Get a single tag by name (returns undefined if not found).
63
+ */
64
+ get(name: string): TagInfo | undefined;
65
+ }
@@ -0,0 +1,161 @@
1
+ /**
2
+ * @fileoverview Workflow Repository
3
+ *
4
+ * SQLite-based repository for workflow CRUD operations.
5
+ */
6
+ import type { Workflow, WorkflowDefinition, WorkflowMetadata, WorkflowConfig } from '../types';
7
+ import { getDatabase } from './sqlite';
8
+ export interface WorkflowRow {
9
+ id: string;
10
+ name: string;
11
+ version: string;
12
+ description: string | null;
13
+ definition: string;
14
+ config: string;
15
+ metadata: string;
16
+ tags: string;
17
+ task_id: number | null;
18
+ created_at: string;
19
+ updated_at: string;
20
+ }
21
+ export interface ListWorkflowsOptions {
22
+ limit?: number;
23
+ offset?: number;
24
+ orderBy?: 'name' | 'created_at' | 'updated_at';
25
+ order?: 'asc' | 'desc';
26
+ tag?: string;
27
+ taskId?: number;
28
+ search?: string;
29
+ }
30
+ export interface UpdateWorkflowOptions {
31
+ name?: string;
32
+ version?: string;
33
+ description?: string;
34
+ definition?: WorkflowDefinition;
35
+ config?: WorkflowConfig;
36
+ metadata?: WorkflowMetadata;
37
+ tags?: string[];
38
+ }
39
+ /**
40
+ * Row to Workflow conversion helper
41
+ *
42
+ * Bug 修复 Task #4037(sibling-risk of Task #4036):
43
+ * 原本 4 处裸 `JSON.parse` 没有任何错误处理;损坏的 metadata/definition
44
+ * 会让整个 `workflow list` 命令挂掉(与 Bug #4033 的 tasks list 同源)。
45
+ *
46
+ * 修复策略按字段语义分流:
47
+ * - definition / metadata:业务关键,损坏时**抛错**(带 fieldName +
48
+ * row.name + row.id 的清晰错误信息),宁可在 ReportError 路径上挂掉
49
+ * 也别返回 silent-corrupt 数据。
50
+ * - config / tags:辅助字段,**graceful fallback**(config → {},
51
+ * tags 复用 task-store 的 parseTagsSafely 模式)。
52
+ *
53
+ * 实现细节见 `./safe-json.ts`。
54
+ */
55
+ export declare function rowToWorkflow(row: WorkflowRow): Workflow;
56
+ /**
57
+ * WorkflowRepository class
58
+ *
59
+ * Provides CRUD operations for workflows in SQLite.
60
+ */
61
+ export declare class WorkflowRepository {
62
+ private db;
63
+ constructor(db?: ReturnType<typeof getDatabase>);
64
+ /**
65
+ * Create a new workflow
66
+ */
67
+ create(workflow: Omit<Workflow, 'id' | 'createdAt' | 'updatedAt'>): Workflow;
68
+ /**
69
+ * Create a workflow from definition only
70
+ */
71
+ createFromDefinition(definition: WorkflowDefinition, options?: {
72
+ config?: WorkflowConfig;
73
+ metadata?: WorkflowMetadata;
74
+ tags?: string[];
75
+ }): Workflow;
76
+ /**
77
+ * Get a workflow by ID
78
+ */
79
+ getById(id: string): Workflow | undefined;
80
+ /**
81
+ * Get a workflow by name (returns latest version)
82
+ */
83
+ getByName(name: string): Workflow | undefined;
84
+ /**
85
+ * Get a specific version of a workflow by name
86
+ */
87
+ getByNameAndVersion(name: string, version: string): Workflow | undefined;
88
+ /**
89
+ * List workflows with optional filtering and pagination
90
+ */
91
+ list(options?: ListWorkflowsOptions): Workflow[];
92
+ /**
93
+ * List all versions of a workflow by name
94
+ */
95
+ listVersions(name: string): Workflow[];
96
+ /**
97
+ * Update a workflow
98
+ */
99
+ update(id: string, updates: UpdateWorkflowOptions): Workflow | undefined;
100
+ /**
101
+ * Delete a workflow
102
+ */
103
+ delete(id: string): boolean;
104
+ /**
105
+ * Check if a workflow exists
106
+ */
107
+ exists(id: string): boolean;
108
+ /**
109
+ * Check if a workflow with name and version exists
110
+ */
111
+ existsByNameAndVersion(name: string, version: string): boolean;
112
+ /**
113
+ * Get total count of workflows
114
+ */
115
+ count(): number;
116
+ /**
117
+ * v4: Get count of workflows matching the given filters.
118
+ *
119
+ * Unlike `list()`, this method:
120
+ * - Returns the **total** count of matching rows (not paginated)
121
+ * - Ignores `limit` / `offset` options
122
+ * - Applies SQL filters (tag, taskId) in SQL
123
+ * - Applies multi-tag AND + search filter in-memory
124
+ *
125
+ * Used by `WorkflowService.listWorkflowsWithTags` and `searchWorkflowsWithTags`
126
+ * to populate the `total` field correctly.
127
+ *
128
+ * @param options - Filter options (no limit/offset)
129
+ * @returns Number of workflows matching the filters
130
+ */
131
+ countAll(options?: {
132
+ tag?: string;
133
+ tags?: string[];
134
+ taskId?: number;
135
+ search?: string;
136
+ }): number;
137
+ /**
138
+ * Search workflows by name (partial match)
139
+ */
140
+ search(query: string, limit?: number): Workflow[];
141
+ /**
142
+ * Migrate workflows with empty/missing tags to ["default"].
143
+ *
144
+ * @returns number of rows updated
145
+ */
146
+ migrateEmptyTagsToDefault(): number;
147
+ /**
148
+ * v2: 在事务中执行一个函数,回滚任何抛出
149
+ */
150
+ transaction<T>(fn: () => T): T;
151
+ }
152
+ /**
153
+ * Module-level helper — migrate workflows with empty/missing tags to `["default"]`.
154
+ *
155
+ * Updates workflows where `tags IS NULL`, `tags = ''`, or `tags = '[]'`.
156
+ * Other workflows are untouched. Idempotent.
157
+ *
158
+ * @param db - SQLite database instance (must have workflows table with tags column)
159
+ * @returns number of workflows that were updated
160
+ */
161
+ export declare function migrateEmptyTagsToDefault(db: any): number;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @fileoverview AskUserTool - Tool for requesting user input in workflow
3
+ *
4
+ * When an AgentNode calls this tool, it throws AskUserError to interrupt
5
+ * the workflow, allowing the workflow to pause and wait for user response.
6
+ */
7
+ import { z } from 'zod';
8
+ import type { ToolInfo } from '../../tool/types';
9
+ /**
10
+ * AskUserTool input schema
11
+ */
12
+ export declare const AskUserInputSchema: z.ZodObject<{
13
+ query: z.ZodString;
14
+ options: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
15
+ required_confirm: z.ZodOptional<z.ZodBoolean>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ query: string;
18
+ options?: string[] | undefined;
19
+ required_confirm?: boolean | undefined;
20
+ }, {
21
+ query: string;
22
+ options?: string[] | undefined;
23
+ required_confirm?: boolean | undefined;
24
+ }>;
25
+ export type AskUserInput = z.infer<typeof AskUserInputSchema>;
26
+ /**
27
+ * AskUserTool
28
+ *
29
+ * A special tool that can be called by Agent to request user input.
30
+ * Calling this tool will throw AskUserError, which the Executor will
31
+ * catch and convert to a workflow pause event.
32
+ */
33
+ export type AskUserTool = ToolInfo<typeof AskUserInputSchema>;
34
+ export declare const askUserTool: AskUserTool;
35
+ export declare const askUserToolInstance: AskUserTool;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Workflow Tools - Phase 7
3
+ *
4
+ * Export all workflow-related tools
5
+ */
6
+ export { createRunWorkflowTool, initRunWorkflowTool, getRunWorkflowTool, resetRunWorkflowTool, createLegacyRunWorkflowTool, RunWorkflowInputSchema, type RunWorkflowInput, type RunWorkflowTool, type RunWorkflowToolInterface, } from "./run-workflow";
7
+ export { createWorkflowGetTool, WorkflowGetInputSchema, type WorkflowGetInput, } from "./workflow-get-tool";
8
+ export { createWorkflowListTool, WorkflowListInputSchema, type WorkflowListInput, } from "./workflow-list-tool";
9
+ export { createWorkflowAddTool, WorkflowAddInputSchema, type WorkflowAddInput, } from "./workflow-add-tool";
10
+ export { createWorkflowValidateTool, WorkflowValidateInputSchema, type WorkflowValidateInput, } from "./workflow-validate-tool";
11
+ export { createWorkflowSearchTool, WorkflowSearchInputSchema, type WorkflowSearchInput, } from "./workflow-search-tool";
12
+ export { createWorkflowTagListTool, WorkflowTagListInputSchema, type WorkflowTagListInput, type WorkflowTagListOutput, } from "./workflow-tag-list-tool";
13
+ export { createWorkflowRunStatusTool, WorkflowRunStatusInputSchema, type WorkflowRunStatusInput, } from "./workflow-run-status-tool";
14
+ export { createWorkflowRunStopTool, WorkflowRunStopInputSchema, type WorkflowRunStopInput, } from "./workflow-run-stop-tool";
15
+ export { askUserTool, askUserToolInstance, AskUserInputSchema, type AskUserTool, type AskUserInput, } from "./ask-user-tool";
16
+ export { createSubmitJsonOutputTool, parseWorkflowJsonOutput, WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME, WorkflowJsonOutputMarker, } from "./submit-json-output-tool";
@@ -24,9 +24,9 @@ import {
24
24
  getRunWorkflowTool,
25
25
  initRunWorkflowTool,
26
26
  resetRunWorkflowTool
27
- } from "../../../shared/@ai-setting/roy-agent-core-vvxb9522.js";
28
- import"../../../shared/@ai-setting/roy-agent-core-yd21n6c7.js";
29
- import"../../../shared/@ai-setting/roy-agent-core-h93v6p6y.js";
27
+ } from "../../../shared/@ai-setting/roy-agent-core-6qxh4xrm.js";
28
+ import"../../../shared/@ai-setting/roy-agent-core-zvemdfx5.js";
29
+ import"../../../shared/@ai-setting/roy-agent-core-7qy3nffr.js";
30
30
  import"../../../shared/@ai-setting/roy-agent-core-7evvpfwc.js";
31
31
  import {
32
32
  WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME,
@@ -37,12 +37,12 @@ import {
37
37
  } from "../../../shared/@ai-setting/roy-agent-core-1db4vpc6.js";
38
38
  import"../../../shared/@ai-setting/roy-agent-core-ze068vc9.js";
39
39
  import"../../../shared/@ai-setting/roy-agent-core-7exqwax1.js";
40
- import"../../../shared/@ai-setting/roy-agent-core-na73mym1.js";
40
+ import"../../../shared/@ai-setting/roy-agent-core-a4vzsn0g.js";
41
41
  import"../../../shared/@ai-setting/roy-agent-core-8s9jd2qy.js";
42
42
  import"../../../shared/@ai-setting/roy-agent-core-jrj30vq3.js";
43
43
  import"../../../shared/@ai-setting/roy-agent-core-rvxg1wps.js";
44
- import"../../../shared/@ai-setting/roy-agent-core-pk1b3kvf.js";
45
- import"../../../shared/@ai-setting/roy-agent-core-zy3hqfwg.js";
44
+ import"../../../shared/@ai-setting/roy-agent-core-2b8jtv7m.js";
45
+ import"../../../shared/@ai-setting/roy-agent-core-0hq21px2.js";
46
46
  import"../../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
47
47
  import"../../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
48
48
  import"../../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Run Workflow Tool - Phase 7
3
+ *
4
+ * A Tool for executing workflows by name from within other workflows or agents.
5
+ *
6
+ * Named "workflow_run" for consistency with other workflow tools.
7
+ * The old name "run-workflow" is available via export alias.
8
+ */
9
+ import { z } from "zod";
10
+ import type { Tool } from "../../../env/tool/types";
11
+ import type { WorkflowService } from "../service/workflow-service";
12
+ /**
13
+ * Task #2144 — Lifecycle hooks for sub-session attach/detach.
14
+ *
15
+ * Passed to createRunWorkflowTool by WorkflowComponent which has access to
16
+ * BackgroundTaskManager. The hooks are optional: when omitted (e.g. main
17
+ * session direct invocation, CLI `roy-agent workflow run`), the tool skips
18
+ * attach/detach and behaves exactly as before.
19
+ *
20
+ * - attachWorkflowRun(bgTaskId, runId) is called BEFORE execute, when a
21
+ * bgTaskId is present in the AsyncLocalStorage stack. Even if the run
22
+ * later fails, attach is left in place so propagateStopToWorkflowRuns
23
+ * can clean up. This is the conservative "leak-prevention" semantics:
24
+ * any workflow run we know about deserves a stop attempt when the
25
+ * parent task stops.
26
+ *
27
+ * - detachWorkflowRun(bgTaskId, runId) is called ONLY on the success
28
+ * path (status === "completed" or "paused"). Detaching on success
29
+ * avoids redundant stopRun attempts on already-terminal workflows
30
+ * (which would otherwise log harmless "Session not found" warnings).
31
+ */
32
+ export interface RunWorkflowLifecycleHooks {
33
+ attachWorkflowRun?: (bgTaskId: string, runId: string) => void;
34
+ detachWorkflowRun?: (bgTaskId: string, runId: string) => void;
35
+ /**
36
+ * Task #2190 — fired when the engine reports the real runId via
37
+ * `onSessionCreated(realRunId)`. Allows the BackgroundTaskManager to
38
+ * swap the registry entry from the reserved (placeholder) runId to the
39
+ * real engine runId, so a mid-flight `stop_task` can find the workflow
40
+ * by its real id (instead of the placeholder).
41
+ *
42
+ * Semantics: caller should drop `oldRunId` and add `newRunId`. If
43
+ * `newRunId` is empty/falsy, the registry entry is simply removed
44
+ * (engine never produced a real id — likely timeout before persistence).
45
+ */
46
+ replaceWorkflowRun?: (bgTaskId: string, oldRunId: string, newRunId: string) => void;
47
+ }
48
+ /**
49
+ * Task #2100 — synthesize a `workflow_`-prefixed fallback runId.
50
+ *
51
+ * Used in `execute()` as the default value for `capturedRunId` when the
52
+ * engine never fires `onSessionCreated` before the timeout/abort/error
53
+ * path resolves. The format mirrors Task #1837's runId == sessionId
54
+ * contract (`workflow_` + timestamp + suffix) so callers can't
55
+ * distinguish a fallback runId from a real one by shape alone.
56
+ *
57
+ * Exported for testability (so tests can assert the format regex without
58
+ * having to trigger the timeout path each time).
59
+ *
60
+ * @internal
61
+ */
62
+ export declare function synthFallbackRunId(now?: number): string;
63
+ /**
64
+ * Input schema for workflow_run tool
65
+ */
66
+ export declare const RunWorkflowInputSchema: z.ZodObject<{
67
+ workflow_name: z.ZodString;
68
+ input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
69
+ timeout: z.ZodOptional<z.ZodNumber>;
70
+ node_config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>;
71
+ session: z.ZodOptional<z.ZodString>;
72
+ }, "strict", z.ZodTypeAny, {
73
+ workflow_name: string;
74
+ input?: Record<string, any> | undefined;
75
+ timeout?: number | undefined;
76
+ session?: string | undefined;
77
+ node_config?: Record<string, Record<string, any>> | undefined;
78
+ }, {
79
+ workflow_name: string;
80
+ input?: Record<string, any> | undefined;
81
+ timeout?: number | undefined;
82
+ session?: string | undefined;
83
+ node_config?: Record<string, Record<string, any>> | undefined;
84
+ }>;
85
+ export type RunWorkflowInput = z.infer<typeof RunWorkflowInputSchema>;
86
+ /**
87
+ * Workflow Run Tool interface for type-safe access
88
+ */
89
+ export interface RunWorkflowToolInterface {
90
+ name: "workflow_run";
91
+ description: string;
92
+ inputSchema: typeof RunWorkflowInputSchema;
93
+ }
94
+ /**
95
+ * Create a workflow_run tool with the given WorkflowService
96
+ *
97
+ * @param workflowService - The WorkflowService instance for executing workflows
98
+ * @param hooks - Optional Task #2144 lifecycle hooks for sub-session attach/detach.
99
+ * When bgTaskId is present in the ALS stack (i.e. invoked from a
100
+ * sub-session inside a delegate_task), the tool will register
101
+ * its runId via `hooks.attachWorkflowRun` and detach on success
102
+ * via `hooks.detachWorkflowRun`. Main-session direct invocation
103
+ * (no bgTaskId) skips both.
104
+ * @returns A Tool instance for running workflows
105
+ */
106
+ export declare function createRunWorkflowTool(workflowService: WorkflowService, hooks?: RunWorkflowLifecycleHooks): Tool;
107
+ /**
108
+ * Initialize the workflow_run tool with a WorkflowService
109
+ *
110
+ * @param workflowService - The WorkflowService instance
111
+ */
112
+ export declare function initRunWorkflowTool(workflowService: WorkflowService): void;
113
+ /**
114
+ * Get the workflow_run tool instance
115
+ *
116
+ * @throws Error if the tool has not been initialized
117
+ */
118
+ export declare function getRunWorkflowTool(): Tool;
119
+ /**
120
+ * Reset the workflow_run tool (for testing)
121
+ */
122
+ export declare function resetRunWorkflowTool(): void;
123
+ export type RunWorkflowTool = ReturnType<typeof createRunWorkflowTool>;
124
+ /**
125
+ * Backward-compatible alias: create a tool named "run-workflow" for existing consumers.
126
+ * The old tool name "run-workflow" is deprecated in favor of "workflow_run".
127
+ *
128
+ * @deprecated Use createRunWorkflowTool() which produces a tool named "workflow_run"
129
+ */
130
+ export declare function createLegacyRunWorkflowTool(workflowService: WorkflowService): Tool;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @fileoverview workflow_submit_output - Tool for AgentNode JSON structured output
3
+ *
4
+ * Design (tool self-recording pattern):
5
+ * - This tool receives the `HookContext` from the plugin at construction time.
6
+ * - When `execute(args)` is called by the json-extract sub-agent, the tool:
7
+ * 1. Validates `args` against the dynamic zod schema derived from `outputSchema`.
8
+ * 2. Writes the parsed JSON directly to `hookCtx.structuredOutputExtracted`.
9
+ * 3. Returns a marker-prefixed string output for compatibility.
10
+ *
11
+ * As a result, the plugin no longer needs to inspect `result.toolCalls` and
12
+ * re-validate; it just reads `hookCtx.structuredOutputExtracted` after the
13
+ * json-extract sub-agent finishes.
14
+ */
15
+ import { z } from 'zod';
16
+ import type { ToolInfo } from '../../tool/types';
17
+ import type { HookContext as AgentHookContext } from '../../agent/types';
18
+ import { type JsonSchemaObject } from '../utils/json-schema-to-zod';
19
+ export declare const WORKFLOW_SUBMIT_OUTPUT_TOOL_NAME = "workflow_submit_output";
20
+ export declare const WorkflowJsonOutputMarker = "__WORKFLOW_JSON_OUTPUT__";
21
+ /**
22
+ * Create a `workflow_submit_output` tool bound to a specific hook context.
23
+ *
24
+ * @param schema - The JSON schema describing the expected structured output.
25
+ * @param hookCtx - The agent hook context. The tool writes the validated
26
+ * structured JSON to `hookCtx.structuredOutputExtracted`
27
+ * so the calling plugin can pick it up without needing to
28
+ * re-inspect tool call history.
29
+ */
30
+ export declare function createSubmitJsonOutputTool(schema: JsonSchemaObject, hookCtx: AgentHookContext): ToolInfo<z.ZodObject<z.ZodRawShape>>;
31
+ /**
32
+ * Parse a marker-prefixed output string back into a typed JSON object.
33
+ *
34
+ * Kept for callers that still scan session history (e.g.
35
+ * `utils/extract-agent-json-output.ts`). The new self-recording flow
36
+ * does not need this, but we keep it as a public utility.
37
+ */
38
+ export declare function parseWorkflowJsonOutput(output: unknown): Record<string, unknown> | undefined;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @fileoverview Workflow Add Tool
3
+ *
4
+ * MCP tool for creating a new workflow.
5
+ * Tags are required (1-3), validated at multiple levels:
6
+ * - Zod schema (count bounds, type)
7
+ * - Per-element: empty string / contains comma (post-parse)
8
+ * - Name consistency between `name` and `definition.name`
9
+ *
10
+ * v2: works with TagRepository via service.createWorkflow (transactional);
11
+ * returns available_tags from the tag table.
12
+ *
13
+ * v3: Soft-prompt description encourages agents to call `workflow_tag_list`
14
+ * FIRST to discover existing tags, then prefer reusing them for semantic
15
+ * consistency. New tags are still auto-created (Strategy A: no hard validation).
16
+ */
17
+ import { z } from "zod";
18
+ import type { Tool } from "../../tool/types";
19
+ import type { WorkflowService } from "../service/workflow-service";
20
+ /**
21
+ * Input schema for workflow_add tool.
22
+ * Note: `tags` is required (Zod enforces 1-3 min/max bounds).
23
+ */
24
+ export declare const WorkflowAddInputSchema: z.ZodObject<{
25
+ definition: z.ZodOptional<z.ZodAny>;
26
+ definition_yaml: z.ZodOptional<z.ZodString>;
27
+ name: z.ZodOptional<z.ZodString>;
28
+ description: z.ZodOptional<z.ZodString>;
29
+ tags: z.ZodArray<z.ZodString, "many">;
30
+ }, "strip", z.ZodTypeAny, {
31
+ tags: string[];
32
+ name?: string | undefined;
33
+ description?: string | undefined;
34
+ definition?: any;
35
+ definition_yaml?: string | undefined;
36
+ }, {
37
+ tags: string[];
38
+ name?: string | undefined;
39
+ description?: string | undefined;
40
+ definition?: any;
41
+ definition_yaml?: string | undefined;
42
+ }>;
43
+ export type WorkflowAddInput = z.infer<typeof WorkflowAddInputSchema>;
44
+ /**
45
+ * Create a workflow_add tool with the given WorkflowService.
46
+ */
47
+ export declare function createWorkflowAddTool(workflowService: WorkflowService): Tool;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @fileoverview Workflow Get Tool
3
+ *
4
+ * Get workflow definition details or run status by name or run_id.
5
+ */
6
+ import { z } from "zod";
7
+ import type { Tool } from "../../tool/types";
8
+ import type { WorkflowService } from "../service/workflow-service";
9
+ /**
10
+ * Input schema for workflow_get tool
11
+ */
12
+ export declare const WorkflowGetInputSchema: z.ZodObject<{
13
+ name: z.ZodOptional<z.ZodString>;
14
+ run_id: z.ZodOptional<z.ZodString>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ name?: string | undefined;
17
+ run_id?: string | undefined;
18
+ }, {
19
+ name?: string | undefined;
20
+ run_id?: string | undefined;
21
+ }>;
22
+ export type WorkflowGetInput = z.infer<typeof WorkflowGetInputSchema>;
23
+ /**
24
+ * Create a workflow_get tool with the given WorkflowService
25
+ *
26
+ * @param workflowService - The WorkflowService instance for querying workflows
27
+ * @returns A Tool instance for getting workflow details
28
+ */
29
+ export declare function createWorkflowGetTool(workflowService: WorkflowService): Tool;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @fileoverview Workflow List Tool
3
+ *
4
+ * List all registered workflows with optional filtering.
5
+ * v2: 返回 available_tags(按 usage_count DESC, name ASC)
6
+ *
7
+ * JSON output shape (Code Review #1479 follow-up — aligned with CLI path):
8
+ *
9
+ * {
10
+ * "total": <number>, // FIRST so it survives tail-truncation
11
+ * "count": <number>,
12
+ * "truncated": <boolean>, // total > count
13
+ * "limit": <number>, // requested page size
14
+ * "offset": <number>,
15
+ * "page": <number>, // 1-based page number (passthrough or default 1)
16
+ * "available_tags": [...], // metadata block tail
17
+ * "workflows": [...] // LAST so the array is the truncation target
18
+ * }
19
+ *
20
+ * Keep this shape in sync with:
21
+ * - packages/cli/src/commands/workflow/commands/list.ts (CLI path: buildListWorkflowsJson)
22
+ */
23
+ import { z } from "zod";
24
+ import type { Tool } from "../../tool/types";
25
+ import type { WorkflowService } from "../service/workflow-service";
26
+ /**
27
+ * Input schema for workflow_list tool
28
+ */
29
+ export declare const WorkflowListInputSchema: z.ZodObject<{
30
+ tag: z.ZodOptional<z.ZodString>;
31
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
32
+ search: z.ZodOptional<z.ZodString>;
33
+ limit: z.ZodOptional<z.ZodNumber>;
34
+ offset: z.ZodOptional<z.ZodNumber>;
35
+ page: z.ZodOptional<z.ZodNumber>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ tags?: string[] | undefined;
38
+ limit?: number | undefined;
39
+ offset?: number | undefined;
40
+ tag?: string | undefined;
41
+ search?: string | undefined;
42
+ page?: number | undefined;
43
+ }, {
44
+ tags?: string[] | undefined;
45
+ limit?: number | undefined;
46
+ offset?: number | undefined;
47
+ tag?: string | undefined;
48
+ search?: string | undefined;
49
+ page?: number | undefined;
50
+ }>;
51
+ export type WorkflowListInput = z.infer<typeof WorkflowListInputSchema>;
52
+ /**
53
+ * Create a workflow_list tool with the given WorkflowService
54
+ */
55
+ export declare function createWorkflowListTool(workflowService: WorkflowService): Tool;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @fileoverview Workflow Run Status Tool
3
+ *
4
+ * Query the status of a workflow run by run/session ID.
5
+ */
6
+ import { z } from "zod";
7
+ import type { Tool } from "../../tool/types";
8
+ import type { WorkflowService } from "../service/workflow-service";
9
+ /**
10
+ * Input schema for workflow_run_status tool
11
+ */
12
+ export declare const WorkflowRunStatusInputSchema: z.ZodObject<{
13
+ run_id: z.ZodString;
14
+ }, "strip", z.ZodTypeAny, {
15
+ run_id: string;
16
+ }, {
17
+ run_id: string;
18
+ }>;
19
+ export type WorkflowRunStatusInput = z.infer<typeof WorkflowRunStatusInputSchema>;
20
+ /**
21
+ * Create a workflow_run_status tool with the given WorkflowService
22
+ *
23
+ * @param workflowService - The WorkflowService instance for querying run status
24
+ * @returns A Tool instance for checking workflow run status
25
+ */
26
+ export declare function createWorkflowRunStatusTool(workflowService: WorkflowService): Tool;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @fileoverview Workflow Run Stop Tool
3
+ *
4
+ * Stop a running workflow by run/session ID.
5
+ */
6
+ import { z } from "zod";
7
+ import type { Tool } from "../../tool/types";
8
+ import type { WorkflowService } from "../service/workflow-service";
9
+ /**
10
+ * Input schema for workflow_run_stop tool
11
+ */
12
+ export declare const WorkflowRunStopInputSchema: z.ZodObject<{
13
+ run_id: z.ZodString;
14
+ reason: z.ZodOptional<z.ZodString>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ run_id: string;
17
+ reason?: string | undefined;
18
+ }, {
19
+ run_id: string;
20
+ reason?: string | undefined;
21
+ }>;
22
+ export type WorkflowRunStopInput = z.infer<typeof WorkflowRunStopInputSchema>;
23
+ /**
24
+ * Create a workflow_run_stop tool with the given WorkflowService
25
+ *
26
+ * @param workflowService - The WorkflowService instance for stopping workflow runs
27
+ * @returns A Tool instance for stopping workflow runs
28
+ */
29
+ export declare function createWorkflowRunStopTool(workflowService: WorkflowService): Tool;