@xopcai/xopc 0.0.331 → 0.0.333
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/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0BtF24E.js → agent-avatar-dicebear-DiI2O7lC.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CVp3J969.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DbvLXQO2.js → agent-plugin-dialog-CacyndrS.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DXYZSuUV.js +70 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-fwzTRJfP.js → app-management-settings-panel-BcszTlqr.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-v_GGe8UZ.js → appearance-settings-B1XPe8qz.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-C9ZMEuuA.js → apps-page-ZqANbUZv.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-B6EgADeH.js → archive-plugin-MjUsJcNb.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-B4H_IFeX.js → attachment-load-DHa-BI9a.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-UlVCvg4r.js → automations-page-Dsjivdxs.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-B37vs5tk.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BxTSx30f.js → binary-plugins-DQYcuBHP.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CVzdrpjl.js → block-editor-Bx0uXbJP.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-C5s1yHOu.js → browser-automation-inputs-1ZIPGDeq.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CBVD8k6O.js → browser-automations-page-CCjYipHc.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CSv4rvmx.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-BnO9LV7U.js +1 -0
- package/dist/gateway/static/root/assets/{capabilities-page-BAT7Vvb8.js → capabilities-page-BfvDvIY1.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CoW7-ESq.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-EETjXmkG.js → capability-header-actions-D_hbWRRF.js} +1 -1
- package/dist/gateway/static/root/assets/channels-BhMaRh1x.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DCqm9j9W.js → chat-terminal-dock-Fnum_IEm.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-CxFWdovV.js → computer-settings-page-DI1zfCTA.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-wxsEhmlU.js → connector-service-page-CiGDAubm.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-Ono0Pha1.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-h_OS6uBR.js → date-picker-D-JhzZyW.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DNgSSH3z.js → dependency-picker-DpD3xaEB.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CflvPnB-.js → desktop-pet-CCoDxKqh.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CXy0X5Js.js → desktop-pet-settings-GxndKfCx.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-BDMiJcsK.js → device-pairing-wizard-B71w3ptm.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BqkOh13m.js → directory-picker-path-field-CUzjJvjs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-VT4s-9pK.js → extension-debug-page-BtDY8ntX.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CBSeGhGA.js → extension-page-D9_XF-XC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DRB6uOo8.js → extension-settings-page-CjhUFAaC.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-settings-lF-FpnZy.js → gateway-settings-BWaCnwT1.js} +1 -1
- 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-BTjGLngn.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-DGkOijwE.js → imports-page-BEtq5BRU.js} +1 -1
- package/dist/gateway/static/root/assets/index-DHL16aYZ.js +121 -0
- package/dist/gateway/static/root/assets/index-N1e6PDwx.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-iU6c2zg1.js → keyboard-shortcuts-settings-JUYY_18v.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-uI7mtoVz.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-C0BWC8D2.js → local-apps-page-BlYESNqz.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-wNXWkWu5.js → locale-store-BY30D6tg.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-Dpoi-r-_.js → logs-page-BbLQreeN.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-c4krhYU7.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DlT9KqwF.js → markdown-view-BEeXMfDw.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C8E_F2F_.js → media-plugins-DEFN1I73.js} +1 -1
- package/dist/gateway/static/root/assets/messages-_6IXbP2u.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel--09xGxyE.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-DsxcVBXF.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-qqWG_gs_.js → page-context-capture-button-D43aVpCj.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-b3lheKy4.js → page-tabs-BhYBCqls.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-0Q4rTfGX.js → preview-open-alternatives-CP8agNlc.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-jnJZCrKQ.js → product-open-page-CU7fRhfT.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-U-EdDfAW.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-r96k_2wB.js → projects-page-DUOKZLt7.js} +1 -1
- 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-B1d8pB_y.js → remote-access-hub-fVPQe5YS.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Do_iF13W.js → runtime-tools-settings-panel-Czvzsuj_.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-C0-WHOY3.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-Cfft26Je.js → schema-form-B9Ni5O93.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DdXvW09N.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BtF83fBY.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-iI0MTyuU.js → settings-form-section-jquf1P7n.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C2Ka9oJm.js → settings-page-DPomsvba.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-nnmS_p5h.js → setup-status-panel-BvVlqpHf.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-D0Knvtlp.js → share-preview-page-b9DI0N1J.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-R_qwc4DN.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-BuZKcy9b.js → skill-api-Bu7-3w-L.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CNJAQ_e-.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DcxWxIrR.js → skills-page-D7XPEQu_.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CMG0ZAsd.js → system-settings-panel-BwFR0Uci.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-PFjGW2g1.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-DGYA6GyO.js → tunnel-api-PfucxMP3.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-t_zdQHcy.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-CDemMoSX.js → use-autosave-DLyy2wHz.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-OyfPVfB9.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CXArY4t5.js → voice-api-key-field-CQDY5EBK.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-Dk5KsKOm.js → work-discovery-overlay-CJzqJ47I.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DNpdaI-2.js → workflow-run-setup-panel-sCOk-esV.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DYBGjN7C.js +6 -0
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +59 -14
- package/dist/packages/gateway-contract/src/capabilities.js +106 -8
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/gateway-contract/src/scenes.js +7 -6
- package/dist/packages/gateway-contract/src/sessions.js +2 -1
- package/dist/packages/gateway-contract/src/usage.js +6 -0
- package/dist/src/agent/agent-manager.js +13 -7
- package/dist/src/agent/background-review/run-background-review.js +7 -2
- package/dist/src/agent/bootstrap/filter-bootstrap-files.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 +44 -11
- package/dist/src/agent/external-tools/index.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- 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/orchestration/agent-orchestrator.js +0 -21
- package/dist/src/agent/service/btw-query.js +8 -2
- package/dist/src/agent/service.js +3 -3
- 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 +4 -0
- 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 +5 -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/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 +69 -14
- package/dist/src/automations/capabilities/write.js +78 -5
- 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 +2 -2
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +180 -7
- package/dist/src/automations/domain/validation.d.ts +172 -22
- package/dist/src/automations/domain/validation.js +82 -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 +31 -3
- package/dist/src/automations/draft/automation-draft-validator.js +5 -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 -24
- 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 +7 -7
- 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/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/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/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +4 -0
- package/dist/src/config/schema.js +5 -1
- package/dist/src/connectors/approval-resume.js +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-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/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.d.ts +3 -0
- package/dist/src/gateway/home-intelligence-automation-reconciler.js +52 -0
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/capabilities.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +18 -4
- package/dist/src/gateway/hono/routes/connection-waits.js +3 -2
- package/dist/src/gateway/hono/routes/home.js +0 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +14 -1
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- 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-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +15 -0
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/update.js +6 -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 +1 -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 +21 -15
- 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 +9 -1
- 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 +7 -3
- package/dist/src/gateway/service.js +108 -89
- 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 +4 -1
- package/dist/src/home-intelligence/host.d.ts +1 -1
- package/dist/src/home-intelligence/host.js +2 -10
- package/dist/src/home-intelligence/notification.js +1 -1
- package/dist/src/home-intelligence/repository.d.ts +1 -1
- package/dist/src/infra/domain-outbox-dispatcher.d.ts +0 -3
- package/dist/src/infra/domain-outbox-dispatcher.js +15 -7
- package/dist/src/infra/update-check.d.ts +8 -4
- package/dist/src/infra/update-check.js +43 -41
- package/dist/src/infra/update-startup.d.ts +7 -1
- package/dist/src/infra/update-startup.js +15 -6
- package/dist/src/local-apps/service.js +2 -2
- package/dist/src/memory-maintenance/index.js +2 -2
- package/dist/src/memory-maintenance/schedule.d.ts +0 -3
- package/dist/src/memory-maintenance/schedule.js +1 -8
- package/dist/src/notes/service.js +2 -3
- package/dist/src/projects/project-service.js +1 -2
- package/dist/src/projects/project-skill-service.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/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 -2
- 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/208_automation_management.sql +2 -0
- 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/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-input-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/session-input-repository.js +18 -1
- 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 +4 -3
- package/dist/src/tasks/task-contract-planner.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- 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/user-context/config.d.ts +9 -0
- package/dist/src/user-context/config.js +13 -4
- 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/workflows/service/workflow-run-service.js +15 -2
- package/package.json +6 -6
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DgP5DEJF.js +0 -1
- package/dist/gateway/static/root/assets/agents-Bh4XNLyk.js +0 -70
- package/dist/gateway/static/root/assets/automations-workspace-C7VS-yb7.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-CC43CC43.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-sAZT4brT.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DPETQOfF.js +0 -8
- package/dist/gateway/static/root/assets/channels-CwA619os.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-l7goF6QS.js +0 -2
- package/dist/gateway/static/root/assets/home-page-DSaXXoLm.js +0 -1
- package/dist/gateway/static/root/assets/index-BEw0xrde.css +0 -1
- package/dist/gateway/static/root/assets/index-D99vN3es.js +0 -121
- package/dist/gateway/static/root/assets/local-app-workbench-page-rH33N8I9.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-RFDLaquR.js +0 -1
- package/dist/gateway/static/root/assets/messages-fmf0dnr4.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-DI7CIjmM.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BkqnU-Jh.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-BvvcTH2F.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-DK316w9a.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-EIk8iJTK.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DcOsdz78.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BcaxGQLC.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Cb_CUL-U.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Cvr1qUTW.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-VXfz3rE7.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-DDNDLdId.js +0 -6
- package/dist/src/automations/product-events.d.ts +0 -5
- package/dist/src/automations/product-events.js +0 -19
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { listActiveSessionInputRuns } from "../../storage/sqlite/session-input-repository.js";
|
|
3
|
+
import { listActiveSessionInputExecutions, listActiveSessionInputRuns } from "../../storage/sqlite/session-input-repository.js";
|
|
4
4
|
import { createClarificationWait, getClarification, getClarificationSnapshot, init_clarification_wait_repository, resolveClarification, supersedeActiveClarification } from "../../storage/sqlite/clarification-wait-repository.js";
|
|
5
5
|
import { init_connection_wait_repository, onConnectionWaitChanged } from "../../storage/sqlite/connection-wait-repository.js";
|
|
6
6
|
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
7
7
|
import { EphemeralClarificationWaiter } from "../ephemeral-clarification-waiter.js";
|
|
8
|
+
import { describeActiveExecution } from "./active-execution.js";
|
|
8
9
|
import { runGatewayAgent } from "./run-gateway-agent.js";
|
|
9
10
|
import { fitSourceContextsToBudget } from "../../agent/source-context/budget.js";
|
|
10
11
|
import { SessionInputCoordinator } from "./session-input-coordinator.js";
|
|
@@ -29,6 +30,7 @@ var GatewayAgentRunner = class {
|
|
|
29
30
|
ephemeralClarifications = new EphemeralClarificationWaiter();
|
|
30
31
|
/** Maps webchat session key → active `runId` for `clarify` tool routing. */
|
|
31
32
|
activeWebchatRunBySession = /* @__PURE__ */ new Map();
|
|
33
|
+
activeExecutionBySession = /* @__PURE__ */ new Map();
|
|
32
34
|
externalStreamBySession = /* @__PURE__ */ new Map();
|
|
33
35
|
externalClarificationResponses = /* @__PURE__ */ new Map();
|
|
34
36
|
inputs;
|
|
@@ -118,18 +120,33 @@ var GatewayAgentRunner = class {
|
|
|
118
120
|
runId
|
|
119
121
|
}));
|
|
120
122
|
}
|
|
123
|
+
listActiveExecutions() {
|
|
124
|
+
const executions = new Map(listActiveSessionInputExecutions().map((run) => [run.conversationId, describeActiveExecution(run)]));
|
|
125
|
+
for (const [conversationId, execution] of this.activeExecutionBySession) executions.set(conversationId, execution);
|
|
126
|
+
return [...executions.values()];
|
|
127
|
+
}
|
|
121
128
|
disposeClarifications() {
|
|
122
129
|
this.ephemeralClarifications.dispose();
|
|
123
130
|
this.unsubscribeConnectionWait();
|
|
124
131
|
}
|
|
125
132
|
registerExternalWebchatRun(conversationId, runId, publish, options) {
|
|
126
133
|
this.activeWebchatRunBySession.set(conversationId, runId);
|
|
134
|
+
this.activeExecutionBySession.set(conversationId, describeActiveExecution({
|
|
135
|
+
conversationId,
|
|
136
|
+
runId,
|
|
137
|
+
origin: {
|
|
138
|
+
type: "endpoint",
|
|
139
|
+
endpointId: "electron-side-chat"
|
|
140
|
+
},
|
|
141
|
+
kind: options?.kind
|
|
142
|
+
}));
|
|
127
143
|
this.externalStreamBySession.set(conversationId, publish);
|
|
128
144
|
if (options?.beforeClarificationResponse) this.externalClarificationResponses.set(conversationId, options.beforeClarificationResponse);
|
|
129
145
|
}
|
|
130
146
|
unregisterExternalWebchatRun(conversationId, runId) {
|
|
131
147
|
if (this.activeWebchatRunBySession.get(conversationId) === runId) {
|
|
132
148
|
this.activeWebchatRunBySession.delete(conversationId);
|
|
149
|
+
this.activeExecutionBySession.delete(conversationId);
|
|
133
150
|
this.externalStreamBySession.delete(conversationId);
|
|
134
151
|
this.externalClarificationResponses.delete(conversationId);
|
|
135
152
|
}
|
|
@@ -152,6 +169,7 @@ var GatewayAgentRunner = class {
|
|
|
152
169
|
bus: this.opts.bus,
|
|
153
170
|
runAbortControllers: this.runAbortControllers,
|
|
154
171
|
activeWebchatRunBySession: this.activeWebchatRunBySession,
|
|
172
|
+
activeExecutionBySession: this.activeExecutionBySession,
|
|
155
173
|
sessionIndex: this.opts.sessionIndex,
|
|
156
174
|
emit: this.opts.emit,
|
|
157
175
|
publishRealtime: this.opts.publishRealtime,
|
|
@@ -3,12 +3,12 @@ import { createLogger } from "../../utils/logger/index.js";
|
|
|
3
3
|
import { init_logger } from "../../utils/logger.js";
|
|
4
4
|
import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
5
5
|
import { init_paths, resolveExtensionsDir } from "../../config/paths.js";
|
|
6
|
+
import { removeSkillsLockEntry } from "../../agent/skills/hub-lock.js";
|
|
7
|
+
import { deleteManagedSkill, installSkillFromZip, listManagedSkillDirs } from "../../agent/skills/managed-store.js";
|
|
6
8
|
import { getExtensionLockfileManager } from "../../extensions/lockfile.js";
|
|
7
9
|
import { AgentPluginStore } from "../../extensions/agent-plugins/store.js";
|
|
8
10
|
import { createSkillConfigManager } from "../../agent/skills/config.js";
|
|
9
11
|
import { resolveWorkspaceSkillsDir, resolveWorkspaceSkillsLockPath } from "../../agent/skills/workspace-skills-dir.js";
|
|
10
|
-
import { removeSkillsLockEntry } from "../../agent/skills/hub-lock.js";
|
|
11
|
-
import { deleteManagedSkill, installSkillFromZip, listManagedSkillDirs } from "../../agent/skills/managed-store.js";
|
|
12
12
|
import { normalizeSkillInstallTarget } from "../../agent/skills/install-target.js";
|
|
13
13
|
import { isAgentPluginArchive, withAgentPluginArchive } from "../../extensions/agent-plugins/sources.js";
|
|
14
14
|
import { existsSync, rmSync } from "node:fs";
|
|
@@ -6,6 +6,7 @@ import type { SessionIndex } from '../../session/index.js';
|
|
|
6
6
|
import type { ChatStreamEvent } from '../chat-stream/protocol.js';
|
|
7
7
|
import type { UserTurnAttachment } from '../user-turn-input.js';
|
|
8
8
|
import type { AgentSourceContext } from '../../agent/source-context/types.js';
|
|
9
|
+
import { type ActiveExecution } from './active-execution.js';
|
|
9
10
|
export type RunGatewayAgentYield = ChatStreamEvent;
|
|
10
11
|
export type RunGatewayAgentDeps = {
|
|
11
12
|
config: Config;
|
|
@@ -13,6 +14,7 @@ export type RunGatewayAgentDeps = {
|
|
|
13
14
|
bus: MessageBus;
|
|
14
15
|
runAbortControllers: Map<string, AbortController>;
|
|
15
16
|
activeWebchatRunBySession: Map<string, string>;
|
|
17
|
+
activeExecutionBySession: Map<string, ActiveExecution>;
|
|
16
18
|
sessionIndex: SessionIndex;
|
|
17
19
|
emit: (type: string, payload: unknown) => void;
|
|
18
20
|
publishRealtime: (topic: string, event: string, data: unknown) => void;
|
|
@@ -17,6 +17,7 @@ import { markdownNotificationPreview } from "../../notifications/plain-text.js";
|
|
|
17
17
|
import { resolveWebchatConversationId } from "../resolve-webchat-session-key.js";
|
|
18
18
|
import { recordExplicitRelationshipFollowUp } from "../../user-context/relationship-continuity.js";
|
|
19
19
|
import { coalesceThinkingDeltas } from "../chat-stream/thinking-delta-coalescer.js";
|
|
20
|
+
import { describeActiveExecution } from "./active-execution.js";
|
|
20
21
|
import crypto from "crypto";
|
|
21
22
|
//#region src/gateway/service/run-gateway-agent.ts
|
|
22
23
|
init_connection_wait_repository();
|
|
@@ -35,7 +36,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
35
36
|
max: 10
|
|
36
37
|
}, "Attachments capped for webchat");
|
|
37
38
|
const runId = runOptions?.runId ?? crypto.randomUUID();
|
|
38
|
-
const { agentService, bus, runAbortControllers, activeWebchatRunBySession, sessionIndex: sessionIndexFromDeps, emit, publishRealtime, completeRealtimeTopic } = deps;
|
|
39
|
+
const { agentService, bus, runAbortControllers, activeWebchatRunBySession, activeExecutionBySession, sessionIndex: sessionIndexFromDeps, emit, publishRealtime, completeRealtimeTopic } = deps;
|
|
39
40
|
const sessionIndex = sessionIndexFromDeps;
|
|
40
41
|
let taskRun;
|
|
41
42
|
let taskRunStatus = "failed";
|
|
@@ -132,6 +133,12 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
132
133
|
agentService.beginInboundTurn(conversationId);
|
|
133
134
|
if (!activeWebchatRunBySession.has(conversationId)) {
|
|
134
135
|
activeWebchatRunBySession.set(conversationId, runId);
|
|
136
|
+
activeExecutionBySession.set(conversationId, describeActiveExecution({
|
|
137
|
+
conversationId,
|
|
138
|
+
runId,
|
|
139
|
+
origin,
|
|
140
|
+
taskRunId: runOptions?.taskRunId
|
|
141
|
+
}));
|
|
135
142
|
registeredActiveWebchatRun = true;
|
|
136
143
|
publishRealtime("sessions", "run.started", {
|
|
137
144
|
conversationId,
|
|
@@ -217,6 +224,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
217
224
|
}
|
|
218
225
|
if (registeredActiveWebchatRun && activeWebchatRunBySession.get(conversationId) === runId) {
|
|
219
226
|
activeWebchatRunBySession.delete(conversationId);
|
|
227
|
+
activeExecutionBySession.delete(conversationId);
|
|
220
228
|
publishRealtime("sessions", "run.completed", {
|
|
221
229
|
conversationId,
|
|
222
230
|
runId,
|
|
@@ -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';
|
|
@@ -77,7 +77,6 @@ export declare class GatewayService {
|
|
|
77
77
|
private connectorSupervisor;
|
|
78
78
|
private connectorLearningCoordinator;
|
|
79
79
|
private connectedKnowledgeCoordinator;
|
|
80
|
-
private stopAutomationProductEventBridge;
|
|
81
80
|
private stopSessionTranscriptAutomationEvents;
|
|
82
81
|
private stopRealtimeLogBridge;
|
|
83
82
|
/**
|
|
@@ -318,6 +317,7 @@ export declare class GatewayService {
|
|
|
318
317
|
getEffectiveListenPort(): number;
|
|
319
318
|
get automationServiceInstance(): AutomationService;
|
|
320
319
|
private reconcileMemoryMaintenanceAutomations;
|
|
320
|
+
private executeSystemAutomationAction;
|
|
321
321
|
get notesServiceInstance(): NotesService;
|
|
322
322
|
get sessionIndexInstance(): SessionIndex;
|
|
323
323
|
/** Shared workflow run orchestrator + session bridge (one instance per gateway). */
|
|
@@ -328,7 +328,11 @@ export declare class GatewayService {
|
|
|
328
328
|
processDirect(content: string, conversationId?: string): Promise<string>;
|
|
329
329
|
emit(type: string, payload: unknown): void;
|
|
330
330
|
private handleAutomationRunCompleted;
|
|
331
|
-
private
|
|
331
|
+
private startSessionTranscriptEventIngestion;
|
|
332
|
+
ingestAutomationEvent(event: AutomationEvent, options?: {
|
|
333
|
+
targetAutomationIds?: string[];
|
|
334
|
+
}): import("../automations/index.js").AutomationEventIngestResult;
|
|
335
|
+
private projectAutomationEvent;
|
|
332
336
|
/**
|
|
333
337
|
* Validate authentication token from request headers.
|
|
334
338
|
* Returns true if auth is disabled (mode: 'none') or token is valid.
|
|
@@ -10,34 +10,35 @@ 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";
|
|
20
|
-
import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
21
|
-
import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
22
19
|
import { init_config, resolveKnowledgeReadPolicy } from "../user-context/config.js";
|
|
23
20
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
21
|
+
import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
24
22
|
import { init_agent_session_key, resolveAgentMainConversationId } from "../routing/agent-session-key.js";
|
|
25
23
|
import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
|
|
26
24
|
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
27
25
|
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
26
|
+
import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
28
27
|
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
29
28
|
import { init_providers, providers_exports } from "../providers/index.js";
|
|
29
|
+
import { AI_USAGE_RETENTION_MS, markStaleAiUsageEventsUnknown, pruneAiUsageEvents } from "../storage/sqlite/ai-usage-repository.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";
|
|
40
39
|
import { resolveEffectiveGatewayPort } from "./host.js";
|
|
40
|
+
import { runMemoryMaintenance } from "../memory-maintenance/service.js";
|
|
41
|
+
import "../memory-maintenance/index.js";
|
|
41
42
|
import { RealtimeExtensionBrowserProvider } from "../browser/providers/realtime-extension.js";
|
|
42
43
|
import { onSessionTranscriptUpdate } from "../session/transcript-events.js";
|
|
43
44
|
import { buildNoteAgentContext } from "../notes/agent-context.js";
|
|
@@ -72,12 +73,6 @@ import { ChatPreviewService } from "../chat-previews/service.js";
|
|
|
72
73
|
import "../chat-previews/index.js";
|
|
73
74
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
74
75
|
import "../config/index.js";
|
|
75
|
-
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
76
|
-
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
77
|
-
import "../knowledge/index.js";
|
|
78
|
-
import { ConnectionRecoveryService } from "../connectors/connection-recovery-service.js";
|
|
79
|
-
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
80
|
-
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
81
76
|
import { DiscussionService } from "../discussions/service.js";
|
|
82
77
|
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
83
78
|
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
@@ -86,10 +81,21 @@ import { DiscussionSealer } from "../discussions/sealer.js";
|
|
|
86
81
|
import "../discussions/index.js";
|
|
87
82
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
88
83
|
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";
|
|
89
94
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
90
95
|
import { prepareAutomationAgentSession } from "./automation-agent-session.js";
|
|
91
96
|
import { stopTailscaleExposure } from "./tailscale-lifecycle.js";
|
|
92
97
|
import { getGatewayFileSpaceService } from "./file-space-service.js";
|
|
98
|
+
import { reconcileHomeIntelligenceAutomation } from "./home-intelligence-automation-reconciler.js";
|
|
93
99
|
import { createBackgroundTask } from "../infra/background-task.js";
|
|
94
100
|
import { buildTaskAgentContext } from "../agent/source-context/task-context.js";
|
|
95
101
|
import { buildFileAgentContext } from "../agent/source-context/file-context.js";
|
|
@@ -140,10 +146,6 @@ import { createGatewayStartupTrace } from "./startup-trace.js";
|
|
|
140
146
|
import { GatewaySceneHost } from "./scenes/host.js";
|
|
141
147
|
import { checkAppContextAccess, prepareAppContext } from "./service/app-context-access.js";
|
|
142
148
|
import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults } from "../voice/language-profile.js";
|
|
143
|
-
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
144
|
-
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
145
|
-
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
146
|
-
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
147
149
|
import crypto from "node:crypto";
|
|
148
150
|
//#region src/gateway/service.ts
|
|
149
151
|
init_session_repository();
|
|
@@ -162,7 +164,6 @@ init_package_version();
|
|
|
162
164
|
init_resolve_route();
|
|
163
165
|
init_session_key();
|
|
164
166
|
init_sqlite();
|
|
165
|
-
init_task_run_repository();
|
|
166
167
|
init_transaction();
|
|
167
168
|
init_config();
|
|
168
169
|
const log = createLogger("Gateway:Service");
|
|
@@ -303,7 +304,6 @@ var GatewayService = class {
|
|
|
303
304
|
connectorSupervisor = null;
|
|
304
305
|
connectorLearningCoordinator = null;
|
|
305
306
|
connectedKnowledgeCoordinator = null;
|
|
306
|
-
stopAutomationProductEventBridge = null;
|
|
307
307
|
stopSessionTranscriptAutomationEvents = null;
|
|
308
308
|
stopRealtimeLogBridge = null;
|
|
309
309
|
/**
|
|
@@ -360,6 +360,9 @@ var GatewayService = class {
|
|
|
360
360
|
this.bus = new MessageBus();
|
|
361
361
|
this.configPath = serviceConfig.configPath || resolveConfigPath();
|
|
362
362
|
bootstrapApplicationStateSync(this.configPath);
|
|
363
|
+
const now = Date.now();
|
|
364
|
+
markStaleAiUsageEventsUnknown(now - 360 * 60 * 1e3, now);
|
|
365
|
+
pruneAiUsageEvents(now - AI_USAGE_RETENTION_MS);
|
|
363
366
|
this.config = loadConfig(this.configPath);
|
|
364
367
|
let bootstrapConfigChanged = initializeVoiceDefaults(this.config, inferProductLanguageFromEnvironment());
|
|
365
368
|
if (sanitizeTunnelConfig(this.config)) bootstrapConfigChanged = true;
|
|
@@ -436,9 +439,16 @@ var GatewayService = class {
|
|
|
436
439
|
openQuestionCount: organization.openQuestions.length
|
|
437
440
|
};
|
|
438
441
|
this.emit("discussion.completed", payload);
|
|
439
|
-
|
|
442
|
+
this.ingestAutomationEvent({
|
|
443
|
+
id: `discussion:${capture.id}:completed:${capture.completedAt}`,
|
|
440
444
|
type: "discussion.completed",
|
|
441
445
|
source: "discussions",
|
|
446
|
+
subject: {
|
|
447
|
+
kind: "discussion",
|
|
448
|
+
id: capture.id
|
|
449
|
+
},
|
|
450
|
+
dedupeKey: `${capture.id}:${capture.completedAt}`,
|
|
451
|
+
trust: "system",
|
|
442
452
|
payload,
|
|
443
453
|
occurredAtMs: capture.completedAt
|
|
444
454
|
});
|
|
@@ -573,7 +583,8 @@ var GatewayService = class {
|
|
|
573
583
|
sessionIndex: this.sessionIndex,
|
|
574
584
|
getAgentService: () => this.ensureAgentService(),
|
|
575
585
|
getActiveWebchatRunId: (sk) => this.agentRunner.getActiveRunId(sk),
|
|
576
|
-
listActiveWebchatRuns: () => this.agentRunner.listActiveRuns()
|
|
586
|
+
listActiveWebchatRuns: () => this.agentRunner.listActiveRuns(),
|
|
587
|
+
listActiveExecutions: () => this.agentRunner.listActiveExecutions()
|
|
577
588
|
});
|
|
578
589
|
this.marketplace = new GatewayMarketplaceService({
|
|
579
590
|
getConfig: () => this.config,
|
|
@@ -726,7 +737,8 @@ var GatewayService = class {
|
|
|
726
737
|
...result.runId ? { runId: result.runId } : {}
|
|
727
738
|
};
|
|
728
739
|
},
|
|
729
|
-
|
|
740
|
+
executeSystemAction: (input) => this.executeSystemAutomationAction(input),
|
|
741
|
+
onRunCompleted: (run, context) => this.handleAutomationRunCompleted(run, context)
|
|
730
742
|
});
|
|
731
743
|
return this._agentService;
|
|
732
744
|
}
|
|
@@ -740,11 +752,8 @@ var GatewayService = class {
|
|
|
740
752
|
})).conversationId;
|
|
741
753
|
},
|
|
742
754
|
runAgent: async (runId, conversationId, message) => {
|
|
743
|
-
const
|
|
744
|
-
if (getSqliteDatabase().prepare("SELECT 1 FROM scene_task_bindings WHERE task_id = ?").get(taskRun.taskId)) {
|
|
745
|
-
if (!this.sceneHost?.http.followUps) throw new Error("Task follow-up runtime is disabled");
|
|
755
|
+
for (const adapter of this.sceneHost?.http.activationAdapters.list() ?? []) if (adapter.executeTask && await adapter.executeTask(runId, conversationId)) {
|
|
746
756
|
this.ensureAgentService();
|
|
747
|
-
await this.sceneHost.http.followUps.executeTask(runId, conversationId);
|
|
748
757
|
return;
|
|
749
758
|
}
|
|
750
759
|
const clientMessageId = `task:${runId}`;
|
|
@@ -774,7 +783,11 @@ var GatewayService = class {
|
|
|
774
783
|
createNotificationService() {
|
|
775
784
|
if (!this.notificationService) this.notificationService = new NotificationService({
|
|
776
785
|
publish: (type, payload) => this.realtime.broker.publish("gateway", type, payload),
|
|
777
|
-
allowsNotification: (notification) =>
|
|
786
|
+
allowsNotification: (notification) => {
|
|
787
|
+
if (notification.target.kind !== "task") return true;
|
|
788
|
+
const taskId = notification.target.taskId;
|
|
789
|
+
return (this.sceneHost?.http.activationAdapters.list() ?? []).every((adapter) => adapter.allowsTaskNotification?.(taskId) !== false);
|
|
790
|
+
}
|
|
778
791
|
});
|
|
779
792
|
return this.notificationService;
|
|
780
793
|
}
|
|
@@ -862,10 +875,8 @@ var GatewayService = class {
|
|
|
862
875
|
};
|
|
863
876
|
}
|
|
864
877
|
dispatchTaskEvents() {
|
|
865
|
-
new DomainOutboxDispatcher((
|
|
866
|
-
|
|
867
|
-
else publishAutomationProductEvent(event);
|
|
868
|
-
}).drain();
|
|
878
|
+
new DomainOutboxDispatcher().drain();
|
|
879
|
+
this.automationService.dispatchEvents();
|
|
869
880
|
}
|
|
870
881
|
runAgent(...args) {
|
|
871
882
|
return this.agentRunner.runAgent(...args);
|
|
@@ -1089,7 +1100,7 @@ var GatewayService = class {
|
|
|
1089
1100
|
publish: (type, payload) => this.realtime.broker.publish("gateway", type, payload),
|
|
1090
1101
|
notifyOpportunity: (payload) => this.emit("home.opportunity.ready", payload),
|
|
1091
1102
|
locale: () => "en",
|
|
1092
|
-
enabled: () => this.config.userContext.enabled,
|
|
1103
|
+
enabled: () => this.config.userContext.enabled && this.config.userContext.homeIntelligence.enabled,
|
|
1093
1104
|
dispatchTaskRuns: () => this.dispatchTaskRuns()
|
|
1094
1105
|
});
|
|
1095
1106
|
await this.localApps.recoverPendingReleases();
|
|
@@ -1234,9 +1245,12 @@ var GatewayService = class {
|
|
|
1234
1245
|
...result.runId ? { runId: result.runId } : {}
|
|
1235
1246
|
};
|
|
1236
1247
|
},
|
|
1237
|
-
|
|
1248
|
+
executeSystemAction: (input) => this.executeSystemAutomationAction(input),
|
|
1249
|
+
onRunCompleted: (run, context) => this.handleAutomationRunCompleted(run, context),
|
|
1250
|
+
onEvent: (event) => this.projectAutomationEvent(event),
|
|
1251
|
+
onReliabilityAttention: (input) => this.emit("automation.attention.required", input)
|
|
1238
1252
|
});
|
|
1239
|
-
this.
|
|
1253
|
+
this.startSessionTranscriptEventIngestion();
|
|
1240
1254
|
await trace.measure("workflows.reconcile", () => this.reconcileInterruptedWorkflowRuns());
|
|
1241
1255
|
this.sessionIndex.on("sessionUpdated", (data) => {
|
|
1242
1256
|
this.emit("session.updated", {
|
|
@@ -1246,6 +1260,7 @@ var GatewayService = class {
|
|
|
1246
1260
|
});
|
|
1247
1261
|
});
|
|
1248
1262
|
await trace.measure("automations.initialize", () => this.automationService.initialize());
|
|
1263
|
+
await trace.measure("homeIntelligence.reconcileAutomation", () => reconcileHomeIntelligenceAutomation(this.automationService));
|
|
1249
1264
|
await trace.measure("memoryMaintenance.reconcile", () => this.reconcileMemoryMaintenanceAutomations());
|
|
1250
1265
|
await this.notesService.initialize();
|
|
1251
1266
|
this.discussionLiveWorker.start();
|
|
@@ -1262,7 +1277,7 @@ var GatewayService = class {
|
|
|
1262
1277
|
});
|
|
1263
1278
|
this.managedComposioEventPoller = new ManagedComposioEventPoller({
|
|
1264
1279
|
getConfig: () => this.config,
|
|
1265
|
-
|
|
1280
|
+
ingestEvent: (event) => this.ingestAutomationEvent(event),
|
|
1266
1281
|
requestLearning: (toolkit) => {
|
|
1267
1282
|
this.requestConnectorLearningForToolkit(toolkit);
|
|
1268
1283
|
},
|
|
@@ -1436,8 +1451,6 @@ var GatewayService = class {
|
|
|
1436
1451
|
await this.channelManager.stop();
|
|
1437
1452
|
await this.extensionLoader?.shutdown();
|
|
1438
1453
|
await this.automationService.stop();
|
|
1439
|
-
this.stopAutomationProductEventBridge?.();
|
|
1440
|
-
this.stopAutomationProductEventBridge = null;
|
|
1441
1454
|
this.stopSessionTranscriptAutomationEvents?.();
|
|
1442
1455
|
this.stopSessionTranscriptAutomationEvents = null;
|
|
1443
1456
|
buckets.destroyAll();
|
|
@@ -1700,6 +1713,21 @@ var GatewayService = class {
|
|
|
1700
1713
|
automationService: this.automationService
|
|
1701
1714
|
});
|
|
1702
1715
|
}
|
|
1716
|
+
executeSystemAutomationAction(input) {
|
|
1717
|
+
if (input.capability === "home.advisor.refresh") {
|
|
1718
|
+
const generationId = this.homeIntelligence.requestRefresh("scheduled_refresh", `automation:${input.runId}`);
|
|
1719
|
+
return { summary: generationId === "disabled" ? "Home AI suggestions are disabled" : `Home advice refresh queued: ${generationId}` };
|
|
1720
|
+
}
|
|
1721
|
+
const maintenance = this.config.userContext.userModel.maintenance;
|
|
1722
|
+
if (!this.config.userContext.enabled || !this.config.userContext.userModel.enabled || !maintenance.enabled) return { summary: "Memory maintenance is disabled" };
|
|
1723
|
+
const result = runMemoryMaintenance({
|
|
1724
|
+
jobType: input.capability.slice(7),
|
|
1725
|
+
limit: maintenance.limit,
|
|
1726
|
+
staleRetentionDays: maintenance.staleRetentionDays,
|
|
1727
|
+
evidenceThreshold: maintenance.evidenceThreshold
|
|
1728
|
+
});
|
|
1729
|
+
return { summary: `Memory maintenance completed: ${JSON.stringify(result.metrics)}` };
|
|
1730
|
+
}
|
|
1703
1731
|
get notesServiceInstance() {
|
|
1704
1732
|
return this.notesService;
|
|
1705
1733
|
}
|
|
@@ -1759,73 +1787,33 @@ var GatewayService = class {
|
|
|
1759
1787
|
const job = payload;
|
|
1760
1788
|
if (job.status === "completed" && typeof job.sourceInstanceId === "string" && typeof job.updatedAt === "string") this.homeIntelligenceHost?.sourceChanged({
|
|
1761
1789
|
sourceInstanceId: job.sourceInstanceId,
|
|
1762
|
-
revision: job.updatedAt
|
|
1790
|
+
revision: job.updatedAt,
|
|
1791
|
+
refresh: this.config.userContext.homeIntelligence.refreshOnContextChange
|
|
1763
1792
|
});
|
|
1764
1793
|
}
|
|
1765
1794
|
this.realtime.broker.publish("gateway", type, payload);
|
|
1766
1795
|
this.createNotificationService().handleGatewayEvent(type, payload);
|
|
1767
1796
|
}
|
|
1768
|
-
handleAutomationRunCompleted(run) {
|
|
1769
|
-
this.
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
this.emit("automation.run.completed", {
|
|
1773
|
-
run,
|
|
1774
|
-
notificationPolicy: automation.notificationPolicy,
|
|
1775
|
-
requiresAttention,
|
|
1776
|
-
projectId: automation.projectId
|
|
1777
|
-
});
|
|
1778
|
-
}).catch((err) => {
|
|
1779
|
-
log.warn({
|
|
1780
|
-
err,
|
|
1781
|
-
automationId: run.automationId,
|
|
1782
|
-
runId: run.id
|
|
1783
|
-
}, "Automation completion event failed");
|
|
1797
|
+
async handleAutomationRunCompleted(run, context) {
|
|
1798
|
+
this.emit("automation.run.completed", {
|
|
1799
|
+
run,
|
|
1800
|
+
...context
|
|
1784
1801
|
});
|
|
1785
1802
|
}
|
|
1786
|
-
|
|
1787
|
-
this.stopAutomationProductEventBridge?.();
|
|
1803
|
+
startSessionTranscriptEventIngestion() {
|
|
1788
1804
|
this.stopSessionTranscriptAutomationEvents?.();
|
|
1789
|
-
this.stopAutomationProductEventBridge = onAutomationProductEvent((event) => {
|
|
1790
|
-
if (event.type === "project.deleted" && typeof event.payload.projectId === "string") {
|
|
1791
|
-
const runIds = event.payload.deletedUnderstandingRunIds;
|
|
1792
|
-
if (Array.isArray(runIds) && runIds.every((id) => typeof id === "string")) this._workDiscovery?.abortDeletedProjectRuns(event.payload.projectId, runIds);
|
|
1793
|
-
}
|
|
1794
|
-
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") {
|
|
1795
|
-
const note = event.type.startsWith("note.");
|
|
1796
|
-
const project = event.type.startsWith("project.");
|
|
1797
|
-
const scene = event.type.startsWith("scene.");
|
|
1798
|
-
const payload = event.payload;
|
|
1799
|
-
if (typeof payload.sourceEventId === "string") this.realtime.broker.publish(note ? "resources:notes" : project ? "resources:projects" : scene ? "resources:scenes" : "resources:tasks", "resource.changed", {
|
|
1800
|
-
eventId: payload.sourceEventId,
|
|
1801
|
-
kind: note ? "note" : project ? "project" : scene ? "scene" : "task",
|
|
1802
|
-
id: note ? payload.noteId : project ? payload.projectId : scene ? payload.sceneId : payload.taskId,
|
|
1803
|
-
revision: note || scene ? payload.revision : payload.version,
|
|
1804
|
-
operation: event.type === "task.deleted.v1" || event.type.endsWith(".deleted") ? "deleted" : event.type.endsWith(".created") ? "created" : "updated",
|
|
1805
|
-
...typeof payload.operationId === "string" ? { operationId: payload.operationId } : {}
|
|
1806
|
-
});
|
|
1807
|
-
}
|
|
1808
|
-
if (event.type.startsWith("task.")) this.emit(event.type, event.payload);
|
|
1809
|
-
if (event.type.startsWith("task.") || event.type.startsWith("project.")) {
|
|
1810
|
-
const payload = event.payload;
|
|
1811
|
-
const objectId = event.type.startsWith("task.") ? payload.taskId : payload.projectId;
|
|
1812
|
-
const revision = payload.version ?? payload.revision ?? "unknown";
|
|
1813
|
-
this.homeIntelligenceHost?.requestRefresh(event.type.startsWith("task.") ? "task_changed" : "project_changed", `domain:${event.type}:${String(objectId)}:${String(revision)}`);
|
|
1814
|
-
}
|
|
1815
|
-
this.automationService.triggerEvent(event).catch((err) => {
|
|
1816
|
-
const em = err instanceof Error ? err.message : String(err);
|
|
1817
|
-
log.warn({
|
|
1818
|
-
err,
|
|
1819
|
-
eventType: event.type,
|
|
1820
|
-
source: event.source
|
|
1821
|
-
}, `Automation product event failed: ${em}`);
|
|
1822
|
-
});
|
|
1823
|
-
});
|
|
1824
1805
|
this.stopSessionTranscriptAutomationEvents = onSessionTranscriptUpdate((update) => {
|
|
1825
1806
|
if (!update.conversationId || getSessionMetadata(update.conversationId)?.sourceChannel === "automation") return;
|
|
1826
|
-
|
|
1807
|
+
this.ingestAutomationEvent({
|
|
1827
1808
|
type: "session.transcript.updated",
|
|
1828
1809
|
source: "sessions",
|
|
1810
|
+
subject: {
|
|
1811
|
+
kind: "session",
|
|
1812
|
+
id: update.conversationId
|
|
1813
|
+
},
|
|
1814
|
+
correlationId: update.conversationId,
|
|
1815
|
+
dedupeKey: update.messageId ?? `${update.conversationId}:${Date.now()}`,
|
|
1816
|
+
trust: "system",
|
|
1829
1817
|
payload: {
|
|
1830
1818
|
conversationId: update.conversationId,
|
|
1831
1819
|
messageId: update.messageId,
|
|
@@ -1834,6 +1822,37 @@ var GatewayService = class {
|
|
|
1834
1822
|
});
|
|
1835
1823
|
});
|
|
1836
1824
|
}
|
|
1825
|
+
ingestAutomationEvent(event, options) {
|
|
1826
|
+
return this.automationService.ingestEvent(event, options?.targetAutomationIds);
|
|
1827
|
+
}
|
|
1828
|
+
projectAutomationEvent(event) {
|
|
1829
|
+
if (event.source === "local_apps") this.emit(event.type, event.payload);
|
|
1830
|
+
if (event.type === "project.deleted" && typeof event.payload.projectId === "string") {
|
|
1831
|
+
const runIds = event.payload.deletedUnderstandingRunIds;
|
|
1832
|
+
if (Array.isArray(runIds) && runIds.every((id) => typeof id === "string")) this._workDiscovery?.abortDeletedProjectRuns(event.payload.projectId, runIds);
|
|
1833
|
+
}
|
|
1834
|
+
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") {
|
|
1835
|
+
const note = event.type.startsWith("note.");
|
|
1836
|
+
const project = event.type.startsWith("project.");
|
|
1837
|
+
const scene = event.type.startsWith("scene.");
|
|
1838
|
+
const payload = event.payload;
|
|
1839
|
+
if (typeof payload.sourceEventId === "string") this.realtime.broker.publish(note ? "resources:notes" : project ? "resources:projects" : scene ? "resources:scenes" : "resources:tasks", "resource.changed", {
|
|
1840
|
+
eventId: payload.sourceEventId,
|
|
1841
|
+
kind: note ? "note" : project ? "project" : scene ? "scene" : "task",
|
|
1842
|
+
id: note ? payload.noteId : project ? payload.projectId : scene ? payload.sceneId : payload.taskId,
|
|
1843
|
+
revision: note || scene ? payload.revision : payload.version,
|
|
1844
|
+
operation: event.type === "task.deleted.v1" || event.type.endsWith(".deleted") ? "deleted" : event.type.endsWith(".created") ? "created" : "updated",
|
|
1845
|
+
...typeof payload.operationId === "string" ? { operationId: payload.operationId } : {}
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1848
|
+
if (event.type.startsWith("task.")) this.emit(event.type, event.payload);
|
|
1849
|
+
if (this.config.userContext.homeIntelligence.refreshOnContextChange && (event.type.startsWith("task.") || event.type.startsWith("project."))) {
|
|
1850
|
+
const payload = event.payload;
|
|
1851
|
+
const objectId = event.type.startsWith("task.") ? payload.taskId : payload.projectId;
|
|
1852
|
+
const revision = payload.version ?? payload.revision ?? "unknown";
|
|
1853
|
+
this.homeIntelligenceHost?.requestRefresh(event.type.startsWith("task.") ? "task_changed" : "project_changed", `domain:${event.type}:${String(objectId)}:${String(revision)}`);
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1837
1856
|
/**
|
|
1838
1857
|
* Validate authentication token from request headers.
|
|
1839
1858
|
* Returns true if auth is disabled (mode: 'none') or token is valid.
|
|
@@ -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,
|