@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,81 @@
|
|
|
1
|
+
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
2
|
+
import { init_session_repository } from "../../storage/sqlite/session-repository.js";
|
|
3
|
+
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
4
|
+
import { resolveProjectAgentId } from "../../projects/project-agent.js";
|
|
5
|
+
import "../../projects/index.js";
|
|
6
|
+
import { getModelThinking } from "../../providers/model-thinking.js";
|
|
7
|
+
import { withModelConfigLock } from "../../session/model-config-lock.js";
|
|
8
|
+
import { SessionCommandError, acceptSessionCommand, getSessionPreparation, matchSessionInputReceipt, sessionCommandHash } from "../../storage/sqlite/session-creation-repository.js";
|
|
9
|
+
//#region src/gateway/service/session-command-service.ts
|
|
10
|
+
init_providers();
|
|
11
|
+
init_session_repository();
|
|
12
|
+
function validateCreation(service, creation) {
|
|
13
|
+
const project = creation.projectId ? service.projects.get(creation.projectId) : null;
|
|
14
|
+
if (creation.projectId && !project) throw new Error("Project not found");
|
|
15
|
+
if (resolveProjectAgentId({
|
|
16
|
+
config: service.currentConfig,
|
|
17
|
+
projects: service.projects,
|
|
18
|
+
explicitAgentId: creation.agentId,
|
|
19
|
+
projectId: creation.projectId ?? void 0
|
|
20
|
+
}) !== creation.agentId) throw new Error("Invalid agent identity");
|
|
21
|
+
if (project?.workspaceRoot?.trim() && !creation.execution) throw new Error("Select an execution environment");
|
|
22
|
+
if (creation.execution && !project?.workspaceRoot?.trim()) throw new Error("Project requires a workspace");
|
|
23
|
+
if (!getModelThinking(resolveModel(creation.model)).options.includes(creation.thinkingLevel)) throw new Error("Unsupported model thinking level");
|
|
24
|
+
}
|
|
25
|
+
async function receiveSessionCommand(service, conversationId, principalId, command, prepareSourceContexts = async () => []) {
|
|
26
|
+
return withModelConfigLock(conversationId, async () => {
|
|
27
|
+
const clientMessageId = "commandId" in command ? command.commandId : command.clientMessageId;
|
|
28
|
+
const existing = matchSessionInputReceipt(conversationId, clientMessageId, principalId, sessionCommandHash(command));
|
|
29
|
+
if (existing) return sessionCommandSnapshot(service, existing);
|
|
30
|
+
if ("kind" in command && command.kind === "append") {
|
|
31
|
+
const session = getSessionMetadata(conversationId);
|
|
32
|
+
if (!session) throw new SessionCommandError("NOT_FOUND", "Conversation not found");
|
|
33
|
+
if (session.transcriptId !== command.expectedTranscriptId) throw new SessionCommandError("SESSION_CHANGED", "Conversation transcript changed");
|
|
34
|
+
}
|
|
35
|
+
if (service.voiceRealtime?.hasConversation(conversationId)) throw new SessionCommandError("SESSION_BUSY", "End the voice call before sending text");
|
|
36
|
+
if ("creation" in command) try {
|
|
37
|
+
validateCreation(service, command.creation);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
throw new SessionCommandError("BAD_REQUEST", error instanceof Error ? error.message : "Invalid creation configuration");
|
|
40
|
+
}
|
|
41
|
+
const receipt = acceptSessionCommand({
|
|
42
|
+
conversationId,
|
|
43
|
+
principalId,
|
|
44
|
+
command,
|
|
45
|
+
preparedInput: "input" in command ? await service.prepareSessionCommandInput({
|
|
46
|
+
conversationId,
|
|
47
|
+
clientMessageId,
|
|
48
|
+
delivery: command.kind === "start" ? "next" : command.delivery,
|
|
49
|
+
content: command.input.content,
|
|
50
|
+
attachments: command.input.attachments,
|
|
51
|
+
contextRefs: command.input.contextRefs,
|
|
52
|
+
sourceContexts: await prepareSourceContexts(),
|
|
53
|
+
thinking: command.kind === "start" ? command.creation.thinkingLevel : (await service.sessions.getAgentConfig(conversationId)).thinkingLevel,
|
|
54
|
+
origin: command.origin.type === "endpoint" ? {
|
|
55
|
+
type: "endpoint",
|
|
56
|
+
endpointId: command.origin.endpointId
|
|
57
|
+
} : command.origin
|
|
58
|
+
}) : void 0,
|
|
59
|
+
attachProject: (id, projectId) => service.projects.attachSession(id, projectId)
|
|
60
|
+
});
|
|
61
|
+
if ("kind" in command && command.kind === "append" && command.delivery === "steer" && receipt.inputId) await service.dispatchAcceptedSessionInput(conversationId, receipt.inputId);
|
|
62
|
+
return sessionCommandSnapshot(service, receipt);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
async function sessionCommandSnapshot(service, receipt) {
|
|
66
|
+
const { principalId: _principal, requestHash: _hash, ...identity } = receipt;
|
|
67
|
+
const inputState = service.getSessionInputState(receipt.conversationId);
|
|
68
|
+
return {
|
|
69
|
+
receipt: {
|
|
70
|
+
...identity,
|
|
71
|
+
lifecycle: getSessionPreparation(receipt.conversationId)?.state ?? "ready"
|
|
72
|
+
},
|
|
73
|
+
session: await service.sessions.getSession(receipt.conversationId),
|
|
74
|
+
agentConfig: await service.sessions.getAgentConfig(receipt.conversationId),
|
|
75
|
+
inputState,
|
|
76
|
+
effectiveDelivery: inputState.inputs.find((input) => input.id === receipt.inputId)?.effectiveDelivery ?? "next",
|
|
77
|
+
preparation: getSessionPreparation(receipt.conversationId)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { receiveSessionCommand, sessionCommandSnapshot };
|
|
@@ -44,6 +44,27 @@ export declare class SessionInputCoordinator {
|
|
|
44
44
|
emit: (type: string, payload: unknown) => void;
|
|
45
45
|
});
|
|
46
46
|
snapshot(conversationId: string): SessionInputState;
|
|
47
|
+
prepareInput(input: SubmitSessionInput): Promise<{
|
|
48
|
+
status: "queued";
|
|
49
|
+
requestedDelivery: SessionInputDelivery;
|
|
50
|
+
effectiveDelivery: "next";
|
|
51
|
+
content: string;
|
|
52
|
+
attachments: UserTurnAttachment[];
|
|
53
|
+
contextRefs: import("../../agent/source-context/types.js").SourceContextRefSummary[];
|
|
54
|
+
contextSnapshots: AgentSourceContext[];
|
|
55
|
+
thinking: string;
|
|
56
|
+
origin: {
|
|
57
|
+
type: "endpoint";
|
|
58
|
+
endpointId: string;
|
|
59
|
+
} | {
|
|
60
|
+
type: "channel";
|
|
61
|
+
channel: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: "system";
|
|
64
|
+
source: "automation" | "cli" | "workflow" | "heartbeat" | "internal";
|
|
65
|
+
};
|
|
66
|
+
}>;
|
|
67
|
+
dispatchAcceptedInput(conversationId: string, inputId: string): Promise<void>;
|
|
47
68
|
private publish;
|
|
48
69
|
private runSubmissionExclusive;
|
|
49
70
|
submit(input: SubmitSessionInput): Promise<{
|
|
@@ -42,6 +42,47 @@ var SessionInputCoordinator = class {
|
|
|
42
42
|
snapshot(conversationId) {
|
|
43
43
|
return getSessionInputState(conversationId);
|
|
44
44
|
}
|
|
45
|
+
async prepareInput(input) {
|
|
46
|
+
const attachments = await this.deps.prepareAttachments(input.conversationId, input.attachments);
|
|
47
|
+
const contexts = fitSourceContextsToBudget([...await this.deps.prepareContexts(input.conversationId, input.contextRefs) ?? [], ...input.sourceContexts ?? []]);
|
|
48
|
+
return {
|
|
49
|
+
status: "queued",
|
|
50
|
+
requestedDelivery: input.delivery,
|
|
51
|
+
effectiveDelivery: "next",
|
|
52
|
+
content: input.content.trim(),
|
|
53
|
+
attachments,
|
|
54
|
+
contextRefs: contexts.map(summarizeSourceContext),
|
|
55
|
+
contextSnapshots: contexts,
|
|
56
|
+
thinking: input.thinking,
|
|
57
|
+
origin: input.origin
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
async dispatchAcceptedInput(conversationId, inputId) {
|
|
61
|
+
const input = getSessionInputById(conversationId, inputId);
|
|
62
|
+
if (!input) return;
|
|
63
|
+
await this.runSubmissionExclusive(input.conversationId, async () => {
|
|
64
|
+
const row = getSessionInputById(conversationId, inputId);
|
|
65
|
+
const state = this.snapshot(input.conversationId);
|
|
66
|
+
if (!row || row.status !== "queued" || row.origin.type === "endpoint" || row.requestedDelivery !== "steer" || !state.activeRunId || row.attachments?.length || row.contextSnapshots?.length || state.preparation && state.preparation.state !== "ready") return;
|
|
67
|
+
setSessionInputStatus(row.id, "injecting", {
|
|
68
|
+
effectiveDelivery: "steer",
|
|
69
|
+
targetRunId: state.activeRunId
|
|
70
|
+
});
|
|
71
|
+
try {
|
|
72
|
+
if (!await this.deps.steer(row.conversationId, row.content)) setSessionInputStatus(row.id, "queued", {
|
|
73
|
+
effectiveDelivery: "next",
|
|
74
|
+
targetRunId: null
|
|
75
|
+
});
|
|
76
|
+
} catch (error) {
|
|
77
|
+
log.warn({
|
|
78
|
+
err: error,
|
|
79
|
+
conversationId: row.conversationId,
|
|
80
|
+
inputId
|
|
81
|
+
}, "Accepted steering input awaits execution recovery");
|
|
82
|
+
}
|
|
83
|
+
this.publish(row.conversationId);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
45
86
|
publish(conversationId) {
|
|
46
87
|
const state = this.snapshot(conversationId);
|
|
47
88
|
this.deps.emit("session.input-state", state);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GatewayService } from '../service.js';
|
|
2
|
+
export declare class SessionPreparationWorker {
|
|
3
|
+
private readonly service;
|
|
4
|
+
private timer?;
|
|
5
|
+
private readonly active;
|
|
6
|
+
private cleaning;
|
|
7
|
+
private cleanupTask?;
|
|
8
|
+
private readonly environments;
|
|
9
|
+
constructor(service: GatewayService);
|
|
10
|
+
start(): void;
|
|
11
|
+
stop(): Promise<void>;
|
|
12
|
+
wake(conversationId: string): void;
|
|
13
|
+
private cleanup;
|
|
14
|
+
private prepare;
|
|
15
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { createLogger } from "../../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
4
|
+
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
5
|
+
import { init_session_repository } from "../../storage/sqlite/session-repository.js";
|
|
6
|
+
import { resolveGitCommit } from "../../execution-environments/git.js";
|
|
7
|
+
import { SessionEnvironmentService } from "../../execution-environments/session-environment-service.js";
|
|
8
|
+
import { claimSessionPreparation, finishSessionPreparation, getSessionPreparation, pendingSessionPreparations } from "../../storage/sqlite/session-creation-repository.js";
|
|
9
|
+
//#region src/gateway/service/session-preparation-worker.ts
|
|
10
|
+
init_transaction();
|
|
11
|
+
init_session_repository();
|
|
12
|
+
init_logger();
|
|
13
|
+
const log = createLogger("Gateway:SessionPreparation");
|
|
14
|
+
var SessionPreparationWorker = class {
|
|
15
|
+
timer;
|
|
16
|
+
active = /* @__PURE__ */ new Map();
|
|
17
|
+
cleaning = false;
|
|
18
|
+
cleanupTask;
|
|
19
|
+
environments = new SessionEnvironmentService();
|
|
20
|
+
constructor(service) {
|
|
21
|
+
this.service = service;
|
|
22
|
+
}
|
|
23
|
+
start() {
|
|
24
|
+
if (this.timer) return;
|
|
25
|
+
const scan = () => {
|
|
26
|
+
for (const id of pendingSessionPreparations()) this.wake(id);
|
|
27
|
+
this.cleanupTask ??= this.cleanup().catch((err) => log.error({ err }, "Session reservation cleanup scan failed")).finally(() => {
|
|
28
|
+
this.cleanupTask = void 0;
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
scan();
|
|
32
|
+
this.timer = setInterval(scan, 5e3);
|
|
33
|
+
this.timer.unref();
|
|
34
|
+
}
|
|
35
|
+
async stop() {
|
|
36
|
+
clearInterval(this.timer);
|
|
37
|
+
this.timer = void 0;
|
|
38
|
+
await Promise.allSettled(this.active.values());
|
|
39
|
+
await this.cleanupTask;
|
|
40
|
+
}
|
|
41
|
+
wake(conversationId) {
|
|
42
|
+
if (this.active.has(conversationId)) return;
|
|
43
|
+
const work = this.prepare(conversationId).catch((err) => {
|
|
44
|
+
log.error({
|
|
45
|
+
err,
|
|
46
|
+
conversationId,
|
|
47
|
+
phase: "prepare"
|
|
48
|
+
}, "Session preparation failed");
|
|
49
|
+
}).finally(() => this.active.delete(conversationId));
|
|
50
|
+
this.active.set(conversationId, work);
|
|
51
|
+
}
|
|
52
|
+
async cleanup() {
|
|
53
|
+
if (this.cleaning) return;
|
|
54
|
+
this.cleaning = true;
|
|
55
|
+
try {
|
|
56
|
+
const pending = getSqliteDatabase().prepare("SELECT * FROM session_preparation_cleanup WHERE not_before<=?").all(Date.now());
|
|
57
|
+
for (const row of pending) {
|
|
58
|
+
if (this.active.has(row.conversation_id)) continue;
|
|
59
|
+
try {
|
|
60
|
+
if (await this.environments.removeUnboundReservation(row.environment_id)) getSqliteDatabase().prepare("DELETE FROM session_preparation_cleanup WHERE environment_id=?").run(row.environment_id);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
63
|
+
getSqliteDatabase().prepare("UPDATE session_preparation_cleanup SET last_error=?,not_before=? WHERE environment_id=?").run(message, Date.now() + 6e4, row.environment_id);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
} finally {
|
|
67
|
+
this.cleaning = false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async prepare(conversationId) {
|
|
71
|
+
const operation = claimSessionPreparation(conversationId);
|
|
72
|
+
if (!operation) return;
|
|
73
|
+
const heartbeat = setInterval(() => {
|
|
74
|
+
getSqliteDatabase().prepare(`UPDATE session_preparations SET lease_until=?
|
|
75
|
+
WHERE operation_id=? AND revision=? AND state='preparing'`).run(Date.now() + 6e4, operation.operationId, operation.revision);
|
|
76
|
+
}, 15e3);
|
|
77
|
+
heartbeat.unref();
|
|
78
|
+
try {
|
|
79
|
+
const project = operation.creation.projectId ? this.service.projects.get(operation.creation.projectId) : null;
|
|
80
|
+
if (!project?.workspaceRoot || !operation.creation.execution) throw new Error("Project workspace is unavailable");
|
|
81
|
+
let baseRef = operation.baseCommit ?? void 0;
|
|
82
|
+
if (operation.creation.execution.mode === "managed_worktree" && !baseRef) {
|
|
83
|
+
baseRef = await resolveGitCommit(project.workspaceRoot, operation.creation.execution.baseRef ?? "HEAD");
|
|
84
|
+
if (!getSqliteDatabase().prepare("UPDATE session_preparations SET base_commit=? WHERE operation_id=? AND revision=?").run(baseRef, operation.operationId, operation.revision).changes) return;
|
|
85
|
+
}
|
|
86
|
+
if (!getSessionMetadata(conversationId)) return;
|
|
87
|
+
await this.environments.attach({
|
|
88
|
+
conversationId,
|
|
89
|
+
project,
|
|
90
|
+
mode: operation.creation.execution.mode,
|
|
91
|
+
baseRef,
|
|
92
|
+
environmentId: operation.environmentId,
|
|
93
|
+
assertCurrent: () => {
|
|
94
|
+
const current = getSessionPreparation(conversationId);
|
|
95
|
+
if (!current || current.operationId !== operation.operationId || current.revision !== operation.revision || current.state !== "preparing" || !getSessionMetadata(conversationId)) throw new Error("Session preparation ownership changed");
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
if (runSqliteWriteTransaction(() => {
|
|
99
|
+
if (!getSessionMetadata(conversationId)) return false;
|
|
100
|
+
return finishSessionPreparation(operation);
|
|
101
|
+
})) this.service.drainSessionInputs(conversationId).catch((err) => {
|
|
102
|
+
log.error({
|
|
103
|
+
err,
|
|
104
|
+
conversationId
|
|
105
|
+
}, "Prepared session input drain failed");
|
|
106
|
+
});
|
|
107
|
+
} catch (error) {
|
|
108
|
+
finishSessionPreparation(operation, error instanceof Error ? error.message : String(error));
|
|
109
|
+
log.warn({
|
|
110
|
+
err: error,
|
|
111
|
+
conversationId,
|
|
112
|
+
operationId: operation.operationId
|
|
113
|
+
}, "Session environment preparation failed");
|
|
114
|
+
} finally {
|
|
115
|
+
clearInterval(heartbeat);
|
|
116
|
+
const preparation = getSessionPreparation(conversationId);
|
|
117
|
+
if (preparation) this.service.emit("session.input-state", {
|
|
118
|
+
...this.service.getSessionInputState(conversationId),
|
|
119
|
+
preparation
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
export { SessionPreparationWorker };
|
|
@@ -20,6 +20,7 @@ import { type BrowserAutomationService } from '../browser/automations/index.js';
|
|
|
20
20
|
import { GatewaySessionsApi } from './service/sessions-api.js';
|
|
21
21
|
import { GatewayMarketplaceService } from './service/marketplace-service.js';
|
|
22
22
|
import { GatewayAgentRunner } from './service/agent-runner.js';
|
|
23
|
+
import { SessionPreparationWorker } from './service/session-preparation-worker.js';
|
|
23
24
|
import { RealtimeRuntime } from '../realtime/runtime.js';
|
|
24
25
|
import { VoiceRealtimeRuntime } from '../voice/realtime/runtime.js';
|
|
25
26
|
import type { GatewayServiceConfig } from './service/types.js';
|
|
@@ -85,6 +86,7 @@ export declare class GatewayService {
|
|
|
85
86
|
* `activeWebchatRunBySession` + `runAbortControllers` maps.
|
|
86
87
|
*/
|
|
87
88
|
readonly agentRunner: GatewayAgentRunner;
|
|
89
|
+
readonly sessionPreparations: SessionPreparationWorker;
|
|
88
90
|
/** Process-local, non-persistent side conversations forked from durable sessions. */
|
|
89
91
|
readonly sideChats: EphemeralSideChatManager;
|
|
90
92
|
readonly sideChatRuns: SideChatRunService;
|
|
@@ -145,6 +147,28 @@ export declare class GatewayService {
|
|
|
145
147
|
ok: false;
|
|
146
148
|
code: "BAD_REQUEST" | "QUEUE_FULL" | "CONTEXT_UNAVAILABLE" | "SESSION_CHANGED";
|
|
147
149
|
}>;
|
|
150
|
+
prepareSessionCommandInput(input: Parameters<GatewayAgentRunner['inputs']['prepareInput']>[0]): Promise<{
|
|
151
|
+
status: "queued";
|
|
152
|
+
requestedDelivery: import("../storage/sqlite/session-input-repository.js").SessionInputDelivery;
|
|
153
|
+
effectiveDelivery: "next";
|
|
154
|
+
content: string;
|
|
155
|
+
attachments: import("./user-turn-input.js").UserTurnAttachment[];
|
|
156
|
+
contextRefs: import("../agent/source-context/types.js").SourceContextRefSummary[];
|
|
157
|
+
contextSnapshots: import("../agent/source-context/types.js").AgentSourceContext[];
|
|
158
|
+
thinking: string;
|
|
159
|
+
origin: {
|
|
160
|
+
type: "endpoint";
|
|
161
|
+
endpointId: string;
|
|
162
|
+
} | {
|
|
163
|
+
type: "channel";
|
|
164
|
+
channel: string;
|
|
165
|
+
} | {
|
|
166
|
+
type: "system";
|
|
167
|
+
source: "automation" | "cli" | "workflow" | "heartbeat" | "internal";
|
|
168
|
+
};
|
|
169
|
+
}>;
|
|
170
|
+
drainSessionInputs(conversationId: string): Promise<void>;
|
|
171
|
+
dispatchAcceptedSessionInput(conversationId: string, inputId: string): Promise<void>;
|
|
148
172
|
private appContextDispatcher;
|
|
149
173
|
prepareSessionAppContext(input: unknown, principal: GatewayPrincipal, conversationId: string, clientMessageId: string): Promise<import("../agent/source-context/types.js").AgentSourceContext>;
|
|
150
174
|
replaceLatestSessionTurn(...args: Parameters<GatewayAgentRunner['replaceLatestSessionTurn']>): Promise<{
|
|
@@ -16,17 +16,17 @@ import { init_session_repository, listSessionMetadata, patchSessionMetadata } fr
|
|
|
16
16
|
import { getSessionConfig, init_config_repository } from "../storage/sqlite/config-repository.js";
|
|
17
17
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
18
18
|
import { normalizeAgentId } from "../agent-catalog/id.js";
|
|
19
|
+
import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
20
|
+
import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
19
21
|
import { init_config, resolveKnowledgeReadPolicy } from "../user-context/config.js";
|
|
20
22
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
21
|
-
import {
|
|
23
|
+
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
22
24
|
import { init_agent_session_key, resolveAgentMainConversationId } from "../routing/agent-session-key.js";
|
|
23
25
|
import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
|
|
24
26
|
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
25
|
-
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
26
|
-
import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
27
|
-
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
28
27
|
import { init_providers, providers_exports } from "../providers/index.js";
|
|
29
28
|
import { AI_USAGE_RETENTION_MS, markStaleAiUsageEventsUnknown, pruneAiUsageEvents } from "../storage/sqlite/ai-usage-repository.js";
|
|
29
|
+
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
30
30
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
31
31
|
import { listKnowledgeItems } from "../knowledge-memory/repository.js";
|
|
32
32
|
import "../knowledge-memory/index.js";
|
|
@@ -73,6 +73,12 @@ import { ChatPreviewService } from "../chat-previews/service.js";
|
|
|
73
73
|
import "../chat-previews/index.js";
|
|
74
74
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
75
75
|
import "../config/index.js";
|
|
76
|
+
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
77
|
+
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
78
|
+
import "../knowledge/index.js";
|
|
79
|
+
import { ConnectionRecoveryService } from "../connectors/connection-recovery-service.js";
|
|
80
|
+
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
81
|
+
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
76
82
|
import { DiscussionService } from "../discussions/service.js";
|
|
77
83
|
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
78
84
|
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
@@ -81,16 +87,6 @@ import { DiscussionSealer } from "../discussions/sealer.js";
|
|
|
81
87
|
import "../discussions/index.js";
|
|
82
88
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
83
89
|
import "../endpoint-tools/index.js";
|
|
84
|
-
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
85
|
-
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
86
|
-
import "../knowledge/index.js";
|
|
87
|
-
import { ConnectionRecoveryService } from "../connectors/connection-recovery-service.js";
|
|
88
|
-
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
89
|
-
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
90
|
-
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
91
|
-
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
92
|
-
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
93
|
-
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
94
90
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
95
91
|
import { prepareAutomationAgentSession } from "./automation-agent-session.js";
|
|
96
92
|
import { stopTailscaleExposure } from "./tailscale-lifecycle.js";
|
|
@@ -136,6 +132,7 @@ import { GatewaySessionsApi } from "./service/sessions-api.js";
|
|
|
136
132
|
import { GatewayMarketplaceService } from "./service/marketplace-service.js";
|
|
137
133
|
import { GatewayConfigCoordinator } from "./service/config-coordinator.js";
|
|
138
134
|
import { GatewayAgentRunner } from "./service/agent-runner.js";
|
|
135
|
+
import { SessionPreparationWorker } from "./service/session-preparation-worker.js";
|
|
139
136
|
import { isBrowserSessionActive } from "../storage/sqlite/browser-session-repository.js";
|
|
140
137
|
import { RealtimeRuntime } from "../realtime/runtime.js";
|
|
141
138
|
import { VoiceRealtimeRuntime } from "../voice/realtime/runtime.js";
|
|
@@ -146,6 +143,10 @@ import { createGatewayStartupTrace } from "./startup-trace.js";
|
|
|
146
143
|
import { GatewaySceneHost } from "./scenes/host.js";
|
|
147
144
|
import { checkAppContextAccess, prepareAppContext } from "./service/app-context-access.js";
|
|
148
145
|
import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults } from "../voice/language-profile.js";
|
|
146
|
+
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
147
|
+
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
148
|
+
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
149
|
+
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
149
150
|
import crypto from "node:crypto";
|
|
150
151
|
//#region src/gateway/service.ts
|
|
151
152
|
init_session_repository();
|
|
@@ -312,6 +313,7 @@ var GatewayService = class {
|
|
|
312
313
|
* `activeWebchatRunBySession` + `runAbortControllers` maps.
|
|
313
314
|
*/
|
|
314
315
|
agentRunner;
|
|
316
|
+
sessionPreparations = new SessionPreparationWorker(this);
|
|
315
317
|
/** Process-local, non-persistent side conversations forked from durable sessions. */
|
|
316
318
|
sideChats;
|
|
317
319
|
sideChatRuns;
|
|
@@ -891,6 +893,15 @@ var GatewayService = class {
|
|
|
891
893
|
submitSessionInput(...args) {
|
|
892
894
|
return this.agentRunner.submitSessionInput(...args);
|
|
893
895
|
}
|
|
896
|
+
prepareSessionCommandInput(input) {
|
|
897
|
+
return this.agentRunner.inputs.prepareInput(input);
|
|
898
|
+
}
|
|
899
|
+
drainSessionInputs(conversationId) {
|
|
900
|
+
return this.agentRunner.inputs.drain(conversationId);
|
|
901
|
+
}
|
|
902
|
+
dispatchAcceptedSessionInput(conversationId, inputId) {
|
|
903
|
+
return this.agentRunner.inputs.dispatchAcceptedInput(conversationId, inputId);
|
|
904
|
+
}
|
|
894
905
|
appContextDispatcher() {
|
|
895
906
|
return createProductDispatcher(() => this.notesService, {
|
|
896
907
|
getProjects: () => this.projects,
|
|
@@ -1142,6 +1153,7 @@ var GatewayService = class {
|
|
|
1142
1153
|
});
|
|
1143
1154
|
this.ensureAgentService();
|
|
1144
1155
|
this.agentRunner.recoverSessionInputs();
|
|
1156
|
+
this.sessionPreparations.start();
|
|
1145
1157
|
this.connectionRecovery.start();
|
|
1146
1158
|
this.channelManager.setOutboundHooks({
|
|
1147
1159
|
runMessageSending: (to, content, channel) => this.agentService.outboundCoordinator.invokeOutboundMessageSending(to, content, channel),
|
|
@@ -1396,6 +1408,7 @@ var GatewayService = class {
|
|
|
1396
1408
|
}
|
|
1397
1409
|
async stop() {
|
|
1398
1410
|
if (!this.running) return;
|
|
1411
|
+
await this.sessionPreparations.stop();
|
|
1399
1412
|
setPairingBroadcastSink(null);
|
|
1400
1413
|
this.stopRealtimeLogBridge?.();
|
|
1401
1414
|
this.stopRealtimeLogBridge = null;
|
|
@@ -54,7 +54,6 @@ var SideChatPromotionService = class {
|
|
|
54
54
|
peerId: chatId
|
|
55
55
|
},
|
|
56
56
|
customData: {
|
|
57
|
-
genericNewChatShell: false,
|
|
58
57
|
promotedFromSideChatId: sideChatId,
|
|
59
58
|
promotedFromParentTranscriptId: snapshot.context.parentTranscriptId,
|
|
60
59
|
sideChatContextHash: snapshot.context.contentHash,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
2
|
+
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
2
3
|
import { getModelCatalogStore, init_model_catalog_store } from "../providers/model-catalog-store.js";
|
|
3
4
|
import { compareCatalogModels } from "../providers/model-catalog-ranking.js";
|
|
4
|
-
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
5
5
|
import { prepareUpdateGlobalDefaults } from "./global-defaults-admin.js";
|
|
6
6
|
//#region src/gateway/xopc-cloud-capability-setup.ts
|
|
7
7
|
init_repository();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { init_agent_scope, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
2
|
+
import { extractAssistantText, getAssistantMessageErrorReason } from "../providers/model-response.js";
|
|
2
3
|
import { init_providers, resolveModel } from "../providers/index.js";
|
|
3
4
|
import { completeWithResolvedCredentials, isLocalModelBaseUrl } from "../providers/model-call.js";
|
|
4
|
-
import { extractAssistantText, getAssistantMessageErrorReason } from "../providers/model-response.js";
|
|
5
5
|
import { resolveModelSelector } from "../config/agent-model-intents.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/home-intelligence/generator.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { homePatternKey } from "./strategy.js";
|
|
4
|
+
import { HomeAdvicePolicy } from "./policy.js";
|
|
4
5
|
import { HomeIntelligenceRepository } from "./repository.js";
|
|
5
6
|
import { HomeOpportunityApplicationService } from "./application-service.js";
|
|
6
|
-
import { HomeAdvicePolicy } from "./policy.js";
|
|
7
7
|
import { buildHomeOpportunityNotification } from "./notification.js";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
9
|
//#region src/home-intelligence/host.ts
|
|
@@ -5,10 +5,10 @@ import { currentOperationId, init_operation_context } from "../infra/operation-c
|
|
|
5
5
|
import { afterSqliteCommit, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
6
6
|
import { ExtensionCapabilityBindingsSchema, extensionCapabilityPermissions } from "../../packages/gateway-contract/src/extension-capabilities.js";
|
|
7
7
|
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
8
|
+
import { CapabilityError } from "../capabilities/runtime/errors.js";
|
|
8
9
|
import { init_paths, resolveExtensionsDir } from "../config/paths.js";
|
|
9
10
|
import { LocalAppStore } from "./store.js";
|
|
10
11
|
import { slugifyProjectName } from "../projects/project-store.js";
|
|
11
|
-
import { CapabilityError } from "../capabilities/runtime/errors.js";
|
|
12
12
|
import { DomainOutboxDispatcher } from "../infra/domain-outbox-dispatcher.js";
|
|
13
13
|
import { validateLocalAppCapabilityContracts } from "./capabilities/contracts.js";
|
|
14
14
|
import { buildLocalAppFixGuidance } from "./fix-guidance.js";
|
|
@@ -144,10 +144,20 @@ var XopcChannelBridge = class {
|
|
|
144
144
|
return null;
|
|
145
145
|
}
|
|
146
146
|
async sendMessage(params) {
|
|
147
|
-
|
|
147
|
+
const client = this.client;
|
|
148
|
+
const path = `/api/sessions/${encodeURIComponent(params.conversationId)}`;
|
|
149
|
+
const [detail, config] = await Promise.all([client.getJson(path), client.getJson(`${path}/agent-config`)]);
|
|
150
|
+
return client.postJson(`/api/sessions/${encodeURIComponent(params.conversationId)}/inputs`, {
|
|
151
|
+
kind: "append",
|
|
148
152
|
clientMessageId: crypto.randomUUID(),
|
|
153
|
+
expectedTranscriptId: detail.session.transcriptId,
|
|
154
|
+
configVersion: config.configVersion,
|
|
149
155
|
delivery: "next",
|
|
150
|
-
content: params.text
|
|
156
|
+
input: { content: params.text },
|
|
157
|
+
origin: {
|
|
158
|
+
type: "system",
|
|
159
|
+
source: "cli"
|
|
160
|
+
}
|
|
151
161
|
});
|
|
152
162
|
}
|
|
153
163
|
listPendingApprovals() {
|
|
@@ -20,8 +20,8 @@ function registerNoteReadCapabilities(dispatcher, getNotes) {
|
|
|
20
20
|
id: "xopc.notes.preview_edit",
|
|
21
21
|
description: "Build a local edit suggestion without modifying the note or calling a model.",
|
|
22
22
|
...ProductReadContracts["xopc.notes.preview_edit"],
|
|
23
|
-
async execute({ id, instruction, markdown }) {
|
|
24
|
-
const result = await getNotes().createAiEditPatch(id, instruction, markdown);
|
|
23
|
+
async execute({ id, instruction, markdown, context }) {
|
|
24
|
+
const result = await getNotes().createAiEditPatch(id, instruction, markdown, context?.range);
|
|
25
25
|
if (!result) throw new CapabilityError("NOT_FOUND", "Note not found");
|
|
26
26
|
return ProductReadContracts["xopc.notes.preview_edit"].output.parse(result);
|
|
27
27
|
}
|
|
@@ -23,7 +23,10 @@ export declare class NotesService {
|
|
|
23
23
|
note: Note | null;
|
|
24
24
|
conflict: boolean;
|
|
25
25
|
}>;
|
|
26
|
-
createAiEditPatch(id: string, instruction: string, markdownOverride?: string
|
|
26
|
+
createAiEditPatch(id: string, instruction: string, markdownOverride?: string, requestedRange?: {
|
|
27
|
+
start: number;
|
|
28
|
+
end: number;
|
|
29
|
+
}): Promise<{
|
|
27
30
|
message: string;
|
|
28
31
|
patch: NoteAiPatch;
|
|
29
32
|
} | null>;
|
|
@@ -7,8 +7,8 @@ import { init_note_markdown, parseNoteMarkdown } from "./note-markdown.js";
|
|
|
7
7
|
import { init_notes_repository, listNoteProjectSummaries } from "../storage/sqlite/notes-repository.js";
|
|
8
8
|
import { changedFieldsFromPatch, emitActivity, previewText, systemActivityActor, systemActivitySource } from "../activity/emitter.js";
|
|
9
9
|
import { getDefaultModelSync, init_providers, resolveModel } from "../providers/index.js";
|
|
10
|
-
import { DomainOutboxDispatcher } from "../infra/domain-outbox-dispatcher.js";
|
|
11
10
|
import { completeWithResolvedCredentials } from "../providers/model-call.js";
|
|
11
|
+
import { DomainOutboxDispatcher } from "../infra/domain-outbox-dispatcher.js";
|
|
12
12
|
import { partitionAttachmentsByReference } from "./note-attachment-sync.js";
|
|
13
13
|
import { buildNoteAgentContextArtifact, getCachedNoteAgentContextArtifact } from "./agent-context.js";
|
|
14
14
|
import { revokeNoteShareRecords } from "../share/note-share-revocation.js";
|
|
@@ -333,19 +333,22 @@ var NotesService = class {
|
|
|
333
333
|
throw error;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
async createAiEditPatch(id, instruction, markdownOverride) {
|
|
336
|
+
async createAiEditPatch(id, instruction, markdownOverride, requestedRange) {
|
|
337
337
|
const note = await this.store.getNote(id);
|
|
338
338
|
if (!note) return null;
|
|
339
339
|
const source = markdownOverride ?? note.markdown;
|
|
340
|
-
const
|
|
340
|
+
const start = Math.max(0, Math.min(source.length, requestedRange?.start ?? 0));
|
|
341
|
+
const end = Math.max(start, Math.min(source.length, requestedRange?.end ?? source.length));
|
|
342
|
+
const target = source.slice(start, end);
|
|
343
|
+
const parsed = parseNoteMarkdown(target, id);
|
|
341
344
|
const wantsTodos = /待办|todo|task|行动|提醒/i.test(instruction);
|
|
342
345
|
const wantsSummary = /摘要|总结|summary|压缩/i.test(instruction);
|
|
343
346
|
let generated = "";
|
|
344
347
|
if (wantsTodos) {
|
|
345
|
-
const lines =
|
|
348
|
+
const lines = target.split(/\n|。|;|;/).map((line) => line.trim()).filter(Boolean);
|
|
346
349
|
generated = (lines.length ? lines : [parsed.plainText]).slice(0, 12).map((line) => `- [ ] ${line.replace(/^[-*\d.\s\[\]x]+/i, "").trim()}`).join("\n");
|
|
347
350
|
} else if (wantsSummary) generated = `> [!SUMMARY]\n> ${parsed.plainText.slice(0, 220)}`;
|
|
348
|
-
else generated = `${
|
|
351
|
+
else generated = `${target.trimEnd()}\n\n## AI 整理\n\n${instruction.trim()}`;
|
|
349
352
|
return {
|
|
350
353
|
message: "AI edit patch generated",
|
|
351
354
|
patch: {
|
|
@@ -353,9 +356,9 @@ var NotesService = class {
|
|
|
353
356
|
summary: instruction,
|
|
354
357
|
operations: [{
|
|
355
358
|
type: "replaceRange",
|
|
356
|
-
from:
|
|
357
|
-
to:
|
|
358
|
-
markdown: generated ||
|
|
359
|
+
from: start,
|
|
360
|
+
to: end,
|
|
361
|
+
markdown: generated || target
|
|
359
362
|
}]
|
|
360
363
|
}
|
|
361
364
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
|
|
2
1
|
import { getApiKeyFromEnv, init_env_keys } from "../env-keys.js";
|
|
2
|
+
import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
|
|
3
3
|
import { getDefaultAuthProfileStore } from "./auth-profile-store.js";
|
|
4
4
|
//#region src/providers/auth-runtime/resolve-auth.ts
|
|
5
5
|
init_env_keys();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __esmMin, __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
3
|
-
import { getModelOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
|
|
4
|
-
import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
|
|
5
3
|
import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
6
4
|
import { init_model_ref, splitProviderModelRef } from "./model-ref.js";
|
|
7
5
|
import { ModelRegistry, getModelRegistry, init_model_registry, prewarmModelRegistry, resetModelRegistry } from "./model-registry.js";
|
|
6
|
+
import { getModelOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
|
|
8
7
|
import { CredentialResolver, hasCredentials, init_credentials } from "../auth/credentials.js";
|
|
8
|
+
import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
|
|
9
9
|
import { EXTENSION_PROVIDER_BASE_URL, init_constants } from "./constants.js";
|
|
10
10
|
import { applyOfficialModelMetadataCorrections, getSupplementalModels, init_model_supplements } from "./model-supplements.js";
|
|
11
11
|
import { getProviderRegistry, init_plugin_registry } from "./plugin-registry.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { init_paths_state, resolveXopcCloudCatalogCachePath } from "../config/paths-state.js";
|
|
3
|
-
import { ComputerProfileSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
|
|
4
3
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
4
|
+
import { ComputerProfileSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
|
|
5
5
|
import { voiceManifestSchema } from "../../packages/realtime-protocol/src/voice-catalog.js";
|
|
6
6
|
import { init_voice } from "../../packages/realtime-protocol/src/voice.js";
|
|
7
7
|
import { readFileSync, rmSync } from "node:fs";
|