fengming 0.3.4 → 0.3.5

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 (2016) hide show
  1. package/CHANGELOG.md +3 -2
  2. package/dist/abort-CjCDVBbH.js +277 -0
  3. package/dist/abort.runtime-DxJ8129J.js +2 -0
  4. package/dist/abort.runtime.js +1 -1
  5. package/dist/accounts-Cyn0sm_v.js +423 -0
  6. package/dist/accounts-DzcLKcN5.js +2 -0
  7. package/dist/acp/control-plane/manager.js +1 -1
  8. package/dist/acp-spawn-4lfz_3K9.js +1286 -0
  9. package/dist/acp-spawn-BCUjuO6L.js +2 -0
  10. package/dist/acp-stateful-target-driver-Bv99uwEA.js +89 -0
  11. package/dist/action-info-CP-p6RHS.js +75 -0
  12. package/dist/active-runtime-registry-DjKe53a5.js +62 -0
  13. package/dist/active-tool-schema-warnings-p7CqUnu1.js +105 -0
  14. package/dist/active-tool-schema-warnings-pGI92yka.js +2 -0
  15. package/dist/agent-B77yluip.js +1825 -0
  16. package/dist/agent-BooUvZnR.js +2 -0
  17. package/dist/agent-bundle-lsp-runtime-3ieSgTgo.js +389 -0
  18. package/dist/agent-bundle-lsp-runtime-CkJ0XJK7.js +2 -0
  19. package/dist/agent-bundle-mcp-materialize-BH-esGZL.js +124 -0
  20. package/dist/agent-bundle-mcp-tools-DkixTTnL.js +3 -0
  21. package/dist/agent-command-BJKcnQy6.js +1435 -0
  22. package/dist/agent-delivery-CEfe_Zzt.js +117 -0
  23. package/dist/agent-harness-runtime-R_Ae6o9C.js +207 -0
  24. package/dist/agent-kWSaRcQt.js +3 -0
  25. package/dist/agent-model-discovery-C49swEgd.js +238 -0
  26. package/dist/agent-model-discovery-DZbixJQs.js +3 -0
  27. package/dist/agent-runner-utils-BChpi9Ec.js +267 -0
  28. package/dist/agent-runner.runtime-3LOdt215.js +3784 -0
  29. package/dist/agent-runner.runtime.js +1 -1
  30. package/dist/agent-runtime-3jsv8b7Y.js +199 -0
  31. package/dist/agent-runtime-label-uoFI4ovH.js +30 -0
  32. package/dist/agent-runtime-metadata-BhFt6kLt.js +53 -0
  33. package/dist/agent-tool-result-middleware-loader-BxYJNC1i.js +55 -0
  34. package/dist/agent-tools-COLEG7aL.js +2506 -0
  35. package/dist/agent-tools.before-tool-call--rMZI5Rd.js +1274 -0
  36. package/dist/agent-tools.before-tool-call-CbX2sfP4.js +2 -0
  37. package/dist/agent-via-gateway-DfKij3De.js +486 -0
  38. package/dist/agent-wait-dedupe-BAUSJotw.js +180 -0
  39. package/dist/agents/agent-bundle-mcp-materialize.js +1 -1
  40. package/dist/agents/auth-profiles.runtime.js +1 -1
  41. package/dist/agents/compaction-planning.worker.js +1 -1
  42. package/dist/agents/embedded-agent-runner/effective-tool-policy.js +1 -1
  43. package/dist/agents/embedded-agent-runner/tool-split.js +1 -1
  44. package/dist/agents/model-catalog.runtime.js +1 -1
  45. package/dist/agents/model-provider-auth.worker.js +3 -3
  46. package/dist/agents/models-config.runtime.js +1 -1
  47. package/dist/agents-CZSNDJWD.js +632 -0
  48. package/dist/agents.command-shared-DgbjfH23.js +16 -0
  49. package/dist/agents.commands.add-DknGM1oz.js +304 -0
  50. package/dist/agents.commands.bind-DDVI0yDe.js +265 -0
  51. package/dist/agents.commands.delete-Dv4RHEhc.js +128 -0
  52. package/dist/agents.commands.identity-BSZbc1QR.js +143 -0
  53. package/dist/agents.commands.list-CA0OTw59.js +235 -0
  54. package/dist/aliases-EY1GbfwT.js +97 -0
  55. package/dist/api-CY0oKcRz.js +3 -0
  56. package/dist/api-DgjY0gIl.js +6 -0
  57. package/dist/api-VyMyAYze.js +2 -0
  58. package/dist/api-key-rotation-DxPKIdmC.js +167 -0
  59. package/dist/app-registration-BBDxCbFo.js +194 -0
  60. package/dist/apply-DMYy7tc3.js +544 -0
  61. package/dist/apply-Dd0n97MD.js +2 -0
  62. package/dist/apply-bHIT1nMp.js +416 -0
  63. package/dist/apply-g8x7Z83S.js +510 -0
  64. package/dist/apply-nnbx9TaB.js +2 -0
  65. package/dist/approval-native-helpers-CjaYvOaZ.js +398 -0
  66. package/dist/artifacts-B55YR-uA.js +368 -0
  67. package/dist/assistant-hJaOgfKl.js +291 -0
  68. package/dist/attachment-normalize-COsastJx.js +213 -0
  69. package/dist/attempt-execution-fDWDWcWe.js +584 -0
  70. package/dist/attempt-execution.helpers-Cze5xPim.js +969 -0
  71. package/dist/attempt-execution.runtime-B1iCG6LN.js +3 -0
  72. package/dist/attempt-execution.runtime.js +1 -1
  73. package/dist/attempt.prompt-helpers-CkBYHBBo.js +543 -0
  74. package/dist/attempt.tool-run-context-DzfRK5pV.js +1240 -0
  75. package/dist/audio-preflight.runtime-rjWd9uyk.js +7 -0
  76. package/dist/audio-preflight.runtime.js +1 -1
  77. package/dist/audit-DgFtNg3U.js +1108 -0
  78. package/dist/audit-L8EC3WhV.js +477 -0
  79. package/dist/audit.nondeep.runtime-D0sQ6bO2.js +1416 -0
  80. package/dist/audit.nondeep.runtime.js +1 -1
  81. package/dist/audit.runtime-CiG82F31.js +7 -0
  82. package/dist/audit.runtime.js +1 -1
  83. package/dist/auth-CzPdsZVM.js +567 -0
  84. package/dist/auth-choice-BNzS9QBI.js +3 -0
  85. package/dist/auth-choice-Cwr5kgcD.js +110 -0
  86. package/dist/auth-choice-DW9qPpMS.js +400 -0
  87. package/dist/auth-choice.apply.api-providers-C68tOdqj.js +34 -0
  88. package/dist/auth-choice.apply.api-providers-DSRK0gYo.js +2 -0
  89. package/dist/auth-choice.plugin-providers.runtime-BJ9VyO1C.js +11 -0
  90. package/dist/auth-choice.plugin-providers.runtime.js +1 -1
  91. package/dist/auth-health-BanKwsTW.js +219 -0
  92. package/dist/auth-list-Dq8obVno.js +115 -0
  93. package/dist/auth-order-VXqoAroP.js +105 -0
  94. package/dist/auth-profiles-6VFEdgC-.js +73 -0
  95. package/dist/auth-profiles-a0M4JYYg.js +14 -0
  96. package/dist/backend-config-COaTdVnN.js +259 -0
  97. package/dist/bash-tools-BMAquSiM.js +3 -0
  98. package/dist/bash-tools-DLiUXfaS.js +3497 -0
  99. package/dist/binding-routing-Bwvdx_7S.js +113 -0
  100. package/dist/binding-targets-Z_d0mK_1.js +121 -0
  101. package/dist/bootstrap-files-CoCV_zqu.js +202 -0
  102. package/dist/bootstrap-files-_T3VoTrV.js +3 -0
  103. package/dist/bridge-server-BIaNurGa.js +113 -0
  104. package/dist/browser-cli-D4wL8NU9.js +230 -0
  105. package/dist/browser-cli-actions-input-z40PGiYI.js +522 -0
  106. package/dist/browser-cli-actions-observe-C4TeyNke.js +81 -0
  107. package/dist/browser-cli-debug-Dv0gH-c8.js +137 -0
  108. package/dist/browser-cli-inspect-BUXeITYc.js +117 -0
  109. package/dist/browser-cli-manage-qMb3Yw5Y.js +446 -0
  110. package/dist/browser-cli-resize-CZWnGwGz.js +32 -0
  111. package/dist/browser-cli-shared-BpinhvE3.js +69 -0
  112. package/dist/browser-cli-state-CBbKqqgP.js +371 -0
  113. package/dist/browser-cli-uI5GGX51.js +2 -0
  114. package/dist/browser-control-auth-CFPJXdN_.js +2 -0
  115. package/dist/browser-profiles-D4ni3t4J.js +2 -0
  116. package/dist/browser-runtime-Dm5D_PLf.js +389 -0
  117. package/dist/browser-tool.schema-Bek02ox5.js +132 -0
  118. package/dist/btw-command-DdrwvCK4.js +18 -0
  119. package/dist/build-DkEeJ9sO.js +261 -0
  120. package/dist/build-info.json +2 -2
  121. package/dist/bundled/boot-md/handler.js +2 -2
  122. package/dist/bundled/session-memory/handler.js +1 -1
  123. package/dist/bundled-channel-config-schema-BeowdkHi.d.ts +3168 -0
  124. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  125. package/dist/capability-cli-DTRuKZJC.js +1809 -0
  126. package/dist/capability-provider-runtime-Cpp-Jq9g.js +346 -0
  127. package/dist/cdp.helpers-GfQkB-B5.js +637 -0
  128. package/dist/channel-BRehZ4Cg.js +2309 -0
  129. package/dist/channel-actions-hdQKe_se.js +46 -0
  130. package/dist/channel-bootstrap.runtime-BzjlNG_j.js +38 -0
  131. package/dist/channel-bootstrap.runtime-CmNNVl40.js +2 -0
  132. package/dist/channel-bootstrap.runtime.js +1 -1
  133. package/dist/channel-core-BLcWqSk-.js +5 -0
  134. package/dist/channel-inbound-pR1B7HTU.js +121 -0
  135. package/dist/channel-message-W0VurpjH.js +12 -0
  136. package/dist/channel-outbound-DO4HI6E_.js +436 -0
  137. package/dist/channel-plugin-resolution-CLA7S5_A.js +2 -0
  138. package/dist/channel-plugin-resolution-DzwVj01h.js +135 -0
  139. package/dist/channel-resolution-DOPyiG4k.js +46 -0
  140. package/dist/channel-selection-kwoWZDQ3.js +171 -0
  141. package/dist/channel-selection.runtime-LiDliif9.js +2 -0
  142. package/dist/channel-selection.runtime.js +1 -1
  143. package/dist/channel.runtime-DDt3PayH.js +697 -0
  144. package/dist/channel.runtime.js +1 -1
  145. package/dist/channels-CKJd4eUz.js +1004 -0
  146. package/dist/channels-cli-DLAPi8pX.js +331 -0
  147. package/dist/chat-6WsYrS9m.js +3 -0
  148. package/dist/chat-DpsCEXAx.js +2940 -0
  149. package/dist/chrome-BWHc9vYG.js +1517 -0
  150. package/dist/chrome-mcp-BGKgR8A_.js +2 -0
  151. package/dist/chrome-mcp-Bg5D5PDc.js +864 -0
  152. package/dist/claude-live-session-BLCZnv-A.js +2 -0
  153. package/dist/claude-live-session-CGnB64D6.js +1338 -0
  154. package/dist/clawbot-cli-ynXzgp8B.js +9 -0
  155. package/dist/cli/daemon-cli.js +3 -3
  156. package/dist/cli/gateway-lifecycle.runtime.js +4 -4
  157. package/dist/cli/run-main.js +12 -12
  158. package/dist/cli-B4Ttnj0P.js +2 -0
  159. package/dist/cli-BjVgdamH.js +2 -0
  160. package/dist/cli-CNqBrHLU.js +293 -0
  161. package/dist/cli-backends.runtime-DoxtCrow.js +7 -0
  162. package/dist/cli-backends.runtime.js +1 -1
  163. package/dist/cli-compaction-BCuLbs75.js +363 -0
  164. package/dist/cli-mthNIkji.js +141 -0
  165. package/dist/cli-registry-loader-B2sNTdgY.js +2 -0
  166. package/dist/cli-registry-loader-Dz9YFrjw.js +193 -0
  167. package/dist/cli-runner-C9t-9-Io.js +597 -0
  168. package/dist/cli-runner-D21qMGk7.js +2 -0
  169. package/dist/cli-runner.runtime-BNqbJFgu.js +3 -0
  170. package/dist/cli-runner.runtime-Dv50IEvH.js +4 -0
  171. package/dist/cli-runner.runtime.js +1 -1
  172. package/dist/cli-session-jBtClYfT.js +119 -0
  173. package/dist/cli-startup-metadata.json +9 -9
  174. package/dist/cli.runtime-CGBzSGAG.js +1276 -0
  175. package/dist/cli.runtime.js +1 -1
  176. package/dist/codex-native-web-search-B3C-srtm.js +20 -0
  177. package/dist/codex-native-web-search-B7xh2Xcb.js +4 -0
  178. package/dist/codex-native-web-search-core-CrwANQg5.js +106 -0
  179. package/dist/command-auth-Dz_pdczs.js +135 -0
  180. package/dist/command-config-resolution-XCA63Yv8.js +25 -0
  181. package/dist/command-config-resolution-xtKMDTG9.js +2 -0
  182. package/dist/command-config-resolution.runtime-xtKMDTG9.js +2 -0
  183. package/dist/command-config-resolution.runtime.js +1 -1
  184. package/dist/command-execution-startup-CasEqEXh.js +90 -0
  185. package/dist/command-primitives-runtime-DC9gtSI3.js +3 -0
  186. package/dist/command-registry-BQnMdca9.js +9 -0
  187. package/dist/command-registry-core-hx2t1jQP.js +114 -0
  188. package/dist/command-registry-rbKA-L_8.js +4 -0
  189. package/dist/command-secret-gateway-7oveYQCx.js +589 -0
  190. package/dist/command-secret-targets-B7M1Us_C.js +2 -0
  191. package/dist/command-status-builders-DrSoZhiI.js +147 -0
  192. package/dist/command-status.runtime-By0071-y.js +90 -0
  193. package/dist/command-status.runtime.js +1 -1
  194. package/dist/commands/status.summary.runtime.js +3 -3
  195. package/dist/commands-B1MnUj5-.js +161 -0
  196. package/dist/commands-compact.runtime-DELj3JaW.js +10 -0
  197. package/dist/commands-compact.runtime.js +1 -1
  198. package/dist/commands-core.runtime-Zw0grrkC.js +2 -0
  199. package/dist/commands-core.runtime.js +1 -1
  200. package/dist/commands-handlers.runtime-BCl_ZHJZ.js +6327 -0
  201. package/dist/commands-handlers.runtime.js +1 -1
  202. package/dist/commands-models-Uurm-0C3.js +448 -0
  203. package/dist/commands-registry-Bo1AeDcq.js +195 -0
  204. package/dist/commands-registry.runtime-C9DBHyhh.js +4 -0
  205. package/dist/commands-registry.runtime.js +1 -1
  206. package/dist/commands-status-BoAXH-wg.js +16 -0
  207. package/dist/commands-status-CNALMTN9.js +3 -0
  208. package/dist/commands-status.runtime-CNALMTN9.js +3 -0
  209. package/dist/commands-status.runtime.js +1 -1
  210. package/dist/commands-subagents-control.runtime-Dl4IuTzV.js +2 -0
  211. package/dist/commands-subagents-control.runtime.js +1 -1
  212. package/dist/commands-system-prompt-BPzpLmUp.js +2 -0
  213. package/dist/commands-system-prompt-DCOZSNh5.js +161 -0
  214. package/dist/commands.runtime-bfCLM0Sg.js +175 -0
  215. package/dist/commands.runtime.js +1 -1
  216. package/dist/commitments/runtime.js +1 -1
  217. package/dist/common-CoOYhmSg.js +286 -0
  218. package/dist/compact-yqaUOESq.js +1165 -0
  219. package/dist/compact.runtime-Y91AFZVE.js +12 -0
  220. package/dist/compact.runtime.js +1 -1
  221. package/dist/compaction-planning-DVnykwzd.js +202 -0
  222. package/dist/completion-cli-BJjq_g_B.js +393 -0
  223. package/dist/config-CsmSEaNn.js +374 -0
  224. package/dist/config-CtNXZ0iy.js +610 -0
  225. package/dist/config-cli-CNpIVdqp.js +1703 -0
  226. package/dist/config-mutation-B-SErGM0.js +5 -0
  227. package/dist/config-mutations-Bu3ahkX8.js +161 -0
  228. package/dist/config-utils-Bv0Nisds.js +141 -0
  229. package/dist/config-validation-DitvTYD8.js +33 -0
  230. package/dist/configure-CdjbRKTg.js +771 -0
  231. package/dist/configure-Cvi-5ml4.js +3 -0
  232. package/dist/configure.commands-BJii4733.js +1253 -0
  233. package/dist/configure.commands-tJzVFJ0o.js +2 -0
  234. package/dist/context-D1N9oPds.js +2 -0
  235. package/dist/context-XMtJ9b3v.js +248 -0
  236. package/dist/context-engine-host-compat-3QznbSaW.js +280 -0
  237. package/dist/context-engine-host-compat-DquSpnKD.js +2 -0
  238. package/dist/context-engine-lifecycle-Bqdhy9JU.js +627 -0
  239. package/dist/control-auth-CMW_9jmY.js +114 -0
  240. package/dist/control-service-D-r3k91q.js +40 -0
  241. package/dist/control-service-uIPYrp9F.js +3 -0
  242. package/dist/control-ui/assets/activity-DgMhyllD.js +124 -0
  243. package/dist/control-ui/assets/agents-CsRhxO2O.js +1030 -0
  244. package/dist/control-ui/assets/channels-Dq8bzpMg.js +120 -0
  245. package/dist/control-ui/assets/cron-Dk5bqYwg.js +1016 -0
  246. package/dist/control-ui/assets/debug-CNIwFEQO.js +97 -0
  247. package/dist/control-ui/assets/index-CV2NsPlu.js +7214 -0
  248. package/dist/control-ui/assets/instances-DLr0iEvT.js +57 -0
  249. package/dist/control-ui/assets/nodes-D3JEksjl.js +444 -0
  250. package/dist/control-ui/assets/sessions-nbXWGlHZ.js +425 -0
  251. package/dist/control-ui/assets/skills-tBOi8OBq.js +362 -0
  252. package/dist/control-ui/assets/workboard-ClTo7wmK.js +402 -0
  253. package/dist/control-ui/index.html +1 -1
  254. package/dist/control-ui/sw.js +1 -1
  255. package/dist/control-ui-AkRMsk9S.js +750 -0
  256. package/dist/conversation-label-generator-DHtcgSBn.js +72 -0
  257. package/dist/conversation-runtime-BEgHW4ta.js +31 -0
  258. package/dist/core-Bslrvfnp.js +284 -0
  259. package/dist/core-api-BOlUb7G8.js +5 -0
  260. package/dist/core-api-CiBoGa2I.js +2 -0
  261. package/dist/crestodian/crestodian.js +1 -1
  262. package/dist/crestodian/rescue-message.js +1 -1
  263. package/dist/crestodian-mXnyuHx9.js +55 -0
  264. package/dist/cron-PbdpyFrD.js +453 -0
  265. package/dist/daemon-install-C-d4dFvn.js +66 -0
  266. package/dist/daemon-install-auth-profiles-store.runtime-CvE2EVVo.js +2 -0
  267. package/dist/daemon-install-auth-profiles-store.runtime.js +1 -1
  268. package/dist/dashboard-Ey5dnvMI.js +263 -0
  269. package/dist/defaults-CsRAv-qE.js +130 -0
  270. package/dist/defaults-DHZBSNHC.js +3 -0
  271. package/dist/defaults.constants-CR4S_tvw.js +76 -0
  272. package/dist/deliver-BkuuFBlm.js +1399 -0
  273. package/dist/deliver-P4upyes7.js +3 -0
  274. package/dist/deliver-runtime-CjnLI_nC.js +2 -0
  275. package/dist/delivery-outbound.runtime-fcJ-M8qj.js +7 -0
  276. package/dist/delivery-outbound.runtime.js +1 -1
  277. package/dist/delivery-queue-BqgHvNlY.js +863 -0
  278. package/dist/delivery-queue-CfsRscJb.js +2 -0
  279. package/dist/delivery-queue-runtime-D0PKG1Bv.js +16 -0
  280. package/dist/delivery-target.runtime-C5e8d0WH.js +45 -0
  281. package/dist/delivery-target.runtime.js +1 -1
  282. package/dist/delivery.runtime-2Ut8xM3P.js +470 -0
  283. package/dist/delivery.runtime.js +1 -1
  284. package/dist/detached-task-runtime-OOZBqRy-.js +86 -0
  285. package/dist/diagnostics-zf6WQ2h7.js +168 -0
  286. package/dist/dialogue-C8IOya-l.js +37 -0
  287. package/dist/direct-dm-wPF-KfNb.js +81 -0
  288. package/dist/directive-handling.defaults-C-1lmFYo.js +22 -0
  289. package/dist/directive-handling.fast-lane-DENPMtYI.js +70 -0
  290. package/dist/directive-handling.impl-C1p5t3qA.js +2 -0
  291. package/dist/directive-handling.impl-DOo2Sa7C.js +823 -0
  292. package/dist/directive-handling.model-selection-6gC-fr_g.js +122 -0
  293. package/dist/directive-handling.persist.runtime-CuhUd2kW.js +274 -0
  294. package/dist/directive-handling.persist.runtime.js +1 -1
  295. package/dist/directives-BIKSyN8C.js +319 -0
  296. package/dist/directory-cli-DZ0PU0Rv.js +239 -0
  297. package/dist/dispatch-DQLImAqt.js +2057 -0
  298. package/dist/dispatch-acp-DzyX7wsq.js +1102 -0
  299. package/dist/dispatch-acp-manager.runtime-CoAfs4O1.js +3 -0
  300. package/dist/dispatch-acp-manager.runtime.js +1 -1
  301. package/dist/dispatch-acp-media.runtime-7uUP_jr9.js +4 -0
  302. package/dist/dispatch-acp-media.runtime.js +1 -1
  303. package/dist/dispatch-acp-transcript.runtime-BUlmV_h0.js +40 -0
  304. package/dist/dispatch-acp-transcript.runtime.js +1 -1
  305. package/dist/dispatch-acp-tts.runtime-ChBnVkNt.js +3 -0
  306. package/dist/dispatch-acp-tts.runtime.js +1 -1
  307. package/dist/dispatch-acp.runtime-DAexFaBu.js +18 -0
  308. package/dist/dispatch-acp.runtime.js +1 -1
  309. package/dist/dispatcher-D3IQEbf9.js +106 -0
  310. package/dist/doctor-BSqEqfb6.js +760 -0
  311. package/dist/doctor-auth-flat-profiles-BIZ4wsYP.js +2 -0
  312. package/dist/doctor-auth-flat-profiles-DXtD5LfC.js +516 -0
  313. package/dist/doctor-auth-legacy-oauth-DwFbRYTP.js +48 -0
  314. package/dist/doctor-auth-oauth-sidecar-6I3FEJbi.js +2 -0
  315. package/dist/doctor-auth-oauth-sidecar-BSC3rnDM.js +177 -0
  316. package/dist/doctor-auth-tVGsUiM6.js +216 -0
  317. package/dist/doctor-bootstrap-size-B0q6bdkO.js +57 -0
  318. package/dist/doctor-claude-cli-Bn79OuBT.js +150 -0
  319. package/dist/doctor-config-flow-CCwocXpV.js +1819 -0
  320. package/dist/doctor-core-checks-D7-1l8jy.js +666 -0
  321. package/dist/doctor-core-checks-eM8FNi8B.js +2 -0
  322. package/dist/doctor-core-checks.runtime-Dc03aeoU.js +278 -0
  323. package/dist/doctor-core-checks.runtime.js +1 -1
  324. package/dist/doctor-gRYfpEbB.js +6 -0
  325. package/dist/doctor-gateway-daemon-flow-KTnHAdeV.js +349 -0
  326. package/dist/doctor-gateway-services-BByDQtjY.js +465 -0
  327. package/dist/doctor-health-CnoM718z.js +65 -0
  328. package/dist/doctor-health-contributions-flVKMQwr.js +874 -0
  329. package/dist/doctor-lint-BBm6gtBa.js +95 -0
  330. package/dist/doctor-memory-search-DjHVDCGo.js +407 -0
  331. package/dist/doctor-state-integrity-Bgw25cz1.js +1257 -0
  332. package/dist/doctor-tool-result-cap-advice-B8wTpiTO.js +27 -0
  333. package/dist/doctor-workspace-status-DcjeJIpT.js +76 -0
  334. package/dist/dreaming-BE4t8DVf.js +523 -0
  335. package/dist/dreaming-command-DWm1lB-Z.js +101 -0
  336. package/dist/dreaming-narrative-8DM-OMrm.js +721 -0
  337. package/dist/dreaming-narrative-CcFfheQI.js +2 -0
  338. package/dist/dreaming-phases-CqOhhTdZ.js +2 -0
  339. package/dist/dreaming-phases-D9eT6Kk0.js +1162 -0
  340. package/dist/drive-D2M5B7-2.js +899 -0
  341. package/dist/echo-transcript-B-wl5MoX.js +52 -0
  342. package/dist/effective-tool-policy-Cx8mC5aA.js +89 -0
  343. package/dist/embedded-agent-BTvtoOe_.js +4 -0
  344. package/dist/embedded-agent-CGmSKuNM.js +4074 -0
  345. package/dist/embedded-agent-helpers-CboIPx57.js +6 -0
  346. package/dist/embedded-agent-helpers-cw0InMDZ.js +1037 -0
  347. package/dist/embedded-agent.runtime-Bfe4bjyF.js +4 -0
  348. package/dist/embedded-agent.runtime.js +1 -1
  349. package/dist/embedded-backend-D-EshN85.js +744 -0
  350. package/dist/embedded-gateway-stub.runtime-Cx9qs0KV.js +12 -0
  351. package/dist/embedded-gateway-stub.runtime.js +1 -1
  352. package/dist/embedding-provider-runtime-DaXfsUPo.js +86 -0
  353. package/dist/embedding-providers-CdU99clu.js +2 -0
  354. package/dist/embeddings-http-BQnlTr-1.js +222 -0
  355. package/dist/engine-qmd-5jbjGywA.js +708 -0
  356. package/dist/engine-storage-CfAgwoDp.js +203 -0
  357. package/dist/entry.js +1 -1
  358. package/dist/errors-C0AUxo3P.js +2 -0
  359. package/dist/exec-approval-forwarder.runtime-BvR47p5Z.js +4 -0
  360. package/dist/exec-approval-forwarder.runtime.js +1 -1
  361. package/dist/exec-approval-session-target-CCqYgaVa.js +177 -0
  362. package/dist/exec-auto-reviewer-BfJaNkNy.js +2 -0
  363. package/dist/exec-auto-reviewer-Dqx7I88Z.js +241 -0
  364. package/dist/execute.runtime-Qb6Z75sG.js +579 -0
  365. package/dist/execute.runtime.js +1 -1
  366. package/dist/extensionAPI.js +2 -2
  367. package/dist/extensions/active-memory/index.js +3 -3
  368. package/dist/extensions/admin-http-rpc/index.js +1 -1
  369. package/dist/extensions/alibaba/index.js +1 -1
  370. package/dist/extensions/alibaba/video-generation-provider.js +1 -1
  371. package/dist/extensions/baichuan/index.js +1 -1
  372. package/dist/extensions/browser/browser-bridge.js +1 -1
  373. package/dist/extensions/browser/browser-cdp.js +1 -1
  374. package/dist/extensions/browser/browser-config.js +5 -5
  375. package/dist/extensions/browser/browser-control-auth.js +2 -2
  376. package/dist/extensions/browser/browser-doctor.js +3 -3
  377. package/dist/extensions/browser/browser-maintenance.js +1 -1
  378. package/dist/extensions/browser/browser-profiles.js +3 -3
  379. package/dist/extensions/browser/browser-runtime-api.js +14 -14
  380. package/dist/extensions/browser/cli-metadata.js +1 -1
  381. package/dist/extensions/browser/index.js +1 -1
  382. package/dist/extensions/browser/plugin-registration.js +1 -1
  383. package/dist/extensions/browser/register.runtime.js +4 -4
  384. package/dist/extensions/browser/runtime-api.js +16 -16
  385. package/dist/extensions/byteplus/index.js +3 -3
  386. package/dist/extensions/byteplus/video-generation-provider.js +1 -1
  387. package/dist/extensions/canvas/index.js +3 -3
  388. package/dist/extensions/canvas/runtime-api.js +2 -2
  389. package/dist/extensions/deepseek/index.js +1 -1
  390. package/dist/extensions/device-pair/api.js +2 -2
  391. package/dist/extensions/device-pair/pair-command-approve.js +1 -1
  392. package/dist/extensions/device-pair/qr-image.js +2 -2
  393. package/dist/extensions/longcat/index.js +1 -1
  394. package/dist/extensions/memory-core/api.js +3 -3
  395. package/dist/extensions/memory-core/cli-metadata.js +1 -1
  396. package/dist/extensions/memory-core/cli.js +2 -2
  397. package/dist/extensions/memory-core/index.js +11 -11
  398. package/dist/extensions/memory-core/manager-runtime.js +1 -1
  399. package/dist/extensions/memory-core/runtime-api.js +6 -6
  400. package/dist/extensions/minimax/image-generation-provider.js +1 -1
  401. package/dist/extensions/minimax/index.js +7 -7
  402. package/dist/extensions/minimax/media-understanding-provider.js +1 -1
  403. package/dist/extensions/minimax/music-generation-provider.js +1 -1
  404. package/dist/extensions/minimax/oauth.js +1 -1
  405. package/dist/extensions/minimax/oauth.runtime.js +1 -1
  406. package/dist/extensions/minimax/provider-registration.js +1 -1
  407. package/dist/extensions/minimax/speech-provider.js +1 -1
  408. package/dist/extensions/minimax/video-generation-provider.js +1 -1
  409. package/dist/extensions/minimax/web-search-provider.js +1 -1
  410. package/dist/extensions/moonshot/index.js +5 -5
  411. package/dist/extensions/moonshot/media-understanding-provider.js +1 -1
  412. package/dist/extensions/moonshot/web-search-provider.js +1 -1
  413. package/dist/extensions/qianfan/index.js +1 -1
  414. package/dist/extensions/qwen/index.js +5 -5
  415. package/dist/extensions/qwen/media-understanding-provider.js +1 -1
  416. package/dist/extensions/qwen/video-generation-provider.js +1 -1
  417. package/dist/extensions/sensenova/index.js +1 -1
  418. package/dist/extensions/skill-workshop/api.js +2 -2
  419. package/dist/extensions/skill-workshop/index.js +4 -4
  420. package/dist/extensions/stepfun/index.js +2 -2
  421. package/dist/extensions/tavily/index.js +1 -1
  422. package/dist/extensions/tavily/web-search-provider.js +1 -1
  423. package/dist/extensions/tencent/index.js +2 -2
  424. package/dist/extensions/tiangong/index.js +1 -1
  425. package/dist/extensions/volcengine/index.js +3 -3
  426. package/dist/extensions/volcengine/speech-provider.js +1 -1
  427. package/dist/extensions/webhooks/api.js +1 -1
  428. package/dist/extensions/webhooks/index.js +1 -1
  429. package/dist/extensions/weixin/index.js +3 -3
  430. package/dist/extensions/workboard/index.js +2 -2
  431. package/dist/extensions/xiaomi/index.js +4 -4
  432. package/dist/extensions/xiaomi/speech-provider.js +1 -1
  433. package/dist/extensions/xingchen/index.js +1 -1
  434. package/dist/extensions/yi/index.js +1 -1
  435. package/dist/extensions/zai/index.js +4 -4
  436. package/dist/extensions/zai/media-understanding-provider.js +1 -1
  437. package/dist/extensions/zhinao/index.js +1 -1
  438. package/dist/external-cli-auth-selection-CM_aOUJw.js +113 -0
  439. package/dist/extra-params-Bm1eLWN9.js +615 -0
  440. package/dist/fallback-notice-state-v1kyWACv.js +15 -0
  441. package/dist/fallbacks-CDllk2g1.js +31 -0
  442. package/dist/fallbacks-shared-DdMKEmAC.js +116 -0
  443. package/dist/fengming-runtime-DSv30J04.js +33 -0
  444. package/dist/fengming-runtime-config-BE-DquuY.js +2 -0
  445. package/dist/fengming-runtime-memory-BE-DquuY.js +2 -0
  446. package/dist/fengming-runtime-session-BE-DquuY.js +2 -0
  447. package/dist/fengming-tools-DHb-ZeDC.js +12221 -0
  448. package/dist/flows-Cz3y10A9.js +189 -0
  449. package/dist/fs-utils-D05rps7O.js +9 -0
  450. package/dist/gateway/protocol/index.d.ts +1 -1
  451. package/dist/gateway-DTi2D7ZS.js +133 -0
  452. package/dist/gateway-cli-DT2fL2fX.js +443 -0
  453. package/dist/gateway-install-token-CJhAycOA.js +136 -0
  454. package/dist/gateway-method-runtime-BuiYTDQk.js +21 -0
  455. package/dist/gateway-runtime-C5_cVlSW.js +23 -0
  456. package/dist/get-reply-Cz-dUrWm.js +5198 -0
  457. package/dist/get-reply-from-config.runtime-BC1HT67i.js +2 -0
  458. package/dist/get-reply-from-config.runtime.js +1 -1
  459. package/dist/github-copilot-token-09lxV3kH.js +2 -0
  460. package/dist/health-CmihbcqN.js +621 -0
  461. package/dist/health-D8L37hBZ.js +111 -0
  462. package/dist/health-DU7I9RrJ.js +3 -0
  463. package/dist/health-state-QZ2E6xGQ.js +106 -0
  464. package/dist/heartbeat-runner-Bz5PMzEI.js +1930 -0
  465. package/dist/heartbeat-runner-DfqqQ_8w.js +5 -0
  466. package/dist/heartbeat-runner.runtime-8BshUhoS.js +3 -0
  467. package/dist/heartbeat-runner.runtime.js +1 -1
  468. package/dist/helpers-Bkq4POdX.js +406 -0
  469. package/dist/hook-helpers-nmDwt3Fa.js +44 -0
  470. package/dist/hooks-9FOcRqfu.js +536 -0
  471. package/dist/hooks-cli-CrQelcwo.js +465 -0
  472. package/dist/http-endpoint-helpers-BD5u6YsT.js +37 -0
  473. package/dist/http-utils-RcKuBJ0I.js +98 -0
  474. package/dist/image-DwNoypK2.js +385 -0
  475. package/dist/image-fallbacks-BUyDnmUX.js +31 -0
  476. package/dist/image-generation-core.auth.runtime-CA8miEMh.js +2 -0
  477. package/dist/image-generation-core.auth.runtime.js +1 -1
  478. package/dist/image-generation-provider-DXMW5EmB.js +152 -0
  479. package/dist/image-runtime-D5QpNNzz.js +9 -0
  480. package/dist/image-tool.helpers-6vGxo1Y0.js +150 -0
  481. package/dist/images-BGWLzQEJ.js +416 -0
  482. package/dist/images-Db4UB3JG.js +2 -0
  483. package/dist/inbound-reply-dispatch-DRF6ZmQg.js +2 -0
  484. package/dist/inbound-reply-dispatch-RAKLqow4.js +147 -0
  485. package/dist/index-DhOQs6M_.d.ts +1497 -0
  486. package/dist/index.js +1 -1
  487. package/dist/infra-runtime-BFrpRc_V.js +32 -0
  488. package/dist/init-sR7bCS9D.js +59 -0
  489. package/dist/install-BzdJbOUx.js +262 -0
  490. package/dist/install.runtime-Zye6pbZ6.js +2 -0
  491. package/dist/internal-DL_vFx8C.js +399 -0
  492. package/dist/isolated-agent-Qif8Llbt.js +2 -0
  493. package/dist/isolated-agent-aqEjxqs-.js +1097 -0
  494. package/dist/kernel-B-i4c2IK.js +979 -0
  495. package/dist/kernel-DYDJ_hLb.js +3 -0
  496. package/dist/kimi-web-search-provider.runtime-95HAkvHY.js +307 -0
  497. package/dist/kimi-web-search-provider.runtime.js +1 -1
  498. package/dist/library-CZVbE5hF.js +45 -0
  499. package/dist/lifecycle-C8M3YLbT.js +2 -0
  500. package/dist/lifecycle-CPDNQnUN.js +570 -0
  501. package/dist/lifecycle-DpuP7n3J.js +355 -0
  502. package/dist/lifecycle.runtime-C8M3YLbT.js +2 -0
  503. package/dist/lifecycle.runtime.js +1 -1
  504. package/dist/link-understanding/apply.runtime.js +3 -3
  505. package/dist/list-B_ALwpPl.js +2 -0
  506. package/dist/list-Bda_GYFy.js +207 -0
  507. package/dist/list.list-command-W9OGfAIU.js +429 -0
  508. package/dist/list.model-row-LV4AaX0H.js +39 -0
  509. package/dist/list.probe-CrZm6BH2.js +451 -0
  510. package/dist/list.probe-Dfdmb8bC.js +2 -0
  511. package/dist/list.provider-catalog-7T1jKk0n.js +211 -0
  512. package/dist/list.provider-catalog-DjGyZVEj.js +2 -0
  513. package/dist/list.registry-load-DkCS8JZQ.js +152 -0
  514. package/dist/list.row-sources-B1vjo_Y9.js +474 -0
  515. package/dist/list.source-plan-C9Sa6zRK.js +81 -0
  516. package/dist/list.status-command-9daSZZDm.js +815 -0
  517. package/dist/live-model-switch-Dy-UFUMS.js +119 -0
  518. package/dist/llm-slug-generator-DEmh5-_1.js +78 -0
  519. package/dist/llm-slug-generator.js +1 -1
  520. package/dist/load-config-CvQpC8k6.js +27 -0
  521. package/dist/load-context-_qSHpZ5S.js +82 -0
  522. package/dist/loader-CntMt07B.js +7008 -0
  523. package/dist/local-dispatch.runtime-BSN_gqNS.js +10 -0
  524. package/dist/local-dispatch.runtime.js +1 -1
  525. package/dist/main-session-restart-recovery-Db7366lt.js +2 -0
  526. package/dist/main-session-restart-recovery-n87NTooQ.js +389 -0
  527. package/dist/managed-image-attachments-BTBBHlKl.js +2 -0
  528. package/dist/managed-image-attachments-C6_V1yX0.js +616 -0
  529. package/dist/manager-CKrWxjV6.js +3737 -0
  530. package/dist/manager-Dvb1FVnx.js +2314 -0
  531. package/dist/mcp/plugin-tools-serve.js +2 -2
  532. package/dist/mcp-http-CSoGXOa_.js +583 -0
  533. package/dist/mcp-http-D4ieDB3W.js +2 -0
  534. package/dist/media-runtime-GeQTQkkK.js +391 -0
  535. package/dist/media-services-CWbIUZDe.js +416 -0
  536. package/dist/media-understanding/apply.runtime.js +1 -1
  537. package/dist/media-understanding-DXc2BD2L.js +87 -0
  538. package/dist/media-understanding-provider-BkdUiVWU.js +70 -0
  539. package/dist/media-understanding-provider-BlgmLViW.js +13 -0
  540. package/dist/media-understanding-provider-C9P2VjkC.js +29 -0
  541. package/dist/media-understanding-provider-CJlbgAvl.js +69 -0
  542. package/dist/memory-CnC2jM1l.js +437 -0
  543. package/dist/memory-core-host-engine-embeddings-Dy9vN-Ce.js +667 -0
  544. package/dist/memory-core-host-engine-foundation-C-pGGQnm.js +15 -0
  545. package/dist/memory-core-host-engine-qmd-DLJDON9w.js +2 -0
  546. package/dist/memory-core-host-engine-storage-Bzf-C8XE.js +2 -0
  547. package/dist/memory-core-host-runtime-cli-_LWA6G3x.js +10 -0
  548. package/dist/memory-core-host-runtime-core-CromkNBr.js +12 -0
  549. package/dist/memory-core-host-runtime-files-DpbviC1b.js +4 -0
  550. package/dist/memory-embedding-provider-runtime-CaVVaYC5.js +36 -0
  551. package/dist/memory-host-core-B5dWHwBF.js +78 -0
  552. package/dist/memory-host-search.runtime-DqlCFac1.js +2 -0
  553. package/dist/memory-host-search.runtime.js +1 -1
  554. package/dist/memory-runtime-BCeeWb1G.js +2 -0
  555. package/dist/memory-runtime-pR9KGin0.js +57 -0
  556. package/dist/memory-search-CpDEEY2Q.js +235 -0
  557. package/dist/message-BeGCG-D8.js +284 -0
  558. package/dist/message-YGMOyqP5.js +2 -0
  559. package/dist/message-action-runner-ByMT3_eb.js +1922 -0
  560. package/dist/message-action-runner-VXmKO_W7.js +2 -0
  561. package/dist/message-handler-MZ0DMbCx.js +1806 -0
  562. package/dist/metadata-registry-loader-BH9D1UOx.js +2 -0
  563. package/dist/metadata-registry-loader-BK1cHCas.js +22 -0
  564. package/dist/migrate-BA6w0hd3.js +2 -0
  565. package/dist/migrate-BGuQC-1W.js +458 -0
  566. package/dist/migration-provider-runtime-BBdDegWG.js +2 -0
  567. package/dist/migration-provider-runtime-C5WUjrQz.js +68 -0
  568. package/dist/minimax-web-search-provider.runtime-suVFk3Zx.js +148 -0
  569. package/dist/minimax-web-search-provider.runtime.js +1 -1
  570. package/dist/model-BJZXR9dq.js +1302 -0
  571. package/dist/model-BL7xlN5h.js +2 -0
  572. package/dist/model-auth-C-6dYVob.js +6 -0
  573. package/dist/model-auth-DJz7R41W.js +705 -0
  574. package/dist/model-auth-label-DKNXktIu.js +67 -0
  575. package/dist/model-catalog-BjiK5rtT.js +3 -0
  576. package/dist/model-catalog-DM1CTjkW.js +434 -0
  577. package/dist/model-catalog-visibility-DEJZG0In.js +76 -0
  578. package/dist/model-config.helpers-BKcUeE_P.js +95 -0
  579. package/dist/model-context-tokens-5y_PQELY.js +572 -0
  580. package/dist/model-fallback-BDdBR053.js +1288 -0
  581. package/dist/model-fallback-auth.runtime-pcWfkIUF.js +5 -0
  582. package/dist/model-fallback-auth.runtime.js +1 -1
  583. package/dist/model-picker-Bpvp4_N4.js +1135 -0
  584. package/dist/model-picker-DWPPtq6d.js +3 -0
  585. package/dist/model-picker-visibility-BtdqVF80.js +22 -0
  586. package/dist/model-picker.runtime-CYlqts2z.js +48 -0
  587. package/dist/model-picker.runtime.js +1 -1
  588. package/dist/model-pricing-cache-BmmncDqL.js +856 -0
  589. package/dist/model-pricing-cache-CEwRyWw2.js +3 -0
  590. package/dist/model-pricing-cache-state-B8Aspp85.js +83 -0
  591. package/dist/model-provider-auth-B3KXoKkE.js +2 -0
  592. package/dist/model-provider-auth-Bo_8T7of.js +375 -0
  593. package/dist/model-runtime-aliases-Br-ZlhrL.js +133 -0
  594. package/dist/model-selection-D5-ERakL.js +254 -0
  595. package/dist/model-selection-DrzgktRu.js +7 -0
  596. package/dist/model-selection-ibwsPgIw.js +352 -0
  597. package/dist/model-selection.runtime-BRkOZejt.js +7 -0
  598. package/dist/model-selection.runtime.js +1 -1
  599. package/dist/models-RPAH3ZBn.js +57 -0
  600. package/dist/models-auth-status-Cwu9OXU8.js +280 -0
  601. package/dist/models-cli-CrYkSUoa.js +257 -0
  602. package/dist/models-config-Ayzj9gDz.js +1189 -0
  603. package/dist/models-config-BFcjB7nN.js +2 -0
  604. package/dist/models-config.providers.secrets-CCRUW7gL.js +2 -0
  605. package/dist/models-config.providers.secrets-DdX_XSRo.js +382 -0
  606. package/dist/models-http-jLFnelH7.js +88 -0
  607. package/dist/monitor-CqWICrjO.js +60 -0
  608. package/dist/monitor-DwccYPfp.js +1024 -0
  609. package/dist/monitor.account-e9EVttpP.js +5382 -0
  610. package/dist/music-generation-provider-Dfc--R-x.js +308 -0
  611. package/dist/native-hook-relay-Cioqiqv8.js +1378 -0
  612. package/dist/native-hook-relay-DRwJIspI.js +19 -0
  613. package/dist/node-cli-CrG3LH9J.js +2806 -0
  614. package/dist/node-command-policy-CkBTEmhl.js +295 -0
  615. package/dist/nodes-BxrWFA09.js +1483 -0
  616. package/dist/nodes-DFPTGZjc.js +3 -0
  617. package/dist/nodes-cli-Czwyt6r1.js +960 -0
  618. package/dist/nodes-pending-B_4QHyB2.js +211 -0
  619. package/dist/nodes-utils-c4k31OaG.js +85 -0
  620. package/dist/oauth-BXncC0JP.js +852 -0
  621. package/dist/oauth-Ba1O2vqP.js +207 -0
  622. package/dist/oauth-CGQkfxbJ.js +746 -0
  623. package/dist/onboard-I5tQlVm6.js +768 -0
  624. package/dist/onboard-channels-BleKfB1D.js +2 -0
  625. package/dist/onboard-channels-jVaUjGYX.js +1534 -0
  626. package/dist/onboard-custom-BR_5oqUr.js +3 -0
  627. package/dist/onboard-custom-Ss0DThuP.js +280 -0
  628. package/dist/onboard-custom-config-B-knjQm7.js +422 -0
  629. package/dist/onboard-search-BsIztGYF.js +412 -0
  630. package/dist/openai-compat-errors-UkLkk8Q9.js +136 -0
  631. package/dist/openai-http-mTQB44gu.js +836 -0
  632. package/dist/openai-transport-stream-CZSs3SIi.js +3427 -0
  633. package/dist/openresponses-http-BA1Shmj-.js +1175 -0
  634. package/dist/operations-DhgPih1F.js +805 -0
  635. package/dist/order-CaXafMPG.js +218 -0
  636. package/dist/outbound-attachment-BAp7DXDc.js +19 -0
  637. package/dist/param-readers-De-m2SoB.js +2 -0
  638. package/dist/payloads-Dg9aAEOC.js +256 -0
  639. package/dist/persistent-bindings.lifecycle-BkLOz501.js +2 -0
  640. package/dist/persistent-bindings.lifecycle-e2MLbBCo.js +85 -0
  641. package/dist/plugin-enabled-CGSENjXc.js +232 -0
  642. package/dist/plugin-install-BI9_bsVT.js +118 -0
  643. package/dist/plugin-install-an4V2iXO.js +2 -0
  644. package/dist/plugin-install-config-policy-C66Nss3D.js +169 -0
  645. package/dist/plugin-registration-DMerQktl.js +97 -0
  646. package/dist/plugin-registry-BZfdCw65.js +3 -0
  647. package/dist/plugin-registry-I1fegSdK.js +2 -0
  648. package/dist/plugin-runtime-B3XMLJka.js +102 -0
  649. package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
  650. package/dist/plugin-sdk/acp-binding-runtime.js +1 -1
  651. package/dist/plugin-sdk/acp-runtime-backend.js +1 -1
  652. package/dist/plugin-sdk/acp-runtime.js +2 -2
  653. package/dist/plugin-sdk/agent-harness-runtime.js +16 -16
  654. package/dist/plugin-sdk/agent-harness-task-runtime.js +4 -4
  655. package/dist/plugin-sdk/agent-harness.js +17 -17
  656. package/dist/plugin-sdk/agent-runtime.js +17 -17
  657. package/dist/plugin-sdk/agent-sessions.js +1 -1
  658. package/dist/plugin-sdk/approval-native-runtime.js +2 -2
  659. package/dist/plugin-sdk/approval-reaction-runtime.js +1 -1
  660. package/dist/plugin-sdk/approval-runtime.js +2 -2
  661. package/dist/plugin-sdk/bundled-channel-config-schema-BsOWCrJT.d.ts +3169 -0
  662. package/dist/plugin-sdk/bundled-channel-config-schema.d.ts +1 -1
  663. package/dist/plugin-sdk/channel-actions.js +2 -2
  664. package/dist/plugin-sdk/channel-config-schema-legacy.d.ts +1 -1
  665. package/dist/plugin-sdk/channel-core.js +2 -2
  666. package/dist/plugin-sdk/channel-envelope.js +1 -1
  667. package/dist/plugin-sdk/channel-inbound-roots.js +1 -1
  668. package/dist/plugin-sdk/channel-inbound.js +4 -4
  669. package/dist/plugin-sdk/channel-location.js +1 -1
  670. package/dist/plugin-sdk/channel-message-runtime.js +5 -5
  671. package/dist/plugin-sdk/channel-message.js +5 -5
  672. package/dist/plugin-sdk/channel-outbound.js +2 -2
  673. package/dist/plugin-sdk/channel-reply-options-runtime.js +1 -1
  674. package/dist/plugin-sdk/command-auth-native.js +2 -2
  675. package/dist/plugin-sdk/command-auth.js +4 -4
  676. package/dist/plugin-sdk/command-primitives-runtime.js +2 -2
  677. package/dist/plugin-sdk/command-status-runtime.js +1 -1
  678. package/dist/plugin-sdk/command-status.js +1 -1
  679. package/dist/plugin-sdk/compat.js +2 -2
  680. package/dist/plugin-sdk/config-mutation.js +2 -2
  681. package/dist/plugin-sdk/config-runtime.js +1 -1
  682. package/dist/plugin-sdk/config-schema.d.ts +2 -2
  683. package/dist/plugin-sdk/conversation-binding-runtime.js +1 -1
  684. package/dist/plugin-sdk/conversation-runtime.js +3 -3
  685. package/dist/plugin-sdk/core.js +3 -3
  686. package/dist/plugin-sdk/delivery-queue-runtime.js +1 -1
  687. package/dist/plugin-sdk/direct-dm.js +1 -1
  688. package/dist/plugin-sdk/discord.d.ts +1 -1
  689. package/dist/plugin-sdk/embedding-providers.js +2 -2
  690. package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
  691. package/dist/plugin-sdk/gateway-runtime.js +2 -2
  692. package/dist/plugin-sdk/health.js +1 -1
  693. package/dist/plugin-sdk/image-generation-core.js +3 -3
  694. package/dist/plugin-sdk/image-generation-runtime.js +1 -1
  695. package/dist/plugin-sdk/image-generation.js +2 -2
  696. package/dist/plugin-sdk/inbound-reply-dispatch.js +3 -3
  697. package/dist/plugin-sdk/index.js +1 -1
  698. package/dist/plugin-sdk/infra-runtime.js +3 -3
  699. package/dist/plugin-sdk/mattermost.js +1 -1
  700. package/dist/plugin-sdk/media-generation-runtime-shared.js +1 -1
  701. package/dist/plugin-sdk/media-generation-runtime.js +1 -1
  702. package/dist/plugin-sdk/media-runtime.js +7 -7
  703. package/dist/plugin-sdk/media-understanding-runtime.js +1 -1
  704. package/dist/plugin-sdk/media-understanding.js +2 -2
  705. package/dist/plugin-sdk/memory-core-host-engine-embeddings.js +4 -4
  706. package/dist/plugin-sdk/memory-core-host-engine-foundation.js +2 -2
  707. package/dist/plugin-sdk/memory-core-host-engine-qmd.js +2 -2
  708. package/dist/plugin-sdk/memory-core-host-engine-storage.js +6 -6
  709. package/dist/plugin-sdk/memory-core-host-runtime-cli.js +2 -2
  710. package/dist/plugin-sdk/memory-core-host-runtime-core.js +3 -3
  711. package/dist/plugin-sdk/memory-core-host-runtime-files.js +4 -4
  712. package/dist/plugin-sdk/memory-core.js +3 -3
  713. package/dist/plugin-sdk/memory-host-core.js +3 -3
  714. package/dist/plugin-sdk/memory-host-files.js +4 -4
  715. package/dist/plugin-sdk/memory-host-search.js +1 -1
  716. package/dist/plugin-sdk/models-provider-runtime.js +1 -1
  717. package/dist/plugin-sdk/music-generation-core.js +1 -1
  718. package/dist/plugin-sdk/native-command-registry.js +1 -1
  719. package/dist/plugin-sdk/outbound-media.js +2 -2
  720. package/dist/plugin-sdk/outbound-runtime.js +3 -3
  721. package/dist/plugin-sdk/param-readers.js +2 -2
  722. package/dist/plugin-sdk/plugin-runtime.js +2 -2
  723. package/dist/plugin-sdk/provider-auth-api-key.js +4 -4
  724. package/dist/plugin-sdk/provider-auth-login.js +1 -1
  725. package/dist/plugin-sdk/provider-auth-runtime.js +2 -2
  726. package/dist/plugin-sdk/provider-auth.js +6 -6
  727. package/dist/plugin-sdk/provider-catalog-runtime.js +2 -2
  728. package/dist/plugin-sdk/provider-entry.js +1 -1
  729. package/dist/plugin-sdk/provider-setup.js +1 -1
  730. package/dist/plugin-sdk/provider-stream-family.js +3 -3
  731. package/dist/plugin-sdk/provider-stream.js +2 -2
  732. package/dist/plugin-sdk/provider-transport-runtime.js +1 -1
  733. package/dist/plugin-sdk/provider-web-fetch.js +2 -2
  734. package/dist/plugin-sdk/provider-web-search.js +4 -4
  735. package/dist/plugin-sdk/realtime-bootstrap-context.js +2 -2
  736. package/dist/plugin-sdk/realtime-transcription.js +1 -1
  737. package/dist/plugin-sdk/realtime-voice.js +2 -2
  738. package/dist/plugin-sdk/reply-dispatch-runtime.js +1 -1
  739. package/dist/plugin-sdk/reply-runtime.js +6 -6
  740. package/dist/plugin-sdk/runtime-secret-resolution.js +2 -2
  741. package/dist/plugin-sdk/runtime.js +3 -3
  742. package/dist/plugin-sdk/self-hosted-provider-setup.js +1 -1
  743. package/dist/plugin-sdk/simple-completion-runtime.js +1 -1
  744. package/dist/plugin-sdk/speech-core.js +2 -2
  745. package/dist/plugin-sdk/speech.js +1 -1
  746. package/dist/plugin-sdk/tool-plugin.js +1 -1
  747. package/dist/plugin-sdk/transcripts.js +1 -1
  748. package/dist/plugin-sdk/tts-runtime.js +1 -1
  749. package/dist/plugin-sdk/video-generation-core.js +2 -2
  750. package/dist/plugin-sdk/video-generation-runtime.js +1 -1
  751. package/dist/plugin-sdk/web-media.js +3 -3
  752. package/dist/plugin-sdk/zalouser.js +1 -1
  753. package/dist/plugin-service-2XF6Lu_a.js +1249 -0
  754. package/dist/plugins/build-smoke-entry.js +2 -2
  755. package/dist/plugins/loader.js +1 -1
  756. package/dist/plugins/provider-discovery.runtime.js +1 -1
  757. package/dist/plugins/provider-runtime.runtime.js +1 -1
  758. package/dist/plugins/runtime/index.js +19 -19
  759. package/dist/plugins/tools.js +1 -1
  760. package/dist/plugins-authoring-command-CCX6tJwd.js +304 -0
  761. package/dist/plugins-cli-HX8nTV2h.js +63 -0
  762. package/dist/plugins-cli.runtime-BYn4VsLP.js +339 -0
  763. package/dist/plugins-cli.runtime.js +1 -1
  764. package/dist/plugins-command-helpers-ByuW-yNj.js +2 -0
  765. package/dist/plugins-command-helpers-DaaxGnCD.js +164 -0
  766. package/dist/plugins-inspect-command-C9NDk23X.js +248 -0
  767. package/dist/plugins-install-command-B0NfUxeA.js +993 -0
  768. package/dist/plugins-install-command-BmuScfLI.js +2 -0
  769. package/dist/plugins-install-persist-CfwO876P.js +252 -0
  770. package/dist/plugins-list-command-Bx8X908n.js +184 -0
  771. package/dist/plugins-uninstall-command-p6h44-Ft.js +118 -0
  772. package/dist/postinstall-inventory.json +862 -862
  773. package/dist/prepare.runtime-8DdQ4k9k.js +798 -0
  774. package/dist/prepare.runtime.js +1 -1
  775. package/dist/presentation-card-DeAf3jYW.js +164 -0
  776. package/dist/preview-warnings-BF7nlTo8.js +618 -0
  777. package/dist/profiles-DUhMLnqX.js +194 -0
  778. package/dist/program-C7f_U7fr.js +131 -0
  779. package/dist/provider-adapters-CWLwE9KS.js +104 -0
  780. package/dist/provider-api-key-auth-CshQbUPZ.js +117 -0
  781. package/dist/provider-api-key-auth.runtime-B64jPCKn.js +14 -0
  782. package/dist/provider-api-key-auth.runtime.js +1 -1
  783. package/dist/provider-auth-D-I3YLSn.js +281 -0
  784. package/dist/provider-auth-api-key-Bub0Rjak.js +5 -0
  785. package/dist/provider-auth-choice-DpNAEScm.js +311 -0
  786. package/dist/provider-auth-choice-helpers-Bof937LW.js +210 -0
  787. package/dist/provider-auth-choice.runtime-B3spikLY.js +18 -0
  788. package/dist/provider-auth-choice.runtime-vVgz7FKq.js +2 -0
  789. package/dist/provider-auth-choice.runtime.js +1 -1
  790. package/dist/provider-auth-guidance-DcCL0Q2U.js +2 -0
  791. package/dist/provider-auth-guidance-rWRMN4Jn.js +34 -0
  792. package/dist/provider-auth-helpers-Cp8L-Xha.js +177 -0
  793. package/dist/provider-auth-login.runtime-BJUzc4iH.js +156 -0
  794. package/dist/provider-auth-login.runtime.js +1 -1
  795. package/dist/provider-auth-runtime-DmcWtzbb.js +186 -0
  796. package/dist/provider-discovery-JyAJi97k.js +95 -0
  797. package/dist/provider-discovery.runtime-D_0WTYr8.js +290 -0
  798. package/dist/provider-discovery.runtime.js +1 -1
  799. package/dist/provider-dispatcher-C8Jt94Xl.js +22 -0
  800. package/dist/provider-dispatcher.runtime.js +1 -1
  801. package/dist/provider-entry-By0ggZuI.js +134 -0
  802. package/dist/provider-hook-runtime-B8AUbQxf.js +255 -0
  803. package/dist/provider-openai-codex-oauth-C9Mmnt7d.js +2 -0
  804. package/dist/provider-openai-codex-oauth-CH5Jg1vk.js +44 -0
  805. package/dist/provider-registration-C1zvaHQP.js +235 -0
  806. package/dist/provider-registry-B9diJyLv.js +31 -0
  807. package/dist/provider-registry-BXSxmPGA.js +61 -0
  808. package/dist/provider-registry-CoE-sxbq.js +61 -0
  809. package/dist/provider-registry-DLth_GdI.js +61 -0
  810. package/dist/provider-registry-J4LRd5Rg.js +36 -0
  811. package/dist/provider-runtime-B4cw16pt.js +3 -0
  812. package/dist/provider-runtime-DNNbfwOK.js +386 -0
  813. package/dist/provider-runtime.runtime-98mAe_ni.js +26 -0
  814. package/dist/provider-runtime.runtime.js +1 -1
  815. package/dist/provider-self-hosted-setup-Dysv2Kwt.js +373 -0
  816. package/dist/provider-stream-BLaC8bqO.js +1084 -0
  817. package/dist/provider-stream-Caa5YOx2.js +313 -0
  818. package/dist/provider-stream-family-CvvfxLyP.js +2 -0
  819. package/dist/provider-usage-CVNosTP3.js +71 -0
  820. package/dist/provider-usage-D2NudXbO.js +4 -0
  821. package/dist/provider-usage.load-DG6R3lkG.js +357 -0
  822. package/dist/provider-web-search-DmgTaxRU.js +58 -0
  823. package/dist/provider-wizard-Cw-5H3tX.js +125 -0
  824. package/dist/providers.runtime-DF0T9lFz.js +240 -0
  825. package/dist/providers.runtime-oM9Vn1wr.js +2 -0
  826. package/dist/providers.runtime.js +1 -1
  827. package/dist/proxy-BxGnVyJu.js +662 -0
  828. package/dist/public-artifacts-BMP9hZfh.js +7 -0
  829. package/dist/pw-ai-CD52qfYo.js +3064 -0
  830. package/dist/qmd-manager-BYbvU4YC.js +2040 -0
  831. package/dist/qr-cli-Btz2ZdO3.js +2 -0
  832. package/dist/qr-cli-eyTRwMm2.js +371 -0
  833. package/dist/qr-image-BCwiO6tL.js +2 -0
  834. package/dist/queue-CJRoTOBi.js +923 -0
  835. package/dist/read-file-ogB-HjbK.js +183 -0
  836. package/dist/register-service-commands-D_gQ3b6_.js +77 -0
  837. package/dist/register.agent-DXQLn-r0.js +152 -0
  838. package/dist/register.configure-FavQPGce.js +16 -0
  839. package/dist/register.crestodian-Cbfmnl6h.js +24 -0
  840. package/dist/register.maintenance-B8xODEMU.js +85 -0
  841. package/dist/register.message-B8PYgZ-j.js +404 -0
  842. package/dist/register.migrate-CieoN8zZ.js +106 -0
  843. package/dist/register.onboard-BqWDIDKH.js +115 -0
  844. package/dist/register.setup-CgeTBW4T.js +40 -0
  845. package/dist/register.status-health-sessions-C99aHa5h.js +293 -0
  846. package/dist/register.subclis-79SvyMFt.js +31 -0
  847. package/dist/register.subclis-CXrO8_TO.js +3 -0
  848. package/dist/register.subclis-core-GoXV1yMG.js +273 -0
  849. package/dist/rem-harness-laL5luQa.js +649 -0
  850. package/dist/repair-sequencing-DGY2mBg6.js +652 -0
  851. package/dist/reply-media-paths.runtime-BeWVPkgy.js +2 -0
  852. package/dist/reply-media-paths.runtime-rzAV_Kee.js +154 -0
  853. package/dist/reply-media-paths.runtime.js +1 -1
  854. package/dist/reply-payloads-D_JHMviC.js +79 -0
  855. package/dist/reply-payloads-dedupe-B9GGGaL-.js +176 -0
  856. package/dist/reply-payloads-dedupe.runtime--C3jHs9y.js +2 -0
  857. package/dist/reply-payloads-dedupe.runtime.js +1 -1
  858. package/dist/reply-timing-tracker-DPjlETUb.js +205 -0
  859. package/dist/reply-turn-admission-DdfIwcMK.js +2056 -0
  860. package/dist/reply.runtime-BC1HT67i.js +2 -0
  861. package/dist/reply.runtime.js +1 -1
  862. package/dist/reset-preserved-selection-Czd80hug.js +45 -0
  863. package/dist/resolve-COJFlAZT.js +106 -0
  864. package/dist/restart-B9GMMIZt.js +121 -0
  865. package/dist/result-fallback-classifier-By0Z6b8r.js +98 -0
  866. package/dist/root-help-Bp0kGaUZ.js +43 -0
  867. package/dist/route-CgG9Z7OI.js +475 -0
  868. package/dist/route-reply-D9_9oRg1.js +174 -0
  869. package/dist/route-reply.runtime-BwNl3h2m.js +2 -0
  870. package/dist/route-reply.runtime.js +1 -1
  871. package/dist/routes-Cz2NHUV4.js +2 -0
  872. package/dist/routes-DMo6Eacc.js +3701 -0
  873. package/dist/run-SFRSThMI.js +1162 -0
  874. package/dist/run-auth-profile.runtime-BxLM8m_2.js +2 -0
  875. package/dist/run-auth-profile.runtime.js +1 -1
  876. package/dist/run-command-Cd5iN7eN.js +2 -0
  877. package/dist/run-command-ah46O06U.js +23 -0
  878. package/dist/run-context-DGCQJldA.js +66 -0
  879. package/dist/run-context.runtime-CSBHDAd5.js +2 -0
  880. package/dist/run-context.runtime.js +1 -1
  881. package/dist/run-delivery.runtime-C9xoiZ3h.js +762 -0
  882. package/dist/run-delivery.runtime.js +1 -1
  883. package/dist/run-embedded.runtime-D8bz5vfV.js +4 -0
  884. package/dist/run-embedded.runtime.js +1 -1
  885. package/dist/run-execution-cli.runtime-BAa8KPn7.js +4 -0
  886. package/dist/run-execution-cli.runtime.js +1 -1
  887. package/dist/run-executor.runtime-CNnemqSa.js +330 -0
  888. package/dist/run-executor.runtime.js +1 -1
  889. package/dist/run-model-catalog.runtime-Dh7EghXr.js +2 -0
  890. package/dist/run-model-catalog.runtime.js +1 -1
  891. package/dist/run-session-state-cMlTFwT_.js +159 -0
  892. package/dist/run-subagent-registry.runtime-BgQU86-E.js +2 -0
  893. package/dist/run-subagent-registry.runtime.js +1 -1
  894. package/dist/runner-B3YXRJOB.js +704 -0
  895. package/dist/runner.entries-DMTKpRDP.js +1485 -0
  896. package/dist/runtime-BHReFHE2.js +2 -0
  897. package/dist/runtime-BiQZ6Usw.js +615 -0
  898. package/dist/runtime-CAeriu2O.js +10 -0
  899. package/dist/runtime-CAnCRCX3.js +224 -0
  900. package/dist/runtime-CV_2NqSY.js +300 -0
  901. package/dist/runtime-CmpnvXo3.js +245 -0
  902. package/dist/runtime-D2fci1Ey.js +2 -0
  903. package/dist/runtime-DAsYmYeA.js +3 -0
  904. package/dist/runtime-DeA45VKG.js +210 -0
  905. package/dist/runtime-DvkZ8tHI.js +436 -0
  906. package/dist/runtime-DxVUR2Xg.js +2 -0
  907. package/dist/runtime-api-B88le0UE.js +12 -0
  908. package/dist/runtime-channel-AubRWvnH.js +2 -0
  909. package/dist/runtime-channel-DdclSuEu.js +148 -0
  910. package/dist/runtime-config-collectors-DukTj2va.js +525 -0
  911. package/dist/runtime-embedded-agent.runtime-BpLweeFv.js +2 -0
  912. package/dist/runtime-embedded-agent.runtime.js +1 -1
  913. package/dist/runtime-internal-CaoUylZw.js +2 -0
  914. package/dist/runtime-llm.runtime-DlpqGc7S.js +307 -0
  915. package/dist/runtime-llm.runtime.js +1 -1
  916. package/dist/runtime-model-auth.runtime-CLAaWzxY.js +46 -0
  917. package/dist/runtime-model-auth.runtime-DxVvqRTd.js +2 -0
  918. package/dist/runtime-model-auth.runtime.js +1 -1
  919. package/dist/runtime-options-TTtN01-I.js +275 -0
  920. package/dist/runtime-plugin-ClqxJSbp.js +92 -0
  921. package/dist/runtime-plugins-Bq01wLXP.js +32 -0
  922. package/dist/runtime-plugins.runtime-cwCvl1TR.js +2 -0
  923. package/dist/runtime-plugins.runtime.js +1 -1
  924. package/dist/runtime-prepare.runtime-Cz_hV_k5.js +81 -0
  925. package/dist/runtime-prepare.runtime.js +1 -1
  926. package/dist/runtime-provider-QCJq90av.js +24 -0
  927. package/dist/runtime-provider-Wllc3jC6.js +2 -0
  928. package/dist/runtime-registry-loader-BM1mQBJr.js +2 -0
  929. package/dist/runtime-registry-loader-DzhYCt4s.js +117 -0
  930. package/dist/runtime-shared-BfqOW-Vb.js +365 -0
  931. package/dist/runtime-web-channel-plugin-BcVPgD14.js +204 -0
  932. package/dist/runtime-web-tools-fallback.runtime.js +1 -1
  933. package/dist/scan-ldbaD8jq.js +573 -0
  934. package/dist/sdk-security-runtime-Bxhq2O1G.js +86 -0
  935. package/dist/sdk-setup-tools-CsQM9pF0.js +8 -0
  936. package/dist/secrets-cli-DbpIf4-z.js +150 -0
  937. package/dist/security-cli-BK4Xpa6h.js +520 -0
  938. package/dist/selection-BXKik6Ps.js +3 -0
  939. package/dist/selection-D4O3gK3Q.js +18365 -0
  940. package/dist/send-DaoGIay5.js +1222 -0
  941. package/dist/send-DzNjJGJX.js +178 -0
  942. package/dist/send-f5w9krNS.js +711 -0
  943. package/dist/send-media-cOciBxcg.js +2072 -0
  944. package/dist/send-result-DMFwBuOl.js +141 -0
  945. package/dist/server-BoC1mxZ-.js +24 -0
  946. package/dist/server-DZnI6w5k.js +72 -0
  947. package/dist/server-aux-handlers-BwRdYdub.js +1347 -0
  948. package/dist/server-chat-Q95f4ywD.js +827 -0
  949. package/dist/server-close.runtime.js +3 -3
  950. package/dist/server-context-CnXNaarB.js +2 -0
  951. package/dist/server-context-DRBebo7Y.js +955 -0
  952. package/dist/server-cron-C0o0ZvqF.js +3173 -0
  953. package/dist/server-cron-CLeBvurR.js +2 -0
  954. package/dist/server-maintenance-CqHfTnFD.js +152 -0
  955. package/dist/server-methods-BmlBQJMD.js +497 -0
  956. package/dist/server-middleware-DJhnR6jl.js +122 -0
  957. package/dist/server-model-catalog-CoSSk_Gy.js +2 -0
  958. package/dist/server-model-catalog-D32oDTQp.js +73 -0
  959. package/dist/server-node-events-DX9a4etQ.js +597 -0
  960. package/dist/server-plugin-bootstrap-Vco-EpxY.js +71 -0
  961. package/dist/server-plugins-WBX2fZRp.js +435 -0
  962. package/dist/server-reload-handlers-DGJLH8bg.js +719 -0
  963. package/dist/server-restart-sentinel-Bvon7f8K.js +700 -0
  964. package/dist/server-runtime-services-BNcH4vhR.js +3 -0
  965. package/dist/server-runtime-services-BjcQG5y7.js +147 -0
  966. package/dist/server-runtime-subscriptions-W39HeyoT.js +67 -0
  967. package/dist/server-session-events-CO73dMU-.js +244 -0
  968. package/dist/server-session-key-D8V67lDk.js +2 -0
  969. package/dist/server-session-key-v-KYSmRS.js +75 -0
  970. package/dist/server-startup-config-u54lUdWN.js +305 -0
  971. package/dist/server-startup-early-Cy5kArJG.js +87 -0
  972. package/dist/server-startup-memory-DvINFAYn.js +72 -0
  973. package/dist/server-startup-plugins-CerpbOSQ.js +127 -0
  974. package/dist/server-startup-post-attach-COUCwhNa.js +793 -0
  975. package/dist/server-ws-runtime-BfznAnbI.js +374 -0
  976. package/dist/server.impl-dQXccj0z.js +2622 -0
  977. package/dist/session-cost-usage-Bs5yIOBH.js +1600 -0
  978. package/dist/session-kill-http-DVleb3RW.js +121 -0
  979. package/dist/session-log-runtime-OG7J4j9m.js +1258 -0
  980. package/dist/session-override-LIWl5a9T.js +134 -0
  981. package/dist/session-reset-model.runtime-BpnTi4sa.js +144 -0
  982. package/dist/session-reset-model.runtime.js +1 -1
  983. package/dist/session-reset-service-HA07zS8L.js +651 -0
  984. package/dist/session-status.runtime-D6_clH8l.js +2 -0
  985. package/dist/session-status.runtime.js +1 -1
  986. package/dist/session-store-Cj4Rh6qc.js +273 -0
  987. package/dist/session-store.runtime-DSCxACdZ.js +4 -0
  988. package/dist/session-store.runtime.js +1 -1
  989. package/dist/session-subagent-reactivation.runtime-CcwaHAxg.js +2 -0
  990. package/dist/session-subagent-reactivation.runtime.js +1 -1
  991. package/dist/session-tab-registry-C-9uI2Wi.js +551 -0
  992. package/dist/session-utils-BRtPESA4.js +1508 -0
  993. package/dist/sessions-Beltl3Ra.js +1917 -0
  994. package/dist/sessions-DR-X-j8D.js +316 -0
  995. package/dist/sessions-cleanup-CR1CFcJb.js +165 -0
  996. package/dist/sessions-history-http-CjyHWYEv.js +432 -0
  997. package/dist/sessions-patch-peSeltuF.js +401 -0
  998. package/dist/sessions-resolve-D9ULr95s.js +180 -0
  999. package/dist/sessions-table-Da6bua9d.js +161 -0
  1000. package/dist/sessions-uKpnhod0.js +12736 -0
  1001. package/dist/sessions.runtime-C1mVNaU3.js +2 -0
  1002. package/dist/sessions.runtime.js +1 -1
  1003. package/dist/set-DVj21EuB.js +31 -0
  1004. package/dist/set-image-JChDCaAP.js +17 -0
  1005. package/dist/setup-5I-zpID3.js +614 -0
  1006. package/dist/setup-CjtY6cli.js +2 -0
  1007. package/dist/setup-onboard-configure-help-fast-path-C5GcSuXb.js +64 -0
  1008. package/dist/setup.finalize-Bf10PNbl.js +586 -0
  1009. package/dist/setup.gateway-config-EH5Rvwzy.js +281 -0
  1010. package/dist/setup.migration-import-CoeV4Kc1.js +200 -0
  1011. package/dist/setup.migration-import-DFFGw4DI.js +2 -0
  1012. package/dist/setup.post-install-migration-DcQmWTE7.js +128 -0
  1013. package/dist/shared-BFSJZ6B3.js +212 -0
  1014. package/dist/shared-CVM-dYkO.js +5 -0
  1015. package/dist/shared-fvgcmCsj.js +71 -0
  1016. package/dist/simple-completion-runtime-C_TXe4M1.js +2 -0
  1017. package/dist/simple-completion-runtime-DREq-fcF.js +206 -0
  1018. package/dist/simple-completion-transport-DtD1fEvJ.js +83 -0
  1019. package/dist/snapshot-urls-B-wkwDI9.js +317 -0
  1020. package/dist/speech-core-KQg6oKcR.js +119 -0
  1021. package/dist/speech-provider-DfyLYitQ.js +171 -0
  1022. package/dist/speech-provider-oDvTumNW.js +227 -0
  1023. package/dist/speech-provider-yL-TQ3Em.js +233 -0
  1024. package/dist/stale-oauth-profile-shadows-CW11VYMM.js +2 -0
  1025. package/dist/stale-oauth-profile-shadows-DFl6Lyf1.js +186 -0
  1026. package/dist/standalone-runtime-registry-loader-BiponY-y.js +59 -0
  1027. package/dist/startup-context-PVXYM-X3.js +314 -0
  1028. package/dist/status-BA_0z83w.js +249 -0
  1029. package/dist/status-Bc7BGlRt.js +2 -0
  1030. package/dist/status-BwPWg9eQ.js +3 -0
  1031. package/dist/status-CLQ66eml.js +4 -0
  1032. package/dist/status-Ci2gChtY.js +466 -0
  1033. package/dist/status-CmtBWJEE.js +2 -0
  1034. package/dist/status-DdnMnPNs.js +73 -0
  1035. package/dist/status-all-BpTvkYrt.js +573 -0
  1036. package/dist/status-json-CizozZCr.js +15 -0
  1037. package/dist/status-json-command-FzKa2t6O.js +84 -0
  1038. package/dist/status-message-BHbnxwmt.js +495 -0
  1039. package/dist/status-message.runtime-Df5WBBAk.js +6 -0
  1040. package/dist/status-message.runtime.js +1 -1
  1041. package/dist/status-queue.runtime-CXnZV4Bj.js +2 -0
  1042. package/dist/status-queue.runtime.js +1 -1
  1043. package/dist/status-runtime-shared-D3Hz8WZ_.js +289 -0
  1044. package/dist/status-subagents.runtime-PoDdwwaw.js +32 -0
  1045. package/dist/status-subagents.runtime.js +1 -1
  1046. package/dist/status-text-DNxXSCuI.js +301 -0
  1047. package/dist/status.command-C_e9GcMg.js +2 -0
  1048. package/dist/status.command-DjVKDmt_.js +425 -0
  1049. package/dist/status.command.text-runtime-BeHlqL8b.js +15 -0
  1050. package/dist/status.runtime-h--fx9HY.js +2 -0
  1051. package/dist/status.scan-WyR8TeJz.js +72 -0
  1052. package/dist/status.scan-overview-CMzUAQMQ.js +460 -0
  1053. package/dist/status.scan.deps.runtime-1JTrdyHk.js +19 -0
  1054. package/dist/status.scan.deps.runtime.js +1 -1
  1055. package/dist/status.scan.fast-json-D2jw1wKO.js +163 -0
  1056. package/dist/status.scan.fast-json-DbN1KxJT.js +2 -0
  1057. package/dist/status.summary-6ZijZM1g.js +2 -0
  1058. package/dist/status.summary-CiCsChO-.js +276 -0
  1059. package/dist/store-CdBPITcg.js +2302 -0
  1060. package/dist/store-D0l2NCdn.js +3 -0
  1061. package/dist/stored-model-override-HEgnFh6b.js +79 -0
  1062. package/dist/subagent-announce-BUv_kA1W.js +353 -0
  1063. package/dist/subagent-announce-delivery-Ci2Y_p--.js +1369 -0
  1064. package/dist/subagent-control-BM3vNgsQ.js +492 -0
  1065. package/dist/subagent-control.runtime-Df3pVQL9.js +3 -0
  1066. package/dist/subagent-control.runtime.js +1 -1
  1067. package/dist/subagent-hooks-CN2fLez2.js +2 -0
  1068. package/dist/subagent-hooks-CeOmTJBf.js +230 -0
  1069. package/dist/subagent-hooks-api-Cfe4DAT9.js +23 -0
  1070. package/dist/subagent-registry-B9RPAXUs.js +2627 -0
  1071. package/dist/subagent-registry-C7tedtVB.js +3 -0
  1072. package/dist/subagent-registry.runtime.js +2 -2
  1073. package/dist/subagent-session-cleanup-y0ijZ-LQ.js +390 -0
  1074. package/dist/system-DVtrOGbV.js +111 -0
  1075. package/dist/system-prompt-config-BVmrcmmr.js +918 -0
  1076. package/dist/talk-CrdgqTCl.js +2454 -0
  1077. package/dist/target-id-CrUyi-Uq.js +107 -0
  1078. package/dist/targets-KZ2ezPwx.js +267 -0
  1079. package/dist/targets.runtime-iZ8KdQ1C.js +2 -0
  1080. package/dist/targets.runtime.js +1 -1
  1081. package/dist/task-executor-893pMqzn.js +349 -0
  1082. package/dist/task-owner-access-DC7MKz3n.js +74 -0
  1083. package/dist/task-registry-control.runtime.js +2 -2
  1084. package/dist/task-registry-delivery-runtime-YGMOyqP5.js +2 -0
  1085. package/dist/task-registry-uaYJfgXF.js +2362 -0
  1086. package/dist/task-registry.maintenance-Dx0m2NYh.js +2 -0
  1087. package/dist/task-registry.maintenance-gApg-XOt.js +764 -0
  1088. package/dist/task-status-access-CFhD_ieY.js +18 -0
  1089. package/dist/tasks-B_Qoz38D.js +153 -0
  1090. package/dist/tasks-DtV85zJT.js +548 -0
  1091. package/dist/tasks-audit-system-Con3yYnm.js +210 -0
  1092. package/dist/tasks-json-BM3pauZl.js +73 -0
  1093. package/dist/tavily-web-search-provider.runtime-Cmyyc5kX.js +112 -0
  1094. package/dist/tavily-web-search-provider.runtime.js +1 -1
  1095. package/dist/text-report-CKxmVmt5.js +695 -0
  1096. package/dist/text-transforms.runtime-DVwVsBRS.js +113 -0
  1097. package/dist/text-transforms.runtime.js +1 -1
  1098. package/dist/thread-bindings-B6UEVp9q.js +228 -0
  1099. package/dist/tool-KOZc7TIF.js +143 -0
  1100. package/dist/tool-dispatch-Ca4z2GEr.js +155 -0
  1101. package/dist/tool-images-CzDwHeDR.js +247 -0
  1102. package/dist/tool-plugin-BvQBJ2gU.js +93 -0
  1103. package/dist/tool-resolution-Ddxl6tjh.js +153 -0
  1104. package/dist/tool-result-truncation-BSKuIhd5.js +498 -0
  1105. package/dist/tool-schema-nB27q-vb.js +40 -0
  1106. package/dist/tool-schema-projection-COrMarLR.js +215 -0
  1107. package/dist/tool-split-BjPHBFrv.js +323 -0
  1108. package/dist/tools-CV40BWkc.js +901 -0
  1109. package/dist/tools-catalog-5stC7W2V.js +156 -0
  1110. package/dist/tools-effective-BVjqz2FV.js +442 -0
  1111. package/dist/tools-effective-inventory-esPY5jRB.js +379 -0
  1112. package/dist/tools-invoke-Czk_NM9G.js +51 -0
  1113. package/dist/tools-invoke-http-D7PbsODz.js +68 -0
  1114. package/dist/tools-invoke-shared-CzrEn0Dm.js +200 -0
  1115. package/dist/tools-rSjgf61B.js +579 -0
  1116. package/dist/tools.runtime-DiChCSGI.js +5 -0
  1117. package/dist/tools.runtime.js +1 -1
  1118. package/dist/transcript-rewrite-4IQefjvK.js +688 -0
  1119. package/dist/transcripts-tool-BXTS8tE5.js +2 -0
  1120. package/dist/transcripts-tool-CeWGgz5k.js +656 -0
  1121. package/dist/tts-BS8EeM8p.js +2 -0
  1122. package/dist/tts-BlTZjsaE.js +194 -0
  1123. package/dist/tts-runtime-BfRdJDyY.js +1337 -0
  1124. package/dist/tts-vRSvSw-t.js +3 -0
  1125. package/dist/tts.runtime-ChBnVkNt.js +3 -0
  1126. package/dist/tts.runtime-CmVCUbzq.js +2 -0
  1127. package/dist/tts.runtime.js +1 -1
  1128. package/dist/tui-BoQVBgWB.js +4860 -0
  1129. package/dist/tui-DBYK9BeQ.js +2 -0
  1130. package/dist/tui-backend-X0NI7rAv.js +256 -0
  1131. package/dist/tui-cli-BpUtjV38.js +40 -0
  1132. package/dist/typing-policy-CBwyAQh4.js +199 -0
  1133. package/dist/usage-Bl-tgGx-.js +623 -0
  1134. package/dist/usage-Cj_ektBl.js +1113 -0
  1135. package/dist/usage-format-DWO9ckX3.js +394 -0
  1136. package/dist/usage-format-DnCIXsqG.js +2 -0
  1137. package/dist/video-generation-provider-B7ib4AeI.js +297 -0
  1138. package/dist/video-generation-provider-CXQ6fqJx.js +64 -0
  1139. package/dist/video-generation-provider-DXjl05T6.js +325 -0
  1140. package/dist/video-generation-provider-Db8h71jA.js +77 -0
  1141. package/dist/web-fetch/runtime.js +1 -1
  1142. package/dist/web-fetch-providers.runtime-DhPkYjgB.js +41 -0
  1143. package/dist/web-fetch-providers.runtime.js +1 -1
  1144. package/dist/web-guarded-fetch-BdsVyvDS.js +58 -0
  1145. package/dist/web-guarded-fetch-CJR3JCwT.js +2 -0
  1146. package/dist/web-media-BzzQJAwk.js +4 -0
  1147. package/dist/web-media-DViZjNBa.js +2 -0
  1148. package/dist/web-media-inHawfBU.js +651 -0
  1149. package/dist/web-provider-runtime-shared-Cc08Lt9p.js +142 -0
  1150. package/dist/web-search-provider-common-CtbtmUL-.js +252 -0
  1151. package/dist/web-search-providers.runtime-B7x_cRVn.js +41 -0
  1152. package/dist/web-search-providers.runtime.js +1 -1
  1153. package/dist/zod-schema.core-Cuz0lz6m.d.ts +166 -0
  1154. package/package.json +1 -1
  1155. package/dist/abort-CR0u3VsG.js +0 -277
  1156. package/dist/abort.runtime-CXUxanGg.js +0 -2
  1157. package/dist/accounts-BxBaquAf.js +0 -423
  1158. package/dist/accounts-vQjpoqEe.js +0 -2
  1159. package/dist/acp-spawn-2elSoS0E.js +0 -1286
  1160. package/dist/acp-spawn-DtKOHNO1.js +0 -2
  1161. package/dist/acp-stateful-target-driver-BqeA5j0h.js +0 -89
  1162. package/dist/action-info-B8NotHFw.js +0 -75
  1163. package/dist/active-runtime-registry-BO9mpPuB.js +0 -62
  1164. package/dist/active-tool-schema-warnings-C8vGj5FX.js +0 -105
  1165. package/dist/active-tool-schema-warnings-CVeFJuWI.js +0 -2
  1166. package/dist/agent-BgEaDMdp.js +0 -1825
  1167. package/dist/agent-_V5GbziF.js +0 -2
  1168. package/dist/agent-bundle-lsp-runtime-0jBcDEHh.js +0 -389
  1169. package/dist/agent-bundle-lsp-runtime-CQ6dZLs_.js +0 -2
  1170. package/dist/agent-bundle-mcp-materialize-Cu6JqMzC.js +0 -124
  1171. package/dist/agent-bundle-mcp-tools-BGL827cn.js +0 -3
  1172. package/dist/agent-command-CMJdGr16.js +0 -1435
  1173. package/dist/agent-delivery-DMu1MOeq.js +0 -117
  1174. package/dist/agent-harness-runtime-BKSW2E1O.js +0 -207
  1175. package/dist/agent-model-discovery-Cu4YL31r.js +0 -3
  1176. package/dist/agent-model-discovery-DdmVtkZo.js +0 -238
  1177. package/dist/agent-runner-utils-DXNDhwkI.js +0 -267
  1178. package/dist/agent-runner.runtime-Cym4Odfd.js +0 -3784
  1179. package/dist/agent-runtime-BkbhevY3.js +0 -199
  1180. package/dist/agent-runtime-label-DNP06p76.js +0 -30
  1181. package/dist/agent-runtime-metadata-JaTKc7mA.js +0 -53
  1182. package/dist/agent-tool-result-middleware-loader-FbZE0Qpk.js +0 -55
  1183. package/dist/agent-tools-Nwh8BlKX.js +0 -2506
  1184. package/dist/agent-tools.before-tool-call-BwY-FYFl.js +0 -1274
  1185. package/dist/agent-tools.before-tool-call-DwUmYhE3.js +0 -2
  1186. package/dist/agent-u5NDWrw9.js +0 -3
  1187. package/dist/agent-via-gateway-DMtOMwZa.js +0 -486
  1188. package/dist/agent-wait-dedupe-CLuKbI_7.js +0 -180
  1189. package/dist/agents-CiW7UEuB.js +0 -632
  1190. package/dist/agents.command-shared-CXGSQscb.js +0 -16
  1191. package/dist/agents.commands.add-BYBrZDXD.js +0 -304
  1192. package/dist/agents.commands.bind-nfg3AlVc.js +0 -265
  1193. package/dist/agents.commands.delete-pRj6vIrn.js +0 -128
  1194. package/dist/agents.commands.identity-Ci2PnDDl.js +0 -143
  1195. package/dist/agents.commands.list-Crj3BmqB.js +0 -235
  1196. package/dist/aliases-BFspFx3-.js +0 -97
  1197. package/dist/api-BiXhdPle.js +0 -3
  1198. package/dist/api-Cptkjys5.js +0 -6
  1199. package/dist/api-D3vT4ZVi.js +0 -2
  1200. package/dist/api-key-rotation-CQgW8LEx.js +0 -167
  1201. package/dist/app-registration-YW276fZC.js +0 -194
  1202. package/dist/apply-BRxKrOiK.js +0 -510
  1203. package/dist/apply-D0fWCa-U.js +0 -2
  1204. package/dist/apply-DIR8y0ZA.js +0 -2
  1205. package/dist/apply-DNUIV0Lt.js +0 -416
  1206. package/dist/apply-Dux9jI7f.js +0 -544
  1207. package/dist/approval-native-helpers-BMT-5X47.js +0 -398
  1208. package/dist/artifacts-CTrtIv9T.js +0 -368
  1209. package/dist/assistant-ClfI8Kho.js +0 -291
  1210. package/dist/attachment-normalize-DAW86mZY.js +0 -213
  1211. package/dist/attempt-execution-DTi2UfET.js +0 -584
  1212. package/dist/attempt-execution.helpers-DrX0QToi.js +0 -969
  1213. package/dist/attempt-execution.runtime-BCmAxwGy.js +0 -3
  1214. package/dist/attempt.prompt-helpers-BE6kGRtT.js +0 -543
  1215. package/dist/attempt.tool-run-context-J9O2yjbV.js +0 -1240
  1216. package/dist/audio-preflight.runtime-D3GXVYBI.js +0 -7
  1217. package/dist/audit-5T20D-xm.js +0 -1108
  1218. package/dist/audit-CWuV5GlP.js +0 -477
  1219. package/dist/audit.nondeep.runtime-DeYwRDYj.js +0 -1416
  1220. package/dist/audit.runtime-rUlvK4Rb.js +0 -7
  1221. package/dist/auth-DunUSatn.js +0 -567
  1222. package/dist/auth-choice--eBzca8Y.js +0 -3
  1223. package/dist/auth-choice-DJ9jsFUq.js +0 -400
  1224. package/dist/auth-choice-_pLkIdVh.js +0 -110
  1225. package/dist/auth-choice.apply.api-providers-CALcopRP.js +0 -2
  1226. package/dist/auth-choice.apply.api-providers-Dzzm1snk.js +0 -34
  1227. package/dist/auth-choice.plugin-providers.runtime-BHKTeZZc.js +0 -11
  1228. package/dist/auth-health-Cs4OjiF2.js +0 -219
  1229. package/dist/auth-list-bwJ4QDs0.js +0 -115
  1230. package/dist/auth-order-BoHN3Dc_.js +0 -105
  1231. package/dist/auth-profiles-BOLncVgy.js +0 -73
  1232. package/dist/auth-profiles-BiQRkULt.js +0 -14
  1233. package/dist/backend-config-B5yga5ay.js +0 -259
  1234. package/dist/bash-tools-BWvldguc.js +0 -3
  1235. package/dist/bash-tools-DEAAO5np.js +0 -3497
  1236. package/dist/binding-routing-BbtHmU_l.js +0 -113
  1237. package/dist/binding-targets-DSNv3-QA.js +0 -121
  1238. package/dist/bootstrap-files-DD8V2dLe.js +0 -202
  1239. package/dist/bootstrap-files-_6u1uJW2.js +0 -3
  1240. package/dist/bridge-server-v1-XPnAZ.js +0 -113
  1241. package/dist/browser-cli-CnpuO4KR.js +0 -230
  1242. package/dist/browser-cli-DPbIn8SK.js +0 -2
  1243. package/dist/browser-cli-actions-input-DoGR6LI-.js +0 -522
  1244. package/dist/browser-cli-actions-observe-CYMpgmtF.js +0 -81
  1245. package/dist/browser-cli-debug-ChJjSq-h.js +0 -137
  1246. package/dist/browser-cli-inspect-Bbci-WPG.js +0 -117
  1247. package/dist/browser-cli-manage-Bnscjb7b.js +0 -446
  1248. package/dist/browser-cli-resize-D1MJdvZI.js +0 -32
  1249. package/dist/browser-cli-shared-BCQwqz51.js +0 -69
  1250. package/dist/browser-cli-state-BWkPsvUg.js +0 -371
  1251. package/dist/browser-control-auth-CEP_ExeC.js +0 -2
  1252. package/dist/browser-profiles-SvnqnHVN.js +0 -2
  1253. package/dist/browser-runtime-0mRxjFpp.js +0 -389
  1254. package/dist/browser-tool.schema--CLR3nDv.js +0 -132
  1255. package/dist/btw-command-DV6HfrRV.js +0 -18
  1256. package/dist/build-DiRmljCi.js +0 -261
  1257. package/dist/bundled-channel-config-schema-Bte--ZlY.d.ts +0 -3168
  1258. package/dist/capability-cli-ATfwTYFe.js +0 -1809
  1259. package/dist/capability-provider-runtime-l3nnLGvn.js +0 -346
  1260. package/dist/cdp.helpers-IIuc0KGS.js +0 -637
  1261. package/dist/channel-CzTD2ouI.js +0 -2309
  1262. package/dist/channel-actions-B5Yk5Axf.js +0 -46
  1263. package/dist/channel-bootstrap.runtime-C9F-Pq1o.js +0 -38
  1264. package/dist/channel-bootstrap.runtime-TPyY5Ngv.js +0 -2
  1265. package/dist/channel-core-XMZJ-ZGF.js +0 -5
  1266. package/dist/channel-inbound-DvqkKmiH.js +0 -121
  1267. package/dist/channel-message-CnJ4vUyt.js +0 -12
  1268. package/dist/channel-outbound-BhefGAqY.js +0 -436
  1269. package/dist/channel-plugin-resolution-BiaJ8aRa.js +0 -2
  1270. package/dist/channel-plugin-resolution-D_CxkMVc.js +0 -135
  1271. package/dist/channel-resolution-DzI28gIM.js +0 -46
  1272. package/dist/channel-selection-CLFO4-eQ.js +0 -171
  1273. package/dist/channel-selection.runtime-Beb2-bMH.js +0 -2
  1274. package/dist/channel.runtime-By5T5eGw.js +0 -697
  1275. package/dist/channels-BrRY9Mag.js +0 -1004
  1276. package/dist/channels-cli-CF--e2RU.js +0 -331
  1277. package/dist/chat-BTMPilpx.js +0 -2940
  1278. package/dist/chat-DnC7XCWK.js +0 -3
  1279. package/dist/chrome-C3_dN9jE.js +0 -1517
  1280. package/dist/chrome-mcp-5jjDHIgn.js +0 -864
  1281. package/dist/chrome-mcp-DFAa-WzK.js +0 -2
  1282. package/dist/claude-live-session-BUPeOzLE.js +0 -1338
  1283. package/dist/claude-live-session-Bprgmr1-.js +0 -2
  1284. package/dist/clawbot-cli-5UVkLT1Y.js +0 -9
  1285. package/dist/cli-6a6sMEUB.js +0 -2
  1286. package/dist/cli-COCN9B5e.js +0 -2
  1287. package/dist/cli-CpI4dBXy.js +0 -141
  1288. package/dist/cli-YLx-ekdH.js +0 -293
  1289. package/dist/cli-backends.runtime-CsBjr7ag.js +0 -7
  1290. package/dist/cli-compaction-Bh0oMwUa.js +0 -363
  1291. package/dist/cli-registry-loader-DDbaAJgY.js +0 -2
  1292. package/dist/cli-registry-loader-xc2Ah8S4.js +0 -193
  1293. package/dist/cli-runner-BfSrIn-9.js +0 -597
  1294. package/dist/cli-runner-D_FAjNbR.js +0 -2
  1295. package/dist/cli-runner.runtime-BJetQDu1.js +0 -3
  1296. package/dist/cli-runner.runtime-BKJQkc7C.js +0 -4
  1297. package/dist/cli-session-Cy3IeH0g.js +0 -119
  1298. package/dist/cli.runtime-BpOz0s3N.js +0 -1276
  1299. package/dist/codex-native-web-search-BDtKRV3F.js +0 -4
  1300. package/dist/codex-native-web-search-C0TrfoMX.js +0 -20
  1301. package/dist/codex-native-web-search-core-CzlK1GfN.js +0 -106
  1302. package/dist/command-auth-CFnvdYX2.js +0 -135
  1303. package/dist/command-config-resolution-B_86rG8v.js +0 -2
  1304. package/dist/command-config-resolution-BbadcA2M.js +0 -25
  1305. package/dist/command-config-resolution.runtime-B_86rG8v.js +0 -2
  1306. package/dist/command-execution-startup-Rrwwdg_5.js +0 -90
  1307. package/dist/command-primitives-runtime-C9bTt5IV.js +0 -3
  1308. package/dist/command-registry-CbpdQKmu.js +0 -9
  1309. package/dist/command-registry-Dw-XC_Zk.js +0 -4
  1310. package/dist/command-registry-core-rvEDki6p.js +0 -114
  1311. package/dist/command-secret-gateway-BX6BIiFn.js +0 -589
  1312. package/dist/command-secret-targets-DCzlTkb5.js +0 -2
  1313. package/dist/command-status-builders-DIsZN9aY.js +0 -147
  1314. package/dist/command-status.runtime-C2x4yMRd.js +0 -90
  1315. package/dist/commands-FYCxWqIx.js +0 -161
  1316. package/dist/commands-compact.runtime-BTMQfx1k.js +0 -10
  1317. package/dist/commands-core.runtime-CuNLz2wm.js +0 -2
  1318. package/dist/commands-handlers.runtime-DyNuPOmY.js +0 -6327
  1319. package/dist/commands-models-s7BRmLQh.js +0 -448
  1320. package/dist/commands-registry-BxEq-3UJ.js +0 -195
  1321. package/dist/commands-registry.runtime-CbXW33S_.js +0 -4
  1322. package/dist/commands-status-BRJMba4h.js +0 -16
  1323. package/dist/commands-status-DCXEwlSF.js +0 -3
  1324. package/dist/commands-status.runtime-DCXEwlSF.js +0 -3
  1325. package/dist/commands-subagents-control.runtime-CduLQJFD.js +0 -2
  1326. package/dist/commands-system-prompt-B3LD8CDs.js +0 -161
  1327. package/dist/commands-system-prompt-DPsXTqOQ.js +0 -2
  1328. package/dist/commands.runtime-3sVz8Qgo.js +0 -175
  1329. package/dist/common-CZvBLb3w.js +0 -286
  1330. package/dist/compact-DxU_9XEc.js +0 -1165
  1331. package/dist/compact.runtime-CqQTypVl.js +0 -12
  1332. package/dist/compaction-planning-DArTi9SN.js +0 -202
  1333. package/dist/completion-cli-CiKl5HhI.js +0 -393
  1334. package/dist/config--yllOaSC.js +0 -374
  1335. package/dist/config-Yt5UcD91.js +0 -610
  1336. package/dist/config-cli-BeXS3R6k.js +0 -1703
  1337. package/dist/config-mutation-cQeWhUqy.js +0 -5
  1338. package/dist/config-mutations-Cg04LH_S.js +0 -161
  1339. package/dist/config-utils-Dhq_UKMC.js +0 -141
  1340. package/dist/config-validation-BANohTKD.js +0 -33
  1341. package/dist/configure-CWxhlx9G.js +0 -771
  1342. package/dist/configure-Jejkc6dn.js +0 -3
  1343. package/dist/configure.commands-BYy1bz8G.js +0 -2
  1344. package/dist/configure.commands-C3hDvZse.js +0 -1253
  1345. package/dist/context-DptQ59DZ.js +0 -248
  1346. package/dist/context-_ZshNBhD.js +0 -2
  1347. package/dist/context-engine-host-compat-C_eflvRw.js +0 -2
  1348. package/dist/context-engine-host-compat-s15Pu845.js +0 -280
  1349. package/dist/context-engine-lifecycle-COHFLnj4.js +0 -627
  1350. package/dist/control-auth-CQJpLoIb.js +0 -114
  1351. package/dist/control-service-BFSgA0Py.js +0 -40
  1352. package/dist/control-service-D7GZv-GS.js +0 -3
  1353. package/dist/control-ui/assets/activity-CCu43qU8.js +0 -124
  1354. package/dist/control-ui/assets/agents-DCvsB0yO.js +0 -1030
  1355. package/dist/control-ui/assets/channels-CpM2j5xT.js +0 -120
  1356. package/dist/control-ui/assets/cron-CLXNfwYa.js +0 -1016
  1357. package/dist/control-ui/assets/debug-BcJ34lrC.js +0 -97
  1358. package/dist/control-ui/assets/index-CuBn2YpX.js +0 -7214
  1359. package/dist/control-ui/assets/instances-Bu6NM_Hs.js +0 -57
  1360. package/dist/control-ui/assets/nodes-Bd1WzVLK.js +0 -444
  1361. package/dist/control-ui/assets/sessions-C2r8pbt7.js +0 -425
  1362. package/dist/control-ui/assets/skills-DIjn93ee.js +0 -362
  1363. package/dist/control-ui/assets/workboard-CHb0if1l.js +0 -402
  1364. package/dist/control-ui-ChfTPXZo.js +0 -750
  1365. package/dist/conversation-label-generator-CTfnInQF.js +0 -72
  1366. package/dist/conversation-runtime-B7oAN9Tq.js +0 -31
  1367. package/dist/core-api-CBD0dvTQ.js +0 -5
  1368. package/dist/core-api-ClCm_yM8.js +0 -2
  1369. package/dist/core-wuoxL08a.js +0 -284
  1370. package/dist/crestodian--iYeGB8u.js +0 -55
  1371. package/dist/cron-D2SzQyqo.js +0 -453
  1372. package/dist/daemon-install-B6CAkU3V.js +0 -66
  1373. package/dist/daemon-install-auth-profiles-store.runtime-Cpt5LSD6.js +0 -2
  1374. package/dist/dashboard-ChYOQjM2.js +0 -263
  1375. package/dist/defaults-CCopehWw.js +0 -130
  1376. package/dist/defaults-H4kBp17N.js +0 -3
  1377. package/dist/defaults.constants-CjB9HP6f.js +0 -76
  1378. package/dist/deliver-BzPhWO_F.js +0 -3
  1379. package/dist/deliver-DGyKH3Qi.js +0 -1399
  1380. package/dist/deliver-runtime-Ca2kcQoZ.js +0 -2
  1381. package/dist/delivery-outbound.runtime-D7ycPxY-.js +0 -7
  1382. package/dist/delivery-queue-CnLv30ko.js +0 -863
  1383. package/dist/delivery-queue-CuaDjNMh.js +0 -2
  1384. package/dist/delivery-queue-runtime-DO2vqOIJ.js +0 -16
  1385. package/dist/delivery-target.runtime-QcBVk_j8.js +0 -45
  1386. package/dist/delivery.runtime-L09v4tys.js +0 -470
  1387. package/dist/detached-task-runtime-BqU7YXYT.js +0 -86
  1388. package/dist/diagnostics-T-Hk_Qzi.js +0 -168
  1389. package/dist/dialogue-C0VnTMMn.js +0 -37
  1390. package/dist/direct-dm-BWn67tDD.js +0 -81
  1391. package/dist/directive-handling.defaults-DO6Snm4_.js +0 -22
  1392. package/dist/directive-handling.fast-lane-BemYRfPn.js +0 -70
  1393. package/dist/directive-handling.impl-BMVh1pMh.js +0 -823
  1394. package/dist/directive-handling.impl-vr4MsYbt.js +0 -2
  1395. package/dist/directive-handling.model-selection-DegP9exp.js +0 -122
  1396. package/dist/directive-handling.persist.runtime-BUdU6_zm.js +0 -274
  1397. package/dist/directives-1xk_ZcMf.js +0 -319
  1398. package/dist/directory-cli-D83WEjEG.js +0 -239
  1399. package/dist/dispatch-Ck2tvRYH.js +0 -2057
  1400. package/dist/dispatch-acp-GdaHNdvf.js +0 -1102
  1401. package/dist/dispatch-acp-manager.runtime-BGSrJqrW.js +0 -3
  1402. package/dist/dispatch-acp-media.runtime-DQ8dYQh8.js +0 -4
  1403. package/dist/dispatch-acp-transcript.runtime-CsJZGhnu.js +0 -40
  1404. package/dist/dispatch-acp-tts.runtime-Bo-QxKgx.js +0 -3
  1405. package/dist/dispatch-acp.runtime-C_u7sGcQ.js +0 -18
  1406. package/dist/dispatcher-GtuYO6Ni.js +0 -106
  1407. package/dist/doctor-B2qP9g8d.js +0 -760
  1408. package/dist/doctor-D9wCez5t.js +0 -6
  1409. package/dist/doctor-auth-XnseqtS7.js +0 -216
  1410. package/dist/doctor-auth-flat-profiles-B6cL-TiJ.js +0 -516
  1411. package/dist/doctor-auth-flat-profiles-Birb7qIk.js +0 -2
  1412. package/dist/doctor-auth-legacy-oauth-CXO3OtyG.js +0 -48
  1413. package/dist/doctor-auth-oauth-sidecar-BSgQPbcS.js +0 -177
  1414. package/dist/doctor-auth-oauth-sidecar-CzzyNwxc.js +0 -2
  1415. package/dist/doctor-bootstrap-size-BlVcO5D6.js +0 -57
  1416. package/dist/doctor-claude-cli-_MTVnCQ-.js +0 -150
  1417. package/dist/doctor-config-flow-0kxzjUjK.js +0 -1819
  1418. package/dist/doctor-core-checks-C_g9REOd.js +0 -666
  1419. package/dist/doctor-core-checks-CahzmM1L.js +0 -2
  1420. package/dist/doctor-core-checks.runtime-Bi_oTiTZ.js +0 -278
  1421. package/dist/doctor-gateway-daemon-flow-UAIWsI9w.js +0 -349
  1422. package/dist/doctor-gateway-services-BiMEGiw_.js +0 -465
  1423. package/dist/doctor-health-C69GVfMl.js +0 -65
  1424. package/dist/doctor-health-contributions-Bz19QhI4.js +0 -874
  1425. package/dist/doctor-lint-BVW4E6Qf.js +0 -95
  1426. package/dist/doctor-memory-search-D2PWzDCY.js +0 -407
  1427. package/dist/doctor-state-integrity-DuJIszQj.js +0 -1257
  1428. package/dist/doctor-tool-result-cap-advice-Dpn4zNH3.js +0 -27
  1429. package/dist/doctor-workspace-status-nW9TcIWi.js +0 -76
  1430. package/dist/dreaming-CcOWzGN5.js +0 -523
  1431. package/dist/dreaming-command-sxm3FQGb.js +0 -101
  1432. package/dist/dreaming-narrative-BSRwiUPL.js +0 -2
  1433. package/dist/dreaming-narrative-BskwmYdC.js +0 -721
  1434. package/dist/dreaming-phases-BuHjGyPw.js +0 -2
  1435. package/dist/dreaming-phases-ChVT8Ovk.js +0 -1162
  1436. package/dist/drive-C_u5W4ln.js +0 -899
  1437. package/dist/echo-transcript-tnZWH4EO.js +0 -52
  1438. package/dist/effective-tool-policy-CeHdL2D7.js +0 -89
  1439. package/dist/embedded-agent-CGULn3lb.js +0 -4
  1440. package/dist/embedded-agent-DZTa1YiK.js +0 -4074
  1441. package/dist/embedded-agent-helpers-B65K9o55.js +0 -6
  1442. package/dist/embedded-agent-helpers-BPXCvWBb.js +0 -1037
  1443. package/dist/embedded-agent.runtime-TfBgXcUV.js +0 -4
  1444. package/dist/embedded-backend-BAaFwayA.js +0 -744
  1445. package/dist/embedded-gateway-stub.runtime-CNyrjvgT.js +0 -12
  1446. package/dist/embedding-provider-runtime-EnkHdROJ.js +0 -86
  1447. package/dist/embedding-providers-CDkDb0kv.js +0 -2
  1448. package/dist/embeddings-http-ClIu4_mP.js +0 -222
  1449. package/dist/engine-qmd-DZRiT9i4.js +0 -708
  1450. package/dist/engine-storage-BEqlN8TR.js +0 -203
  1451. package/dist/errors-Co8auIlv.js +0 -2
  1452. package/dist/exec-approval-forwarder.runtime-C7QvfWQ6.js +0 -4
  1453. package/dist/exec-approval-session-target-ChuH1nXL.js +0 -177
  1454. package/dist/exec-auto-reviewer-Bm7380HF.js +0 -2
  1455. package/dist/exec-auto-reviewer-BrrdGleK.js +0 -241
  1456. package/dist/execute.runtime-B-8jUqDB.js +0 -579
  1457. package/dist/external-cli-auth-selection-0BxmRUps.js +0 -113
  1458. package/dist/extra-params-BgyvpEpv.js +0 -615
  1459. package/dist/fallback-notice-state-BXk_kRWM.js +0 -15
  1460. package/dist/fallbacks-CPdVRP81.js +0 -31
  1461. package/dist/fallbacks-shared-CSGf1oaf.js +0 -116
  1462. package/dist/fengming-runtime-NUA51sEw.js +0 -33
  1463. package/dist/fengming-runtime-config-CIZ-SHPt.js +0 -2
  1464. package/dist/fengming-runtime-memory-CIZ-SHPt.js +0 -2
  1465. package/dist/fengming-runtime-session-CIZ-SHPt.js +0 -2
  1466. package/dist/fengming-tools-MvRSt0JA.js +0 -12221
  1467. package/dist/flows-BocRit8D.js +0 -189
  1468. package/dist/fs-utils-DSXeBcjj.js +0 -9
  1469. package/dist/gateway-BCrUxrVw.js +0 -133
  1470. package/dist/gateway-cli-B8bXBd_L.js +0 -443
  1471. package/dist/gateway-install-token-pngTMc-f.js +0 -136
  1472. package/dist/gateway-method-runtime-ueZTz7WH.js +0 -21
  1473. package/dist/gateway-runtime-DbsoThML.js +0 -23
  1474. package/dist/get-reply-DUuaxcBz.js +0 -5198
  1475. package/dist/get-reply-from-config.runtime-B4Dgs3Hg.js +0 -2
  1476. package/dist/github-copilot-token-7AfRRF7J.js +0 -2
  1477. package/dist/health-7Yq5zpoZ.js +0 -3
  1478. package/dist/health-DlZqxm2f.js +0 -621
  1479. package/dist/health-DxesUuur.js +0 -111
  1480. package/dist/health-state-BMG8kOby.js +0 -106
  1481. package/dist/heartbeat-runner-Bq7A_Cjm.js +0 -5
  1482. package/dist/heartbeat-runner-DVwbVyft.js +0 -1930
  1483. package/dist/heartbeat-runner.runtime-DQ2NPXMD.js +0 -3
  1484. package/dist/helpers-PCu2RivJ.js +0 -406
  1485. package/dist/hook-helpers-DLEnCRO7.js +0 -44
  1486. package/dist/hooks-Bv-otcl7.js +0 -536
  1487. package/dist/hooks-cli-C5ve0nzF.js +0 -465
  1488. package/dist/http-endpoint-helpers-w2SagsQz.js +0 -37
  1489. package/dist/http-utils-CVvn0ZA-.js +0 -98
  1490. package/dist/image-BeixBis4.js +0 -385
  1491. package/dist/image-fallbacks-CPbmIMn9.js +0 -31
  1492. package/dist/image-generation-core.auth.runtime-Co38iRxQ.js +0 -2
  1493. package/dist/image-generation-provider-BA4Ar91S.js +0 -152
  1494. package/dist/image-runtime-7ZsfioS1.js +0 -9
  1495. package/dist/image-tool.helpers-upjA3ksB.js +0 -150
  1496. package/dist/images-ChLi1Uog.js +0 -2
  1497. package/dist/images-nB0XAnTa.js +0 -416
  1498. package/dist/inbound-reply-dispatch-DglobJ8j.js +0 -2
  1499. package/dist/inbound-reply-dispatch-QKOgNx-m.js +0 -147
  1500. package/dist/index-AZzJCgph.d.ts +0 -1497
  1501. package/dist/infra-runtime-CGD3RE_2.js +0 -32
  1502. package/dist/init-poVZDCAM.js +0 -59
  1503. package/dist/install-Dn9oPGmU.js +0 -262
  1504. package/dist/install.runtime-D5sllsjl.js +0 -2
  1505. package/dist/internal-CnOL_Roa.js +0 -399
  1506. package/dist/isolated-agent-CNw6E3F0.js +0 -1097
  1507. package/dist/isolated-agent-DjkHhEyR.js +0 -2
  1508. package/dist/kernel-B5Y5IQ-A.js +0 -3
  1509. package/dist/kernel-CMuO4VJy.js +0 -979
  1510. package/dist/kimi-web-search-provider.runtime-V4m_MHsk.js +0 -307
  1511. package/dist/library-B-1EZjtY.js +0 -45
  1512. package/dist/lifecycle-B-5gEZ7O.js +0 -570
  1513. package/dist/lifecycle-Bzh5Jo09.js +0 -2
  1514. package/dist/lifecycle-DvbcJYMl.js +0 -355
  1515. package/dist/lifecycle.runtime-Bzh5Jo09.js +0 -2
  1516. package/dist/list-B4xSHRdU.js +0 -2
  1517. package/dist/list-BnhZHpxx.js +0 -207
  1518. package/dist/list.list-command-DAz-Ws_6.js +0 -429
  1519. package/dist/list.model-row-DtdX9KDu.js +0 -39
  1520. package/dist/list.probe-CY6lxq51.js +0 -2
  1521. package/dist/list.probe-DPuE1GOH.js +0 -451
  1522. package/dist/list.provider-catalog-BHc9WXI6.js +0 -211
  1523. package/dist/list.provider-catalog-CFbrroys.js +0 -2
  1524. package/dist/list.registry-load-C1_sr3gb.js +0 -152
  1525. package/dist/list.row-sources-BMtHc9oi.js +0 -474
  1526. package/dist/list.source-plan-Dth72qPP.js +0 -81
  1527. package/dist/list.status-command-BXCnEq8Q.js +0 -815
  1528. package/dist/live-model-switch-Dxav22vq.js +0 -119
  1529. package/dist/llm-slug-generator-6o8RXL11.js +0 -78
  1530. package/dist/load-config-EF3n0Dyo.js +0 -27
  1531. package/dist/load-context-CI_ogQt_.js +0 -82
  1532. package/dist/loader-DtwEzpp-.js +0 -7008
  1533. package/dist/local-dispatch.runtime-21liE3rA.js +0 -10
  1534. package/dist/main-session-restart-recovery-D1g62iJ5.js +0 -2
  1535. package/dist/main-session-restart-recovery-v2I9CEXi.js +0 -389
  1536. package/dist/managed-image-attachments-BEl5qfCT.js +0 -616
  1537. package/dist/managed-image-attachments-D5KqX2Qy.js +0 -2
  1538. package/dist/manager-DZc3xiNq.js +0 -2314
  1539. package/dist/manager-Vf3vLTGe.js +0 -3737
  1540. package/dist/mcp-http-BaJoPKF9.js +0 -583
  1541. package/dist/mcp-http-CpEaJIGJ.js +0 -2
  1542. package/dist/media-runtime-DtP_Ff8m.js +0 -391
  1543. package/dist/media-services-CXYbyIIp.js +0 -416
  1544. package/dist/media-understanding-DvTIsIyr.js +0 -87
  1545. package/dist/media-understanding-provider-DBBAvuwG.js +0 -13
  1546. package/dist/media-understanding-provider-DOf_uZrx.js +0 -70
  1547. package/dist/media-understanding-provider-DdRfNh9h.js +0 -69
  1548. package/dist/media-understanding-provider-mqpQDt8V.js +0 -29
  1549. package/dist/memory-BNk25Hi6.js +0 -437
  1550. package/dist/memory-core-host-engine-embeddings-XsK5xS70.js +0 -667
  1551. package/dist/memory-core-host-engine-foundation-BYkoOLXl.js +0 -15
  1552. package/dist/memory-core-host-engine-qmd-0JuUCKCK.js +0 -2
  1553. package/dist/memory-core-host-engine-storage-MCFGjDwW.js +0 -2
  1554. package/dist/memory-core-host-runtime-cli-fVGH65E8.js +0 -10
  1555. package/dist/memory-core-host-runtime-core-JtXIAdlM.js +0 -12
  1556. package/dist/memory-core-host-runtime-files-BGw_ypoN.js +0 -4
  1557. package/dist/memory-embedding-provider-runtime-3UBzs4sx.js +0 -36
  1558. package/dist/memory-host-core-Y_O5V-mu.js +0 -78
  1559. package/dist/memory-host-search.runtime-B4TzyvmR.js +0 -2
  1560. package/dist/memory-runtime-9kEPAeKV.js +0 -2
  1561. package/dist/memory-runtime-BU4t85uu.js +0 -57
  1562. package/dist/memory-search-CVX--mSz.js +0 -235
  1563. package/dist/message-BVXoNpWP.js +0 -284
  1564. package/dist/message-HaiKqj0A.js +0 -2
  1565. package/dist/message-action-runner-Chwzn02r.js +0 -2
  1566. package/dist/message-action-runner-tEEliptt.js +0 -1922
  1567. package/dist/message-handler-CHDS_NF-.js +0 -1806
  1568. package/dist/metadata-registry-loader-Croa1pgR.js +0 -22
  1569. package/dist/metadata-registry-loader-w0p86vis.js +0 -2
  1570. package/dist/migrate-CPCZJ4H5.js +0 -2
  1571. package/dist/migrate-CUj6m6Cx.js +0 -458
  1572. package/dist/migration-provider-runtime-4r4WGtf2.js +0 -2
  1573. package/dist/migration-provider-runtime-TxrH_mM7.js +0 -68
  1574. package/dist/minimax-web-search-provider.runtime-Dr2GJiWj.js +0 -148
  1575. package/dist/model-BQSouNOa.js +0 -2
  1576. package/dist/model-CAk0bcuO.js +0 -1302
  1577. package/dist/model-auth-BF7w9Fiv.js +0 -705
  1578. package/dist/model-auth-label-r729wcPk.js +0 -67
  1579. package/dist/model-auth-us8b_D5d.js +0 -6
  1580. package/dist/model-catalog-BGykBGxx.js +0 -434
  1581. package/dist/model-catalog-BVXrqFbI.js +0 -3
  1582. package/dist/model-catalog-visibility-Bsup46vy.js +0 -76
  1583. package/dist/model-config.helpers-wzD1EEfE.js +0 -95
  1584. package/dist/model-context-tokens-DrIU9eJc.js +0 -572
  1585. package/dist/model-fallback-GySPjr3J.js +0 -1288
  1586. package/dist/model-fallback-auth.runtime-Dg_Jmguu.js +0 -5
  1587. package/dist/model-picker-BI6jXOjt.js +0 -3
  1588. package/dist/model-picker-DYyJHhfH.js +0 -1135
  1589. package/dist/model-picker-visibility-D_IMZfxd.js +0 -22
  1590. package/dist/model-picker.runtime-B70kQMyc.js +0 -48
  1591. package/dist/model-pricing-cache-CSpUDzSt.js +0 -856
  1592. package/dist/model-pricing-cache-dkPwTUVJ.js +0 -3
  1593. package/dist/model-pricing-cache-state-C6shoEWy.js +0 -83
  1594. package/dist/model-provider-auth-BfZHbTaj.js +0 -2
  1595. package/dist/model-provider-auth-CPCBWvqL.js +0 -375
  1596. package/dist/model-runtime-aliases-DUzusc9_.js +0 -133
  1597. package/dist/model-selection-8UzO5mgF.js +0 -254
  1598. package/dist/model-selection-Cb7azWw1.js +0 -7
  1599. package/dist/model-selection-jDYEo0WI.js +0 -352
  1600. package/dist/model-selection.runtime-D_yHZLbs.js +0 -7
  1601. package/dist/models-BxA2IU3W.js +0 -57
  1602. package/dist/models-auth-status-yG7yyRcv.js +0 -280
  1603. package/dist/models-cli-DUt4uiMH.js +0 -257
  1604. package/dist/models-config-B5bkuh6A.js +0 -1189
  1605. package/dist/models-config-Xj8vG_x2.js +0 -2
  1606. package/dist/models-config.providers.secrets-DNBB440Z.js +0 -2
  1607. package/dist/models-config.providers.secrets-DNIQlBSE.js +0 -382
  1608. package/dist/models-http-DMILRsry.js +0 -88
  1609. package/dist/monitor-2_c2Ttjf.js +0 -1024
  1610. package/dist/monitor-7tD_FE_5.js +0 -60
  1611. package/dist/monitor.account-D0F9tnWD.js +0 -5382
  1612. package/dist/music-generation-provider-3ykPaUwR.js +0 -308
  1613. package/dist/native-hook-relay-BJKHIhWd.js +0 -1378
  1614. package/dist/native-hook-relay-V8Kappw1.js +0 -19
  1615. package/dist/node-cli-BLVyQ93e.js +0 -2806
  1616. package/dist/node-command-policy-B0ezpI_O.js +0 -295
  1617. package/dist/nodes-DnWH_15m.js +0 -3
  1618. package/dist/nodes-RkB4ZmP6.js +0 -1483
  1619. package/dist/nodes-cli-upwPs91b.js +0 -960
  1620. package/dist/nodes-pending--sojaxpI.js +0 -211
  1621. package/dist/nodes-utils-Yks_uDZK.js +0 -85
  1622. package/dist/oauth-CQN2efEy.js +0 -207
  1623. package/dist/oauth-DApi3OI9.js +0 -746
  1624. package/dist/oauth-DkUWBub2.js +0 -852
  1625. package/dist/onboard-CiQSBSrz.js +0 -768
  1626. package/dist/onboard-channels-DaWYXiLv.js +0 -1534
  1627. package/dist/onboard-channels-DnwM2_IL.js +0 -2
  1628. package/dist/onboard-custom-BQPckD0V.js +0 -3
  1629. package/dist/onboard-custom-config-BmbThk2-.js +0 -422
  1630. package/dist/onboard-custom-xInFj1Rs.js +0 -280
  1631. package/dist/onboard-search-DSfmthe5.js +0 -412
  1632. package/dist/openai-compat-errors-VR4SN1MV.js +0 -136
  1633. package/dist/openai-http-DV95ynPi.js +0 -836
  1634. package/dist/openai-transport-stream-BwpzqR-b.js +0 -3427
  1635. package/dist/openresponses-http-DPchx8IC.js +0 -1175
  1636. package/dist/operations-f9R8j-r9.js +0 -805
  1637. package/dist/order-BQx8mNGZ.js +0 -218
  1638. package/dist/outbound-attachment-C4yojK6p.js +0 -19
  1639. package/dist/param-readers-BIXyd5la.js +0 -2
  1640. package/dist/payloads-DrY1bKyF.js +0 -256
  1641. package/dist/persistent-bindings.lifecycle-BiPN7luW.js +0 -85
  1642. package/dist/persistent-bindings.lifecycle-X3wfan2Z.js +0 -2
  1643. package/dist/plugin-enabled-CqsBObeO.js +0 -232
  1644. package/dist/plugin-install-CfB1_kpX.js +0 -118
  1645. package/dist/plugin-install-DzMraXHH.js +0 -2
  1646. package/dist/plugin-install-config-policy-BD_elPNg.js +0 -169
  1647. package/dist/plugin-registration-Dy58ncPf.js +0 -97
  1648. package/dist/plugin-registry-BlmODeop.js +0 -3
  1649. package/dist/plugin-registry-k5OK18l5.js +0 -2
  1650. package/dist/plugin-runtime-B3t53CKr.js +0 -102
  1651. package/dist/plugin-sdk/bundled-channel-config-schema-UtIBjviA.d.ts +0 -3169
  1652. package/dist/plugin-service-sKF4gWFm.js +0 -1249
  1653. package/dist/plugins-authoring-command-I72k2cuv.js +0 -304
  1654. package/dist/plugins-cli-DMQRbPsU.js +0 -63
  1655. package/dist/plugins-cli.runtime-CvDuKFJj.js +0 -339
  1656. package/dist/plugins-command-helpers-C5WMM4bk.js +0 -164
  1657. package/dist/plugins-command-helpers-DDt_pMQ4.js +0 -2
  1658. package/dist/plugins-inspect-command-ka7Hpld3.js +0 -248
  1659. package/dist/plugins-install-command-BHSgof-_.js +0 -2
  1660. package/dist/plugins-install-command-t5caX9q_.js +0 -993
  1661. package/dist/plugins-install-persist-Bah1m3x7.js +0 -252
  1662. package/dist/plugins-list-command-BXLWwXHM.js +0 -184
  1663. package/dist/plugins-uninstall-command-C_3m6CrW.js +0 -118
  1664. package/dist/prepare.runtime-COZaHg5E.js +0 -798
  1665. package/dist/presentation-card-CciJv4ru.js +0 -164
  1666. package/dist/preview-warnings-L4VuEOyB.js +0 -618
  1667. package/dist/profiles-CM2xoUYX.js +0 -194
  1668. package/dist/program-B-4C7bC-.js +0 -131
  1669. package/dist/provider-adapters-Eh8mS2Fd.js +0 -104
  1670. package/dist/provider-api-key-auth-DTh2cbmS.js +0 -117
  1671. package/dist/provider-api-key-auth.runtime-DrTYYfxK.js +0 -14
  1672. package/dist/provider-auth-Bnaijzmv.js +0 -281
  1673. package/dist/provider-auth-api-key-CNP8o5E7.js +0 -5
  1674. package/dist/provider-auth-choice-Devw4sQf.js +0 -311
  1675. package/dist/provider-auth-choice-helpers-DmVudRp6.js +0 -210
  1676. package/dist/provider-auth-choice.runtime-C337IQ3W.js +0 -2
  1677. package/dist/provider-auth-choice.runtime-DqGYalFo.js +0 -18
  1678. package/dist/provider-auth-guidance-Bk4WV6Lg.js +0 -2
  1679. package/dist/provider-auth-guidance-C7NCKuKn.js +0 -34
  1680. package/dist/provider-auth-helpers-r7mC8I5l.js +0 -177
  1681. package/dist/provider-auth-login.runtime-BFJgAAS6.js +0 -156
  1682. package/dist/provider-auth-runtime-BiLPGiMW.js +0 -186
  1683. package/dist/provider-discovery-uxRmAIf_.js +0 -95
  1684. package/dist/provider-discovery.runtime-mwbSivDS.js +0 -290
  1685. package/dist/provider-dispatcher-CtKWj3r-.js +0 -22
  1686. package/dist/provider-entry-DjACqdrB.js +0 -134
  1687. package/dist/provider-hook-runtime-CpJsM7Dk.js +0 -255
  1688. package/dist/provider-openai-codex-oauth-DWGmVUYg.js +0 -2
  1689. package/dist/provider-openai-codex-oauth-ctxd00JW.js +0 -44
  1690. package/dist/provider-registration-l8EX4voM.js +0 -235
  1691. package/dist/provider-registry-BgIQXJle.js +0 -31
  1692. package/dist/provider-registry-CVuzobHN.js +0 -36
  1693. package/dist/provider-registry-DmdDbSQs.js +0 -61
  1694. package/dist/provider-registry-LqtLqheu.js +0 -61
  1695. package/dist/provider-registry-pTYVjODc.js +0 -61
  1696. package/dist/provider-runtime-BQZSuC9l.js +0 -3
  1697. package/dist/provider-runtime-D9Q-7VuO.js +0 -386
  1698. package/dist/provider-runtime.runtime-C6YZ8YI0.js +0 -26
  1699. package/dist/provider-self-hosted-setup-BIAD2ISe.js +0 -373
  1700. package/dist/provider-stream-DScdaoRo.js +0 -313
  1701. package/dist/provider-stream-PE0IxmpZ.js +0 -1084
  1702. package/dist/provider-stream-family-S2fhlydZ.js +0 -2
  1703. package/dist/provider-usage-DVKHMF6l.js +0 -4
  1704. package/dist/provider-usage-EEjx1av0.js +0 -71
  1705. package/dist/provider-usage.load-Cu11xbrw.js +0 -357
  1706. package/dist/provider-web-search-Dbk7MO-1.js +0 -58
  1707. package/dist/provider-wizard-DS2Xb2eu.js +0 -125
  1708. package/dist/providers.runtime-BPhGcupv.js +0 -240
  1709. package/dist/providers.runtime-DoylK-ht.js +0 -2
  1710. package/dist/proxy-BxacG0p3.js +0 -662
  1711. package/dist/public-artifacts-Dq3y7bBv.js +0 -7
  1712. package/dist/pw-ai-DlSSqerW.js +0 -3064
  1713. package/dist/qmd-manager-B_SG-ejE.js +0 -2040
  1714. package/dist/qr-cli-CT-sE_j9.js +0 -2
  1715. package/dist/qr-cli-DPlDCXJQ.js +0 -371
  1716. package/dist/qr-image--VmmvuDB.js +0 -2
  1717. package/dist/queue-Be2Y7PcO.js +0 -923
  1718. package/dist/read-file-hhemkDfq.js +0 -183
  1719. package/dist/register-service-commands-CeVpCQU3.js +0 -77
  1720. package/dist/register.agent-JLsb-giw.js +0 -152
  1721. package/dist/register.configure-CP0Q-ost.js +0 -16
  1722. package/dist/register.crestodian-CBXyXEix.js +0 -24
  1723. package/dist/register.maintenance-DGIPQ2Vo.js +0 -85
  1724. package/dist/register.message-BBQwz0Ld.js +0 -404
  1725. package/dist/register.migrate-CkgNlvLD.js +0 -106
  1726. package/dist/register.onboard-CS9gRK0c.js +0 -115
  1727. package/dist/register.setup-DhqDOer9.js +0 -40
  1728. package/dist/register.status-health-sessions-CiwQN_lw.js +0 -293
  1729. package/dist/register.subclis-86Md7P0P.js +0 -3
  1730. package/dist/register.subclis-CTVI8zvZ.js +0 -31
  1731. package/dist/register.subclis-core-Cy4AnRCu.js +0 -273
  1732. package/dist/rem-harness-vSsq3HiK.js +0 -649
  1733. package/dist/repair-sequencing-SHADYdcA.js +0 -652
  1734. package/dist/reply-media-paths.runtime-Bf5nxPuP.js +0 -154
  1735. package/dist/reply-media-paths.runtime-sLsMpKGO.js +0 -2
  1736. package/dist/reply-payloads-CJ3w8rSA.js +0 -79
  1737. package/dist/reply-payloads-dedupe-DDFXWCVR.js +0 -176
  1738. package/dist/reply-payloads-dedupe.runtime-DbXPzKmG.js +0 -2
  1739. package/dist/reply-timing-tracker-DjVIBsVb.js +0 -205
  1740. package/dist/reply-turn-admission-nEW5QbY5.js +0 -2056
  1741. package/dist/reply.runtime-B4Dgs3Hg.js +0 -2
  1742. package/dist/reset-preserved-selection-CVD1yeVC.js +0 -45
  1743. package/dist/resolve-DidlinMh.js +0 -106
  1744. package/dist/restart-DzTrO95c.js +0 -121
  1745. package/dist/result-fallback-classifier-BqsFUDvP.js +0 -98
  1746. package/dist/root-help-QGs0dCCN.js +0 -43
  1747. package/dist/route-B3R-uzFG.js +0 -475
  1748. package/dist/route-reply-CdfhgIoY.js +0 -174
  1749. package/dist/route-reply.runtime-DwuU2WjH.js +0 -2
  1750. package/dist/routes-ChXmJocl.js +0 -3701
  1751. package/dist/routes-D-ZF4AdA.js +0 -2
  1752. package/dist/run-ClmVDTET.js +0 -1162
  1753. package/dist/run-auth-profile.runtime-CTxrwz0y.js +0 -2
  1754. package/dist/run-command-CqZJQ0Im.js +0 -2
  1755. package/dist/run-command-GClW75NL.js +0 -23
  1756. package/dist/run-context-BOdGeRg5.js +0 -66
  1757. package/dist/run-context.runtime-CwuKVYPj.js +0 -2
  1758. package/dist/run-delivery.runtime-BQ39dm34.js +0 -762
  1759. package/dist/run-embedded.runtime-e1K4Bt1_.js +0 -4
  1760. package/dist/run-execution-cli.runtime-Cjrgt4cV.js +0 -4
  1761. package/dist/run-executor.runtime-C2JE6JGb.js +0 -330
  1762. package/dist/run-model-catalog.runtime-DkrLKopr.js +0 -2
  1763. package/dist/run-session-state-C5YdQs7o.js +0 -159
  1764. package/dist/run-subagent-registry.runtime-Dl_lXi6y.js +0 -2
  1765. package/dist/runner-CNGHdaIg.js +0 -704
  1766. package/dist/runner.entries-dckPkeld.js +0 -1485
  1767. package/dist/runtime-9LxcVCyw.js +0 -615
  1768. package/dist/runtime-BCOtBS5G.js +0 -3
  1769. package/dist/runtime-C-pgjoJr.js +0 -210
  1770. package/dist/runtime-CyF0vJXG.js +0 -10
  1771. package/dist/runtime-D-7lMvGV.js +0 -2
  1772. package/dist/runtime-D17OmF9G.js +0 -224
  1773. package/dist/runtime-D6SweufG.js +0 -245
  1774. package/dist/runtime-DVAM7AFd.js +0 -2
  1775. package/dist/runtime-DX2ClrP-.js +0 -436
  1776. package/dist/runtime-FOOWuiYX.js +0 -300
  1777. package/dist/runtime-api-B0F0JsV1.js +0 -12
  1778. package/dist/runtime-cREKSBYC.js +0 -2
  1779. package/dist/runtime-channel-BmD4hoCR.js +0 -148
  1780. package/dist/runtime-channel-BsebQSPL.js +0 -2
  1781. package/dist/runtime-config-collectors-BjYeQ0Tk.js +0 -525
  1782. package/dist/runtime-embedded-agent.runtime-A4r23Bn8.js +0 -2
  1783. package/dist/runtime-internal-DkV-EMTK.js +0 -2
  1784. package/dist/runtime-llm.runtime-BQKNnuRc.js +0 -307
  1785. package/dist/runtime-model-auth.runtime-BbGqHVM5.js +0 -2
  1786. package/dist/runtime-model-auth.runtime-rtJH4LBB.js +0 -46
  1787. package/dist/runtime-options-B0EGb1Wq.js +0 -275
  1788. package/dist/runtime-plugin-Bdqm44bH.js +0 -92
  1789. package/dist/runtime-plugins-rZk1eAK_.js +0 -32
  1790. package/dist/runtime-plugins.runtime-DApiYzny.js +0 -2
  1791. package/dist/runtime-prepare.runtime-DWxvnbyY.js +0 -81
  1792. package/dist/runtime-provider-B0slPjtk.js +0 -2
  1793. package/dist/runtime-provider-DLgupOKt.js +0 -24
  1794. package/dist/runtime-registry-loader-Cf2HuMjd.js +0 -2
  1795. package/dist/runtime-registry-loader-DLzDrA7e.js +0 -117
  1796. package/dist/runtime-shared-Bg-OiD4u.js +0 -365
  1797. package/dist/runtime-web-channel-plugin-DrMjRaqi.js +0 -204
  1798. package/dist/scan-DA7Oqxuv.js +0 -573
  1799. package/dist/sdk-security-runtime-WjOaCbga.js +0 -86
  1800. package/dist/sdk-setup-tools-DaYT6_jD.js +0 -8
  1801. package/dist/secrets-cli-fJQ0geWO.js +0 -150
  1802. package/dist/security-cli-CJMwGp8U.js +0 -520
  1803. package/dist/selection-BNwLQzqJ.js +0 -3
  1804. package/dist/selection-Cj-l80pO.js +0 -18365
  1805. package/dist/send-DstYcrDW.js +0 -711
  1806. package/dist/send-aTxtLkJm.js +0 -178
  1807. package/dist/send-media-OG5Gd31l.js +0 -2072
  1808. package/dist/send-qwDMMnM6.js +0 -1222
  1809. package/dist/send-result-BWRKr16H.js +0 -141
  1810. package/dist/server-CMtA1S09.js +0 -24
  1811. package/dist/server-DIRaYiiH.js +0 -72
  1812. package/dist/server-aux-handlers-BRO-9-Jf.js +0 -1347
  1813. package/dist/server-chat-0J_ke0ph.js +0 -827
  1814. package/dist/server-context-DWOSX34k.js +0 -2
  1815. package/dist/server-context-R7MFLFdI.js +0 -955
  1816. package/dist/server-cron-2FuFg2j8.js +0 -2
  1817. package/dist/server-cron-ChPAVQtg.js +0 -3173
  1818. package/dist/server-maintenance-ZvS7Id6T.js +0 -152
  1819. package/dist/server-methods-DSbhPK3k.js +0 -497
  1820. package/dist/server-middleware-CYxFU-e5.js +0 -122
  1821. package/dist/server-model-catalog-B22UhmRr.js +0 -73
  1822. package/dist/server-model-catalog-BJIHPP3P.js +0 -2
  1823. package/dist/server-node-events-tNWJnXQM.js +0 -597
  1824. package/dist/server-plugin-bootstrap-Ccu97zi8.js +0 -71
  1825. package/dist/server-plugins-ByXwKPnj.js +0 -435
  1826. package/dist/server-reload-handlers-ConGiT9Q.js +0 -719
  1827. package/dist/server-restart-sentinel-mPHo61LL.js +0 -700
  1828. package/dist/server-runtime-services-BR1icaUW.js +0 -3
  1829. package/dist/server-runtime-services-Bx8n34dj.js +0 -147
  1830. package/dist/server-runtime-subscriptions-CZklTkRG.js +0 -67
  1831. package/dist/server-session-events-DxdiZYM2.js +0 -244
  1832. package/dist/server-session-key-CYvLslFO.js +0 -75
  1833. package/dist/server-session-key-D9GQut81.js +0 -2
  1834. package/dist/server-startup-config-Byb0vR8j.js +0 -305
  1835. package/dist/server-startup-early-a65fHTQS.js +0 -87
  1836. package/dist/server-startup-memory-ClwzC9jX.js +0 -72
  1837. package/dist/server-startup-plugins-CaBj0Nt2.js +0 -127
  1838. package/dist/server-startup-post-attach-B7TcxkmO.js +0 -793
  1839. package/dist/server-ws-runtime-Cxk_CqMr.js +0 -374
  1840. package/dist/server.impl-CQ6dnx43.js +0 -2622
  1841. package/dist/session-cost-usage-GsYDNvka.js +0 -1600
  1842. package/dist/session-kill-http-CKkxZhhd.js +0 -121
  1843. package/dist/session-log-runtime-Bwc2Oijk.js +0 -1258
  1844. package/dist/session-override-CWbKiXiC.js +0 -134
  1845. package/dist/session-reset-model.runtime-CDFMjwWA.js +0 -144
  1846. package/dist/session-reset-service-SE0aK4cw.js +0 -651
  1847. package/dist/session-status.runtime-Df89I7Fk.js +0 -2
  1848. package/dist/session-store-RkvjJPMQ.js +0 -273
  1849. package/dist/session-store.runtime-C7P5asx7.js +0 -4
  1850. package/dist/session-subagent-reactivation.runtime-BhGUZG1Z.js +0 -2
  1851. package/dist/session-tab-registry-9rSuQ0Yz.js +0 -551
  1852. package/dist/session-utils-De8TIM0h.js +0 -1508
  1853. package/dist/sessions-6b9a00Tl.js +0 -1917
  1854. package/dist/sessions-CEPHczjC.js +0 -316
  1855. package/dist/sessions-CEojHc8b.js +0 -12736
  1856. package/dist/sessions-cleanup-BkG7_sq9.js +0 -165
  1857. package/dist/sessions-history-http-BjJEfjJa.js +0 -432
  1858. package/dist/sessions-patch-PwG5sknc.js +0 -401
  1859. package/dist/sessions-resolve-CSIrd_fi.js +0 -180
  1860. package/dist/sessions-table-8CbU7jXa.js +0 -161
  1861. package/dist/sessions.runtime-BYHMD0M7.js +0 -2
  1862. package/dist/set-BJDpe28W.js +0 -31
  1863. package/dist/set-image-CwTFx7PX.js +0 -17
  1864. package/dist/setup-B6LmeIms.js +0 -614
  1865. package/dist/setup-B_zxHfYu.js +0 -2
  1866. package/dist/setup-onboard-configure-help-fast-path-Bck3SKEH.js +0 -64
  1867. package/dist/setup.finalize-CmLYX-Rf.js +0 -586
  1868. package/dist/setup.gateway-config-H_89Msro.js +0 -281
  1869. package/dist/setup.migration-import-DVzyUjX6.js +0 -2
  1870. package/dist/setup.migration-import-DmJpqoqf.js +0 -200
  1871. package/dist/setup.post-install-migration-WPFWKXXg.js +0 -128
  1872. package/dist/shared-CUhu8NTs.js +0 -5
  1873. package/dist/shared-D-BN2JhY.js +0 -71
  1874. package/dist/shared-ES8nDIcn.js +0 -212
  1875. package/dist/simple-completion-runtime-BGZkWvKr.js +0 -206
  1876. package/dist/simple-completion-runtime-CM_IISYW.js +0 -2
  1877. package/dist/simple-completion-transport-Bo0u9dhp.js +0 -83
  1878. package/dist/snapshot-urls-C1KjRQD5.js +0 -317
  1879. package/dist/speech-core-Bas7e4h0.js +0 -119
  1880. package/dist/speech-provider-BonJQv5S.js +0 -227
  1881. package/dist/speech-provider-CwdKQmDv.js +0 -171
  1882. package/dist/speech-provider-DcQRnYhZ.js +0 -233
  1883. package/dist/stale-oauth-profile-shadows-C3aeAWfv.js +0 -186
  1884. package/dist/stale-oauth-profile-shadows-m5rb8dPc.js +0 -2
  1885. package/dist/standalone-runtime-registry-loader-B9n2LBKC.js +0 -59
  1886. package/dist/startup-context-DY7C4riM.js +0 -314
  1887. package/dist/status-6EPKat7p.js +0 -73
  1888. package/dist/status-C6Fa7Dsf.js +0 -2
  1889. package/dist/status-CNnxDQlM.js +0 -4
  1890. package/dist/status-D2Scvbc0.js +0 -3
  1891. package/dist/status-Ducanro3.js +0 -2
  1892. package/dist/status-_XX_6QVA.js +0 -466
  1893. package/dist/status-all-BP1u6vou.js +0 -573
  1894. package/dist/status-json-DPlOJ_ue.js +0 -15
  1895. package/dist/status-json-command-BT7EwVKj.js +0 -84
  1896. package/dist/status-message-Dzr9-MX-.js +0 -495
  1897. package/dist/status-message.runtime-DFezIt1d.js +0 -6
  1898. package/dist/status-prBlcUV5.js +0 -249
  1899. package/dist/status-queue.runtime-C1bmg2rl.js +0 -2
  1900. package/dist/status-runtime-shared-RjKIPEQ0.js +0 -289
  1901. package/dist/status-subagents.runtime-tsCCe4Ny.js +0 -32
  1902. package/dist/status-text-Bkeyg8Bf.js +0 -301
  1903. package/dist/status.command-D06_4ATq.js +0 -425
  1904. package/dist/status.command-dDEZM84a.js +0 -2
  1905. package/dist/status.command.text-runtime-WH9tP7yg.js +0 -15
  1906. package/dist/status.runtime-B76GaBIR.js +0 -2
  1907. package/dist/status.scan-Bc6clx0F.js +0 -72
  1908. package/dist/status.scan-overview-v_-AaFhC.js +0 -460
  1909. package/dist/status.scan.deps.runtime-BkH1HAb4.js +0 -19
  1910. package/dist/status.scan.fast-json-CrlfKKI3.js +0 -2
  1911. package/dist/status.scan.fast-json-D8v6zfP8.js +0 -163
  1912. package/dist/status.summary-DBhvgOPr.js +0 -276
  1913. package/dist/status.summary-hQV0PKFO.js +0 -2
  1914. package/dist/store-BClomp_4.js +0 -3
  1915. package/dist/store-BHqDPtNw.js +0 -2302
  1916. package/dist/stored-model-override-vm4CtQWX.js +0 -79
  1917. package/dist/subagent-announce-D244Q4w2.js +0 -353
  1918. package/dist/subagent-announce-delivery-qKZfF7Bs.js +0 -1369
  1919. package/dist/subagent-control-c87mVGUE.js +0 -492
  1920. package/dist/subagent-control.runtime-DfQtIsDb.js +0 -3
  1921. package/dist/subagent-hooks-B_UW5Len.js +0 -2
  1922. package/dist/subagent-hooks-CYvFWt_r.js +0 -230
  1923. package/dist/subagent-hooks-api-DZgaJf19.js +0 -23
  1924. package/dist/subagent-registry-BlcoCggo.js +0 -2627
  1925. package/dist/subagent-registry-CuObhNeO.js +0 -3
  1926. package/dist/subagent-session-cleanup-hFF8Z34s.js +0 -390
  1927. package/dist/system-CN_Knfqq.js +0 -111
  1928. package/dist/system-prompt-config-BmZlhYK9.js +0 -918
  1929. package/dist/talk-DrjGczYs.js +0 -2454
  1930. package/dist/target-id-BNpbyWkq.js +0 -107
  1931. package/dist/targets-CQcGo6u4.js +0 -267
  1932. package/dist/targets.runtime-DwcxNI-x.js +0 -2
  1933. package/dist/task-executor-CZg-qt4u.js +0 -349
  1934. package/dist/task-owner-access-Duem5jjb.js +0 -74
  1935. package/dist/task-registry-Cw8pc3Ry.js +0 -2362
  1936. package/dist/task-registry-delivery-runtime-HaiKqj0A.js +0 -2
  1937. package/dist/task-registry.maintenance-BLv3wpK9.js +0 -764
  1938. package/dist/task-registry.maintenance-CvlIcxE-.js +0 -2
  1939. package/dist/task-status-access-C5nDJSI4.js +0 -18
  1940. package/dist/tasks-D3CfEAlq.js +0 -548
  1941. package/dist/tasks-WKnE5fvr.js +0 -153
  1942. package/dist/tasks-audit-system-okJjcOjU.js +0 -210
  1943. package/dist/tasks-json-C-iUgWNu.js +0 -73
  1944. package/dist/tavily-web-search-provider.runtime-jpagljrA.js +0 -112
  1945. package/dist/text-report-BTsF3Pv3.js +0 -695
  1946. package/dist/text-transforms.runtime-CgH_pbcQ.js +0 -113
  1947. package/dist/thread-bindings-BWxpUE9U.js +0 -228
  1948. package/dist/tool-DhJbbm91.js +0 -143
  1949. package/dist/tool-dispatch-CpFUfblu.js +0 -155
  1950. package/dist/tool-images-C-tFlXjE.js +0 -247
  1951. package/dist/tool-plugin-3NejWxZW.js +0 -93
  1952. package/dist/tool-resolution-oW8Cbamd.js +0 -153
  1953. package/dist/tool-result-truncation-CWFGf7Eu.js +0 -498
  1954. package/dist/tool-schema-CMtc7PdZ.js +0 -40
  1955. package/dist/tool-schema-projection-DJRPEEvY.js +0 -215
  1956. package/dist/tool-split-E4RdK5jS.js +0 -323
  1957. package/dist/tools-BAl3JiNw.js +0 -901
  1958. package/dist/tools-DC8tCPxR.js +0 -579
  1959. package/dist/tools-catalog-Dzv9zaBD.js +0 -156
  1960. package/dist/tools-effective-CGvzyIL2.js +0 -442
  1961. package/dist/tools-effective-inventory-GI5N5Q9v.js +0 -379
  1962. package/dist/tools-invoke-CU2U0hNH.js +0 -51
  1963. package/dist/tools-invoke-http-8s3FiUy4.js +0 -68
  1964. package/dist/tools-invoke-shared-DIETrEY7.js +0 -200
  1965. package/dist/tools.runtime-Bnm8CI7w.js +0 -5
  1966. package/dist/transcript-rewrite-Buv2ITw4.js +0 -688
  1967. package/dist/transcripts-tool-BCFlLCFd.js +0 -2
  1968. package/dist/transcripts-tool-CWgNd0Uw.js +0 -656
  1969. package/dist/tts-Aguo4zC5.js +0 -3
  1970. package/dist/tts-Bf77cURn.js +0 -2
  1971. package/dist/tts-DnADOKOP.js +0 -194
  1972. package/dist/tts-runtime-MBSH-nOM.js +0 -1337
  1973. package/dist/tts.runtime-B-NR9osE.js +0 -2
  1974. package/dist/tts.runtime-Bo-QxKgx.js +0 -3
  1975. package/dist/tui-B0CdNmCz.js +0 -4860
  1976. package/dist/tui-ByRcXM3Z.js +0 -2
  1977. package/dist/tui-backend-C52BUoZI.js +0 -256
  1978. package/dist/tui-cli-BQHpZ4n0.js +0 -40
  1979. package/dist/typing-policy-XspVOezC.js +0 -199
  1980. package/dist/usage-BOYwzimH.js +0 -1113
  1981. package/dist/usage-BSmLrVWB.js +0 -623
  1982. package/dist/usage-format-CfzICmvv.js +0 -2
  1983. package/dist/usage-format-DPJKCPic.js +0 -394
  1984. package/dist/video-generation-provider-CdCTztQ7.js +0 -77
  1985. package/dist/video-generation-provider-MUUshUzz.js +0 -325
  1986. package/dist/video-generation-provider-XmzzTa6e.js +0 -297
  1987. package/dist/video-generation-provider-weiQUJE5.js +0 -64
  1988. package/dist/web-fetch-providers.runtime-tD9zqAS2.js +0 -41
  1989. package/dist/web-guarded-fetch-CyhQZ1yD.js +0 -2
  1990. package/dist/web-guarded-fetch-DIXHI-yJ.js +0 -58
  1991. package/dist/web-media-BPnTMYE5.js +0 -4
  1992. package/dist/web-media-DV_tCQiQ.js +0 -2
  1993. package/dist/web-media-DYydVGCK.js +0 -651
  1994. package/dist/web-provider-runtime-shared-h3M6Bqyg.js +0 -142
  1995. package/dist/web-search-provider-common-CEYWuDcp.js +0 -252
  1996. package/dist/web-search-providers.runtime-YrayP296.js +0 -41
  1997. package/dist/zod-schema.core-BGLctDlK.d.ts +0 -166
  1998. /package/dist/{acp-runtime-backend-CHZtaM6t.js → acp-runtime-backend-B83JR5Zf.js} +0 -0
  1999. /package/dist/{agent-turn-attachments-BYCRK86s.js → agent-turn-attachments-D5uJijuK.js} +0 -0
  2000. /package/dist/{auth-install-policy-t46tJ8jV.js → auth-install-policy-BIpdwrZ9.js} +0 -0
  2001. /package/dist/{cli-backends-BHXnrVN_.js → cli-backends-79CCRQ2a.js} +0 -0
  2002. /package/dist/{command-secret-targets-DZ0J2Wm3.js → command-secret-targets-BOJlcBil.js} +0 -0
  2003. /package/dist/{commands-DWp49Exc.js → commands-Dw9hwmVt.js} +0 -0
  2004. /package/dist/{commands-reset-hooks-MMq2dvff.js → commands-reset-hooks-epArfNOY.js} +0 -0
  2005. /package/dist/{delegate-Dkj_5OvH.js → delegate-Bw8NQXVr.js} +0 -0
  2006. /package/dist/{jobs-BGELIHcx.js → jobs-BIOTaq7l.js} +0 -0
  2007. /package/dist/{kimi-web-search-provider-4PlMYsPx.js → kimi-web-search-provider-Bzg_DiXO.js} +0 -0
  2008. /package/dist/{memory-host-search-Ds9GiNpf.js → memory-host-search-Dph0Mq-v.js} +0 -0
  2009. /package/dist/{minimax-web-search-provider-d5gTJUNg.js → minimax-web-search-provider-CETxDkkI.js} +0 -0
  2010. /package/dist/{model-selection-cli-CO6BHPiL.js → model-selection-cli-DizUvxeY.js} +0 -0
  2011. /package/dist/{provider-auth-choice-preference-f7Us6TQL.js → provider-auth-choice-preference-uJn1811S.js} +0 -0
  2012. /package/dist/{runtime-wfO9bV5y.js → runtime-BEVbpIgZ.js} +0 -0
  2013. /package/dist/{runtime-web-tools-B6vr1LZs.js → runtime-web-tools-Bf0aEe-F.js} +0 -0
  2014. /package/dist/{runtime-web-tools-fallback.runtime-Crs7KfH5.js → runtime-web-tools-fallback.runtime-DU6rTj6l.js} +0 -0
  2015. /package/dist/{session-subagent-reactivation-H5Rdwkyy.js → session-subagent-reactivation-Bb5SCi9J.js} +0 -0
  2016. /package/dist/{tavily-web-search-provider-DbdIzpMv.js → tavily-web-search-provider-CIEhV60D.js} +0 -0
@@ -0,0 +1,3737 @@
1
+ import { a as normalizeLowercaseStringOrEmpty } from "./string-coerce-DKw2K5wM.js";
2
+ import { E as resolveTimerTimeoutMs, n as MAX_TIMER_TIMEOUT_MS } from "./number-coercion-D1aDmIZp.js";
3
+ import { i as formatErrorMessage } from "./errors-5ePGD43N.js";
4
+ import { n as resolveGlobalSingleton } from "./global-singleton-DE6St75u.js";
5
+ import { _ as uniqueStrings, l as normalizeStringEntries, u as normalizeStringEntriesLower, v as uniqueValues } from "./string-normalization-B8G0vlWE.js";
6
+ import { p as resolveUserPath, y as truncateUtf16Safe } from "./utils-v5zGdVpj.js";
7
+ import { t as createSubsystemLogger } from "./subsystem-46gngkCY.js";
8
+ import { a as resolveAgentDir, o as resolveAgentWorkspaceDir } from "./agent-scope-config-BFfPgg3b.js";
9
+ import { b as isUsageCountedSessionTranscriptFileName, h as isSessionArchiveArtifactName, l as resolveSessionTranscriptsDirForAgent } from "./paths-C79m3Aob.js";
10
+ import { n as onSessionTranscriptUpdate } from "./transcript-events-CX3wuAgS.js";
11
+ import "./error-runtime-CR2EdbOL.js";
12
+ import "./number-runtime-Cu8gqEYx.js";
13
+ import "./string-coerce-runtime-BurriTLB.js";
14
+ import { t as extractKeywords } from "./query-expansion-CLq1xHPJ.js";
15
+ import { r as classifyMemoryMultimodalPath } from "./multimodal-CnyHf_yl.js";
16
+ import { t as getEmbeddingProvider } from "./embedding-provider-runtime-DaXfsUPo.js";
17
+ import { t as resolveMemorySearchConfig } from "./memory-search-CpDEEY2Q.js";
18
+ import "./embedding-providers-CdU99clu.js";
19
+ import { t as getMemoryEmbeddingProvider } from "./memory-embedding-provider-runtime-CaVVaYC5.js";
20
+ import { u as enforceEmbeddingMaxInputTokens } from "./memory-core-host-engine-embeddings-Dy9vN-Ce.js";
21
+ import { t as isFileMissingError } from "./fs-utils-D05rps7O.js";
22
+ import { a as ensureDir, c as normalizeExtraMemoryPaths, d as runWithConcurrency, f as hasNonTextEmbeddingParts, i as cosineSimilarity, l as parseEmbedding, n as buildMultimodalChunkForIndexing, r as chunkMarkdown, s as listMemoryFiles, t as buildFileEntry, u as remapChunkLines } from "./internal-DL_vFx8C.js";
23
+ import { t as hashText } from "./hash-C0FSXO-A.js";
24
+ import "./memory-core-host-engine-foundation-C-pGGQnm.js";
25
+ import { l as buildSessionEntry, m as sessionPathForFile, u as listSessionFilesForAgent } from "./engine-qmd-5jbjGywA.js";
26
+ import "./memory-core-host-engine-qmd-DLJDON9w.js";
27
+ import { n as readMemoryFile } from "./read-file-ogB-HjbK.js";
28
+ import { a as ensureMemoryIndexSchema, i as loadSqliteVecExtension, n as configureMemorySqliteWalMaintenance, r as requireNodeSqlite, t as closeMemorySqliteWalMaintenance } from "./engine-storage-CfAgwoDp.js";
29
+ import "./memory-core-host-engine-storage-Bzf-C8XE.js";
30
+ import "./dreaming-shared-DDoGNtLG.js";
31
+ import { r as tokenize, t as jaccardSimilarity } from "./tokenize-DY4dd1v-.js";
32
+ import { n as settleMemoryWatchEventPaths, t as recordMemoryWatchEventPath } from "./watch-settle-D8vi8R4W.js";
33
+ import fs from "node:fs";
34
+ import path from "node:path";
35
+ import fs$1 from "node:fs/promises";
36
+ import { randomUUID } from "node:crypto";
37
+ import { setTimeout as setTimeout$1 } from "node:timers/promises";
38
+ import chokidar from "chokidar";
39
+ //#region extensions/memory-core/src/memory/embeddings.ts
40
+ const DEFAULT_MEMORY_EMBEDDING_PROVIDER = "openai";
41
+ function adaptGenericEmbeddingProvider(provider) {
42
+ return {
43
+ id: provider.id,
44
+ model: provider.model,
45
+ ...typeof provider.maxInputTokens === "number" ? { maxInputTokens: provider.maxInputTokens } : {},
46
+ embedQuery: async (text, options) => await provider.embed(text, {
47
+ ...options,
48
+ inputType: "query"
49
+ }),
50
+ embedBatch: async (texts, options) => await provider.embedBatch(texts, {
51
+ ...options,
52
+ inputType: "document"
53
+ }),
54
+ embedBatchInputs: async (inputs, options) => await provider.embedBatch(inputs, {
55
+ ...options,
56
+ inputType: "document"
57
+ }),
58
+ ...provider.close ? { close: provider.close } : {}
59
+ };
60
+ }
61
+ function adaptGenericRuntime(runtime) {
62
+ if (!runtime) return;
63
+ return {
64
+ id: runtime.id,
65
+ ...runtime.cacheKeyData ? { cacheKeyData: runtime.cacheKeyData } : {},
66
+ ...typeof runtime.inlineQueryTimeoutMs === "number" ? { inlineQueryTimeoutMs: runtime.inlineQueryTimeoutMs } : {},
67
+ ...typeof runtime.inlineBatchTimeoutMs === "number" ? { inlineBatchTimeoutMs: runtime.inlineBatchTimeoutMs } : {}
68
+ };
69
+ }
70
+ function adaptGenericEmbeddingAdapter(adapter) {
71
+ return {
72
+ id: adapter.id,
73
+ ...adapter.defaultModel ? { defaultModel: adapter.defaultModel } : {},
74
+ ...adapter.transport ? { transport: adapter.transport } : {},
75
+ ...adapter.authProviderId ? { authProviderId: adapter.authProviderId } : {},
76
+ ...adapter.formatSetupError ? { formatSetupError: adapter.formatSetupError } : {},
77
+ create: async (options) => {
78
+ const result = await adapter.create({
79
+ ...options,
80
+ ...typeof options.outputDimensionality === "number" ? { dimensions: options.outputDimensionality } : {}
81
+ });
82
+ return {
83
+ provider: result.provider ? adaptGenericEmbeddingProvider(result.provider) : null,
84
+ runtime: adaptGenericRuntime(result.runtime)
85
+ };
86
+ }
87
+ };
88
+ }
89
+ function formatProviderError(adapter, err) {
90
+ return adapter.formatSetupError?.(err) ?? formatErrorMessage(err);
91
+ }
92
+ function getAdapter(id, config) {
93
+ const adapter = getMemoryEmbeddingProvider(id, config);
94
+ if (adapter) return adapter;
95
+ const genericAdapter = getEmbeddingProvider(id, config);
96
+ if (genericAdapter) return adaptGenericEmbeddingAdapter(genericAdapter);
97
+ throw new Error(`Unknown memory embedding provider: ${id}`);
98
+ }
99
+ function resolveProviderModel(adapter, requestedModel) {
100
+ const trimmed = requestedModel.trim();
101
+ if (trimmed) return trimmed;
102
+ return adapter.defaultModel ?? "";
103
+ }
104
+ function resolveEmbeddingProviderFallbackModel(providerId, fallbackSourceModel, config) {
105
+ return (getMemoryEmbeddingProvider(providerId, config) ?? getEmbeddingProvider(providerId, config))?.defaultModel ?? fallbackSourceModel;
106
+ }
107
+ async function createWithAdapter(adapter, options) {
108
+ const result = await adapter.create({
109
+ ...options,
110
+ model: resolveProviderModel(adapter, options.model)
111
+ });
112
+ return {
113
+ provider: result.provider,
114
+ requestedProvider: options.provider,
115
+ runtime: result.runtime
116
+ };
117
+ }
118
+ async function createEmbeddingProvider(options) {
119
+ const provider = options.provider === "auto" ? DEFAULT_MEMORY_EMBEDDING_PROVIDER : options.provider;
120
+ const primaryAdapter = getAdapter(provider, options.config);
121
+ try {
122
+ return await createWithAdapter(primaryAdapter, {
123
+ ...options,
124
+ provider
125
+ });
126
+ } catch (primaryErr) {
127
+ const reason = formatProviderError(primaryAdapter, primaryErr);
128
+ if (options.fallback && options.fallback !== "none" && options.fallback !== provider) {
129
+ const fallbackAdapter = getAdapter(options.fallback, options.config);
130
+ try {
131
+ return {
132
+ ...await createWithAdapter(fallbackAdapter, {
133
+ ...options,
134
+ provider: options.fallback
135
+ }),
136
+ requestedProvider: provider,
137
+ fallbackFrom: provider,
138
+ fallbackReason: reason
139
+ };
140
+ } catch (fallbackErr) {
141
+ const fallbackReason = formatProviderError(fallbackAdapter, fallbackErr);
142
+ const wrapped = /* @__PURE__ */ new Error(`${reason}\n\nFallback to ${options.fallback} failed: ${fallbackReason}`);
143
+ wrapped.cause = primaryErr;
144
+ throw wrapped;
145
+ }
146
+ }
147
+ const wrapped = new Error(reason);
148
+ wrapped.cause = primaryErr;
149
+ throw wrapped;
150
+ }
151
+ }
152
+ //#endregion
153
+ //#region extensions/memory-core/src/memory/mmr.ts
154
+ const DEFAULT_MMR_CONFIG = {
155
+ enabled: false,
156
+ lambda: .7
157
+ };
158
+ /**
159
+ * Compute the maximum similarity between an item and all selected items.
160
+ */
161
+ function maxSimilarityToSelected(item, selectedItems, tokenCache) {
162
+ if (selectedItems.length === 0) return 0;
163
+ let maxSim = 0;
164
+ const itemTokens = tokenCache.get(item.id) ?? tokenize(item.content);
165
+ for (const selected of selectedItems) {
166
+ const sim = jaccardSimilarity(itemTokens, tokenCache.get(selected.id) ?? tokenize(selected.content));
167
+ if (sim > maxSim) maxSim = sim;
168
+ }
169
+ return maxSim;
170
+ }
171
+ /**
172
+ * Compute MMR score for a candidate item.
173
+ * MMR = λ * relevance - (1-λ) * max_similarity_to_selected
174
+ */
175
+ function computeMMRScore(relevance, maxSimilarity, lambda) {
176
+ return lambda * relevance - (1 - lambda) * maxSimilarity;
177
+ }
178
+ /**
179
+ * Re-rank items using Maximal Marginal Relevance (MMR).
180
+ *
181
+ * The algorithm iteratively selects items that balance relevance with diversity:
182
+ * 1. Start with the highest-scoring item
183
+ * 2. For each remaining slot, select the item that maximizes the MMR score
184
+ * 3. MMR score = λ * relevance - (1-λ) * max_similarity_to_already_selected
185
+ *
186
+ * @param items - Items to re-rank, must have score and content
187
+ * @param config - MMR configuration (lambda, enabled)
188
+ * @returns Re-ranked items in MMR order
189
+ */
190
+ function mmrRerank(items, config = {}) {
191
+ const { enabled = DEFAULT_MMR_CONFIG.enabled, lambda = DEFAULT_MMR_CONFIG.lambda } = config;
192
+ if (!enabled || items.length <= 1) return [...items];
193
+ const clampedLambda = Math.max(0, Math.min(1, lambda));
194
+ if (clampedLambda === 1) return [...items].toSorted((a, b) => b.score - a.score);
195
+ const tokenCache = /* @__PURE__ */ new Map();
196
+ for (const item of items) tokenCache.set(item.id, tokenize(item.content));
197
+ const maxScore = Math.max(...items.map((i) => i.score));
198
+ const minScore = Math.min(...items.map((i) => i.score));
199
+ const scoreRange = maxScore - minScore;
200
+ const normalizeScore = (score) => {
201
+ if (scoreRange === 0) return 1;
202
+ return (score - minScore) / scoreRange;
203
+ };
204
+ const selected = [];
205
+ const remaining = new Set(items);
206
+ while (remaining.size > 0) {
207
+ let bestItem = null;
208
+ let bestMMRScore = -Infinity;
209
+ for (const candidate of remaining) {
210
+ const mmrScore = computeMMRScore(normalizeScore(candidate.score), maxSimilarityToSelected(candidate, selected, tokenCache), clampedLambda);
211
+ if (mmrScore > bestMMRScore || mmrScore === bestMMRScore && candidate.score > (bestItem?.score ?? -Infinity)) {
212
+ bestMMRScore = mmrScore;
213
+ bestItem = candidate;
214
+ }
215
+ }
216
+ if (bestItem) {
217
+ selected.push(bestItem);
218
+ remaining.delete(bestItem);
219
+ } else break;
220
+ }
221
+ return selected;
222
+ }
223
+ /**
224
+ * Apply MMR re-ranking to hybrid search results.
225
+ * Adapts the generic MMR function to work with the hybrid search result format.
226
+ */
227
+ function applyMMRToHybridResults(results, config = {}) {
228
+ if (results.length === 0) return results;
229
+ const itemById = /* @__PURE__ */ new Map();
230
+ return mmrRerank(results.map((r, index) => {
231
+ const id = `${r.path}:${r.startLine}:${index}`;
232
+ itemById.set(id, r);
233
+ return {
234
+ id,
235
+ score: r.score,
236
+ content: r.snippet
237
+ };
238
+ }), config).map((item) => itemById.get(item.id));
239
+ }
240
+ //#endregion
241
+ //#region extensions/memory-core/src/memory/temporal-decay.ts
242
+ const DEFAULT_TEMPORAL_DECAY_CONFIG = {
243
+ enabled: false,
244
+ halfLifeDays: 30
245
+ };
246
+ const DAY_MS = 1440 * 60 * 1e3;
247
+ const DATED_MEMORY_PATH_RE = /(?:^|\/)memory\/(\d{4})-(\d{2})-(\d{2})\.md$/;
248
+ function toDecayLambda(halfLifeDays) {
249
+ if (!Number.isFinite(halfLifeDays) || halfLifeDays <= 0) return 0;
250
+ return Math.LN2 / halfLifeDays;
251
+ }
252
+ function calculateTemporalDecayMultiplier(params) {
253
+ const lambda = toDecayLambda(params.halfLifeDays);
254
+ const clampedAge = Math.max(0, params.ageInDays);
255
+ if (lambda <= 0 || !Number.isFinite(clampedAge)) return 1;
256
+ return Math.exp(-lambda * clampedAge);
257
+ }
258
+ function applyTemporalDecayToScore(params) {
259
+ return params.score * calculateTemporalDecayMultiplier(params);
260
+ }
261
+ function parseMemoryDateFromPath(filePath) {
262
+ const normalized = filePath.replaceAll("\\", "/").replace(/^\.\//, "");
263
+ const match = DATED_MEMORY_PATH_RE.exec(normalized);
264
+ if (!match) return null;
265
+ const year = Number(match[1]);
266
+ const month = Number(match[2]);
267
+ const day = Number(match[3]);
268
+ if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)) return null;
269
+ const timestamp = Date.UTC(year, month - 1, day);
270
+ const parsed = new Date(timestamp);
271
+ if (parsed.getUTCFullYear() !== year || parsed.getUTCMonth() !== month - 1 || parsed.getUTCDate() !== day) return null;
272
+ return parsed;
273
+ }
274
+ function isEvergreenMemoryPath(filePath) {
275
+ const normalized = filePath.replaceAll("\\", "/").replace(/^\.\//, "");
276
+ if (normalized === "MEMORY.md") return true;
277
+ if (!normalized.startsWith("memory/")) return false;
278
+ return !DATED_MEMORY_PATH_RE.test(normalized);
279
+ }
280
+ async function extractTimestamp(params) {
281
+ const fromPath = parseMemoryDateFromPath(params.filePath);
282
+ if (fromPath) return fromPath;
283
+ if (params.source === "memory" && isEvergreenMemoryPath(params.filePath)) return null;
284
+ if (!params.workspaceDir) return null;
285
+ const absolutePath = path.isAbsolute(params.filePath) ? params.filePath : path.resolve(params.workspaceDir, params.filePath);
286
+ try {
287
+ const stat = await fs$1.stat(absolutePath);
288
+ if (!Number.isFinite(stat.mtimeMs)) return null;
289
+ return new Date(stat.mtimeMs);
290
+ } catch {
291
+ return null;
292
+ }
293
+ }
294
+ function ageInDaysFromTimestamp(timestamp, nowMs) {
295
+ return Math.max(0, nowMs - timestamp.getTime()) / DAY_MS;
296
+ }
297
+ async function applyTemporalDecayToHybridResults(params) {
298
+ const config = {
299
+ ...DEFAULT_TEMPORAL_DECAY_CONFIG,
300
+ ...params.temporalDecay
301
+ };
302
+ if (!config.enabled) return [...params.results];
303
+ const nowMs = params.nowMs ?? Date.now();
304
+ const timestampPromiseCache = /* @__PURE__ */ new Map();
305
+ return Promise.all(params.results.map(async (entry) => {
306
+ const cacheKey = `${entry.source}:${entry.path}`;
307
+ let timestampPromise = timestampPromiseCache.get(cacheKey);
308
+ if (!timestampPromise) {
309
+ timestampPromise = extractTimestamp({
310
+ filePath: entry.path,
311
+ source: entry.source,
312
+ workspaceDir: params.workspaceDir
313
+ });
314
+ timestampPromiseCache.set(cacheKey, timestampPromise);
315
+ }
316
+ const timestamp = await timestampPromise;
317
+ if (!timestamp) return entry;
318
+ const decayedScore = applyTemporalDecayToScore({
319
+ score: entry.score,
320
+ ageInDays: ageInDaysFromTimestamp(timestamp, nowMs),
321
+ halfLifeDays: config.halfLifeDays
322
+ });
323
+ return {
324
+ ...entry,
325
+ score: decayedScore
326
+ };
327
+ }));
328
+ }
329
+ //#endregion
330
+ //#region extensions/memory-core/src/memory/hybrid.ts
331
+ function buildFtsQuery(raw) {
332
+ const tokens = normalizeStringEntries(raw.match(/[\p{L}\p{N}_]+/gu) ?? []);
333
+ if (tokens.length === 0) return null;
334
+ return tokens.map((t) => `"${t.replaceAll("\"", "")}"`).join(" AND ");
335
+ }
336
+ function bm25RankToScore(rank) {
337
+ if (!Number.isFinite(rank)) return 1 / 1e3;
338
+ if (rank < 0) {
339
+ const relevance = -rank;
340
+ return relevance / (1 + relevance);
341
+ }
342
+ return 1 / (1 + rank);
343
+ }
344
+ async function mergeHybridResults(params) {
345
+ const byId = /* @__PURE__ */ new Map();
346
+ for (const r of params.vector) byId.set(r.id, {
347
+ id: r.id,
348
+ path: r.path,
349
+ startLine: r.startLine,
350
+ endLine: r.endLine,
351
+ source: r.source,
352
+ snippet: r.snippet,
353
+ vectorScore: r.vectorScore,
354
+ textScore: 0
355
+ });
356
+ for (const r of params.keyword) {
357
+ const existing = byId.get(r.id);
358
+ if (existing) {
359
+ existing.textScore = r.textScore;
360
+ if (r.snippet && r.snippet.length > 0) existing.snippet = r.snippet;
361
+ } else byId.set(r.id, {
362
+ id: r.id,
363
+ path: r.path,
364
+ startLine: r.startLine,
365
+ endLine: r.endLine,
366
+ source: r.source,
367
+ snippet: r.snippet,
368
+ vectorScore: 0,
369
+ textScore: r.textScore
370
+ });
371
+ }
372
+ const sorted = (await applyTemporalDecayToHybridResults({
373
+ results: Array.from(byId.values()).map((entry) => {
374
+ const score = params.vectorWeight * entry.vectorScore + params.textWeight * entry.textScore;
375
+ return {
376
+ path: entry.path,
377
+ startLine: entry.startLine,
378
+ endLine: entry.endLine,
379
+ score,
380
+ vectorScore: entry.vectorScore,
381
+ textScore: entry.textScore,
382
+ snippet: entry.snippet,
383
+ source: entry.source
384
+ };
385
+ }),
386
+ temporalDecay: {
387
+ ...DEFAULT_TEMPORAL_DECAY_CONFIG,
388
+ ...params.temporalDecay
389
+ },
390
+ workspaceDir: params.workspaceDir,
391
+ nowMs: params.nowMs
392
+ })).toSorted((a, b) => b.score - a.score);
393
+ const mmrConfig = {
394
+ ...DEFAULT_MMR_CONFIG,
395
+ ...params.mmr
396
+ };
397
+ if (mmrConfig.enabled) return applyMMRToHybridResults(sorted, mmrConfig);
398
+ return sorted;
399
+ }
400
+ //#endregion
401
+ //#region extensions/memory-core/src/memory/manager-async-state.ts
402
+ function startAsyncSearchSync(params) {
403
+ if (!params.enabled || !params.dirty && !params.sessionsDirty) return;
404
+ params.sync({ reason: "search" }).catch((err) => {
405
+ params.onError(err);
406
+ });
407
+ }
408
+ async function awaitPendingManagerWork(params) {
409
+ if (params.pendingSync) try {
410
+ await params.pendingSync;
411
+ } catch {}
412
+ if (params.pendingProviderInit) try {
413
+ await params.pendingProviderInit;
414
+ } catch {}
415
+ }
416
+ function resetMemoryBatchFailureState(state) {
417
+ return {
418
+ ...state,
419
+ count: 0,
420
+ lastError: void 0,
421
+ lastProvider: void 0
422
+ };
423
+ }
424
+ function recordMemoryBatchFailure(state, params) {
425
+ if (!state.enabled) return state;
426
+ const increment = params.forceDisable ? 2 : Math.max(1, params.attempts ?? 1);
427
+ const count = state.count + increment;
428
+ return {
429
+ enabled: !(params.forceDisable || count >= 2),
430
+ count,
431
+ lastError: params.message,
432
+ lastProvider: params.provider
433
+ };
434
+ }
435
+ //#endregion
436
+ //#region extensions/memory-core/src/memory/manager-cache.ts
437
+ function resolveSingletonManagedCache(cacheKey) {
438
+ const resolved = resolveGlobalSingleton(cacheKey, () => ({
439
+ cache: /* @__PURE__ */ new Map(),
440
+ pending: /* @__PURE__ */ new Map()
441
+ }));
442
+ if (typeof resolved === "object" && resolved !== null && resolved.cache instanceof Map && resolved.pending instanceof Map) return resolved;
443
+ const repaired = {
444
+ cache: /* @__PURE__ */ new Map(),
445
+ pending: /* @__PURE__ */ new Map()
446
+ };
447
+ globalThis[cacheKey] = repaired;
448
+ return repaired;
449
+ }
450
+ async function getOrCreateManagedCacheEntry(params) {
451
+ if (params.bypassCache) return await params.create();
452
+ const existing = params.cache.get(params.key);
453
+ if (existing) return existing;
454
+ const pending = params.pending.get(params.key);
455
+ if (pending) return pending;
456
+ const createPromise = (async () => {
457
+ const refreshed = params.cache.get(params.key);
458
+ if (refreshed) return refreshed;
459
+ const entry = await params.create();
460
+ params.cache.set(params.key, entry);
461
+ return entry;
462
+ })();
463
+ params.pending.set(params.key, createPromise);
464
+ try {
465
+ return await createPromise;
466
+ } finally {
467
+ if (params.pending.get(params.key) === createPromise) params.pending.delete(params.key);
468
+ }
469
+ }
470
+ async function closeManagedCacheEntries(params) {
471
+ const pending = Array.from(params.pending.values());
472
+ if (pending.length > 0) await Promise.allSettled(pending);
473
+ const entries = Array.from(params.cache.values());
474
+ params.cache.clear();
475
+ for (const entry of entries) {
476
+ if (typeof entry.close !== "function") continue;
477
+ try {
478
+ await entry.close();
479
+ } catch (err) {
480
+ params.onCloseError?.(err);
481
+ }
482
+ }
483
+ }
484
+ //#endregion
485
+ //#region extensions/memory-core/src/memory/manager-db.ts
486
+ function openMemoryDatabaseAtPath(dbPath, allowExtension) {
487
+ ensureDir(path.dirname(dbPath));
488
+ const { DatabaseSync } = requireNodeSqlite();
489
+ const db = new DatabaseSync(dbPath, { allowExtension });
490
+ configureMemorySqliteWalMaintenance(db);
491
+ db.exec("PRAGMA busy_timeout = 5000");
492
+ return db;
493
+ }
494
+ function closeMemoryDatabase(db) {
495
+ closeMemorySqliteWalMaintenance(db);
496
+ db.close();
497
+ }
498
+ //#endregion
499
+ //#region extensions/memory-core/src/memory/manager-embedding-cache.ts
500
+ function loadMemoryEmbeddingCache(params) {
501
+ const provider = params.provider;
502
+ if (!params.enabled || !provider || !params.providerKey || params.hashes.length === 0) return /* @__PURE__ */ new Map();
503
+ const unique = [];
504
+ const seen = /* @__PURE__ */ new Set();
505
+ for (const hash of params.hashes) {
506
+ if (!hash || seen.has(hash)) continue;
507
+ seen.add(hash);
508
+ unique.push(hash);
509
+ }
510
+ if (unique.length === 0) return /* @__PURE__ */ new Map();
511
+ const tableName = params.tableName ?? "embedding_cache";
512
+ const out = /* @__PURE__ */ new Map();
513
+ const baseParams = [
514
+ provider.id,
515
+ provider.model,
516
+ params.providerKey
517
+ ];
518
+ const batchSize = 400;
519
+ for (let start = 0; start < unique.length; start += batchSize) {
520
+ const batch = unique.slice(start, start + batchSize);
521
+ const placeholders = batch.map(() => "?").join(", ");
522
+ const rows = params.db.prepare(`SELECT hash, embedding FROM ${tableName}\n WHERE provider = ? AND model = ? AND provider_key = ? AND hash IN (${placeholders})`).all(...baseParams, ...batch);
523
+ for (const row of rows) out.set(row.hash, parseEmbedding(row.embedding));
524
+ }
525
+ return out;
526
+ }
527
+ function upsertMemoryEmbeddingCache(params) {
528
+ const provider = params.provider;
529
+ if (!params.enabled || !provider || !params.providerKey || params.entries.length === 0) return;
530
+ const tableName = params.tableName ?? "embedding_cache";
531
+ const now = params.now ?? Date.now();
532
+ const stmt = params.db.prepare(`INSERT INTO ${tableName} (provider, model, provider_key, hash, embedding, dims, updated_at)\n VALUES (?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT(provider, model, provider_key, hash) DO UPDATE SET\n embedding=excluded.embedding,\n dims=excluded.dims,\n updated_at=excluded.updated_at`);
533
+ for (const entry of params.entries) {
534
+ const embedding = entry.embedding ?? [];
535
+ stmt.run(provider.id, provider.model, params.providerKey, entry.hash, JSON.stringify(embedding), embedding.length, now);
536
+ }
537
+ }
538
+ function collectMemoryCachedEmbeddings(params) {
539
+ const embeddings = Array.from({ length: params.chunks.length }, () => []);
540
+ const missing = [];
541
+ for (let index = 0; index < params.chunks.length; index += 1) {
542
+ const chunk = params.chunks[index];
543
+ const hit = chunk?.hash ? params.cached.get(chunk.hash) : void 0;
544
+ if (hit && hit.length > 0) embeddings[index] = hit;
545
+ else if (chunk) missing.push({
546
+ index,
547
+ chunk
548
+ });
549
+ }
550
+ return {
551
+ embeddings,
552
+ missing
553
+ };
554
+ }
555
+ //#endregion
556
+ //#region extensions/memory-core/src/memory/manager-embedding-errors.ts
557
+ const MEMORY_EMBEDDING_OPERATION_ERROR_CODE = "MEMORY_EMBEDDING_OPERATION_FAILED";
558
+ function createMemoryEmbeddingOperationError(params) {
559
+ const message = formatErrorMessage(params.cause);
560
+ const error = new Error(message);
561
+ error.code = MEMORY_EMBEDDING_OPERATION_ERROR_CODE;
562
+ error.operation = params.operation;
563
+ if (params.providerId) error.providerId = params.providerId;
564
+ error.cause = params.cause;
565
+ return error;
566
+ }
567
+ function isMemoryEmbeddingOperationError(err) {
568
+ return err instanceof Error && err.code === "MEMORY_EMBEDDING_OPERATION_FAILED";
569
+ }
570
+ //#endregion
571
+ //#region extensions/memory-core/src/memory/manager-embedding-policy.ts
572
+ function estimateUtf8Bytes(text) {
573
+ if (!text) return 0;
574
+ return Buffer.byteLength(text, "utf8");
575
+ }
576
+ function estimateStructuredEmbeddingInputBytes(input) {
577
+ if (!input.parts?.length) return estimateUtf8Bytes(input.text);
578
+ let total = 0;
579
+ for (const part of input.parts) if (part.type === "text") total += estimateUtf8Bytes(part.text);
580
+ else {
581
+ total += estimateUtf8Bytes(part.mimeType);
582
+ total += estimateUtf8Bytes(part.data);
583
+ }
584
+ return total;
585
+ }
586
+ function filterNonEmptyMemoryChunks(chunks) {
587
+ return chunks.filter((chunk) => chunk.text.trim().length > 0);
588
+ }
589
+ function buildMemoryEmbeddingBatches(chunks, maxTokens) {
590
+ const batches = [];
591
+ let current = [];
592
+ let currentTokens = 0;
593
+ for (const chunk of chunks) {
594
+ const estimate = chunk.embeddingInput ? estimateStructuredEmbeddingInputBytes(chunk.embeddingInput) : estimateUtf8Bytes(chunk.text);
595
+ if (current.length > 0 && currentTokens + estimate > maxTokens) {
596
+ batches.push(current);
597
+ current = [];
598
+ currentTokens = 0;
599
+ }
600
+ if (current.length === 0 && estimate > maxTokens) {
601
+ batches.push([chunk]);
602
+ continue;
603
+ }
604
+ current.push(chunk);
605
+ currentTokens += estimate;
606
+ }
607
+ if (current.length > 0) batches.push(current);
608
+ return batches;
609
+ }
610
+ function isRetryableMemoryEmbeddingError(message) {
611
+ return /(rate[_ ]limit|too many requests|429|resource has been exhausted|5\d\d|cloudflare|tokens per day|fetch failed|other side closed|ECONNRESET|ECONNREFUSED|ETIMEDOUT|EPIPE|UND_ERR_|socket hang up|network error|read ECONN|timed out)/i.test(message);
612
+ }
613
+ function resolveMemoryEmbeddingRetryDelay(delayMs, randomValue, maxDelayMs) {
614
+ return Math.min(maxDelayMs, Math.round(delayMs * (1 + randomValue * .2)));
615
+ }
616
+ async function runMemoryEmbeddingRetryLoop(params) {
617
+ let attempt = 0;
618
+ let delayMs = params.baseDelayMs;
619
+ while (true) try {
620
+ return await params.run();
621
+ } catch (err) {
622
+ const message = formatErrorMessage(err);
623
+ if (!params.isRetryable(message) || attempt >= params.maxAttempts) throw err;
624
+ await params.waitForRetry(delayMs);
625
+ delayMs *= 2;
626
+ attempt += 1;
627
+ }
628
+ }
629
+ function buildTextEmbeddingInputs(chunks) {
630
+ return chunks.map((chunk) => chunk.embeddingInput ?? { text: chunk.text });
631
+ }
632
+ //#endregion
633
+ //#region extensions/memory-core/src/memory/manager-fts-state.ts
634
+ function deleteMemoryFtsRows(params) {
635
+ const tableName = params.tableName ?? "chunks_fts";
636
+ if (params.currentModel) {
637
+ params.db.prepare(`DELETE FROM ${tableName} WHERE path = ? AND source = ? AND model = ?`).run(params.path, params.source, params.currentModel);
638
+ return;
639
+ }
640
+ params.db.prepare(`DELETE FROM ${tableName} WHERE path = ? AND source = ?`).run(params.path, params.source);
641
+ }
642
+ //#endregion
643
+ //#region extensions/memory-core/src/memory/manager-atomic-reindex.ts
644
+ const defaultFileOps = {
645
+ rename: fs$1.rename,
646
+ rm: fs$1.rm,
647
+ wait: setTimeout$1
648
+ };
649
+ const transientFileErrorCodes = new Set([
650
+ "EBUSY",
651
+ "EPERM",
652
+ "EACCES"
653
+ ]);
654
+ const defaultMaxRenameAttempts = 6;
655
+ const defaultRenameRetryDelayMs = 25;
656
+ const defaultMaxRemoveAttempts = 10;
657
+ const defaultRemoveRetryDelayMs = 50;
658
+ function isTransientFileError(err) {
659
+ return transientFileErrorCodes.has(err.code ?? "");
660
+ }
661
+ function resolveMemoryIndexFileOptions(options = {}) {
662
+ return {
663
+ fileOps: options.fileOps ?? defaultFileOps,
664
+ maxRenameAttempts: Math.max(1, options.maxRenameAttempts ?? defaultMaxRenameAttempts),
665
+ renameRetryDelayMs: options.renameRetryDelayMs ?? defaultRenameRetryDelayMs,
666
+ maxRemoveAttempts: Math.max(1, options.maxRemoveAttempts ?? defaultMaxRemoveAttempts),
667
+ removeRetryDelayMs: options.removeRetryDelayMs ?? defaultRemoveRetryDelayMs
668
+ };
669
+ }
670
+ async function renameWithRetry(source, target, options) {
671
+ for (let attempt = 1; attempt <= options.maxRenameAttempts; attempt++) try {
672
+ await options.fileOps.rename(source, target);
673
+ return;
674
+ } catch (err) {
675
+ if (err.code === "ENOENT") return;
676
+ if (!isTransientFileError(err) || attempt === options.maxRenameAttempts) throw err;
677
+ await options.fileOps.wait(options.renameRetryDelayMs * attempt);
678
+ }
679
+ throw new Error("重命名重试循环意外退出");
680
+ }
681
+ async function moveMemoryIndexFiles(sourceBase, targetBase, options = {}) {
682
+ const resolvedOptions = resolveMemoryIndexFileOptions(options);
683
+ for (const suffix of [
684
+ "",
685
+ "-wal",
686
+ "-shm"
687
+ ]) await renameWithRetry(`${sourceBase}${suffix}`, `${targetBase}${suffix}`, resolvedOptions);
688
+ }
689
+ async function rmWithRetry(path, options) {
690
+ for (let attempt = 1; attempt <= options.maxRemoveAttempts; attempt++) try {
691
+ await options.fileOps.rm(path, { force: true });
692
+ return;
693
+ } catch (err) {
694
+ if (err.code === "ENOENT") return;
695
+ if (!isTransientFileError(err) || attempt === options.maxRemoveAttempts) throw err;
696
+ await options.fileOps.wait(options.removeRetryDelayMs * attempt);
697
+ }
698
+ throw new Error("删除重试循环意外退出");
699
+ }
700
+ async function removeMemoryIndexFiles(basePath, options = {}) {
701
+ const resolvedOptions = resolveMemoryIndexFileOptions(options);
702
+ for (const suffix of [
703
+ "",
704
+ "-wal",
705
+ "-shm"
706
+ ]) await rmWithRetry(`${basePath}${suffix}`, resolvedOptions);
707
+ }
708
+ async function swapMemoryIndexFiles(targetPath, tempPath) {
709
+ const backupPath = `${targetPath}.backup-${randomUUID()}`;
710
+ await moveMemoryIndexFiles(targetPath, backupPath);
711
+ try {
712
+ await moveMemoryIndexFiles(tempPath, targetPath);
713
+ } catch (err) {
714
+ await moveMemoryIndexFiles(backupPath, targetPath);
715
+ throw err;
716
+ }
717
+ await removeMemoryIndexFiles(backupPath);
718
+ }
719
+ async function runMemoryAtomicReindex(params) {
720
+ try {
721
+ const result = await params.build();
722
+ await swapMemoryIndexFiles(params.targetPath, params.tempPath);
723
+ return result;
724
+ } catch (err) {
725
+ try {
726
+ await params.beforeTempCleanup?.();
727
+ await removeMemoryIndexFiles(params.tempPath, params.fileOptions);
728
+ } catch (cleanupErr) {
729
+ throw new AggregateError([err, cleanupErr], "memory atomic reindex failed and temp cleanup failed", { cause: cleanupErr });
730
+ }
731
+ throw err;
732
+ }
733
+ }
734
+ //#endregion
735
+ //#region extensions/memory-core/src/memory/manager-provider-state.ts
736
+ function createPendingMemoryProviderLifecycle(requestedProvider) {
737
+ return {
738
+ mode: "pending",
739
+ requestedProvider
740
+ };
741
+ }
742
+ function createDegradedMemoryProviderLifecycle(params) {
743
+ return {
744
+ mode: "degraded",
745
+ providerId: params.providerId,
746
+ reason: params.reason,
747
+ ...params.code ? { code: params.code } : {}
748
+ };
749
+ }
750
+ function resolveProviderLifecycle(result) {
751
+ if (result.provider && result.fallbackFrom) return {
752
+ mode: "fallback-active",
753
+ providerId: result.provider.id,
754
+ fallbackFrom: result.fallbackFrom,
755
+ reason: result.fallbackReason ?? "fallback activated"
756
+ };
757
+ if (result.provider) return {
758
+ mode: "active",
759
+ providerId: result.provider.id
760
+ };
761
+ return {
762
+ mode: "fts-only",
763
+ reason: result.providerUnavailableReason ?? "No embedding provider available",
764
+ attemptedProviderId: result.requestedProvider
765
+ };
766
+ }
767
+ function resolveFallbackCurrentProviderId(params) {
768
+ if (params.provider) return params.provider.id;
769
+ if (params.lifecycle.mode === "degraded") return params.lifecycle.providerId;
770
+ return null;
771
+ }
772
+ function resolveMemoryPrimaryProviderRequest(params) {
773
+ return {
774
+ provider: params.settings.provider,
775
+ model: params.settings.model,
776
+ remote: params.settings.remote,
777
+ inputType: params.settings.inputType,
778
+ queryInputType: params.settings.queryInputType,
779
+ documentInputType: params.settings.documentInputType,
780
+ outputDimensionality: params.settings.outputDimensionality,
781
+ fallback: params.settings.fallback,
782
+ local: params.settings.local
783
+ };
784
+ }
785
+ function resolveMemoryProviderState(result) {
786
+ return {
787
+ provider: result.provider,
788
+ fallbackFrom: result.fallbackFrom,
789
+ fallbackReason: result.fallbackReason,
790
+ providerUnavailableReason: result.providerUnavailableReason,
791
+ providerRuntime: result.runtime,
792
+ lifecycle: resolveProviderLifecycle(result)
793
+ };
794
+ }
795
+ function applyMemoryFallbackProviderState(params) {
796
+ return {
797
+ ...params.current,
798
+ fallbackFrom: params.fallbackFrom,
799
+ fallbackReason: params.reason,
800
+ providerUnavailableReason: void 0,
801
+ provider: params.result.provider,
802
+ providerRuntime: params.result.runtime,
803
+ lifecycle: params.result.provider ? {
804
+ mode: "fallback-active",
805
+ providerId: params.result.provider.id,
806
+ fallbackFrom: params.fallbackFrom,
807
+ reason: params.reason
808
+ } : {
809
+ mode: "fts-only",
810
+ reason: params.reason,
811
+ attemptedProviderId: params.fallbackFrom
812
+ }
813
+ };
814
+ }
815
+ function resolveMemoryFallbackProviderRequest(params) {
816
+ const fallback = params.settings.fallback;
817
+ if (!fallback || fallback === "none" || !params.currentProviderId || fallback === params.currentProviderId) return null;
818
+ return {
819
+ provider: fallback,
820
+ model: resolveEmbeddingProviderFallbackModel(fallback, params.settings.model, params.cfg),
821
+ remote: params.settings.remote,
822
+ inputType: params.settings.inputType,
823
+ queryInputType: params.settings.queryInputType,
824
+ documentInputType: params.settings.documentInputType,
825
+ outputDimensionality: params.settings.outputDimensionality,
826
+ fallback: "none",
827
+ local: params.settings.local
828
+ };
829
+ }
830
+ //#endregion
831
+ //#region extensions/memory-core/src/memory/manager-reindex-state.ts
832
+ function resolveConfiguredSourcesForMeta(sources) {
833
+ const normalized = Array.from(sources).filter((source) => source === "memory" || source === "sessions").toSorted((left, right) => left.localeCompare(right));
834
+ return normalized.length > 0 ? normalized : ["memory"];
835
+ }
836
+ function normalizeMetaSources(meta) {
837
+ if (!Array.isArray(meta.sources)) return ["memory"];
838
+ const normalized = Array.from(new Set(meta.sources.filter((source) => source === "memory" || source === "sessions"))).toSorted((left, right) => left.localeCompare(right));
839
+ return normalized.length > 0 ? normalized : ["memory"];
840
+ }
841
+ function configuredMetaSourcesDiffer(params) {
842
+ const metaSources = normalizeMetaSources(params.meta);
843
+ if (metaSources.length !== params.configuredSources.length) return true;
844
+ return metaSources.some((source, index) => source !== params.configuredSources[index]);
845
+ }
846
+ function resolveConfiguredScopeHash(params) {
847
+ const extraPaths = normalizeExtraMemoryPaths(params.workspaceDir, params.extraPaths).map((value) => value.replace(/\\/g, "/")).toSorted();
848
+ return hashText(JSON.stringify({
849
+ extraPaths,
850
+ multimodal: {
851
+ enabled: params.multimodal.enabled,
852
+ modalities: [...params.multimodal.modalities].toSorted(),
853
+ maxFileBytes: params.multimodal.maxFileBytes
854
+ }
855
+ }));
856
+ }
857
+ function shouldRunFullMemoryReindex(params) {
858
+ const { meta } = params;
859
+ return !meta || (params.provider ? meta.model !== params.provider.model : meta.model !== "fts-only") || (params.provider ? meta.provider !== params.provider.id : meta.provider !== "none") || meta.providerKey !== params.providerKey || configuredMetaSourcesDiffer({
860
+ meta,
861
+ configuredSources: params.configuredSources
862
+ }) || meta.scopeHash !== params.configuredScopeHash || meta.chunkTokens !== params.chunkTokens || meta.chunkOverlap !== params.chunkOverlap || params.vectorReady && !meta.vectorDims || (meta.ftsTokenizer ?? "unicode61") !== params.ftsTokenizer;
863
+ }
864
+ //#endregion
865
+ //#region extensions/memory-core/src/memory/manager-session-reindex.ts
866
+ function shouldSyncSessionsForReindex(params) {
867
+ if (!params.hasSessionSource) return false;
868
+ if (params.sync?.sessionFiles?.some((sessionFile) => sessionFile.trim().length > 0)) return true;
869
+ if (params.sync?.force) return true;
870
+ if (params.needsFullReindex) return true;
871
+ const reason = params.sync?.reason;
872
+ if (reason === "session-start" || reason === "watch") return false;
873
+ return params.sessionsDirty && params.dirtySessionFileCount > 0;
874
+ }
875
+ //#endregion
876
+ //#region extensions/memory-core/src/memory/manager-source-state.ts
877
+ const MEMORY_SOURCE_FILE_STATE_SQL = `SELECT path, hash, mtime, size FROM files WHERE source = ?`;
878
+ const MEMORY_SOURCE_FILE_HASH_SQL = `SELECT hash FROM files WHERE path = ? AND source = ?`;
879
+ function loadMemorySourceFileState(params) {
880
+ const normalizedRows = params.db.prepare(MEMORY_SOURCE_FILE_STATE_SQL).all(params.source) ?? [];
881
+ return {
882
+ rows: normalizedRows,
883
+ hashes: new Map(normalizedRows.map((row) => [row.path, row.hash]))
884
+ };
885
+ }
886
+ function resolveMemorySourceExistingHash(params) {
887
+ if (params.existingHashes) return params.existingHashes.get(params.path);
888
+ return params.db.prepare(MEMORY_SOURCE_FILE_HASH_SQL).get(params.path, params.source)?.hash;
889
+ }
890
+ //#endregion
891
+ //#region extensions/memory-core/src/memory/manager-session-sync-state.ts
892
+ function resolveMemorySessionStartupDirtyFiles(params) {
893
+ const indexedRows = new Map((params.existingRows ?? []).map((row) => [row.path, row]));
894
+ const dirtyFiles = [];
895
+ for (const file of params.files) {
896
+ const existing = indexedRows.get(file.path);
897
+ if (!existing) {
898
+ dirtyFiles.push(file.absPath);
899
+ continue;
900
+ }
901
+ const indexedMtimeMs = Number(existing.mtime);
902
+ const indexedSize = Number(existing.size);
903
+ if (!Number.isFinite(indexedMtimeMs) || !Number.isFinite(indexedSize)) {
904
+ dirtyFiles.push(file.absPath);
905
+ continue;
906
+ }
907
+ if (file.size !== indexedSize || file.mtimeMs > indexedMtimeMs) dirtyFiles.push(file.absPath);
908
+ }
909
+ return dirtyFiles;
910
+ }
911
+ function resolveMemorySessionSyncPlan(params) {
912
+ const activePaths = params.targetSessionFiles ? null : new Set(params.files.map((file) => params.sessionPathForFile(file)));
913
+ const existingRows = activePaths === null ? null : params.existingRows ?? [];
914
+ return {
915
+ activePaths,
916
+ existingRows,
917
+ existingHashes: existingRows ? new Map(existingRows.map((row) => [row.path, row.hash])) : null,
918
+ indexAll: params.needsFullReindex || Boolean(params.targetSessionFiles) || params.sessionsDirtyFiles.size === 0
919
+ };
920
+ }
921
+ //#endregion
922
+ //#region extensions/memory-core/src/memory/manager-targeted-sync.ts
923
+ function clearMemorySyncedSessionFiles(params) {
924
+ if (!params.targetSessionFiles) params.sessionsDirtyFiles.clear();
925
+ else for (const targetSessionFile of params.targetSessionFiles) params.sessionsDirtyFiles.delete(targetSessionFile);
926
+ return params.sessionsDirtyFiles.size > 0;
927
+ }
928
+ async function runMemoryTargetedSessionSync(params) {
929
+ if (!params.hasSessionSource || !params.targetSessionFiles) return {
930
+ handled: false,
931
+ sessionsDirty: params.sessionsDirtyFiles.size > 0
932
+ };
933
+ try {
934
+ await params.syncSessionFiles({
935
+ needsFullReindex: false,
936
+ targetSessionFiles: Array.from(params.targetSessionFiles),
937
+ progress: params.progress
938
+ });
939
+ return {
940
+ handled: true,
941
+ sessionsDirty: clearMemorySyncedSessionFiles({
942
+ sessionsDirtyFiles: params.sessionsDirtyFiles,
943
+ targetSessionFiles: params.targetSessionFiles
944
+ })
945
+ };
946
+ } catch (err) {
947
+ const reason = formatErrorMessage(err);
948
+ if (!(params.shouldFallbackOnError(err) && await params.activateFallbackProvider(reason))) throw err;
949
+ const reindexParams = {
950
+ reason: params.reason,
951
+ force: true,
952
+ progress: params.progress
953
+ };
954
+ if (params.useUnsafeReindex) await params.runUnsafeReindex(reindexParams);
955
+ else await params.runSafeReindex(reindexParams);
956
+ return {
957
+ handled: true,
958
+ sessionsDirty: params.sessionsDirtyFiles.size > 0
959
+ };
960
+ }
961
+ }
962
+ //#endregion
963
+ //#region extensions/memory-core/src/memory/manager-sync-ops.ts
964
+ const META_KEY = "memory_index_meta_v1";
965
+ const VECTOR_TABLE$2 = "chunks_vec";
966
+ const FTS_TABLE$2 = "chunks_fts";
967
+ const EMBEDDING_CACHE_TABLE$2 = "embedding_cache";
968
+ const SESSION_DIRTY_DEBOUNCE_MS = 5e3;
969
+ const SESSION_DELTA_READ_CHUNK_BYTES = 64 * 1024;
970
+ const SESSION_SYNC_YIELD_EVERY = 10;
971
+ const VECTOR_LOAD_TIMEOUT_MS = 3e4;
972
+ const IGNORED_MEMORY_WATCH_DIR_NAMES = new Set([
973
+ ".git",
974
+ "node_modules",
975
+ ".pnpm-store",
976
+ ".venv",
977
+ "venv",
978
+ ".tox",
979
+ "__pycache__"
980
+ ]);
981
+ const log$3 = createSubsystemLogger("memory");
982
+ const TEST_MEMORY_WATCH_FACTORY_KEY = Symbol.for("fengming.test.memoryWatchFactory");
983
+ const TEST_MEMORY_NATIVE_WATCH_FACTORY_KEY = Symbol.for("fengming.test.memoryNativeWatchFactory");
984
+ function resolveMemoryWatchFactory() {
985
+ if (process.env.VITEST === "true" || false) {
986
+ const override = globalThis[TEST_MEMORY_WATCH_FACTORY_KEY];
987
+ if (typeof override === "function") return override;
988
+ }
989
+ return chokidar.watch.bind(chokidar);
990
+ }
991
+ function resolveMemoryNativeWatchFactory() {
992
+ if (process.env.VITEST === "true" || false) {
993
+ const override = globalThis[TEST_MEMORY_NATIVE_WATCH_FACTORY_KEY];
994
+ if (typeof override === "function") return override;
995
+ }
996
+ return fs.watch.bind(fs);
997
+ }
998
+ function shouldIgnoreMemoryWatchPath(watchPath, stats, multimodalSettings) {
999
+ const normalized = path.normalize(watchPath);
1000
+ if (normalized.split(path.sep).map((segment) => normalizeLowercaseStringOrEmpty(segment)).some((segment) => IGNORED_MEMORY_WATCH_DIR_NAMES.has(segment))) return true;
1001
+ if (stats?.isDirectory?.()) return false;
1002
+ if (!stats) return false;
1003
+ const extension = normalizeLowercaseStringOrEmpty(path.extname(normalized));
1004
+ if (extension.length === 0 || extension === ".md") return false;
1005
+ if (!multimodalSettings) return true;
1006
+ return classifyMemoryMultimodalPath(normalized, multimodalSettings) === null;
1007
+ }
1008
+ function runDetachedMemorySync(sync, reason) {
1009
+ sync().catch((err) => {
1010
+ log$3.warn(`memory sync failed (${reason}): ${String(err)}`);
1011
+ });
1012
+ }
1013
+ function createSessionSyncYield(total) {
1014
+ let completed = 0;
1015
+ return async () => {
1016
+ completed += 1;
1017
+ if (completed < total && completed % SESSION_SYNC_YIELD_EVERY === 0) await new Promise((resolve) => {
1018
+ setImmediate(resolve);
1019
+ });
1020
+ };
1021
+ }
1022
+ var MemoryManagerSyncOps = class {
1023
+ constructor() {
1024
+ this.provider = null;
1025
+ this.sources = /* @__PURE__ */ new Set();
1026
+ this.providerKey = null;
1027
+ this.fts = {
1028
+ enabled: false,
1029
+ available: false
1030
+ };
1031
+ this.vectorReady = null;
1032
+ this.watcher = null;
1033
+ this.nativeMemoryWatchPairs = [];
1034
+ this.watchTimer = null;
1035
+ this.sessionWatchTimer = null;
1036
+ this.sessionUnsubscribe = null;
1037
+ this.intervalTimer = null;
1038
+ this.closed = false;
1039
+ this.dirty = false;
1040
+ this.pendingWatchPaths = /* @__PURE__ */ new Map();
1041
+ this.sessionsDirty = false;
1042
+ this.sessionsDirtyFiles = /* @__PURE__ */ new Set();
1043
+ this.sessionPendingFiles = /* @__PURE__ */ new Set();
1044
+ this.sessionDeltas = /* @__PURE__ */ new Map();
1045
+ this.vectorDegradedWriteWarningShown = false;
1046
+ this.lastMetaSerialized = null;
1047
+ }
1048
+ resetVectorState() {
1049
+ this.vectorReady = null;
1050
+ this.vector.available = null;
1051
+ this.vector.semanticAvailable = void 0;
1052
+ this.vector.loadError = void 0;
1053
+ this.vector.dims = void 0;
1054
+ this.vectorDegradedWriteWarningShown = false;
1055
+ }
1056
+ async ensureVectorReady(dimensions) {
1057
+ if (!this.vector.enabled) return false;
1058
+ if (!this.vectorReady) this.vectorReady = this.withTimeout(this.loadVectorExtension(), VECTOR_LOAD_TIMEOUT_MS, `sqlite-vec load timed out after ${Math.round(VECTOR_LOAD_TIMEOUT_MS / 1e3)}s`);
1059
+ let ready = false;
1060
+ try {
1061
+ ready = await this.vectorReady || false;
1062
+ } catch (err) {
1063
+ const message = formatErrorMessage(err);
1064
+ this.vector.available = false;
1065
+ this.vector.loadError = message;
1066
+ this.vectorReady = null;
1067
+ log$3.warn(`sqlite-vec unavailable: ${message}`);
1068
+ return false;
1069
+ }
1070
+ if (ready && typeof dimensions === "number" && dimensions > 0) this.ensureVectorTable(dimensions);
1071
+ return ready;
1072
+ }
1073
+ async loadVectorExtension() {
1074
+ if (this.vector.available !== null) return this.vector.available;
1075
+ if (!this.vector.enabled) {
1076
+ this.vector.available = false;
1077
+ return false;
1078
+ }
1079
+ try {
1080
+ const resolvedPath = this.vector.extensionPath?.trim() ? resolveUserPath(this.vector.extensionPath) : void 0;
1081
+ const loaded = await loadSqliteVecExtension({
1082
+ db: this.db,
1083
+ extensionPath: resolvedPath
1084
+ });
1085
+ if (!loaded.ok) throw new Error(loaded.error ?? "unknown sqlite-vec load error");
1086
+ this.vector.extensionPath = loaded.extensionPath;
1087
+ this.vector.available = true;
1088
+ return true;
1089
+ } catch (err) {
1090
+ const message = formatErrorMessage(err);
1091
+ this.vector.available = false;
1092
+ this.vector.loadError = message;
1093
+ log$3.warn(`sqlite-vec unavailable: ${message}`);
1094
+ return false;
1095
+ }
1096
+ }
1097
+ ensureVectorTable(dimensions) {
1098
+ if (this.vector.dims === dimensions) return;
1099
+ if (this.vector.dims && this.vector.dims !== dimensions) this.dropVectorTable();
1100
+ this.db.exec(`CREATE VIRTUAL TABLE IF NOT EXISTS ${VECTOR_TABLE$2} USING vec0(\n id TEXT PRIMARY KEY,\n embedding FLOAT[${dimensions}]\n)`);
1101
+ this.vector.dims = dimensions;
1102
+ }
1103
+ dropVectorTable() {
1104
+ try {
1105
+ this.db.exec(`DROP TABLE IF EXISTS ${VECTOR_TABLE$2}`);
1106
+ } catch (err) {
1107
+ const message = formatErrorMessage(err);
1108
+ log$3.debug(`Failed to drop ${VECTOR_TABLE$2}: ${message}`);
1109
+ }
1110
+ }
1111
+ buildSourceFilter(alias, sourcesOverride) {
1112
+ const sources = sourcesOverride ?? Array.from(this.sources);
1113
+ if (sources.length === 0) return {
1114
+ sql: "",
1115
+ params: []
1116
+ };
1117
+ return {
1118
+ sql: ` AND ${alias ? `${alias}.source` : "source"} IN (${sources.map(() => "?").join(", ")})`,
1119
+ params: sources
1120
+ };
1121
+ }
1122
+ openDatabase() {
1123
+ return openMemoryDatabaseAtPath(resolveUserPath(this.settings.store.path), this.settings.store.vector.enabled);
1124
+ }
1125
+ async seedEmbeddingCache(sourceDb) {
1126
+ if (!this.cache.enabled) return;
1127
+ let transactionStarted = false;
1128
+ try {
1129
+ const rows = sourceDb.prepare(`SELECT provider, model, provider_key, hash, embedding, dims, updated_at FROM ${EMBEDDING_CACHE_TABLE$2}`).iterate();
1130
+ const SEED_EMBEDDING_YIELD_EVERY = 1e3;
1131
+ let rowCount = 0;
1132
+ let insert = null;
1133
+ for (const row of rows) {
1134
+ if (!insert) {
1135
+ insert = this.db.prepare(`INSERT INTO ${EMBEDDING_CACHE_TABLE$2} (provider, model, provider_key, hash, embedding, dims, updated_at)
1136
+ VALUES (?, ?, ?, ?, ?, ?, ?)
1137
+ ON CONFLICT(provider, model, provider_key, hash) DO UPDATE SET
1138
+ embedding=excluded.embedding,
1139
+ dims=excluded.dims,
1140
+ updated_at=excluded.updated_at`);
1141
+ this.db.exec("BEGIN");
1142
+ transactionStarted = true;
1143
+ }
1144
+ insert.run(row.provider, row.model, row.provider_key, row.hash, row.embedding, row.dims, row.updated_at);
1145
+ rowCount += 1;
1146
+ if (rowCount % SEED_EMBEDDING_YIELD_EVERY === 0) await new Promise((resolve) => {
1147
+ setImmediate(resolve);
1148
+ });
1149
+ }
1150
+ if (transactionStarted) this.db.exec("COMMIT");
1151
+ } catch (err) {
1152
+ if (transactionStarted) try {
1153
+ this.db.exec("ROLLBACK");
1154
+ } catch {}
1155
+ throw err;
1156
+ }
1157
+ }
1158
+ ensureSchema() {
1159
+ const result = ensureMemoryIndexSchema({
1160
+ db: this.db,
1161
+ embeddingCacheTable: EMBEDDING_CACHE_TABLE$2,
1162
+ cacheEnabled: this.cache.enabled,
1163
+ ftsTable: FTS_TABLE$2,
1164
+ ftsEnabled: this.fts.enabled,
1165
+ ftsTokenizer: this.settings.store.fts.tokenizer
1166
+ });
1167
+ this.fts.available = result.ftsAvailable;
1168
+ if (result.ftsError) {
1169
+ this.fts.loadError = result.ftsError;
1170
+ if (this.fts.enabled) log$3.warn(`fts unavailable: ${result.ftsError}`);
1171
+ }
1172
+ }
1173
+ ensureWatcher() {
1174
+ if (!this.sources.has("memory") || !this.settings.sync.watch) return;
1175
+ if (this.watcher || this.nativeMemoryWatchPairs.length > 0) return;
1176
+ const fileWatchPaths = new Set([path.join(this.workspaceDir, "MEMORY.md")]);
1177
+ const dirWatchPaths = new Set([path.join(this.workspaceDir, "memory")]);
1178
+ const additionalPaths = normalizeExtraMemoryPaths(this.workspaceDir, this.settings.extraPaths);
1179
+ for (const entry of additionalPaths) try {
1180
+ const stat = fs.lstatSync(entry);
1181
+ if (stat.isSymbolicLink()) continue;
1182
+ if (stat.isDirectory()) {
1183
+ dirWatchPaths.add(entry);
1184
+ continue;
1185
+ }
1186
+ if (stat.isFile() && (normalizeLowercaseStringOrEmpty(entry).endsWith(".md") || classifyMemoryMultimodalPath(entry, this.settings.multimodal) !== null)) fileWatchPaths.add(entry);
1187
+ } catch {}
1188
+ const markDirty = (watchPath, stats) => {
1189
+ recordMemoryWatchEventPath(this.pendingWatchPaths, watchPath, stats);
1190
+ this.dirty = true;
1191
+ this.scheduleWatchSync();
1192
+ };
1193
+ const nativeRecursiveSupported = process.platform === "darwin" || process.platform === "win32";
1194
+ for (const dir of dirWatchPaths) {
1195
+ if (!nativeRecursiveSupported) {
1196
+ fileWatchPaths.add(dir);
1197
+ continue;
1198
+ }
1199
+ if (!this.attachNativeMemoryWatchForDir(dir, markDirty)) fileWatchPaths.add(dir);
1200
+ }
1201
+ if (fileWatchPaths.size > 0) {
1202
+ this.watcher = resolveMemoryWatchFactory()(Array.from(fileWatchPaths), {
1203
+ ignoreInitial: true,
1204
+ ignored: (watchPath, stats) => shouldIgnoreMemoryWatchPath(watchPath, stats, this.settings.multimodal)
1205
+ });
1206
+ this.watcher.on("add", markDirty);
1207
+ this.watcher.on("change", markDirty);
1208
+ this.watcher.on("unlink", markDirty);
1209
+ this.watcher.on("unlinkDir", markDirty);
1210
+ this.watcher.on("error", (err) => {
1211
+ const message = err instanceof Error ? err.message : String(err);
1212
+ log$3.warn(`memory watcher error: ${message}`);
1213
+ });
1214
+ }
1215
+ }
1216
+ attachNativeMemoryWatchForDir(dir, markDirty) {
1217
+ if (this.closed) return false;
1218
+ let recordedInode;
1219
+ try {
1220
+ recordedInode = fs.statSync(dir).ino;
1221
+ } catch {
1222
+ return false;
1223
+ }
1224
+ let mainWatcher;
1225
+ try {
1226
+ mainWatcher = resolveMemoryNativeWatchFactory()(dir, { recursive: true }, (_eventType, filename) => {
1227
+ if (filename == null) {
1228
+ markDirty();
1229
+ return;
1230
+ }
1231
+ const full = path.join(dir, filename);
1232
+ let stats;
1233
+ try {
1234
+ stats = fs.lstatSync(full, { throwIfNoEntry: false }) ?? void 0;
1235
+ } catch {
1236
+ stats = void 0;
1237
+ }
1238
+ if (shouldIgnoreMemoryWatchPath(full, stats, this.settings.multimodal)) return;
1239
+ markDirty(full, stats);
1240
+ });
1241
+ } catch (err) {
1242
+ log$3.warn(`failed to start native recursive watcher on ${dir}: ${String(err)}; falling back to chokidar`);
1243
+ return false;
1244
+ }
1245
+ const pair = {
1246
+ dir,
1247
+ main: mainWatcher,
1248
+ parent: null
1249
+ };
1250
+ mainWatcher.on("error", (err) => {
1251
+ const message = err instanceof Error ? err.message : String(err);
1252
+ log$3.warn(`memory native watcher error on ${dir}: ${message}`);
1253
+ this.closeNativeMemoryWatchPair(pair);
1254
+ if (this.closed) return;
1255
+ markDirty();
1256
+ this.attachMemoryChokidarFallback(dir, markDirty);
1257
+ });
1258
+ this.nativeMemoryWatchPairs.push(pair);
1259
+ try {
1260
+ const parentDir = path.dirname(dir);
1261
+ const baseName = path.basename(dir);
1262
+ const parentWatcher = resolveMemoryNativeWatchFactory()(parentDir, { recursive: false }, (_eventType, filename) => {
1263
+ if (filename !== null && filename !== baseName) return;
1264
+ let currentInode;
1265
+ try {
1266
+ currentInode = fs.statSync(dir).ino;
1267
+ } catch {
1268
+ currentInode = null;
1269
+ }
1270
+ if (currentInode === recordedInode) return;
1271
+ this.closeNativeMemoryWatchPair(pair);
1272
+ if (this.closed) return;
1273
+ markDirty();
1274
+ if (currentInode !== null) {
1275
+ if (!this.attachNativeMemoryWatchForDir(dir, markDirty)) this.attachMemoryChokidarFallback(dir, markDirty);
1276
+ } else this.attachMemoryChokidarFallback(dir, markDirty);
1277
+ });
1278
+ parentWatcher.on("error", (err) => {
1279
+ const message = err instanceof Error ? err.message : String(err);
1280
+ log$3.warn(`memory native parent watcher error on ${path.dirname(dir)}: ${message}`);
1281
+ try {
1282
+ parentWatcher.close();
1283
+ } catch {}
1284
+ this.removeNativeMemoryParentWatch(parentWatcher);
1285
+ if (pair.parent === parentWatcher) pair.parent = null;
1286
+ });
1287
+ pair.parent = parentWatcher;
1288
+ } catch (err) {
1289
+ log$3.warn(`memory native parent watcher could not start on ${path.dirname(dir)}: ${String(err)}`);
1290
+ }
1291
+ return true;
1292
+ }
1293
+ closeNativeMemoryWatchPair(pair) {
1294
+ try {
1295
+ pair.main.close();
1296
+ } catch {}
1297
+ if (pair.parent) {
1298
+ try {
1299
+ pair.parent.close();
1300
+ } catch {}
1301
+ pair.parent = null;
1302
+ }
1303
+ this.removeNativeMemoryWatchPair(pair);
1304
+ }
1305
+ closeNativeMemoryWatchPairs() {
1306
+ while (this.nativeMemoryWatchPairs.length > 0) {
1307
+ const pair = this.nativeMemoryWatchPairs[0];
1308
+ if (!pair) return;
1309
+ this.closeNativeMemoryWatchPair(pair);
1310
+ }
1311
+ }
1312
+ removeNativeMemoryParentWatch(w) {
1313
+ for (const pair of this.nativeMemoryWatchPairs) if (pair.parent === w) {
1314
+ pair.parent = null;
1315
+ return;
1316
+ }
1317
+ }
1318
+ removeNativeMemoryWatchPair(pair) {
1319
+ const idx = this.nativeMemoryWatchPairs.indexOf(pair);
1320
+ if (idx >= 0) this.nativeMemoryWatchPairs.splice(idx, 1);
1321
+ }
1322
+ attachMemoryChokidarFallback(dir, markDirty) {
1323
+ if (this.closed) return;
1324
+ try {
1325
+ if (this.watcher) {
1326
+ this.watcher.add(dir);
1327
+ return;
1328
+ }
1329
+ this.watcher = resolveMemoryWatchFactory()([dir], {
1330
+ ignoreInitial: true,
1331
+ ignored: (watchPath, stats) => shouldIgnoreMemoryWatchPath(watchPath, stats, this.settings.multimodal)
1332
+ });
1333
+ this.watcher.on("add", markDirty);
1334
+ this.watcher.on("change", markDirty);
1335
+ this.watcher.on("unlink", markDirty);
1336
+ this.watcher.on("unlinkDir", markDirty);
1337
+ this.watcher.on("error", (err) => {
1338
+ const message = err instanceof Error ? err.message : String(err);
1339
+ log$3.warn(`memory watcher error: ${message}`);
1340
+ });
1341
+ } catch (err) {
1342
+ log$3.warn(`failed to attach chokidar fallback for ${dir}: ${String(err)}`);
1343
+ }
1344
+ }
1345
+ ensureSessionListener() {
1346
+ if (!this.sources.has("sessions") || this.sessionUnsubscribe) return;
1347
+ this.sessionUnsubscribe = onSessionTranscriptUpdate((update) => {
1348
+ if (this.closed) return;
1349
+ const sessionFile = update.sessionFile;
1350
+ if (!this.isSessionFileForAgent(sessionFile)) return;
1351
+ this.scheduleSessionDirty(sessionFile);
1352
+ });
1353
+ }
1354
+ ensureSessionStartupCatchup() {
1355
+ if (!this.sources.has("sessions")) return;
1356
+ this.runSessionStartupCatchup().catch((err) => {
1357
+ log$3.warn("memory session startup catch-up failed: " + String(err));
1358
+ });
1359
+ }
1360
+ async markSessionStartupCatchupDirtyFiles() {
1361
+ if (!this.sources.has("sessions") || this.closed) return [];
1362
+ const files = await listSessionFilesForAgent(this.agentId);
1363
+ if (files.length === 0 || this.closed) return [];
1364
+ const existingRows = loadMemorySourceFileState({
1365
+ db: this.db,
1366
+ source: "sessions"
1367
+ }).rows;
1368
+ const dirtyFiles = resolveMemorySessionStartupDirtyFiles({
1369
+ files: (await runWithConcurrency(files.map((file) => async () => {
1370
+ try {
1371
+ const stat = await fs$1.stat(file);
1372
+ if (!stat.isFile()) return null;
1373
+ return {
1374
+ absPath: file,
1375
+ path: sessionPathForFile(file),
1376
+ mtimeMs: stat.mtimeMs,
1377
+ size: stat.size
1378
+ };
1379
+ } catch (err) {
1380
+ if (isFileMissingError(err)) return null;
1381
+ throw err;
1382
+ }
1383
+ }), this.getIndexConcurrency())).filter((file) => file !== null),
1384
+ existingRows
1385
+ });
1386
+ if (dirtyFiles.length === 0 || this.closed) return dirtyFiles;
1387
+ for (const file of dirtyFiles) this.sessionsDirtyFiles.add(file);
1388
+ this.sessionsDirty = true;
1389
+ return dirtyFiles;
1390
+ }
1391
+ async runSessionStartupCatchup() {
1392
+ const dirtyFiles = await this.markSessionStartupCatchupDirtyFiles();
1393
+ if (dirtyFiles.length === 0 || this.closed) return dirtyFiles;
1394
+ this.sync({ reason: "session-startup-catchup" }).catch((err) => {
1395
+ log$3.warn("memory sync failed (session-startup-catchup): " + String(err));
1396
+ });
1397
+ return dirtyFiles;
1398
+ }
1399
+ scheduleSessionDirty(sessionFile) {
1400
+ this.sessionPendingFiles.add(sessionFile);
1401
+ if (this.sessionWatchTimer) return;
1402
+ this.sessionWatchTimer = setTimeout(() => {
1403
+ this.sessionWatchTimer = null;
1404
+ this.processSessionDeltaBatch().catch((err) => {
1405
+ log$3.warn(`memory session delta failed: ${String(err)}`);
1406
+ });
1407
+ }, SESSION_DIRTY_DEBOUNCE_MS);
1408
+ }
1409
+ async processSessionDeltaBatch() {
1410
+ if (this.sessionPendingFiles.size === 0) return;
1411
+ const pending = Array.from(this.sessionPendingFiles);
1412
+ this.sessionPendingFiles.clear();
1413
+ let shouldSync = false;
1414
+ for (const sessionFile of pending) {
1415
+ const baseName = path.basename(sessionFile);
1416
+ if (isSessionArchiveArtifactName(baseName) && isUsageCountedSessionTranscriptFileName(baseName)) {
1417
+ this.sessionsDirtyFiles.add(sessionFile);
1418
+ this.sessionsDirty = true;
1419
+ shouldSync = true;
1420
+ continue;
1421
+ }
1422
+ const delta = await this.updateSessionDelta(sessionFile);
1423
+ if (!delta) continue;
1424
+ const bytesThreshold = delta.deltaBytes;
1425
+ const messagesThreshold = delta.deltaMessages;
1426
+ const bytesHit = bytesThreshold <= 0 ? delta.pendingBytes > 0 : delta.pendingBytes >= bytesThreshold;
1427
+ const messagesHit = messagesThreshold <= 0 ? delta.pendingMessages > 0 : delta.pendingMessages >= messagesThreshold;
1428
+ if (!bytesHit && !messagesHit) continue;
1429
+ this.sessionsDirtyFiles.add(sessionFile);
1430
+ this.sessionsDirty = true;
1431
+ delta.pendingBytes = bytesThreshold > 0 ? Math.max(0, delta.pendingBytes - bytesThreshold) : 0;
1432
+ delta.pendingMessages = messagesThreshold > 0 ? Math.max(0, delta.pendingMessages - messagesThreshold) : 0;
1433
+ shouldSync = true;
1434
+ }
1435
+ if (shouldSync) this.sync({ reason: "session-delta" }).catch((err) => {
1436
+ log$3.warn(`memory sync failed (session-delta): ${String(err)}`);
1437
+ });
1438
+ }
1439
+ async updateSessionDelta(sessionFile) {
1440
+ const thresholds = this.settings.sync.sessions;
1441
+ if (!thresholds) return null;
1442
+ let stat;
1443
+ try {
1444
+ stat = await fs$1.stat(sessionFile);
1445
+ } catch {
1446
+ return null;
1447
+ }
1448
+ const size = stat.size;
1449
+ let state = this.sessionDeltas.get(sessionFile);
1450
+ if (!state) {
1451
+ state = {
1452
+ lastSize: 0,
1453
+ pendingBytes: 0,
1454
+ pendingMessages: 0
1455
+ };
1456
+ this.sessionDeltas.set(sessionFile, state);
1457
+ }
1458
+ const deltaBytes = Math.max(0, size - state.lastSize);
1459
+ if (deltaBytes === 0 && size === state.lastSize) return {
1460
+ deltaBytes: thresholds.deltaBytes,
1461
+ deltaMessages: thresholds.deltaMessages,
1462
+ pendingBytes: state.pendingBytes,
1463
+ pendingMessages: state.pendingMessages
1464
+ };
1465
+ if (size < state.lastSize) {
1466
+ state.lastSize = size;
1467
+ state.pendingBytes += size;
1468
+ if (thresholds.deltaMessages > 0 && (thresholds.deltaBytes <= 0 || state.pendingBytes < thresholds.deltaBytes)) state.pendingMessages += await this.countNewlines(sessionFile, 0, size);
1469
+ } else {
1470
+ state.pendingBytes += deltaBytes;
1471
+ if (thresholds.deltaMessages > 0 && (thresholds.deltaBytes <= 0 || state.pendingBytes < thresholds.deltaBytes)) state.pendingMessages += await this.countNewlines(sessionFile, state.lastSize, size);
1472
+ state.lastSize = size;
1473
+ }
1474
+ this.sessionDeltas.set(sessionFile, state);
1475
+ return {
1476
+ deltaBytes: thresholds.deltaBytes,
1477
+ deltaMessages: thresholds.deltaMessages,
1478
+ pendingBytes: state.pendingBytes,
1479
+ pendingMessages: state.pendingMessages
1480
+ };
1481
+ }
1482
+ async countNewlines(absPath, start, end) {
1483
+ if (end <= start) return 0;
1484
+ let handle;
1485
+ try {
1486
+ handle = await fs$1.open(absPath, "r");
1487
+ } catch (err) {
1488
+ if (isFileMissingError(err)) return 0;
1489
+ throw err;
1490
+ }
1491
+ try {
1492
+ let offset = start;
1493
+ let count = 0;
1494
+ const buffer = Buffer.alloc(SESSION_DELTA_READ_CHUNK_BYTES);
1495
+ while (offset < end) {
1496
+ const toRead = Math.min(buffer.length, end - offset);
1497
+ const { bytesRead } = await handle.read(buffer, 0, toRead, offset);
1498
+ if (bytesRead <= 0) break;
1499
+ for (let i = 0; i < bytesRead; i += 1) if (buffer[i] === 10) count += 1;
1500
+ offset += bytesRead;
1501
+ }
1502
+ return count;
1503
+ } finally {
1504
+ await handle.close();
1505
+ }
1506
+ }
1507
+ resetSessionDelta(absPath, size) {
1508
+ const state = this.sessionDeltas.get(absPath);
1509
+ if (!state) return;
1510
+ state.lastSize = size;
1511
+ state.pendingBytes = 0;
1512
+ state.pendingMessages = 0;
1513
+ }
1514
+ isSessionFileForAgent(sessionFile) {
1515
+ if (!sessionFile) return false;
1516
+ const sessionsDir = resolveSessionTranscriptsDirForAgent(this.agentId);
1517
+ const resolvedFile = path.resolve(sessionFile);
1518
+ const resolvedDir = path.resolve(sessionsDir);
1519
+ return resolvedFile.startsWith(`${resolvedDir}${path.sep}`);
1520
+ }
1521
+ normalizeTargetSessionFiles(sessionFiles) {
1522
+ if (!sessionFiles || sessionFiles.length === 0) return null;
1523
+ const normalized = /* @__PURE__ */ new Set();
1524
+ for (const sessionFile of sessionFiles) {
1525
+ const trimmed = sessionFile.trim();
1526
+ if (!trimmed) continue;
1527
+ const resolved = path.resolve(trimmed);
1528
+ if (this.isSessionFileForAgent(resolved)) normalized.add(resolved);
1529
+ }
1530
+ return normalized.size > 0 ? normalized : null;
1531
+ }
1532
+ ensureIntervalSync() {
1533
+ const minutes = this.settings.sync.intervalMinutes;
1534
+ if (!minutes || minutes <= 0 || this.intervalTimer) return;
1535
+ const ms = minutes * 60 * 1e3;
1536
+ this.intervalTimer = setInterval(() => {
1537
+ runDetachedMemorySync(() => this.sync({ reason: "interval" }), "interval");
1538
+ }, ms);
1539
+ }
1540
+ scheduleWatchSync() {
1541
+ if (!this.sources.has("memory") || !this.settings.sync.watch) return;
1542
+ if (this.watchTimer) clearTimeout(this.watchTimer);
1543
+ this.watchTimer = setTimeout(() => {
1544
+ this.watchTimer = null;
1545
+ runDetachedMemorySync(async () => {
1546
+ if (this.closed) return;
1547
+ if (!await settleMemoryWatchEventPaths(this.pendingWatchPaths)) {
1548
+ if (!this.closed) this.scheduleWatchSync();
1549
+ return;
1550
+ }
1551
+ if (this.closed) return;
1552
+ await this.sync({ reason: "watch" });
1553
+ }, "watch");
1554
+ }, this.settings.sync.watchDebounceMs);
1555
+ }
1556
+ shouldSyncSessions(params, needsFullReindex = false) {
1557
+ return shouldSyncSessionsForReindex({
1558
+ hasSessionSource: this.sources.has("sessions"),
1559
+ sessionsDirty: this.sessionsDirty,
1560
+ dirtySessionFileCount: this.sessionsDirtyFiles.size,
1561
+ sync: params,
1562
+ needsFullReindex
1563
+ });
1564
+ }
1565
+ async syncMemoryFiles(params) {
1566
+ const deleteFileByPathAndSource = this.db.prepare(`DELETE FROM files WHERE path = ? AND source = ?`);
1567
+ const deleteChunksByPathAndSource = this.db.prepare(`DELETE FROM chunks WHERE path = ? AND source = ?`);
1568
+ const deleteVectorRowsByPathAndSource = this.vector.enabled && this.vector.available ? this.db.prepare(`DELETE FROM ${VECTOR_TABLE$2} WHERE id IN (SELECT id FROM chunks WHERE path = ? AND source = ?)`) : null;
1569
+ const deleteFtsRowsByPathAndSource = this.fts.enabled && this.fts.available ? this.db.prepare(`DELETE FROM ${FTS_TABLE$2} WHERE path = ? AND source = ?`) : null;
1570
+ const fileEntries = (await runWithConcurrency((await listMemoryFiles(this.workspaceDir, this.settings.extraPaths, this.settings.multimodal)).map((file) => async () => await buildFileEntry(file, this.workspaceDir, this.settings.multimodal)), this.getIndexConcurrency())).filter((entry) => entry !== null);
1571
+ log$3.debug("memory sync: indexing memory files", {
1572
+ files: fileEntries.length,
1573
+ needsFullReindex: params.needsFullReindex,
1574
+ batch: this.batch.enabled,
1575
+ concurrency: this.getIndexConcurrency()
1576
+ });
1577
+ const existingState = loadMemorySourceFileState({
1578
+ db: this.db,
1579
+ source: "memory"
1580
+ });
1581
+ const existingRows = existingState.rows;
1582
+ const existingHashes = existingState.hashes;
1583
+ const activePaths = new Set(fileEntries.map((entry) => entry.path));
1584
+ if (params.progress) {
1585
+ params.progress.total += fileEntries.length;
1586
+ params.progress.report({
1587
+ completed: params.progress.completed,
1588
+ total: params.progress.total,
1589
+ label: this.batch.enabled ? "Indexing memory files (batch)..." : "Indexing memory files…"
1590
+ });
1591
+ }
1592
+ await runWithConcurrency(fileEntries.map((entry) => async () => {
1593
+ if (!params.needsFullReindex && existingHashes.get(entry.path) === entry.hash) {
1594
+ if (params.progress) {
1595
+ params.progress.completed += 1;
1596
+ params.progress.report({
1597
+ completed: params.progress.completed,
1598
+ total: params.progress.total
1599
+ });
1600
+ }
1601
+ return;
1602
+ }
1603
+ await this.indexFile(entry, { source: "memory" });
1604
+ if (params.progress) {
1605
+ params.progress.completed += 1;
1606
+ params.progress.report({
1607
+ completed: params.progress.completed,
1608
+ total: params.progress.total
1609
+ });
1610
+ }
1611
+ }), this.getIndexConcurrency());
1612
+ for (const stale of existingRows) {
1613
+ if (activePaths.has(stale.path)) continue;
1614
+ deleteFileByPathAndSource.run(stale.path, "memory");
1615
+ if (deleteVectorRowsByPathAndSource) try {
1616
+ deleteVectorRowsByPathAndSource.run(stale.path, "memory");
1617
+ } catch {}
1618
+ deleteChunksByPathAndSource.run(stale.path, "memory");
1619
+ if (deleteFtsRowsByPathAndSource) try {
1620
+ deleteFtsRowsByPathAndSource.run(stale.path, "memory");
1621
+ } catch {}
1622
+ }
1623
+ }
1624
+ async syncSessionFiles(params) {
1625
+ const deleteFileByPathAndSource = this.db.prepare(`DELETE FROM files WHERE path = ? AND source = ?`);
1626
+ const deleteChunksByPathAndSource = this.db.prepare(`DELETE FROM chunks WHERE path = ? AND source = ?`);
1627
+ const deleteVectorRowsByPathAndSource = this.vector.enabled && this.vector.available ? this.db.prepare(`DELETE FROM ${VECTOR_TABLE$2} WHERE id IN (SELECT id FROM chunks WHERE path = ? AND source = ?)`) : null;
1628
+ const deleteFtsRowsByPathSourceAndModel = this.fts.enabled && this.fts.available ? this.db.prepare(`DELETE FROM ${FTS_TABLE$2} WHERE path = ? AND source = ? AND model = ?`) : null;
1629
+ const targetSessionFiles = params.needsFullReindex ? null : this.normalizeTargetSessionFiles(params.targetSessionFiles);
1630
+ const files = targetSessionFiles ? Array.from(targetSessionFiles) : await listSessionFilesForAgent(this.agentId);
1631
+ const { activePaths, existingRows, existingHashes, indexAll } = resolveMemorySessionSyncPlan({
1632
+ needsFullReindex: params.needsFullReindex,
1633
+ files,
1634
+ targetSessionFiles,
1635
+ sessionsDirtyFiles: this.sessionsDirtyFiles,
1636
+ existingRows: targetSessionFiles ? null : loadMemorySourceFileState({
1637
+ db: this.db,
1638
+ source: "sessions"
1639
+ }).rows,
1640
+ sessionPathForFile
1641
+ });
1642
+ log$3.debug("memory sync: indexing session files", {
1643
+ files: files.length,
1644
+ indexAll,
1645
+ dirtyFiles: this.sessionsDirtyFiles.size,
1646
+ targetedFiles: targetSessionFiles?.size ?? 0,
1647
+ batch: this.batch.enabled,
1648
+ concurrency: this.getIndexConcurrency()
1649
+ });
1650
+ if (params.progress) {
1651
+ params.progress.total += files.length;
1652
+ params.progress.report({
1653
+ completed: params.progress.completed,
1654
+ total: params.progress.total,
1655
+ label: this.batch.enabled ? "Indexing session files (batch)..." : "Indexing session files…"
1656
+ });
1657
+ }
1658
+ const yieldAfterSessionFile = createSessionSyncYield(files.length);
1659
+ await runWithConcurrency(files.map((absPath) => async () => {
1660
+ try {
1661
+ if (!indexAll && !this.sessionsDirtyFiles.has(absPath)) {
1662
+ if (params.progress) {
1663
+ params.progress.completed += 1;
1664
+ params.progress.report({
1665
+ completed: params.progress.completed,
1666
+ total: params.progress.total
1667
+ });
1668
+ }
1669
+ return;
1670
+ }
1671
+ const entry = await buildSessionEntry(absPath);
1672
+ if (!entry) {
1673
+ if (params.progress) {
1674
+ params.progress.completed += 1;
1675
+ params.progress.report({
1676
+ completed: params.progress.completed,
1677
+ total: params.progress.total
1678
+ });
1679
+ }
1680
+ return;
1681
+ }
1682
+ const existingHash = resolveMemorySourceExistingHash({
1683
+ db: this.db,
1684
+ source: "sessions",
1685
+ path: entry.path,
1686
+ existingHashes
1687
+ });
1688
+ if (!params.needsFullReindex && existingHash === entry.hash) {
1689
+ if (params.progress) {
1690
+ params.progress.completed += 1;
1691
+ params.progress.report({
1692
+ completed: params.progress.completed,
1693
+ total: params.progress.total
1694
+ });
1695
+ }
1696
+ this.resetSessionDelta(absPath, entry.size);
1697
+ return;
1698
+ }
1699
+ await this.indexFile(entry, {
1700
+ source: "sessions",
1701
+ content: entry.content
1702
+ });
1703
+ this.resetSessionDelta(absPath, entry.size);
1704
+ if (params.progress) {
1705
+ params.progress.completed += 1;
1706
+ params.progress.report({
1707
+ completed: params.progress.completed,
1708
+ total: params.progress.total
1709
+ });
1710
+ }
1711
+ } finally {
1712
+ await yieldAfterSessionFile();
1713
+ }
1714
+ }), this.getIndexConcurrency());
1715
+ if (activePaths === null) return;
1716
+ const staleRows = existingRows ?? [];
1717
+ const yieldAfterStaleSessionRow = createSessionSyncYield(staleRows.length);
1718
+ for (const stale of staleRows) try {
1719
+ if (activePaths.has(stale.path)) continue;
1720
+ deleteFileByPathAndSource.run(stale.path, "sessions");
1721
+ if (deleteVectorRowsByPathAndSource) try {
1722
+ deleteVectorRowsByPathAndSource.run(stale.path, "sessions");
1723
+ } catch {}
1724
+ deleteChunksByPathAndSource.run(stale.path, "sessions");
1725
+ if (deleteFtsRowsByPathSourceAndModel) try {
1726
+ deleteFtsRowsByPathSourceAndModel.run(stale.path, "sessions", this.provider?.model ?? "fts-only");
1727
+ } catch {}
1728
+ } finally {
1729
+ await yieldAfterStaleSessionRow();
1730
+ }
1731
+ }
1732
+ createSyncProgress(onProgress) {
1733
+ const state = {
1734
+ completed: 0,
1735
+ total: 0,
1736
+ label: void 0,
1737
+ report: (update) => {
1738
+ if (update.label) state.label = update.label;
1739
+ const label = update.total > 0 && state.label ? `${state.label} ${update.completed}/${update.total}` : state.label;
1740
+ onProgress({
1741
+ completed: update.completed,
1742
+ total: update.total,
1743
+ label
1744
+ });
1745
+ }
1746
+ };
1747
+ return state;
1748
+ }
1749
+ assertFtsOnlySyncAllowed() {
1750
+ if (this.provider) return;
1751
+ const existingMeta = this.readMeta();
1752
+ if (!existingMeta || existingMeta.model === "fts-only" || !this.settings.provider || this.settings.provider === "none") return;
1753
+ this.resetProviderInitializationForRetry();
1754
+ throw new Error(`Memory sync aborted: embedding provider "${this.settings.provider}" is configured but unavailable. Refusing to run sync in fts-only fallback mode to protect existing vector index (current model: ${existingMeta.model}).`);
1755
+ }
1756
+ async runSync(params) {
1757
+ this.assertFtsOnlySyncAllowed();
1758
+ const progress = params?.progress ? this.createSyncProgress(params.progress) : void 0;
1759
+ if (progress) progress.report({
1760
+ completed: progress.completed,
1761
+ total: progress.total,
1762
+ label: "Loading vector extension…"
1763
+ });
1764
+ const vectorReady = await this.ensureVectorReady();
1765
+ const meta = this.readMeta();
1766
+ const configuredSources = resolveConfiguredSourcesForMeta(this.sources);
1767
+ const configuredScopeHash = resolveConfiguredScopeHash({
1768
+ workspaceDir: this.workspaceDir,
1769
+ extraPaths: this.settings.extraPaths,
1770
+ multimodal: {
1771
+ enabled: this.settings.multimodal.enabled,
1772
+ modalities: this.settings.multimodal.modalities,
1773
+ maxFileBytes: this.settings.multimodal.maxFileBytes
1774
+ }
1775
+ });
1776
+ const targetSessionFiles = this.normalizeTargetSessionFiles(params?.sessionFiles);
1777
+ const hasTargetSessionFiles = targetSessionFiles !== null;
1778
+ if (params?.reason === "cli" && !params.force && !hasTargetSessionFiles) await this.markSessionStartupCatchupDirtyFiles();
1779
+ const targetedSessionSync = await runMemoryTargetedSessionSync({
1780
+ hasSessionSource: this.sources.has("sessions"),
1781
+ targetSessionFiles,
1782
+ reason: params?.reason,
1783
+ progress: progress ?? void 0,
1784
+ useUnsafeReindex: process.env.FENGMING_TEST_FAST === "1" && process.env.FENGMING_TEST_MEMORY_UNSAFE_REINDEX === "1",
1785
+ sessionsDirtyFiles: this.sessionsDirtyFiles,
1786
+ syncSessionFiles: async (targetedParams) => {
1787
+ await this.syncSessionFiles(targetedParams);
1788
+ },
1789
+ shouldFallbackOnError: (err) => this.shouldFallbackOnError(err),
1790
+ activateFallbackProvider: async (reason) => await this.activateFallbackProvider(reason),
1791
+ runSafeReindex: async (reindexParams) => {
1792
+ await this.runSafeReindex(reindexParams);
1793
+ },
1794
+ runUnsafeReindex: async (reindexParams) => {
1795
+ await this.runUnsafeReindex(reindexParams);
1796
+ }
1797
+ });
1798
+ if (targetedSessionSync.handled) {
1799
+ this.sessionsDirty = targetedSessionSync.sessionsDirty;
1800
+ return;
1801
+ }
1802
+ const needsFullReindex = params?.force && !hasTargetSessionFiles || shouldRunFullMemoryReindex({
1803
+ meta,
1804
+ provider: this.provider ? {
1805
+ id: this.provider.id,
1806
+ model: this.provider.model
1807
+ } : null,
1808
+ providerKey: this.providerKey ?? void 0,
1809
+ configuredSources,
1810
+ configuredScopeHash,
1811
+ chunkTokens: this.settings.chunking.tokens,
1812
+ chunkOverlap: this.settings.chunking.overlap,
1813
+ vectorReady,
1814
+ ftsTokenizer: this.settings.store.fts.tokenizer
1815
+ });
1816
+ try {
1817
+ if (needsFullReindex) {
1818
+ if (process.env.FENGMING_TEST_FAST === "1" && process.env.FENGMING_TEST_MEMORY_UNSAFE_REINDEX === "1") await this.runUnsafeReindex({
1819
+ reason: params?.reason,
1820
+ force: params?.force,
1821
+ progress: progress ?? void 0
1822
+ });
1823
+ else await this.runSafeReindex({
1824
+ reason: params?.reason,
1825
+ force: params?.force,
1826
+ progress: progress ?? void 0
1827
+ });
1828
+ return;
1829
+ }
1830
+ const shouldSyncMemory = this.sources.has("memory") && (!hasTargetSessionFiles && params?.force || needsFullReindex || this.dirty);
1831
+ const shouldSyncSessions = this.shouldSyncSessions(params, needsFullReindex);
1832
+ if (shouldSyncMemory) {
1833
+ await this.syncMemoryFiles({
1834
+ needsFullReindex,
1835
+ progress: progress ?? void 0
1836
+ });
1837
+ this.dirty = false;
1838
+ }
1839
+ if (shouldSyncSessions) {
1840
+ await this.syncSessionFiles({
1841
+ needsFullReindex,
1842
+ targetSessionFiles: targetSessionFiles ? Array.from(targetSessionFiles) : void 0,
1843
+ progress: progress ?? void 0
1844
+ });
1845
+ this.sessionsDirty = false;
1846
+ this.sessionsDirtyFiles.clear();
1847
+ } else if (this.sessionsDirtyFiles.size > 0) this.sessionsDirty = true;
1848
+ else this.sessionsDirty = false;
1849
+ } catch (err) {
1850
+ const reason = formatErrorMessage(err);
1851
+ if (this.shouldFallbackOnError(err) && await this.activateFallbackProvider(reason)) {
1852
+ await this.runSafeReindex({
1853
+ reason: params?.reason ?? "fallback",
1854
+ force: true,
1855
+ progress: progress ?? void 0
1856
+ });
1857
+ return;
1858
+ }
1859
+ if (!this.provider && this.fts.enabled && this.shouldFallbackOnError(err)) {
1860
+ log$3.warn(`memory embeddings unavailable; rebuilding lexical memory index only: ${reason}`);
1861
+ await this.runSafeReindex({
1862
+ reason: params?.reason ?? "embedding-degraded",
1863
+ force: true,
1864
+ progress: progress ?? void 0
1865
+ });
1866
+ return;
1867
+ }
1868
+ throw err;
1869
+ }
1870
+ }
1871
+ shouldFallbackOnError(err) {
1872
+ return isMemoryEmbeddingOperationError(err);
1873
+ }
1874
+ resolveBatchConfig() {
1875
+ const batch = this.settings.remote?.batch;
1876
+ return {
1877
+ enabled: Boolean(batch?.enabled && this.provider && this.providerRuntime?.batchEmbed),
1878
+ wait: batch?.wait ?? true,
1879
+ concurrency: Math.max(1, batch?.concurrency ?? 2),
1880
+ pollIntervalMs: batch?.pollIntervalMs ?? 2e3,
1881
+ timeoutMs: (batch?.timeoutMinutes ?? 60) * 60 * 1e3
1882
+ };
1883
+ }
1884
+ async activateFallbackProvider(reason) {
1885
+ const currentProviderId = resolveFallbackCurrentProviderId({
1886
+ provider: this.provider,
1887
+ lifecycle: this.providerLifecycle
1888
+ });
1889
+ const fallbackRequest = resolveMemoryFallbackProviderRequest({
1890
+ cfg: this.cfg,
1891
+ settings: this.settings,
1892
+ currentProviderId
1893
+ });
1894
+ if (!fallbackRequest || !currentProviderId) return false;
1895
+ if (this.fallbackFrom) return false;
1896
+ const fallbackResult = await createEmbeddingProvider({
1897
+ config: this.cfg,
1898
+ agentDir: resolveAgentDir(this.cfg, this.agentId),
1899
+ ...fallbackRequest
1900
+ });
1901
+ const fallbackState = applyMemoryFallbackProviderState({
1902
+ current: {
1903
+ provider: this.provider,
1904
+ fallbackFrom: this.fallbackFrom,
1905
+ fallbackReason: this.fallbackReason,
1906
+ providerUnavailableReason: void 0,
1907
+ providerRuntime: this.providerRuntime,
1908
+ lifecycle: this.providerLifecycle
1909
+ },
1910
+ fallbackFrom: currentProviderId,
1911
+ reason,
1912
+ result: fallbackResult
1913
+ });
1914
+ this.fallbackFrom = fallbackState.fallbackFrom;
1915
+ this.fallbackReason = fallbackState.fallbackReason;
1916
+ this.provider = fallbackState.provider;
1917
+ this.providerRuntime = fallbackState.providerRuntime;
1918
+ this.providerUnavailableReason = fallbackState.providerUnavailableReason;
1919
+ this.providerLifecycle = fallbackState.lifecycle;
1920
+ this.providerKey = this.computeProviderKey();
1921
+ this.batch = this.resolveBatchConfig();
1922
+ log$3.warn(`memory embeddings: switched to fallback provider (${fallbackRequest.provider})`, { reason });
1923
+ return true;
1924
+ }
1925
+ async runSafeReindex(params) {
1926
+ this.assertFtsOnlySyncAllowed();
1927
+ const dbPath = resolveUserPath(this.settings.store.path);
1928
+ const tempDbPath = `${dbPath}.tmp-${randomUUID()}`;
1929
+ const tempDb = openMemoryDatabaseAtPath(tempDbPath, this.settings.store.vector.enabled);
1930
+ const originalDb = this.db;
1931
+ let tempDbClosed = false;
1932
+ let originalDbClosed = false;
1933
+ const originalState = {
1934
+ ftsAvailable: this.fts.available,
1935
+ ftsError: this.fts.loadError,
1936
+ vectorAvailable: this.vector.available,
1937
+ vectorLoadError: this.vector.loadError,
1938
+ vectorDims: this.vector.dims,
1939
+ vectorDegradedWriteWarningShown: this.vectorDegradedWriteWarningShown,
1940
+ vectorReady: this.vectorReady
1941
+ };
1942
+ const restoreOriginalState = () => {
1943
+ if (originalDbClosed) this.db = openMemoryDatabaseAtPath(dbPath, this.settings.store.vector.enabled);
1944
+ else this.db = originalDb;
1945
+ this.fts.available = originalState.ftsAvailable;
1946
+ this.fts.loadError = originalState.ftsError;
1947
+ this.vector.available = originalDbClosed ? null : originalState.vectorAvailable;
1948
+ this.vector.loadError = originalState.vectorLoadError;
1949
+ this.vector.dims = originalState.vectorDims;
1950
+ this.vectorDegradedWriteWarningShown = originalState.vectorDegradedWriteWarningShown;
1951
+ this.vectorReady = originalDbClosed ? null : originalState.vectorReady;
1952
+ };
1953
+ this.db = tempDb;
1954
+ this.resetVectorState();
1955
+ this.fts.available = false;
1956
+ this.fts.loadError = void 0;
1957
+ this.ensureSchema();
1958
+ let nextMeta = null;
1959
+ try {
1960
+ nextMeta = await runMemoryAtomicReindex({
1961
+ targetPath: dbPath,
1962
+ tempPath: tempDbPath,
1963
+ beforeTempCleanup: () => {
1964
+ if (!tempDbClosed) {
1965
+ closeMemoryDatabase(tempDb);
1966
+ tempDbClosed = true;
1967
+ }
1968
+ },
1969
+ build: async () => {
1970
+ await this.seedEmbeddingCache(originalDb);
1971
+ const shouldSyncMemory = this.sources.has("memory");
1972
+ const shouldSyncSessions = this.shouldSyncSessions({
1973
+ reason: params.reason,
1974
+ force: params.force
1975
+ }, true);
1976
+ if (shouldSyncMemory) {
1977
+ await this.syncMemoryFiles({
1978
+ needsFullReindex: true,
1979
+ progress: params.progress
1980
+ });
1981
+ this.dirty = false;
1982
+ }
1983
+ if (shouldSyncSessions) {
1984
+ await this.syncSessionFiles({
1985
+ needsFullReindex: true,
1986
+ progress: params.progress
1987
+ });
1988
+ this.sessionsDirty = false;
1989
+ this.sessionsDirtyFiles.clear();
1990
+ } else if (this.sessionsDirtyFiles.size > 0) this.sessionsDirty = true;
1991
+ else this.sessionsDirty = false;
1992
+ const meta = {
1993
+ model: this.provider?.model ?? "fts-only",
1994
+ provider: this.provider?.id ?? "none",
1995
+ providerKey: this.providerKey,
1996
+ sources: resolveConfiguredSourcesForMeta(this.sources),
1997
+ scopeHash: resolveConfiguredScopeHash({
1998
+ workspaceDir: this.workspaceDir,
1999
+ extraPaths: this.settings.extraPaths,
2000
+ multimodal: {
2001
+ enabled: this.settings.multimodal.enabled,
2002
+ modalities: this.settings.multimodal.modalities,
2003
+ maxFileBytes: this.settings.multimodal.maxFileBytes
2004
+ }
2005
+ }),
2006
+ chunkTokens: this.settings.chunking.tokens,
2007
+ chunkOverlap: this.settings.chunking.overlap,
2008
+ ftsTokenizer: this.settings.store.fts.tokenizer
2009
+ };
2010
+ if (this.vector.available && this.vector.dims) meta.vectorDims = this.vector.dims;
2011
+ this.writeMeta(meta);
2012
+ this.pruneEmbeddingCacheIfNeeded?.();
2013
+ closeMemoryDatabase(tempDb);
2014
+ tempDbClosed = true;
2015
+ closeMemoryDatabase(originalDb);
2016
+ originalDbClosed = true;
2017
+ return meta;
2018
+ }
2019
+ });
2020
+ this.db = openMemoryDatabaseAtPath(dbPath, this.settings.store.vector.enabled);
2021
+ this.resetVectorState();
2022
+ this.ensureSchema();
2023
+ this.vector.dims = nextMeta?.vectorDims;
2024
+ } catch (err) {
2025
+ try {
2026
+ if (!tempDbClosed && this.db === tempDb) {
2027
+ closeMemoryDatabase(tempDb);
2028
+ tempDbClosed = true;
2029
+ }
2030
+ } catch {}
2031
+ restoreOriginalState();
2032
+ throw err;
2033
+ }
2034
+ }
2035
+ async runUnsafeReindex(params) {
2036
+ this.resetIndex();
2037
+ const shouldSyncMemory = this.sources.has("memory");
2038
+ const shouldSyncSessions = this.shouldSyncSessions({
2039
+ reason: params.reason,
2040
+ force: params.force
2041
+ }, true);
2042
+ if (shouldSyncMemory) {
2043
+ await this.syncMemoryFiles({
2044
+ needsFullReindex: true,
2045
+ progress: params.progress
2046
+ });
2047
+ this.dirty = false;
2048
+ }
2049
+ if (shouldSyncSessions) {
2050
+ await this.syncSessionFiles({
2051
+ needsFullReindex: true,
2052
+ progress: params.progress
2053
+ });
2054
+ this.sessionsDirty = false;
2055
+ this.sessionsDirtyFiles.clear();
2056
+ } else if (this.sessionsDirtyFiles.size > 0) this.sessionsDirty = true;
2057
+ else this.sessionsDirty = false;
2058
+ const nextMeta = {
2059
+ model: this.provider?.model ?? "fts-only",
2060
+ provider: this.provider?.id ?? "none",
2061
+ providerKey: this.providerKey,
2062
+ sources: resolveConfiguredSourcesForMeta(this.sources),
2063
+ scopeHash: resolveConfiguredScopeHash({
2064
+ workspaceDir: this.workspaceDir,
2065
+ extraPaths: this.settings.extraPaths,
2066
+ multimodal: {
2067
+ enabled: this.settings.multimodal.enabled,
2068
+ modalities: this.settings.multimodal.modalities,
2069
+ maxFileBytes: this.settings.multimodal.maxFileBytes
2070
+ }
2071
+ }),
2072
+ chunkTokens: this.settings.chunking.tokens,
2073
+ chunkOverlap: this.settings.chunking.overlap,
2074
+ ftsTokenizer: this.settings.store.fts.tokenizer
2075
+ };
2076
+ if (this.vector.available && this.vector.dims) nextMeta.vectorDims = this.vector.dims;
2077
+ this.writeMeta(nextMeta);
2078
+ this.pruneEmbeddingCacheIfNeeded?.();
2079
+ }
2080
+ resetIndex() {
2081
+ this.db.exec(`DELETE FROM files`);
2082
+ this.db.exec(`DELETE FROM chunks`);
2083
+ if (this.fts.enabled && this.fts.available) try {
2084
+ this.db.exec(`DROP TABLE IF EXISTS ${FTS_TABLE$2}`);
2085
+ } catch {}
2086
+ this.ensureSchema();
2087
+ this.dropVectorTable();
2088
+ this.vector.dims = void 0;
2089
+ this.sessionsDirtyFiles.clear();
2090
+ }
2091
+ readMeta() {
2092
+ const row = this.db.prepare(`SELECT value FROM meta WHERE key = ?`).get(META_KEY);
2093
+ if (!row?.value) {
2094
+ this.lastMetaSerialized = null;
2095
+ return null;
2096
+ }
2097
+ try {
2098
+ const parsed = JSON.parse(row.value);
2099
+ this.lastMetaSerialized = row.value;
2100
+ return parsed;
2101
+ } catch {
2102
+ this.lastMetaSerialized = null;
2103
+ return null;
2104
+ }
2105
+ }
2106
+ writeMeta(meta) {
2107
+ const value = JSON.stringify(meta);
2108
+ if (this.lastMetaSerialized === value) return;
2109
+ this.db.prepare(`INSERT INTO meta (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value=excluded.value`).run(META_KEY, value);
2110
+ this.lastMetaSerialized = value;
2111
+ }
2112
+ };
2113
+ //#endregion
2114
+ //#region extensions/memory-core/src/memory/manager-vector-warning.ts
2115
+ function formatMemoryVectorDegradedWriteReason(loadError) {
2116
+ return loadError ? `sqlite-vec unavailable: ${loadError}` : "semantic vector embeddings unavailable — no vector dimensions resolved";
2117
+ }
2118
+ function logMemoryVectorDegradedWrite(params) {
2119
+ if (!params.vectorEnabled || params.vectorReady || params.chunkCount <= 0 || params.warningShown) return params.warningShown;
2120
+ params.warn(`chunks_vec not updated — ${formatMemoryVectorDegradedWriteReason(params.loadError)}. Vector recall degraded. Further duplicate warnings suppressed.`);
2121
+ return true;
2122
+ }
2123
+ //#endregion
2124
+ //#region extensions/memory-core/src/memory/manager-vector-write.ts
2125
+ const vectorToBlob$1 = (embedding) => Buffer.from(new Float32Array(embedding).buffer);
2126
+ function replaceMemoryVectorRow(params) {
2127
+ const tableName = params.tableName ?? "chunks_vec";
2128
+ try {
2129
+ params.db.prepare(`DELETE FROM ${tableName} WHERE id = ?`).run(params.id);
2130
+ } catch {}
2131
+ params.db.prepare(`INSERT INTO ${tableName} (id, embedding) VALUES (?, ?)`).run(params.id, vectorToBlob$1(params.embedding));
2132
+ }
2133
+ //#endregion
2134
+ //#region extensions/memory-core/src/memory/manager-embedding-ops.ts
2135
+ const VECTOR_TABLE$1 = "chunks_vec";
2136
+ const FTS_TABLE$1 = "chunks_fts";
2137
+ const EMBEDDING_CACHE_TABLE$1 = "embedding_cache";
2138
+ const EMBEDDING_BATCH_MAX_TOKENS = 8e3;
2139
+ const EMBEDDING_INDEX_CONCURRENCY = 4;
2140
+ const EMBEDDING_RETRY_MAX_ATTEMPTS = 3;
2141
+ const EMBEDDING_RETRY_BASE_DELAY_MS = 500;
2142
+ const EMBEDDING_RETRY_MAX_DELAY_MS = 8e3;
2143
+ const EMBEDDING_QUERY_TIMEOUT_REMOTE_MS = 6e4;
2144
+ const EMBEDDING_QUERY_TIMEOUT_LOCAL_MS = 5 * 6e4;
2145
+ const EMBEDDING_BATCH_TIMEOUT_REMOTE_MS = 2 * 6e4;
2146
+ const EMBEDDING_BATCH_TIMEOUT_LOCAL_MS = 10 * 6e4;
2147
+ const log$2 = createSubsystemLogger("memory");
2148
+ function resolveEmbeddingSecondsTimeoutMs(seconds) {
2149
+ if (!Number.isFinite(seconds)) return MAX_TIMER_TIMEOUT_MS;
2150
+ const timeoutMs = Math.floor(seconds * 1e3);
2151
+ return resolveTimerTimeoutMs(Number.isFinite(timeoutMs) ? timeoutMs : MAX_TIMER_TIMEOUT_MS, MAX_TIMER_TIMEOUT_MS);
2152
+ }
2153
+ function resolveEmbeddingTimeoutMs(params) {
2154
+ if (params.kind === "query") {
2155
+ const runtimeTimeoutMs = params.providerRuntime?.inlineQueryTimeoutMs;
2156
+ if (typeof runtimeTimeoutMs === "number" && runtimeTimeoutMs > 0) return resolveTimerTimeoutMs(runtimeTimeoutMs, EMBEDDING_QUERY_TIMEOUT_REMOTE_MS);
2157
+ return params.providerId === "local" ? EMBEDDING_QUERY_TIMEOUT_LOCAL_MS : EMBEDDING_QUERY_TIMEOUT_REMOTE_MS;
2158
+ }
2159
+ const configuredTimeoutSeconds = params.configuredBatchTimeoutSeconds;
2160
+ if (typeof configuredTimeoutSeconds === "number" && configuredTimeoutSeconds > 0) return resolveEmbeddingSecondsTimeoutMs(configuredTimeoutSeconds);
2161
+ const runtimeTimeoutMs = params.providerRuntime?.inlineBatchTimeoutMs;
2162
+ if (typeof runtimeTimeoutMs === "number" && runtimeTimeoutMs > 0) return resolveTimerTimeoutMs(runtimeTimeoutMs, EMBEDDING_BATCH_TIMEOUT_REMOTE_MS);
2163
+ return params.providerId === "local" ? EMBEDDING_BATCH_TIMEOUT_LOCAL_MS : EMBEDDING_BATCH_TIMEOUT_REMOTE_MS;
2164
+ }
2165
+ function resolveMemoryIndexConcurrency(params) {
2166
+ if (params.batch.enabled) return params.batch.concurrency;
2167
+ const configured = params.configuredNonBatchConcurrency;
2168
+ if (typeof configured === "number" && Number.isFinite(configured)) return Math.max(1, Math.floor(configured));
2169
+ return params.providerId === "ollama" ? 1 : EMBEDDING_INDEX_CONCURRENCY;
2170
+ }
2171
+ async function runEmbeddingOperationWithTimeout(params) {
2172
+ const controller = new AbortController();
2173
+ if (!Number.isFinite(params.timeoutMs) || params.timeoutMs <= 0) return await params.run(controller.signal);
2174
+ const timeoutMs = resolveTimerTimeoutMs(params.timeoutMs, 1);
2175
+ let timer = null;
2176
+ const timeoutPromise = new Promise((_, reject) => {
2177
+ timer = setTimeout(() => {
2178
+ const error = new Error(params.message);
2179
+ reject(error);
2180
+ controller.abort(error);
2181
+ }, timeoutMs);
2182
+ timer.unref?.();
2183
+ });
2184
+ try {
2185
+ const operation = params.run(controller.signal);
2186
+ return await Promise.race([operation, timeoutPromise]);
2187
+ } finally {
2188
+ if (timer) clearTimeout(timer);
2189
+ }
2190
+ }
2191
+ var MemoryManagerEmbeddingOps = class extends MemoryManagerSyncOps {
2192
+ pruneEmbeddingCacheIfNeeded() {
2193
+ if (!this.cache.enabled) return;
2194
+ const max = this.cache.maxEntries;
2195
+ if (!max || max <= 0) return;
2196
+ const count = this.db.prepare(`SELECT COUNT(*) as c FROM ${EMBEDDING_CACHE_TABLE$1}`).get()?.c ?? 0;
2197
+ if (count <= max) return;
2198
+ const excess = count - max;
2199
+ this.db.prepare(`DELETE FROM ${EMBEDDING_CACHE_TABLE$1}\n WHERE rowid IN (\n SELECT rowid FROM ${EMBEDDING_CACHE_TABLE$1}\n ORDER BY updated_at ASC\n LIMIT ?\n )`).run(excess);
2200
+ }
2201
+ async embedChunksInBatches(chunks) {
2202
+ if (chunks.length === 0) return [];
2203
+ const { embeddings, missing } = this.collectCachedEmbeddings(chunks);
2204
+ if (missing.length === 0) return embeddings;
2205
+ const batches = buildMemoryEmbeddingBatches(missing.map((m) => m.chunk), EMBEDDING_BATCH_MAX_TOKENS);
2206
+ const toCache = [];
2207
+ const provider = this.provider;
2208
+ if (!provider) throw new Error("FTS 专用模式下无法嵌入批次(无 embedding 提供商)");
2209
+ let cursor = 0;
2210
+ for (const batch of batches) {
2211
+ const inputs = buildTextEmbeddingInputs(batch);
2212
+ const hasStructuredInputs = inputs.some((input) => hasNonTextEmbeddingParts(input));
2213
+ if (hasStructuredInputs && !provider.embedBatchInputs) throw createMemoryEmbeddingOperationError({
2214
+ operation: "structured-batch",
2215
+ providerId: provider.id,
2216
+ cause: /* @__PURE__ */ new Error(`Embedding provider "${provider.id}" does not support multimodal memory inputs.`)
2217
+ });
2218
+ const batchEmbeddings = hasStructuredInputs ? await this.embedBatchInputsWithRetry(inputs) : await this.embedBatchWithRetry(batch.map((chunk) => chunk.text));
2219
+ for (let i = 0; i < batch.length; i += 1) {
2220
+ const item = missing[cursor + i];
2221
+ const embedding = batchEmbeddings[i] ?? [];
2222
+ if (item) {
2223
+ embeddings[item.index] = embedding;
2224
+ toCache.push({
2225
+ hash: item.chunk.hash,
2226
+ embedding
2227
+ });
2228
+ }
2229
+ }
2230
+ cursor += batch.length;
2231
+ }
2232
+ upsertMemoryEmbeddingCache({
2233
+ db: this.db,
2234
+ enabled: this.cache.enabled,
2235
+ provider: this.provider,
2236
+ providerKey: this.providerKey,
2237
+ entries: toCache,
2238
+ tableName: EMBEDDING_CACHE_TABLE$1
2239
+ });
2240
+ return embeddings;
2241
+ }
2242
+ computeProviderKey() {
2243
+ if (!this.provider) return hashText(JSON.stringify({
2244
+ provider: "none",
2245
+ model: "fts-only"
2246
+ }));
2247
+ if (this.providerRuntime?.cacheKeyData) return hashText(JSON.stringify(this.providerRuntime.cacheKeyData));
2248
+ return hashText(JSON.stringify({
2249
+ provider: this.provider.id,
2250
+ model: this.provider.model
2251
+ }));
2252
+ }
2253
+ buildBatchDebug(source, chunks) {
2254
+ return (message, data) => log$2.debug(message, data ? {
2255
+ ...data,
2256
+ source,
2257
+ chunks: chunks.length
2258
+ } : {
2259
+ source,
2260
+ chunks: chunks.length
2261
+ });
2262
+ }
2263
+ async embedChunksWithBatch(chunks, _entry, source) {
2264
+ const provider = this.provider;
2265
+ const batchEmbed = this.providerRuntime?.batchEmbed;
2266
+ if (!provider || !batchEmbed) return this.embedChunksInBatches(chunks);
2267
+ if (chunks.length === 0) return [];
2268
+ const { embeddings, missing } = this.collectCachedEmbeddings(chunks);
2269
+ if (missing.length === 0) return embeddings;
2270
+ const missingChunks = missing.map((item) => item.chunk);
2271
+ const batchResult = await this.runBatchWithFallback({
2272
+ provider: provider.id,
2273
+ run: async () => await batchEmbed({
2274
+ agentId: this.agentId,
2275
+ chunks: missingChunks,
2276
+ wait: this.batch.wait,
2277
+ concurrency: this.batch.concurrency,
2278
+ pollIntervalMs: this.batch.pollIntervalMs,
2279
+ timeoutMs: this.batch.timeoutMs,
2280
+ debug: this.buildBatchDebug(source, chunks)
2281
+ }),
2282
+ fallback: async () => await this.embedChunksInBatches(chunks)
2283
+ });
2284
+ if (!batchResult) return this.embedChunksInBatches(chunks);
2285
+ const toCache = [];
2286
+ for (let index = 0; index < missing.length; index += 1) {
2287
+ const item = missing[index];
2288
+ const embedding = batchResult[index] ?? [];
2289
+ if (!item) continue;
2290
+ embeddings[item.index] = embedding;
2291
+ toCache.push({
2292
+ hash: item.chunk.hash,
2293
+ embedding
2294
+ });
2295
+ }
2296
+ upsertMemoryEmbeddingCache({
2297
+ db: this.db,
2298
+ enabled: this.cache.enabled,
2299
+ provider,
2300
+ providerKey: this.providerKey,
2301
+ entries: toCache,
2302
+ tableName: EMBEDDING_CACHE_TABLE$1
2303
+ });
2304
+ return embeddings;
2305
+ }
2306
+ collectCachedEmbeddings(chunks) {
2307
+ return collectMemoryCachedEmbeddings({
2308
+ chunks,
2309
+ cached: loadMemoryEmbeddingCache({
2310
+ db: this.db,
2311
+ enabled: this.cache.enabled,
2312
+ provider: this.provider,
2313
+ providerKey: this.providerKey,
2314
+ hashes: chunks.map((chunk) => chunk.hash),
2315
+ tableName: EMBEDDING_CACHE_TABLE$1
2316
+ })
2317
+ });
2318
+ }
2319
+ async embedBatchWithRetry(texts) {
2320
+ if (texts.length === 0) return [];
2321
+ const provider = this.provider;
2322
+ if (!provider) throw new Error("FTS 专用模式下无法嵌入批次(无 embedding 提供商)");
2323
+ try {
2324
+ return await runMemoryEmbeddingRetryLoop({
2325
+ run: async () => {
2326
+ const timeoutMs = this.resolveEmbeddingTimeout("batch");
2327
+ log$2.debug("memory embeddings: batch start", {
2328
+ provider: provider.id,
2329
+ items: texts.length,
2330
+ timeoutMs
2331
+ });
2332
+ return await runEmbeddingOperationWithTimeout({
2333
+ timeoutMs,
2334
+ message: `memory embeddings batch timed out after ${Math.round(timeoutMs / 1e3)}s`,
2335
+ run: async (signal) => await provider.embedBatch(texts, { signal })
2336
+ });
2337
+ },
2338
+ isRetryable: isRetryableMemoryEmbeddingError,
2339
+ waitForRetry: async (delayMs) => {
2340
+ await this.waitForEmbeddingRetry(delayMs, "retrying");
2341
+ },
2342
+ maxAttempts: EMBEDDING_RETRY_MAX_ATTEMPTS,
2343
+ baseDelayMs: EMBEDDING_RETRY_BASE_DELAY_MS
2344
+ });
2345
+ } catch (err) {
2346
+ this.markLocalEmbeddingProviderDegraded(err);
2347
+ throw createMemoryEmbeddingOperationError({
2348
+ operation: "batch",
2349
+ providerId: provider.id,
2350
+ cause: err
2351
+ });
2352
+ }
2353
+ }
2354
+ async embedBatchInputsWithRetry(inputs) {
2355
+ if (inputs.length === 0) return [];
2356
+ const provider = this.provider;
2357
+ const embedBatchInputs = provider?.embedBatchInputs;
2358
+ if (!embedBatchInputs) return await this.embedBatchWithRetry(inputs.map((input) => input.text));
2359
+ try {
2360
+ return await runMemoryEmbeddingRetryLoop({
2361
+ run: async () => {
2362
+ const timeoutMs = this.resolveEmbeddingTimeout("batch");
2363
+ log$2.debug("memory embeddings: structured batch start", {
2364
+ provider: provider.id,
2365
+ items: inputs.length,
2366
+ timeoutMs
2367
+ });
2368
+ return await runEmbeddingOperationWithTimeout({
2369
+ timeoutMs,
2370
+ message: `memory embeddings batch timed out after ${Math.round(timeoutMs / 1e3)}s`,
2371
+ run: async (signal) => await embedBatchInputs(inputs, { signal })
2372
+ });
2373
+ },
2374
+ isRetryable: isRetryableMemoryEmbeddingError,
2375
+ waitForRetry: async (delayMs) => {
2376
+ await this.waitForEmbeddingRetry(delayMs, "retrying structured batch");
2377
+ },
2378
+ maxAttempts: EMBEDDING_RETRY_MAX_ATTEMPTS,
2379
+ baseDelayMs: EMBEDDING_RETRY_BASE_DELAY_MS
2380
+ });
2381
+ } catch (err) {
2382
+ this.markLocalEmbeddingProviderDegraded(err);
2383
+ throw createMemoryEmbeddingOperationError({
2384
+ operation: "structured-batch",
2385
+ providerId: provider.id,
2386
+ cause: err
2387
+ });
2388
+ }
2389
+ }
2390
+ async waitForEmbeddingRetry(delayMs, action) {
2391
+ const waitMs = resolveMemoryEmbeddingRetryDelay(delayMs, Math.random(), EMBEDDING_RETRY_MAX_DELAY_MS);
2392
+ log$2.warn(`memory embeddings rate limited; ${action} in ${waitMs}ms`);
2393
+ await new Promise((resolve) => setTimeout(resolve, waitMs));
2394
+ }
2395
+ resolveEmbeddingTimeout(kind) {
2396
+ return resolveEmbeddingTimeoutMs({
2397
+ kind,
2398
+ providerId: this.provider?.id,
2399
+ providerRuntime: this.providerRuntime,
2400
+ configuredBatchTimeoutSeconds: this.settings.sync.embeddingBatchTimeoutSeconds
2401
+ });
2402
+ }
2403
+ async embedQueryWithTimeout(text) {
2404
+ const provider = this.provider;
2405
+ if (!provider) throw new Error("FTS 专用模式下无法嵌入查询(无 embedding 提供商)");
2406
+ const timeoutMs = this.resolveEmbeddingTimeout("query");
2407
+ log$2.debug("memory embeddings: query start", {
2408
+ provider: provider.id,
2409
+ timeoutMs
2410
+ });
2411
+ try {
2412
+ return await runEmbeddingOperationWithTimeout({
2413
+ timeoutMs,
2414
+ message: `memory embeddings query timed out after ${Math.round(timeoutMs / 1e3)}s`,
2415
+ run: async (signal) => await provider.embedQuery(text, { signal })
2416
+ });
2417
+ } catch (err) {
2418
+ this.markLocalEmbeddingProviderDegraded(err);
2419
+ throw createMemoryEmbeddingOperationError({
2420
+ operation: "query",
2421
+ providerId: provider.id,
2422
+ cause: err
2423
+ });
2424
+ }
2425
+ }
2426
+ async withTimeout(promise, timeoutMs, message) {
2427
+ if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) return await promise;
2428
+ const resolvedTimeoutMs = resolveTimerTimeoutMs(timeoutMs, 1);
2429
+ let timer = null;
2430
+ const timeoutPromise = new Promise((_, reject) => {
2431
+ timer = setTimeout(() => reject(new Error(message)), resolvedTimeoutMs);
2432
+ });
2433
+ try {
2434
+ return await Promise.race([promise, timeoutPromise]);
2435
+ } finally {
2436
+ if (timer) clearTimeout(timer);
2437
+ }
2438
+ }
2439
+ async withBatchFailureLock(fn) {
2440
+ let release;
2441
+ const wait = this.batchFailureLock;
2442
+ this.batchFailureLock = new Promise((resolve) => {
2443
+ release = resolve;
2444
+ });
2445
+ await wait;
2446
+ try {
2447
+ return await fn();
2448
+ } finally {
2449
+ release();
2450
+ }
2451
+ }
2452
+ async resetBatchFailureCount() {
2453
+ await this.withBatchFailureLock(async () => {
2454
+ if (this.batchFailureCount > 0) log$2.debug("memory embeddings: batch recovered; resetting failure count");
2455
+ const nextState = resetMemoryBatchFailureState({
2456
+ enabled: this.batch.enabled,
2457
+ count: this.batchFailureCount,
2458
+ lastError: this.batchFailureLastError,
2459
+ lastProvider: this.batchFailureLastProvider
2460
+ });
2461
+ this.batch.enabled = nextState.enabled;
2462
+ this.batchFailureCount = nextState.count;
2463
+ this.batchFailureLastError = nextState.lastError;
2464
+ this.batchFailureLastProvider = nextState.lastProvider;
2465
+ });
2466
+ }
2467
+ async recordBatchFailure(params) {
2468
+ return await this.withBatchFailureLock(async () => {
2469
+ if (!this.batch.enabled) return {
2470
+ disabled: true,
2471
+ count: this.batchFailureCount
2472
+ };
2473
+ const nextState = recordMemoryBatchFailure({
2474
+ enabled: this.batch.enabled,
2475
+ count: this.batchFailureCount,
2476
+ lastError: this.batchFailureLastError,
2477
+ lastProvider: this.batchFailureLastProvider
2478
+ }, params);
2479
+ this.batch.enabled = nextState.enabled;
2480
+ this.batchFailureCount = nextState.count;
2481
+ this.batchFailureLastError = nextState.lastError;
2482
+ this.batchFailureLastProvider = nextState.lastProvider;
2483
+ return {
2484
+ disabled: !nextState.enabled,
2485
+ count: nextState.count
2486
+ };
2487
+ });
2488
+ }
2489
+ isBatchTimeoutError(message) {
2490
+ return /timed out|timeout/i.test(message);
2491
+ }
2492
+ async runBatchWithTimeoutRetry(params) {
2493
+ try {
2494
+ return await params.run();
2495
+ } catch (err) {
2496
+ const message = formatErrorMessage(err);
2497
+ if (this.isBatchTimeoutError(message)) {
2498
+ log$2.warn(`memory embeddings: ${params.provider} batch timed out; retrying once`);
2499
+ try {
2500
+ return await params.run();
2501
+ } catch (retryErr) {
2502
+ retryErr.batchAttempts = 2;
2503
+ throw retryErr;
2504
+ }
2505
+ }
2506
+ throw err;
2507
+ }
2508
+ }
2509
+ async runBatchWithFallback(params) {
2510
+ if (!this.batch.enabled) return await params.fallback();
2511
+ try {
2512
+ const result = await this.runBatchWithTimeoutRetry({
2513
+ provider: params.provider,
2514
+ run: params.run
2515
+ });
2516
+ await this.resetBatchFailureCount();
2517
+ return result;
2518
+ } catch (err) {
2519
+ const message = formatErrorMessage(err);
2520
+ const attempts = err.batchAttempts ?? 1;
2521
+ const forceDisable = /asyncBatchEmbedContent not available/i.test(message);
2522
+ const failure = await this.recordBatchFailure({
2523
+ provider: params.provider,
2524
+ message,
2525
+ attempts,
2526
+ forceDisable
2527
+ });
2528
+ const suffix = failure.disabled ? "disabling batch" : "keeping batch enabled";
2529
+ log$2.warn(`memory embeddings: ${params.provider} batch failed (${failure.count}/2); ${suffix}; falling back to non-batch embeddings: ${message}`);
2530
+ return await params.fallback();
2531
+ }
2532
+ }
2533
+ getIndexConcurrency() {
2534
+ return resolveMemoryIndexConcurrency({
2535
+ batch: this.batch,
2536
+ configuredNonBatchConcurrency: this.settings.remote?.nonBatchConcurrency,
2537
+ providerId: this.provider?.id
2538
+ });
2539
+ }
2540
+ clearIndexedFileData(pathname, source) {
2541
+ if (this.vector.enabled) try {
2542
+ this.db.prepare(`DELETE FROM ${VECTOR_TABLE$1} WHERE id IN (SELECT id FROM chunks WHERE path = ? AND source = ?)`).run(pathname, source);
2543
+ } catch {}
2544
+ if (this.fts.enabled && this.fts.available) try {
2545
+ deleteMemoryFtsRows({
2546
+ db: this.db,
2547
+ tableName: FTS_TABLE$1,
2548
+ path: pathname,
2549
+ source,
2550
+ currentModel: this.provider?.model
2551
+ });
2552
+ } catch {}
2553
+ this.db.prepare(`DELETE FROM chunks WHERE path = ? AND source = ?`).run(pathname, source);
2554
+ }
2555
+ upsertFileRecord(entry, source) {
2556
+ this.db.prepare(`INSERT INTO files (path, source, hash, mtime, size) VALUES (?, ?, ?, ?, ?)
2557
+ ON CONFLICT(path) DO UPDATE SET
2558
+ source=excluded.source,
2559
+ hash=excluded.hash,
2560
+ mtime=excluded.mtime,
2561
+ size=excluded.size`).run(entry.path, source, entry.hash, entry.mtimeMs, entry.size);
2562
+ }
2563
+ deleteFileRecord(pathname, source) {
2564
+ this.db.prepare(`DELETE FROM files WHERE path = ? AND source = ?`).run(pathname, source);
2565
+ }
2566
+ /**
2567
+ * Write chunks (and optional embeddings) for a file into the index.
2568
+ * Handles both the chunks table, the vector table, and the FTS table.
2569
+ * Pass an empty embeddings array to skip vector writes (FTS-only mode).
2570
+ */
2571
+ writeChunks(entry, source, model, chunks, embeddings, vectorReady) {
2572
+ const now = Date.now();
2573
+ this.clearIndexedFileData(entry.path, source);
2574
+ for (let i = 0; i < chunks.length; i++) {
2575
+ const chunk = chunks[i];
2576
+ const embedding = embeddings[i] ?? [];
2577
+ const id = hashText(`${source}:${entry.path}:${chunk.startLine}:${chunk.endLine}:${chunk.hash}:${model}`);
2578
+ this.db.prepare(`INSERT INTO chunks (id, path, source, start_line, end_line, hash, model, text, embedding, updated_at)
2579
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2580
+ ON CONFLICT(id) DO UPDATE SET
2581
+ hash=excluded.hash,
2582
+ model=excluded.model,
2583
+ text=excluded.text,
2584
+ embedding=excluded.embedding,
2585
+ updated_at=excluded.updated_at`).run(id, entry.path, source, chunk.startLine, chunk.endLine, chunk.hash, model, chunk.text, JSON.stringify(embedding), now);
2586
+ if (vectorReady && embedding.length > 0) replaceMemoryVectorRow({
2587
+ db: this.db,
2588
+ tableName: VECTOR_TABLE$1,
2589
+ id,
2590
+ embedding
2591
+ });
2592
+ if (this.fts.enabled && this.fts.available) this.db.prepare(`INSERT INTO ${FTS_TABLE$1} (text, id, path, source, model, start_line, end_line)\n VALUES (?, ?, ?, ?, ?, ?, ?)`).run(chunk.text, id, entry.path, source, model, chunk.startLine, chunk.endLine);
2593
+ }
2594
+ this.vectorDegradedWriteWarningShown = logMemoryVectorDegradedWrite({
2595
+ vectorEnabled: this.vector.enabled,
2596
+ vectorReady,
2597
+ chunkCount: chunks.length,
2598
+ warningShown: this.vectorDegradedWriteWarningShown,
2599
+ loadError: this.vector.loadError,
2600
+ warn: (message) => log$2.warn(message)
2601
+ });
2602
+ this.upsertFileRecord(entry, source);
2603
+ }
2604
+ async indexFile(entry, options) {
2605
+ if (!this.provider) {
2606
+ if ("kind" in entry && entry.kind === "multimodal") return;
2607
+ const chunks = filterNonEmptyMemoryChunks(chunkMarkdown(options.content ?? await fs$1.readFile(entry.absPath, "utf-8"), this.settings.chunking));
2608
+ if (options.source === "sessions" && "lineMap" in entry) remapChunkLines(chunks, entry.lineMap);
2609
+ this.writeChunks(entry, options.source, "fts-only", chunks, [], false);
2610
+ return;
2611
+ }
2612
+ let chunks;
2613
+ let structuredInputBytes;
2614
+ if ("kind" in entry && entry.kind === "multimodal") {
2615
+ if (!this.provider) {
2616
+ log$2.debug("Skipping multimodal indexing in FTS-only mode", {
2617
+ path: entry.path,
2618
+ source: options.source
2619
+ });
2620
+ this.clearIndexedFileData(entry.path, options.source);
2621
+ this.upsertFileRecord(entry, options.source);
2622
+ return;
2623
+ }
2624
+ const multimodalChunk = await buildMultimodalChunkForIndexing(entry);
2625
+ if (!multimodalChunk) {
2626
+ this.clearIndexedFileData(entry.path, options.source);
2627
+ this.deleteFileRecord(entry.path, options.source);
2628
+ return;
2629
+ }
2630
+ structuredInputBytes = multimodalChunk.structuredInputBytes;
2631
+ chunks = [multimodalChunk.chunk];
2632
+ } else {
2633
+ const baseChunks = filterNonEmptyMemoryChunks(chunkMarkdown(options.content ?? await fs$1.readFile(entry.absPath, "utf-8"), this.settings.chunking));
2634
+ chunks = this.provider ? enforceEmbeddingMaxInputTokens(this.provider, baseChunks, EMBEDDING_BATCH_MAX_TOKENS) : baseChunks;
2635
+ if (options.source === "sessions" && "lineMap" in entry) remapChunkLines(chunks, entry.lineMap);
2636
+ }
2637
+ if (!this.provider) {
2638
+ this.writeChunks(entry, options.source, "fts-only", chunks, [], false);
2639
+ return;
2640
+ }
2641
+ let embeddings;
2642
+ try {
2643
+ embeddings = this.batch.enabled ? await this.embedChunksWithBatch(chunks, entry, options.source) : await this.embedChunksInBatches(chunks);
2644
+ } catch (err) {
2645
+ const message = formatErrorMessage(err);
2646
+ if ("kind" in entry && entry.kind === "multimodal" && /(413|payload too large|request too large|input too large|too many tokens|input limit|request size)/i.test(message)) {
2647
+ log$2.warn("memory embeddings: skipping multimodal file rejected as too large", {
2648
+ path: entry.path,
2649
+ bytes: structuredInputBytes,
2650
+ provider: this.provider.id,
2651
+ model: this.provider.model,
2652
+ error: message
2653
+ });
2654
+ this.clearIndexedFileData(entry.path, options.source);
2655
+ this.upsertFileRecord(entry, options.source);
2656
+ return;
2657
+ }
2658
+ throw err;
2659
+ }
2660
+ const sample = embeddings.find((embedding) => embedding.length > 0);
2661
+ const vectorReady = sample ? await this.ensureVectorReady(sample.length) : false;
2662
+ this.writeChunks(entry, options.source, this.provider.model, chunks, embeddings, vectorReady);
2663
+ }
2664
+ };
2665
+ const LOCAL_EMBEDDING_WORKER_FAILURE_CODES = new Set(Object.values({
2666
+ exited: "LOCAL_EMBEDDING_WORKER_EXITED",
2667
+ processError: "LOCAL_EMBEDDING_WORKER_PROCESS_ERROR",
2668
+ ipcError: "LOCAL_EMBEDDING_WORKER_IPC_ERROR"
2669
+ }));
2670
+ function isLocalEmbeddingWorkerFailure(err) {
2671
+ return err instanceof Error && LOCAL_EMBEDDING_WORKER_FAILURE_CODES.has(String(err.code));
2672
+ }
2673
+ //#endregion
2674
+ //#region extensions/memory-core/src/memory/manager-search-preflight.ts
2675
+ function resolveMemorySearchPreflight(params) {
2676
+ const normalizedQuery = params.query.trim();
2677
+ if (!normalizedQuery) return {
2678
+ normalizedQuery,
2679
+ shouldInitializeProvider: false,
2680
+ shouldSearch: false
2681
+ };
2682
+ if (!params.hasIndexedContent) return {
2683
+ normalizedQuery,
2684
+ shouldInitializeProvider: false,
2685
+ shouldSearch: false
2686
+ };
2687
+ return {
2688
+ normalizedQuery,
2689
+ shouldInitializeProvider: true,
2690
+ shouldSearch: true
2691
+ };
2692
+ }
2693
+ //#endregion
2694
+ //#region extensions/memory-core/src/memory/manager-search.ts
2695
+ const vectorToBlob = (embedding) => Buffer.from(new Float32Array(embedding).buffer);
2696
+ const FTS_QUERY_TOKEN_RE = /[\p{L}\p{N}_]+/gu;
2697
+ const SHORT_CJK_TRIGRAM_RE = /[\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af\u3131-\u3163]/u;
2698
+ const VECTOR_KNN_OVERSAMPLE_FACTOR = 8;
2699
+ const FALLBACK_VECTOR_BATCH_SIZE = 256;
2700
+ function yieldToEventLoop() {
2701
+ return new Promise((resolve) => {
2702
+ setImmediate(resolve);
2703
+ });
2704
+ }
2705
+ function normalizeSearchTokens(raw) {
2706
+ return normalizeStringEntriesLower(raw.match(FTS_QUERY_TOKEN_RE) ?? []);
2707
+ }
2708
+ function scoreFallbackKeywordResult(params) {
2709
+ const queryTokens = uniqueStrings(normalizeSearchTokens(params.query));
2710
+ if (queryTokens.length === 0) return params.ftsScore;
2711
+ const textTokens = normalizeSearchTokens(params.text);
2712
+ const textTokenSet = new Set(textTokens);
2713
+ const pathLower = params.path.toLowerCase();
2714
+ const overlap = queryTokens.filter((token) => textTokenSet.has(token)).length;
2715
+ const uniqueQueryOverlap = overlap / Math.max(new Set(queryTokens).size, 1);
2716
+ const density = overlap / Math.max(textTokenSet.size, 1);
2717
+ const pathBoost = queryTokens.reduce((score, token) => score + (pathLower.includes(token) ? .18 : 0), 0);
2718
+ const textLengthBoost = Math.min(params.text.length / 160, .18);
2719
+ const lexicalBoost = uniqueQueryOverlap * .45 + density * .2 + pathBoost + textLengthBoost;
2720
+ return Math.min(1, params.ftsScore + lexicalBoost);
2721
+ }
2722
+ function escapeLikePattern(term) {
2723
+ return term.replaceAll("\\", "\\\\").replaceAll("%", "\\%").replaceAll("_", "\\_");
2724
+ }
2725
+ function buildMatchQueryFromTerms(terms) {
2726
+ if (terms.length === 0) return null;
2727
+ return terms.map((term) => `"${term.replaceAll("\"", "")}"`).join(" AND ");
2728
+ }
2729
+ function readCount(row) {
2730
+ if (typeof row?.count === "bigint") return Number(row.count);
2731
+ if (typeof row?.count === "number") return row.count;
2732
+ return 0;
2733
+ }
2734
+ function planKeywordSearch(params) {
2735
+ if (params.ftsTokenizer !== "trigram") return {
2736
+ matchQuery: params.buildFtsQuery(params.query),
2737
+ substringTerms: []
2738
+ };
2739
+ const tokens = normalizeStringEntries(params.query.match(FTS_QUERY_TOKEN_RE) ?? []);
2740
+ if (tokens.length === 0) return {
2741
+ matchQuery: null,
2742
+ substringTerms: []
2743
+ };
2744
+ const matchTerms = [];
2745
+ const substringTerms = [];
2746
+ for (const token of tokens) {
2747
+ if (SHORT_CJK_TRIGRAM_RE.test(token) && Array.from(token).length < 3) {
2748
+ substringTerms.push(token);
2749
+ continue;
2750
+ }
2751
+ matchTerms.push(token);
2752
+ }
2753
+ return {
2754
+ matchQuery: buildMatchQueryFromTerms(matchTerms),
2755
+ substringTerms
2756
+ };
2757
+ }
2758
+ async function searchVector(params) {
2759
+ if (params.queryVec.length === 0 || params.limit <= 0) return [];
2760
+ if (await params.ensureVectorReady(params.queryVec.length)) {
2761
+ const qBlob = vectorToBlob(params.queryVec);
2762
+ const runVectorQuery = (candidateLimit) => params.db.prepare(`SELECT c.id, c.path, c.start_line, c.end_line, c.text,
2763
+ c.source,
2764
+ vec_distance_cosine(v.embedding, ?) AS dist
2765
+ FROM ${params.vectorTable} v\n JOIN chunks c ON c.id = v.id\n WHERE v.embedding MATCH ? AND k = ? AND c.model = ?${params.sourceFilterVec.sql}\n ORDER BY dist ASC\n LIMIT ?`).all(qBlob, qBlob, candidateLimit, params.providerModel, ...params.sourceFilterVec.params, params.limit);
2766
+ const candidateLimit = params.limit * VECTOR_KNN_OVERSAMPLE_FACTOR;
2767
+ let rows = runVectorQuery(candidateLimit);
2768
+ if (rows.length < params.limit) {
2769
+ if (readCount(params.db.prepare(`SELECT COUNT(*) AS count FROM chunks c WHERE c.model = ?${params.sourceFilterVec.sql}`).get(params.providerModel, ...params.sourceFilterVec.params)) > rows.length) {
2770
+ const vectorCount = readCount(params.db.prepare(`SELECT COUNT(*) AS count FROM ${params.vectorTable}`).get());
2771
+ if (vectorCount > candidateLimit) rows = runVectorQuery(vectorCount);
2772
+ }
2773
+ }
2774
+ return rows.map((row) => ({
2775
+ id: row.id,
2776
+ path: row.path,
2777
+ startLine: row.start_line,
2778
+ endLine: row.end_line,
2779
+ score: 1 - row.dist,
2780
+ snippet: truncateUtf16Safe(row.text, params.snippetMaxChars),
2781
+ source: row.source
2782
+ }));
2783
+ }
2784
+ return await searchChunksByEmbedding({
2785
+ db: params.db,
2786
+ providerModel: params.providerModel,
2787
+ sourceFilter: params.sourceFilterChunks,
2788
+ queryVec: params.queryVec,
2789
+ limit: params.limit,
2790
+ snippetMaxChars: params.snippetMaxChars
2791
+ });
2792
+ }
2793
+ async function searchChunksByEmbedding(params) {
2794
+ if (params.limit <= 0) return [];
2795
+ const stmt = params.db.prepare(`SELECT rowid, id, path, start_line, end_line, text, embedding, source
2796
+ FROM chunks
2797
+ WHERE model = ? AND rowid > ?${params.sourceFilter.sql}\n ORDER BY rowid ASC\n LIMIT ?`);
2798
+ const topResults = [];
2799
+ let lastRowid = 0;
2800
+ while (true) {
2801
+ const batch = stmt.all(params.providerModel, lastRowid, ...params.sourceFilter.params, FALLBACK_VECTOR_BATCH_SIZE);
2802
+ if (batch.length === 0) break;
2803
+ for (const row of batch) {
2804
+ const score = cosineSimilarity(params.queryVec, parseEmbedding(row.embedding));
2805
+ if (Number.isFinite(score)) {
2806
+ const result = {
2807
+ id: row.id,
2808
+ path: row.path,
2809
+ startLine: row.start_line,
2810
+ endLine: row.end_line,
2811
+ score,
2812
+ snippet: truncateUtf16Safe(row.text, params.snippetMaxChars),
2813
+ source: row.source
2814
+ };
2815
+ if (topResults.length < params.limit) {
2816
+ topResults.push(result);
2817
+ if (topResults.length === params.limit) topResults.sort((a, b) => b.score - a.score);
2818
+ } else {
2819
+ const lowest = topResults.at(-1);
2820
+ if (lowest && result.score > lowest.score) {
2821
+ topResults[topResults.length - 1] = result;
2822
+ topResults.sort((a, b) => b.score - a.score);
2823
+ }
2824
+ }
2825
+ }
2826
+ }
2827
+ const nextRowid = batch.at(-1)?.rowid;
2828
+ lastRowid = typeof nextRowid === "bigint" ? Number(nextRowid) : nextRowid ?? lastRowid;
2829
+ if (batch.length < FALLBACK_VECTOR_BATCH_SIZE) break;
2830
+ await yieldToEventLoop();
2831
+ }
2832
+ topResults.sort((a, b) => b.score - a.score);
2833
+ return topResults;
2834
+ }
2835
+ async function searchKeyword(params) {
2836
+ if (params.limit <= 0) return [];
2837
+ const plan = planKeywordSearch({
2838
+ query: params.query,
2839
+ ftsTokenizer: params.ftsTokenizer,
2840
+ buildFtsQuery: params.buildFtsQuery
2841
+ });
2842
+ if (!plan.matchQuery && plan.substringTerms.length === 0) return [];
2843
+ const modelClause = params.providerModel ? " AND model = ?" : "";
2844
+ const modelParams = params.providerModel ? [params.providerModel] : [];
2845
+ const substringClause = plan.substringTerms.map(() => " AND text LIKE ? ESCAPE '\\'").join("");
2846
+ const substringParams = plan.substringTerms.map((term) => `%${escapeLikePattern(term)}%`);
2847
+ let rows;
2848
+ let usedMatch = false;
2849
+ if (plan.matchQuery) try {
2850
+ rows = params.db.prepare(`SELECT id, path, source, start_line, end_line, text,\n bm25(${params.ftsTable}) AS rank\n FROM ${params.ftsTable}\n WHERE ${params.ftsTable} MATCH ?${substringClause}${modelClause}${params.sourceFilter.sql}\n ORDER BY rank ASC\n LIMIT ?`).all(plan.matchQuery, ...substringParams, ...modelParams, ...params.sourceFilter.params, params.limit);
2851
+ usedMatch = true;
2852
+ } catch (matchErr) {
2853
+ console.warn(`memory search: FTS5 MATCH failed, falling back to LIKE: ${String(matchErr)}`);
2854
+ const allTerms = uniqueStrings([...normalizeStringEntries(params.query.match(FTS_QUERY_TOKEN_RE) ?? []), ...plan.substringTerms]);
2855
+ const fallbackLikeClause = allTerms.map(() => " AND text LIKE ? ESCAPE '\\'").join("");
2856
+ const fallbackLikeParams = allTerms.map((term) => `%${escapeLikePattern(term)}%`);
2857
+ rows = params.db.prepare(`SELECT id, path, source, start_line, end_line, text,
2858
+ 0 AS rank
2859
+ FROM ${params.ftsTable}\n WHERE 1=1${fallbackLikeClause}${modelClause}${params.sourceFilter.sql}\n LIMIT ?`).all(...fallbackLikeParams, ...modelParams, ...params.sourceFilter.params, params.limit);
2860
+ }
2861
+ else rows = params.db.prepare(`SELECT id, path, source, start_line, end_line, text,
2862
+ 0 AS rank
2863
+ FROM ${params.ftsTable}\n WHERE 1=1${substringClause}${modelClause}${params.sourceFilter.sql}\n LIMIT ?`).all(...substringParams, ...modelParams, ...params.sourceFilter.params, params.limit);
2864
+ return rows.map((row) => {
2865
+ const textScore = usedMatch ? params.bm25RankToScore(row.rank) : 1;
2866
+ const score = params.boostFallbackRanking ? scoreFallbackKeywordResult({
2867
+ query: params.query,
2868
+ path: row.path,
2869
+ text: row.text,
2870
+ ftsScore: textScore
2871
+ }) : textScore;
2872
+ return {
2873
+ id: row.id,
2874
+ path: row.path,
2875
+ startLine: row.start_line,
2876
+ endLine: row.end_line,
2877
+ score,
2878
+ textScore,
2879
+ snippet: truncateUtf16Safe(row.text, params.snippetMaxChars),
2880
+ source: row.source
2881
+ };
2882
+ });
2883
+ }
2884
+ //#endregion
2885
+ //#region extensions/memory-core/src/memory/manager-status-state.ts
2886
+ const MEMORY_STATUS_AGGREGATE_SQL = "SELECT 'files' AS kind, source, COUNT(*) as c FROM files WHERE 1=1__FILTER__ GROUP BY source\nUNION ALL\nSELECT 'chunks' AS kind, source, COUNT(*) as c FROM chunks WHERE 1=1__FILTER__ GROUP BY source";
2887
+ function resolveInitialMemoryDirty(params) {
2888
+ return params.hasMemorySource && (params.statusOnly ? !params.hasIndexedMeta : true);
2889
+ }
2890
+ function resolveStatusProviderInfo(params) {
2891
+ if (params.provider) return {
2892
+ provider: params.provider.id,
2893
+ model: params.provider.model,
2894
+ searchMode: "hybrid"
2895
+ };
2896
+ if (params.providerInitialized) return {
2897
+ provider: "none",
2898
+ model: void 0,
2899
+ searchMode: "fts-only"
2900
+ };
2901
+ return {
2902
+ provider: params.requestedProvider,
2903
+ model: params.configuredModel || void 0,
2904
+ searchMode: "hybrid"
2905
+ };
2906
+ }
2907
+ function collectMemoryStatusAggregate(params) {
2908
+ const sources = Array.from(params.sources);
2909
+ const bySource = /* @__PURE__ */ new Map();
2910
+ for (const source of sources) bySource.set(source, {
2911
+ files: 0,
2912
+ chunks: 0
2913
+ });
2914
+ const sourceFilterSql = params.sourceFilterSql ?? "";
2915
+ const sourceFilterParams = params.sourceFilterParams ?? [];
2916
+ const aggregateRows = params.db.prepare(MEMORY_STATUS_AGGREGATE_SQL.replaceAll("__FILTER__", sourceFilterSql)).all(...sourceFilterParams, ...sourceFilterParams);
2917
+ let files = 0;
2918
+ let chunks = 0;
2919
+ for (const row of aggregateRows) {
2920
+ const count = row.c ?? 0;
2921
+ const entry = bySource.get(row.source) ?? {
2922
+ files: 0,
2923
+ chunks: 0
2924
+ };
2925
+ if (row.kind === "files") {
2926
+ entry.files = count;
2927
+ files += count;
2928
+ } else {
2929
+ entry.chunks = count;
2930
+ chunks += count;
2931
+ }
2932
+ bySource.set(row.source, entry);
2933
+ }
2934
+ return {
2935
+ files,
2936
+ chunks,
2937
+ sourceCounts: sources.map((source) => Object.assign({ source }, bySource.get(source)))
2938
+ };
2939
+ }
2940
+ //#endregion
2941
+ //#region extensions/memory-core/src/memory/manager-sync-control.ts
2942
+ const log$1 = createSubsystemLogger("memory");
2943
+ function isMemoryReadonlyDbError(err) {
2944
+ const readonlyPattern = /attempt to write a readonly database|database is read-only|SQLITE_READONLY/i;
2945
+ const messages = /* @__PURE__ */ new Set();
2946
+ const pushValue = (value) => {
2947
+ if (typeof value !== "string") return;
2948
+ const normalized = value.trim();
2949
+ if (!normalized) return;
2950
+ messages.add(normalized);
2951
+ };
2952
+ pushValue(formatErrorMessage(err));
2953
+ if (err && typeof err === "object") {
2954
+ const record = err;
2955
+ pushValue(record.message);
2956
+ pushValue(record.code);
2957
+ pushValue(record.name);
2958
+ if (record.cause && typeof record.cause === "object") {
2959
+ const cause = record.cause;
2960
+ pushValue(cause.message);
2961
+ pushValue(cause.code);
2962
+ pushValue(cause.name);
2963
+ }
2964
+ }
2965
+ return [...messages].some((value) => readonlyPattern.test(value));
2966
+ }
2967
+ function extractMemoryErrorReason(err) {
2968
+ if (err instanceof Error && err.message.trim()) return err.message;
2969
+ if (err && typeof err === "object") {
2970
+ const record = err;
2971
+ if (typeof record.message === "string" && record.message.trim()) return record.message;
2972
+ if (typeof record.code === "string" && record.code.trim()) return record.code;
2973
+ }
2974
+ return String(err);
2975
+ }
2976
+ async function runMemorySyncWithReadonlyRecovery(state, params) {
2977
+ try {
2978
+ await state.runSync(params);
2979
+ return;
2980
+ } catch (err) {
2981
+ if (!isMemoryReadonlyDbError(err) || state.closed) throw err;
2982
+ const reason = extractMemoryErrorReason(err);
2983
+ state.readonlyRecoveryAttempts += 1;
2984
+ state.readonlyRecoveryLastError = reason;
2985
+ log$1.warn(`memory sync readonly handle detected; reopening sqlite connection`, { reason });
2986
+ try {
2987
+ state.closeDatabase(state.db);
2988
+ } catch {}
2989
+ const previousVectorDims = state.vector.dims;
2990
+ state.db = state.openDatabase();
2991
+ state.resetVectorState();
2992
+ state.ensureSchema();
2993
+ const meta = state.readMeta();
2994
+ state.vector.dims = meta?.vectorDims ?? previousVectorDims;
2995
+ try {
2996
+ await state.runSync(params);
2997
+ state.readonlyRecoverySuccesses += 1;
2998
+ } catch (retryErr) {
2999
+ state.readonlyRecoveryFailures += 1;
3000
+ throw retryErr;
3001
+ }
3002
+ }
3003
+ }
3004
+ function enqueueMemoryTargetedSessionSync(state, sessionFiles) {
3005
+ const queuedSessionFiles = state.getQueuedSessionFiles();
3006
+ for (const sessionFile of sessionFiles ?? []) {
3007
+ const trimmed = sessionFile.trim();
3008
+ if (trimmed) queuedSessionFiles.add(trimmed);
3009
+ }
3010
+ if (queuedSessionFiles.size === 0) return state.getSyncing() ?? Promise.resolve();
3011
+ if (!state.getQueuedSessionSync()) state.setQueuedSessionSync((async () => {
3012
+ try {
3013
+ await state.getSyncing()?.catch(() => void 0);
3014
+ while (!state.isClosed() && state.getQueuedSessionFiles().size > 0) {
3015
+ const pendingSessionFiles = Array.from(state.getQueuedSessionFiles());
3016
+ state.getQueuedSessionFiles().clear();
3017
+ await state.sync({
3018
+ reason: "queued-session-files",
3019
+ sessionFiles: pendingSessionFiles
3020
+ });
3021
+ }
3022
+ } finally {
3023
+ state.setQueuedSessionSync(null);
3024
+ }
3025
+ })());
3026
+ return state.getQueuedSessionSync() ?? Promise.resolve();
3027
+ }
3028
+ //#endregion
3029
+ //#region extensions/memory-core/src/memory/manager.ts
3030
+ const SNIPPET_MAX_CHARS = 700;
3031
+ const VECTOR_TABLE = "chunks_vec";
3032
+ const FTS_TABLE = "chunks_fts";
3033
+ const EMBEDDING_CACHE_TABLE = "embedding_cache";
3034
+ const MEMORY_INDEX_MANAGER_CACHE_KEY = Symbol.for("fengming.memoryIndexManagerCache");
3035
+ const EMBEDDING_PROBE_CACHE_TTL_MS = 3e4;
3036
+ const log = createSubsystemLogger("memory");
3037
+ const { cache: INDEX_CACHE, pending: INDEX_CACHE_PENDING } = resolveSingletonManagedCache(MEMORY_INDEX_MANAGER_CACHE_KEY);
3038
+ const EMBEDDING_PROBE_CACHE = /* @__PURE__ */ new Map();
3039
+ async function closeAllMemoryIndexManagers() {
3040
+ EMBEDDING_PROBE_CACHE.clear();
3041
+ await closeManagedCacheEntries({
3042
+ cache: INDEX_CACHE,
3043
+ pending: INDEX_CACHE_PENDING,
3044
+ onCloseError: (err) => {
3045
+ log.warn(`failed to close memory index manager: ${String(err)}`);
3046
+ }
3047
+ });
3048
+ }
3049
+ async function closeMemoryIndexManagersForAgent(params) {
3050
+ const settings = resolveMemorySearchConfig(params.cfg, params.agentId);
3051
+ if (!settings) return;
3052
+ const workspaceDir = resolveAgentWorkspaceDir(params.cfg, params.agentId);
3053
+ const key = `${params.agentId}:${workspaceDir}:${JSON.stringify(settings)}:default`;
3054
+ const pending = INDEX_CACHE_PENDING.get(key);
3055
+ if (pending) await Promise.allSettled([pending]);
3056
+ const manager = INDEX_CACHE.get(key);
3057
+ if (!manager) return;
3058
+ INDEX_CACHE.delete(key);
3059
+ try {
3060
+ await manager.close();
3061
+ } catch (err) {
3062
+ log.warn(`failed to close memory index manager for agent ${params.agentId}: ${String(err)}`);
3063
+ }
3064
+ }
3065
+ var MemoryIndexManager = class MemoryIndexManager extends MemoryManagerEmbeddingOps {
3066
+ static async loadProviderResult(params) {
3067
+ return await createEmbeddingProvider({
3068
+ config: params.cfg,
3069
+ agentDir: resolveAgentDir(params.cfg, params.agentId),
3070
+ ...resolveMemoryPrimaryProviderRequest({ settings: params.settings })
3071
+ });
3072
+ }
3073
+ static async get(params) {
3074
+ const { cfg, agentId } = params;
3075
+ const settings = resolveMemorySearchConfig(cfg, agentId);
3076
+ if (!settings) return null;
3077
+ const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);
3078
+ const purpose = params.purpose === "status" || params.purpose === "cli" ? params.purpose : "default";
3079
+ const key = `${agentId}:${workspaceDir}:${JSON.stringify(settings)}:${purpose}`;
3080
+ return await getOrCreateManagedCacheEntry({
3081
+ cache: INDEX_CACHE,
3082
+ pending: INDEX_CACHE_PENDING,
3083
+ key,
3084
+ bypassCache: purpose === "status" || purpose === "cli",
3085
+ create: async () => new MemoryIndexManager({
3086
+ cacheKey: key,
3087
+ cfg,
3088
+ agentId,
3089
+ workspaceDir,
3090
+ settings,
3091
+ purpose: params.purpose
3092
+ })
3093
+ });
3094
+ }
3095
+ constructor(params) {
3096
+ super();
3097
+ this.providerInitPromise = null;
3098
+ this.providerInitialized = false;
3099
+ this.batchFailureCount = 0;
3100
+ this.batchFailureLock = Promise.resolve();
3101
+ this.vectorReady = null;
3102
+ this.watcher = null;
3103
+ this.watchTimer = null;
3104
+ this.sessionWatchTimer = null;
3105
+ this.sessionUnsubscribe = null;
3106
+ this.intervalTimer = null;
3107
+ this.closed = false;
3108
+ this.dirty = false;
3109
+ this.sessionsDirty = false;
3110
+ this.sessionsDirtyFiles = /* @__PURE__ */ new Set();
3111
+ this.sessionPendingFiles = /* @__PURE__ */ new Set();
3112
+ this.sessionDeltas = /* @__PURE__ */ new Map();
3113
+ this.sessionWarm = /* @__PURE__ */ new Set();
3114
+ this.syncing = null;
3115
+ this.queuedSessionFiles = /* @__PURE__ */ new Set();
3116
+ this.queuedSessionSync = null;
3117
+ this.readonlyRecoveryAttempts = 0;
3118
+ this.readonlyRecoverySuccesses = 0;
3119
+ this.readonlyRecoveryFailures = 0;
3120
+ this.cacheKey = params.cacheKey;
3121
+ this.cfg = params.cfg;
3122
+ this.agentId = params.agentId;
3123
+ this.workspaceDir = params.workspaceDir;
3124
+ this.settings = params.settings;
3125
+ this.provider = null;
3126
+ this.requestedProvider = params.settings.provider;
3127
+ this.providerLifecycle = createPendingMemoryProviderLifecycle(this.requestedProvider);
3128
+ if (params.providerResult) this.applyProviderResult(params.providerResult);
3129
+ this.sources = new Set(params.settings.sources);
3130
+ this.db = this.openDatabase();
3131
+ this.providerKey = this.computeProviderKey();
3132
+ this.cache = {
3133
+ enabled: params.settings.cache.enabled,
3134
+ maxEntries: params.settings.cache.maxEntries
3135
+ };
3136
+ this.fts = {
3137
+ enabled: params.settings.query.hybrid.enabled,
3138
+ available: false
3139
+ };
3140
+ this.ensureSchema();
3141
+ this.vector = {
3142
+ enabled: params.settings.store.vector.enabled,
3143
+ available: null,
3144
+ extensionPath: params.settings.store.vector.extensionPath
3145
+ };
3146
+ const meta = this.readMeta();
3147
+ if (meta?.vectorDims) this.vector.dims = meta.vectorDims;
3148
+ const transient = params.purpose === "status" || params.purpose === "cli";
3149
+ if (!transient) {
3150
+ this.ensureWatcher();
3151
+ this.ensureSessionListener();
3152
+ this.ensureIntervalSync();
3153
+ }
3154
+ this.dirty = resolveInitialMemoryDirty({
3155
+ hasMemorySource: this.sources.has("memory"),
3156
+ statusOnly: params.purpose === "status",
3157
+ hasIndexedMeta: Boolean(meta)
3158
+ });
3159
+ this.batch = this.resolveBatchConfig();
3160
+ if (!transient) this.ensureSessionStartupCatchup();
3161
+ }
3162
+ applyProviderResult(providerResult) {
3163
+ const providerState = resolveMemoryProviderState(providerResult);
3164
+ this.provider = providerState.provider;
3165
+ this.fallbackFrom = providerState.fallbackFrom;
3166
+ this.fallbackReason = providerState.fallbackReason;
3167
+ this.providerUnavailableReason = providerState.providerUnavailableReason;
3168
+ this.providerLifecycle = providerState.lifecycle;
3169
+ this.providerRuntime = providerState.providerRuntime;
3170
+ this.providerInitialized = true;
3171
+ }
3172
+ async ensureProviderInitialized() {
3173
+ if (this.providerInitialized) return;
3174
+ if (!this.providerInitPromise) this.providerInitPromise = (async () => {
3175
+ const providerResult = await MemoryIndexManager.loadProviderResult({
3176
+ cfg: this.cfg,
3177
+ agentId: this.agentId,
3178
+ settings: this.settings
3179
+ });
3180
+ this.applyProviderResult(providerResult);
3181
+ this.providerKey = this.computeProviderKey();
3182
+ this.batch = this.resolveBatchConfig();
3183
+ })();
3184
+ try {
3185
+ await this.providerInitPromise;
3186
+ } catch (err) {
3187
+ this.providerInitPromise = null;
3188
+ throw err;
3189
+ } finally {
3190
+ if (this.providerInitialized) this.providerInitPromise = null;
3191
+ }
3192
+ }
3193
+ resetProviderInitializationForRetry() {
3194
+ this.providerInitialized = false;
3195
+ this.providerInitPromise = null;
3196
+ this.providerUnavailableReason = void 0;
3197
+ this.providerLifecycle = createPendingMemoryProviderLifecycle(this.requestedProvider);
3198
+ }
3199
+ markLocalEmbeddingProviderDegraded(err) {
3200
+ if (this.provider?.id !== "local") return;
3201
+ if (!isLocalEmbeddingWorkerFailure(err)) return;
3202
+ const message = formatErrorMessage(err);
3203
+ const degradedProvider = this.provider;
3204
+ this.provider = null;
3205
+ this.providerRuntime = void 0;
3206
+ this.providerUnavailableReason = `Local embeddings degraded: ${message}`;
3207
+ this.providerLifecycle = createDegradedMemoryProviderLifecycle({
3208
+ providerId: degradedProvider.id,
3209
+ reason: message,
3210
+ code: err.code
3211
+ });
3212
+ EMBEDDING_PROBE_CACHE.delete(this.cacheKey);
3213
+ this.providerKey = this.computeProviderKey();
3214
+ this.batch = this.resolveBatchConfig();
3215
+ this.vector.semanticAvailable = false;
3216
+ Promise.resolve(degradedProvider.close?.()).catch((err) => {
3217
+ log.debug(`memory embeddings: failed to close degraded local provider: ${String(err)}`);
3218
+ });
3219
+ log.warn("memory embeddings: local provider degraded after worker failure", { error: message });
3220
+ }
3221
+ async warmSession(sessionKey) {
3222
+ if (!this.settings.sync.onSessionStart) return;
3223
+ const key = sessionKey?.trim() || "";
3224
+ if (key && this.sessionWarm.has(key)) return;
3225
+ this.sync({ reason: "session-start" }).catch((err) => {
3226
+ log.warn(`memory sync failed (session-start): ${String(err)}`);
3227
+ });
3228
+ if (key) this.sessionWarm.add(key);
3229
+ }
3230
+ async search(query, opts) {
3231
+ opts?.onDebug?.({ backend: "builtin" });
3232
+ let hasIndexedContent = this.hasIndexedContent();
3233
+ if (!hasIndexedContent) {
3234
+ try {
3235
+ await this.sync({
3236
+ reason: "search",
3237
+ force: true
3238
+ });
3239
+ } catch (err) {
3240
+ log.warn(`memory sync failed (search-bootstrap): ${String(err)}`);
3241
+ }
3242
+ hasIndexedContent = this.hasIndexedContent();
3243
+ }
3244
+ const preflight = resolveMemorySearchPreflight({
3245
+ query,
3246
+ hasIndexedContent
3247
+ });
3248
+ if (!preflight.shouldSearch) return [];
3249
+ const cleaned = preflight.normalizedQuery;
3250
+ this.warmSession(opts?.sessionKey);
3251
+ startAsyncSearchSync({
3252
+ enabled: this.settings.sync.onSearch,
3253
+ dirty: this.dirty,
3254
+ sessionsDirty: this.sessionsDirty,
3255
+ sync: async (params) => await this.sync(params),
3256
+ onError: (err) => {
3257
+ log.warn(`memory sync failed (search): ${String(err)}`);
3258
+ }
3259
+ });
3260
+ if (preflight.shouldInitializeProvider) await this.ensureProviderInitialized();
3261
+ const minScore = opts?.minScore ?? this.settings.query.minScore;
3262
+ const maxResults = opts?.maxResults ?? this.settings.query.maxResults;
3263
+ const searchSources = opts?.sources && opts.sources.length > 0 ? uniqueValues(opts.sources).filter((s) => this.sources.has(s)) : void 0;
3264
+ if (opts?.sources && opts.sources.length > 0 && (!searchSources || searchSources.length === 0)) return [];
3265
+ const sourceFilterList = searchSources ?? [...this.sources];
3266
+ const hybrid = this.settings.query.hybrid;
3267
+ const candidates = Math.min(200, Math.max(1, Math.floor(maxResults * hybrid.candidateMultiplier)));
3268
+ if (!this.provider && this.providerLifecycle.mode === "degraded") {
3269
+ if (await this.activateFallbackProvider(this.providerLifecycle.reason).catch((fallbackErr) => {
3270
+ log.warn(`memory search: failed to activate fallback provider: ${formatErrorMessage(fallbackErr)}`);
3271
+ return false;
3272
+ })) await this.runSafeReindex({
3273
+ reason: "fallback",
3274
+ force: true
3275
+ });
3276
+ }
3277
+ if (!this.provider) {
3278
+ if (!this.fts.enabled || !this.fts.available) {
3279
+ log.warn("memory search: no provider and FTS unavailable");
3280
+ return [];
3281
+ }
3282
+ const fullQueryResults = await this.searchKeyword(cleaned, candidates, { boostFallbackRanking: true }, sourceFilterList).catch((err) => {
3283
+ log.warn(`memory search: FTS keyword query failed: ${formatErrorMessage(err)}`);
3284
+ return [];
3285
+ });
3286
+ const resultSets = fullQueryResults.length > 0 ? [fullQueryResults] : await Promise.all((() => {
3287
+ const keywords = extractKeywords(cleaned, { ftsTokenizer: this.settings.store.fts.tokenizer });
3288
+ return (keywords.length > 0 ? keywords : [cleaned]).map((term) => this.searchKeyword(term, candidates, { boostFallbackRanking: true }, sourceFilterList).catch((err) => {
3289
+ log.warn(`memory search: FTS per-keyword query failed for "${term}": ${formatErrorMessage(err)}`);
3290
+ return [];
3291
+ }));
3292
+ })());
3293
+ const seenIds = /* @__PURE__ */ new Map();
3294
+ for (const results of resultSets) for (const result of results) {
3295
+ const existing = seenIds.get(result.id);
3296
+ if (!existing || result.score > existing.score) seenIds.set(result.id, result);
3297
+ }
3298
+ const sorted = (await applyTemporalDecayToHybridResults({
3299
+ results: [...seenIds.values()],
3300
+ temporalDecay: hybrid.temporalDecay,
3301
+ workspaceDir: this.workspaceDir
3302
+ })).toSorted((a, b) => b.score - a.score);
3303
+ return this.selectScoredResults(sorted, maxResults, minScore, 0);
3304
+ }
3305
+ const loadKeywordResults = async () => hybrid.enabled && this.fts.enabled && this.fts.available ? await this.searchKeyword(cleaned, candidates, { boostFallbackRanking: true }, sourceFilterList).catch((err) => {
3306
+ log.warn(`memory search: FTS hybrid keyword query failed: ${formatErrorMessage(err)}`);
3307
+ return [];
3308
+ }) : [];
3309
+ let keywordResults = await loadKeywordResults();
3310
+ let queryVec;
3311
+ try {
3312
+ queryVec = await this.embedQueryWithTimeout(cleaned);
3313
+ } catch (err) {
3314
+ const message = formatErrorMessage(err);
3315
+ if (this.shouldFallbackOnError(err) ? await this.activateFallbackProvider(message).catch((fallbackErr) => {
3316
+ log.warn(`memory search: failed to activate fallback provider: ${formatErrorMessage(fallbackErr)}`);
3317
+ return false;
3318
+ }) : false) {
3319
+ await this.runSafeReindex({
3320
+ reason: "fallback",
3321
+ force: true
3322
+ });
3323
+ keywordResults = await loadKeywordResults();
3324
+ queryVec = await this.embedQueryWithTimeout(cleaned);
3325
+ } else if (!this.provider && this.fts.enabled && this.fts.available) {
3326
+ log.warn(`memory search: embeddings unavailable; using keyword-only results: ${message}`);
3327
+ return this.selectScoredResults(keywordResults, maxResults, minScore, 0);
3328
+ } else throw err;
3329
+ }
3330
+ const vectorResults = queryVec.some((v) => v !== 0) ? await this.searchVector(queryVec, candidates, sourceFilterList).catch((err) => {
3331
+ log.warn(`memory search: vector query failed: ${formatErrorMessage(err)}`);
3332
+ return [];
3333
+ }) : [];
3334
+ if (!hybrid.enabled || !this.fts.enabled || !this.fts.available) return vectorResults.filter((entry) => entry.score >= minScore).slice(0, maxResults);
3335
+ const merged = await this.mergeHybridResults({
3336
+ vector: vectorResults,
3337
+ keyword: keywordResults,
3338
+ vectorWeight: hybrid.vectorWeight,
3339
+ textWeight: hybrid.textWeight,
3340
+ mmr: hybrid.mmr,
3341
+ temporalDecay: hybrid.temporalDecay
3342
+ });
3343
+ const strict = merged.filter((entry) => entry.score >= minScore);
3344
+ if (strict.length > 0 || keywordResults.length === 0) return strict.slice(0, maxResults);
3345
+ const relaxedMinScore = 0;
3346
+ const keywordKeys = new Set(keywordResults.map((entry) => `${entry.source}:${entry.path}:${entry.startLine}:${entry.endLine}`));
3347
+ return this.selectScoredResults(merged.filter((entry) => keywordKeys.has(`${entry.source}:${entry.path}:${entry.startLine}:${entry.endLine}`)), maxResults, minScore, relaxedMinScore);
3348
+ }
3349
+ selectScoredResults(results, maxResults, minScore, relaxedMinScore = minScore) {
3350
+ const strict = results.filter((entry) => entry.score >= minScore);
3351
+ if (strict.length > 0) return strict.slice(0, maxResults);
3352
+ return results.filter((entry) => entry.score >= relaxedMinScore).slice(0, maxResults);
3353
+ }
3354
+ hasIndexedContent() {
3355
+ if (this.db.prepare(`SELECT 1 as found FROM chunks LIMIT 1`).get()?.found === 1) return true;
3356
+ if (!this.fts.enabled || !this.fts.available) return false;
3357
+ return this.db.prepare(`SELECT 1 as found FROM ${FTS_TABLE} LIMIT 1`).get()?.found === 1;
3358
+ }
3359
+ async searchVector(queryVec, limit, sourceFilterList) {
3360
+ if (!this.provider) return [];
3361
+ return (await searchVector({
3362
+ db: this.db,
3363
+ vectorTable: VECTOR_TABLE,
3364
+ providerModel: this.provider.model,
3365
+ queryVec,
3366
+ limit,
3367
+ snippetMaxChars: SNIPPET_MAX_CHARS,
3368
+ ensureVectorReady: async (dimensions) => await this.ensureVectorReady(dimensions),
3369
+ sourceFilterVec: this.buildSourceFilter("c", sourceFilterList),
3370
+ sourceFilterChunks: this.buildSourceFilter(void 0, sourceFilterList)
3371
+ })).map((entry) => entry);
3372
+ }
3373
+ buildFtsQuery(raw) {
3374
+ return buildFtsQuery(raw);
3375
+ }
3376
+ async searchKeyword(query, limit, options, sourceFilterList) {
3377
+ if (!this.fts.enabled || !this.fts.available) return [];
3378
+ const sourceFilter = this.buildSourceFilter(void 0, sourceFilterList);
3379
+ const providerModel = this.provider?.model;
3380
+ return (await searchKeyword({
3381
+ db: this.db,
3382
+ ftsTable: FTS_TABLE,
3383
+ providerModel,
3384
+ query,
3385
+ ftsTokenizer: this.settings.store.fts.tokenizer,
3386
+ limit,
3387
+ snippetMaxChars: SNIPPET_MAX_CHARS,
3388
+ sourceFilter,
3389
+ buildFtsQuery: (raw) => this.buildFtsQuery(raw),
3390
+ bm25RankToScore,
3391
+ boostFallbackRanking: options?.boostFallbackRanking
3392
+ })).map((entry) => entry);
3393
+ }
3394
+ mergeHybridResults(params) {
3395
+ return mergeHybridResults({
3396
+ vector: params.vector.map((r) => ({
3397
+ id: r.id,
3398
+ path: r.path,
3399
+ startLine: r.startLine,
3400
+ endLine: r.endLine,
3401
+ source: r.source,
3402
+ snippet: r.snippet,
3403
+ vectorScore: r.score
3404
+ })),
3405
+ keyword: params.keyword.map((r) => ({
3406
+ id: r.id,
3407
+ path: r.path,
3408
+ startLine: r.startLine,
3409
+ endLine: r.endLine,
3410
+ source: r.source,
3411
+ snippet: r.snippet,
3412
+ textScore: r.textScore
3413
+ })),
3414
+ vectorWeight: params.vectorWeight,
3415
+ textWeight: params.textWeight,
3416
+ mmr: params.mmr,
3417
+ temporalDecay: params.temporalDecay,
3418
+ workspaceDir: this.workspaceDir
3419
+ }).then((entries) => entries.map((entry) => entry));
3420
+ }
3421
+ async sync(params) {
3422
+ if (this.closed) return;
3423
+ if (this.syncing) {
3424
+ if (params?.sessionFiles?.some((sessionFile) => sessionFile.trim().length > 0)) return this.enqueueTargetedSessionSync(params.sessionFiles);
3425
+ return this.syncing;
3426
+ }
3427
+ this.syncing = (async () => {
3428
+ await this.ensureProviderInitialized();
3429
+ await this.runSyncWithReadonlyRecovery(params);
3430
+ })().finally(() => {
3431
+ this.syncing = null;
3432
+ });
3433
+ return this.syncing ?? Promise.resolve();
3434
+ }
3435
+ enqueueTargetedSessionSync(sessionFiles) {
3436
+ return enqueueMemoryTargetedSessionSync({
3437
+ isClosed: () => this.closed,
3438
+ getSyncing: () => this.syncing,
3439
+ getQueuedSessionFiles: () => this.queuedSessionFiles,
3440
+ getQueuedSessionSync: () => this.queuedSessionSync,
3441
+ setQueuedSessionSync: (value) => {
3442
+ this.queuedSessionSync = value;
3443
+ },
3444
+ sync: async (params) => await this.sync(params)
3445
+ }, sessionFiles);
3446
+ }
3447
+ async runSyncWithReadonlyRecovery(params) {
3448
+ const getClosed = () => this.closed;
3449
+ const getDb = () => this.db;
3450
+ const setDb = (value) => {
3451
+ this.db = value;
3452
+ };
3453
+ const getReadonlyRecoveryAttempts = () => this.readonlyRecoveryAttempts;
3454
+ const setReadonlyRecoveryAttempts = (value) => {
3455
+ this.readonlyRecoveryAttempts = value;
3456
+ };
3457
+ const getReadonlyRecoverySuccesses = () => this.readonlyRecoverySuccesses;
3458
+ const setReadonlyRecoverySuccesses = (value) => {
3459
+ this.readonlyRecoverySuccesses = value;
3460
+ };
3461
+ const getReadonlyRecoveryFailures = () => this.readonlyRecoveryFailures;
3462
+ const setReadonlyRecoveryFailures = (value) => {
3463
+ this.readonlyRecoveryFailures = value;
3464
+ };
3465
+ const getReadonlyRecoveryLastError = () => this.readonlyRecoveryLastError;
3466
+ const setReadonlyRecoveryLastError = (value) => {
3467
+ this.readonlyRecoveryLastError = value;
3468
+ };
3469
+ await runMemorySyncWithReadonlyRecovery({
3470
+ get closed() {
3471
+ return getClosed();
3472
+ },
3473
+ get db() {
3474
+ return getDb();
3475
+ },
3476
+ set db(value) {
3477
+ setDb(value);
3478
+ },
3479
+ vector: this.vector,
3480
+ get readonlyRecoveryAttempts() {
3481
+ return getReadonlyRecoveryAttempts();
3482
+ },
3483
+ set readonlyRecoveryAttempts(value) {
3484
+ setReadonlyRecoveryAttempts(value);
3485
+ },
3486
+ get readonlyRecoverySuccesses() {
3487
+ return getReadonlyRecoverySuccesses();
3488
+ },
3489
+ set readonlyRecoverySuccesses(value) {
3490
+ setReadonlyRecoverySuccesses(value);
3491
+ },
3492
+ get readonlyRecoveryFailures() {
3493
+ return getReadonlyRecoveryFailures();
3494
+ },
3495
+ set readonlyRecoveryFailures(value) {
3496
+ setReadonlyRecoveryFailures(value);
3497
+ },
3498
+ get readonlyRecoveryLastError() {
3499
+ return getReadonlyRecoveryLastError();
3500
+ },
3501
+ set readonlyRecoveryLastError(value) {
3502
+ setReadonlyRecoveryLastError(value);
3503
+ },
3504
+ runSync: (nextParams) => this.runSync(nextParams),
3505
+ openDatabase: () => this.openDatabase(),
3506
+ closeDatabase: (db) => closeMemoryDatabase(db),
3507
+ resetVectorState: () => this.resetVectorState(),
3508
+ ensureSchema: () => this.ensureSchema(),
3509
+ readMeta: () => this.readMeta() ?? void 0
3510
+ }, params);
3511
+ }
3512
+ async readFile(params) {
3513
+ return await readMemoryFile({
3514
+ workspaceDir: this.workspaceDir,
3515
+ extraPaths: this.settings.extraPaths,
3516
+ relPath: params.relPath,
3517
+ from: params.from,
3518
+ lines: params.lines
3519
+ });
3520
+ }
3521
+ status() {
3522
+ const sourceFilter = this.buildSourceFilter();
3523
+ const aggregateState = collectMemoryStatusAggregate({
3524
+ db: { prepare: (sql) => ({ all: (...args) => this.db.prepare(sql).all(...args) }) },
3525
+ sources: this.sources,
3526
+ sourceFilterSql: sourceFilter.sql,
3527
+ sourceFilterParams: sourceFilter.params
3528
+ });
3529
+ const providerInfo = resolveStatusProviderInfo({
3530
+ provider: this.provider,
3531
+ providerInitialized: this.providerInitialized,
3532
+ requestedProvider: this.requestedProvider,
3533
+ configuredModel: this.settings.model || void 0
3534
+ });
3535
+ return {
3536
+ backend: "builtin",
3537
+ files: aggregateState.files,
3538
+ chunks: aggregateState.chunks,
3539
+ dirty: this.dirty || this.sessionsDirty,
3540
+ workspaceDir: this.workspaceDir,
3541
+ dbPath: this.settings.store.path,
3542
+ provider: providerInfo.provider,
3543
+ model: providerInfo.model,
3544
+ requestedProvider: this.requestedProvider,
3545
+ sources: Array.from(this.sources),
3546
+ extraPaths: this.settings.extraPaths,
3547
+ sourceCounts: aggregateState.sourceCounts,
3548
+ cache: this.cache.enabled ? {
3549
+ enabled: true,
3550
+ entries: this.db.prepare(`SELECT COUNT(*) as c FROM ${EMBEDDING_CACHE_TABLE}`).get()?.c ?? 0,
3551
+ maxEntries: this.cache.maxEntries
3552
+ } : {
3553
+ enabled: false,
3554
+ maxEntries: this.cache.maxEntries
3555
+ },
3556
+ fts: {
3557
+ enabled: this.fts.enabled,
3558
+ available: this.fts.available,
3559
+ error: this.fts.loadError
3560
+ },
3561
+ fallback: this.fallbackReason ? {
3562
+ from: this.fallbackFrom ?? "local",
3563
+ reason: this.fallbackReason
3564
+ } : void 0,
3565
+ vector: {
3566
+ enabled: this.vector.enabled,
3567
+ storeAvailable: this.vector.available ?? void 0,
3568
+ semanticAvailable: this.vector.semanticAvailable,
3569
+ available: this.vector.semanticAvailable,
3570
+ extensionPath: this.vector.extensionPath,
3571
+ loadError: this.vector.loadError,
3572
+ dims: this.vector.dims
3573
+ },
3574
+ batch: {
3575
+ enabled: this.batch.enabled,
3576
+ failures: this.batchFailureCount,
3577
+ limit: 2,
3578
+ wait: this.batch.wait,
3579
+ concurrency: this.batch.concurrency,
3580
+ pollIntervalMs: this.batch.pollIntervalMs,
3581
+ timeoutMs: this.batch.timeoutMs,
3582
+ lastError: this.batchFailureLastError,
3583
+ lastProvider: this.batchFailureLastProvider
3584
+ },
3585
+ custom: {
3586
+ searchMode: providerInfo.searchMode,
3587
+ providerState: this.providerLifecycle,
3588
+ providerUnavailableReason: this.providerUnavailableReason,
3589
+ readonlyRecovery: {
3590
+ attempts: this.readonlyRecoveryAttempts,
3591
+ successes: this.readonlyRecoverySuccesses,
3592
+ failures: this.readonlyRecoveryFailures,
3593
+ lastError: this.readonlyRecoveryLastError
3594
+ }
3595
+ }
3596
+ };
3597
+ }
3598
+ async probeVectorAvailability() {
3599
+ if (!this.vector.enabled) {
3600
+ this.vector.semanticAvailable = false;
3601
+ return false;
3602
+ }
3603
+ await this.ensureProviderInitialized();
3604
+ if (!this.provider) {
3605
+ this.vector.semanticAvailable = false;
3606
+ return false;
3607
+ }
3608
+ const ready = await this.probeVectorStoreAvailability();
3609
+ this.vector.semanticAvailable = ready;
3610
+ return ready;
3611
+ }
3612
+ async probeVectorStoreAvailability() {
3613
+ if (!this.vector.enabled) {
3614
+ this.vector.available = false;
3615
+ return false;
3616
+ }
3617
+ return await this.ensureVectorReady();
3618
+ }
3619
+ cacheProbeResult(result) {
3620
+ const checkedAtMs = Date.now();
3621
+ EMBEDDING_PROBE_CACHE.set(this.cacheKey, {
3622
+ result,
3623
+ checkedAtMs,
3624
+ expireAtMs: checkedAtMs + EMBEDDING_PROBE_CACHE_TTL_MS
3625
+ });
3626
+ return result;
3627
+ }
3628
+ getCachedEmbeddingAvailability() {
3629
+ const cached = EMBEDDING_PROBE_CACHE.get(this.cacheKey);
3630
+ if (!cached) return null;
3631
+ if (Date.now() >= cached.expireAtMs) {
3632
+ EMBEDDING_PROBE_CACHE.delete(this.cacheKey);
3633
+ return null;
3634
+ }
3635
+ return {
3636
+ ...cached.result,
3637
+ checked: true,
3638
+ cached: true,
3639
+ checkedAtMs: cached.checkedAtMs,
3640
+ cacheExpiresAtMs: cached.expireAtMs
3641
+ };
3642
+ }
3643
+ async probeEmbeddingAvailability() {
3644
+ const cached = this.getCachedEmbeddingAvailability();
3645
+ if (cached) return cached;
3646
+ await this.ensureProviderInitialized();
3647
+ if (!this.provider) return this.cacheProbeResult({
3648
+ ok: false,
3649
+ error: this.providerUnavailableReason ?? "No embedding provider available (FTS-only mode)"
3650
+ });
3651
+ try {
3652
+ await this.embedBatchWithRetry(["ping"]);
3653
+ return this.cacheProbeResult({ ok: true });
3654
+ } catch (err) {
3655
+ const message = formatErrorMessage(err);
3656
+ return this.cacheProbeResult({
3657
+ ok: false,
3658
+ error: message
3659
+ });
3660
+ }
3661
+ }
3662
+ async close() {
3663
+ if (this.closed) return;
3664
+ this.closed = true;
3665
+ const pendingProviderInit = this.providerInitPromise;
3666
+ if (this.watchTimer) {
3667
+ clearTimeout(this.watchTimer);
3668
+ this.watchTimer = null;
3669
+ }
3670
+ if (this.sessionWatchTimer) {
3671
+ clearTimeout(this.sessionWatchTimer);
3672
+ this.sessionWatchTimer = null;
3673
+ }
3674
+ if (this.intervalTimer) {
3675
+ clearInterval(this.intervalTimer);
3676
+ this.intervalTimer = null;
3677
+ }
3678
+ if (this.watcher) {
3679
+ await this.watcher.close();
3680
+ this.watcher = null;
3681
+ }
3682
+ this.closeNativeMemoryWatchPairs();
3683
+ if (this.sessionUnsubscribe) {
3684
+ this.sessionUnsubscribe();
3685
+ this.sessionUnsubscribe = null;
3686
+ }
3687
+ const closeErrors = /* @__PURE__ */ new Map();
3688
+ const providersToClose = /* @__PURE__ */ new Set();
3689
+ const rememberCurrentProvider = () => {
3690
+ const provider = this.provider;
3691
+ if (!provider) return;
3692
+ providersToClose.add(provider);
3693
+ };
3694
+ const closeProvider = async (provider) => {
3695
+ try {
3696
+ await provider.close?.();
3697
+ closeErrors.delete(provider);
3698
+ if (this.provider === provider) this.provider = null;
3699
+ } catch (err) {
3700
+ closeErrors.set(provider, err);
3701
+ providersToClose.add(provider);
3702
+ } finally {
3703
+ rememberCurrentProvider();
3704
+ }
3705
+ };
3706
+ const drainTrackedProviders = async () => {
3707
+ for (let attempt = 0; attempt < 2 && providersToClose.size > 0; attempt += 1) {
3708
+ const providers = Array.from(providersToClose);
3709
+ providersToClose.clear();
3710
+ try {
3711
+ for (const provider of providers) await closeProvider(provider);
3712
+ } finally {
3713
+ rememberCurrentProvider();
3714
+ }
3715
+ }
3716
+ };
3717
+ const awaitCurrentSync = async () => {
3718
+ const pendingSync = this.syncing;
3719
+ if (!pendingSync) return;
3720
+ await awaitPendingManagerWork({ pendingSync });
3721
+ };
3722
+ await awaitPendingManagerWork({ pendingProviderInit });
3723
+ rememberCurrentProvider();
3724
+ try {
3725
+ await awaitCurrentSync();
3726
+ rememberCurrentProvider();
3727
+ await drainTrackedProviders();
3728
+ } finally {
3729
+ closeMemoryDatabase(this.db);
3730
+ if (INDEX_CACHE.get(this.cacheKey) === this) INDEX_CACHE.delete(this.cacheKey);
3731
+ }
3732
+ const closeError = closeErrors.values().next().value;
3733
+ if (closeError) throw closeError;
3734
+ }
3735
+ };
3736
+ //#endregion
3737
+ export { createEmbeddingProvider as a, formatMemoryVectorDegradedWriteReason as i, closeAllMemoryIndexManagers as n, closeMemoryIndexManagersForAgent as r, MemoryIndexManager as t };