@ai-setting/roy-agent-core 1.7.51 → 1.7.53

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 (337) 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/summary-agent.d.ts +44 -0
  13. package/dist/env/agent/types.d.ts +503 -0
  14. package/dist/env/commands/commands-component.d.ts +97 -0
  15. package/dist/env/commands/commands-config-registration.d.ts +19 -0
  16. package/dist/env/commands/index.d.ts +7 -0
  17. package/dist/env/commands/parser.d.ts +18 -0
  18. package/dist/env/commands/types.d.ts +133 -0
  19. package/dist/env/component.d.ts +186 -0
  20. package/dist/env/constants.d.ts +112 -0
  21. package/dist/env/context/env-context.d.ts +420 -0
  22. package/dist/env/context/env-event.d.ts +144 -0
  23. package/dist/env/context/index.d.ts +13 -0
  24. package/dist/env/debug/debug-component.d.ts +160 -0
  25. package/dist/env/debug/formatters/index.d.ts +8 -0
  26. package/dist/env/debug/formatters/repl-formatter.d.ts +80 -0
  27. package/dist/env/debug/formatters/trace-formatter.d.ts +43 -0
  28. package/dist/env/debug/formatters/tree-formatter.d.ts +72 -0
  29. package/dist/env/debug/index.d.ts +15 -0
  30. package/dist/env/debug/index.js +1 -1
  31. package/dist/env/debug/parser/regex-parser.d.ts +49 -0
  32. package/dist/env/debug/parser/span-builder.d.ts +79 -0
  33. package/dist/env/debug/reader/log-reader.d.ts +55 -0
  34. package/dist/env/debug/reader/span-db-reader.d.ts +70 -0
  35. package/dist/env/debug/types.d.ts +145 -0
  36. package/dist/env/environment.d.ts +185 -0
  37. package/dist/env/errors.d.ts +120 -0
  38. package/dist/env/event-source/bounty-cli-handler.d.ts +42 -0
  39. package/dist/env/event-source/bounty-im-handler.d.ts +232 -0
  40. package/dist/env/event-source/event-source-component.d.ts +177 -0
  41. package/dist/env/event-source/event-source-config-registration.d.ts +18 -0
  42. package/dist/env/event-source/event-source-handlers.d.ts +486 -0
  43. package/dist/env/event-source/event-store.d.ts +110 -0
  44. package/dist/env/event-source/idempotency-key.d.ts +19 -0
  45. package/dist/env/event-source/index.d.ts +15 -0
  46. package/dist/env/event-source/index.js +4 -4
  47. package/dist/env/event-source/timer-handler.d.ts +74 -0
  48. package/dist/env/event-source/types.d.ts +803 -0
  49. package/dist/env/hook/global-hook-manager.d.ts +73 -0
  50. package/dist/env/hook/hook-manager.d.ts +139 -0
  51. package/dist/env/hook/index.d.ts +9 -0
  52. package/dist/env/hook/types.d.ts +107 -0
  53. package/dist/env/index.d.ts +24 -0
  54. package/dist/env/index.js +6 -6
  55. package/dist/env/interface.d.ts +156 -0
  56. package/dist/env/lark-mention-utils.d.ts +59 -0
  57. package/dist/env/llm/adapter-ai-sdk.d.ts +10 -0
  58. package/dist/env/llm/adapter-pi-ai.d.ts +39 -0
  59. package/dist/env/llm/adapter.d.ts +80 -0
  60. package/dist/env/llm/factory.d.ts +13 -0
  61. package/dist/env/llm/hooks.d.ts +150 -0
  62. package/dist/env/llm/index.d.ts +16 -0
  63. package/dist/env/llm/invoke.d.ts +264 -0
  64. package/dist/env/llm/llm-cache.d.ts +38 -0
  65. package/dist/env/llm/llm.d.ts +238 -0
  66. package/dist/env/llm/opencode-session.d.ts +79 -0
  67. package/dist/env/llm/provider.d.ts +40 -0
  68. package/dist/env/llm/tool-args-parser.d.ts +77 -0
  69. package/dist/env/llm/tool-schema.d.ts +54 -0
  70. package/dist/env/llm/transform.d.ts +57 -0
  71. package/dist/env/llm/types.d.ts +818 -0
  72. package/dist/env/log-trace/decorator.d.ts +88 -0
  73. package/dist/env/log-trace/index.d.ts +14 -0
  74. package/dist/env/log-trace/log-trace-component.d.ts +268 -0
  75. package/dist/env/log-trace/log-trace-config-registration.d.ts +25 -0
  76. package/dist/env/log-trace/logger.d.ts +83 -0
  77. package/dist/env/log-trace/opentelemetry/cli-propagation.d.ts +105 -0
  78. package/dist/env/log-trace/opentelemetry/mod.d.ts +24 -0
  79. package/dist/env/log-trace/opentelemetry/propagation-env.d.ts +81 -0
  80. package/dist/env/log-trace/opentelemetry/propagation.d.ts +79 -0
  81. package/dist/env/log-trace/opentelemetry/tracer-provider.d.ts +157 -0
  82. package/dist/env/log-trace/span-storage.d.ts +37 -0
  83. package/dist/env/log-trace/trace-context.d.ts +28 -0
  84. package/dist/env/log-trace/types.d.ts +127 -0
  85. package/dist/env/mcp/command-resolver.d.ts +12 -0
  86. package/dist/env/mcp/config.d.ts +103 -0
  87. package/dist/env/mcp/index.d.ts +13 -0
  88. package/dist/env/mcp/loader.d.ts +78 -0
  89. package/dist/env/mcp/mcp-component.d.ts +54 -0
  90. package/dist/env/mcp/mcp-config-registration.d.ts +19 -0
  91. package/dist/env/mcp/npm-prefix/index.d.ts +17 -0
  92. package/dist/env/mcp/scanner.d.ts +38 -0
  93. package/dist/env/mcp/tool/adapter.d.ts +32 -0
  94. package/dist/env/mcp/tool/index.d.ts +4 -0
  95. package/dist/env/mcp/types.d.ts +131 -0
  96. package/dist/env/memory/built-in/index.d.ts +41 -0
  97. package/dist/env/memory/built-in/recall-memory.d.ts +29 -0
  98. package/dist/env/memory/built-in/record-memory.d.ts +44 -0
  99. package/dist/env/memory/index.d.ts +10 -0
  100. package/dist/env/memory/memory-component.d.ts +114 -0
  101. package/dist/env/memory/memory-config-registration.d.ts +18 -0
  102. package/dist/env/memory/memory-config.d.ts +18 -0
  103. package/dist/env/memory/plugin/index.d.ts +16 -0
  104. package/dist/env/memory/plugin/memory-agent.d.ts +126 -0
  105. package/dist/env/memory/plugin/memory-manager.d.ts +71 -0
  106. package/dist/env/memory/plugin/memory-plugin.d.ts +103 -0
  107. package/dist/env/memory/plugin/recall-memory.d.ts +16 -0
  108. package/dist/env/memory/plugin/types.d.ts +75 -0
  109. package/dist/env/memory/tools/memory-agent-tools.d.ts +109 -0
  110. package/dist/env/memory/types.d.ts +80 -0
  111. package/dist/env/paths.d.ts +46 -0
  112. package/dist/env/plugin/bounty-cli-notification-channel.d.ts +60 -0
  113. package/dist/env/plugin/event-bus-notification-channel.d.ts +50 -0
  114. package/dist/env/plugin/index.d.ts +13 -0
  115. package/dist/env/plugin/lark-cli-notification-channel.d.ts +61 -0
  116. package/dist/env/plugin/notification-channel.d.ts +143 -0
  117. package/dist/env/plugin/plugin-component.d.ts +232 -0
  118. package/dist/env/plugin/types.d.ts +146 -0
  119. package/dist/env/prompt/index.d.ts +7 -0
  120. package/dist/env/prompt/prompt-component.d.ts +194 -0
  121. package/dist/env/prompt/prompt-config-registration.d.ts +18 -0
  122. package/dist/env/prompt/prompt-store.d.ts +26 -0
  123. package/dist/env/prompt/prompts-index.d.ts +146 -0
  124. package/dist/env/prompt/renderer.d.ts +21 -0
  125. package/dist/env/prompt/types.d.ts +176 -0
  126. package/dist/env/session/hooks.d.ts +14 -0
  127. package/dist/env/session/index.d.ts +19 -0
  128. package/dist/env/session/search-query-parser.d.ts +41 -0
  129. package/dist/env/session/session-component.d.ts +464 -0
  130. package/dist/env/session/session-config-registration.d.ts +18 -0
  131. package/dist/env/session/session-id.d.ts +26 -0
  132. package/dist/env/session/session-message-converter.d.ts +142 -0
  133. package/dist/env/session/session-store.d.ts +188 -0
  134. package/dist/env/session/storage/index.d.ts +5 -0
  135. package/dist/env/session/storage/memory.d.ts +119 -0
  136. package/dist/env/session/storage/sqlite.d.ts +108 -0
  137. package/dist/env/session/types.d.ts +705 -0
  138. package/dist/env/session-tree-stopper.d.ts +79 -0
  139. package/dist/env/skill/config.d.ts +13 -0
  140. package/dist/env/skill/index.d.ts +6 -0
  141. package/dist/env/skill/parser.d.ts +9 -0
  142. package/dist/env/skill/scanner.d.ts +25 -0
  143. package/dist/env/skill/skill-component.d.ts +89 -0
  144. package/dist/env/skill/skill-config-registration.d.ts +18 -0
  145. package/dist/env/skill/tool/index.d.ts +1 -0
  146. package/dist/env/skill/tool/skill-tool.d.ts +15 -0
  147. package/dist/env/skill/types.d.ts +61 -0
  148. package/dist/env/task/backend/index.d.ts +24 -0
  149. package/dist/env/task/backend/index.js +704 -0
  150. package/dist/env/task/backend/roy-sidecar-task-port.d.ts +148 -0
  151. package/dist/env/task/backend/sqlite-task-port.d.ts +28 -0
  152. package/dist/env/task/backend/task-store-backend.d.ts +107 -0
  153. package/dist/env/task/backend/types.d.ts +293 -0
  154. package/dist/env/task/delegate/bg-task-id-storage.d.ts +9 -0
  155. package/dist/env/task/delegate/delegate-tool.d.ts +681 -0
  156. package/dist/env/task/delegate/index.d.ts +8 -0
  157. package/dist/env/task/delegate/process-registry.d.ts +58 -0
  158. package/dist/env/task/delegate/stop-tool.d.ts +12 -0
  159. package/dist/env/task/delegate/subagent-resolver.d.ts +25 -0
  160. package/dist/env/task/events/index.d.ts +7 -0
  161. package/dist/env/task/events/task-event-payloads.d.ts +101 -0
  162. package/dist/env/task/events/task-event-types.d.ts +23 -0
  163. package/dist/env/task/hooks/contexts.d.ts +191 -0
  164. package/dist/env/task/hooks/index.d.ts +7 -0
  165. package/dist/env/task/hooks/task-hook-points.d.ts +42 -0
  166. package/dist/env/task/index.d.ts +7 -0
  167. package/dist/env/task/plugins/auto-task-plugin.d.ts +38 -0
  168. package/dist/env/task/plugins/card-chat-routing.d.ts +135 -0
  169. package/dist/env/task/plugins/fake-user-message-helper.d.ts +90 -0
  170. package/dist/env/task/plugins/index.d.ts +8 -0
  171. package/dist/env/task/plugins/index.js +2 -2
  172. package/dist/env/task/plugins/lark-card-action-handler.d.ts +166 -0
  173. package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +651 -0
  174. package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +248 -0
  175. package/dist/env/task/plugins/max-iteration-reminder-plugin.d.ts +112 -0
  176. package/dist/env/task/plugins/per-task-group-chat-plugin.d.ts +561 -0
  177. package/dist/env/task/plugins/task-tag-plugin.d.ts +70 -0
  178. package/dist/env/task/plugins/workflow-extractor-agent.d.ts +43 -0
  179. package/dist/env/task/registry-hook-installer.d.ts +43 -0
  180. package/dist/env/task/storage/index.d.ts +5 -0
  181. package/dist/env/task/storage/migrations/001_add_project_path_context.d.ts +14 -0
  182. package/dist/env/task/storage/migrations/002_add_task_type.d.ts +14 -0
  183. package/dist/env/task/storage/migrations/003_add_process_description.d.ts +20 -0
  184. package/dist/env/task/storage/migrations/004_rename_action_to_milestone.d.ts +37 -0
  185. package/dist/env/task/storage/migrations/005_convert_blob_description_to_text.d.ts +51 -0
  186. package/dist/env/task/storage/sqlite-task-store.d.ts +241 -0
  187. package/dist/env/task/tag-service.d.ts +138 -0
  188. package/dist/env/task/task-child-context.d.ts +70 -0
  189. package/dist/env/task/task-component.d.ts +270 -0
  190. package/dist/env/task/task-config-registration.d.ts +19 -0
  191. package/dist/env/task/task-creation-registry.d.ts +181 -0
  192. package/dist/env/task/task-reuse-context.d.ts +52 -0
  193. package/dist/env/task/task-reuse-registry.d.ts +31 -0
  194. package/dist/env/task/tools/batch-archive-tool.d.ts +9 -0
  195. package/dist/env/task/tools/batch-delete-tool.d.ts +9 -0
  196. package/dist/env/task/tools/complete-tool.d.ts +12 -0
  197. package/dist/env/task/tools/create-tool.d.ts +6 -0
  198. package/dist/env/task/tools/delete-tool.d.ts +6 -0
  199. package/dist/env/task/tools/get-tool.d.ts +6 -0
  200. package/dist/env/task/tools/index.d.ts +13 -0
  201. package/dist/env/task/tools/list-tool.d.ts +6 -0
  202. package/dist/env/task/tools/operation/create-tool.d.ts +12 -0
  203. package/dist/env/task/tools/operation/delete-tool.d.ts +6 -0
  204. package/dist/env/task/tools/operation/get-tool.d.ts +6 -0
  205. package/dist/env/task/tools/operation/index.d.ts +8 -0
  206. package/dist/env/task/tools/operation/list-tool.d.ts +6 -0
  207. package/dist/env/task/tools/operation/operation-types.d.ts +225 -0
  208. package/dist/env/task/tools/operation/update-tool.d.ts +6 -0
  209. package/dist/env/task/tools/search-tool.d.ts +9 -0
  210. package/dist/env/task/tools/task-tree-tool.d.ts +65 -0
  211. package/dist/env/task/tools/task-types.d.ts +255 -0
  212. package/dist/env/task/tools/update-tool.d.ts +6 -0
  213. package/dist/env/task/types.d.ts +290 -0
  214. package/dist/env/tool/built-in/bash-effect.d.ts +36 -0
  215. package/dist/env/tool/built-in/bash.d.ts +16 -0
  216. package/dist/env/tool/built-in/echo.d.ts +7 -0
  217. package/dist/env/tool/built-in/edit-file.d.ts +6 -0
  218. package/dist/env/tool/built-in/glob.d.ts +6 -0
  219. package/dist/env/tool/built-in/grep.d.ts +6 -0
  220. package/dist/env/tool/built-in/index.d.ts +39 -0
  221. package/dist/env/tool/built-in/query-background-process-tool.d.ts +113 -0
  222. package/dist/env/tool/built-in/read-file.d.ts +5 -0
  223. package/dist/env/tool/built-in/understand-image.d.ts +59 -0
  224. package/dist/env/tool/built-in/write-file.d.ts +5 -0
  225. package/dist/env/tool/index.d.ts +16 -0
  226. package/dist/env/tool/registry.d.ts +61 -0
  227. package/dist/env/tool/tool-component.d.ts +242 -0
  228. package/dist/env/tool/tool-config-registration.d.ts +18 -0
  229. package/dist/env/tool/types.d.ts +274 -0
  230. package/dist/env/tool/validator.d.ts +14 -0
  231. package/dist/env/types.d.ts +184 -0
  232. package/dist/env/workflow/decorators/decorator-node.d.ts +76 -0
  233. package/dist/env/workflow/decorators/edge.d.ts +42 -0
  234. package/dist/env/workflow/decorators/index.d.ts +13 -0
  235. package/dist/env/workflow/decorators/node-as.d.ts +40 -0
  236. package/dist/env/workflow/decorators/workflow.d.ts +30 -0
  237. package/dist/env/workflow/engine/dag-manager.d.ts +176 -0
  238. package/dist/env/workflow/engine/engine.d.ts +375 -0
  239. package/dist/env/workflow/engine/event-bus.d.ts +54 -0
  240. package/dist/env/workflow/engine/executor.d.ts +122 -0
  241. package/dist/env/workflow/engine/index.d.ts +15 -0
  242. package/dist/env/workflow/engine/node-registry.d.ts +159 -0
  243. package/dist/env/workflow/engine/scheduler.d.ts +164 -0
  244. package/dist/env/workflow/extractor/workflow-converter.d.ts +55 -0
  245. package/dist/env/workflow/fixtures.d.ts +401 -0
  246. package/dist/env/workflow/hooks/index.d.ts +4 -0
  247. package/dist/env/workflow/hooks/workflow-hook-points.d.ts +161 -0
  248. package/dist/env/workflow/index.d.ts +30 -0
  249. package/dist/env/workflow/index.js +1 -1
  250. package/dist/env/workflow/metadata/keys.d.ts +6 -0
  251. package/dist/env/workflow/nodes/agent-component-adapter.d.ts +175 -0
  252. package/dist/env/workflow/nodes/agent-node.d.ts +206 -0
  253. package/dist/env/workflow/nodes/ask-user-node.d.ts +66 -0
  254. package/dist/env/workflow/nodes/condition-node.d.ts +39 -0
  255. package/dist/env/workflow/nodes/index.d.ts +8 -0
  256. package/dist/env/workflow/nodes/merge-node.d.ts +40 -0
  257. package/dist/env/workflow/nodes/python-call-node.d.ts +95 -0
  258. package/dist/env/workflow/nodes/skill-node.d.ts +29 -0
  259. package/dist/env/workflow/nodes/tool-node.d.ts +58 -0
  260. package/dist/env/workflow/nodes/workflow-node.d.ts +118 -0
  261. package/dist/env/workflow/plugins/index.d.ts +6 -0
  262. package/dist/env/workflow/plugins/index.js +2 -2
  263. package/dist/env/workflow/plugins/lark-cli-workflow-notify-plugin.d.ts +107 -0
  264. package/dist/env/workflow/plugins/workflow-json-output-plugin.d.ts +166 -0
  265. package/dist/env/workflow/runtime/runtime-cancellation-scope.d.ts +121 -0
  266. package/dist/env/workflow/service/index.d.ts +9 -0
  267. package/dist/env/workflow/service/registry.d.ts +37 -0
  268. package/dist/env/workflow/service/workflow-service.d.ts +422 -0
  269. package/dist/env/workflow/storage/index.d.ts +11 -0
  270. package/dist/env/workflow/storage/mock-repositories.d.ts +106 -0
  271. package/dist/env/workflow/storage/safe-json.d.ts +62 -0
  272. package/dist/env/workflow/storage/sqlite.d.ts +57 -0
  273. package/dist/env/workflow/storage/tag-repo.d.ts +65 -0
  274. package/dist/env/workflow/storage/workflow-repo.d.ts +161 -0
  275. package/dist/env/workflow/tools/ask-user-tool.d.ts +35 -0
  276. package/dist/env/workflow/tools/index.d.ts +16 -0
  277. package/dist/env/workflow/tools/run-workflow.d.ts +130 -0
  278. package/dist/env/workflow/tools/submit-json-output-tool.d.ts +38 -0
  279. package/dist/env/workflow/tools/workflow-add-tool.d.ts +47 -0
  280. package/dist/env/workflow/tools/workflow-get-tool.d.ts +29 -0
  281. package/dist/env/workflow/tools/workflow-list-tool.d.ts +55 -0
  282. package/dist/env/workflow/tools/workflow-run-status-tool.d.ts +26 -0
  283. package/dist/env/workflow/tools/workflow-run-stop-tool.d.ts +29 -0
  284. package/dist/env/workflow/tools/workflow-search-tool.d.ts +33 -0
  285. package/dist/env/workflow/tools/workflow-tag-list-tool.d.ts +59 -0
  286. package/dist/env/workflow/tools/workflow-validate-tool.d.ts +60 -0
  287. package/dist/env/workflow/types/context.d.ts +17 -0
  288. package/dist/env/workflow/types/decorators-types.d.ts +182 -0
  289. package/dist/env/workflow/types/edge.d.ts +33 -0
  290. package/dist/env/workflow/types/event.d.ts +869 -0
  291. package/dist/env/workflow/types/index.d.ts +16 -0
  292. package/dist/env/workflow/types/run.d.ts +235 -0
  293. package/dist/env/workflow/types/workflow-error.d.ts +79 -0
  294. package/dist/env/workflow/types/workflow-hil.d.ts +57 -0
  295. package/dist/env/workflow/types/workflow-message.d.ts +193 -0
  296. package/dist/env/workflow/types/workflow-session.d.ts +17 -0
  297. package/dist/env/workflow/types/workflow.d.ts +654 -0
  298. package/dist/env/workflow/types_compat.d.ts +10 -0
  299. package/dist/env/workflow/utils/agent-session-metadata.d.ts +35 -0
  300. package/dist/env/workflow/utils/build-agent-node-output.d.ts +11 -0
  301. package/dist/env/workflow/utils/create-workflow.d.ts +35 -0
  302. package/dist/env/workflow/utils/dependency-prescan.d.ts +67 -0
  303. package/dist/env/workflow/utils/execution-state.d.ts +46 -0
  304. package/dist/env/workflow/utils/extract-agent-json-output.d.ts +6 -0
  305. package/dist/env/workflow/utils/index.d.ts +14 -0
  306. package/dist/env/workflow/utils/json-schema-to-zod.d.ts +23 -0
  307. package/dist/env/workflow/utils/node-id-utils.d.ts +20 -0
  308. package/dist/env/workflow/utils/node-output-contracts.d.ts +137 -0
  309. package/dist/env/workflow/utils/node-registry-helper.d.ts +36 -0
  310. package/dist/env/workflow/utils/output-schema-hint.d.ts +7 -0
  311. package/dist/env/workflow/utils/parse-agent-output-config.d.ts +9 -0
  312. package/dist/env/workflow/utils/recovery-validator.d.ts +30 -0
  313. package/dist/env/workflow/utils/sensitive-redact.d.ts +37 -0
  314. package/dist/env/workflow/utils/session-parser.d.ts +23 -0
  315. package/dist/env/workflow/utils/session-recovery.d.ts +122 -0
  316. package/dist/env/workflow/utils/template-contract-validator.d.ts +87 -0
  317. package/dist/env/workflow/utils/template-resolver.d.ts +285 -0
  318. package/dist/env/workflow/utils/validate-workflow-definition.d.ts +57 -0
  319. package/dist/env/workflow/utils/validation-rules.d.ts +103 -0
  320. package/dist/env/workflow/utils/workflow-message-metadata.d.ts +20 -0
  321. package/dist/env/workflow/utils/workflow-sanitize.d.ts +51 -0
  322. package/dist/env/workflow/workflow-component.d.ts +138 -0
  323. package/dist/index.d.ts +59 -0
  324. package/dist/index.js +7 -7
  325. package/dist/shared/@ai-setting/{roy-agent-core-9faekt5n.js → roy-agent-core-4sx6sdb2.js} +1 -1
  326. package/dist/shared/@ai-setting/{roy-agent-core-wxsgay02.js → roy-agent-core-brwzs8wf.js} +1 -1
  327. package/dist/shared/@ai-setting/{roy-agent-core-kyasfzeh.js → roy-agent-core-hch2geta.js} +45 -14
  328. package/dist/shared/@ai-setting/{roy-agent-core-zd077w51.js → roy-agent-core-j8e92gj8.js} +43 -1
  329. package/dist/shared/@ai-setting/{roy-agent-core-wwytg8rv.js → roy-agent-core-ph5qbqcx.js} +566 -78
  330. package/dist/util/process/process-tree-killer.d.ts +67 -0
  331. package/dist/utils/id.d.ts +11 -0
  332. package/dist/utils/loose-json.d.ts +30 -0
  333. package/dist/utils/media.d.ts +70 -0
  334. package/dist/utils/temp-file-manager/index.d.ts +99 -0
  335. package/package.json +4 -2
  336. /package/dist/shared/@ai-setting/{roy-agent-core-s214vmmd.js → roy-agent-core-4vpk40ss.js} +0 -0
  337. /package/dist/shared/@ai-setting/{roy-agent-core-0cfaqnz9.js → roy-agent-core-k25gv86p.js} +0 -0
@@ -0,0 +1,290 @@
1
+ /**
2
+ * @fileoverview Task Component Types
3
+ */
4
+ import { z } from "zod";
5
+ /**
6
+ * Task status enum
7
+ */
8
+ export declare const TaskStatusEnum: z.ZodEnum<["todo", "active", "completed", "paused", "cancelled", "archived"]>;
9
+ export type TaskStatus = z.infer<typeof TaskStatusEnum>;
10
+ /**
11
+ * Task priority enum
12
+ */
13
+ export declare const TaskPriorityEnum: z.ZodEnum<["low", "medium", "high"]>;
14
+ export type TaskPriority = z.infer<typeof TaskPriorityEnum>;
15
+ /**
16
+ * Task type enum
17
+ * - normal: 常规任务,需要跟踪完成
18
+ * - cycle: 周期任务(如写周报),无需 complete,定期执行
19
+ * - longterm: 长期任务/愿景目标,无法一次性完成,持续跟进
20
+ */
21
+ export declare const TaskTypeEnum: z.ZodEnum<["normal", "cycle", "longterm"]>;
22
+ export type TaskType = z.infer<typeof TaskTypeEnum>;
23
+ /**
24
+ * Action type for task operations
25
+ */
26
+ export declare const ActionTypeEnum: z.ZodEnum<["create", "progress", "milestone", "problem", "solution", "decision", "review", "completed", "workflow_extracted"]>;
27
+ export type ActionType = z.infer<typeof ActionTypeEnum>;
28
+ /**
29
+ * Task entity
30
+ */
31
+ export interface Task {
32
+ id: number;
33
+ title: string;
34
+ description: string;
35
+ status: TaskStatus;
36
+ priority: TaskPriority;
37
+ type: TaskType;
38
+ progress: number;
39
+ current_status: string;
40
+ goals_and_expected_deliverables: string;
41
+ parent_task_id?: number;
42
+ createdAt: string;
43
+ updatedAt: string;
44
+ due_date?: string;
45
+ tags?: string[];
46
+ /** Project root path for task positioning */
47
+ project_path: string;
48
+ /** JSON string with time-space positioning info (worktree, branch, etc.) */
49
+ context: string;
50
+ }
51
+ /**
52
+ * TaskOperation entity — 双维度操作记录(Task #2211 重构后版本)
53
+ *
54
+ * 每条 operation 描述任务生命周期中**某一时刻达到的里程碑/状态**
55
+ * 与**达成该状态所采用的过程概要**——两个维度严格分工:
56
+ *
57
+ * 1. **状态/里程碑维度**("达成的状态/结果"):
58
+ * - `milestoneType`: 里程碑类型(ActionTypeEnum: create/progress/milestone/problem/...)
59
+ * - `milestoneTitle`: 里程碑标题(一行)
60
+ * - `milestoneDescription`: 达成状态/结果描述
61
+ *
62
+ * 2. **过程维度**("如何达到"):
63
+ * - `processDescription`: 过程概要(采取的策略 + 工具步骤概要,100-150 字符)
64
+ *
65
+ * ⚠️ **不要把 action 当状态**,也不要让 process 与 milestone_description 重复。
66
+ *
67
+ * ---
68
+ * **向后兼容**(兼容窗口期,Task #2211 引入):
69
+ * - DB 列已重命名为 milestone_* (migration 004);action_* 列已不存在。
70
+ * - `actionType/actionTitle/actionDescription` 仍作为本接口的 @deprecated alias 保留,
71
+ * 通过 getter/setter 自动代理到 milestone_* 字段,保证现有调用方代码不改也能工作。
72
+ * - 旧调用方应尽快迁移到 milestone_* 主字段。
73
+ */
74
+ export interface TaskOperation {
75
+ id: number;
76
+ taskId: number;
77
+ sessionId: string;
78
+ /** 里程碑类型(create / progress / milestone / problem / solution / decision / review / completed / workflow_extracted) */
79
+ milestoneType: ActionType;
80
+ /** 里程碑标题(一行) */
81
+ milestoneTitle: string;
82
+ /** 状态/结果描述(保留原义,可长可短;过程概要应放在 processDescription) */
83
+ milestoneDescription: string;
84
+ /**
85
+ * 过程概要:采取了什么策略 + 工具步骤达成的概要描述。
86
+ *
87
+ * 设计哲学:操作记录只承担节点阶段 milestone 摘要。
88
+ * 字符范围硬约束 100-150,应用层 schema 校验。
89
+ * 完整过程通过 sessionId 回查 session。
90
+ */
91
+ processDescription: string;
92
+ timestamp: string;
93
+ mdPath?: string;
94
+ /**
95
+ * @deprecated 旧命名,已重命名为 milestoneType。仍可读写(自动代理),
96
+ * 旧调用方应尽快迁移到 milestoneType。
97
+ */
98
+ actionType?: ActionType;
99
+ /** @deprecated 已重命名为 milestoneTitle。 */
100
+ actionTitle?: string;
101
+ /** @deprecated 已重命名为 milestoneDescription。 */
102
+ actionDescription?: string;
103
+ }
104
+ /**
105
+ * TaskTag entity
106
+ *
107
+ * Tag 池中的单个 Tag
108
+ */
109
+ export interface TaskTag {
110
+ id: number;
111
+ name: string;
112
+ createdAt: string;
113
+ taskCount: number;
114
+ }
115
+ export declare const TaskConfigSchema: z.ZodDefault<z.ZodObject<{
116
+ storage: z.ZodDefault<z.ZodObject<{
117
+ type: z.ZodDefault<z.ZodEnum<["memory", "sqlite"]>>;
118
+ dbPath: z.ZodOptional<z.ZodString>;
119
+ }, "strip", z.ZodTypeAny, {
120
+ type: "memory" | "sqlite";
121
+ dbPath?: string | undefined;
122
+ }, {
123
+ type?: "memory" | "sqlite" | undefined;
124
+ dbPath?: string | undefined;
125
+ }>>;
126
+ }, "strip", z.ZodTypeAny, {
127
+ storage: {
128
+ type: "memory" | "sqlite";
129
+ dbPath?: string | undefined;
130
+ };
131
+ }, {
132
+ storage?: {
133
+ type?: "memory" | "sqlite" | undefined;
134
+ dbPath?: string | undefined;
135
+ } | undefined;
136
+ }>>;
137
+ export type TaskConfig = z.infer<typeof TaskConfigSchema>;
138
+ export interface CreateTaskOptions {
139
+ title: string;
140
+ description?: string;
141
+ priority?: TaskPriority;
142
+ type?: TaskType;
143
+ /**
144
+ * 父任务 ID(可选)。
145
+ * - 不传 / undefined / null:创建根任务(root task,无父任务)
146
+ * - 传 number:作为指定父任务的子任务
147
+ */
148
+ parent_task_id?: number | null;
149
+ goals_and_expected_deliverables?: string;
150
+ due_date?: string;
151
+ tags?: string[];
152
+ sessionId: string;
153
+ /** Project root path for task positioning. Use 'unknown' if unknown. */
154
+ project_path: string;
155
+ /**
156
+ * JSON string with time-space positioning info.
157
+ * - For coding tasks: include worktree_path, branch, type
158
+ * - For other tasks: use '{}' or '{"type":"unknown"}'
159
+ * Must be a valid JSON string.
160
+ */
161
+ context: string;
162
+ }
163
+ export interface UpdateTaskOptions {
164
+ title?: string;
165
+ description?: string;
166
+ status?: TaskStatus;
167
+ priority?: TaskPriority;
168
+ type?: TaskType;
169
+ progress?: number;
170
+ current_status?: string;
171
+ goals_and_expected_deliverables?: string;
172
+ due_date?: string;
173
+ tags?: string[];
174
+ /** 项目路径,标识任务所属的项目 */
175
+ project_path?: string;
176
+ /** 任务上下文信息,用于存储额外上下文 */
177
+ context?: string;
178
+ /** 父任务 ID,null = 设为根任务(无父任务) */
179
+ parent_task_id?: number | null;
180
+ }
181
+ export interface ListTasksOptions {
182
+ status?: TaskStatus;
183
+ priority?: TaskPriority;
184
+ type?: TaskType;
185
+ parent_task_id?: number;
186
+ limit?: number;
187
+ offset?: number;
188
+ /**
189
+ * 检索层级深度:
190
+ * - undefined / null:不做层级过滤(默认行为,向后兼容)
191
+ * - 0:只查询根任务(`parent_task_id IS NULL`)
192
+ * - 1:根 + 一层子任务
193
+ * - 2:根 + 二层子任务,依此类推
194
+ * - -1 或负数:不限制层级(全部)
195
+ *
196
+ * 注意:与 `parent_task_id` 一起使用时,`parent_task_id` 优先
197
+ * (即深度过滤从指定父节点开始计算)。
198
+ */
199
+ depth?: number;
200
+ /**
201
+ * 是否包含已归档任务。默认 false(向后兼容)。
202
+ * 当前 task 系统尚未实现归档字段,保留接口位以便 Phase 5 接入。
203
+ */
204
+ include_archived?: boolean;
205
+ }
206
+ export interface CreateOperationOptions {
207
+ taskId: number;
208
+ sessionId: string;
209
+ /** 里程碑类型(主命名,替代旧 actionType) */
210
+ milestoneType: ActionType;
211
+ /** 里程碑标题(主命名,替代旧 actionTitle) */
212
+ milestoneTitle: string;
213
+ /** 里程碑描述/状态/结果(主命名,替代旧 actionDescription) */
214
+ milestoneDescription?: string;
215
+ /**
216
+ * 过程概要(采取的策略 + 工具步骤),可选;如提供,应用层会校验 100-150 字符。
217
+ * 字符范围外会由 tool schema 拒绝(不在 DB 层强约束)。
218
+ */
219
+ processDescription?: string;
220
+ mdPath?: string;
221
+ /**
222
+ * @deprecated 兼容旧调用方。如提供,自动映射到 milestoneType。
223
+ * 建议尽快迁移到 milestoneType。
224
+ */
225
+ actionType?: ActionType;
226
+ /** @deprecated 已重命名为 milestoneTitle。 */
227
+ actionTitle?: string;
228
+ /** @deprecated 已重命名为 milestoneDescription。 */
229
+ actionDescription?: string;
230
+ }
231
+ export interface ListOperationsOptions {
232
+ taskId: number;
233
+ /** 过滤里程碑类型(主命名) */
234
+ milestoneType?: ActionType;
235
+ /** @deprecated 已重命名为 milestoneType。仍可读写,自动代理。 */
236
+ actionType?: ActionType;
237
+ limit?: number;
238
+ offset?: number;
239
+ }
240
+ /**
241
+ * Operation update payload — 兼容 milestone_* 与 action_* 两种字段。
242
+ *
243
+ * 双维度:
244
+ * - milestone_* 字段描述状态/结果
245
+ * - processDescription 描述过程
246
+ */
247
+ export interface UpdateOperationOptions {
248
+ milestoneTitle?: string;
249
+ milestoneDescription?: string;
250
+ processDescription?: string;
251
+ /** @deprecated 已重命名为 milestoneTitle。 */
252
+ actionTitle?: string;
253
+ /** @deprecated 已重命名为 milestoneDescription。 */
254
+ actionDescription?: string;
255
+ }
256
+ /**
257
+ * 任务列表结果(带分页总数)
258
+ *
259
+ * 用于 listTasks / searchTasksByKeywords 等分页接口。
260
+ * - tasks: 当前页的任务列表
261
+ * - total: 满足筛选条件的总任务数(分页前)
262
+ */
263
+ export interface TaskListResult {
264
+ tasks: Task[];
265
+ total: number;
266
+ }
267
+ /**
268
+ * 搜索选项(searchTasksByKeywords 专用)
269
+ */
270
+ export interface SearchTasksOptions {
271
+ limit?: number;
272
+ offset?: number;
273
+ excludeTaskId?: number;
274
+ status?: TaskStatus;
275
+ priority?: TaskPriority;
276
+ type?: TaskType;
277
+ /**
278
+ * 检索层级深度(与 ListTasksOptions.depth 语义一致):
279
+ * - undefined:不过滤
280
+ * - 0:只根任务
281
+ * - 1:根 + 一层子任务
282
+ * - 2:根 + 二层子任务,依此类推
283
+ * - -1 或负数:不限制
284
+ */
285
+ depth?: number;
286
+ /**
287
+ * 是否包含已归档任务。默认 false。
288
+ */
289
+ include_archived?: boolean;
290
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Bash Spawner - Effect 架构实现
3
+ *
4
+ * 借鉴 opencode 的 Effect/Scope 架构,实现正确的 stdin 生命周期管理。
5
+ *
6
+ * 进程树清理(2026-07 新增):
7
+ * - POSIX spawn 使用 `detached: true`,让子 shell 拥有独立的进程组(PGID == shell PID),
8
+ * 这样 `process.kill(-shell_pid, SIGKILL)` 才能杀进程组(含孙进程)而不误伤父进程组。
9
+ * - Windows 走 taskkill /F /T 杀进程树,不依赖 detached。
10
+ * - 若当前在 delegate_task 的 ProcessRegistry 作用域内,bash 启动的 child.pid 会
11
+ * 自动注册到 registry;child exit 时自动反注册。当外层 task 超时/stop 时
12
+ * registry.killAll() 会杀掉所有仍注册的进程(彻底解决"孙进程泄漏"问题)。
13
+ */
14
+ import { Effect, Context, Layer } from "effect";
15
+ import { spawn as _childProcessSpawn } from "child_process";
16
+ export declare function _setSpawnForTests(s: typeof _childProcessSpawn | undefined): void;
17
+ export interface BashSpawnerOptions {
18
+ cwd?: string;
19
+ timeout?: number;
20
+ env?: Record<string, string>;
21
+ }
22
+ export interface BashSpawnerResult {
23
+ stdout: string;
24
+ stderr: string;
25
+ exitCode: number;
26
+ success: boolean;
27
+ timedOut: boolean;
28
+ }
29
+ export declare const BashSpawner: Context.Tag<{
30
+ run(command: string, options?: BashSpawnerOptions): Effect.Effect<BashSpawnerResult>;
31
+ }, {
32
+ run(command: string, options?: BashSpawnerOptions): Effect.Effect<BashSpawnerResult>;
33
+ }>;
34
+ export declare const BashSpawnerLayer: Layer.Layer<{
35
+ run(command: string, options?: BashSpawnerOptions): Effect.Effect<BashSpawnerResult>;
36
+ }, never, never>;
@@ -0,0 +1,16 @@
1
+ import type { Tool } from "../types";
2
+ /**
3
+ * Bash 工具
4
+ *
5
+ * 使用 Effect 架构实现,支持正确的 stdin 生命周期管理。
6
+ *
7
+ * 关键特性:
8
+ * 1. 使用 Effect/Scope 管理进程生命周期
9
+ * 2. stdin 保持打开直到 Effect 完成
10
+ * 3. 支持 OpenTelemetry W3C TraceContext 跨进程追踪
11
+ *
12
+ * 跨平台兼容:
13
+ * - Windows: 使用 cmd.exe
14
+ * - Linux/macOS: 使用 bash
15
+ */
16
+ export declare const bashTool: Tool;
@@ -0,0 +1,7 @@
1
+ import type { Tool } from "../types";
2
+ /**
3
+ * Echo tool - simple echo command
4
+ *
5
+ * This is a convenience tool for logging messages in workflows.
6
+ */
7
+ export declare const echoTool: Tool;
@@ -0,0 +1,6 @@
1
+ import type { Tool } from "../types";
2
+ /**
3
+ * 编辑文件工具
4
+ * 通过 oldString/newString 替换来编辑文件
5
+ */
6
+ export declare const editFileTool: Tool;
@@ -0,0 +1,6 @@
1
+ import type { Tool } from "../types";
2
+ /**
3
+ * Glob 工具
4
+ * 文件模式匹配搜索
5
+ */
6
+ export declare const globTool: Tool;
@@ -0,0 +1,6 @@
1
+ import type { Tool } from "../types";
2
+ /**
3
+ * Grep 工具
4
+ * 在文件中搜索内容
5
+ */
6
+ export declare const grepTool: Tool;
@@ -0,0 +1,39 @@
1
+ import type { Tool } from "../types";
2
+ import { bashTool } from "./bash";
3
+ import { echoTool } from "./echo";
4
+ import { globTool } from "./glob";
5
+ import { readFileTool } from "./read-file";
6
+ import { writeFileTool } from "./write-file";
7
+ import { editFileTool } from "./edit-file";
8
+ import { grepTool } from "./grep";
9
+ import { understandImageTool } from "./understand-image";
10
+ import { createQueryBackgroundProcessTool } from "./query-background-process-tool";
11
+ export { bashTool };
12
+ export { echoTool };
13
+ export { globTool };
14
+ export { readFileTool };
15
+ export { writeFileTool };
16
+ export { editFileTool };
17
+ export { grepTool };
18
+ export { understandImageTool };
19
+ import { queryBackgroundProcessTool } from "./query-background-process-tool";
20
+ export { queryBackgroundProcessTool, createQueryBackgroundProcessTool };
21
+ export { setUnderstandImageLLMProvider, getUnderstandImageLLMProvider, resetUnderstandImageLLMProvider, type UnderstandImageLLMProvider, } from "./understand-image";
22
+ /**
23
+ * 获取所有内置工具
24
+ *
25
+ * Note:
26
+ * - run-workflow tool is not included here because it requires
27
+ * a WorkflowService instance which needs to be initialized at runtime.
28
+ * Use initRunWorkflowTool(workflowService) to initialize it.
29
+ * - query_background_process is registered but visible ONLY to the
30
+ * "default" agent (via metadata.allowedAgentTypes=["default"]).
31
+ * Other agents (roy / strict-task-agent / explore / etc.) won't see it.
32
+ * 实际使用时 TaskComponent.start() 会用 createQueryBackgroundProcessTool(manager)
33
+ * 重新注册一个 manager-bound 实例,覆盖此 no-manager 默认版本。
34
+ */
35
+ export declare function getAllBuiltInTools(): Tool[];
36
+ /**
37
+ * 获取指定内置工具
38
+ */
39
+ export declare function getBuiltInTool(name: string): Tool | undefined;
@@ -0,0 +1,113 @@
1
+ /**
2
+ * @fileoverview query_background_process — Default Agent 后台进程查询工具
3
+ *
4
+ * 目的:
5
+ * - 让 default 接待员 agent 可以查询由 `delegate_task` 启动的后台子进程当前状态
6
+ * - 解决"通知丢失"或"怀疑卡住"时无法判断后台任务真实状态的问题
7
+ *
8
+ * 可见性:
9
+ * - `metadata.allowedAgentTypes: ["default"]` — 只对 default agent 可见
10
+ * - 其他 agent(roy / strict-task-agent / explore 等)看不到这个工具
11
+ * - 不需要这个工具的原因是:subagent 自己不会被委托任务,所以也不会去查后台进程
12
+ *
13
+ * 注入方式(2026-07 重构):
14
+ * - 使用 `createQueryBackgroundProcessTool(manager)` 工厂函数闭包注入
15
+ * - 每个 Environment/TaskComponent 持有一个独立的 BackgroundTaskManager 引用
16
+ * - TaskComponent.start() 创建 manager-bound tool 并注册到 ToolComponent
17
+ * - 多个 Environment 拥有独立的 manager,不会互相覆盖(修复多 Environment 互相 reset 问题)
18
+ *
19
+ * Session ownership(2026-07 新增):
20
+ * - 工具会校验 ctx.session_id 与 task.parentSessionId 一致
21
+ * - 不匹配 → 返回 status='not_found'(不暴露存在性)
22
+ * - 防止 session A 拿 bgProcessId 偷看 session B 的后台任务
23
+ *
24
+ * 输入:
25
+ * - bgProcessId: string — delegate_task 返回的 background process ID
26
+ *
27
+ * 输出(JSON 字符串):
28
+ * {
29
+ * alive: boolean,
30
+ * status: 'running' | 'pending' | 'completed' | 'failed' | 'stopped' | 'timeout' | 'not_found',
31
+ * createdAt: number, // 启动时间戳
32
+ * lastUpdatedAt: number, // 最后状态更新时间戳
33
+ * description?: string, // 任务描述
34
+ * result?: any, // 已完成时返回
35
+ * error?: string, // 失败时返回
36
+ * }
37
+ *
38
+ * 失败行为:
39
+ * - manager 未注入 → success=false, error="not initialized"
40
+ * - 参数校验失败 → throw (zod)
41
+ * - 任务不存在 → success=true, status='not_found'(正常查询结果,不是错误)
42
+ */
43
+ import type { Tool } from "../types";
44
+ import type { BackgroundTaskManager, BackgroundTask } from "../../task/delegate/delegate-tool";
45
+ /**
46
+ * 输出 schema(结构化返回,序列化为 JSON 字符串)
47
+ */
48
+ export interface QueryBackgroundProcessOutput {
49
+ /** 是否仍在运行(pending/running 视为 alive=true) */
50
+ alive: boolean;
51
+ /** 当前状态 */
52
+ status: BackgroundTask["status"] | "not_found";
53
+ /** 启动时间戳(毫秒) */
54
+ createdAt: number;
55
+ /** 最后状态更新时间戳(毫秒;not_found 时为查询时刻) */
56
+ lastUpdatedAt: number;
57
+ /** 任务描述(not_found 时为 undefined) */
58
+ description?: string;
59
+ /** 已完成 / 失败 / 停止时的结果 */
60
+ result?: string;
61
+ /** 失败时的错误信息 */
62
+ error?: string;
63
+ }
64
+ /**
65
+ * 将 BackgroundTask 转成工具输出。
66
+ *
67
+ * - alive: status === 'pending' || 'running' → true;其余 → false
68
+ * - lastUpdatedAt: task.lastUpdatedAt,兼容旧任务时 fallback 到 completedAt/startedAt/createdAt
69
+ * - description: 总是透传(agent 需要知道是哪个任务)
70
+ *
71
+ * 提取为纯函数便于单元测试。
72
+ */
73
+ export declare function backgroundTaskToOutput(task: BackgroundTask): QueryBackgroundProcessOutput;
74
+ /**
75
+ * not_found 状态的输出
76
+ */
77
+ export declare function notFoundOutput(bgProcessId: string): QueryBackgroundProcessOutput;
78
+ /**
79
+ * query_background_process 工具的"无 manager"实例。
80
+ *
81
+ * 历史:这个 named export 原本是 module-global 单例,所有 agent 共享一个 manager 引用。
82
+ * 重构后(2026-07):
83
+ * - 实际注入的 manager 通过 `createQueryBackgroundProcessTool(manager)` 工厂绑定
84
+ * - 此 named export 仍存在以保持向后兼容(getAllBuiltInTools / 旧测试代码会引用),
85
+ * 但它绑定的是 null manager → 执行时会返回 "not initialized" 错误
86
+ * - TaskComponent.start() 会用 `createQueryBackgroundProcessTool(manager)` 重新注册
87
+ * 真正的实例到 ToolComponent,覆盖此 no-manager 版本
88
+ *
89
+ * 用法示例(推荐):
90
+ * ```ts
91
+ * const tool = createQueryBackgroundProcessTool(manager);
92
+ * toolComponent.register(tool);
93
+ * ```
94
+ */
95
+ export declare const queryBackgroundProcessTool: Tool;
96
+ /**
97
+ * 工厂函数 — 创建 manager-bound 工具实例(2026-07 重构新增)
98
+ *
99
+ * 为什么需要工厂:
100
+ * - 旧模式(setter 全局变量)导致多 Environment/TaskComponent 实例互相覆盖 manager
101
+ * - 工厂函数将 manager 闭包到工具内部,每个 TaskComponent 创建独立的 tool 实例
102
+ * - TaskComponent.start() 负责调用此工厂并把生成的 tool 注册到 ToolComponent
103
+ *
104
+ * 行为契约:
105
+ * - manager 有效(getTask 函数存在)→ 正常查询
106
+ * - manager 为 null/undefined → 返回 success=false, error="not initialized"
107
+ * - 任务存在但 ctx.session_id 与 task.parentSessionId 不匹配 → 返回 not_found
108
+ * (防止跨 session 数据泄露;不暴露存在性)
109
+ *
110
+ * @param manager BackgroundTaskManager 实例;传入 null/undefined 表示未注入
111
+ * @returns 新的 Tool 实例
112
+ */
113
+ export declare function createQueryBackgroundProcessTool(manager?: BackgroundTaskManager | null): Tool;
@@ -0,0 +1,5 @@
1
+ import type { Tool } from "../types";
2
+ /**
3
+ * 读取文件工具
4
+ */
5
+ export declare const readFileTool: Tool;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @fileoverview understand_image — 多模态图片理解工具
3
+ *
4
+ * 对齐 MCP `understand_image` 工具的入参格式(image_source + prompt),
5
+ * 但内部走 LLMComponent.invoke() 多模态调用路径。
6
+ *
7
+ * 设计取舍:
8
+ * - 不直接 import LLMComponent(避免循环依赖 + 让单元测试注入 mock 即可)。
9
+ * 改用模块级 setter(类似 `setToolConfigComponent`),由 AgentComponent 在
10
+ * LLMComponent 就绪后注入。
11
+ * - 不注入 provider 时直接返回错误(fail-loud,避免静默空响应)。
12
+ * - 图片解析复用 `parseImageInput` (P0),支持 URL / data:base64 / 本地路径 / @ 前缀。
13
+ * - 返回多模态 LLM 调用的文本结果。
14
+ *
15
+ * 实施位置:core 包内置工具,由 `loadBuiltInTools()` 自动注册到 default 和所有
16
+ * 声明过 tools 的 agent。
17
+ */
18
+ import type { Tool } from "../types";
19
+ import type { LLMMessage } from "../../llm/types";
20
+ /**
21
+ * LLM 调用 provider 函数签名。
22
+ *
23
+ * AgentComponent 注入时会包装 LLMComponent.invoke() 调用:
24
+ * - 接收 messages[](已组装为多模态 text + image content)
25
+ * - 返回 LLM 的文本响应
26
+ * - 不抛错由调用方处理
27
+ *
28
+ * 测试中以 mock 替代。
29
+ */
30
+ export type UnderstandImageLLMProvider = (messages: LLMMessage[]) => Promise<string>;
31
+ /**
32
+ * 设置 understand_image 工具使用的 LLM provider
33
+ *
34
+ * 通常由 AgentComponent 在 LLMComponent 就绪时调用。
35
+ */
36
+ export declare function setUnderstandImageLLMProvider(provider: UnderstandImageLLMProvider | null): void;
37
+ /**
38
+ * 读取当前 provider(仅用于测试 / 诊断)。
39
+ */
40
+ export declare function getUnderstandImageLLMProvider(): UnderstandImageLLMProvider | null;
41
+ /**
42
+ * 重置 provider(仅用于测试 cleanup)。
43
+ */
44
+ export declare function resetUnderstandImageLLMProvider(): Promise<void>;
45
+ /**
46
+ * understand_image 工具
47
+ *
48
+ * 使用一个多模态 LLM 来分析图片内容。可用于:
49
+ * - 看图描述("What is in this image?")
50
+ * - OCR / 图文混排解析
51
+ * - 视觉问答(VQA)
52
+ *
53
+ * 支持的 image_source:
54
+ * - http(s) URL — 直接传给 LLM
55
+ * - data:base64 URL — 直接传给 LLM
56
+ * - 本地文件路径 — readFile 后以 buffer 形式传给 LLM
57
+ * - `@`-prefixed 路径 — 同上,前缀被剥除
58
+ */
59
+ export declare const understandImageTool: Tool;
@@ -0,0 +1,5 @@
1
+ import type { Tool } from "../types";
2
+ /**
3
+ * 写入文件工具
4
+ */
5
+ export declare const writeFileTool: Tool;
@@ -0,0 +1,16 @@
1
+ export * from "./types";
2
+ export { ToolComponent } from "./tool-component";
3
+ export type { ToolComponentConfig } from "./tool-component";
4
+ export { setToolConfigComponent, getMaxOutputSize } from "./tool-component";
5
+ export { ToolRegistry } from "./registry";
6
+ export { ToolValidator } from "./validator";
7
+ export { getAllBuiltInTools, getBuiltInTool } from "./built-in";
8
+ export { bashTool } from "./built-in/bash";
9
+ export { echoTool } from "./built-in/echo";
10
+ export { globTool } from "./built-in/glob";
11
+ export { readFileTool } from "./built-in/read-file";
12
+ export { writeFileTool } from "./built-in/write-file";
13
+ export { editFileTool } from "./built-in/edit-file";
14
+ export { grepTool } from "./built-in/grep";
15
+ export { understandImageTool } from "./built-in/understand-image";
16
+ export { setUnderstandImageLLMProvider, getUnderstandImageLLMProvider, resetUnderstandImageLLMProvider, type UnderstandImageLLMProvider, } from "./built-in/understand-image";
@@ -0,0 +1,61 @@
1
+ import type { Tool, ToolRegistration, ToolListFilter } from "./types";
2
+ /**
3
+ * 工具注册中心
4
+ * 管理所有已注册的工具
5
+ */
6
+ export declare class ToolRegistry {
7
+ private tools;
8
+ /**
9
+ * 注册工具
10
+ */
11
+ register(tool: Tool, registration: ToolRegistration): void;
12
+ /**
13
+ * 注销工具
14
+ */
15
+ unregister(name: string): boolean;
16
+ /**
17
+ * 获取工具
18
+ */
19
+ getTool(name: string): ToolRegistration | undefined;
20
+ /**
21
+ * 获取所有工具注册信息
22
+ */
23
+ getAllTools(): ToolRegistration[];
24
+ /**
25
+ * 列出工具(带过滤)
26
+ */
27
+ listTools(filter?: ToolListFilter): Tool[];
28
+ /**
29
+ * 检查工具是否存在
30
+ */
31
+ has(name: string): boolean;
32
+ /**
33
+ * 获取工具数量
34
+ */
35
+ getCount(): number;
36
+ /**
37
+ * 启用工具
38
+ */
39
+ enable(name: string): boolean;
40
+ /**
41
+ * 禁用工具
42
+ */
43
+ disable(name: string): boolean;
44
+ /**
45
+ * 清除所有工具
46
+ */
47
+ clear(): void;
48
+ /**
49
+ * 导出工具注册表快照
50
+ */
51
+ snapshot(): ToolRegistration[];
52
+ /**
53
+ * 从快照恢复
54
+ */
55
+ restore(snapshot: ToolRegistration[]): void;
56
+ /**
57
+ * 简单的 glob 模式匹配
58
+ * 支持 * 匹配任意字符
59
+ */
60
+ private matchGlob;
61
+ }