@ai-setting/roy-agent-core 1.7.52 → 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 (334) 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 +2 -2
  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 +4 -4
  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 +1 -1
  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/lark-cli-workflow-notify-plugin.d.ts +107 -0
  263. package/dist/env/workflow/plugins/workflow-json-output-plugin.d.ts +166 -0
  264. package/dist/env/workflow/runtime/runtime-cancellation-scope.d.ts +121 -0
  265. package/dist/env/workflow/service/index.d.ts +9 -0
  266. package/dist/env/workflow/service/registry.d.ts +37 -0
  267. package/dist/env/workflow/service/workflow-service.d.ts +422 -0
  268. package/dist/env/workflow/storage/index.d.ts +11 -0
  269. package/dist/env/workflow/storage/mock-repositories.d.ts +106 -0
  270. package/dist/env/workflow/storage/safe-json.d.ts +62 -0
  271. package/dist/env/workflow/storage/sqlite.d.ts +57 -0
  272. package/dist/env/workflow/storage/tag-repo.d.ts +65 -0
  273. package/dist/env/workflow/storage/workflow-repo.d.ts +161 -0
  274. package/dist/env/workflow/tools/ask-user-tool.d.ts +35 -0
  275. package/dist/env/workflow/tools/index.d.ts +16 -0
  276. package/dist/env/workflow/tools/run-workflow.d.ts +130 -0
  277. package/dist/env/workflow/tools/submit-json-output-tool.d.ts +38 -0
  278. package/dist/env/workflow/tools/workflow-add-tool.d.ts +47 -0
  279. package/dist/env/workflow/tools/workflow-get-tool.d.ts +29 -0
  280. package/dist/env/workflow/tools/workflow-list-tool.d.ts +55 -0
  281. package/dist/env/workflow/tools/workflow-run-status-tool.d.ts +26 -0
  282. package/dist/env/workflow/tools/workflow-run-stop-tool.d.ts +29 -0
  283. package/dist/env/workflow/tools/workflow-search-tool.d.ts +33 -0
  284. package/dist/env/workflow/tools/workflow-tag-list-tool.d.ts +59 -0
  285. package/dist/env/workflow/tools/workflow-validate-tool.d.ts +60 -0
  286. package/dist/env/workflow/types/context.d.ts +17 -0
  287. package/dist/env/workflow/types/decorators-types.d.ts +182 -0
  288. package/dist/env/workflow/types/edge.d.ts +33 -0
  289. package/dist/env/workflow/types/event.d.ts +869 -0
  290. package/dist/env/workflow/types/index.d.ts +16 -0
  291. package/dist/env/workflow/types/run.d.ts +235 -0
  292. package/dist/env/workflow/types/workflow-error.d.ts +79 -0
  293. package/dist/env/workflow/types/workflow-hil.d.ts +57 -0
  294. package/dist/env/workflow/types/workflow-message.d.ts +193 -0
  295. package/dist/env/workflow/types/workflow-session.d.ts +17 -0
  296. package/dist/env/workflow/types/workflow.d.ts +654 -0
  297. package/dist/env/workflow/types_compat.d.ts +10 -0
  298. package/dist/env/workflow/utils/agent-session-metadata.d.ts +35 -0
  299. package/dist/env/workflow/utils/build-agent-node-output.d.ts +11 -0
  300. package/dist/env/workflow/utils/create-workflow.d.ts +35 -0
  301. package/dist/env/workflow/utils/dependency-prescan.d.ts +67 -0
  302. package/dist/env/workflow/utils/execution-state.d.ts +46 -0
  303. package/dist/env/workflow/utils/extract-agent-json-output.d.ts +6 -0
  304. package/dist/env/workflow/utils/index.d.ts +14 -0
  305. package/dist/env/workflow/utils/json-schema-to-zod.d.ts +23 -0
  306. package/dist/env/workflow/utils/node-id-utils.d.ts +20 -0
  307. package/dist/env/workflow/utils/node-output-contracts.d.ts +137 -0
  308. package/dist/env/workflow/utils/node-registry-helper.d.ts +36 -0
  309. package/dist/env/workflow/utils/output-schema-hint.d.ts +7 -0
  310. package/dist/env/workflow/utils/parse-agent-output-config.d.ts +9 -0
  311. package/dist/env/workflow/utils/recovery-validator.d.ts +30 -0
  312. package/dist/env/workflow/utils/sensitive-redact.d.ts +37 -0
  313. package/dist/env/workflow/utils/session-parser.d.ts +23 -0
  314. package/dist/env/workflow/utils/session-recovery.d.ts +122 -0
  315. package/dist/env/workflow/utils/template-contract-validator.d.ts +87 -0
  316. package/dist/env/workflow/utils/template-resolver.d.ts +285 -0
  317. package/dist/env/workflow/utils/validate-workflow-definition.d.ts +57 -0
  318. package/dist/env/workflow/utils/validation-rules.d.ts +103 -0
  319. package/dist/env/workflow/utils/workflow-message-metadata.d.ts +20 -0
  320. package/dist/env/workflow/utils/workflow-sanitize.d.ts +51 -0
  321. package/dist/env/workflow/workflow-component.d.ts +138 -0
  322. package/dist/index.d.ts +59 -0
  323. package/dist/index.js +5 -5
  324. package/dist/shared/@ai-setting/{roy-agent-core-rcfewbzr.js → roy-agent-core-4sx6sdb2.js} +1 -1
  325. package/dist/shared/@ai-setting/{roy-agent-core-ezgsem94.js → roy-agent-core-ph5qbqcx.js} +1 -1
  326. package/dist/util/process/process-tree-killer.d.ts +67 -0
  327. package/dist/utils/id.d.ts +11 -0
  328. package/dist/utils/loose-json.d.ts +30 -0
  329. package/dist/utils/media.d.ts +70 -0
  330. package/dist/utils/temp-file-manager/index.d.ts +99 -0
  331. package/package.json +4 -2
  332. /package/dist/shared/@ai-setting/{roy-agent-core-s214vmmd.js → roy-agent-core-4vpk40ss.js} +0 -0
  333. /package/dist/shared/@ai-setting/{roy-agent-core-pkpkctvf.js → roy-agent-core-hch2geta.js} +0 -0
  334. /package/dist/shared/@ai-setting/{roy-agent-core-0cfaqnz9.js → roy-agent-core-k25gv86p.js} +0 -0
@@ -0,0 +1,143 @@
1
+ /**
2
+ * @fileoverview Notification Channel Abstraction
3
+ *
4
+ * Plugin 通知通道抽象。Plugin 通过 `PluginEnv.notify(options)` 发送通知,
5
+ * PluginComponent 负责把通知路由到已注册的 NotificationChannel 实例。
6
+ *
7
+ * ## 默认实现
8
+ *
9
+ * `EventBusNotificationChannel` —— 默认通道,把通知转成 roy-agent 自身
10
+ * `env.pushEnvEvent` 事件,事件命名空间 `plugin.notification.<type>`,
11
+ * metadata.source 固定为 `plugin:<pluginName>`。
12
+ *
13
+ * ## Legacy 实现(@deprecated)
14
+ *
15
+ * `LarkCliNotificationChannel` —— 历史默认通道,直接通过 `lark-cli` 子进程
16
+ * 发飞书消息。保留为可选/opt-in;标记为 @deprecated,新代码请用
17
+ * `EventBusNotificationChannel`,配合 env-level event subscriber 自定义
18
+ * 飞书投递逻辑。
19
+ *
20
+ * ## 自定义通道
21
+ *
22
+ * 实现 `NotificationChannel` 接口,并通过 `PluginComponent.setNotificationChannels()`
23
+ * 注入。PluginComponent 按 channels 数组顺序选第一个 `canRoute() === true` 的通道。
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * // 1. 自定义通道(IM-implementable)
28
+ * class WebhookChannel implements NotificationChannel {
29
+ * readonly name = "webhook";
30
+ * canRoute(opts, extras, ctx) { return !!ctx.replyChannel?.params?.webhookUrl; }
31
+ * async send(opts, extras, ctx) { await fetch(...); }
32
+ * }
33
+ *
34
+ * // 2. 注册到 PluginComponent
35
+ * component.setNotificationChannels([
36
+ * new WebhookChannel(),
37
+ * EventBusNotificationChannel(), // 兜底
38
+ * ]);
39
+ * ```
40
+ */
41
+ /**
42
+ * EnvContext 简化视图(通道只用 replyChannel,传入最小必需字段即可)。
43
+ *
44
+ * 通过 `getEnvContextOrEmpty()` 获取当前 ALS 中的 EnvContext。
45
+ */
46
+ export interface EnvContextLike {
47
+ /** Reply channel(IM 通道路由信息) */
48
+ replyChannel?: {
49
+ /** 渠道类型,如 lark-cli, bounty-im */
50
+ type?: string;
51
+ /** app ID */
52
+ appId?: string;
53
+ /** chat ID */
54
+ chatId?: string;
55
+ /** message ID(用于 reply) */
56
+ messageId?: string;
57
+ /** raw command(IM 场景下的原始指令) */
58
+ rawCommand?: string;
59
+ /**
60
+ * lark-cli profile(多 appId 场景下指定用哪个 lark-cli profile 发消息)
61
+ *
62
+ * 当 replyChannel.type 含 'lark' 时,LarkCliNotificationChannel 会读取此字段
63
+ * 决定是否在 args 头部插入 `--profile <name>` flag。
64
+ */
65
+ profile?: string;
66
+ /** 其他参数(由 EventSource 注入) */
67
+ params?: Record<string, unknown>;
68
+ };
69
+ }
70
+ /**
71
+ * Plugin 调用 `env.notify(options)` 时传入的选项。
72
+ *
73
+ * 设计原则:
74
+ * - `type` 是必填的"通知类型",EventBus 通道会把它转换成
75
+ * `plugin.notification.<type>` 事件
76
+ * - `title` / `content` 是人类可读的展示文本(IM 通知渲染用)
77
+ * - `metadata` 是结构化扩展字段(透传到 event.metadata 中)
78
+ */
79
+ export interface NotificationOptions {
80
+ /**
81
+ * 通知类型(必填)
82
+ *
83
+ * 推荐使用下划线分隔的 snake_case,例如:
84
+ * - "visualization_ready"
85
+ * - "task_completed"
86
+ * - "report_uploaded"
87
+ */
88
+ type: string;
89
+ /** 通知标题 */
90
+ title: string;
91
+ /** 通知内容(人类可读文本,可包含 markdown) */
92
+ content: string;
93
+ /** 额外元数据(透传到 event.metadata) */
94
+ metadata?: Record<string, unknown>;
95
+ }
96
+ /**
97
+ * PluginComponent 调用 `channel.send(options, extras, envContext)` 时附带的额外信息。
98
+ *
99
+ * PluginChannel 不需要知道是哪个 Plugin 在调用 — extras 提供必要的绑定信息。
100
+ */
101
+ export interface NotificationSendExtras {
102
+ /** Plugin 名称(用于 metadata.source = `plugin:<pluginName>`) */
103
+ pluginName: string;
104
+ /**
105
+ * Environment 实例(用于 EventBusNotificationChannel 调用 pushEnvEvent)
106
+ *
107
+ * 在单测场景或某些 PluginContext 下可能为 undefined;EventBusNotificationChannel
108
+ * 应当 silent skip 而不是抛错。
109
+ */
110
+ envInstance?: {
111
+ pushEnvEvent(event: unknown): void;
112
+ [key: string]: unknown;
113
+ };
114
+ }
115
+ /**
116
+ * Notification Channel - Plugin 通知通道抽象
117
+ *
118
+ * PluginComponent 按 channels 数组顺序选第一个 `canRoute() === true` 的通道。
119
+ * 如果所有通道都返回 false,则通知被丢弃(log warn)。
120
+ */
121
+ export interface NotificationChannel {
122
+ /** 通道名称(log / debug 用) */
123
+ readonly name: string;
124
+ /**
125
+ * 当前 channel 是否能处理这条通知
126
+ *
127
+ * @param options 通知选项
128
+ * @param extras PluginComponent 注入的上下文
129
+ * @param envContext 当前 ALS 中的 EnvContext(可能为空)
130
+ */
131
+ canRoute(options: NotificationOptions, extras: NotificationSendExtras, envContext: EnvContextLike): boolean;
132
+ /**
133
+ * 发送通知
134
+ *
135
+ * - 实现方负责 swallow 内部异常,避免污染 Plugin 主流程
136
+ * - 应当支持并发调用(不同 Plugin 异步触发)
137
+ *
138
+ * @param options 通知选项
139
+ * @param extras PluginComponent 注入的上下文
140
+ * @param envContext 当前 ALS 中的 EnvContext(可能为空)
141
+ */
142
+ send(options: NotificationOptions, extras: NotificationSendExtras, envContext: EnvContextLike): Promise<void>;
143
+ }
@@ -0,0 +1,232 @@
1
+ /**
2
+ * @fileoverview PluginComponent - 统一插件管理组件
3
+ *
4
+ * 提供统一的插件注册、注销、查询接口
5
+ */
6
+ import { BaseComponent, type ComponentConfig } from "../component";
7
+ import { BasePlugin } from "./types";
8
+ import type { ConfigComponent } from "../../config/config-component";
9
+ import type { NotificationChannel } from "./notification-channel";
10
+ /**
11
+ * 从 resolvedPath(指向 plugin 入口文件)向上查找最近的 package.json 并读取 version。
12
+ *
13
+ * **Task #2903 修复说明(version drift)**:
14
+ * 实际加载的 plugin 代码可能与 plugins.json 声明的 version 不一致 —
15
+ * 例如 `~/.roy-agent/node_modules/@scope/pkg/index.js` 是旧版 cp 副本
16
+ * (v2.5.7),但 plugins.json 记的是新版本(v2.5.9)。这个 helper 通过
17
+ * 入口路径找到最近的 package.json,读出真实 version,给上层做对比。
18
+ *
19
+ * 算法:从 resolvedPath 所在目录开始,向上走 dir.parent 直到文件系统根,
20
+ * 命中第一个 package.json 即返回。
21
+ *
22
+ * 找不到 / 解析失败 → 返回 null(不抛异常)。
23
+ *
24
+ * 导出供测试调用。
25
+ */
26
+ export declare function readActualVersion(resolvedPath: string): string | null;
27
+ /**
28
+ * 对比 declared version vs loaded version,不一致时 warn。
29
+ *
30
+ * **Task #2903 修复说明(startup warn)**:
31
+ * PluginComponent 启动时遍历 plugins.json,对每个插件做一次 version drift 校验。
32
+ * 如果 loaded version 找不到(resolvedPath 无效),返回 { drifted: false } —
33
+ * 这种情况下 import 都成功了,version 字段缺失是 plugin 自己的问题,不归我们管。
34
+ *
35
+ * 返回结构:
36
+ * { declared, actual, resolvedPath, drifted }
37
+ *
38
+ * - declared: plugins.json 声明的 version
39
+ * - actual: 磁盘上 plugin 入口的 package.json 实际 version(找不到 = null)
40
+ * - resolvedPath: 传入的入口路径(透传,方便用户诊断)
41
+ * - drifted: actual != null && actual !== declared
42
+ *
43
+ * 如果 logger 提供且 drifted=true,会调 logger.warn 输出一行 warning。
44
+ * warning 包含 packageName(推断自 resolvedPath 末段)、declared、actual、resolvedPath。
45
+ *
46
+ * 导出供测试调用。
47
+ */
48
+ export interface VersionDriftLogger {
49
+ warn: (msg: string) => void;
50
+ }
51
+ export declare function checkVersionDrift(declaredVersion: string, resolvedPath: string, logger?: VersionDriftLogger): {
52
+ declared: string;
53
+ actual: string | null;
54
+ resolvedPath: string;
55
+ drifted: boolean;
56
+ };
57
+ /**
58
+ * PluginComponent 配置选项
59
+ */
60
+ export interface PluginComponentOptions {
61
+ /** ConfigComponent 实例(必填) */
62
+ configComponent: ConfigComponent;
63
+ /** 配置文件相对路径(可选) */
64
+ configPath?: string;
65
+ /** 环境变量前缀(可选,默认 "PLUGIN")*/
66
+ envPrefix?: string;
67
+ }
68
+ /**
69
+ * PluginComponent - 统一插件管理组件
70
+ *
71
+ * 功能:
72
+ * - 管理所有插件的注册和生命周期
73
+ * - 提供统一的 PluginEnv 给每个插件
74
+ * - 通过 --plugin 参数加载的插件都注册到此组件
75
+ */
76
+ export declare class PluginComponent extends BaseComponent {
77
+ name: string;
78
+ version: string;
79
+ /** 插件注册表 */
80
+ private registry;
81
+ /** 组件引用缓存 */
82
+ private componentCache;
83
+ /** 日志器 */
84
+ private logger;
85
+ /** ConfigComponent 引用 */
86
+ private configComponent?;
87
+ /**
88
+ * NotificationChannel 列表(按顺序遍历,第一个 canRoute=true 的被选中)
89
+ *
90
+ * 默认 = [EventBusNotificationChannel()]
91
+ *
92
+ * LarkCliNotificationChannel(legacy)不在默认列表中 —— 它是 opt-in,
93
+ * 需要通过 setNotificationChannels() 显式注册。
94
+ */
95
+ private notificationChannels;
96
+ constructor();
97
+ /**
98
+ * Initialize the component
99
+ */
100
+ init(config?: ComponentConfig): Promise<void>;
101
+ /**
102
+ * 从 ~/.roy-agent/plugins.json 读取并加载已安装的插件
103
+ *
104
+ * 对每个插件:
105
+ * 1. 通过 import(packageName) 动态导入插件模块
106
+ * 2. 调用 register() 注册
107
+ */
108
+ private loadInstalledPlugins;
109
+ /**
110
+ * 从已安装的 npm 包加载插件
111
+ *
112
+ * 通过 import(packageName) 动态导入插件模块
113
+ * 插件模块应导出实现了 BasePlugin 接口的实例
114
+ *
115
+ * 支持多种导出方式:
116
+ * - default export: 插件实例 / 类
117
+ * - named export 'plugin': 插件实例 / 类
118
+ *
119
+ * 类型检查:优先 instanceof BasePlugin(内部插件),fallback 到 duck-type(外部插件)
120
+ * duck-type 要求:name (string) + init (function) + 可选 dispose (function)
121
+ *
122
+ * **Task #2903 修复说明(version drift warn)**:
123
+ * 加载成功后,如果传入 declaredVersion,对比实际加载的 plugin 入口的
124
+ * package.json version,不一致就 warn(带 resolvedPath 帮助用户诊断)。
125
+ *
126
+ * **Task #2908 修复说明(npm global root fallback)**:
127
+ * import(packageName) 默认不解析 npm global root(不在 Node 模块解析路径
128
+ * 中),所以 `roy-agent install --global <pkg>` 后 `roy-agent run` 永远
129
+ * 找不到 plugin。修复:在 PRIMARY import() 失败后的 fallback chain 头部
130
+ * 插入 npm global root 查询(`npm root -g`)。
131
+ *
132
+ * 完整加载顺序(new):
133
+ * PRIMARY: import(packageName) (Node default resolution)
134
+ * 失败 → fallback chain:
135
+ * 1. <npm global root>/<packageName>/ ← NEW (Task #2899 authoritative)
136
+ * 2. ./.roy/plugins/<packageName>/ (project local)
137
+ * 3. ~/.roy-agent/node_modules/<pkg>/ (cp copy — deprecated but kept for back-compat)
138
+ */
139
+ private loadPluginFromPackage;
140
+ /**
141
+ * 注册插件
142
+ *
143
+ * 创建 PluginEnv 并调用 plugin.init()
144
+ *
145
+ * @param plugin - 要注册的插件实例
146
+ * @throws 如果插件名称已存在
147
+ */
148
+ register(plugin: BasePlugin): Promise<void>;
149
+ /**
150
+ * 注销插件
151
+ *
152
+ * 调用 plugin.dispose() 并从注册表移除
153
+ *
154
+ * @param name - 插件名称
155
+ * @returns 是否成功注销
156
+ */
157
+ unregister(name: string): boolean;
158
+ /**
159
+ * 获取插件
160
+ *
161
+ * @param name - 插件名称
162
+ * @returns 插件实例,如果不存在则返回 undefined
163
+ */
164
+ get(name: string): BasePlugin | undefined;
165
+ /**
166
+ * 获取所有插件
167
+ *
168
+ * @returns 插件数组
169
+ */
170
+ list(): BasePlugin[];
171
+ /**
172
+ * 检查插件是否已注册
173
+ *
174
+ * @param name - 插件名称
175
+ */
176
+ has(name: string): boolean;
177
+ /**
178
+ * 获取插件配置
179
+ *
180
+ * Overload 1: 无参 → 返回组件自身配置(继承自 BaseComponent.getConfig)
181
+ * Overload 2: 带 name → 返回指定插件配置
182
+ *
183
+ * @param name - 插件名称
184
+ * @returns 插件配置,如果不存在则返回 undefined
185
+ */
186
+ getConfig(): ComponentConfig;
187
+ getConfig(name: string): any;
188
+ /**
189
+ * 批量注册插件
190
+ *
191
+ * @param plugins - 插件数组
192
+ */
193
+ registerAll(plugins: BasePlugin[]): Promise<void>;
194
+ /**
195
+ * 设置 NotificationChannel 列表
196
+ *
197
+ * PluginComponent 按数组顺序选第一个 canRoute=true 的通道处理 notify 调用。
198
+ *
199
+ * 传空数组 → 禁用所有通知通道(notify 会成为 noop)。
200
+ *
201
+ * @example
202
+ * ```ts
203
+ * // 完全替换默认
204
+ * component.setNotificationChannels([
205
+ * new EventBusNotificationChannel(),
206
+ * new LarkCliNotificationChannel(), // opt-in legacy
207
+ * ]);
208
+ * ```
209
+ */
210
+ setNotificationChannels(channels: NotificationChannel[]): void;
211
+ /**
212
+ * 获取当前 NotificationChannel 名称列表
213
+ */
214
+ getNotificationChannelNames(): string[];
215
+ /**
216
+ * 把 notify 调用路由到第一个 canRoute=true 的 channel
217
+ *
218
+ * - channel 异常被 swallow(不污染 Plugin 主流程)
219
+ * - 所有 channel 都不路由 → log warn(不影响 notify 调用方)
220
+ */
221
+ private routeNotification;
222
+ /**
223
+ * 停止组件
224
+ *
225
+ * 调用所有已注册插件的 dispose() 方法
226
+ */
227
+ stop(): Promise<void>;
228
+ /**
229
+ * 创建 PluginEnv
230
+ */
231
+ private createPluginEnv;
232
+ }
@@ -0,0 +1,146 @@
1
+ /**
2
+ * @fileoverview Unified Plugin System Types
3
+ *
4
+ * 统一插件接口定义
5
+ */
6
+ import type { HookContext, HookResult } from "../hook/types";
7
+ import type { ILogger as Logger } from "../log-trace/logger";
8
+ import type { NotificationOptions } from "./notification-channel";
9
+ /**
10
+ * Hook 处理函数
11
+ */
12
+ export type HookHandler = (ctx: HookContext) => void | Promise<void> | HookResult | Promise<HookResult>;
13
+ /**
14
+ * Hook 定义
15
+ */
16
+ export interface HookDefinition {
17
+ /** Hook 点名称 */
18
+ point: string;
19
+ /** 优先级(数字越大越先执行,默认 0)*/
20
+ priority?: number;
21
+ /** 处理函数 */
22
+ handler: HookHandler;
23
+ }
24
+ /**
25
+ * Plugin 环境接口
26
+ *
27
+ * 注入到每个 Plugin 的统一环境
28
+ */
29
+ export interface PluginEnv {
30
+ /** 获取组件 */
31
+ getComponent<T>(name: string): T | undefined;
32
+ /** 注册 Agent */
33
+ registerAgent(config: AgentInstanceConfig): void;
34
+ /** 注册 Tool */
35
+ registerTool(tool: ToolDefinition): void;
36
+ /** 注册 Hook */
37
+ registerHook(hook: HookDefinition): void;
38
+ /**
39
+ * 发送通知
40
+ *
41
+ * Plugin 调用此方法发出"通知",由 PluginComponent 路由到已注册的
42
+ * NotificationChannel(默认 EventBusNotificationChannel)。
43
+ *
44
+ * 注意:
45
+ * - 此方法不抛错(channel.send 异常会被 swallow)
46
+ * - 如果没有任何 channel 能路由(canRoute 全 false),通知被丢弃
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * await env.notify({
51
+ * type: "visualization_ready",
52
+ * title: "Viz Ready",
53
+ * content: "Chart rendered",
54
+ * metadata: { taskId: 42 },
55
+ * });
56
+ * ```
57
+ */
58
+ notify(options: NotificationOptions): Promise<void>;
59
+ /** 日志器 */
60
+ logger: Logger;
61
+ }
62
+ /**
63
+ * Agent 实例配置(Plugin 注册时需要)
64
+ */
65
+ export interface AgentInstanceConfig {
66
+ name: string;
67
+ description?: string;
68
+ systemPrompt?: string;
69
+ tools?: string[];
70
+ model?: string;
71
+ maxIterations?: number;
72
+ }
73
+ /**
74
+ * Tool 定义(Plugin 注册时需要)
75
+ */
76
+ export interface ToolDefinition {
77
+ name: string;
78
+ description?: string;
79
+ parameters?: any;
80
+ handler: (...args: any[]) => any;
81
+ }
82
+ /**
83
+ * Plugin 基类
84
+ *
85
+ * 所有插件都必须继承此类或实现相同接口
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * class MyPlugin extends BasePlugin {
90
+ * readonly name = "my-plugin";
91
+ * readonly version = "1.0.0";
92
+ *
93
+ * constructor(config?: MyConfig) {
94
+ * super();
95
+ * this.config = config;
96
+ * }
97
+ *
98
+ * init(env: PluginEnv): void {
99
+ * env.registerHook({
100
+ * point: "agent:before.llm",
101
+ * handler: this.onBeforeLLM.bind(this),
102
+ * });
103
+ * }
104
+ *
105
+ * private async onBeforeLLM(ctx: HookContext): Promise<void> {
106
+ * // ...
107
+ * }
108
+ * }
109
+ * ```
110
+ */
111
+ export declare abstract class BasePlugin {
112
+ /** 插件唯一名称 */
113
+ abstract readonly name: string;
114
+ /** 插件版本 */
115
+ readonly version: string;
116
+ /** 插件描述 */
117
+ readonly description?: string;
118
+ /** 插件优先级(数字越大优先级越高,默认 0)*/
119
+ readonly priority: number;
120
+ /**
121
+ * 构造函数
122
+ *
123
+ * 子类可覆盖以接收配置参数
124
+ */
125
+ constructor();
126
+ /**
127
+ * 初始化
128
+ *
129
+ * 在插件注册到 PluginComponent 时调用
130
+ * - 获取依赖组件
131
+ * - 注册 Hooks
132
+ * - 注册 Agents/Tools
133
+ *
134
+ * @param env - Plugin 环境
135
+ */
136
+ init(env: PluginEnv): void | Promise<void>;
137
+ /**
138
+ * 销毁
139
+ *
140
+ * 在插件注销时调用
141
+ * - 清理资源
142
+ * - 关闭连接
143
+ */
144
+ dispose(): void | Promise<void>;
145
+ }
146
+ export type { HookContext, HookResult } from "../hook/types";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @fileoverview PromptComponent 导出
3
+ */
4
+ export { PromptComponent, type PromptComponentOptions } from "./prompt-component";
5
+ export { PromptRenderer } from "./renderer";
6
+ export type { PromptConfig, PromptPath, PromptEntry, PromptSource, PromptHook, RenderHookContext, PromptHookMap, } from "./types";
7
+ export { PromptConfigSchema, PromptPathSchema } from "./types";