@xopcai/xopc 0.0.333 → 0.0.335
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-DtmNsTNI.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-CVp3J969.js → agent-defaults-settings-panel-AvGo9fao.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-CacyndrS.js → agent-plugin-dialog-DZCh4_E1.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Drt1vHf6.js +70 -0
- package/dist/gateway/static/root/assets/agents-admin-api-C82B1W9Z.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-IKZm5_s2.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-B1XPe8qz.js → appearance-settings-DKWGkrVW.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DY6Q7TMZ.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-MjUsJcNb.js → archive-plugin-DXGAt0G7.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-DzqfYcqe.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-qMpqvBz1.js +7 -0
- package/dist/gateway/static/root/assets/binary-plugins-Cy2FLsPv.js +2 -0
- package/dist/gateway/static/root/assets/{block-editor-Bx0uXbJP.js → block-editor-BqSpSNnv.js} +29 -29
- package/dist/gateway/static/root/assets/{browser-automation-inputs-1ZIPGDeq.js → browser-automation-inputs-CLOq1KtH.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CCjYipHc.js → browser-automations-page-BEeyiVEw.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-D6SygxnY.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-BfHgt4uk.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-C9Od0WN-.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-6HAVkNE4.js +8 -0
- package/dist/gateway/static/root/assets/capability-header-actions-CwcT7mjE.js +1 -0
- package/dist/gateway/static/root/assets/channels-D5HNBMLS.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Fnum_IEm.js → chat-terminal-dock-BsxTfU1T.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-DI1zfCTA.js → computer-settings-page-CH01h8yI.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-CiGDAubm.js → connector-service-page-CTi8iaOn.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-C3GhbPPg.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-DTEOeiC4.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-DpD3xaEB.js → dependency-picker-DFA0RZ02.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CCoDxKqh.js → desktop-pet-Txr49_Zi.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-GxndKfCx.js → desktop-pet-settings-Coi0DUai.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-B71w3ptm.js → device-pairing-wizard-OPY8ujCN.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CUzjJvjs.js → directory-picker-path-field-B1ckH4hn.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-6e8BCEb6.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D9_XF-XC.js → extension-page-DgaFykYf.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CjhUFAaC.js → extension-settings-page-B-TyR9GM.js} +1 -1
- package/dist/gateway/static/root/assets/{files-BK6enEvD.js → files-Bw4SBGdM.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-CgIjCxM8.js → gateway-config-swr-Hn1vj6uI.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-CGjSxzj6.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-DytaaEu8.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CtjGyqB2.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-i-1lTrwY.js → gateway-startup-retry-CtTVgB7_.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-Cs5fPXcJ.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-gilc-u7M.js → image-generation-api-DBA-bdEM.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BEtq5BRU.js → imports-page-C72wCY44.js} +1 -1
- package/dist/gateway/static/root/assets/index-BkSp_1Il.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-D1nzw6zI.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DqB0hGrZ.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BlYESNqz.js → local-apps-page-D4FX0Ptx.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-Byxxogdc.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-BY30D6tg.js → locale-store-7F4l6DRV.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CcWD_-zy.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-c4krhYU7.js → management-settings-L9YGzLaz.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BEeXMfDw.js → markdown-view-bxpOryax.js} +1 -1
- package/dist/gateway/static/root/assets/media-plugins-DqsiYyAz.js +1 -0
- package/dist/gateway/static/root/assets/{messages-_6IXbP2u.js → messages-DsUnS7rn.js} +2 -2
- package/dist/gateway/static/root/assets/note-detail-panel-DwK9Ndw1.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-D2FvAV9x.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-CeWnFomm.js +1 -0
- package/dist/gateway/static/root/assets/{page-tabs-BhYBCqls.js → page-tabs-B90ywILw.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-CwuY-FIE.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-CUcJOCAz.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Blo9-zcq.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-C9rh1U9Z.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BvVx0G1o.js → registry-api-DU915Prn.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Cw2Beq7s.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Czvzsuj_.js → runtime-tools-settings-panel-Cj8LnZRV.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-BZd4VZBP.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-B9Ni5O93.js → schema-form-CNbrdYAu.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-C7i3UFhq.js +1 -0
- package/dist/gateway/static/root/assets/session-manager-DAck_U0C.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-BKt3Cd0a.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BToasX5M.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-jquf1P7n.js → settings-form-section-u6ZXo3oJ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DPomsvba.js → settings-page-gXacaOIv.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-qKaz5drv.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-DdkQ-B5M.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-BwFn5CYE.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-Bu7-3w-L.js → skill-api-Cf3_ZQOb.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CdNp1N-Y.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-fKPvwSpa.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BwFR0Uci.js → system-settings-panel-CO3l1jdd.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-zClWGuT5.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-Dw6DW1j5.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-t_zdQHcy.js → usage-page-QP_8nuHU.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DLyy2wHz.js → use-autosave-ZwnXUpG4.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-B72PRFAI.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CQDY5EBK.js → voice-api-key-field-CbIxN5SC.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-Bwy3Al3J.js → voice-config-api-LKFent6f.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CJzqJ47I.js → work-discovery-overlay-WIGHfEL3.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-sCOk-esV.js → workflow-run-setup-panel-Bk0Jhdeq.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BC385JPr.js +6 -0
- package/dist/gateway/static/root/index.html +27 -21
- 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 +11 -6
- package/dist/src/agent/agent-instance-gateway.d.ts +0 -2
- package/dist/src/agent/agent-manager.d.ts +0 -2
- package/dist/src/agent/agent-manager.js +5 -36
- package/dist/src/agent/background-review/run-background-review.d.ts +0 -7
- package/dist/src/agent/background-review/run-background-review.js +3 -23
- 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/orchestration/agent-orchestrator.js +0 -3
- package/dist/src/agent/service/direct-turn-helpers.js +0 -3
- 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/automations/events/event-dispatcher.d.ts +10 -3
- package/dist/src/automations/service/automation-service.js +0 -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 +15 -169
- 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 +22 -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 +29 -16
- 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.d.ts +8 -1
- package/dist/src/home-intelligence/generator.js +26 -15
- package/dist/src/home-intelligence/host.d.ts +8 -1
- package/dist/src/home-intelligence/host.js +82 -8
- package/dist/src/home-intelligence/repository.d.ts +5 -1
- package/dist/src/home-intelligence/repository.js +16 -9
- package/dist/src/home-intelligence/snapshot.js +4 -4
- 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/ai-usage-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/ai-usage-repository.js +25 -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 +5 -5
- 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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { normalizeAgentId, validateAgentIdForNewAgent } from "../agent-catalog/id.js";
|
|
2
2
|
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
3
3
|
import { init_agent_scope, listAgentEntries, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath } from "../agent/agent-scope.js";
|
|
4
|
-
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
5
4
|
import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
6
5
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
7
|
-
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
8
6
|
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
7
|
+
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
8
|
+
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
9
9
|
import { GATEWAY_BUILTIN_TOOL_IDS } from "./agent-builtin-tools.js";
|
|
10
10
|
import { join, resolve } from "node:path";
|
|
11
11
|
import { mkdir, readFile, realpath, stat, unlink, writeFile } from "node:fs/promises";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
|
|
2
2
|
import { init_agent_scope, resolveAgentProfileDir } from "../agent/agent-scope.js";
|
|
3
|
-
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
4
3
|
import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
|
|
4
|
+
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
5
5
|
import { isBareProfileMarkdownFileName, resolveProfileMarkdownPathIfBareName } from "../agent/tools/tool-paths.js";
|
|
6
6
|
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
7
7
|
import { basename, isAbsolute, resolve } from "node:path";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { normalizeAgentId } from "../../../agent-catalog/id.js";
|
|
2
2
|
import { AgentCatalogRepository, init_repository } from "../../../agent-catalog/repository.js";
|
|
3
|
-
import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConfigSchema, init_config } from "../../../user-context/config.js";
|
|
4
3
|
import { init_agent_scope, listAgentEntries, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
5
4
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
5
|
+
import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConfigSchema, init_config } from "../../../user-context/config.js";
|
|
6
6
|
import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
|
|
7
7
|
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
8
8
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
@@ -2,7 +2,8 @@ import { parseUserTurnDocument, userTurnDocumentRefIds } from "../../../../packa
|
|
|
2
2
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
3
3
|
import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
|
|
4
4
|
import { parseTurnContextRefs } from "../../../agent/source-context/types.js";
|
|
5
|
-
import { replaceLatestSessionTurn
|
|
5
|
+
import { replaceLatestSessionTurn } from "./session-input-handler.js";
|
|
6
|
+
import { handleSessionCommand, handleSessionInputReceipt, handleSessionPreparationRetry } from "./session-command-handler.js";
|
|
6
7
|
//#region src/gateway/hono/routes/agent-stream.ts
|
|
7
8
|
init_src();
|
|
8
9
|
function registerAgentStreamRoutes(authenticated, deps) {
|
|
@@ -38,8 +39,11 @@ function registerAgentStreamRoutes(authenticated, deps) {
|
|
|
38
39
|
});
|
|
39
40
|
});
|
|
40
41
|
authenticated.post("/api/sessions/:conversationId/inputs", chatRateLimitMiddleware, async (c) => {
|
|
41
|
-
return
|
|
42
|
+
return handleSessionCommand(c, deps);
|
|
42
43
|
});
|
|
44
|
+
authenticated.post("/api/sessions/:conversationId/materialize", chatRateLimitMiddleware, (c) => handleSessionCommand(c, deps, true));
|
|
45
|
+
authenticated.get("/api/sessions/:conversationId/input-receipts/:clientMessageId", (c) => handleSessionInputReceipt(c, deps));
|
|
46
|
+
authenticated.post("/api/sessions/:conversationId/preparation/retry", chatRateLimitMiddleware, (c) => handleSessionPreparationRetry(c, deps));
|
|
43
47
|
authenticated.post("/api/sessions/:conversationId/turns/:turnId/replace", chatRateLimitMiddleware, async (c) => {
|
|
44
48
|
return replaceLatestSessionTurn(c, deps, (c.req.param("conversationId") ?? "").trim(), (c.req.param("turnId") ?? "").trim());
|
|
45
49
|
});
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { getOrCreateGatewayIdentity, init_gateway_identity_repository } from "../../../storage/sqlite/gateway-identity-repository.js";
|
|
1
2
|
import { BrowserSessionLimitError, createBrowserSession, deleteBrowserSession } from "../../../storage/sqlite/browser-session-repository.js";
|
|
2
3
|
import { browserCookieRequestAllowed, clearBrowserSessionCookie, writeBrowserSessionCookie } from "../../security/browser-session.js";
|
|
3
4
|
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
4
5
|
//#region src/gateway/hono/routes/browser-session.ts
|
|
6
|
+
init_gateway_identity_repository();
|
|
5
7
|
function registerBrowserSessionRoutes(app, deps) {
|
|
6
8
|
app.get("/api/browser-session", (c) => {
|
|
7
9
|
c.header("Cache-Control", "no-store");
|
|
8
10
|
const principal = getGatewayPrincipal(c);
|
|
9
|
-
return c.json({ conversationId: principal.principalId });
|
|
11
|
+
return c.json({ conversationId: `${getOrCreateGatewayIdentity().id}:${principal.principalId}` });
|
|
10
12
|
});
|
|
11
13
|
app.post("/api/browser-session", deps.strictRateLimitMiddleware, (c) => {
|
|
12
14
|
const principal = getGatewayPrincipal(c);
|
|
@@ -24,7 +26,7 @@ function registerBrowserSessionRoutes(app, deps) {
|
|
|
24
26
|
}
|
|
25
27
|
writeBrowserSessionCookie(c, session.token, session.expiresAt);
|
|
26
28
|
c.header("Cache-Control", "no-store");
|
|
27
|
-
return c.json({ conversationId:
|
|
29
|
+
return c.json({ conversationId: `${getOrCreateGatewayIdentity().id}:browser:${session.sessionId}` });
|
|
28
30
|
});
|
|
29
31
|
app.delete("/api/browser-session", (c) => {
|
|
30
32
|
if (!browserCookieRequestAllowed(c)) return c.json({ error: "Forbidden" }, 403);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
2
|
-
import {
|
|
2
|
+
import { resolveEffectiveAgentProfile } from "../../../config/agent-profile.js";
|
|
3
|
+
import { effectiveWorkspacePathForSession, projectWorkspacePath } from "../../../session/session-workspace.js";
|
|
3
4
|
import { getProjectForSession } from "../../../projects/workspace.js";
|
|
5
|
+
import { ProjectService } from "../../../projects/project-service.js";
|
|
4
6
|
import { isRegisteredProvider } from "../../../agent/skills/marketplace/registry.js";
|
|
5
7
|
import "../../../agent/skills/skills-marketplace.js";
|
|
8
|
+
import "../../../projects/index.js";
|
|
6
9
|
import { isSkillInstallTarget } from "../../../agent/skills/install-target.js";
|
|
7
10
|
import { commandRegistry } from "../../../chat-commands/registry.js";
|
|
8
11
|
import { buildReviewContext, resolveGitRoot } from "../../../review/review-git.js";
|
|
@@ -62,7 +65,11 @@ function registerCommandsSkillsRoutes(authenticated, deps) {
|
|
|
62
65
|
authenticated.get("/api/review/context", async (c) => {
|
|
63
66
|
const conversationId = c.req.query("conversationId")?.trim();
|
|
64
67
|
try {
|
|
65
|
-
const
|
|
68
|
+
const agentId = c.req.query("agentId")?.trim();
|
|
69
|
+
const projectId = c.req.query("projectId")?.trim();
|
|
70
|
+
const project = !conversationId && projectId ? new ProjectService().get(projectId) : null;
|
|
71
|
+
if (!conversationId && projectId && !project) throw new Error("Project not found");
|
|
72
|
+
const payload = await buildReviewContext(await resolveGitRoot(!conversationId && agentId ? projectWorkspacePath(project) ?? resolveEffectiveAgentProfile(agentId).resolvedWorkspacePath : effectiveWorkspacePathForSession(service.getConfig(), conversationId, null, getProjectForSession(conversationId))));
|
|
66
73
|
return c.json({
|
|
67
74
|
ok: true,
|
|
68
75
|
payload
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ComputerConfigSchema, init_config } from "../../../../computer/config.js";
|
|
2
1
|
import { BindingsSchema, init_binding_schema } from "../../../../routing/binding-schema.js";
|
|
2
|
+
import { AgentCatalogService } from "../../../../agent-catalog/service.js";
|
|
3
|
+
import { ComputerConfigSchema, init_config } from "../../../../computer/config.js";
|
|
3
4
|
import { ContextPlanningConfigSchema, HomeIntelligenceConfigSchema, KnowledgeMemoryConfigSchema, UserContextConfigSchema, UserModelConfigSchema, init_config as init_config$1 } from "../../../../user-context/config.js";
|
|
4
5
|
import { BrowserConfigSchema, McpConfigSchema, VoiceConfigSchema, init_schema } from "../../../../config/schema.js";
|
|
5
6
|
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
6
7
|
import { canonicalizeConfiguredMcpServer } from "../../../../config/mcp-config-normalize.js";
|
|
7
|
-
import { AgentCatalogService } from "../../../../agent-catalog/service.js";
|
|
8
8
|
import { mergeGatewaySkillsMarketplacePatch, mergeSessionConfigPatch, mergeUpdateConfigPatch } from "../../../../config/web-patch.js";
|
|
9
9
|
import { assertGatewayAuthConfigured, resolveGatewayAuth } from "../../../auth.js";
|
|
10
10
|
import { isMaskedSecretPatchValue } from "../../lib/mask-secret-length.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FileServiceError, fileResourceFromPath, parseFileResourceId, resolveFilePath } from "../../../files/file-service.js";
|
|
2
2
|
import { getGatewayFileSpaceService } from "../../file-space-service.js";
|
|
3
|
+
import { getSessionPreparation } from "../../../storage/sqlite/session-creation-repository.js";
|
|
3
4
|
import { fuzzySearchWorkspaceFiles, fuzzySubsequenceScore } from "../../workspace-file-search.js";
|
|
4
5
|
import { registerFileReferenceRoutes } from "./file-references.js";
|
|
5
6
|
import { basename, join } from "node:path";
|
|
@@ -55,6 +56,8 @@ function registerFilesRoutes(authenticated, deps) {
|
|
|
55
56
|
try {
|
|
56
57
|
const kind = c.req.param("kind");
|
|
57
58
|
if (kind !== "agent" && kind !== "project" && kind !== "session") throw new FileServiceError(400, "Invalid context kind");
|
|
59
|
+
const preparation = kind === "session" ? getSessionPreparation(c.req.param("id")) : void 0;
|
|
60
|
+
if (preparation && preparation.state !== "ready") throw new FileServiceError(409, "Session environment is not ready");
|
|
58
61
|
return c.json({ space: publicSpace(await files.forContext(kind, c.req.param("id"))) });
|
|
59
62
|
} catch (error) {
|
|
60
63
|
return errorResponse(c, error);
|
|
@@ -8,6 +8,7 @@ import { CredentialResolver, init_credentials } from "../../../auth/credentials.
|
|
|
8
8
|
import "../../../providers/constants.js";
|
|
9
9
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
10
10
|
import { PROVIDER_META, getAllModels, getAllProviders, getAvailableModels, getProviderAuthState, init_providers, isProviderConfigured, isProviderConfiguredSync } from "../../../providers/index.js";
|
|
11
|
+
import { resolveEffectiveAgentConfigForAgent } from "../../../config/agent-profile.js";
|
|
11
12
|
import { buildCapabilityPlansForConfig } from "../../../capabilities/readiness/from-config.js";
|
|
12
13
|
import "../../../capabilities/readiness/index.js";
|
|
13
14
|
import { getImageGenerationProvider, reloadImageGenerationProviders, resolveImageGenerationCredentialMode } from "../../../agent/image/generation/provider-registry.js";
|
|
@@ -325,9 +326,24 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
325
326
|
if (a.provider !== b.provider) return a.provider.localeCompare(b.provider);
|
|
326
327
|
return a.name.localeCompare(b.name, void 0, { sensitivity: "base" });
|
|
327
328
|
});
|
|
329
|
+
const agentId = c.req.query("agentId")?.trim();
|
|
330
|
+
let defaultId;
|
|
331
|
+
if (agentId) try {
|
|
332
|
+
const configured = resolveEffectiveAgentConfigForAgent(agentId).config.models.chat.primary;
|
|
333
|
+
const matches = models.filter((model) => model.id === configured || model.id.endsWith(`/${configured}`));
|
|
334
|
+
defaultId = models.find((model) => model.id === configured)?.id ?? (matches.length === 1 ? matches[0].id : configured);
|
|
335
|
+
} catch (error) {
|
|
336
|
+
return c.json({
|
|
337
|
+
ok: false,
|
|
338
|
+
error: { message: error instanceof Error ? error.message : "Invalid agent" }
|
|
339
|
+
}, 400);
|
|
340
|
+
}
|
|
328
341
|
return c.json({
|
|
329
342
|
ok: true,
|
|
330
|
-
payload: {
|
|
343
|
+
payload: {
|
|
344
|
+
models,
|
|
345
|
+
...defaultId ? { defaultId } : {}
|
|
346
|
+
}
|
|
331
347
|
});
|
|
332
348
|
});
|
|
333
349
|
authenticated.get("/api/image-generation/catalog", (c) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { NoteDeleteOutputSchema, NoteGetOutputSchema, ProductReadContracts } from "../../../../packages/gateway-contract/src/capabilities.js";
|
|
2
2
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
3
|
-
import { init_session_key, resolveConversationId } from "../../../routing/session-key.js";
|
|
4
|
-
import { agentExists, getDefaultAgentId, init_resolve_route } from "../../../routing/resolve-route.js";
|
|
5
3
|
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
6
4
|
import "../../../capabilities/runtime/dispatcher.js";
|
|
5
|
+
import { init_session_key, resolveConversationId } from "../../../routing/session-key.js";
|
|
6
|
+
import { agentExists, getDefaultAgentId, init_resolve_route } from "../../../routing/resolve-route.js";
|
|
7
7
|
import { resolveGatewayEffectiveHost } from "../../../config/gateway-bind.js";
|
|
8
8
|
import { getShareStore } from "../../../share/share-store.js";
|
|
9
9
|
import { resolveShareUrl } from "../../../share/share-url.js";
|
|
@@ -269,7 +269,6 @@ function registerNotesRoutes(authenticated, deps) {
|
|
|
269
269
|
...projectId ? { projectId } : {},
|
|
270
270
|
customData: {
|
|
271
271
|
...meta?.customData ?? {},
|
|
272
|
-
genericNewChatShell: false,
|
|
273
272
|
sourceBinding
|
|
274
273
|
}
|
|
275
274
|
});
|
|
@@ -310,7 +309,6 @@ function registerNotesRoutes(authenticated, deps) {
|
|
|
310
309
|
tags: Array.from(new Set([...meta?.tags ?? [], "note"])),
|
|
311
310
|
customData: {
|
|
312
311
|
...meta?.customData ?? {},
|
|
313
|
-
genericNewChatShell: false,
|
|
314
312
|
sourceBinding
|
|
315
313
|
}
|
|
316
314
|
});
|
|
@@ -7,12 +7,12 @@ import { loadTranscriptRowsForSession } from "../../../storage/sqlite/transcript
|
|
|
7
7
|
import { init_sqlite } from "../../../storage/sqlite/index.js";
|
|
8
8
|
import { ActivityService } from "../../../activity/service.js";
|
|
9
9
|
import "../../../activity/index.js";
|
|
10
|
+
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
11
|
+
import "../../../capabilities/runtime/dispatcher.js";
|
|
10
12
|
import { resolveEffectiveAgentProfile } from "../../../config/agent-profile.js";
|
|
11
13
|
import { TaskReadModelProjector } from "../../../tasks/task-read-model-projector.js";
|
|
12
14
|
import { listKnowledgeItems, writeKnowledgeItem } from "../../../knowledge-memory/repository.js";
|
|
13
15
|
import "../../../knowledge-memory/index.js";
|
|
14
|
-
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
15
|
-
import "../../../capabilities/runtime/dispatcher.js";
|
|
16
16
|
import { ProjectWorkspaceConflictError, ProjectWorkspaceMissingError } from "../../../projects/workspace-project.js";
|
|
17
17
|
import { inferProjectExecutionMode, inferProjectKind } from "../../../projects/project-kind.js";
|
|
18
18
|
import { ProjectDeletionBlockedError, ProjectWorkspaceInUseError } from "../../../projects/project-service.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Context } from 'hono';
|
|
2
|
+
import type { AuthenticatedRouteDeps } from './deps.js';
|
|
3
|
+
export declare function handleSessionCommand(c: Context, deps: AuthenticatedRouteDeps, materialize?: boolean): Promise<Response>;
|
|
4
|
+
export declare function handleSessionInputReceipt(c: Context, deps: AuthenticatedRouteDeps): Promise<Response>;
|
|
5
|
+
export declare function handleSessionPreparationRetry(c: Context, deps: AuthenticatedRouteDeps): Promise<Response>;
|
|
@@ -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";
|