@xopcai/xopc 0.0.278 → 0.0.283

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 (468) hide show
  1. package/dist/browser-ext/_locales/en/messages.json +34 -4
  2. package/dist/browser-ext/_locales/zh_CN/messages.json +34 -4
  3. package/dist/browser-ext/dist/assets/{auth-ClQTK565.js → auth-DB30ywek.js} +18 -53
  4. package/dist/browser-ext/dist/assets/pcm-capture-worklet-CGN9Mlhg.js +39 -0
  5. package/dist/browser-ext/dist/assets/{sidepanel-CeGqObOa.css → sidepanel-BbSQr-6P.css} +40 -6
  6. package/dist/browser-ext/dist/background.js +1 -1
  7. package/dist/browser-ext/dist/sidepanel.html +2 -2
  8. package/dist/browser-ext/dist/sidepanel.js +1219 -191
  9. package/dist/browser-ext/manifest.json +2 -1
  10. package/dist/extensions/feishu/src/adapters/cli-login.js +3 -3
  11. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  12. package/dist/extensions/telegram/src/inbound-processor.js +2 -2
  13. package/dist/extensions/telegram/src/outbound-sender.js +1 -1
  14. package/dist/extensions/telegram/src/plugin.js +2 -2
  15. package/dist/extensions/telegram/xopc.extension.json +1 -1
  16. package/dist/extensions/weixin/src/api/api.js +2 -2
  17. package/dist/extensions/weixin/src/auth/accounts.js +12 -12
  18. package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
  19. package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
  20. package/dist/gateway/static/root/assets/{activity-store-SJZ5fS17.js → activity-store-iPtG94qr.js} +1 -1
  21. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-lRVOwbrK.js → agent-avatar-dicebear-DQ74xqLi.js} +1 -1
  22. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-SElFkQd6.js +1 -0
  23. package/dist/gateway/static/root/assets/{agents-DNQNTDkU.js → agents-DYazUaZ6.js} +1 -1
  24. package/dist/gateway/static/root/assets/{api-CnJAVHBu.js → api-KMJzMqvZ.js} +1 -1
  25. package/dist/gateway/static/root/assets/{app-management-settings-panel-oHTY5PDs.js → app-management-settings-panel-B42TpqIb.js} +1 -1
  26. package/dist/gateway/static/root/assets/{appearance-settings-B0YnZ3ig.js → appearance-settings-D9Lfe7Sk.js} +1 -1
  27. package/dist/gateway/static/root/assets/apps-page-BzrodN8C.js +1 -0
  28. package/dist/gateway/static/root/assets/{archive-plugin-D4x142le.js → archive-plugin-BdmQwj4x.js} +1 -1
  29. package/dist/gateway/static/root/assets/{attachment-load-zibD2Hod.js → attachment-load-B4S0_nji.js} +1 -1
  30. package/dist/gateway/static/root/assets/{attachment-preview-renderer-CfEDFYPE.js → attachment-preview-renderer-wzIchDSv.js} +4 -4
  31. package/dist/gateway/static/root/assets/attachment-process-heavy-Db4nTY5N.js +5 -0
  32. package/dist/gateway/static/root/assets/{automations-page-Dkp7gp_S.js → automations-page-B3TmHNjQ.js} +1 -1
  33. package/dist/gateway/static/root/assets/automations-workspace--A4I0jMu.js +6 -0
  34. package/dist/gateway/static/root/assets/binary-plugins-B3cXF_DP.js +2 -0
  35. package/dist/gateway/static/root/assets/{block-editor-r5nCBBan.js → block-editor-05zyBXBe.js} +3 -3
  36. package/dist/gateway/static/root/assets/{browser-automation-inputs-DcVLoIzc.js → browser-automation-inputs-BTIufVbM.js} +1 -1
  37. package/dist/gateway/static/root/assets/{browser-automations-page-BnL4JnTM.js → browser-automations-page-DRBA9nwe.js} +2 -2
  38. package/dist/gateway/static/root/assets/browser-settings-page-DDTXUNWK.js +8 -0
  39. package/dist/gateway/static/root/assets/capabilities-settings-panel-Ll5UeXq5.js +8 -0
  40. package/dist/gateway/static/root/assets/channels-settings-BzL15bkU.js +1 -0
  41. package/dist/gateway/static/root/assets/{channels-status-swr-BTT2sIGg.js → channels-status-swr-DMYQNs-J.js} +1 -1
  42. package/dist/gateway/static/root/assets/{chat-terminal-dock-CWVnJtBp.js → chat-terminal-dock-Dx5KQyo5.js} +2 -2
  43. package/dist/gateway/static/root/assets/connectors-page-RPw1AOMb.js +2 -0
  44. package/dist/gateway/static/root/assets/{date-picker-XjPSlgq_.js → date-picker-CkDROZoe.js} +1 -1
  45. package/dist/gateway/static/root/assets/{dependency-picker-CkyfEP88.js → dependency-picker-Bl8HcvzL.js} +1 -1
  46. package/dist/gateway/static/root/assets/{desktop-pet-BAE_NVx5.js → desktop-pet-BcknAjbW.js} +1 -1
  47. package/dist/gateway/static/root/assets/{desktop-pet-settings-BUw6V2R9.js → desktop-pet-settings-BuCpXQPm.js} +1 -1
  48. package/dist/gateway/static/root/assets/device-pairing-wizard-D0_tCX49.js +1 -0
  49. package/dist/gateway/static/root/assets/{extension-debug-page-giBeIVUT.js → extension-debug-page-qRpb2FFa.js} +1 -1
  50. package/dist/gateway/static/root/assets/{extension-page-Bqo9bNtx.js → extension-page-C7gs9wu4.js} +1 -1
  51. package/dist/gateway/static/root/assets/{extension-settings-page-BX-6AA3k.js → extension-settings-page-CyJP1CMZ.js} +1 -1
  52. package/dist/gateway/static/root/assets/gateway-config-swr-Cpmyrr6j.js +1 -0
  53. package/dist/gateway/static/root/assets/gateway-settings-DOeeTdWE.js +1 -0
  54. package/dist/gateway/static/root/assets/{gateway-startup-retry-CVTa5HSS.js → gateway-startup-retry-DoiPeb65.js} +1 -1
  55. package/dist/gateway/static/root/assets/{heartbeat-settings-DWFAopk_.js → heartbeat-settings-CV6Dolcn.js} +1 -1
  56. package/dist/gateway/static/root/assets/home-page-Djw1H_Go.js +1 -0
  57. package/dist/gateway/static/root/assets/{image-generation-api-DtMRG1oF.js → image-generation-api-CqjHWl2T.js} +1 -1
  58. package/dist/gateway/static/root/assets/index-B_Sg5BKz.css +2 -0
  59. package/dist/gateway/static/root/assets/index-CHgOG1aR.js +74 -0
  60. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BKGPpBnV.js → keyboard-shortcuts-settings-B3XqA41D.js} +1 -1
  61. package/dist/gateway/static/root/assets/local-app-workbench-page-BPqgyYJq.js +2 -0
  62. package/dist/gateway/static/root/assets/{local-apps-page-B06ToOxB.js → local-apps-page-BcIVYp0J.js} +1 -1
  63. package/dist/gateway/static/root/assets/{locale-store-BkJ7g35d.js → locale-store-1urrBBCQ.js} +1 -1
  64. package/dist/gateway/static/root/assets/{logs-page-DibI1GsP.js → logs-page-BHax3XlS.js} +2 -2
  65. package/dist/gateway/static/root/assets/{management-settings-DJ6yMZCd.js → management-settings-DNFCdgzR.js} +1 -1
  66. package/dist/gateway/static/root/assets/{markdown-view-DF3aJP_5.js → markdown-view-BZmcFIWa.js} +1 -1
  67. package/dist/gateway/static/root/assets/{media-plugins-CdrLNAks.js → media-plugins-BDxNhoBC.js} +1 -1
  68. package/dist/gateway/static/root/assets/messages-DYFcjtmG.js +3 -0
  69. package/dist/gateway/static/root/assets/note-detail-panel-Cs46LFXO.js +5 -0
  70. package/dist/gateway/static/root/assets/notes-page-BUkcn_0t.js +8 -0
  71. package/dist/gateway/static/root/assets/{page-tabs-B7LA4z-x.js → page-tabs-agH3a2PI.js} +1 -1
  72. package/dist/gateway/static/root/assets/pdf-runtime-DU_sMPjG.js +2 -0
  73. package/dist/gateway/static/root/assets/pdf.worker.min-B4E34YdZ.js +48 -0
  74. package/dist/gateway/static/root/assets/{preview-open-alternatives-DTQRN7WR.js → preview-open-alternatives-XEZ7zDOP.js} +1 -1
  75. package/dist/gateway/static/root/assets/proactive-page-Bn484J9v.js +1 -0
  76. package/dist/gateway/static/root/assets/{product-open-page-BazdmFYo.js → product-open-page-lXAbj85Z.js} +1 -1
  77. package/dist/gateway/static/root/assets/project-detail-page-LcH21ixD.js +1 -0
  78. package/dist/gateway/static/root/assets/projects-page-DelBiwyB.js +1 -0
  79. package/dist/gateway/static/root/assets/{registry-api-CTq8EECj.js → registry-api-CxQstD00.js} +1 -1
  80. package/dist/gateway/static/root/assets/remote-access-hub-3BjFYXCf.js +1 -0
  81. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-D-DZf4I1.js → runtime-tools-settings-panel-DErKZlVJ.js} +2 -2
  82. package/dist/gateway/static/root/assets/{schema-form-B-Yj9DVW.js → schema-form-DhCmJQVJ.js} +1 -1
  83. package/dist/gateway/static/root/assets/sessions-page-CVFirgVd.js +1 -0
  84. package/dist/gateway/static/root/assets/settings-advanced-gate-DyfBpqkY.js +1 -0
  85. package/dist/gateway/static/root/assets/{settings-form-section-BxPUqwY6.js → settings-form-section-Dg6chotg.js} +1 -1
  86. package/dist/gateway/static/root/assets/{settings-page-zLn8lIrs.js → settings-page-LyuN5N3M.js} +1 -1
  87. package/dist/gateway/static/root/assets/setup-status-panel-CrXhTzHr.js +1 -0
  88. package/dist/gateway/static/root/assets/share-preview-page-CZvmf4Ob.js +2 -0
  89. package/dist/gateway/static/root/assets/shares-settings-DyM_D8hM.js +1 -0
  90. package/dist/gateway/static/root/assets/skill-reload-api-Bys58-15.js +1 -0
  91. package/dist/gateway/static/root/assets/skills-page-sWNvFo6D.js +2 -0
  92. package/dist/gateway/static/root/assets/{skills-page.utils-BR5bk2vT.js → skills-page.utils-Eu0WVHTS.js} +1 -1
  93. package/dist/gateway/static/root/assets/{system-settings-panel-C0ptJutB.js → system-settings-panel-DQKkM7B2.js} +1 -1
  94. package/dist/gateway/static/root/assets/task-detail-page-B18NcZQJ.js +1 -0
  95. package/dist/gateway/static/root/assets/{theme-store-mV6Cm2vj.js → theme-store-Dc5s20V3.js} +1 -1
  96. package/dist/gateway/static/root/assets/tunnel-api-TKQpPVd6.js +1 -0
  97. package/dist/gateway/static/root/assets/{use-autosave-Dc5aN2px.js → use-autosave-CkVlrFk1.js} +1 -1
  98. package/dist/gateway/static/root/assets/user-model-page-ul-zr58b.js +2 -0
  99. package/dist/gateway/static/root/assets/{voice-api-key-field-CY0DpJui.js → voice-api-key-field-B12fFN-L.js} +1 -1
  100. package/dist/gateway/static/root/assets/{voice-config-api-D3DdcH4H.js → voice-config-api-Mk78BrpP.js} +1 -1
  101. package/dist/gateway/static/root/assets/{work-discovery-overlay-Brg9yJBr.js → work-discovery-overlay-CT9Zy36i.js} +1 -1
  102. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D3fq7boB.js → workflow-run-setup-panel-BwefQliE.js} +2 -2
  103. package/dist/gateway/static/root/assets/workflows-page-BY_AWs7S.js +6 -0
  104. package/dist/gateway/static/root/index.html +10 -11
  105. package/dist/package.js +1 -1
  106. package/dist/packages/gateway-contract/src/discussions.js +17 -0
  107. package/dist/packages/gateway-contract/src/proactive.js +4 -2
  108. package/dist/src/agent/agent-manager.js +17 -17
  109. package/dist/src/agent/agent-scope.js +2 -2
  110. package/dist/src/agent/background-review/run-background-review.js +4 -4
  111. package/dist/src/agent/context/coordinator.js +3 -3
  112. package/dist/src/agent/context/execution-context.js +4 -4
  113. package/dist/src/agent/context/execution-scope.js +2 -2
  114. package/dist/src/agent/context/project-context.d.ts +1 -0
  115. package/dist/src/agent/context/project-context.js +16 -8
  116. package/dist/src/agent/embedded/index.js +2 -2
  117. package/dist/src/agent/embedded/model-runtime.js +1 -1
  118. package/dist/src/agent/embedded/run-for-session.js +5 -5
  119. package/dist/src/agent/embedded/run-turn.js +2 -2
  120. package/dist/src/agent/embedded/session-tool-result-guard.js +3 -3
  121. package/dist/src/agent/external-tools/composio-provider.js +1 -1
  122. package/dist/src/agent/external-tools/gateway-tools.js +1 -1
  123. package/dist/src/agent/external-tools/mcp-provider.js +2 -2
  124. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  125. package/dist/src/agent/image/generation/providers/dashscope.js +1 -1
  126. package/dist/src/agent/image/generation/providers/fal.js +1 -1
  127. package/dist/src/agent/image/generation/providers/google.js +1 -1
  128. package/dist/src/agent/image/generation/runtime.js +1 -1
  129. package/dist/src/agent/image/index.js +1 -1
  130. package/dist/src/agent/image/load-image-media.js +1 -1
  131. package/dist/src/agent/image/tool-model-config.js +1 -1
  132. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  133. package/dist/src/agent/inbound/inbound-loop.js +2 -2
  134. package/dist/src/agent/index.js +1 -1
  135. package/dist/src/agent/mcp/bundle-mcp-gateway.js +1 -1
  136. package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
  137. package/dist/src/agent/mcp/index.js +2 -2
  138. package/dist/src/agent/mcp/mcp-transport.js +1 -1
  139. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
  140. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  141. package/dist/src/agent/memory/index.js +2 -2
  142. package/dist/src/agent/messaging/outbound-coordinator.js +1 -1
  143. package/dist/src/agent/orchestration/agent-orchestrator.js +5 -5
  144. package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
  145. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  146. package/dist/src/agent/service/direct-turn-helpers.js +6 -6
  147. package/dist/src/agent/service/process-direct-one-shot.js +1 -1
  148. package/dist/src/agent/service/process-direct-streaming.js +5 -5
  149. package/dist/src/agent/service/webchat-tts.js +2 -2
  150. package/dist/src/agent/service.js +19 -19
  151. package/dist/src/agent/session/session-inspector.js +1 -1
  152. package/dist/src/agent/skills/filesystem-watcher.js +1 -1
  153. package/dist/src/agent/skills/hub-lock.js +1 -1
  154. package/dist/src/agent/skills/hub-pull.js +3 -3
  155. package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
  156. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
  157. package/dist/src/agent/source-context/task-context.d.ts +3 -0
  158. package/dist/src/agent/source-context/task-context.js +24 -0
  159. package/dist/src/agent/source-context/types.d.ts +2 -2
  160. package/dist/src/agent/source-context/types.js +1 -1
  161. package/dist/src/agent/tasks/task-judge-service.js +5 -5
  162. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  163. package/dist/src/agent/tool-manuals/xopc-use.js +1 -0
  164. package/dist/src/agent/tools/create-share-tool.js +3 -3
  165. package/dist/src/agent/tools/delegate-tool.js +3 -3
  166. package/dist/src/agent/tools/executor.js +1 -1
  167. package/dist/src/agent/tools/factory.js +13 -13
  168. package/dist/src/agent/tools/image-generate-tool.js +3 -3
  169. package/dist/src/agent/tools/index.js +5 -5
  170. package/dist/src/agent/tools/list-dir.js +1 -1
  171. package/dist/src/agent/tools/publish-artifacts.js +2 -2
  172. package/dist/src/agent/tools/read.js +1 -1
  173. package/dist/src/agent/tools/review-workspace.js +1 -1
  174. package/dist/src/agent/tools/send-media.js +2 -2
  175. package/dist/src/agent/tools/skills-tools.js +1 -1
  176. package/dist/src/agent/tools/tts-tool.js +1 -1
  177. package/dist/src/agent/tools/user-context-tool.js +1 -1
  178. package/dist/src/agent/tools/write.js +2 -2
  179. package/dist/src/agent/tools/xopc-use-tool.js +6 -6
  180. package/dist/src/agent/workflow/subagent-runner.js +1 -1
  181. package/dist/src/ai-assist/text-assist.js +1 -1
  182. package/dist/src/auth/credentials.js +2 -2
  183. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  184. package/dist/src/auth/profiles/store.js +1 -1
  185. package/dist/src/auth/sync-provider-auth.js +2 -2
  186. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  187. package/dist/src/capabilities/store-connector.js +1 -1
  188. package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
  189. package/dist/src/channels/index.js +2 -2
  190. package/dist/src/channels/outbound-sender.js +1 -1
  191. package/dist/src/channels/pairing/allow-from-file.js +9 -9
  192. package/dist/src/channels/pairing/pairing-store.js +6 -6
  193. package/dist/src/chat-commands/builtins/config.js +2 -2
  194. package/dist/src/chat-commands/builtins/review.js +1 -1
  195. package/dist/src/chat-commands/builtins/session.js +1 -1
  196. package/dist/src/chat-commands/builtins/thinking.js +1 -1
  197. package/dist/src/chat-commands/builtins/tts.js +1 -1
  198. package/dist/src/chat-commands/builtins/understanding.js +1 -1
  199. package/dist/src/chat-commands/builtins/workflow.js +2 -2
  200. package/dist/src/chat-commands/context.js +2 -2
  201. package/dist/src/chat-commands/index.js +3 -3
  202. package/dist/src/cli/commands/agent.js +6 -6
  203. package/dist/src/cli/commands/agents.js +1 -1
  204. package/dist/src/cli/commands/config.js +1 -1
  205. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  206. package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -3
  207. package/dist/src/cli/commands/extension-dev.js +1 -1
  208. package/dist/src/cli/commands/extension.js +1 -1
  209. package/dist/src/cli/commands/gateway/shared.js +1 -1
  210. package/dist/src/cli/commands/gateway/token.js +1 -1
  211. package/dist/src/cli/commands/image.js +1 -1
  212. package/dist/src/cli/commands/init.js +1 -1
  213. package/dist/src/cli/commands/models.js +1 -1
  214. package/dist/src/cli/commands/onboard.js +1 -1
  215. package/dist/src/cli/commands/project.js +2 -2
  216. package/dist/src/cli/commands/runtime.js +1 -1
  217. package/dist/src/cli/commands/skills.js +2 -2
  218. package/dist/src/cli/commands/tui.js +1 -1
  219. package/dist/src/cli/commands/tunnel.js +3 -3
  220. package/dist/src/cli/extension-cli-register.js +4 -4
  221. package/dist/src/cli/utils/gateway-client.js +1 -1
  222. package/dist/src/config/index.js +5 -5
  223. package/dist/src/config/loader.js +2 -2
  224. package/dist/src/config/models-json.js +1 -1
  225. package/dist/src/connectors/connected-source-understanding.js +2 -2
  226. package/dist/src/connectors/connection-recovery-service.js +3 -3
  227. package/dist/src/discussions/action-tasks.d.ts +21 -0
  228. package/dist/src/discussions/action-tasks.js +93 -0
  229. package/dist/src/discussions/analyzer.d.ts +21 -1
  230. package/dist/src/discussions/analyzer.js +229 -62
  231. package/dist/src/discussions/audio-repair.d.ts +8 -0
  232. package/dist/src/discussions/audio-repair.js +41 -0
  233. package/dist/src/discussions/edits.d.ts +22 -0
  234. package/dist/src/discussions/edits.js +81 -0
  235. package/dist/src/discussions/errors.d.ts +4 -0
  236. package/dist/src/discussions/errors.js +10 -0
  237. package/dist/src/discussions/export.d.ts +2 -0
  238. package/dist/src/discussions/export.js +23 -0
  239. package/dist/src/discussions/index.js +3 -2
  240. package/dist/src/discussions/live-worker.js +2 -2
  241. package/dist/src/discussions/organizer-worker.js +14 -5
  242. package/dist/src/discussions/organizer.d.ts +1 -1
  243. package/dist/src/discussions/organizer.js +60 -24
  244. package/dist/src/discussions/reconcile.d.ts +22 -0
  245. package/dist/src/discussions/reconcile.js +55 -0
  246. package/dist/src/discussions/recording.d.ts +9 -0
  247. package/dist/src/discussions/recording.js +219 -0
  248. package/dist/src/discussions/recordingJobs.d.ts +14 -0
  249. package/dist/src/discussions/recordingJobs.js +69 -0
  250. package/dist/src/discussions/repository.d.ts +4 -2
  251. package/dist/src/discussions/repository.js +15 -10
  252. package/dist/src/discussions/revisions.d.ts +12 -0
  253. package/dist/src/discussions/revisions.js +36 -0
  254. package/dist/src/discussions/sealer.d.ts +1 -0
  255. package/dist/src/discussions/sealer.js +62 -12
  256. package/dist/src/discussions/service.d.ts +16 -15
  257. package/dist/src/discussions/service.js +177 -91
  258. package/dist/src/discussions/types.d.ts +4 -139
  259. package/dist/src/discussions/types.js +1 -11
  260. package/dist/src/extensions/api.js +3 -3
  261. package/dist/src/extensions/bundled-extension-activation.js +1 -1
  262. package/dist/src/extensions/index.js +1 -1
  263. package/dist/src/extensions/loader.js +1 -1
  264. package/dist/src/extensions/lockfile.js +1 -1
  265. package/dist/src/extensions/sdk/index.js +1 -1
  266. package/dist/src/files/file-service.d.ts +1 -0
  267. package/dist/src/files/file-service.js +77 -0
  268. package/dist/src/gateway/agents-admin.js +4 -4
  269. package/dist/src/gateway/chat-stream/mapper.js +2 -2
  270. package/dist/src/gateway/device-routes.js +2 -2
  271. package/dist/src/gateway/file-path-classifier.js +2 -2
  272. package/dist/src/gateway/hono/app.js +6 -5
  273. package/dist/src/gateway/hono/lib/config-payload.js +3 -3
  274. package/dist/src/gateway/hono/lib/static-ui.js +1 -0
  275. package/dist/src/gateway/hono/routes/agents.js +1 -1
  276. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  277. package/dist/src/gateway/hono/routes/browser.js +1 -1
  278. package/dist/src/gateway/hono/routes/commands-skills.js +3 -3
  279. package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
  280. package/dist/src/gateway/hono/routes/context-sources.js +1 -2
  281. package/dist/src/gateway/hono/routes/discussions.js +126 -19
  282. package/dist/src/gateway/hono/routes/files.js +1 -22
  283. package/dist/src/gateway/hono/routes/index.js +0 -2
  284. package/dist/src/gateway/hono/routes/lazy-bundles.js +16 -0
  285. package/dist/src/gateway/hono/routes/mcp.js +2 -2
  286. package/dist/src/gateway/hono/routes/media.js +1 -1
  287. package/dist/src/gateway/hono/routes/models.js +5 -5
  288. package/dist/src/gateway/hono/routes/notes.js +1 -1
  289. package/dist/src/gateway/hono/routes/proactive-control.js +4 -38
  290. package/dist/src/gateway/hono/routes/project-understanding.d.ts +3 -0
  291. package/dist/src/gateway/hono/routes/project-understanding.js +65 -0
  292. package/dist/src/gateway/hono/routes/projects.js +22 -6
  293. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
  294. package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
  295. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  296. package/dist/src/gateway/hono/routes/shares.js +3 -3
  297. package/dist/src/gateway/hono/routes/site-shares.js +1 -1
  298. package/dist/src/gateway/hono/routes/status.js +1 -1
  299. package/dist/src/gateway/hono/routes/tasks.js +4 -3
  300. package/dist/src/gateway/hono/routes/user-model.js +4 -4
  301. package/dist/src/gateway/hono/routes/voice.js +3 -3
  302. package/dist/src/gateway/hono/routes/work-discovery.d.ts +0 -2
  303. package/dist/src/gateway/hono/routes/work-discovery.js +2 -16
  304. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  305. package/dist/src/gateway/image-generation-setup.js +1 -1
  306. package/dist/src/gateway/lock.js +10 -10
  307. package/dist/src/gateway/media-access.js +2 -2
  308. package/dist/src/gateway/ports.js +6 -6
  309. package/dist/src/gateway/security/gateway-scopes.js +1 -2
  310. package/dist/src/gateway/server.js +1 -1
  311. package/dist/src/gateway/service/agent-runner.js +2 -2
  312. package/dist/src/gateway/service/config-coordinator.js +4 -4
  313. package/dist/src/gateway/service/marketplace-service.js +3 -3
  314. package/dist/src/gateway/service/run-gateway-agent.js +3 -3
  315. package/dist/src/gateway/service.d.ts +3 -0
  316. package/dist/src/gateway/service.js +45 -30
  317. package/dist/src/gateway/session-context-summary.js +2 -2
  318. package/dist/src/gateway/workspace-editor-path.js +2 -2
  319. package/dist/src/infra/gateway-processes.js +2 -2
  320. package/dist/src/infra/path-env.js +3 -3
  321. package/dist/src/infra/update-global.js +10 -10
  322. package/dist/src/knowledge-memory/repository.d.ts +2 -0
  323. package/dist/src/knowledge-memory/repository.js +3 -1
  324. package/dist/src/local-apps/service.js +1 -1
  325. package/dist/src/media-shared/http/ssrf-guard.js +1 -1
  326. package/dist/src/media-understanding/audio-transcription-runner.d.ts +1 -0
  327. package/dist/src/media-understanding/audio-transcription-runner.js +1 -0
  328. package/dist/src/media-understanding/runner.js +1 -0
  329. package/dist/src/media-understanding/types.d.ts +8 -0
  330. package/dist/src/notes/agent-context.js +3 -3
  331. package/dist/src/notes/service.d.ts +3 -1
  332. package/dist/src/notes/store.d.ts +3 -1
  333. package/dist/src/notes/store.js +5 -3
  334. package/dist/src/proactive/actions/service.js +1 -1
  335. package/dist/src/proactive/execution/agent-executor.js +1 -1
  336. package/dist/src/proactive/execution/context.js +1 -1
  337. package/dist/src/proactive/execution/worker.js +1 -1
  338. package/dist/src/proactive/experience.d.ts +38 -21
  339. package/dist/src/proactive/experience.js +109 -13
  340. package/dist/src/proactive/follow-ups.js +1 -1
  341. package/dist/src/proactive/inbox/cards.js +9 -3
  342. package/dist/src/proactive/inbox/delivery.js +2 -2
  343. package/dist/src/proactive/inbox/digest.js +2 -2
  344. package/dist/src/proactive/inbox/notification-policy.js +1 -1
  345. package/dist/src/proactive/inbox/repository.js +1 -1
  346. package/dist/src/proactive/inbox/service.js +1 -1
  347. package/dist/src/proactive/index.js +1 -1
  348. package/dist/src/proactive/maintenance.js +0 -1
  349. package/dist/src/proactive/scenarios/control.d.ts +0 -35
  350. package/dist/src/proactive/scenarios/control.js +7 -53
  351. package/dist/src/proactive/temporal/worker.js +1 -1
  352. package/dist/src/projects/project-skill-service.js +2 -2
  353. package/dist/src/projects/project-store.js +6 -4
  354. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  355. package/dist/src/providers/index.js +2 -2
  356. package/dist/src/providers/model-reference-auditor.js +1 -1
  357. package/dist/src/providers/model-registry.js +1 -1
  358. package/dist/src/providers/register-runtime-providers.js +1 -1
  359. package/dist/src/remote-access/exposure-manager.js +1 -1
  360. package/dist/src/session/client-history.d.ts +1 -1
  361. package/dist/src/session/client-history.js +1 -1
  362. package/dist/src/session/index.js +2 -2
  363. package/dist/src/session/session-title.js +1 -1
  364. package/dist/src/session/store.js +3 -3
  365. package/dist/src/session/thinking-resolve.js +1 -1
  366. package/dist/src/share/share-store.js +1 -1
  367. package/dist/src/share/share-thumbnail.js +1 -1
  368. package/dist/src/share/site-share-store.js +1 -1
  369. package/dist/src/storage/sqlite/connection.js +9 -9
  370. package/dist/src/storage/sqlite/migrations/166_remove_proactive_previews.sql +1 -0
  371. package/dist/src/storage/sqlite/migrations/167_discussion_recording_chunks.sql +7 -0
  372. package/dist/src/storage/sqlite/migrations/168_discussion_evidence.sql +16 -0
  373. package/dist/src/storage/sqlite/migrations/169_discussion_action_tasks.sql +8 -0
  374. package/dist/src/storage/sqlite/migrations/170_discussion_edits.sql +8 -0
  375. package/dist/src/storage/sqlite/migrations/171_discussion_recording_jobs.sql +14 -0
  376. package/dist/src/storage/sqlite/migrations/172_project_understanding.sql +3 -0
  377. package/dist/src/storage/sqlite/migrations/173_mobile_discussion_source.sql +5 -0
  378. package/dist/src/storage/sqlite/migrations/__tests__/mobile-discussion-source.test.ts +20 -0
  379. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  380. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  381. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  382. package/dist/src/storage/sqlite/schema.js +1 -1
  383. package/dist/src/tasks/execution-context.js +1 -1
  384. package/dist/src/tasks/home-query-service.js +3 -3
  385. package/dist/src/tasks/index.js +3 -3
  386. package/dist/src/tasks/task-application-service.js +1 -1
  387. package/dist/src/tasks/task-context-assembler.js +1 -1
  388. package/dist/src/tasks/task-handoff-service.js +1 -1
  389. package/dist/src/tasks/task-repository.d.ts +1 -0
  390. package/dist/src/tasks/task-repository.js +4 -0
  391. package/dist/src/tasks/task-run-coordinator.js +1 -1
  392. package/dist/src/tui/backends/embedded-backend.js +9 -9
  393. package/dist/src/tui/backends/gateway-realtime-backend.js +2 -2
  394. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  395. package/dist/src/tui/tui-command-formatters.js +1 -1
  396. package/dist/src/tui/tui-commands.js +5 -5
  397. package/dist/src/tui/tui-picker-overlay.js +1 -1
  398. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  399. package/dist/src/tui/tui-startup-resources.js +5 -5
  400. package/dist/src/tui/tui.js +3 -3
  401. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  402. package/dist/src/voice/audio/normalize.js +28 -5
  403. package/dist/src/voice/local/runtime-worker.js +1 -1
  404. package/dist/src/voice/realtime/memory-context.js +3 -3
  405. package/dist/src/voice/stt/index.js +2 -2
  406. package/dist/src/voice/stt/preflight.js +1 -1
  407. package/dist/src/voice/stt/providers/local-transcription.js +1 -1
  408. package/dist/src/voice/stt/transcribe-core.js +2 -1
  409. package/dist/src/voice/stt/types.d.ts +1 -0
  410. package/dist/src/voice/tts/index.js +3 -3
  411. package/dist/src/voice/tts/merge-config.js +1 -1
  412. package/dist/src/voice/tts/payload.js +1 -1
  413. package/dist/src/voice/tts/speak-core.js +1 -1
  414. package/dist/src/work-discovery/analyzer.d.ts +1 -0
  415. package/dist/src/work-discovery/analyzer.js +28 -22
  416. package/dist/src/work-discovery/index.js +3 -3
  417. package/dist/src/work-discovery/investigator.js +1 -1
  418. package/dist/src/work-discovery/project-understanding.d.ts +7 -0
  419. package/dist/src/work-discovery/project-understanding.js +38 -0
  420. package/dist/src/work-discovery/repository.d.ts +3 -1
  421. package/dist/src/work-discovery/repository.js +18 -5
  422. package/dist/src/work-discovery/service.d.ts +8 -0
  423. package/dist/src/work-discovery/service.js +165 -17
  424. package/dist/src/work-discovery/types.d.ts +2 -0
  425. package/dist/src/workflows/context/workflow-context.js +1 -1
  426. package/dist/src/workflows/service/workflow-run-service.js +6 -6
  427. package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
  428. package/package.json +4 -4
  429. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DAqn5DdL.js +0 -1
  430. package/dist/gateway/static/root/assets/apps-page-Bh0etSmL.js +0 -1
  431. package/dist/gateway/static/root/assets/attachment-process-heavy-C5CqLCsX.js +0 -5
  432. package/dist/gateway/static/root/assets/automations-workspace-w4McwueN.js +0 -6
  433. package/dist/gateway/static/root/assets/binary-plugins-CfUzu1Hc.js +0 -2
  434. package/dist/gateway/static/root/assets/browser-settings-page-DxX-t0EJ.js +0 -8
  435. package/dist/gateway/static/root/assets/capabilities-settings-panel-CvacBQAI.js +0 -8
  436. package/dist/gateway/static/root/assets/channels-settings-CJzSNo-L.js +0 -1
  437. package/dist/gateway/static/root/assets/config-reload-event-Bjh2zoKp.js +0 -1
  438. package/dist/gateway/static/root/assets/connectors-page-DNBhBT0b.js +0 -2
  439. package/dist/gateway/static/root/assets/device-pairing-wizard-DsR5NQEC.js +0 -1
  440. package/dist/gateway/static/root/assets/excel-worksheet-utils-DpdB-DjU.js +0 -1
  441. package/dist/gateway/static/root/assets/gateway-config-swr-cd8owslz.js +0 -1
  442. package/dist/gateway/static/root/assets/gateway-settings-Dil7vuyU.js +0 -1
  443. package/dist/gateway/static/root/assets/home-page-Dpeuvazg.js +0 -1
  444. package/dist/gateway/static/root/assets/index-B03HGpzt.js +0 -74
  445. package/dist/gateway/static/root/assets/index-CXF9-BpI.css +0 -2
  446. package/dist/gateway/static/root/assets/local-app-workbench-page-CBtemxFc.js +0 -2
  447. package/dist/gateway/static/root/assets/messages-BGc-OJWg.js +0 -3
  448. package/dist/gateway/static/root/assets/note-detail-panel-GOxomxOK.js +0 -5
  449. package/dist/gateway/static/root/assets/notes-page-CQBgk3_x.js +0 -8
  450. package/dist/gateway/static/root/assets/pdf.worker.min-CHFwMXne.mjs +0 -29
  451. package/dist/gateway/static/root/assets/proactive-card-BF3741px.js +0 -1
  452. package/dist/gateway/static/root/assets/proactive-page-1EM217v0.js +0 -1
  453. package/dist/gateway/static/root/assets/project-detail-page-B1Pm-fQd.js +0 -1
  454. package/dist/gateway/static/root/assets/projects-page-DUrxyNR9.js +0 -1
  455. package/dist/gateway/static/root/assets/remote-access-hub-C6VzHUwx.js +0 -1
  456. package/dist/gateway/static/root/assets/sessions-page-DtemHfkv.js +0 -1
  457. package/dist/gateway/static/root/assets/settings-advanced-gate-ByEVQe0c.js +0 -1
  458. package/dist/gateway/static/root/assets/setup-status-panel-BwIrk3Jx.js +0 -1
  459. package/dist/gateway/static/root/assets/share-preview-page-DAc_FkVc.js +0 -2
  460. package/dist/gateway/static/root/assets/shares-settings-Dwdv6QyS.js +0 -1
  461. package/dist/gateway/static/root/assets/skill-reload-api-CDzQWN60.js +0 -1
  462. package/dist/gateway/static/root/assets/skills-page-CO5XVkbY.js +0 -2
  463. package/dist/gateway/static/root/assets/task-detail-page-DOjcKOzQ.js +0 -1
  464. package/dist/gateway/static/root/assets/tunnel-api-BABuQvGD.js +0 -1
  465. package/dist/gateway/static/root/assets/user-model-page-UhsSP_pC.js +0 -2
  466. package/dist/gateway/static/root/assets/workflows-page-S7XXNBWa.js +0 -6
  467. package/dist/src/proactive/scenarios/preview.d.ts +0 -13
  468. package/dist/src/proactive/scenarios/preview.js +0 -81
@@ -0,0 +1,41 @@
1
+ //#region src/discussions/audio-repair.ts
2
+ /** Subtract already confirmed ranges without guessing word-level boundaries. */
3
+ function missingAudioRanges(start, end, confirmed) {
4
+ let cursor = start;
5
+ const missing = [];
6
+ for (const range of [...confirmed].sort((a, b) => a.startedAtMs - b.startedAtMs)) {
7
+ if (range.endedAtMs <= cursor || range.startedAtMs >= end) continue;
8
+ if (range.startedAtMs > cursor) missing.push({
9
+ startedAtMs: cursor,
10
+ endedAtMs: Math.min(end, range.startedAtMs)
11
+ });
12
+ cursor = Math.max(cursor, Math.min(end, range.endedAtMs));
13
+ }
14
+ if (cursor < end) missing.push({
15
+ startedAtMs: cursor,
16
+ endedAtMs: end
17
+ });
18
+ return missing;
19
+ }
20
+ function slicePcmWav(audio, startMs, endMs) {
21
+ const start = Math.max(0, Math.round(startMs * audio.sampleRate / 1e3));
22
+ const end = Math.min(audio.samples.length, Math.round(endMs * audio.sampleRate / 1e3));
23
+ const samples = audio.samples.subarray(start, end);
24
+ const output = Buffer.alloc(44 + samples.length * 2);
25
+ output.write("RIFF", 0);
26
+ output.writeUInt32LE(output.length - 8, 4);
27
+ output.write("WAVEfmt ", 8);
28
+ output.writeUInt32LE(16, 16);
29
+ output.writeUInt16LE(1, 20);
30
+ output.writeUInt16LE(1, 22);
31
+ output.writeUInt32LE(audio.sampleRate, 24);
32
+ output.writeUInt32LE(audio.sampleRate * 2, 28);
33
+ output.writeUInt16LE(2, 32);
34
+ output.writeUInt16LE(16, 34);
35
+ output.write("data", 36);
36
+ output.writeUInt32LE(samples.length * 2, 40);
37
+ samples.forEach((sample, index) => output.writeInt16LE(Math.round(Math.max(-1, Math.min(1, sample)) * 32767), 44 + index * 2));
38
+ return output;
39
+ }
40
+ //#endregion
41
+ export { missingAudioRanges, slicePcmWav };
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import type { DiscussionOrganization } from './types.js';
3
+ export declare const MeetingEditSchema: z.ZodObject<{
4
+ kind: z.ZodEnum<{
5
+ summary: "summary";
6
+ risks: "risks";
7
+ decisions: "decisions";
8
+ actionItems: "actionItems";
9
+ openQuestions: "openQuestions";
10
+ }>;
11
+ itemId: z.ZodString;
12
+ expectedRevision: z.ZodNumber;
13
+ text: z.ZodOptional<z.ZodString>;
14
+ owner: z.ZodOptional<z.ZodString>;
15
+ dueDate: z.ZodOptional<z.ZodString>;
16
+ ignored: z.ZodOptional<z.ZodBoolean>;
17
+ }, z.core.$strip>;
18
+ type Edit = z.infer<typeof MeetingEditSchema>;
19
+ /** Preserve explicit user changes, with the immutable source revision they edited. */
20
+ export declare function applyMeetingEdits(id: string, organization: DiscussionOrganization): DiscussionOrganization;
21
+ export declare function editMeeting(id: string, input: Edit): import("@xopcai/gateway-contract/src/discussions.js").DiscussionOrganizationRecord;
22
+ export {};
@@ -0,0 +1,81 @@
1
+ import { getSqliteDatabase, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
2
+ import { DiscussionServiceError } from "./errors.js";
3
+ import { completeDiscussionOrganization, createDiscussionOrganization, getDiscussionCapture, getLatestDiscussionOrganization } from "./repository.js";
4
+ import { z } from "zod";
5
+ const MeetingEditSchema = z.object({
6
+ kind: z.enum([
7
+ "summary",
8
+ "decisions",
9
+ "actionItems",
10
+ "risks",
11
+ "openQuestions"
12
+ ]),
13
+ itemId: z.string().max(100),
14
+ expectedRevision: z.number().int().positive(),
15
+ text: z.string().trim().min(1).max(2e4).optional(),
16
+ owner: z.string().trim().max(200).optional(),
17
+ dueDate: z.string().trim().max(100).optional(),
18
+ ignored: z.boolean().optional()
19
+ });
20
+ /** Preserve explicit user changes, with the immutable source revision they edited. */
21
+ function applyMeetingEdits(id, organization) {
22
+ const edited = structuredClone(organization);
23
+ const rows = getSqliteDatabase().prepare("SELECT kind, item_id, value_json FROM discussion_edits WHERE discussion_id=?").all(id);
24
+ for (const row of rows) {
25
+ if (row.kind === "summary") {
26
+ edited.summary = JSON.parse(row.value_json).text;
27
+ edited.summaryEditedByUser = true;
28
+ continue;
29
+ }
30
+ const value = JSON.parse(row.value_json);
31
+ const list = edited[row.kind];
32
+ const index = list.findIndex((item) => item.id === row.item_id);
33
+ if (index < 0) list.push(value);
34
+ else list[index] = {
35
+ ...value,
36
+ supersededBy: list[index].supersededBy ?? value.supersededBy,
37
+ disputedBy: list[index].disputedBy ?? value.disputedBy
38
+ };
39
+ }
40
+ return edited;
41
+ }
42
+ function editMeeting(id, input) {
43
+ return runSqliteWriteTransaction((db) => {
44
+ const capture = getDiscussionCapture(id);
45
+ if (!capture) throw new DiscussionServiceError("not_found", "Discussion not found");
46
+ if (capture.status !== "completed" && capture.status !== "needs_attention") throw new DiscussionServiceError("conflict", "Wait for meeting processing to finish");
47
+ const previous = getLatestDiscussionOrganization(id);
48
+ if (!previous?.organization || previous.revision !== input.expectedRevision) throw new DiscussionServiceError("conflict", "Meeting summary changed; reload before editing");
49
+ let value;
50
+ if (input.kind === "summary") {
51
+ if (!input.text) throw new DiscussionServiceError("invalid_input", "Summary text is required");
52
+ value = { text: input.text };
53
+ } else {
54
+ const item = previous.organization[input.kind].find((candidate) => candidate.id === input.itemId);
55
+ if (!item) throw new DiscussionServiceError("not_found", "Meeting item not found");
56
+ value = {
57
+ ...item,
58
+ evidenceRevision: item.evidenceRevision ?? previous.transcriptRevision,
59
+ editedByUser: true,
60
+ reviewedChangeId: item.supersededBy ?? item.disputedBy
61
+ };
62
+ if (input.text !== void 0) if ("title" in value) value.title = input.text;
63
+ else value.text = input.text;
64
+ if ("title" in value) {
65
+ if (input.owner !== void 0) value.owner = input.owner || void 0;
66
+ if (input.dueDate !== void 0) value.dueDate = input.dueDate || void 0;
67
+ }
68
+ if (input.ignored !== void 0) value.ignored = input.ignored;
69
+ }
70
+ db.prepare("INSERT INTO discussion_edits (discussion_id,kind,item_id,value_json,updated_at) VALUES (?,?,?,?,?) ON CONFLICT(discussion_id,kind,item_id) DO UPDATE SET value_json=excluded.value_json,updated_at=excluded.updated_at").run(id, input.kind, input.kind === "summary" ? "summary" : input.itemId, JSON.stringify(value), Date.now());
71
+ return completeDiscussionOrganization(createDiscussionOrganization({
72
+ discussionId: id,
73
+ transcriptRevision: previous.transcriptRevision,
74
+ inputTranscriptSha256: previous.inputTranscriptSha256,
75
+ promptVersion: previous.promptVersion,
76
+ modelRef: previous.modelRef
77
+ }).id, applyMeetingEdits(id, previous.organization));
78
+ });
79
+ }
80
+ //#endregion
81
+ export { MeetingEditSchema, applyMeetingEdits, editMeeting };
@@ -0,0 +1,4 @@
1
+ export declare class DiscussionServiceError extends Error {
2
+ readonly code: 'invalid_input' | 'not_found' | 'conflict';
3
+ constructor(code: 'invalid_input' | 'not_found' | 'conflict', message: string);
4
+ }
@@ -0,0 +1,10 @@
1
+ //#region src/discussions/errors.ts
2
+ var DiscussionServiceError = class extends Error {
3
+ constructor(code, message) {
4
+ super(message);
5
+ this.code = code;
6
+ this.name = "DiscussionServiceError";
7
+ }
8
+ };
9
+ //#endregion
10
+ export { DiscussionServiceError };
@@ -0,0 +1,2 @@
1
+ import type { DiscussionDetail } from './types.js';
2
+ export declare function exportDiscussion(detail: DiscussionDetail, format: string): string;
@@ -0,0 +1,23 @@
1
+ import { DiscussionServiceError } from "./errors.js";
2
+ //#region src/discussions/export.ts
3
+ const time = (ms) => `${String(Math.floor(ms / 36e5)).padStart(2, "0")}:${String(Math.floor(ms / 6e4) % 60).padStart(2, "0")}:${String(Math.floor(ms / 1e3) % 60).padStart(2, "0")},${String(Math.round(ms) % 1e3).padStart(3, "0")}`;
4
+ function exportDiscussion(detail, format) {
5
+ const segments = detail.transcript.segments.filter((segment) => segment.status === "confirmed");
6
+ if (format === "txt") return segments.map((segment) => `${time(segment.startedAtMs)} ${segment.speakerLabel ?? ""}\n${segment.displayText ?? segment.rawText ?? ""}`).join("\n\n");
7
+ if (format === "srt") return segments.map((segment, index) => `${index + 1}\n${time(segment.startedAtMs)} --> ${time(segment.endedAtMs)}\n${segment.speakerLabel ? `${segment.speakerLabel}: ` : ""}${segment.displayText ?? segment.rawText ?? ""}`).join("\n\n");
8
+ if (format !== "md") throw new DiscussionServiceError("invalid_input", "Unsupported export format");
9
+ const organization = detail.organization?.organization;
10
+ if (!organization) throw new DiscussionServiceError("conflict", "Meeting summary is not ready");
11
+ return [
12
+ `# ${organization.title}`,
13
+ organization.summary,
14
+ ...[
15
+ ["Decisions", organization.decisions.filter((item) => !item.ignored && !item.supersededBy).map((item) => item.text)],
16
+ ["Actions", organization.actionItems.filter((item) => !item.ignored && !item.supersededBy).map((item) => `${item.title}${item.owner ? ` · ${item.owner}` : ""}${item.dueDate ? ` · ${item.dueDate}` : ""}`)],
17
+ ["Risks", organization.risks.filter((item) => !item.ignored && !item.supersededBy).map((item) => item.text)],
18
+ ["Open questions", organization.openQuestions.filter((item) => !item.ignored && !item.supersededBy).map((item) => item.text)]
19
+ ].map(([title, items]) => `## ${title}\n\n${items.map((text) => `- ${text}`).join("\n")}`)
20
+ ].join("\n\n");
21
+ }
22
+ //#endregion
23
+ export { exportDiscussion };
@@ -1,6 +1,7 @@
1
+ import { DISCUSSION_AUDIO_MAX_BYTES, DISCUSSION_MAX_DURATION_MS, DISCUSSION_STATUSES } from "../../packages/gateway-contract/src/discussions.js";
2
+ import { DiscussionServiceError } from "./errors.js";
1
3
  import { analyzeDiscussion } from "./analyzer.js";
2
- import { DISCUSSION_STATUSES } from "./types.js";
3
- import { DISCUSSION_AUDIO_MAX_BYTES, DISCUSSION_MAX_DURATION_MS, DiscussionService, DiscussionServiceError } from "./service.js";
4
+ import { DiscussionService } from "./service.js";
4
5
  import { DiscussionOrganizer } from "./organizer.js";
5
6
  import { DiscussionLiveWorker } from "./live-worker.js";
6
7
  import { DiscussionOrganizerWorker } from "./organizer-worker.js";
@@ -1,13 +1,13 @@
1
1
  import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
3
  import { ObjectLinkService } from "../activity/service.js";
4
- import { isSTTAvailable } from "../voice/stt/availability.js";
5
4
  import { transcribe } from "../voice/stt/transcribe-core.js";
5
+ import { isSTTAvailable } from "../voice/stt/availability.js";
6
6
  import { mergeSttConfigFromAppConfig } from "../voice/stt/config.js";
7
7
  import "../voice/stt/index.js";
8
- import { enrichLiveDiscussion } from "./analyzer.js";
9
8
  import { claimNextDiscussionTranscriptSegment, completeDiscussionTranscriptSegment, getDiscussionCapture, listDiscussionTranscriptSegments, retryOrFailDiscussionTranscriptSegment, updateDiscussionCapture } from "./repository.js";
10
9
  import { assembleDiscussionTranscript } from "./transcript.js";
10
+ import { enrichLiveDiscussion } from "./analyzer.js";
11
11
  import { acceptRankedProject, findExactProjectMention } from "./project-inference.js";
12
12
  import { randomUUID } from "node:crypto";
13
13
  //#region src/discussions/live-worker.ts
@@ -1,6 +1,6 @@
1
1
  import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
- import { claimNextDiscussionCapture, getDiscussionCapture, releaseDiscussionWorkLease, updateDiscussionCapture } from "./repository.js";
3
+ import { claimNextDiscussionCapture, getDiscussionCapture, releaseDiscussionWorkLease, renewDiscussionWorkLease, updateDiscussionCapture } from "./repository.js";
4
4
  import { randomUUID } from "node:crypto";
5
5
  //#region src/discussions/organizer-worker.ts
6
6
  init_logger();
@@ -31,13 +31,20 @@ var DiscussionOrganizerWorker = class {
31
31
  try {
32
32
  const capture = claimNextDiscussionCapture(this.owner);
33
33
  if (!capture) return;
34
+ const controller = new AbortController();
35
+ const renewal = setInterval(() => {
36
+ if (!renewDiscussionWorkLease(capture.id, this.owner)) controller.abort();
37
+ }, 3e4);
38
+ renewal.unref();
34
39
  try {
35
- await this.processor.process(capture, this.owner);
36
- releaseDiscussionWorkLease(capture.id);
40
+ await this.processor.process(capture, this.owner, controller.signal);
41
+ releaseDiscussionWorkLease(capture.id, this.owner);
37
42
  } catch (error) {
38
43
  const message = error instanceof Error ? error.message : String(error);
39
- releaseDiscussionWorkLease(capture.id);
40
- const updated = getDiscussionCapture(capture.id) && updateDiscussionCapture(capture.id, {
44
+ const ownsLease = renewDiscussionWorkLease(capture.id, this.owner);
45
+ releaseDiscussionWorkLease(capture.id, this.owner);
46
+ const current = getDiscussionCapture(capture.id);
47
+ const updated = ownsLease && current && updateDiscussionCapture(capture.id, {
41
48
  status: "needs_attention",
42
49
  failureStage: "organization",
43
50
  failureCode: "organization_failed",
@@ -48,6 +55,8 @@ var DiscussionOrganizerWorker = class {
48
55
  err: error,
49
56
  discussionId: capture.id
50
57
  }, `Discussion organization failed: ${message}`);
58
+ } finally {
59
+ clearInterval(renewal);
51
60
  }
52
61
  } finally {
53
62
  this.running = false;
@@ -17,6 +17,6 @@ export declare class DiscussionOrganizer {
17
17
  private readonly deps;
18
18
  private readonly objectLinks;
19
19
  constructor(deps: DiscussionOrganizerDeps);
20
- process(capture: DiscussionCapture, _owner: string, signal?: AbortSignal): Promise<DiscussionCapture>;
20
+ process(capture: DiscussionCapture, owner: string, signal?: AbortSignal): Promise<DiscussionCapture>;
21
21
  private linkProject;
22
22
  }
@@ -1,18 +1,22 @@
1
+ import { runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
1
2
  import { ObjectLinkService } from "../activity/service.js";
3
+ import { completeDiscussionOrganization, createDiscussionOrganization, getDiscussionCapture, getLatestDiscussionOrganization, listDiscussionTranscriptSegments, renewDiscussionWorkLease, updateDiscussionCapture } from "./repository.js";
4
+ import { saveTranscriptRevision } from "./revisions.js";
2
5
  import { analyzeDiscussion } from "./analyzer.js";
3
- import { completeDiscussionOrganization, createDiscussionOrganization, updateDiscussionCapture } from "./repository.js";
6
+ import { applyMeetingEdits } from "./edits.js";
4
7
  import { acceptRankedProject, findExactProjectMention } from "./project-inference.js";
5
8
  //#region src/discussions/organizer.ts
6
- const PROMPT_VERSION = "discussion-organizer-v1";
9
+ const PROMPT_VERSION = "discussion-evidence-v2";
7
10
  var DiscussionOrganizer = class {
8
11
  objectLinks = new ObjectLinkService();
9
12
  constructor(deps) {
10
13
  this.deps = deps;
11
14
  }
12
- async process(capture, _owner, signal) {
15
+ async process(capture, owner, signal) {
13
16
  const transcript = capture.canonicalTranscript?.trim();
14
17
  const inputHash = capture.canonicalTranscriptSha256;
15
18
  if (!transcript || !inputHash) throw new Error("Canonical discussion transcript is missing");
19
+ const transcriptRevision = saveTranscriptRevision(capture.id);
16
20
  const projects = this.deps.projects.list({
17
21
  status: "active",
18
22
  limit: 100
@@ -20,18 +24,35 @@ var DiscussionOrganizer = class {
20
24
  const result = this.deps.organizeTranscript ? await this.deps.organizeTranscript(transcript, capture, signal) : await analyzeDiscussion({
21
25
  config: this.deps.getConfig(),
22
26
  transcript,
27
+ segments: listDiscussionTranscriptSegments(capture.id),
28
+ discussionId: capture.id,
29
+ template: capture.template,
23
30
  projects: projects.map(({ id, name }) => ({
24
31
  id,
25
32
  name
26
33
  })),
27
34
  signal
28
35
  });
29
- completeDiscussionOrganization(createDiscussionOrganization({
30
- discussionId: capture.id,
31
- inputTranscriptSha256: inputHash,
32
- promptVersion: PROMPT_VERSION,
33
- modelRef: result.modelRef
34
- }).id, result.organization);
36
+ signal?.throwIfAborted();
37
+ if (!renewDiscussionWorkLease(capture.id, owner)) throw new Error("Meeting processing lease lost");
38
+ if (getDiscussionCapture(capture.id)?.canonicalTranscriptSha256 !== inputHash) throw new Error("Transcript changed during organization");
39
+ const previous = getLatestDiscussionOrganization(capture.id)?.organization;
40
+ if (previous) {
41
+ const signature = (refs) => JSON.stringify([...refs].sort((a, b) => a - b));
42
+ for (const kind of [
43
+ "decisions",
44
+ "actionItems",
45
+ "risks",
46
+ "openQuestions"
47
+ ]) for (const item of result.organization[kind]) {
48
+ const candidates = previous[kind].filter((old) => signature(old.evidenceSegmentIds) === signature(item.evidenceSegmentIds));
49
+ const label = (value) => "title" in value ? value.title : value.text;
50
+ const exact = previous[kind].filter((old) => label(old) === label(item));
51
+ const matches = exact.length ? exact : candidates;
52
+ const currentMatches = result.organization[kind].filter((other) => signature(other.evidenceSegmentIds) === signature(item.evidenceSegmentIds));
53
+ if (matches.length === 1 && (label(matches[0]) === label(item) && result.organization[kind].filter((other) => label(other) === label(item)).length === 1 || currentMatches.length === 1)) item.id = matches[0].id;
54
+ }
55
+ }
35
56
  let inferredProject;
36
57
  if (!capture.projectId) {
37
58
  const exact = findExactProjectMention(transcript, projects);
@@ -50,23 +71,38 @@ var DiscussionOrganizer = class {
50
71
  if (!note) throw new Error("Discussion note is missing");
51
72
  const title = result.organization.title.trim().slice(0, 200);
52
73
  if (note.title?.startsWith("Discussion ·") && title) await this.deps.notes.updateNote(capture.noteId, { title }, "ai_edit");
53
- const updated = updateDiscussionCapture(capture.id, {
54
- status: "completed",
55
- generatedTitle: title,
56
- ...inferredProject ? {
57
- projectId: inferredProject.id,
58
- projectInferenceScore: inferredProject.score,
59
- projectInferenceSource: inferredProject.source
60
- } : {},
61
- failureStage: void 0,
62
- failureCode: void 0,
63
- failureMessage: void 0,
64
- completedAt: Date.now()
65
- }, ["organizing"]);
66
- if (!updated) throw new Error("Discussion changed while applying organization");
74
+ const updated = runSqliteWriteTransaction(() => {
75
+ signal?.throwIfAborted();
76
+ if (!renewDiscussionWorkLease(capture.id, owner)) throw new Error("Meeting processing lease lost");
77
+ if (getDiscussionCapture(capture.id)?.canonicalTranscriptSha256 !== inputHash) throw new Error("Transcript changed during organization");
78
+ const record = createDiscussionOrganization({
79
+ discussionId: capture.id,
80
+ transcriptRevision,
81
+ inputTranscriptSha256: inputHash,
82
+ promptVersion: PROMPT_VERSION,
83
+ modelRef: result.modelRef
84
+ });
85
+ result.organization = applyMeetingEdits(capture.id, result.organization);
86
+ completeDiscussionOrganization(record.id, result.organization);
87
+ const published = updateDiscussionCapture(capture.id, {
88
+ status: "completed",
89
+ generatedTitle: title,
90
+ ...inferredProject ? {
91
+ projectId: inferredProject.id,
92
+ projectInferenceScore: inferredProject.score,
93
+ projectInferenceSource: inferredProject.source
94
+ } : {},
95
+ failureStage: void 0,
96
+ failureCode: void 0,
97
+ failureMessage: void 0,
98
+ completedAt: capture.completedAt ?? Date.now()
99
+ }, ["organizing"]);
100
+ if (!published) throw new Error("Discussion changed while applying organization");
101
+ return published;
102
+ });
67
103
  if (inferredProject) this.linkProject(updated, inferredProject.id);
68
104
  this.deps.onUpdated?.(updated);
69
- this.deps.onCompleted?.(updated, result.organization);
105
+ if (!capture.completedAt) this.deps.onCompleted?.(updated, result.organization);
70
106
  return updated;
71
107
  }
72
108
  linkProject(capture, projectId) {
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import type { DiscussionOrganization } from './types.js';
3
+ type Candidate = {
4
+ id: string;
5
+ kind: string;
6
+ text: string;
7
+ evidenceSegmentIds: number[];
8
+ };
9
+ export declare const MeetingChangesSchema: z.ZodObject<{
10
+ changes: z.ZodArray<z.ZodObject<{
11
+ fromId: z.ZodString;
12
+ toId: z.ZodString;
13
+ relation: z.ZodEnum<{
14
+ supersedes: "supersedes";
15
+ contradicts: "contradicts";
16
+ }>;
17
+ }, z.core.$strip>>;
18
+ }, z.core.$strip>;
19
+ export type MeetingChange = z.infer<typeof MeetingChangesSchema>['changes'][number];
20
+ /** Relations can only point from an earlier fact to an actual later fact. */
21
+ export declare function reconcileMeetingChapters(chapters: DiscussionOrganization[], compare: (earlier: Candidate[], later: Candidate[]) => Promise<MeetingChange[]>): Promise<MeetingChange[]>;
22
+ export {};
@@ -0,0 +1,55 @@
1
+ import { z } from "zod";
2
+ //#region src/discussions/reconcile.ts
3
+ const MeetingChangesSchema = z.object({ changes: z.array(z.object({
4
+ fromId: z.string(),
5
+ toId: z.string(),
6
+ relation: z.enum(["supersedes", "contradicts"])
7
+ })).max(200) });
8
+ function groups(items) {
9
+ const result = [];
10
+ let current = [];
11
+ let size = 0;
12
+ for (const item of items) {
13
+ const length = JSON.stringify(item).length;
14
+ if (length > 12e3) throw new Error("Meeting fact exceeds reconciliation input budget");
15
+ if (current.length && size + length > 12e3) {
16
+ result.push(current);
17
+ current = [];
18
+ size = 0;
19
+ }
20
+ current.push(item);
21
+ size += length;
22
+ }
23
+ if (current.length) result.push(current);
24
+ return result;
25
+ }
26
+ /** Relations can only point from an earlier fact to an actual later fact. */
27
+ async function reconcileMeetingChapters(chapters, compare) {
28
+ const earlier = [];
29
+ const changes = /* @__PURE__ */ new Map();
30
+ for (const chapter of chapters) {
31
+ const later = [];
32
+ for (const kind of [
33
+ "decisions",
34
+ "actionItems",
35
+ "risks",
36
+ "openQuestions"
37
+ ]) for (const item of chapter[kind]) later.push({
38
+ id: item.id,
39
+ kind,
40
+ text: "title" in item ? item.title : item.text,
41
+ evidenceSegmentIds: item.evidenceSegmentIds
42
+ });
43
+ for (const left of groups(earlier)) for (const right of groups(later)) {
44
+ const output = await compare(left, right);
45
+ for (const change of output) {
46
+ if (change.fromId === change.toId || !left.some((item) => item.id === change.fromId) || !right.some((item) => item.id === change.toId)) throw new Error("Meeting change refers to an invalid or unordered fact");
47
+ changes.set(`${change.fromId}:${change.toId}`, change);
48
+ }
49
+ }
50
+ earlier.push(...later.filter((item) => item.kind === "decisions" || item.kind === "actionItems"));
51
+ }
52
+ return [...changes.values()];
53
+ }
54
+ //#endregion
55
+ export { MeetingChangesSchema, reconcileMeetingChapters };
@@ -0,0 +1,9 @@
1
+ import { type DiscussionRecordingChunk, type DiscussionRecordingManifest } from '@xopcai/gateway-contract';
2
+ import type { NotesService } from '../notes/service.js';
3
+ import type { DiscussionCapture } from './types.js';
4
+ export declare function listRecordingChunks(id: string): DiscussionRecordingChunk[];
5
+ /** Called under the discussion mutation queue. Receipt follows durable disk write. */
6
+ export declare function saveRecordingChunk(capture: DiscussionCapture, sequence: number, sha256: string, body: ReadableStream<Uint8Array>): Promise<DiscussionRecordingChunk>;
7
+ export declare function validateRecordingManifest(capture: DiscussionCapture, input: DiscussionRecordingManifest): void;
8
+ export declare function completeRecording(capture: DiscussionCapture, input: DiscussionRecordingManifest, notes: NotesService, assertLease: () => void, signal: AbortSignal): Promise<DiscussionCapture>;
9
+ export declare function removeRecordingChunks(capture: DiscussionCapture): Promise<void>;