@xopcai/xopc 0.0.331 → 0.0.333
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0BtF24E.js → agent-avatar-dicebear-DiI2O7lC.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CVp3J969.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DbvLXQO2.js → agent-plugin-dialog-CacyndrS.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DXYZSuUV.js +70 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-fwzTRJfP.js → app-management-settings-panel-BcszTlqr.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-v_GGe8UZ.js → appearance-settings-B1XPe8qz.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-C9ZMEuuA.js → apps-page-ZqANbUZv.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-B6EgADeH.js → archive-plugin-MjUsJcNb.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-B4H_IFeX.js → attachment-load-DHa-BI9a.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-UlVCvg4r.js → automations-page-Dsjivdxs.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-B37vs5tk.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BxTSx30f.js → binary-plugins-DQYcuBHP.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CVzdrpjl.js → block-editor-Bx0uXbJP.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-C5s1yHOu.js → browser-automation-inputs-1ZIPGDeq.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CBVD8k6O.js → browser-automations-page-CCjYipHc.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CSv4rvmx.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-BnO9LV7U.js +1 -0
- package/dist/gateway/static/root/assets/{capabilities-page-BAT7Vvb8.js → capabilities-page-BfvDvIY1.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CoW7-ESq.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-EETjXmkG.js → capability-header-actions-D_hbWRRF.js} +1 -1
- package/dist/gateway/static/root/assets/channels-BhMaRh1x.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DCqm9j9W.js → chat-terminal-dock-Fnum_IEm.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-CxFWdovV.js → computer-settings-page-DI1zfCTA.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-wxsEhmlU.js → connector-service-page-CiGDAubm.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-Ono0Pha1.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-h_OS6uBR.js → date-picker-D-JhzZyW.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DNgSSH3z.js → dependency-picker-DpD3xaEB.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CflvPnB-.js → desktop-pet-CCoDxKqh.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CXy0X5Js.js → desktop-pet-settings-GxndKfCx.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-BDMiJcsK.js → device-pairing-wizard-B71w3ptm.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BqkOh13m.js → directory-picker-path-field-CUzjJvjs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-VT4s-9pK.js → extension-debug-page-BtDY8ntX.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CBSeGhGA.js → extension-page-D9_XF-XC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DRB6uOo8.js → extension-settings-page-CjhUFAaC.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-cR-tz7-Q.js → gateway-config-swr-CgIjCxM8.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-lF-FpnZy.js → gateway-settings-BWaCnwT1.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-6jLRcQsu.js → gateway-startup-retry-i-1lTrwY.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BTjGLngn.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-CSSkwsyC.js → image-generation-api-gilc-u7M.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-DGkOijwE.js → imports-page-BEtq5BRU.js} +1 -1
- package/dist/gateway/static/root/assets/index-DHL16aYZ.js +121 -0
- package/dist/gateway/static/root/assets/index-N1e6PDwx.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-iU6c2zg1.js → keyboard-shortcuts-settings-JUYY_18v.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-uI7mtoVz.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-C0BWC8D2.js → local-apps-page-BlYESNqz.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-wNXWkWu5.js → locale-store-BY30D6tg.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-Dpoi-r-_.js → logs-page-BbLQreeN.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-c4krhYU7.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DlT9KqwF.js → markdown-view-BEeXMfDw.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C8E_F2F_.js → media-plugins-DEFN1I73.js} +1 -1
- package/dist/gateway/static/root/assets/messages-_6IXbP2u.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel--09xGxyE.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-DsxcVBXF.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-qqWG_gs_.js → page-context-capture-button-D43aVpCj.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-b3lheKy4.js → page-tabs-BhYBCqls.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-0Q4rTfGX.js → preview-open-alternatives-CP8agNlc.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-jnJZCrKQ.js → product-open-page-CU7fRhfT.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-U-EdDfAW.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-r96k_2wB.js → projects-page-DUOKZLt7.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-BIpltJ47.js → registry-api-BvVx0G1o.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-B1d8pB_y.js → remote-access-hub-fVPQe5YS.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Do_iF13W.js → runtime-tools-settings-panel-Czvzsuj_.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-C0-WHOY3.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-Cfft26Je.js → schema-form-B9Ni5O93.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DdXvW09N.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BtF83fBY.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-iI0MTyuU.js → settings-form-section-jquf1P7n.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C2Ka9oJm.js → settings-page-DPomsvba.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-nnmS_p5h.js → setup-status-panel-BvVlqpHf.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-D0Knvtlp.js → share-preview-page-b9DI0N1J.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-R_qwc4DN.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-BuZKcy9b.js → skill-api-Bu7-3w-L.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CNJAQ_e-.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DcxWxIrR.js → skills-page-D7XPEQu_.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CMG0ZAsd.js → system-settings-panel-BwFR0Uci.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-PFjGW2g1.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-DGYA6GyO.js → tunnel-api-PfucxMP3.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-t_zdQHcy.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-CDemMoSX.js → use-autosave-DLyy2wHz.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-OyfPVfB9.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CXArY4t5.js → voice-api-key-field-CQDY5EBK.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-ujEySjyc.js → voice-config-api-Bwy3Al3J.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Dk5KsKOm.js → work-discovery-overlay-CJzqJ47I.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DNpdaI-2.js → workflow-run-setup-panel-sCOk-esV.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DYBGjN7C.js +6 -0
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +59 -14
- package/dist/packages/gateway-contract/src/capabilities.js +106 -8
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/gateway-contract/src/scenes.js +7 -6
- package/dist/packages/gateway-contract/src/sessions.js +2 -1
- package/dist/packages/gateway-contract/src/usage.js +6 -0
- package/dist/src/agent/agent-manager.js +13 -7
- package/dist/src/agent/background-review/run-background-review.js +7 -2
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +7 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/external-tools/gateway-tools.d.ts +2 -1
- package/dist/src/agent/external-tools/gateway-tools.js +44 -11
- package/dist/src/agent/external-tools/index.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/image/understanding/pi-ai-provider.js +1 -1
- package/dist/src/agent/memory/compaction.js +4 -0
- package/dist/src/agent/orchestration/agent-orchestrator.js +0 -21
- package/dist/src/agent/service/btw-query.js +8 -2
- package/dist/src/agent/service.js +3 -3
- package/dist/src/agent/skills/filesystem-watcher.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +2 -2
- package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +4 -0
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +5 -4
- package/dist/src/agent/tools/automation-tool.d.ts +4 -1
- package/dist/src/agent/tools/automation-tool.js +42 -4
- package/dist/src/agent/tools/session-search-tool.js +1 -1
- package/dist/src/agent/tools/web-extract.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +50 -9
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/ai-assist/text-assist.js +5 -1
- package/dist/src/auth/credentials.js +1 -1
- package/dist/src/auth/oauth-provider-lock.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/api/routes.js +65 -0
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/read.js +24 -0
- package/dist/src/automations/capabilities/write.d.ts +69 -14
- package/dist/src/automations/capabilities/write.js +78 -5
- package/dist/src/automations/delivery/delivery-router.d.ts +50 -0
- package/dist/src/automations/delivery/delivery-router.js +318 -0
- package/dist/src/automations/delivery/index.d.ts +1 -0
- package/dist/src/automations/delivery/index.js +2 -0
- package/dist/src/automations/domain/defaults.d.ts +0 -1
- package/dist/src/automations/domain/defaults.js +2 -2
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +180 -7
- package/dist/src/automations/domain/validation.d.ts +172 -22
- package/dist/src/automations/domain/validation.js +82 -13
- package/dist/src/automations/draft/automation-draft-prompt.js +3 -4
- package/dist/src/automations/draft/automation-draft-service.js +6 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +31 -3
- package/dist/src/automations/draft/automation-draft-validator.js +5 -4
- package/dist/src/automations/events/event-catalog.d.ts +14 -0
- package/dist/src/automations/events/event-catalog.js +117 -0
- package/dist/src/automations/events/event-dispatcher.d.ts +27 -0
- package/dist/src/automations/events/event-dispatcher.js +140 -0
- package/dist/src/automations/events/event-repository.d.ts +59 -0
- package/dist/src/automations/events/event-repository.js +361 -0
- package/dist/src/automations/events/index.d.ts +3 -0
- package/dist/src/automations/events/index.js +4 -0
- package/dist/src/automations/index.d.ts +3 -1
- package/dist/src/automations/index.js +9 -3
- package/dist/src/automations/service/action-executor.d.ts +20 -1
- package/dist/src/automations/service/action-executor.js +80 -24
- package/dist/src/automations/service/automation-service.d.ts +21 -4
- package/dist/src/automations/service/automation-service.js +150 -100
- package/dist/src/automations/storage/automation-repository.js +7 -7
- package/dist/src/automations/storage/automation-run-repository.d.ts +1 -0
- package/dist/src/automations/storage/automation-run-repository.js +26 -1
- package/dist/src/automations/storage/index.js +2 -2
- package/dist/src/automations/webhook-secrets.d.ts +1 -0
- package/dist/src/automations/webhook-secrets.js +16 -0
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/capabilities/store-connector.d.ts +17 -1
- package/dist/src/capabilities/store-connector.js +69 -3
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/connectors.js +4 -3
- package/dist/src/cli/commands/doctor/checks/automation-integrity.d.ts +2 -0
- package/dist/src/cli/commands/doctor/checks/automation-integrity.js +55 -0
- package/dist/src/cli/commands/doctor/checks/database-relations.d.ts +2 -0
- package/dist/src/cli/commands/doctor/checks/database-relations.js +81 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/flow.js +5 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +2 -2
- package/dist/src/cli/commands/skills.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +4 -0
- package/dist/src/config/schema.js +5 -1
- package/dist/src/connectors/approval-resume.js +1 -1
- package/dist/src/connectors/cli/store.js +1 -1
- package/dist/src/connectors/composio-backends.js +14 -4
- package/dist/src/connectors/composio-managed-events.d.ts +5 -2
- package/dist/src/connectors/composio-managed-events.js +4 -1
- package/dist/src/connectors/connection-recovery-service.d.ts +2 -1
- package/dist/src/connectors/connection-recovery-service.js +89 -4
- package/dist/src/discussions/analyzer.js +4 -4
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/home-intelligence-automation-reconciler.d.ts +3 -0
- package/dist/src/gateway/home-intelligence-automation-reconciler.js +52 -0
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/capabilities.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +18 -4
- package/dist/src/gateway/hono/routes/connection-waits.js +3 -2
- package/dist/src/gateway/hono/routes/home.js +0 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +14 -1
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/public-gateway.js +93 -3
- package/dist/src/gateway/hono/routes/scenes.js +57 -41
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +15 -0
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/update.js +6 -1
- package/dist/src/gateway/hono/routes/usage.d.ts +3 -0
- package/dist/src/gateway/hono/routes/usage.js +61 -0
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +2 -2
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/memory-maintenance-automation-reconciler.js +21 -15
- package/dist/src/gateway/scenes/host.js +27 -14
- package/dist/src/gateway/scenes/slackThreadSource.d.ts +2 -2
- package/dist/src/gateway/security/gateway-scopes.js +1 -0
- package/dist/src/gateway/service/active-execution.d.ts +19 -0
- package/dist/src/gateway/service/active-execution.js +16 -0
- package/dist/src/gateway/service/agent-runner.d.ts +4 -0
- package/dist/src/gateway/service/agent-runner.js +19 -1
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.d.ts +2 -0
- package/dist/src/gateway/service/run-gateway-agent.js +9 -1
- package/dist/src/gateway/service/sessions-api.d.ts +13 -0
- package/dist/src/gateway/service/sessions-api.js +23 -0
- package/dist/src/gateway/service.d.ts +7 -3
- package/dist/src/gateway/service.js +108 -89
- package/dist/src/gateway/side-chat/run-service.js +10 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/generator.js +4 -1
- package/dist/src/home-intelligence/host.d.ts +1 -1
- package/dist/src/home-intelligence/host.js +2 -10
- package/dist/src/home-intelligence/notification.js +1 -1
- package/dist/src/home-intelligence/repository.d.ts +1 -1
- package/dist/src/infra/domain-outbox-dispatcher.d.ts +0 -3
- package/dist/src/infra/domain-outbox-dispatcher.js +15 -7
- package/dist/src/infra/update-check.d.ts +8 -4
- package/dist/src/infra/update-check.js +43 -41
- package/dist/src/infra/update-startup.d.ts +7 -1
- package/dist/src/infra/update-startup.js +15 -6
- package/dist/src/local-apps/service.js +2 -2
- package/dist/src/memory-maintenance/index.js +2 -2
- package/dist/src/memory-maintenance/schedule.d.ts +0 -3
- package/dist/src/memory-maintenance/schedule.js +1 -8
- package/dist/src/notes/service.js +2 -3
- package/dist/src/projects/project-service.js +1 -2
- package/dist/src/projects/project-skill-service.js +2 -2
- package/dist/src/providers/model-call.d.ts +3 -2
- package/dist/src/providers/model-call.js +30 -5
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/scenes/activationAdapter.d.ts +19 -0
- package/dist/src/scenes/activationAdapter.js +1 -0
- package/dist/src/scenes/agentExecutor.js +3 -10
- package/dist/src/scenes/contracts.d.ts +3 -9
- package/dist/src/scenes/contracts.js +1 -0
- package/dist/src/scenes/execution.d.ts +9 -3
- package/dist/src/scenes/execution.js +12 -11
- package/dist/src/scenes/httpServices.d.ts +5 -2
- package/dist/src/scenes/mailContext.d.ts +4 -0
- package/dist/src/scenes/mailContext.js +9 -0
- package/dist/src/scenes/maintenance.js +1 -5
- package/dist/src/scenes/metrics.d.ts +0 -6
- package/dist/src/scenes/metrics.js +0 -11
- package/dist/src/scenes/registry.d.ts +11 -0
- package/dist/src/scenes/registry.js +28 -0
- package/dist/src/scenes/repository.d.ts +6 -3
- package/dist/src/scenes/repository.js +43 -5
- package/dist/src/scenes/service.d.ts +2 -1
- package/dist/src/scenes/service.js +9 -7
- package/dist/src/scenes/taskFollowUp/contracts.d.ts +37 -7
- package/dist/src/scenes/taskFollowUp/contracts.js +36 -17
- package/dist/src/scenes/taskFollowUp/service.d.ts +35 -7
- package/dist/src/scenes/taskFollowUp/service.js +86 -28
- package/dist/src/scenes/templates.d.ts +2 -2
- package/dist/src/scenes/userNotes.d.ts +3 -0
- package/dist/src/scenes/userNotes.js +6 -0
- package/dist/src/session/client-history.d.ts +3 -0
- package/dist/src/session/client-history.js +10 -5
- package/dist/src/session/manager.d.ts +1 -0
- package/dist/src/session/resolve-session.js +4 -3
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/store.d.ts +1 -0
- package/dist/src/session/store.js +3 -2
- package/dist/src/storage/sqlite/ai-usage-repository.d.ts +137 -0
- package/dist/src/storage/sqlite/ai-usage-repository.js +175 -0
- package/dist/src/storage/sqlite/connector-account-repository.js +7 -5
- package/dist/src/storage/sqlite/connector-repository.js +36 -34
- package/dist/src/storage/sqlite/index.d.ts +2 -2
- package/dist/src/storage/sqlite/index.js +3 -3
- package/dist/src/storage/sqlite/migrations/208_automation_management.sql +2 -0
- package/dist/src/storage/sqlite/migrations/209_automation_event_hub.sql +48 -0
- package/dist/src/storage/sqlite/migrations/210_remove_legacy_automation_timeout.sql +14 -0
- package/dist/src/storage/sqlite/migrations/211_automation_result_deliveries.sql +16 -0
- package/dist/src/storage/sqlite/migrations/212_automation_delivery_policy.sql +30 -0
- package/dist/src/storage/sqlite/migrations/213_automation_reliability_contract.sql +188 -0
- package/dist/src/storage/sqlite/migrations/214_ai_usage_ledger.sql +41 -0
- package/dist/src/storage/sqlite/migrations/215_scene_execution_adapters.sql +6 -0
- package/dist/src/storage/sqlite/migrations/216_remove_scene_model_usage.sql +1 -0
- package/dist/src/storage/sqlite/migrations/217_remove_legacy_memory_tables.sql +4 -0
- package/dist/src/storage/sqlite/migrations/218_core_relation_indexes.sql +26 -0
- package/dist/src/storage/sqlite/migrations/219_json_contracts.sql +123 -0
- package/dist/src/storage/sqlite/migrations/220_normalize_timestamps.sql +339 -0
- package/dist/src/storage/sqlite/migrations/221_ai_usage_retention_index.sql +2 -0
- package/dist/src/storage/sqlite/migrations/222_session_config_authority.sql +13 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +4 -4
- package/dist/src/storage/sqlite/row-mappers.d.ts +3 -7
- package/dist/src/storage/sqlite/row-mappers.js +6 -6
- package/dist/src/storage/sqlite/scenes-schema.d.ts +1 -1
- package/dist/src/storage/sqlite/scenes-schema.js +0 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +0 -52
- package/dist/src/storage/sqlite/schemas/scenes.sql +0 -7
- package/dist/src/storage/sqlite/session-input-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/session-input-repository.js +18 -1
- package/dist/src/storage/sqlite/session-read-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/session-read-repository.js +0 -1
- package/dist/src/storage/sqlite/session-repository.d.ts +0 -4
- package/dist/src/storage/sqlite/session-repository.js +8 -18
- package/dist/src/storage/sqlite/timestamps.d.ts +4 -0
- package/dist/src/storage/sqlite/timestamps.js +20 -0
- package/dist/src/storage/sqlite/transcript-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/transcript-repository.js +23 -15
- package/dist/src/storage/sqlite/user-trust-repository.js +4 -2
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.d.ts +1 -1
- package/dist/src/tasks/home-query-service.js +4 -3
- package/dist/src/tasks/task-contract-planner.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/usage/cost.d.ts +4 -0
- package/dist/src/usage/cost.js +28 -0
- package/dist/src/usage/recorder.d.ts +13 -0
- package/dist/src/usage/recorder.js +117 -0
- package/dist/src/usage/scenario-registry.d.ts +8 -0
- package/dist/src/usage/scenario-registry.js +117 -0
- package/dist/src/usage/types.d.ts +55 -0
- package/dist/src/usage/types.js +1 -0
- package/dist/src/user-context/config.d.ts +9 -0
- package/dist/src/user-context/config.js +13 -4
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/voice/tts/summarize.js +1 -1
- package/dist/src/work-discovery/analyzer.js +2 -2
- package/dist/src/work-discovery/investigator.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +15 -2
- package/package.json +6 -6
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DgP5DEJF.js +0 -1
- package/dist/gateway/static/root/assets/agents-Bh4XNLyk.js +0 -70
- package/dist/gateway/static/root/assets/automations-workspace-C7VS-yb7.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-CC43CC43.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-sAZT4brT.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DPETQOfF.js +0 -8
- package/dist/gateway/static/root/assets/channels-CwA619os.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-l7goF6QS.js +0 -2
- package/dist/gateway/static/root/assets/home-page-DSaXXoLm.js +0 -1
- package/dist/gateway/static/root/assets/index-BEw0xrde.css +0 -1
- package/dist/gateway/static/root/assets/index-D99vN3es.js +0 -121
- package/dist/gateway/static/root/assets/local-app-workbench-page-rH33N8I9.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-RFDLaquR.js +0 -1
- package/dist/gateway/static/root/assets/messages-fmf0dnr4.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-DI7CIjmM.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BkqnU-Jh.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-BvvcTH2F.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-DK316w9a.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-EIk8iJTK.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DcOsdz78.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BcaxGQLC.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Cb_CUL-U.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Cvr1qUTW.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-VXfz3rE7.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-DDNDLdId.js +0 -6
- package/dist/src/automations/product-events.d.ts +0 -5
- package/dist/src/automations/product-events.js +0 -19
|
@@ -3,10 +3,15 @@ import { init_logger } from "../../utils/logger.js";
|
|
|
3
3
|
import { init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
4
4
|
import { AutomationSchema, CreateAutomationSchema, UpdateAutomationSchema } from "../domain/validation.js";
|
|
5
5
|
import { deleteAutomation, getAutomation, getDeletedAutomationRevision, listAutomations, saveAutomation, saveAutomations } from "../storage/automation-repository.js";
|
|
6
|
-
import { appendAutomationRunEvent, getAutomationRun, getAutomationRunRequest, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, saveAutomationRun, saveAutomationRunRequest, touchAutomationRunLease } from "../storage/automation-run-repository.js";
|
|
6
|
+
import { appendAutomationRunEvent, getAutomationRun, getAutomationRunRequest, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, pruneAutomationHistory, saveAutomationRun, saveAutomationRunRequest, touchAutomationRunLease } from "../storage/automation-run-repository.js";
|
|
7
7
|
import "../storage/index.js";
|
|
8
|
+
import { getAutomationEventDeliveryRunId, getAutomationEventForRun, getAutomationEventQueueMetrics, ingestAutomationEvent, listAutomationEventRecords, markAutomationEventDeliveryQueued, replayAutomationEvent } from "../events/event-repository.js";
|
|
8
9
|
import { computeNextAutomationRunAtMs, timerDelayUntil } from "../domain/schedule.js";
|
|
9
10
|
import { AutomationActionExecutor } from "./action-executor.js";
|
|
11
|
+
import { AutomationEventDispatcher } from "../events/event-dispatcher.js";
|
|
12
|
+
import "../events/index.js";
|
|
13
|
+
import { AutomationDeliveryRouter, getAutomationResultDeliveryMetrics, listAutomationResultDeliveries, retryAutomationResultDelivery } from "../delivery/delivery-router.js";
|
|
14
|
+
import "../delivery/index.js";
|
|
10
15
|
import { randomUUID } from "node:crypto";
|
|
11
16
|
//#region src/automations/service/automation-service.ts
|
|
12
17
|
init_logger();
|
|
@@ -17,12 +22,6 @@ const MISSED_RUN_STAGGER_MS = 5e3;
|
|
|
17
22
|
const RUN_HEARTBEAT_INTERVAL_MS = 1e4;
|
|
18
23
|
const RUN_LEASE_DURATION_MS = 3e4;
|
|
19
24
|
const RETRY_BASE_DELAY_MS = 1e3;
|
|
20
|
-
var AutomationDeadlineExceededError = class extends Error {
|
|
21
|
-
constructor() {
|
|
22
|
-
super("Automation deadline exceeded while calling the completion webhook");
|
|
23
|
-
this.name = "AutomationDeadlineExceededError";
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
25
|
var AutomationAlreadyRunningError = class extends Error {
|
|
27
26
|
constructor(automationId, runningRunId) {
|
|
28
27
|
super(`Automation is already running: ${automationId}`);
|
|
@@ -40,12 +39,21 @@ var AutomationAlreadyExistsError = class extends Error {
|
|
|
40
39
|
};
|
|
41
40
|
var AutomationService = class {
|
|
42
41
|
executor = new AutomationActionExecutor();
|
|
42
|
+
eventDispatcher = new AutomationEventDispatcher(this, {
|
|
43
|
+
onEvent: (event, signal) => this.deps.onEvent?.(event, signal),
|
|
44
|
+
onDeadLetter: (input) => this.deps.onReliabilityAttention?.(input)
|
|
45
|
+
});
|
|
46
|
+
deliveryRouter = new AutomationDeliveryRouter({
|
|
47
|
+
deliverGatewayEvent: (run, context) => this.deps.onRunCompleted?.(run, context),
|
|
48
|
+
onDeadLetter: (input) => this.deps.onReliabilityAttention?.(input)
|
|
49
|
+
});
|
|
43
50
|
timer = null;
|
|
44
51
|
stopped = true;
|
|
45
52
|
runningScheduler = false;
|
|
46
53
|
deps = {};
|
|
47
54
|
maxConcurrentRuns = DEFAULT_MAX_CONCURRENT_RUNS;
|
|
48
55
|
activeRuns = /* @__PURE__ */ new Map();
|
|
56
|
+
activeRunTasks = /* @__PURE__ */ new Map();
|
|
49
57
|
heartbeatTimers = /* @__PURE__ */ new Map();
|
|
50
58
|
leaseOwner = `automation-service:${process.pid}:${randomUUID()}`;
|
|
51
59
|
setDeps(deps) {
|
|
@@ -59,8 +67,11 @@ var AutomationService = class {
|
|
|
59
67
|
this.maxConcurrentRuns = Math.max(1, Math.floor(options?.maxConcurrentRuns ?? DEFAULT_MAX_CONCURRENT_RUNS));
|
|
60
68
|
this.stopped = false;
|
|
61
69
|
await this.recoverInterruptedRuns();
|
|
70
|
+
pruneAutomationHistory();
|
|
62
71
|
await this.recomputeNextRuns({ catchUp: true });
|
|
63
72
|
this.armTimer();
|
|
73
|
+
this.eventDispatcher.start();
|
|
74
|
+
this.deliveryRouter.start();
|
|
64
75
|
log.info("Automation service initialized");
|
|
65
76
|
}
|
|
66
77
|
async stop() {
|
|
@@ -69,9 +80,10 @@ var AutomationService = class {
|
|
|
69
80
|
clearTimeout(this.timer);
|
|
70
81
|
this.timer = null;
|
|
71
82
|
}
|
|
72
|
-
|
|
73
|
-
for (const
|
|
74
|
-
this.
|
|
83
|
+
await this.eventDispatcher.stop();
|
|
84
|
+
for (const controller of this.activeRuns.values()) controller.abort(/* @__PURE__ */ new Error("Automation service stopped"));
|
|
85
|
+
await Promise.allSettled(this.activeRunTasks.values());
|
|
86
|
+
await this.deliveryRouter.stop();
|
|
75
87
|
log.info("Automation service stopped");
|
|
76
88
|
}
|
|
77
89
|
async create(input) {
|
|
@@ -92,7 +104,13 @@ var AutomationService = class {
|
|
|
92
104
|
enabled: parsed.enabled ?? true,
|
|
93
105
|
safety: parsed.safety ?? { mode: "auto_apply" },
|
|
94
106
|
conversationMode: parsed.conversationMode ?? "new_session",
|
|
95
|
-
|
|
107
|
+
delivery: parsed.delivery ?? {
|
|
108
|
+
notificationPolicy: "attention",
|
|
109
|
+
destinations: [{
|
|
110
|
+
key: "gateway_event",
|
|
111
|
+
kind: "gateway_event"
|
|
112
|
+
}]
|
|
113
|
+
},
|
|
96
114
|
state: parsed.state ?? {},
|
|
97
115
|
createdAtMs: now,
|
|
98
116
|
updatedAtMs: now
|
|
@@ -188,24 +206,80 @@ var AutomationService = class {
|
|
|
188
206
|
return this.update(id, { enabled: true });
|
|
189
207
|
}
|
|
190
208
|
async runNow(id) {
|
|
191
|
-
|
|
209
|
+
return this.ingestTargetedTrigger(id, {
|
|
210
|
+
type: "automation.manual.requested",
|
|
211
|
+
source: "user",
|
|
212
|
+
trust: "user",
|
|
213
|
+
payload: { automationId: id }
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
async rerunFromRun(runId) {
|
|
217
|
+
const previous = getAutomationRun(runId);
|
|
218
|
+
if (!previous) throw new Error(`Automation run not found: ${runId}`);
|
|
219
|
+
const request = {
|
|
220
|
+
type: "automation.rerun.requested",
|
|
221
|
+
source: "user",
|
|
222
|
+
trust: "user",
|
|
223
|
+
payload: {
|
|
224
|
+
automationId: previous.automationId,
|
|
225
|
+
previousRunId: runId
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
const run = this.queueTriggerAtomically(previous.automationId, request, getAutomationEventForRun(runId) ?? request);
|
|
192
229
|
this.dispatchQueuedRun(run.id);
|
|
193
230
|
return run;
|
|
194
231
|
}
|
|
195
|
-
|
|
196
|
-
const
|
|
232
|
+
ingestEvent(event, targetAutomationIds) {
|
|
233
|
+
const result = ingestAutomationEvent(event, targetAutomationIds ? { targetAutomationIds } : void 0);
|
|
234
|
+
this.eventDispatcher.dispatch();
|
|
235
|
+
return result;
|
|
236
|
+
}
|
|
237
|
+
dispatchEvents() {
|
|
238
|
+
return this.eventDispatcher.dispatch();
|
|
239
|
+
}
|
|
240
|
+
replayEventAtomically(eventId) {
|
|
241
|
+
return replayAutomationEvent(eventId);
|
|
242
|
+
}
|
|
243
|
+
retryResultDeliveryAtomically(runId, destinationKey) {
|
|
244
|
+
return retryAutomationResultDelivery(runId, destinationKey);
|
|
245
|
+
}
|
|
246
|
+
dispatchRecoveryWork() {
|
|
247
|
+
this.eventDispatcher.dispatch();
|
|
248
|
+
this.deliveryRouter.dispatch();
|
|
249
|
+
}
|
|
250
|
+
listEventRecords(input) {
|
|
251
|
+
return listAutomationEventRecords(input);
|
|
252
|
+
}
|
|
253
|
+
listResultDeliveries(input) {
|
|
254
|
+
return listAutomationResultDeliveries(input);
|
|
255
|
+
}
|
|
256
|
+
async ingestTargetedTrigger(automationId, event) {
|
|
257
|
+
const run = this.queueTriggerAtomically(automationId, event);
|
|
197
258
|
this.dispatchQueuedRun(run.id);
|
|
198
259
|
return run;
|
|
199
260
|
}
|
|
200
|
-
|
|
261
|
+
queueTriggerAtomically(automationId, input, executionEvent = input) {
|
|
201
262
|
return runSqliteWriteTransaction(() => {
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
263
|
+
const eventId = input.id?.trim() || randomUUID();
|
|
264
|
+
const result = ingestAutomationEvent({
|
|
265
|
+
...input,
|
|
266
|
+
id: eventId,
|
|
267
|
+
subject: input.subject ?? {
|
|
268
|
+
kind: "automation",
|
|
269
|
+
id: automationId
|
|
270
|
+
},
|
|
271
|
+
correlationId: input.correlationId ?? eventId
|
|
272
|
+
}, { targetAutomationIds: [automationId] });
|
|
273
|
+
const existingRunId = getAutomationEventDeliveryRunId(result.event.id, automationId);
|
|
274
|
+
const existingRun = existingRunId ? getAutomationRun(existingRunId) : null;
|
|
275
|
+
if (existingRun) return existingRun;
|
|
276
|
+
const manual = result.event.type === "automation.manual.requested" || result.event.type === "automation.rerun.requested";
|
|
277
|
+
const run = this.queueRunAtomically(automationId, {
|
|
278
|
+
manual,
|
|
279
|
+
event: executionEvent
|
|
280
|
+
});
|
|
281
|
+
markAutomationEventDeliveryQueued(result.event.id, automationId, run.id);
|
|
282
|
+
return run;
|
|
209
283
|
});
|
|
210
284
|
}
|
|
211
285
|
queueRunAtomically(id, opts = { manual: true }) {
|
|
@@ -242,26 +316,18 @@ var AutomationService = class {
|
|
|
242
316
|
};
|
|
243
317
|
});
|
|
244
318
|
if (!claimed) return;
|
|
245
|
-
this.executeRun(claimed.automation, claimed.run).catch((err) => {
|
|
319
|
+
const task = this.executeRun(claimed.automation, claimed.run).catch((err) => {
|
|
246
320
|
log.error({
|
|
247
321
|
err,
|
|
248
322
|
runId
|
|
249
323
|
}, "Queued automation run failed");
|
|
324
|
+
}).finally(() => {
|
|
325
|
+
this.activeRunTasks.delete(runId);
|
|
250
326
|
});
|
|
327
|
+
this.activeRunTasks.set(runId, task);
|
|
251
328
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
...event,
|
|
255
|
-
occurredAtMs: event.occurredAtMs ?? Date.now()
|
|
256
|
-
};
|
|
257
|
-
const automations = listAutomations().filter((automation) => automation.enabled && automation.trigger.kind === "event" && !automation.state.runningRunId && matchesAutomationEvent(automation.trigger, normalized));
|
|
258
|
-
const availableSlots = Math.max(0, this.maxConcurrentRuns - this.activeRuns.size);
|
|
259
|
-
const started = [];
|
|
260
|
-
for (const automation of automations.slice(0, availableSlots)) started.push(await this.startRun(automation, {
|
|
261
|
-
manual: false,
|
|
262
|
-
event: normalized
|
|
263
|
-
}));
|
|
264
|
-
return started;
|
|
329
|
+
availableRunSlots() {
|
|
330
|
+
return Math.max(0, this.maxConcurrentRuns - this.activeRuns.size);
|
|
265
331
|
}
|
|
266
332
|
async listRuns(options) {
|
|
267
333
|
return listAutomationRuns(options);
|
|
@@ -288,6 +354,8 @@ var AutomationService = class {
|
|
|
288
354
|
}
|
|
289
355
|
dispatchCancellation(runId) {
|
|
290
356
|
this.activeRuns.get(runId)?.abort(/* @__PURE__ */ new Error("Automation run was cancelled by the user"));
|
|
357
|
+
const run = getAutomationRun(runId);
|
|
358
|
+
if (run?.status === "cancelled") this.eventDispatcher.runCompleted(run);
|
|
291
359
|
this.refreshSchedule();
|
|
292
360
|
}
|
|
293
361
|
cancelRunAtomically(runId) {
|
|
@@ -336,6 +404,8 @@ var AutomationService = class {
|
|
|
336
404
|
this.appendRunEvent(cancelled, "run.cancel_confirmed", "Queued automation cancelled before execution");
|
|
337
405
|
this.appendRunEvent(cancelled, "run.completed", "Automation run cancelled", { status: "cancelled" });
|
|
338
406
|
this.finishAutomationRun(current.automationId, runId, "cancelled", void 0, now);
|
|
407
|
+
const automation = getAutomation(current.automationId);
|
|
408
|
+
if (automation) this.deliveryRouter.enqueue(cancelled, automation);
|
|
339
409
|
return {
|
|
340
410
|
cancelled: true,
|
|
341
411
|
confirmed: true
|
|
@@ -347,6 +417,8 @@ var AutomationService = class {
|
|
|
347
417
|
const enabled = automations.filter((automation) => automation.enabled);
|
|
348
418
|
const next = enabled.filter((automation) => automation.state.nextRunAtMs != null).toSorted((a, b) => (a.state.nextRunAtMs ?? 0) - (b.state.nextRunAtMs ?? 0))[0];
|
|
349
419
|
const oneHourAgo = Date.now() - 60 * 6e4;
|
|
420
|
+
const eventMetrics = getAutomationEventQueueMetrics();
|
|
421
|
+
const deliveryMetrics = getAutomationResultDeliveryMetrics();
|
|
350
422
|
return {
|
|
351
423
|
totalAutomations: automations.length,
|
|
352
424
|
enabledAutomations: enabled.length,
|
|
@@ -356,7 +428,16 @@ var AutomationService = class {
|
|
|
356
428
|
automationId: next.id,
|
|
357
429
|
name: next.name,
|
|
358
430
|
runAtMs: next.state.nextRunAtMs
|
|
359
|
-
} : void 0
|
|
431
|
+
} : void 0,
|
|
432
|
+
pendingEvents: eventMetrics.pending,
|
|
433
|
+
oldestPendingEventAgeMs: eventMetrics.oldestPendingAgeMs,
|
|
434
|
+
projectionDeadLetters: eventMetrics.projectionDeadLetters,
|
|
435
|
+
pendingRunDeliveries: eventMetrics.pendingDeliveries,
|
|
436
|
+
runDeliveryDeadLetters: eventMetrics.deliveryDeadLetters,
|
|
437
|
+
pendingResultDeliveries: deliveryMetrics.pending,
|
|
438
|
+
resultDeliveryDeadLetters: deliveryMetrics.deadLetters,
|
|
439
|
+
activeExecutions: this.activeRuns.size,
|
|
440
|
+
activeDeliveryLeases: eventMetrics.activeLeases + deliveryMetrics.activeLeases
|
|
360
441
|
};
|
|
361
442
|
}
|
|
362
443
|
async recomputeNextRuns(options) {
|
|
@@ -400,17 +481,28 @@ var AutomationService = class {
|
|
|
400
481
|
try {
|
|
401
482
|
const now = Date.now();
|
|
402
483
|
const due = listAutomations().filter((automation) => automation.enabled && automation.trigger.kind === "schedule" && automation.state.nextRunAtMs != null && automation.state.nextRunAtMs <= now && !automation.state.runningRunId).slice(0, this.maxConcurrentRuns);
|
|
403
|
-
await Promise.all(due.map((automation) => this.
|
|
484
|
+
await Promise.all(due.map((automation) => this.ingestTargetedTrigger(automation.id, {
|
|
485
|
+
id: `schedule:${automation.id}:${automation.state.nextRunAtMs}`,
|
|
486
|
+
type: "automation.schedule.due",
|
|
487
|
+
source: "scheduler",
|
|
488
|
+
subject: {
|
|
489
|
+
kind: "automation",
|
|
490
|
+
id: automation.id
|
|
491
|
+
},
|
|
492
|
+
correlationId: `schedule:${automation.id}:${automation.state.nextRunAtMs}`,
|
|
493
|
+
dedupeKey: `${automation.id}:${automation.state.nextRunAtMs}`,
|
|
494
|
+
trust: "system",
|
|
495
|
+
payload: {
|
|
496
|
+
automationId: automation.id,
|
|
497
|
+
dueAtMs: automation.state.nextRunAtMs
|
|
498
|
+
},
|
|
499
|
+
occurredAtMs: automation.state.nextRunAtMs
|
|
500
|
+
})));
|
|
404
501
|
} finally {
|
|
405
502
|
this.runningScheduler = false;
|
|
406
503
|
this.armTimer();
|
|
407
504
|
}
|
|
408
505
|
}
|
|
409
|
-
async startRun(automation, opts) {
|
|
410
|
-
const run = this.queueRunAtomically(automation.id, opts);
|
|
411
|
-
this.dispatchQueuedRun(run.id);
|
|
412
|
-
return run;
|
|
413
|
-
}
|
|
414
506
|
persistQueuedRun(automation, opts) {
|
|
415
507
|
const now = Date.now();
|
|
416
508
|
const run = {
|
|
@@ -420,7 +512,7 @@ var AutomationService = class {
|
|
|
420
512
|
status: "queued",
|
|
421
513
|
triggerSnapshot: automation.trigger,
|
|
422
514
|
actionSnapshot: automation.action,
|
|
423
|
-
manual: opts.manual,
|
|
515
|
+
manual: opts.manual || opts.event?.type === "automation.manual.requested" || opts.event?.type === "automation.rerun.requested",
|
|
424
516
|
createdAtMs: now,
|
|
425
517
|
attemptNumber: 1
|
|
426
518
|
};
|
|
@@ -465,7 +557,7 @@ var AutomationService = class {
|
|
|
465
557
|
this.heartbeatTimers.set(run.id, heartbeat);
|
|
466
558
|
let status = "failed";
|
|
467
559
|
let error;
|
|
468
|
-
let
|
|
560
|
+
let artifacts;
|
|
469
561
|
const triggerEvent = listAutomationRunEvents(run.id).map(readAutomationEventFromRunEvent).find((item) => item !== null);
|
|
470
562
|
try {
|
|
471
563
|
const maxAttempts = Math.max(1, (automation.reliability?.retryCount ?? 0) + 1);
|
|
@@ -494,7 +586,7 @@ var AutomationService = class {
|
|
|
494
586
|
timeoutMs: patch.deadlineAtMs - startedAtMs
|
|
495
587
|
});
|
|
496
588
|
} }, { triggerEvent });
|
|
497
|
-
if (!(task.status === "failed") || attempt >= maxAttempts || controller.signal.aborted) break;
|
|
589
|
+
if (!(task.status === "failed" && this.executor.canRetry(automation.action.kind, task.error)) || attempt >= maxAttempts || controller.signal.aborted) break;
|
|
498
590
|
const delayMs = Math.min(RETRY_BASE_DELAY_MS * 2 ** (attempt - 1), 3e4);
|
|
499
591
|
this.appendRunEvent(run, "action.retry_scheduled", "Automation action retry scheduled", {
|
|
500
592
|
attempt,
|
|
@@ -506,8 +598,10 @@ var AutomationService = class {
|
|
|
506
598
|
});
|
|
507
599
|
await this.waitForRetry(delayMs, controller.signal);
|
|
508
600
|
}
|
|
601
|
+
this.deliveryRouter.validateArtifacts(task.artifacts ?? []);
|
|
509
602
|
status = task.status;
|
|
510
603
|
error = task.error;
|
|
604
|
+
artifacts = task.artifacts;
|
|
511
605
|
const persistedRun = getAutomationRun(run.id);
|
|
512
606
|
if (persistedRun) run = {
|
|
513
607
|
...run,
|
|
@@ -547,18 +641,6 @@ var AutomationService = class {
|
|
|
547
641
|
};
|
|
548
642
|
this.appendRunEvent(run, task.termination.cancellationConfirmed ? "run.cancel_confirmed" : "run.cancellation_unconfirmed", task.termination.cancellationConfirmed ? "Automation cancellation confirmed" : "Automation cancellation was not confirmed within the cleanup grace period", { termination: task.termination });
|
|
549
643
|
}
|
|
550
|
-
if (controller.signal.aborted || status === "timeout" || status === "cancelled") {} else if ((automation.safety?.mode ?? "auto_apply") !== "auto_apply" && automation.completionWebhookUrl) this.appendRunEvent(run, "completion_hook.completed", "Completion webhook skipped by safety mode", { safety: automation.safety ?? { mode: "auto_apply" } });
|
|
551
|
-
else if (automation.completionWebhookUrl) {
|
|
552
|
-
activePhase = "completion_hook";
|
|
553
|
-
run = {
|
|
554
|
-
...run,
|
|
555
|
-
currentPhase: "completion_hook"
|
|
556
|
-
};
|
|
557
|
-
saveAutomationRun(run);
|
|
558
|
-
this.appendRunEvent(run, "completion_hook.started", "Calling completion webhook", { url: automation.completionWebhookUrl });
|
|
559
|
-
await this.postCompletionWebhook(automation.completionWebhookUrl, run, controller.signal);
|
|
560
|
-
this.appendRunEvent(run, "completion_hook.completed", "Completion webhook completed");
|
|
561
|
-
}
|
|
562
644
|
} catch (err) {
|
|
563
645
|
const persistedRun = getAutomationRun(run.id);
|
|
564
646
|
if (persistedRun) run = {
|
|
@@ -566,16 +648,16 @@ var AutomationService = class {
|
|
|
566
648
|
...persistedRun
|
|
567
649
|
};
|
|
568
650
|
error = err instanceof Error ? err.message : String(err);
|
|
569
|
-
const deadlineExceeded =
|
|
651
|
+
const deadlineExceeded = run.deadlineAtMs !== void 0 && Date.now() >= run.deadlineAtMs;
|
|
570
652
|
status = controller.signal.aborted ? "cancelled" : deadlineExceeded ? "timeout" : "failed";
|
|
571
|
-
this.appendRunEvent(run,
|
|
653
|
+
this.appendRunEvent(run, "action.failed", `Automation run ${status}`, { error });
|
|
572
654
|
run = {
|
|
573
655
|
...run,
|
|
574
656
|
status,
|
|
575
657
|
error,
|
|
576
658
|
termination: {
|
|
577
659
|
reason: status === "cancelled" ? "user_cancelled" : status === "timeout" ? "deadline_exceeded" : "failed",
|
|
578
|
-
component:
|
|
660
|
+
component: run.termination?.component,
|
|
579
661
|
cancellationConfirmed: status !== "cancelled" || controller.signal.aborted
|
|
580
662
|
}
|
|
581
663
|
};
|
|
@@ -606,17 +688,11 @@ var AutomationService = class {
|
|
|
606
688
|
error
|
|
607
689
|
});
|
|
608
690
|
this.finishAutomationRun(automation.id, run.id, status, error, endedAtMs);
|
|
691
|
+
this.deliveryRouter.enqueue(run, automation, artifacts);
|
|
609
692
|
});
|
|
610
693
|
this.refreshSchedule();
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
} catch (err) {
|
|
614
|
-
log.warn({
|
|
615
|
-
err,
|
|
616
|
-
automationId: automation.id,
|
|
617
|
-
runId: run.id
|
|
618
|
-
}, "Automation completion hook failed");
|
|
619
|
-
}
|
|
694
|
+
this.eventDispatcher.runCompleted(run);
|
|
695
|
+
this.deliveryRouter.dispatch();
|
|
620
696
|
}
|
|
621
697
|
}
|
|
622
698
|
async recoverInterruptedRuns() {
|
|
@@ -656,7 +732,10 @@ var AutomationService = class {
|
|
|
656
732
|
status,
|
|
657
733
|
error
|
|
658
734
|
});
|
|
659
|
-
if (automation)
|
|
735
|
+
if (automation) {
|
|
736
|
+
this.finishAutomationRun(automation.id, run.id, status, error, now);
|
|
737
|
+
this.deliveryRouter.enqueue(recovered, automation);
|
|
738
|
+
}
|
|
660
739
|
}
|
|
661
740
|
}
|
|
662
741
|
waitForRetry(delayMs, signal) {
|
|
@@ -706,36 +785,7 @@ var AutomationService = class {
|
|
|
706
785
|
next.state.nextRunAtMs = computeNextAutomationRunAtMs(next, finishedAtMs);
|
|
707
786
|
saveAutomation(next);
|
|
708
787
|
}
|
|
709
|
-
async postCompletionWebhook(url, run, signal) {
|
|
710
|
-
const remainingMs = run.deadlineAtMs === void 0 ? 3e4 : Math.max(1, run.deadlineAtMs - Date.now());
|
|
711
|
-
const deadlineSignal = AbortSignal.timeout(remainingMs);
|
|
712
|
-
const requestSignal = AbortSignal.any([signal, deadlineSignal]);
|
|
713
|
-
let response;
|
|
714
|
-
try {
|
|
715
|
-
response = await fetch(url, {
|
|
716
|
-
method: "POST",
|
|
717
|
-
headers: { "content-type": "application/json" },
|
|
718
|
-
body: JSON.stringify({ run }),
|
|
719
|
-
signal: requestSignal
|
|
720
|
-
});
|
|
721
|
-
} catch (err) {
|
|
722
|
-
if (!signal.aborted && deadlineSignal.aborted) throw new AutomationDeadlineExceededError();
|
|
723
|
-
throw err;
|
|
724
|
-
}
|
|
725
|
-
if (!response.ok) {
|
|
726
|
-
const text = await response.text().catch(() => "");
|
|
727
|
-
throw new Error(`Automation webhook failed: HTTP ${response.status}${text ? ` ${text.slice(0, 200)}` : ""}`);
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
788
|
};
|
|
731
|
-
function matchesAutomationEvent(trigger, event) {
|
|
732
|
-
if (trigger.eventType !== event.type) return false;
|
|
733
|
-
if (trigger.source && trigger.source !== event.source) return false;
|
|
734
|
-
const payloadMatch = trigger.payloadMatch;
|
|
735
|
-
if (!payloadMatch) return true;
|
|
736
|
-
const payload = event.payload ?? {};
|
|
737
|
-
return Object.entries(payloadMatch).every(([key, expected]) => Object.is(payload[key], expected));
|
|
738
|
-
}
|
|
739
789
|
function readAutomationEventFromRunEvent(event) {
|
|
740
790
|
if (!event.data || typeof event.data !== "object" || Array.isArray(event.data)) return null;
|
|
741
791
|
const raw = event.data.event;
|
|
@@ -20,9 +20,9 @@ function rowToAutomation(row) {
|
|
|
20
20
|
action: parseJson(row.action_json),
|
|
21
21
|
safety: parseJson(row.safety_json) ?? { mode: "auto_apply" },
|
|
22
22
|
conversationMode: row.conversation_mode,
|
|
23
|
-
|
|
24
|
-
completionWebhookUrl: row.completion_webhook_url ?? void 0,
|
|
23
|
+
delivery: parseJson(row.delivery_json),
|
|
25
24
|
reliability: parseJson(row.reliability_json),
|
|
25
|
+
management: parseJson(row.management_json),
|
|
26
26
|
state: parseJson(row.state_json) ?? {},
|
|
27
27
|
createdAtMs: row.created_at_ms,
|
|
28
28
|
updatedAtMs: row.updated_at_ms
|
|
@@ -31,14 +31,14 @@ function rowToAutomation(row) {
|
|
|
31
31
|
function upsertAutomation(db, automation) {
|
|
32
32
|
db.prepare(`INSERT OR REPLACE INTO automations (
|
|
33
33
|
automation_id, name, description, project_id, enabled, trigger_json, action_json,
|
|
34
|
-
safety_json, conversation_mode,
|
|
35
|
-
reliability_json, state_json, created_at_ms, updated_at_ms
|
|
36
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(automation.id, automation.name, automation.description ?? null, automation.projectId ?? null, automation.enabled ? 1 : 0, JSON.stringify(automation.trigger), JSON.stringify(automation.action), bindJson(automation.safety ?? { mode: "auto_apply" }), automation.conversationMode, automation.
|
|
34
|
+
safety_json, conversation_mode, delivery_json,
|
|
35
|
+
reliability_json, management_json, state_json, created_at_ms, updated_at_ms
|
|
36
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(automation.id, automation.name, automation.description ?? null, automation.projectId ?? null, automation.enabled ? 1 : 0, JSON.stringify(automation.trigger), JSON.stringify(automation.action), bindJson(automation.safety ?? { mode: "auto_apply" }), automation.conversationMode, bindJson(automation.delivery), bindJson(automation.reliability), bindJson(automation.management), JSON.stringify(automation.state ?? {}), automation.createdAtMs, automation.updatedAtMs);
|
|
37
37
|
}
|
|
38
38
|
const AUTOMATION_SELECT = `
|
|
39
39
|
SELECT automation_id, name, description, project_id, enabled, trigger_json, action_json,
|
|
40
|
-
safety_json, conversation_mode,
|
|
41
|
-
reliability_json, state_json, created_at_ms, updated_at_ms
|
|
40
|
+
safety_json, conversation_mode, delivery_json,
|
|
41
|
+
reliability_json, management_json, state_json, created_at_ms, updated_at_ms
|
|
42
42
|
FROM automations
|
|
43
43
|
`;
|
|
44
44
|
function listAutomations(options) {
|
|
@@ -20,6 +20,7 @@ export declare function listAutomationRunsForProductEvent(options: {
|
|
|
20
20
|
limit?: number;
|
|
21
21
|
}): AutomationProductEventRun[];
|
|
22
22
|
export declare function deleteAutomationRunsForAutomation(automationId: string): void;
|
|
23
|
+
export declare function pruneAutomationHistory(cutoffMs?: number): number;
|
|
23
24
|
export declare function markAutomationRunRead(runId: string, readAtMs?: number): boolean;
|
|
24
25
|
export declare function markAllAutomationRunsRead(options?: {
|
|
25
26
|
projectId?: string;
|
|
@@ -50,8 +50,15 @@ function trimRuns(db, automationId) {
|
|
|
50
50
|
const countRow = db.prepare(`SELECT COUNT(*) AS count FROM automation_runs WHERE automation_id = ?`).get(automationId);
|
|
51
51
|
if (countRow.count <= MAX_RUNS_PER_AUTOMATION) return;
|
|
52
52
|
const staleRunIds = db.prepare(`SELECT run_id FROM automation_runs WHERE automation_id = ? AND status NOT IN ('queued', 'running', 'cancelling')
|
|
53
|
+
AND NOT EXISTS (
|
|
54
|
+
SELECT 1 FROM automation_result_deliveries d
|
|
55
|
+
WHERE d.run_id = automation_runs.run_id AND d.status <> 'delivered'
|
|
56
|
+
)
|
|
53
57
|
ORDER BY created_at_ms ASC LIMIT ?`).all(automationId, countRow.count - TRIM_TO_RUNS);
|
|
54
58
|
for (const { run_id: runId } of staleRunIds) {
|
|
59
|
+
db.prepare("DELETE FROM automation_event_deliveries WHERE run_id = ?").run(runId);
|
|
60
|
+
db.prepare("DELETE FROM automation_result_deliveries WHERE run_id = ?").run(runId);
|
|
61
|
+
db.prepare("DELETE FROM automation_results WHERE run_id = ?").run(runId);
|
|
55
62
|
db.prepare("DELETE FROM automation_run_requests WHERE run_id = ?").run(runId);
|
|
56
63
|
db.prepare(`DELETE FROM automation_run_events WHERE run_id = ?`).run(runId);
|
|
57
64
|
db.prepare(`DELETE FROM automation_runs WHERE run_id = ?`).run(runId);
|
|
@@ -175,11 +182,29 @@ function listAutomationRunsForProductEvent(options) {
|
|
|
175
182
|
}
|
|
176
183
|
function deleteAutomationRunsForAutomation(automationId) {
|
|
177
184
|
runSqliteWriteTransaction((db) => {
|
|
185
|
+
db.prepare(`DELETE FROM automation_event_deliveries
|
|
186
|
+
WHERE run_id IN (SELECT run_id FROM automation_runs WHERE automation_id = ?)`).run(automationId);
|
|
187
|
+
db.prepare(`DELETE FROM automation_result_deliveries
|
|
188
|
+
WHERE run_id IN (SELECT run_id FROM automation_runs WHERE automation_id = ?)`).run(automationId);
|
|
189
|
+
db.prepare(`DELETE FROM automation_results
|
|
190
|
+
WHERE run_id IN (SELECT run_id FROM automation_runs WHERE automation_id = ?)`).run(automationId);
|
|
178
191
|
db.prepare("DELETE FROM automation_run_requests WHERE run_id IN (SELECT run_id FROM automation_runs WHERE automation_id = ?)").run(automationId);
|
|
179
192
|
db.prepare(`DELETE FROM automation_run_events WHERE automation_id = ?`).run(automationId);
|
|
180
193
|
db.prepare(`DELETE FROM automation_runs WHERE automation_id = ?`).run(automationId);
|
|
181
194
|
});
|
|
182
195
|
}
|
|
196
|
+
function pruneAutomationHistory(cutoffMs = Date.now() - 720 * 60 * 6e4) {
|
|
197
|
+
return runSqliteWriteTransaction((db) => {
|
|
198
|
+
const result = db.prepare(`DELETE FROM automation_events
|
|
199
|
+
WHERE projection_status = 'projected' AND projected_at_ms < ?
|
|
200
|
+
AND NOT EXISTS (
|
|
201
|
+
SELECT 1 FROM automation_event_deliveries d
|
|
202
|
+
WHERE d.event_id = automation_events.event_id
|
|
203
|
+
AND d.status IN ('pending', 'retrying', 'queued', 'dead_letter')
|
|
204
|
+
)`).run(cutoffMs);
|
|
205
|
+
return Number(result.changes);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
183
208
|
function markAutomationRunRead(runId, readAtMs = Date.now()) {
|
|
184
209
|
return getSqliteDatabase().prepare(`UPDATE automation_runs SET read_at_ms = COALESCE(read_at_ms, ?) WHERE run_id = ? AND ended_at_ms IS NOT NULL`).run(readAtMs, runId).changes > 0;
|
|
185
210
|
}
|
|
@@ -196,4 +221,4 @@ function markAllAutomationRunsRead(options) {
|
|
|
196
221
|
return Number(result.changes);
|
|
197
222
|
}
|
|
198
223
|
//#endregion
|
|
199
|
-
export { appendAutomationRunEvent, deleteAutomationRunsForAutomation, getAutomationRun, getAutomationRunRequest, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, saveAutomationRun, saveAutomationRunRequest, touchAutomationRunLease };
|
|
224
|
+
export { appendAutomationRunEvent, deleteAutomationRunsForAutomation, getAutomationRun, getAutomationRunRequest, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, pruneAutomationHistory, saveAutomationRun, saveAutomationRunRequest, touchAutomationRunLease };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { deleteAutomation, getAutomation, getDeletedAutomationRevision, listAutomations, saveAutomation, saveAutomations } from "./automation-repository.js";
|
|
2
|
-
import { appendAutomationRunEvent, deleteAutomationRunsForAutomation, getAutomationRun, getAutomationRunRequest, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, saveAutomationRun, saveAutomationRunRequest, touchAutomationRunLease } from "./automation-run-repository.js";
|
|
3
|
-
export { appendAutomationRunEvent, deleteAutomation, deleteAutomationRunsForAutomation, getAutomation, getAutomationRun, getAutomationRunRequest, getDeletedAutomationRevision, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listAutomations, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, saveAutomation, saveAutomationRun, saveAutomationRunRequest, saveAutomations, touchAutomationRunLease };
|
|
2
|
+
import { appendAutomationRunEvent, deleteAutomationRunsForAutomation, getAutomationRun, getAutomationRunRequest, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, pruneAutomationHistory, saveAutomationRun, saveAutomationRunRequest, touchAutomationRunLease } from "./automation-run-repository.js";
|
|
3
|
+
export { appendAutomationRunEvent, deleteAutomation, deleteAutomationRunsForAutomation, getAutomation, getAutomationRun, getAutomationRunRequest, getDeletedAutomationRevision, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listAutomations, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, pruneAutomationHistory, saveAutomation, saveAutomationRun, saveAutomationRunRequest, saveAutomations, touchAutomationRunLease };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveAutomationWebhookSecret(secretId: string): string | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/automations/webhook-secrets.ts
|
|
2
|
+
function resolveAutomationWebhookSecret(secretId) {
|
|
3
|
+
const raw = process.env.XOPC_AUTOMATION_WEBHOOK_SECRETS?.trim();
|
|
4
|
+
if (!raw) return void 0;
|
|
5
|
+
let parsed;
|
|
6
|
+
try {
|
|
7
|
+
parsed = JSON.parse(raw);
|
|
8
|
+
} catch {
|
|
9
|
+
throw new Error("XOPC_AUTOMATION_WEBHOOK_SECRETS must be a JSON object");
|
|
10
|
+
}
|
|
11
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("XOPC_AUTOMATION_WEBHOOK_SECRETS must be a JSON object");
|
|
12
|
+
const value = parsed[secretId];
|
|
13
|
+
return typeof value === "string" && value.length >= 16 ? value : void 0;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { resolveAutomationWebhookSecret };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { requireXopcDatabase } from "../storage/sqlite/connection.js";
|
|
2
2
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
3
3
|
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
4
|
+
import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
4
5
|
import { cutoverLegacyAgentConfig } from "../agent-catalog/migrations/legacy-config-cutover.js";
|
|
5
6
|
import "../agent-catalog/index.js";
|
|
6
|
-
import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
7
7
|
import { runBootstrapMigrationsSync } from "../migrations/runner.js";
|
|
8
8
|
//#region src/bootstrap/application-state.ts
|
|
9
9
|
init_sqlite();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SqliteCommitEffectError, init_transaction } from "../../storage/sqlite/transaction.js";
|
|
2
|
-
import { OperationConflictError, executeAtomicOperation } from "./atomic-operations.js";
|
|
3
2
|
import { CapabilityError } from "./errors.js";
|
|
4
3
|
import { executeExternalOperation } from "./external-operations.js";
|
|
4
|
+
import { OperationConflictError, executeAtomicOperation } from "./atomic-operations.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/capabilities/runtime/dispatcher.ts
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CapabilityError } from "./errors.js";
|
|
2
2
|
import { CapabilityDispatcher } from "./dispatcher.js";
|
|
3
|
-
import { registerAgentCapabilities } from "../../agent-catalog/capabilities.js";
|
|
4
3
|
import { registerLocalAppReadCapabilities } from "../../local-apps/capabilities/read.js";
|
|
5
4
|
import { registerNoteReadCapabilities } from "../../notes/capabilities/read.js";
|
|
6
5
|
import { registerNoteWriteCapabilities } from "../../notes/capabilities/write.js";
|
|
@@ -19,6 +18,7 @@ import { registerSceneReadCapabilities } from "../../scenes/capabilities/read.js
|
|
|
19
18
|
import { registerSceneWriteCapabilities } from "../../scenes/capabilities/write.js";
|
|
20
19
|
import { registerSettingsCapability } from "./settings.js";
|
|
21
20
|
import { registerAppContextCapability } from "./app-context.js";
|
|
21
|
+
import { registerAgentCapabilities } from "../../agent-catalog/capabilities.js";
|
|
22
22
|
//#region src/capabilities/runtime/product.ts
|
|
23
23
|
function createProductDispatcher(getNotes, taskWrites) {
|
|
24
24
|
const dispatcher = new CapabilityDispatcher();
|
|
@@ -7,10 +7,26 @@ export type StoreConnectorInstallPlan = {
|
|
|
7
7
|
definition: ConnectorDefinition;
|
|
8
8
|
permissions: ConnectorPermissions;
|
|
9
9
|
requiresRestart: false;
|
|
10
|
+
reviewHash: string;
|
|
10
11
|
};
|
|
12
|
+
export type StoreConnectorInstallCandidate = {
|
|
13
|
+
candidateRef: string;
|
|
14
|
+
source: 'store';
|
|
15
|
+
packageName: string;
|
|
16
|
+
version: string;
|
|
17
|
+
label: string;
|
|
18
|
+
summary: string;
|
|
19
|
+
capabilities: string[];
|
|
20
|
+
};
|
|
21
|
+
export declare function storeConnectorCandidateRef(packageName: string, version: string): string;
|
|
22
|
+
export declare function parseStoreConnectorCandidateRef(ref: string): {
|
|
23
|
+
packageName: string;
|
|
24
|
+
version: string;
|
|
25
|
+
} | undefined;
|
|
26
|
+
export declare function searchStoreConnectorInstallCandidates(config: Config, query: string, limit?: number): Promise<StoreConnectorInstallCandidate[]>;
|
|
11
27
|
export declare function listStoreConnectors(config: Config, params: SkillsStoreListParams): Promise<import("../agent/skills/skills-marketplace.js").SkillsStoreListResponse>;
|
|
12
28
|
export declare function getStoreConnectorInstallPlan(config: Config, packageName: string, version?: string): Promise<StoreConnectorInstallPlan>;
|
|
13
|
-
export declare function installStoreConnector(config: Config, packageName: string, input: ConnectorInstallInput, version?: string): Promise<{
|
|
29
|
+
export declare function installStoreConnector(config: Config, packageName: string, input: ConnectorInstallInput, version?: string, reviewHash?: string): Promise<{
|
|
14
30
|
instance: import("../connectors/types.js").ConnectorInstance;
|
|
15
31
|
plan: StoreConnectorInstallPlan;
|
|
16
32
|
}>;
|