@xopcai/xopc 0.0.277 → 0.0.282

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 (315) 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/telegram/xopc.extension.json +1 -1
  11. package/dist/gateway/static/root/assets/{activity-store-SJZ5fS17.js → activity-store-iPtG94qr.js} +1 -1
  12. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Cavbls0E.js → agent-avatar-dicebear-Cny5rATT.js} +1 -1
  13. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-OyQ8OVZv.js +1 -0
  14. package/dist/gateway/static/root/assets/{agents-DlDTItrB.js → agents-DJeh_Ewo.js} +1 -1
  15. package/dist/gateway/static/root/assets/{api-CnJAVHBu.js → api-KMJzMqvZ.js} +1 -1
  16. package/dist/gateway/static/root/assets/{app-management-settings-panel-5gS0_LWl.js → app-management-settings-panel-ZqQKaZEI.js} +1 -1
  17. package/dist/gateway/static/root/assets/{appearance-settings-DHzZCJon.js → appearance-settings-CfXsQkKO.js} +1 -1
  18. package/dist/gateway/static/root/assets/apps-page-k-QnVhKW.js +1 -0
  19. package/dist/gateway/static/root/assets/{archive-plugin-Ia98yZe3.js → archive-plugin-BrW53Hap.js} +1 -1
  20. package/dist/gateway/static/root/assets/{attachment-load-DiWW88c8.js → attachment-load-DkfFWHiS.js} +1 -1
  21. package/dist/gateway/static/root/assets/{automations-page-BuhTeGRJ.js → automations-page-e-5we6kD.js} +1 -1
  22. package/dist/gateway/static/root/assets/automations-workspace-DPnlkws1.js +6 -0
  23. package/dist/gateway/static/root/assets/{binary-plugins-DDD48cJv.js → binary-plugins-CWIswfXA.js} +1 -1
  24. package/dist/gateway/static/root/assets/{block-editor-0AWVCD3F.js → block-editor-CfeF1OmA.js} +3 -3
  25. package/dist/gateway/static/root/assets/{browser-automation-inputs-DcVLoIzc.js → browser-automation-inputs-BTIufVbM.js} +1 -1
  26. package/dist/gateway/static/root/assets/{browser-automations-page-BKOYX5xV.js → browser-automations-page-DnsuWKRu.js} +2 -2
  27. package/dist/gateway/static/root/assets/browser-settings-page-C8xyhnxx.js +8 -0
  28. package/dist/gateway/static/root/assets/capabilities-settings-panel-CBllOLTT.js +8 -0
  29. package/dist/gateway/static/root/assets/channels-settings-C-A-VUE2.js +1 -0
  30. package/dist/gateway/static/root/assets/{channels-status-swr-BTT2sIGg.js → channels-status-swr-DMYQNs-J.js} +1 -1
  31. package/dist/gateway/static/root/assets/{chat-terminal-dock-CW9Byi8V.js → chat-terminal-dock-C_Fw1R3A.js} +2 -2
  32. package/dist/gateway/static/root/assets/connectors-page-CtsMo3H4.js +2 -0
  33. package/dist/gateway/static/root/assets/{date-picker-gdYmKC8W.js → date-picker-CPFxjTrN.js} +1 -1
  34. package/dist/gateway/static/root/assets/{dependency-picker-40BYmiMc.js → dependency-picker-C_5KqzjI.js} +1 -1
  35. package/dist/gateway/static/root/assets/{desktop-pet-By1z6tKE.js → desktop-pet-DLJsC5D6.js} +1 -1
  36. package/dist/gateway/static/root/assets/{desktop-pet-settings-ByjJqx9H.js → desktop-pet-settings-BdI1iSgz.js} +1 -1
  37. package/dist/gateway/static/root/assets/device-pairing-wizard-BnvPLhc9.js +1 -0
  38. package/dist/gateway/static/root/assets/{extension-debug-page-DQO65KbM.js → extension-debug-page-BNS_TkZQ.js} +1 -1
  39. package/dist/gateway/static/root/assets/{extension-page-Db32jip6.js → extension-page-DMSDZ7Mb.js} +1 -1
  40. package/dist/gateway/static/root/assets/{extension-settings-page-CL8Wx8lf.js → extension-settings-page-CeGCWMt0.js} +1 -1
  41. package/dist/gateway/static/root/assets/gateway-config-swr-Cpmyrr6j.js +1 -0
  42. package/dist/gateway/static/root/assets/gateway-settings-DKOTYUma.js +1 -0
  43. package/dist/gateway/static/root/assets/{gateway-startup-retry-CVTa5HSS.js → gateway-startup-retry-DoiPeb65.js} +1 -1
  44. package/dist/gateway/static/root/assets/{heartbeat-settings-CRXWu2q6.js → heartbeat-settings-gsdL_Yij.js} +1 -1
  45. package/dist/gateway/static/root/assets/home-page-CbeAdS1T.js +1 -0
  46. package/dist/gateway/static/root/assets/{image-generation-api-DtMRG1oF.js → image-generation-api-CqjHWl2T.js} +1 -1
  47. package/dist/gateway/static/root/assets/index-B_Sg5BKz.css +2 -0
  48. package/dist/gateway/static/root/assets/index-enFXJJCU.js +74 -0
  49. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CjehhHPz.js → keyboard-shortcuts-settings-CCLtJ8s8.js} +1 -1
  50. package/dist/gateway/static/root/assets/local-app-workbench-page-DzC6SrXj.js +2 -0
  51. package/dist/gateway/static/root/assets/{local-apps-page-CrIdaTrK.js → local-apps-page-3LdgP3NO.js} +1 -1
  52. package/dist/gateway/static/root/assets/{locale-store-BkJ7g35d.js → locale-store-1urrBBCQ.js} +1 -1
  53. package/dist/gateway/static/root/assets/{logs-page-FfSwV_VH.js → logs-page-DHClKtm6.js} +2 -2
  54. package/dist/gateway/static/root/assets/{management-settings-BakV5aOw.js → management-settings-BaCo9Nuo.js} +1 -1
  55. package/dist/gateway/static/root/assets/{markdown-view-DF3aJP_5.js → markdown-view-BZmcFIWa.js} +1 -1
  56. package/dist/gateway/static/root/assets/{media-plugins-Blv9U6Jp.js → media-plugins-BMjJppvG.js} +1 -1
  57. package/dist/gateway/static/root/assets/messages-DYFcjtmG.js +3 -0
  58. package/dist/gateway/static/root/assets/note-detail-panel-hYO2jNhL.js +5 -0
  59. package/dist/gateway/static/root/assets/notes-page-BT66x22W.js +8 -0
  60. package/dist/gateway/static/root/assets/{page-tabs-BQfVtLLC.js → page-tabs-BCszXX_F.js} +1 -1
  61. package/dist/gateway/static/root/assets/{preview-open-alternatives-kjHFiO81.js → preview-open-alternatives-CyM0sanh.js} +1 -1
  62. package/dist/gateway/static/root/assets/proactive-page-CVDGA5sB.js +1 -0
  63. package/dist/gateway/static/root/assets/{product-open-page-BazdmFYo.js → product-open-page-lXAbj85Z.js} +1 -1
  64. package/dist/gateway/static/root/assets/project-detail-page-Bp6TAMPM.js +1 -0
  65. package/dist/gateway/static/root/assets/projects-page-UhOIiDcg.js +1 -0
  66. package/dist/gateway/static/root/assets/{registry-api-CTq8EECj.js → registry-api-CxQstD00.js} +1 -1
  67. package/dist/gateway/static/root/assets/remote-access-hub-DJIkMFT4.js +1 -0
  68. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BhJlopSW.js → runtime-tools-settings-panel-BUFCgRdZ.js} +2 -2
  69. package/dist/gateway/static/root/assets/{schema-form-cxoO_5I1.js → schema-form-B01ksA8M.js} +1 -1
  70. package/dist/gateway/static/root/assets/sessions-page-CQOAwPDt.js +1 -0
  71. package/dist/gateway/static/root/assets/settings-advanced-gate-CFuqbGI-.js +1 -0
  72. package/dist/gateway/static/root/assets/{settings-form-section-BiRTWiBi.js → settings-form-section-DvnjZBa3.js} +1 -1
  73. package/dist/gateway/static/root/assets/{settings-page-D-Cb71pq.js → settings-page-DZRkpbCh.js} +1 -1
  74. package/dist/gateway/static/root/assets/setup-status-panel-DVaEiAVY.js +1 -0
  75. package/dist/gateway/static/root/assets/{share-preview-page-DciHfTay.js → share-preview-page-vz0UK56q.js} +1 -1
  76. package/dist/gateway/static/root/assets/shares-settings-XiCqMDAe.js +1 -0
  77. package/dist/gateway/static/root/assets/skill-reload-api-C3D8WanU.js +1 -0
  78. package/dist/gateway/static/root/assets/skills-page-CxMWwR6A.js +2 -0
  79. package/dist/gateway/static/root/assets/{skills-page.utils-CU7PALQB.js → skills-page.utils-BryVNYll.js} +1 -1
  80. package/dist/gateway/static/root/assets/{system-settings-panel-GpjNbqvM.js → system-settings-panel-mKFDe6aZ.js} +1 -1
  81. package/dist/gateway/static/root/assets/task-detail-page-Cb0RZNcJ.js +1 -0
  82. package/dist/gateway/static/root/assets/{theme-store-mV6Cm2vj.js → theme-store-Dc5s20V3.js} +1 -1
  83. package/dist/gateway/static/root/assets/tunnel-api-FcI3wKy3.js +1 -0
  84. package/dist/gateway/static/root/assets/{use-autosave-LvCiBidm.js → use-autosave-CDgdtjTC.js} +1 -1
  85. package/dist/gateway/static/root/assets/user-model-page-Cnshc-Un.js +2 -0
  86. package/dist/gateway/static/root/assets/{voice-api-key-field-BlGysZxj.js → voice-api-key-field-Ce8cb5mN.js} +1 -1
  87. package/dist/gateway/static/root/assets/{voice-config-api-D3DdcH4H.js → voice-config-api-Mk78BrpP.js} +1 -1
  88. package/dist/gateway/static/root/assets/{work-discovery-overlay-DvIQOR5x.js → work-discovery-overlay-CacFTtXe.js} +1 -1
  89. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-JIp60bXT.js → workflow-run-setup-panel-V-5HuEUq.js} +2 -2
  90. package/dist/gateway/static/root/assets/workflows-page-1OJimIfo.js +6 -0
  91. package/dist/gateway/static/root/index.html +10 -11
  92. package/dist/package.js +1 -1
  93. package/dist/packages/gateway-contract/src/discussions.js +17 -0
  94. package/dist/packages/gateway-contract/src/proactive.js +4 -2
  95. package/dist/src/agent/agent-manager.js +4 -4
  96. package/dist/src/agent/background-review/run-background-review.js +1 -1
  97. package/dist/src/agent/commands/command-isolation.d.ts +1 -0
  98. package/dist/src/agent/commands/command-isolation.js +17 -1
  99. package/dist/src/agent/commands/commandMounts.d.ts +2 -0
  100. package/dist/src/agent/commands/commandMounts.js +32 -0
  101. package/dist/src/agent/context/project-context.d.ts +1 -0
  102. package/dist/src/agent/context/project-context.js +12 -4
  103. package/dist/src/agent/embedded/model-runtime.js +1 -1
  104. package/dist/src/agent/embedded/run-for-session.js +1 -1
  105. package/dist/src/agent/image/tool-model-config.js +1 -1
  106. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  107. package/dist/src/agent/sandbox/command-validator.js +0 -20
  108. package/dist/src/agent/sandbox/exec-policy.d.ts +1 -0
  109. package/dist/src/agent/sandbox/exec-policy.js +4 -4
  110. package/dist/src/agent/sandbox/fileAccess.d.ts +7 -0
  111. package/dist/src/agent/sandbox/fileAccess.js +100 -0
  112. package/dist/src/agent/sandbox/path-policy.d.ts +2 -0
  113. package/dist/src/agent/sandbox/path-policy.js +54 -17
  114. package/dist/src/agent/sandbox/sanitize-env-vars.js +10 -9
  115. package/dist/src/agent/service.js +2 -2
  116. package/dist/src/agent/session/session-inspector.js +1 -1
  117. package/dist/src/agent/skills/hub-lock.js +1 -1
  118. package/dist/src/agent/source-context/task-context.d.ts +3 -0
  119. package/dist/src/agent/source-context/task-context.js +24 -0
  120. package/dist/src/agent/source-context/types.d.ts +2 -2
  121. package/dist/src/agent/source-context/types.js +1 -1
  122. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  123. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  124. package/dist/src/agent/tool-manuals/xopc-use.js +1 -0
  125. package/dist/src/agent/tools/apply-patch.js +25 -38
  126. package/dist/src/agent/tools/create-share-tool.js +11 -3
  127. package/dist/src/agent/tools/exec-command.js +2 -1
  128. package/dist/src/agent/tools/find.js +5 -3
  129. package/dist/src/agent/tools/grep.js +21 -4
  130. package/dist/src/agent/tools/image-generate-tool.js +3 -4
  131. package/dist/src/agent/tools/list-dir.js +2 -1
  132. package/dist/src/agent/tools/managed-job-tool.js +1 -0
  133. package/dist/src/agent/tools/publish-artifacts.js +4 -3
  134. package/dist/src/agent/tools/read.js +8 -5
  135. package/dist/src/agent/tools/repository-search.d.ts +2 -0
  136. package/dist/src/agent/tools/repository-search.js +51 -7
  137. package/dist/src/agent/tools/review-workspace.js +76 -10
  138. package/dist/src/agent/tools/send-media.js +4 -3
  139. package/dist/src/agent/tools/tool-paths.js +3 -1
  140. package/dist/src/agent/tools/write.js +4 -17
  141. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  142. package/dist/src/agent-config/schema.d.ts +24 -0
  143. package/dist/src/agent-config/schema.js +2 -1
  144. package/dist/src/ai-assist/text-assist.js +1 -1
  145. package/dist/src/auth/credentials.js +2 -2
  146. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  147. package/dist/src/auth/profiles/store.js +1 -1
  148. package/dist/src/auth/sync-provider-auth.js +2 -2
  149. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  150. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  151. package/dist/src/cli/commands/doctor/checks/provider-auth.js +21 -20
  152. package/dist/src/cli/commands/models.js +1 -1
  153. package/dist/src/config/index.js +4 -4
  154. package/dist/src/config/loader.js +2 -2
  155. package/dist/src/config/models-json.js +1 -1
  156. package/dist/src/config/schema.d.ts +16 -0
  157. package/dist/src/discussions/action-tasks.d.ts +21 -0
  158. package/dist/src/discussions/action-tasks.js +93 -0
  159. package/dist/src/discussions/analyzer.d.ts +21 -1
  160. package/dist/src/discussions/analyzer.js +229 -62
  161. package/dist/src/discussions/audio-repair.d.ts +8 -0
  162. package/dist/src/discussions/audio-repair.js +41 -0
  163. package/dist/src/discussions/edits.d.ts +22 -0
  164. package/dist/src/discussions/edits.js +81 -0
  165. package/dist/src/discussions/errors.d.ts +4 -0
  166. package/dist/src/discussions/errors.js +10 -0
  167. package/dist/src/discussions/export.d.ts +2 -0
  168. package/dist/src/discussions/export.js +23 -0
  169. package/dist/src/discussions/index.js +3 -2
  170. package/dist/src/discussions/live-worker.js +1 -1
  171. package/dist/src/discussions/organizer-worker.js +14 -5
  172. package/dist/src/discussions/organizer.d.ts +1 -1
  173. package/dist/src/discussions/organizer.js +60 -24
  174. package/dist/src/discussions/reconcile.d.ts +22 -0
  175. package/dist/src/discussions/reconcile.js +55 -0
  176. package/dist/src/discussions/recording.d.ts +9 -0
  177. package/dist/src/discussions/recording.js +219 -0
  178. package/dist/src/discussions/recordingJobs.d.ts +14 -0
  179. package/dist/src/discussions/recordingJobs.js +69 -0
  180. package/dist/src/discussions/repository.d.ts +4 -2
  181. package/dist/src/discussions/repository.js +15 -10
  182. package/dist/src/discussions/revisions.d.ts +12 -0
  183. package/dist/src/discussions/revisions.js +36 -0
  184. package/dist/src/discussions/sealer.d.ts +1 -0
  185. package/dist/src/discussions/sealer.js +61 -11
  186. package/dist/src/discussions/service.d.ts +16 -15
  187. package/dist/src/discussions/service.js +177 -91
  188. package/dist/src/discussions/types.d.ts +4 -139
  189. package/dist/src/discussions/types.js +1 -11
  190. package/dist/src/extensions/lockfile.js +1 -1
  191. package/dist/src/files/file-service.d.ts +1 -0
  192. package/dist/src/files/file-service.js +77 -0
  193. package/dist/src/gateway/agents-admin.js +1 -1
  194. package/dist/src/gateway/chat-stream/mapper.js +2 -2
  195. package/dist/src/gateway/file-path-classifier.js +1 -1
  196. package/dist/src/gateway/hono/app.js +3 -2
  197. package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -0
  198. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  199. package/dist/src/gateway/hono/lib/static-ui.js +1 -0
  200. package/dist/src/gateway/hono/routes/context-sources.js +1 -2
  201. package/dist/src/gateway/hono/routes/discussions.js +126 -19
  202. package/dist/src/gateway/hono/routes/files.js +1 -22
  203. package/dist/src/gateway/hono/routes/index.js +0 -2
  204. package/dist/src/gateway/hono/routes/lazy-bundles.js +16 -0
  205. package/dist/src/gateway/hono/routes/models.js +1 -1
  206. package/dist/src/gateway/hono/routes/proactive-control.js +2 -36
  207. package/dist/src/gateway/hono/routes/project-understanding.d.ts +3 -0
  208. package/dist/src/gateway/hono/routes/project-understanding.js +65 -0
  209. package/dist/src/gateway/hono/routes/projects.js +20 -4
  210. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
  211. package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
  212. package/dist/src/gateway/hono/routes/shares.js +22 -1
  213. package/dist/src/gateway/hono/routes/tasks.js +2 -1
  214. package/dist/src/gateway/hono/routes/work-discovery.d.ts +0 -2
  215. package/dist/src/gateway/hono/routes/work-discovery.js +2 -16
  216. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  217. package/dist/src/gateway/security/gateway-scopes.js +1 -2
  218. package/dist/src/gateway/service/agent-runner.js +2 -2
  219. package/dist/src/gateway/service/config-coordinator.js +1 -1
  220. package/dist/src/gateway/service.d.ts +3 -0
  221. package/dist/src/gateway/service.js +28 -13
  222. package/dist/src/knowledge-memory/repository.d.ts +2 -0
  223. package/dist/src/knowledge-memory/repository.js +3 -1
  224. package/dist/src/media-understanding/audio-transcription-runner.d.ts +1 -0
  225. package/dist/src/media-understanding/audio-transcription-runner.js +1 -0
  226. package/dist/src/media-understanding/runner.js +1 -0
  227. package/dist/src/media-understanding/types.d.ts +8 -0
  228. package/dist/src/notes/service.d.ts +3 -1
  229. package/dist/src/notes/store.d.ts +3 -1
  230. package/dist/src/notes/store.js +5 -3
  231. package/dist/src/proactive/experience.d.ts +38 -21
  232. package/dist/src/proactive/experience.js +113 -12
  233. package/dist/src/proactive/inbox/cards.js +7 -1
  234. package/dist/src/proactive/maintenance.js +0 -1
  235. package/dist/src/proactive/scenarios/control.d.ts +0 -35
  236. package/dist/src/proactive/scenarios/control.js +7 -53
  237. package/dist/src/projects/project-store.js +6 -4
  238. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  239. package/dist/src/providers/index.js +2 -2
  240. package/dist/src/providers/model-registry.js +1 -1
  241. package/dist/src/providers/register-runtime-providers.js +1 -1
  242. package/dist/src/session/client-history.d.ts +1 -1
  243. package/dist/src/session/client-history.js +1 -1
  244. package/dist/src/share/share-store.js +5 -1
  245. package/dist/src/storage/sqlite/migrations/166_remove_proactive_previews.sql +1 -0
  246. package/dist/src/storage/sqlite/migrations/167_discussion_recording_chunks.sql +7 -0
  247. package/dist/src/storage/sqlite/migrations/168_discussion_evidence.sql +16 -0
  248. package/dist/src/storage/sqlite/migrations/169_discussion_action_tasks.sql +8 -0
  249. package/dist/src/storage/sqlite/migrations/170_discussion_edits.sql +8 -0
  250. package/dist/src/storage/sqlite/migrations/171_discussion_recording_jobs.sql +14 -0
  251. package/dist/src/storage/sqlite/migrations/172_project_understanding.sql +3 -0
  252. package/dist/src/storage/sqlite/migrations/173_mobile_discussion_source.sql +5 -0
  253. package/dist/src/storage/sqlite/migrations/__tests__/mobile-discussion-source.test.ts +20 -0
  254. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  255. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  256. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  257. package/dist/src/storage/sqlite/schema.js +1 -1
  258. package/dist/src/tasks/home-query-service.js +2 -2
  259. package/dist/src/tasks/task-application-service.js +77 -3
  260. package/dist/src/tasks/task-context-assembler.js +1 -0
  261. package/dist/src/tasks/task-repository.d.ts +1 -0
  262. package/dist/src/tasks/task-repository.js +4 -0
  263. package/dist/src/tui/tui-startup-resources.js +1 -1
  264. package/dist/src/tui/tui.js +1 -1
  265. package/dist/src/voice/audio/normalize.js +28 -5
  266. package/dist/src/voice/stt/transcribe-core.js +1 -0
  267. package/dist/src/voice/stt/types.d.ts +1 -0
  268. package/dist/src/work-discovery/analyzer.d.ts +1 -0
  269. package/dist/src/work-discovery/analyzer.js +28 -22
  270. package/dist/src/work-discovery/index.js +3 -3
  271. package/dist/src/work-discovery/investigator.js +1 -1
  272. package/dist/src/work-discovery/project-understanding.d.ts +7 -0
  273. package/dist/src/work-discovery/project-understanding.js +38 -0
  274. package/dist/src/work-discovery/repository.d.ts +3 -1
  275. package/dist/src/work-discovery/repository.js +18 -5
  276. package/dist/src/work-discovery/service.d.ts +8 -0
  277. package/dist/src/work-discovery/service.js +163 -15
  278. package/dist/src/work-discovery/types.d.ts +2 -0
  279. package/dist/src/workflows/service/workflow-run-service.js +2 -2
  280. package/package.json +3 -3
  281. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DyCyuJpi.js +0 -1
  282. package/dist/gateway/static/root/assets/apps-page-__yzruGu.js +0 -1
  283. package/dist/gateway/static/root/assets/automations-workspace-DaisbmEh.js +0 -6
  284. package/dist/gateway/static/root/assets/browser-settings-page-C7zjxscU.js +0 -8
  285. package/dist/gateway/static/root/assets/capabilities-settings-panel-7kZMT1r6.js +0 -8
  286. package/dist/gateway/static/root/assets/channels-settings-BKUh6hzO.js +0 -1
  287. package/dist/gateway/static/root/assets/config-reload-event-Bjh2zoKp.js +0 -1
  288. package/dist/gateway/static/root/assets/connectors-page-m8J-F3u8.js +0 -2
  289. package/dist/gateway/static/root/assets/device-pairing-wizard-CfWQfz7a.js +0 -1
  290. package/dist/gateway/static/root/assets/gateway-config-swr-cd8owslz.js +0 -1
  291. package/dist/gateway/static/root/assets/gateway-settings-wLly-Kc1.js +0 -1
  292. package/dist/gateway/static/root/assets/home-page-FqgSwpmy.js +0 -1
  293. package/dist/gateway/static/root/assets/index-5UchbidQ.js +0 -74
  294. package/dist/gateway/static/root/assets/index-CXF9-BpI.css +0 -2
  295. package/dist/gateway/static/root/assets/local-app-workbench-page-DtYZa4GK.js +0 -2
  296. package/dist/gateway/static/root/assets/messages-BGc-OJWg.js +0 -3
  297. package/dist/gateway/static/root/assets/note-detail-panel-JbvyGdEX.js +0 -5
  298. package/dist/gateway/static/root/assets/notes-page-Dm7mE2FK.js +0 -8
  299. package/dist/gateway/static/root/assets/proactive-card-Ap_wfos3.js +0 -1
  300. package/dist/gateway/static/root/assets/proactive-page-D1lEuanT.js +0 -1
  301. package/dist/gateway/static/root/assets/project-detail-page-h00lfcVI.js +0 -1
  302. package/dist/gateway/static/root/assets/projects-page-C2Bo1FAL.js +0 -1
  303. package/dist/gateway/static/root/assets/remote-access-hub-_bZYAl49.js +0 -1
  304. package/dist/gateway/static/root/assets/sessions-page-F7CHsvPa.js +0 -1
  305. package/dist/gateway/static/root/assets/settings-advanced-gate-DtZSUX4H.js +0 -1
  306. package/dist/gateway/static/root/assets/setup-status-panel-VPfBsNVv.js +0 -1
  307. package/dist/gateway/static/root/assets/shares-settings-BS2pnWO0.js +0 -1
  308. package/dist/gateway/static/root/assets/skill-reload-api-DX344nVV.js +0 -1
  309. package/dist/gateway/static/root/assets/skills-page-BhfKUsv7.js +0 -2
  310. package/dist/gateway/static/root/assets/task-detail-page-CElcQ9Sh.js +0 -1
  311. package/dist/gateway/static/root/assets/tunnel-api-Bhi_x_h4.js +0 -1
  312. package/dist/gateway/static/root/assets/user-model-page-BydARq2C.js +0 -2
  313. package/dist/gateway/static/root/assets/workflows-page-B972t6zx.js +0 -6
  314. package/dist/src/proactive/scenarios/preview.d.ts +0 -13
  315. package/dist/src/proactive/scenarios/preview.js +0 -81
@@ -8,6 +8,12 @@ const TARGET_SAMPLE_RATE = 16e3;
8
8
  const MAX_DECODED_DURATION_SECONDS = 900;
9
9
  const MAX_DECODED_BYTES = TARGET_SAMPLE_RATE * 4 * MAX_DECODED_DURATION_SECONDS;
10
10
  const MAX_SEGMENTED_DURATION_SECONDS = 1800;
11
+ const LOCAL_AUDIO_INPUT_OPTIONS = [
12
+ "-protocol_whitelist",
13
+ "file,pipe",
14
+ "-format_whitelist",
15
+ "wav,matroska,webm,ogg,mp3,mov"
16
+ ];
11
17
  var AudioNormalizationError = class extends Error {
12
18
  code = "unsupported_audio_codec";
13
19
  constructor(message, options) {
@@ -73,23 +79,30 @@ function runFfmpeg(args, options = {}) {
73
79
  let outputBytes = 0;
74
80
  let errorBytes = 0;
75
81
  let settled = false;
82
+ let terminationError;
83
+ let killTimer;
76
84
  const finish = (error) => {
77
85
  if (settled) return;
78
86
  settled = true;
87
+ if (killTimer) clearTimeout(killTimer);
79
88
  options.signal?.removeEventListener("abort", abort);
80
89
  if (error) reject(error);
81
90
  else resolve(Buffer.concat(stdout));
82
91
  };
83
- const abort = () => {
92
+ const terminate = (error) => {
93
+ if (terminationError || settled) return;
94
+ terminationError = error;
84
95
  child.kill("SIGTERM");
85
- finish(new AudioNormalizationError("Audio decoding was cancelled"));
96
+ killTimer = setTimeout(() => child.kill("SIGKILL"), 2e3);
97
+ killTimer.unref();
86
98
  };
99
+ const abort = () => terminate(new AudioNormalizationError("Audio decoding was cancelled"));
87
100
  options.signal?.addEventListener("abort", abort, { once: true });
88
101
  child.stdout.on("data", (chunk) => {
102
+ if (terminationError) return;
89
103
  outputBytes += chunk.length;
90
104
  if (options.maxOutputBytes != null && outputBytes > options.maxOutputBytes) {
91
- child.kill("SIGTERM");
92
- finish(new AudioNormalizationError("Decoded audio exceeds the supported duration"));
105
+ terminate(new AudioNormalizationError("Decoded audio exceeds the supported duration"));
93
106
  return;
94
107
  }
95
108
  stdout.push(chunk);
@@ -105,6 +118,10 @@ function runFfmpeg(args, options = {}) {
105
118
  });
106
119
  child.once("close", (code) => {
107
120
  if (settled) return;
121
+ if (terminationError) {
122
+ finish(terminationError);
123
+ return;
124
+ }
108
125
  if (code === 0) finish();
109
126
  else finish(new AudioNormalizationError(Buffer.concat(stderr).toString("utf8").trim() || `Unsupported or corrupt audio (decoder exit ${code})`));
110
127
  });
@@ -123,6 +140,7 @@ async function decodeAudioToMonoFloat32(input) {
123
140
  if (!(error instanceof UnsupportedWavEncodingError)) throw error;
124
141
  }
125
142
  const bytes = await runFfmpeg([
143
+ ...LOCAL_AUDIO_INPUT_OPTIONS,
126
144
  "-i",
127
145
  "pipe:0",
128
146
  "-map",
@@ -159,6 +177,7 @@ async function forEachNormalizedAudioSegment(input, consume) {
159
177
  const outputPattern = join(directory, "segment-%05d.wav");
160
178
  try {
161
179
  await runFfmpeg([
180
+ ...LOCAL_AUDIO_INPUT_OPTIONS,
162
181
  "-i",
163
182
  input.filePath,
164
183
  "-map",
@@ -184,11 +203,15 @@ async function forEachNormalizedAudioSegment(input, consume) {
184
203
  if (files.length === 0) throw new AudioNormalizationError("Audio decoder produced no segments");
185
204
  let decodedDurationSeconds = 0;
186
205
  for (const file of files) {
206
+ input.signal?.throwIfAborted();
187
207
  const decoded = decodeWavToMonoFloat32(await readFile(join(directory, file)));
188
208
  decodedDurationSeconds += decoded.durationSeconds;
189
209
  if (decodedDurationSeconds > maxDurationSeconds + .05) throw new AudioNormalizationError(`Decoded audio exceeds the ${Math.round(maxDurationSeconds)} second limit`);
190
210
  }
191
- for (let index = 0; index < files.length; index += 1) await consume(await readFile(join(directory, files[index])), index);
211
+ for (let index = 0; index < files.length; index += 1) {
212
+ input.signal?.throwIfAborted();
213
+ await consume(await readFile(join(directory, files[index])), index);
214
+ }
192
215
  return files.length;
193
216
  } finally {
194
217
  await rm(directory, {
@@ -82,6 +82,7 @@ async function transcribe(audioBuffer, config, options) {
82
82
  const fallbackFrom = chosen.provider && chosen.provider !== primaryProvider ? primaryProvider : void 0;
83
83
  return {
84
84
  text: output.text,
85
+ ...output.segments ? { segments: output.segments } : {},
85
86
  provider: chosen.provider ?? "unknown",
86
87
  ...output.durationSeconds !== void 0 ? { duration: output.durationSeconds } : {},
87
88
  ...output.language || options?.language ? { language: output.language ?? options?.language } : {},
@@ -6,6 +6,7 @@
6
6
  * (see src/media-understanding/types.ts).
7
7
  */
8
8
  export interface STTResult {
9
+ segments?: import('../../media-understanding/types.js').AudioTranscriptionSegment[];
9
10
  /** Transcribed text. */
10
11
  text: string;
11
12
  /** Provider that performed the transcription (e.g. "alibaba", "openai"). */
@@ -5,6 +5,7 @@ export declare function analyzeWorkContext(input: {
5
5
  config: Config;
6
6
  snapshot: WorkContextSnapshot;
7
7
  candidateContext?: WorkDiscoveryCandidate[];
8
+ projectOverviewOnly?: boolean;
8
9
  signal?: AbortSignal;
9
10
  }): Promise<{
10
11
  modelRef: string;
@@ -184,27 +184,33 @@ async function analyzeWorkContext(input) {
184
184
  "You help a user resume real work in one explicitly selected local folder.",
185
185
  "Analyze only the supplied bounded snapshot. Never claim that you ran commands, tests, or inspected anything absent from it.",
186
186
  "Return only one JSON object with projectSummary, currentState, uncertainties, suggestions, profileCandidates, workThreads, conversationStarter, lowConfidence, and contextQuestion.",
187
- "profileCandidates contains only durable user-specific role, responsibility, preference, routine, communication, boundary, or relationship facts that are directly supported and would remain useful outside this repository snapshot.",
188
- "Do not put the project stack, packages, architecture, deployment setup, repository conventions, or current task in profileCandidates. Put project facts in projectSummary/currentState and current work in workThreads.",
189
- "Each profile candidate has category (role, responsibility, preference, routine, communication, boundary, or relationship), factKey, statement, confidence, and evidence.",
190
- "Put current or desired outcomes in workThreads, not profileCandidates. Emit boundary or relationship only when directly stated in user-authored evidence; never infer private relationship labels or expanded permissions.",
191
- "factKey is a stable language-neutral lowercase identifier such as workflow:code-review:github; equivalent facts in different languages must use the same factKey.",
192
187
  USER_FACING_UNDERSTANDING_WRITING_GUIDANCE,
193
- "Do not infer sensitive traits, identity, health, finances, political views, or anything not directly supported by the work evidence.",
194
- "workThreads contains every distinct evidence-backed work stream with topicKey, title, summary, horizon, status, confidence, and evidenceRefs. Do not merge unrelated streams to force a fixed count.",
195
- "horizon is current, ongoing, or long_term. status is active, paused, blocked, completed, or uncertain.",
196
- "topicKey is a short stable topic identifier. evidenceRefs must use exact relative paths from the snapshot or git://recent-state.",
197
- "Distinguish one-off recent edits from work sustained across multiple days. Prefer one current thread and only add ongoing or long_term threads when evidence supports them.",
198
- "For a normal result, suggestions must contain exactly 3 materially different next steps.",
199
- "Each suggestion must include actionType, title, rationale, evidence, actionPrompt, confidence, expectedTask, estimatedMinutes, risk, and verification.",
200
- "actionType must be summarize_recent_work, inspect_related_tests, or plan_next_step.",
201
- "risk must be analysis, command, or file_write. estimatedMinutes is an integer from 1 to 30.",
202
- "verification is a short array describing how the user can tell the task is real.",
203
- "Each evidence item contains an optional exact relative path from the snapshot and one concrete observation.",
204
- "actionPrompt asks the assistant to investigate or continue the step; it does not silently authorize file changes.",
205
- "conversationStarter is one concise, editable first-person prompt the user can send immediately. Ground it in the most important visible project or directory signal, ask the assistant to explain before acting, and never silently authorize file changes.",
206
- "Always return conversationStarter, including when confidence is low.",
207
- "If the current objective is unclear or fewer than three credible suggestions exist, set lowConfidence=true, return suggestions=[], and ask one concise contextQuestion.",
188
+ ...input.projectOverviewOnly ? [
189
+ "This request is background project understanding. Return empty suggestions, profileCandidates, and workThreads; omit conversationStarter and contextQuestion. Do not ask the user to make decisions.",
190
+ "Use projectSummary to describe the documented purpose and structure, and currentState for startup/test commands, project conventions, and constraints. Cite the supporting relative file paths inline.",
191
+ "Keep the overview concise. Distinguish documented facts from interpretations. Put missing goals and uncertain assumptions in uncertainties; never treat inferred goals as user-confirmed."
192
+ ] : [
193
+ "profileCandidates contains only durable user-specific role, responsibility, preference, routine, communication, boundary, or relationship facts that are directly supported and would remain useful outside this repository snapshot.",
194
+ "Do not put the project stack, packages, architecture, deployment setup, repository conventions, or current task in profileCandidates. Put project facts in projectSummary/currentState and current work in workThreads.",
195
+ "Each profile candidate has category (role, responsibility, preference, routine, communication, boundary, or relationship), factKey, statement, confidence, and evidence.",
196
+ "Put current or desired outcomes in workThreads, not profileCandidates. Emit boundary or relationship only when directly stated in user-authored evidence; never infer private relationship labels or expanded permissions.",
197
+ "factKey is a stable language-neutral lowercase identifier such as workflow:code-review:github; equivalent facts in different languages must use the same factKey.",
198
+ "Do not infer sensitive traits, identity, health, finances, political views, or anything not directly supported by the work evidence.",
199
+ "workThreads contains every distinct evidence-backed work stream with topicKey, title, summary, horizon, status, confidence, and evidenceRefs. Do not merge unrelated streams to force a fixed count.",
200
+ "horizon is current, ongoing, or long_term. status is active, paused, blocked, completed, or uncertain.",
201
+ "topicKey is a short stable topic identifier. evidenceRefs must use exact relative paths from the snapshot or git://recent-state.",
202
+ "Distinguish one-off recent edits from work sustained across multiple days. Prefer one current thread and only add ongoing or long_term threads when evidence supports them.",
203
+ "For a normal result, suggestions must contain exactly 3 materially different next steps.",
204
+ "Each suggestion must include actionType, title, rationale, evidence, actionPrompt, confidence, expectedTask, estimatedMinutes, risk, and verification.",
205
+ "actionType must be summarize_recent_work, inspect_related_tests, or plan_next_step.",
206
+ "risk must be analysis, command, or file_write. estimatedMinutes is an integer from 1 to 30.",
207
+ "verification is a short array describing how the user can tell the task is real.",
208
+ "Each evidence item contains an optional exact relative path from the snapshot and one concrete observation.",
209
+ "actionPrompt asks the assistant to investigate or continue the step; it does not silently authorize file changes.",
210
+ "conversationStarter is one concise, editable first-person prompt the user can send immediately. Ground it in the most important visible project or directory signal, ask the assistant to explain before acting, and never silently authorize file changes.",
211
+ "Always return conversationStarter, including when confidence is low.",
212
+ "If the current objective is unclear or fewer than three credible suggestions exist, set lowConfidence=true, return suggestions=[], and ask one concise contextQuestion."
213
+ ],
208
214
  "Use Simplified Chinese for every user-facing string when the visible snapshot documents are mainly Chinese; otherwise use English.",
209
215
  "",
210
216
  input.candidateContext?.length ? `Other ranked local work projects (metadata only):\n${JSON.stringify(input.candidateContext.slice(0, 8).map((candidate) => ({
@@ -220,7 +226,7 @@ async function analyzeWorkContext(input) {
220
226
  ].join("\n"),
221
227
  timestamp: Date.now()
222
228
  }] }, {
223
- maxTokens: WORK_ANALYSIS_MAX_TOKENS,
229
+ maxTokens: input.projectOverviewOnly ? 2e3 : WORK_ANALYSIS_MAX_TOKENS,
224
230
  temperature: .1,
225
231
  signal: input.signal
226
232
  });
@@ -232,7 +238,7 @@ async function analyzeWorkContext(input) {
232
238
  const suggestions = Array.isArray(parsed.suggestions) ? parsed.suggestions.map((value) => validateSuggestion(value, allowedPaths)).filter((value) => Boolean(value)) : [];
233
239
  const profileCandidates = Array.isArray(parsed.profileCandidates) ? parsed.profileCandidates.map((value) => validateProfileCandidate(value)).filter((value) => Boolean(value)) : [];
234
240
  const workThreadCandidates = Array.isArray(parsed.workThreads) ? parsed.workThreads.map((value) => validateWorkThreadCandidate(value, allowedThreadRefs)).filter((value) => Boolean(value)) : [];
235
- if (parsed.lowConfidence === true || suggestions.length !== 3) {
241
+ if (parsed.lowConfidence === true || !input.projectOverviewOnly && suggestions.length !== 3) {
236
242
  const fallback = lowConfidenceResult(input.snapshot, typeof parsed.contextQuestion === "string" ? parsed.contextQuestion.trim().slice(0, 500) : void 0, typeof parsed.conversationStarter === "string" ? parsed.conversationStarter : void 0);
237
243
  const projectSummary = typeof parsed.projectSummary === "string" && parsed.projectSummary.trim() ? parsed.projectSummary.trim().slice(0, 1200) : fallback.projectSummary;
238
244
  const currentState = typeof parsed.currentState === "string" && parsed.currentState.trim() ? parsed.currentState.trim().slice(0, 1200) : fallback.currentState;
@@ -1,13 +1,13 @@
1
1
  import { analyzeUnderstandingSources, analyzeWorkContext, workDiscoveryResultMarkdown } from "./analyzer.js";
2
- import { WORK_DISCOVERY_SCAN_POLICY_VERSION, canonicalWorkDiscoveryRoot, previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, readWorkDiscoveryTextExcerpt, searchWorkDiscoveryText, summarizeWorkContextSnapshot } from "./probe.js";
3
2
  import { discoverWorkCandidates, resolvePersonalWorkRoots } from "./candidate-discovery.js";
4
3
  import { workDiscoveryFingerprintsEqual } from "./incremental.js";
5
- import { createWorkDiscoveryRun, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, updateWorkDiscoveryRun } from "./repository.js";
4
+ import { createWorkDiscoveryRun, getProjectUnderstandingRun, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, listPendingProjectUnderstandingRuns, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, updateWorkDiscoveryRun } from "./repository.js";
6
5
  import { findActiveWorkDiscoverySourceRefresh, listWorkDiscoverySourceRefreshes, recordWorkDiscoverySourceRefresh, updateWorkDiscoverySourceRefreshForRun } from "./incremental-repository.js";
7
6
  import { appendWorkUnderstandingEvidence, createWorkUnderstandingInvestigation, getWorkUnderstandingInvestigation, getWorkUnderstandingInvestigationForRun, listWorkUnderstandingEvidence, resetWorkUnderstandingInvestigation, updateWorkUnderstandingEvidenceObservation, updateWorkUnderstandingInvestigation } from "./investigation-repository.js";
7
+ import { WORK_DISCOVERY_SCAN_POLICY_VERSION, canonicalWorkDiscoveryRoot, previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, readWorkDiscoveryTextExcerpt, searchWorkDiscoveryText, summarizeWorkContextSnapshot } from "./probe.js";
8
8
  import { DEFAULT_WORK_INVESTIGATION_BUDGET, investigateWorkContext } from "./investigator.js";
9
9
  import { persistWorkThreadsFromDiscovery } from "./thread-service.js";
10
10
  import { getWorkDiscoveryDirectorySource, listWorkDiscoveryDirectorySources, revokeWorkDiscoveryDirectorySource, upsertWorkDiscoveryDirectorySource } from "./source-repository.js";
11
11
  import { WorkDiscoveryService, normalizeUnderstandingSourceItems } from "./service.js";
12
12
  import { evaluateQuickUnderstandingCase, evaluateWorkUnderstandingCase, meetsQuickUnderstandingGate } from "./evaluation.js";
13
- export { DEFAULT_WORK_INVESTIGATION_BUDGET, WORK_DISCOVERY_SCAN_POLICY_VERSION, WorkDiscoveryService, analyzeUnderstandingSources, analyzeWorkContext, appendWorkUnderstandingEvidence, canonicalWorkDiscoveryRoot, createWorkDiscoveryRun, createWorkUnderstandingInvestigation, discoverWorkCandidates, evaluateQuickUnderstandingCase, evaluateWorkUnderstandingCase, findActiveWorkDiscoverySourceRefresh, getWorkDiscoveryDirectorySource, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, getWorkUnderstandingInvestigation, getWorkUnderstandingInvestigationForRun, investigateWorkContext, listWorkDiscoveryDirectorySources, listWorkDiscoverySourceRefreshes, listWorkUnderstandingEvidence, meetsQuickUnderstandingGate, normalizeUnderstandingSourceItems, persistWorkThreadsFromDiscovery, previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, readWorkDiscoveryTextExcerpt, recordWorkDiscoverySourceRefresh, resetWorkUnderstandingInvestigation, resolvePersonalWorkRoots, revokeWorkDiscoveryDirectorySource, searchWorkDiscoveryText, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, summarizeWorkContextSnapshot, updateWorkDiscoveryRun, updateWorkDiscoverySourceRefreshForRun, updateWorkUnderstandingEvidenceObservation, updateWorkUnderstandingInvestigation, upsertWorkDiscoveryDirectorySource, workDiscoveryFingerprintsEqual, workDiscoveryResultMarkdown };
13
+ export { DEFAULT_WORK_INVESTIGATION_BUDGET, WORK_DISCOVERY_SCAN_POLICY_VERSION, WorkDiscoveryService, analyzeUnderstandingSources, analyzeWorkContext, appendWorkUnderstandingEvidence, canonicalWorkDiscoveryRoot, createWorkDiscoveryRun, createWorkUnderstandingInvestigation, discoverWorkCandidates, evaluateQuickUnderstandingCase, evaluateWorkUnderstandingCase, findActiveWorkDiscoverySourceRefresh, getProjectUnderstandingRun, getWorkDiscoveryDirectorySource, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, getWorkUnderstandingInvestigation, getWorkUnderstandingInvestigationForRun, investigateWorkContext, listPendingProjectUnderstandingRuns, listWorkDiscoveryDirectorySources, listWorkDiscoverySourceRefreshes, listWorkUnderstandingEvidence, meetsQuickUnderstandingGate, normalizeUnderstandingSourceItems, persistWorkThreadsFromDiscovery, previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, readWorkDiscoveryTextExcerpt, recordWorkDiscoverySourceRefresh, resetWorkUnderstandingInvestigation, resolvePersonalWorkRoots, revokeWorkDiscoveryDirectorySource, searchWorkDiscoveryText, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, summarizeWorkContextSnapshot, updateWorkDiscoveryRun, updateWorkDiscoverySourceRefreshForRun, updateWorkUnderstandingEvidenceObservation, updateWorkUnderstandingInvestigation, upsertWorkDiscoveryDirectorySource, workDiscoveryFingerprintsEqual, workDiscoveryResultMarkdown };
@@ -3,8 +3,8 @@ import { init_logger } from "../utils/logger.js";
3
3
  import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
4
4
  import { init_providers, resolveModel } from "../providers/index.js";
5
5
  import { completeWithResolvedCredentials } from "../providers/model-call.js";
6
- import { readWorkDiscoveryTextExcerpt, searchWorkDiscoveryText } from "./probe.js";
7
6
  import { appendWorkUnderstandingEvidence, createWorkUnderstandingInvestigation, getWorkUnderstandingInvestigationForRun, resetWorkUnderstandingInvestigation, updateWorkUnderstandingEvidenceObservation, updateWorkUnderstandingInvestigation } from "./investigation-repository.js";
7
+ import { readWorkDiscoveryTextExcerpt, searchWorkDiscoveryText } from "./probe.js";
8
8
  import { createHash } from "node:crypto";
9
9
  //#region src/work-discovery/investigator.ts
10
10
  init_schema();
@@ -0,0 +1,7 @@
1
+ export declare function getProjectUnderstandingOverview(projectId: string): import("../knowledge-memory/domain.js").KnowledgeItem;
2
+ export declare function saveProjectUnderstandingOverview(input: {
3
+ projectId: string;
4
+ content: string;
5
+ correctedByUser?: boolean;
6
+ evidenceRefs?: string[];
7
+ }): import("../knowledge-memory/domain.js").KnowledgeItem;
@@ -0,0 +1,38 @@
1
+ import { listKnowledgeItems, writeKnowledgeItem } from "../knowledge-memory/repository.js";
2
+ import "../knowledge-memory/index.js";
3
+ //#region src/work-discovery/project-understanding.ts
4
+ function getProjectUnderstandingOverview(projectId) {
5
+ return listKnowledgeItems({
6
+ scope: {
7
+ type: "project",
8
+ id: projectId
9
+ },
10
+ statuses: ["active"],
11
+ canonicalKey: `project-understanding:${projectId}`,
12
+ limit: 1
13
+ })[0];
14
+ }
15
+ function saveProjectUnderstandingOverview(input) {
16
+ const existing = getProjectUnderstandingOverview(input.projectId);
17
+ if (!input.correctedByUser && existing?.originClass === "owner") return existing;
18
+ return writeKnowledgeItem({
19
+ kind: "project_fact",
20
+ scope: {
21
+ type: "project",
22
+ id: input.projectId
23
+ },
24
+ canonicalKey: `project-understanding:${input.projectId}`,
25
+ content: input.content.slice(0, 6e3),
26
+ status: "active",
27
+ importance: .9,
28
+ confidence: input.correctedByUser ? 1 : .7,
29
+ originClass: input.correctedByUser ? "owner" : "agent",
30
+ source: {
31
+ provider: "project-understanding",
32
+ evidenceRefs: input.evidenceRefs ?? []
33
+ },
34
+ replaceExisting: true
35
+ }).item;
36
+ }
37
+ //#endregion
38
+ export { getProjectUnderstandingOverview, saveProjectUnderstandingOverview };
@@ -8,10 +8,12 @@ export declare function setWorkDiscoveryOnboardingState(input: {
8
8
  export declare function createWorkDiscoveryRun(run: WorkDiscoveryRun): WorkDiscoveryRun;
9
9
  export declare function getWorkDiscoveryRun(id: string): WorkDiscoveryRun | null;
10
10
  export declare function getWorkDiscoveryRunByIdempotencyKey(key: string): WorkDiscoveryRun | null;
11
+ export declare function getProjectUnderstandingRun(projectId: string): WorkDiscoveryRun | null;
12
+ export declare function listPendingProjectUnderstandingRuns(): WorkDiscoveryRun[];
11
13
  export declare function setWorkDiscoveryFeedback(input: {
12
14
  runId: string;
13
15
  recognitionDecision: WorkDiscoveryRecognitionDecision;
14
16
  correctedIntent?: string;
15
17
  nowMs?: number;
16
18
  }): WorkDiscoveryFeedback;
17
- export declare function updateWorkDiscoveryRun(id: string, patch: Partial<Pick<WorkDiscoveryRun, 'status' | 'stage' | 'snapshot' | 'result' | 'errorCode' | 'errorMessage' | 'startedAt' | 'completedAt' | 'canceledAt'>>): WorkDiscoveryRun | null;
19
+ export declare function updateWorkDiscoveryRun(id: string, patch: Partial<Pick<WorkDiscoveryRun, 'status' | 'stage' | 'snapshot' | 'result' | 'errorCode' | 'errorMessage' | 'startedAt' | 'completedAt' | 'canceledAt' | 'attempts'>>): WorkDiscoveryRun | null;
@@ -21,6 +21,8 @@ function onboardingFromRow(row) {
21
21
  function runFromRow(row) {
22
22
  return {
23
23
  id: row.id,
24
+ mode: row.mode,
25
+ attempts: row.attempts,
24
26
  idempotencyKey: row.idempotency_key,
25
27
  source: row.source,
26
28
  status: row.status,
@@ -85,8 +87,8 @@ function createWorkDiscoveryRun(run) {
85
87
  db.prepare(`INSERT INTO work_discovery_runs (
86
88
  id, idempotency_key, source, status, stage, root_path, project_id, session_key,
87
89
  agent_id, model_ref, scan_policy_version, snapshot_summary_json, result_json,
88
- error_code, error_message, created_at, started_at, completed_at, canceled_at
89
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(run.id, run.idempotencyKey, run.source, run.status, run.stage ?? null, run.rootPath, run.projectId, run.sessionKey, run.agentId, run.modelRef, run.scanPolicyVersion, run.snapshot ? JSON.stringify(run.snapshot) : null, run.result ? JSON.stringify(run.result) : null, run.errorCode ?? null, run.errorMessage ?? null, run.createdAt, run.startedAt ?? null, run.completedAt ?? null, run.canceledAt ?? null);
90
+ error_code, error_message, created_at, started_at, completed_at, canceled_at, mode, attempts
91
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(run.id, run.idempotencyKey, run.source, run.status, run.stage ?? null, run.rootPath, run.projectId, run.sessionKey, run.agentId, run.modelRef, run.scanPolicyVersion, run.snapshot ? JSON.stringify(run.snapshot) : null, run.result ? JSON.stringify(run.result) : null, run.errorCode ?? null, run.errorMessage ?? null, run.createdAt, run.startedAt ?? null, run.completedAt ?? null, run.canceledAt ?? null, run.mode ?? "interactive", run.attempts ?? 0);
90
92
  });
91
93
  return getWorkDiscoveryRun(run.id);
92
94
  }
@@ -98,6 +100,17 @@ function getWorkDiscoveryRunByIdempotencyKey(key) {
98
100
  const { db } = requireXopcDatabase();
99
101
  return readRun(db, "idempotency_key", key);
100
102
  }
103
+ function getProjectUnderstandingRun(projectId) {
104
+ const { db } = requireXopcDatabase();
105
+ const row = db.prepare(`SELECT * FROM work_discovery_runs
106
+ WHERE project_id = ? AND mode = 'background' ORDER BY created_at DESC, rowid DESC LIMIT 1`).get(projectId);
107
+ return row ? runFromRow(row) : null;
108
+ }
109
+ function listPendingProjectUnderstandingRuns() {
110
+ const { db } = requireXopcDatabase();
111
+ return db.prepare(`SELECT * FROM work_discovery_runs
112
+ WHERE mode = 'background' AND status IN ('queued', 'probing', 'analyzing')`).all().map(runFromRow);
113
+ }
101
114
  function setWorkDiscoveryFeedback(input) {
102
115
  const now = input.nowMs ?? Date.now();
103
116
  runSqliteWriteTransaction((db) => {
@@ -122,10 +135,10 @@ function updateWorkDiscoveryRun(id, patch) {
122
135
  runSqliteWriteTransaction((db) => {
123
136
  db.prepare(`UPDATE work_discovery_runs SET
124
137
  status = ?, stage = ?, snapshot_summary_json = ?, result_json = ?,
125
- error_code = ?, error_message = ?, started_at = ?, completed_at = ?, canceled_at = ?
126
- WHERE id = ?`).run(next.status, next.stage ?? null, next.snapshot ? JSON.stringify(next.snapshot) : null, next.result ? JSON.stringify(next.result) : null, next.errorCode ?? null, next.errorMessage ?? null, next.startedAt ?? null, next.completedAt ?? null, next.canceledAt ?? null, id);
138
+ error_code = ?, error_message = ?, started_at = ?, completed_at = ?, canceled_at = ?, attempts = ?
139
+ WHERE id = ?`).run(next.status, next.stage ?? null, next.snapshot ? JSON.stringify(next.snapshot) : null, next.result ? JSON.stringify(next.result) : null, next.errorCode ?? null, next.errorMessage ?? null, next.startedAt ?? null, next.completedAt ?? null, next.canceledAt ?? null, next.attempts ?? 0, id);
127
140
  });
128
141
  return getWorkDiscoveryRun(id);
129
142
  }
130
143
  //#endregion
131
- export { createWorkDiscoveryRun, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, updateWorkDiscoveryRun };
144
+ export { createWorkDiscoveryRun, getProjectUnderstandingRun, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, listPendingProjectUnderstandingRuns, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, updateWorkDiscoveryRun };
@@ -15,9 +15,17 @@ export interface WorkDiscoveryServiceOptions {
15
15
  export declare class WorkDiscoveryService {
16
16
  private readonly options;
17
17
  private readonly abortControllers;
18
+ private readonly executions;
19
+ private stopped;
18
20
  private readonly candidateContexts;
19
21
  private readonly activity;
20
22
  constructor(options: WorkDiscoveryServiceOptions);
23
+ startProjectUnderstanding(projectId: string): WorkDiscoveryRun;
24
+ resumeProjectUnderstanding(): void;
25
+ stop(): Promise<void>;
26
+ private trackExecution;
27
+ private scheduleProjectUnderstanding;
28
+ private runProjectUnderstanding;
21
29
  isEnabled(): boolean;
22
30
  getOnboardingState(): WorkDiscoveryOnboardingState;
23
31
  dismissOnboarding(): WorkDiscoveryOnboardingState;