@xopcai/xopc 0.0.332 → 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-C2wg3xC_.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-BeNnu1Ts.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-etFSkfzl.js → app-management-settings-panel-BcszTlqr.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DKmU2VAP.js → appearance-settings-B1XPe8qz.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DVNySL58.js → apps-page-ZqANbUZv.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-D0z_Fr2G.js → archive-plugin-MjUsJcNb.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DNCDbeOX.js → attachment-load-DHa-BI9a.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-B7_C-p66.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-BYn2hScX.js → binary-plugins-DQYcuBHP.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-ChWW8Z9L.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-BV00BXRb.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-v0WkhV5o.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-vmx35sbu.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-C41mXCAi.js → chat-terminal-dock-Fnum_IEm.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-BJkqok2G.js → computer-settings-page-DI1zfCTA.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BKCZMmwm.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-CrOV4Ynd.js → date-picker-D-JhzZyW.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CqADAHZp.js → dependency-picker-DpD3xaEB.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Bab-iWED.js → desktop-pet-CCoDxKqh.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BqgzLOdi.js → desktop-pet-settings-GxndKfCx.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DFg7FDPf.js → device-pairing-wizard-B71w3ptm.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-hqJ9sFCR.js → directory-picker-path-field-CUzjJvjs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DX3PFhRE.js → extension-debug-page-BtDY8ntX.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DkREdHLs.js → extension-page-D9_XF-XC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-wF-HNTM-.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-Du-Dos9O.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-B80Cv043.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-BgoFaTwv.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-HO6OQlQT.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-CjzR9Rpj.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-Dlj6TD3M.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-BArPtqp5.js → page-context-capture-button-D43aVpCj.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-vqI30Yrg.js → page-tabs-BhYBCqls.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-B-mwPBJW.js → preview-open-alternatives-CP8agNlc.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-D--sj_uN.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-DBsBwAQ6.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-BurdDY0m.js → remote-access-hub-fVPQe5YS.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CAnb0PNY.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-BKj6wIMb.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-78ycUHfv.js → settings-form-section-jquf1P7n.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BOdxIVzo.js → settings-page-DPomsvba.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CbKHBjrU.js → setup-status-panel-BvVlqpHf.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DyLfktib.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-CiBGQ0Jg.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-C35VKjhb.js → skills-page-D7XPEQu_.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CyJUeREH.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-Day9zhKi.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-Bj9hC6ML.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-fWRD6B8r.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-CnxdvIk8.js → work-discovery-overlay-CJzqJ47I.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DlWNN1VA.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 +44 -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 +9 -3
- package/dist/src/agent/background-review/run-background-review.js +6 -1
- package/dist/src/agent/embedded/run-turn.js +7 -1
- 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/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.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 +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 +49 -8
- package/dist/src/ai-assist/text-assist.js +5 -1
- package/dist/src/automations/api/routes.js +65 -0
- 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/capabilities/store-connector.d.ts +17 -1
- package/dist/src/capabilities/store-connector.js +69 -3
- 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/skills.js +1 -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/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/home-intelligence-automation-reconciler.js +4 -1
- package/dist/src/gateway/hono/routes/capabilities.js +1 -1
- package/dist/src/gateway/hono/routes/connection-waits.js +3 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +14 -1
- 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/sessions.js +15 -0
- 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/memory-maintenance-automation-reconciler.js +5 -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 +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 +6 -3
- package/dist/src/gateway/service.js +82 -85
- package/dist/src/gateway/side-chat/run-service.js +10 -7
- package/dist/src/home-intelligence/generator.js +4 -1
- package/dist/src/home-intelligence/host.js +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/local-apps/service.js +1 -1
- 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/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/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/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/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/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 +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/automations-workspace-BMgJvdcv.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-xwTmuZjS.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-CHA-sTAZ.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DefBGjhV.js +0 -8
- 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/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/management-settings-Dk_gTJb9.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/project-detail-page-BFUdtWXF.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/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/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
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/gateway/service/active-execution.ts
|
|
2
|
+
function describeActiveExecution(input) {
|
|
3
|
+
const { origin } = input;
|
|
4
|
+
const background = origin.type === "system" && (origin.source === "automation" || origin.source === "heartbeat" || origin.source === "internal");
|
|
5
|
+
const kind = input.kind ?? (origin.type === "system" && origin.source === "automation" ? "automation" : origin.type === "system" && origin.source === "workflow" ? "workflow" : input.taskRunId ? "task" : "chat");
|
|
6
|
+
return {
|
|
7
|
+
conversationId: input.conversationId,
|
|
8
|
+
runId: input.runId,
|
|
9
|
+
kind,
|
|
10
|
+
initiator: background ? "background" : "user",
|
|
11
|
+
phase: "running",
|
|
12
|
+
startedAt: input.startedAt ?? Date.now()
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { describeActiveExecution };
|
|
@@ -7,6 +7,7 @@ import type { ChannelManager } from '../../channels/manager.js';
|
|
|
7
7
|
import type { SessionIndex } from '../../session/index.js';
|
|
8
8
|
import { type ClarificationStreamEvent } from '../ephemeral-clarification-waiter.js';
|
|
9
9
|
import type { ClarifyRequestPayload, ClarifyRequestResult } from '../../agent/tools/clarify-tool.js';
|
|
10
|
+
import { type ActiveExecution, type ActiveExecutionKind } from './active-execution.js';
|
|
10
11
|
import type { UserTurnAttachment, UserTurnInput } from '../user-turn-input.js';
|
|
11
12
|
import type { AgentSourceContext, TurnContextRef } from '../../agent/source-context/types.js';
|
|
12
13
|
import { SessionInputCoordinator, type ReplaceLatestTurnInput, type SubmitSessionInput } from './session-input-coordinator.js';
|
|
@@ -33,6 +34,7 @@ export declare class GatewayAgentRunner {
|
|
|
33
34
|
private readonly ephemeralClarifications;
|
|
34
35
|
/** Maps webchat session key → active `runId` for `clarify` tool routing. */
|
|
35
36
|
private readonly activeWebchatRunBySession;
|
|
37
|
+
private readonly activeExecutionBySession;
|
|
36
38
|
private readonly externalStreamBySession;
|
|
37
39
|
private readonly externalClarificationResponses;
|
|
38
40
|
readonly inputs: SessionInputCoordinator;
|
|
@@ -45,9 +47,11 @@ export declare class GatewayAgentRunner {
|
|
|
45
47
|
conversationId: string;
|
|
46
48
|
runId: string;
|
|
47
49
|
}>;
|
|
50
|
+
listActiveExecutions(): ActiveExecution[];
|
|
48
51
|
disposeClarifications(): void;
|
|
49
52
|
registerExternalWebchatRun(conversationId: string, runId: string, publish: (event: ClarificationStreamEvent) => void, options?: {
|
|
50
53
|
beforeClarificationResponse?: () => boolean;
|
|
54
|
+
kind?: ActiveExecutionKind;
|
|
51
55
|
}): void;
|
|
52
56
|
unregisterExternalWebchatRun(conversationId: string, runId: string): void;
|
|
53
57
|
cancelClarificationForRun(runId: string): void;
|
|
@@ -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
|
/**
|
|
@@ -329,7 +328,11 @@ export declare class GatewayService {
|
|
|
329
328
|
processDirect(content: string, conversationId?: string): Promise<string>;
|
|
330
329
|
emit(type: string, payload: unknown): void;
|
|
331
330
|
private handleAutomationRunCompleted;
|
|
332
|
-
private
|
|
331
|
+
private startSessionTranscriptEventIngestion;
|
|
332
|
+
ingestAutomationEvent(event: AutomationEvent, options?: {
|
|
333
|
+
targetAutomationIds?: string[];
|
|
334
|
+
}): import("../automations/index.js").AutomationEventIngestResult;
|
|
335
|
+
private projectAutomationEvent;
|
|
333
336
|
/**
|
|
334
337
|
* Validate authentication token from request headers.
|
|
335
338
|
* Returns true if auth is disabled (mode: 'none') or token is valid.
|
|
@@ -10,7 +10,6 @@ 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";
|
|
@@ -27,13 +26,13 @@ import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.
|
|
|
27
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";
|
|
@@ -74,12 +73,6 @@ import { ChatPreviewService } from "../chat-previews/service.js";
|
|
|
74
73
|
import "../chat-previews/index.js";
|
|
75
74
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
76
75
|
import "../config/index.js";
|
|
77
|
-
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
78
|
-
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
79
|
-
import "../knowledge/index.js";
|
|
80
|
-
import { ConnectionRecoveryService } from "../connectors/connection-recovery-service.js";
|
|
81
|
-
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
82
|
-
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
83
76
|
import { DiscussionService } from "../discussions/service.js";
|
|
84
77
|
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
85
78
|
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
@@ -88,6 +81,16 @@ import { DiscussionSealer } from "../discussions/sealer.js";
|
|
|
88
81
|
import "../discussions/index.js";
|
|
89
82
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
90
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";
|
|
91
94
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
92
95
|
import { prepareAutomationAgentSession } from "./automation-agent-session.js";
|
|
93
96
|
import { stopTailscaleExposure } from "./tailscale-lifecycle.js";
|
|
@@ -143,10 +146,6 @@ import { createGatewayStartupTrace } from "./startup-trace.js";
|
|
|
143
146
|
import { GatewaySceneHost } from "./scenes/host.js";
|
|
144
147
|
import { checkAppContextAccess, prepareAppContext } from "./service/app-context-access.js";
|
|
145
148
|
import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults } from "../voice/language-profile.js";
|
|
146
|
-
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
147
|
-
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
148
|
-
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
149
|
-
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
150
149
|
import crypto from "node:crypto";
|
|
151
150
|
//#region src/gateway/service.ts
|
|
152
151
|
init_session_repository();
|
|
@@ -165,7 +164,6 @@ init_package_version();
|
|
|
165
164
|
init_resolve_route();
|
|
166
165
|
init_session_key();
|
|
167
166
|
init_sqlite();
|
|
168
|
-
init_task_run_repository();
|
|
169
167
|
init_transaction();
|
|
170
168
|
init_config();
|
|
171
169
|
const log = createLogger("Gateway:Service");
|
|
@@ -306,7 +304,6 @@ var GatewayService = class {
|
|
|
306
304
|
connectorSupervisor = null;
|
|
307
305
|
connectorLearningCoordinator = null;
|
|
308
306
|
connectedKnowledgeCoordinator = null;
|
|
309
|
-
stopAutomationProductEventBridge = null;
|
|
310
307
|
stopSessionTranscriptAutomationEvents = null;
|
|
311
308
|
stopRealtimeLogBridge = null;
|
|
312
309
|
/**
|
|
@@ -363,6 +360,9 @@ var GatewayService = class {
|
|
|
363
360
|
this.bus = new MessageBus();
|
|
364
361
|
this.configPath = serviceConfig.configPath || resolveConfigPath();
|
|
365
362
|
bootstrapApplicationStateSync(this.configPath);
|
|
363
|
+
const now = Date.now();
|
|
364
|
+
markStaleAiUsageEventsUnknown(now - 360 * 60 * 1e3, now);
|
|
365
|
+
pruneAiUsageEvents(now - AI_USAGE_RETENTION_MS);
|
|
366
366
|
this.config = loadConfig(this.configPath);
|
|
367
367
|
let bootstrapConfigChanged = initializeVoiceDefaults(this.config, inferProductLanguageFromEnvironment());
|
|
368
368
|
if (sanitizeTunnelConfig(this.config)) bootstrapConfigChanged = true;
|
|
@@ -439,9 +439,16 @@ var GatewayService = class {
|
|
|
439
439
|
openQuestionCount: organization.openQuestions.length
|
|
440
440
|
};
|
|
441
441
|
this.emit("discussion.completed", payload);
|
|
442
|
-
|
|
442
|
+
this.ingestAutomationEvent({
|
|
443
|
+
id: `discussion:${capture.id}:completed:${capture.completedAt}`,
|
|
443
444
|
type: "discussion.completed",
|
|
444
445
|
source: "discussions",
|
|
446
|
+
subject: {
|
|
447
|
+
kind: "discussion",
|
|
448
|
+
id: capture.id
|
|
449
|
+
},
|
|
450
|
+
dedupeKey: `${capture.id}:${capture.completedAt}`,
|
|
451
|
+
trust: "system",
|
|
445
452
|
payload,
|
|
446
453
|
occurredAtMs: capture.completedAt
|
|
447
454
|
});
|
|
@@ -576,7 +583,8 @@ var GatewayService = class {
|
|
|
576
583
|
sessionIndex: this.sessionIndex,
|
|
577
584
|
getAgentService: () => this.ensureAgentService(),
|
|
578
585
|
getActiveWebchatRunId: (sk) => this.agentRunner.getActiveRunId(sk),
|
|
579
|
-
listActiveWebchatRuns: () => this.agentRunner.listActiveRuns()
|
|
586
|
+
listActiveWebchatRuns: () => this.agentRunner.listActiveRuns(),
|
|
587
|
+
listActiveExecutions: () => this.agentRunner.listActiveExecutions()
|
|
580
588
|
});
|
|
581
589
|
this.marketplace = new GatewayMarketplaceService({
|
|
582
590
|
getConfig: () => this.config,
|
|
@@ -730,7 +738,7 @@ var GatewayService = class {
|
|
|
730
738
|
};
|
|
731
739
|
},
|
|
732
740
|
executeSystemAction: (input) => this.executeSystemAutomationAction(input),
|
|
733
|
-
onRunCompleted: (run) => this.handleAutomationRunCompleted(run)
|
|
741
|
+
onRunCompleted: (run, context) => this.handleAutomationRunCompleted(run, context)
|
|
734
742
|
});
|
|
735
743
|
return this._agentService;
|
|
736
744
|
}
|
|
@@ -744,11 +752,8 @@ var GatewayService = class {
|
|
|
744
752
|
})).conversationId;
|
|
745
753
|
},
|
|
746
754
|
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");
|
|
755
|
+
for (const adapter of this.sceneHost?.http.activationAdapters.list() ?? []) if (adapter.executeTask && await adapter.executeTask(runId, conversationId)) {
|
|
750
756
|
this.ensureAgentService();
|
|
751
|
-
await this.sceneHost.http.followUps.executeTask(runId, conversationId);
|
|
752
757
|
return;
|
|
753
758
|
}
|
|
754
759
|
const clientMessageId = `task:${runId}`;
|
|
@@ -778,7 +783,11 @@ var GatewayService = class {
|
|
|
778
783
|
createNotificationService() {
|
|
779
784
|
if (!this.notificationService) this.notificationService = new NotificationService({
|
|
780
785
|
publish: (type, payload) => this.realtime.broker.publish("gateway", type, payload),
|
|
781
|
-
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
|
+
}
|
|
782
791
|
});
|
|
783
792
|
return this.notificationService;
|
|
784
793
|
}
|
|
@@ -866,10 +875,8 @@ var GatewayService = class {
|
|
|
866
875
|
};
|
|
867
876
|
}
|
|
868
877
|
dispatchTaskEvents() {
|
|
869
|
-
new DomainOutboxDispatcher((
|
|
870
|
-
|
|
871
|
-
else publishAutomationProductEvent(event);
|
|
872
|
-
}).drain();
|
|
878
|
+
new DomainOutboxDispatcher().drain();
|
|
879
|
+
this.automationService.dispatchEvents();
|
|
873
880
|
}
|
|
874
881
|
runAgent(...args) {
|
|
875
882
|
return this.agentRunner.runAgent(...args);
|
|
@@ -1239,9 +1246,11 @@ var GatewayService = class {
|
|
|
1239
1246
|
};
|
|
1240
1247
|
},
|
|
1241
1248
|
executeSystemAction: (input) => this.executeSystemAutomationAction(input),
|
|
1242
|
-
onRunCompleted: (run) => this.handleAutomationRunCompleted(run)
|
|
1249
|
+
onRunCompleted: (run, context) => this.handleAutomationRunCompleted(run, context),
|
|
1250
|
+
onEvent: (event) => this.projectAutomationEvent(event),
|
|
1251
|
+
onReliabilityAttention: (input) => this.emit("automation.attention.required", input)
|
|
1243
1252
|
});
|
|
1244
|
-
this.
|
|
1253
|
+
this.startSessionTranscriptEventIngestion();
|
|
1245
1254
|
await trace.measure("workflows.reconcile", () => this.reconcileInterruptedWorkflowRuns());
|
|
1246
1255
|
this.sessionIndex.on("sessionUpdated", (data) => {
|
|
1247
1256
|
this.emit("session.updated", {
|
|
@@ -1268,7 +1277,7 @@ var GatewayService = class {
|
|
|
1268
1277
|
});
|
|
1269
1278
|
this.managedComposioEventPoller = new ManagedComposioEventPoller({
|
|
1270
1279
|
getConfig: () => this.config,
|
|
1271
|
-
|
|
1280
|
+
ingestEvent: (event) => this.ingestAutomationEvent(event),
|
|
1272
1281
|
requestLearning: (toolkit) => {
|
|
1273
1282
|
this.requestConnectorLearningForToolkit(toolkit);
|
|
1274
1283
|
},
|
|
@@ -1442,8 +1451,6 @@ var GatewayService = class {
|
|
|
1442
1451
|
await this.channelManager.stop();
|
|
1443
1452
|
await this.extensionLoader?.shutdown();
|
|
1444
1453
|
await this.automationService.stop();
|
|
1445
|
-
this.stopAutomationProductEventBridge?.();
|
|
1446
|
-
this.stopAutomationProductEventBridge = null;
|
|
1447
1454
|
this.stopSessionTranscriptAutomationEvents?.();
|
|
1448
1455
|
this.stopSessionTranscriptAutomationEvents = null;
|
|
1449
1456
|
buckets.destroyAll();
|
|
@@ -1787,67 +1794,26 @@ var GatewayService = class {
|
|
|
1787
1794
|
this.realtime.broker.publish("gateway", type, payload);
|
|
1788
1795
|
this.createNotificationService().handleGatewayEvent(type, payload);
|
|
1789
1796
|
}
|
|
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");
|
|
1797
|
+
async handleAutomationRunCompleted(run, context) {
|
|
1798
|
+
this.emit("automation.run.completed", {
|
|
1799
|
+
run,
|
|
1800
|
+
...context
|
|
1806
1801
|
});
|
|
1807
1802
|
}
|
|
1808
|
-
|
|
1809
|
-
this.stopAutomationProductEventBridge?.();
|
|
1803
|
+
startSessionTranscriptEventIngestion() {
|
|
1810
1804
|
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
1805
|
this.stopSessionTranscriptAutomationEvents = onSessionTranscriptUpdate((update) => {
|
|
1847
1806
|
if (!update.conversationId || getSessionMetadata(update.conversationId)?.sourceChannel === "automation") return;
|
|
1848
|
-
|
|
1807
|
+
this.ingestAutomationEvent({
|
|
1849
1808
|
type: "session.transcript.updated",
|
|
1850
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",
|
|
1851
1817
|
payload: {
|
|
1852
1818
|
conversationId: update.conversationId,
|
|
1853
1819
|
messageId: update.messageId,
|
|
@@ -1856,6 +1822,37 @@ var GatewayService = class {
|
|
|
1856
1822
|
});
|
|
1857
1823
|
});
|
|
1858
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
|
+
}
|
|
1859
1856
|
/**
|
|
1860
1857
|
* Validate authentication token from request headers.
|
|
1861
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,
|
|
@@ -182,7 +182,7 @@ var HomeAdviceGenerator = class {
|
|
|
182
182
|
maxTokens: 3e3,
|
|
183
183
|
temperature: .1,
|
|
184
184
|
signal: requestSignal
|
|
185
|
-
});
|
|
185
|
+
}, void 0, { operation: "home.generate_advice" });
|
|
186
186
|
const raw = extractHomeResponseText(response);
|
|
187
187
|
let result;
|
|
188
188
|
try {
|
|
@@ -205,6 +205,9 @@ var HomeAdviceGenerator = class {
|
|
|
205
205
|
maxTokens: 3e3,
|
|
206
206
|
temperature: 0,
|
|
207
207
|
signal: requestSignal
|
|
208
|
+
}, void 0, {
|
|
209
|
+
operation: "home.generate_advice",
|
|
210
|
+
trigger: "retry"
|
|
208
211
|
});
|
|
209
212
|
try {
|
|
210
213
|
result = HomeModelResultSchema.parse(parseJson(extractHomeResponseText(corrected)));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { homePatternKey } from "./strategy.js";
|
|
4
|
-
import { HomeAdvicePolicy } from "./policy.js";
|
|
5
4
|
import { HomeIntelligenceRepository } from "./repository.js";
|
|
6
5
|
import { HomeOpportunityApplicationService } from "./application-service.js";
|
|
6
|
+
import { HomeAdvicePolicy } from "./policy.js";
|
|
7
7
|
import { buildHomeOpportunityNotification } from "./notification.js";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
9
|
//#region src/home-intelligence/host.ts
|