@xopcai/xopc 0.0.333 → 0.0.334
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.
- package/dist/browser-ext/dist/assets/{auth-DocRzRlS.js → auth-Cjj5SuoT.js} +49 -39
- package/dist/browser-ext/dist/background.js +1 -1
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +240 -36
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DiI2O7lC.js → agent-avatar-dicebear-B73q7mlz.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-CVp3J969.js → agent-defaults-settings-panel-B9L2YIXz.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-CacyndrS.js → agent-plugin-dialog-COOjsvea.js} +1 -1
- package/dist/gateway/static/root/assets/agents-CCj1JnLu.js +70 -0
- package/dist/gateway/static/root/assets/agents-admin-api-Cuqi5xZn.js +2 -0
- package/dist/gateway/static/root/assets/{app-link-C6gA5Nck.js → app-link-DRL0YnPs.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BcszTlqr.js → app-management-settings-panel-CckioKud.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-B1XPe8qz.js → appearance-settings-DDiPIr_Q.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Azqy8vfo.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-MjUsJcNb.js → archive-plugin-Dtyr0RhX.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-load-qjPpQzYY.js +1 -0
- package/dist/gateway/static/root/assets/attachment-utils-core-BIOUBrpT.js +1 -0
- package/dist/gateway/static/root/assets/{automations-page-Dsjivdxs.js → automations-page-g3SrFkTC.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-B0nW2nZD.js +7 -0
- package/dist/gateway/static/root/assets/binary-plugins-BwKQVxsU.js +2 -0
- package/dist/gateway/static/root/assets/{block-editor-Bx0uXbJP.js → block-editor-DD9d5pCt.js} +29 -29
- package/dist/gateway/static/root/assets/{browser-automation-inputs-1ZIPGDeq.js → browser-automation-inputs-D2gNdS3e.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CCjYipHc.js → browser-automations-page-BKqqJR7P.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-BZH9bZbk.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-CHk4RZl4.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-CfWaVH-6.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C5FcWsSe.js +8 -0
- package/dist/gateway/static/root/assets/capability-header-actions-Bd66yEOa.js +1 -0
- package/dist/gateway/static/root/assets/channels-DIU5Gq4o.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Fnum_IEm.js → chat-terminal-dock-B0nPDJyj.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-DI1zfCTA.js → computer-settings-page-D7PxxaoG.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-CiGDAubm.js → connector-service-page-BZH4SeQg.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BC81R_fz.js +2 -0
- package/dist/gateway/static/root/assets/{turn-outcome-D0SnyZ3Z.js → constants-Co2_smKQ.js} +1 -1
- package/dist/gateway/static/root/assets/date-picker-CDEVYjXI.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-DpD3xaEB.js → dependency-picker-AInmpSwC.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CCoDxKqh.js → desktop-pet-Sjgnlq8M.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-GxndKfCx.js → desktop-pet-settings-BWn0rrhr.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-B71w3ptm.js → device-pairing-wizard-BtW837_d.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CUzjJvjs.js → directory-picker-path-field-2CpmDx_D.js} +1 -1
- package/dist/gateway/static/root/assets/dist-CKkafhaS.js +1 -0
- package/dist/gateway/static/root/assets/dist-io9jFpN72.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BtDY8ntX.js → extension-debug-page-WWJFj9Z5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D9_XF-XC.js → extension-page-DL00dFRr.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CjhUFAaC.js → extension-settings-page-CN-agjPk.js} +1 -1
- package/dist/gateway/static/root/assets/{files-BK6enEvD.js → files-Bw4SBGdM.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-Ciq4c7KT.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-BHeHN26R.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-4oD6fhAm.js +1 -0
- package/dist/gateway/static/root/assets/home-page-nEpyJUBY.js +1 -0
- package/dist/gateway/static/root/assets/{imports-page-BEtq5BRU.js → imports-page-BivdeiQ5.js} +1 -1
- package/dist/gateway/static/root/assets/index-BioG1pRD.js +106 -0
- package/dist/gateway/static/root/assets/index-DbLEkdNg.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-JUYY_18v.js → keyboard-shortcuts-settings-B_8AJTFr.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CRtZQrmz.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BlYESNqz.js → local-apps-page-DclxpoqR.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-Bpja8nC6.js → local-apps-yys1VChX.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-DkolHmyp.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-DX8TxkRl.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-c4krhYU7.js → management-settings-5WFufZ4g.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BEeXMfDw.js → markdown-view-DYJnwlDr.js} +1 -1
- package/dist/gateway/static/root/assets/media-plugins-DlJDvwLK.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-GF5Q9Fqy.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-E8o4_Ty9.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-CiCmfRTw.js +1 -0
- package/dist/gateway/static/root/assets/{page-tabs-BhYBCqls.js → page-tabs-Cwp3fGVM.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-0p9PIHRy.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CP8agNlc.js → preview-open-alternatives-DJ5xqGeu.js} +1 -1
- package/dist/gateway/static/root/assets/{product-delivery-bv3z8Xkh.js → product-delivery-BAks11S4.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CU7fRhfT.js → product-open-page-CcGwNePw.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-6hhRBkmC.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DUOzRaFI.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BWpWUXiE.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Czvzsuj_.js → runtime-tools-settings-panel-C6eDCNHz.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-pF7Lmqnk.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-B9Ni5O93.js → schema-form-D8W8q_ez.js} +1 -1
- package/dist/gateway/static/root/assets/{schemas-88fK3zzl.js → schemas-CObaziC7.js} +3 -3
- package/dist/gateway/static/root/assets/session-api-BAyUr97V.js +1 -0
- package/dist/gateway/static/root/assets/session-manager-BAy2sR2Q.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-BDKDqqf9.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-C9cJWlAq.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-jquf1P7n.js → settings-form-section-B0cAj0nq.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DPomsvba.js → settings-page-DZVVTFxs.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DZCPVx9c.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-BkPNyV8c.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-Bqlv5JBi.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-Bu7-3w-L.js → skill-api-C0dufzQC.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-3JF2OTBz.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DB4lR4om.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BwFR0Uci.js → system-settings-panel-xjrlhdUz.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-CB6M7wSs.js +1 -0
- package/dist/gateway/static/root/assets/{tasks-CDR_RVbQ.js → tasks-QQJXsiER.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-PfucxMP3.js → tunnel-api--68MQEWM.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-t_zdQHcy.js → usage-page-OLZ00eqD.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DLyy2wHz.js → use-autosave-DsnHYpTv.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CoePFpHD.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CQDY5EBK.js → voice-api-key-field-CvIXutQp.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CJzqJ47I.js → work-discovery-overlay-By5_7MLR.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-sCOk-esV.js → workflow-run-setup-panel-HSMDxDXV.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DElQ47Da.js +6 -0
- package/dist/gateway/static/root/index.html +24 -18
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/capabilities.js +14 -2
- package/dist/packages/gateway-contract/src/index.js +6 -2
- package/dist/packages/gateway-contract/src/session-command-rejection.js +19 -0
- package/dist/packages/gateway-contract/src/session-input-command.js +109 -0
- package/dist/packages/gateway-contract/src/sessions.js +0 -6
- package/dist/src/agent/agent-manager.js +6 -6
- package/dist/src/agent/background-review/run-background-review.js +2 -2
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/external-tools/gateway-tools.js +2 -1
- package/dist/src/agent/image/tool-model-config.js +2 -2
- package/dist/src/agent/service/process-direct-streaming.js +4 -2
- package/dist/src/agent/service.js +4 -4
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tools/xopc-use-tool.js +1 -1
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +1 -1
- package/dist/src/auth/oauth-provider-lock.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/write.d.ts +11 -11
- package/dist/src/automations/domain/validation.d.ts +11 -11
- package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +2 -2
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +2 -2
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/computer/runtime.js +1 -1
- package/dist/src/config/index.js +5 -5
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.js +1 -1
- package/dist/src/connectors/cli/authorization.d.ts +1 -1
- package/dist/src/connectors/cli/store.d.ts +1 -1
- package/dist/src/connectors/connection-candidates.js +53 -15
- package/dist/src/connectors/connection-capabilities.js +5 -1
- package/dist/src/execution-environments/local-worktree-manager.js +10 -1
- package/dist/src/execution-environments/session-environment-service.d.ts +3 -0
- package/dist/src/execution-environments/session-environment-service.js +28 -4
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +6 -2
- package/dist/src/gateway/hono/routes/browser-session.js +4 -2
- package/dist/src/gateway/hono/routes/commands-skills.js +9 -2
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/files.js +3 -0
- package/dist/src/gateway/hono/routes/models.js +17 -1
- package/dist/src/gateway/hono/routes/notes.js +2 -4
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-command-handler.d.ts +5 -0
- package/dist/src/gateway/hono/routes/session-command-handler.js +189 -0
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +14 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
- package/dist/src/gateway/hono/routes/sessions.js +0 -168
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/tui.js +2 -1
- package/dist/src/gateway/hono/routes/voice.js +9 -0
- package/dist/src/gateway/image-generation-setup.js +2 -2
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/resolve-webchat-session-key.d.ts +1 -1
- package/dist/src/gateway/resolve-webchat-session-key.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service/session-command-service.d.ts +34 -0
- package/dist/src/gateway/service/session-command-service.js +81 -0
- package/dist/src/gateway/service/session-input-coordinator.d.ts +21 -0
- package/dist/src/gateway/service/session-input-coordinator.js +41 -0
- package/dist/src/gateway/service/session-preparation-worker.d.ts +15 -0
- package/dist/src/gateway/service/session-preparation-worker.js +125 -0
- package/dist/src/gateway/service.d.ts +24 -0
- package/dist/src/gateway/service.js +27 -14
- package/dist/src/gateway/side-chat/promotion-service.js +0 -1
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/generator.js +1 -1
- package/dist/src/home-intelligence/host.js +1 -1
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/mcp/channel-bridge.js +12 -2
- package/dist/src/notes/capabilities/read.js +2 -2
- package/dist/src/notes/service.d.ts +4 -1
- package/dist/src/notes/service.js +11 -8
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/session/store.js +0 -1
- package/dist/src/storage/sqlite/migrations/223_session_creation_receipts.sql +59 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-creation-repository.d.ts +50 -0
- package/dist/src/storage/sqlite/session-creation-repository.js +166 -0
- package/dist/src/storage/sqlite/session-input-repository.d.ts +4 -2
- package/dist/src/storage/sqlite/session-input-repository.js +7 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tui/backends/embedded-backend.d.ts +5 -0
- package/dist/src/tui/backends/embedded-backend.js +266 -20
- package/dist/src/tui/backends/embedded-drafts.d.ts +22 -0
- package/dist/src/tui/backends/embedded-drafts.js +53 -0
- package/dist/src/tui/backends/gateway-realtime-backend.d.ts +10 -0
- package/dist/src/tui/backends/gateway-realtime-backend.js +214 -33
- package/dist/src/tui/tui-backend.d.ts +1 -1
- package/dist/src/tui/tui-chat-input-state.d.ts +1 -0
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-session-format.js +0 -1
- package/dist/src/tui/tui-startup-resources.d.ts +1 -0
- package/dist/src/tui/tui-startup-resources.js +2 -2
- package/dist/src/tui/tui-types.d.ts +0 -1
- package/dist/src/tui/tui.js +69 -29
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/work-discovery/service.js +3 -6
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/agents-DXYZSuUV.js +0 -70
- package/dist/gateway/static/root/assets/apps-page-ZqANbUZv.js +0 -1
- package/dist/gateway/static/root/assets/attachment-load-DHa-BI9a.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-B37vs5tk.js +0 -7
- package/dist/gateway/static/root/assets/binary-plugins-DQYcuBHP.js +0 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CSv4rvmx.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-BnO9LV7U.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-BfvDvIY1.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CoW7-ESq.js +0 -8
- package/dist/gateway/static/root/assets/capability-header-actions-D_hbWRRF.js +0 -1
- package/dist/gateway/static/root/assets/channels-BhMaRh1x.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Ono0Pha1.js +0 -2
- package/dist/gateway/static/root/assets/conversation-identity-Cw0n9uzK.js +0 -1
- package/dist/gateway/static/root/assets/date-picker-D-JhzZyW.js +0 -1
- package/dist/gateway/static/root/assets/dist-3h6cXXhT.js +0 -1
- package/dist/gateway/static/root/assets/dist-Che_jiQF.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BWaCnwT1.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BTjGLngn.js +0 -1
- package/dist/gateway/static/root/assets/index-DHL16aYZ.js +0 -121
- package/dist/gateway/static/root/assets/index-N1e6PDwx.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-uI7mtoVz.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-BbLQreeN.js +0 -2
- package/dist/gateway/static/root/assets/media-plugins-DEFN1I73.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel--09xGxyE.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-DsxcVBXF.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-D43aVpCj.js +0 -1
- package/dist/gateway/static/root/assets/popover-select-DcsFzD_i.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-U-EdDfAW.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DUOKZLt7.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-fVPQe5YS.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-C0-WHOY3.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-DdXvW09N.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BtF83fBY.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BvVlqpHf.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-b9DI0N1J.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-R_qwc4DN.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CNJAQ_e-.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-D7XPEQu_.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-PFjGW2g1.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-OyfPVfB9.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-DYBGjN7C.js +0 -6
- package/dist/src/tui/tui-empty-session-cleanup.d.ts +0 -9
- package/dist/src/tui/tui-empty-session-cleanup.js +0 -19
- /package/dist/gateway/static/root/assets/{dist-CI_fqRk-.js → dist-CI_fqRk-2.js} +0 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { createLogger } from "../../../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../../../utils/logger.js";
|
|
3
|
+
import { conversationIdSchema } from "../../../../packages/gateway-contract/src/conversation-identity.js";
|
|
4
|
+
import { sessionInputCommandSchema, sessionMaterializeCommandSchema } from "../../../../packages/gateway-contract/src/session-input-command.js";
|
|
5
|
+
import { parseUserTurnDocument, userTurnDocumentRefIds } from "../../../../packages/gateway-contract/src/user-turn-document.js";
|
|
6
|
+
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
7
|
+
import { endpointTurnClaimSchema, init_src as init_src$1 } from "../../../../packages/endpoint-tools-protocol/src/index.js";
|
|
8
|
+
import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
|
|
9
|
+
import { parseSlashCommand } from "../../../chat-commands/command-parse.js";
|
|
10
|
+
import { commandRegistry } from "../../../chat-commands/registry.js";
|
|
11
|
+
import "../../../chat-commands/index.js";
|
|
12
|
+
import { isVoiceLikeAttachment } from "../../../channels/attachments/voice-stt-webchat.js";
|
|
13
|
+
import { SessionCommandError, getSessionInputReceipt, isConversationDeleted, retrySessionPreparation } from "../../../storage/sqlite/session-creation-repository.js";
|
|
14
|
+
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
15
|
+
import { browserPageContextToAgentContext } from "../../../agent/source-context/browser-page.js";
|
|
16
|
+
import { receiveSessionCommand, sessionCommandSnapshot } from "../../service/session-command-service.js";
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
//#region src/gateway/hono/routes/session-command-handler.ts
|
|
19
|
+
init_src();
|
|
20
|
+
init_src$1();
|
|
21
|
+
init_logger();
|
|
22
|
+
const log = createLogger("Gateway:SessionCommand");
|
|
23
|
+
function commandError(c, error) {
|
|
24
|
+
if (error instanceof SessionCommandError) {
|
|
25
|
+
const status = error.code === "BAD_REQUEST" ? 400 : error.code === "SESSION_DELETED" ? 410 : error.code === "FORBIDDEN" ? 403 : error.code === "NOT_FOUND" ? 404 : 409;
|
|
26
|
+
return c.json({
|
|
27
|
+
ok: false,
|
|
28
|
+
error: {
|
|
29
|
+
code: error.code,
|
|
30
|
+
message: error.message
|
|
31
|
+
}
|
|
32
|
+
}, status);
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
async function handleSessionCommand(c, deps, materialize = false) {
|
|
37
|
+
const id = conversationIdSchema.safeParse(c.req.param("conversationId"));
|
|
38
|
+
const body = await c.req.json().catch(() => null);
|
|
39
|
+
const parsed = materialize ? sessionMaterializeCommandSchema.safeParse(body) : sessionInputCommandSchema.safeParse(body);
|
|
40
|
+
if (!id.success || !parsed.success) return c.json({
|
|
41
|
+
ok: false,
|
|
42
|
+
error: {
|
|
43
|
+
code: "BAD_REQUEST",
|
|
44
|
+
message: "Invalid session command"
|
|
45
|
+
}
|
|
46
|
+
}, 400);
|
|
47
|
+
const command = parsed.data;
|
|
48
|
+
const principal = getGatewayPrincipal(c);
|
|
49
|
+
if ("input" in command) {
|
|
50
|
+
const origin = command.origin.type === "endpoint" ? endpointTurnClaimSchema.safeParse(command.origin) : null;
|
|
51
|
+
if (origin && (!origin.success || !deps.service.endpointTools.registry.verifyTurnClaim(origin.data.endpointId, origin.data.token))) return c.json({
|
|
52
|
+
ok: false,
|
|
53
|
+
error: {
|
|
54
|
+
code: "INVALID_ENDPOINT",
|
|
55
|
+
message: "Endpoint connection is not active"
|
|
56
|
+
}
|
|
57
|
+
}, 401);
|
|
58
|
+
if (!origin && principal.kind !== "owner") return c.json({
|
|
59
|
+
ok: false,
|
|
60
|
+
error: {
|
|
61
|
+
code: "FORBIDDEN",
|
|
62
|
+
message: "CLI input requires owner authentication"
|
|
63
|
+
}
|
|
64
|
+
}, 403);
|
|
65
|
+
if (command.input.browserContexts?.length && (!origin?.success || deps.service.endpointTools.registry.get(origin.data.endpointId)?.kind !== "browser")) return c.json({
|
|
66
|
+
ok: false,
|
|
67
|
+
error: {
|
|
68
|
+
code: "FORBIDDEN",
|
|
69
|
+
message: "Browser context requires a browser endpoint"
|
|
70
|
+
}
|
|
71
|
+
}, 403);
|
|
72
|
+
const inputError = validateWebchatContent(command.input.content) ?? validateWebchatAttachments(command.input.attachments);
|
|
73
|
+
if (inputError) return c.json({
|
|
74
|
+
ok: false,
|
|
75
|
+
error: {
|
|
76
|
+
code: "BAD_REQUEST",
|
|
77
|
+
message: inputError
|
|
78
|
+
}
|
|
79
|
+
}, 400);
|
|
80
|
+
const document = parseUserTurnDocument(command.input.content);
|
|
81
|
+
const refs = new Set((command.input.contextRefs ?? []).flatMap((ref) => ref.refId ? [ref.refId] : []));
|
|
82
|
+
if (document && !userTurnDocumentRefIds(document).every((ref) => refs.has(ref))) return c.json({
|
|
83
|
+
ok: false,
|
|
84
|
+
error: {
|
|
85
|
+
code: "BAD_REQUEST",
|
|
86
|
+
message: "Input contains an unknown context reference"
|
|
87
|
+
}
|
|
88
|
+
}, 400);
|
|
89
|
+
const slash = parseSlashCommand(command.input.content);
|
|
90
|
+
if (slash && commandRegistry.has(slash.command) && command.input.attachments?.some((attachment) => !isVoiceLikeAttachment(attachment))) return c.json({
|
|
91
|
+
ok: false,
|
|
92
|
+
error: {
|
|
93
|
+
code: "BAD_REQUEST",
|
|
94
|
+
message: "Slash commands do not accept file or image attachments."
|
|
95
|
+
}
|
|
96
|
+
}, 400);
|
|
97
|
+
if (!command.input.content.trim() && !command.input.attachments?.length && !command.input.contextRefs?.length && !command.input.browserContexts?.length && !command.input.appContext) return c.json({
|
|
98
|
+
ok: false,
|
|
99
|
+
error: {
|
|
100
|
+
code: "BAD_REQUEST",
|
|
101
|
+
message: "Input is empty"
|
|
102
|
+
}
|
|
103
|
+
}, 400);
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const payload = await receiveSessionCommand(deps.service, id.data, principal.principalId, command, async () => {
|
|
107
|
+
if (!("input" in command)) return [];
|
|
108
|
+
const contexts = (command.input.browserContexts ?? []).map(browserPageContextToAgentContext);
|
|
109
|
+
if (command.input.appContext) contexts.push(await deps.service.prepareSessionAppContext(command.input.appContext, principal, id.data, command.clientMessageId));
|
|
110
|
+
return contexts;
|
|
111
|
+
});
|
|
112
|
+
deps.service.emit("session.input-state", payload.inputState);
|
|
113
|
+
if ("kind" in command && command.kind === "start") deps.service.emit("session.updated", { key: id.data });
|
|
114
|
+
if (payload.receipt.lifecycle === "preparing") deps.service.sessionPreparations.wake(id.data);
|
|
115
|
+
else if (payload.receipt.lifecycle === "ready") deps.service.drainSessionInputs(id.data).catch((err) => {
|
|
116
|
+
log.error({
|
|
117
|
+
err,
|
|
118
|
+
conversationId: id.data
|
|
119
|
+
}, "Accepted session input drain failed");
|
|
120
|
+
});
|
|
121
|
+
return c.json({
|
|
122
|
+
ok: true,
|
|
123
|
+
payload
|
|
124
|
+
}, 202);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
return commandError(c, error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async function handleSessionInputReceipt(c, deps) {
|
|
130
|
+
const id = conversationIdSchema.safeParse(c.req.param("conversationId"));
|
|
131
|
+
if (!id.success) return c.json({
|
|
132
|
+
ok: false,
|
|
133
|
+
error: {
|
|
134
|
+
code: "BAD_REQUEST",
|
|
135
|
+
message: "Invalid conversation identity"
|
|
136
|
+
}
|
|
137
|
+
}, 400);
|
|
138
|
+
try {
|
|
139
|
+
const receipt = getSessionInputReceipt(id.data, c.req.param("clientMessageId"), getGatewayPrincipal(c).principalId);
|
|
140
|
+
if (!receipt) return c.json({
|
|
141
|
+
ok: false,
|
|
142
|
+
error: {
|
|
143
|
+
code: "NOT_RECEIVED",
|
|
144
|
+
message: "Input has not been received"
|
|
145
|
+
}
|
|
146
|
+
}, 404);
|
|
147
|
+
if (isConversationDeleted(id.data)) return c.json({
|
|
148
|
+
ok: false,
|
|
149
|
+
error: {
|
|
150
|
+
code: "SESSION_DELETED",
|
|
151
|
+
message: "Conversation was deleted"
|
|
152
|
+
}
|
|
153
|
+
}, 410);
|
|
154
|
+
return c.json({
|
|
155
|
+
ok: true,
|
|
156
|
+
payload: await sessionCommandSnapshot(deps.service, receipt)
|
|
157
|
+
});
|
|
158
|
+
} catch (error) {
|
|
159
|
+
return commandError(c, error);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const preparationRetrySchema = z.strictObject({
|
|
163
|
+
operationId: z.string().uuid(),
|
|
164
|
+
expectedRevision: z.number().int().positive(),
|
|
165
|
+
idempotencyKey: z.string().min(1).max(128)
|
|
166
|
+
});
|
|
167
|
+
async function handleSessionPreparationRetry(c, deps) {
|
|
168
|
+
const id = conversationIdSchema.safeParse(c.req.param("conversationId"));
|
|
169
|
+
const parsed = preparationRetrySchema.safeParse(await c.req.json().catch(() => null));
|
|
170
|
+
if (!id.success || !parsed.success) return c.json({
|
|
171
|
+
ok: false,
|
|
172
|
+
error: {
|
|
173
|
+
code: "BAD_REQUEST",
|
|
174
|
+
message: "Invalid preparation retry"
|
|
175
|
+
}
|
|
176
|
+
}, 400);
|
|
177
|
+
try {
|
|
178
|
+
const preparation = retrySessionPreparation(id.data, getGatewayPrincipal(c).principalId, parsed.data);
|
|
179
|
+
deps.service.sessionPreparations.wake(id.data);
|
|
180
|
+
return c.json({
|
|
181
|
+
ok: true,
|
|
182
|
+
payload: { preparation }
|
|
183
|
+
}, 202);
|
|
184
|
+
} catch (error) {
|
|
185
|
+
return commandError(c, error);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
export { handleSessionCommand, handleSessionInputReceipt, handleSessionPreparationRetry };
|
|
@@ -20,13 +20,19 @@ export declare function submitSessionInput(c: Context, deps: AuthenticatedRouteD
|
|
|
20
20
|
code: string;
|
|
21
21
|
message: string;
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, 400 | 409 | 403, "json">) | (Response & import("hono").TypedResponse<{
|
|
24
24
|
ok: true;
|
|
25
25
|
payload: {
|
|
26
26
|
conversationId: string;
|
|
27
27
|
ok: true;
|
|
28
28
|
effectiveDelivery: import("../../../storage/sqlite/session-input-repository.js").SessionInputDelivery;
|
|
29
29
|
state: {
|
|
30
|
+
preparation?: {
|
|
31
|
+
operationId: string;
|
|
32
|
+
revision: number;
|
|
33
|
+
state: "ready" | "preparing" | "preparation_failed";
|
|
34
|
+
lastError?: string;
|
|
35
|
+
};
|
|
30
36
|
conversationId: string;
|
|
31
37
|
revision: number;
|
|
32
38
|
activeRunId?: string;
|
|
@@ -155,7 +161,7 @@ export declare function replaceLatestSessionTurn(c: Context, deps: Authenticated
|
|
|
155
161
|
}, 409, "json">) | (Response & import("hono").TypedResponse<{
|
|
156
162
|
ok: false;
|
|
157
163
|
error: {
|
|
158
|
-
code: "
|
|
164
|
+
code: "BAD_REQUEST" | "SESSION_BUSY" | "TARGET_NOT_FOUND" | "NOT_LATEST" | "CONTEXT_UNAVAILABLE";
|
|
159
165
|
message: string;
|
|
160
166
|
};
|
|
161
167
|
}, 404 | 400 | 409, "json">) | (Response & import("hono").TypedResponse<{
|
|
@@ -165,6 +171,12 @@ export declare function replaceLatestSessionTurn(c: Context, deps: Authenticated
|
|
|
165
171
|
ok: true;
|
|
166
172
|
effectiveDelivery: "next";
|
|
167
173
|
state: {
|
|
174
|
+
preparation?: {
|
|
175
|
+
operationId: string;
|
|
176
|
+
revision: number;
|
|
177
|
+
state: "ready" | "preparing" | "preparation_failed";
|
|
178
|
+
lastError?: string;
|
|
179
|
+
};
|
|
168
180
|
conversationId: string;
|
|
169
181
|
revision: number;
|
|
170
182
|
activeRunId?: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createLogger } from "../../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../../utils/logger.js";
|
|
3
|
-
import { parseUserTurnDocument, userTurnDocumentRefIds } from "../../../../packages/gateway-contract/src/user-turn-document.js";
|
|
4
3
|
import { browserPageContextsInputSchema } from "../../../../packages/gateway-contract/src/browser-page-context.js";
|
|
4
|
+
import { parseUserTurnDocument, userTurnDocumentRefIds } from "../../../../packages/gateway-contract/src/user-turn-document.js";
|
|
5
5
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
6
6
|
import { endpointTurnClaimSchema, init_src as init_src$1 } from "../../../../packages/endpoint-tools-protocol/src/index.js";
|
|
7
|
-
import { init_providers, resolveModel } from "../../../providers/index.js";
|
|
8
7
|
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
9
8
|
import "../../../capabilities/runtime/dispatcher.js";
|
|
9
|
+
import { init_providers, resolveModel } from "../../../providers/index.js";
|
|
10
10
|
import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
|
|
11
11
|
import { isTaskDestructiveCommand } from "../../../session/reset-triggers.js";
|
|
12
12
|
import { parseSlashCommand } from "../../../chat-commands/command-parse.js";
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { deleteBrowserTabBinding, init_browser_tab_binding_repository } from "../../../storage/sqlite/browser-tab-binding-repository.js";
|
|
2
|
-
import { conversationIdSchema } from "../../../../packages/gateway-contract/src/conversation-identity.js";
|
|
3
2
|
import { SessionDiscoveryQuerySchema } from "../../../../packages/gateway-contract/src/session-identity.js";
|
|
4
3
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
5
4
|
import "../../../session/types.js";
|
|
6
|
-
import { deleteSessionRecord, init_session_repository } from "../../../storage/sqlite/session-repository.js";
|
|
7
5
|
import { SidebarLayoutConflictError, getSidebarLayout, init_sidebar_layout_repository, replaceSidebarLayout, sortBySidebarLayout } from "../../../storage/sqlite/sidebar-layout-repository.js";
|
|
8
|
-
import { ConversationAlreadyExistsError, createConversation, init_conversation_repository } from "../../../storage/sqlite/conversation-repository.js";
|
|
9
|
-
import { resolveProjectAgentId } from "../../../projects/project-agent.js";
|
|
10
|
-
import "../../../projects/index.js";
|
|
11
6
|
import { messagesToClientHistory } from "../../../session/client-history.js";
|
|
12
7
|
import { evictEmbeddedSessionRunner } from "../../../agent/embedded/session-runner.js";
|
|
13
8
|
import { SessionEnvironmentService } from "../../../execution-environments/session-environment-service.js";
|
|
@@ -17,11 +12,8 @@ import { createGatewayRouteLogger, logRouteError } from "../lib/route-logger.js"
|
|
|
17
12
|
import { patchChatModelConfig } from "./chat-model-config.js";
|
|
18
13
|
import { getSessionContextSummary } from "../../session-context-summary.js";
|
|
19
14
|
import { respondStartupUnavailable } from "../lib/startup-unavailable.js";
|
|
20
|
-
import { randomUUID } from "node:crypto";
|
|
21
15
|
//#region src/gateway/hono/routes/sessions.ts
|
|
22
16
|
init_src();
|
|
23
|
-
init_conversation_repository();
|
|
24
|
-
init_session_repository();
|
|
25
17
|
init_browser_tab_binding_repository();
|
|
26
18
|
init_sidebar_layout_repository();
|
|
27
19
|
const log = createGatewayRouteLogger("Sessions");
|
|
@@ -36,9 +28,6 @@ const DEFAULT_SIDEBAR_STALE_DAYS = 60;
|
|
|
36
28
|
function isSessionType(value) {
|
|
37
29
|
return SESSION_TYPES.has(value);
|
|
38
30
|
}
|
|
39
|
-
function parseExecutionMode(value) {
|
|
40
|
-
return value === "local_checkout" || value === "managed_worktree" ? value : void 0;
|
|
41
|
-
}
|
|
42
31
|
function ensureGatewayReadyForSessions(c, service, method) {
|
|
43
32
|
if (service.isGatewayReady()) return null;
|
|
44
33
|
return respondStartupUnavailable(c, method);
|
|
@@ -71,26 +60,6 @@ function isHistoryCursor(value) {
|
|
|
71
60
|
if (!/^(0|[1-9]\d*)$/.test(value)) return false;
|
|
72
61
|
return Number.isSafeInteger(Number(value));
|
|
73
62
|
}
|
|
74
|
-
function buildDirectSessionMetadata(params) {
|
|
75
|
-
return {
|
|
76
|
-
sourceChannel: params.source,
|
|
77
|
-
sourceChatId: [
|
|
78
|
-
params.accountId,
|
|
79
|
-
"direct",
|
|
80
|
-
params.peerId
|
|
81
|
-
].join(":"),
|
|
82
|
-
sessionType: "chat",
|
|
83
|
-
hiddenFromSessionList: true,
|
|
84
|
-
routing: {
|
|
85
|
-
agentId: params.agentId,
|
|
86
|
-
source: params.source,
|
|
87
|
-
accountId: params.accountId,
|
|
88
|
-
peerKind: "direct",
|
|
89
|
-
peerId: params.peerId
|
|
90
|
-
},
|
|
91
|
-
customData: { genericNewChatShell: params.source === "webchat" && params.peerId.startsWith("chat_") }
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
63
|
function registerSessionsRoutes(authenticated, deps) {
|
|
95
64
|
const { service } = deps;
|
|
96
65
|
const environments = new SessionEnvironmentService();
|
|
@@ -288,143 +257,6 @@ function registerSessionsRoutes(authenticated, deps) {
|
|
|
288
257
|
throw error;
|
|
289
258
|
}
|
|
290
259
|
});
|
|
291
|
-
authenticated.post("/api/sessions", async (c) => {
|
|
292
|
-
const body = await c.req.json().catch(() => ({}));
|
|
293
|
-
if (body.conversationId !== void 0 && !conversationIdSchema.safeParse(body.conversationId).success) return c.json({
|
|
294
|
-
ok: false,
|
|
295
|
-
error: "conversationId must be a UUID"
|
|
296
|
-
}, 400);
|
|
297
|
-
const channel = typeof body.channel === "string" && body.channel.trim() ? body.channel.trim() : "webchat";
|
|
298
|
-
const projectId = typeof body.projectId === "string" && body.projectId.trim() ? body.projectId.trim() : void 0;
|
|
299
|
-
const routingCfg = service.currentConfig;
|
|
300
|
-
const project = projectId ? service.projects.get(projectId) : null;
|
|
301
|
-
if (projectId && !project) return c.json({
|
|
302
|
-
ok: false,
|
|
303
|
-
error: "Project not found"
|
|
304
|
-
}, 404);
|
|
305
|
-
const requestedExecutionMode = parseExecutionMode(body.executionMode);
|
|
306
|
-
if (body.executionMode !== void 0 && !requestedExecutionMode) return c.json({
|
|
307
|
-
ok: false,
|
|
308
|
-
error: "Invalid execution mode"
|
|
309
|
-
}, 400);
|
|
310
|
-
if (requestedExecutionMode && !project) return c.json({
|
|
311
|
-
ok: false,
|
|
312
|
-
error: "An execution mode requires a project"
|
|
313
|
-
}, 400);
|
|
314
|
-
let agentId;
|
|
315
|
-
try {
|
|
316
|
-
agentId = resolveProjectAgentId({
|
|
317
|
-
config: routingCfg,
|
|
318
|
-
projects: service.projects,
|
|
319
|
-
explicitAgentId: typeof body.agentId === "string" ? body.agentId : void 0,
|
|
320
|
-
projectId
|
|
321
|
-
});
|
|
322
|
-
} catch (error) {
|
|
323
|
-
return c.json({
|
|
324
|
-
ok: false,
|
|
325
|
-
error: error instanceof Error ? error.message : String(error)
|
|
326
|
-
}, 400);
|
|
327
|
-
}
|
|
328
|
-
const chatId = (typeof body.chat_id === "string" && body.chat_id.trim() ? body.chat_id.trim() : void 0) ?? `chat_${randomUUID()}`;
|
|
329
|
-
const metadata = {
|
|
330
|
-
agentId,
|
|
331
|
-
...buildDirectSessionMetadata({
|
|
332
|
-
agentId,
|
|
333
|
-
source: channel,
|
|
334
|
-
accountId: "default",
|
|
335
|
-
peerId: chatId
|
|
336
|
-
}),
|
|
337
|
-
...channel === "tui" ? {
|
|
338
|
-
hiddenFromSessionList: true,
|
|
339
|
-
customData: { genericNewChatShell: true }
|
|
340
|
-
} : {}
|
|
341
|
-
};
|
|
342
|
-
let conversationId;
|
|
343
|
-
try {
|
|
344
|
-
conversationId = createConversation(metadata, "", body.conversationId).key;
|
|
345
|
-
} catch (error) {
|
|
346
|
-
if (error instanceof ConversationAlreadyExistsError) return c.json({
|
|
347
|
-
ok: false,
|
|
348
|
-
error: error.message
|
|
349
|
-
}, 409);
|
|
350
|
-
throw error;
|
|
351
|
-
}
|
|
352
|
-
let environment;
|
|
353
|
-
if (project && (project.workspaceRoot?.trim() || requestedExecutionMode)) try {
|
|
354
|
-
environment = await environments.attach({
|
|
355
|
-
conversationId,
|
|
356
|
-
project,
|
|
357
|
-
mode: requestedExecutionMode,
|
|
358
|
-
baseRef: typeof body.baseRef === "string" ? body.baseRef : void 0
|
|
359
|
-
});
|
|
360
|
-
} catch (error) {
|
|
361
|
-
deleteSessionRecord(conversationId);
|
|
362
|
-
return c.json({
|
|
363
|
-
ok: false,
|
|
364
|
-
code: "execution_environment_unavailable",
|
|
365
|
-
error: error instanceof Error ? error.message : String(error)
|
|
366
|
-
}, 409);
|
|
367
|
-
}
|
|
368
|
-
try {
|
|
369
|
-
await service.sessionIndexInstance.saveMessages(conversationId, [], { metadata });
|
|
370
|
-
if (projectId) service.projects.attachSession(conversationId, projectId);
|
|
371
|
-
} catch (error) {
|
|
372
|
-
await service.sessions.delete(conversationId).catch(() => void 0);
|
|
373
|
-
await environments.release(conversationId).catch(() => void 0);
|
|
374
|
-
throw error;
|
|
375
|
-
}
|
|
376
|
-
const rawInitialConfig = body.initialAgentConfig && typeof body.initialAgentConfig === "object" ? body.initialAgentConfig : {};
|
|
377
|
-
const model = typeof rawInitialConfig.model === "string" && rawInitialConfig.model.trim() ? rawInitialConfig.model.trim() : void 0;
|
|
378
|
-
const thinkingLevel = typeof rawInitialConfig.thinkingLevel === "string" && rawInitialConfig.thinkingLevel.trim() ? rawInitialConfig.thinkingLevel.trim() : void 0;
|
|
379
|
-
const initialAgentConfig = {
|
|
380
|
-
...model ? { model } : {},
|
|
381
|
-
...thinkingLevel ? { thinkingLevel } : {},
|
|
382
|
-
...body.temporary === true ? { userContextMode: "temporary" } : {}
|
|
383
|
-
};
|
|
384
|
-
if (channel === "webchat" && model) {
|
|
385
|
-
const result = await service.sessions.initializeChatModel(conversationId, model, thinkingLevel);
|
|
386
|
-
if (!result.ok) {
|
|
387
|
-
await service.sessions.delete(conversationId).catch(() => void 0);
|
|
388
|
-
await environments.release(conversationId).catch((error) => {
|
|
389
|
-
log.warn({
|
|
390
|
-
err: error,
|
|
391
|
-
conversationId
|
|
392
|
-
}, "Invalid new session model and execution environment cleanup failed");
|
|
393
|
-
});
|
|
394
|
-
return c.json({
|
|
395
|
-
ok: false,
|
|
396
|
-
error: result.error
|
|
397
|
-
}, 400);
|
|
398
|
-
}
|
|
399
|
-
delete initialAgentConfig.model;
|
|
400
|
-
delete initialAgentConfig.thinkingLevel;
|
|
401
|
-
}
|
|
402
|
-
if (Object.keys(initialAgentConfig).length > 0) {
|
|
403
|
-
const result = await service.sessions.patchAgentConfig(conversationId, initialAgentConfig);
|
|
404
|
-
if (!result.ok) {
|
|
405
|
-
await service.sessions.delete(conversationId).catch(() => void 0);
|
|
406
|
-
await environments.release(conversationId).catch((error) => {
|
|
407
|
-
log.warn({
|
|
408
|
-
err: error,
|
|
409
|
-
conversationId
|
|
410
|
-
}, "Invalid new session config and execution environment cleanup failed");
|
|
411
|
-
});
|
|
412
|
-
return c.json({
|
|
413
|
-
ok: false,
|
|
414
|
-
error: result.error
|
|
415
|
-
}, 400);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
if (body.createdSurface === "browser_extension") await service.sessions.patch(conversationId, { customData: { createdSurface: "browser_extension" } });
|
|
419
|
-
const session = await service.sessions.getSession(conversationId);
|
|
420
|
-
const agentConfig = channel === "webchat" ? await service.sessions.getFixedAgentConfig(conversationId) : void 0;
|
|
421
|
-
return c.json({
|
|
422
|
-
conversationId,
|
|
423
|
-
session,
|
|
424
|
-
agentConfig,
|
|
425
|
-
...environment ? { environment } : {}
|
|
426
|
-
}, 201);
|
|
427
|
-
});
|
|
428
260
|
authenticated.get("/api/sessions", async (c) => {
|
|
429
261
|
const blocked = ensureGatewayReadyForSessions(c, service, "sessions.list");
|
|
430
262
|
if (blocked) return blocked;
|
|
@@ -5,9 +5,9 @@ import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
|
5
5
|
import { enqueueTaskChangedEvent, init_task_change_events } from "../../../tasks/task-change-events.js";
|
|
6
6
|
import { TaskRepository, init_task_repository } from "../../../tasks/task-repository.js";
|
|
7
7
|
import { TaskRunRepository, init_task_run_repository } from "../../../tasks/task-run-repository.js";
|
|
8
|
-
import { TaskConversationRepository } from "../../../tasks/task-conversation-repository.js";
|
|
9
8
|
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
10
9
|
import "../../../capabilities/runtime/dispatcher.js";
|
|
10
|
+
import { TaskConversationRepository } from "../../../tasks/task-conversation-repository.js";
|
|
11
11
|
import { TaskContextMutationOutputSchema } from "../../../tasks/capabilities/relations.js";
|
|
12
12
|
import { TaskDeleteOutputSchema } from "../../../tasks/capabilities/management.js";
|
|
13
13
|
import { TaskMutationOutputSchema } from "../../../tasks/capabilities/write.js";
|
|
@@ -3,7 +3,8 @@ import { collectTuiStartupResources } from "../../../tui/tui-startup-resources.j
|
|
|
3
3
|
function registerTuiRoutes(authenticated, deps) {
|
|
4
4
|
authenticated.get("/api/tui/startup-resources", (c) => {
|
|
5
5
|
const conversationId = c.req.query("conversationId")?.trim() || void 0;
|
|
6
|
-
const
|
|
6
|
+
const agentId = conversationId ? void 0 : c.req.query("agentId")?.trim();
|
|
7
|
+
const payload = collectTuiStartupResources(deps.service.currentConfig, conversationId, { agentId });
|
|
7
8
|
return c.json({
|
|
8
9
|
ok: true,
|
|
9
10
|
payload
|
|
@@ -14,6 +14,7 @@ import { mergeTtsConfigFromAppConfig } from "../../../voice/tts/merge-config.js"
|
|
|
14
14
|
import { listSttProvidersForApi } from "../../../voice/stt/list-providers.js";
|
|
15
15
|
import "../../../voice/tts/index.js";
|
|
16
16
|
import { withModelConfigLock } from "../../../session/model-config-lock.js";
|
|
17
|
+
import { getSessionPreparation } from "../../../storage/sqlite/session-creation-repository.js";
|
|
17
18
|
import { resolveOmniRoute } from "../../../voice/realtime/omniRoute.js";
|
|
18
19
|
import { VoiceSessionCreationError, resolveStreamingStt, resolveStreamingTts } from "../../../voice/realtime/runtime.js";
|
|
19
20
|
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
@@ -268,6 +269,14 @@ function registerVoiceRoutes(authenticated, deps) {
|
|
|
268
269
|
}
|
|
269
270
|
}, 400);
|
|
270
271
|
try {
|
|
272
|
+
const preparation = parsed.data.conversationId ? getSessionPreparation(parsed.data.conversationId) : void 0;
|
|
273
|
+
if (preparation && preparation.state !== "ready") return c.json({
|
|
274
|
+
ok: false,
|
|
275
|
+
error: {
|
|
276
|
+
code: "SESSION_PREPARING",
|
|
277
|
+
message: "Session environment is not ready"
|
|
278
|
+
}
|
|
279
|
+
}, 409);
|
|
271
280
|
if (action === "preflight") {
|
|
272
281
|
await service.voiceRealtime.preflight(parsed.data);
|
|
273
282
|
return c.json({ ok: true });
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { normalizeAgentId } from "../agent-catalog/id.js";
|
|
2
2
|
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
3
|
-
import { ConfigSchema, init_schema } from "../config/schema.js";
|
|
4
3
|
import { init_agent_scope } from "../agent/agent-scope.js";
|
|
4
|
+
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
5
|
+
import { ConfigSchema, init_schema } from "../config/schema.js";
|
|
5
6
|
import { resolveEffectiveAgentConfigForAgent } from "../config/agent-profile.js";
|
|
6
7
|
import { fetchWithTimeoutGuarded } from "../media-shared/http/provider-http.js";
|
|
7
8
|
import "../media-shared/http/index.js";
|
|
8
|
-
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
9
9
|
import { getImageGenerationProvider, listImageGenerationProvidersSummary } from "../agent/image/generation/provider-registry.js";
|
|
10
10
|
//#region src/gateway/image-generation-setup.ts
|
|
11
11
|
init_repository();
|
package/dist/src/gateway/lock.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
-
import net from "node:net";
|
|
5
4
|
import fs$1 from "node:fs/promises";
|
|
5
|
+
import net from "node:net";
|
|
6
6
|
import { homedir } from "os";
|
|
7
7
|
//#region src/gateway/lock.ts
|
|
8
8
|
/**
|
|
@@ -10,6 +10,6 @@ export type ResolveWebchatConversationIdResult = {
|
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Resolve the server-owned session key for webchat `/api/agent` requests.
|
|
13
|
-
*
|
|
13
|
+
* Ordinary creation is accepted atomically by a start input command.
|
|
14
14
|
*/
|
|
15
15
|
export declare function resolveWebchatConversationId(input: ResolveWebchatConversationIdInput): ResolveWebchatConversationIdResult;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
//#region src/gateway/resolve-webchat-session-key.ts
|
|
2
2
|
/**
|
|
3
3
|
* Resolve the server-owned session key for webchat `/api/agent` requests.
|
|
4
|
-
*
|
|
4
|
+
* Ordinary creation is accepted atomically by a start input command.
|
|
5
5
|
*/
|
|
6
6
|
function resolveWebchatConversationId(input) {
|
|
7
7
|
const raw = input.conversationId?.trim() ?? "";
|
|
8
8
|
if (!raw) return {
|
|
9
9
|
ok: false,
|
|
10
|
-
error: "Missing conversationId
|
|
10
|
+
error: "Missing conversationId"
|
|
11
11
|
};
|
|
12
12
|
return {
|
|
13
13
|
ok: true,
|
|
@@ -51,7 +51,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
51
51
|
if (resolved.ok === false) throw new Error(resolved.error);
|
|
52
52
|
webchatConversationId = resolved.conversationId;
|
|
53
53
|
const meta = await sessionIndex.getSessionMetadata(webchatConversationId);
|
|
54
|
-
if (!meta) throw new Error("Session not found;
|
|
54
|
+
if (!meta) throw new Error("Session not found; submit a start input command first");
|
|
55
55
|
webchatTranscriptId = meta?.transcriptId;
|
|
56
56
|
webchatMetadata = meta;
|
|
57
57
|
runAbortControllers.set(runId, new AbortController());
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SessionInputCommand, SessionMaterializeCommand } from '@xopcai/gateway-contract';
|
|
2
|
+
import type { AgentSourceContext } from '../../agent/source-context/types.js';
|
|
3
|
+
import { type SessionInputReceipt } from '../../storage/sqlite/session-creation-repository.js';
|
|
4
|
+
import type { GatewayService } from '../service.js';
|
|
5
|
+
export declare function receiveSessionCommand(service: GatewayService, conversationId: string, principalId: string, command: SessionInputCommand | SessionMaterializeCommand, prepareSourceContexts?: () => Promise<AgentSourceContext[]>): Promise<{
|
|
6
|
+
receipt: {
|
|
7
|
+
lifecycle: import("@xopcai/gateway-contract").SessionPreparationState;
|
|
8
|
+
conversationId: string;
|
|
9
|
+
clientMessageId: string;
|
|
10
|
+
inputId: string | null;
|
|
11
|
+
transcriptId: string;
|
|
12
|
+
acceptedAt: number;
|
|
13
|
+
};
|
|
14
|
+
session: import("../../session/types.js").SessionDetail;
|
|
15
|
+
agentConfig: import("../../agent/session/session-inspector.js").SessionAgentConfigView;
|
|
16
|
+
inputState: import("../../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
17
|
+
effectiveDelivery: import("../../storage/sqlite/session-input-repository.js").SessionInputDelivery;
|
|
18
|
+
preparation: import("../../storage/sqlite/session-creation-repository.js").SessionPreparation;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function sessionCommandSnapshot(service: GatewayService, receipt: SessionInputReceipt): Promise<{
|
|
21
|
+
receipt: {
|
|
22
|
+
lifecycle: import("@xopcai/gateway-contract").SessionPreparationState;
|
|
23
|
+
conversationId: string;
|
|
24
|
+
clientMessageId: string;
|
|
25
|
+
inputId: string | null;
|
|
26
|
+
transcriptId: string;
|
|
27
|
+
acceptedAt: number;
|
|
28
|
+
};
|
|
29
|
+
session: import("../../session/types.js").SessionDetail;
|
|
30
|
+
agentConfig: import("../../agent/session/session-inspector.js").SessionAgentConfigView;
|
|
31
|
+
inputState: import("../../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
32
|
+
effectiveDelivery: import("../../storage/sqlite/session-input-repository.js").SessionInputDelivery;
|
|
33
|
+
preparation: import("../../storage/sqlite/session-creation-repository.js").SessionPreparation;
|
|
34
|
+
}>;
|