@xopcai/xopc 0.0.251 → 0.0.253

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 (376) hide show
  1. package/README.md +8 -5
  2. package/README.zh-CN.md +8 -5
  3. package/dist/browser-ext/dist/background.js +358 -768
  4. package/dist/browser-ext/manifest.json +1 -2
  5. package/dist/extensions/telegram/src/inbound-processor.js +2 -2
  6. package/dist/extensions/telegram/src/plugin.js +3 -2
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/gateway/static/root/assets/{activity-store-DfBjTSo9.js → activity-store-CeS1bgXP.js} +1 -1
  9. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Bo_dmLv8.js → agent-avatar-dicebear-BdF3HhCW.js} +1 -1
  10. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Bs34Kp0K.js +1 -0
  11. package/dist/gateway/static/root/assets/{agents-yuUn8n-f.js → agents-DARlgjTm.js} +1 -1
  12. package/dist/gateway/static/root/assets/{api-zxpcJfgj.js → api-zMPeC0yU.js} +1 -1
  13. package/dist/gateway/static/root/assets/{app-management-settings-panel-Cz56nrVF.js → app-management-settings-panel-BaAFln8W.js} +1 -1
  14. package/dist/gateway/static/root/assets/{appearance-settings-DxSws5U4.js → appearance-settings-CXvsoBlw.js} +1 -1
  15. package/dist/gateway/static/root/assets/apps-page-BhgvfBJT.js +1 -0
  16. package/dist/gateway/static/root/assets/{archive-plugin-7k15-hqo.js → archive-plugin-C0o_mVQI.js} +1 -1
  17. package/dist/gateway/static/root/assets/{attachment-load-B-SFpjd9.js → attachment-load-B5Ry3tGL.js} +1 -1
  18. package/dist/gateway/static/root/assets/{automations-page-Qy36j19q.js → automations-page-DY5QAEQd.js} +1 -1
  19. package/dist/gateway/static/root/assets/automations-workspace-BzX4lILP.js +6 -0
  20. package/dist/gateway/static/root/assets/{binary-plugins-CPOZQt8F.js → binary-plugins-BydpEgBA.js} +1 -1
  21. package/dist/gateway/static/root/assets/{block-editor-DhvVlIp9.js → block-editor-D0CpUOMo.js} +3 -3
  22. package/dist/gateway/static/root/assets/browser-automation-inputs-DzbTsGI6.js +1 -0
  23. package/dist/gateway/static/root/assets/browser-automations-page-D7fZYjni.js +3 -0
  24. package/dist/gateway/static/root/assets/browser-settings-page-BBdMqxl0.js +3 -0
  25. package/dist/gateway/static/root/assets/capabilities-settings-panel-D_WfftDW.js +7 -0
  26. package/dist/gateway/static/root/assets/channels-settings-bdRLT9KA.js +1 -0
  27. package/dist/gateway/static/root/assets/{channels-status-swr-CX-yWwLD.js → channels-status-swr-BGGRTkn6.js} +1 -1
  28. package/dist/gateway/static/root/assets/{chat-terminal-dock-1PJoxRuV.js → chat-terminal-dock-_CP4nvlg.js} +2 -2
  29. package/dist/gateway/static/root/assets/connectors-page-CPDjU5wU.js +2 -0
  30. package/dist/gateway/static/root/assets/{cron-expression-CBCc6zFA.js → cron-expression-g2U8Rllf.js} +1 -1
  31. package/dist/gateway/static/root/assets/{date-picker-u8K5Kt_N.js → date-picker-SmVlhtj_.js} +1 -1
  32. package/dist/gateway/static/root/assets/{dependency-picker-y_i_cnpz.js → dependency-picker-D-0gcbbM.js} +1 -1
  33. package/dist/gateway/static/root/assets/{desktop-pet-DyL0JxLm.js → desktop-pet-Cl3JRIu6.js} +1 -1
  34. package/dist/gateway/static/root/assets/{desktop-pet-settings-d2d_IsyP.js → desktop-pet-settings-D7kvWQ9H.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-debug-page-DqIBKJwl.js → extension-debug-page-DtP2tJHY.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-page-DUW1xxj2.js → extension-page-CphZDdoT.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-settings-page-BHY9qaNw.js → extension-settings-page-CsxVLV4-.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-config-swr-CMNbl0FZ.js → gateway-config-swr-BW3Bx-aV.js} +1 -1
  39. package/dist/gateway/static/root/assets/gateway-settings-DxBZ05dX.js +1 -0
  40. package/dist/gateway/static/root/assets/{gateway-startup-retry-CR7Xg8As.js → gateway-startup-retry-DAq74TZe.js} +1 -1
  41. package/dist/gateway/static/root/assets/{heartbeat-settings-7CD9iPR7.js → heartbeat-settings-DWcKsIoZ.js} +1 -1
  42. package/dist/gateway/static/root/assets/home-page-BdvLZKQZ.js +1 -0
  43. package/dist/gateway/static/root/assets/{image-generation-api-C5mn73ca.js → image-generation-api-MPuaXDRs.js} +1 -1
  44. package/dist/gateway/static/root/assets/index-C7RDs6S-.js +74 -0
  45. package/dist/gateway/static/root/assets/index-Cu8xqZQ9.css +2 -0
  46. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BtlqMleF.js → keyboard-shortcuts-settings-CfhaTqgE.js} +1 -1
  47. package/dist/gateway/static/root/assets/{local-app-workbench-page-BjxfkjxE.js → local-app-workbench-page-CR6asX7L.js} +2 -2
  48. package/dist/gateway/static/root/assets/{local-apps-page-B7xqQe2s.js → local-apps-page-g01W3kEK.js} +1 -1
  49. package/dist/gateway/static/root/assets/{locale-store-CF4erhjB.js → locale-store-BkeaPZpn.js} +1 -1
  50. package/dist/gateway/static/root/assets/{logs-page-kACaPZKL.js → logs-page-ZP4QTWoC.js} +2 -2
  51. package/dist/gateway/static/root/assets/{management-settings-A432siER.js → management-settings-DeGxJF_Z.js} +1 -1
  52. package/dist/gateway/static/root/assets/markdown-view-Ca7BRBLL.js +201 -0
  53. package/dist/gateway/static/root/assets/{media-plugins-CpvYiauZ.js → media-plugins-FmOhmzlD.js} +1 -1
  54. package/dist/gateway/static/root/assets/messages-C72stReU.js +3 -0
  55. package/dist/gateway/static/root/assets/{mobile-pairing-wizard-DyjVGngO.js → mobile-pairing-wizard-BXNbn05L.js} +1 -1
  56. package/dist/gateway/static/root/assets/note-detail-panel-EeVeF4II.js +5 -0
  57. package/dist/gateway/static/root/assets/notes-page-D7bMff96.js +8 -0
  58. package/dist/gateway/static/root/assets/{page-tabs-B3FKzjR6.js → page-tabs-pyukZ1PJ.js} +1 -1
  59. package/dist/gateway/static/root/assets/{preview-open-alternatives-DnjrwAHD.js → preview-open-alternatives-slFHoMUe.js} +1 -1
  60. package/dist/gateway/static/root/assets/{product-open-page-COcr_NUJ.js → product-open-page-CXa3FNNk.js} +1 -1
  61. package/dist/gateway/static/root/assets/project-detail-page-BDF88VdN.js +1 -0
  62. package/dist/gateway/static/root/assets/projects-page-DeTD6pu1.js +1 -0
  63. package/dist/gateway/static/root/assets/{registry-api-BsRBlji7.js → registry-api-CviQoUBf.js} +1 -1
  64. package/dist/gateway/static/root/assets/remote-access-hub-CxKrdQ6a.js +1 -0
  65. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-LO4wZ_dO.js → runtime-tools-settings-panel-O9D9o7-O.js} +2 -2
  66. package/dist/gateway/static/root/assets/{schema-form-crcj4-Pm.js → schema-form-8FesicnL.js} +1 -1
  67. package/dist/gateway/static/root/assets/sessions-page-DUFJN-2t.js +1 -0
  68. package/dist/gateway/static/root/assets/settings-advanced-gate-CcSYDjaH.js +1 -0
  69. package/dist/gateway/static/root/assets/{settings-form-section-Bl4MvTmq.js → settings-form-section-CBic9TFH.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-page-DplrjZ6x.js → settings-page-Xz66_Mjg.js} +1 -1
  71. package/dist/gateway/static/root/assets/setup-status-panel-C6DuwrP5.js +1 -0
  72. package/dist/gateway/static/root/assets/{share-preview-page-CJP1kURj.js → share-preview-page--JpjwB58.js} +1 -1
  73. package/dist/gateway/static/root/assets/{shares-settings-CemgzEi4.js → shares-settings-CovcdHSC.js} +1 -1
  74. package/dist/gateway/static/root/assets/skill-reload-api-CrHagTsE.js +1 -0
  75. package/dist/gateway/static/root/assets/{skills-page-DsjcKg9Q.js → skills-page-fVKExKv5.js} +1 -1
  76. package/dist/gateway/static/root/assets/{skills-page.utils-D6gWBbvy.js → skills-page.utils-Yv9u3uJp.js} +1 -1
  77. package/dist/gateway/static/root/assets/{system-settings-panel-_eCXfqCo.js → system-settings-panel-CCWjVdc2.js} +1 -1
  78. package/dist/gateway/static/root/assets/{task-detail-page-D0Z_K5JT.js → task-detail-page-I8hueJnG.js} +1 -1
  79. package/dist/gateway/static/root/assets/{theme-store-BOgkc_9D.js → theme-store-BtkaVpMm.js} +1 -1
  80. package/dist/gateway/static/root/assets/{tunnel-api-W5mktxl1.js → tunnel-api-C__W9BaN.js} +1 -1
  81. package/dist/gateway/static/root/assets/{use-autosave-Na2DYzT3.js → use-autosave-Dow9RRcq.js} +1 -1
  82. package/dist/gateway/static/root/assets/user-model-page-CU6nxmoM.js +2 -0
  83. package/dist/gateway/static/root/assets/{voice-api-key-field-OXweUxS_.js → voice-api-key-field-CvF3lEyx.js} +1 -1
  84. package/dist/gateway/static/root/assets/{voice-config-api-C-ryeIxj.js → voice-config-api-BEUVAyM6.js} +1 -1
  85. package/dist/gateway/static/root/assets/{work-discovery-overlay-BqOsO47I.js → work-discovery-overlay-B9PDfReq.js} +1 -1
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-B9S_lfT1.js → workflow-run-setup-panel-kWGFkhjz.js} +2 -2
  87. package/dist/gateway/static/root/assets/workflows-page-B4Is5E42.js +5 -0
  88. package/dist/gateway/static/root/index.html +10 -10
  89. package/dist/package.js +1 -1
  90. package/dist/packages/gateway-contract/src/new-session.js +9 -0
  91. package/dist/packages/realtime-protocol/src/voice.js +6 -1
  92. package/dist/src/agent/agent-manager.d.ts +2 -1
  93. package/dist/src/agent/agent-manager.js +26 -8
  94. package/dist/src/agent/background-review/run-background-review.js +1 -1
  95. package/dist/src/agent/coding/repository-instructions.js +2 -2
  96. package/dist/src/agent/coding/workspace-revision.js +2 -2
  97. package/dist/src/agent/commands/command-isolation.js +2 -2
  98. package/dist/src/agent/embedded/execution-context.d.ts +2 -1
  99. package/dist/src/agent/embedded/execution-context.js +10 -4
  100. package/dist/src/agent/embedded/index.d.ts +1 -1
  101. package/dist/src/agent/embedded/index.js +2 -2
  102. package/dist/src/agent/embedded/model-runtime.js +1 -1
  103. package/dist/src/agent/embedded/run-for-session.js +5 -4
  104. package/dist/src/agent/embedded/run-turn.js +22 -3
  105. package/dist/src/agent/embedded/types.d.ts +1 -1
  106. package/dist/src/agent/external-tools/composio-provider.d.ts +1 -0
  107. package/dist/src/agent/external-tools/composio-provider.js +64 -34
  108. package/dist/src/agent/external-tools/search-error.js +5 -3
  109. package/dist/src/agent/image/tool-model-config.js +1 -1
  110. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  111. package/dist/src/agent/service/direct-turn-helpers.js +6 -3
  112. package/dist/src/agent/service/process-direct-streaming.js +6 -3
  113. package/dist/src/agent/service.d.ts +2 -0
  114. package/dist/src/agent/service.js +25 -10
  115. package/dist/src/agent/service.types.d.ts +2 -1
  116. package/dist/src/agent/session/session-inspector.js +1 -1
  117. package/dist/src/agent/skills/hub-lock.js +1 -1
  118. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +4 -0
  119. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  120. package/dist/src/agent/tool-manuals/browser.d.ts +1 -1
  121. package/dist/src/agent/tool-manuals/browser.js +15 -226
  122. package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +4 -21
  123. package/dist/src/agent/tools/browser/tool/browser-use-tool.js +48 -165
  124. package/dist/src/agent/tools/browser/tool/schemas.d.ts +203 -16
  125. package/dist/src/agent/tools/browser/tool/schemas.js +146 -16
  126. package/dist/src/agent/tools/browser-automation-tool.d.ts +121 -0
  127. package/dist/src/agent/tools/browser-automation-tool.js +197 -0
  128. package/dist/src/agent/tools/clarify-tool.d.ts +17 -3
  129. package/dist/src/agent/tools/clarify-tool.js +27 -32
  130. package/dist/src/agent/tools/cli-clarify.js +23 -8
  131. package/dist/src/agent/tools/factory.d.ts +6 -9
  132. package/dist/src/agent/tools/factory.js +42 -59
  133. package/dist/src/agent/tools/index.d.ts +2 -2
  134. package/dist/src/agent/tools/index.js +3 -3
  135. package/dist/src/agent/tools/review-workspace.js +2 -2
  136. package/dist/src/ai-assist/text-assist.js +1 -1
  137. package/dist/src/auth/credentials.js +2 -2
  138. package/dist/src/auth/oauth/xopc-cloud.js +3 -1
  139. package/dist/src/auth/profiles/store.js +1 -1
  140. package/dist/src/auth/sync-provider-auth.js +2 -2
  141. package/dist/src/automations/domain/defaults.js +1 -1
  142. package/dist/src/automations/domain/types.d.ts +5 -5
  143. package/dist/src/automations/domain/validation.d.ts +16 -16
  144. package/dist/src/automations/domain/validation.js +3 -3
  145. package/dist/src/automations/draft/automation-draft-validator.d.ts +4 -4
  146. package/dist/src/automations/draft/automation-draft-validator.js +1 -1
  147. package/dist/src/automations/service/action-executor.d.ts +1 -1
  148. package/dist/src/automations/service/action-executor.js +7 -7
  149. package/dist/src/browser/{recipes → automations}/index.d.ts +1 -0
  150. package/dist/src/browser/automations/index.js +4 -0
  151. package/dist/src/browser/automations/repository.d.ts +13 -0
  152. package/dist/src/browser/automations/repository.js +60 -0
  153. package/dist/src/browser/automations/runner.d.ts +17 -0
  154. package/dist/src/browser/automations/runner.js +173 -0
  155. package/dist/src/browser/automations/runtime-service.d.ts +6 -0
  156. package/dist/src/browser/automations/runtime-service.js +37 -0
  157. package/dist/src/browser/automations/schema.d.ts +144 -0
  158. package/dist/src/browser/automations/schema.js +135 -0
  159. package/dist/src/browser/automations/service.d.ts +146 -0
  160. package/dist/src/browser/automations/service.js +168 -0
  161. package/dist/src/browser/automations/types.d.ts +90 -0
  162. package/dist/src/browser/cache-dir-policy.d.ts +1 -1
  163. package/dist/src/browser/cache-dir-policy.js +1 -4
  164. package/dist/src/browser/drivers/browser-driver.d.ts +17 -0
  165. package/dist/src/browser/drivers/create-driver.d.ts +3 -0
  166. package/dist/src/browser/drivers/create-driver.js +84 -0
  167. package/dist/src/browser/drivers/extension-driver.d.ts +20 -0
  168. package/dist/src/browser/drivers/extension-driver.js +47 -0
  169. package/dist/src/browser/drivers/playwright-driver.d.ts +38 -0
  170. package/dist/src/browser/drivers/playwright-driver.js +406 -0
  171. package/dist/src/browser/index.d.ts +10 -15
  172. package/dist/src/browser/index.js +10 -15
  173. package/dist/src/browser/install-lock.d.ts +1 -2
  174. package/dist/src/browser/install-lock.js +3 -9
  175. package/dist/src/browser/install-progress.d.ts +1 -1
  176. package/dist/src/browser/observation/format.d.ts +2 -0
  177. package/dist/src/browser/observation/format.js +26 -0
  178. package/dist/src/browser/policy/approval-store.d.ts +17 -0
  179. package/dist/src/browser/policy/approval-store.js +62 -0
  180. package/dist/src/browser/policy/browser-policy.d.ts +3 -0
  181. package/dist/src/browser/policy/browser-policy.js +27 -0
  182. package/dist/src/browser/providers/browser-ext-install.d.ts +1 -1
  183. package/dist/src/browser/providers/browser-ext-install.js +4 -6
  184. package/dist/src/browser/providers/browser-use.js +1 -1
  185. package/dist/src/browser/providers/browserbase.js +1 -1
  186. package/dist/src/browser/providers/extension-ws-acquire.d.ts +1 -4
  187. package/dist/src/browser/providers/extension-ws-acquire.js +1 -13
  188. package/dist/src/browser/providers/extension.d.ts +3 -22
  189. package/dist/src/browser/providers/extension.js +7 -15
  190. package/dist/src/browser/providers/index.d.ts +2 -2
  191. package/dist/src/browser/providers/index.js +3 -3
  192. package/dist/src/browser/providers/types.d.ts +0 -94
  193. package/dist/src/browser/readiness.d.ts +4 -22
  194. package/dist/src/browser/readiness.js +55 -118
  195. package/dist/src/browser/runtime/browser-runtime.d.ts +30 -0
  196. package/dist/src/browser/runtime/browser-runtime.js +362 -0
  197. package/dist/src/browser/url-policy.d.ts +3 -3
  198. package/dist/src/browser/url-policy.js +7 -6
  199. package/dist/src/browser/verification/expectation.d.ts +2 -0
  200. package/dist/src/browser/verification/expectation.js +17 -0
  201. package/dist/src/cli/command-loaders.js +1 -0
  202. package/dist/src/cli/command-manifest.js +5 -1
  203. package/dist/src/cli/commands/browser-cli-helpers.d.ts +0 -6
  204. package/dist/src/cli/commands/browser-cli-helpers.js +11 -144
  205. package/dist/src/cli/commands/browser.d.ts +0 -5
  206. package/dist/src/cli/commands/browser.js +11 -152
  207. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  208. package/dist/src/cli/commands/doctor/checks/node-version.js +25 -9
  209. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  210. package/dist/src/cli/commands/models.js +1 -1
  211. package/dist/src/cli/commands/platform.d.ts +1 -0
  212. package/dist/src/cli/commands/platform.js +111 -0
  213. package/dist/src/config/index.js +4 -4
  214. package/dist/src/config/loader.js +10 -4
  215. package/dist/src/config/models-json.js +1 -1
  216. package/dist/src/config/schema.d.ts +131 -84
  217. package/dist/src/config/schema.js +112 -59
  218. package/dist/src/connectors/composio-sessions.js +1 -3
  219. package/dist/src/extensions/lockfile.js +1 -1
  220. package/dist/src/extensions/marketplace.js +4 -0
  221. package/dist/src/gateway/agents-admin.js +1 -1
  222. package/dist/src/gateway/chat-stream/mapper.js +5 -1
  223. package/dist/src/gateway/chat-stream/protocol.d.ts +5 -1
  224. package/dist/src/gateway/clarify-runtime.d.ts +7 -5
  225. package/dist/src/gateway/clarify-runtime.js +8 -11
  226. package/dist/src/gateway/ephemeral-clarification-waiter.d.ts +17 -0
  227. package/dist/src/gateway/ephemeral-clarification-waiter.js +46 -0
  228. package/dist/src/gateway/file-path-classifier.js +1 -1
  229. package/dist/src/gateway/heartbeat/service.js +1 -1
  230. package/dist/src/gateway/hono/lib/config-payload.d.ts +12 -26
  231. package/dist/src/gateway/hono/lib/config-payload.js +11 -40
  232. package/dist/src/gateway/hono/routes/agent-stream.js +44 -18
  233. package/dist/src/gateway/hono/routes/browser-automations.d.ts +3 -0
  234. package/dist/src/gateway/hono/routes/browser-automations.js +77 -0
  235. package/dist/src/gateway/hono/routes/browser-install.js +0 -32
  236. package/dist/src/gateway/hono/routes/browser.d.ts +0 -17
  237. package/dist/src/gateway/hono/routes/browser.js +46 -568
  238. package/dist/src/gateway/hono/routes/config-patch/misc.js +8 -1
  239. package/dist/src/gateway/hono/routes/config.js +0 -11
  240. package/dist/src/gateway/hono/routes/lazy-bundles.js +5 -5
  241. package/dist/src/gateway/hono/routes/models.js +1 -1
  242. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +10 -2
  243. package/dist/src/gateway/hono/routes/side-chats.js +24 -4
  244. package/dist/src/gateway/security/gateway-scopes.js +1 -1
  245. package/dist/src/gateway/service/agent-runner.d.ts +25 -36
  246. package/dist/src/gateway/service/agent-runner.js +103 -32
  247. package/dist/src/gateway/service/config-coordinator.js +1 -1
  248. package/dist/src/gateway/service/run-gateway-agent.js +5 -2
  249. package/dist/src/gateway/service/session-input-coordinator.js +4 -1
  250. package/dist/src/gateway/service/sessions-api.js +1 -1
  251. package/dist/src/gateway/service.d.ts +8 -8
  252. package/dist/src/gateway/service.js +50 -37
  253. package/dist/src/gateway/side-chat/manager.d.ts +2 -1
  254. package/dist/src/gateway/side-chat/manager.js +5 -4
  255. package/dist/src/gateway/side-chat/run-service.d.ts +5 -1
  256. package/dist/src/gateway/side-chat/run-service.js +24 -23
  257. package/dist/src/gateway/side-chat/types.d.ts +3 -1
  258. package/dist/src/heartbeat/index.js +1 -1
  259. package/dist/src/platform/client.d.ts +121 -0
  260. package/dist/src/platform/client.js +108 -0
  261. package/dist/src/platform/contracts.d.ts +194 -0
  262. package/dist/src/platform/contracts.js +150 -0
  263. package/dist/src/platform/index.d.ts +4 -0
  264. package/dist/src/platform/index.js +9 -0
  265. package/dist/src/platform/resolution.d.ts +4 -0
  266. package/dist/src/platform/resolution.js +16 -0
  267. package/dist/src/platform/worker.d.ts +6 -0
  268. package/dist/src/platform/worker.js +75 -0
  269. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  270. package/dist/src/providers/index.js +2 -2
  271. package/dist/src/providers/model-registry.js +1 -1
  272. package/dist/src/providers/register-runtime-providers.js +1 -1
  273. package/dist/src/providers/xopc-cloud-config.js +3 -1
  274. package/dist/src/session/session-context-for-llm.js +41 -1
  275. package/dist/src/share/hosted-session-share.js +3 -1
  276. package/dist/src/share/share-thumbnail.js +1 -1
  277. package/dist/src/storage/sqlite/clarification-wait-repository.d.ts +41 -0
  278. package/dist/src/storage/sqlite/clarification-wait-repository.js +418 -0
  279. package/dist/src/storage/sqlite/index.d.ts +2 -1
  280. package/dist/src/storage/sqlite/index.js +2 -1
  281. package/dist/src/storage/sqlite/migrations/153_browser_control_v2.sql +45 -0
  282. package/dist/src/storage/sqlite/migrations/154_session_clarification_waits.sql +60 -0
  283. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  284. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  285. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  286. package/dist/src/storage/sqlite/schema.js +1 -1
  287. package/dist/src/storage/sqlite/schema.sql +16 -20
  288. package/dist/src/storage/sqlite/session-input-repository.d.ts +11 -6
  289. package/dist/src/tasks/home-query-service.js +1 -1
  290. package/dist/src/tui/tui-startup-resources.js +1 -1
  291. package/dist/src/tui/tui.js +1 -1
  292. package/dist/src/tunnel/env.js +3 -1
  293. package/dist/src/voice/realtime/agentEngine.js +7 -2
  294. package/dist/src/voice/realtime/runtime.types.d.ts +5 -0
  295. package/dist/src/work-discovery/service.js +1 -1
  296. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  297. package/package.json +7 -7
  298. package/skills/creative/hatch-pet/SKILL.md +1 -1
  299. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-kILWelNb.js +0 -1
  300. package/dist/gateway/static/root/assets/apps-page-BnizTdgs.js +0 -1
  301. package/dist/gateway/static/root/assets/automations-workspace-CZRKqSqY.js +0 -6
  302. package/dist/gateway/static/root/assets/browser-settings-page-pN5LbChY.js +0 -8
  303. package/dist/gateway/static/root/assets/browser-workflow-inputs-BX1-uM9L.js +0 -1
  304. package/dist/gateway/static/root/assets/browser-workflows-page-C65MI57t.js +0 -3
  305. package/dist/gateway/static/root/assets/capabilities-settings-panel-CJw2e16J.js +0 -7
  306. package/dist/gateway/static/root/assets/channels-settings-CRgjb4Ck.js +0 -1
  307. package/dist/gateway/static/root/assets/connectors-page-Dcpdy06y.js +0 -2
  308. package/dist/gateway/static/root/assets/gateway-config-api-e3BRcgDx.js +0 -1
  309. package/dist/gateway/static/root/assets/gateway-settings-Cheo0Rkc.js +0 -1
  310. package/dist/gateway/static/root/assets/home-page-DVrTRqNc.js +0 -1
  311. package/dist/gateway/static/root/assets/index-B7CX4Qob.css +0 -2
  312. package/dist/gateway/static/root/assets/index-BHrpyJ4t.js +0 -72
  313. package/dist/gateway/static/root/assets/markdown-view-CQvzsE24.js +0 -201
  314. package/dist/gateway/static/root/assets/messages-Cf5hpZE6.js +0 -3
  315. package/dist/gateway/static/root/assets/note-detail-panel-CUd8O4K7.js +0 -5
  316. package/dist/gateway/static/root/assets/notes-page-BLQwd39W.js +0 -8
  317. package/dist/gateway/static/root/assets/project-detail-page-NttW338u.js +0 -1
  318. package/dist/gateway/static/root/assets/projects-page-BzH8pjEz.js +0 -1
  319. package/dist/gateway/static/root/assets/remote-access-hub-BxpjSDnL.js +0 -1
  320. package/dist/gateway/static/root/assets/sessions-page-BLMaibOb.js +0 -1
  321. package/dist/gateway/static/root/assets/settings-advanced-gate-BRvvKhoH.js +0 -1
  322. package/dist/gateway/static/root/assets/setup-status-panel-DTOsxQC1.js +0 -1
  323. package/dist/gateway/static/root/assets/skill-reload-api-BWYanBlQ.js +0 -1
  324. package/dist/gateway/static/root/assets/user-model-page-B_-SNat-.js +0 -2
  325. package/dist/gateway/static/root/assets/workflows-page-CNOT2Coo.js +0 -5
  326. package/dist/src/agent/tools/browser-recipe-tool.d.ts +0 -12
  327. package/dist/src/agent/tools/browser-recipe-tool.js +0 -113
  328. package/dist/src/browser/actions/extension-registry-bridge.d.ts +0 -5
  329. package/dist/src/browser/actions/extension-registry-bridge.js +0 -312
  330. package/dist/src/browser/actions/registry.d.ts +0 -5
  331. package/dist/src/browser/actions/registry.js +0 -741
  332. package/dist/src/browser/actions/types.d.ts +0 -65
  333. package/dist/src/browser/backend-from-config.d.ts +0 -22
  334. package/dist/src/browser/backend-from-config.js +0 -99
  335. package/dist/src/browser/browser-command-timeout.d.ts +0 -2
  336. package/dist/src/browser/browser-command-timeout.js +0 -11
  337. package/dist/src/browser/cdp-local-launcher.d.ts +0 -35
  338. package/dist/src/browser/cdp-local-launcher.js +0 -154
  339. package/dist/src/browser/cdp-supervisor.d.ts +0 -58
  340. package/dist/src/browser/cdp-supervisor.js +0 -133
  341. package/dist/src/browser/humanize.d.ts +0 -80
  342. package/dist/src/browser/humanize.js +0 -363
  343. package/dist/src/browser/manager.d.ts +0 -50
  344. package/dist/src/browser/manager.js +0 -251
  345. package/dist/src/browser/pipeline/output.d.ts +0 -35
  346. package/dist/src/browser/pipeline/output.js +0 -74
  347. package/dist/src/browser/pipeline/runner.d.ts +0 -27
  348. package/dist/src/browser/pipeline/runner.js +0 -453
  349. package/dist/src/browser/pipeline/schema.d.ts +0 -42
  350. package/dist/src/browser/pipeline/schema.js +0 -116
  351. package/dist/src/browser/pipeline/template.d.ts +0 -30
  352. package/dist/src/browser/pipeline/template.js +0 -112
  353. package/dist/src/browser/providers/cloakbrowser.d.ts +0 -83
  354. package/dist/src/browser/providers/cloakbrowser.js +0 -612
  355. package/dist/src/browser/recipes/index.js +0 -3
  356. package/dist/src/browser/recipes/repository.d.ts +0 -13
  357. package/dist/src/browser/recipes/repository.js +0 -81
  358. package/dist/src/browser/recipes/runtime-service.d.ts +0 -6
  359. package/dist/src/browser/recipes/runtime-service.js +0 -30
  360. package/dist/src/browser/recipes/service.d.ts +0 -36
  361. package/dist/src/browser/recipes/service.js +0 -186
  362. package/dist/src/browser/recipes/types.d.ts +0 -36
  363. package/dist/src/browser/schemas.d.ts +0 -53
  364. package/dist/src/browser/schemas.js +0 -68
  365. package/dist/src/browser/session-lifecycle.d.ts +0 -40
  366. package/dist/src/browser/session-lifecycle.js +0 -136
  367. package/dist/src/browser/snapshot-helpers.d.ts +0 -24
  368. package/dist/src/browser/snapshot-helpers.js +0 -70
  369. package/dist/src/browser/stealth.d.ts +0 -46
  370. package/dist/src/browser/stealth.js +0 -163
  371. package/dist/src/gateway/clarify-bridge.d.ts +0 -46
  372. package/dist/src/gateway/clarify-bridge.js +0 -111
  373. package/dist/src/gateway/hono/routes/browser-workflows.d.ts +0 -3
  374. package/dist/src/gateway/hono/routes/browser-workflows.js +0 -78
  375. /package/dist/src/browser/{actions → automations}/types.js +0 -0
  376. /package/dist/src/browser/{recipes/types.js → drivers/browser-driver.js} +0 -0
@@ -12,16 +12,16 @@ import { getSessionConfig } from "../storage/sqlite/config-repository.js";
12
12
  import "../storage/sqlite/index.js";
13
13
  import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
14
14
  import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
15
+ import { buildSessionKey, init_session_key, sanitizeSegment } from "../routing/session-key.js";
16
+ import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
17
+ import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
15
18
  import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
16
- import { prewarmModelRegistry } from "../providers/model-registry.js";
17
19
  import { areExtensionsGloballyDisabled } from "../extensions/discover-extensions.js";
18
20
  import { buildExtensionMetadataSnapshot } from "../extensions/extension-metadata-snapshot.js";
19
21
  import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, init_channel_catalog_service } from "../channels/catalog/channel-catalog-service.js";
20
22
  import { loadConfig, saveConfig } from "../config/loader.js";
21
- import { buildSessionKey, init_session_key, sanitizeSegment } from "../routing/session-key.js";
22
- import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
23
+ import { prewarmModelRegistry } from "../providers/model-registry.js";
23
24
  import { init_providers, providers_exports } from "../providers/index.js";
24
- import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
25
25
  import { TaskRepository } from "../tasks/task-repository.js";
26
26
  import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
27
27
  import { getEmbeddedExecutionSession } from "../agent/embedded/execution-context.js";
@@ -50,7 +50,7 @@ import "../infra/bus/index.js";
50
50
  import { AgentService } from "../agent/service.js";
51
51
  import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
52
52
  import { setPairingBroadcastSink } from "../channels/pairing/pairing-events.js";
53
- import { registerClarifyBridge } from "./clarify-runtime.js";
53
+ import { registerClarificationChannelRuntime } from "./clarify-runtime.js";
54
54
  import { ChannelManager } from "../channels/manager.js";
55
55
  import { getWorkspacePath } from "../config/workspace-path-helpers.js";
56
56
  import "../config/index.js";
@@ -97,12 +97,13 @@ import { assertGatewayRuntimeConfig } from "./runtime-config.js";
97
97
  import { auditGatewayConfig } from "./security/audit.js";
98
98
  import { getXopcCloudCatalogCoordinator } from "../providers/xopc-cloud-catalog-coordinator.js";
99
99
  import { ModelCatalogSyncService } from "../providers/model-catalog-sync-service.js";
100
+ import { collectMediaUrisFromMessages, deleteMediaUris } from "../media/session-references.js";
100
101
  import { runBootstrapMigrationsSync } from "../migrations/runner.js";
101
102
  import { NotificationService } from "../notifications/service.js";
102
103
  import { LocalAppService } from "../local-apps/service.js";
103
104
  import "../local-apps/index.js";
104
- import { createRuntimeBrowserRecipeService } from "../browser/recipes/runtime-service.js";
105
- import "../browser/recipes/index.js";
105
+ import { createRuntimeBrowserAutomationService } from "../browser/automations/runtime-service.js";
106
+ import "../browser/automations/index.js";
106
107
  import { mapProductEventToProactive } from "../proactive/events/product-event-bridge.js";
107
108
  import { ProactiveEventService } from "../proactive/service.js";
108
109
  import { ReadonlyProactiveAgentExecutor } from "../proactive/execution/agent-executor.js";
@@ -145,7 +146,7 @@ var GatewayService = class {
145
146
  _agentService = null;
146
147
  channelManager;
147
148
  automationService;
148
- browserRecipeService = null;
149
+ browserAutomationService = null;
149
150
  notesService;
150
151
  extensionLoader = null;
151
152
  extensionMetadataSnapshot = null;
@@ -237,12 +238,12 @@ var GatewayService = class {
237
238
  getModelCatalogSync() {
238
239
  return this.modelCatalogSync;
239
240
  }
240
- get browserRecipes() {
241
- if (!this.browserRecipeService) this.browserRecipeService = createRuntimeBrowserRecipeService({
241
+ get browserAutomations() {
242
+ if (!this.browserAutomationService) this.browserAutomationService = createRuntimeBrowserAutomationService({
242
243
  getConfig: () => this.config,
243
244
  emit: (type, payload) => this.emit(type, payload)
244
245
  });
245
- return this.browserRecipeService;
246
+ return this.browserAutomationService;
246
247
  }
247
248
  stopGatewayUpdateCheck = null;
248
249
  /** When set (e.g. by `GatewayServer`), `triggerGatewayProcessRestart` can stop HTTP then exit. */
@@ -268,7 +269,7 @@ var GatewayService = class {
268
269
  stopRealtimeLogBridge = null;
269
270
  /**
270
271
  * Webchat agent invocation surface (`runAgent`, `abortAgentRun`, `steer*`,
271
- * `submitClarifyResponse`, clarify-bridge dispatch). Owns the
272
+ * clarification dispatch). Owns the
272
273
  * `activeWebchatRunBySession` + `runAbortControllers` maps.
273
274
  */
274
275
  agentRunner;
@@ -465,8 +466,12 @@ var GatewayService = class {
465
466
  getParentMetadata: (sessionKey) => this.sessionIndex.getSessionMetadata(sessionKey),
466
467
  loadParentMessages: (sessionKey) => this.sessionIndex.getStore().load(sessionKey),
467
468
  getDefaultModelRef: (sessionKey) => this.ensureAgentService().getModelForSession(sessionKey),
469
+ getDefaultThinkingLevel: (sessionKey) => this.ensureAgentService().getThinkingLevelForSession(sessionKey),
468
470
  getWorkspacePath: (metadata) => metadata.cwd || this.currentWorkspacePath,
469
- onBeforeDispose: (sideChatId, clientInstanceId) => sideChatRuns?.cancelRun(sideChatId, clientInstanceId).then(() => void 0),
471
+ onBeforeDispose: async (sideChatId, clientInstanceId, messages) => {
472
+ await sideChatRuns?.cancelRun(sideChatId, clientInstanceId);
473
+ await deleteMediaUris(collectMediaUrisFromMessages(messages));
474
+ },
470
475
  onExpired: (sideChatId, clientInstanceId, reason) => {
471
476
  const topic = `side-chat:${clientInstanceId}:${sideChatId}`;
472
477
  this.realtime.broker.publish(topic, "expired", { reason });
@@ -552,7 +557,8 @@ var GatewayService = class {
552
557
  extensionRegistry: this.extensionLoader?.getRegistry(),
553
558
  endpointTools: this.endpointTools,
554
559
  getAutomationService: () => this.automationService,
555
- getBrowserRecipeService: () => this.browserRecipes,
560
+ getBrowserAutomationService: () => this.browserAutomations,
561
+ emitBrowserEvent: (type, payload) => this.emit(type, payload),
556
562
  getNotesService: () => this.notesService,
557
563
  getProjectService: () => this.projects,
558
564
  getLocalAppService: () => this.localApps,
@@ -571,10 +577,12 @@ var GatewayService = class {
571
577
  }
572
578
  return null;
573
579
  },
574
- gatewayClarify: { requestClarification: (sessionKey, request) => {
575
- const executionSessionKey = getEmbeddedExecutionSession() ?? sessionKey;
580
+ gatewayClarify: { requestClarification: (context, request) => {
581
+ const executionSessionKey = getEmbeddedExecutionSession() ?? context.sessionKey;
576
582
  return this.agentRunner.requestClarification({
577
583
  sessionKey: executionSessionKey,
584
+ runId: context.runId,
585
+ toolCallId: context.toolCallId,
578
586
  request,
579
587
  publishStreamFor: (_runId) => (event) => {
580
588
  this._agentService.turnDispatcher.enqueueWebchatStreamEvent(executionSessionKey, event);
@@ -592,7 +600,7 @@ var GatewayService = class {
592
600
  getDefaultAgentId: () => getDefaultAgentId(this.config),
593
601
  prepareAgentSession: (input) => prepareAutomationAgentSession(this.sessionIndex.getStore(), this.projects, input),
594
602
  workflowRunService: this.createWorkflowRunService(),
595
- browserRecipeService: this.browserRecipes,
603
+ browserAutomationService: this.browserAutomations,
596
604
  executeTaskCommand: ({ taskId, idempotencyKey, command }) => {
597
605
  const task = new TaskRepository().get(taskId);
598
606
  if (!task) return {
@@ -775,8 +783,14 @@ var GatewayService = class {
775
783
  getActiveWebchatRunId(sessionKey) {
776
784
  return this.agentRunner.getActiveRunId(sessionKey);
777
785
  }
778
- submitClarifyResponse(requestId, answer) {
779
- return this.agentRunner.submitClarifyResponse(requestId, answer);
786
+ answerEphemeralClarification(requestId, answer) {
787
+ return this.agentRunner.answerEphemeralClarification(requestId, answer);
788
+ }
789
+ getClarificationState(sessionKey) {
790
+ return this.agentRunner.getClarificationState(sessionKey);
791
+ }
792
+ resolveClarificationResponse(input) {
793
+ return this.agentRunner.resolveClarificationResponse(input);
780
794
  }
781
795
  initializeExtensionLoader() {
782
796
  try {
@@ -924,7 +938,10 @@ var GatewayService = class {
924
938
  errorMessage: readiness.error.message
925
939
  }, `Initial XOPC Cloud catalog refresh failed: ${readiness.error.message}`);
926
940
  }
927
- registerClarifyBridge(this.agentRunner.getClarifyBridge());
941
+ registerClarificationChannelRuntime({
942
+ answerChoice: (requestId, choiceIndex, idempotencyKey) => this.agentRunner.answerClarificationChoice(requestId, choiceIndex, idempotencyKey),
943
+ answerText: (sessionKey, text, idempotencyKey) => this.agentRunner.answerClarificationText(sessionKey, text, idempotencyKey)
944
+ });
928
945
  this.ensureAgentService();
929
946
  this.agentRunner.recoverSessionInputs();
930
947
  this.connectionRecovery.start();
@@ -1002,7 +1019,7 @@ var GatewayService = class {
1002
1019
  getDefaultAgentId: () => getDefaultAgentId(this.config),
1003
1020
  prepareAgentSession: (input) => prepareAutomationAgentSession(this.sessionIndex.getStore(), this.projects, input),
1004
1021
  workflowRunService: this.createWorkflowRunService(),
1005
- browserRecipeService: this.browserRecipes,
1022
+ browserAutomationService: this.browserAutomations,
1006
1023
  executeTaskCommand: ({ taskId, idempotencyKey, command }) => {
1007
1024
  const task = new TaskRepository().get(taskId);
1008
1025
  if (!task) return {
@@ -1234,16 +1251,16 @@ var GatewayService = class {
1234
1251
  this.connectedSourceChangePublisher = null;
1235
1252
  this.connectedKnowledgeCoordinator?.stop();
1236
1253
  this.connectedKnowledgeCoordinator = null;
1237
- await this.browserRecipeService?.shutdown();
1254
+ await this.browserAutomationService?.shutdown();
1238
1255
  if (this.browserExtensionRelease) {
1239
1256
  await this.browserExtensionRelease();
1240
1257
  this.browserExtensionRelease = null;
1241
1258
  }
1242
1259
  this.browserExtensionProvider = null;
1243
1260
  this.browserExtensionBindKey = null;
1244
- registerClarifyBridge(null);
1261
+ registerClarificationChannelRuntime(null);
1245
1262
  this.connectionRecovery.stop();
1246
- this.agentRunner.disposeClarifyBridge();
1263
+ this.agentRunner.disposeClarifications();
1247
1264
  await disposeAllSessionMcpRuntimes().catch((err) => {
1248
1265
  log.warn({ err }, "MCP runtime shutdown failed");
1249
1266
  });
@@ -1263,33 +1280,29 @@ var GatewayService = class {
1263
1280
  closeXopcDatabase();
1264
1281
  log.debug("Gateway service stopped");
1265
1282
  }
1266
- /** Start the browser extension WS server when backend is 'extension'. */
1283
+ /** Start the browser extension WebSocket server when its driver is active. */
1267
1284
  async startBrowserExtensionServerIfNeeded() {
1268
1285
  await this.reconcileBrowserExtensionServer();
1269
1286
  }
1270
- /** Release the gateway's hold on the shared extension bridge (does not restart). */
1271
- async releaseBrowserExtensionBridge() {
1272
- if (!this.browserExtensionRelease) return;
1273
- await this.browserExtensionRelease();
1274
- this.browserExtensionRelease = null;
1275
- this.browserExtensionProvider = null;
1276
- this.browserExtensionBindKey = null;
1277
- log.debug("Browser extension WS server released");
1278
- }
1279
1287
  /**
1280
1288
  * Start/stop/rebind the Chrome extension bridge.
1281
1289
  * PATCH saves update config in memory without re-running gateway startup, so this must run on save too.
1282
1290
  */
1283
1291
  async reconcileBrowserExtensionServer() {
1284
- const { resolveExtensionBridgeServerConfig } = await import("../browser/backend-from-config.js");
1285
- const bridgeConfig = resolveExtensionBridgeServerConfig(this.config);
1292
+ const driver = this.config.browser.driver;
1293
+ const bridgeConfig = this.config.browser.enabled && driver.kind === "extension" ? {
1294
+ host: "127.0.0.1",
1295
+ port: 19820,
1296
+ connectionTimeout: this.config.browser.limits.actionTimeoutMs,
1297
+ commandTimeout: this.config.browser.limits.actionTimeoutMs
1298
+ } : null;
1286
1299
  if (!bridgeConfig) {
1287
1300
  if (this.browserExtensionRelease) {
1288
1301
  await this.browserExtensionRelease();
1289
1302
  this.browserExtensionRelease = null;
1290
1303
  this.browserExtensionProvider = null;
1291
1304
  this.browserExtensionBindKey = null;
1292
- log.debug("Browser extension WS server stopped (backend is not extension)");
1305
+ log.debug("Browser extension WebSocket server stopped because its driver is inactive");
1293
1306
  }
1294
1307
  return;
1295
1308
  }
@@ -11,13 +11,14 @@ export interface EphemeralSideChatManagerOptions {
11
11
  getParentMetadata: (sessionKey: string) => Promise<SessionMetadata | null>;
12
12
  loadParentMessages: (sessionKey: string) => Promise<AgentMessage[]>;
13
13
  getDefaultModelRef: (sessionKey: string) => string;
14
+ getDefaultThinkingLevel?: (sessionKey: string) => ThinkingLevel;
14
15
  getWorkspacePath: (metadata: SessionMetadata) => string;
15
16
  idleTtlMs?: number;
16
17
  maxPerClient?: number;
17
18
  maxTotal?: number;
18
19
  now?: () => number;
19
20
  startSweepTimer?: boolean;
20
- onBeforeDispose?: (sideChatId: string, clientInstanceId: string) => void | Promise<void>;
21
+ onBeforeDispose?: (sideChatId: string, clientInstanceId: string, messages: AgentMessage[]) => void | Promise<void>;
21
22
  onExpired?: (sideChatId: string, clientInstanceId: string, reason: 'idle' | 'waiting') => void;
22
23
  }
23
24
  export declare class EphemeralSideChatManager {
@@ -90,7 +90,7 @@ var EphemeralSideChatManager = class {
90
90
  runtime.captureBaseline();
91
91
  const config = {
92
92
  modelRef: normalizeOptionalString(input.config?.modelRef) || this.options.getDefaultModelRef(parentSessionKey),
93
- thinkingLevel: input.config?.thinkingLevel
93
+ thinkingLevel: input.config?.thinkingLevel ?? this.options.getDefaultThinkingLevel?.(parentSessionKey) ?? "medium"
94
94
  };
95
95
  const entry = {
96
96
  id,
@@ -169,10 +169,11 @@ var EphemeralSideChatManager = class {
169
169
  }
170
170
  if (entry.clientInstanceId !== clientInstanceId) return false;
171
171
  entry.status = "closing";
172
+ const messages = entry.runtime.loadConversationMessages();
172
173
  this.entries.delete(id);
173
174
  const cleanup = (async () => {
174
175
  try {
175
- await this.runBeforeDispose(id, clientInstanceId);
176
+ await this.runBeforeDispose(id, clientInstanceId, messages);
176
177
  await evictEmbeddedSessionRunner(entry.runtime.runtimeId, "side_chat_dispose");
177
178
  return true;
178
179
  } finally {
@@ -255,9 +256,9 @@ var EphemeralSideChatManager = class {
255
256
  entry.lastActiveAt = new Date(now).toISOString();
256
257
  entry.expiresAt = entry.status === "running" ? null : new Date(now + this.idleTtlMs).toISOString();
257
258
  }
258
- async runBeforeDispose(id, clientInstanceId) {
259
+ async runBeforeDispose(id, clientInstanceId, messages) {
259
260
  try {
260
- await this.options.onBeforeDispose?.(id, clientInstanceId);
261
+ await this.options.onBeforeDispose?.(id, clientInstanceId, messages);
261
262
  } catch (err) {
262
263
  log.warn({
263
264
  err,
@@ -1,6 +1,7 @@
1
1
  import type { AgentService } from '../../agent/service.js';
2
2
  import type { GatewayAgentRunner } from '../service/agent-runner.js';
3
3
  import { type EphemeralSideChatManager } from './manager.js';
4
+ import type { UserTurnAttachment } from '../user-turn-input.js';
4
5
  export interface SideChatRunServiceOptions {
5
6
  manager: EphemeralSideChatManager;
6
7
  getAgentService: () => AgentService;
@@ -12,7 +13,10 @@ export declare class SideChatRunService {
12
13
  private readonly options;
13
14
  private readonly activeBySideChat;
14
15
  constructor(options: SideChatRunServiceOptions);
15
- submit(sideChatId: string, clientInstanceId: string, content: string): {
16
+ submit(sideChatId: string, clientInstanceId: string, input: {
17
+ content: string;
18
+ attachments?: UserTurnAttachment[];
19
+ }): {
16
20
  runId: string;
17
21
  };
18
22
  abort(sideChatId: string, clientInstanceId: string, runId?: string): Promise<boolean>;
@@ -12,9 +12,9 @@ var SideChatRunService = class {
12
12
  constructor(options) {
13
13
  this.options = options;
14
14
  }
15
- submit(sideChatId, clientInstanceId, content) {
16
- const text = content.trim();
17
- if (!text) throw new SideChatError("content is required", "INVALID_REQUEST");
15
+ submit(sideChatId, clientInstanceId, input) {
16
+ const text = input.content.trim();
17
+ if (!text && !input.attachments?.length) throw new SideChatError("content or attachments are required", "INVALID_REQUEST");
18
18
  const sideChat = this.options.manager.get(sideChatId, clientInstanceId);
19
19
  if (this.activeBySideChat.has(sideChatId)) throw new SideChatError("A side chat run is already active", "CONFLICT");
20
20
  const run = {
@@ -26,7 +26,10 @@ var SideChatRunService = class {
26
26
  };
27
27
  this.activeBySideChat.set(sideChatId, run);
28
28
  this.options.manager.setStatus(sideChatId, clientInstanceId, "running", run.runId);
29
- this.execute(run, text, sideChat.config).catch((err) => {
29
+ this.execute(run, {
30
+ content: text,
31
+ attachments: input.attachments
32
+ }, sideChat.config).catch((err) => {
30
33
  log.error({
31
34
  err,
32
35
  sideChatId,
@@ -55,11 +58,11 @@ var SideChatRunService = class {
55
58
  }
56
59
  submitClarification(sideChatId, clientInstanceId, requestId, answer) {
57
60
  if (this.options.manager.get(sideChatId, clientInstanceId).clarification?.requestId !== requestId) return false;
58
- const handled = this.options.agentRunner.submitClarifyResponse(requestId, answer);
61
+ const handled = this.options.agentRunner.answerEphemeralClarification(requestId, answer);
59
62
  if (handled) this.options.manager.setStatus(sideChatId, clientInstanceId, "running");
60
63
  return handled;
61
64
  }
62
- async execute(run, content, config) {
65
+ async execute(run, input, config) {
63
66
  const topic = `run:${run.runId}`;
64
67
  const mapper = new ChatStreamMapper({
65
68
  runId: run.runId,
@@ -73,8 +76,10 @@ var SideChatRunService = class {
73
76
  if (run.abortController.signal.aborted) return;
74
77
  if (event.type === "clarify_request") this.options.manager.waitForInput(run.sideChatId, run.clientInstanceId, {
75
78
  requestId: String(event.requestId),
79
+ kind: event.kind === "approval" ? "approval" : "input",
76
80
  question: String(event.question),
77
- choices: Array.isArray(event.choices) ? event.choices.filter((choice) => typeof choice === "string") : void 0
81
+ choices: Array.isArray(event.choices) ? event.choices.filter((choice) => typeof choice === "string") : void 0,
82
+ suggestedAnswer: typeof event.suggestedAnswer === "string" ? event.suggestedAnswer : void 0
78
83
  }, event.kind === "approval" ? "waiting-approval" : "waiting-input");
79
84
  for (const mapped of mapper.map(event)) publish(mapped);
80
85
  };
@@ -82,28 +87,24 @@ var SideChatRunService = class {
82
87
  for (const event of mapper.start()) publish(event);
83
88
  publishMapped({
84
89
  type: "user_message",
85
- message: {
86
- role: "user",
87
- content,
88
- timestamp: Date.now()
89
- }
90
+ content: input.content,
91
+ media: input.attachments?.map(({ data: _data, ...attachment }) => attachment),
92
+ timestamp: Date.now()
90
93
  });
91
- this.options.agentRunner.registerExternalWebchatRun(run.executionSessionKey, run.runId, (event) => publishMapped(event), {
92
- clarificationTimeoutMs: null,
93
- beforeClarificationResponse: () => {
94
- try {
95
- this.options.manager.setStatus(run.sideChatId, run.clientInstanceId, "running");
96
- return true;
97
- } catch {
98
- return false;
99
- }
94
+ this.options.agentRunner.registerExternalWebchatRun(run.executionSessionKey, run.runId, (event) => publishMapped(event), { beforeClarificationResponse: () => {
95
+ try {
96
+ this.options.manager.setStatus(run.sideChatId, run.clientInstanceId, "running");
97
+ return true;
98
+ } catch {
99
+ return false;
100
100
  }
101
- });
101
+ } });
102
102
  const result = await this.options.getAgentService().runEphemeralTurn({
103
103
  executionSessionKey: run.executionSessionKey,
104
104
  parentSessionKey: this.options.manager.get(run.sideChatId, run.clientInstanceId).parentSessionKey,
105
105
  runId: run.runId,
106
- content,
106
+ content: input.content,
107
+ attachments: input.attachments,
107
108
  modelRef: config.modelRef,
108
109
  thinkingLevel: config.thinkingLevel,
109
110
  transcriptRuntime: this.options.manager.getRuntime(run.sideChatId, run.clientInstanceId),
@@ -39,7 +39,7 @@ export interface SideChatContextSnapshot {
39
39
  }
40
40
  export interface SideChatConfig {
41
41
  modelRef: string;
42
- thinkingLevel?: ThinkingLevel;
42
+ thinkingLevel: ThinkingLevel;
43
43
  }
44
44
  export interface SideChatView {
45
45
  id: string;
@@ -54,8 +54,10 @@ export interface SideChatView {
54
54
  runId?: string;
55
55
  clarification?: {
56
56
  requestId: string;
57
+ kind: 'input' | 'approval';
57
58
  question: string;
58
59
  choices?: string[];
60
+ suggestedAnswer?: string;
59
61
  };
60
62
  messageCount: number;
61
63
  context: SideChatContextSnapshot;
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, shouldSilence, stripHeartbeatToken } from "./tokens.js";
2
+ import { appendCronEventLines } from "./event-prompt.js";
2
3
  import { isWithinActiveHours } from "./active-hours.js";
3
4
  import { isHeartbeatContentEmpty } from "./content-check.js";
4
- import { appendCronEventLines } from "./event-prompt.js";
5
5
  import { createHeartbeatWake } from "./wake.js";
6
6
  export { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, appendCronEventLines, createHeartbeatWake, isHeartbeatContentEmpty, isWithinActiveHours, shouldSilence, stripHeartbeatToken };
@@ -0,0 +1,121 @@
1
+ import { z } from 'zod';
2
+ import { type PlatformDiscovery, type PlatformEvent } from './contracts.js';
3
+ export declare const PLATFORM_RUNTIME_PROVIDER = "xopc-platform-runtime";
4
+ export declare const PLATFORM_RUNTIME_PROFILE = "xopc-platform-runtime:default";
5
+ export declare function discoverPlatform(baseUrl: string, fetchImpl?: typeof fetch): Promise<PlatformDiscovery>;
6
+ export declare const RuntimeCommandSchema: z.ZodObject<{
7
+ type: z.ZodLiteral<"run.start">;
8
+ payload: z.ZodObject<{
9
+ runId: z.ZodString;
10
+ traceId: z.ZodString;
11
+ agentVersionId: z.ZodString;
12
+ organizationId: z.ZodString;
13
+ workspaceId: z.ZodString;
14
+ runtimeId: z.ZodString;
15
+ manifest: z.ZodObject<{
16
+ schemaVersion: z.ZodLiteral<"1">;
17
+ agentId: z.ZodString;
18
+ version: z.ZodString;
19
+ runtime: z.ZodObject<{
20
+ engine: z.ZodLiteral<"xopc">;
21
+ requires: z.ZodString;
22
+ execution: z.ZodArray<z.ZodEnum<{
23
+ local: "local";
24
+ managed: "managed";
25
+ enterprise: "enterprise";
26
+ }>>;
27
+ }, z.core.$strict>;
28
+ entry: z.ZodObject<{
29
+ instructions: z.ZodString;
30
+ workflow: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strict>;
32
+ models: z.ZodObject<{
33
+ intents: z.ZodArray<z.ZodEnum<{
34
+ review: "review";
35
+ coding: "coding";
36
+ understanding: "understanding";
37
+ fast: "fast";
38
+ reasoning: "reasoning";
39
+ vision: "vision";
40
+ }>>;
41
+ allow: z.ZodArray<z.ZodString>;
42
+ }, z.core.$strict>;
43
+ dependencies: z.ZodObject<{
44
+ skills: z.ZodArray<z.ZodObject<{
45
+ id: z.ZodString;
46
+ version: z.ZodString;
47
+ sha256: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strict>>;
49
+ connectors: z.ZodArray<z.ZodObject<{
50
+ id: z.ZodString;
51
+ version: z.ZodString;
52
+ sha256: z.ZodOptional<z.ZodString>;
53
+ }, z.core.$strict>>;
54
+ extensions: z.ZodDefault<z.ZodArray<z.ZodObject<{
55
+ id: z.ZodString;
56
+ version: z.ZodString;
57
+ sha256: z.ZodOptional<z.ZodString>;
58
+ }, z.core.$strict>>>;
59
+ }, z.core.$strict>;
60
+ permissions: z.ZodObject<{
61
+ tools: z.ZodArray<z.ZodString>;
62
+ networkDomains: z.ZodArray<z.ZodString>;
63
+ filesystem: z.ZodArray<z.ZodString>;
64
+ effects: z.ZodArray<z.ZodEnum<{
65
+ delete: "delete";
66
+ read: "read";
67
+ write: "write";
68
+ execute: "execute";
69
+ admin: "admin";
70
+ send: "send";
71
+ purchase: "purchase";
72
+ publish: "publish";
73
+ }>>;
74
+ }, z.core.$strict>;
75
+ data: z.ZodObject<{
76
+ classification: z.ZodEnum<{
77
+ public: "public";
78
+ internal: "internal";
79
+ confidential: "confidential";
80
+ restricted: "restricted";
81
+ }>;
82
+ memory: z.ZodEnum<{
83
+ workspace: "workspace";
84
+ none: "none";
85
+ local: "local";
86
+ }>;
87
+ retentionPolicy: z.ZodString;
88
+ }, z.core.$strict>;
89
+ quality: z.ZodObject<{
90
+ evaluationSuite: z.ZodOptional<z.ZodString>;
91
+ releaseGate: z.ZodOptional<z.ZodString>;
92
+ }, z.core.$strict>;
93
+ }, z.core.$strict>;
94
+ }, z.core.$loose>;
95
+ id: z.ZodString;
96
+ runId: z.ZodString;
97
+ leaseToken: z.ZodString;
98
+ leaseExpiresAt: z.ZodNumber;
99
+ }, z.core.$strict>;
100
+ export type RuntimeCommand = z.infer<typeof RuntimeCommandSchema>;
101
+ declare const runtimeRenewalResponseSchema: z.ZodObject<{
102
+ leaseExpiresAt: z.ZodNumber;
103
+ cancelRequested: z.ZodBoolean;
104
+ }, z.core.$strict>;
105
+ export type RuntimeLeaseRenewal = z.infer<typeof runtimeRenewalResponseSchema>;
106
+ export declare class PlatformRuntimeClient {
107
+ private readonly token;
108
+ private readonly fetchImpl;
109
+ private readonly agentApi;
110
+ constructor(discovery: PlatformDiscovery, token: string, fetchImpl?: typeof fetch);
111
+ private request;
112
+ heartbeat(input?: {
113
+ capabilities?: Record<string, unknown>;
114
+ endpoint?: string;
115
+ leaseSeconds?: number;
116
+ }): Promise<Record<string, unknown>>;
117
+ lease(leaseSeconds?: number): Promise<RuntimeCommand | null>;
118
+ report(event: PlatformEvent, leaseToken?: string): Promise<'accepted' | 'duplicate'>;
119
+ renew(commandId: string, leaseToken: string, leaseSeconds?: number): Promise<RuntimeLeaseRenewal>;
120
+ }
121
+ export {};
@@ -0,0 +1,108 @@
1
+ import { AgentManifestSchema, PlatformDiscoverySchema, PlatformEventSchema, init_contracts } from "./contracts.js";
2
+ import { z } from "zod";
3
+ //#region src/platform/client.ts
4
+ init_contracts();
5
+ const PLATFORM_RUNTIME_PROVIDER = "xopc-platform-runtime";
6
+ const PLATFORM_RUNTIME_PROFILE = "xopc-platform-runtime:default";
7
+ function trimBaseUrl(value) {
8
+ const url = new URL(value);
9
+ url.hash = "";
10
+ url.search = "";
11
+ url.pathname = url.pathname.replace(/\/+$/, "");
12
+ return url.toString().replace(/\/+$/, "");
13
+ }
14
+ async function responseJson(response) {
15
+ return response.json().catch(() => null);
16
+ }
17
+ async function discoverPlatform(baseUrl, fetchImpl = fetch) {
18
+ const response = await fetchImpl(`${trimBaseUrl(baseUrl)}/.well-known/xopc-platform`, {
19
+ headers: { accept: "application/json" },
20
+ signal: AbortSignal.timeout(15e3)
21
+ });
22
+ if (!response.ok) throw new Error(`Platform discovery failed with HTTP ${response.status}`);
23
+ return PlatformDiscoverySchema.parse(await responseJson(response));
24
+ }
25
+ const runtimeIdentifier = z.string().min(1).max(128).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/);
26
+ const runtimeCommandBase = {
27
+ id: runtimeIdentifier,
28
+ runId: runtimeIdentifier,
29
+ leaseToken: z.string().min(1).max(512),
30
+ leaseExpiresAt: z.number().int().positive()
31
+ };
32
+ const RuntimeCommandSchema = z.object({
33
+ ...runtimeCommandBase,
34
+ type: z.literal("run.start"),
35
+ payload: z.object({
36
+ runId: runtimeIdentifier,
37
+ traceId: runtimeIdentifier,
38
+ agentVersionId: runtimeIdentifier,
39
+ organizationId: runtimeIdentifier,
40
+ workspaceId: runtimeIdentifier,
41
+ runtimeId: runtimeIdentifier,
42
+ manifest: AgentManifestSchema
43
+ }).passthrough()
44
+ }).strict().superRefine((command, context) => {
45
+ if (command.payload.runId !== command.runId) context.addIssue({
46
+ code: z.ZodIssueCode.custom,
47
+ message: "Runtime command run identity does not match its payload",
48
+ path: ["payload", "runId"]
49
+ });
50
+ });
51
+ const runtimeLeaseResponseSchema = z.object({ command: RuntimeCommandSchema }).strict();
52
+ const runtimeRenewalResponseSchema = z.object({
53
+ leaseExpiresAt: z.number().int().positive(),
54
+ cancelRequested: z.boolean()
55
+ }).strict();
56
+ var PlatformRuntimeClient = class {
57
+ agentApi;
58
+ constructor(discovery, token, fetchImpl = fetch) {
59
+ this.token = token;
60
+ this.fetchImpl = fetchImpl;
61
+ if (!discovery.capabilities.runtimeFleet || !discovery.endpoints.agentApi) throw new Error("Connected platform does not provide a runtime fleet");
62
+ this.agentApi = discovery.endpoints.agentApi.replace(/\/+$/, "");
63
+ if (!token.startsWith("xopc_rt_")) throw new Error("Invalid platform runtime token");
64
+ }
65
+ async request(path, body) {
66
+ return this.fetchImpl(`${this.agentApi}${path}`, {
67
+ method: "POST",
68
+ headers: {
69
+ authorization: `Bearer ${this.token}`,
70
+ "content-type": "application/json",
71
+ accept: "application/json"
72
+ },
73
+ body: JSON.stringify(body),
74
+ signal: AbortSignal.timeout(3e4)
75
+ });
76
+ }
77
+ async heartbeat(input = {}) {
78
+ const response = await this.request("/heartbeat", input);
79
+ if (!response.ok) throw new Error(`Runtime heartbeat failed with HTTP ${response.status}`);
80
+ return await responseJson(response);
81
+ }
82
+ async lease(leaseSeconds = 30) {
83
+ const response = await this.request("/lease", { leaseSeconds });
84
+ if (response.status === 204) return null;
85
+ if (!response.ok) throw new Error(`Runtime lease failed with HTTP ${response.status}`);
86
+ return runtimeLeaseResponseSchema.parse(await responseJson(response)).command;
87
+ }
88
+ async report(event, leaseToken) {
89
+ const response = await this.request("/events", {
90
+ event: PlatformEventSchema.parse(event),
91
+ leaseToken
92
+ });
93
+ if (!response.ok) throw new Error(`Runtime event failed with HTTP ${response.status}`);
94
+ const value = await responseJson(response);
95
+ if (value?.status !== "accepted" && value?.status !== "duplicate") throw new Error("Runtime event response is incomplete");
96
+ return value.status;
97
+ }
98
+ async renew(commandId, leaseToken, leaseSeconds = 60) {
99
+ const response = await this.request(`/commands/${encodeURIComponent(commandId)}/renew`, {
100
+ leaseToken,
101
+ leaseSeconds
102
+ });
103
+ if (!response.ok) throw new Error(`Runtime lease renewal failed with HTTP ${response.status}`);
104
+ return runtimeRenewalResponseSchema.parse(await responseJson(response));
105
+ }
106
+ };
107
+ //#endregion
108
+ export { PLATFORM_RUNTIME_PROFILE, PLATFORM_RUNTIME_PROVIDER, PlatformRuntimeClient, RuntimeCommandSchema, discoverPlatform };