@xopcai/xopc 0.0.217 → 0.0.219

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 (329) 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-D6trMTyZ.js → activity-store-slG02hSm.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CAQdFrcu.js → agent-avatar-dicebear-DZ6ETNIk.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-DxaIH0Ep.js +68 -0
  6. package/dist/gateway/static/root/assets/{api-B9pZAyMB.js → api-Tz57QxiN.js} +1 -1
  7. package/dist/gateway/static/root/assets/app-management-settings-panel-DdR1L4LR.js +1 -0
  8. package/dist/gateway/static/root/assets/appearance-settings-wYbwqmee.js +1 -0
  9. package/dist/gateway/static/root/assets/apps-page-CyWr6KyO.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-BF0q7N24.js → archive-plugin-DKXa160O.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-D1qmjGDo.js → attachment-load-CzwA9g2y.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-Ccu4yRFa.js → automations-page-DwAXyWAY.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-workspace-CL7ieYIt.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-DooqxEZz.js → binary-plugins-DoQ_DnT7.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-Dqg9kvb9.js → block-editor-Bj_Uxxng.js} +47 -47
  16. package/dist/gateway/static/root/assets/browser-settings-page-BYa_FNC1.js +8 -0
  17. package/dist/gateway/static/root/assets/{browser-workflow-inputs-CsIh8ySc.js → browser-workflow-inputs-D4roXE6r.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-workflows-page-BXQFxT0p.js → browser-workflows-page-CleKTAKD.js} +2 -2
  19. package/dist/gateway/static/root/assets/capabilities-settings-panel-DYG37N0k.js +7 -0
  20. package/dist/gateway/static/root/assets/{capability-presets-api-BX9U0FRh.js → capability-presets-api-wtEN6Ss6.js} +1 -1
  21. package/dist/gateway/static/root/assets/capability-presets-settings-panel-C0Q4dFq-.js +3 -0
  22. package/dist/gateway/static/root/assets/{channel-recipient-api-CUBTQ0Bz.js → channel-recipient-api-DhuS2RJ3.js} +1 -1
  23. package/dist/gateway/static/root/assets/channels-settings-CpO6Xg0n.js +1 -0
  24. package/dist/gateway/static/root/assets/channels-status-swr-CXhPeiNj.js +1 -0
  25. package/dist/gateway/static/root/assets/chat-terminal-dock-ClQMDe2n.js +36 -0
  26. package/dist/gateway/static/root/assets/connectors-page-BvyiPdKU.js +2 -0
  27. package/dist/gateway/static/root/assets/{cron-expression-XzPZhzVM.js → cron-expression-4DvCFs-v.js} +1 -1
  28. package/dist/gateway/static/root/assets/date-picker-B6FSjt4Z.js +1 -0
  29. package/dist/gateway/static/root/assets/dependency-picker-Za18eMp1.js +1 -0
  30. package/dist/gateway/static/root/assets/{desktop-pet-DZjW-7Tw.js → desktop-pet-DUUf3yyJ.js} +1 -1
  31. package/dist/gateway/static/root/assets/desktop-pet-settings-Dwx3GfB8.js +1 -0
  32. package/dist/gateway/static/root/assets/directory-picker-path-field-C6dfTCsl.js +1 -0
  33. package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +1 -0
  34. package/dist/gateway/static/root/assets/{extension-debug-page-D7APnE3n.js → extension-debug-page-Cordpg4X.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-BhV5hz70.js → extension-page-Dw0dGyMl.js} +1 -1
  36. package/dist/gateway/static/root/assets/extension-settings-page-B2pUMaXm.js +1 -0
  37. package/dist/gateway/static/root/assets/eye-CABVeTq0.js +1 -0
  38. package/dist/gateway/static/root/assets/eye-off-DEAzt3g1.js +1 -0
  39. package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +1 -0
  40. package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +1 -0
  41. package/dist/gateway/static/root/assets/gateway-config-api-DAZUOEQh.js +1 -0
  42. package/dist/gateway/static/root/assets/{gateway-config-swr-BTH9HVUk.js → gateway-config-swr-BIqRg-zo.js} +1 -1
  43. package/dist/gateway/static/root/assets/gateway-settings-ik2f-pmV.js +1 -0
  44. package/dist/gateway/static/root/assets/{gateway-startup-retry-DAEk_tnd.js → gateway-startup-retry-BFjWYOCS.js} +1 -1
  45. package/dist/gateway/static/root/assets/heartbeat-settings-BE81XJ8F.js +1 -0
  46. package/dist/gateway/static/root/assets/home-page-BTWXJu_m.js +1 -0
  47. package/dist/gateway/static/root/assets/{image-generation-api-HqcQrSed.js → image-generation-api-HXAWlgm6.js} +1 -1
  48. package/dist/gateway/static/root/assets/index-B6gWYy08.js +108 -0
  49. package/dist/gateway/static/root/assets/index-CDkuz_YC.css +2 -0
  50. package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +1 -0
  51. package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +1 -0
  52. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BG6lShzn.js → keyboard-shortcuts-settings-ROqQ_Xlo.js} +1 -1
  53. package/dist/gateway/static/root/assets/local-app-workbench-page-Dcaf190G.js +2 -0
  54. package/dist/gateway/static/root/assets/{local-apps-page-vaz8ewe2.js → local-apps-page-Be79cyMG.js} +1 -1
  55. package/dist/gateway/static/root/assets/{locale-store-De8wYkd7.js → locale-store-DfK-Hofd.js} +1 -1
  56. package/dist/gateway/static/root/assets/logs-page-C2pjbXno.js +2 -0
  57. package/dist/gateway/static/root/assets/{management-settings-tqTGCHt0.js → management-settings-CRspx0oY.js} +1 -1
  58. package/dist/gateway/static/root/assets/{markdown-split-BGx8Aao0.js → markdown-split-G3PTpGw3.js} +1 -1
  59. package/dist/gateway/static/root/assets/{markdown-view-ybRARsPs.js → markdown-view-D4FPJZ91.js} +1 -1
  60. package/dist/gateway/static/root/assets/{media-plugins-xbM-SSP5.js → media-plugins-DT0P7j7u.js} +1 -1
  61. package/dist/gateway/static/root/assets/messages-B701TEZ5.js +3 -0
  62. package/dist/gateway/static/root/assets/{notes-api-D9CCwyWK.js → notes-api-q7HjYO07.js} +1 -1
  63. package/dist/gateway/static/root/assets/{notes-page-CMNBbg6g.js → notes-page-Cgl2h7AR.js} +1 -1
  64. package/dist/gateway/static/root/assets/notes-workbench-DFMQYyGJ.js +4 -0
  65. package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +1 -0
  66. package/dist/gateway/static/root/assets/preview-open-alternatives-CsNVTKC0.js +1 -0
  67. package/dist/gateway/static/root/assets/{product-open-page-CZdzgPZW.js → product-open-page-ComKLO4D.js} +1 -1
  68. package/dist/gateway/static/root/assets/project-detail-page-DUFmQscH.js +1 -0
  69. package/dist/gateway/static/root/assets/projects-page-CTWxt3dv.js +1 -0
  70. package/dist/gateway/static/root/assets/{registry-api-DYmKEwiG.js → registry-api-BBoJ7khF.js} +1 -1
  71. package/dist/gateway/static/root/assets/remote-access-hub-qmG-3qjj.js +1 -0
  72. package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +1 -0
  73. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DQ12tLCL.js → runtime-tools-settings-panel-CXHQc53b.js} +2 -2
  74. package/dist/gateway/static/root/assets/{schema-form-DNCDIkqC.js → schema-form-3jTDF2lJ.js} +1 -1
  75. package/dist/gateway/static/root/assets/search-DA7gz22f.js +1 -0
  76. package/dist/gateway/static/root/assets/sessions-page-D_We4_MV.js +1 -0
  77. package/dist/gateway/static/root/assets/settings-advanced-gate-B_QhPgU0.js +1 -0
  78. package/dist/gateway/static/root/assets/settings-form-section-CUDozALU.js +1 -0
  79. package/dist/gateway/static/root/assets/{settings-loading-skeleton-xgo41cfo.js → settings-loading-skeleton-H3ZH6a6l.js} +1 -1
  80. package/dist/gateway/static/root/assets/{settings-page-8astk_1U.js → settings-page-tx29z21o.js} +1 -1
  81. package/dist/gateway/static/root/assets/setup-status-panel-VunfXpTX.js +1 -0
  82. package/dist/gateway/static/root/assets/{share-preview-page-BBZV4AGy.js → share-preview-page-MyThymEx.js} +1 -1
  83. package/dist/gateway/static/root/assets/shares-settings-DkZvY1cr.js +1 -0
  84. package/dist/gateway/static/root/assets/skill-reload-api-DVDOh1iY.js +1 -0
  85. package/dist/gateway/static/root/assets/skills-page-BOOyMnno.js +2 -0
  86. package/dist/gateway/static/root/assets/{skills-page.utils-HmoDhJVh.js → skills-page.utils-Bl5Yv3Cx.js} +1 -1
  87. package/dist/gateway/static/root/assets/system-settings-panel-DwQ3O1ta.js +1 -0
  88. package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +1 -0
  89. package/dist/gateway/static/root/assets/tab-completion-input.utils-BP3NH_du.js +1 -0
  90. package/dist/gateway/static/root/assets/task-detail-page-BwOyrADL.js +1 -0
  91. package/dist/gateway/static/root/assets/{theme-store-STx6jo38.js → theme-store-Br4BtK4x.js} +1 -1
  92. package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +1 -0
  93. package/dist/gateway/static/root/assets/{use-autosave-CqFVx92z.js → use-autosave-DRS3RwS9.js} +1 -1
  94. package/dist/gateway/static/root/assets/user-context-page-ClV2r3Cr.js +1 -0
  95. package/dist/gateway/static/root/assets/{voice-api-key-field-pYDiKKMo.js → voice-api-key-field-CGTE5156.js} +1 -1
  96. package/dist/gateway/static/root/assets/{work-discovery-overlay-LJLw9zf0.js → work-discovery-overlay-CW-HKD7h.js} +1 -1
  97. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D0WhQ3kI.js → workflow-run-setup-panel-Dtr9fDC8.js} +2 -2
  98. package/dist/gateway/static/root/assets/workflows-page-CDOyNgZf.js +5 -0
  99. package/dist/gateway/static/root/index.html +20 -11
  100. package/dist/package.js +1 -1
  101. package/dist/packages/gateway-contract/src/new-session.js +99 -0
  102. package/dist/packages/gateway-contract/src/tasks.js +5 -0
  103. package/dist/packages/gateway-contract/src/user-message-display.js +55 -0
  104. package/dist/src/agent/agent-manager.js +3 -2
  105. package/dist/src/agent/background-review/prompts.d.ts +1 -1
  106. package/dist/src/agent/background-review/prompts.js +6 -3
  107. package/dist/src/agent/background-review/run-background-review.js +144 -16
  108. package/dist/src/agent/inbound/turn-dispatcher.d.ts +3 -1
  109. package/dist/src/agent/inbound/turn-dispatcher.js +2 -1
  110. package/dist/src/agent/memory/context/types.d.ts +1 -1
  111. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  112. package/dist/src/agent/memory/manager.d.ts +2 -1
  113. package/dist/src/agent/memory/manager.js +2 -6
  114. package/dist/src/agent/memory/understanding/service.d.ts +1 -0
  115. package/dist/src/agent/memory/understanding/service.js +179 -36
  116. package/dist/src/agent/memory/understanding/types.d.ts +6 -0
  117. package/dist/src/agent/messaging/command-handler.d.ts +2 -0
  118. package/dist/src/agent/messaging/command-handler.js +3 -1
  119. package/dist/src/agent/service/direct-turn-helpers.d.ts +3 -0
  120. package/dist/src/agent/service/direct-turn-helpers.js +13 -3
  121. package/dist/src/agent/service/process-direct-streaming.d.ts +2 -1
  122. package/dist/src/agent/service/process-direct-streaming.js +12 -11
  123. package/dist/src/agent/session/session-config-service.d.ts +1 -0
  124. package/dist/src/agent/session/session-config-service.js +11 -0
  125. package/dist/src/agent/session/session-inspector.d.ts +1 -0
  126. package/dist/src/agent/session/session-inspector.js +1 -0
  127. package/dist/src/agent/source-context/budget.d.ts +3 -0
  128. package/dist/src/agent/source-context/budget.js +21 -0
  129. package/dist/src/agent/source-context/index.js +3 -3
  130. package/dist/src/agent/source-context/injector.d.ts +2 -2
  131. package/dist/src/agent/source-context/injector.js +19 -9
  132. package/dist/src/agent/source-context/types.d.ts +16 -0
  133. package/dist/src/agent/source-context/types.js +25 -1
  134. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  135. package/dist/src/agent/tool-manuals/xopc-use.js +19 -2
  136. package/dist/src/agent/tools/xopc-use-tool.js +62 -2
  137. package/dist/src/agent-runtime/index.js +1 -1
  138. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  139. package/dist/src/browser/backend-from-config.d.ts +8 -0
  140. package/dist/src/browser/backend-from-config.js +16 -1
  141. package/dist/src/browser/providers/browser-ext-install.d.ts +3 -2
  142. package/dist/src/browser/providers/browser-ext-install.js +4 -2
  143. package/dist/src/chat-commands/builtins/review.js +11 -2
  144. package/dist/src/chat-commands/builtins/understanding.js +11 -4
  145. package/dist/src/chat-commands/types.d.ts +4 -0
  146. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  147. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  148. package/dist/src/cli/commands/extension.js +1 -1
  149. package/dist/src/config/agent-profile.js +1 -1
  150. package/dist/src/config/models-json.d.ts +20 -20
  151. package/dist/src/connectors/connected-source-ingestion.js +21 -4
  152. package/dist/src/connectors/connected-source-normalizers.js +51 -4
  153. package/dist/src/connectors/connected-source-understanding.d.ts +20 -0
  154. package/dist/src/connectors/connected-source-understanding.js +180 -0
  155. package/dist/src/connectors/content-enrichment.d.ts +1 -0
  156. package/dist/src/connectors/content-enrichment.js +11 -7
  157. package/dist/src/connectors/learning-coordinator.js +112 -15
  158. package/dist/src/connectors/learning-recipes.js +2 -2
  159. package/dist/src/document-understanding/extract.d.ts +1 -1
  160. package/dist/src/document-understanding/extract.js +54 -1
  161. package/dist/src/extensions/update.js +1 -1
  162. package/dist/src/gateway/agents-admin.js +1 -1
  163. package/dist/src/gateway/chat-stream/mapper.js +18 -0
  164. package/dist/src/gateway/heartbeat/service.js +1 -1
  165. package/dist/src/gateway/hono/routes/agent-stream.js +12 -2
  166. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  167. package/dist/src/gateway/hono/routes/commands-skills.js +1 -0
  168. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +46 -2
  169. package/dist/src/gateway/hono/routes/session-input-handler.js +23 -3
  170. package/dist/src/gateway/hono/routes/sessions.js +17 -20
  171. package/dist/src/gateway/hono/routes/tasks.js +25 -0
  172. package/dist/src/gateway/hono/routes/understanding-sources.d.ts +9 -0
  173. package/dist/src/gateway/hono/routes/understanding-sources.js +138 -24
  174. package/dist/src/gateway/hono/routes/you.js +71 -4
  175. package/dist/src/gateway/rate-limit/buckets.d.ts +1 -1
  176. package/dist/src/gateway/rate-limit/buckets.js +2 -2
  177. package/dist/src/gateway/service/agent-runner.d.ts +7 -2
  178. package/dist/src/gateway/service/agent-runner.js +21 -1
  179. package/dist/src/gateway/service/config-coordinator.js +1 -1
  180. package/dist/src/gateway/service/run-gateway-agent.d.ts +2 -0
  181. package/dist/src/gateway/service/run-gateway-agent.js +2 -1
  182. package/dist/src/gateway/service/session-input-coordinator.d.ts +8 -2
  183. package/dist/src/gateway/service/session-input-coordinator.js +62 -3
  184. package/dist/src/gateway/service/sessions-api.d.ts +1 -0
  185. package/dist/src/gateway/service.d.ts +3 -2
  186. package/dist/src/gateway/service.js +16 -6
  187. package/dist/src/gateway/user-turn-input.d.ts +2 -0
  188. package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +3 -2
  189. package/dist/src/gateway/xopc-cloud-capability-setup.js +16 -3
  190. package/dist/src/heartbeat/index.js +1 -1
  191. package/dist/src/infra/update-runner.js +1 -1
  192. package/dist/src/knowledge/connected-understanding-pipeline.d.ts +1 -1
  193. package/dist/src/knowledge/connected-understanding-pipeline.js +4 -2
  194. package/dist/src/retrieval/queryProfile.d.ts +1 -0
  195. package/dist/src/retrieval/queryProfile.js +9 -1
  196. package/dist/src/session/client-history.d.ts +11 -0
  197. package/dist/src/session/client-history.js +24 -2
  198. package/dist/src/session/config-types.d.ts +1 -1
  199. package/dist/src/session/session-title.js +2 -3
  200. package/dist/src/session/store.js +1 -0
  201. package/dist/src/session/transcript-outline.js +5 -2
  202. package/dist/src/session/types.d.ts +1 -0
  203. package/dist/src/session/user-message-display.d.ts +4 -0
  204. package/dist/src/session/user-message-display.js +22 -0
  205. package/dist/src/storage/sqlite/context-extraction-repository.d.ts +57 -0
  206. package/dist/src/storage/sqlite/context-extraction-repository.js +119 -0
  207. package/dist/src/storage/sqlite/context-relation-repository.d.ts +50 -0
  208. package/dist/src/storage/sqlite/context-relation-repository.js +97 -0
  209. package/dist/src/storage/sqlite/index.d.ts +4 -2
  210. package/dist/src/storage/sqlite/index.js +5 -3
  211. package/dist/src/storage/sqlite/migrations/126_focus_context_governance.sql +72 -0
  212. package/dist/src/storage/sqlite/migrations/127_context_object_origin.sql +36 -0
  213. package/dist/src/storage/sqlite/migrations/128_context_extraction.sql +73 -0
  214. package/dist/src/storage/sqlite/migrations/129_focus_versions.sql +51 -0
  215. package/dist/src/storage/sqlite/migrations/130_context_evidence_provenance.sql +18 -0
  216. package/dist/src/storage/sqlite/migrations/131_session_input_contexts.sql +2 -0
  217. package/dist/src/storage/sqlite/migrations/132_transcript_source_context_metadata.sql +34 -0
  218. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  219. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  220. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  221. package/dist/src/storage/sqlite/schema.js +1 -1
  222. package/dist/src/storage/sqlite/session-input-repository.d.ts +8 -0
  223. package/dist/src/storage/sqlite/session-input-repository.js +19 -7
  224. package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +3 -0
  225. package/dist/src/storage/sqlite/session-turn-replace-repository.js +3 -2
  226. package/dist/src/storage/sqlite/transcript-repository.js +29 -3
  227. package/dist/src/storage/sqlite/user-context-repository.d.ts +4 -1
  228. package/dist/src/storage/sqlite/user-context-repository.js +65 -29
  229. package/dist/src/tasks/index.d.ts +1 -0
  230. package/dist/src/tasks/index.js +2 -1
  231. package/dist/src/tasks/task-deletion-service.d.ts +21 -0
  232. package/dist/src/tasks/task-deletion-service.js +35 -0
  233. package/dist/src/tasks/task-repository.js +22 -1
  234. package/dist/src/tui/backends/embedded-backend.js +5 -3
  235. package/dist/src/tui/backends/gateway-realtime-backend.js +5 -3
  236. package/dist/src/tui/chat-history.js +2 -1
  237. package/dist/src/tui/tui-agent-events.js +4 -2
  238. package/dist/src/tui/tui-commands.d.ts +1 -0
  239. package/dist/src/tui/tui-commands.js +8 -3
  240. package/dist/src/tui/tui-empty-session-cleanup.d.ts +0 -1
  241. package/dist/src/tui/tui-empty-session-cleanup.js +1 -11
  242. package/dist/src/tui/tui-new-session-preferences.d.ts +10 -0
  243. package/dist/src/tui/tui-new-session-preferences.js +32 -0
  244. package/dist/src/tui/tui-session-actions.d.ts +1 -0
  245. package/dist/src/tui/tui-session-actions.js +2 -1
  246. package/dist/src/tui/tui-settings.d.ts +2 -0
  247. package/dist/src/tui/tui-settings.js +4 -1
  248. package/dist/src/tui/tui-types.d.ts +1 -0
  249. package/dist/src/tui/tui.js +57 -4
  250. package/dist/src/tunnel/frpc-process.js +3 -0
  251. package/dist/src/tunnel/tunnel-service.d.ts +2 -0
  252. package/dist/src/tunnel/tunnel-service.js +40 -28
  253. package/dist/src/user-context/context-objects.d.ts +17 -0
  254. package/dist/src/user-context/context-objects.js +99 -0
  255. package/dist/src/user-context/domain.d.ts +13 -1
  256. package/dist/src/user-context/evaluation/harness.d.ts +13 -0
  257. package/dist/src/user-context/evaluation/harness.js +31 -0
  258. package/dist/src/user-context/extraction/registry.d.ts +26 -0
  259. package/dist/src/user-context/extraction/registry.js +113 -0
  260. package/dist/src/user-context/extraction/repair.d.ts +19 -0
  261. package/dist/src/user-context/extraction/repair.js +68 -0
  262. package/dist/src/user-context/planner.js +214 -57
  263. package/dist/src/user-context/retriever.js +69 -9
  264. package/dist/src/user-context/sources/catalog.js +9 -2
  265. package/dist/src/user-context/sources/index.js +2 -2
  266. package/dist/src/user-context/sources/local-source-contract.d.ts +1 -1
  267. package/dist/src/user-context/sources/local-source-contract.js +1 -0
  268. package/dist/src/user-context/sources/processing-policy.d.ts +2 -0
  269. package/dist/src/user-context/sources/processing-policy.js +7 -0
  270. package/dist/src/user-context/sources/repository.d.ts +23 -4
  271. package/dist/src/user-context/sources/repository.js +122 -12
  272. package/dist/src/user-context/sources/types.d.ts +10 -1
  273. package/dist/src/user-context/understanding-writing.d.ts +1 -0
  274. package/dist/src/user-context/understanding-writing.js +4 -0
  275. package/dist/src/user-context/understanding.js +1 -1
  276. package/dist/src/work-discovery/analyzer.d.ts +6 -0
  277. package/dist/src/work-discovery/analyzer.js +181 -57
  278. package/dist/src/work-discovery/index.js +1 -1
  279. package/dist/src/work-discovery/probe.js +20 -0
  280. package/dist/src/work-discovery/service.d.ts +9 -0
  281. package/dist/src/work-discovery/service.js +39 -11
  282. package/dist/src/work-discovery/source-repository.js +1 -1
  283. package/dist/src/work-discovery/types.d.ts +5 -0
  284. package/package.json +3 -3
  285. package/dist/gateway/static/root/assets/agents-C6q_vDzP.js +0 -68
  286. package/dist/gateway/static/root/assets/app-management-settings-panel-DRsTwFbF.js +0 -1
  287. package/dist/gateway/static/root/assets/appearance-settings-B99NaPTf.js +0 -1
  288. package/dist/gateway/static/root/assets/apps-page-Dx66anqa.js +0 -1
  289. package/dist/gateway/static/root/assets/automations-workspace-CHbA8d-P.js +0 -6
  290. package/dist/gateway/static/root/assets/browser-settings-page-CpRc-9Jy.js +0 -8
  291. package/dist/gateway/static/root/assets/capabilities-settings-panel-C89FGECN.js +0 -7
  292. package/dist/gateway/static/root/assets/capability-presets-settings-panel-XT6WEz9E.js +0 -3
  293. package/dist/gateway/static/root/assets/channels-settings-DhKk1oNT.js +0 -1
  294. package/dist/gateway/static/root/assets/channels-status-swr-CiwOOoVL.js +0 -1
  295. package/dist/gateway/static/root/assets/chat-terminal-dock-CTbkTsc2.js +0 -36
  296. package/dist/gateway/static/root/assets/connectors-page-BDn3HTzX.js +0 -2
  297. package/dist/gateway/static/root/assets/date-picker-BmZjs4Bq.js +0 -1
  298. package/dist/gateway/static/root/assets/dependency-picker-ndtb88_T.js +0 -1
  299. package/dist/gateway/static/root/assets/desktop-pet-settings-C7BLs783.js +0 -1
  300. package/dist/gateway/static/root/assets/directory-picker-path-field-BWiap88p.js +0 -1
  301. package/dist/gateway/static/root/assets/extension-settings-page-BhbcGuiJ.js +0 -1
  302. package/dist/gateway/static/root/assets/gateway-config-api-CUt9bIpL.js +0 -1
  303. package/dist/gateway/static/root/assets/gateway-settings-RafSECLG.js +0 -1
  304. package/dist/gateway/static/root/assets/heartbeat-settings-CwVPlPLB.js +0 -1
  305. package/dist/gateway/static/root/assets/home-page-CbdBcCwC.js +0 -1
  306. package/dist/gateway/static/root/assets/index-AbNnQyKk.css +0 -2
  307. package/dist/gateway/static/root/assets/index-CMLkr37Y.js +0 -108
  308. package/dist/gateway/static/root/assets/local-app-workbench-page-DdaPtQ5M.js +0 -2
  309. package/dist/gateway/static/root/assets/logs-page-CjxMHTQO.js +0 -2
  310. package/dist/gateway/static/root/assets/messages-VI9m1xJl.js +0 -3
  311. package/dist/gateway/static/root/assets/notes-workbench-V9C-8vSn.js +0 -4
  312. package/dist/gateway/static/root/assets/page-tabs-e99j9S9K.js +0 -1
  313. package/dist/gateway/static/root/assets/preview-open-alternatives-DW9MDOva.js +0 -1
  314. package/dist/gateway/static/root/assets/project-detail-page-DHmAUggu.js +0 -1
  315. package/dist/gateway/static/root/assets/projects-page-D0EiN69Y.js +0 -1
  316. package/dist/gateway/static/root/assets/remote-access-hub-BuAVFk2O.js +0 -1
  317. package/dist/gateway/static/root/assets/sessions-page-hzlTfgOl.js +0 -1
  318. package/dist/gateway/static/root/assets/settings-advanced-gate-BlCoA_9h.js +0 -1
  319. package/dist/gateway/static/root/assets/settings-form-section-z0JH53Fu.js +0 -1
  320. package/dist/gateway/static/root/assets/setup-status-panel-fZQfoJAk.js +0 -1
  321. package/dist/gateway/static/root/assets/shares-settings-B5dPMq3Y.js +0 -1
  322. package/dist/gateway/static/root/assets/skill-reload-api-i1PGf1V2.js +0 -1
  323. package/dist/gateway/static/root/assets/skills-page-BSN2VaqR.js +0 -2
  324. package/dist/gateway/static/root/assets/system-settings-panel-CSibO8vj.js +0 -1
  325. package/dist/gateway/static/root/assets/tab-completion-input-B-VsxKhC.js +0 -1
  326. package/dist/gateway/static/root/assets/task-detail-page-HCKZ11E8.js +0 -1
  327. package/dist/gateway/static/root/assets/typed-models-lib-zrYg51t3.js +0 -1
  328. package/dist/gateway/static/root/assets/user-context-page-CqG56cDS.js +0 -1
  329. package/dist/gateway/static/root/assets/workflows-page-DQAJzV5w.js +0 -5
@@ -1,6 +1,9 @@
1
1
  import { extname } from "node:path";
2
+ import AdmZip from "adm-zip";
2
3
  //#region src/document-understanding/extract.ts
3
4
  const MAX_EXTRACTED_CHARS = 6e4;
5
+ const MAX_OFFICE_XML_BYTES = 8 * 1024 * 1024;
6
+ const MAX_OFFICE_TOTAL_XML_BYTES = 16 * 1024 * 1024;
4
7
  function truncate(text) {
5
8
  return text.length > MAX_EXTRACTED_CHARS ? `${text.slice(0, MAX_EXTRACTED_CHARS)}\n\n[document extraction truncated ${text.length - MAX_EXTRACTED_CHARS} chars]` : text;
6
9
  }
@@ -43,11 +46,61 @@ function extractPdfText(buffer) {
43
46
  text: truncate(text)
44
47
  };
45
48
  }
49
+ function decodeXmlText(value) {
50
+ return value.replaceAll("&amp;", "&").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&quot;", "\"").replaceAll("&apos;", "'");
51
+ }
52
+ function officeXmlText(buffer, extension) {
53
+ let zip;
54
+ try {
55
+ zip = new AdmZip(buffer);
56
+ } catch {
57
+ return {
58
+ ok: false,
59
+ reason: "Office document archive is invalid."
60
+ };
61
+ }
62
+ const prefixes = extension === ".docx" ? ["word/document.xml"] : extension === ".pptx" ? ["ppt/slides/"] : ["xl/sharedStrings.xml", "xl/worksheets/"];
63
+ const entries = zip.getEntries().filter((entry) => !entry.isDirectory && entry.header.size <= MAX_OFFICE_XML_BYTES && prefixes.some((prefix) => entry.entryName.startsWith(prefix))).sort((left, right) => left.entryName.localeCompare(right.entryName));
64
+ const parts = [];
65
+ let extractedBytes = 0;
66
+ for (const entry of entries) {
67
+ if (extractedBytes + entry.header.size > MAX_OFFICE_TOTAL_XML_BYTES) break;
68
+ extractedBytes += entry.header.size;
69
+ const xml = entry.getData().toString("utf8");
70
+ for (const match of xml.matchAll(/<(?:w:t|a:t|t)(?:\s[^>]*)?>([\s\S]*?)<\/(?:w:t|a:t|t)>/g)) {
71
+ const text = decodeXmlText((match[1] ?? "").replace(/<[^>]+>/g, "")).trim();
72
+ if (text) parts.push(text);
73
+ }
74
+ }
75
+ const text = parts.join("\n").replace(/\n{3,}/g, "\n\n").trim();
76
+ return text ? {
77
+ ok: true,
78
+ kind: "office",
79
+ text: truncate(text)
80
+ } : {
81
+ ok: false,
82
+ reason: "Office document extraction found no readable text."
83
+ };
84
+ }
46
85
  function extractDocumentText(params) {
47
86
  const ext = extname(params.fileName).toLowerCase();
48
87
  const mime = params.mimeType?.toLowerCase() ?? "";
49
88
  if (mime === "application/pdf" || ext === ".pdf") return extractPdfText(params.buffer);
50
- if (mime.startsWith("text/")) return {
89
+ if ([
90
+ ".docx",
91
+ ".pptx",
92
+ ".xlsx"
93
+ ].includes(ext)) return officeXmlText(params.buffer, ext);
94
+ if (mime.startsWith("text/") || [
95
+ ".csv",
96
+ ".html",
97
+ ".json",
98
+ ".md",
99
+ ".rtf",
100
+ ".tsv",
101
+ ".txt",
102
+ ".xml"
103
+ ].includes(ext)) return {
51
104
  ok: true,
52
105
  kind: "plain",
53
106
  text: truncate(params.buffer.toString("utf8"))
@@ -4,8 +4,8 @@ import { init_paths, resolveBundledExtensionsDir, resolveExtensionsDir } from ".
4
4
  import { init_loader, loadConfig } from "../config/loader.js";
5
5
  import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, verifyStoreArtifactSha256 } from "../agent/skills/marketplace/adapters/store/store-api-client.js";
6
6
  import { getExtensionLockfileManager } from "./lockfile.js";
7
- import { installExtensionFromStoreZip, installFromNpm } from "./install.js";
8
7
  import { findExtension } from "./marketplace.js";
8
+ import { installExtensionFromStoreZip, installFromNpm } from "./install.js";
9
9
  import { join } from "node:path";
10
10
  import { existsSync, readFileSync, readdirSync, rmSync } from "node:fs";
11
11
  import semver from "semver";
@@ -1,5 +1,5 @@
1
- import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
2
1
  import { resolveCapabilityPresetLayer, resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
2
+ import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
3
3
  import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
4
4
  import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
5
5
  import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
@@ -434,9 +434,27 @@ function userMessageFromEvent(event) {
434
434
  role: "user",
435
435
  content: event.content ?? [],
436
436
  attachments: event.media,
437
+ metadata: userMessageDisplayMetadata(event.metadata),
437
438
  timestamp: typeof event.timestamp === "number" ? event.timestamp : Date.now()
438
439
  };
439
440
  }
441
+ function userMessageDisplayMetadata(value) {
442
+ const rows = asRecord(value)?.sourceContexts;
443
+ if (!Array.isArray(rows)) return void 0;
444
+ const sourceContexts = rows.flatMap((value) => {
445
+ const row = asRecord(value);
446
+ if (row?.kind !== "note" || typeof row.sourceId !== "string" || typeof row.version !== "string" || typeof row.title !== "string") return [];
447
+ return [{
448
+ kind: "note",
449
+ sourceId: row.sourceId,
450
+ version: row.version,
451
+ title: row.title,
452
+ ...typeof row.tokenEstimate === "number" ? { tokenEstimate: row.tokenEstimate } : {},
453
+ ...row.truncated === true ? { truncated: true } : {}
454
+ }];
455
+ });
456
+ return sourceContexts.length > 0 ? { sourceContexts } : void 0;
457
+ }
440
458
  function extractTextFromMessage(message) {
441
459
  return extractText(message.content);
442
460
  }
@@ -1,9 +1,9 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
3
  import { shouldSilence, stripHeartbeatToken } from "../../heartbeat/tokens.js";
4
- import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
5
4
  import { isWithinActiveHours } from "../../heartbeat/active-hours.js";
6
5
  import { isHeartbeatContentEmpty } from "../../heartbeat/content-check.js";
6
+ import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
7
7
  import { createHeartbeatWake } from "../../heartbeat/wake.js";
8
8
  import { resolveHeartbeatMdPath } from "../workspace-heartbeat-path.js";
9
9
  import { readFile } from "fs/promises";
@@ -1,3 +1,4 @@
1
+ import { parseTurnContextRefs } from "../../../agent/source-context/types.js";
1
2
  import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
2
3
  import { replaceLatestSessionTurn, submitSessionInput } from "./session-input-handler.js";
3
4
  //#region src/gateway/hono/routes/agent-stream.ts
@@ -51,6 +52,14 @@ function registerAgentStreamRoutes(authenticated, deps) {
51
52
  }
52
53
  }, 400);
53
54
  const attachments = Array.isArray(body.attachments) ? body.attachments : void 0;
55
+ const contextRefs = body.contextRefs === void 0 ? void 0 : parseTurnContextRefs(body.contextRefs);
56
+ if (contextRefs === null) return c.json({
57
+ ok: false,
58
+ error: {
59
+ code: "BAD_REQUEST",
60
+ message: "Invalid Note context references"
61
+ }
62
+ }, 400);
54
63
  if (body.content !== void 0) {
55
64
  const contentError = validateWebchatContent(body.content);
56
65
  if (contentError) return c.json({
@@ -73,6 +82,7 @@ function registerAgentStreamRoutes(authenticated, deps) {
73
82
  version: body.version,
74
83
  content: typeof body.content === "string" ? body.content : void 0,
75
84
  attachments,
85
+ contextRefs,
76
86
  thinking: typeof body.thinking === "string" ? body.thinking : void 0,
77
87
  position: typeof body.position === "number" ? body.position : void 0
78
88
  });
@@ -82,8 +92,8 @@ function registerAgentStreamRoutes(authenticated, deps) {
82
92
  }) : c.json({
83
93
  ok: false,
84
94
  error: {
85
- code: "CONFLICT",
86
- message: "Input changed"
95
+ code: result.contextUnavailable ? "CONTEXT_UNAVAILABLE" : "CONFLICT",
96
+ message: result.contextUnavailable ? "A referenced Note changed or is no longer available. Select it again." : "Input changed"
87
97
  },
88
98
  payload: result.state
89
99
  }, 409);
@@ -1,8 +1,8 @@
1
1
  import { getAllModels, getAvailableModels, init_providers } from "../../../providers/index.js";
2
2
  import { ActivationPlanner } from "../../../extensions/activation-planner.js";
3
3
  import { mergeActivationContext } from "../../../extensions/activation-context.js";
4
- import { fetchRegistry, listExtensions, searchExtensions } from "../../../extensions/marketplace.js";
5
4
  import { buildWhenContextSnapshot } from "../../../extensions/when-context.js";
5
+ import { fetchRegistry, listExtensions, searchExtensions } from "../../../extensions/marketplace.js";
6
6
  import { createOAuthAsyncHandler } from "../oauth-async.js";
7
7
  import { createOAuthHandler } from "../oauth.js";
8
8
  import { extensionAssetMimeType } from "../lib/extension-assets.js";
@@ -40,6 +40,7 @@ function registerCommandsSkillsRoutes(authenticated, deps) {
40
40
  category: cmd.category,
41
41
  scope: cmd.scope,
42
42
  acceptsArgs: cmd.acceptsArgs ?? false,
43
+ acceptsContext: cmd.acceptsContext ?? false,
43
44
  examples: cmd.examples ?? []
44
45
  }));
45
46
  const extensionCommands = all.filter((cmd) => cmd.category === "extension").map((cmd) => ({
@@ -15,7 +15,7 @@ export declare function submitSessionInput(c: Context, deps: AuthenticatedRouteD
15
15
  }, 401, "json">) | (Response & import("hono").TypedResponse<{
16
16
  ok: false;
17
17
  error: {
18
- code: "BAD_REQUEST" | "QUEUE_FULL";
18
+ code: "BAD_REQUEST" | "QUEUE_FULL" | "CONTEXT_UNAVAILABLE";
19
19
  message: string;
20
20
  };
21
21
  }, 400 | 409, "json">) | (Response & import("hono").TypedResponse<{
@@ -38,6 +38,28 @@ export declare function submitSessionInput(c: Context, deps: AuthenticatedRouteD
38
38
  status: import("../../../storage/sqlite/session-input-repository.js").SessionInputStatus;
39
39
  content: string;
40
40
  attachments?: import("hono/dist/types/utils/types.js").JSONValue[];
41
+ contextRefs?: {
42
+ kind: import("../../../agent/source-context/types.js").AgentSourceContext["kind"];
43
+ sourceId: string;
44
+ version: string;
45
+ title: string;
46
+ tokenEstimate?: number;
47
+ truncated?: boolean;
48
+ }[];
49
+ contextSnapshots?: {
50
+ kind: import("../../../agent/source-context/types.js").SessionSourceBinding["kind"];
51
+ sourceId: string;
52
+ version: string;
53
+ title: string;
54
+ text: string;
55
+ images?: {
56
+ type: "image";
57
+ data: string;
58
+ mimeType: string;
59
+ }[];
60
+ tokenEstimate?: number;
61
+ truncated?: boolean;
62
+ }[];
41
63
  thinking?: string;
42
64
  origin: {
43
65
  type: "endpoint";
@@ -75,7 +97,7 @@ export declare function replaceLatestSessionTurn(c: Context, deps: Authenticated
75
97
  }, 401, "json">) | (Response & import("hono").TypedResponse<{
76
98
  ok: false;
77
99
  error: {
78
- code: "TARGET_NOT_FOUND" | "NOT_LATEST" | "SESSION_BUSY" | "BAD_REQUEST";
100
+ code: "TARGET_NOT_FOUND" | "NOT_LATEST" | "SESSION_BUSY" | "BAD_REQUEST" | "CONTEXT_UNAVAILABLE";
79
101
  message: string;
80
102
  };
81
103
  }, 400 | 404 | 409, "json">) | (Response & import("hono").TypedResponse<{
@@ -98,6 +120,28 @@ export declare function replaceLatestSessionTurn(c: Context, deps: Authenticated
98
120
  status: import("../../../storage/sqlite/session-input-repository.js").SessionInputStatus;
99
121
  content: string;
100
122
  attachments?: import("hono/dist/types/utils/types.js").JSONValue[];
123
+ contextRefs?: {
124
+ kind: import("../../../agent/source-context/types.js").AgentSourceContext["kind"];
125
+ sourceId: string;
126
+ version: string;
127
+ title: string;
128
+ tokenEstimate?: number;
129
+ truncated?: boolean;
130
+ }[];
131
+ contextSnapshots?: {
132
+ kind: import("../../../agent/source-context/types.js").SessionSourceBinding["kind"];
133
+ sourceId: string;
134
+ version: string;
135
+ title: string;
136
+ text: string;
137
+ images?: {
138
+ type: "image";
139
+ data: string;
140
+ mimeType: string;
141
+ }[];
142
+ tokenEstimate?: number;
143
+ truncated?: boolean;
144
+ }[];
101
145
  thinking?: string;
102
146
  origin: {
103
147
  type: "endpoint";
@@ -1,6 +1,8 @@
1
1
  import { endpointTurnClaimSchema } from "../../../../packages/endpoint-tools-protocol/src/index.js";
2
+ import { parseTurnContextRefs } from "../../../agent/source-context/types.js";
2
3
  import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
3
4
  //#region src/gateway/hono/routes/session-input-handler.ts
5
+ const MAX_TURN_CONTEXTS = 5;
4
6
  async function submitSessionInput(c, deps, sessionKey) {
5
7
  const body = await c.req.json().catch(() => null);
6
8
  if (!body || !sessionKey) return c.json({
@@ -11,6 +13,14 @@ async function submitSessionInput(c, deps, sessionKey) {
11
13
  }
12
14
  }, 400);
13
15
  const attachments = Array.isArray(body.attachments) ? body.attachments : void 0;
16
+ const contextRefs = parseTurnContextRefs(body.contextRefs, MAX_TURN_CONTEXTS);
17
+ if (contextRefs === null) return c.json({
18
+ ok: false,
19
+ error: {
20
+ code: "BAD_REQUEST",
21
+ message: `contextRefs must contain at most ${MAX_TURN_CONTEXTS} valid notes`
22
+ }
23
+ }, 400);
14
24
  const content = typeof body.content === "string" ? body.content : "";
15
25
  const contentError = validateWebchatContent(content);
16
26
  if (contentError) return c.json({
@@ -57,6 +67,7 @@ async function submitSessionInput(c, deps, sessionKey) {
57
67
  delivery,
58
68
  content,
59
69
  attachments,
70
+ contextRefs,
60
71
  thinking: typeof body.thinking === "string" ? body.thinking : void 0,
61
72
  origin: {
62
73
  type: "endpoint",
@@ -67,9 +78,9 @@ async function submitSessionInput(c, deps, sessionKey) {
67
78
  ok: false,
68
79
  error: {
69
80
  code: result.code,
70
- message: "Input was not accepted"
81
+ message: result.code === "CONTEXT_UNAVAILABLE" ? "A referenced Note changed or is no longer available. Select it again." : "Input was not accepted"
71
82
  }
72
- }, result.code === "QUEUE_FULL" ? 409 : 400);
83
+ }, result.code === "QUEUE_FULL" || result.code === "CONTEXT_UNAVAILABLE" ? 409 : 400);
73
84
  return c.json({
74
85
  ok: true,
75
86
  payload: {
@@ -88,6 +99,14 @@ async function replaceLatestSessionTurn(c, deps, sessionKey, targetTurnId) {
88
99
  }
89
100
  }, 400);
90
101
  const attachments = Array.isArray(body.attachments) ? body.attachments : void 0;
102
+ const contextRefs = parseTurnContextRefs(body.contextRefs, MAX_TURN_CONTEXTS);
103
+ if (contextRefs === null) return c.json({
104
+ ok: false,
105
+ error: {
106
+ code: "BAD_REQUEST",
107
+ message: `contextRefs must contain at most ${MAX_TURN_CONTEXTS} valid notes`
108
+ }
109
+ }, 400);
91
110
  const content = typeof body.content === "string" ? body.content : "";
92
111
  const contentError = validateWebchatContent(content);
93
112
  if (contentError) return c.json({
@@ -127,6 +146,7 @@ async function replaceLatestSessionTurn(c, deps, sessionKey, targetTurnId) {
127
146
  delivery: "next",
128
147
  content,
129
148
  attachments,
149
+ contextRefs,
130
150
  thinking: typeof body.thinking === "string" ? body.thinking : void 0,
131
151
  origin: {
132
152
  type: "endpoint",
@@ -135,7 +155,7 @@ async function replaceLatestSessionTurn(c, deps, sessionKey, targetTurnId) {
135
155
  });
136
156
  if (result.ok === false) {
137
157
  const status = result.code === "TARGET_NOT_FOUND" ? 404 : result.code === "BAD_REQUEST" ? 400 : 409;
138
- const message = result.code === "NOT_LATEST" ? "Only the latest user turn can be replaced" : result.code === "SESSION_BUSY" ? "Session has pending input" : result.code === "TARGET_NOT_FOUND" ? "User turn was not found" : "Replacement input was not accepted";
158
+ const message = result.code === "NOT_LATEST" ? "Only the latest user turn can be replaced" : result.code === "SESSION_BUSY" ? "Session has pending input" : result.code === "TARGET_NOT_FOUND" ? "User turn was not found" : result.code === "CONTEXT_UNAVAILABLE" ? "A referenced Note changed or is no longer available. Select it again." : "Replacement input was not accepted";
139
159
  return c.json({
140
160
  ok: false,
141
161
  error: {
@@ -121,7 +121,7 @@ function registerSessionsRoutes(authenticated, deps) {
121
121
  });
122
122
  authenticated.post("/api/sessions", async (c) => {
123
123
  const body = await c.req.json().catch(() => ({}));
124
- const channel = body.channel || "webchat";
124
+ const channel = typeof body.channel === "string" && body.channel.trim() ? body.channel.trim() : "webchat";
125
125
  const projectId = typeof body.projectId === "string" && body.projectId.trim() ? body.projectId.trim() : void 0;
126
126
  const routingCfg = service.currentConfig;
127
127
  if (projectId && !service.projects.get(projectId)) return c.json({
@@ -134,25 +134,7 @@ function registerSessionsRoutes(authenticated, deps) {
134
134
  explicitAgentId: typeof body.agentId === "string" ? body.agentId : void 0,
135
135
  projectId
136
136
  });
137
- if (body.chat_id) {
138
- const sessionKey = buildSessionKey({
139
- agentId,
140
- source: channel,
141
- accountId: "default",
142
- peerKind: "direct",
143
- peerId: body.chat_id
144
- });
145
- await service.sessionIndexInstance.saveMessages(sessionKey, [], { metadata: buildDirectSessionMetadata({
146
- agentId,
147
- source: channel,
148
- accountId: "default",
149
- peerId: body.chat_id
150
- }) });
151
- if (projectId) service.projects.attachSession(sessionKey, projectId);
152
- const session = await service.sessions.getSession(sessionKey);
153
- return c.json({ session }, 201);
154
- }
155
- const chatId = `chat_${randomUUID()}`;
137
+ const chatId = (typeof body.chat_id === "string" && body.chat_id.trim() ? body.chat_id.trim() : void 0) ?? `chat_${randomUUID()}`;
156
138
  const sessionKey = buildSessionKey({
157
139
  agentId,
158
140
  source: channel,
@@ -167,6 +149,21 @@ function registerSessionsRoutes(authenticated, deps) {
167
149
  peerId: chatId
168
150
  }) });
169
151
  if (projectId) service.projects.attachSession(sessionKey, projectId);
152
+ const rawInitialConfig = body.initialAgentConfig && typeof body.initialAgentConfig === "object" ? body.initialAgentConfig : {};
153
+ const model = typeof rawInitialConfig.model === "string" && rawInitialConfig.model.trim() ? rawInitialConfig.model.trim() : void 0;
154
+ const thinkingLevel = typeof rawInitialConfig.thinkingLevel === "string" && rawInitialConfig.thinkingLevel.trim() ? rawInitialConfig.thinkingLevel.trim() : void 0;
155
+ const initialAgentConfig = {
156
+ ...model ? { model } : {},
157
+ ...thinkingLevel ? { thinkingLevel } : {},
158
+ ...body.temporary === true ? { userContextMode: "temporary" } : {}
159
+ };
160
+ if (Object.keys(initialAgentConfig).length > 0) {
161
+ const result = await service.sessions.patchAgentConfig(sessionKey, initialAgentConfig);
162
+ if (!result.ok) return c.json({
163
+ ok: false,
164
+ error: result.error
165
+ }, 400);
166
+ }
170
167
  const session = await service.sessions.getSession(sessionKey);
171
168
  return c.json({ session }, 201);
172
169
  });
@@ -15,6 +15,7 @@ import { ProjectMonitoringService } from "../../../tasks/project-monitoring-serv
15
15
  import { ProjectOperatingViewService } from "../../../tasks/project-operating-view-service.js";
16
16
  import { TaskValueMetricsService } from "../../../tasks/task-value-metrics-service.js";
17
17
  import { TaskHandoffService } from "../../../tasks/task-handoff-service.js";
18
+ import { TaskDeletionService } from "../../../tasks/task-deletion-service.js";
18
19
  import { TaskSignalService } from "../../../tasks/task-signal-service.js";
19
20
  import { submitSessionInput } from "./session-input-handler.js";
20
21
  import { TaskConversationQueryService } from "../../service/task-conversation-query-service.js";
@@ -33,6 +34,7 @@ function registerTaskRoutes(authenticated, deps) {
33
34
  const projector = new TaskReadModelProjector();
34
35
  const signals = new TaskSignalService(() => deps.service.dispatchTaskRuns());
35
36
  const dependencies = new TaskDependencyService();
37
+ const deletion = new TaskDeletionService(tasks, runs);
36
38
  const handoffs = new TaskHandoffService({
37
39
  getConfig: () => deps.service.currentConfig,
38
40
  sessionIndex: deps.service.sessionIndexInstance,
@@ -289,6 +291,29 @@ function registerTaskRoutes(authenticated, deps) {
289
291
  task: updated
290
292
  });
291
293
  });
294
+ authenticated.delete("/api/tasks/:id", taskRateLimit, (c) => {
295
+ const taskId = c.req.param("id");
296
+ const result = deletion.delete(taskId);
297
+ if (result.ok === true) {
298
+ deps.service.dispatchTaskEvents();
299
+ return c.json({
300
+ ok: true,
301
+ deleted: true,
302
+ taskId
303
+ });
304
+ }
305
+ if (result.reason === "active_run") return c.json({
306
+ ok: false,
307
+ code: "task_active",
308
+ error: "Cancel the active TaskRun before deleting the Task",
309
+ runId: result.run.id
310
+ }, 409);
311
+ return c.json({
312
+ ok: false,
313
+ code: "task_not_found",
314
+ error: "Task not found"
315
+ }, 404);
316
+ });
292
317
  authenticated.put("/api/tasks/:id/dependencies", taskRateLimit, async (c) => {
293
318
  const parsed = TaskDependencyUpdateRequestSchema.safeParse(await c.req.json().catch(() => ({})));
294
319
  if (!parsed.success) return c.json({
@@ -1,3 +1,12 @@
1
1
  import type { Hono } from 'hono';
2
2
  import type { AuthenticatedRouteDeps } from './deps.js';
3
+ export declare function sourceRevocationImpact(grantId: string): {
4
+ grant: import("../../../user-context/sources/types.js").UnderstandingSourceGrant;
5
+ understandingIds: string[];
6
+ focusIds: string[];
7
+ derivedCount: number;
8
+ understandingCount: number;
9
+ focusCount: number;
10
+ boundedRawCount: number;
11
+ };
3
12
  export declare function registerUnderstandingSourceRoutes(authenticated: Hono, deps: AuthenticatedRouteDeps): void;