@xopcai/xopc 0.0.230 → 0.0.232

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 (384) hide show
  1. package/README.md +1 -0
  2. package/README.zh-CN.md +1 -0
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/feishu/src/schema/config-schema.d.ts +3 -3
  5. package/dist/extensions/telegram/src/config-schema.d.ts +4 -4
  6. package/dist/extensions/telegram/xopc.extension.json +1 -1
  7. package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
  8. package/dist/gateway/static/root/assets/{activity-store-M0nAY5XB.js → activity-store-VXCWz43N.js} +1 -1
  9. package/dist/gateway/static/root/assets/agent-avatar-dicebear-BXRaZYW8.js +1 -0
  10. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-dR7HMaRX.js +1 -0
  11. package/dist/gateway/static/root/assets/agents-Bileycwe.js +1 -0
  12. package/dist/gateway/static/root/assets/api-wGPgL8xY.js +1 -0
  13. package/dist/gateway/static/root/assets/{app-management-settings-panel-CwAPK4Jm.js → app-management-settings-panel-BJfClfPx.js} +1 -1
  14. package/dist/gateway/static/root/assets/{appearance-settings-DsGLvqTb.js → appearance-settings-C_R0vUAu.js} +1 -1
  15. package/dist/gateway/static/root/assets/{apps-page-Ee9qOQEx.js → apps-page-CBow8pBI.js} +1 -1
  16. package/dist/gateway/static/root/assets/{archive-plugin-7_DXaMTP.js → archive-plugin-DnFHkSHE.js} +1 -1
  17. package/dist/gateway/static/root/assets/{attachment-load-B4qqigAQ.js → attachment-load-DZrEwytM.js} +1 -1
  18. package/dist/gateway/static/root/assets/{automations-page-B8ImehSW.js → automations-page-DpkKajui.js} +1 -1
  19. package/dist/gateway/static/root/assets/automations-workspace-BBntVWgv.js +6 -0
  20. package/dist/gateway/static/root/assets/{binary-plugins-DaJbyYc2.js → binary-plugins-Ckc_Csue.js} +1 -1
  21. package/dist/gateway/static/root/assets/{block-editor-Kl25XWJc.js → block-editor-DAC6w-iV.js} +4 -4
  22. package/dist/gateway/static/root/assets/browser-settings-page-DrsMd-Po.js +8 -0
  23. package/dist/gateway/static/root/assets/browser-workflow-inputs-BGd7R8GO.js +1 -0
  24. package/dist/gateway/static/root/assets/{browser-workflows-page-DjMxs33B.js → browser-workflows-page-DUfj7ntM.js} +2 -2
  25. package/dist/gateway/static/root/assets/capabilities-settings-panel-97gkGeSV.js +7 -0
  26. package/dist/gateway/static/root/assets/channels-settings-CuBsz8UI.js +1 -0
  27. package/dist/gateway/static/root/assets/{channel-recipient-api-C5ABr73b.js → channels-status-swr-CfboECLt.js} +1 -1
  28. package/dist/gateway/static/root/assets/{chat-terminal-dock-BiU_4Rq6.js → chat-terminal-dock-CA9fndbZ.js} +2 -2
  29. package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +1 -0
  30. package/dist/gateway/static/root/assets/{code-editor-dFzqyDXS.js → code-editor-D4_k-6QN.js} +1 -1
  31. package/dist/gateway/static/root/assets/connectors-page-SuL7td7Z.js +2 -0
  32. package/dist/gateway/static/root/assets/cron-expression-CqPu7HYJ.js +2 -0
  33. package/dist/gateway/static/root/assets/date-picker-C8dJsCgk.js +1 -0
  34. package/dist/gateway/static/root/assets/dependency-picker-Iz2wYimy.js +1 -0
  35. package/dist/gateway/static/root/assets/{desktop-pet-ux9DxchT.js → desktop-pet-C3h40FmG.js} +1 -1
  36. package/dist/gateway/static/root/assets/{desktop-pet-settings-BVVCBgYK.js → desktop-pet-settings-YfeVVzLe.js} +1 -1
  37. package/dist/gateway/static/root/assets/dist-DqPZM2MH2.js +1 -0
  38. package/dist/gateway/static/root/assets/{extension-debug-page-Dh6DDuvQ.js → extension-debug-page-CChgztz_.js} +1 -1
  39. package/dist/gateway/static/root/assets/{extension-page-8OKQDEat.js → extension-page-DF6ct6_y.js} +1 -1
  40. package/dist/gateway/static/root/assets/extension-settings-page-jgBsjn0F.js +1 -0
  41. package/dist/gateway/static/root/assets/files-Dp8_uGTO.js +1 -0
  42. package/dist/gateway/static/root/assets/{gateway-config-api-Dlc6eaTG.js → gateway-config-api-CVajuIGL.js} +1 -1
  43. package/dist/gateway/static/root/assets/gateway-config-swr-BGQn8duh.js +1 -0
  44. package/dist/gateway/static/root/assets/{gateway-settings-DqQgiAUv.js → gateway-settings-BbssNGid.js} +1 -1
  45. package/dist/gateway/static/root/assets/{gateway-startup-retry-B_zrtccP.js → gateway-startup-retry-D2Rnh9fX.js} +1 -1
  46. package/dist/gateway/static/root/assets/heartbeat-settings-CJtXu8iD.js +1 -0
  47. package/dist/gateway/static/root/assets/home-page-Be1o1AXQ.js +1 -0
  48. package/dist/gateway/static/root/assets/html-workspace-editor-C3DKAkMc.js +1 -0
  49. package/dist/gateway/static/root/assets/{image-generation-api-YKP2me5Z.js → image-generation-api-D7W2p5_8.js} +1 -1
  50. package/dist/gateway/static/root/assets/index-B2OJSXX9.js +70 -0
  51. package/dist/gateway/static/root/assets/index-rHjAElxG.css +2 -0
  52. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BSFNqxzY.js → keyboard-shortcuts-settings-BvHYyNus.js} +1 -1
  53. package/dist/gateway/static/root/assets/local-app-workbench-page-COfelgk7.js +2 -0
  54. package/dist/gateway/static/root/assets/{local-apps-page-DzU6yZ9-.js → local-apps-page-Cb8t2wWM.js} +1 -1
  55. package/dist/gateway/static/root/assets/locale-store-DLwVxS3V.js +1 -0
  56. package/dist/gateway/static/root/assets/logs-page-DA8oDjeB.js +2 -0
  57. package/dist/gateway/static/root/assets/management-settings-B8Jie4-J.js +1 -0
  58. package/dist/gateway/static/root/assets/markdown-editor-nDLmA_LF.js +2 -0
  59. package/dist/gateway/static/root/assets/markdown-split-BD1r4o2i.js +1 -0
  60. package/dist/gateway/static/root/assets/{markdown-view-DvM5PWEH.js → markdown-view-B-BHEcNd.js} +1 -1
  61. package/dist/gateway/static/root/assets/markdown-view-B1bGSQqt.css +1 -0
  62. package/dist/gateway/static/root/assets/{media-plugins-B8vMe5VX.js → media-plugins-BCev8fkW.js} +1 -1
  63. package/dist/gateway/static/root/assets/messages-Dp1OxSKt.js +3 -0
  64. package/dist/gateway/static/root/assets/mobile-device-api-DACoHhhk.js +1 -0
  65. package/dist/gateway/static/root/assets/models-hub-cache-C8zjqmIv.js +1 -0
  66. package/dist/gateway/static/root/assets/{notes-api-BFsOGYkd.js → notes-api-DEdNKw0I.js} +1 -1
  67. package/dist/gateway/static/root/assets/{notes-page-B-YZ7iuK.js → notes-page-BBTLjJwa.js} +1 -1
  68. package/dist/gateway/static/root/assets/notes-workbench-DICgUGPv.js +4 -0
  69. package/dist/gateway/static/root/assets/oauth-api-BNCO2YK5.js +1 -0
  70. package/dist/gateway/static/root/assets/popover-select-3E24E65N.js +1 -0
  71. package/dist/gateway/static/root/assets/{product-open-page-DkWcyki5.js → product-open-page-fEBbRekH.js} +1 -1
  72. package/dist/gateway/static/root/assets/project-detail-page-CqdkznYJ.js +1 -0
  73. package/dist/gateway/static/root/assets/projects-page-dHDXpMCg.js +1 -0
  74. package/dist/gateway/static/root/assets/{registry-api-BFZrVYfy.js → registry-api-Cvr4Qm7N.js} +1 -1
  75. package/dist/gateway/static/root/assets/remote-access-hub-2feZudJw.js +1 -0
  76. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bq_ETeal.js → runtime-tools-settings-panel-BT5B74IH.js} +2 -2
  77. package/dist/gateway/static/root/assets/{schema-form-BogTlrsP.js → schema-form-C4tB34S5.js} +1 -1
  78. package/dist/gateway/static/root/assets/sessions-page-CO2JCFdy.js +1 -0
  79. package/dist/gateway/static/root/assets/settings-advanced-gate-DxMVaqdn.js +1 -0
  80. package/dist/gateway/static/root/assets/{settings-form-section-Coy1Cbp6.js → settings-form-section-D1oXhkgI.js} +1 -1
  81. package/dist/gateway/static/root/assets/settings-loading-skeleton-CldfX6FJ.js +1 -0
  82. package/dist/gateway/static/root/assets/settings-page-c3LJnbvE.js +1 -0
  83. package/dist/gateway/static/root/assets/settings-shell-layer-context-DCp6ykjQ.js +1 -0
  84. package/dist/gateway/static/root/assets/setup-status-panel-DZNHb6A5.js +1 -0
  85. package/dist/gateway/static/root/assets/share-preview-page-DptCK_mk.js +2 -0
  86. package/dist/gateway/static/root/assets/shares-settings-DakZ2AGN.js +1 -0
  87. package/dist/gateway/static/root/assets/skill-reload-api-BOiNkWJC.js +1 -0
  88. package/dist/gateway/static/root/assets/{skills-page-Brxb6QnW.js → skills-page-OHBeBtSg.js} +1 -1
  89. package/dist/gateway/static/root/assets/{skills-page.utils-FB5LtEGm.js → skills-page.utils-B9WZbOLC.js} +1 -1
  90. package/dist/gateway/static/root/assets/{system-settings-panel-ChosWt8n.js → system-settings-panel-Dj_DpOGw.js} +1 -1
  91. package/dist/gateway/static/root/assets/task-detail-page-D5Nbe3C8.js +1 -0
  92. package/dist/gateway/static/root/assets/theme-store-Cpd3Gd5R.js +1 -0
  93. package/dist/gateway/static/root/assets/{use-autosave-2SqnmSKD.js → use-autosave-DCl5Yq7N.js} +1 -1
  94. package/dist/gateway/static/root/assets/user-context-page-CAPSUK8B.js +1 -0
  95. package/dist/gateway/static/root/assets/{vendor-codemirror-DRr7hFaD.js → vendor-codemirror--gTq3YAI.js} +16 -16
  96. package/dist/gateway/static/root/assets/voice-api-key-field-BB_ZQV8F.js +1 -0
  97. package/dist/gateway/static/root/assets/voice-config-api-BNiYmpl5.js +1 -0
  98. package/dist/gateway/static/root/assets/{work-discovery-overlay-CK3aZDdE.js → work-discovery-overlay-BrIdtdum.js} +1 -1
  99. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BjOuddkX.js → workflow-run-setup-panel-hKh-uCLo.js} +2 -2
  100. package/dist/gateway/static/root/assets/workflows-page-ahDvypGO.js +5 -0
  101. package/dist/gateway/static/root/index.html +19 -15
  102. package/dist/package.js +1 -1
  103. package/dist/src/agent/agent-manager.d.ts +1 -2
  104. package/dist/src/agent/agent-manager.js +29 -44
  105. package/dist/src/agent/background-review/run-background-review.js +10 -15
  106. package/dist/src/agent/embedded/run-for-session.js +1 -1
  107. package/dist/src/agent/external-tools/mcp-provider.js +3 -13
  108. package/dist/src/agent/image/generation/runtime.js +1 -1
  109. package/dist/src/agent/image/tool-model-config.js +13 -14
  110. package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +0 -9
  111. package/dist/src/agent/mcp/bundle-mcp-policy.js +1 -13
  112. package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
  113. package/dist/src/agent/mcp/index.js +2 -2
  114. package/dist/src/agent/media-generation/runtime-shared.d.ts +1 -1
  115. package/dist/src/agent/media-generation/runtime-shared.js +1 -1
  116. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  117. package/dist/src/agent/memory/manager.d.ts +1 -1
  118. package/dist/src/{agent-runtime/memory-runtime.d.ts → agent/memory/runtime.d.ts} +1 -1
  119. package/dist/src/{agent-runtime/memory-runtime.js → agent/memory/runtime.js} +2 -3
  120. package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -3
  121. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -3
  122. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -2
  123. package/dist/src/agent/service.d.ts +1 -0
  124. package/dist/src/agent/service.js +5 -3
  125. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  126. package/dist/src/agent/starter-agents.js +1 -8
  127. package/dist/src/agent/tools/executor.d.ts +1 -1
  128. package/dist/src/agent/tools/workflow-tool.js +1 -5
  129. package/dist/src/agent/tools/write.js +9 -12
  130. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  131. package/dist/src/agent-config/index.d.ts +2 -0
  132. package/dist/src/agent-config/index.js +11 -0
  133. package/dist/src/agent-config/resolver.d.ts +11 -0
  134. package/dist/src/agent-config/resolver.js +113 -0
  135. package/dist/src/agent-config/schema.d.ts +491 -0
  136. package/dist/src/agent-config/schema.js +172 -0
  137. package/dist/src/auth/oauth/index.js +2 -2
  138. package/dist/src/auth/oauth/registry.d.ts +1 -1
  139. package/dist/src/auth/oauth/registry.js +5 -1
  140. package/dist/src/auth/oauth/xopc-cloud.d.ts +1 -0
  141. package/dist/src/auth/oauth/xopc-cloud.js +8 -2
  142. package/dist/src/chat-commands/builtins/config.js +2 -2
  143. package/dist/src/chat-commands/builtins/review.js +1 -1
  144. package/dist/src/chat-commands/config-paths.js +1 -1
  145. package/dist/src/cli/commands/agents.js +2 -1
  146. package/dist/src/cli/commands/config.js +1 -1
  147. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  148. package/dist/src/cli/commands/doctor/checks/provider-auth.js +12 -4
  149. package/dist/src/cli/commands/image.js +3 -4
  150. package/dist/src/cli/commands/models.js +9 -3
  151. package/dist/src/cli/commands/onboard/model.js +12 -11
  152. package/dist/src/cli/commands/onboard.js +1 -1
  153. package/dist/src/cli/commands/tunnel.js +3 -18
  154. package/dist/src/cli/utils/init-workspace-core.d.ts +1 -1
  155. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  156. package/dist/src/commands/agents.config.d.ts +1 -3
  157. package/dist/src/commands/agents.config.js +9 -26
  158. package/dist/src/config/agent-model-intents.d.ts +10 -0
  159. package/dist/src/config/agent-model-intents.js +39 -0
  160. package/dist/src/config/agent-profile.d.ts +7 -9
  161. package/dist/src/config/agent-profile.js +30 -28
  162. package/dist/src/config/default-model.d.ts +1 -11
  163. package/dist/src/config/default-model.js +3 -11
  164. package/dist/src/config/index.js +3 -3
  165. package/dist/src/config/integration.d.ts +1 -1
  166. package/dist/src/config/reload.js +1 -1
  167. package/dist/src/config/rules.js +3 -3
  168. package/dist/src/config/schema.d.ts +187 -452
  169. package/dist/src/config/schema.js +53 -131
  170. package/dist/src/extensions/activation-context.js +7 -11
  171. package/dist/src/files/file-service.d.ts +36 -0
  172. package/dist/src/files/file-service.js +282 -0
  173. package/dist/src/gateway/agent-builtin-tools.d.ts +250 -6
  174. package/dist/src/gateway/agent-builtin-tools.js +284 -46
  175. package/dist/src/gateway/agents-admin.d.ts +20 -62
  176. package/dist/src/gateway/agents-admin.js +36 -228
  177. package/dist/src/gateway/device-routes.d.ts +3 -0
  178. package/dist/src/gateway/device-routes.js +47 -0
  179. package/dist/src/gateway/global-defaults-admin.d.ts +6 -20
  180. package/dist/src/gateway/global-defaults-admin.js +20 -120
  181. package/dist/src/gateway/heartbeat/service.js +1 -1
  182. package/dist/src/gateway/hono/app.js +6 -4
  183. package/dist/src/gateway/hono/lib/config-payload.d.ts +54 -137
  184. package/dist/src/gateway/hono/lib/config-payload.js +2 -4
  185. package/dist/src/gateway/hono/middleware/auth.js +33 -1
  186. package/dist/src/gateway/hono/middleware/scopes.d.ts +2 -12
  187. package/dist/src/gateway/hono/middleware/scopes.js +9 -18
  188. package/dist/src/gateway/hono/routes/agents.js +64 -100
  189. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  190. package/dist/src/gateway/hono/routes/device-push.d.ts +2 -0
  191. package/dist/src/gateway/hono/routes/{mobile.js → device-push.js} +40 -18
  192. package/dist/src/gateway/hono/routes/devices.d.ts +4 -0
  193. package/dist/src/gateway/hono/routes/devices.js +214 -0
  194. package/dist/src/gateway/hono/routes/files.d.ts +3 -0
  195. package/dist/src/gateway/hono/routes/files.js +176 -0
  196. package/dist/src/gateway/hono/routes/global-defaults.js +5 -9
  197. package/dist/src/gateway/hono/routes/index.js +4 -2
  198. package/dist/src/gateway/hono/routes/lazy-bundles.js +12 -20
  199. package/dist/src/gateway/hono/routes/models.js +2 -2
  200. package/dist/src/gateway/hono/routes/projects.js +0 -508
  201. package/dist/src/gateway/hono/routes/realtime.js +8 -1
  202. package/dist/src/gateway/hono/routes/shares.js +410 -21
  203. package/dist/src/gateway/hono/routes/status.js +9 -16
  204. package/dist/src/gateway/hono/routes/tunnel.d.ts +0 -2
  205. package/dist/src/gateway/hono/routes/tunnel.js +10 -199
  206. package/dist/src/gateway/hono/routes/voice.js +1 -1
  207. package/dist/src/gateway/hono/routes/workspace.js +15 -974
  208. package/dist/src/gateway/image-generation-setup.d.ts +2 -2
  209. package/dist/src/gateway/image-generation-setup.js +8 -7
  210. package/dist/src/gateway/public-url.d.ts +1 -1
  211. package/dist/src/gateway/security/gateway-principal.d.ts +11 -0
  212. package/dist/src/gateway/security/gateway-principal.js +12 -0
  213. package/dist/src/gateway/security/gateway-scopes.d.ts +7 -0
  214. package/dist/src/gateway/security/gateway-scopes.js +66 -0
  215. package/dist/src/gateway/security/index.d.ts +2 -1
  216. package/dist/src/gateway/security/index.js +3 -2
  217. package/dist/src/gateway/service.js +4 -4
  218. package/dist/src/gateway/xopc-cloud-capability-setup.js +19 -21
  219. package/dist/src/heartbeat/index.js +1 -1
  220. package/dist/src/migrations/index.d.ts +0 -1
  221. package/dist/src/migrations/index.js +1 -2
  222. package/dist/src/migrations/runner.js +1 -2
  223. package/dist/src/notifications/device-store.d.ts +1 -1
  224. package/dist/src/notifications/device-store.js +11 -11
  225. package/dist/src/notifications/store.js +3 -3
  226. package/dist/src/providers/index.js +1 -1
  227. package/dist/src/providers/model-reference-auditor.js +14 -9
  228. package/dist/src/realtime/runtime.d.ts +2 -0
  229. package/dist/src/realtime/runtime.js +27 -3
  230. package/dist/src/realtime/tickets.d.ts +6 -1
  231. package/dist/src/realtime/tickets.js +2 -1
  232. package/dist/src/remote-access/exposure-manager.js +3 -3
  233. package/dist/src/share/hosted-session-share.d.ts +104 -0
  234. package/dist/src/share/hosted-session-share.js +276 -0
  235. package/dist/src/share/note-share-service.js +4 -24
  236. package/dist/src/share/session-share-projector.d.ts +31 -0
  237. package/dist/src/share/session-share-projector.js +79 -0
  238. package/dist/src/share/session-share-service.d.ts +89 -0
  239. package/dist/src/share/session-share-service.js +325 -0
  240. package/dist/src/share/share-asset-ticket.d.ts +7 -0
  241. package/dist/src/share/share-asset-ticket.js +30 -0
  242. package/dist/src/share/share-landing.d.ts +4 -3
  243. package/dist/src/share/share-landing.js +5 -5
  244. package/dist/src/share/share-store.d.ts +27 -2
  245. package/dist/src/share/share-store.js +71 -8
  246. package/dist/src/share/share-types.d.ts +17 -2
  247. package/dist/src/share/share-url.js +2 -2
  248. package/dist/src/storage/sqlite/device-access-repository.d.ts +54 -0
  249. package/dist/src/storage/sqlite/device-access-repository.js +194 -0
  250. package/dist/src/storage/sqlite/device-pairing-repository.d.ts +22 -0
  251. package/dist/src/storage/sqlite/device-pairing-repository.js +86 -0
  252. package/dist/src/storage/sqlite/gateway-identity-repository.d.ts +10 -0
  253. package/dist/src/storage/sqlite/gateway-identity-repository.js +50 -0
  254. package/dist/src/storage/sqlite/index.d.ts +3 -0
  255. package/dist/src/storage/sqlite/index.js +4 -1
  256. package/dist/src/storage/sqlite/migrations/138_device_access.sql +96 -0
  257. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  258. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  259. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  260. package/dist/src/storage/sqlite/schema.js +1 -1
  261. package/dist/src/tui/backends/embedded-backend.js +1 -1
  262. package/dist/src/tui/backends/gateway-realtime-backend.js +11 -3
  263. package/dist/src/tunnel/consent.d.ts +1 -1
  264. package/dist/src/tunnel/consent.js +1 -1
  265. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  266. package/dist/src/tunnel/index.d.ts +1 -4
  267. package/dist/src/tunnel/index.js +3 -5
  268. package/dist/src/tunnel/tunnel-audit.d.ts +1 -1
  269. package/dist/src/tunnel/tunnel-config.js +1 -1
  270. package/dist/src/tunnel/tunnel-service.d.ts +2 -3
  271. package/dist/src/tunnel/tunnel-service.js +1 -20
  272. package/dist/src/tunnel/tunnel-types.d.ts +0 -6
  273. package/dist/src/workflows/draft/workflow-draft-service.js +2 -2
  274. package/dist/src/workflows/service/workflow-run-service.js +3 -3
  275. package/package.json +3 -3
  276. package/dist/gateway/static/root/assets/agent-avatar-dicebear-Bp_wmuGW.js +0 -1
  277. package/dist/gateway/static/root/assets/agents-CKG93dlc.js +0 -68
  278. package/dist/gateway/static/root/assets/api-BywYxpaS.js +0 -1
  279. package/dist/gateway/static/root/assets/automations-workspace-BNFAfNwC.js +0 -6
  280. package/dist/gateway/static/root/assets/browser-settings-page-Cg6NgwE_.js +0 -8
  281. package/dist/gateway/static/root/assets/browser-workflow-inputs-8NC2qDRF.js +0 -1
  282. package/dist/gateway/static/root/assets/capabilities-settings-panel-NvJKgF1u.js +0 -7
  283. package/dist/gateway/static/root/assets/capability-presets-api-o0y9WgAI.js +0 -1
  284. package/dist/gateway/static/root/assets/capability-presets-settings-panel-C2uBdALe.js +0 -3
  285. package/dist/gateway/static/root/assets/channels-settings-CIcYKMEs.js +0 -1
  286. package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +0 -1
  287. package/dist/gateway/static/root/assets/connectors-page-CEEcmUiP.js +0 -2
  288. package/dist/gateway/static/root/assets/cron-expression-Cs_5pUPT.js +0 -2
  289. package/dist/gateway/static/root/assets/date-picker-y1kWrFVU.js +0 -1
  290. package/dist/gateway/static/root/assets/dependency-picker-skc62zrn.js +0 -1
  291. package/dist/gateway/static/root/assets/directory-picker-path-field-V8vZP0Dy.js +0 -1
  292. package/dist/gateway/static/root/assets/dist-J_ySZvz0.js +0 -1
  293. package/dist/gateway/static/root/assets/extension-settings-page-BgSV0Nny.js +0 -1
  294. package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +0 -1
  295. package/dist/gateway/static/root/assets/gateway-config-swr-BWGjnmDl.js +0 -1
  296. package/dist/gateway/static/root/assets/heartbeat-settings-Pxqk5GFH.js +0 -1
  297. package/dist/gateway/static/root/assets/home-page-1xjo6wE4.js +0 -1
  298. package/dist/gateway/static/root/assets/html-workspace-editor-bXK5tq64.js +0 -1
  299. package/dist/gateway/static/root/assets/index-Bbd_dXui.js +0 -70
  300. package/dist/gateway/static/root/assets/index-D_hrEKXM.css +0 -2
  301. package/dist/gateway/static/root/assets/local-app-workbench-page-heQ4-PJ7.js +0 -2
  302. package/dist/gateway/static/root/assets/locale-store-CXhjfe4q.js +0 -1
  303. package/dist/gateway/static/root/assets/logs-page-BblnS6Jy.js +0 -2
  304. package/dist/gateway/static/root/assets/management-settings-B8hM56HS.js +0 -1
  305. package/dist/gateway/static/root/assets/markdown-editor-TWGaF7Xa.js +0 -2
  306. package/dist/gateway/static/root/assets/markdown-split-DRbZjxMK.js +0 -1
  307. package/dist/gateway/static/root/assets/markdown-view-CLzTdVLW.css +0 -1
  308. package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +0 -3
  309. package/dist/gateway/static/root/assets/notes-workbench-CAM09C8b.js +0 -4
  310. package/dist/gateway/static/root/assets/popover-select-CccGri5Y.js +0 -1
  311. package/dist/gateway/static/root/assets/project-detail-page-BIPIwgU2.js +0 -1
  312. package/dist/gateway/static/root/assets/projects-page-B_kzTn1K.js +0 -1
  313. package/dist/gateway/static/root/assets/remote-access-hub-CtD8DsD-.js +0 -1
  314. package/dist/gateway/static/root/assets/sessions-page-B8n9HI1y.js +0 -1
  315. package/dist/gateway/static/root/assets/settings-advanced-gate-xlhdRTME.js +0 -1
  316. package/dist/gateway/static/root/assets/settings-loading-skeleton-B5GU7iCG.js +0 -1
  317. package/dist/gateway/static/root/assets/settings-page-Dd-BRu12.js +0 -1
  318. package/dist/gateway/static/root/assets/setup-status-panel-CwEFAVWx.js +0 -1
  319. package/dist/gateway/static/root/assets/share-preview-page-DzXw9UQJ.js +0 -2
  320. package/dist/gateway/static/root/assets/shares-settings-Bk6UQOwS.js +0 -1
  321. package/dist/gateway/static/root/assets/skill-reload-api-DrmQZ3Au.js +0 -1
  322. package/dist/gateway/static/root/assets/task-detail-page-CW2sJbdc.js +0 -1
  323. package/dist/gateway/static/root/assets/theme-store-DOdCjyuw.js +0 -1
  324. package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +0 -1
  325. package/dist/gateway/static/root/assets/user-context-page-Bq9KB-Oj.js +0 -1
  326. package/dist/gateway/static/root/assets/voice-api-key-field-DtTIF6M8.js +0 -1
  327. package/dist/gateway/static/root/assets/workflows-page-CcbGEQol.js +0 -5
  328. package/dist/src/agent-manifest/index.d.ts +0 -5
  329. package/dist/src/agent-manifest/index.js +0 -10
  330. package/dist/src/agent-manifest/preset-chain.d.ts +0 -10
  331. package/dist/src/agent-manifest/preset-chain.js +0 -30
  332. package/dist/src/agent-manifest/prompt.d.ts +0 -2
  333. package/dist/src/agent-manifest/prompt.js +0 -49
  334. package/dist/src/agent-manifest/resolver.d.ts +0 -32
  335. package/dist/src/agent-manifest/resolver.js +0 -114
  336. package/dist/src/agent-manifest/schema.d.ts +0 -695
  337. package/dist/src/agent-manifest/schema.js +0 -226
  338. package/dist/src/agent-manifest/validator.d.ts +0 -25
  339. package/dist/src/agent-manifest/validator.js +0 -74
  340. package/dist/src/agent-runtime/boundary-guard.d.ts +0 -12
  341. package/dist/src/agent-runtime/boundary-guard.js +0 -21
  342. package/dist/src/agent-runtime/index.d.ts +0 -7
  343. package/dist/src/agent-runtime/index.js +0 -8
  344. package/dist/src/agent-runtime/model-router.d.ts +0 -11
  345. package/dist/src/agent-runtime/model-router.js +0 -14
  346. package/dist/src/agent-runtime/run-trace.d.ts +0 -27
  347. package/dist/src/agent-runtime/run-trace.js +0 -51
  348. package/dist/src/agent-runtime/runtime-profile.d.ts +0 -26
  349. package/dist/src/agent-runtime/runtime-profile.js +0 -42
  350. package/dist/src/agent-runtime/tool-registry.d.ts +0 -28
  351. package/dist/src/agent-runtime/tool-registry.js +0 -50
  352. package/dist/src/agent-runtime/workflow-runtime.d.ts +0 -31
  353. package/dist/src/agent-runtime/workflow-runtime.js +0 -32
  354. package/dist/src/config/agent-typed-models.d.ts +0 -13
  355. package/dist/src/config/agent-typed-models.js +0 -48
  356. package/dist/src/gateway/capability-presets-admin.d.ts +0 -88
  357. package/dist/src/gateway/capability-presets-admin.js +0 -303
  358. package/dist/src/gateway/file-path-classifier.d.ts +0 -30
  359. package/dist/src/gateway/file-path-classifier.js +0 -105
  360. package/dist/src/gateway/file-reference-errors.d.ts +0 -6
  361. package/dist/src/gateway/file-reference-errors.js +0 -21
  362. package/dist/src/gateway/file-reference-registry.d.ts +0 -34
  363. package/dist/src/gateway/file-reference-registry.js +0 -45
  364. package/dist/src/gateway/hono/lib/agent-model.d.ts +0 -35
  365. package/dist/src/gateway/hono/lib/agent-model.js +0 -97
  366. package/dist/src/gateway/hono/routes/capability-presets.d.ts +0 -3
  367. package/dist/src/gateway/hono/routes/capability-presets.js +0 -187
  368. package/dist/src/gateway/hono/routes/mobile.d.ts +0 -3
  369. package/dist/src/gateway/security/operator-scopes.d.ts +0 -37
  370. package/dist/src/gateway/security/operator-scopes.js +0 -147
  371. package/dist/src/migrations/config/default-capability-preset.d.ts +0 -10
  372. package/dist/src/migrations/config/default-capability-preset.js +0 -133
  373. package/dist/src/tunnel/enable-lan-pairing.d.ts +0 -8
  374. package/dist/src/tunnel/enable-lan-pairing.js +0 -41
  375. package/dist/src/tunnel/pair-context.d.ts +0 -36
  376. package/dist/src/tunnel/pair-context.js +0 -77
  377. package/dist/src/tunnel/pair-url.d.ts +0 -43
  378. package/dist/src/tunnel/pair-url.js +0 -117
  379. package/dist/src/tunnel/pairing-rate-limit.d.ts +0 -12
  380. package/dist/src/tunnel/pairing-rate-limit.js +0 -28
  381. package/dist/src/tunnel/pairing.d.ts +0 -21
  382. package/dist/src/tunnel/pairing.js +0 -103
  383. package/dist/src/tunnel/tunnel-qr.d.ts +0 -9
  384. package/dist/src/tunnel/tunnel-qr.js +0 -29
@@ -1,3 +1,5 @@
1
+ import { loadCompactionSourceSnapshot } from "../../../storage/sqlite/transcript-repository.js";
2
+ import "../../../storage/sqlite/index.js";
1
3
  import { resolveGatewayEffectiveHost } from "../../../config/gateway-bind.js";
2
4
  import { SHARE_CONFIG_DEFAULTS } from "../../../share/share-types.js";
3
5
  import { resolveSiteShareConfig } from "../../../share/site-share-config.js";
@@ -10,7 +12,9 @@ import { audienceDefaults, cleanupStagedSite, decideShareKind, forgetStagedSite,
10
12
  import { deleteThumbnail, placeholderSvg, readThumbnail, scheduleThumbnail, thumbnailContentType, thumbnailExists } from "../../../share/share-thumbnail.js";
11
13
  import { extractToken } from "../../auth.js";
12
14
  import { getClientIpFromHeaders } from "../../security/loopback.js";
13
- import { renderFolderLandingPage, renderNoteShareLandingPage, renderShareExpiredPage, renderShareLandingPage } from "../../../share/share-landing.js";
15
+ import { renderFolderLandingPage, renderShareExpiredPage, renderShareLandingPage, renderSnapshotShareLandingPage } from "../../../share/share-landing.js";
16
+ import { SessionShareService, SessionShareSnapshotConflictError } from "../../../share/session-share-service.js";
17
+ import { HostedSessionShareBuilder, HostedSessionSharePublisher, HostedShareAuthorizationError, HostedShareBindingStore } from "../../../share/hosted-session-share.js";
14
18
  import { NoteShareService } from "../../../share/note-share-service.js";
15
19
  import { consumeSharePublicLimit } from "../../../share/share-rate-limit.js";
16
20
  import { createZipStream, planDirectoryFiles } from "../../../share/share-zip.js";
@@ -95,6 +99,7 @@ function rfc5987ContentDisposition(disposition, fileName) {
95
99
  function registerSharePublicRoutes(app, service) {
96
100
  const store = getShareStore(resolveShareConfig(service));
97
101
  const noteShares = new NoteShareService(store, service.notesServiceInstance);
102
+ const sessionShares = createSessionShareService(service, store);
98
103
  /** Landing page — does NOT consume downloadCount. */
99
104
  app.get("/s/:token", async (c) => {
100
105
  const clientIp = getClientIpFromHeaders({ get: (n) => c.req.header(n) ?? void 0 });
@@ -117,12 +122,15 @@ function registerSharePublicRoutes(app, service) {
117
122
  return c.html(renderShareExpiredPage(validation.reason), 410);
118
123
  }
119
124
  if (record.kind === "directory") return renderDirectoryLanding(c, store, service, record, token);
120
- if (record.kind === "note") {
125
+ if (record.kind === "note" || record.kind === "session") {
121
126
  const previewUrl = `/#/share/${encodeURIComponent(token)}`;
122
127
  c.header("Content-Security-Policy", "default-src 'none'; script-src 'unsafe-inline'; base-uri 'none'; frame-ancestors 'none'");
123
128
  c.header("X-Frame-Options", "DENY");
124
129
  c.header("Referrer-Policy", "no-referrer");
125
- return c.html(renderNoteShareLandingPage(record, previewUrl, { og: buildLandingOg(service, record) }));
130
+ return c.html(renderSnapshotShareLandingPage(record, previewUrl, {
131
+ label: record.kind === "note" ? "Note" : "conversation",
132
+ og: buildLandingOg(service, record)
133
+ }));
126
134
  }
127
135
  if (c.req.query("dl") === "1") return handleFileDownload(c, store, record, clientIp);
128
136
  if (c.req.query("inline") === "1") {
@@ -169,7 +177,7 @@ function registerSharePublicRoutes(app, service) {
169
177
  if (record.kind !== "file") return c.html(renderShareExpiredPage("not_found"), 404);
170
178
  return handleFileDownload(c, store, record, clientIp);
171
179
  });
172
- /** Claim one Note view. POST prevents social unfurlers from consuming maxViews. */
180
+ /** Claim one state-owned snapshot view. POST prevents social unfurlers from consuming maxViews. */
173
181
  app.post("/s/:token/view", async (c) => {
174
182
  const clientIp = getClientIpFromHeaders({ get: (n) => c.req.header(n) ?? void 0 });
175
183
  const rateResult = consumeSharePublicLimit(clientIp);
@@ -182,7 +190,7 @@ function registerSharePublicRoutes(app, service) {
182
190
  }
183
191
  const token = c.req.param("token");
184
192
  const record = store.getByToken(token);
185
- if (!record || record.kind !== "note") return c.json({
193
+ if (!record || record.kind !== "note" && record.kind !== "session") return c.json({
186
194
  ok: false,
187
195
  error: { message: "not_found" }
188
196
  }, 404);
@@ -192,6 +200,39 @@ function registerSharePublicRoutes(app, service) {
192
200
  error: { message: validation.reason }
193
201
  }, 410);
194
202
  try {
203
+ if (record.kind === "session") {
204
+ const manifest = await sessionShares.readManifest(record);
205
+ const consumed = store.consumeAccess(record.id);
206
+ if (consumed.valid === false) return c.json({
207
+ ok: false,
208
+ error: { message: consumed.reason }
209
+ }, 410);
210
+ logShareAudit("share.access", {
211
+ shareId: record.id,
212
+ sourceSessionId: record.sourceSessionId,
213
+ tokenPrefix: token.slice(0, 8),
214
+ clientIp,
215
+ snapshotRevision: record.snapshotRevision
216
+ }, `Session share viewed: ${record.fileName}`);
217
+ const ticket = manifest.attachments.length ? sessionShares.issueAssetTicket(record) : null;
218
+ return c.json({
219
+ ok: true,
220
+ payload: {
221
+ kind: "session",
222
+ title: manifest.title,
223
+ snapshotAt: manifest.snapshotAt,
224
+ expiresAt: record.expiresAt,
225
+ description: record.description ?? null,
226
+ snapshotRevision: record.snapshotRevision,
227
+ messages: manifest.messages,
228
+ toolActivities: manifest.toolActivities,
229
+ attachments: manifest.attachments.map(({ artifactFileName: _artifactFileName, checksum: _checksum, ...attachment }) => ({
230
+ ...attachment,
231
+ url: `/s/${encodeURIComponent(token)}/assets/${encodeURIComponent(attachment.id)}?ticket=${encodeURIComponent(ticket ?? "")}`
232
+ }))
233
+ }
234
+ });
235
+ }
195
236
  const manifest = await noteShares.readManifest(record);
196
237
  const consumed = store.consumeAccess(record.id);
197
238
  if (consumed.valid === false) return c.json({
@@ -220,21 +261,21 @@ function registerSharePublicRoutes(app, service) {
220
261
  attachments: manifest.attachments.map(({ artifactFileName: _artifactFileName, checksum: _checksum, ...attachment }) => attachment)
221
262
  }
222
263
  });
223
- } catch (err) {
264
+ } catch {
224
265
  logShareAudit("share.access_denied", {
225
266
  shareId: record.id,
226
- noteId: record.sourceNoteId,
267
+ ...record.kind === "note" ? { noteId: record.sourceNoteId } : { sourceSessionId: record.sourceSessionId },
227
268
  tokenPrefix: token.slice(0, 8),
228
269
  clientIp,
229
270
  reason: "artifact_missing"
230
- }, "Note share artifact could not be read");
271
+ }, "Share artifact could not be read");
231
272
  return c.json({
232
273
  ok: false,
233
- error: { message: err instanceof Error ? err.message : "artifact_missing" }
274
+ error: { message: "artifact_missing" }
234
275
  }, 410);
235
276
  }
236
277
  });
237
- /** Serve one snapshotted Note attachment through a short-lived view ticket. */
278
+ /** Serve one snapshotted attachment through a short-lived view ticket. */
238
279
  app.get("/s/:token/assets/:attachmentId", async (c) => {
239
280
  const rateResult = consumeSharePublicLimit(getClientIpFromHeaders({ get: (n) => c.req.header(n) ?? void 0 }));
240
281
  if (!rateResult.allowed) {
@@ -242,15 +283,15 @@ function registerSharePublicRoutes(app, service) {
242
283
  return c.text("Too many requests", 429);
243
284
  }
244
285
  const record = store.getByToken(c.req.param("token"));
245
- if (!record || record.kind !== "note") return c.text("Not found", 404);
286
+ if (!record || record.kind !== "note" && record.kind !== "session") return c.text("Not found", 404);
246
287
  if (record.revoked || Date.now() >= new Date(record.expiresAt).getTime()) return c.text("Gone", 410);
247
288
  const ticket = c.req.query("ticket") ?? "";
248
- if (!noteShares.verifyAssetTicket(record, ticket)) return c.text("Forbidden", 403);
249
- const resolved = await noteShares.resolveAsset(record, c.req.param("attachmentId")).catch(() => null);
289
+ if (!(record.kind === "note" ? noteShares.verifyAssetTicket(record, ticket) : sessionShares.verifyAssetTicket(record, ticket))) return c.text("Forbidden", 403);
290
+ const resolved = record.kind === "note" ? await noteShares.resolveAsset(record, c.req.param("attachmentId")).catch(() => null) : await sessionShares.resolveAsset(record, c.req.param("attachmentId")).catch(() => null);
250
291
  if (!resolved) return c.text("Not found", 404);
251
292
  const fileStat = await stat(resolved.path).catch(() => null);
252
293
  if (!fileStat?.isFile()) return c.text("Not found", 404);
253
- const inline = resolved.attachment.type !== "file";
294
+ const inline = record.kind === "session" ? isSafeInlineSessionMime(resolved.attachment.mimeType) : "type" in resolved.attachment && resolved.attachment.type !== "file";
254
295
  const stream = createReadStream(resolved.path);
255
296
  return new Response(Readable.toWeb(stream), {
256
297
  status: 200,
@@ -261,7 +302,8 @@ function registerSharePublicRoutes(app, service) {
261
302
  "Cache-Control": "private, no-store",
262
303
  "X-Content-Type-Options": "nosniff",
263
304
  "X-Frame-Options": "DENY",
264
- "Referrer-Policy": "no-referrer"
305
+ "Referrer-Policy": "no-referrer",
306
+ ...record.kind === "session" ? { "Content-Security-Policy": "sandbox; default-src 'none'" } : {}
265
307
  }
266
308
  });
267
309
  });
@@ -361,6 +403,12 @@ function registerSharePublicRoutes(app, service) {
361
403
  sourceVersion: record.sourceVersion,
362
404
  snapshotRevision: record.snapshotRevision,
363
405
  attachmentCount: record.attachmentCount
406
+ } : record.kind === "session" ? {
407
+ cutoffSeq: record.cutoffSeq,
408
+ snapshotRevision: record.snapshotRevision,
409
+ messageCount: record.messageCount,
410
+ attachmentCount: record.attachmentCount,
411
+ includeToolActivities: record.includeToolActivities
364
412
  } : {}
365
413
  });
366
414
  });
@@ -392,7 +440,7 @@ function registerSharePublicRoutes(app, service) {
392
440
  "X-Content-Type-Options": "nosniff"
393
441
  }
394
442
  });
395
- if (record.kind === "note") {
443
+ if (record.kind === "note" || record.kind === "session") {
396
444
  const placeholder = placeholderSvg(record.fileName, "text");
397
445
  return new Response(placeholder, {
398
446
  status: 200,
@@ -474,10 +522,285 @@ function registerShareRoutes(authenticated, deps) {
474
522
  const { service } = deps;
475
523
  const store = getShareStore(resolveShareConfig(service));
476
524
  const noteShares = new NoteShareService(store, service.notesServiceInstance);
525
+ const sessionShares = createSessionShareService(service, store);
526
+ const hostedBuilder = new HostedSessionShareBuilder(createSessionShareSource(service));
527
+ const hostedPublisher = new HostedSessionSharePublisher();
528
+ const hostedBindings = new HostedShareBindingStore();
477
529
  getSiteShareStore(resolveSiteShareConfig(service)).setCleanupHook((rec) => {
478
530
  const dir = forgetStagedSite(rec.id);
479
531
  if (dir) cleanupStagedSite(dir);
480
532
  });
533
+ authenticated.get("/api/sessions/:key/share-preview", async (c) => {
534
+ try {
535
+ const preview = await sessionShares.preview(c.req.param("key"));
536
+ return c.json({
537
+ ok: true,
538
+ payload: preview
539
+ });
540
+ } catch (err) {
541
+ const message = err instanceof Error ? err.message : String(err);
542
+ return c.json({
543
+ ok: false,
544
+ error: { message }
545
+ }, message === "Session not found" ? 404 : 400);
546
+ }
547
+ });
548
+ authenticated.get("/api/sessions/:key/shares", async (c) => {
549
+ const metadata = await service.sessionIndexInstance.getSessionMetadata(c.req.param("key"));
550
+ if (!metadata?.sessionId) return c.json({
551
+ ok: false,
552
+ error: { message: "Session not found" }
553
+ }, 404);
554
+ const urlCtx = getShareUrlContext(service);
555
+ const now = Date.now();
556
+ const items = sessionShares.list(metadata.sessionId).map((record) => {
557
+ const resolved = resolveShareUrl(record.token, urlCtx);
558
+ return {
559
+ id: record.id,
560
+ kind: record.kind,
561
+ delivery: "local",
562
+ fileName: record.fileName,
563
+ shareUrl: resolved.shareUrl,
564
+ lanUrl: resolved.lanUrl,
565
+ reachability: resolved.reachability,
566
+ reachabilityHint: resolved.reachabilityHint,
567
+ createdAt: record.createdAt,
568
+ expiresAt: record.expiresAt,
569
+ viewCount: record.downloadCount,
570
+ maxViews: record.maxViews,
571
+ revoked: record.revoked,
572
+ expired: now >= new Date(record.expiresAt).getTime(),
573
+ description: record.description ?? null,
574
+ cutoffSeq: record.cutoffSeq,
575
+ snapshotRevision: record.snapshotRevision,
576
+ messageCount: record.messageCount,
577
+ attachmentCount: record.attachmentCount,
578
+ includeToolActivities: record.includeToolActivities
579
+ };
580
+ });
581
+ return c.json({
582
+ ok: true,
583
+ payload: { shares: items }
584
+ });
585
+ });
586
+ authenticated.post("/api/sessions/:key/shares", async (c) => {
587
+ const gatewayToken = extractToken({ authorization: c.req.header("authorization") ?? void 0 });
588
+ if (!gatewayToken) return c.json({
589
+ ok: false,
590
+ error: { message: "Token required" }
591
+ }, 401);
592
+ const body = await c.req.json().catch(() => ({}));
593
+ if (typeof body.expectedSessionId !== "string" || typeof body.expectedCutoffSeq !== "number" || typeof body.expectedMetadataUpdatedAt !== "string") return c.json({
594
+ ok: false,
595
+ error: { message: "Share preview fingerprint is required" }
596
+ }, 400);
597
+ try {
598
+ const record = await sessionShares.create(c.req.param("key"), {
599
+ expectedSessionId: body.expectedSessionId,
600
+ expectedCutoffSeq: body.expectedCutoffSeq,
601
+ expectedMetadataUpdatedAt: body.expectedMetadataUpdatedAt,
602
+ ttlMs: typeof body.ttlMs === "number" ? body.ttlMs : void 0,
603
+ maxViews: body.maxViews === null ? null : typeof body.maxViews === "number" ? body.maxViews : void 0,
604
+ description: typeof body.description === "string" ? body.description.trim() || void 0 : void 0,
605
+ includeToolActivities: body.includeToolActivities === true,
606
+ attachmentIds: Array.isArray(body.attachmentIds) ? body.attachmentIds.filter((id) => typeof id === "string") : void 0,
607
+ gatewayTokenHash: hashGatewayToken(gatewayToken)
608
+ });
609
+ const resolved = resolveShareUrl(record.token, getShareUrlContext(service));
610
+ return c.json({
611
+ ok: true,
612
+ payload: {
613
+ id: record.id,
614
+ kind: record.kind,
615
+ delivery: "local",
616
+ shareUrl: resolved.shareUrl,
617
+ lanUrl: resolved.lanUrl,
618
+ reachability: resolved.reachability,
619
+ reachabilityHint: resolved.reachabilityHint,
620
+ expiresAt: record.expiresAt,
621
+ maxViews: record.maxViews,
622
+ fileName: record.fileName,
623
+ messageCount: record.messageCount,
624
+ attachmentCount: record.attachmentCount,
625
+ snapshotRevision: record.snapshotRevision,
626
+ includeToolActivities: record.includeToolActivities
627
+ }
628
+ }, 201);
629
+ } catch (err) {
630
+ const message = err instanceof Error ? err.message : String(err);
631
+ const status = err instanceof SessionShareSnapshotConflictError ? 409 : message === "Session not found" ? 404 : 400;
632
+ return c.json({
633
+ ok: false,
634
+ error: {
635
+ message,
636
+ code: status === 409 ? "session_snapshot_conflict" : void 0
637
+ }
638
+ }, status);
639
+ }
640
+ });
641
+ authenticated.post("/api/sessions/:key/shares/:shareId/refresh", async (c) => {
642
+ const body = await c.req.json().catch(() => ({}));
643
+ if (typeof body.expectedSessionId !== "string" || typeof body.expectedCutoffSeq !== "number" || typeof body.expectedMetadataUpdatedAt !== "string") return c.json({
644
+ ok: false,
645
+ error: { message: "Share preview fingerprint is required" }
646
+ }, 400);
647
+ try {
648
+ const record = await sessionShares.refresh(c.req.param("key"), c.req.param("shareId"), {
649
+ expectedSessionId: body.expectedSessionId,
650
+ expectedCutoffSeq: body.expectedCutoffSeq,
651
+ expectedMetadataUpdatedAt: body.expectedMetadataUpdatedAt,
652
+ includeToolActivities: typeof body.includeToolActivities === "boolean" ? body.includeToolActivities : void 0,
653
+ attachmentIds: Array.isArray(body.attachmentIds) ? body.attachmentIds.filter((id) => typeof id === "string") : void 0
654
+ });
655
+ const resolved = resolveShareUrl(record.token, getShareUrlContext(service));
656
+ return c.json({
657
+ ok: true,
658
+ payload: {
659
+ id: record.id,
660
+ kind: record.kind,
661
+ delivery: "local",
662
+ shareUrl: resolved.shareUrl,
663
+ lanUrl: resolved.lanUrl,
664
+ reachability: resolved.reachability,
665
+ reachabilityHint: resolved.reachabilityHint,
666
+ expiresAt: record.expiresAt,
667
+ maxViews: record.maxViews,
668
+ fileName: record.fileName,
669
+ messageCount: record.messageCount,
670
+ attachmentCount: record.attachmentCount,
671
+ snapshotRevision: record.snapshotRevision,
672
+ includeToolActivities: record.includeToolActivities
673
+ }
674
+ });
675
+ } catch (err) {
676
+ const message = err instanceof Error ? err.message : String(err);
677
+ const status = err instanceof SessionShareSnapshotConflictError ? 409 : message === "Session share not found" || message === "Session not found" ? 404 : 400;
678
+ return c.json({
679
+ ok: false,
680
+ error: {
681
+ message,
682
+ code: status === 409 ? "session_snapshot_conflict" : void 0
683
+ }
684
+ }, status);
685
+ }
686
+ });
687
+ authenticated.get("/api/sessions/:key/hosted-shares", async (c) => {
688
+ const metadata = await service.sessionIndexInstance.getSessionMetadata(c.req.param("key"));
689
+ if (!metadata?.sessionId) return c.json({
690
+ ok: false,
691
+ error: { message: "Session not found" }
692
+ }, 404);
693
+ try {
694
+ await hostedBindings.reconcile(await hostedPublisher.list());
695
+ return c.json({
696
+ ok: true,
697
+ payload: { shares: (await hostedBindings.list(metadata.sessionId)).map(hostedBindingResponse) }
698
+ });
699
+ } catch (err) {
700
+ return hostedShareErrorResponse(c, err);
701
+ }
702
+ });
703
+ authenticated.post("/api/sessions/:key/hosted-shares", async (c) => {
704
+ const body = await c.req.json().catch(() => ({}));
705
+ if (typeof body.expectedSessionId !== "string" || typeof body.expectedCutoffSeq !== "number" || typeof body.expectedMetadataUpdatedAt !== "string") return c.json({
706
+ ok: false,
707
+ error: { message: "Share preview fingerprint is required" }
708
+ }, 400);
709
+ try {
710
+ const snapshot = await hostedBuilder.build(c.req.param("key"), hostedBuildInput(body));
711
+ const result = await hostedPublisher.create(snapshot, {
712
+ ttlMs: typeof body.ttlMs === "number" ? body.ttlMs : 864e5,
713
+ maxViews: body.maxViews === null ? null : typeof body.maxViews === "number" ? body.maxViews : null
714
+ });
715
+ const now = (/* @__PURE__ */ new Date()).toISOString();
716
+ const binding = {
717
+ ...result,
718
+ sessionId: snapshot.sessionId,
719
+ cutoffSeq: snapshot.cutoffSeq,
720
+ title: snapshot.manifest.title,
721
+ description: snapshot.manifest.description ?? null,
722
+ messageCount: snapshot.manifest.messages.length,
723
+ attachmentCount: snapshot.manifest.attachments.length,
724
+ includeToolActivities: body.includeToolActivities === true,
725
+ attachmentIds: snapshot.manifest.attachments.map((attachment) => attachment.id),
726
+ createdAt: now,
727
+ updatedAt: now,
728
+ revoked: false
729
+ };
730
+ await hostedBindings.upsert(binding);
731
+ return c.json({
732
+ ok: true,
733
+ payload: hostedBindingResponse(binding)
734
+ }, 201);
735
+ } catch (err) {
736
+ return hostedShareErrorResponse(c, err);
737
+ }
738
+ });
739
+ authenticated.post("/api/sessions/:key/hosted-shares/:shareId/refresh", async (c) => {
740
+ const body = await c.req.json().catch(() => ({}));
741
+ if (typeof body.expectedSessionId !== "string" || typeof body.expectedCutoffSeq !== "number" || typeof body.expectedMetadataUpdatedAt !== "string") return c.json({
742
+ ok: false,
743
+ error: { message: "Share preview fingerprint is required" }
744
+ }, 400);
745
+ const previous = (await hostedBindings.list(body.expectedSessionId)).find((binding) => binding.id === c.req.param("shareId") && !binding.revoked);
746
+ if (!previous) return c.json({
747
+ ok: false,
748
+ error: { message: "Hosted share not found" }
749
+ }, 404);
750
+ try {
751
+ const snapshot = await hostedBuilder.build(c.req.param("key"), {
752
+ ...hostedBuildInput(body),
753
+ description: previous.description ?? void 0,
754
+ includeToolActivities: typeof body.includeToolActivities === "boolean" ? body.includeToolActivities : previous.includeToolActivities,
755
+ attachmentIds: Array.isArray(body.attachmentIds) ? body.attachmentIds.filter((id) => typeof id === "string") : previous.attachmentIds
756
+ });
757
+ const result = await hostedPublisher.refresh(previous.id, previous.snapshotRevision, previous.shareUrl, snapshot);
758
+ const binding = {
759
+ ...previous,
760
+ ...result,
761
+ cutoffSeq: snapshot.cutoffSeq,
762
+ title: snapshot.manifest.title,
763
+ messageCount: snapshot.manifest.messages.length,
764
+ attachmentCount: snapshot.manifest.attachments.length,
765
+ includeToolActivities: typeof body.includeToolActivities === "boolean" ? body.includeToolActivities : previous.includeToolActivities,
766
+ attachmentIds: snapshot.manifest.attachments.map((attachment) => attachment.id),
767
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
768
+ };
769
+ await hostedBindings.upsert(binding);
770
+ return c.json({
771
+ ok: true,
772
+ payload: hostedBindingResponse(binding)
773
+ });
774
+ } catch (err) {
775
+ return hostedShareErrorResponse(c, err);
776
+ }
777
+ });
778
+ authenticated.delete("/api/sessions/:key/hosted-shares/:shareId", async (c) => {
779
+ const metadata = await service.sessionIndexInstance.getSessionMetadata(c.req.param("key"));
780
+ if (!metadata?.sessionId) return c.json({
781
+ ok: false,
782
+ error: { message: "Session not found" }
783
+ }, 404);
784
+ const binding = (await hostedBindings.list(metadata.sessionId)).find((item) => item.id === c.req.param("shareId"));
785
+ if (!binding) return c.json({
786
+ ok: false,
787
+ error: { message: "Hosted share not found" }
788
+ }, 404);
789
+ try {
790
+ await hostedPublisher.revoke(binding.id);
791
+ await hostedBindings.upsert({
792
+ ...binding,
793
+ revoked: true,
794
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
795
+ });
796
+ return c.json({
797
+ ok: true,
798
+ payload: { revoked: binding.id }
799
+ });
800
+ } catch (err) {
801
+ return hostedShareErrorResponse(c, err);
802
+ }
803
+ });
481
804
  authenticated.post("/api/shares", async (c) => {
482
805
  const gatewayToken = extractToken({ authorization: c.req.header("authorization") ?? void 0 });
483
806
  if (!gatewayToken) return c.json({
@@ -756,6 +1079,13 @@ function registerShareRoutes(authenticated, deps) {
756
1079
  sourceVersion: r.sourceVersion,
757
1080
  snapshotRevision: r.snapshotRevision,
758
1081
  attachmentCount: r.attachmentCount
1082
+ } : r.kind === "session" ? {
1083
+ sourceSessionId: r.sourceSessionId,
1084
+ cutoffSeq: r.cutoffSeq,
1085
+ snapshotRevision: r.snapshotRevision,
1086
+ messageCount: r.messageCount,
1087
+ attachmentCount: r.attachmentCount,
1088
+ includeToolActivities: r.includeToolActivities
759
1089
  } : {}
760
1090
  };
761
1091
  });
@@ -795,6 +1125,7 @@ function registerShareRoutes(authenticated, deps) {
795
1125
  error: { message: "Not found" }
796
1126
  }, 404);
797
1127
  if (record?.kind === "note") await noteShares.removeArtifact(record.id);
1128
+ if (record?.kind === "session") await sessionShares.removeArtifact(record.id);
798
1129
  return c.json({ ok: true });
799
1130
  });
800
1131
  authenticated.delete("/api/shares", async (c) => {
@@ -803,9 +1134,9 @@ function registerShareRoutes(authenticated, deps) {
803
1134
  body = await c.req.json();
804
1135
  } catch {}
805
1136
  if (body.expired === true) {
806
- const expiredNoteShares = store.getAllShares().filter((record) => record.kind === "note" && !record.revoked && Date.now() >= new Date(record.expiresAt).getTime());
1137
+ const expiredStateShares = store.getAllShares().filter((record) => (record.kind === "note" || record.kind === "session") && !record.revoked && Date.now() >= new Date(record.expiresAt).getTime());
807
1138
  const count = store.revokeExpired();
808
- await Promise.all(expiredNoteShares.map((record) => noteShares.removeArtifact(record.id)));
1139
+ await Promise.all(expiredStateShares.map((record) => record.kind === "note" ? noteShares.removeArtifact(record.id) : sessionShares.removeArtifact(record.id)));
809
1140
  return c.json({
810
1141
  ok: true,
811
1142
  payload: { revokedCount: count }
@@ -816,9 +1147,9 @@ function registerShareRoutes(authenticated, deps) {
816
1147
  ok: false,
817
1148
  error: { message: "Provide ids array or expired: true" }
818
1149
  }, 400);
819
- const noteRecords = ids.map((id) => store.getById(id)).filter((record) => record?.kind === "note");
1150
+ const stateRecords = ids.map((id) => store.getById(id)).filter((record) => record?.kind === "note" || record?.kind === "session");
820
1151
  const count = store.revokeMany(ids);
821
- await Promise.all(noteRecords.map((record) => noteShares.removeArtifact(record.id)));
1152
+ await Promise.all(stateRecords.map((record) => record.kind === "note" ? noteShares.removeArtifact(record.id) : sessionShares.removeArtifact(record.id)));
822
1153
  return c.json({
823
1154
  ok: true,
824
1155
  payload: { revokedCount: count }
@@ -856,6 +1187,60 @@ function registerShareRoutes(authenticated, deps) {
856
1187
  });
857
1188
  });
858
1189
  }
1190
+ function createSessionShareService(service, store) {
1191
+ return new SessionShareService(store, createSessionShareSource(service));
1192
+ }
1193
+ function createSessionShareSource(service) {
1194
+ return {
1195
+ getMetadata: (sessionKey) => service.sessionIndexInstance.getSessionMetadata(sessionKey),
1196
+ getSnapshot: async (sessionKey) => loadCompactionSourceSnapshot(sessionKey)
1197
+ };
1198
+ }
1199
+ function hostedBuildInput(body) {
1200
+ return {
1201
+ expectedSessionId: String(body.expectedSessionId),
1202
+ expectedCutoffSeq: Number(body.expectedCutoffSeq),
1203
+ expectedMetadataUpdatedAt: String(body.expectedMetadataUpdatedAt),
1204
+ description: typeof body.description === "string" ? body.description.trim() || void 0 : void 0,
1205
+ includeToolActivities: body.includeToolActivities === true,
1206
+ attachmentIds: Array.isArray(body.attachmentIds) ? body.attachmentIds.filter((id) => typeof id === "string") : void 0
1207
+ };
1208
+ }
1209
+ function hostedBindingResponse(binding) {
1210
+ return {
1211
+ id: binding.id,
1212
+ kind: "session",
1213
+ delivery: "hosted",
1214
+ shareUrl: binding.shareUrl,
1215
+ lanUrl: null,
1216
+ reachability: "public",
1217
+ reachabilityHint: null,
1218
+ expiresAt: binding.expiresAt,
1219
+ maxViews: binding.maxViews,
1220
+ fileName: binding.title,
1221
+ messageCount: binding.messageCount,
1222
+ attachmentCount: binding.attachmentCount,
1223
+ snapshotRevision: binding.snapshotRevision,
1224
+ includeToolActivities: binding.includeToolActivities,
1225
+ createdAt: binding.createdAt,
1226
+ viewCount: binding.viewCount,
1227
+ revoked: binding.revoked,
1228
+ expired: Date.now() >= new Date(binding.expiresAt).getTime(),
1229
+ description: binding.description,
1230
+ cutoffSeq: binding.cutoffSeq
1231
+ };
1232
+ }
1233
+ function hostedShareErrorResponse(c, err) {
1234
+ const message = err instanceof Error ? err.message : String(err);
1235
+ const status = err instanceof HostedShareAuthorizationError ? 401 : err instanceof SessionShareSnapshotConflictError ? 409 : message === "Session not found" || message === "Hosted share not found" ? 404 : 400;
1236
+ return c.json({
1237
+ ok: false,
1238
+ error: {
1239
+ message,
1240
+ code: err instanceof HostedShareAuthorizationError ? "hosted_share_auth_required" : status === 409 ? "session_snapshot_conflict" : void 0
1241
+ }
1242
+ }, status);
1243
+ }
859
1244
  async function renderDirectoryLanding(c, store, service, record, token, subPath = "") {
860
1245
  store.updateConfig(resolveShareConfig(service));
861
1246
  const urls = {
@@ -885,9 +1270,13 @@ function buildLandingOg(service, record) {
885
1270
  absoluteShareUrl: resolved.shareUrl,
886
1271
  absoluteThumbnailUrl: `${resolved.shareUrl}/thumbnail`,
887
1272
  title: record.fileName,
888
- description: record.description ?? void 0
1273
+ description: record.description ?? (record.kind === "session" ? `${record.messageCount} messages shared via xopc` : void 0)
889
1274
  };
890
1275
  }
1276
+ function isSafeInlineSessionMime(mimeType) {
1277
+ const normalized = mimeType.split(";")[0]?.trim().toLowerCase();
1278
+ return normalized === "image/png" || normalized === "image/jpeg" || normalized === "image/gif" || normalized === "image/webp" || normalized?.startsWith("audio/") === true || normalized?.startsWith("video/") === true;
1279
+ }
891
1280
  async function handleDirectoryFile(c, store, service, record, relPath, clientIp, inline) {
892
1281
  if (!acquireDownloadSlot(record.token)) return new Response("Too many concurrent downloads for this share", { status: 429 });
893
1282
  try {
@@ -1,5 +1,5 @@
1
1
  import { getDefaultModelSync, init_providers, resolveModel } from "../../../providers/index.js";
2
- import { getGatewayAgentEffectiveManifest } from "../../agents-admin.js";
2
+ import { getGatewayAgentEffectiveConfig } from "../../agents-admin.js";
3
3
  import { isSTTAvailable } from "../../../voice/stt/availability.js";
4
4
  import { mergeSttConfigFromAppConfig } from "../../../voice/stt/config.js";
5
5
  import "../../../voice/stt/index.js";
@@ -14,9 +14,6 @@ function stableValue(value) {
14
14
  function contentHash(value) {
15
15
  return createHash("sha256").update(JSON.stringify(stableValue(value))).digest("hex");
16
16
  }
17
- function asRecord(value) {
18
- return value && typeof value === "object" && !Array.isArray(value) ? value : {};
19
- }
20
17
  function buildEvalRuntimeIdentity(service, agentId) {
21
18
  const config = service.currentConfig;
22
19
  if (!config) return {
@@ -24,16 +21,13 @@ function buildEvalRuntimeIdentity(service, agentId) {
24
21
  error: "Gateway configuration is unavailable",
25
22
  status: 503
26
23
  };
27
- const effective = getGatewayAgentEffectiveManifest(config, agentId);
24
+ const effective = getGatewayAgentEffectiveConfig(config, agentId);
28
25
  if ("error" in effective) return {
29
26
  ok: false,
30
27
  error: effective.error,
31
28
  status: effective.status ?? 400
32
29
  };
33
- const manifest = asRecord(effective.data.manifest);
34
- const models = asRecord(manifest.models);
35
- const tools = asRecord(manifest.tools);
36
- const skills = manifest.skills ?? [];
30
+ const agentConfig = effective.data.config;
37
31
  return {
38
32
  ok: true,
39
33
  payload: {
@@ -41,13 +35,12 @@ function buildEvalRuntimeIdentity(service, agentId) {
41
35
  version: service.getHealth().version,
42
36
  buildCommit: process.env.XOPC_BUILD_COMMIT?.trim() || process.env.GITHUB_SHA?.trim() || null,
43
37
  agentId,
44
- modelRef: models.primary ?? null,
45
- thinkingLevel: manifest.thinkingDefault ?? null,
46
- manifestHash: contentHash(effective.data.manifest),
47
- systemPromptConfigHash: contentHash(manifest.systemPrompt ?? null),
48
- toolPolicyHash: contentHash(tools),
49
- skillPolicyHash: contentHash(skills),
50
- presetChain: effective.data.sources
38
+ modelRef: agentConfig.models.chat.primary,
39
+ thinkingLevel: null,
40
+ configHash: contentHash(agentConfig),
41
+ toolPolicyHash: contentHash(agentConfig.tools),
42
+ skillPolicyHash: contentHash(agentConfig.skills),
43
+ sources: effective.data.sources
51
44
  }
52
45
  };
53
46
  }
@@ -1,5 +1,3 @@
1
1
  import type { Hono } from 'hono';
2
2
  import type { AuthenticatedRouteDeps } from './deps.js';
3
- import type { GatewayService } from '../../service.js';
4
- export declare function registerTunnelPublicRoutes(app: Hono, service: GatewayService): void;
5
3
  export declare function registerTunnelRoutes(authenticated: Hono, deps: AuthenticatedRouteDeps): void;