@xopcai/xopc 0.0.248 → 0.0.250

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 (512) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-etpmyV7S.js → activity-store-DfBjTSo9.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BmKxSM1k.js → agent-avatar-dicebear-BN6FJXkJ.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C7rZH1A2.js +1 -0
  6. package/dist/gateway/static/root/assets/agents-CgGaoo4z.js +1 -0
  7. package/dist/gateway/static/root/assets/{api-B0-hLuZ1.js → api-zxpcJfgj.js} +1 -1
  8. package/dist/gateway/static/root/assets/app-management-settings-panel-D2gMshuS.js +1 -0
  9. package/dist/gateway/static/root/assets/appearance-settings-wMu0jSKx.js +1 -0
  10. package/dist/gateway/static/root/assets/apps-page-KF1Gnv36.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-BnMSgZvR.js → archive-plugin-u6EE3JV8.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-CejsQMev.js → attachment-load-DbJurnv-.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-RC8EyoAf.js → automations-page-Ew_e5HDn.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-workspace-Ch-ldu35.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-DGjppLSG.js → binary-plugins-DtDFNfPM.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-CWdP4bUc.js → block-editor-CnAwmabq.js} +44 -44
  17. package/dist/gateway/static/root/assets/browser-settings-page-DtVhsHJW.js +8 -0
  18. package/dist/gateway/static/root/assets/{browser-workflow-inputs-BQ1Ilw_o.js → browser-workflow-inputs-BX1-uM9L.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-workflows-page-CJh4NyxT.js → browser-workflows-page-CcbUOWDF.js} +2 -2
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel--sXeylhe.js +7 -0
  21. package/dist/gateway/static/root/assets/channels-settings-AXSBDujZ.js +1 -0
  22. package/dist/gateway/static/root/assets/{channels-status-swr-Ohhee4vm.js → channels-status-swr-CX-yWwLD.js} +1 -1
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-BOtoKTK3.js → chat-terminal-dock-CryTDNdD.js} +2 -2
  24. package/dist/gateway/static/root/assets/connectors-page-HBHUWohz.js +2 -0
  25. package/dist/gateway/static/root/assets/{cron-expression-DTj1V3Sw.js → cron-expression-ji5aWrjG.js} +1 -1
  26. package/dist/gateway/static/root/assets/{date-picker-Yr6OCvGL.js → date-picker-Dro_w3eX.js} +1 -1
  27. package/dist/gateway/static/root/assets/dependency-picker-Ce19KKnX.js +1 -0
  28. package/dist/gateway/static/root/assets/{desktop-pet-DbGzggPF.js → desktop-pet-DsSi-3uZ.js} +1 -1
  29. package/dist/gateway/static/root/assets/desktop-pet-settings-8WQ4woJy.js +1 -0
  30. package/dist/gateway/static/root/assets/{extension-debug-page-DgTtk4KC.js → extension-debug-page-CgvEBfLZ.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-page-DtQeiP6f.js → extension-page-DkznBbMj.js} +1 -1
  32. package/dist/gateway/static/root/assets/extension-settings-page-BOjhchK2.js +1 -0
  33. package/dist/gateway/static/root/assets/files-BArWTfr7.js +1 -0
  34. package/dist/gateway/static/root/assets/gateway-config-api-OEruhhX3.js +1 -0
  35. package/dist/gateway/static/root/assets/{gateway-config-swr-DXuXtU1w.js → gateway-config-swr-CMNbl0FZ.js} +1 -1
  36. package/dist/gateway/static/root/assets/gateway-settings-BgH3A0LO.js +1 -0
  37. package/dist/gateway/static/root/assets/{gateway-startup-retry-CzBzglzQ.js → gateway-startup-retry-CR7Xg8As.js} +1 -1
  38. package/dist/gateway/static/root/assets/heartbeat-settings-C97naDkO.js +1 -0
  39. package/dist/gateway/static/root/assets/home-page-BBKKme4G.js +1 -0
  40. package/dist/gateway/static/root/assets/{image-generation-api-TIgsn04n.js → image-generation-api-C5mn73ca.js} +1 -1
  41. package/dist/gateway/static/root/assets/index-BcaF-dgQ.js +72 -0
  42. package/dist/gateway/static/root/assets/index-DAryGvZ7.css +2 -0
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-wsWuoa8p.js → keyboard-shortcuts-settings-BYhfzsqe.js} +1 -1
  44. package/dist/gateway/static/root/assets/local-app-workbench-page-DNncc2tn.js +2 -0
  45. package/dist/gateway/static/root/assets/{local-apps-page-CXrbrGo8.js → local-apps-page-vBlknU7C.js} +1 -1
  46. package/dist/gateway/static/root/assets/{locale-store-BJFLQY8O.js → locale-store-CF4erhjB.js} +1 -1
  47. package/dist/gateway/static/root/assets/logs-page-CizZInrT.js +2 -0
  48. package/dist/gateway/static/root/assets/{management-settings-BdJZFR7U.js → management-settings-Dnx6mSNe.js} +1 -1
  49. package/dist/gateway/static/root/assets/{markdown-split-NK3ACVG2.js → markdown-split-DtBtcHWi.js} +1 -1
  50. package/dist/gateway/static/root/assets/{markdown-view-DTF9v1gg.js → markdown-view-CQvzsE24.js} +1 -1
  51. package/dist/gateway/static/root/assets/{media-plugins-F0jcUxyl.js → media-plugins-DrMYeHe7.js} +1 -1
  52. package/dist/gateway/static/root/assets/messages-Cf5hpZE6.js +3 -0
  53. package/dist/gateway/static/root/assets/mobile-pairing-wizard-AKgGy3Kx.js +1 -0
  54. package/dist/gateway/static/root/assets/note-detail-panel-Bw3jD9Jf.js +5 -0
  55. package/dist/gateway/static/root/assets/notes-page-Dpqq7Z-J.js +8 -0
  56. package/dist/gateway/static/root/assets/page-tabs-CX9T71by.js +1 -0
  57. package/dist/gateway/static/root/assets/preview-open-alternatives-DvEHoimN.js +1 -0
  58. package/dist/gateway/static/root/assets/{product-open-page-CxGGlWA8.js → product-open-page-COcr_NUJ.js} +1 -1
  59. package/dist/gateway/static/root/assets/project-detail-page-BuT6MCTs.js +1 -0
  60. package/dist/gateway/static/root/assets/projects-page-DXWMxOjf.js +1 -0
  61. package/dist/gateway/static/root/assets/{registry-api-CIsNlSBi.js → registry-api-BsRBlji7.js} +1 -1
  62. package/dist/gateway/static/root/assets/remote-access-hub-7rBCUWzZ.js +1 -0
  63. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-YkjhiQfA.js → runtime-tools-settings-panel-CQ13P-mS.js} +2 -2
  64. package/dist/gateway/static/root/assets/{schema-form-oFGf3G3s.js → schema-form-BUVyTpZj.js} +1 -1
  65. package/dist/gateway/static/root/assets/sessions-page-gmEOYNb4.js +1 -0
  66. package/dist/gateway/static/root/assets/settings-advanced-gate-DYYoJcl7.js +1 -0
  67. package/dist/gateway/static/root/assets/settings-form-section-DVY-8_B9.js +1 -0
  68. package/dist/gateway/static/root/assets/{settings-page-C7VWs0IT.js → settings-page-CdiVYyTl.js} +1 -1
  69. package/dist/gateway/static/root/assets/setup-status-panel-BhenBnUj.js +1 -0
  70. package/dist/gateway/static/root/assets/{share-preview-page-t5oz18rh.js → share-preview-page-C88YLKm4.js} +1 -1
  71. package/dist/gateway/static/root/assets/shares-settings-Dq7xIj0_.js +1 -0
  72. package/dist/gateway/static/root/assets/skill-reload-api-MDI9Lz6z.js +1 -0
  73. package/dist/gateway/static/root/assets/skills-page-DLir1nM0.js +2 -0
  74. package/dist/gateway/static/root/assets/{skills-page.utils-DEDTYs2W.js → skills-page.utils-BMZAfS3G.js} +1 -1
  75. package/dist/gateway/static/root/assets/system-settings-panel-BM8ivYan.js +1 -0
  76. package/dist/gateway/static/root/assets/task-detail-page-P0_RldWv.js +1 -0
  77. package/dist/gateway/static/root/assets/{theme-store-O597U8q_.js → theme-store-BOgkc_9D.js} +1 -1
  78. package/dist/gateway/static/root/assets/tunnel-api-DemxChjo.js +1 -0
  79. package/dist/gateway/static/root/assets/{use-autosave-B5eUJ6Zq.js → use-autosave-CV3Ui5hu.js} +1 -1
  80. package/dist/gateway/static/root/assets/user-model-page-CxfnoRVn.js +2 -0
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-CMKSwz4C.js → voice-api-key-field-CUoCi4Sq.js} +1 -1
  82. package/dist/gateway/static/root/assets/{voice-config-api-q7B6fOFB.js → voice-config-api-C-ryeIxj.js} +1 -1
  83. package/dist/gateway/static/root/assets/work-discovery-overlay-BhDlkCMB.js +1 -0
  84. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DZmvLZjb.js → workflow-run-setup-panel-D8CcPc_C.js} +2 -2
  85. package/dist/gateway/static/root/assets/workflows-page-Bxn2Dc16.js +5 -0
  86. package/dist/gateway/static/root/index.html +11 -27
  87. package/dist/package.js +1 -1
  88. package/dist/packages/gateway-contract/src/user-message-display.js +18 -0
  89. package/dist/src/agent/agent-instance-gateway.d.ts +3 -3
  90. package/dist/src/agent/agent-manager.d.ts +13 -13
  91. package/dist/src/agent/agent-manager.js +76 -42
  92. package/dist/src/agent/background-review/coordinator.d.ts +2 -4
  93. package/dist/src/agent/background-review/coordinator.js +5 -30
  94. package/dist/src/agent/background-review/prompts.d.ts +4 -2
  95. package/dist/src/agent/background-review/prompts.js +33 -19
  96. package/dist/src/agent/background-review/run-background-review.d.ts +6 -7
  97. package/dist/src/agent/background-review/run-background-review.js +47 -41
  98. package/dist/src/agent/background-review/settings.d.ts +0 -1
  99. package/dist/src/agent/background-review/settings.js +6 -7
  100. package/dist/src/agent/context/audit.d.ts +38 -0
  101. package/dist/src/agent/context/audit.js +123 -0
  102. package/dist/src/agent/context/coordinator.d.ts +31 -0
  103. package/dist/src/agent/context/coordinator.js +73 -0
  104. package/dist/src/agent/context/execution-context.d.ts +13 -0
  105. package/dist/src/agent/context/execution-context.js +211 -0
  106. package/dist/src/agent/context/execution-context.types.d.ts +50 -0
  107. package/dist/src/agent/context/execution-scope.d.ts +5 -1
  108. package/dist/src/agent/context/execution-scope.js +6 -2
  109. package/dist/src/agent/context/prepend.d.ts +2 -0
  110. package/dist/src/agent/context/prepend.js +28 -0
  111. package/dist/src/agent/context/project-context.d.ts +6 -3
  112. package/dist/src/agent/context/project-context.js +28 -23
  113. package/dist/src/agent/embedded/index.js +1 -1
  114. package/dist/src/agent/embedded/run-for-session.js +1 -0
  115. package/dist/src/agent/embedded/run-turn.js +22 -2
  116. package/dist/src/agent/embedded/types.d.ts +1 -25
  117. package/dist/src/agent/external-tools/composio-provider.js +87 -92
  118. package/dist/src/agent/external-tools/gateway-tools.d.ts +4 -1
  119. package/dist/src/agent/external-tools/gateway-tools.js +153 -41
  120. package/dist/src/agent/external-tools/index.d.ts +1 -0
  121. package/dist/src/agent/external-tools/index.js +2 -1
  122. package/dist/src/agent/external-tools/memory-provider.d.ts +1 -0
  123. package/dist/src/agent/external-tools/memory-provider.js +1 -0
  124. package/dist/src/agent/external-tools/search-error.d.ts +12 -0
  125. package/dist/src/agent/external-tools/search-error.js +29 -0
  126. package/dist/src/agent/external-tools/service.d.ts +4 -0
  127. package/dist/src/agent/external-tools/service.js +22 -2
  128. package/dist/src/agent/inbound/attachment-pipeline.js +5 -1
  129. package/dist/src/agent/memory/compaction-policy.js +1 -1
  130. package/dist/src/agent/memory/compaction-promotion.d.ts +1 -0
  131. package/dist/src/agent/memory/compaction-promotion.js +52 -79
  132. package/dist/src/agent/memory/create-memory-manager.js +1 -3
  133. package/dist/src/agent/memory/index.d.ts +1 -6
  134. package/dist/src/agent/memory/index.js +3 -6
  135. package/dist/src/agent/memory/manager.d.ts +0 -16
  136. package/dist/src/agent/memory/manager.js +11 -40
  137. package/dist/src/agent/memory/memory-config.d.ts +0 -5
  138. package/dist/src/agent/memory/memory-config.js +2 -9
  139. package/dist/src/agent/memory/runtime.d.ts +2 -2
  140. package/dist/src/agent/memory/runtime.js +9 -19
  141. package/dist/src/agent/memory/types.d.ts +1 -1
  142. package/dist/src/agent/orchestration/agent-orchestrator.js +13 -21
  143. package/dist/src/agent/orchestration/context-overflow.js +1 -0
  144. package/dist/src/agent/prompt/sections/memory-skills.js +25 -36
  145. package/dist/src/agent/prompt/sections/tooling.js +10 -4
  146. package/dist/src/agent/prompt/service-prompt-builder.js +4 -3
  147. package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -2
  148. package/dist/src/agent/service/direct-turn-helpers.js +8 -25
  149. package/dist/src/agent/service/process-direct-streaming.js +8 -7
  150. package/dist/src/agent/service.js +4 -3
  151. package/dist/src/agent/tasks/task-judge-service.js +1 -1
  152. package/dist/src/agent/tools/clarify-tool.d.ts +1 -0
  153. package/dist/src/agent/tools/delegate-tool.js +5 -2
  154. package/dist/src/agent/tools/factory.d.ts +1 -0
  155. package/dist/src/agent/tools/factory.js +68 -21
  156. package/dist/src/agent/tools/index.d.ts +3 -2
  157. package/dist/src/agent/tools/index.js +4 -3
  158. package/dist/src/agent/tools/knowledge-memory-tool.d.ts +15 -0
  159. package/dist/src/agent/tools/knowledge-memory-tool.js +184 -0
  160. package/dist/src/agent/tools/{dreaming-tool.d.ts → memory-maintenance-tool.d.ts} +2 -2
  161. package/dist/src/agent/tools/memory-maintenance-tool.js +31 -0
  162. package/dist/src/agent/tools/session-search-tool.d.ts +1 -0
  163. package/dist/src/agent/tools/session-search-tool.js +7 -0
  164. package/dist/src/agent/tools/user-context-tool.d.ts +10 -0
  165. package/dist/src/agent/tools/user-context-tool.js +98 -0
  166. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  167. package/dist/src/automations/service/automation-service.d.ts +2 -1
  168. package/dist/src/automations/service/automation-service.js +6 -2
  169. package/dist/src/chat-commands/builtins/understanding.js +24 -6
  170. package/dist/src/cli/commands/connectors.js +1 -1
  171. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  172. package/dist/src/config/schema.d.ts +68 -75
  173. package/dist/src/config/schema.js +29 -18
  174. package/dist/src/config/web-patch.d.ts +1 -1
  175. package/dist/src/connectors/auth-provider-registry.js +1 -1
  176. package/dist/src/connectors/composio-managed-client.js +6 -2
  177. package/dist/src/connectors/connected-source-ingestion.js +1 -1
  178. package/dist/src/connectors/connected-source-understanding.d.ts +1 -3
  179. package/dist/src/connectors/connected-source-understanding.js +86 -99
  180. package/dist/src/connectors/connection-candidates.d.ts +11 -0
  181. package/dist/src/connectors/connection-candidates.js +58 -0
  182. package/dist/src/connectors/connection-capabilities.d.ts +4 -0
  183. package/dist/src/connectors/connection-capabilities.js +37 -0
  184. package/dist/src/connectors/connection-recovery-service.d.ts +43 -0
  185. package/dist/src/connectors/connection-recovery-service.js +420 -0
  186. package/dist/src/connectors/health.js +1 -1
  187. package/dist/src/connectors/learning-coordinator.d.ts +0 -2
  188. package/dist/src/connectors/learning-coordinator.js +6 -7
  189. package/dist/src/connectors/principal.d.ts +5 -0
  190. package/dist/src/connectors/principal.js +18 -0
  191. package/dist/src/files/file-service.js +4 -1
  192. package/dist/src/gateway/agent-builtin-tools.d.ts +28 -10
  193. package/dist/src/gateway/agent-builtin-tools.js +30 -9
  194. package/dist/src/gateway/chat-stream/mapper.js +1 -28
  195. package/dist/src/gateway/chat-stream/protocol.d.ts +2 -24
  196. package/dist/src/gateway/clarify-bridge.d.ts +4 -0
  197. package/dist/src/gateway/clarify-bridge.js +9 -4
  198. package/dist/src/gateway/heartbeat/service.js +1 -1
  199. package/dist/src/gateway/hono/lib/config-payload.d.ts +52 -30
  200. package/dist/src/gateway/hono/lib/config-payload.js +4 -4
  201. package/dist/src/gateway/hono/middleware/auth.js +1 -2
  202. package/dist/src/gateway/hono/routes/capabilities.js +1 -1
  203. package/dist/src/gateway/hono/routes/config-patch/misc.d.ts +1 -1
  204. package/dist/src/gateway/hono/routes/config-patch/misc.js +72 -28
  205. package/dist/src/gateway/hono/routes/connection-waits.d.ts +3 -0
  206. package/dist/src/gateway/hono/routes/connection-waits.js +58 -0
  207. package/dist/src/gateway/hono/routes/connectors.js +24 -18
  208. package/dist/src/gateway/hono/routes/context-sources.d.ts +4 -0
  209. package/dist/src/gateway/hono/routes/context-sources.js +159 -0
  210. package/dist/src/gateway/hono/routes/files.js +23 -2
  211. package/dist/src/gateway/hono/routes/index.js +4 -2
  212. package/dist/src/gateway/hono/routes/lazy-bundles.js +9 -4
  213. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  214. package/dist/src/gateway/hono/routes/notes.js +22 -7
  215. package/dist/src/gateway/hono/routes/projects.js +36 -44
  216. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +15 -1
  217. package/dist/src/gateway/hono/routes/side-chats.js +13 -2
  218. package/dist/src/gateway/hono/routes/tasks.js +3 -3
  219. package/dist/src/gateway/hono/routes/user-model.d.ts +3 -0
  220. package/dist/src/gateway/hono/routes/user-model.js +480 -0
  221. package/dist/src/gateway/memory-maintenance-automation-reconciler.d.ts +11 -0
  222. package/dist/src/gateway/memory-maintenance-automation-reconciler.js +72 -0
  223. package/dist/src/gateway/security/gateway-scopes.js +2 -0
  224. package/dist/src/gateway/service/agent-runner.d.ts +9 -1
  225. package/dist/src/gateway/service/agent-runner.js +25 -1
  226. package/dist/src/gateway/service/config-coordinator.d.ts +2 -2
  227. package/dist/src/gateway/service/config-coordinator.js +4 -4
  228. package/dist/src/gateway/service/run-gateway-agent.d.ts +1 -0
  229. package/dist/src/gateway/service/run-gateway-agent.js +18 -14
  230. package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
  231. package/dist/src/gateway/service/session-input-coordinator.js +12 -2
  232. package/dist/src/gateway/service.d.ts +3 -1
  233. package/dist/src/gateway/service.js +52 -17
  234. package/dist/src/gateway/side-chat/manager.d.ts +16 -3
  235. package/dist/src/gateway/side-chat/manager.js +117 -28
  236. package/dist/src/gateway/side-chat/run-service.d.ts +2 -0
  237. package/dist/src/gateway/side-chat/run-service.js +28 -5
  238. package/dist/src/gateway/side-chat/types.d.ts +9 -1
  239. package/dist/src/heartbeat/index.js +1 -1
  240. package/dist/src/knowledge/connected-knowledge-pipeline.d.ts +0 -2
  241. package/dist/src/knowledge/connected-knowledge-pipeline.js +46 -217
  242. package/dist/src/knowledge-memory/domain.d.ts +36 -0
  243. package/dist/src/knowledge-memory/index.d.ts +2 -0
  244. package/dist/src/knowledge-memory/index.js +2 -0
  245. package/dist/src/knowledge-memory/repository.d.ts +48 -0
  246. package/dist/src/knowledge-memory/repository.js +168 -0
  247. package/dist/src/memory-maintenance/index.d.ts +2 -0
  248. package/dist/src/memory-maintenance/index.js +3 -0
  249. package/dist/src/memory-maintenance/schedule.d.ts +13 -0
  250. package/dist/src/memory-maintenance/schedule.js +51 -0
  251. package/dist/src/memory-maintenance/service.d.ts +28 -0
  252. package/dist/src/memory-maintenance/service.js +216 -0
  253. package/dist/src/notes/service.d.ts +1 -0
  254. package/dist/src/notes/service.js +7 -1
  255. package/dist/src/notes/types.d.ts +16 -0
  256. package/dist/src/notifications/planner.js +7 -3
  257. package/dist/src/proactive/actions/service.d.ts +0 -1
  258. package/dist/src/proactive/actions/service.js +1 -10
  259. package/dist/src/proactive/execution/context.d.ts +8 -10
  260. package/dist/src/proactive/execution/context.js +93 -42
  261. package/dist/src/proactive/execution/insight.d.ts +4 -1
  262. package/dist/src/proactive/execution/insight.js +5 -2
  263. package/dist/src/proactive/execution/repository.d.ts +1 -0
  264. package/dist/src/proactive/execution/repository.js +9 -1
  265. package/dist/src/proactive/execution/types.d.ts +0 -1
  266. package/dist/src/proactive/execution/worker.js +7 -5
  267. package/dist/src/proactive/inbox/repository.js +8 -2
  268. package/dist/src/proactive/inbox/service.js +2 -2
  269. package/dist/src/proactive/inbox/types.d.ts +1 -0
  270. package/dist/src/proactive/inbox/worker.d.ts +1 -0
  271. package/dist/src/proactive/inbox/worker.js +7 -0
  272. package/dist/src/proactive/index.d.ts +2 -1
  273. package/dist/src/proactive/index.js +3 -2
  274. package/dist/src/proactive/maintenance.d.ts +4 -0
  275. package/dist/src/proactive/maintenance.js +21 -0
  276. package/dist/src/proactive/scenarios/repository.d.ts +1 -1
  277. package/dist/src/proactive/scenarios/repository.js +10 -3
  278. package/dist/src/proactive/scenarios/types.d.ts +7 -0
  279. package/dist/src/proactive/service.d.ts +7 -0
  280. package/dist/src/proactive/service.js +17 -1
  281. package/dist/src/projects/index.d.ts +1 -1
  282. package/dist/src/projects/index.js +2 -2
  283. package/dist/src/projects/knowledge-bind.d.ts +1 -0
  284. package/dist/src/projects/knowledge-bind.js +15 -0
  285. package/dist/src/projects/project-loop.d.ts +3 -3
  286. package/dist/src/projects/project-loop.js +4 -4
  287. package/dist/src/projects/project-service.d.ts +2 -1
  288. package/dist/src/projects/project-service.js +3 -2
  289. package/dist/src/projects/project-store.js +2 -1
  290. package/dist/src/realtime/runtime.js +1 -0
  291. package/dist/src/runtime-tools/manager.js +1 -1
  292. package/dist/src/session/index.js +1 -1
  293. package/dist/src/session/store.js +5 -2
  294. package/dist/src/storage/sqlite/collaboration-rule-repository.d.ts +19 -0
  295. package/dist/src/storage/sqlite/collaboration-rule-repository.js +54 -0
  296. package/dist/src/storage/sqlite/config-repository.js +1 -1
  297. package/dist/src/storage/sqlite/connection-wait-repository.d.ts +30 -0
  298. package/dist/src/storage/sqlite/connection-wait-repository.js +338 -0
  299. package/dist/src/storage/sqlite/connector-account-repository.js +1 -1
  300. package/dist/src/storage/sqlite/context-evidence-repository.d.ts +24 -0
  301. package/dist/src/storage/sqlite/context-evidence-repository.js +52 -0
  302. package/dist/src/storage/sqlite/index.d.ts +3 -5
  303. package/dist/src/storage/sqlite/index.js +6 -8
  304. package/dist/src/storage/sqlite/knowledge-repository.d.ts +0 -19
  305. package/dist/src/storage/sqlite/knowledge-repository.js +1 -90
  306. package/dist/src/storage/sqlite/migrations/148_user_model_foundation.sql +554 -0
  307. package/dist/src/storage/sqlite/migrations/149_separate_source_index_from_memory.sql +18 -0
  308. package/dist/src/storage/sqlite/migrations/150_session_connection_waits.sql +47 -0
  309. package/dist/src/storage/sqlite/migrations/151_proactive_scope_cleanup.sql +6 -0
  310. package/dist/src/storage/sqlite/migrations/152_proactive_scenario_contract.sql +140 -0
  311. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  312. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  313. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  314. package/dist/src/storage/sqlite/notes-repository.d.ts +2 -1
  315. package/dist/src/storage/sqlite/notes-repository.js +37 -3
  316. package/dist/src/storage/sqlite/row-mappers.js +2 -2
  317. package/dist/src/storage/sqlite/schema.js +1 -1
  318. package/dist/src/storage/sqlite/session-input-repository.d.ts +14 -2
  319. package/dist/src/storage/sqlite/session-input-repository.js +17 -14
  320. package/dist/src/storage/sqlite/session-instance-repository.d.ts +2 -0
  321. package/dist/src/storage/sqlite/session-instance-repository.js +6 -0
  322. package/dist/src/storage/sqlite/session-repository.d.ts +1 -1
  323. package/dist/src/storage/sqlite/session-repository.js +7 -6
  324. package/dist/src/storage/sqlite/transcript-repository.js +3 -2
  325. package/dist/src/tasks/home-query-service.js +35 -13
  326. package/dist/src/tasks/index.js +2 -2
  327. package/dist/src/tasks/project-monitoring-service.d.ts +2 -0
  328. package/dist/src/tasks/project-monitoring-service.js +4 -1
  329. package/dist/src/tasks/project-operating-view-service.js +1 -1
  330. package/dist/src/tasks/task-application-service.js +6 -1
  331. package/dist/src/tasks/task-context-assembler.js +1 -1
  332. package/dist/src/tasks/task-context-repository.d.ts +0 -1
  333. package/dist/src/tasks/task-context-repository.js +1 -1
  334. package/dist/src/tasks/task-deletion-service.js +1 -1
  335. package/dist/src/tasks/task-handoff-service.js +1 -1
  336. package/dist/src/tasks/task-read-model-projector.js +1 -1
  337. package/dist/src/tasks/task-run-coordinator.js +1 -1
  338. package/dist/src/tasks/task-run-dispatcher.js +1 -1
  339. package/dist/src/tasks/task-run-repository.js +1 -0
  340. package/dist/src/tasks/task-signal-service.js +1 -1
  341. package/dist/src/tui/backends/embedded-backend.js +1 -1
  342. package/dist/src/tui/tool-summary.js +2 -1
  343. package/dist/src/tui/tui-startup-resources.js +1 -1
  344. package/dist/src/user-context/access-policy.d.ts +11 -0
  345. package/dist/src/user-context/access-policy.js +26 -0
  346. package/dist/src/user-context/changes.d.ts +1 -1
  347. package/dist/src/user-context/config.d.ts +135 -153
  348. package/dist/src/user-context/config.js +94 -99
  349. package/dist/src/user-context/relationship-continuity.d.ts +2 -2
  350. package/dist/src/user-context/relationship-continuity.js +34 -24
  351. package/dist/src/user-context/sources/activity-clustering.d.ts +9 -3
  352. package/dist/src/user-context/sources/index.js +2 -2
  353. package/dist/src/user-context/sources/repository.d.ts +1 -21
  354. package/dist/src/user-context/sources/repository.js +1 -183
  355. package/dist/src/user-context/sources/types.d.ts +0 -23
  356. package/dist/src/user-model/capture/executor.d.ts +50 -0
  357. package/dist/src/user-model/capture/executor.js +230 -0
  358. package/dist/src/user-model/capture/index.d.ts +2 -0
  359. package/dist/src/user-model/capture/index.js +3 -0
  360. package/dist/src/user-model/capture/semantic.d.ts +39 -0
  361. package/dist/src/user-model/capture/semantic.js +263 -0
  362. package/dist/src/user-model/domain.d.ts +93 -0
  363. package/dist/src/user-model/domain.js +33 -0
  364. package/dist/src/user-model/goals.d.ts +62 -0
  365. package/dist/src/user-model/goals.js +91 -0
  366. package/dist/src/user-model/importance.d.ts +11 -0
  367. package/dist/src/user-model/importance.js +17 -0
  368. package/dist/src/user-model/index.d.ts +5 -0
  369. package/dist/src/user-model/index.js +6 -0
  370. package/dist/src/user-model/repository.d.ts +23 -0
  371. package/dist/src/user-model/repository.js +268 -0
  372. package/dist/src/user-model/temporal.d.ts +10 -0
  373. package/dist/src/user-model/temporal.js +44 -0
  374. package/dist/src/voice/realtime/memory-context.d.ts +7 -2
  375. package/dist/src/voice/realtime/memory-context.js +39 -51
  376. package/dist/src/work-discovery/service.d.ts +3 -14
  377. package/dist/src/work-discovery/service.js +138 -99
  378. package/dist/src/work-discovery/types.d.ts +3 -3
  379. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  380. package/dist/src/workflows/service/workflow-session-bridge.js +12 -20
  381. package/package.json +3 -3
  382. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CUXApfcE.js +0 -1
  383. package/dist/gateway/static/root/assets/agents-DNq_GKuc.js +0 -1
  384. package/dist/gateway/static/root/assets/app-management-settings-panel-qfwAgyhQ.js +0 -1
  385. package/dist/gateway/static/root/assets/appearance-settings-DqQVUpCC.js +0 -1
  386. package/dist/gateway/static/root/assets/apps-page-dwIqYmXk.js +0 -1
  387. package/dist/gateway/static/root/assets/automations-workspace-SkdcSZ0i.js +0 -6
  388. package/dist/gateway/static/root/assets/browser-settings-page-CKCa6TvG.js +0 -8
  389. package/dist/gateway/static/root/assets/capabilities-settings-panel-DSp--zIZ.js +0 -7
  390. package/dist/gateway/static/root/assets/channels-settings-CMd2dDrI.js +0 -1
  391. package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +0 -1
  392. package/dist/gateway/static/root/assets/connectors-page-udWs5Kdm.js +0 -2
  393. package/dist/gateway/static/root/assets/dependency-picker-DpN3XZg9.js +0 -1
  394. package/dist/gateway/static/root/assets/desktop-pet-settings-DinCToZh.js +0 -1
  395. package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +0 -1
  396. package/dist/gateway/static/root/assets/extension-settings-page-DcguCgsH.js +0 -1
  397. package/dist/gateway/static/root/assets/eye-CABVeTq0.js +0 -1
  398. package/dist/gateway/static/root/assets/eye-off-DEAzt3g1.js +0 -1
  399. package/dist/gateway/static/root/assets/files-D6vf3S30.js +0 -1
  400. package/dist/gateway/static/root/assets/folder-open-CyzJ19I9.js +0 -1
  401. package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +0 -1
  402. package/dist/gateway/static/root/assets/gateway-config-api-Br7lSf6H.js +0 -1
  403. package/dist/gateway/static/root/assets/gateway-settings-CdPoDMuj.js +0 -1
  404. package/dist/gateway/static/root/assets/heartbeat-settings-DHk1hawP.js +0 -1
  405. package/dist/gateway/static/root/assets/home-page-YGipe_W6.js +0 -1
  406. package/dist/gateway/static/root/assets/index-D5TQQpeb.js +0 -71
  407. package/dist/gateway/static/root/assets/index-DReBaaTX.css +0 -2
  408. package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +0 -1
  409. package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +0 -1
  410. package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +0 -1
  411. package/dist/gateway/static/root/assets/local-app-workbench-page-CpyvYyrb.js +0 -2
  412. package/dist/gateway/static/root/assets/local-context-graph-BjUf7fQ9.js +0 -1
  413. package/dist/gateway/static/root/assets/logs-page-CXKy6E_l.js +0 -2
  414. package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +0 -1
  415. package/dist/gateway/static/root/assets/messages-CHNYp8EQ.js +0 -3
  416. package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +0 -1
  417. package/dist/gateway/static/root/assets/mobile-pairing-wizard-3NKCniSp.js +0 -1
  418. package/dist/gateway/static/root/assets/models-hub-cache-nCfkBN8M.js +0 -1
  419. package/dist/gateway/static/root/assets/notes-page-DuqLahi6.js +0 -1
  420. package/dist/gateway/static/root/assets/notes-workbench-C7j9EdQk.js +0 -5
  421. package/dist/gateway/static/root/assets/oauth-api-8lP_qJpq.js +0 -1
  422. package/dist/gateway/static/root/assets/oauth-authorization-window-Cdolr2wE.js +0 -1
  423. package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +0 -1
  424. package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +0 -1
  425. package/dist/gateway/static/root/assets/preview-open-alternatives-CsNVTKC0.js +0 -1
  426. package/dist/gateway/static/root/assets/project-detail-page-CfebYVX0.js +0 -1
  427. package/dist/gateway/static/root/assets/projects-page-48GvzSVa.js +0 -1
  428. package/dist/gateway/static/root/assets/remote-access-hub-64xj_s2m.js +0 -1
  429. package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +0 -1
  430. package/dist/gateway/static/root/assets/search-DA7gz22f.js +0 -1
  431. package/dist/gateway/static/root/assets/sessions-page-CcwcdRN8.js +0 -1
  432. package/dist/gateway/static/root/assets/settings-advanced-gate-BaN84CyW.js +0 -1
  433. package/dist/gateway/static/root/assets/settings-form-section-DjWzRk4z.js +0 -1
  434. package/dist/gateway/static/root/assets/setup-status-panel-DVVOCNbr.js +0 -1
  435. package/dist/gateway/static/root/assets/shares-settings-DUYbYLi7.js +0 -1
  436. package/dist/gateway/static/root/assets/skill-reload-api-BGyD0gB9.js +0 -1
  437. package/dist/gateway/static/root/assets/skills-page-CjF8DTsN.js +0 -2
  438. package/dist/gateway/static/root/assets/system-settings-panel-BSYuRgFI.js +0 -1
  439. package/dist/gateway/static/root/assets/task-detail-page-YZYSTJH7.js +0 -1
  440. package/dist/gateway/static/root/assets/tunnel-api-FKUi9wDL.js +0 -1
  441. package/dist/gateway/static/root/assets/user-context-page-BCyiduKd.js +0 -2
  442. package/dist/gateway/static/root/assets/work-discovery-overlay-jhT2EzeH.js +0 -1
  443. package/dist/gateway/static/root/assets/workflows-page-DQC0TpMa.js +0 -5
  444. package/dist/src/agent/memory/builtin-provider.d.ts +0 -37
  445. package/dist/src/agent/memory/builtin-provider.js +0 -225
  446. package/dist/src/agent/memory/context/types.d.ts +0 -40
  447. package/dist/src/agent/memory/understanding/quality.d.ts +0 -8
  448. package/dist/src/agent/memory/understanding/quality.js +0 -18
  449. package/dist/src/agent/memory/understanding/service.d.ts +0 -19
  450. package/dist/src/agent/memory/understanding/service.js +0 -209
  451. package/dist/src/agent/memory/understanding/types.d.ts +0 -34
  452. package/dist/src/agent/memory/user-context-coordinator.d.ts +0 -23
  453. package/dist/src/agent/memory/user-context-coordinator.js +0 -113
  454. package/dist/src/agent/tools/dreaming-tool.js +0 -37
  455. package/dist/src/agent/tools/memory-tool.d.ts +0 -9
  456. package/dist/src/agent/tools/memory-tool.js +0 -119
  457. package/dist/src/gateway/dreaming-automation-reconciler.d.ts +0 -11
  458. package/dist/src/gateway/dreaming-automation-reconciler.js +0 -63
  459. package/dist/src/gateway/hono/routes/understanding-sources.d.ts +0 -21
  460. package/dist/src/gateway/hono/routes/understanding-sources.js +0 -387
  461. package/dist/src/gateway/hono/routes/you.d.ts +0 -3
  462. package/dist/src/gateway/hono/routes/you.js +0 -457
  463. package/dist/src/projects/memory-bind.d.ts +0 -1
  464. package/dist/src/projects/memory-bind.js +0 -14
  465. package/dist/src/storage/sqlite/context-consolidation-repository.d.ts +0 -37
  466. package/dist/src/storage/sqlite/context-consolidation-repository.js +0 -64
  467. package/dist/src/storage/sqlite/memory-records-repository.d.ts +0 -217
  468. package/dist/src/storage/sqlite/memory-records-repository.js +0 -715
  469. package/dist/src/storage/sqlite/remote-context-repository.d.ts +0 -3
  470. package/dist/src/storage/sqlite/remote-context-repository.js +0 -40
  471. package/dist/src/storage/sqlite/understanding-focus-exclusions.d.ts +0 -2
  472. package/dist/src/storage/sqlite/understanding-focus-exclusions.js +0 -24
  473. package/dist/src/storage/sqlite/user-context-quality-repository.d.ts +0 -49
  474. package/dist/src/storage/sqlite/user-context-quality-repository.js +0 -118
  475. package/dist/src/storage/sqlite/user-context-repository.d.ts +0 -85
  476. package/dist/src/storage/sqlite/user-context-repository.js +0 -535
  477. package/dist/src/user-context/automatic-context.d.ts +0 -17
  478. package/dist/src/user-context/automatic-context.js +0 -85
  479. package/dist/src/user-context/consolidation.d.ts +0 -27
  480. package/dist/src/user-context/consolidation.js +0 -187
  481. package/dist/src/user-context/context-objects.d.ts +0 -17
  482. package/dist/src/user-context/context-objects.js +0 -99
  483. package/dist/src/user-context/evaluation/harness.d.ts +0 -13
  484. package/dist/src/user-context/evaluation/harness.js +0 -31
  485. package/dist/src/user-context/extraction/executor.d.ts +0 -22
  486. package/dist/src/user-context/extraction/executor.js +0 -142
  487. package/dist/src/user-context/extraction/repair.d.ts +0 -19
  488. package/dist/src/user-context/extraction/repair.js +0 -71
  489. package/dist/src/user-context/extraction/semantic.d.ts +0 -18
  490. package/dist/src/user-context/extraction/semantic.js +0 -148
  491. package/dist/src/user-context/focus-lifecycle.d.ts +0 -2
  492. package/dist/src/user-context/focus-lifecycle.js +0 -26
  493. package/dist/src/user-context/manual-understanding.d.ts +0 -12
  494. package/dist/src/user-context/manual-understanding.js +0 -37
  495. package/dist/src/user-context/planner.d.ts +0 -17
  496. package/dist/src/user-context/planner.js +0 -465
  497. package/dist/src/user-context/relationships/indexer.d.ts +0 -13
  498. package/dist/src/user-context/relationships/indexer.js +0 -185
  499. package/dist/src/user-context/relationships/service.d.ts +0 -22
  500. package/dist/src/user-context/relationships/service.js +0 -50
  501. package/dist/src/user-context/retriever.d.ts +0 -15
  502. package/dist/src/user-context/retriever.js +0 -124
  503. package/dist/src/user-context/scope.d.ts +0 -7
  504. package/dist/src/user-context/scope.js +0 -9
  505. package/dist/src/user-context/selection-policy.d.ts +0 -20
  506. package/dist/src/user-context/selection-policy.js +0 -33
  507. package/dist/src/user-context/understanding.d.ts +0 -15
  508. package/dist/src/user-context/understanding.js +0 -24
  509. package/dist/src/user-context/understandingQuality.d.ts +0 -5
  510. package/dist/src/user-context/understandingQuality.js +0 -48
  511. /package/dist/src/agent/{memory/context/types.js → context/execution-context.types.js} +0 -0
  512. /package/dist/src/{agent/memory/understanding/types.js → knowledge-memory/domain.js} +0 -0
@@ -0,0 +1,159 @@
1
+ import { getSqliteDatabase } from "../../../storage/sqlite/transaction.js";
2
+ import { countKnowledgeSourceItems, deleteKnowledgeSourceItems } from "../../../storage/sqlite/knowledge-repository.js";
3
+ import { getConnectorAccount } from "../../../storage/sqlite/connector-account-repository.js";
4
+ import "../../../storage/sqlite/index.js";
5
+ import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
6
+ import { setAssertionStatus } from "../../../user-model/repository.js";
7
+ import "../../../user-model/index.js";
8
+ import { listConnectedContentCandidates, readConnectedContent } from "../../../connectors/content-enrichment.js";
9
+ import { getUnderstandingSourceGrant, listUnderstandingSourceGrants, listUnderstandingSourceRuns, revokeUnderstandingSourceGrant, updateUnderstandingSourceGrantPolicies } from "../../../user-context/sources/repository.js";
10
+ import { getWorkDiscoveryService } from "./work-discovery.js";
11
+ import { listUnderstandingSourceDefinitions } from "../../../user-context/sources/catalog.js";
12
+ import { randomUUID } from "node:crypto";
13
+ //#region src/gateway/hono/routes/context-sources.ts
14
+ init_agent_scope();
15
+ function stringField(value, field) {
16
+ if (!value || typeof value !== "object") return "";
17
+ const fieldValue = value[field];
18
+ return typeof fieldValue === "string" ? fieldValue.trim() : "";
19
+ }
20
+ function sourceInstanceId(grant) {
21
+ const accountId = typeof grant.config.accountId === "string" ? grant.config.accountId : void 0;
22
+ const connectorId = typeof grant.config.connectorId === "string" ? grant.config.connectorId : void 0;
23
+ return accountId && connectorId ? `composio:${connectorId}:${accountId}` : void 0;
24
+ }
25
+ function assertionIdsForSource(instanceId) {
26
+ return getSqliteDatabase().prepare(`SELECT DISTINCT ae.assertion_id
27
+ FROM user_assertion_evidence ae JOIN context_evidence e ON e.evidence_id = ae.evidence_id
28
+ WHERE e.source_instance_id = ?`).all(instanceId).map((row) => row.assertion_id);
29
+ }
30
+ function markContextSourceAssertionsForReview(grantId) {
31
+ const grant = getUnderstandingSourceGrant(grantId);
32
+ const instanceId = grant ? sourceInstanceId(grant) : void 0;
33
+ const ids = instanceId ? assertionIdsForSource(instanceId) : [];
34
+ for (const id of ids) setAssertionStatus(id, "needs_review", {
35
+ actor: "runtime",
36
+ reason: "Its context source was revoked."
37
+ });
38
+ return ids.length;
39
+ }
40
+ function registerContextSourceRoutes(authenticated, deps) {
41
+ const service = getWorkDiscoveryService(deps);
42
+ const limited = deps.strictRateLimitMiddleware;
43
+ authenticated.get("/api/context-sources/catalog", (c) => {
44
+ const requested = c.req.query("platform");
45
+ const platform = requested === "darwin" || requested === "win32" || requested === "linux" ? requested : process.platform;
46
+ return c.json({ sources: listUnderstandingSourceDefinitions(platform) });
47
+ });
48
+ authenticated.get("/api/context-sources/grants", (c) => {
49
+ const grants = listUnderstandingSourceGrants({ includeRevoked: c.req.query("includeRevoked") === "true" });
50
+ return c.json({
51
+ grants,
52
+ latestRuns: Object.fromEntries(grants.flatMap((grant) => {
53
+ const run = listUnderstandingSourceRuns(grant.id, 1)[0];
54
+ return run ? [[grant.id, run]] : [];
55
+ }))
56
+ });
57
+ });
58
+ authenticated.patch("/api/context-sources/grants/:grantId", limited, async (c) => {
59
+ const input = await c.req.json().catch(() => null);
60
+ if (!input) return c.json({ error: "Invalid JSON" }, 400);
61
+ const accessMode = input.accessMode;
62
+ const retentionPolicy = input.retentionPolicy;
63
+ const processingPolicy = input.processingPolicy;
64
+ if (accessMode !== void 0 && accessMode !== "once" && accessMode !== "continuous") return c.json({ error: "Invalid access mode" }, 400);
65
+ if (retentionPolicy !== void 0 && ![
66
+ "metadata_only",
67
+ "derived_only",
68
+ "bounded_raw"
69
+ ].includes(String(retentionPolicy))) return c.json({ error: "Invalid retention policy" }, 400);
70
+ if (processingPolicy !== void 0 && processingPolicy !== "local_only" && processingPolicy !== "remote_allowed") return c.json({ error: "Invalid processing policy" }, 400);
71
+ const grant = updateUnderstandingSourceGrantPolicies(c.req.param("grantId"), {
72
+ ...accessMode ? { accessMode } : {},
73
+ ...retentionPolicy ? { retentionPolicy } : {},
74
+ ...processingPolicy ? { processingPolicy } : {}
75
+ });
76
+ return grant ? c.json({ grant }) : c.json({ error: "Context source not found" }, 404);
77
+ });
78
+ authenticated.delete("/api/context-sources/grants/:grantId", limited, (c) => {
79
+ const current = getUnderstandingSourceGrant(c.req.param("grantId"));
80
+ if (!current) return c.json({ error: "Context source not found" }, 404);
81
+ const instanceId = sourceInstanceId(current);
82
+ const affectedAssertions = markContextSourceAssertionsForReview(current.id);
83
+ const rawDeleted = c.req.query("deleteRaw") === "true" && instanceId ? deleteKnowledgeSourceItems(instanceId) : 0;
84
+ const accountId = typeof current.config.accountId === "string" ? current.config.accountId : void 0;
85
+ const connectionId = accountId ? getConnectorAccount(accountId)?.currentConnectionId : void 0;
86
+ if (connectionId) deps.service.setConnectorLearningPaused(connectionId, true);
87
+ return c.json({
88
+ grant: revokeUnderstandingSourceGrant(current.id),
89
+ affectedAssertions,
90
+ rawDeleted
91
+ });
92
+ });
93
+ authenticated.get("/api/context-sources/content-candidates", (c) => c.json({ candidates: listConnectedContentCandidates({ agentId: resolveDefaultAgentId(deps.service.currentConfig) }) }));
94
+ authenticated.post("/api/context-sources/content-reads", limited, async (c) => {
95
+ const input = await c.req.json().catch(() => null);
96
+ const sourceItemIds = input && typeof input === "object" && Array.isArray(input.sourceItemIds) ? input.sourceItemIds.filter((item) => typeof item === "string") : [];
97
+ try {
98
+ return c.json({ result: await readConnectedContent({
99
+ sourceItemIds,
100
+ agentId: resolveDefaultAgentId(deps.service.currentConfig)
101
+ }) });
102
+ } catch (error) {
103
+ return c.json({ error: error instanceof Error ? error.message : String(error) }, 400);
104
+ }
105
+ });
106
+ authenticated.post("/api/context-sources/grants/:grantId/refresh", limited, async (c) => {
107
+ const grant = getUnderstandingSourceGrant(c.req.param("grantId"));
108
+ if (!grant || grant.status !== "active") return c.json({ error: "Active context source not found" }, 404);
109
+ try {
110
+ if (grant.adapterId === "local-work-folders") {
111
+ const result = await service.refreshDirectorySourceIfChanged({
112
+ id: grant.id,
113
+ idempotencyKey: randomUUID()
114
+ });
115
+ return c.json({ result }, result.changed ? 202 : 200);
116
+ }
117
+ const accountId = typeof grant.config.accountId === "string" ? grant.config.accountId : "";
118
+ const connectionId = accountId ? getConnectorAccount(accountId)?.currentConnectionId : void 0;
119
+ const job = connectionId ? deps.service.requestConnectorLearning(connectionId, {
120
+ mode: "incremental",
121
+ reason: "manual"
122
+ }) : null;
123
+ return job ? c.json({ job }, 202) : c.json({ error: "Context source cannot be refreshed here" }, 409);
124
+ } catch (error) {
125
+ return c.json({ error: error instanceof Error ? error.message : String(error) }, 400);
126
+ }
127
+ });
128
+ authenticated.get("/api/context-sources/work-folders", (c) => c.json({ sources: service.listDirectorySources() }));
129
+ authenticated.post("/api/context-sources/work-folders", limited, async (c) => {
130
+ const input = await c.req.json().catch(() => null);
131
+ const rootPath = stringField(input, "rootPath");
132
+ const processingPolicy = stringField(input, "processingPolicy");
133
+ if (!rootPath || processingPolicy !== "local_only" && processingPolicy !== "remote_allowed") return c.json({ error: "rootPath and an explicit processingPolicy are required" }, 400);
134
+ try {
135
+ return c.json({ source: await service.grantDirectorySource(rootPath, processingPolicy) }, 201);
136
+ } catch (error) {
137
+ return c.json({ error: error instanceof Error ? error.message : String(error) }, 400);
138
+ }
139
+ });
140
+ authenticated.post("/api/context-sources/bootstrap", limited, async (c) => {
141
+ const input = await c.req.json().catch(() => null);
142
+ const items = input && typeof input === "object" && Array.isArray(input.items) ? input.items.slice(0, 1200) : [];
143
+ const processingPolicy = stringField(input, "processingPolicy");
144
+ if (!items.length || processingPolicy !== "local_only" && processingPolicy !== "remote_allowed") return c.json({ error: "items and an explicit processingPolicy are required" }, 400);
145
+ try {
146
+ const result = await service.importUnderstandingSources(items, processingPolicy, c.req.raw.signal);
147
+ return c.json(result, 201);
148
+ } catch (error) {
149
+ return c.json({ error: error instanceof Error ? error.message : String(error) }, 400);
150
+ }
151
+ });
152
+ authenticated.get("/api/context-sources/:grantId/raw-count", (c) => {
153
+ const grant = getUnderstandingSourceGrant(c.req.param("grantId"));
154
+ const instanceId = grant ? sourceInstanceId(grant) : void 0;
155
+ return grant ? c.json({ count: instanceId ? countKnowledgeSourceItems(instanceId) : 0 }) : c.json({ error: "Context source not found" }, 404);
156
+ });
157
+ }
158
+ //#endregion
159
+ export { markContextSourceAssertionsForReview, registerContextSourceRoutes };
@@ -1,9 +1,9 @@
1
- import { FileServiceError, fileResourceFromPath, resolveFilePath } from "../../../files/file-service.js";
1
+ import { FileServiceError, fileResourceFromPath, parseFileResourceId, resolveFilePath } from "../../../files/file-service.js";
2
2
  import { getGatewayFileSpaceService } from "../../file-space-service.js";
3
3
  import { fuzzySearchWorkspaceFiles, fuzzySubsequenceScore } from "../../workspace-file-search.js";
4
4
  import { registerFileReferenceRoutes } from "./file-references.js";
5
5
  import { basename, join } from "node:path";
6
- import { readFile, writeFile } from "node:fs/promises";
6
+ import { readFile, unlink, writeFile } from "node:fs/promises";
7
7
  //#region src/gateway/hono/routes/files.ts
8
8
  const mutationLocks = /* @__PURE__ */ new Map();
9
9
  async function withMutationLock(key, action) {
@@ -185,6 +185,27 @@ function registerFilesRoutes(authenticated, deps) {
185
185
  return errorResponse(c, error);
186
186
  }
187
187
  });
188
+ authenticated.delete("/api/files/:id", async (c) => {
189
+ try {
190
+ const id = c.req.param("id");
191
+ const initial = await files.resource(id);
192
+ if (!initial.space.writable) throw new FileServiceError(403, "File space is read-only");
193
+ if (initial.resource.kind !== "file") throw new FileServiceError(400, "Resource is not a file");
194
+ await withMutationLock(initial.absolutePath, async () => {
195
+ const current = await files.resource(id);
196
+ if (current.absolutePath !== initial.absolutePath) throw new FileServiceError(409, "File has changed");
197
+ if (current.resource.kind !== "file") throw new FileServiceError(400, "Resource is not a file");
198
+ const { relativePath } = parseFileResourceId(id);
199
+ await unlink(await resolveFilePath(current.space.root, relativePath, false)).catch((error) => {
200
+ if (error.code === "ENOENT") throw new FileServiceError(404, "File not found");
201
+ throw error;
202
+ });
203
+ });
204
+ return c.json({ ok: true });
205
+ } catch (error) {
206
+ return errorResponse(c, error);
207
+ }
208
+ });
188
209
  authenticated.post("/api/files/spaces/:id/upload", async (c) => {
189
210
  try {
190
211
  const space = await files.get(c.req.param("id"));
@@ -1,3 +1,4 @@
1
+ import { registerConnectionWaitRoutes } from "./connection-waits.js";
1
2
  import { registerActivityRoutes } from "./activity.js";
2
3
  import { registerAgentStreamRoutes } from "./agent-stream.js";
3
4
  import { registerDiscussionRoutes } from "./discussions.js";
@@ -17,7 +18,7 @@ import { registerRealtimeRoutes } from "./realtime.js";
17
18
  import { registerDeviceRoutes } from "./devices.js";
18
19
  import { registerLocalAppsRoutes } from "./local-apps.js";
19
20
  import { registerWorkDiscoveryRoutes } from "./work-discovery.js";
20
- import { registerUnderstandingSourceRoutes } from "./understanding-sources.js";
21
+ import { registerContextSourceRoutes } from "./context-sources.js";
21
22
  import { registerTaskRoutes } from "./tasks.js";
22
23
  import { registerProactiveRoutes } from "./proactive.js";
23
24
  import { registerMobilePrivacyRoutes } from "./mobile-privacy.js";
@@ -28,6 +29,7 @@ function registerCoreAuthenticatedRoutes(authenticated, deps) {
28
29
  registerMobilePrivacyRoutes(authenticated, deps);
29
30
  registerAgentStreamRoutes(authenticated, deps);
30
31
  registerSessionsRoutes(authenticated, deps);
32
+ registerConnectionWaitRoutes(authenticated, deps);
31
33
  registerExecutionEnvironmentRoutes(authenticated, deps);
32
34
  registerSideChatRoutes(authenticated, deps);
33
35
  registerActivityRoutes(authenticated, deps);
@@ -36,7 +38,7 @@ function registerCoreAuthenticatedRoutes(authenticated, deps) {
36
38
  registerProjectSkillRoutes(authenticated, deps);
37
39
  registerLocalAppsRoutes(authenticated, deps);
38
40
  registerWorkDiscoveryRoutes(authenticated, deps);
39
- registerUnderstandingSourceRoutes(authenticated, deps);
41
+ registerContextSourceRoutes(authenticated, deps);
40
42
  registerTaskRoutes(authenticated, deps);
41
43
  registerProactiveRoutes(authenticated, deps);
42
44
  registerSearchRoutes(authenticated, deps);
@@ -279,11 +279,16 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
279
279
  }
280
280
  },
281
281
  {
282
- id: "you",
283
- match: (path) => startsWithAny(path, ["/api/you"]),
282
+ id: "user-model",
283
+ match: (path) => startsWithAny(path, [
284
+ "/api/user-model",
285
+ "/api/knowledge-memory",
286
+ "/api/memory-maintenance",
287
+ "/api/turns"
288
+ ]),
284
289
  load: async () => {
285
- const { registerYouRoutes } = await import("./you.js");
286
- return { register: registerYouRoutes };
290
+ const { registerUserModelRoutes } = await import("./user-model.js");
291
+ return { register: registerUserModelRoutes };
287
292
  }
288
293
  },
289
294
  {
@@ -1,8 +1,8 @@
1
1
  import { canonicalizeConfiguredMcpServer, normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
2
2
  import { loadMergedBundleMcpConfig } from "../../../agent/mcp/bundle-mcp-config.js";
3
+ import { isManagedConnectorServer } from "../../../connectors/materialize.js";
3
4
  import { getWorkspacePath } from "../../../config/workspace-path-helpers.js";
4
5
  import { getMcpOAuthManager } from "../../../agent/mcp/oauth/mcp-oauth-manager.js";
5
- import { isManagedConnectorServer } from "../../../connectors/materialize.js";
6
6
  import { listBundleMcpServerCapabilitiesForGateway, listBundleMcpServerToolsForGateway } from "../../../agent/mcp/bundle-mcp-gateway.js";
7
7
  //#region src/gateway/hono/routes/mcp.ts
8
8
  function registerMcpRoutes(authenticated, deps) {
@@ -134,6 +134,8 @@ function registerNotesRoutes(authenticated, deps) {
134
134
  kind: kind && VALID_KINDS.has(kind) ? kind : void 0,
135
135
  tag: tag || void 0,
136
136
  projectId: projectId || void 0,
137
+ unassigned: c.req.query("unassigned") === "true" || void 0,
138
+ agentEdited: c.req.query("agentEdited") === "true" || void 0,
137
139
  search: search || void 0,
138
140
  pinned: pinnedRaw === "true" ? true : pinnedRaw === "false" ? false : void 0,
139
141
  limit: limitRaw ? parseInt(limitRaw, 10) : void 0,
@@ -143,6 +145,9 @@ function registerNotesRoutes(authenticated, deps) {
143
145
  });
144
146
  return c.json(result);
145
147
  });
148
+ authenticated.get("/api/notes/project-summaries", (c) => {
149
+ return c.json({ items: service.notesServiceInstance.listProjectSummaries() });
150
+ });
146
151
  authenticated.post("/api/notes", async (c) => {
147
152
  const contentType = c.req.header("content-type") || "";
148
153
  const idempotencyKey = readIdempotencyKey(c.req.header("idempotency-key"));
@@ -246,7 +251,10 @@ function registerNotesRoutes(authenticated, deps) {
246
251
  if (!note) return c.json(noteNotFound(), 404);
247
252
  const body = await c.req.json().catch(() => ({}));
248
253
  const routingCfg = service.currentConfig;
249
- let agentId = typeof body.agentId === "string" && body.agentId.trim() ? body.agentId.trim().toLowerCase() : getDefaultAgentId(routingCfg);
254
+ const projectId = typeof body.projectId === "string" ? body.projectId.trim() : void 0;
255
+ const project = projectId ? service.projects.get(projectId) : void 0;
256
+ if (projectId && !project) return c.json({ error: "Project not found" }, 400);
257
+ let agentId = typeof body.agentId === "string" && body.agentId.trim() ? body.agentId.trim().toLowerCase() : project?.defaultAgentId ?? getDefaultAgentId(routingCfg);
250
258
  if (!agentExists(agentId, routingCfg)) agentId = getDefaultAgentId(routingCfg);
251
259
  const sourceBinding = {
252
260
  kind: "note",
@@ -260,11 +268,14 @@ function registerNotesRoutes(authenticated, deps) {
260
268
  const existingSession = await service.sessions.getSession(existingKey);
261
269
  if (existingSession) {
262
270
  const meta = await service.sessionIndexInstance.getSessionMetadata(existingKey);
263
- await service.sessionIndexInstance.updateSessionMetadata(existingKey, { customData: {
264
- ...meta?.customData ?? {},
265
- genericNewChatShell: false,
266
- sourceBinding
267
- } });
271
+ await service.sessionIndexInstance.updateSessionMetadata(existingKey, {
272
+ ...projectId ? { projectId } : {},
273
+ customData: {
274
+ ...meta?.customData ?? {},
275
+ genericNewChatShell: false,
276
+ sourceBinding
277
+ }
278
+ });
268
279
  return c.json({
269
280
  session: existingSession,
270
281
  sessionKey: existingKey,
@@ -282,6 +293,7 @@ function registerNotesRoutes(authenticated, deps) {
282
293
  peerId
283
294
  });
284
295
  await service.sessionIndexInstance.saveMessages(sessionKey, [], { metadata: {
296
+ ...projectId ? { projectId } : {},
285
297
  sourceChannel: "webchat",
286
298
  sourceChatId: `default:direct:${peerId}`,
287
299
  sessionType: "chat",
@@ -296,6 +308,7 @@ function registerNotesRoutes(authenticated, deps) {
296
308
  } });
297
309
  const meta = await service.sessionIndexInstance.getSessionMetadata(sessionKey);
298
310
  await service.sessionIndexInstance.updateSessionMetadata(sessionKey, {
311
+ ...projectId ? { projectId } : {},
299
312
  name: noteThreadName(note),
300
313
  tags: Array.from(new Set([...meta?.tags ?? [], "note"])),
301
314
  customData: {
@@ -538,6 +551,8 @@ function registerNotesRoutes(authenticated, deps) {
538
551
  });
539
552
  authenticated.post("/api/notes/:id/media", async (c) => {
540
553
  const noteId = c.req.param("id");
554
+ const idempotencyKey = readIdempotencyKey(c.req.header("idempotency-key"));
555
+ if (idempotencyKey && idempotencyKey.length > 200) return c.json({ error: "Idempotency-Key is too long" }, 400);
541
556
  let body;
542
557
  try {
543
558
  body = await c.req.parseBody({ all: true });
@@ -562,7 +577,7 @@ function registerNotesRoutes(authenticated, deps) {
562
577
  buffer: buf,
563
578
  mimeType,
564
579
  duration: Number.isFinite(duration) ? duration : void 0
565
- });
580
+ }, idempotencyKey);
566
581
  if (!attachment) return c.json(noteNotFound(), 404);
567
582
  return c.json({ attachment }, 201);
568
583
  });
@@ -1,7 +1,6 @@
1
1
  import { getSqliteDatabase } from "../../../storage/sqlite/transaction.js";
2
2
  import { getSessionMetadata } from "../../../storage/sqlite/session-repository.js";
3
3
  import { loadTranscriptRowsForSession } from "../../../storage/sqlite/transcript-repository.js";
4
- import { listMemoryRecords, upsertMemoryRecord } from "../../../storage/sqlite/memory-records-repository.js";
5
4
  import "../../../storage/sqlite/index.js";
6
5
  import { ActivityService } from "../../../activity/service.js";
7
6
  import "../../../activity/index.js";
@@ -9,6 +8,8 @@ import { resolveEffectiveAgentProfile } from "../../../config/agent-profile.js";
9
8
  import { TaskRepository } from "../../../tasks/task-repository.js";
10
9
  import { TaskReadModelProjector } from "../../../tasks/task-read-model-projector.js";
11
10
  import { ExecutionEnvironmentStore } from "../../../execution-environments/store.js";
11
+ import { listKnowledgeItems, writeKnowledgeItem } from "../../../knowledge-memory/repository.js";
12
+ import "../../../knowledge-memory/index.js";
12
13
  import { ProjectWorkspaceConflictError, ProjectWorkspaceMissingError } from "../../../projects/workspace-project.js";
13
14
  import { inferProjectExecutionMode, inferProjectKind } from "../../../projects/project-kind.js";
14
15
  import { isValidProjectAgentId, normalizeProjectAgentId, resolveProjectAgentId } from "../../../projects/project-agent.js";
@@ -96,7 +97,7 @@ function textFromTranscriptContent(content) {
96
97
  return typeof record.text === "string" ? record.text : "";
97
98
  }).filter(Boolean).join("\n");
98
99
  }
99
- function buildSessionSummaryMemoryContent(sessionKey, explicitSummary) {
100
+ function buildSessionSummaryKnowledgeContent(sessionKey, explicitSummary) {
100
101
  const summary = explicitSummary?.trim();
101
102
  if (summary) return summary;
102
103
  const lines = loadTranscriptRowsForSession(sessionKey).filter((row) => {
@@ -125,7 +126,7 @@ function listFailedProjectWorkflowRuns(projectId, limit = 5) {
125
126
  errorMessage: row.error_message ?? void 0
126
127
  }));
127
128
  }
128
- function buildProjectDigestMemoryContent(input) {
129
+ function buildProjectDigestKnowledgeContent(input) {
129
130
  const lines = [
130
131
  `Project digest: ${input.projectName}`,
131
132
  `Status: ${input.digest.summary}`,
@@ -141,9 +142,6 @@ function buildProjectDigestMemoryContent(input) {
141
142
  }
142
143
  return lines.join("\n");
143
144
  }
144
- function projectDigestMemoryRecordId(projectId) {
145
- return `project-digest:${projectId}`;
146
- }
147
145
  function registerProjectsRoutes(authenticated, deps) {
148
146
  const { service } = deps;
149
147
  const activity = new ActivityService();
@@ -343,7 +341,7 @@ function registerProjectsRoutes(authenticated, deps) {
343
341
  ...result
344
342
  });
345
343
  });
346
- authenticated.post("/api/projects/:id/digest-memory", async (c) => {
344
+ authenticated.post("/api/projects/:id/digest-knowledge", async (c) => {
347
345
  const project = service.projects.getWithDetails(c.req.param("id"));
348
346
  if (!project) return c.json({
349
347
  ok: false,
@@ -365,40 +363,37 @@ function registerProjectsRoutes(authenticated, deps) {
365
363
  }),
366
364
  recentWorkflowRuns: project.recentWorkflowRuns,
367
365
  failedWorkflowRuns: listFailedProjectWorkflowRuns(project.id),
368
- memoryRecords: listMemoryRecords({
369
- projectId: project.id,
370
- status: "active",
371
- limit: 5
372
- })
366
+ knowledgeItems: listKnowledgeItems({
367
+ statuses: ["active"],
368
+ limit: 500
369
+ }).filter((item) => item.scope.type === "project" && item.scope.id === project.id).slice(0, 5)
373
370
  });
374
- const record = upsertMemoryRecord({
375
- id: projectDigestMemoryRecordId(project.id),
376
- providerId: "local",
377
- kind: "daily_note",
371
+ const record = writeKnowledgeItem({
372
+ kind: "note",
373
+ scope: {
374
+ type: "project",
375
+ id: project.id
376
+ },
378
377
  sourceAgentId: resolveProjectAgentId({
379
378
  config: service.currentConfig,
380
379
  projects: service.projects,
381
380
  projectId: project.id
382
381
  }),
383
- workspaceId: project.workspaceRoot,
384
- projectId: project.id,
385
- content: buildProjectDigestMemoryContent({
382
+ content: buildProjectDigestKnowledgeContent({
386
383
  ...loop,
387
384
  projectName: project.name
388
385
  }),
386
+ canonicalKey: `project-digest:${project.id}`,
389
387
  source: { provider: "project-digest" },
390
388
  confidence: .75,
391
- tags: [
392
- "project",
393
- "project-digest",
394
- project.slug
395
- ],
389
+ importance: .7,
396
390
  status: "active",
397
- sensitivity: "normal"
391
+ originClass: "system",
392
+ replaceExisting: true
398
393
  });
399
394
  return c.json({
400
395
  ok: true,
401
- record
396
+ knowledge: record.item
402
397
  }, 201);
403
398
  });
404
399
  authenticated.post("/api/projects/:id/blockers", async (c) => {
@@ -755,11 +750,10 @@ function registerProjectsRoutes(authenticated, deps) {
755
750
  }, 404);
756
751
  }
757
752
  });
758
- authenticated.post("/api/projects/:id/sessions/:sessionKey/summary-memory", async (c) => {
753
+ authenticated.post("/api/projects/:id/sessions/:sessionKey/summary-knowledge", async (c) => {
759
754
  const projectId = c.req.param("id");
760
755
  const sessionKey = c.req.param("sessionKey");
761
- const project = service.projects.get(projectId);
762
- if (!project) return c.json({
756
+ if (!service.projects.get(projectId)) return c.json({
763
757
  ok: false,
764
758
  error: "Project not found"
765
759
  }, 404);
@@ -773,32 +767,30 @@ function registerProjectsRoutes(authenticated, deps) {
773
767
  error: "Session is not attached to this project"
774
768
  }, 409);
775
769
  const body = await c.req.json().catch(() => ({}));
776
- const content = buildSessionSummaryMemoryContent(sessionKey, typeof body.summary === "string" ? body.summary : void 0);
777
- const record = upsertMemoryRecord({
778
- providerId: "local",
779
- kind: "session_summary",
770
+ const content = buildSessionSummaryKnowledgeContent(sessionKey, typeof body.summary === "string" ? body.summary : void 0);
771
+ const record = writeKnowledgeItem({
772
+ kind: "episode",
773
+ scope: {
774
+ type: "project",
775
+ id: projectId
776
+ },
780
777
  sourceAgentId: session.routing?.agentId ?? "main",
781
- workspaceId: session.cwd,
782
- sessionKey,
783
- projectId,
778
+ sourceSessionId: sessionKey,
784
779
  content,
780
+ canonicalKey: `project-session-summary:${projectId}:${sessionKey}`,
785
781
  source: {
786
782
  provider: "project-summary",
787
783
  sessionEntryId: sessionKey
788
784
  },
789
785
  confidence: typeof body.confidence === "number" ? body.confidence : .7,
790
- tags: [
791
- "project",
792
- "session-summary",
793
- project.slug
794
- ],
786
+ importance: .6,
795
787
  status: "active",
796
- sensitivity: "normal",
797
- evidence: [{ sessionKey }]
788
+ originClass: "agent",
789
+ replaceExisting: true
798
790
  });
799
791
  return c.json({
800
792
  ok: true,
801
- record
793
+ knowledge: record.item
802
794
  }, 201);
803
795
  });
804
796
  }
@@ -21,7 +21,7 @@ export declare function submitSessionInput(c: Context, deps: AuthenticatedRouteD
21
21
  }, 409, "json">) | (Response & import("hono").TypedResponse<{
22
22
  ok: false;
23
23
  error: {
24
- code: "BAD_REQUEST" | "QUEUE_FULL" | "CONTEXT_UNAVAILABLE" | "SESSION_CHANGED";
24
+ code: "SESSION_CHANGED" | "BAD_REQUEST" | "QUEUE_FULL" | "CONTEXT_UNAVAILABLE";
25
25
  message: string;
26
26
  };
27
27
  }, 400 | 409, "json">) | (Response & import("hono").TypedResponse<{
@@ -44,6 +44,13 @@ export declare function submitSessionInput(c: Context, deps: AuthenticatedRouteD
44
44
  effectiveDelivery: import("../../../storage/sqlite/session-input-repository.js").SessionInputDelivery;
45
45
  status: import("../../../storage/sqlite/session-input-repository.js").SessionInputStatus;
46
46
  content: string;
47
+ taskRunId?: string;
48
+ kind: "message" | "connection_resume";
49
+ payload?: {
50
+ waitId: string;
51
+ objectiveRevision: number;
52
+ resolution: "continued" | "skipped";
53
+ };
47
54
  attachments?: import("hono/dist/types/utils/types.js").JSONValue[];
48
55
  contextRefs?: {
49
56
  kind: import("../../../agent/source-context/types.js").AgentSourceContext["kind"];
@@ -133,6 +140,13 @@ export declare function replaceLatestSessionTurn(c: Context, deps: Authenticated
133
140
  effectiveDelivery: import("../../../storage/sqlite/session-input-repository.js").SessionInputDelivery;
134
141
  status: import("../../../storage/sqlite/session-input-repository.js").SessionInputStatus;
135
142
  content: string;
143
+ taskRunId?: string;
144
+ kind: "message" | "connection_resume";
145
+ payload?: {
146
+ waitId: string;
147
+ objectiveRevision: number;
148
+ resolution: "continued" | "skipped";
149
+ };
136
150
  attachments?: import("hono/dist/types/utils/types.js").JSONValue[];
137
151
  contextRefs?: {
138
152
  kind: import("../../../agent/source-context/types.js").AgentSourceContext["kind"];
@@ -87,6 +87,16 @@ function registerSideChatRoutes(authenticated, deps) {
87
87
  return respondSideChatError(c, error);
88
88
  }
89
89
  });
90
+ authenticated.post("/api/side-chats/:sideChatId/extend", deps.chatRateLimitMiddleware, (c) => {
91
+ try {
92
+ return c.json({
93
+ ok: true,
94
+ sideChat: service.sideChats.extend(c.req.param("sideChatId"), readClientInstanceId(c))
95
+ });
96
+ } catch (error) {
97
+ return respondSideChatError(c, error);
98
+ }
99
+ });
90
100
  authenticated.post("/api/side-chats/:sideChatId/inputs", deps.chatRateLimitMiddleware, async (c) => {
91
101
  try {
92
102
  const body = await c.req.json().catch(() => ({}));
@@ -162,11 +172,12 @@ function respondSideChatError(c, error) {
162
172
  code: "INTERNAL_ERROR"
163
173
  }, 500);
164
174
  }
165
- const status = error.code === "NOT_FOUND" ? 404 : error.code === "CONFLICT" ? 409 : error.code === "LIMIT_REACHED" ? 429 : 400;
175
+ const status = error.code === "EXPIRED" ? 410 : error.code === "NOT_FOUND" || error.code === "PARENT_NOT_FOUND" ? 404 : error.code === "CONFLICT" ? 409 : error.code === "CAPACITY_REACHED" ? 503 : error.code === "LIMIT_REACHED" ? 429 : 400;
166
176
  return c.json({
167
177
  ok: false,
168
178
  error: error.message,
169
- code: error.code
179
+ code: error.code,
180
+ reason: error.reason
170
181
  }, status);
171
182
  }
172
183
  //#endregion
@@ -2,10 +2,10 @@ import { runSqliteWriteTransaction } from "../../../storage/sqlite/transaction.j
2
2
  import { TaskPhaseSchema } from "../../../../packages/gateway-contract/src/task-lifecycle.js";
3
3
  import { TaskBoardPositionRequestSchema, TaskCommandRequestSchema, TaskContextInputSchema, TaskCreateRequestSchema, TaskDependencyUpdateRequestSchema, TaskHandoffRequestSchema, TaskPatchRequestSchema } from "../../../../packages/gateway-contract/src/tasks.js";
4
4
  import { ProjectMonitoringUpdateSchema } from "../../../../packages/gateway-contract/src/project-monitoring.js";
5
- import { TaskRepository } from "../../../tasks/task-repository.js";
6
- import { TaskConversationRepository } from "../../../tasks/task-conversation-repository.js";
7
5
  import { enqueueTaskChangedEvent } from "../../../tasks/task-change-events.js";
8
6
  import { TaskRunRepository } from "../../../tasks/task-run-repository.js";
7
+ import { TaskRepository } from "../../../tasks/task-repository.js";
8
+ import { TaskConversationRepository } from "../../../tasks/task-conversation-repository.js";
9
9
  import { TaskReadModelProjector } from "../../../tasks/task-read-model-projector.js";
10
10
  import { resolveProjectAgentId } from "../../../projects/project-agent.js";
11
11
  import { TaskContextRepository } from "../../../tasks/task-context-repository.js";
@@ -25,7 +25,7 @@ function registerTaskRoutes(authenticated, deps) {
25
25
  const taskRateLimit = deps.taskRateLimitMiddleware ?? deps.strictRateLimitMiddleware;
26
26
  const application = new TaskApplicationService();
27
27
  const operatingViews = new ProjectOperatingViewService(deps.service.projects);
28
- const monitoring = new ProjectMonitoringService();
28
+ const monitoring = new ProjectMonitoringService(deps.service.currentWorkspacePath);
29
29
  const metrics = new TaskValueMetricsService();
30
30
  const tasks = new TaskRepository();
31
31
  const runs = new TaskRunRepository();
@@ -0,0 +1,3 @@
1
+ import type { Hono } from 'hono';
2
+ import type { AuthenticatedRouteDeps } from './deps.js';
3
+ export declare function registerUserModelRoutes(authenticated: Hono, deps: AuthenticatedRouteDeps): void;