@xopcai/xopc 0.0.468 → 0.0.469

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 (349) hide show
  1. package/dist/browser-ext/dist/sidepanel.js +5 -0
  2. package/dist/browser-ext/manifest.json +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agents-CIV2R_El.js → agents-DZftplJc.js} +3 -3
  5. package/dist/gateway/static/root/assets/{api-Cl08_xtM.js → api-BnS9d0p6.js} +1 -1
  6. package/dist/gateway/static/root/assets/{app-link-BkEO3eBe.js → app-link-CauYDM-y.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-CncU5JvR.js → apps-page-CXKTWj1s.js} +1 -1
  8. package/dist/gateway/static/root/assets/arrow-down-to-line-C5D8Vt-L.js +1 -0
  9. package/dist/gateway/static/root/assets/{attachment-load-DrVGNxJm.js → attachment-load-C9iZLUHv.js} +1 -1
  10. package/dist/gateway/static/root/assets/attachment-preview-renderer-_6GhoCYk.js +12 -0
  11. package/dist/gateway/static/root/assets/attachment-utils-core-BPYdUI6y.js +1 -0
  12. package/dist/gateway/static/root/assets/{automation-task-card-sR61FFLn.js → automation-task-card-BNT3n0qu.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-BNzj3R7A.js → automations-page-DqrAOReO.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-workspace-BYmFhO8E.js +9 -0
  15. package/dist/gateway/static/root/assets/binary-plugins-CnFVuJtL.js +2 -0
  16. package/dist/gateway/static/root/assets/{block-editor-B4Yqbxab.js → block-editor-jy5CCmhH.js} +9 -9
  17. package/dist/gateway/static/root/assets/{capabilities-CBSMm_jo.js → capabilities-CaJjMTli.js} +1 -1
  18. package/dist/gateway/static/root/assets/capabilities-YmBD7oK8.js +1 -0
  19. package/dist/gateway/static/root/assets/capabilities-page-XgIRdqCb.js +2 -0
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-DfyND0IO.js +8 -0
  21. package/dist/gateway/static/root/assets/channels-DwUmMnA1.js +1 -0
  22. package/dist/gateway/static/root/assets/{chat-chart-block-CS-cORJt.js → chat-chart-block-B_c5sy7q.js} +1 -1
  23. package/dist/gateway/static/root/assets/chat-page-DfFXhDRv.js +72 -0
  24. package/dist/gateway/static/root/assets/{chat-terminal-dock-D6LH3W5H.js → chat-terminal-dock-Dn7Cm1O4.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connected-providers-grid-CxeXJKxg.js → connected-providers-grid-DUHMZjyV.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connector-service-page-Bsec3-eZ.js → connector-service-page-DLbBblN2.js} +1 -1
  27. package/dist/gateway/static/root/assets/{connectors-page-C0ZCUtxF.js → connectors-page-HHGB3r3Q.js} +1 -1
  28. package/dist/gateway/static/root/assets/constants-D5Z-mUto.js +1 -0
  29. package/dist/gateway/static/root/assets/{device-pairing-wizard-diuSsk-H.js → device-pairing-wizard-eWeHH6Ru.js} +1 -1
  30. package/dist/gateway/static/root/assets/extension-authoritative-grants-BqtUnmq-.js +1 -0
  31. package/dist/gateway/static/root/assets/{extension-debug-page-DrpE2lQ3.js → extension-debug-page-DIAyDA-a.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-iframe-host-hr60GwXQ.js → extension-iframe-host-CCe4R7L7.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-message-router-aoF3x4-X.js → extension-message-router-BD0ZamBV.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-BfM8zli6.js → extension-page-C09dlV3J.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-provider-BcSgVeKW.js → extension-provider-BhluafoX.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-settings-page-Db5t2Mz0.js → extension-settings-page-CB8KLYoG.js} +1 -1
  37. package/dist/gateway/static/root/assets/file-CStvVK2S.js +1 -0
  38. package/dist/gateway/static/root/assets/{file-BqMS_3DT.js → file-code-corner-byQA1VfD.js} +1 -1
  39. package/dist/gateway/static/root/assets/file-icon-N6WjUhq_.js +1 -0
  40. package/dist/gateway/static/root/assets/file-tree-CYUkQR1t.js +1 -0
  41. package/dist/gateway/static/root/assets/{home-page-DsS2UT08.js → home-page-8KwhWlYt.js} +3 -3
  42. package/dist/gateway/static/root/assets/index-CZUfwwLp.css +1 -0
  43. package/dist/gateway/static/root/assets/index-D5hovYIw.js +11 -0
  44. package/dist/gateway/static/root/assets/{install-connector-dialog-0_PeJJqO.js → install-connector-dialog-BZjodnUC.js} +1 -1
  45. package/dist/gateway/static/root/assets/local-app-workbench-page-DmzgjJNj.js +1 -0
  46. package/dist/gateway/static/root/assets/{local-apps-page-yBqRl5Bi.js → local-apps-page-Ct8z2B7R.js} +1 -1
  47. package/dist/gateway/static/root/assets/logs-page-CH9amuGc.js +2 -0
  48. package/dist/gateway/static/root/assets/{management-settings-D9HGIYXx.js → management-settings-CUQd0FJ3.js} +1 -1
  49. package/dist/gateway/static/root/assets/{markdown-view-CiGdWuN3.js → markdown-view-Dm01GIXv.js} +1 -1
  50. package/dist/gateway/static/root/assets/{media-plugins-C2lp7UmI.js → media-plugins-jsWNdARw.js} +1 -1
  51. package/dist/gateway/static/root/assets/models-hub-cache-B2QcrY4n.js +1 -0
  52. package/dist/gateway/static/root/assets/note-detail-panel-DeFb2HEC.js +7 -0
  53. package/dist/gateway/static/root/assets/note-image-lightbox-DUzoWZEe.js +1 -0
  54. package/dist/gateway/static/root/assets/notes-api-BMSPkAm8.js +1 -0
  55. package/dist/gateway/static/root/assets/notes-page-nvqpOeHp.js +8 -0
  56. package/dist/gateway/static/root/assets/{oauth-provider-connect-BW7zcXfb.js → oauth-provider-connect-BexlZuZ4.js} +1 -1
  57. package/dist/gateway/static/root/assets/{page-context-capture-button-Cw58-5P3.js → page-context-capture-button-Cn4zi3Mt.js} +1 -1
  58. package/dist/gateway/static/root/assets/page-header-store-1-lflHAx.js +1 -0
  59. package/dist/gateway/static/root/assets/personal-avatar-CM3vUGhL.js +1 -0
  60. package/dist/gateway/static/root/assets/personal-avatar-DsEp8QJ7.css +1 -0
  61. package/dist/gateway/static/root/assets/personal-page-HFjWZacf.js +1 -0
  62. package/dist/gateway/static/root/assets/{personal-profile-settings-CDrzvI35.js → personal-profile-settings-CNI5Eor6.js} +1 -1
  63. package/dist/gateway/static/root/assets/{personal-settings-panel-CoZ3qWSr.js → personal-settings-panel-BcrpYRn9.js} +1 -1
  64. package/dist/gateway/static/root/assets/{phone-model-connection-UHVwbC3H.js → phone-model-connection-DKvOEjWH.js} +1 -1
  65. package/dist/gateway/static/root/assets/{phone-settings-page-fS2IT-dK.js → phone-settings-page-DvX6okzz.js} +1 -1
  66. package/dist/gateway/static/root/assets/playback-coordinator-CWHIf0wr.js +1 -0
  67. package/dist/gateway/static/root/assets/presentation-D-Ui_vVA.js +1 -0
  68. package/dist/gateway/static/root/assets/preview-runtime-RnBDP-Lq.js +15 -0
  69. package/dist/gateway/static/root/assets/product-automation-feedback-xAcXeJM2.js +7 -0
  70. package/dist/gateway/static/root/assets/product-delivery-4gEqUIsK.js +1 -0
  71. package/dist/gateway/static/root/assets/{product-open-page-BMJ2x5m3.js → product-open-page-DXwOPgRP.js} +1 -1
  72. package/dist/gateway/static/root/assets/{product-preview-content-lkkZPvMa.js → product-preview-content-DiQbeaCK.js} +1 -1
  73. package/dist/gateway/static/root/assets/{product-preview-modal-DtUBJGs5.js → product-preview-modal-BU7Qojpq.js} +2 -2
  74. package/dist/gateway/static/root/assets/project-detail-page-Dr5_WPRB.js +7 -0
  75. package/dist/gateway/static/root/assets/{projects-page-Dua6taaG.js → projects-page-DGATZB23.js} +1 -1
  76. package/dist/gateway/static/root/assets/{providers-api-B6eZLEnh.js → providers-api-BXa2Aheb.js} +1 -1
  77. package/dist/gateway/static/root/assets/recording-upload-CQdhrRq3.js +1 -0
  78. package/dist/gateway/static/root/assets/{remote-access-hub-Dy3-oGK1.js → remote-access-hub-_7tmWand.js} +1 -1
  79. package/dist/gateway/static/root/assets/right-workspace-store-NXMrEuwH.js +1 -0
  80. package/dist/gateway/static/root/assets/route-preload-D-pdVwIK.js +2 -0
  81. package/dist/gateway/static/root/assets/routine-panel-rjq-8nZ8.js +2 -0
  82. package/dist/gateway/static/root/assets/scan-search-CSIGkseh.js +1 -0
  83. package/dist/gateway/static/root/assets/{service-recommendation-list-CsU74h1b.js → service-recommendation-list-2UOjV0Mx.js} +1 -1
  84. package/dist/gateway/static/root/assets/session-manager-BVS3zxRZ.js +22 -0
  85. package/dist/gateway/static/root/assets/{settings-page-ByFNIBfp.js → settings-page-bCW4rave.js} +1 -1
  86. package/dist/gateway/static/root/assets/{setup-interaction-page-Bsn4Wa4p.js → setup-interaction-page-BYXDX0F2.js} +1 -1
  87. package/dist/gateway/static/root/assets/{setup-status-panel-CstjOb7g.js → setup-status-panel-Bhda3jS2.js} +1 -1
  88. package/dist/gateway/static/root/assets/share-preview-page-nzWjWhqF.js +2 -0
  89. package/dist/gateway/static/root/assets/shares-settings-LB3SYKFS.js +1 -0
  90. package/dist/gateway/static/root/assets/sheet-C2H8iR8Y.js +1 -0
  91. package/dist/gateway/static/root/assets/{skills-page-CkkHufmv.js → skills-page-CfhEcU8L.js} +1 -1
  92. package/dist/gateway/static/root/assets/space-api-DaKpHc_7.js +1 -0
  93. package/dist/gateway/static/root/assets/space-page-BXyQdUvp.js +2 -0
  94. package/dist/gateway/static/root/assets/star-BuMAkjC9.js +1 -0
  95. package/dist/gateway/static/root/assets/task-detail-page-gffrDRvW.js +3 -0
  96. package/dist/gateway/static/root/assets/task-header-title-DwtjUOBg.js +1 -0
  97. package/dist/gateway/static/root/assets/{task-result-evidence-dtN1sSjU.js → task-result-evidence-Bmgta9z9.js} +1 -1
  98. package/dist/gateway/static/root/assets/tasks-BIehlq7k.js +1 -0
  99. package/dist/gateway/static/root/assets/turn-outcome-BSbEJx8h.js +1 -0
  100. package/dist/gateway/static/root/assets/use-composer-attachments-sszsCdh5.js +2 -0
  101. package/dist/gateway/static/root/assets/use-file-preview-expanded-D4b4fDeu.js +1 -0
  102. package/dist/gateway/static/root/assets/use-personal-profile-CNPszzzT.js +1 -0
  103. package/dist/gateway/static/root/assets/use-personal-work-C-rw8XVO.js +1 -0
  104. package/dist/gateway/static/root/assets/{use-realtime-voice-lRHVixh4.js → use-realtime-voice-cugjs8cK.js} +1 -1
  105. package/dist/gateway/static/root/assets/{use-workspace-tree-DrWnW1aA.js → use-workspace-tree-Crfx5ctU.js} +1 -1
  106. package/dist/gateway/static/root/assets/{user-model-page-Bw1_PGdD.js → user-model-page-BvnLbTYx.js} +1 -1
  107. package/dist/gateway/static/root/assets/video-generation-Cec49Jwg.js +1 -0
  108. package/dist/gateway/static/root/assets/voice-player-store-DZGlzjva.js +1 -0
  109. package/dist/gateway/static/root/assets/voice-settings-BzfNK5Jm.js +1 -0
  110. package/dist/gateway/static/root/assets/{work-discovery-overlay-DcZS4OMj.js → work-discovery-overlay-DpEYgcG2.js} +1 -1
  111. package/dist/gateway/static/root/assets/{work-discovery-page-CZF9iWPT.js → work-discovery-page-DappIHQq.js} +1 -1
  112. package/dist/gateway/static/root/assets/workspace-api-g-wCKoQU.js +2 -0
  113. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-DxaxVC3q.js +1 -0
  114. package/dist/gateway/static/root/assets/workspace-preview-store-DoIjn_2j.js +1 -0
  115. package/dist/gateway/static/root/index.html +90 -77
  116. package/dist/package.js +1 -1
  117. package/dist/packages/gateway-contract/src/automations.js +7 -0
  118. package/dist/packages/gateway-contract/src/capabilities.js +1 -1
  119. package/dist/packages/gateway-contract/src/clarifications.js +20 -2
  120. package/dist/packages/gateway-contract/src/index.js +6 -4
  121. package/dist/packages/gateway-contract/src/space.js +23 -0
  122. package/dist/packages/gateway-contract/src/task-lifecycle.js +1 -0
  123. package/dist/packages/gateway-contract/src/task-result-delivery.js +1 -0
  124. package/dist/packages/gateway-contract/src/task-runs.js +1 -0
  125. package/dist/packages/gateway-contract/src/tasks.js +118 -6
  126. package/dist/packages/gateway-contract/src/turn-outcome.js +16 -2
  127. package/dist/packages/gateway-contract/src/video-generation.js +29 -4
  128. package/dist/src/agent/agent-manager.js +2 -2
  129. package/dist/src/agent/embedded/agent-profile-context.js +1 -1
  130. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  131. package/dist/src/agent/orchestration/delegation-budget.d.ts +2 -2
  132. package/dist/src/agent/orchestration/turn-recovery.d.ts +12 -3
  133. package/dist/src/agent/orchestration/turn-recovery.js +25 -6
  134. package/dist/src/agent/service/process-direct-streaming.js +1 -1
  135. package/dist/src/agent/service/webchat-tts.js +1 -1
  136. package/dist/src/agent/service.js +1 -1
  137. package/dist/src/agent/tasks/task-judge-service.js +1 -1
  138. package/dist/src/agent/tools/apply-patch.js +1 -1
  139. package/dist/src/agent/tools/factory.js +1 -1
  140. package/dist/src/agent/tools/image-generate-tool.js +1 -0
  141. package/dist/src/agent/tools/language-diagnostics.js +1 -1
  142. package/dist/src/agent/tools/personal-task-tool.d.ts +1 -0
  143. package/dist/src/agent/tools/personal-task-tool.js +12 -7
  144. package/dist/src/agent/tools/publish-artifacts.js +2 -1
  145. package/dist/src/agent/tools/review-workspace.js +1 -1
  146. package/dist/src/agent/tools/send-media.js +1 -0
  147. package/dist/src/agent/tools/tool-media.d.ts +3 -1
  148. package/dist/src/agent/tools/tool-media.js +2 -0
  149. package/dist/src/agent/tools/xopc-use-tool.js +21 -4
  150. package/dist/src/agent-catalog/test-support.js +1 -1
  151. package/dist/src/agent-matching/delegation-service.js +1 -1
  152. package/dist/src/automations/capabilities/drafts.js +1 -1
  153. package/dist/src/automations/capabilities/write.d.ts +30 -6
  154. package/dist/src/automations/capabilities/write.js +2 -2
  155. package/dist/src/automations/configuration-conversation.js +1 -1
  156. package/dist/src/automations/domain/types.d.ts +6 -0
  157. package/dist/src/automations/domain/validation.d.ts +60 -12
  158. package/dist/src/automations/domain/validation.js +7 -0
  159. package/dist/src/automations/draft/automation-draft-validator.d.ts +12 -3
  160. package/dist/src/automations/draft/automation-draft-validator.js +1 -0
  161. package/dist/src/automations/service/action-executor.js +14 -2
  162. package/dist/src/automations/service/automation-service.js +2 -2
  163. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  164. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  165. package/dist/src/computer/diagnostics.d.ts +9 -9
  166. package/dist/src/computer/errors.d.ts +2 -2
  167. package/dist/src/computer/evaluation.d.ts +7 -7
  168. package/dist/src/computer/runtime.d.ts +4 -4
  169. package/dist/src/config/schema.d.ts +2 -2
  170. package/dist/src/discussions/action-tasks.d.ts +2 -2
  171. package/dist/src/execution-environments/local-worktree-manager.js +1 -1
  172. package/dist/src/extensions/agent-plugins/inventory.d.ts +2 -2
  173. package/dist/src/extensions/agent-plugins/setup.d.ts +3 -3
  174. package/dist/src/gateway/hono/routes/commands-skills.js +1 -1
  175. package/dist/src/gateway/hono/routes/connectors.js +2 -2
  176. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  177. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  178. package/dist/src/gateway/hono/routes/music-generation.js +2 -0
  179. package/dist/src/gateway/hono/routes/personal-agent.js +214 -5
  180. package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
  181. package/dist/src/gateway/hono/routes/space.d.ts +3 -0
  182. package/dist/src/gateway/hono/routes/space.js +105 -0
  183. package/dist/src/gateway/hono/routes/tasks.js +27 -28
  184. package/dist/src/gateway/hono/routes/video-generation.js +8 -5
  185. package/dist/src/gateway/html-preview-shell.d.ts +1 -1
  186. package/dist/src/gateway/html-preview-shell.js +3 -0
  187. package/dist/src/gateway/media-access.js +2 -2
  188. package/dist/src/gateway/security/gateway-scopes.js +2 -0
  189. package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
  190. package/dist/src/gateway/service.d.ts +1 -0
  191. package/dist/src/gateway/service.js +10 -3
  192. package/dist/src/gateway/session-context-summary.js +1 -1
  193. package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +2 -0
  194. package/dist/src/gateway/xopc-cloud-capability-setup.js +18 -1
  195. package/dist/src/home-intelligence/follow-ups.js +2 -1
  196. package/dist/src/home-intelligence/routines.js +1 -1
  197. package/dist/src/local-apps/automation-proposals.d.ts +54 -12
  198. package/dist/src/local-apps/capabilities/projections.d.ts +7 -7
  199. package/dist/src/local-apps/preview-fixtures.d.ts +1 -1
  200. package/dist/src/media/session-references.d.ts +4 -1
  201. package/dist/src/media/session-references.js +40 -8
  202. package/dist/src/music-generation/artifact.js +3 -1
  203. package/dist/src/music-generation/providers.js +26 -15
  204. package/dist/src/music-generation/repository.js +8 -1
  205. package/dist/src/music-generation/xopc-cloud.d.ts +2 -0
  206. package/dist/src/music-generation/xopc-cloud.js +38 -0
  207. package/dist/src/personal-agent/capability-service.js +1 -1
  208. package/dist/src/personal-agent/proactivity/service.js +1 -1
  209. package/dist/src/personal-agent/prompt-context.js +1 -1
  210. package/dist/src/personal-agent/prompts.js +1 -1
  211. package/dist/src/personal-agent/reply-composer.js +16 -7
  212. package/dist/src/personal-agent/repository.js +1 -1
  213. package/dist/src/personal-agent/request-delivery.js +17 -7
  214. package/dist/src/personal-agent/request-service.js +6 -10
  215. package/dist/src/personal-agent/result-extraction.js +13 -13
  216. package/dist/src/personal-agent/schedules.d.ts +9 -0
  217. package/dist/src/personal-agent/schedules.js +44 -0
  218. package/dist/src/personal-agent/service.js +1 -1
  219. package/dist/src/providers/model-catalog-persistence.js +6 -1
  220. package/dist/src/providers/model-catalog-store.js +1 -0
  221. package/dist/src/providers/model-catalog-types.d.ts +2 -0
  222. package/dist/src/providers/xopc-cloud-media-manifest.d.ts +24 -0
  223. package/dist/src/providers/xopc-cloud-media-manifest.js +28 -0
  224. package/dist/src/providers/xopc-cloud-media.d.ts +28 -0
  225. package/dist/src/providers/xopc-cloud-media.js +67 -0
  226. package/dist/src/providers/xopc-cloud-model-source.js +4 -0
  227. package/dist/src/runtime-tools/archive.js +1 -1
  228. package/dist/src/runtime-tools/manager.js +1 -1
  229. package/dist/src/runtime-tools/phone-dependencies.js +1 -1
  230. package/dist/src/session/client-history.d.ts +4 -1
  231. package/dist/src/session/client-history.js +18 -0
  232. package/dist/src/session/compact-history.js +30 -1
  233. package/dist/src/session/turn-outcome-projector.js +1 -1
  234. package/dist/src/space/ingest.d.ts +36 -0
  235. package/dist/src/space/ingest.js +149 -0
  236. package/dist/src/space/repository.d.ts +39 -0
  237. package/dist/src/space/repository.js +325 -0
  238. package/dist/src/space/worker.d.ts +14 -0
  239. package/dist/src/space/worker.js +199 -0
  240. package/dist/src/storage/sqlite/clarification-wait-repository.js +7 -4
  241. package/dist/src/storage/sqlite/row-mappers.d.ts +1 -0
  242. package/dist/src/storage/sqlite/row-mappers.js +9 -2
  243. package/dist/src/storage/sqlite/schema.d.ts +2 -2
  244. package/dist/src/storage/sqlite/schema.js +8 -7
  245. package/dist/src/storage/sqlite/schema.sql +103 -0
  246. package/dist/src/storage/sqlite/transcript-repository.js +8 -0
  247. package/dist/src/storage/sqlite/upgrades/279_task_model_cutover.sql +288 -0
  248. package/dist/src/storage/sqlite/upgrades/280_space.sql +61 -0
  249. package/dist/src/tasks/capabilities/management.d.ts +15 -2
  250. package/dist/src/tasks/capabilities/management.js +8 -2
  251. package/dist/src/tasks/capabilities/read.js +14 -2
  252. package/dist/src/tasks/capabilities/relations.d.ts +13 -7
  253. package/dist/src/tasks/capabilities/write.d.ts +118 -2
  254. package/dist/src/tasks/capabilities/write.js +2 -0
  255. package/dist/src/tasks/home-query-service.js +7 -9
  256. package/dist/src/tasks/task-allocation-service.js +2 -2
  257. package/dist/src/tasks/task-application-service.d.ts +8 -2
  258. package/dist/src/tasks/task-application-service.js +94 -27
  259. package/dist/src/tasks/task-collaboration-repository.js +12 -1
  260. package/dist/src/tasks/task-context-assembler.js +9 -3
  261. package/dist/src/tasks/task-contract-planner.js +1 -3
  262. package/dist/src/tasks/task-conversation-summary.d.ts +33 -2
  263. package/dist/src/tasks/task-conversation-summary.js +3 -1
  264. package/dist/src/tasks/task-criterion-review-repository.d.ts +31 -2
  265. package/dist/src/tasks/task-criterion-review-repository.js +70 -23
  266. package/dist/src/tasks/task-deliverables.d.ts +7 -0
  267. package/dist/src/tasks/task-deliverables.js +112 -0
  268. package/dist/src/tasks/task-handoff-service.js +1 -1
  269. package/dist/src/tasks/task-instruction-sequence.js +10 -3
  270. package/dist/src/tasks/task-json-acceptance.js +3 -5
  271. package/dist/src/tasks/task-origin-repository.d.ts +99 -1
  272. package/dist/src/tasks/task-origin-repository.js +67 -5
  273. package/dist/src/tasks/task-read-model-projector.d.ts +4 -1
  274. package/dist/src/tasks/task-read-model-projector.js +123 -9
  275. package/dist/src/tasks/task-repository.d.ts +4 -1
  276. package/dist/src/tasks/task-repository.js +34 -11
  277. package/dist/src/tasks/task-research-repair.d.ts +2 -2
  278. package/dist/src/tasks/task-research-result.d.ts +1 -0
  279. package/dist/src/tasks/task-research-result.js +13 -3
  280. package/dist/src/tasks/task-result-delivery-repository.d.ts +4 -3
  281. package/dist/src/tasks/task-result-delivery-repository.js +35 -17
  282. package/dist/src/tasks/task-result-delivery-service.js +22 -7
  283. package/dist/src/tasks/task-result-versions.d.ts +11 -0
  284. package/dist/src/tasks/task-result-versions.js +34 -0
  285. package/dist/src/tasks/task-run-coordinator.js +28 -15
  286. package/dist/src/tasks/task-run-dispatcher.js +29 -4
  287. package/dist/src/tasks/task-run-repository.d.ts +2 -0
  288. package/dist/src/tasks/task-run-repository.js +62 -19
  289. package/dist/src/tasks/task-workspace-verification.d.ts +16 -0
  290. package/dist/src/tasks/task-workspace-verification.js +95 -0
  291. package/dist/src/tui/backends/embedded-backend.js +2 -2
  292. package/dist/src/video-generation/artifact.js +3 -1
  293. package/dist/src/video-generation/drafts.js +4 -0
  294. package/dist/src/video-generation/providers.d.ts +1 -0
  295. package/dist/src/video-generation/providers.js +37 -5
  296. package/dist/src/video-generation/repository.js +8 -1
  297. package/dist/src/video-generation/settings.d.ts +1 -0
  298. package/dist/src/video-generation/settings.js +10 -4
  299. package/dist/src/voice/realtime/runtime.js +1 -1
  300. package/package.json +1 -1
  301. package/dist/gateway/static/root/assets/attachment-preview-renderer-DdOEgexg.js +0 -12
  302. package/dist/gateway/static/root/assets/attachment-utils-core-BIOUBrpT.js +0 -1
  303. package/dist/gateway/static/root/assets/automations-workspace-BWpA-X_S.js +0 -9
  304. package/dist/gateway/static/root/assets/binary-plugins-BjEE5sVq.js +0 -2
  305. package/dist/gateway/static/root/assets/capabilities-EmBa4Blq.js +0 -1
  306. package/dist/gateway/static/root/assets/capabilities-page-BQf7oyqc.js +0 -2
  307. package/dist/gateway/static/root/assets/capabilities-settings-panel-hlByP8SE.js +0 -8
  308. package/dist/gateway/static/root/assets/channels-oyMymJDx.js +0 -1
  309. package/dist/gateway/static/root/assets/chat-page-hcsqrv-7.js +0 -71
  310. package/dist/gateway/static/root/assets/constants-Bg1wM2nv.js +0 -1
  311. package/dist/gateway/static/root/assets/extension-authoritative-grants-CVQ7q0DU.js +0 -1
  312. package/dist/gateway/static/root/assets/file-tree-CFlZnV3Y.js +0 -1
  313. package/dist/gateway/static/root/assets/index-DFa0pZhC.js +0 -11
  314. package/dist/gateway/static/root/assets/index-DHPaL7Ku.css +0 -1
  315. package/dist/gateway/static/root/assets/local-app-workbench-page-OSinc6m6.js +0 -1
  316. package/dist/gateway/static/root/assets/local-apps-DeqzkJiF.js +0 -1
  317. package/dist/gateway/static/root/assets/logs-page-BJxQ_Jd5.js +0 -2
  318. package/dist/gateway/static/root/assets/models-hub-cache-CmdULYFt.js +0 -1
  319. package/dist/gateway/static/root/assets/note-detail-panel-CVEG1JdF.js +0 -7
  320. package/dist/gateway/static/root/assets/note-image-lightbox-WA8FiHsm.js +0 -1
  321. package/dist/gateway/static/root/assets/notes-api-BQXOYFQ5.js +0 -1
  322. package/dist/gateway/static/root/assets/notes-page-Cc-c1Yhg.js +0 -8
  323. package/dist/gateway/static/root/assets/page-header-store-DwFwq_lI.js +0 -1
  324. package/dist/gateway/static/root/assets/personal-avatar-B-Oes3ef.js +0 -1
  325. package/dist/gateway/static/root/assets/personal-avatar-BUCb7OiW.css +0 -1
  326. package/dist/gateway/static/root/assets/personal-page-DWPu-iwK.js +0 -1
  327. package/dist/gateway/static/root/assets/phone-DdhTnt6X.js +0 -1
  328. package/dist/gateway/static/root/assets/product-automation-feedback-DrBclzH1.js +0 -7
  329. package/dist/gateway/static/root/assets/product-delivery-CnvCn9L-.js +0 -1
  330. package/dist/gateway/static/root/assets/project-detail-page-DGFUj6jS.js +0 -7
  331. package/dist/gateway/static/root/assets/recording-upload-DXxD6grq.js +0 -1
  332. package/dist/gateway/static/root/assets/right-workspace-store-BzXnZDK5.js +0 -1
  333. package/dist/gateway/static/root/assets/route-preload-8KCgPcjp.js +0 -2
  334. package/dist/gateway/static/root/assets/routine-panel-BALhliq6.js +0 -2
  335. package/dist/gateway/static/root/assets/session-manager-Cby6Nkib.js +0 -25
  336. package/dist/gateway/static/root/assets/share-preview-page-9pOnypJv.js +0 -2
  337. package/dist/gateway/static/root/assets/shares-settings-CJdVDQqf.js +0 -1
  338. package/dist/gateway/static/root/assets/star-CnYNmpLd.js +0 -1
  339. package/dist/gateway/static/root/assets/task-detail-page-BjBkKeIf.js +0 -3
  340. package/dist/gateway/static/root/assets/tasks-BTLabOMp.js +0 -1
  341. package/dist/gateway/static/root/assets/use-composer-attachments-BEYkb8cs.js +0 -2
  342. package/dist/gateway/static/root/assets/use-file-preview-expanded-CQeo2Ztn.js +0 -15
  343. package/dist/gateway/static/root/assets/use-personal-profile-CKm5FaTl.js +0 -1
  344. package/dist/gateway/static/root/assets/video-generation-D08uZbsu.js +0 -1
  345. package/dist/gateway/static/root/assets/voice-settings-CssuMBjt.js +0 -1
  346. package/dist/gateway/static/root/assets/with-selector-xonYxPoM.js +0 -1
  347. package/dist/gateway/static/root/assets/workspace-api-BfApIXLw.js +0 -2
  348. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-BRhsCs1S.js +0 -1
  349. package/dist/gateway/static/root/assets/workspace-preview-store-BrofEVle.js +0 -1
@@ -1,19 +1,26 @@
1
+ import { init_transaction, runSqliteWriteTransaction } from "../../../storage/sqlite/transaction.js";
1
2
  import { getDevice } from "../../../storage/sqlite/device-access-repository.js";
2
- import { getPersonalRequest, init_request_repository, listPersonalRequests } from "../../../personal-agent/request-repository.js";
3
3
  import { init_voice, voiceCallPreferencesPatchSchema } from "../../../../packages/realtime-protocol/src/voice.js";
4
+ import { getPersonalRequest, init_request_repository, listPersonalRequests } from "../../../personal-agent/request-repository.js";
4
5
  import { getPersonalAgent } from "../../../personal-agent/repository.js";
5
6
  import { TaskOriginRepository } from "../../../tasks/task-origin-repository.js";
7
+ import { AutomationScheduleSchema } from "../../../automations/domain/validation.js";
8
+ import { getAutomation } from "../../../automations/storage/automation-repository.js";
9
+ import "../../../automations/storage/index.js";
10
+ import { listDeliverables } from "../../../tasks/task-deliverables.js";
6
11
  import { cancelPersonalRequest, personalRequestSnapshot, publishPersonalRequest } from "../../../personal-agent/request-service.js";
7
12
  import { writeAgentAvatarFromBase64 } from "../../agents-admin.js";
8
13
  import { legacyNaturalModel } from "../../../voice/realtime/omniRoute.js";
9
14
  import { getGatewayPrincipal } from "../../security/gateway-principal.js";
10
15
  import { PersonalOnboardingDraftSchema, PersonalOnboardingStepSchema, finishPersonalWelcome, getPersonalOnboarding, savePersonalOnboarding } from "../../../personal-agent/onboarding.js";
16
+ import { isPersonalSchedule } from "../../../personal-agent/schedules.js";
11
17
  import { PersonalAppearanceSchema, createOrResumePersonalAgent, ensurePersonalConversationVisibility, listPersonalModels, patchPersonalProfile, refreshPersonalDelegationGuidance } from "../../../personal-agent/service.js";
12
18
  import { markPersonalRead, personalUnreadSnapshot } from "../../../personal-agent/unread.js";
13
19
  import { registerProactivityRoutes } from "../../../personal-agent/proactivity/routes.js";
14
20
  import { z } from "zod";
15
21
  //#region src/gateway/hono/routes/personal-agent.ts
16
22
  init_voice();
23
+ init_transaction();
17
24
  init_request_repository();
18
25
  const AvatarSchema = z.object({
19
26
  base64: z.string().min(1).max(7e5),
@@ -54,8 +61,19 @@ const ProfileSchema = z.object({
54
61
  }).strict();
55
62
  const ActivityQuerySchema = z.object({
56
63
  limit: z.coerce.number().int().min(1).max(20).default(5),
57
- offset: z.coerce.number().int().min(0).default(0)
64
+ offset: z.coerce.number().int().min(0).default(0),
65
+ view: z.enum(["work", "deliverables"]).optional()
58
66
  });
67
+ const PersonalScheduleSchema = z.object({
68
+ name: z.string().trim().min(1).max(100),
69
+ instruction: z.string().trim().min(1).max(5e4),
70
+ locale: z.enum(["zh", "en"]),
71
+ schedule: AutomationScheduleSchema
72
+ }).strict();
73
+ const PersonalSchedulePatchSchema = PersonalScheduleSchema.partial().extend({
74
+ enabled: z.boolean().optional(),
75
+ expectedRevision: z.number().int().nonnegative()
76
+ }).refine((value) => Object.keys(value).length > 1);
59
77
  function registerPersonalAgentRoutes(authenticated, deps) {
60
78
  const owner = (c) => {
61
79
  const principal = getGatewayPrincipal(c);
@@ -65,6 +83,170 @@ function registerPersonalAgentRoutes(authenticated, deps) {
65
83
  return platform === "harmonyos" || platform === "ios" || platform === "android" ? "local-owner" : null;
66
84
  };
67
85
  registerProactivityRoutes(authenticated, deps, owner);
86
+ authenticated.get("/api/personal-agent/schedules", async (c) => {
87
+ const ownerId = owner(c);
88
+ if (!ownerId) return c.json({
89
+ ok: false,
90
+ error: "Owner access is required"
91
+ }, 403);
92
+ const profile = getPersonalAgent(ownerId);
93
+ if (profile?.state !== "ready") return c.json({
94
+ ok: true,
95
+ payload: []
96
+ });
97
+ const items = await deps.service.automationServiceInstance.list();
98
+ return c.json({
99
+ ok: true,
100
+ payload: items.filter((item) => isPersonalSchedule(item, profile.conversationId, profile.agentId))
101
+ });
102
+ });
103
+ authenticated.post("/api/personal-agent/schedules", deps.strictRateLimitMiddleware, async (c) => {
104
+ const ownerId = owner(c);
105
+ if (!ownerId) return c.json({
106
+ ok: false,
107
+ error: "Owner access is required"
108
+ }, 403);
109
+ const profile = getPersonalAgent(ownerId);
110
+ if (profile?.state !== "ready") return c.json({
111
+ ok: false,
112
+ error: "Personal Agent is unavailable"
113
+ }, 409);
114
+ const parsed = PersonalScheduleSchema.safeParse(await c.req.json().catch(() => null));
115
+ if (!parsed.success) return c.json({
116
+ ok: false,
117
+ error: "Invalid Personal schedule"
118
+ }, 400);
119
+ const { name, instruction, locale, schedule } = parsed.data;
120
+ try {
121
+ const automation = await deps.service.automationServiceInstance.create({
122
+ name,
123
+ trigger: {
124
+ kind: "schedule",
125
+ schedule
126
+ },
127
+ action: {
128
+ kind: "personal_task",
129
+ agentId: profile.agentId,
130
+ conversationId: profile.conversationId,
131
+ instruction,
132
+ locale
133
+ },
134
+ management: {
135
+ owner: "personal-agent",
136
+ editable: ["enabled", "trigger"],
137
+ runnable: true,
138
+ deletable: true
139
+ },
140
+ conversationMode: "new_session",
141
+ delivery: {
142
+ notificationPolicy: "attention",
143
+ destinations: [{
144
+ key: "gateway_event",
145
+ kind: "gateway_event"
146
+ }]
147
+ }
148
+ });
149
+ return c.json({
150
+ ok: true,
151
+ payload: automation
152
+ }, 201);
153
+ } catch (error) {
154
+ return c.json({
155
+ ok: false,
156
+ error: error instanceof Error ? error.message : String(error)
157
+ }, 400);
158
+ }
159
+ });
160
+ authenticated.patch("/api/personal-agent/schedules/:id", deps.strictRateLimitMiddleware, async (c) => {
161
+ const ownerId = owner(c);
162
+ if (!ownerId) return c.json({
163
+ ok: false,
164
+ error: "Owner access is required"
165
+ }, 403);
166
+ const profile = getPersonalAgent(ownerId);
167
+ if (profile?.state !== "ready") return c.json({
168
+ ok: false,
169
+ error: "Personal Agent is unavailable"
170
+ }, 409);
171
+ const parsed = PersonalSchedulePatchSchema.safeParse(await c.req.json().catch(() => null));
172
+ if (!parsed.success) return c.json({
173
+ ok: false,
174
+ error: "Invalid Personal schedule changes"
175
+ }, 400);
176
+ const service = deps.service.automationServiceInstance;
177
+ const id = c.req.param("id");
178
+ const { name, instruction, locale, schedule, enabled, expectedRevision } = parsed.data;
179
+ try {
180
+ const result = runSqliteWriteTransaction(() => {
181
+ const current = getAutomation(id);
182
+ if (!isPersonalSchedule(current, profile.conversationId, profile.agentId)) return { status: "missing" };
183
+ if (current.updatedAtMs !== expectedRevision) return { status: "conflict" };
184
+ return {
185
+ status: "updated",
186
+ automation: service.updateAtomically(id, {
187
+ ...name !== void 0 ? { name } : {},
188
+ ...enabled !== void 0 ? { enabled } : {},
189
+ ...schedule ? { trigger: {
190
+ kind: "schedule",
191
+ schedule
192
+ } } : {},
193
+ ...instruction !== void 0 || locale !== void 0 ? { action: {
194
+ ...current.action,
195
+ instruction: instruction ?? current.action.instruction,
196
+ locale: locale ?? current.action.locale
197
+ } } : {}
198
+ })
199
+ };
200
+ });
201
+ if (result.status === "missing") return c.json({
202
+ ok: false,
203
+ error: "Personal schedule not found"
204
+ }, 404);
205
+ if (result.status === "conflict") return c.json({
206
+ ok: false,
207
+ error: "The schedule changed. Reload and try again."
208
+ }, 409);
209
+ service.refreshSchedule();
210
+ return c.json({
211
+ ok: true,
212
+ payload: result.automation
213
+ });
214
+ } catch (error) {
215
+ return c.json({
216
+ ok: false,
217
+ error: error instanceof Error ? error.message : String(error)
218
+ }, 400);
219
+ }
220
+ });
221
+ authenticated.post("/api/personal-agent/schedules/:id/run", deps.strictRateLimitMiddleware, async (c) => {
222
+ const ownerId = owner(c);
223
+ if (!ownerId) return c.json({
224
+ ok: false,
225
+ error: "Owner access is required"
226
+ }, 403);
227
+ const profile = getPersonalAgent(ownerId);
228
+ if (profile?.state !== "ready") return c.json({
229
+ ok: false,
230
+ error: "Personal Agent is unavailable"
231
+ }, 409);
232
+ const id = c.req.param("id");
233
+ if (!isPersonalSchedule(getAutomation(id), profile.conversationId, profile.agentId)) return c.json({
234
+ ok: false,
235
+ error: "Personal schedule not found"
236
+ }, 404);
237
+ try {
238
+ const run = await deps.service.automationServiceInstance.runNow(id);
239
+ return c.json({
240
+ ok: true,
241
+ payload: run
242
+ }, 202);
243
+ } catch (error) {
244
+ return c.json({
245
+ ok: false,
246
+ error: error instanceof Error ? error.message : String(error)
247
+ }, 400);
248
+ }
249
+ });
68
250
  authenticated.put("/api/personal-agent/avatar", deps.strictRateLimitMiddleware, async (c) => {
69
251
  const ownerId = owner(c);
70
252
  if (!ownerId) return c.json({
@@ -273,13 +455,40 @@ function registerPersonalAgentRoutes(authenticated, deps) {
273
455
  }, 403);
274
456
  const query = ActivityQuerySchema.safeParse({
275
457
  limit: c.req.query("limit"),
276
- offset: c.req.query("offset")
458
+ offset: c.req.query("offset"),
459
+ view: c.req.query("view")
277
460
  });
278
461
  if (!query.success) return c.json({
279
462
  ok: false,
280
463
  error: "Invalid activity pagination"
281
464
  }, 400);
282
465
  const record = getPersonalAgent(ownerId);
466
+ const { limit, offset, view } = query.data;
467
+ if (view === "deliverables") {
468
+ const payload = record?.state === "ready" ? listDeliverables({ conversationId: record.conversationId }, limit, offset) : {
469
+ items: [],
470
+ nextOffset: null
471
+ };
472
+ return c.json({
473
+ ok: true,
474
+ payload
475
+ });
476
+ }
477
+ const tasks = new TaskOriginRepository();
478
+ if (view === "work") {
479
+ const conversationId = record?.state === "ready" ? record.conversationId : null;
480
+ const recent = conversationId ? tasks.listRecentEnded(conversationId, limit, offset) : {
481
+ items: [],
482
+ total: 0
483
+ };
484
+ return c.json({
485
+ ok: true,
486
+ payload: {
487
+ ...recent,
488
+ current: conversationId && offset === 0 ? tasks.listCurrent(conversationId) : []
489
+ }
490
+ });
491
+ }
283
492
  if (!record || record.state !== "ready") return c.json({
284
493
  ok: true,
285
494
  payload: {
@@ -289,8 +498,8 @@ function registerPersonalAgentRoutes(authenticated, deps) {
289
498
  });
290
499
  return c.json({
291
500
  ok: true,
292
- payload: new TaskOriginRepository().list(record.conversationId, query.data.limit, {
293
- offset: query.data.offset,
501
+ payload: tasks.list(record.conversationId, limit, {
502
+ offset,
294
503
  order: "recent"
295
504
  })
296
505
  });
@@ -1,6 +1,6 @@
1
1
  import { resolveStateDir } from "../../../config/paths-state.js";
2
- import { getSessionMetadata, init_session_read_repository } from "../../../storage/sqlite/session-read-repository.js";
3
2
  import { AgentCatalogRepository, init_repository } from "../../../agent-catalog/repository.js";
3
+ import { getSessionMetadata, init_session_read_repository } from "../../../storage/sqlite/session-read-repository.js";
4
4
  import { init_paths } from "../../../config/paths.js";
5
5
  import { resolveEffectiveAgentConfigForAgent } from "../../../config/agent-profile.js";
6
6
  import { phoneModelProfile } from "../../../phone/model-policy.js";
@@ -0,0 +1,3 @@
1
+ import type { Hono } from 'hono';
2
+ import type { AuthenticatedRouteDeps } from './deps.js';
3
+ export declare function registerSpaceRoutes(app: Hono, deps: AuthenticatedRouteDeps): void;
@@ -0,0 +1,105 @@
1
+ import { SpacePatchSchema, SpaceSaveReplySchema, SpaceSaveVersionSchema } from "../../../../packages/gateway-contract/src/space.js";
2
+ import { init_src } from "../../../../packages/gateway-contract/src/index.js";
3
+ import { changeSpaceItem, findSpaceArtifact, findSpaceTaskDelivery, getSpaceItem, listSpaceItems, purgeSpaceItem, readSpaceContent, saveSpaceReply, saveSpaceVersion } from "../../../space/repository.js";
4
+ import { z } from "zod";
5
+ //#region src/gateway/hono/routes/space.ts
6
+ init_src();
7
+ const revisionSchema = SpacePatchSchema.pick({ revision: true });
8
+ const listSchema = z.object({
9
+ view: z.enum([
10
+ "all",
11
+ "favorites",
12
+ "trash"
13
+ ]).default("all"),
14
+ q: z.string().max(160).optional(),
15
+ kind: z.string().max(60).optional(),
16
+ projectId: z.string().max(160).optional(),
17
+ taskId: z.string().max(160).optional(),
18
+ cursor: z.string().max(512).optional(),
19
+ versionTargetFor: z.string().uuid().optional()
20
+ });
21
+ function registerSpaceRoutes(app, deps) {
22
+ const limited = deps.strictRateLimitMiddleware;
23
+ app.get("/api/spaces/items", (c) => {
24
+ const input = listSchema.safeParse(c.req.query());
25
+ return input.success ? c.json(listSpaceItems(input.data)) : c.json({ error: "Invalid search" }, 400);
26
+ });
27
+ app.post("/api/spaces/items", limited, async (c) => {
28
+ const input = SpaceSaveReplySchema.safeParse(await c.req.json().catch(() => null));
29
+ if (!input.success) return c.json({ error: "Invalid reply reference" }, 400);
30
+ const id = saveSpaceReply(input.data.conversationId, input.data.entryId ?? { turnId: input.data.turnId });
31
+ return id ? c.json({ id }) : c.json({ error: "Reply not found" }, 404);
32
+ });
33
+ app.get("/api/spaces/artifacts/:mediaId", (c) => {
34
+ const result = findSpaceArtifact(c.req.param("mediaId"));
35
+ return result ? c.json(result) : c.json({ error: "Artifact not found" }, 404);
36
+ });
37
+ app.get("/api/spaces/deliveries/:deliveryId", (c) => {
38
+ const result = findSpaceTaskDelivery(c.req.param("deliveryId"));
39
+ return result ? c.json(result) : c.json({ error: "Delivery not found" }, 404);
40
+ });
41
+ app.get("/api/spaces/items/:id", (c) => {
42
+ const item = getSpaceItem(c.req.param("id"));
43
+ return item ? c.json(item) : c.json({ error: "Item not found" }, 404);
44
+ });
45
+ app.patch("/api/spaces/items/:id", limited, async (c) => {
46
+ const input = SpacePatchSchema.safeParse(await c.req.json().catch(() => null));
47
+ if (!input.success) return c.json({ error: "Invalid item update" }, 400);
48
+ const { revision, ...patch } = input.data;
49
+ const result = changeSpaceItem(c.req.param("id"), revision, patch);
50
+ return result === "ok" ? c.json(getSpaceItem(c.req.param("id"))) : c.json({ error: result }, result === "missing" ? 404 : 409);
51
+ });
52
+ app.post("/api/spaces/items/:id/versions", limited, async (c) => {
53
+ const input = SpaceSaveVersionSchema.safeParse(await c.req.json().catch(() => null));
54
+ if (!input.success) return c.json({ error: "Invalid version reference" }, 400);
55
+ const result = saveSpaceVersion(c.req.param("id"), input.data.sourceVersionId, input.data.revision);
56
+ return typeof result !== "string" ? c.json(result) : c.json({ error: result }, result === "missing" ? 404 : 409);
57
+ });
58
+ for (const action of [
59
+ "trash",
60
+ "restore",
61
+ "purge"
62
+ ]) {
63
+ const handler = async (c) => {
64
+ const input = revisionSchema.safeParse(await c.req.json().catch(() => null));
65
+ if (!input.success) return c.json({ error: "Invalid item revision" }, 400);
66
+ const id = c.req.param("id");
67
+ const result = action === "purge" ? purgeSpaceItem(id, input.data.revision) : changeSpaceItem(id, input.data.revision, { trash: action === "trash" });
68
+ return result === "ok" ? c.json({ ok: true }) : c.json({ error: result }, result === "missing" ? 404 : 409);
69
+ };
70
+ if (action === "trash") app.delete("/api/spaces/items/:id", limited, handler);
71
+ else app.post(`/api/spaces/items/:id/${action}`, limited, handler);
72
+ }
73
+ app.get("/api/spaces/items/:id/versions/:versionId/content", async (c) => {
74
+ const content = await readSpaceContent(c.req.param("id"), c.req.param("versionId"), c.req.header("Range"));
75
+ if (!content) return c.json({ error: "Content not found" }, 404);
76
+ const { version, body, size, range } = content;
77
+ const headers = new Headers({
78
+ "Content-Type": /^[\w.+-]+\/[\w.+-]+$/.test(version.mimeType) ? version.mimeType : "application/octet-stream",
79
+ "Content-Disposition": `attachment; filename*=UTF-8''${encodeURIComponent(Buffer.from(version.fileName, "utf8").toString("utf8")).replace(/[!'()*]/g, (char) => "%" + char.charCodeAt(0).toString(16).toUpperCase())}`,
80
+ "Content-Security-Policy": "sandbox; default-src 'none'",
81
+ "X-Content-Type-Options": "nosniff",
82
+ "Cache-Control": "private, no-store",
83
+ "Accept-Ranges": "bytes"
84
+ });
85
+ if (range === "invalid") {
86
+ headers.set("Content-Range", `bytes */${size}`);
87
+ return new Response(null, {
88
+ status: 416,
89
+ headers
90
+ });
91
+ }
92
+ if (range) {
93
+ headers.set("Content-Range", `bytes ${range.start}-${range.end}/${size}`);
94
+ headers.set("Content-Length", String(range.end - range.start + 1));
95
+ return new Response(body, {
96
+ status: 206,
97
+ headers
98
+ });
99
+ }
100
+ headers.set("Content-Length", String(size));
101
+ return new Response(body, { headers });
102
+ });
103
+ }
104
+ //#endregion
105
+ export { registerSpaceRoutes };
@@ -1,17 +1,18 @@
1
1
  import { init_transaction, runSqliteWriteTransaction } from "../../../storage/sqlite/transaction.js";
2
- import { TaskCommandRequestSchema, TaskCreateRequestSchema, TaskCriterionReviewInputSchema, TaskHandoffRequestSchema } from "../../../../packages/gateway-contract/src/tasks.js";
2
+ import { TaskCommandRequestSchema, TaskCreateRequestSchema, TaskCriterionReviewInputSchema, TaskHandoffRequestSchema, taskCheckId } from "../../../../packages/gateway-contract/src/tasks.js";
3
+ import { isMobileDevicePlatform } from "../../../../packages/gateway-contract/src/device-pairing.js";
3
4
  import { ProductReadContracts, TaskRunCancelOutputSchema, TaskRunFeedbackOutputSchema } from "../../../../packages/gateway-contract/src/capabilities.js";
4
5
  import { init_src } from "../../../../packages/gateway-contract/src/index.js";
5
6
  import { hasGatewayScope } from "../../security/gateway-scopes.js";
7
+ import { getDevice, isDeviceAccessSessionActive } from "../../../storage/sqlite/device-access-repository.js";
6
8
  import { enqueueTaskChangedEvent, init_task_change_events } from "../../../tasks/task-change-events.js";
7
9
  import { TaskRepository, init_task_repository } from "../../../tasks/task-repository.js";
8
10
  import { TaskRunRepository, init_task_run_repository } from "../../../tasks/task-run-repository.js";
11
+ import { TaskCriterionReviewRepository } from "../../../tasks/task-criterion-review-repository.js";
9
12
  import { TaskConversationRepository } from "../../../tasks/task-conversation-repository.js";
10
13
  import { TaskCollaborationRepository } from "../../../tasks/task-collaboration-repository.js";
11
14
  import { CapabilityError } from "../../../capabilities/runtime/errors.js";
12
15
  import "../../../capabilities/runtime/dispatcher.js";
13
- import { TaskCriterionReviewRepository } from "../../../tasks/task-criterion-review-repository.js";
14
- import { TaskApplicationService } from "../../../tasks/task-application-service.js";
15
16
  import { TaskMutationOutputSchema } from "../../../tasks/capabilities/write.js";
16
17
  import { TaskDeleteOutputSchema } from "../../../tasks/capabilities/management.js";
17
18
  import { TaskContextMutationOutputSchema } from "../../../tasks/capabilities/relations.js";
@@ -31,6 +32,12 @@ init_transaction();
31
32
  init_task_change_events();
32
33
  init_task_repository();
33
34
  init_task_run_repository();
35
+ function canReviewTask(principal) {
36
+ if (!hasGatewayScope(principal.scopes, "tasks.write")) return false;
37
+ if (principal.kind === "owner" || principal.kind === "trusted-proxy") return true;
38
+ const device = principal.deviceId ? getDevice(principal.deviceId) : void 0;
39
+ return Boolean(device && isMobileDevicePlatform(device.platform) && principal.accessSessionId && hasGatewayScope(device.scopes, "tasks.write") && isDeviceAccessSessionActive(device.id, principal.accessSessionId));
40
+ }
34
41
  function registerTaskRoutes(authenticated, deps) {
35
42
  const capabilities = createProductDispatcher(() => deps.service.notesServiceInstance, {
36
43
  getConfig: () => deps.service.currentConfig,
@@ -133,15 +140,14 @@ function registerTaskRoutes(authenticated, deps) {
133
140
  return capabilityHttpError(c, error);
134
141
  }
135
142
  });
136
- authenticated.put("/api/tasks/:id/criteria/:index/review", taskRateLimit, async (c) => {
143
+ authenticated.put("/api/tasks/:id/criteria/:checkId/review", taskRateLimit, async (c) => {
137
144
  const principal = getGatewayPrincipal(c);
138
- if (!hasGatewayScope(principal.scopes, "tasks.write") || principal.kind !== "owner" && principal.kind !== "trusted-proxy") return c.json({
145
+ if (!canReviewTask(principal)) return c.json({
139
146
  ok: false,
140
- error: "Human review requires owner access"
147
+ error: "Task review requires owner or paired mobile access"
141
148
  }, 403);
142
- const index = Number(c.req.param("index"));
143
149
  const parsed = TaskCriterionReviewInputSchema.safeParse(await c.req.json().catch(() => null));
144
- if (!Number.isInteger(index) || index < 0 || !parsed.success) return c.json({
150
+ if (!parsed.success) return c.json({
145
151
  ok: false,
146
152
  error: "Invalid criterion review"
147
153
  }, 400);
@@ -154,7 +160,9 @@ function registerTaskRoutes(authenticated, deps) {
154
160
  ok: false,
155
161
  error: "Task changed; refresh before reviewing"
156
162
  }, 409);
157
- if (task.contract?.acceptanceCriteria[index] === void 0) return c.json({
163
+ const checkId = c.req.param("checkId");
164
+ const index = task.contract?.acceptanceCriteria.findIndex((_, position) => taskCheckId(task.id, task.latestContractVersion, position) === checkId) ?? -1;
165
+ if (index < 0) return c.json({
158
166
  ok: false,
159
167
  error: "Criterion not found"
160
168
  }, 404);
@@ -163,32 +171,18 @@ function registerTaskRoutes(authenticated, deps) {
163
171
  id: principal.principalId
164
172
  };
165
173
  const result = runSqliteWriteTransaction((db) => {
166
- const completed = parsed.data.status === "passed" && criterionReviews.allPassed(task, index);
167
- if (completed && (runs.getActiveRoot(task.id) || runs.listActiveWaits(task.id).length > 0)) return { blocked: true };
174
+ if (runs.listActiveWaits(task.id).length > 0) return { blocked: true };
168
175
  const review = criterionReviews.set({
169
176
  task,
170
177
  expectedVersion: parsed.data.expectedVersion,
171
178
  criterionIndex: index,
179
+ resultId: parsed.data.resultId,
172
180
  status: parsed.data.status,
173
181
  note: parsed.data.note,
174
182
  actor
175
183
  });
176
184
  if (!review) return void 0;
177
- let version = task.version + 1;
178
- if (completed) {
179
- const closed = new TaskApplicationService().execute({
180
- taskId: task.id,
181
- expectedVersion: version,
182
- idempotencyKey: `criterion-completion:${task.id}:${version}`,
183
- actor,
184
- command: {
185
- type: "close",
186
- resolution: "done"
187
- }
188
- });
189
- if (closed.ok === false) throw new Error(`Task completion failed after criterion review: ${closed.reason}`);
190
- version = closed.model.task.version;
191
- }
185
+ const version = task.version + 1;
192
186
  enqueueTaskChangedEvent(db, {
193
187
  taskId: task.id,
194
188
  projectId: task.projectId,
@@ -198,8 +192,7 @@ function registerTaskRoutes(authenticated, deps) {
198
192
  });
199
193
  return {
200
194
  review,
201
- version,
202
- completed
195
+ version
203
196
  };
204
197
  });
205
198
  if (!result) return c.json({
@@ -482,6 +475,12 @@ function registerTaskRoutes(authenticated, deps) {
482
475
  ok: false,
483
476
  error: "Invalid task command"
484
477
  }, 400);
478
+ if (parsed.data.command.type === "signoff") {
479
+ if (!canReviewTask(getGatewayPrincipal(c))) return c.json({
480
+ ok: false,
481
+ error: "Task sign-off requires owner or paired mobile access"
482
+ }, 403);
483
+ }
485
484
  const capabilityContext = capabilityHttpContext(c);
486
485
  const { idempotencyKey, ...input } = parsed.data;
487
486
  let result;
@@ -6,7 +6,7 @@ import { getVideoDefaults, getVideoModel, setVideoDefaults, setVideoModel } from
6
6
  import { enqueueVideoJob, getVideoJob, listVideoJobs } from "../../../video-generation/repository.js";
7
7
  import { getVideoDraft } from "../../../video-generation/drafts.js";
8
8
  import { readVideoArtifact } from "../../../video-generation/artifact.js";
9
- import { getConfiguredVideoProviders, getVideoProvider } from "../../../video-generation/providers.js";
9
+ import { getAvailableVideoModelRefs, getConfiguredVideoProviders, getVideoProvider } from "../../../video-generation/providers.js";
10
10
  import { resolveScopedMediaReference } from "../../media-access.js";
11
11
  import { createHash } from "node:crypto";
12
12
  import { z } from "zod";
@@ -58,7 +58,8 @@ async function videoSettings() {
58
58
  return {
59
59
  modelRef,
60
60
  defaults: getVideoDefaults(modelRef),
61
- configured
61
+ configured,
62
+ modelRefs: [...new Set([...getAvailableVideoModelRefs(), modelRef])]
62
63
  };
63
64
  }
64
65
  function registerVideoGenerationRoutes(app, deps) {
@@ -66,6 +67,7 @@ function registerVideoGenerationRoutes(app, deps) {
66
67
  app.put(settingsPath, deps.strictRateLimitMiddleware, async (c) => {
67
68
  const parsed = z.object({ modelRef: modelSchema }).safeParse(await c.req.json().catch(() => null));
68
69
  if (!parsed.success) return c.json({ error: "Unknown video generation model" }, 400);
70
+ if (!getAvailableVideoModelRefs().includes(parsed.data.modelRef)) return c.json({ error: "XOPC Cloud video model is unavailable" }, 400);
69
71
  setVideoModel(parsed.data.modelRef);
70
72
  return c.json(await videoSettings());
71
73
  });
@@ -90,7 +92,7 @@ function registerVideoGenerationRoutes(app, deps) {
90
92
  const session = await deps.service.sessionIndexInstance.getSessionMetadata(conversationId);
91
93
  if (!session?.transcriptId) return c.json({ error: "Conversation not found" }, 404);
92
94
  const modelRef = getVideoModel();
93
- const configured = Boolean(await getVideoProvider(modelRef).resolveKey().catch(() => void 0));
95
+ const configured = getAvailableVideoModelRefs().includes(modelRef) && Boolean(await getVideoProvider(modelRef).resolveKey().catch(() => void 0));
94
96
  const jobs = listVideoJobs(conversationId);
95
97
  const draft = getVideoDraft(conversationId, session.transcriptId);
96
98
  return c.json({
@@ -145,15 +147,16 @@ function registerVideoGenerationRoutes(app, deps) {
145
147
  }
146
148
  const mime = bytes && imageMime(bytes);
147
149
  if (bytes && !mime) return c.json({ error: "Reference image must be PNG, JPEG or WebP" }, 400);
148
- if (bytes && model.provider === "volcengine-ark") {
150
+ if (bytes && (model.provider === "volcengine-ark" || modelRef.startsWith("xopc-cloud/video-seedance"))) {
149
151
  const { default: sharp } = await import("sharp");
150
152
  const size = await sharp(bytes, { limitInputPixels: 36e6 }).metadata().catch(() => void 0);
151
153
  const width = size?.autoOrient.width ?? 0;
152
154
  const height = size?.autoOrient.height ?? 0;
153
155
  if (width < 300 || height < 300 || width > 6e3 || height > 6e3 || width / height < .4 || width / height > 2.5) return c.json({ error: "Seedance requires a readable image with sides of 300–6000 px and an aspect ratio of 0.4–2.5" }, 400);
154
156
  }
157
+ if (!getAvailableVideoModelRefs().includes(modelRef)) return c.json({ error: "XOPC Cloud video model is unavailable" }, 503);
155
158
  const provider = getVideoProvider(modelRef);
156
- if (!await provider.resolveKey().catch(() => void 0)) return c.json({ error: `Configure a ${provider.name} API key on the Gateway` }, 503);
159
+ if (!await provider.resolveKey().catch(() => void 0)) return c.json({ error: `Connect ${provider.name} on the Gateway` }, 503);
157
160
  const hash = createHash("sha256").update(JSON.stringify({
158
161
  ...request,
159
162
  imageName
@@ -1,5 +1,5 @@
1
1
  export declare const HTML_PREVIEW_PATH = "/api/preview/html";
2
- export declare const HTML_PREVIEW_SHELL = "<!doctype html>\n<html><head><meta charset=\"utf-8\"><title>HTML preview</title>\n<style>html,body{height:100%;margin:0;overflow:hidden}iframe{display:block;width:100%;height:100%;border:0}</style>\n</head><body><iframe title=\"HTML preview\" sandbox=\"allow-scripts allow-popups allow-popups-to-escape-sandbox allow-downloads allow-forms allow-modals\"></iframe>\n<script>\nconst preview = document.querySelector('iframe');\nwindow.addEventListener('message', (event) => {\n if (event.source !== window.parent || window.parent === window) return;\n const data = event.data;\n if (!data || data.type !== 'xopc-html-preview' || typeof data.html !== 'string') return;\n // Repeated load notifications must not restart scripts or discard preview state.\n if (preview.srcdoc !== data.html) preview.srcdoc = data.html;\n});\n</script></body></html>";
2
+ export declare const HTML_PREVIEW_SHELL = "<!doctype html>\n<html><head><meta charset=\"utf-8\"><title>HTML preview</title>\n<style>html,body{height:100%;margin:0;overflow:hidden}iframe{display:block;width:100%;height:100%;border:0}</style>\n</head><body><iframe title=\"HTML preview\" sandbox=\"allow-scripts allow-popups allow-popups-to-escape-sandbox allow-downloads allow-forms allow-modals\"></iframe>\n<script>\nconst preview = document.querySelector('iframe');\npreview.addEventListener('load', () => {\n if (preview.hasAttribute('srcdoc')) window.parent.postMessage({ type: 'xopc-html-preview-ready' }, '*');\n});\nwindow.addEventListener('message', (event) => {\n if (event.source !== window.parent || window.parent === window) return;\n const data = event.data;\n if (!data || data.type !== 'xopc-html-preview' || typeof data.html !== 'string') return;\n // Repeated load notifications must not restart scripts or discard preview state.\n if (preview.srcdoc !== data.html) preview.srcdoc = data.html;\n});\n</script></body></html>";
3
3
  export declare const HTML_PREVIEW_HEADERS: {
4
4
  'Content-Type': string;
5
5
  'Content-Security-Policy': string;
@@ -22,6 +22,9 @@ const HTML_PREVIEW_SHELL = `<!doctype html>
22
22
  </head><body><iframe title="HTML preview" sandbox="${HTML_PREVIEW_SANDBOX}"></iframe>
23
23
  <script>
24
24
  const preview = document.querySelector('iframe');
25
+ preview.addEventListener('load', () => {
26
+ if (preview.hasAttribute('srcdoc')) window.parent.postMessage({ type: 'xopc-html-preview-ready' }, '*');
27
+ });
25
28
  window.addEventListener('message', (event) => {
26
29
  if (event.source !== window.parent || window.parent === window) return;
27
30
  const data = event.data;
@@ -3,7 +3,7 @@ import { resolveMediaReference } from "../media/media-reference.js";
3
3
  import { pendingTranscriptReferencesMediaUri } from "../agent/inbound/attachment-pipeline.js";
4
4
  import { TaskContextRepository } from "../tasks/task-context-repository.js";
5
5
  import { FileServiceError } from "../files/file-service.js";
6
- import { messagesReferenceMediaUri, taskResultReferencesMediaUri } from "../media/session-references.js";
6
+ import { messagesReferenceMediaUri, taskOutcomeReferencesMediaUri, taskResultReferencesMediaUri } from "../media/session-references.js";
7
7
  //#region src/gateway/media-access.ts
8
8
  init_task_repository();
9
9
  /** Resolve media only when the supplied session or task references it. */
@@ -12,7 +12,7 @@ async function resolveScopedMediaReference(service, uri, scope) {
12
12
  if (!conversationId && !taskId) throw new FileServiceError(400, "Missing media scope");
13
13
  const media = await resolveMediaReference(uri);
14
14
  const sessionReferencesUri = conversationId ? messagesReferenceMediaUri(await service.sessionIndexInstance.loadMessages(conversationId), media.uri) || pendingTranscriptReferencesMediaUri(conversationId, media.uri) || taskResultReferencesMediaUri(conversationId, media.uri) : false;
15
- const taskReferencesUri = taskId && new TaskRepository().get(taskId) ? new TaskContextRepository().list(taskId).some((edge) => edge.targetKind === "file" && edge.targetId === media.uri) : false;
15
+ const taskReferencesUri = taskId && new TaskRepository().get(taskId) ? taskOutcomeReferencesMediaUri(taskId, media.uri) || new TaskContextRepository().list(taskId).some((edge) => edge.targetKind === "file" && edge.targetId === media.uri) : false;
16
16
  if (!sessionReferencesUri && !taskReferencesUri) throw new FileServiceError(404, "Not found");
17
17
  return media;
18
18
  }
@@ -36,6 +36,7 @@ function requiredGatewayScope(method, path) {
36
36
  if (path.startsWith("/api/endpoint-tools")) return "device.self";
37
37
  if (path === "/api/user-context/environment" || path.startsWith("/api/user-context/environment/")) return "device.self";
38
38
  if (path === "/api/personal-agent/activity") return "tasks.read";
39
+ if (path === "/api/personal-agent/schedules" || path.startsWith("/api/personal-agent/schedules/")) return methodScope(method, "automations.read", "automations.write");
39
40
  if (path === "/api/personal-agent" || path.startsWith("/api/personal-agent/")) return methodScope(method, "sessions.read", "sessions.write");
40
41
  if (path.startsWith("/api/browser/tab-bindings")) return methodScope(method, "sessions.read", "sessions.write");
41
42
  if (method === "GET" && path === "/api/connectors/approvals") return "sessions.read";
@@ -46,6 +47,7 @@ function requiredGatewayScope(method, path) {
46
47
  if (path.startsWith("/api/agents") || path.startsWith("/api/models")) return methodScope(method, "agents.read", "gateway.admin");
47
48
  if (path === "/api/video-generation/settings") return "gateway.admin";
48
49
  if (path.startsWith("/api/video-generation/")) return methodScope(method, "sessions.read", "sessions.write");
50
+ if (method === "GET" && /^\/api\/music-generation\/sessions\/[^/]+\/jobs(?:\/[a-f0-9]{64}\/audio)?$/.test(path)) return "sessions.read";
49
51
  if (path.startsWith("/api/sessions") || path.startsWith("/api/side-chats")) return methodScope(method, "sessions.read", "sessions.write");
50
52
  if (path.startsWith("/api/tasks")) return methodScope(method, "tasks.read", "tasks.write");
51
53
  if (path === "/api/task-runs" || path.startsWith("/api/task-runs/")) return methodScope(method, "tasks.read", "tasks.write");
@@ -687,7 +687,7 @@ export declare class GatewayConfigCoordinator {
687
687
  voice?: string;
688
688
  };
689
689
  omni?: {
690
- provider: "qwen-token-plan-cn" | "xopc-cloud" | "alibaba";
690
+ provider: "xopc-cloud" | "qwen-token-plan-cn" | "alibaba";
691
691
  model: string;
692
692
  voice: string;
693
693
  instructions: string;
@@ -222,6 +222,7 @@ export declare class GatewayService {
222
222
  private loadDeferredExtensions;
223
223
  private schedulePostReadySidecars;
224
224
  private runPostReadySidecars;
225
+ private readonly spaceWorker;
225
226
  private readonly musicGenerationWorker;
226
227
  private readonly videoGenerationWorker;
227
228
  start(): Promise<void>;