@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,117 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/automations/events/event-catalog.ts
|
|
3
|
+
const definitions = /* @__PURE__ */ new Map();
|
|
4
|
+
function catalogKey(type, source, schemaVersion) {
|
|
5
|
+
return `${source}\0${type}\0${schemaVersion}`;
|
|
6
|
+
}
|
|
7
|
+
function registerBusinessEvent(definition) {
|
|
8
|
+
const key = catalogKey(definition.type, definition.source, definition.schemaVersion);
|
|
9
|
+
if (definitions.has(key)) throw new Error(`Business event is already registered: ${definition.source}/${definition.type}@${definition.schemaVersion}`);
|
|
10
|
+
definitions.set(key, definition);
|
|
11
|
+
}
|
|
12
|
+
function validateCatalogedBusinessEvent(event) {
|
|
13
|
+
const definition = definitions.get(catalogKey(event.type, event.source, event.schemaVersion));
|
|
14
|
+
if (!definition) return;
|
|
15
|
+
if (event.subject?.kind !== definition.subjectKind) throw new Error(`Business event subject must be ${definition.subjectKind}: ${event.type}`);
|
|
16
|
+
definition.payloadSchema.parse(event.payload);
|
|
17
|
+
}
|
|
18
|
+
function listBusinessEventDefinitions() {
|
|
19
|
+
return [...definitions.values()].toSorted((left, right) => `${left.source}/${left.type}`.localeCompare(`${right.source}/${right.type}`));
|
|
20
|
+
}
|
|
21
|
+
const objectPayload = z.record(z.string(), z.unknown());
|
|
22
|
+
for (const definition of [
|
|
23
|
+
[
|
|
24
|
+
"tasks",
|
|
25
|
+
"task.changed.v2",
|
|
26
|
+
"task",
|
|
27
|
+
"A Task changed."
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
"tasks",
|
|
31
|
+
"task.deleted.v1",
|
|
32
|
+
"task",
|
|
33
|
+
"A Task was deleted."
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
"notes",
|
|
37
|
+
"note.created",
|
|
38
|
+
"note",
|
|
39
|
+
"A Note was created."
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
"notes",
|
|
43
|
+
"note.updated",
|
|
44
|
+
"note",
|
|
45
|
+
"A Note changed."
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
"notes",
|
|
49
|
+
"note.deleted",
|
|
50
|
+
"note",
|
|
51
|
+
"A Note was deleted."
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
"projects",
|
|
55
|
+
"project.created",
|
|
56
|
+
"project",
|
|
57
|
+
"A Project was created."
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
"projects",
|
|
61
|
+
"project.changed",
|
|
62
|
+
"project",
|
|
63
|
+
"A Project changed."
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
"projects",
|
|
67
|
+
"project.deleted",
|
|
68
|
+
"project",
|
|
69
|
+
"A Project was deleted."
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
"scenes",
|
|
73
|
+
"scene.created",
|
|
74
|
+
"scene",
|
|
75
|
+
"A Scene was created."
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
"scenes",
|
|
79
|
+
"scene.changed",
|
|
80
|
+
"scene",
|
|
81
|
+
"A Scene changed."
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
"scenes",
|
|
85
|
+
"scene.deleted",
|
|
86
|
+
"scene",
|
|
87
|
+
"A Scene was deleted."
|
|
88
|
+
],
|
|
89
|
+
[
|
|
90
|
+
"discussions",
|
|
91
|
+
"discussion.completed",
|
|
92
|
+
"discussion",
|
|
93
|
+
"A Discussion completed."
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
"sessions",
|
|
97
|
+
"session.transcript.updated",
|
|
98
|
+
"session",
|
|
99
|
+
"A Session transcript changed."
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
"workflows",
|
|
103
|
+
"workflow.run.completed",
|
|
104
|
+
"workflow_run",
|
|
105
|
+
"A Workflow run completed."
|
|
106
|
+
]
|
|
107
|
+
]) registerBusinessEvent({
|
|
108
|
+
source: definition[0],
|
|
109
|
+
type: definition[1],
|
|
110
|
+
subjectKind: definition[2],
|
|
111
|
+
description: definition[3],
|
|
112
|
+
schemaVersion: 1,
|
|
113
|
+
payloadSchema: objectPayload,
|
|
114
|
+
defaultTrust: "system"
|
|
115
|
+
});
|
|
116
|
+
//#endregion
|
|
117
|
+
export { listBusinessEventDefinitions, registerBusinessEvent, validateCatalogedBusinessEvent };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AutomationEventEnvelope, AutomationRun } from '../domain/types.js';
|
|
2
|
+
import type { AutomationService } from '../service/automation-service.js';
|
|
3
|
+
export declare class AutomationEventDispatcher {
|
|
4
|
+
private readonly automationService;
|
|
5
|
+
private readonly options;
|
|
6
|
+
private timer?;
|
|
7
|
+
private active?;
|
|
8
|
+
private stopping;
|
|
9
|
+
private readonly owner;
|
|
10
|
+
private readonly abortController;
|
|
11
|
+
constructor(automationService: AutomationService, options?: {
|
|
12
|
+
onEvent?: (event: AutomationEventEnvelope, signal?: AbortSignal) => void | Promise<void>;
|
|
13
|
+
onDeadLetter?: (input: {
|
|
14
|
+
phase: 'event_projection' | 'event_delivery';
|
|
15
|
+
eventId: string;
|
|
16
|
+
automationId?: string;
|
|
17
|
+
error: string;
|
|
18
|
+
}) => void;
|
|
19
|
+
intervalMs?: number;
|
|
20
|
+
});
|
|
21
|
+
start(): void;
|
|
22
|
+
stop(): Promise<void>;
|
|
23
|
+
dispatch(): Promise<number>;
|
|
24
|
+
runCompleted(run: AutomationRun): void;
|
|
25
|
+
private runDispatch;
|
|
26
|
+
private projectEvents;
|
|
27
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { createLogger } from "../../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
4
|
+
import { getAutomation } from "../storage/automation-repository.js";
|
|
5
|
+
import "../storage/index.js";
|
|
6
|
+
import { claimAutomationEventDeliveries, claimAutomationEventsForProjection, completeAutomationEventDelivery, completeAutomationEventProjection, deferAutomationEventDelivery, expireAutomationEventProjectionLeases, failAutomationEventProjection, markAutomationEventDeliveryQueued, reconcileAutomationEventDeliveries, releaseAutomationEventDelivery, releaseAutomationEventProjection, skipAutomationEventDelivery } from "./event-repository.js";
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
8
|
+
//#region src/automations/events/event-dispatcher.ts
|
|
9
|
+
init_transaction();
|
|
10
|
+
init_logger();
|
|
11
|
+
const log = createLogger("AutomationEventDispatcher");
|
|
12
|
+
const DELIVERY_SCAN_BUDGET = 500;
|
|
13
|
+
var AutomationEventDispatcher = class {
|
|
14
|
+
timer;
|
|
15
|
+
active;
|
|
16
|
+
stopping = false;
|
|
17
|
+
owner = `automation-event:${process.pid}:${randomUUID()}`;
|
|
18
|
+
abortController = new AbortController();
|
|
19
|
+
constructor(automationService, options = {}) {
|
|
20
|
+
this.automationService = automationService;
|
|
21
|
+
this.options = options;
|
|
22
|
+
}
|
|
23
|
+
start() {
|
|
24
|
+
if (this.timer) return;
|
|
25
|
+
this.stopping = false;
|
|
26
|
+
reconcileAutomationEventDeliveries();
|
|
27
|
+
this.dispatch();
|
|
28
|
+
this.timer = setInterval(() => void this.dispatch(), this.options.intervalMs ?? 1e3);
|
|
29
|
+
this.timer.unref?.();
|
|
30
|
+
}
|
|
31
|
+
async stop() {
|
|
32
|
+
this.stopping = true;
|
|
33
|
+
if (this.timer) clearInterval(this.timer);
|
|
34
|
+
this.timer = void 0;
|
|
35
|
+
this.abortController.abort(/* @__PURE__ */ new Error("Automation event dispatcher stopped"));
|
|
36
|
+
await this.active?.catch(() => void 0);
|
|
37
|
+
}
|
|
38
|
+
dispatch() {
|
|
39
|
+
if (this.stopping) return Promise.resolve(0);
|
|
40
|
+
this.active ??= this.runDispatch().finally(() => {
|
|
41
|
+
this.active = void 0;
|
|
42
|
+
});
|
|
43
|
+
return this.active;
|
|
44
|
+
}
|
|
45
|
+
runCompleted(run) {
|
|
46
|
+
completeAutomationEventDelivery(run.id, run.status);
|
|
47
|
+
if (!this.stopping) this.dispatch();
|
|
48
|
+
}
|
|
49
|
+
async runDispatch() {
|
|
50
|
+
await this.projectEvents();
|
|
51
|
+
const availableSlots = this.automationService.availableRunSlots();
|
|
52
|
+
if (availableSlots <= 0 || this.stopping) return 0;
|
|
53
|
+
let queued = 0;
|
|
54
|
+
const deliveries = claimAutomationEventDeliveries(this.owner, DELIVERY_SCAN_BUDGET);
|
|
55
|
+
for (const [index, delivery] of deliveries.entries()) {
|
|
56
|
+
if (queued >= availableSlots || this.stopping) {
|
|
57
|
+
for (const remaining of deliveries.slice(index)) releaseAutomationEventDelivery(remaining.event.id, remaining.automationId, this.owner, 0);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
const automation = getAutomation(delivery.automationId);
|
|
61
|
+
if (!automation || !automation.enabled) {
|
|
62
|
+
skipAutomationEventDelivery(delivery.event.id, delivery.automationId, "Automation is unavailable", this.owner);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (automation.state.runningRunId) {
|
|
66
|
+
releaseAutomationEventDelivery(delivery.event.id, automation.id, this.owner);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
const run = runSqliteWriteTransaction(() => {
|
|
71
|
+
const next = this.automationService.queueRunAtomically(automation.id, {
|
|
72
|
+
manual: false,
|
|
73
|
+
event: delivery.event
|
|
74
|
+
});
|
|
75
|
+
markAutomationEventDeliveryQueued(delivery.event.id, automation.id, next.id, this.owner);
|
|
76
|
+
return next;
|
|
77
|
+
});
|
|
78
|
+
this.automationService.dispatchQueuedRun(run.id);
|
|
79
|
+
queued += 1;
|
|
80
|
+
} catch (error) {
|
|
81
|
+
if (error instanceof Error && error.name === "AutomationAlreadyRunningError") {
|
|
82
|
+
releaseAutomationEventDelivery(delivery.event.id, automation.id, this.owner);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const status = deferAutomationEventDelivery(delivery.event.id, automation.id, this.owner, error);
|
|
86
|
+
if (status === "dead_letter") this.options.onDeadLetter?.({
|
|
87
|
+
phase: "event_delivery",
|
|
88
|
+
eventId: delivery.event.id,
|
|
89
|
+
automationId: automation.id,
|
|
90
|
+
error: error instanceof Error ? error.message : String(error)
|
|
91
|
+
});
|
|
92
|
+
log.warn({
|
|
93
|
+
err: error,
|
|
94
|
+
eventId: delivery.event.id,
|
|
95
|
+
automationId: automation.id,
|
|
96
|
+
status
|
|
97
|
+
}, status === "dead_letter" ? "Automation event delivery moved to dead letter" : "Automation event delivery will retry");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return queued;
|
|
101
|
+
}
|
|
102
|
+
async projectEvents() {
|
|
103
|
+
for (const expired of expireAutomationEventProjectionLeases()) {
|
|
104
|
+
this.options.onDeadLetter?.({
|
|
105
|
+
phase: "event_projection",
|
|
106
|
+
...expired
|
|
107
|
+
});
|
|
108
|
+
log.warn(expired, "Automation event projection moved to dead letter after lease expiry");
|
|
109
|
+
}
|
|
110
|
+
for (const event of claimAutomationEventsForProjection(this.owner)) {
|
|
111
|
+
if (this.stopping) {
|
|
112
|
+
releaseAutomationEventProjection(event.id, this.owner);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
await this.options.onEvent?.(event, this.abortController.signal);
|
|
117
|
+
completeAutomationEventProjection(event.id, this.owner);
|
|
118
|
+
} catch (error) {
|
|
119
|
+
if (this.stopping || this.abortController.signal.aborted) {
|
|
120
|
+
releaseAutomationEventProjection(event.id, this.owner);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const status = failAutomationEventProjection(event.id, this.owner, error);
|
|
124
|
+
if (status === "dead_letter") this.options.onDeadLetter?.({
|
|
125
|
+
phase: "event_projection",
|
|
126
|
+
eventId: event.id,
|
|
127
|
+
error: error instanceof Error ? error.message : String(error)
|
|
128
|
+
});
|
|
129
|
+
log.warn({
|
|
130
|
+
err: error,
|
|
131
|
+
eventId: event.id,
|
|
132
|
+
eventType: event.type,
|
|
133
|
+
status
|
|
134
|
+
}, status === "dead_letter" ? "Automation event projection moved to dead letter" : "Automation event projection will retry");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
//#endregion
|
|
140
|
+
export { AutomationEventDispatcher };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { AutomationEvent, AutomationEventDeliveryStatus, AutomationEventEnvelope, AutomationEventProjectionStatus, AutomationEventRecord, AutomationRunStatus } from '../domain/types.js';
|
|
2
|
+
export interface ClaimedAutomationEventDelivery {
|
|
3
|
+
event: AutomationEventEnvelope;
|
|
4
|
+
automationId: string;
|
|
5
|
+
attempts: number;
|
|
6
|
+
owner: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AutomationEventIngestResult {
|
|
9
|
+
event: AutomationEventEnvelope;
|
|
10
|
+
created: boolean;
|
|
11
|
+
deliveryCount: number;
|
|
12
|
+
}
|
|
13
|
+
export interface AutomationEventIngestOptions {
|
|
14
|
+
targetAutomationIds?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface AutomationEventPublisher {
|
|
17
|
+
publish(input: AutomationEvent, options?: AutomationEventIngestOptions): AutomationEventIngestResult;
|
|
18
|
+
}
|
|
19
|
+
export declare function ingestAutomationEvent(input: AutomationEvent, options?: AutomationEventIngestOptions): AutomationEventIngestResult;
|
|
20
|
+
export declare const automationEventPublisher: AutomationEventPublisher;
|
|
21
|
+
export declare function listAutomationEvents(input?: {
|
|
22
|
+
type?: string;
|
|
23
|
+
source?: string;
|
|
24
|
+
subjectKind?: string;
|
|
25
|
+
subjectId?: string;
|
|
26
|
+
limit?: number;
|
|
27
|
+
newestFirst?: boolean;
|
|
28
|
+
}): AutomationEventEnvelope[];
|
|
29
|
+
export declare function listAutomationEventRecords(input?: {
|
|
30
|
+
type?: string;
|
|
31
|
+
source?: string;
|
|
32
|
+
limit?: number;
|
|
33
|
+
}): AutomationEventRecord[];
|
|
34
|
+
export declare function claimAutomationEventsForProjection(owner: string, limit?: number, leaseMs?: number): AutomationEventEnvelope[];
|
|
35
|
+
export declare function expireAutomationEventProjectionLeases(): Array<{
|
|
36
|
+
eventId: string;
|
|
37
|
+
error: string;
|
|
38
|
+
}>;
|
|
39
|
+
export declare function completeAutomationEventProjection(eventId: string, owner: string): void;
|
|
40
|
+
export declare function releaseAutomationEventProjection(eventId: string, owner: string): void;
|
|
41
|
+
export declare function failAutomationEventProjection(eventId: string, owner: string, error: unknown): AutomationEventProjectionStatus;
|
|
42
|
+
export declare function claimAutomationEventDeliveries(owner: string, limit: number, leaseMs?: number): ClaimedAutomationEventDelivery[];
|
|
43
|
+
export declare function releaseAutomationEventDelivery(eventId: string, automationId: string, owner: string, delayMs?: number): void;
|
|
44
|
+
export declare function getAutomationEventDeliveryRunId(eventId: string, automationId: string): string | null;
|
|
45
|
+
export declare function getAutomationEventForRun(runId: string): AutomationEventEnvelope | null;
|
|
46
|
+
export declare function markAutomationEventDeliveryQueued(eventId: string, automationId: string, runId: string, owner?: string): void;
|
|
47
|
+
export declare function deferAutomationEventDelivery(eventId: string, automationId: string, owner: string, error: unknown): AutomationEventDeliveryStatus;
|
|
48
|
+
export declare function skipAutomationEventDelivery(eventId: string, automationId: string, reason: string, owner?: string): void;
|
|
49
|
+
export declare function completeAutomationEventDelivery(runId: string, runStatus: AutomationRunStatus): void;
|
|
50
|
+
export declare function reconcileAutomationEventDeliveries(): number;
|
|
51
|
+
export declare function replayAutomationEvent(eventId: string): boolean;
|
|
52
|
+
export declare function getAutomationEventQueueMetrics(): {
|
|
53
|
+
pending: number;
|
|
54
|
+
oldestPendingAgeMs: number;
|
|
55
|
+
projectionDeadLetters: number;
|
|
56
|
+
pendingDeliveries: number;
|
|
57
|
+
deliveryDeadLetters: number;
|
|
58
|
+
activeLeases: number;
|
|
59
|
+
};
|