@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,71 @@
1
+ /**
2
+ * @fileoverview MemoryManager V3 - Simplified
3
+ *
4
+ * 后台异步任务队列处理
5
+ *
6
+ * 简化设计:
7
+ * - 移除 DraftManager(草稿管理已废弃)
8
+ * - 移除 MemoryOrganizer(整理机制已废弃)
9
+ * - 移除 AccessLog(访问日志已废弃)
10
+ * - 只保留核心的任务队列处理
11
+ */
12
+ import type { MemoryTask, ExtractMemoryPayload } from "./types";
13
+ /**
14
+ * MemoryManager 配置
15
+ */
16
+ export interface MemoryManagerConfig {
17
+ /** 回调:当需要提取记忆时调用 */
18
+ onExtractMemory?: (payload: ExtractMemoryPayload) => Promise<void>;
19
+ }
20
+ /**
21
+ * MemoryManager V3 - Simplified
22
+ *
23
+ * 简化的后台异步内存处理,只负责任务队列
24
+ */
25
+ export declare class MemoryManager {
26
+ /** 队列最大容量,防止内存溢出 */
27
+ private static readonly MAX_QUEUE_SIZE;
28
+ private queue;
29
+ private processing;
30
+ private shuttingDown;
31
+ private config;
32
+ private processingPromise;
33
+ private resolveProcessing;
34
+ constructor(config?: MemoryManagerConfig);
35
+ /**
36
+ * 更新配置
37
+ */
38
+ updateConfig(config: Partial<MemoryManagerConfig>): void;
39
+ /**
40
+ * 入队(非阻塞)
41
+ */
42
+ enqueue(task: Omit<MemoryTask, "id">): void;
43
+ /**
44
+ * 启动处理循环
45
+ */
46
+ private startProcessingLoop;
47
+ /**
48
+ * 检查是否有待处理任务
49
+ */
50
+ hasPendingTasks(): boolean;
51
+ /**
52
+ * 等待处理完成
53
+ */
54
+ waitForCompletion(): Promise<void>;
55
+ /**
56
+ * 准备关闭
57
+ */
58
+ prepareShutdown(): void;
59
+ /**
60
+ * 释放资源
61
+ */
62
+ dispose(): Promise<void>;
63
+ /**
64
+ * 处理单个任务
65
+ */
66
+ private processTask;
67
+ /**
68
+ * 处理记忆提取
69
+ */
70
+ private handleExtractMemory;
71
+ }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * @fileoverview MemoryPlugin - Simplified
3
+ *
4
+ * Hook handler for agent:after.react
5
+ *
6
+ * 简化设计(移除旧的复杂机制):
7
+ * - 移除了 DraftManager(草稿管理已废弃)
8
+ * - 移除了 MemoryOrganizer(整理机制已废弃)
9
+ * - 移除了 AccessLog(访问日志已废弃)
10
+ *
11
+ * 新的记忆管理方式:
12
+ * - 使用 `roy memory recall --extract` 命令手动触发
13
+ * - 使用 Memory Agent 自动分析会话历史
14
+ * - 直接更新 memory.md 文件
15
+ */
16
+ import type { HookContext } from "../../agent/types";
17
+ import type { MemoryPluginConfig } from "./types";
18
+ /**
19
+ * MemoryPlugin - Simplified
20
+ *
21
+ * 简化的记忆插件,不再自动处理。
22
+ *
23
+ * 用户应该使用 `roy memory recall --extract` 命令来手动触发记忆提取。
24
+ *
25
+ * 保留此插件是为了:
26
+ * 1. 保持 API 兼容性
27
+ * 2. 未来可以扩展为可选的自动触发
28
+ */
29
+ export declare class MemoryPlugin {
30
+ private config;
31
+ private disposed;
32
+ private initialized;
33
+ /** 项目 memory 基础目录 */
34
+ private projectBaseDir;
35
+ /** 全局 memory 基础目录 */
36
+ private globalBaseDir;
37
+ /** 当前工作目录(用于推断项目路径) */
38
+ private workDir;
39
+ /** AgentComponent 引用(延迟获取) */
40
+ private agentComponent;
41
+ constructor(baseDir: string, config?: MemoryPluginConfig);
42
+ /**
43
+ * Plugin 名称
44
+ */
45
+ get name(): string;
46
+ /**
47
+ * 订阅的 Hook 点
48
+ */
49
+ get hookPoint(): "agent:after.react";
50
+ /**
51
+ * 优先级
52
+ */
53
+ get priority(): number;
54
+ /**
55
+ * 描述
56
+ */
57
+ get description(): string;
58
+ /**
59
+ * 获取 Hook 定义
60
+ */
61
+ get hooks(): {
62
+ point: "agent:after.react";
63
+ priority: number;
64
+ }[];
65
+ /**
66
+ * 初始化
67
+ */
68
+ initialize(): Promise<void>;
69
+ /**
70
+ * 执行 Hook
71
+ *
72
+ * 简化为空操作。用户应该使用 `roy memory recall --extract` 命令。
73
+ */
74
+ execute(ctx: HookContext): Promise<void>;
75
+ /**
76
+ * 准备关闭
77
+ */
78
+ prepareShutdown(): void;
79
+ /**
80
+ * 检查是否有待处理任务
81
+ */
82
+ hasPendingTasks(): boolean;
83
+ /**
84
+ * 等待处理完成
85
+ */
86
+ waitForCompletion(): Promise<void>;
87
+ /**
88
+ * 释放资源
89
+ */
90
+ dispose(): Promise<void>;
91
+ /**
92
+ * 获取项目 base dir
93
+ */
94
+ getProjectBaseDir(): string;
95
+ /**
96
+ * 获取全局 base dir
97
+ */
98
+ getGlobalBaseDir(): string;
99
+ }
100
+ /**
101
+ * 创建 MemoryPlugin 实例
102
+ */
103
+ export declare function createMemoryPlugin(baseDir: string, config?: MemoryPluginConfig): MemoryPlugin;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @fileoverview Recall Memory - Simplified
3
+ *
4
+ * 简化设计:
5
+ * - 移除 AccessLog(访问日志已废弃)
6
+ * - 只读取 memory.md 文件
7
+ */
8
+ import type { MemoryPath } from "../types";
9
+ /**
10
+ * 读取记忆文件
11
+ *
12
+ * @param memoryPaths - 记忆路径列表
13
+ * @returns 记忆内容
14
+ */
15
+ export declare function recallMemory(memoryPaths: MemoryPath[]): Promise<string>;
16
+ export type { MemoryPath } from "../types";
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @fileoverview Memory Plugin Types (Simplified)
3
+ *
4
+ * MemoryPlugin 相关类型定义
5
+ *
6
+ * 简化设计:
7
+ * - 移除 Draft 相关的类型
8
+ * - 移除 AccessLog 相关的类型
9
+ */
10
+ import type { HookContext } from "../../hook/types";
11
+ import type { ModelMessage } from "ai";
12
+ /**
13
+ * MemoryPlugin configuration
14
+ */
15
+ export interface MemoryPluginConfig {
16
+ /** Enable memory plugin */
17
+ enabled?: boolean;
18
+ }
19
+ /**
20
+ * Default MemoryPlugin configuration
21
+ */
22
+ export declare const DEFAULT_MEMORY_PLUGIN_CONFIG: MemoryPluginConfig;
23
+ /**
24
+ * Memory task types
25
+ */
26
+ export type MemoryTaskType = "extract_memory";
27
+ /**
28
+ * Memory task
29
+ */
30
+ export interface MemoryTask {
31
+ id: string;
32
+ type: MemoryTaskType;
33
+ payload: unknown;
34
+ timestamp: number;
35
+ priority: number;
36
+ }
37
+ /**
38
+ * Extract memory payload
39
+ */
40
+ export interface ExtractMemoryPayload {
41
+ messages: ModelMessage[];
42
+ sessionId?: string;
43
+ /** Hook context for Memory Agent */
44
+ ctx?: MemoryHookContext;
45
+ }
46
+ /**
47
+ * SessionMessage 接口
48
+ */
49
+ export interface SessionMessage {
50
+ /** 消息角色 */
51
+ role: "user" | "assistant" | "system" | "tool";
52
+ /** 消息内容 */
53
+ content: string | Array<{
54
+ type: string;
55
+ [key: string]: unknown;
56
+ }>;
57
+ /** 工具调用 ID(仅 tool 角色) */
58
+ toolCallId?: string;
59
+ /** 工具名称(仅 tool 角色) */
60
+ toolName?: string;
61
+ /** 时间戳 */
62
+ timestamp?: number;
63
+ }
64
+ /**
65
+ * Hook context data for agent:after.react
66
+ */
67
+ export interface MemoryHookContext {
68
+ /** Current messages for memory extraction */
69
+ messages: ModelMessage[];
70
+ /** Current session ID */
71
+ sessionId?: string;
72
+ /** Project summaries (populated by project agent) */
73
+ projectSummaries?: unknown[];
74
+ }
75
+ export type { HookContext };
@@ -0,0 +1,109 @@
1
+ /**
2
+ * @fileoverview Memory Agent Tools
3
+ *
4
+ * Memory Agent 使用的工具:
5
+ * - search_sessions: 搜索会话历史
6
+ * - get_session: 获取指定会话
7
+ * - write_memory: 写入记忆文件
8
+ * - bash: 执行 Shell 命令(用于探索项目结构)
9
+ * - read_file: 读取文件内容(用于阅读文档)
10
+ */
11
+ import { z } from "zod";
12
+ import type { Tool } from "../../tool/types";
13
+ /**
14
+ * search_sessions 输入参数
15
+ */
16
+ export declare const SearchSessionsSchema: z.ZodObject<{
17
+ query: z.ZodString;
18
+ session_id: z.ZodOptional<z.ZodString>;
19
+ limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ query: string;
22
+ limit: number;
23
+ session_id?: string | undefined;
24
+ }, {
25
+ query: string;
26
+ session_id?: string | undefined;
27
+ limit?: number | undefined;
28
+ }>;
29
+ export type SearchSessionsParams = z.infer<typeof SearchSessionsSchema>;
30
+ /**
31
+ * get_session 输入参数
32
+ */
33
+ export declare const GetSessionSchema: z.ZodObject<{
34
+ session_id: z.ZodString;
35
+ }, "strip", z.ZodTypeAny, {
36
+ session_id: string;
37
+ }, {
38
+ session_id: string;
39
+ }>;
40
+ export type GetSessionParams = z.infer<typeof GetSessionSchema>;
41
+ /**
42
+ * write_memory 输入参数
43
+ */
44
+ export declare const WriteMemorySchema: z.ZodObject<{
45
+ scope: z.ZodEnum<["project", "global"]>;
46
+ content: z.ZodString;
47
+ }, "strip", z.ZodTypeAny, {
48
+ scope: "project" | "global";
49
+ content: string;
50
+ }, {
51
+ scope: "project" | "global";
52
+ content: string;
53
+ }>;
54
+ export type WriteMemoryParams = z.infer<typeof WriteMemorySchema>;
55
+ /**
56
+ * Session Component 接口(需要 searchSessions, getSession 方法)
57
+ */
58
+ export interface MemoryAgentSessionComponent {
59
+ /**
60
+ * 列出所有会话(用于 search_sessions)
61
+ */
62
+ list(options?: any): Promise<any[]>;
63
+ /**
64
+ * 获取会话上下文(包含消息)
65
+ */
66
+ getContext(sessionId: string, options?: any): Promise<any>;
67
+ /**
68
+ * 搜索会话(通过 grep 命令)
69
+ */
70
+ searchSessions(query: string, options?: {
71
+ session_id?: string;
72
+ limit?: number;
73
+ }): Promise<any[]>;
74
+ /**
75
+ * 获取单个会话
76
+ */
77
+ getSession(sessionId: string): Promise<any | null>;
78
+ }
79
+ /**
80
+ * Memory Component 接口(需要 recallMemory, recordMemory 方法)
81
+ */
82
+ export interface MemoryAgentMemoryComponent {
83
+ recallMemory(scope?: "project" | "global"): Promise<string | null>;
84
+ recordMemory(params: {
85
+ mode: string;
86
+ content: string;
87
+ scope?: string;
88
+ }): Promise<void>;
89
+ }
90
+ /**
91
+ * Config Component 接口
92
+ */
93
+ export interface MemoryAgentConfigComponent {
94
+ get(key: string): unknown;
95
+ }
96
+ /**
97
+ * Memory Agent 工具工厂
98
+ */
99
+ export declare function createMemoryAgentTools(deps: {
100
+ sessionComponent: MemoryAgentSessionComponent;
101
+ memoryComponent: MemoryAgentMemoryComponent;
102
+ configComponent?: MemoryAgentConfigComponent;
103
+ }): {
104
+ searchSessions: Tool;
105
+ getSession: Tool;
106
+ writeMemory: Tool;
107
+ bash: Tool;
108
+ read_file: Tool;
109
+ };
@@ -0,0 +1,80 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Memory 来源类型
4
+ * - project: 项目级记忆
5
+ * - global: 全局记忆
6
+ */
7
+ export type MemorySource = "project" | "global";
8
+ /**
9
+ * Memory 路径配置
10
+ */
11
+ export interface MemoryPath {
12
+ /** 来源类型 */
13
+ type: MemorySource;
14
+ /** 绝对路径 */
15
+ path: string;
16
+ }
17
+ /**
18
+ * MemoryComponent 配置
19
+ */
20
+ export interface MemoryConfig {
21
+ /** 多路径配置 */
22
+ memoryPaths: MemoryPath[];
23
+ /** 是否递归扫描子目录 */
24
+ recursive: boolean;
25
+ /** 是否启用缓存 */
26
+ cacheEnabled: boolean;
27
+ /** 缓存有效期(毫秒) */
28
+ cacheTTL?: number;
29
+ /** 记忆文件名 */
30
+ memoryFile?: string;
31
+ }
32
+ /**
33
+ * record_memory 操作模式
34
+ */
35
+ export type RecordMemoryMode = "append" | "prepend" | "overwrite" | "delete";
36
+ /**
37
+ * record_memory 操作结果
38
+ */
39
+ export interface RecordMemoryResult {
40
+ /** 文件路径 */
41
+ path: string;
42
+ /** 操作类型 */
43
+ action: "created" | "append" | "prepend" | "overwrite" | "delete";
44
+ }
45
+ /**
46
+ * record_memory 工具参数
47
+ */
48
+ export declare const RecordMemorySchema: z.ZodObject<{
49
+ /** 作用域 (必填) */
50
+ scope: z.ZodEnum<["project", "global"]>;
51
+ /** 操作模式 */
52
+ mode: z.ZodEnum<["append", "prepend", "overwrite", "delete"]>;
53
+ /** 记忆内容 (delete 模式不需要) */
54
+ content: z.ZodOptional<z.ZodString>;
55
+ /** 章节标题 (可选,用于生成 ## title 章节) */
56
+ title: z.ZodOptional<z.ZodString>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ scope: "project" | "global";
59
+ mode: "append" | "prepend" | "overwrite" | "delete";
60
+ title?: string | undefined;
61
+ content?: string | undefined;
62
+ }, {
63
+ scope: "project" | "global";
64
+ mode: "append" | "prepend" | "overwrite" | "delete";
65
+ title?: string | undefined;
66
+ content?: string | undefined;
67
+ }>;
68
+ export type RecordMemoryParams = z.infer<typeof RecordMemorySchema>;
69
+ /**
70
+ * recall_memory 工具参数
71
+ */
72
+ export declare const RecallMemorySchema: z.ZodObject<{
73
+ /** 作用域 (可选,不传则读取所有 scope) */
74
+ scope: z.ZodOptional<z.ZodEnum<["project", "global"]>>;
75
+ }, "strip", z.ZodTypeAny, {
76
+ scope?: "project" | "global" | undefined;
77
+ }, {
78
+ scope?: "project" | "global" | undefined;
79
+ }>;
80
+ export type RecallMemoryParams = z.infer<typeof RecallMemorySchema>;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * XDG 基础目录类型
3
+ */
4
+ export type XDGDirType = "config" | "state" | "data" | "cache";
5
+ /**
6
+ * XDG 路径接口
7
+ */
8
+ export interface XDGPaths {
9
+ home: string;
10
+ config: string;
11
+ state: string;
12
+ data: string;
13
+ cache: string;
14
+ }
15
+ /**
16
+ * XDG 路径计算器(惰性计算)
17
+ */
18
+ declare class XDGPathsCalculator {
19
+ private _paths?;
20
+ get paths(): XDGPaths;
21
+ /**
22
+ * 获取特定类型的路径
23
+ */
24
+ getPath(type: XDGDirType): string;
25
+ /**
26
+ * 计算 Component 的绝对路径
27
+ */
28
+ getComponentPath(base: XDGDirType, subPath: string): string;
29
+ /**
30
+ * 强制重新计算路径(用于测试或配置变更)
31
+ */
32
+ reset(): void;
33
+ }
34
+ /**
35
+ * 全局 XDG 路径实例
36
+ */
37
+ export declare const XDG_PATHS: XDGPathsCalculator;
38
+ /**
39
+ * 获取 XDG 路径
40
+ */
41
+ export declare function getXDGPaths(): XDGPaths;
42
+ /**
43
+ * 获取特定类型的 XDG 路径
44
+ */
45
+ export declare function getXDGPath(type: XDGDirType): string;
46
+ export {};
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @fileoverview BountyCliNotificationChannel
3
+ *
4
+ * 仿 `LarkCliNotificationChannel` 设计,spawn `bounty event publish` 子进程
5
+ * 投递到 Mattermost。
6
+ *
7
+ * ## 路由逻辑
8
+ *
9
+ * - canRoute = true 仅当 `envContext.replyChannel` 存在
10
+ * - type 含 "bounty-cli"(不区分大小写)
11
+ * - 至少有 channelId 或 messageId
12
+ *
13
+ * ## spawn bounty-cli
14
+ *
15
+ * - `bounty event publish --channel <channelId> --text <text>` 投递到 Mattermost
16
+ * - profile 不为 undefined 时在 args 头部插入 `--profile <name>` flag
17
+ * - 也支持 channelName(按 Mattermost 频道名称)
18
+ *
19
+ * ## 失败处理
20
+ *
21
+ * - spawn 失败 / exit code != 0 → swallow(log warn,notification 失败不污染 Plugin 主流程)
22
+ *
23
+ * ## 与 bounty-cli 的关系
24
+ *
25
+ * bounty-cli 是独立的 Go 二进制(@ai-setting/bounty-cli npm 包,
26
+ * https://github.com/ai-setting/bounty-cli)。它通过 postinstall 自动下载。
27
+ * 用户安装 `@ai-setting/bounty-cli` 后,`bounty` 命令即可在 PATH 中使用。
28
+ */
29
+ import type { EnvContextLike, NotificationChannel, NotificationOptions, NotificationSendExtras } from "./notification-channel";
30
+ /**
31
+ * BountyCli Notification Channel
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * // 注册 bounty-cli 通道(用于 Mattermost 投递)
36
+ * component.setNotificationChannels([
37
+ * new BountyCliNotificationChannel(),
38
+ * EventBusNotificationChannel(), // 兜底
39
+ * ]);
40
+ * ```
41
+ */
42
+ export declare class BountyCliNotificationChannel implements NotificationChannel {
43
+ readonly name = "bounty-cli";
44
+ /**
45
+ * 仅当 replyChannel 含 bounty-cli 类型且有 channelId/messageId/channelName 时路由
46
+ */
47
+ canRoute(_options: NotificationOptions, _extras: NotificationSendExtras, envContext: EnvContextLike): boolean;
48
+ /**
49
+ * spawn bounty event publish 发 Mattermost 消息
50
+ */
51
+ send(options: NotificationOptions, extras: NotificationSendExtras, envContext: EnvContextLike): Promise<void>;
52
+ /**
53
+ * spawn `bounty event publish` 子进程
54
+ *
55
+ * - messageId 优先:用 `bounty event reply`(如果存在)或附加到 publish 的 text
56
+ * - channelId 优先:用 `--channel <id>`
57
+ * - channelName:用 `--channel <name>`(按名称)
58
+ */
59
+ private spawnBountyPublish;
60
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @fileoverview EventBusNotificationChannel
3
+ *
4
+ * 默认 NotificationChannel 实现 —— 把通知转成 roy-agent 自身
5
+ * `env.pushEnvEvent` 事件。
6
+ *
7
+ * ## 事件命名空间
8
+ *
9
+ * - event.type = `plugin.notification.<NotificationOptions.type>`
10
+ * - event.metadata.source = `plugin:<extras.pluginName>`
11
+ * - event.metadata 合并用户传入的 options.metadata(不覆盖 source)
12
+ * - event.payload = `{ title, content }`
13
+ *
14
+ * ## 失败处理
15
+ *
16
+ * - 缺失 envInstance / pushEnvEvent → silent skip(log debug)
17
+ * - pushEnvEvent 抛错 → swallow(log warn)
18
+ *
19
+ * 通知失败不应当污染 Plugin 主流程 —— Plugin 永远拿不到通知失败信号。
20
+ */
21
+ import type { EnvContextLike, NotificationChannel, NotificationOptions, NotificationSendExtras } from "./notification-channel";
22
+ /**
23
+ * EventBus Notification Channel
24
+ *
25
+ * 默认通道。可用于任何 plugin 通知场景(不依赖 replyChannel)。
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * import { EventBusNotificationChannel } from "./event-bus-notification-channel";
30
+ *
31
+ * component.setNotificationChannels([
32
+ * new EventBusNotificationChannel(),
33
+ * // 或其他自定义通道
34
+ * ]);
35
+ * ```
36
+ */
37
+ export declare class EventBusNotificationChannel implements NotificationChannel {
38
+ readonly name = "event-bus";
39
+ /**
40
+ * event-bus 通道 always routable(无外部依赖)
41
+ *
42
+ * 注:missing envInstance / pushEnvEvent 在 send 时检测,不在这里拒绝,
43
+ * 保持 canRoute 语义简单("我能路由这种通知吗"),让 send 决定是否真的能投递。
44
+ */
45
+ canRoute(_options: NotificationOptions, _extras: NotificationSendExtras, _envContext: EnvContextLike): boolean;
46
+ /**
47
+ * 通过 env.pushEnvEvent 推送 plugin.notification.<type> 事件
48
+ */
49
+ send(options: NotificationOptions, extras: NotificationSendExtras, _envContext: EnvContextLike): Promise<void>;
50
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @fileoverview Plugin System Module
3
+ */
4
+ export { BasePlugin, type PluginEnv, type HookDefinition, type HookHandler, type AgentInstanceConfig, type ToolDefinition, type HookContext, type HookResult, } from "./types";
5
+ export { PluginComponent, type PluginComponentOptions } from "./plugin-component";
6
+ export type { EnvContextLike, NotificationChannel, NotificationOptions, NotificationSendExtras, } from "./notification-channel";
7
+ export { EventBusNotificationChannel } from "./event-bus-notification-channel";
8
+ /**
9
+ * @deprecated 自 v2 起默认通道改为 EventBusNotificationChannel。
10
+ * LarkCliNotificationChannel 保留为 opt-in legacy 实现。
11
+ * 新代码请用 EventBusNotificationChannel + env-level event subscriber。
12
+ */
13
+ export { LarkCliNotificationChannel } from "./lark-cli-notification-channel";
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @fileoverview LarkCliNotificationChannel
3
+ *
4
+ * @deprecated 自 v2 起默认通道改为 `EventBusNotificationChannel`。
5
+ * LarkCliNotificationChannel 保留为可选/opt-in 实现,
6
+ * 新代码请用 EventBusNotificationChannel + env-level event
7
+ * subscriber 自行投递到飞书。
8
+ *
9
+ * ## 保留原因
10
+ *
11
+ * - 部分现有 Plugin 通过 `PluginEnv.notify` 期望直接发飞书(不通过 event bus)
12
+ * - 兼容旧 Plugin 配置(lark-cli 是历史默认通道)
13
+ *
14
+ * ## 路由逻辑
15
+ *
16
+ * - canRoute = true 仅当 `envContext.replyChannel` 存在,且
17
+ * - type 含 "lark"(不区分大小写)
18
+ * - 至少有 chatId 或 messageId
19
+ *
20
+ * ## spawn lark-cli
21
+ *
22
+ * - messageId 走 `lark-cli im +messages-reply --message-id <id> --markdown <md>`
23
+ * - chatId 走 `lark-cli im +messages-send --chat-id <id> --markdown <md>`
24
+ * - profile 不为 undefined 时在 args 头部插入 `--profile <name>`
25
+ *
26
+ * ## 失败处理
27
+ *
28
+ * - spawn 失败 / exit code != 0 → swallow(log warn,notification 失败不污染 Plugin 主流程)
29
+ */
30
+ import type { EnvContextLike, NotificationChannel, NotificationOptions, NotificationSendExtras } from "./notification-channel";
31
+ /**
32
+ * Lark-cli Notification Channel(legacy / @deprecated)
33
+ *
34
+ * 行为:
35
+ * - 通过 spawn lark-cli 子进程投递到飞书
36
+ * - 路由依据 envContext.replyChannel
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * // opt-in legacy channel
41
+ * component.setNotificationChannels([
42
+ * new LarkCliNotificationChannel(),
43
+ * EventBusNotificationChannel(), // 兜底
44
+ * ]);
45
+ * ```
46
+ */
47
+ export declare class LarkCliNotificationChannel implements NotificationChannel {
48
+ readonly name = "lark-cli";
49
+ /**
50
+ * 仅当 replyChannel 含 lark 类型且有 chatId/messageId 时路由
51
+ */
52
+ canRoute(_options: NotificationOptions, _extras: NotificationSendExtras, envContext: EnvContextLike): boolean;
53
+ /**
54
+ * spawn lark-cli 发飞书消息
55
+ */
56
+ send(options: NotificationOptions, extras: NotificationSendExtras, envContext: EnvContextLike): Promise<void>;
57
+ /**
58
+ * spawn `lark-cli im +messages-{reply,send}` 子进程
59
+ */
60
+ private spawnLarkMessage;
61
+ }