@xopcai/xopc 0.0.284 → 0.0.286

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 (996) hide show
  1. package/dist/browser-ext/dist/assets/{auth-DB30ywek.js → auth-BXCWrPlg.js} +1 -1
  2. package/dist/browser-ext/dist/background.js +2 -2
  3. package/dist/browser-ext/dist/sidepanel.html +1 -1
  4. package/dist/browser-ext/dist/sidepanel.js +136 -136
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/feishu/src/adapters/gateway-setup.js +14 -14
  7. package/dist/extensions/feishu/src/state/message-bindings.d.ts +1 -1
  8. package/dist/extensions/feishu/src/state/thread-bindings.d.ts +4 -4
  9. package/dist/extensions/feishu/src/state/thread-bindings.js +6 -6
  10. package/dist/extensions/feishu/src/subagent-hooks.d.ts +1 -1
  11. package/dist/extensions/feishu/src/subagent-hooks.js +5 -5
  12. package/dist/extensions/feishu/src/transport/socket-mode/monitor.js +9 -9
  13. package/dist/extensions/feishu/src/transport/webhook/monitor.js +4 -4
  14. package/dist/extensions/feishu/src/workflow-progress.d.ts +1 -1
  15. package/dist/extensions/feishu/src/workflow-progress.js +8 -7
  16. package/dist/extensions/telegram/src/approval-store.d.ts +2 -2
  17. package/dist/extensions/telegram/src/approval-store.js +1 -1
  18. package/dist/extensions/telegram/src/command-handler.d.ts +2 -2
  19. package/dist/extensions/telegram/src/command-handler.js +8 -8
  20. package/dist/extensions/telegram/src/delivery-chat-id.d.ts +1 -1
  21. package/dist/extensions/telegram/src/delivery-chat-id.js +7 -3
  22. package/dist/extensions/telegram/src/exec-approval-handler.js +1 -1
  23. package/dist/extensions/telegram/src/focus-handler.d.ts +2 -2
  24. package/dist/extensions/telegram/src/focus-handler.js +10 -10
  25. package/dist/extensions/telegram/src/inbound-processor.d.ts +3 -3
  26. package/dist/extensions/telegram/src/inbound-processor.js +11 -11
  27. package/dist/extensions/telegram/src/plugin.js +5 -5
  28. package/dist/extensions/telegram/src/routing-integration.d.ts +1 -1
  29. package/dist/extensions/telegram/src/routing-integration.js +19 -21
  30. package/dist/extensions/telegram/src/thread-bindings.d.ts +1 -1
  31. package/dist/extensions/telegram/src/workflow-progress.js +8 -7
  32. package/dist/extensions/telegram/xopc.extension.json +1 -1
  33. package/dist/extensions/weixin/src/auth/login-qr.d.ts +4 -4
  34. package/dist/extensions/weixin/src/auth/login-qr.js +21 -21
  35. package/dist/extensions/weixin/src/auth/weixin-account-id.d.ts +1 -1
  36. package/dist/extensions/weixin/src/auth/weixin-account-id.js +1 -1
  37. package/dist/extensions/weixin/src/cli/gateway-qr-login.d.ts +2 -2
  38. package/dist/extensions/weixin/src/cli/gateway-qr-login.js +13 -13
  39. package/dist/extensions/weixin/src/cli/qr-login.js +1 -1
  40. package/dist/extensions/weixin/src/delivery-to.js +6 -2
  41. package/dist/extensions/weixin/src/messaging/inbound.d.ts +1 -1
  42. package/dist/extensions/weixin/src/messaging/inbound.js +1 -1
  43. package/dist/extensions/weixin/src/messaging/process-message.js +3 -3
  44. package/dist/extensions/weixin/src/plugin.js +5 -5
  45. package/dist/extensions/weixin/src/routing-integration.d.ts +1 -1
  46. package/dist/extensions/weixin/src/routing-integration.js +3 -3
  47. package/dist/extensions/weixin/src/workflow-progress.d.ts +1 -1
  48. package/dist/extensions/weixin/src/workflow-progress.js +7 -6
  49. package/dist/gateway/static/root/assets/{activity-store-CwbIMGLY.js → activity-store-xOhV8FHx.js} +1 -1
  50. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DjiOld-S.js → agent-avatar-dicebear-BzQbYWEj.js} +1 -1
  51. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BxR5eog4.js +1 -0
  52. package/dist/gateway/static/root/assets/agents-Dx1om1eN.js +1 -0
  53. package/dist/gateway/static/root/assets/{api-3lphBVuY.js → api-CVJQLBv9.js} +1 -1
  54. package/dist/gateway/static/root/assets/api-q1kIMCLW.js +1 -0
  55. package/dist/gateway/static/root/assets/{app-management-settings-panel-B2nwCXxE.js → app-management-settings-panel-CTyuXkNC.js} +1 -1
  56. package/dist/gateway/static/root/assets/{appearance-settings-BXO4Ej88.js → appearance-settings-Tk-GJtvF.js} +1 -1
  57. package/dist/gateway/static/root/assets/apps-page-BA-7OrhJ.js +1 -0
  58. package/dist/gateway/static/root/assets/{archive-plugin-6ZRqNjla.js → archive-plugin-O49jeeXo.js} +1 -1
  59. package/dist/gateway/static/root/assets/{attachment-load-CmPZalcW.js → attachment-load-r9lBF2tW.js} +1 -1
  60. package/dist/gateway/static/root/assets/{automations-page-Bc3WbK5n.js → automations-page-CFFLXYgS.js} +1 -1
  61. package/dist/gateway/static/root/assets/automations-workspace-DUZE1NOH.js +6 -0
  62. package/dist/gateway/static/root/assets/{binary-plugins-OWR6cxpc.js → binary-plugins-BpM43vsn.js} +1 -1
  63. package/dist/gateway/static/root/assets/{block-editor-Ca-tDQXm.js → block-editor-DFrfEcGw.js} +3 -3
  64. package/dist/gateway/static/root/assets/{browser-automation-inputs-Dxy2_p3U.js → browser-automation-inputs-CyHGQwxQ.js} +1 -1
  65. package/dist/gateway/static/root/assets/{browser-automations-page-CibQIxpi.js → browser-automations-page-CPkOWfM9.js} +2 -2
  66. package/dist/gateway/static/root/assets/browser-settings-page-BOcseZxg.js +8 -0
  67. package/dist/gateway/static/root/assets/button-CGlRPNzi.js +1 -0
  68. package/dist/gateway/static/root/assets/capabilities-settings-panel-ohEV64hG.js +8 -0
  69. package/dist/gateway/static/root/assets/channels-settings-UOf9mgqt.js +1 -0
  70. package/dist/gateway/static/root/assets/{channels-status-swr-Bh-G9mdZ.js → channels-status-swr-BArPeImO.js} +1 -1
  71. package/dist/gateway/static/root/assets/{chat-terminal-dock-lbzbSpV3.js → chat-terminal-dock-D5Aka4S8.js} +2 -2
  72. package/dist/gateway/static/root/assets/connectors-page-BEQR0NRq.js +2 -0
  73. package/dist/gateway/static/root/assets/{cron-expression-CjrWuy2m.js → cron-expression-GDPX4NxC.js} +1 -1
  74. package/dist/gateway/static/root/assets/{date-picker-tYvbTfZT.js → date-picker-DNtRu6EB.js} +1 -1
  75. package/dist/gateway/static/root/assets/{dependency-picker-B8yo7-7V.js → dependency-picker-Dng3dIQa.js} +1 -1
  76. package/dist/gateway/static/root/assets/desktop-pet-BicYycxy.js +1 -0
  77. package/dist/gateway/static/root/assets/{desktop-pet-settings-DNeVGZNp.js → desktop-pet-settings-BEse55eX.js} +1 -1
  78. package/dist/gateway/static/root/assets/device-pairing-wizard-be30HuFI.js +1 -0
  79. package/dist/gateway/static/root/assets/{extension-debug-page-CiK0QI2p.js → extension-debug-page-YzhYyuay.js} +1 -1
  80. package/dist/gateway/static/root/assets/{extension-page-CirPNHJd.js → extension-page-CEXVIkDl.js} +1 -1
  81. package/dist/gateway/static/root/assets/extension-settings-page-CrlbgK8g.js +1 -0
  82. package/dist/gateway/static/root/assets/{gateway-config-swr-Co4hHe0i.js → gateway-config-swr-BNuoHXiZ.js} +1 -1
  83. package/dist/gateway/static/root/assets/gateway-settings-CDJY1AOW.js +1 -0
  84. package/dist/gateway/static/root/assets/{gateway-startup-retry-DBPNJG-e.js → gateway-startup-retry-zMPfje0n.js} +1 -1
  85. package/dist/gateway/static/root/assets/heartbeat-settings-BtxitqZ3.js +1 -0
  86. package/dist/gateway/static/root/assets/home-page-_oqo0pNR.js +1 -0
  87. package/dist/gateway/static/root/assets/{image-generation-api-D0rMTumD.js → image-generation-api-B_Tyx74A.js} +1 -1
  88. package/dist/gateway/static/root/assets/imports-page-eZciuLw_.js +1 -0
  89. package/dist/gateway/static/root/assets/index--YC42LAz.css +2 -0
  90. package/dist/gateway/static/root/assets/index-fVtuw2o9.js +75 -0
  91. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CMUaF61L.js → keyboard-shortcuts-settings-B796W039.js} +1 -1
  92. package/dist/gateway/static/root/assets/local-app-workbench-page-Z8mpau9d.js +2 -0
  93. package/dist/gateway/static/root/assets/{local-apps-page-CHxyT09t.js → local-apps-page-DXmY5jwM.js} +1 -1
  94. package/dist/gateway/static/root/assets/locale-store-D0001I7p.js +1 -0
  95. package/dist/gateway/static/root/assets/logs-page-BGOO8ouT.js +2 -0
  96. package/dist/gateway/static/root/assets/{management-settings-jXbA2S54.js → management-settings-b1MG7s-3.js} +1 -1
  97. package/dist/gateway/static/root/assets/{markdown-view-CKInRsDh.js → markdown-view-2txE_Blz.js} +1 -1
  98. package/dist/gateway/static/root/assets/{media-plugins-BaPkSvW7.js → media-plugins-CDEf3ksI.js} +1 -1
  99. package/dist/gateway/static/root/assets/messages-BWANv-N-.js +3 -0
  100. package/dist/gateway/static/root/assets/note-detail-panel-Bm33_3xJ.js +5 -0
  101. package/dist/gateway/static/root/assets/notes-page-C32-xssK.js +8 -0
  102. package/dist/gateway/static/root/assets/page-tabs-Bi_-DA5J.js +1 -0
  103. package/dist/gateway/static/root/assets/popover-select-DldSX8GX.js +1 -0
  104. package/dist/gateway/static/root/assets/{preview-open-alternatives-DzgF1yYO.js → preview-open-alternatives-Dhfdf14p.js} +1 -1
  105. package/dist/gateway/static/root/assets/proactive-page-BNouL7Tv.js +1 -0
  106. package/dist/gateway/static/root/assets/{product-open-page-iQ-eW6Aj.js → product-open-page-BkbZBqBr.js} +1 -1
  107. package/dist/gateway/static/root/assets/project-detail-page-CZ7glGYw.js +1 -0
  108. package/dist/gateway/static/root/assets/projects-page-DP3ZINZz.js +1 -0
  109. package/dist/gateway/static/root/assets/{registry-api-DMNudT60.js → registry-api-icwoEKYB.js} +1 -1
  110. package/dist/gateway/static/root/assets/remote-access-hub-xqJcPdOO.js +1 -0
  111. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-u_wVepf7.js → runtime-tools-settings-panel-bmgxwWpW.js} +2 -2
  112. package/dist/gateway/static/root/assets/{schema-form-YdZj2xdI.js → schema-form-DoZeepCg.js} +1 -1
  113. package/dist/gateway/static/root/assets/sessions-page-BaxIfjpm.js +1 -0
  114. package/dist/gateway/static/root/assets/settings-advanced-gate-Cy3Ab3Vg.js +1 -0
  115. package/dist/gateway/static/root/assets/settings-form-section-sw2bbS2b.js +1 -0
  116. package/dist/gateway/static/root/assets/{settings-page-CV8kVdnE.js → settings-page-BWF8uac0.js} +1 -1
  117. package/dist/gateway/static/root/assets/settings-page-layout-CsUQKRq0.js +1 -0
  118. package/dist/gateway/static/root/assets/setup-status-panel-BuYto2mT.js +1 -0
  119. package/dist/gateway/static/root/assets/{share-preview-page-BHwjHlrV.js → share-preview-page-BIHYD6-O.js} +1 -1
  120. package/dist/gateway/static/root/assets/shares-settings-DKtWUneq.js +1 -0
  121. package/dist/gateway/static/root/assets/skill-reload-api-Dn7ElMUk.js +1 -0
  122. package/dist/gateway/static/root/assets/{skills-page-DRKdb6O5.js → skills-page-D-7UtJIc.js} +1 -1
  123. package/dist/gateway/static/root/assets/{skills-page.utils-DYfaLtts.js → skills-page.utils-dvue6Ish.js} +1 -1
  124. package/dist/gateway/static/root/assets/{system-settings-panel-CWrWpKV-.js → system-settings-panel-DCyxPWCl.js} +1 -1
  125. package/dist/gateway/static/root/assets/task-detail-page-efmH43Pq.js +1 -0
  126. package/dist/gateway/static/root/assets/{theme-store-CDc7Wqy5.js → theme-store-CZwYGpbY.js} +1 -1
  127. package/dist/gateway/static/root/assets/tunnel-api-__auf8Ww.js +1 -0
  128. package/dist/gateway/static/root/assets/{use-autosave-D-FRib85.js → use-autosave-Iq83UDt3.js} +1 -1
  129. package/dist/gateway/static/root/assets/user-model-page-DByIJcQq.js +2 -0
  130. package/dist/gateway/static/root/assets/{voice-api-key-field-iQ7EBzII.js → voice-api-key-field-D-QssKik.js} +1 -1
  131. package/dist/gateway/static/root/assets/{voice-config-api-DNMWA2tx.js → voice-config-api-B0wNN_tE.js} +1 -1
  132. package/dist/gateway/static/root/assets/{work-discovery-overlay-BesuhDlH.js → work-discovery-overlay-5NRYg1iI.js} +1 -1
  133. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Du81FoCy.js → workflow-run-setup-panel-Ds2SZjLG.js} +2 -2
  134. package/dist/gateway/static/root/assets/workflows-page-BJv3eoKR.js +6 -0
  135. package/dist/gateway/static/root/index.html +12 -12
  136. package/dist/package.js +1 -1
  137. package/dist/packages/endpoint-tools-protocol/src/index.js +312 -305
  138. package/dist/packages/gateway-contract/src/agent-stream.js +6 -0
  139. package/dist/packages/gateway-contract/src/automations.js +215 -0
  140. package/dist/packages/gateway-contract/src/browser-page-context.js +48 -39
  141. package/dist/packages/gateway-contract/src/browser-tab-binding.js +30 -25
  142. package/dist/packages/gateway-contract/src/clarifications.js +6 -0
  143. package/dist/packages/gateway-contract/src/connection-waits.js +6 -0
  144. package/dist/packages/gateway-contract/src/conversation-identity.js +17 -0
  145. package/dist/packages/gateway-contract/src/device-pairing.js +84 -78
  146. package/dist/packages/gateway-contract/src/discussions.js +19 -15
  147. package/dist/packages/gateway-contract/src/files.js +55 -0
  148. package/dist/packages/gateway-contract/src/home.js +188 -0
  149. package/dist/packages/gateway-contract/src/index.js +65 -0
  150. package/dist/packages/gateway-contract/src/mobile-privacy.js +26 -0
  151. package/dist/packages/gateway-contract/src/model-selection.js +4 -1
  152. package/dist/packages/gateway-contract/src/new-session.js +5 -1
  153. package/dist/packages/gateway-contract/src/notifications.js +64 -59
  154. package/dist/packages/gateway-contract/src/proactive.js +133 -119
  155. package/dist/packages/gateway-contract/src/product-delivery.js +56 -50
  156. package/dist/packages/gateway-contract/src/project-monitoring.js +33 -28
  157. package/dist/packages/gateway-contract/src/project-operating.js +100 -0
  158. package/dist/packages/gateway-contract/src/session-identity.js +38 -34
  159. package/dist/packages/gateway-contract/src/session-input-reliability.js +6 -0
  160. package/dist/packages/gateway-contract/src/sessions.js +145 -0
  161. package/dist/packages/gateway-contract/src/task-lifecycle.js +69 -64
  162. package/dist/packages/gateway-contract/src/task-runs.js +80 -75
  163. package/dist/packages/gateway-contract/src/tasks.js +445 -438
  164. package/dist/packages/gateway-contract/src/tool-activity.js +154 -149
  165. package/dist/packages/gateway-contract/src/turn-outcome.js +118 -112
  166. package/dist/packages/gateway-contract/src/user-message-display.js +13 -8
  167. package/dist/packages/gateway-contract/src/welcome-suggestions.js +6 -0
  168. package/dist/packages/realtime-client/src/index.js +1 -1
  169. package/dist/packages/realtime-protocol/src/index.js +4 -2
  170. package/dist/packages/realtime-protocol/src/voice.js +4 -4
  171. package/dist/src/activity/types.d.ts +1 -1
  172. package/dist/src/agent/agent-instance-gateway.d.ts +18 -18
  173. package/dist/src/agent/agent-manager.d.ts +27 -27
  174. package/dist/src/agent/agent-manager.js +180 -179
  175. package/dist/src/agent/background-review/coordinator.d.ts +3 -3
  176. package/dist/src/agent/background-review/coordinator.js +10 -10
  177. package/dist/src/agent/background-review/run-background-review.d.ts +1 -1
  178. package/dist/src/agent/background-review/run-background-review.js +14 -14
  179. package/dist/src/agent/bootstrap/bootstrap-cache.d.ts +4 -4
  180. package/dist/src/agent/bootstrap/bootstrap-cache.js +9 -9
  181. package/dist/src/agent/bootstrap/bootstrap-files.d.ts +4 -4
  182. package/dist/src/agent/bootstrap/bootstrap-files.js +9 -9
  183. package/dist/src/agent/bootstrap/filter-bootstrap-files.d.ts +1 -1
  184. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +3 -3
  185. package/dist/src/agent/child-agent-factory.d.ts +3 -3
  186. package/dist/src/agent/child-agent-factory.js +5 -5
  187. package/dist/src/agent/coding/repository-instructions.js +1 -1
  188. package/dist/src/agent/coding/workspace-revision.js +1 -1
  189. package/dist/src/agent/commands/command-isolation.js +1 -1
  190. package/dist/src/agent/commands/command-registry.js +2 -1
  191. package/dist/src/agent/context/audit.d.ts +2 -2
  192. package/dist/src/agent/context/audit.js +5 -4
  193. package/dist/src/agent/context/coordinator.d.ts +6 -6
  194. package/dist/src/agent/context/coordinator.js +13 -13
  195. package/dist/src/agent/context/execution-context.js +4 -3
  196. package/dist/src/agent/context/execution-scope.d.ts +3 -3
  197. package/dist/src/agent/context/execution-scope.js +13 -13
  198. package/dist/src/agent/context/project-context.d.ts +1 -1
  199. package/dist/src/agent/context/project-context.js +4 -4
  200. package/dist/src/agent/embedded/execution-context.d.ts +1 -1
  201. package/dist/src/agent/embedded/execution-context.js +3 -3
  202. package/dist/src/agent/embedded/index.d.ts +1 -1
  203. package/dist/src/agent/embedded/index.js +2 -2
  204. package/dist/src/agent/embedded/run-for-session.d.ts +1 -1
  205. package/dist/src/agent/embedded/run-for-session.js +78 -104
  206. package/dist/src/agent/embedded/run-turn.js +77 -33
  207. package/dist/src/agent/embedded/runs.d.ts +11 -11
  208. package/dist/src/agent/embedded/runs.js +22 -22
  209. package/dist/src/agent/embedded/session-runner.d.ts +2 -2
  210. package/dist/src/agent/embedded/session-runner.js +5 -5
  211. package/dist/src/agent/embedded/session-tool-result-guard.d.ts +2 -2
  212. package/dist/src/agent/embedded/session-tool-result-guard.js +8 -8
  213. package/dist/src/agent/embedded/sqlite-hydrating-session-manager.d.ts +2 -2
  214. package/dist/src/agent/embedded/sqlite-hydrating-session-manager.js +4 -4
  215. package/dist/src/agent/embedded/transcript-runtime.d.ts +4 -3
  216. package/dist/src/agent/embedded/transcript-runtime.js +33 -20
  217. package/dist/src/agent/embedded/types.d.ts +2 -1
  218. package/dist/src/agent/external-tools/composio-provider.d.ts +1 -1
  219. package/dist/src/agent/external-tools/composio-provider.js +12 -11
  220. package/dist/src/agent/external-tools/endpoint-provider.js +1 -1
  221. package/dist/src/agent/external-tools/extension-provider.d.ts +1 -1
  222. package/dist/src/agent/external-tools/extension-provider.js +1 -1
  223. package/dist/src/agent/external-tools/gateway-tools.js +9 -8
  224. package/dist/src/agent/external-tools/index.js +3 -3
  225. package/dist/src/agent/external-tools/mcp-provider.d.ts +2 -2
  226. package/dist/src/agent/external-tools/mcp-provider.js +8 -8
  227. package/dist/src/agent/external-tools/memory-provider.d.ts +1 -1
  228. package/dist/src/agent/external-tools/memory-provider.js +1 -1
  229. package/dist/src/agent/external-tools/types.d.ts +1 -1
  230. package/dist/src/agent/inbound/attachment-pipeline.d.ts +7 -7
  231. package/dist/src/agent/inbound/attachment-pipeline.js +22 -21
  232. package/dist/src/agent/inbound/inbound-loop.d.ts +6 -6
  233. package/dist/src/agent/inbound/inbound-loop.js +23 -23
  234. package/dist/src/agent/inbound/turn-dispatcher.d.ts +14 -14
  235. package/dist/src/agent/inbound/turn-dispatcher.js +16 -16
  236. package/dist/src/agent/ipc/bus.d.ts +1 -1
  237. package/dist/src/agent/ipc/types.d.ts +3 -3
  238. package/dist/src/agent/ipc/types.js +1 -1
  239. package/dist/src/agent/lifecycle/hook-handler.d.ts +2 -2
  240. package/dist/src/agent/lifecycle/hook-handler.js +6 -6
  241. package/dist/src/agent/lifecycle/manager.d.ts +1 -1
  242. package/dist/src/agent/lifecycle/manager.js +4 -4
  243. package/dist/src/agent/lifecycle/types.d.ts +1 -1
  244. package/dist/src/agent/mcp/bundle-mcp-runtime.d.ts +4 -4
  245. package/dist/src/agent/mcp/bundle-mcp-runtime.js +21 -20
  246. package/dist/src/agent/mcp/bundle-mcp-tools.d.ts +1 -1
  247. package/dist/src/agent/mcp/bundle-mcp-tools.js +2 -2
  248. package/dist/src/agent/mcp/bundle-mcp-types.d.ts +4 -4
  249. package/dist/src/agent/mcp/index.js +2 -2
  250. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +9 -8
  251. package/dist/src/agent/memory/compaction-ledger.js +9 -2
  252. package/dist/src/agent/memory/compaction-promotion.d.ts +2 -2
  253. package/dist/src/agent/memory/compaction-promotion.js +6 -6
  254. package/dist/src/agent/memory/compaction-source-planner.d.ts +2 -0
  255. package/dist/src/agent/memory/compaction-source-planner.js +9 -1
  256. package/dist/src/agent/memory/compaction.d.ts +6 -1
  257. package/dist/src/agent/memory/compaction.js +22 -11
  258. package/dist/src/agent/memory/context-recovery.d.ts +44 -0
  259. package/dist/src/agent/memory/context-recovery.js +96 -0
  260. package/dist/src/agent/memory/manager.js +11 -11
  261. package/dist/src/agent/memory/turn-provenance.d.ts +5 -5
  262. package/dist/src/agent/memory/turn-provenance.js +21 -17
  263. package/dist/src/agent/memory/types.d.ts +2 -2
  264. package/dist/src/agent/messaging/command-handler.d.ts +11 -11
  265. package/dist/src/agent/messaging/command-handler.js +7 -7
  266. package/dist/src/agent/messaging/message-router.d.ts +1 -1
  267. package/dist/src/agent/messaging/message-router.js +4 -4
  268. package/dist/src/agent/messaging/outbound-coordinator.d.ts +2 -2
  269. package/dist/src/agent/messaging/outbound-coordinator.js +4 -4
  270. package/dist/src/agent/middleware/context.d.ts +1 -2
  271. package/dist/src/agent/middleware/context.js +2 -5
  272. package/dist/src/agent/models/manager.d.ts +10 -10
  273. package/dist/src/agent/models/manager.js +34 -34
  274. package/dist/src/agent/orchestration/agent-event-handler.js +14 -14
  275. package/dist/src/agent/orchestration/agent-orchestrator.d.ts +7 -7
  276. package/dist/src/agent/orchestration/agent-orchestrator.js +29 -29
  277. package/dist/src/agent/orchestration/context-overflow.js +2 -0
  278. package/dist/src/agent/orchestration/llm-turn-retry.d.ts +1 -1
  279. package/dist/src/agent/orchestration/llm-turn-retry.js +2 -2
  280. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +1 -1
  281. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -2
  282. package/dist/src/agent/prompt/response-language.d.ts +1 -1
  283. package/dist/src/agent/prompt/response-language.js +2 -2
  284. package/dist/src/agent/prompt/service-prompt-builder.d.ts +2 -2
  285. package/dist/src/agent/prompt/service-prompt-builder.js +4 -4
  286. package/dist/src/agent/prompt/subagent-context.d.ts +4 -4
  287. package/dist/src/agent/prompt/subagent-context.js +1 -1
  288. package/dist/src/agent/prompt/system-prompt-params.d.ts +4 -4
  289. package/dist/src/agent/prompt/system-prompt-params.js +13 -12
  290. package/dist/src/agent/reply/apply-turn-user-enrichment.d.ts +1 -1
  291. package/dist/src/agent/reply/apply-turn-user-enrichment.js +3 -3
  292. package/dist/src/agent/reply/post-compaction-context.d.ts +1 -1
  293. package/dist/src/agent/reply/post-compaction-context.js +2 -2
  294. package/dist/src/agent/service/btw-query.d.ts +1 -1
  295. package/dist/src/agent/service/btw-query.js +4 -4
  296. package/dist/src/agent/service/build-direct-message-content.d.ts +1 -1
  297. package/dist/src/agent/service/build-direct-message-content.js +2 -2
  298. package/dist/src/agent/service/direct-turn-helpers.d.ts +6 -6
  299. package/dist/src/agent/service/direct-turn-helpers.js +17 -16
  300. package/dist/src/agent/service/parse-outbound-session-key.d.ts +1 -1
  301. package/dist/src/agent/service/parse-outbound-session-key.js +8 -9
  302. package/dist/src/agent/service/process-direct-one-shot.d.ts +11 -11
  303. package/dist/src/agent/service/process-direct-one-shot.js +16 -16
  304. package/dist/src/agent/service/process-direct-streaming.d.ts +18 -18
  305. package/dist/src/agent/service/process-direct-streaming.js +45 -40
  306. package/dist/src/agent/service/session-context-report.d.ts +1 -1
  307. package/dist/src/agent/service/session-context-report.js +3 -3
  308. package/dist/src/agent/service/webchat-tts.d.ts +3 -3
  309. package/dist/src/agent/service/webchat-tts.js +7 -7
  310. package/dist/src/agent/service.d.ts +23 -23
  311. package/dist/src/agent/service.js +111 -108
  312. package/dist/src/agent/service.types.d.ts +3 -3
  313. package/dist/src/agent/session/session-config-service.d.ts +5 -5
  314. package/dist/src/agent/session/session-config-service.js +53 -66
  315. package/dist/src/agent/session/session-context.d.ts +2 -2
  316. package/dist/src/agent/session/session-context.js +2 -2
  317. package/dist/src/agent/session/session-hydrator.d.ts +3 -3
  318. package/dist/src/agent/session/session-hydrator.js +19 -19
  319. package/dist/src/agent/session/session-inspector.d.ts +7 -7
  320. package/dist/src/agent/session/session-inspector.js +45 -45
  321. package/dist/src/agent/session/session-lifecycle.d.ts +2 -2
  322. package/dist/src/agent/session/session-lifecycle.js +17 -17
  323. package/dist/src/agent/session/session-state-bag.d.ts +18 -18
  324. package/dist/src/agent/session/session-state-bag.js +46 -46
  325. package/dist/src/agent/session/tracker.d.ts +7 -7
  326. package/dist/src/agent/session/tracker.js +27 -27
  327. package/dist/src/agent/source-context/types.d.ts +1 -1
  328. package/dist/src/agent/tasks/task-judge-service.d.ts +1 -1
  329. package/dist/src/agent/tasks/task-judge-service.js +11 -10
  330. package/dist/src/agent/tools/automation-tool.js +2 -0
  331. package/dist/src/agent/tools/chain-tracker.d.ts +10 -10
  332. package/dist/src/agent/tools/chain-tracker.js +31 -31
  333. package/dist/src/agent/tools/clarify-tool.d.ts +1 -1
  334. package/dist/src/agent/tools/create-share-tool.js +2 -0
  335. package/dist/src/agent/tools/delegate-tool.d.ts +1 -1
  336. package/dist/src/agent/tools/delegate-tool.js +4 -4
  337. package/dist/src/agent/tools/exec-command.d.ts +1 -1
  338. package/dist/src/agent/tools/exec-command.js +1 -1
  339. package/dist/src/agent/tools/factory.d.ts +3 -3
  340. package/dist/src/agent/tools/factory.js +42 -38
  341. package/dist/src/agent/tools/knowledge-memory-tool.js +2 -2
  342. package/dist/src/agent/tools/managed-job-tool.d.ts +1 -1
  343. package/dist/src/agent/tools/managed-job-tool.js +2 -2
  344. package/dist/src/agent/tools/publish-artifacts.js +2 -0
  345. package/dist/src/agent/tools/review-workspace.js +1 -1
  346. package/dist/src/agent/tools/send-media.js +2 -0
  347. package/dist/src/agent/tools/session-recall-tool.d.ts +1 -1
  348. package/dist/src/agent/tools/session-recall-tool.js +3 -3
  349. package/dist/src/agent/tools/session-search-tool.d.ts +1 -1
  350. package/dist/src/agent/tools/session-search-tool.js +6 -6
  351. package/dist/src/agent/tools/skill-install-tool.d.ts +3 -3
  352. package/dist/src/agent/tools/skill-install-tool.js +3 -3
  353. package/dist/src/agent/tools/todo-tool.d.ts +3 -3
  354. package/dist/src/agent/tools/todo-tool.js +4 -4
  355. package/dist/src/agent/tools/workflow-tool.d.ts +1 -1
  356. package/dist/src/agent/tools/workflow-tool.js +15 -13
  357. package/dist/src/agent/tools/write.js +2 -0
  358. package/dist/src/agent/tools/xopc-use-tool.d.ts +1 -1
  359. package/dist/src/agent/tools/xopc-use-tool.js +16 -13
  360. package/dist/src/agent/types.d.ts +1 -1
  361. package/dist/src/agent/workflow/catalog.js +4 -2
  362. package/dist/src/agent/workflow/channel-capability.d.ts +2 -2
  363. package/dist/src/agent/workflow/progress-broker.d.ts +4 -4
  364. package/dist/src/agent/workflow/progress-broker.js +17 -17
  365. package/dist/src/agent/workflow/subagent-runner.js +10 -10
  366. package/dist/src/agent/workflow/types.d.ts +2 -2
  367. package/dist/src/agent/workflow/workflow-child-tools.js +1 -1
  368. package/dist/src/agent/workspace-runtime/registry.js +1 -1
  369. package/dist/src/automations/domain/types.d.ts +7 -7
  370. package/dist/src/automations/domain/validation.js +2 -0
  371. package/dist/src/automations/service/action-executor.js +15 -15
  372. package/dist/src/automations/service/automation-service.js +4 -3
  373. package/dist/src/automations/storage/automation-repository.js +2 -1
  374. package/dist/src/automations/storage/automation-run-repository.js +9 -8
  375. package/dist/src/browser/native-messaging-host.js +4 -1
  376. package/dist/src/browser/policy/approval-store.d.ts +4 -4
  377. package/dist/src/browser/policy/approval-store.js +8 -8
  378. package/dist/src/browser/providers/browser-ext-install.js +10 -2
  379. package/dist/src/browser/providers/extension.js +6 -6
  380. package/dist/src/browser/providers/realtime-extension.js +2 -2
  381. package/dist/src/browser/runtime/browser-runtime.js +3 -3
  382. package/dist/src/channels/exec-approval-runtime.d.ts +1 -1
  383. package/dist/src/channels/manager.js +1 -1
  384. package/dist/src/channels/pipeline.js +2 -2
  385. package/dist/src/channels/plugin-types.d.ts +2 -2
  386. package/dist/src/channels/plugins/types.adapters.d.ts +1 -1
  387. package/dist/src/channels/telegram/index.d.ts +1 -1
  388. package/dist/src/channels/telegram/index.js +2 -2
  389. package/dist/src/chat-commands/agent-edit.js +2 -2
  390. package/dist/src/chat-commands/builtins/review.js +4 -4
  391. package/dist/src/chat-commands/builtins/session.js +1 -1
  392. package/dist/src/chat-commands/builtins/system.js +2 -2
  393. package/dist/src/chat-commands/builtins/thinking.js +7 -7
  394. package/dist/src/chat-commands/builtins/understanding.js +4 -4
  395. package/dist/src/chat-commands/builtins/workflow.js +8 -8
  396. package/dist/src/chat-commands/context.d.ts +9 -9
  397. package/dist/src/chat-commands/context.js +35 -35
  398. package/dist/src/chat-commands/index.d.ts +1 -1
  399. package/dist/src/chat-commands/index.js +2 -2
  400. package/dist/src/chat-commands/processor.js +2 -2
  401. package/dist/src/chat-commands/registry.js +1 -1
  402. package/dist/src/chat-commands/session-key.d.ts +3 -3
  403. package/dist/src/chat-commands/session-key.js +20 -24
  404. package/dist/src/chat-commands/types.d.ts +3 -3
  405. package/dist/src/cli/command-manifest.js +3 -3
  406. package/dist/src/cli/commands/agent/interactive.d.ts +1 -1
  407. package/dist/src/cli/commands/agent/interactive.js +8 -8
  408. package/dist/src/cli/commands/agent/stream-renderer.d.ts +1 -1
  409. package/dist/src/cli/commands/agent/stream-renderer.js +2 -2
  410. package/dist/src/cli/commands/agent.js +12 -8
  411. package/dist/src/cli/commands/doctor/checks/database-schema.js +3 -2
  412. package/dist/src/cli/commands/doctor/checks/session-integrity.js +9 -9
  413. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  414. package/dist/src/cli/commands/gateway/run-foreground.js +4 -0
  415. package/dist/src/cli/commands/import.js +56 -7
  416. package/dist/src/cli/commands/logs.js +3 -3
  417. package/dist/src/cli/commands/models.js +1 -1
  418. package/dist/src/cli/commands/onboard.js +1 -1
  419. package/dist/src/cli/commands/platform.js +1 -1
  420. package/dist/src/cli/commands/profile.js +1 -1
  421. package/dist/src/cli/commands/project.js +5 -5
  422. package/dist/src/cli/commands/resume.js +4 -4
  423. package/dist/src/cli/commands/tunnel.js +3 -2
  424. package/dist/src/cli/commands/update.js +1 -1
  425. package/dist/src/cli/extension-cli-register.js +1 -1
  426. package/dist/src/config/agent-profile.d.ts +3 -3
  427. package/dist/src/config/agent-profile.js +12 -12
  428. package/dist/src/config/index.js +1 -1
  429. package/dist/src/config/models-json.d.ts +6 -6
  430. package/dist/src/config/schema.d.ts +1 -1
  431. package/dist/src/connectors/catalog.js +2 -1
  432. package/dist/src/connectors/composio-sessions.d.ts +1 -1
  433. package/dist/src/connectors/composio-sessions.js +3 -3
  434. package/dist/src/connectors/connection-recovery-service.d.ts +4 -4
  435. package/dist/src/connectors/connection-recovery-service.js +41 -37
  436. package/dist/src/connectors/principal.d.ts +1 -1
  437. package/dist/src/connectors/principal.js +4 -3
  438. package/dist/src/connectors/types.d.ts +2 -2
  439. package/dist/src/discussions/action-tasks.js +4 -1
  440. package/dist/src/discussions/analyzer.js +2 -1
  441. package/dist/src/discussions/edits.js +3 -1
  442. package/dist/src/discussions/organizer.js +2 -1
  443. package/dist/src/discussions/recording.js +4 -1
  444. package/dist/src/discussions/recordingJobs.js +2 -1
  445. package/dist/src/discussions/repository.js +2 -1
  446. package/dist/src/discussions/revisions.js +2 -1
  447. package/dist/src/discussions/service.js +4 -1
  448. package/dist/src/discussions/types.js +4 -0
  449. package/dist/src/endpoint-tools/auth.js +2 -1
  450. package/dist/src/endpoint-tools/binding-service.d.ts +8 -8
  451. package/dist/src/endpoint-tools/binding-service.js +14 -14
  452. package/dist/src/endpoint-tools/invocation-service.d.ts +2 -0
  453. package/dist/src/endpoint-tools/invocation-service.js +50 -20
  454. package/dist/src/endpoint-tools/policy.js +2 -1
  455. package/dist/src/endpoint-tools/registry.js +2 -1
  456. package/dist/src/endpoint-tools/upload-service.js +2 -1
  457. package/dist/src/execution-environments/local-worktree-manager.d.ts +1 -1
  458. package/dist/src/execution-environments/local-worktree-manager.js +2 -2
  459. package/dist/src/execution-environments/session-environment-service.d.ts +3 -3
  460. package/dist/src/execution-environments/session-environment-service.js +10 -10
  461. package/dist/src/execution-environments/store.d.ts +2 -2
  462. package/dist/src/execution-environments/store.js +15 -14
  463. package/dist/src/execution-environments/subject.d.ts +1 -1
  464. package/dist/src/execution-environments/subject.js +2 -2
  465. package/dist/src/execution-environments/types.d.ts +2 -2
  466. package/dist/src/extensions/api.js +1 -1
  467. package/dist/src/extensions/install.js +1 -1
  468. package/dist/src/extensions/loader.d.ts +1 -1
  469. package/dist/src/extensions/types/core.d.ts +2 -2
  470. package/dist/src/extensions/types/hooks.d.ts +12 -12
  471. package/dist/src/extensions/types/tools.d.ts +3 -3
  472. package/dist/src/extensions/types/tui.d.ts +3 -3
  473. package/dist/src/files/file-service.d.ts +3 -3
  474. package/dist/src/files/file-service.js +3 -3
  475. package/dist/src/gateway/automation-agent-session.js +5 -5
  476. package/dist/src/gateway/chat-stream/mapper.d.ts +1 -1
  477. package/dist/src/gateway/chat-stream/mapper.js +4 -2
  478. package/dist/src/gateway/chat-stream/protocol.d.ts +1 -1
  479. package/dist/src/gateway/chat-stream/thinking-delta-coalescer.js +1 -1
  480. package/dist/src/gateway/clarify-runtime.d.ts +2 -2
  481. package/dist/src/gateway/clarify-runtime.js +2 -2
  482. package/dist/src/gateway/file-path-classifier.d.ts +2 -2
  483. package/dist/src/gateway/file-path-classifier.js +4 -4
  484. package/dist/src/gateway/file-reference-registry.d.ts +2 -2
  485. package/dist/src/gateway/file-reference-registry.js +1 -1
  486. package/dist/src/gateway/file-space-service.js +3 -3
  487. package/dist/src/gateway/gateway-workflow-host.types.d.ts +1 -1
  488. package/dist/src/gateway/heartbeat/check-store.d.ts +18 -0
  489. package/dist/src/gateway/heartbeat/check-store.js +74 -0
  490. package/dist/src/gateway/heartbeat/service.d.ts +12 -3
  491. package/dist/src/gateway/heartbeat/service.js +82 -51
  492. package/dist/src/gateway/hono/middleware/log-context.d.ts +1 -1
  493. package/dist/src/gateway/hono/middleware/log-context.js +3 -3
  494. package/dist/src/gateway/hono/routes/agent-stream.js +20 -20
  495. package/dist/src/gateway/hono/routes/browser-session.js +2 -2
  496. package/dist/src/gateway/hono/routes/browser.js +22 -20
  497. package/dist/src/gateway/hono/routes/chat-model-config.d.ts +1 -1
  498. package/dist/src/gateway/hono/routes/chat-model-config.js +6 -6
  499. package/dist/src/gateway/hono/routes/commands-skills.js +13 -13
  500. package/dist/src/gateway/hono/routes/connection-waits.js +5 -5
  501. package/dist/src/gateway/hono/routes/connectors.js +5 -5
  502. package/dist/src/gateway/hono/routes/context-sources.js +2 -1
  503. package/dist/src/gateway/hono/routes/device-pairing-approval.js +2 -0
  504. package/dist/src/gateway/hono/routes/devices.js +2 -0
  505. package/dist/src/gateway/hono/routes/endpoint-tools.js +8 -7
  506. package/dist/src/gateway/hono/routes/execution-environments.js +11 -11
  507. package/dist/src/gateway/hono/routes/file-references.js +5 -5
  508. package/dist/src/gateway/hono/routes/home.js +1 -1
  509. package/dist/src/gateway/hono/routes/imports.js +18 -6
  510. package/dist/src/gateway/hono/routes/interaction-state.js +6 -6
  511. package/dist/src/gateway/hono/routes/logs.js +2 -2
  512. package/dist/src/gateway/hono/routes/media.js +3 -3
  513. package/dist/src/gateway/hono/routes/notes.js +11 -11
  514. package/dist/src/gateway/hono/routes/proactive-control.js +2 -1
  515. package/dist/src/gateway/hono/routes/projects.js +26 -26
  516. package/dist/src/gateway/hono/routes/public-gateway.js +3 -3
  517. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +10 -10
  518. package/dist/src/gateway/hono/routes/session-input-handler.js +20 -17
  519. package/dist/src/gateway/hono/routes/sessions.js +79 -50
  520. package/dist/src/gateway/hono/routes/shares.js +38 -38
  521. package/dist/src/gateway/hono/routes/side-chats.js +4 -2
  522. package/dist/src/gateway/hono/routes/site-shares.js +6 -6
  523. package/dist/src/gateway/hono/routes/tasks.js +18 -13
  524. package/dist/src/gateway/hono/routes/tui.js +2 -2
  525. package/dist/src/gateway/hono/routes/user-model.js +1 -1
  526. package/dist/src/gateway/hono/routes/voice.js +1 -1
  527. package/dist/src/gateway/hono/routes/workflows.js +9 -9
  528. package/dist/src/gateway/media-access.d.ts +1 -1
  529. package/dist/src/gateway/media-access.js +3 -3
  530. package/dist/src/gateway/resolve-webchat-session-key.d.ts +5 -5
  531. package/dist/src/gateway/resolve-webchat-session-key.js +5 -5
  532. package/dist/src/gateway/run-loop.js +1 -1
  533. package/dist/src/gateway/service/agent-runner.d.ts +15 -15
  534. package/dist/src/gateway/service/agent-runner.js +63 -62
  535. package/dist/src/gateway/service/marketplace-service.d.ts +3 -3
  536. package/dist/src/gateway/service/marketplace-service.js +6 -6
  537. package/dist/src/gateway/service/run-gateway-agent.js +51 -49
  538. package/dist/src/gateway/service/session-input-coordinator.d.ts +11 -11
  539. package/dist/src/gateway/service/session-input-coordinator.js +76 -74
  540. package/dist/src/gateway/service/sessions-api.d.ts +19 -20
  541. package/dist/src/gateway/service/sessions-api.js +30 -38
  542. package/dist/src/gateway/service/task-conversation-query-service.d.ts +3 -2
  543. package/dist/src/gateway/service/task-conversation-query-service.js +3 -3
  544. package/dist/src/gateway/service.d.ts +11 -4
  545. package/dist/src/gateway/service.js +92 -71
  546. package/dist/src/gateway/session-context-summary.d.ts +1 -1
  547. package/dist/src/gateway/session-context-summary.js +13 -11
  548. package/dist/src/gateway/session-reset-service.d.ts +4 -4
  549. package/dist/src/gateway/session-reset-service.js +12 -12
  550. package/dist/src/gateway/side-chat/context-snapshot.d.ts +2 -2
  551. package/dist/src/gateway/side-chat/context-snapshot.js +2 -2
  552. package/dist/src/gateway/side-chat/manager.d.ts +4 -4
  553. package/dist/src/gateway/side-chat/manager.js +13 -13
  554. package/dist/src/gateway/side-chat/run-service.js +8 -8
  555. package/dist/src/gateway/side-chat/types.d.ts +4 -4
  556. package/dist/src/heartbeat/wake.d.ts +1 -1
  557. package/dist/src/history/ctx/exporter.js +11 -11
  558. package/dist/src/history/ctx/format.d.ts +1 -1
  559. package/dist/src/history/ctx/format.js +7 -7
  560. package/dist/src/imports/contextImport.js +2 -1
  561. package/dist/src/imports/importService.d.ts +17 -12
  562. package/dist/src/imports/importService.js +67 -70
  563. package/dist/src/imports/inventory.d.ts +11 -0
  564. package/dist/src/imports/inventory.js +202 -0
  565. package/dist/src/imports/productImport.d.ts +4 -4
  566. package/dist/src/imports/productImport.js +202 -108
  567. package/dist/src/imports/runtime.js +7 -2
  568. package/dist/src/imports/scanner.d.ts +1 -1
  569. package/dist/src/imports/scanner.js +4 -4
  570. package/dist/src/imports/types.d.ts +53 -0
  571. package/dist/src/infra/background-task.d.ts +2 -0
  572. package/dist/src/infra/background-task.js +25 -0
  573. package/dist/src/infra/node-sqlite.js +9 -3
  574. package/dist/src/infra/process-diagnostics.d.ts +5 -0
  575. package/dist/src/infra/process-diagnostics.js +101 -0
  576. package/dist/src/infra/sqlite-errors.js +25 -20
  577. package/dist/src/infra/unhandled-rejections.js +20 -9
  578. package/dist/src/infra/warning-filter.js +9 -3
  579. package/dist/src/knowledge/ingestion-service.js +1 -0
  580. package/dist/src/knowledge-memory/domain.d.ts +2 -2
  581. package/dist/src/knowledge-memory/repository.d.ts +1 -1
  582. package/dist/src/knowledge-memory/repository.js +10 -8
  583. package/dist/src/mcp/channel-bridge.d.ts +3 -3
  584. package/dist/src/mcp/channel-bridge.js +7 -7
  585. package/dist/src/mcp/channel-shared.d.ts +4 -4
  586. package/dist/src/mcp/channel-shared.js +3 -3
  587. package/dist/src/mcp/channel-tools.js +19 -19
  588. package/dist/src/media/session-references.js +2 -2
  589. package/dist/src/media-shared/http/ssrf-guard.js +1 -1
  590. package/dist/src/memory-maintenance/service.js +2 -1
  591. package/dist/src/migrations/conversation-routing-config.d.ts +2 -0
  592. package/dist/src/migrations/conversation-routing-config.js +42 -0
  593. package/dist/src/migrations/runner.js +6 -5
  594. package/dist/src/notes/service.d.ts +2 -2
  595. package/dist/src/notes/service.js +6 -6
  596. package/dist/src/notes/store.js +2 -1
  597. package/dist/src/notes/types.d.ts +3 -3
  598. package/dist/src/notifications/device-store.js +2 -1
  599. package/dist/src/notifications/planner.js +5 -3
  600. package/dist/src/notifications/proactive-channel.js +4 -1
  601. package/dist/src/notifications/proactive-policy.js +9 -6
  602. package/dist/src/notifications/service.d.ts +4 -4
  603. package/dist/src/notifications/service.js +4 -1
  604. package/dist/src/notifications/store.js +4 -1
  605. package/dist/src/notifications/web-push.js +4 -1
  606. package/dist/src/platform/contracts.d.ts +3 -3
  607. package/dist/src/proactive/actions/service.js +2 -1
  608. package/dist/src/proactive/events/product-event-bridge.js +1 -1
  609. package/dist/src/proactive/events/repository.js +2 -1
  610. package/dist/src/proactive/execution/authorization.d.ts +2 -0
  611. package/dist/src/proactive/execution/authorization.js +12 -2
  612. package/dist/src/proactive/execution/context.js +3 -1
  613. package/dist/src/proactive/execution/insight.js +2 -0
  614. package/dist/src/proactive/execution/repository.d.ts +2 -0
  615. package/dist/src/proactive/execution/repository.js +21 -3
  616. package/dist/src/proactive/execution/worker.js +15 -4
  617. package/dist/src/proactive/experience.d.ts +5 -2
  618. package/dist/src/proactive/experience.js +7 -3
  619. package/dist/src/proactive/follow-ups.d.ts +12 -7
  620. package/dist/src/proactive/follow-ups.js +23 -11
  621. package/dist/src/proactive/inbox/cards.js +7 -3
  622. package/dist/src/proactive/inbox/delivery.js +8 -8
  623. package/dist/src/proactive/inbox/digest.d.ts +1 -1
  624. package/dist/src/proactive/inbox/digest.js +25 -14
  625. package/dist/src/proactive/inbox/lifecycle.js +2 -1
  626. package/dist/src/proactive/inbox/notification-policy.d.ts +1 -1
  627. package/dist/src/proactive/inbox/notification-policy.js +9 -6
  628. package/dist/src/proactive/inbox/repository.js +5 -3
  629. package/dist/src/proactive/inbox/service.d.ts +6 -0
  630. package/dist/src/proactive/inbox/service.js +19 -0
  631. package/dist/src/proactive/inbox/types.d.ts +1 -0
  632. package/dist/src/proactive/mail-thread.js +2 -1
  633. package/dist/src/proactive/maintenance.js +2 -1
  634. package/dist/src/proactive/metrics.js +2 -1
  635. package/dist/src/proactive/policy/presence.d.ts +1 -1
  636. package/dist/src/proactive/policy/presence.js +9 -6
  637. package/dist/src/proactive/policy/service.d.ts +8 -5
  638. package/dist/src/proactive/policy/service.js +16 -13
  639. package/dist/src/proactive/routing/batch-repository.js +2 -1
  640. package/dist/src/proactive/scenarios/control.d.ts +3 -3
  641. package/dist/src/proactive/scenarios/control.js +16 -3
  642. package/dist/src/proactive/scenarios/repository.js +2 -1
  643. package/dist/src/proactive/service.js +2 -1
  644. package/dist/src/proactive/source-freshness.d.ts +8 -0
  645. package/dist/src/proactive/source-freshness.js +28 -0
  646. package/dist/src/proactive/status.d.ts +2 -0
  647. package/dist/src/proactive/status.js +22 -0
  648. package/dist/src/proactive/temporal/schedule.js +2 -1
  649. package/dist/src/proactive/temporal/worker.js +2 -1
  650. package/dist/src/projects/automation-bind.js +2 -1
  651. package/dist/src/projects/index.js +2 -2
  652. package/dist/src/projects/knowledge-bind.js +2 -1
  653. package/dist/src/projects/project-agent.js +4 -1
  654. package/dist/src/projects/project-service.d.ts +4 -4
  655. package/dist/src/projects/project-service.js +11 -10
  656. package/dist/src/projects/project-store.js +11 -9
  657. package/dist/src/projects/session-bind.d.ts +5 -5
  658. package/dist/src/projects/session-bind.js +18 -17
  659. package/dist/src/projects/types.d.ts +1 -1
  660. package/dist/src/projects/workflow-bind.js +2 -1
  661. package/dist/src/projects/workspace.d.ts +3 -3
  662. package/dist/src/projects/workspace.js +6 -6
  663. package/dist/src/providers/model-reference-auditor.js +1 -1
  664. package/dist/src/providers/prompt-cache-lifecycle.d.ts +2 -2
  665. package/dist/src/providers/prompt-cache-lifecycle.js +6 -6
  666. package/dist/src/realtime/broker.js +3 -3
  667. package/dist/src/realtime/runtime.js +32 -6
  668. package/dist/src/realtime/writer.js +16 -9
  669. package/dist/src/retrieval/queryProfile.d.ts +1 -1
  670. package/dist/src/routing/agent-session-key.d.ts +12 -41
  671. package/dist/src/routing/agent-session-key.js +39 -120
  672. package/dist/src/routing/conversation-route.d.ts +28 -0
  673. package/dist/src/routing/conversation-route.js +50 -0
  674. package/dist/src/routing/index.d.ts +2 -2
  675. package/dist/src/routing/index.js +5 -5
  676. package/dist/src/routing/resolve-route.d.ts +4 -9
  677. package/dist/src/routing/resolve-route.js +20 -60
  678. package/dist/src/routing/resolve-tui-session-key.d.ts +5 -13
  679. package/dist/src/routing/resolve-tui-session-key.js +11 -36
  680. package/dist/src/routing/session-key.d.ts +6 -39
  681. package/dist/src/routing/session-key.js +13 -161
  682. package/dist/src/session/client-history.js +2 -0
  683. package/dist/src/session/compaction-types.js +18 -13
  684. package/dist/src/session/config-store.d.ts +8 -8
  685. package/dist/src/session/config-store.js +19 -19
  686. package/dist/src/session/index.d.ts +2 -2
  687. package/dist/src/session/index.js +9 -5
  688. package/dist/src/session/init-session-turn.d.ts +7 -7
  689. package/dist/src/session/init-session-turn.js +18 -18
  690. package/dist/src/session/manager.d.ts +7 -7
  691. package/dist/src/session/manager.js +6 -6
  692. package/dist/src/session/model-config-lock.d.ts +1 -1
  693. package/dist/src/session/model-config-lock.js +4 -4
  694. package/dist/src/session/resolve-session.d.ts +10 -10
  695. package/dist/src/session/resolve-session.js +20 -20
  696. package/dist/src/session/session-context-for-llm.js +17 -10
  697. package/dist/src/session/session-title.d.ts +5 -5
  698. package/dist/src/session/session-title.js +28 -28
  699. package/dist/src/session/session-workspace.d.ts +1 -1
  700. package/dist/src/session/session-workspace.js +3 -3
  701. package/dist/src/session/store.d.ts +14 -14
  702. package/dist/src/session/store.js +70 -50
  703. package/dist/src/session/stored-rows-to-file-entries.d.ts +1 -1
  704. package/dist/src/session/stored-rows-to-file-entries.js +5 -3
  705. package/dist/src/session/thinking-resolve.d.ts +2 -2
  706. package/dist/src/session/thinking-resolve.js +4 -4
  707. package/dist/src/session/transcript-events.d.ts +1 -1
  708. package/dist/src/session/transcript-events.js +3 -3
  709. package/dist/src/session/transcript-outline.js +2 -1
  710. package/dist/src/session/turn-outcome-projector.js +2 -0
  711. package/dist/src/session/types.d.ts +5 -4
  712. package/dist/src/session/types.js +13 -9
  713. package/dist/src/session/user-message-display.js +2 -0
  714. package/dist/src/session/user-round-delete.js +2 -1
  715. package/dist/src/session/voice-transcript.js +8 -3
  716. package/dist/src/share/hosted-session-share.d.ts +6 -6
  717. package/dist/src/share/hosted-session-share.js +13 -11
  718. package/dist/src/share/hosted-static-site-publish.d.ts +1 -1
  719. package/dist/src/share/hosted-static-site-publish.js +1 -1
  720. package/dist/src/share/session-share-service.d.ts +9 -9
  721. package/dist/src/share/session-share-service.js +19 -19
  722. package/dist/src/share/share-store.d.ts +2 -2
  723. package/dist/src/share/share-store.js +9 -7
  724. package/dist/src/share/share-types.d.ts +2 -2
  725. package/dist/src/share/site-share-router.d.ts +2 -2
  726. package/dist/src/share/site-share-store.js +4 -2
  727. package/dist/src/share/site-share-types.d.ts +1 -1
  728. package/dist/src/storage/sqlite/activity-repository.js +2 -1
  729. package/dist/src/storage/sqlite/browser-session-repository.js +2 -1
  730. package/dist/src/storage/sqlite/browser-tab-binding-repository.d.ts +2 -2
  731. package/dist/src/storage/sqlite/browser-tab-binding-repository.js +10 -9
  732. package/dist/src/storage/sqlite/clarification-wait-repository.d.ts +7 -7
  733. package/dist/src/storage/sqlite/clarification-wait-repository.js +58 -53
  734. package/dist/src/storage/sqlite/collaboration-rule-repository.js +2 -1
  735. package/dist/src/storage/sqlite/composer-input-history-repository.js +2 -1
  736. package/dist/src/storage/sqlite/config-repository.d.ts +6 -6
  737. package/dist/src/storage/sqlite/config-repository.js +29 -25
  738. package/dist/src/storage/sqlite/connection-wait-repository.d.ts +11 -11
  739. package/dist/src/storage/sqlite/connection-wait-repository.js +61 -51
  740. package/dist/src/storage/sqlite/connection.js +28 -18
  741. package/dist/src/storage/sqlite/connector-account-repository.js +2 -1
  742. package/dist/src/storage/sqlite/connector-learning-repository.js +2 -1
  743. package/dist/src/storage/sqlite/connector-repository.d.ts +1 -1
  744. package/dist/src/storage/sqlite/connector-repository.js +11 -10
  745. package/dist/src/storage/sqlite/connector-sync-policy-repository.js +2 -1
  746. package/dist/src/storage/sqlite/context-evidence-repository.d.ts +1 -1
  747. package/dist/src/storage/sqlite/context-evidence-repository.js +7 -6
  748. package/dist/src/storage/sqlite/context-extraction-repository.js +2 -1
  749. package/dist/src/storage/sqlite/context-relation-repository.js +2 -1
  750. package/dist/src/storage/sqlite/conversation-repository.d.ts +12 -0
  751. package/dist/src/storage/sqlite/conversation-repository.js +76 -0
  752. package/dist/src/storage/sqlite/device-access-repository.js +4 -1
  753. package/dist/src/storage/sqlite/device-pairing-approval.js +4 -1
  754. package/dist/src/storage/sqlite/device-pairing-repository.js +2 -1
  755. package/dist/src/storage/sqlite/durable-queue.js +4 -2
  756. package/dist/src/storage/sqlite/durable-state.js +4 -2
  757. package/dist/src/storage/sqlite/endpoint-principal-repository.js +2 -1
  758. package/dist/src/storage/sqlite/endpoint-session-binding-repository.d.ts +3 -3
  759. package/dist/src/storage/sqlite/endpoint-session-binding-repository.js +12 -11
  760. package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +2 -1
  761. package/dist/src/storage/sqlite/fts.js +39 -34
  762. package/dist/src/storage/sqlite/gateway-identity-repository.js +2 -1
  763. package/dist/src/storage/sqlite/home-attention-repository.js +2 -1
  764. package/dist/src/storage/sqlite/import-repository.d.ts +2 -3
  765. package/dist/src/storage/sqlite/import-repository.js +5 -4
  766. package/dist/src/storage/sqlite/import-selection-repository.d.ts +15 -0
  767. package/dist/src/storage/sqlite/import-selection-repository.js +29 -0
  768. package/dist/src/storage/sqlite/index.d.ts +1 -1
  769. package/dist/src/storage/sqlite/index.js +25 -11
  770. package/dist/src/storage/sqlite/interaction-state-repository.d.ts +4 -4
  771. package/dist/src/storage/sqlite/interaction-state-repository.js +12 -11
  772. package/dist/src/storage/sqlite/knowledge-repository.d.ts +1 -0
  773. package/dist/src/storage/sqlite/knowledge-repository.js +4 -3
  774. package/dist/src/storage/sqlite/migrations/175_import_selections.sql +8 -0
  775. package/dist/src/storage/sqlite/migrations/176_proactive_quality.sql +5 -0
  776. package/dist/src/storage/sqlite/migrations/177_proactive_check_controls.sql +25 -0
  777. package/dist/src/storage/sqlite/migrations/178_conversation_uuid.sql +2 -0
  778. package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +3 -0
  779. package/dist/src/storage/sqlite/migrations/conversation-backup.js +88 -0
  780. package/dist/src/storage/sqlite/migrations/conversation-backup.ts +66 -0
  781. package/dist/src/storage/sqlite/migrations/conversation-key-decoder.d.ts +8 -0
  782. package/dist/src/storage/sqlite/migrations/conversation-key-decoder.js +87 -0
  783. package/dist/src/storage/sqlite/migrations/conversation-key-decoder.ts +50 -0
  784. package/dist/src/storage/sqlite/migrations/conversation-uuid.d.ts +8 -0
  785. package/dist/src/storage/sqlite/migrations/conversation-uuid.js +366 -0
  786. package/dist/src/storage/sqlite/migrations/conversation-uuid.ts +324 -0
  787. package/dist/src/storage/sqlite/migrations/conversation-windows-owners.d.ts +1 -0
  788. package/dist/src/storage/sqlite/migrations/conversation-windows-owners.js +92 -0
  789. package/dist/src/storage/sqlite/migrations/conversation-windows-owners.ts +71 -0
  790. package/dist/src/storage/sqlite/migrations/discover.js +7 -3
  791. package/dist/src/storage/sqlite/migrations/errors.js +28 -23
  792. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  793. package/dist/src/storage/sqlite/migrations/runner.js +43 -14
  794. package/dist/src/storage/sqlite/migrations/runner.ts +13 -3
  795. package/dist/src/storage/sqlite/migrations/types.d.ts +1 -1
  796. package/dist/src/storage/sqlite/migrations/types.ts +1 -1
  797. package/dist/src/storage/sqlite/note-agent-context-repository.js +2 -1
  798. package/dist/src/storage/sqlite/notes-repository.js +4 -2
  799. package/dist/src/storage/sqlite/paths.js +6 -2
  800. package/dist/src/storage/sqlite/relationship-settings-repository.js +2 -1
  801. package/dist/src/storage/sqlite/row-mappers.d.ts +10 -10
  802. package/dist/src/storage/sqlite/row-mappers.js +22 -15
  803. package/dist/src/storage/sqlite/schema-version.js +7 -2
  804. package/dist/src/storage/sqlite/schema.js +14 -6
  805. package/dist/src/storage/sqlite/session-identity-sql.js +12 -5
  806. package/dist/src/storage/sqlite/session-input-repository.d.ts +14 -14
  807. package/dist/src/storage/sqlite/session-input-repository.js +69 -61
  808. package/dist/src/storage/sqlite/session-instance-repository.d.ts +1 -1
  809. package/dist/src/storage/sqlite/session-instance-repository.js +6 -3
  810. package/dist/src/storage/sqlite/session-metadata.d.ts +2 -2
  811. package/dist/src/storage/sqlite/session-metadata.js +7 -3
  812. package/dist/src/storage/sqlite/session-repository.d.ts +15 -15
  813. package/dist/src/storage/sqlite/session-repository.js +126 -102
  814. package/dist/src/storage/sqlite/session-task-plan-repository.d.ts +3 -3
  815. package/dist/src/storage/sqlite/session-task-plan-repository.js +21 -19
  816. package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +2 -2
  817. package/dist/src/storage/sqlite/session-turn-replace-repository.js +26 -22
  818. package/dist/src/storage/sqlite/transaction.js +12 -6
  819. package/dist/src/storage/sqlite/transcript-repository.d.ts +14 -14
  820. package/dist/src/storage/sqlite/transcript-repository.js +107 -102
  821. package/dist/src/storage/sqlite/user-people-repository.js +2 -1
  822. package/dist/src/storage/sqlite/user-trust-repository.js +2 -1
  823. package/dist/src/support/collect-support-report.js +7 -7
  824. package/dist/src/support/types.d.ts +2 -2
  825. package/dist/src/support/types.js +1 -1
  826. package/dist/src/tasks/execution-context.d.ts +2 -2
  827. package/dist/src/tasks/execution-context.js +3 -3
  828. package/dist/src/tasks/home-query-service.d.ts +2 -2
  829. package/dist/src/tasks/home-query-service.js +6 -6
  830. package/dist/src/tasks/index.js +6 -2
  831. package/dist/src/tasks/project-monitoring-service.js +2 -1
  832. package/dist/src/tasks/project-operating-view-service.js +2 -1
  833. package/dist/src/tasks/task-application-service.js +9 -4
  834. package/dist/src/tasks/task-change-events.js +7 -2
  835. package/dist/src/tasks/task-context-assembler.d.ts +2 -2
  836. package/dist/src/tasks/task-context-assembler.js +12 -9
  837. package/dist/src/tasks/task-context-repository.d.ts +1 -1
  838. package/dist/src/tasks/task-context-repository.js +4 -3
  839. package/dist/src/tasks/task-conversation-repository.d.ts +7 -7
  840. package/dist/src/tasks/task-conversation-repository.js +27 -26
  841. package/dist/src/tasks/task-deletion-service.js +2 -1
  842. package/dist/src/tasks/task-dependency-service.js +2 -1
  843. package/dist/src/tasks/task-handoff-service.d.ts +2 -2
  844. package/dist/src/tasks/task-handoff-service.js +16 -15
  845. package/dist/src/tasks/task-outbox-dispatcher.js +2 -1
  846. package/dist/src/tasks/task-read-model-projector.js +4 -2
  847. package/dist/src/tasks/task-repository.js +2 -1
  848. package/dist/src/tasks/task-run-coordinator.js +6 -5
  849. package/dist/src/tasks/task-run-dispatcher.d.ts +1 -1
  850. package/dist/src/tasks/task-run-dispatcher.js +4 -3
  851. package/dist/src/tasks/task-run-repository.d.ts +2 -2
  852. package/dist/src/tasks/task-run-repository.js +219 -212
  853. package/dist/src/tasks/task-signal-service.js +6 -2
  854. package/dist/src/tasks/task-workflow-coordinator.js +2 -1
  855. package/dist/src/tui/backends/embedded-backend.d.ts +33 -32
  856. package/dist/src/tui/backends/embedded-backend.js +95 -83
  857. package/dist/src/tui/backends/gateway-realtime-backend.d.ts +34 -33
  858. package/dist/src/tui/backends/gateway-realtime-backend.js +95 -78
  859. package/dist/src/tui/components/branch-summary.js +3 -3
  860. package/dist/src/tui/components/session-selector.d.ts +5 -5
  861. package/dist/src/tui/components/session-selector.js +7 -7
  862. package/dist/src/tui/components/tui-bottom-bar.js +1 -1
  863. package/dist/src/tui/components/tui-header.d.ts +1 -1
  864. package/dist/src/tui/components/tui-header.js +2 -2
  865. package/dist/src/tui/extension-host/autocomplete.d.ts +2 -2
  866. package/dist/src/tui/extension-host/autocomplete.js +4 -4
  867. package/dist/src/tui/extension-host/host.d.ts +1 -1
  868. package/dist/src/tui/extension-host/runtime-context.d.ts +1 -1
  869. package/dist/src/tui/extension-host/runtime-context.js +2 -2
  870. package/dist/src/tui/extension-host/runtime.d.ts +1 -1
  871. package/dist/src/tui/extension-host/runtime.js +6 -6
  872. package/dist/src/tui/tui-backend.d.ts +43 -39
  873. package/dist/src/tui/tui-command-formatters.d.ts +2 -2
  874. package/dist/src/tui/tui-command-formatters.js +10 -18
  875. package/dist/src/tui/tui-commands.d.ts +3 -3
  876. package/dist/src/tui/tui-commands.js +31 -33
  877. package/dist/src/tui/tui-empty-session-cleanup.d.ts +2 -3
  878. package/dist/src/tui/tui-empty-session-cleanup.js +7 -15
  879. package/dist/src/tui/tui-file-autocomplete.d.ts +1 -1
  880. package/dist/src/tui/tui-file-autocomplete.js +2 -2
  881. package/dist/src/tui/tui-new-session-preferences.js +2 -0
  882. package/dist/src/tui/tui-picker-overlay.d.ts +1 -1
  883. package/dist/src/tui/tui-picker-overlay.js +41 -53
  884. package/dist/src/tui/tui-picker-services.d.ts +3 -3
  885. package/dist/src/tui/tui-session-actions.d.ts +1 -1
  886. package/dist/src/tui/tui-session-actions.js +8 -17
  887. package/dist/src/tui/tui-session-format.js +4 -1
  888. package/dist/src/tui/tui-session-snapshot.d.ts +2 -2
  889. package/dist/src/tui/tui-session-snapshot.js +4 -4
  890. package/dist/src/tui/tui-settings.js +2 -0
  891. package/dist/src/tui/tui-startup-resources.d.ts +1 -1
  892. package/dist/src/tui/tui-startup-resources.js +3 -3
  893. package/dist/src/tui/tui-startup-text.js +1 -1
  894. package/dist/src/tui/tui-transcript-tree-picker.d.ts +1 -1
  895. package/dist/src/tui/tui-transcript-tree-picker.js +2 -2
  896. package/dist/src/tui/tui-types.d.ts +4 -2
  897. package/dist/src/tui/tui-types.js +2 -2
  898. package/dist/src/tui/tui.js +114 -112
  899. package/dist/src/user-context/access-policy.d.ts +1 -1
  900. package/dist/src/user-context/access-policy.js +6 -5
  901. package/dist/src/user-context/changes.js +9 -4
  902. package/dist/src/user-context/domain.d.ts +1 -1
  903. package/dist/src/user-context/relationship-continuity.d.ts +1 -1
  904. package/dist/src/user-context/relationship-continuity.js +1 -1
  905. package/dist/src/user-context/sources/repository.js +4 -2
  906. package/dist/src/user-model/capture/executor.d.ts +1 -1
  907. package/dist/src/user-model/capture/executor.js +3 -3
  908. package/dist/src/user-model/goals.js +2 -1
  909. package/dist/src/user-model/repository.js +2 -1
  910. package/dist/src/utils/global-singleton.js +4 -1
  911. package/dist/src/utils/logger/context.d.ts +1 -1
  912. package/dist/src/utils/logger/context.js +2 -2
  913. package/dist/src/utils/logger/log-store.js +2 -2
  914. package/dist/src/utils/logger/pino-record.js +6 -6
  915. package/dist/src/utils/logger/types.d.ts +6 -6
  916. package/dist/src/voice/realtime/agentBroker.d.ts +6 -6
  917. package/dist/src/voice/realtime/agentBroker.js +6 -6
  918. package/dist/src/voice/realtime/agentEngine.js +6 -6
  919. package/dist/src/voice/realtime/memory-context.d.ts +2 -2
  920. package/dist/src/voice/realtime/memory-context.js +15 -15
  921. package/dist/src/voice/realtime/persona-context.d.ts +1 -1
  922. package/dist/src/voice/realtime/persona-context.js +6 -6
  923. package/dist/src/voice/realtime/runtime.d.ts +1 -1
  924. package/dist/src/voice/realtime/runtime.js +14 -13
  925. package/dist/src/voice/realtime/runtime.types.d.ts +6 -6
  926. package/dist/src/work-discovery/candidate-discovery.js +1 -1
  927. package/dist/src/work-discovery/investigation-repository.js +4 -2
  928. package/dist/src/work-discovery/probe.js +1 -1
  929. package/dist/src/work-discovery/repository.js +7 -5
  930. package/dist/src/work-discovery/service.js +33 -29
  931. package/dist/src/work-discovery/types.d.ts +1 -1
  932. package/dist/src/workflows/context/workflow-context-snapshot-repository.js +2 -1
  933. package/dist/src/workflows/domain/event.d.ts +1 -1
  934. package/dist/src/workflows/domain/run.d.ts +5 -5
  935. package/dist/src/workflows/engine/projector.js +1 -1
  936. package/dist/src/workflows/engine/workflow-engine.d.ts +2 -2
  937. package/dist/src/workflows/engine/workflow-engine.js +15 -18
  938. package/dist/src/workflows/index.js +3 -3
  939. package/dist/src/workflows/project-presets/project-workflow-preset-repository.js +2 -1
  940. package/dist/src/workflows/service/run-view-to-snapshot.js +1 -1
  941. package/dist/src/workflows/service/workflow-run-service.d.ts +2 -2
  942. package/dist/src/workflows/service/workflow-run-service.js +53 -42
  943. package/dist/src/workflows/service/workflow-run-service.types.d.ts +2 -2
  944. package/dist/src/workflows/service/workflow-session-bridge.d.ts +2 -2
  945. package/dist/src/workflows/service/workflow-session-bridge.js +31 -31
  946. package/dist/src/workflows/service/workflow-session-key.d.ts +1 -1
  947. package/dist/src/workflows/service/workflow-session-key.js +4 -4
  948. package/dist/src/workflows/service/workflow-writeback-service.js +2 -1
  949. package/dist/src/workflows/store/event-store.js +4 -2
  950. package/dist/src/workflows/store/run-index-store.js +9 -8
  951. package/package.json +3 -3
  952. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D9qP10BK.js +0 -1
  953. package/dist/gateway/static/root/assets/agents-D-bkOuAl.js +0 -1
  954. package/dist/gateway/static/root/assets/apps-page-BKwBBwJN.js +0 -1
  955. package/dist/gateway/static/root/assets/automations-workspace-B2-f9qZu.js +0 -6
  956. package/dist/gateway/static/root/assets/browser-settings-page-Dtn4rMeq.js +0 -8
  957. package/dist/gateway/static/root/assets/button-BA45yciM.js +0 -1
  958. package/dist/gateway/static/root/assets/capabilities-settings-panel-DiwtR9MD.js +0 -8
  959. package/dist/gateway/static/root/assets/channels-settings-pTdR1q1K.js +0 -1
  960. package/dist/gateway/static/root/assets/connectors-page-BSQ7Hs2w.js +0 -2
  961. package/dist/gateway/static/root/assets/desktop-pet-BUGkGB4-.js +0 -1
  962. package/dist/gateway/static/root/assets/device-pairing-wizard-CYkT7ecp.js +0 -1
  963. package/dist/gateway/static/root/assets/extension-settings-page-Baua1_Le.js +0 -1
  964. package/dist/gateway/static/root/assets/gateway-settings-CzpSYWex.js +0 -1
  965. package/dist/gateway/static/root/assets/heartbeat-settings-DTM_kYpE.js +0 -1
  966. package/dist/gateway/static/root/assets/home-page-CSSJvdd6.js +0 -1
  967. package/dist/gateway/static/root/assets/imports-page-XqVVYbAp.js +0 -1
  968. package/dist/gateway/static/root/assets/index-B_Sg5BKz.css +0 -2
  969. package/dist/gateway/static/root/assets/index-C9aQA4Dr.js +0 -74
  970. package/dist/gateway/static/root/assets/local-app-workbench-page-CZSgTYuI.js +0 -2
  971. package/dist/gateway/static/root/assets/locale-store-DO6JJ1l2.js +0 -1
  972. package/dist/gateway/static/root/assets/logs-page-z5ktnEzX.js +0 -2
  973. package/dist/gateway/static/root/assets/messages-BgZRsCkG.js +0 -3
  974. package/dist/gateway/static/root/assets/note-detail-panel-DSaZfkna.js +0 -5
  975. package/dist/gateway/static/root/assets/notes-page-CePEyv_C.js +0 -8
  976. package/dist/gateway/static/root/assets/page-tabs-CdYemUOu.js +0 -1
  977. package/dist/gateway/static/root/assets/popover-select-DGmMQt4t.js +0 -1
  978. package/dist/gateway/static/root/assets/proactive-page-Cy2Gm2f8.js +0 -1
  979. package/dist/gateway/static/root/assets/project-detail-page-BliwYpns.js +0 -1
  980. package/dist/gateway/static/root/assets/projects-page-Dm-BqnQn.js +0 -1
  981. package/dist/gateway/static/root/assets/remote-access-hub-C_XuQ9XR.js +0 -1
  982. package/dist/gateway/static/root/assets/sessions-page-Drt1aS2G.js +0 -1
  983. package/dist/gateway/static/root/assets/settings-advanced-gate-BAUd06_9.js +0 -1
  984. package/dist/gateway/static/root/assets/settings-form-section-Bw6xKOX5.js +0 -1
  985. package/dist/gateway/static/root/assets/settings-page-layout-DYelDcMV.js +0 -1
  986. package/dist/gateway/static/root/assets/setup-status-panel-BHI9e5Tw.js +0 -1
  987. package/dist/gateway/static/root/assets/shares-settings-DOAOjZBQ.js +0 -1
  988. package/dist/gateway/static/root/assets/skill-reload-api-DU0VQpHj.js +0 -1
  989. package/dist/gateway/static/root/assets/task-detail-page-DiPgMmBM.js +0 -1
  990. package/dist/gateway/static/root/assets/tunnel-api-Bmsy-5Fs.js +0 -1
  991. package/dist/gateway/static/root/assets/user-model-page-DxRaRdA0.js +0 -2
  992. package/dist/gateway/static/root/assets/workflows-page-CZikdgNw.js +0 -6
  993. package/dist/src/routing/session-key-utils.d.ts +0 -23
  994. package/dist/src/routing/session-key-utils.js +0 -85
  995. package/dist/src/session/session-id.d.ts +0 -3
  996. package/dist/src/session/session-id.js +0 -10
@@ -10,7 +10,8 @@ import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
10
10
  import { applyConfigOverrides } from "../config/runtime-overrides.js";
11
11
  import { expandWorkspacePathString, init_workspace_path } from "../config/workspace-path.js";
12
12
  import { init_agent_scope, resolveAgentProfileDir } from "./agent-scope.js";
13
- import { init_session_key, parseSessionKey } from "../routing/session-key.js";
13
+ import { getConversationRouting } from "../storage/sqlite/conversation-repository.js";
14
+ import { init_session_key } from "../routing/session-key.js";
14
15
  import { resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
15
16
  import { init_paths, resolveBundledSkillsDir } from "../config/paths.js";
16
17
  import { init_sync_provider_auth, resolveProviderApiKeySync } from "../auth/sync-provider-auth.js";
@@ -25,7 +26,7 @@ import { loadProjectAgentsContextFile } from "./bootstrap/project-agents-context
25
26
  import { getEmbeddedExecutionRunId } from "./embedded/execution-context.js";
26
27
  import { parseExternalToolRef } from "./external-tools/refs.js";
27
28
  import { mcpToolPolicyId } from "./mcp/bundle-mcp-policy.js";
28
- import { disposeAllSessionMcpRuntimes, retireSessionMcpRuntimeForSessionKey } from "./mcp/bundle-mcp-runtime.js";
29
+ import { disposeAllSessionMcpRuntimes, retireSessionMcpRuntimeForConversationId } from "./mcp/bundle-mcp-runtime.js";
29
30
  import { createSkillConfigManager, isSkillEnabled, resolveSkillConfig } from "./skills/config.js";
30
31
  import { isValidSkillEnvVarName } from "./skills/required-env-vars.js";
31
32
  import { resolveWorkspaceSkillsDir, resolveWorkspaceSkillsLockPath } from "./skills/workspace-skills-dir.js";
@@ -138,7 +139,7 @@ var AgentManager = class {
138
139
  });
139
140
  this.executionContext = new ExecutionContextCoordinator({
140
141
  getConfig: () => this.config.config,
141
- getAccessForSession: (sessionKey) => resolveUserContextSessionAccess(this.config.config, sessionKey),
142
+ getAccessForSession: (conversationId) => resolveUserContextSessionAccess(this.config.config, conversationId),
142
143
  getWorkspaceIdForSession: (sk) => this.getResolvedWorkspaceForSession(sk),
143
144
  getProjectIdForSession: (sk) => getSessionMetadata(sk)?.projectId
144
145
  });
@@ -154,8 +155,8 @@ var AgentManager = class {
154
155
  }, `Credential cache pre-warm failed: ${em}`);
155
156
  });
156
157
  }
157
- isUserContextEnabledForSession(sessionKey) {
158
- return resolveUserContextSessionAccess(this.config.config, sessionKey).userModel;
158
+ isUserContextEnabledForSession(conversationId) {
159
+ return resolveUserContextSessionAccess(this.config.config, conversationId).userModel;
159
160
  }
160
161
  computeBaseWorkspacePath() {
161
162
  const cfg = this.config.config;
@@ -166,27 +167,27 @@ var AgentManager = class {
166
167
  * Workspace root for inbound attachments / side effects for this session's agent id.
167
168
  * Uses in-memory session workspace overrides when the session has a persisted `workingDirectoryOverride`.
168
169
  */
169
- getResolvedWorkspaceForSession(sessionKey) {
170
+ getResolvedWorkspaceForSession(conversationId) {
170
171
  const cfg = this.config.config;
171
- const fromMap = this.sessionWorkspaceOverrides.get(sessionKey);
172
+ const fromMap = this.sessionWorkspaceOverrides.get(conversationId);
172
173
  if (fromMap !== void 0) return fromMap;
173
- return resolveEffectiveAgentProfileForSession(cfg, sessionKey).resolvedWorkspacePath;
174
+ return resolveEffectiveAgentProfileForSession(cfg, conversationId).resolvedWorkspacePath;
174
175
  }
175
- getWorkspaceRuntimeForSession(sessionKey) {
176
- const profile = resolveEffectiveAgentProfileForSession(this.config.config, sessionKey);
177
- const resolvedPath = sessionKey ? this.getResolvedWorkspaceForSession(sessionKey) : this.baseWorkspacePath;
176
+ getWorkspaceRuntimeForSession(conversationId) {
177
+ const profile = resolveEffectiveAgentProfileForSession(this.config.config, conversationId);
178
+ const resolvedPath = conversationId ? this.getResolvedWorkspaceForSession(conversationId) : this.baseWorkspacePath;
178
179
  return this.workspaceRuntimes.getOrCreate(resolvedPath, profile.agentId);
179
180
  }
180
181
  getCurrentWorkspaceRuntime() {
181
- return this.getWorkspaceRuntimeForSession(this.config.getCurrentContext?.()?.sessionKey);
182
+ return this.getWorkspaceRuntimeForSession(this.config.getCurrentContext?.()?.conversationId);
182
183
  }
183
184
  /**
184
185
  * Sync in-memory workspace override from session config (after load or PATCH).
185
186
  * Pass `null` to clear when the session has no `workingDirectoryOverride` on disk.
186
187
  */
187
- setSessionWorkspaceOverride(sessionKey, absolutePath) {
188
- if (absolutePath === null || absolutePath === "") this.sessionWorkspaceOverrides.delete(sessionKey);
189
- else this.sessionWorkspaceOverrides.set(sessionKey, absolutePath);
188
+ setSessionWorkspaceOverride(conversationId, absolutePath) {
189
+ if (absolutePath === null || absolutePath === "") this.sessionWorkspaceOverrides.delete(conversationId);
190
+ else this.sessionWorkspaceOverrides.set(conversationId, absolutePath);
190
191
  }
191
192
  pickDefaultModelRef() {
192
193
  const cfg = this.mergedConfig();
@@ -238,8 +239,8 @@ var AgentManager = class {
238
239
  bus: this.config.bus,
239
240
  toolExecutorConfig: { resolveTimeoutMs: (toolName) => {
240
241
  const config = this.mergedConfig();
241
- const sessionKey = this.config.getCurrentContext?.()?.sessionKey;
242
- return resolveEffectiveAgentProfileForSession(config, sessionKey).config.tools[toolName]?.timeoutMs;
242
+ const conversationId = this.config.getCurrentContext?.()?.conversationId;
243
+ return resolveEffectiveAgentProfileForSession(config, conversationId).config.tools[toolName]?.timeoutMs;
243
244
  } },
244
245
  getConfig: () => this.mergedConfig(),
245
246
  getPrimaryModel: () => this.resolveModelStringToModel(this.pickDefaultModelRef()),
@@ -258,8 +259,8 @@ var AgentManager = class {
258
259
  getWorkflowRunService: this.config.getWorkflowRunService,
259
260
  getSkillIndexingContext: () => {
260
261
  const ctx = this.config.getCurrentContext?.();
261
- if (!ctx?.sessionKey) return void 0;
262
- const inst = this.agents.get(ctx.sessionKey);
262
+ if (!ctx?.conversationId) return void 0;
263
+ const inst = this.agents.get(ctx.conversationId);
263
264
  if (!inst) return void 0;
264
265
  return {
265
266
  registeredToolNames: inst.registeredToolNames,
@@ -271,13 +272,13 @@ var AgentManager = class {
271
272
  },
272
273
  getSkillPassthroughEnvVarNames: () => {
273
274
  const ctx = this.config.getCurrentContext?.();
274
- if (!ctx?.sessionKey) return [];
275
- return [...this.agents.get(ctx.sessionKey)?.skillEnvPassthroughKeys ?? []];
275
+ if (!ctx?.conversationId) return [];
276
+ return [...this.agents.get(ctx.conversationId)?.skillEnvPassthroughKeys ?? []];
276
277
  },
277
278
  registerSkillEnvPassthrough: (names) => {
278
279
  const ctx = this.config.getCurrentContext?.();
279
- if (!ctx?.sessionKey) return;
280
- const inst = this.agents.get(ctx.sessionKey);
280
+ if (!ctx?.conversationId) return;
281
+ const inst = this.agents.get(ctx.conversationId);
281
282
  if (!inst) return;
282
283
  for (const n of names) if (isValidSkillEnvVarName(n)) inst.skillEnvPassthroughKeys.add(n.trim());
283
284
  },
@@ -288,26 +289,26 @@ var AgentManager = class {
288
289
  getMemoryManager() {
289
290
  return this.getCurrentWorkspaceRuntime().memoryManager;
290
291
  }
291
- getMemoryManagerForSession(sessionKey) {
292
- return this.getWorkspaceRuntimeForSession(sessionKey).memoryManager;
292
+ getMemoryManagerForSession(conversationId) {
293
+ return this.getWorkspaceRuntimeForSession(conversationId).memoryManager;
293
294
  }
294
295
  /** Build the bounded, policy-filtered context used for this model turn. */
295
- prepareUserTurnContext(userMessage, sessionKey, turnId) {
296
- return this.executionContext.prepare(userMessage, sessionKey, turnId);
296
+ prepareUserTurnContext(userMessage, conversationId, turnId) {
297
+ return this.executionContext.prepare(userMessage, conversationId, turnId);
297
298
  }
298
299
  /** Capture durable structured user context after a completed turn. */
299
- async afterAgentTurn(sessionKey, userPlainText, turnId) {
300
- if (!this.isUserContextEnabledForSession(sessionKey)) return void 0;
301
- const parsed = parseSessionKey(sessionKey);
300
+ async afterAgentTurn(conversationId, userPlainText, turnId) {
301
+ if (!this.isUserContextEnabledForSession(conversationId)) return void 0;
302
+ const parsed = getConversationRouting(conversationId);
302
303
  if (parsed && parsed.peerKind !== "direct") return void 0;
303
- const instance = this.agents.get(sessionKey);
304
+ const instance = this.agents.get(conversationId);
304
305
  if (!instance) return void 0;
305
306
  return runTurnUserModelCapture({
306
- sessionKey,
307
+ conversationId,
307
308
  turnId,
308
309
  userText: userPlainText,
309
310
  mainAgent: instance.agent,
310
- workspaceId: this.getResolvedWorkspaceForSession(sessionKey),
311
+ workspaceId: this.getResolvedWorkspaceForSession(conversationId),
311
312
  getConfig: () => this.mergedConfig()
312
313
  });
313
314
  }
@@ -315,40 +316,40 @@ var AgentManager = class {
315
316
  * Call once per user turn before the main embedded agent turn.
316
317
  * Delegates to {@link BackgroundReviewCoordinator}.
317
318
  */
318
- beginBackgroundReviewUserTurn(sessionKey) {
319
- if (!this.agents.get(sessionKey) || !this.isUserContextEnabledForSession(sessionKey)) return;
320
- this.backgroundReview.beginUserTurn(sessionKey);
319
+ beginBackgroundReviewUserTurn(conversationId) {
320
+ if (!this.agents.get(conversationId) || !this.isUserContextEnabledForSession(conversationId)) return;
321
+ this.backgroundReview.beginUserTurn(conversationId);
321
322
  }
322
323
  /** After a successful main turn, may run a quiet follow-up for context review and skills. */
323
- scheduleBackgroundReviewAfterUserTurn(sessionKey) {
324
- const inst = this.agents.get(sessionKey);
325
- if (!inst || !this.isUserContextEnabledForSession(sessionKey)) return;
324
+ scheduleBackgroundReviewAfterUserTurn(conversationId) {
325
+ const inst = this.agents.get(conversationId);
326
+ if (!inst || !this.isUserContextEnabledForSession(conversationId)) return;
326
327
  this.backgroundReview.scheduleAfterUserTurn({
327
- sessionKey,
328
+ conversationId,
328
329
  agent: inst.agent,
329
- lastAssistantText: this.getLastAssistantContent(sessionKey),
330
- workspaceId: this.getResolvedWorkspaceForSession(sessionKey)
330
+ lastAssistantText: this.getLastAssistantContent(conversationId),
331
+ workspaceId: this.getResolvedWorkspaceForSession(conversationId)
331
332
  });
332
333
  }
333
334
  /**
334
335
  * Expand `/skill:name` user text into the full skill block for the current turn (WebChat, channels).
335
336
  */
336
337
  expandSkillUserText(text) {
337
- const sessionKey = (this.config.getCurrentContext?.())?.sessionKey;
338
- const inst = sessionKey ? this.agents.get(sessionKey) : void 0;
339
- return this.getWorkspaceRuntimeForSession(sessionKey).skillManager.expandCommand(text, {
338
+ const conversationId = (this.config.getCurrentContext?.())?.conversationId;
339
+ const inst = conversationId ? this.agents.get(conversationId) : void 0;
340
+ return this.getWorkspaceRuntimeForSession(conversationId).skillManager.expandCommand(text, {
340
341
  skillAllowlist: inst?.effectiveProfile.skillsAllowlist,
341
342
  registeredToolNames: inst?.registeredToolNames
342
343
  });
343
344
  }
344
- prepareSkillTurn(sessionKey, text) {
345
- this.getOrCreateAgent(sessionKey);
346
- const inst = this.agents.get(sessionKey);
345
+ prepareSkillTurn(conversationId, text) {
346
+ this.getOrCreateAgent(conversationId);
347
+ const inst = this.agents.get(conversationId);
347
348
  if (!text.includes("/skill:")) return {
348
349
  text,
349
350
  activatedCapabilityNames: this.activeCapabilityNames(inst)
350
351
  };
351
- const rt = this.getWorkspaceRuntimeForSession(sessionKey);
352
+ const rt = this.getWorkspaceRuntimeForSession(conversationId);
352
353
  const options = {
353
354
  skillAllowlist: inst?.effectiveProfile.skillsAllowlist,
354
355
  registeredToolNames: inst?.registeredToolNames
@@ -371,11 +372,11 @@ var AgentManager = class {
371
372
  activatedCapabilityNames: [...new Set([...this.activeCapabilityNames(inst), ...turnOnlyCapabilities])]
372
373
  };
373
374
  }
374
- async withSkillCapabilities(sessionKey, capabilityNames, run) {
375
+ async withSkillCapabilities(conversationId, capabilityNames, run) {
375
376
  const requested = [...new Set(capabilityNames.map((name) => name.trim()).filter(Boolean))];
376
377
  if (requested.length === 0) return run();
377
- this.getOrCreateAgent(sessionKey);
378
- const inst = this.agents.get(sessionKey);
378
+ this.getOrCreateAgent(conversationId);
379
+ const inst = this.agents.get(conversationId);
379
380
  if (!inst) return run();
380
381
  const activatedTools = this.toolsFactory.createCapabilityTools(requested, { disabledTools: inst.effectiveProfile.tools.denied });
381
382
  const existingNames = new Set(inst.registeredToolNames);
@@ -397,19 +398,19 @@ var AgentManager = class {
397
398
  }
398
399
  buildSystemPromptForInstance(instance, registeredToolNames = instance.registeredToolNames, activeCapabilityNames = this.activeCapabilityNames(instance)) {
399
400
  const cfg = this.config.config;
400
- const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(instance.sessionKey);
401
+ const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(instance.conversationId);
401
402
  const rt = this.workspaceRuntimes.getOrCreate(resolvedWorkspacePath, instance.effectiveProfile.agentId);
402
- const contextFiles = this.resolveContextFilesForSession(instance.sessionKey, instance.effectiveProfile);
403
+ const contextFiles = this.resolveContextFilesForSession(instance.conversationId, instance.effectiveProfile);
403
404
  const modelRef = instance.effectiveProfile.primaryModelRef?.trim() || this.defaultModel;
404
405
  const thinkingLevel = instance.agent.state.thinkingLevel ?? this.config.thinkingLevel ?? "medium";
405
406
  return rt.systemPromptBuilder.build(contextFiles, {
406
- externalMemoryInstructions: this.buildExternalMemoryInstructions(instance.sessionKey, rt),
407
+ externalMemoryInstructions: this.buildExternalMemoryInstructions(instance.conversationId, rt),
407
408
  workspaceOverride: resolvedWorkspacePath,
408
409
  profileMarkdownPathRoot: resolveAgentProfileDir(cfg, instance.effectiveProfile.agentId),
409
410
  customInstructions: instance.effectiveProfile.customInstructions,
410
411
  skillAllowlist: instance.effectiveProfile.skillsAllowlist,
411
412
  registeredToolNames,
412
- sessionKey: instance.sessionKey,
413
+ conversationId: instance.conversationId,
413
414
  modelRef,
414
415
  agentId: instance.effectiveProfile.agentId,
415
416
  thinkingLevel,
@@ -447,7 +448,7 @@ var AgentManager = class {
447
448
  return false;
448
449
  }
449
450
  }
450
- resolveContextFilesForSession(sessionKey, profile, excludeHeartbeat) {
451
+ resolveContextFilesForSession(conversationId, profile, excludeHeartbeat) {
451
452
  const cfg = this.config.config;
452
453
  const profileDir = resolveAgentProfileDir(cfg, profile.agentId);
453
454
  const heartbeatEnabled = cfg.gateway?.heartbeat?.includeSystemPromptSection ?? false;
@@ -455,12 +456,12 @@ var AgentManager = class {
455
456
  const { contextFiles } = resolveBootstrapContextSync({
456
457
  profileDir,
457
458
  config: cfg,
458
- sessionKey,
459
+ conversationId,
459
460
  excludeHeartbeat: excludeHeartbeat ?? !heartbeatEnabled,
460
461
  contextInjection
461
462
  });
462
463
  const shouldAppendProjectContext = contextInjection === "always" || contextInjection === "continuation-skip" && contextFiles.length > 0;
463
- const workspaceDir = this.getResolvedWorkspaceForSession(sessionKey);
464
+ const workspaceDir = this.getResolvedWorkspaceForSession(conversationId);
464
465
  if (shouldAppendProjectContext && this.isProjectWorkspaceTrusted(workspaceDir)) {
465
466
  const projectAgentsFile = loadProjectAgentsContextFile(workspaceDir);
466
467
  if (projectAgentsFile) contextFiles.push(projectAgentsFile);
@@ -499,8 +500,8 @@ var AgentManager = class {
499
500
  getSkillCatalogSnapshot() {
500
501
  const skillsConfig = createSkillConfigManager(resolveStateDir()).load();
501
502
  const lock = loadSkillsLock();
502
- const sessionKey = this.config.getCurrentContext?.()?.sessionKey;
503
- const workspaceDir = sessionKey ? this.getResolvedWorkspaceForSession(sessionKey) : this.baseWorkspacePath;
503
+ const conversationId = this.config.getCurrentContext?.()?.conversationId;
504
+ const workspaceDir = conversationId ? this.getResolvedWorkspaceForSession(conversationId) : this.baseWorkspacePath;
504
505
  const workspaceLock = loadSkillsLock(resolveWorkspaceSkillsLockPath(workspaceDir));
505
506
  const rt = this.getCurrentWorkspaceRuntime();
506
507
  return {
@@ -569,12 +570,12 @@ var AgentManager = class {
569
570
  const profile = resolveEffectiveAgentProfile(this.config.config, agentId);
570
571
  return this.buildAgentSkillAvailability(profile, profile.resolvedWorkspacePath);
571
572
  }
572
- getSessionSkillAvailability(sessionKey) {
573
- const profile = resolveEffectiveAgentProfileForSession(this.config.config, sessionKey);
574
- return this.buildAgentSkillAvailability(profile, this.getResolvedWorkspaceForSession(sessionKey), this.agents.get(sessionKey)?.registeredToolNames);
573
+ getSessionSkillAvailability(conversationId) {
574
+ const profile = resolveEffectiveAgentProfileForSession(this.config.config, conversationId);
575
+ return this.buildAgentSkillAvailability(profile, this.getResolvedWorkspaceForSession(conversationId), this.agents.get(conversationId)?.registeredToolNames);
575
576
  }
576
- getSessionWorkspaceTrust(sessionKey) {
577
- return this.getWorkspaceTrust(this.getResolvedWorkspaceForSession(sessionKey));
577
+ getSessionWorkspaceTrust(conversationId) {
578
+ return this.getWorkspaceTrust(this.getResolvedWorkspaceForSession(conversationId));
578
579
  }
579
580
  getWorkspaceTrust(workspacePath) {
580
581
  const required = hasTrustRequiringProjectResources(workspacePath);
@@ -585,8 +586,8 @@ var AgentManager = class {
585
586
  trusted: required && this.isProjectWorkspaceTrusted(workspacePath)
586
587
  };
587
588
  }
588
- setSessionWorkspaceTrust(sessionKey, trusted) {
589
- return this.setWorkspaceTrust(this.getResolvedWorkspaceForSession(sessionKey), trusted);
589
+ setSessionWorkspaceTrust(conversationId, trusted) {
590
+ return this.setWorkspaceTrust(this.getResolvedWorkspaceForSession(conversationId), trusted);
590
591
  }
591
592
  setWorkspaceTrust(workspacePath, trusted) {
592
593
  if (!hasTrustRequiringProjectResources(workspacePath)) return {
@@ -606,18 +607,18 @@ var AgentManager = class {
606
607
  const cfg = this.config.config;
607
608
  for (const rt of this.workspaceRuntimes.values()) rt.skillManager.refreshPromptFromConfig();
608
609
  for (const instance of this.agents.values()) {
609
- const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(instance.sessionKey);
610
+ const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(instance.conversationId);
610
611
  const rt = this.workspaceRuntimes.getOrCreate(resolvedWorkspacePath, instance.effectiveProfile.agentId);
611
- const contextFiles = this.resolveContextFilesForSession(instance.sessionKey, instance.effectiveProfile);
612
- instance.activeProjectContext = this.buildExecutionScopeContext(instance.sessionKey);
612
+ const contextFiles = this.resolveContextFilesForSession(instance.conversationId, instance.effectiveProfile);
613
+ instance.activeProjectContext = this.buildExecutionScopeContext(instance.conversationId);
613
614
  const newPrompt = rt.systemPromptBuilder.build(contextFiles, {
614
- externalMemoryInstructions: this.buildExternalMemoryInstructions(instance.sessionKey, rt),
615
+ externalMemoryInstructions: this.buildExternalMemoryInstructions(instance.conversationId, rt),
615
616
  workspaceOverride: resolvedWorkspacePath,
616
617
  profileMarkdownPathRoot: resolveAgentProfileDir(cfg, instance.effectiveProfile.agentId),
617
618
  customInstructions: instance.effectiveProfile.customInstructions,
618
619
  skillAllowlist: instance.effectiveProfile.skillsAllowlist,
619
620
  registeredToolNames: instance.registeredToolNames,
620
- sessionKey: instance.sessionKey,
621
+ conversationId: instance.conversationId,
621
622
  modelRef: instance.effectiveProfile.primaryModelRef?.trim() || this.defaultModel,
622
623
  agentId: instance.effectiveProfile.agentId,
623
624
  thinkingLevel: this.config.thinkingLevel ?? "medium",
@@ -681,18 +682,18 @@ var AgentManager = class {
681
682
  const cfg = this.config.config;
682
683
  for (const rt of this.workspaceRuntimes.values()) rt.skillManager.reload(reason);
683
684
  for (const instance of this.agents.values()) {
684
- const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(instance.sessionKey);
685
+ const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(instance.conversationId);
685
686
  const rt = this.workspaceRuntimes.getOrCreate(resolvedWorkspacePath, instance.effectiveProfile.agentId);
686
- const contextFiles = this.resolveContextFilesForSession(instance.sessionKey, instance.effectiveProfile);
687
- instance.activeProjectContext = this.buildExecutionScopeContext(instance.sessionKey);
687
+ const contextFiles = this.resolveContextFilesForSession(instance.conversationId, instance.effectiveProfile);
688
+ instance.activeProjectContext = this.buildExecutionScopeContext(instance.conversationId);
688
689
  const newPrompt = rt.systemPromptBuilder.rebuild(contextFiles, {
689
- externalMemoryInstructions: this.buildExternalMemoryInstructions(instance.sessionKey, rt),
690
+ externalMemoryInstructions: this.buildExternalMemoryInstructions(instance.conversationId, rt),
690
691
  workspaceOverride: resolvedWorkspacePath,
691
692
  profileMarkdownPathRoot: resolveAgentProfileDir(cfg, instance.effectiveProfile.agentId),
692
693
  customInstructions: instance.effectiveProfile.customInstructions,
693
694
  skillAllowlist: instance.effectiveProfile.skillsAllowlist,
694
695
  registeredToolNames: instance.registeredToolNames,
695
- sessionKey: instance.sessionKey,
696
+ conversationId: instance.conversationId,
696
697
  modelRef: instance.effectiveProfile.primaryModelRef?.trim() || this.defaultModel,
697
698
  agentId: instance.effectiveProfile.agentId,
698
699
  thinkingLevel: this.config.thinkingLevel ?? "medium",
@@ -705,43 +706,43 @@ var AgentManager = class {
705
706
  /**
706
707
  * Get or create an Agent instance for a session
707
708
  */
708
- getOrCreateAgent(sessionKey) {
709
+ getOrCreateAgent(conversationId) {
709
710
  const cfg = this.config.config;
710
- const targetPath = this.getResolvedWorkspaceForSession(sessionKey);
711
- const existing = this.agents.get(sessionKey);
712
- if (existing) if (existing.resolvedWorkspacePath !== targetPath) this.removeAgent(sessionKey);
711
+ const targetPath = this.getResolvedWorkspaceForSession(conversationId);
712
+ const existing = this.agents.get(conversationId);
713
+ if (existing) if (existing.resolvedWorkspacePath !== targetPath) this.removeAgent(conversationId);
713
714
  else {
714
715
  this.refreshDynamicContextIfChanged(existing);
715
716
  existing.lastUsedAt = Date.now();
716
- log.debug({ sessionKey }, "Reusing existing agent instance");
717
+ log.debug({ conversationId }, "Reusing existing agent instance");
717
718
  return existing.agent;
718
719
  }
719
- let profile = resolveEffectiveAgentProfileForSession(cfg, sessionKey);
720
+ let profile = resolveEffectiveAgentProfileForSession(cfg, conversationId);
720
721
  const resolvedPath = targetPath;
721
722
  const rt = this.workspaceRuntimes.getOrCreate(resolvedPath, profile.agentId);
722
723
  profile = this.materializeSkillAllowlist(profile, rt);
723
- if (isMemorySubsystemEnabled(cfg)) rt.memoryManager.initializeAll(sessionKey, {
724
+ if (isMemorySubsystemEnabled(cfg)) rt.memoryManager.initializeAll(conversationId, {
724
725
  workspace: resolvedPath,
725
726
  agentId: profile.agentId
726
727
  }).catch((err) => log.warn({
727
728
  err,
728
- sessionKey
729
+ conversationId
729
730
  }, "memory initializeAll failed"));
730
- const activeProjectContext = this.buildExecutionScopeContext(sessionKey);
731
+ const activeProjectContext = this.buildExecutionScopeContext(conversationId);
731
732
  const profileModelRef = profile.primaryModelRef?.trim() || this.defaultModel;
732
733
  const modelManager = this.config.getModelManager?.();
733
- const initialModelRef = modelManager?.resolveInitialModelForSession(sessionKey, profileModelRef, profile.fallbacks) ?? profileModelRef;
734
+ const initialModelRef = modelManager?.resolveInitialModelForSession(conversationId, profileModelRef, profile.fallbacks) ?? profileModelRef;
734
735
  let created;
735
736
  try {
736
- created = this.createAgentForProfile(sessionKey, profile, initialModelRef, resolvedPath, rt, activeProjectContext);
737
+ created = this.createAgentForProfile(conversationId, profile, initialModelRef, resolvedPath, rt, activeProjectContext);
737
738
  } catch (err) {
738
- modelManager?.clearSessionProfileDefault(sessionKey);
739
+ modelManager?.clearSessionProfileDefault(conversationId);
739
740
  throw err;
740
741
  }
741
742
  const { agent, registeredToolNames } = created;
742
- this.agents.set(sessionKey, {
743
+ this.agents.set(conversationId, {
743
744
  agent,
744
- sessionKey,
745
+ conversationId,
745
746
  createdAt: Date.now(),
746
747
  lastUsedAt: Date.now(),
747
748
  effectiveProfile: profile,
@@ -749,53 +750,53 @@ var AgentManager = class {
749
750
  registeredToolNames,
750
751
  activeCapabilities: /* @__PURE__ */ new Map(),
751
752
  activeProjectContext,
752
- interactionStateVersion: this.getInteractionStateVersion(sessionKey),
753
- userContextAccessVersion: this.getUserContextAccessVersion(sessionKey),
753
+ interactionStateVersion: this.getInteractionStateVersion(conversationId),
754
+ userContextAccessVersion: this.getUserContextAccessVersion(conversationId),
754
755
  skillEnvPassthroughKeys: /* @__PURE__ */ new Set()
755
756
  });
756
757
  log.debug({
757
- sessionKey,
758
+ conversationId,
758
759
  totalAgents: this.agents.size,
759
760
  agentId: profile.agentId
760
761
  }, "Created new agent instance");
761
762
  return agent;
762
763
  }
763
- createAgentTurnPolicy(sessionKey) {
764
- const profile = this.agents.get(sessionKey)?.effectiveProfile ?? resolveEffectiveAgentProfileForSession(this.config.config, sessionKey);
765
- return this.buildAgentTurnPolicy(sessionKey, profile);
764
+ createAgentTurnPolicy(conversationId) {
765
+ const profile = this.agents.get(conversationId)?.effectiveProfile ?? resolveEffectiveAgentProfileForSession(this.config.config, conversationId);
766
+ return this.buildAgentTurnPolicy(conversationId, profile);
766
767
  }
767
768
  /**
768
769
  * Get existing agent for a session (if any)
769
770
  */
770
- getAgent(sessionKey) {
771
- return this.agents.get(sessionKey)?.agent;
771
+ getAgent(conversationId) {
772
+ return this.agents.get(conversationId)?.agent;
772
773
  }
773
774
  /**
774
775
  * Check if an agent exists for a session
775
776
  */
776
- hasAgent(sessionKey) {
777
- return this.agents.has(sessionKey);
777
+ hasAgent(conversationId) {
778
+ return this.agents.has(conversationId);
778
779
  }
779
780
  /**
780
781
  * Remove an agent instance
781
782
  */
782
- removeAgent(sessionKey) {
783
- const instance = this.agents.get(sessionKey);
783
+ removeAgent(conversationId) {
784
+ const instance = this.agents.get(conversationId);
784
785
  if (instance) {
785
- this.backgroundReview.forgetSession(sessionKey);
786
- this.toolsFactory.closeBrowserPageForSession(sessionKey);
787
- retireSessionMcpRuntimeForSessionKey({
788
- sessionKey,
786
+ this.backgroundReview.forgetSession(conversationId);
787
+ this.toolsFactory.closeBrowserPageForSession(conversationId);
788
+ retireSessionMcpRuntimeForConversationId({
789
+ conversationId,
789
790
  reason: "agent-evict"
790
791
  });
791
792
  instance.agent.abort();
792
- evictEmbeddedSessionRunner(sessionKey, "agent_removed");
793
- this.agents.delete(sessionKey);
794
- this.executionContext.forgetSession(sessionKey);
795
- clearBootstrapSnapshot(sessionKey);
796
- this.config.getModelManager?.().clearSessionProfileDefault(sessionKey);
793
+ evictEmbeddedSessionRunner(conversationId, "agent_removed");
794
+ this.agents.delete(conversationId);
795
+ this.executionContext.forgetSession(conversationId);
796
+ clearBootstrapSnapshot(conversationId);
797
+ this.config.getModelManager?.().clearSessionProfileDefault(conversationId);
797
798
  log.info({
798
- sessionKey,
799
+ conversationId,
799
800
  totalAgents: this.agents.size
800
801
  }, "Removed agent instance");
801
802
  return true;
@@ -817,26 +818,26 @@ var AgentManager = class {
817
818
  /**
818
819
  * Merge per-turn channel system prompt (e.g. Telegram group/topic override) into the agent.
819
820
  */
820
- applyTurnChannelSystemPrompt(sessionKey, channelSystemPrompt) {
821
+ applyTurnChannelSystemPrompt(conversationId, channelSystemPrompt) {
821
822
  const trimmed = channelSystemPrompt.trim();
822
823
  if (!trimmed) return;
823
- const instance = this.agents.get(sessionKey);
824
+ const instance = this.agents.get(conversationId);
824
825
  if (!instance) return;
825
826
  const cfg = this.config.config;
826
- const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(sessionKey);
827
+ const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(conversationId);
827
828
  const rt = this.workspaceRuntimes.getOrCreate(resolvedWorkspacePath, instance.effectiveProfile.agentId);
828
- const contextFiles = this.resolveContextFilesForSession(sessionKey, instance.effectiveProfile);
829
+ const contextFiles = this.resolveContextFilesForSession(conversationId, instance.effectiveProfile);
829
830
  const modelRef = instance.effectiveProfile.primaryModelRef?.trim() || this.defaultModel;
830
831
  const thinkingLevel = this.config.thinkingLevel ?? "medium";
831
- const activeProjectContext = this.buildExecutionScopeContext(sessionKey);
832
+ const activeProjectContext = this.buildExecutionScopeContext(conversationId);
832
833
  instance.agent.state.systemPrompt = rt.systemPromptBuilder.build(contextFiles, {
833
- externalMemoryInstructions: this.buildExternalMemoryInstructions(sessionKey, rt),
834
+ externalMemoryInstructions: this.buildExternalMemoryInstructions(conversationId, rt),
834
835
  workspaceOverride: resolvedWorkspacePath,
835
836
  profileMarkdownPathRoot: resolveAgentProfileDir(cfg, instance.effectiveProfile.agentId),
836
837
  customInstructions: instance.effectiveProfile.customInstructions,
837
838
  skillAllowlist: instance.effectiveProfile.skillsAllowlist,
838
839
  registeredToolNames: instance.registeredToolNames,
839
- sessionKey,
840
+ conversationId,
840
841
  modelRef,
841
842
  agentId: instance.effectiveProfile.agentId,
842
843
  thinkingLevel,
@@ -848,12 +849,12 @@ var AgentManager = class {
848
849
  /**
849
850
  * Set thinking level for a session's agent
850
851
  */
851
- setThinkingLevel(sessionKey, level) {
852
- const instance = this.agents.get(sessionKey);
852
+ setThinkingLevel(conversationId, level) {
853
+ const instance = this.agents.get(conversationId);
853
854
  if (instance) {
854
855
  instance.agent.state.thinkingLevel = level;
855
856
  log.debug({
856
- sessionKey,
857
+ conversationId,
857
858
  thinkingLevel: level
858
859
  }, "Set thinking level for agent");
859
860
  }
@@ -906,35 +907,35 @@ var AgentManager = class {
906
907
  composeDynamicProjectContext(...sections) {
907
908
  return sections.map((section) => section?.trim()).filter((section) => Boolean(section)).join("\n\n") || void 0;
908
909
  }
909
- buildExecutionScopeContext(sessionKey) {
910
- const access = resolveUserContextSessionAccess(this.config.config, sessionKey);
911
- return buildExecutionScopeContextForPrompt(sessionKey, {
910
+ buildExecutionScopeContext(conversationId) {
911
+ const access = resolveUserContextSessionAccess(this.config.config, conversationId);
912
+ return buildExecutionScopeContextForPrompt(conversationId, {
912
913
  includeKnowledge: access.knowledge,
913
914
  knowledgeSources: access.knowledgeSources
914
915
  });
915
916
  }
916
- getInteractionStateVersion(sessionKey) {
917
- return isXopcDatabaseOpen() ? getInteractionState(sessionKey)?.updatedAt : void 0;
917
+ getInteractionStateVersion(conversationId) {
918
+ return isXopcDatabaseOpen() ? getInteractionState(conversationId)?.updatedAt : void 0;
918
919
  }
919
- getUserContextAccessVersion(sessionKey) {
920
- return JSON.stringify(resolveUserContextSessionAccess(this.config.config, sessionKey));
920
+ getUserContextAccessVersion(conversationId) {
921
+ return JSON.stringify(resolveUserContextSessionAccess(this.config.config, conversationId));
921
922
  }
922
- buildExternalMemoryInstructions(sessionKey, rt) {
923
- return resolveUserContextSessionAccess(this.config.config, sessionKey).knowledge ? rt.memoryManager.buildExternalSystemPrompt() : "";
923
+ buildExternalMemoryInstructions(conversationId, rt) {
924
+ return resolveUserContextSessionAccess(this.config.config, conversationId).knowledge ? rt.memoryManager.buildExternalSystemPrompt() : "";
924
925
  }
925
- getCapabilityCatalogForSession(sessionKey) {
926
- const inst = sessionKey?.trim() ? this.agents.get(sessionKey.trim()) : void 0;
926
+ getCapabilityCatalogForSession(conversationId) {
927
+ const inst = conversationId?.trim() ? this.agents.get(conversationId.trim()) : void 0;
927
928
  return this.resolveCapabilityCatalogForInstance(inst);
928
929
  }
929
- createAgentForProfile(sessionKey, profile, modelRef, resolvedWorkspacePath, rt, activeProjectContext) {
930
+ createAgentForProfile(conversationId, profile, modelRef, resolvedWorkspacePath, rt, activeProjectContext) {
930
931
  const model = this.resolveModelStringToModel(modelRef);
931
932
  let agent;
932
- const contextFiles = this.resolveContextFilesForSession(sessionKey, profile);
933
+ const contextFiles = this.resolveContextFilesForSession(conversationId, profile);
933
934
  const tools = this.toolsFactory.createAllTools({
934
935
  workspace: resolvedWorkspacePath,
935
936
  profileMarkdownRoot: resolveAgentProfileDir(this.config.config, profile.agentId),
936
937
  agentId: profile.agentId,
937
- sessionKey,
938
+ conversationId,
938
939
  disabledTools: profile.tools.denied,
939
940
  getPrimaryModel: () => agent?.state.model ?? model,
940
941
  getMemoryManager: () => rt.memoryManager,
@@ -942,17 +943,17 @@ var AgentManager = class {
942
943
  });
943
944
  const registeredToolNames = tools.map((t) => t.name);
944
945
  const thinkingLevel = this.config.thinkingLevel ?? "medium";
945
- const turnPolicy = this.buildAgentTurnPolicy(sessionKey, profile);
946
+ const turnPolicy = this.buildAgentTurnPolicy(conversationId, profile);
946
947
  agent = new Agent({
947
948
  initialState: {
948
949
  systemPrompt: rt.systemPromptBuilder.build(contextFiles, {
949
- externalMemoryInstructions: this.buildExternalMemoryInstructions(sessionKey, rt),
950
+ externalMemoryInstructions: this.buildExternalMemoryInstructions(conversationId, rt),
950
951
  workspaceOverride: resolvedWorkspacePath,
951
952
  profileMarkdownPathRoot: resolveAgentProfileDir(this.config.config, profile.agentId),
952
953
  customInstructions: profile.customInstructions,
953
954
  skillAllowlist: profile.skillsAllowlist,
954
955
  registeredToolNames,
955
- sessionKey,
956
+ conversationId,
956
957
  modelRef,
957
958
  agentId: profile.agentId,
958
959
  thinkingLevel,
@@ -978,7 +979,7 @@ var AgentManager = class {
978
979
  registeredToolNames
979
980
  };
980
981
  }
981
- buildAgentTurnPolicy(sessionKey, profile) {
982
+ buildAgentTurnPolicy(conversationId, profile) {
982
983
  return createAgentTurnPolicy({
983
984
  maxTurns: profile.config.runtime.maxTurns,
984
985
  maxToolFailures: profile.config.runtime.maxToolFailuresPerTurn,
@@ -1000,7 +1001,7 @@ var AgentManager = class {
1000
1001
  apply_patch: "filesystem_write",
1001
1002
  xopc_tool_execute: "external_tool"
1002
1003
  }[toolName] ?? toolName;
1003
- const executionGate = this.executionContext.getCurrent(sessionKey);
1004
+ const executionGate = this.executionContext.getCurrent(conversationId);
1004
1005
  if (executionGate) {
1005
1006
  const decision = evaluateToolGate(executionGate, operation);
1006
1007
  if (!decision.allowed) return {
@@ -1012,7 +1013,7 @@ var AgentManager = class {
1012
1013
  const policy = this.resolveToolPolicy(profile, toolName, args);
1013
1014
  const detail = JSON.stringify(args ?? {});
1014
1015
  if (policy?.mode === "ask") {
1015
- if (!await this.requestToolConfirmation(sessionKey, policy?.id ?? toolName, detail)) return {
1016
+ if (!await this.requestToolConfirmation(conversationId, policy?.id ?? toolName, detail)) return {
1016
1017
  block: true,
1017
1018
  terminate: true,
1018
1019
  reason: `User did not approve ${policy?.id ?? toolName}.`
@@ -1027,7 +1028,7 @@ var AgentManager = class {
1027
1028
  const approval = await maybeRequestChannelExecApproval({
1028
1029
  cfg,
1029
1030
  payload: {
1030
- sessionKey: ctx.sessionKey,
1031
+ conversationId: ctx.conversationId,
1031
1032
  channel: ctx.channel,
1032
1033
  chatId: ctx.chatId,
1033
1034
  accountId,
@@ -1043,7 +1044,7 @@ var AgentManager = class {
1043
1044
  }
1044
1045
  }
1045
1046
  if (!this.config.hookRunner) return;
1046
- const hookResult = await this.config.hookRunner.runBeforeToolCall(toolName, args ?? {}, { sessionKey });
1047
+ const hookResult = await this.config.hookRunner.runBeforeToolCall(toolName, args ?? {}, { conversationId });
1047
1048
  if (!hookResult.allowed) return {
1048
1049
  block: true,
1049
1050
  reason: hookResult.reason ?? "Tool call blocked by policy hook."
@@ -1068,16 +1069,16 @@ var AgentManager = class {
1068
1069
  ...policy
1069
1070
  } : void 0;
1070
1071
  }
1071
- async requestToolConfirmation(sessionKey, toolName, detail) {
1072
+ async requestToolConfirmation(conversationId, toolName, detail) {
1072
1073
  const request = this.config.gatewayClarify?.requestClarification;
1073
1074
  if (!request) return false;
1074
1075
  const approvalKey = createHash("sha256").update(`${toolName}\0${detail}`).digest("hex");
1075
- const existing = consumeClarificationApproval(sessionKey, approvalKey);
1076
+ const existing = consumeClarificationApproval(conversationId, approvalKey);
1076
1077
  if (existing) return existing === "approved";
1077
1078
  const runId = getEmbeddedExecutionRunId();
1078
1079
  if (!runId) return false;
1079
1080
  const result = await request({
1080
- sessionKey,
1081
+ conversationId,
1081
1082
  runId,
1082
1083
  toolCallId: `approval:${approvalKey}`
1083
1084
  }, {
@@ -1093,24 +1094,24 @@ var AgentManager = class {
1093
1094
  return result.status === "answered" && result.answer === "Allow once";
1094
1095
  }
1095
1096
  refreshDynamicContextIfChanged(instance) {
1096
- const nextProjectContext = this.buildExecutionScopeContext(instance.sessionKey);
1097
- const interactionStateVersion = this.getInteractionStateVersion(instance.sessionKey);
1098
- const userContextAccessVersion = this.getUserContextAccessVersion(instance.sessionKey);
1097
+ const nextProjectContext = this.buildExecutionScopeContext(instance.conversationId);
1098
+ const interactionStateVersion = this.getInteractionStateVersion(instance.conversationId);
1099
+ const userContextAccessVersion = this.getUserContextAccessVersion(instance.conversationId);
1099
1100
  if (nextProjectContext === instance.activeProjectContext && interactionStateVersion === instance.interactionStateVersion && userContextAccessVersion === instance.userContextAccessVersion) return;
1100
1101
  const cfg = this.config.config;
1101
- const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(instance.sessionKey);
1102
+ const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(instance.conversationId);
1102
1103
  const rt = this.workspaceRuntimes.getOrCreate(resolvedWorkspacePath, instance.effectiveProfile.agentId);
1103
- const contextFiles = this.resolveContextFilesForSession(instance.sessionKey, instance.effectiveProfile);
1104
+ const contextFiles = this.resolveContextFilesForSession(instance.conversationId, instance.effectiveProfile);
1104
1105
  const modelRef = instance.effectiveProfile.primaryModelRef?.trim() || this.defaultModel;
1105
1106
  const thinkingLevel = instance.agent.state.thinkingLevel ?? this.config.thinkingLevel ?? "medium";
1106
1107
  instance.agent.state.systemPrompt = rt.systemPromptBuilder.build(contextFiles, {
1107
- externalMemoryInstructions: this.buildExternalMemoryInstructions(instance.sessionKey, rt),
1108
+ externalMemoryInstructions: this.buildExternalMemoryInstructions(instance.conversationId, rt),
1108
1109
  workspaceOverride: resolvedWorkspacePath,
1109
1110
  profileMarkdownPathRoot: resolveAgentProfileDir(cfg, instance.effectiveProfile.agentId),
1110
1111
  customInstructions: instance.effectiveProfile.customInstructions,
1111
1112
  skillAllowlist: instance.effectiveProfile.skillsAllowlist,
1112
1113
  registeredToolNames: instance.registeredToolNames,
1113
- sessionKey: instance.sessionKey,
1114
+ conversationId: instance.conversationId,
1114
1115
  modelRef,
1115
1116
  agentId: instance.effectiveProfile.agentId,
1116
1117
  thinkingLevel,
@@ -1119,16 +1120,16 @@ var AgentManager = class {
1119
1120
  instance.activeProjectContext = nextProjectContext;
1120
1121
  instance.interactionStateVersion = interactionStateVersion;
1121
1122
  instance.userContextAccessVersion = userContextAccessVersion;
1122
- log.debug({ sessionKey: instance.sessionKey }, "Dynamic agent context changed; system prompt refreshed");
1123
+ log.debug({ conversationId: instance.conversationId }, "Dynamic agent context changed; system prompt refreshed");
1123
1124
  }
1124
1125
  /**
1125
1126
  * Set model for a specific session
1126
1127
  */
1127
- setModelForSession(sessionKey, modelId) {
1128
- const instance = this.agents.get(sessionKey);
1128
+ setModelForSession(conversationId, modelId) {
1129
+ const instance = this.agents.get(conversationId);
1129
1130
  if (!instance) {
1130
1131
  log.warn({
1131
- sessionKey,
1132
+ conversationId,
1132
1133
  modelId,
1133
1134
  activeSessionCount: this.agents.size
1134
1135
  }, `setModelForSession: no agent instance for session (create session / run turn first); modelId=${modelId}`);
@@ -1138,19 +1139,19 @@ var AgentManager = class {
1138
1139
  const model = resolveModel(modelId);
1139
1140
  instance.agent.state.model = model;
1140
1141
  const cfg = this.config.config;
1141
- const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(sessionKey);
1142
+ const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(conversationId);
1142
1143
  const rt = this.workspaceRuntimes.getOrCreate(resolvedWorkspacePath, instance.effectiveProfile.agentId);
1143
- const contextFiles = this.resolveContextFilesForSession(sessionKey, instance.effectiveProfile);
1144
+ const contextFiles = this.resolveContextFilesForSession(conversationId, instance.effectiveProfile);
1144
1145
  const thinkingLevel = instance.agent.state.thinkingLevel ?? this.config.thinkingLevel ?? "medium";
1145
- const activeProjectContext = this.buildExecutionScopeContext(sessionKey);
1146
+ const activeProjectContext = this.buildExecutionScopeContext(conversationId);
1146
1147
  instance.agent.state.systemPrompt = rt.systemPromptBuilder.build(contextFiles, {
1147
- externalMemoryInstructions: this.buildExternalMemoryInstructions(sessionKey, rt),
1148
+ externalMemoryInstructions: this.buildExternalMemoryInstructions(conversationId, rt),
1148
1149
  workspaceOverride: resolvedWorkspacePath,
1149
1150
  profileMarkdownPathRoot: resolveAgentProfileDir(cfg, instance.effectiveProfile.agentId),
1150
1151
  customInstructions: instance.effectiveProfile.customInstructions,
1151
1152
  skillAllowlist: instance.effectiveProfile.skillsAllowlist,
1152
1153
  registeredToolNames: instance.registeredToolNames,
1153
- sessionKey,
1154
+ conversationId,
1154
1155
  modelRef: modelId,
1155
1156
  agentId: instance.effectiveProfile.agentId,
1156
1157
  thinkingLevel,
@@ -1158,14 +1159,14 @@ var AgentManager = class {
1158
1159
  });
1159
1160
  instance.activeProjectContext = activeProjectContext;
1160
1161
  log.info({
1161
- sessionKey,
1162
+ conversationId,
1162
1163
  modelId
1163
1164
  }, "Model set for session");
1164
1165
  return true;
1165
1166
  } catch (err) {
1166
1167
  log.error({
1167
1168
  err,
1168
- sessionKey,
1169
+ conversationId,
1169
1170
  modelId
1170
1171
  }, "Failed to set model for session");
1171
1172
  return false;
@@ -1174,8 +1175,8 @@ var AgentManager = class {
1174
1175
  /**
1175
1176
  * Get last assistant content from a session's agent
1176
1177
  */
1177
- getLastAssistantContent(sessionKey) {
1178
- const instance = this.agents.get(sessionKey);
1178
+ getLastAssistantContent(conversationId) {
1179
+ const instance = this.agents.get(conversationId);
1179
1180
  if (!instance) return null;
1180
1181
  const messages = instance.agent.state.messages;
1181
1182
  for (let i = messages.length - 1; i >= 0; i--) {
@@ -1191,8 +1192,8 @@ var AgentManager = class {
1191
1192
  /**
1192
1193
  * Replace messages for a session's agent
1193
1194
  */
1194
- replaceMessages(sessionKey, messages) {
1195
- const instance = this.agents.get(sessionKey);
1195
+ replaceMessages(conversationId, messages) {
1196
+ const instance = this.agents.get(conversationId);
1196
1197
  if (!instance) return false;
1197
1198
  instance.agent.state.messages = messages;
1198
1199
  return true;
@@ -1200,26 +1201,26 @@ var AgentManager = class {
1200
1201
  /**
1201
1202
  * Get messages for a session's agent
1202
1203
  */
1203
- getMessages(sessionKey) {
1204
- const instance = this.agents.get(sessionKey);
1204
+ getMessages(conversationId) {
1205
+ const instance = this.agents.get(conversationId);
1205
1206
  if (!instance) return null;
1206
1207
  return instance.agent.state.messages;
1207
1208
  }
1208
1209
  /**
1209
1210
  * Subscribe to agent events for a session
1210
1211
  */
1211
- subscribeToSession(sessionKey, callback) {
1212
- const listeners = this.runtimeListeners.get(sessionKey) ?? /* @__PURE__ */ new Set();
1212
+ subscribeToSession(conversationId, callback) {
1213
+ const listeners = this.runtimeListeners.get(conversationId) ?? /* @__PURE__ */ new Set();
1213
1214
  listeners.add(callback);
1214
- this.runtimeListeners.set(sessionKey, listeners);
1215
+ this.runtimeListeners.set(conversationId, listeners);
1215
1216
  return () => {
1216
1217
  listeners.delete(callback);
1217
- if (listeners.size === 0) this.runtimeListeners.delete(sessionKey);
1218
+ if (listeners.size === 0) this.runtimeListeners.delete(conversationId);
1218
1219
  };
1219
1220
  }
1220
1221
  runtimeListeners = /* @__PURE__ */ new Map();
1221
- emitRuntimeEvent(sessionKey, event) {
1222
- for (const listener of this.runtimeListeners.get(sessionKey) ?? []) listener(event);
1222
+ emitRuntimeEvent(conversationId, event) {
1223
+ for (const listener of this.runtimeListeners.get(conversationId) ?? []) listener(event);
1223
1224
  }
1224
1225
  };
1225
1226
  //#endregion