@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,705 @@
1
+ /**
2
+ * @fileoverview Session Component Types
3
+ */
4
+ import { z } from "zod";
5
+ /**
6
+ * Session Component configuration schema
7
+ */
8
+ export declare const SessionConfigSchema: z.ZodEffects<z.ZodObject<{
9
+ /** Default working directory */
10
+ defaultDirectory: z.ZodDefault<z.ZodString>;
11
+ /** Default title template */
12
+ defaultTitleTemplate: z.ZodDefault<z.ZodString>;
13
+ /** Maximum number of messages per session */
14
+ maxMessages: z.ZodDefault<z.ZodNumber>;
15
+ /** Context compaction threshold (percentage) */
16
+ compactionThreshold: z.ZodDefault<z.ZodNumber>;
17
+ /** Enable auto compaction */
18
+ autoCompact: z.ZodDefault<z.ZodBoolean>;
19
+ /** Storage configuration */
20
+ storage: z.ZodDefault<z.ZodObject<{
21
+ type: z.ZodDefault<z.ZodEnum<["memory", "sqlite"]>>;
22
+ dbPath: z.ZodOptional<z.ZodString>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ type: "memory" | "sqlite";
25
+ dbPath?: string | undefined;
26
+ }, {
27
+ type?: "memory" | "sqlite" | undefined;
28
+ dbPath?: string | undefined;
29
+ }>>;
30
+ }, "strip", z.ZodTypeAny, {
31
+ compactionThreshold: number;
32
+ storage: {
33
+ type: "memory" | "sqlite";
34
+ dbPath?: string | undefined;
35
+ };
36
+ defaultDirectory: string;
37
+ defaultTitleTemplate: string;
38
+ maxMessages: number;
39
+ autoCompact: boolean;
40
+ }, {
41
+ compactionThreshold?: number | undefined;
42
+ storage?: {
43
+ type?: "memory" | "sqlite" | undefined;
44
+ dbPath?: string | undefined;
45
+ } | undefined;
46
+ defaultDirectory?: string | undefined;
47
+ defaultTitleTemplate?: string | undefined;
48
+ maxMessages?: number | undefined;
49
+ autoCompact?: boolean | undefined;
50
+ }>, {
51
+ defaultDirectory: string;
52
+ compactionThreshold: number;
53
+ storage: {
54
+ type: "memory" | "sqlite";
55
+ dbPath?: string | undefined;
56
+ };
57
+ defaultTitleTemplate: string;
58
+ maxMessages: number;
59
+ autoCompact: boolean;
60
+ }, {
61
+ compactionThreshold?: number | undefined;
62
+ storage?: {
63
+ type?: "memory" | "sqlite" | undefined;
64
+ dbPath?: string | undefined;
65
+ } | undefined;
66
+ defaultDirectory?: string | undefined;
67
+ defaultTitleTemplate?: string | undefined;
68
+ maxMessages?: number | undefined;
69
+ autoCompact?: boolean | undefined;
70
+ }>;
71
+ export type SessionConfig = z.infer<typeof SessionConfigSchema>;
72
+ /**
73
+ * Checkpoint type
74
+ */
75
+ export type CheckpointType = "compact" | "manual";
76
+ /**
77
+ * Checkpoint metadata (stored in Session.metadata)
78
+ */
79
+ export interface CheckpointMeta {
80
+ id: string;
81
+ messageIndex: number;
82
+ title: string;
83
+ createdAt: number;
84
+ type: CheckpointType;
85
+ }
86
+ /**
87
+ * User Intent type - represents a user's intent extracted from conversation
88
+ */
89
+ export type UserIntent = string;
90
+ /**
91
+ * Recent message for checkpoint
92
+ *
93
+ * Stores a simplified version of a message for context preservation
94
+ */
95
+ export interface RecentMessage {
96
+ role: string;
97
+ content: string;
98
+ }
99
+ /**
100
+ * Complete checkpoint information (includes generated content)
101
+ */
102
+ export interface SessionCheckpoint extends CheckpointMeta {
103
+ summary: string;
104
+ processKeyPoints: string[];
105
+ currentState: string;
106
+ nextSteps: string[];
107
+ messageCountBefore: number;
108
+ metadata?: Record<string, unknown>;
109
+ /** User intents extracted from the conversation */
110
+ userIntents: UserIntent[];
111
+ /**
112
+ * Recent messages preserved from the compacted conversation
113
+ *
114
+ * Contains the last N turns of user query + assistant text response
115
+ * (excluding tool calls and tool results).
116
+ * This allows the checkpoint to serve as a fresh history context.
117
+ *
118
+ * Format: [user, assistant, user, assistant, ...] from most recent
119
+ */
120
+ recentMessages?: RecentMessage[];
121
+ }
122
+ /**
123
+ * Checkpoints metadata in session
124
+ */
125
+ export interface SessionCheckpointsMeta {
126
+ latestCheckpointId?: string;
127
+ checkpoints: CheckpointMeta[];
128
+ }
129
+ /**
130
+ * Checkpoint message metadata (stored in message metadata)
131
+ */
132
+ export interface CheckpointMessageMeta {
133
+ isCheckpoint: boolean;
134
+ checkpointId: string;
135
+ checkpointMeta: SessionCheckpoint;
136
+ }
137
+ /**
138
+ * Session entity
139
+ */
140
+ export interface Session {
141
+ id: string;
142
+ title: string;
143
+ directory: string;
144
+ /**
145
+ * Top-level parent session id (Task #1739).
146
+ *
147
+ * - `null` when this session has no parent, or when the underlying storage
148
+ * row pre-dates the field (no backward migration is performed).
149
+ * - Persisted in SQLite via the existing `parent_id` column to avoid a
150
+ * schema migration; the column is shared with the legacy `parentID`.
151
+ *
152
+ * New code should prefer this field. `parentID` is kept as a deprecated
153
+ * alias that always mirrors `parentSessionId`.
154
+ */
155
+ parentSessionId: string | null;
156
+ /**
157
+ * @deprecated Kept for backward compatibility. Mirrors `parentSessionId`.
158
+ * New code should set/read `parentSessionId` instead.
159
+ */
160
+ parentID?: string;
161
+ createdAt: number;
162
+ updatedAt: number;
163
+ messageCount: number;
164
+ metadata?: SessionMetadata;
165
+ }
166
+ /**
167
+ * Session metadata
168
+ */
169
+ export interface SessionMetadata extends Record<string, unknown> {
170
+ /** Total number of messages in the session */
171
+ messageCount?: number;
172
+ checkpoints?: SessionCheckpointsMeta;
173
+ checkpointDetails?: Record<string, SessionCheckpoint>;
174
+ larkChat?: ChatTaskBinding;
175
+ }
176
+ /**
177
+ * 飞书群聊 → task 绑定关系
178
+ *
179
+ * 存储位置:session.metadata.larkChat(session id = chat_id)
180
+ *
181
+ * 关键约束:
182
+ * - chatId 是 session 主键(PRIMARY KEY),天然唯一
183
+ * - taskId 与 chatId 是 1:1(每个 task 群对应唯一一个 task)
184
+ * - rebindCount > 0 时表示曾尝试绑定到不同 task(保留旧 taskId 防误覆盖)
185
+ */
186
+ export interface ChatTaskBinding {
187
+ /** 飞书群聊 ID(与 session.id 相同,冗余便于诊断) */
188
+ chatId: string;
189
+ /** 绑定的 task ID */
190
+ taskId: number;
191
+ /** 创建群聊时使用的 lark-cli profile */
192
+ profile?: string;
193
+ /** 绑定时间(ISO 8601) */
194
+ boundAt: string;
195
+ /** 绑定状态:creating→ready 成功,failed 标记失败可重试 */
196
+ status: "creating" | "ready" | "failed";
197
+ /** 失败时的错误信息(成功时为 null) */
198
+ errorMessage?: string | null;
199
+ /** 不同 taskId 重绑次数(>0 时表示检测到冲突) */
200
+ rebindCount: number;
201
+ }
202
+ /**
203
+ * upsertChatTaskBinding 入参
204
+ */
205
+ export interface UpsertChatTaskBindingOptions {
206
+ /** 飞书群聊 ID(必填) */
207
+ chatId: string;
208
+ /** 绑定的 task ID(必填,必须为正整数) */
209
+ taskId: number;
210
+ /** lark-cli profile(可选) */
211
+ profile?: string;
212
+ /** 绑定状态,默认 "ready" */
213
+ status?: "creating" | "ready" | "failed";
214
+ /** 失败时的错误信息 */
215
+ errorMessage?: string | null;
216
+ }
217
+ /**
218
+ * Agent Sub-session reference
219
+ */
220
+ export interface AgentSessionRef {
221
+ nodeId: string;
222
+ sessionId: string;
223
+ status: 'active' | 'paused' | 'completed';
224
+ }
225
+ /**
226
+ * Workflow Session metadata
227
+ * Extends SessionMetadata with workflow-specific fields
228
+ */
229
+ export interface WorkflowSessionMetadata extends SessionMetadata {
230
+ type: 'workflow';
231
+ workflowId?: string;
232
+ workflowName: string;
233
+ workflowVersion?: string;
234
+ status: 'running' | 'paused' | 'completed' | 'failed';
235
+ input?: unknown;
236
+ rootNodeId?: string;
237
+ agentSessions?: AgentSessionRef[];
238
+ }
239
+ /**
240
+ * Session message
241
+ */
242
+ export interface SessionMessage {
243
+ id: string;
244
+ sessionID: string;
245
+ role: Role;
246
+ content: string;
247
+ timestamp: number;
248
+ parts?: MessagePart[];
249
+ /** Whether the message has been archived (compacted) */
250
+ isArchived?: boolean;
251
+ /** Timestamp when the message was archived */
252
+ archivedAt?: number;
253
+ /** Checkpoint ID this message belongs to */
254
+ checkpointId?: string;
255
+ /** Message metadata (includes checkpoint info if this is a checkpoint message) */
256
+ metadata?: MessageMetadata;
257
+ }
258
+ /**
259
+ * Message metadata
260
+ */
261
+ export interface MessageMetadata extends Record<string, unknown> {
262
+ /** 消息类型标识,用于过滤和分类 */
263
+ type?: "tool_call" | "tool_result" | "checkpoint" | "user_intent" | "workflow.node.start" | "workflow.node.interrupt" | "workflow.node.end" | "workflow.node.resume";
264
+ isCheckpoint?: boolean;
265
+ checkpointId?: string;
266
+ checkpointMeta?: SessionCheckpoint;
267
+ /** Workflow node ID (for workflow.node.* messages) */
268
+ workflowNodeId?: string;
269
+ /** Workflow node type (for workflow.node.* messages) */
270
+ workflowNodeType?: string;
271
+ /** Agent session ID (for agent nodes in workflow) */
272
+ agentSessionId?: string;
273
+ /** User response (for workflow.node.resume messages) */
274
+ response?: string;
275
+ /** Success flag (for workflow.node.end messages) */
276
+ success?: boolean;
277
+ }
278
+ /**
279
+ * Message role
280
+ */
281
+ export type Role = "user" | "assistant" | "system" | "tool" | "workflow.node.start" | "workflow.node.interrupt" | "workflow.node.end" | "workflow.node.resume";
282
+ /**
283
+ * Message part
284
+ */
285
+ export type MessagePart = SessionPart;
286
+ /**
287
+ * Text part - plain text content
288
+ */
289
+ export interface TextPart {
290
+ type: "text";
291
+ content: string;
292
+ /** If true, this part was generated by the system (e.g., auto-summary) */
293
+ synthetic?: boolean;
294
+ /** If true, this part should be ignored (e.g., replaced by reasoning) */
295
+ ignored?: boolean;
296
+ }
297
+ /**
298
+ * Tool call part - represents a tool invocation
299
+ */
300
+ export interface ToolCallPart {
301
+ type: "tool-call";
302
+ /** AI SDK standard field name */
303
+ toolCallId: string;
304
+ toolName: string;
305
+ /** Tool arguments - can be string (JSON) or object */
306
+ arguments: string | Record<string, unknown>;
307
+ state: "pending" | "running";
308
+ }
309
+ /**
310
+ * Tool result part - represents the result of a tool execution
311
+ */
312
+ export interface ToolResultPart {
313
+ type: "tool-result";
314
+ toolCallId: string;
315
+ toolName: string;
316
+ output: string;
317
+ error?: string;
318
+ state: "completed" | "error";
319
+ }
320
+ /**
321
+ * Reasoning part - AI thinking/thought content
322
+ */
323
+ export interface ReasoningPart {
324
+ type: "reasoning";
325
+ /** Reasoning content */
326
+ content: string;
327
+ /** Reasoning type (for different models) */
328
+ reasoningType?: "core" | "effort" | "summary";
329
+ /** State */
330
+ state?: "thinking" | "completed";
331
+ /** Whether to collapse by default (like AI SDK default) */
332
+ isCollapsed?: boolean;
333
+ /** Metadata */
334
+ metadata?: {
335
+ tokenCount?: number;
336
+ time?: {
337
+ start: number;
338
+ end?: number;
339
+ };
340
+ };
341
+ }
342
+ /**
343
+ * File part - file attachment
344
+ */
345
+ export interface FilePart {
346
+ type: "file";
347
+ mime: string;
348
+ url: string;
349
+ filename?: string;
350
+ }
351
+ /**
352
+ * Image part - multimodal image attachment
353
+ *
354
+ * Used in user messages for vision-capable LLM calls. Field shape mirrors
355
+ * the AI SDK v6 `ImagePart` ({ type: 'image', image: DataContent | URL })
356
+ * so that round-trip through `toModelMessage` / `fromModelMessage` is
357
+ * lossless. Stores the image data as a `data:` URL string, a remote URL
358
+ * string, or a `URL` object instance.
359
+ *
360
+ * @see packages/core/src/env/llm/invoke.ts convertToSDKMessages
361
+ * for how LLMMessage.image parts map to the AI SDK ImagePart shape.
362
+ */
363
+ export interface ImagePart {
364
+ type: "image";
365
+ /** Image data (data: URL / base64 / remote URL / URL object) */
366
+ image: string | URL;
367
+ /** Optional MIME type (e.g. "image/png") — best-effort metadata */
368
+ mimeType?: string;
369
+ }
370
+ /**
371
+ * Checkpoint part - compaction checkpoint marker
372
+ *
373
+ * Represents a checkpoint message in the conversation history.
374
+ * This is stored as a user role message with markdown content summarizing
375
+ * the compacted conversation segment.
376
+ */
377
+ export interface CheckpointPart {
378
+ type: "checkpoint";
379
+ /** Checkpoint ID reference */
380
+ checkpointId: string;
381
+ /** Markdown content summarizing the checkpoint */
382
+ content: string;
383
+ /** Title of the checkpoint */
384
+ title?: string;
385
+ /** Process key points */
386
+ processKeyPoints?: string[];
387
+ /** Current state description */
388
+ currentState?: string;
389
+ /** Next steps */
390
+ nextSteps?: string[];
391
+ /** Number of messages that were compacted */
392
+ messageCountBefore?: number;
393
+ /** Creation timestamp */
394
+ createdAt?: number;
395
+ }
396
+ /**
397
+ * Union type for all Session Part types
398
+ */
399
+ export type SessionPart = TextPart | ToolCallPart | ToolResultPart | ReasoningPart | FilePart | ImagePart | CheckpointPart | WorkflowNodeStartPart | WorkflowNodeInterruptPart | WorkflowNodeEndPart | WorkflowNodeResumePart;
400
+ /**
401
+ * workflow.node.start 消息 part (对应 tool-call)
402
+ */
403
+ export interface WorkflowNodeStartPart {
404
+ type: 'workflow-node-start';
405
+ nodeId: string;
406
+ nodeType: string;
407
+ input?: unknown;
408
+ startTime: number;
409
+ /** Agent session ID (only for agent nodes) */
410
+ agentSessionId?: string;
411
+ }
412
+ /**
413
+ * workflow.node.interrupt 消息 part
414
+ */
415
+ export interface WorkflowNodeInterruptPart {
416
+ type: 'workflow-node-interrupt';
417
+ nodeId: string;
418
+ nodeType: string;
419
+ query: string;
420
+ options?: string[];
421
+ timestamp: number;
422
+ /** Agent session ID (only for agent nodes) */
423
+ agentSessionId?: string;
424
+ }
425
+ /**
426
+ * workflow.node.end 消息 part (对应 tool-result)
427
+ */
428
+ export interface WorkflowNodeEndPart {
429
+ type: 'workflow-node-end';
430
+ nodeId: string;
431
+ nodeType: string;
432
+ output?: unknown;
433
+ error?: string;
434
+ durationMs: number;
435
+ /** Agent session ID (only for agent nodes) */
436
+ agentSessionId?: string;
437
+ }
438
+ /**
439
+ * workflow.node.resume 消息 part
440
+ */
441
+ export interface WorkflowNodeResumePart {
442
+ type: 'workflow-node-resume';
443
+ nodeId: string;
444
+ response: string;
445
+ timestamp: number;
446
+ /** Agent session ID (only for agent nodes) */
447
+ agentSessionId?: string;
448
+ }
449
+ /**
450
+ * Context usage statistics
451
+ */
452
+ export interface ContextUsage {
453
+ inputTokens: number;
454
+ outputTokens: number;
455
+ totalTokens: number;
456
+ contextWindow?: number;
457
+ usagePercent?: number;
458
+ requestCount: number;
459
+ lastUpdated: number;
460
+ }
461
+ /**
462
+ * Options for creating a session
463
+ */
464
+ export interface CreateSessionOptions {
465
+ /** Custom session ID (optional, will be generated if not provided) */
466
+ id?: string;
467
+ title?: string;
468
+ directory?: string;
469
+ /**
470
+ * @deprecated Use `parentSessionId` instead. Retained as alias for
471
+ * backward compatibility — passing `parentID` is equivalent to
472
+ * passing `parentSessionId` and the same value will be set on both
473
+ * fields of the resulting Session.
474
+ */
475
+ parentID?: string;
476
+ /**
477
+ * ID of the parent session whose execution spawned this one.
478
+ * Mirrored to the legacy `parentID` field on the resulting Session.
479
+ */
480
+ parentSessionId?: string | null;
481
+ metadata?: Record<string, unknown>;
482
+ hooks?: SessionHooksConfig;
483
+ }
484
+ /**
485
+ * Options for updating a session
486
+ */
487
+ export interface UpdateSessionOptions {
488
+ title?: string;
489
+ metadata?: Record<string, unknown>;
490
+ }
491
+ /**
492
+ * Options for listing sessions
493
+ */
494
+ export interface ListSessionsOptions {
495
+ filter?: {
496
+ metadata?: Record<string, unknown>;
497
+ startTime?: number;
498
+ endTime?: number;
499
+ };
500
+ sort?: {
501
+ field: "updatedAt" | "createdAt" | "title";
502
+ order: "asc" | "desc";
503
+ };
504
+ offset?: number;
505
+ limit?: number;
506
+ }
507
+ /**
508
+ * Options for adding a message
509
+ */
510
+ export interface AddMessageOptions {
511
+ role: Role;
512
+ content: string;
513
+ parts?: MessagePart[];
514
+ metadata?: MessageMetadata;
515
+ }
516
+ /**
517
+ * Options for compact operation
518
+ */
519
+ export interface CompactOptions {
520
+ /** User-provided summary hint for checkpoint generation */
521
+ summary?: string;
522
+ /** User-provided process key points hint */
523
+ processKeyPoints?: string[];
524
+ /** User-provided current state hint */
525
+ currentState?: string;
526
+ /** User-provided next steps hint */
527
+ nextSteps?: string[];
528
+ /** Whether this is auto-triggered compact */
529
+ auto?: boolean;
530
+ /**
531
+ * Scenario hint for guiding checkpoint generation
532
+ *
533
+ * A natural language description that provides context about the current scenario.
534
+ * This helps the SummaryAgent generate more relevant checkpoints based on the specific
535
+ * situation. Examples:
536
+ * - "Task execution in progress: implementing feature X, current working directory is /path/to/project"
537
+ * - "Bug investigation: analyzing crash dump, current hypothesis is memory corruption"
538
+ * - "Code review session: reviewing PR #123, focus on security implications"
539
+ *
540
+ * When provided, this will be prepended to the system prompt to guide the checkpoint
541
+ * generation with scenario-specific emphasis.
542
+ */
543
+ scenarioHint?: string;
544
+ }
545
+ /**
546
+ * Result of compact operation
547
+ */
548
+ export interface CompactResult {
549
+ checkpoint: SessionCheckpoint;
550
+ deletedMessageCount: number;
551
+ remainingMessageCount: number;
552
+ checkpointCount: number;
553
+ }
554
+ /**
555
+ * Preview of compact operation
556
+ */
557
+ export interface CompactPreview {
558
+ messageCountToCompact: number;
559
+ estimatedCheckpointTokens: number;
560
+ wouldTrigger: boolean;
561
+ }
562
+ /**
563
+ * Options for getting session context
564
+ */
565
+ export interface GetContextOptions {
566
+ /** Start from specified checkpoint */
567
+ fromCheckpoint?: string;
568
+ /** Start from latest checkpoint (default: true) */
569
+ fromLatestCheckpoint?: boolean;
570
+ /** Read full history (ignore checkpoints) */
571
+ fullHistory?: boolean;
572
+ /** Message limit */
573
+ messageLimit?: number;
574
+ /** Minimum user messages to include (ensures starting from user message boundary) */
575
+ minUserMessages?: number;
576
+ /** Include checkpoint details */
577
+ includeCheckpoints?: boolean;
578
+ }
579
+ /**
580
+ * Result of getting session context
581
+ */
582
+ export interface GetContextResult {
583
+ session: Session;
584
+ checkpoints: SessionCheckpoint[];
585
+ startCheckpoint?: SessionCheckpoint;
586
+ messages: SessionMessage[];
587
+ totalMessageCount: number;
588
+ activeMessageCount: number;
589
+ archivedMessageCount: number;
590
+ estimatedTokens: number;
591
+ }
592
+ /**
593
+ * Options for getting messages
594
+ */
595
+ export interface GetMessagesOptions {
596
+ /** Include archived messages */
597
+ includeArchived?: boolean;
598
+ /** From checkpoint ID */
599
+ fromCheckpointId?: string;
600
+ /** Reverse order */
601
+ reverse?: boolean;
602
+ }
603
+ /**
604
+ * Session hook type
605
+ */
606
+ export type SessionHookType = "before.session.create" | "after.session.create" | "before.session.get" | "after.session.get" | "before.session.list" | "after.session.list" | "before.session.update" | "after.session.update" | "before.session.delete" | "after.session.delete" | "before.session.compact" | "after.session.compact" | "before.session.createCheckpoint" | "after.session.createCheckpoint" | "before.session.deleteCheckpoint" | "after.session.deleteCheckpoint";
607
+ /**
608
+ * Session hook context
609
+ */
610
+ export interface SessionHookContext {
611
+ session?: Session;
612
+ id?: string;
613
+ options?: CreateSessionOptions | UpdateSessionOptions;
614
+ checkpoint?: SessionCheckpoint;
615
+ }
616
+ /**
617
+ * Session hook callback
618
+ */
619
+ export type SessionHookCallback = (context?: any) => Promise<void>;
620
+ /**
621
+ * Session hook definition
622
+ */
623
+ export interface SessionHook {
624
+ name: string;
625
+ before?: SessionHookCallback;
626
+ after?: SessionHookCallback;
627
+ }
628
+ /**
629
+ * Session hooks configuration
630
+ */
631
+ export interface SessionHooksConfig {
632
+ [key: string]: SessionHook[];
633
+ }
634
+ /**
635
+ * Options for searching messages
636
+ */
637
+ export interface SearchMessagesOptions {
638
+ /** Search query (supports AND/OR/NOT syntax) */
639
+ query: string;
640
+ /** Limit search to specific session ID */
641
+ sessionId?: string;
642
+ /** Maximum number of results per session */
643
+ limit?: number;
644
+ /** Maximum total results */
645
+ maxResults?: number;
646
+ /** Only search messages before this timestamp */
647
+ beforeTime?: number;
648
+ /** Only search messages after this timestamp */
649
+ afterTime?: number;
650
+ /** Include archived messages */
651
+ includeArchived?: boolean;
652
+ /** Include context (messages before/after matches) */
653
+ includeContext?: boolean;
654
+ /** Number of context lines before/after */
655
+ contextLines?: number;
656
+ }
657
+ /**
658
+ * A single message match
659
+ */
660
+ export interface MessageMatch {
661
+ /** Message ID */
662
+ messageId: string;
663
+ /** Session ID */
664
+ sessionId: string;
665
+ /** Message role */
666
+ role: Role;
667
+ /** Message content */
668
+ content: string;
669
+ /** Message timestamp */
670
+ timestamp: number;
671
+ /** Context before the match (if enabled) */
672
+ contextBefore?: string;
673
+ /** Context after the match (if enabled) */
674
+ contextAfter?: string;
675
+ /** Match score (relevance) */
676
+ score?: number;
677
+ }
678
+ /**
679
+ * Search result aggregated by session
680
+ */
681
+ export interface SearchResult {
682
+ /** Session ID */
683
+ sessionId: string;
684
+ /** Session title */
685
+ sessionTitle: string;
686
+ /** Session directory */
687
+ sessionDirectory: string;
688
+ /** Session update timestamp */
689
+ updatedAt: number;
690
+ /** Total message count in session */
691
+ messageCount: number;
692
+ /** Matching messages in this session */
693
+ matches: MessageMatch[];
694
+ }
695
+ /**
696
+ * Search result with metadata
697
+ */
698
+ export interface SearchResultWithMeta {
699
+ /** Total number of matching messages */
700
+ totalMatches: number;
701
+ /** Number of sessions with matches */
702
+ sessionCount: number;
703
+ /** Results grouped by session */
704
+ results: SearchResult[];
705
+ }