@xopcai/xopc 0.0.332 → 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-C2wg3xC_.js → agent-avatar-dicebear-B73q7mlz.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-B9L2YIXz.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-BeNnu1Ts.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-etFSkfzl.js → app-management-settings-panel-CckioKud.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DKmU2VAP.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-D0z_Fr2G.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-B7_C-p66.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-ChWW8Z9L.js → block-editor-DD9d5pCt.js} +29 -29
- package/dist/gateway/static/root/assets/{browser-automation-inputs-C5s1yHOu.js → browser-automation-inputs-D2gNdS3e.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BV00BXRb.js → browser-automations-page-BKqqJR7P.js} +2 -2
- package/dist/gateway/static/root/assets/{browser-settings-page-xwTmuZjS.js → browser-settings-page-BZH9bZbk.js} +2 -2
- 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-C41mXCAi.js → chat-terminal-dock-B0nPDJyj.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-BJkqok2G.js → computer-settings-page-D7PxxaoG.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BKCZMmwm.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-CqADAHZp.js → dependency-picker-AInmpSwC.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Bab-iWED.js → desktop-pet-Sjgnlq8M.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BqgzLOdi.js → desktop-pet-settings-BWn0rrhr.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DFg7FDPf.js → device-pairing-wizard-BtW837_d.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-hqJ9sFCR.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-DX3PFhRE.js → extension-debug-page-WWJFj9Z5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DkREdHLs.js → extension-page-DL00dFRr.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-wF-HNTM-.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-config-swr-cR-tz7-Q.js → gateway-config-swr-CgIjCxM8.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/{gateway-startup-retry-6jLRcQsu.js → gateway-startup-retry-i-1lTrwY.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-nEpyJUBY.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-CSSkwsyC.js → image-generation-api-gilc-u7M.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-B80Cv043.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-BgoFaTwv.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-HO6OQlQT.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/{locale-store-wNXWkWu5.js → locale-store-BY30D6tg.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DX8TxkRl.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-5WFufZ4g.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DlT9KqwF.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/messages-_6IXbP2u.js +3 -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-vqI30Yrg.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-B-mwPBJW.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-D--sj_uN.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/{registry-api-BIpltJ47.js → registry-api-BvVx0G1o.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BWpWUXiE.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CAnb0PNY.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-BKj6wIMb.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-78ycUHfv.js → settings-form-section-B0cAj0nq.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BOdxIVzo.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-CiBGQ0Jg.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-CyJUeREH.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-Day9zhKi.js → tunnel-api--68MQEWM.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-OLZ00eqD.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-Bj9hC6ML.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-fWRD6B8r.js → voice-api-key-field-CvIXutQp.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-ujEySjyc.js → voice-config-api-Bwy3Al3J.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CnxdvIk8.js → work-discovery-overlay-By5_7MLR.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DlWNN1VA.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 +27 -21
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +44 -14
- package/dist/packages/gateway-contract/src/capabilities.js +120 -10
- package/dist/packages/gateway-contract/src/index.js +8 -2
- package/dist/packages/gateway-contract/src/scenes.js +7 -6
- 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 +2 -7
- package/dist/packages/gateway-contract/src/usage.js +6 -0
- package/dist/src/agent/agent-manager.js +15 -9
- package/dist/src/agent/background-review/run-background-review.js +8 -3
- 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/embedded/run-turn.js +7 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/external-tools/gateway-tools.d.ts +2 -1
- package/dist/src/agent/external-tools/gateway-tools.js +45 -11
- package/dist/src/agent/external-tools/index.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +2 -2
- package/dist/src/agent/image/understanding/pi-ai-provider.js +1 -1
- package/dist/src/agent/memory/compaction.js +4 -0
- package/dist/src/agent/service/btw-query.js +8 -2
- package/dist/src/agent/service/process-direct-streaming.js +4 -2
- package/dist/src/agent/service.js +5 -5
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/filesystem-watcher.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +2 -2
- package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +7 -3
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +5 -4
- package/dist/src/agent/tools/automation-tool.d.ts +4 -1
- package/dist/src/agent/tools/automation-tool.js +42 -4
- package/dist/src/agent/tools/session-search-tool.js +1 -1
- package/dist/src/agent/tools/web-extract.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +50 -9
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/ai-assist/text-assist.js +6 -2
- 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/api/routes.js +65 -0
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/read.js +24 -0
- package/dist/src/automations/capabilities/write.d.ts +52 -14
- package/dist/src/automations/capabilities/write.js +52 -3
- package/dist/src/automations/delivery/delivery-router.d.ts +50 -0
- package/dist/src/automations/delivery/delivery-router.js +318 -0
- package/dist/src/automations/delivery/index.d.ts +1 -0
- package/dist/src/automations/delivery/index.js +2 -0
- package/dist/src/automations/domain/defaults.d.ts +0 -1
- package/dist/src/automations/domain/defaults.js +1 -1
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +158 -7
- package/dist/src/automations/domain/validation.d.ts +104 -22
- package/dist/src/automations/domain/validation.js +66 -13
- package/dist/src/automations/draft/automation-draft-prompt.js +3 -4
- package/dist/src/automations/draft/automation-draft-service.js +6 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +22 -3
- package/dist/src/automations/draft/automation-draft-validator.js +4 -4
- package/dist/src/automations/events/event-catalog.d.ts +14 -0
- package/dist/src/automations/events/event-catalog.js +117 -0
- package/dist/src/automations/events/event-dispatcher.d.ts +27 -0
- package/dist/src/automations/events/event-dispatcher.js +140 -0
- package/dist/src/automations/events/event-repository.d.ts +59 -0
- package/dist/src/automations/events/event-repository.js +361 -0
- package/dist/src/automations/events/index.d.ts +3 -0
- package/dist/src/automations/events/index.js +4 -0
- package/dist/src/automations/index.d.ts +3 -1
- package/dist/src/automations/index.js +9 -3
- package/dist/src/automations/service/action-executor.d.ts +20 -1
- package/dist/src/automations/service/action-executor.js +80 -40
- package/dist/src/automations/service/automation-service.d.ts +21 -4
- package/dist/src/automations/service/automation-service.js +150 -100
- package/dist/src/automations/storage/automation-repository.js +4 -5
- package/dist/src/automations/storage/automation-run-repository.d.ts +1 -0
- package/dist/src/automations/storage/automation-run-repository.js +26 -1
- package/dist/src/automations/storage/index.js +2 -2
- package/dist/src/automations/webhook-secrets.d.ts +1 -0
- package/dist/src/automations/webhook-secrets.js +16 -0
- 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/capabilities/store-connector.d.ts +17 -1
- package/dist/src/capabilities/store-connector.js +69 -3
- 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/connectors.js +4 -3
- package/dist/src/cli/commands/doctor/checks/automation-integrity.d.ts +2 -0
- package/dist/src/cli/commands/doctor/checks/automation-integrity.js +55 -0
- package/dist/src/cli/commands/doctor/checks/database-relations.d.ts +2 -0
- package/dist/src/cli/commands/doctor/checks/database-relations.js +81 -0
- 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/doctor/flow.js +5 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +2 -2
- package/dist/src/cli/commands/skills.js +1 -1
- 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/approval-resume.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/cli/store.js +1 -1
- package/dist/src/connectors/composio-backends.js +14 -4
- package/dist/src/connectors/composio-managed-events.d.ts +5 -2
- package/dist/src/connectors/composio-managed-events.js +4 -1
- package/dist/src/connectors/connection-candidates.js +53 -15
- package/dist/src/connectors/connection-capabilities.js +5 -1
- package/dist/src/connectors/connection-recovery-service.d.ts +2 -1
- package/dist/src/connectors/connection-recovery-service.js +89 -4
- package/dist/src/discussions/analyzer.js +4 -4
- 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/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +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/home-intelligence-automation-reconciler.js +4 -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/capabilities.js +1 -1
- 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/connection-waits.js +3 -2
- package/dist/src/gateway/hono/routes/files.js +3 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +14 -1
- 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/public-gateway.js +93 -3
- package/dist/src/gateway/hono/routes/scenes.js +57 -41
- 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 -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/usage.d.ts +3 -0
- package/dist/src/gateway/hono/routes/usage.js +61 -0
- package/dist/src/gateway/hono/routes/voice.js +10 -1
- package/dist/src/gateway/image-generation-setup.js +2 -2
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/memory-maintenance-automation-reconciler.js +5 -2
- 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/scenes/host.js +27 -14
- package/dist/src/gateway/scenes/slackThreadSource.d.ts +2 -2
- package/dist/src/gateway/security/gateway-scopes.js +1 -0
- package/dist/src/gateway/service/active-execution.d.ts +19 -0
- package/dist/src/gateway/service/active-execution.js +16 -0
- package/dist/src/gateway/service/agent-runner.d.ts +4 -0
- package/dist/src/gateway/service/agent-runner.js +19 -1
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.d.ts +2 -0
- package/dist/src/gateway/service/run-gateway-agent.js +10 -2
- 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/sessions-api.d.ts +13 -0
- package/dist/src/gateway/service/sessions-api.js +23 -0
- package/dist/src/gateway/service.d.ts +30 -3
- package/dist/src/gateway/service.js +89 -79
- package/dist/src/gateway/side-chat/promotion-service.js +0 -1
- package/dist/src/gateway/side-chat/run-service.js +10 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/generator.js +5 -2
- package/dist/src/infra/domain-outbox-dispatcher.d.ts +0 -3
- package/dist/src/infra/domain-outbox-dispatcher.js +15 -7
- package/dist/src/local-apps/service.js +2 -2
- 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 +13 -11
- package/dist/src/projects/project-service.js +1 -2
- package/dist/src/projects/project-skill-service.js +2 -2
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-call.d.ts +3 -2
- package/dist/src/providers/model-call.js +30 -5
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/scenes/activationAdapter.d.ts +19 -0
- package/dist/src/scenes/activationAdapter.js +1 -0
- package/dist/src/scenes/agentExecutor.js +3 -10
- package/dist/src/scenes/contracts.d.ts +3 -9
- package/dist/src/scenes/contracts.js +1 -0
- package/dist/src/scenes/execution.d.ts +9 -3
- package/dist/src/scenes/execution.js +12 -11
- package/dist/src/scenes/httpServices.d.ts +5 -2
- package/dist/src/scenes/mailContext.d.ts +4 -0
- package/dist/src/scenes/mailContext.js +9 -0
- package/dist/src/scenes/maintenance.js +1 -5
- package/dist/src/scenes/metrics.d.ts +0 -6
- package/dist/src/scenes/metrics.js +0 -11
- package/dist/src/scenes/registry.d.ts +11 -0
- package/dist/src/scenes/registry.js +28 -0
- package/dist/src/scenes/repository.d.ts +6 -3
- package/dist/src/scenes/repository.js +43 -5
- package/dist/src/scenes/service.d.ts +2 -1
- package/dist/src/scenes/service.js +9 -7
- package/dist/src/scenes/taskFollowUp/contracts.d.ts +37 -7
- package/dist/src/scenes/taskFollowUp/contracts.js +36 -17
- package/dist/src/scenes/taskFollowUp/service.d.ts +35 -7
- package/dist/src/scenes/taskFollowUp/service.js +86 -28
- package/dist/src/scenes/templates.d.ts +2 -2
- package/dist/src/scenes/userNotes.d.ts +3 -0
- package/dist/src/scenes/userNotes.js +6 -0
- package/dist/src/session/client-history.d.ts +3 -0
- package/dist/src/session/client-history.js +10 -5
- package/dist/src/session/manager.d.ts +1 -0
- package/dist/src/session/resolve-session.js +4 -3
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/store.d.ts +1 -0
- package/dist/src/session/store.js +3 -3
- package/dist/src/storage/sqlite/ai-usage-repository.d.ts +137 -0
- package/dist/src/storage/sqlite/ai-usage-repository.js +175 -0
- package/dist/src/storage/sqlite/connector-account-repository.js +7 -5
- package/dist/src/storage/sqlite/connector-repository.js +36 -34
- package/dist/src/storage/sqlite/index.d.ts +2 -2
- package/dist/src/storage/sqlite/index.js +3 -3
- package/dist/src/storage/sqlite/migrations/209_automation_event_hub.sql +48 -0
- package/dist/src/storage/sqlite/migrations/210_remove_legacy_automation_timeout.sql +14 -0
- package/dist/src/storage/sqlite/migrations/211_automation_result_deliveries.sql +16 -0
- package/dist/src/storage/sqlite/migrations/212_automation_delivery_policy.sql +30 -0
- package/dist/src/storage/sqlite/migrations/213_automation_reliability_contract.sql +188 -0
- package/dist/src/storage/sqlite/migrations/214_ai_usage_ledger.sql +41 -0
- package/dist/src/storage/sqlite/migrations/215_scene_execution_adapters.sql +6 -0
- package/dist/src/storage/sqlite/migrations/216_remove_scene_model_usage.sql +1 -0
- package/dist/src/storage/sqlite/migrations/217_remove_legacy_memory_tables.sql +4 -0
- package/dist/src/storage/sqlite/migrations/218_core_relation_indexes.sql +26 -0
- package/dist/src/storage/sqlite/migrations/219_json_contracts.sql +123 -0
- package/dist/src/storage/sqlite/migrations/220_normalize_timestamps.sql +339 -0
- package/dist/src/storage/sqlite/migrations/221_ai_usage_retention_index.sql +2 -0
- package/dist/src/storage/sqlite/migrations/222_session_config_authority.sql +13 -0
- 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 +4 -4
- package/dist/src/storage/sqlite/row-mappers.d.ts +3 -7
- package/dist/src/storage/sqlite/row-mappers.js +6 -6
- package/dist/src/storage/sqlite/scenes-schema.d.ts +1 -1
- package/dist/src/storage/sqlite/scenes-schema.js +0 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +0 -52
- package/dist/src/storage/sqlite/schemas/scenes.sql +0 -7
- 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 +12 -2
- package/dist/src/storage/sqlite/session-input-repository.js +25 -2
- package/dist/src/storage/sqlite/session-read-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/session-read-repository.js +0 -1
- package/dist/src/storage/sqlite/session-repository.d.ts +0 -4
- package/dist/src/storage/sqlite/session-repository.js +8 -18
- package/dist/src/storage/sqlite/timestamps.d.ts +4 -0
- package/dist/src/storage/sqlite/timestamps.js +20 -0
- package/dist/src/storage/sqlite/transcript-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/transcript-repository.js +23 -15
- package/dist/src/storage/sqlite/user-trust-repository.js +4 -2
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.d.ts +1 -1
- package/dist/src/tasks/home-query-service.js +3 -3
- package/dist/src/tasks/task-contract-planner.js +1 -1
- 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/usage/cost.d.ts +4 -0
- package/dist/src/usage/cost.js +28 -0
- package/dist/src/usage/recorder.d.ts +13 -0
- package/dist/src/usage/recorder.js +117 -0
- package/dist/src/usage/scenario-registry.d.ts +8 -0
- package/dist/src/usage/scenario-registry.js +117 -0
- package/dist/src/usage/types.d.ts +55 -0
- package/dist/src/usage/types.js +1 -0
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/voice/tts/summarize.js +1 -1
- package/dist/src/work-discovery/analyzer.js +2 -2
- package/dist/src/work-discovery/investigator.js +1 -1
- package/dist/src/work-discovery/service.js +3 -6
- package/dist/src/workflows/service/workflow-run-service.js +16 -3
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Se1Z72VG.js +0 -1
- package/dist/gateway/static/root/assets/agents-udIitwV8.js +0 -70
- package/dist/gateway/static/root/assets/apps-page-DVNySL58.js +0 -1
- package/dist/gateway/static/root/assets/attachment-load-DNCDbeOX.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BMgJvdcv.js +0 -7
- package/dist/gateway/static/root/assets/binary-plugins-BYn2hScX.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-CHA-sTAZ.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-v0WkhV5o.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DefBGjhV.js +0 -8
- package/dist/gateway/static/root/assets/capability-header-actions-vmx35sbu.js +0 -1
- package/dist/gateway/static/root/assets/channels-Eo4ONF5X.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DZYgogQw.js +0 -2
- package/dist/gateway/static/root/assets/conversation-identity-Cw0n9uzK.js +0 -1
- package/dist/gateway/static/root/assets/date-picker-CrOV4Ynd.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-Du-Dos9O.js +0 -1
- package/dist/gateway/static/root/assets/home-page-D7YoMHq4.js +0 -1
- package/dist/gateway/static/root/assets/index-BEw0xrde.css +0 -1
- package/dist/gateway/static/root/assets/index-DalslRUx.js +0 -121
- package/dist/gateway/static/root/assets/local-app-workbench-page-BKL5UZAj.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CjzR9Rpj.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-Dk_gTJb9.js +0 -1
- package/dist/gateway/static/root/assets/media-plugins-Dlj6TD3M.js +0 -1
- package/dist/gateway/static/root/assets/messages-fmf0dnr4.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-BebJPjjk.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-CmS_hvz8.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-BArPtqp5.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-BFUdtWXF.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DBsBwAQ6.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BurdDY0m.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-Cj8xtr5t.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-BCsjgkCs.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BLL7csOJ.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CbKHBjrU.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-DyLfktib.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-BzvSNouj.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BHnru0F5.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-C35VKjhb.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-Bd1_Fguk.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-DuYzuR1T.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-B45YDiEw.js +0 -6
- package/dist/src/automations/product-events.d.ts +0 -5
- package/dist/src/automations/product-events.js +0 -19
- 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,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 };
|
|
@@ -4,6 +4,7 @@ import { SessionIndex } from '../../session/index.js';
|
|
|
4
4
|
import type { ExportFormat, SessionListQuery } from '../../session/types.js';
|
|
5
5
|
import type { SessionPatchBody } from '../../session/patch-metadata.js';
|
|
6
6
|
import { type SessionResetResult } from '../session-reset-service.js';
|
|
7
|
+
import type { ActiveExecution } from './active-execution.js';
|
|
7
8
|
export interface GatewaySessionsApiOptions {
|
|
8
9
|
sessionIndex: SessionIndex;
|
|
9
10
|
/** Resolves the live agent service (created lazily; throws if gateway is starting). */
|
|
@@ -15,6 +16,8 @@ export interface GatewaySessionsApiOptions {
|
|
|
15
16
|
conversationId: string;
|
|
16
17
|
runId: string;
|
|
17
18
|
}>;
|
|
19
|
+
/** Rich in-flight execution snapshot used for shutdown impact policy. */
|
|
20
|
+
listActiveExecutions: () => ActiveExecution[];
|
|
18
21
|
}
|
|
19
22
|
export declare class GatewaySessionsApi {
|
|
20
23
|
private readonly opts;
|
|
@@ -43,6 +46,15 @@ export declare class GatewaySessionsApi {
|
|
|
43
46
|
conversationId: string;
|
|
44
47
|
runId: string;
|
|
45
48
|
}>;
|
|
49
|
+
getQuitImpact(): Promise<{
|
|
50
|
+
shouldConfirm: boolean;
|
|
51
|
+
blockingCount: number;
|
|
52
|
+
blockingRuns: Array<ActiveExecution & {
|
|
53
|
+
title?: string;
|
|
54
|
+
}>;
|
|
55
|
+
backgroundCount: number;
|
|
56
|
+
assessedAt: number;
|
|
57
|
+
}>;
|
|
46
58
|
getMessagePage(key: string, options?: {
|
|
47
59
|
offset?: number;
|
|
48
60
|
limit?: number;
|
|
@@ -59,6 +71,7 @@ export declare class GatewaySessionsApi {
|
|
|
59
71
|
hasMore: boolean;
|
|
60
72
|
before?: string;
|
|
61
73
|
nextBeforeCursor?: string;
|
|
74
|
+
revision?: number;
|
|
62
75
|
};
|
|
63
76
|
}>;
|
|
64
77
|
getTimeline(key: string): Promise<import("../../session/transcript-outline.js").SessionTimelineItem[]>;
|
|
@@ -67,6 +67,29 @@ var GatewaySessionsApi = class {
|
|
|
67
67
|
listActiveRuns() {
|
|
68
68
|
return this.opts.listActiveWebchatRuns();
|
|
69
69
|
}
|
|
70
|
+
async getQuitImpact() {
|
|
71
|
+
const executions = this.opts.listActiveExecutions();
|
|
72
|
+
const blockingRuns = (await Promise.all(executions.map(async (execution) => {
|
|
73
|
+
const session = await this.getSession(execution.conversationId);
|
|
74
|
+
const title = session?.name?.trim().slice(0, 120);
|
|
75
|
+
const triggerSource = typeof session?.customData?.triggerSource === "string" ? session.customData.triggerSource : void 0;
|
|
76
|
+
return {
|
|
77
|
+
execution,
|
|
78
|
+
title,
|
|
79
|
+
backgroundSession: session?.sessionType === "cron" || session?.sessionType === "heartbeat" || triggerSource === "automation"
|
|
80
|
+
};
|
|
81
|
+
}))).filter(({ execution, backgroundSession }) => execution.initiator === "user" && execution.phase === "running" && !backgroundSession).map(({ execution, title }) => ({
|
|
82
|
+
...execution,
|
|
83
|
+
...title ? { title } : {}
|
|
84
|
+
}));
|
|
85
|
+
return {
|
|
86
|
+
shouldConfirm: blockingRuns.length > 0,
|
|
87
|
+
blockingCount: blockingRuns.length,
|
|
88
|
+
blockingRuns,
|
|
89
|
+
backgroundCount: executions.length - blockingRuns.length,
|
|
90
|
+
assessedAt: Date.now()
|
|
91
|
+
};
|
|
92
|
+
}
|
|
70
93
|
getMessagePage(key, options) {
|
|
71
94
|
return this.opts.sessionIndex.getSessionMessagePage(key, options);
|
|
72
95
|
}
|
|
@@ -2,7 +2,7 @@ import { WorkDiscoveryService } from '../work-discovery/service.js';
|
|
|
2
2
|
import { ConnectionRecoveryService } from '../connectors/connection-recovery-service.js';
|
|
3
3
|
import { AgentService } from '../agent/service.js';
|
|
4
4
|
import { MessageBus } from '../infra/bus/index.js';
|
|
5
|
-
import { AutomationService } from '../automations/index.js';
|
|
5
|
+
import { AutomationService, type AutomationEvent } from '../automations/index.js';
|
|
6
6
|
import { DiscussionLiveWorker, DiscussionOrganizerWorker, DiscussionSealer, DiscussionService } from '../discussions/index.js';
|
|
7
7
|
import { NotesService } from '../notes/index.js';
|
|
8
8
|
import { WorkflowRunService } from '../workflows/service/workflow-run-service.js';
|
|
@@ -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';
|
|
@@ -77,7 +78,6 @@ export declare class GatewayService {
|
|
|
77
78
|
private connectorSupervisor;
|
|
78
79
|
private connectorLearningCoordinator;
|
|
79
80
|
private connectedKnowledgeCoordinator;
|
|
80
|
-
private stopAutomationProductEventBridge;
|
|
81
81
|
private stopSessionTranscriptAutomationEvents;
|
|
82
82
|
private stopRealtimeLogBridge;
|
|
83
83
|
/**
|
|
@@ -86,6 +86,7 @@ export declare class GatewayService {
|
|
|
86
86
|
* `activeWebchatRunBySession` + `runAbortControllers` maps.
|
|
87
87
|
*/
|
|
88
88
|
readonly agentRunner: GatewayAgentRunner;
|
|
89
|
+
readonly sessionPreparations: SessionPreparationWorker;
|
|
89
90
|
/** Process-local, non-persistent side conversations forked from durable sessions. */
|
|
90
91
|
readonly sideChats: EphemeralSideChatManager;
|
|
91
92
|
readonly sideChatRuns: SideChatRunService;
|
|
@@ -146,6 +147,28 @@ export declare class GatewayService {
|
|
|
146
147
|
ok: false;
|
|
147
148
|
code: "BAD_REQUEST" | "QUEUE_FULL" | "CONTEXT_UNAVAILABLE" | "SESSION_CHANGED";
|
|
148
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>;
|
|
149
172
|
private appContextDispatcher;
|
|
150
173
|
prepareSessionAppContext(input: unknown, principal: GatewayPrincipal, conversationId: string, clientMessageId: string): Promise<import("../agent/source-context/types.js").AgentSourceContext>;
|
|
151
174
|
replaceLatestSessionTurn(...args: Parameters<GatewayAgentRunner['replaceLatestSessionTurn']>): Promise<{
|
|
@@ -329,7 +352,11 @@ export declare class GatewayService {
|
|
|
329
352
|
processDirect(content: string, conversationId?: string): Promise<string>;
|
|
330
353
|
emit(type: string, payload: unknown): void;
|
|
331
354
|
private handleAutomationRunCompleted;
|
|
332
|
-
private
|
|
355
|
+
private startSessionTranscriptEventIngestion;
|
|
356
|
+
ingestAutomationEvent(event: AutomationEvent, options?: {
|
|
357
|
+
targetAutomationIds?: string[];
|
|
358
|
+
}): import("../automations/index.js").AutomationEventIngestResult;
|
|
359
|
+
private projectAutomationEvent;
|
|
333
360
|
/**
|
|
334
361
|
* Validate authentication token from request headers.
|
|
335
362
|
* Returns true if auth is disabled (mode: 'none') or token is valid.
|
|
@@ -10,30 +10,29 @@ import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transacti
|
|
|
10
10
|
import { getBrowserTabBindingById, init_browser_tab_binding_repository } from "../storage/sqlite/browser-tab-binding-repository.js";
|
|
11
11
|
import { findSessionInput, init_session_input_repository, insertSessionInput } from "../storage/sqlite/session-input-repository.js";
|
|
12
12
|
import { TaskRepository } from "../tasks/task-repository.js";
|
|
13
|
-
import { TaskRunRepository, init_task_run_repository } from "../tasks/task-run-repository.js";
|
|
14
13
|
import { init_changes, notifyUserContextChange } from "../user-context/changes.js";
|
|
15
14
|
import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js";
|
|
16
15
|
import { init_session_repository, listSessionMetadata, patchSessionMetadata } from "../storage/sqlite/session-repository.js";
|
|
17
16
|
import { getSessionConfig, init_config_repository } from "../storage/sqlite/config-repository.js";
|
|
18
17
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
19
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";
|
|
20
21
|
import { init_config, resolveKnowledgeReadPolicy } from "../user-context/config.js";
|
|
21
22
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
22
|
-
import {
|
|
23
|
+
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
23
24
|
import { init_agent_session_key, resolveAgentMainConversationId } from "../routing/agent-session-key.js";
|
|
24
25
|
import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
|
|
25
26
|
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
26
|
-
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
27
|
-
import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
28
|
-
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
29
27
|
import { init_providers, providers_exports } from "../providers/index.js";
|
|
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";
|
|
33
33
|
import { getEmbeddedExecutionSession } from "../agent/embedded/execution-context.js";
|
|
34
34
|
import { disposeAllSessionMcpRuntimes } from "../agent/mcp/bundle-mcp-runtime.js";
|
|
35
35
|
import { DomainOutboxDispatcher } from "../infra/domain-outbox-dispatcher.js";
|
|
36
|
-
import { onAutomationProductEvent, publishAutomationProductEvent } from "../automations/product-events.js";
|
|
37
36
|
import { ProjectService } from "../projects/project-service.js";
|
|
38
37
|
import { resolveProjectAgentId } from "../projects/project-agent.js";
|
|
39
38
|
import "../projects/index.js";
|
|
@@ -133,6 +132,7 @@ import { GatewaySessionsApi } from "./service/sessions-api.js";
|
|
|
133
132
|
import { GatewayMarketplaceService } from "./service/marketplace-service.js";
|
|
134
133
|
import { GatewayConfigCoordinator } from "./service/config-coordinator.js";
|
|
135
134
|
import { GatewayAgentRunner } from "./service/agent-runner.js";
|
|
135
|
+
import { SessionPreparationWorker } from "./service/session-preparation-worker.js";
|
|
136
136
|
import { isBrowserSessionActive } from "../storage/sqlite/browser-session-repository.js";
|
|
137
137
|
import { RealtimeRuntime } from "../realtime/runtime.js";
|
|
138
138
|
import { VoiceRealtimeRuntime } from "../voice/realtime/runtime.js";
|
|
@@ -165,7 +165,6 @@ init_package_version();
|
|
|
165
165
|
init_resolve_route();
|
|
166
166
|
init_session_key();
|
|
167
167
|
init_sqlite();
|
|
168
|
-
init_task_run_repository();
|
|
169
168
|
init_transaction();
|
|
170
169
|
init_config();
|
|
171
170
|
const log = createLogger("Gateway:Service");
|
|
@@ -306,7 +305,6 @@ var GatewayService = class {
|
|
|
306
305
|
connectorSupervisor = null;
|
|
307
306
|
connectorLearningCoordinator = null;
|
|
308
307
|
connectedKnowledgeCoordinator = null;
|
|
309
|
-
stopAutomationProductEventBridge = null;
|
|
310
308
|
stopSessionTranscriptAutomationEvents = null;
|
|
311
309
|
stopRealtimeLogBridge = null;
|
|
312
310
|
/**
|
|
@@ -315,6 +313,7 @@ var GatewayService = class {
|
|
|
315
313
|
* `activeWebchatRunBySession` + `runAbortControllers` maps.
|
|
316
314
|
*/
|
|
317
315
|
agentRunner;
|
|
316
|
+
sessionPreparations = new SessionPreparationWorker(this);
|
|
318
317
|
/** Process-local, non-persistent side conversations forked from durable sessions. */
|
|
319
318
|
sideChats;
|
|
320
319
|
sideChatRuns;
|
|
@@ -363,6 +362,9 @@ var GatewayService = class {
|
|
|
363
362
|
this.bus = new MessageBus();
|
|
364
363
|
this.configPath = serviceConfig.configPath || resolveConfigPath();
|
|
365
364
|
bootstrapApplicationStateSync(this.configPath);
|
|
365
|
+
const now = Date.now();
|
|
366
|
+
markStaleAiUsageEventsUnknown(now - 360 * 60 * 1e3, now);
|
|
367
|
+
pruneAiUsageEvents(now - AI_USAGE_RETENTION_MS);
|
|
366
368
|
this.config = loadConfig(this.configPath);
|
|
367
369
|
let bootstrapConfigChanged = initializeVoiceDefaults(this.config, inferProductLanguageFromEnvironment());
|
|
368
370
|
if (sanitizeTunnelConfig(this.config)) bootstrapConfigChanged = true;
|
|
@@ -439,9 +441,16 @@ var GatewayService = class {
|
|
|
439
441
|
openQuestionCount: organization.openQuestions.length
|
|
440
442
|
};
|
|
441
443
|
this.emit("discussion.completed", payload);
|
|
442
|
-
|
|
444
|
+
this.ingestAutomationEvent({
|
|
445
|
+
id: `discussion:${capture.id}:completed:${capture.completedAt}`,
|
|
443
446
|
type: "discussion.completed",
|
|
444
447
|
source: "discussions",
|
|
448
|
+
subject: {
|
|
449
|
+
kind: "discussion",
|
|
450
|
+
id: capture.id
|
|
451
|
+
},
|
|
452
|
+
dedupeKey: `${capture.id}:${capture.completedAt}`,
|
|
453
|
+
trust: "system",
|
|
445
454
|
payload,
|
|
446
455
|
occurredAtMs: capture.completedAt
|
|
447
456
|
});
|
|
@@ -576,7 +585,8 @@ var GatewayService = class {
|
|
|
576
585
|
sessionIndex: this.sessionIndex,
|
|
577
586
|
getAgentService: () => this.ensureAgentService(),
|
|
578
587
|
getActiveWebchatRunId: (sk) => this.agentRunner.getActiveRunId(sk),
|
|
579
|
-
listActiveWebchatRuns: () => this.agentRunner.listActiveRuns()
|
|
588
|
+
listActiveWebchatRuns: () => this.agentRunner.listActiveRuns(),
|
|
589
|
+
listActiveExecutions: () => this.agentRunner.listActiveExecutions()
|
|
580
590
|
});
|
|
581
591
|
this.marketplace = new GatewayMarketplaceService({
|
|
582
592
|
getConfig: () => this.config,
|
|
@@ -730,7 +740,7 @@ var GatewayService = class {
|
|
|
730
740
|
};
|
|
731
741
|
},
|
|
732
742
|
executeSystemAction: (input) => this.executeSystemAutomationAction(input),
|
|
733
|
-
onRunCompleted: (run) => this.handleAutomationRunCompleted(run)
|
|
743
|
+
onRunCompleted: (run, context) => this.handleAutomationRunCompleted(run, context)
|
|
734
744
|
});
|
|
735
745
|
return this._agentService;
|
|
736
746
|
}
|
|
@@ -744,11 +754,8 @@ var GatewayService = class {
|
|
|
744
754
|
})).conversationId;
|
|
745
755
|
},
|
|
746
756
|
runAgent: async (runId, conversationId, message) => {
|
|
747
|
-
const
|
|
748
|
-
if (getSqliteDatabase().prepare("SELECT 1 FROM scene_task_bindings WHERE task_id = ?").get(taskRun.taskId)) {
|
|
749
|
-
if (!this.sceneHost?.http.followUps) throw new Error("Task follow-up runtime is disabled");
|
|
757
|
+
for (const adapter of this.sceneHost?.http.activationAdapters.list() ?? []) if (adapter.executeTask && await adapter.executeTask(runId, conversationId)) {
|
|
750
758
|
this.ensureAgentService();
|
|
751
|
-
await this.sceneHost.http.followUps.executeTask(runId, conversationId);
|
|
752
759
|
return;
|
|
753
760
|
}
|
|
754
761
|
const clientMessageId = `task:${runId}`;
|
|
@@ -778,7 +785,11 @@ var GatewayService = class {
|
|
|
778
785
|
createNotificationService() {
|
|
779
786
|
if (!this.notificationService) this.notificationService = new NotificationService({
|
|
780
787
|
publish: (type, payload) => this.realtime.broker.publish("gateway", type, payload),
|
|
781
|
-
allowsNotification: (notification) =>
|
|
788
|
+
allowsNotification: (notification) => {
|
|
789
|
+
if (notification.target.kind !== "task") return true;
|
|
790
|
+
const taskId = notification.target.taskId;
|
|
791
|
+
return (this.sceneHost?.http.activationAdapters.list() ?? []).every((adapter) => adapter.allowsTaskNotification?.(taskId) !== false);
|
|
792
|
+
}
|
|
782
793
|
});
|
|
783
794
|
return this.notificationService;
|
|
784
795
|
}
|
|
@@ -866,10 +877,8 @@ var GatewayService = class {
|
|
|
866
877
|
};
|
|
867
878
|
}
|
|
868
879
|
dispatchTaskEvents() {
|
|
869
|
-
new DomainOutboxDispatcher((
|
|
870
|
-
|
|
871
|
-
else publishAutomationProductEvent(event);
|
|
872
|
-
}).drain();
|
|
880
|
+
new DomainOutboxDispatcher().drain();
|
|
881
|
+
this.automationService.dispatchEvents();
|
|
873
882
|
}
|
|
874
883
|
runAgent(...args) {
|
|
875
884
|
return this.agentRunner.runAgent(...args);
|
|
@@ -884,6 +893,15 @@ var GatewayService = class {
|
|
|
884
893
|
submitSessionInput(...args) {
|
|
885
894
|
return this.agentRunner.submitSessionInput(...args);
|
|
886
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
|
+
}
|
|
887
905
|
appContextDispatcher() {
|
|
888
906
|
return createProductDispatcher(() => this.notesService, {
|
|
889
907
|
getProjects: () => this.projects,
|
|
@@ -1135,6 +1153,7 @@ var GatewayService = class {
|
|
|
1135
1153
|
});
|
|
1136
1154
|
this.ensureAgentService();
|
|
1137
1155
|
this.agentRunner.recoverSessionInputs();
|
|
1156
|
+
this.sessionPreparations.start();
|
|
1138
1157
|
this.connectionRecovery.start();
|
|
1139
1158
|
this.channelManager.setOutboundHooks({
|
|
1140
1159
|
runMessageSending: (to, content, channel) => this.agentService.outboundCoordinator.invokeOutboundMessageSending(to, content, channel),
|
|
@@ -1239,9 +1258,11 @@ var GatewayService = class {
|
|
|
1239
1258
|
};
|
|
1240
1259
|
},
|
|
1241
1260
|
executeSystemAction: (input) => this.executeSystemAutomationAction(input),
|
|
1242
|
-
onRunCompleted: (run) => this.handleAutomationRunCompleted(run)
|
|
1261
|
+
onRunCompleted: (run, context) => this.handleAutomationRunCompleted(run, context),
|
|
1262
|
+
onEvent: (event) => this.projectAutomationEvent(event),
|
|
1263
|
+
onReliabilityAttention: (input) => this.emit("automation.attention.required", input)
|
|
1243
1264
|
});
|
|
1244
|
-
this.
|
|
1265
|
+
this.startSessionTranscriptEventIngestion();
|
|
1245
1266
|
await trace.measure("workflows.reconcile", () => this.reconcileInterruptedWorkflowRuns());
|
|
1246
1267
|
this.sessionIndex.on("sessionUpdated", (data) => {
|
|
1247
1268
|
this.emit("session.updated", {
|
|
@@ -1268,7 +1289,7 @@ var GatewayService = class {
|
|
|
1268
1289
|
});
|
|
1269
1290
|
this.managedComposioEventPoller = new ManagedComposioEventPoller({
|
|
1270
1291
|
getConfig: () => this.config,
|
|
1271
|
-
|
|
1292
|
+
ingestEvent: (event) => this.ingestAutomationEvent(event),
|
|
1272
1293
|
requestLearning: (toolkit) => {
|
|
1273
1294
|
this.requestConnectorLearningForToolkit(toolkit);
|
|
1274
1295
|
},
|
|
@@ -1387,6 +1408,7 @@ var GatewayService = class {
|
|
|
1387
1408
|
}
|
|
1388
1409
|
async stop() {
|
|
1389
1410
|
if (!this.running) return;
|
|
1411
|
+
await this.sessionPreparations.stop();
|
|
1390
1412
|
setPairingBroadcastSink(null);
|
|
1391
1413
|
this.stopRealtimeLogBridge?.();
|
|
1392
1414
|
this.stopRealtimeLogBridge = null;
|
|
@@ -1442,8 +1464,6 @@ var GatewayService = class {
|
|
|
1442
1464
|
await this.channelManager.stop();
|
|
1443
1465
|
await this.extensionLoader?.shutdown();
|
|
1444
1466
|
await this.automationService.stop();
|
|
1445
|
-
this.stopAutomationProductEventBridge?.();
|
|
1446
|
-
this.stopAutomationProductEventBridge = null;
|
|
1447
1467
|
this.stopSessionTranscriptAutomationEvents?.();
|
|
1448
1468
|
this.stopSessionTranscriptAutomationEvents = null;
|
|
1449
1469
|
buckets.destroyAll();
|
|
@@ -1787,67 +1807,26 @@ var GatewayService = class {
|
|
|
1787
1807
|
this.realtime.broker.publish("gateway", type, payload);
|
|
1788
1808
|
this.createNotificationService().handleGatewayEvent(type, payload);
|
|
1789
1809
|
}
|
|
1790
|
-
handleAutomationRunCompleted(run) {
|
|
1791
|
-
this.
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
this.emit("automation.run.completed", {
|
|
1795
|
-
run,
|
|
1796
|
-
notificationPolicy: automation.notificationPolicy,
|
|
1797
|
-
requiresAttention,
|
|
1798
|
-
projectId: automation.projectId
|
|
1799
|
-
});
|
|
1800
|
-
}).catch((err) => {
|
|
1801
|
-
log.warn({
|
|
1802
|
-
err,
|
|
1803
|
-
automationId: run.automationId,
|
|
1804
|
-
runId: run.id
|
|
1805
|
-
}, "Automation completion event failed");
|
|
1810
|
+
async handleAutomationRunCompleted(run, context) {
|
|
1811
|
+
this.emit("automation.run.completed", {
|
|
1812
|
+
run,
|
|
1813
|
+
...context
|
|
1806
1814
|
});
|
|
1807
1815
|
}
|
|
1808
|
-
|
|
1809
|
-
this.stopAutomationProductEventBridge?.();
|
|
1816
|
+
startSessionTranscriptEventIngestion() {
|
|
1810
1817
|
this.stopSessionTranscriptAutomationEvents?.();
|
|
1811
|
-
this.stopAutomationProductEventBridge = onAutomationProductEvent((event) => {
|
|
1812
|
-
if (event.type === "project.deleted" && typeof event.payload.projectId === "string") {
|
|
1813
|
-
const runIds = event.payload.deletedUnderstandingRunIds;
|
|
1814
|
-
if (Array.isArray(runIds) && runIds.every((id) => typeof id === "string")) this._workDiscovery?.abortDeletedProjectRuns(event.payload.projectId, runIds);
|
|
1815
|
-
}
|
|
1816
|
-
if (event.type === "note.created" || event.type === "note.updated" || event.type === "note.deleted" || event.type === "task.changed.v2" || event.type === "task.deleted.v1" || event.type === "project.changed" || event.type === "project.created" || event.type === "project.deleted" || event.type === "scene.changed" || event.type === "scene.created" || event.type === "scene.deleted") {
|
|
1817
|
-
const note = event.type.startsWith("note.");
|
|
1818
|
-
const project = event.type.startsWith("project.");
|
|
1819
|
-
const scene = event.type.startsWith("scene.");
|
|
1820
|
-
const payload = event.payload;
|
|
1821
|
-
if (typeof payload.sourceEventId === "string") this.realtime.broker.publish(note ? "resources:notes" : project ? "resources:projects" : scene ? "resources:scenes" : "resources:tasks", "resource.changed", {
|
|
1822
|
-
eventId: payload.sourceEventId,
|
|
1823
|
-
kind: note ? "note" : project ? "project" : scene ? "scene" : "task",
|
|
1824
|
-
id: note ? payload.noteId : project ? payload.projectId : scene ? payload.sceneId : payload.taskId,
|
|
1825
|
-
revision: note || scene ? payload.revision : payload.version,
|
|
1826
|
-
operation: event.type === "task.deleted.v1" || event.type.endsWith(".deleted") ? "deleted" : event.type.endsWith(".created") ? "created" : "updated",
|
|
1827
|
-
...typeof payload.operationId === "string" ? { operationId: payload.operationId } : {}
|
|
1828
|
-
});
|
|
1829
|
-
}
|
|
1830
|
-
if (event.type.startsWith("task.")) this.emit(event.type, event.payload);
|
|
1831
|
-
if (this.config.userContext.homeIntelligence.refreshOnContextChange && (event.type.startsWith("task.") || event.type.startsWith("project."))) {
|
|
1832
|
-
const payload = event.payload;
|
|
1833
|
-
const objectId = event.type.startsWith("task.") ? payload.taskId : payload.projectId;
|
|
1834
|
-
const revision = payload.version ?? payload.revision ?? "unknown";
|
|
1835
|
-
this.homeIntelligenceHost?.requestRefresh(event.type.startsWith("task.") ? "task_changed" : "project_changed", `domain:${event.type}:${String(objectId)}:${String(revision)}`);
|
|
1836
|
-
}
|
|
1837
|
-
this.automationService.triggerEvent(event).catch((err) => {
|
|
1838
|
-
const em = err instanceof Error ? err.message : String(err);
|
|
1839
|
-
log.warn({
|
|
1840
|
-
err,
|
|
1841
|
-
eventType: event.type,
|
|
1842
|
-
source: event.source
|
|
1843
|
-
}, `Automation product event failed: ${em}`);
|
|
1844
|
-
});
|
|
1845
|
-
});
|
|
1846
1818
|
this.stopSessionTranscriptAutomationEvents = onSessionTranscriptUpdate((update) => {
|
|
1847
1819
|
if (!update.conversationId || getSessionMetadata(update.conversationId)?.sourceChannel === "automation") return;
|
|
1848
|
-
|
|
1820
|
+
this.ingestAutomationEvent({
|
|
1849
1821
|
type: "session.transcript.updated",
|
|
1850
1822
|
source: "sessions",
|
|
1823
|
+
subject: {
|
|
1824
|
+
kind: "session",
|
|
1825
|
+
id: update.conversationId
|
|
1826
|
+
},
|
|
1827
|
+
correlationId: update.conversationId,
|
|
1828
|
+
dedupeKey: update.messageId ?? `${update.conversationId}:${Date.now()}`,
|
|
1829
|
+
trust: "system",
|
|
1851
1830
|
payload: {
|
|
1852
1831
|
conversationId: update.conversationId,
|
|
1853
1832
|
messageId: update.messageId,
|
|
@@ -1856,6 +1835,37 @@ var GatewayService = class {
|
|
|
1856
1835
|
});
|
|
1857
1836
|
});
|
|
1858
1837
|
}
|
|
1838
|
+
ingestAutomationEvent(event, options) {
|
|
1839
|
+
return this.automationService.ingestEvent(event, options?.targetAutomationIds);
|
|
1840
|
+
}
|
|
1841
|
+
projectAutomationEvent(event) {
|
|
1842
|
+
if (event.source === "local_apps") this.emit(event.type, event.payload);
|
|
1843
|
+
if (event.type === "project.deleted" && typeof event.payload.projectId === "string") {
|
|
1844
|
+
const runIds = event.payload.deletedUnderstandingRunIds;
|
|
1845
|
+
if (Array.isArray(runIds) && runIds.every((id) => typeof id === "string")) this._workDiscovery?.abortDeletedProjectRuns(event.payload.projectId, runIds);
|
|
1846
|
+
}
|
|
1847
|
+
if (event.type === "note.created" || event.type === "note.updated" || event.type === "note.deleted" || event.type === "task.changed.v2" || event.type === "task.deleted.v1" || event.type === "project.changed" || event.type === "project.created" || event.type === "project.deleted" || event.type === "scene.changed" || event.type === "scene.created" || event.type === "scene.deleted") {
|
|
1848
|
+
const note = event.type.startsWith("note.");
|
|
1849
|
+
const project = event.type.startsWith("project.");
|
|
1850
|
+
const scene = event.type.startsWith("scene.");
|
|
1851
|
+
const payload = event.payload;
|
|
1852
|
+
if (typeof payload.sourceEventId === "string") this.realtime.broker.publish(note ? "resources:notes" : project ? "resources:projects" : scene ? "resources:scenes" : "resources:tasks", "resource.changed", {
|
|
1853
|
+
eventId: payload.sourceEventId,
|
|
1854
|
+
kind: note ? "note" : project ? "project" : scene ? "scene" : "task",
|
|
1855
|
+
id: note ? payload.noteId : project ? payload.projectId : scene ? payload.sceneId : payload.taskId,
|
|
1856
|
+
revision: note || scene ? payload.revision : payload.version,
|
|
1857
|
+
operation: event.type === "task.deleted.v1" || event.type.endsWith(".deleted") ? "deleted" : event.type.endsWith(".created") ? "created" : "updated",
|
|
1858
|
+
...typeof payload.operationId === "string" ? { operationId: payload.operationId } : {}
|
|
1859
|
+
});
|
|
1860
|
+
}
|
|
1861
|
+
if (event.type.startsWith("task.")) this.emit(event.type, event.payload);
|
|
1862
|
+
if (this.config.userContext.homeIntelligence.refreshOnContextChange && (event.type.startsWith("task.") || event.type.startsWith("project."))) {
|
|
1863
|
+
const payload = event.payload;
|
|
1864
|
+
const objectId = event.type.startsWith("task.") ? payload.taskId : payload.projectId;
|
|
1865
|
+
const revision = payload.version ?? payload.revision ?? "unknown";
|
|
1866
|
+
this.homeIntelligenceHost?.requestRefresh(event.type.startsWith("task.") ? "task_changed" : "project_changed", `domain:${event.type}:${String(objectId)}:${String(revision)}`);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1859
1869
|
/**
|
|
1860
1870
|
* Validate authentication token from request headers.
|
|
1861
1871
|
* Returns true if auth is disabled (mode: 'none') or token is valid.
|
|
@@ -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,
|
|
@@ -92,14 +92,17 @@ var SideChatRunService = class {
|
|
|
92
92
|
media: input.attachments?.map(({ data: _data, ...attachment }) => attachment),
|
|
93
93
|
timestamp: Date.now()
|
|
94
94
|
});
|
|
95
|
-
this.options.agentRunner.registerExternalWebchatRun(run.executionConversationId, run.runId, (event) => publishMapped(event), {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
this.options.agentRunner.registerExternalWebchatRun(run.executionConversationId, run.runId, (event) => publishMapped(event), {
|
|
96
|
+
kind: "side-chat",
|
|
97
|
+
beforeClarificationResponse: () => {
|
|
98
|
+
try {
|
|
99
|
+
this.options.manager.setStatus(run.sideChatId, run.clientInstanceId, "running");
|
|
100
|
+
return true;
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
101
104
|
}
|
|
102
|
-
}
|
|
105
|
+
});
|
|
103
106
|
const result = await this.options.getAgentService().runEphemeralTurn({
|
|
104
107
|
executionConversationId: run.executionConversationId,
|
|
105
108
|
parentConversationId: this.options.manager.get(run.sideChatId, run.clientInstanceId).parentConversationId,
|
|
@@ -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();
|