@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
|
@@ -1,10 +1,65 @@
|
|
|
1
1
|
import { getCliAdapter } from "../connectors/cli/adapterRegistry.js";
|
|
2
|
-
import {
|
|
2
|
+
import { listConnectorInstances } from "../connectors/instances.js";
|
|
3
3
|
import { installConnectorDefinition } from "../connectors/install.js";
|
|
4
|
+
import { downloadConnectorStoreZipBuffer, fetchStoreConnectorPackageDetail, listConnectorPackages, resolveSkillsStoreBaseUrl } from "../agent/skills/marketplace/adapters/store/store-api-client.js";
|
|
4
5
|
import { createHash } from "node:crypto";
|
|
5
6
|
import { isIP } from "node:net";
|
|
6
7
|
import AdmZip from "adm-zip";
|
|
7
8
|
//#region src/capabilities/store-connector.ts
|
|
9
|
+
const STORE_CONNECTOR_CANDIDATE_PREFIX = "store-connector:";
|
|
10
|
+
function storeConnectorCandidateRef(packageName, version) {
|
|
11
|
+
return `${STORE_CONNECTOR_CANDIDATE_PREFIX}${encodeURIComponent(packageName)}:${encodeURIComponent(version)}`;
|
|
12
|
+
}
|
|
13
|
+
function parseStoreConnectorCandidateRef(ref) {
|
|
14
|
+
if (!ref.startsWith(STORE_CONNECTOR_CANDIDATE_PREFIX)) return void 0;
|
|
15
|
+
const parts = ref.slice(16).split(":");
|
|
16
|
+
if (parts.length !== 2) return void 0;
|
|
17
|
+
try {
|
|
18
|
+
const packageName = decodeURIComponent(parts[0]);
|
|
19
|
+
const version = decodeURIComponent(parts[1]);
|
|
20
|
+
return packageName && version ? {
|
|
21
|
+
packageName,
|
|
22
|
+
version
|
|
23
|
+
} : void 0;
|
|
24
|
+
} catch {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function manifestCapabilities(value) {
|
|
29
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return ["connector.tools"];
|
|
30
|
+
const manifest = value;
|
|
31
|
+
if (!Array.isArray(manifest.provides)) return ["connector.tools"];
|
|
32
|
+
const values = manifest.provides.flatMap((entry) => {
|
|
33
|
+
if (typeof entry === "string" && entry.trim()) return [entry.trim()];
|
|
34
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return [];
|
|
35
|
+
const id = entry.id;
|
|
36
|
+
return typeof id === "string" && id.trim() ? [id.trim()] : [];
|
|
37
|
+
});
|
|
38
|
+
return values.length ? [...new Set(values)].slice(0, 20) : ["connector.tools"];
|
|
39
|
+
}
|
|
40
|
+
async function searchStoreConnectorInstallCandidates(config, query, limit = 5) {
|
|
41
|
+
const result = await listStoreConnectors(config, {
|
|
42
|
+
q: query,
|
|
43
|
+
page: 1,
|
|
44
|
+
pageSize: Math.min(10, Math.max(1, limit)),
|
|
45
|
+
sort: "downloads"
|
|
46
|
+
});
|
|
47
|
+
const installed = new Set(listConnectorInstances(config).map((instance) => instance.connectorId));
|
|
48
|
+
return result.items.filter((item) => item.type === "connector" && !installed.has(item.name) && typeof item.latestVersion === "string" && item.latestVersion).slice(0, limit).map((item) => ({
|
|
49
|
+
candidateRef: storeConnectorCandidateRef(item.name, item.latestVersion),
|
|
50
|
+
source: "store",
|
|
51
|
+
packageName: item.name,
|
|
52
|
+
version: item.latestVersion,
|
|
53
|
+
label: (() => {
|
|
54
|
+
const manifest = item.connectorManifest;
|
|
55
|
+
if (!manifest || typeof manifest !== "object" || Array.isArray(manifest)) return item.name;
|
|
56
|
+
const displayName = manifest.displayName;
|
|
57
|
+
return typeof displayName === "string" && displayName.trim() ? displayName.trim() : item.name;
|
|
58
|
+
})(),
|
|
59
|
+
summary: item.description,
|
|
60
|
+
capabilities: manifestCapabilities(item.connectorManifest)
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
8
63
|
function asRecord(value, label) {
|
|
9
64
|
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`${label} must be an object.`);
|
|
10
65
|
return value;
|
|
@@ -308,15 +363,26 @@ async function getStoreConnectorInstallPlan(config, packageName, version) {
|
|
|
308
363
|
version: detail.latestVersion.version,
|
|
309
364
|
permissions: definition.permissions ?? {},
|
|
310
365
|
requiresRestart: false,
|
|
366
|
+
reviewHash: createHash("sha256").update(JSON.stringify({
|
|
367
|
+
packageName: detail.name,
|
|
368
|
+
version: detail.latestVersion.version,
|
|
369
|
+
sha256: actualSha256,
|
|
370
|
+
permissions: definition.permissions ?? {},
|
|
371
|
+
capabilities: definition.capabilities,
|
|
372
|
+
auth: definition.auth,
|
|
373
|
+
setup: definition.setup,
|
|
374
|
+
runtime: definition.runtime
|
|
375
|
+
})).digest("hex"),
|
|
311
376
|
definition
|
|
312
377
|
};
|
|
313
378
|
}
|
|
314
|
-
async function installStoreConnector(config, packageName, input, version) {
|
|
379
|
+
async function installStoreConnector(config, packageName, input, version, reviewHash) {
|
|
315
380
|
const plan = await getStoreConnectorInstallPlan(config, packageName, version);
|
|
381
|
+
if (!reviewHash || reviewHash !== plan.reviewHash) throw new Error(reviewHash ? "Connector package changed after review; inspect it again." : "Connector capability review is required.");
|
|
316
382
|
return {
|
|
317
383
|
instance: await installConnectorDefinition(config, plan.definition, input),
|
|
318
384
|
plan
|
|
319
385
|
};
|
|
320
386
|
}
|
|
321
387
|
//#endregion
|
|
322
|
-
export { getStoreConnectorInstallPlan, installStoreConnector, listStoreConnectors };
|
|
388
|
+
export { getStoreConnectorInstallPlan, installStoreConnector, listStoreConnectors, parseStoreConnectorCandidateRef, searchStoreConnectorInstallCandidates, storeConnectorCandidateRef };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
2
1
|
import { getStoreConnectorInstallPlan, installStoreConnector, listStoreConnectors } from "../../capabilities/store-connector.js";
|
|
2
|
+
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
3
3
|
import { register } from "../registry.js";
|
|
4
4
|
import { confirm } from "@inquirer/prompts";
|
|
5
5
|
import { Command } from "commander";
|
|
@@ -52,7 +52,8 @@ function createConnectorsCommand(ctx) {
|
|
|
52
52
|
command.command("install <packageName>").description("Verify and install a connector capability from xopc-store").option("--version <version>", "Install an exact version").option("--secret <KEY=VALUE>", "Provide a required secret; repeat for multiple values", (value, previous = []) => [...previous, value], []).option("--config-value <KEY=VALUE>", "Provide a connector config value; repeat for multiple values", (value, previous = []) => [...previous, value], []).option("-y, --yes", "Skip the interactive confirmation", false).action(async (packageName, options) => {
|
|
53
53
|
try {
|
|
54
54
|
const config = loadConfig(ctx.configPath);
|
|
55
|
-
|
|
55
|
+
const plan = await getStoreConnectorInstallPlan(config, packageName, options.version);
|
|
56
|
+
printPlan(plan);
|
|
56
57
|
if (!options.yes && process.stdin.isTTY) {
|
|
57
58
|
if (!await confirm({
|
|
58
59
|
message: "Install this connector?",
|
|
@@ -65,7 +66,7 @@ function createConnectorsCommand(ctx) {
|
|
|
65
66
|
const { instance } = await installStoreConnector(config, packageName, {
|
|
66
67
|
secrets: parsePairs(options.secret, "--secret"),
|
|
67
68
|
config: parsePairs(options.configValue, "--config-value")
|
|
68
|
-
}, options.version);
|
|
69
|
+
}, options.version, plan.reviewHash);
|
|
69
70
|
await saveConfig(config, ctx.configPath);
|
|
70
71
|
console.log(`Installed ${instance.displayName} (${instance.instanceId}).`);
|
|
71
72
|
} catch (error) {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { requireXopcDatabase } from "../../../../storage/sqlite/connection.js";
|
|
2
|
+
import { getSqliteDatabase } from "../../../../storage/sqlite/transaction.js";
|
|
3
|
+
import { init_sqlite } from "../../../../storage/sqlite/index.js";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
//#region src/cli/commands/doctor/checks/automation-integrity.ts
|
|
6
|
+
init_sqlite();
|
|
7
|
+
async function checkAutomationIntegrity(ctx) {
|
|
8
|
+
if (!ctx.options.deep) return {
|
|
9
|
+
id: "automation-integrity",
|
|
10
|
+
label: "Automations",
|
|
11
|
+
status: "skip",
|
|
12
|
+
message: "Deep mode off; automation scan skipped.",
|
|
13
|
+
hints: ["Run: xopc doctor --deep"]
|
|
14
|
+
};
|
|
15
|
+
if (!existsSync(ctx.configPath)) return {
|
|
16
|
+
id: "automation-integrity",
|
|
17
|
+
label: "Automations",
|
|
18
|
+
status: "skip",
|
|
19
|
+
message: "No config file; skipped.",
|
|
20
|
+
hints: []
|
|
21
|
+
};
|
|
22
|
+
requireXopcDatabase();
|
|
23
|
+
const db = getSqliteDatabase();
|
|
24
|
+
const issues = [];
|
|
25
|
+
const orphanResults = db.prepare(`SELECT r.run_id FROM automation_results r
|
|
26
|
+
LEFT JOIN automation_runs ar ON ar.run_id = r.run_id WHERE ar.run_id IS NULL LIMIT 20`).all();
|
|
27
|
+
for (const row of orphanResults) issues.push(`orphan result ${row.run_id}`);
|
|
28
|
+
const orphanResultDeliveries = db.prepare(`SELECT d.run_id, d.destination_key FROM automation_result_deliveries d
|
|
29
|
+
LEFT JOIN automation_results r ON r.run_id = d.run_id WHERE r.run_id IS NULL LIMIT 20`).all();
|
|
30
|
+
for (const row of orphanResultDeliveries) issues.push(`orphan result delivery ${row.run_id}/${row.destination_key}`);
|
|
31
|
+
const orphanEventRuns = db.prepare(`SELECT d.event_id, d.automation_id, d.run_id FROM automation_event_deliveries d
|
|
32
|
+
LEFT JOIN automation_runs r ON r.run_id = d.run_id
|
|
33
|
+
WHERE d.run_id IS NOT NULL AND r.run_id IS NULL LIMIT 20`).all();
|
|
34
|
+
for (const row of orphanEventRuns) issues.push(`orphan event delivery run ${row.event_id}/${row.automation_id}/${row.run_id}`);
|
|
35
|
+
const expiredLeases = db.prepare(`SELECT
|
|
36
|
+
(SELECT COUNT(*) FROM automation_events WHERE projection_status = 'projecting' AND projection_lease_until_ms <= ?) +
|
|
37
|
+
(SELECT COUNT(*) FROM automation_event_deliveries WHERE lease_owner IS NOT NULL AND lease_until_ms <= ?) +
|
|
38
|
+
(SELECT COUNT(*) FROM automation_result_deliveries WHERE status = 'delivering' AND lease_until_ms <= ?) AS count`).get(Date.now(), Date.now(), Date.now());
|
|
39
|
+
if (expiredLeases.count > 0) issues.push(`${expiredLeases.count} expired automation lease(s) awaiting recovery`);
|
|
40
|
+
return issues.length === 0 ? {
|
|
41
|
+
id: "automation-integrity",
|
|
42
|
+
label: "Automations",
|
|
43
|
+
status: "pass",
|
|
44
|
+
message: "Automation state graph OK.",
|
|
45
|
+
hints: []
|
|
46
|
+
} : {
|
|
47
|
+
id: "automation-integrity",
|
|
48
|
+
label: "Automations",
|
|
49
|
+
status: "warn",
|
|
50
|
+
message: `${issues.length} automation integrity issue(s).`,
|
|
51
|
+
hints: issues
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { checkAutomationIntegrity };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { requireXopcDatabase } from "../../../../storage/sqlite/connection.js";
|
|
2
|
+
import { getSqliteDatabase } from "../../../../storage/sqlite/transaction.js";
|
|
3
|
+
import { init_sqlite } from "../../../../storage/sqlite/index.js";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
//#region src/cli/commands/doctor/checks/database-relations.ts
|
|
6
|
+
init_sqlite();
|
|
7
|
+
const IMPLICIT_RELATION_CHECKS = [
|
|
8
|
+
["session active transcript", `SELECT COUNT(*) AS count FROM sessions s
|
|
9
|
+
LEFT JOIN transcripts t ON t.transcript_id = s.active_transcript_id
|
|
10
|
+
WHERE t.transcript_id IS NULL`],
|
|
11
|
+
["session project", `SELECT COUNT(*) AS count FROM sessions s
|
|
12
|
+
LEFT JOIN projects p ON p.project_id = s.project_id
|
|
13
|
+
WHERE s.project_id IS NOT NULL AND p.project_id IS NULL`],
|
|
14
|
+
["queued session input", `SELECT COUNT(*) AS count FROM session_inputs i
|
|
15
|
+
LEFT JOIN sessions s ON s.conversation_id = i.conversation_id
|
|
16
|
+
WHERE s.conversation_id IS NULL`],
|
|
17
|
+
["discussion action task", `SELECT COUNT(*) AS count FROM discussion_action_tasks a
|
|
18
|
+
LEFT JOIN tasks t ON t.task_id = a.task_id
|
|
19
|
+
WHERE t.task_id IS NULL`],
|
|
20
|
+
["workflow event run", `SELECT COUNT(*) AS count FROM workflow_events e
|
|
21
|
+
LEFT JOIN workflow_runs r ON r.run_id = e.run_id
|
|
22
|
+
WHERE r.run_id IS NULL`],
|
|
23
|
+
["local app active release", `SELECT COUNT(*) AS count FROM local_apps a
|
|
24
|
+
LEFT JOIN local_app_releases r ON r.release_id = a.active_release_id
|
|
25
|
+
WHERE a.active_release_id IS NOT NULL AND r.release_id IS NULL`],
|
|
26
|
+
["automation run owner", `SELECT COUNT(*) AS count FROM automation_runs r
|
|
27
|
+
LEFT JOIN automations a ON a.automation_id = r.automation_id
|
|
28
|
+
WHERE a.automation_id IS NULL`],
|
|
29
|
+
["automation run event", `SELECT COUNT(*) AS count FROM automation_run_events e
|
|
30
|
+
LEFT JOIN automation_runs r ON r.run_id = e.run_id
|
|
31
|
+
WHERE r.run_id IS NULL`],
|
|
32
|
+
["automation event delivery owner", `SELECT COUNT(*) AS count FROM automation_event_deliveries d
|
|
33
|
+
LEFT JOIN automations a ON a.automation_id = d.automation_id
|
|
34
|
+
WHERE a.automation_id IS NULL`]
|
|
35
|
+
];
|
|
36
|
+
async function checkDatabaseRelations(ctx) {
|
|
37
|
+
if (!ctx.options.deep) return {
|
|
38
|
+
id: "database-relations",
|
|
39
|
+
label: "Database relations",
|
|
40
|
+
status: "skip",
|
|
41
|
+
message: "Deep mode off; relation scan skipped.",
|
|
42
|
+
hints: ["Run: xopc doctor --deep"]
|
|
43
|
+
};
|
|
44
|
+
if (!existsSync(ctx.configPath)) return {
|
|
45
|
+
id: "database-relations",
|
|
46
|
+
label: "Database relations",
|
|
47
|
+
status: "skip",
|
|
48
|
+
message: "No config file; skipped.",
|
|
49
|
+
hints: []
|
|
50
|
+
};
|
|
51
|
+
requireXopcDatabase();
|
|
52
|
+
const db = getSqliteDatabase();
|
|
53
|
+
const issues = [];
|
|
54
|
+
const tables = new Set(db.prepare(`SELECT name FROM sqlite_master WHERE type = 'table'`).all().map((row) => row.name));
|
|
55
|
+
for (const table of tables) {
|
|
56
|
+
const escaped = table.replaceAll("\"", "\"\"");
|
|
57
|
+
const foreignKeys = db.prepare(`PRAGMA foreign_key_list("${escaped}")`).all();
|
|
58
|
+
for (const foreignKey of foreignKeys) if (!tables.has(foreignKey.table)) issues.push(`missing foreign-key target ${table} -> ${foreignKey.table}`);
|
|
59
|
+
}
|
|
60
|
+
const violations = db.prepare("PRAGMA foreign_key_check").all();
|
|
61
|
+
for (const violation of violations.slice(0, 20)) issues.push(`foreign-key violation ${violation.table} row ${violation.rowid ?? "?"} -> ${violation.parent}`);
|
|
62
|
+
for (const [label, sql] of IMPLICIT_RELATION_CHECKS) {
|
|
63
|
+
const row = db.prepare(sql).get();
|
|
64
|
+
if (row.count > 0) issues.push(`${row.count} orphan ${label} record(s)`);
|
|
65
|
+
}
|
|
66
|
+
return issues.length === 0 ? {
|
|
67
|
+
id: "database-relations",
|
|
68
|
+
label: "Database relations",
|
|
69
|
+
status: "pass",
|
|
70
|
+
message: "Foreign-key and core implicit relations OK.",
|
|
71
|
+
hints: []
|
|
72
|
+
} : {
|
|
73
|
+
id: "database-relations",
|
|
74
|
+
label: "Database relations",
|
|
75
|
+
status: "warn",
|
|
76
|
+
message: `${issues.length} database relation issue(s).`,
|
|
77
|
+
hints: issues.slice(0, 20)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { checkDatabaseRelations };
|
|
@@ -53,7 +53,7 @@ async function checkDatabaseSchema(ctx) {
|
|
|
53
53
|
id: "database-schema",
|
|
54
54
|
label: "Database schema",
|
|
55
55
|
status: "pass",
|
|
56
|
-
message: `SQLite schema v${status.dbVersion} (current release
|
|
56
|
+
message: `SQLite schema v${status.dbVersion} (current release v222).`,
|
|
57
57
|
hints: []
|
|
58
58
|
};
|
|
59
59
|
}
|
|
@@ -3,6 +3,7 @@ import { checkNodeVersion } from "./checks/node-version.js";
|
|
|
3
3
|
import { checkConfigHealth } from "./checks/config-health.js";
|
|
4
4
|
import { checkStateIntegrity } from "./checks/state-integrity.js";
|
|
5
5
|
import { checkDatabaseSchema } from "./checks/database-schema.js";
|
|
6
|
+
import { checkDatabaseRelations } from "./checks/database-relations.js";
|
|
6
7
|
import { checkProviderAuth } from "./checks/provider-auth.js";
|
|
7
8
|
import { checkChannelConfig } from "./checks/channel-config.js";
|
|
8
9
|
import { checkChannelPairingPending } from "./checks/channel-pairing-pending.js";
|
|
@@ -16,6 +17,7 @@ import { checkChannelPlugins } from "./checks/channel-plugins.js";
|
|
|
16
17
|
import { checkMigrations } from "./checks/migrations.js";
|
|
17
18
|
import { checkImageProviders } from "./checks/image-providers.js";
|
|
18
19
|
import { checkToolRuntimes } from "./checks/tool-runtimes.js";
|
|
20
|
+
import { checkAutomationIntegrity } from "./checks/automation-integrity.js";
|
|
19
21
|
//#region src/cli/commands/doctor/flow.ts
|
|
20
22
|
const DOCTOR_CHECKS = [
|
|
21
23
|
checkVersionUpdate,
|
|
@@ -25,6 +27,7 @@ const DOCTOR_CHECKS = [
|
|
|
25
27
|
checkConfigHealth,
|
|
26
28
|
checkStateIntegrity,
|
|
27
29
|
checkDatabaseSchema,
|
|
30
|
+
checkDatabaseRelations,
|
|
28
31
|
checkProviderAuth,
|
|
29
32
|
checkImageProviders,
|
|
30
33
|
checkChannelConfig,
|
|
@@ -33,7 +36,8 @@ const DOCTOR_CHECKS = [
|
|
|
33
36
|
checkWorkspaceStatus,
|
|
34
37
|
checkGatewayService,
|
|
35
38
|
checkGatewayHealth,
|
|
36
|
-
checkSessionIntegrity
|
|
39
|
+
checkSessionIntegrity,
|
|
40
|
+
checkAutomationIntegrity
|
|
37
41
|
];
|
|
38
42
|
/**
|
|
39
43
|
* Headless data collection — used by both CLI and gateway API.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { init_paths, resolveExtensionsDir } from "../../config/paths.js";
|
|
2
|
+
import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, verifyStoreArtifactSha256 } from "../../agent/skills/marketplace/adapters/store/store-api-client.js";
|
|
2
3
|
import { computeExtensionDirectoryIntegrity, getExtensionLockfileManager } from "../../extensions/lockfile.js";
|
|
3
4
|
import { AgentPluginStore } from "../../extensions/agent-plugins/store.js";
|
|
4
|
-
import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, verifyStoreArtifactSha256 } from "../../agent/skills/marketplace/adapters/store/store-api-client.js";
|
|
5
5
|
import { loadConfig } from "../../config/loader.js";
|
|
6
6
|
import { getContextWithOpts } from "../context.js";
|
|
7
7
|
import { peekExtensionManifestFromStoreZip } from "../../extensions/install.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { resolveStateDir } from "../../config/paths-state.js";
|
|
2
2
|
import { init_paths, resolveBundledSkillsDir, resolveSkillsLockPath } from "../../config/paths.js";
|
|
3
|
+
import { loadSkillsLock } from "../../agent/skills/hub-lock.js";
|
|
3
4
|
import { findInstallSpec, hasBinary, installSkill } from "../../agent/skills/installer.js";
|
|
4
5
|
import { createSkillConfigManager, isSkillEnabled } from "../../agent/skills/config.js";
|
|
5
6
|
import { formatScanSummary, scanSkillDirectory } from "../../agent/skills/scanner.js";
|
|
6
7
|
import { createSkillLoader } from "../../agent/skills/index.js";
|
|
7
|
-
import { loadSkillsLock } from "../../agent/skills/hub-lock.js";
|
|
8
8
|
import { pullSkillFromSource, updateSkillFromLock } from "../../agent/skills/hub-pull.js";
|
|
9
9
|
import { ProjectTrustStore } from "../../project-trust/trust-store.js";
|
|
10
10
|
import { loadConfig } from "../../config/loader.js";
|
|
@@ -9,7 +9,7 @@ async function resumeApprovedConnectorAction(approval, recovery) {
|
|
|
9
9
|
if (!wait || wait.id !== approval.waitId || wait.principalId !== approval.principalId || wait.agentId !== approval.agentId || wait.status !== "open") return false;
|
|
10
10
|
try {
|
|
11
11
|
return (await recovery.act(wait.conversationId, {
|
|
12
|
-
action: "
|
|
12
|
+
action: "check",
|
|
13
13
|
waitId: wait.id,
|
|
14
14
|
expectedTranscriptId: wait.transcriptId,
|
|
15
15
|
expectedVersion: wait.version,
|
|
@@ -93,7 +93,7 @@ function commitCliIdentity(attempt, identity) {
|
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
db.prepare(`UPDATE connector_accounts SET runtime_instance_id = ?, identity_key = ?, identity_json = ?,
|
|
96
|
-
enabled = 1, label = COALESCE(label, ?), current_connection_id = ?, updated_at = ? WHERE id = ?`).run(attempt.instance_id, identity.key, JSON.stringify(identity.identity), identity.label, connectionId,
|
|
96
|
+
enabled = 1, label = COALESCE(label, ?), current_connection_id = ?, updated_at = ? WHERE id = ?`).run(attempt.instance_id, identity.key, JSON.stringify(identity.identity), identity.label, connectionId, Date.now(), accountId);
|
|
97
97
|
db.prepare("UPDATE connector_connections SET status = 'disabled' WHERE account_id = ? AND id <> ? AND provider = 'cli'").run(accountId, connectionId);
|
|
98
98
|
updateCliAuthorization(attempt.id, {
|
|
99
99
|
phase: "succeeded",
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
2
|
+
import { init_timestamps, optionalTimestampToIso, timestampToIso } from "../storage/sqlite/timestamps.js";
|
|
2
3
|
import { CredentialResolver, init_credentials } from "../auth/credentials.js";
|
|
3
4
|
import { randomUUID } from "node:crypto";
|
|
4
5
|
//#region src/connectors/composio-backends.ts
|
|
5
6
|
init_credentials();
|
|
7
|
+
init_timestamps();
|
|
6
8
|
init_transaction();
|
|
9
|
+
function fromRow(row) {
|
|
10
|
+
return {
|
|
11
|
+
...row,
|
|
12
|
+
verified_at: optionalTimestampToIso(row.verified_at) ?? null,
|
|
13
|
+
created_at: timestampToIso(row.created_at)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
7
16
|
function listComposioBackends() {
|
|
8
|
-
return getSqliteDatabase().prepare("SELECT * FROM connector_backends ORDER BY created_at").all();
|
|
17
|
+
return getSqliteDatabase().prepare("SELECT * FROM connector_backends ORDER BY created_at").all().map(fromRow);
|
|
9
18
|
}
|
|
10
19
|
function getComposioBackend(id) {
|
|
11
|
-
|
|
20
|
+
const row = id ? getSqliteDatabase().prepare("SELECT * FROM connector_backends WHERE id = ?").get(id) : getSqliteDatabase().prepare("SELECT * FROM connector_backends WHERE active = 1").get();
|
|
21
|
+
return row ? fromRow(row) : void 0;
|
|
12
22
|
}
|
|
13
23
|
function addComposioBackend(input) {
|
|
14
24
|
const id = input.id ?? randomUUID();
|
|
15
25
|
getSqliteDatabase().prepare(`INSERT INTO connector_backends(id, mode, label, credential_ref, credential_source, created_at)
|
|
16
|
-
VALUES (?, ?, ?, ?, ?, ?)`).run(id, input.mode, input.label, input.credentialRef ?? null, input.credentialSource ?? "stored",
|
|
26
|
+
VALUES (?, ?, ?, ?, ?, ?)`).run(id, input.mode, input.label, input.credentialRef ?? null, input.credentialSource ?? "stored", Date.now());
|
|
17
27
|
return getComposioBackend(id);
|
|
18
28
|
}
|
|
19
29
|
function activateComposioBackend(id) {
|
|
@@ -59,7 +69,7 @@ async function resolveBackendKey(backend, resolver = new CredentialResolver()) {
|
|
|
59
69
|
return null;
|
|
60
70
|
}
|
|
61
71
|
function markComposioBackendVerified(id) {
|
|
62
|
-
getSqliteDatabase().prepare("UPDATE connector_backends SET verified_at = ? WHERE id = ?").run(
|
|
72
|
+
getSqliteDatabase().prepare("UPDATE connector_backends SET verified_at = ? WHERE id = ?").run(Date.now(), id);
|
|
63
73
|
}
|
|
64
74
|
//#endregion
|
|
65
75
|
export { activateComposioBackend, addComposioBackend, ensureComposioBackend, getComposioBackend, listComposioBackends, markComposioBackendVerified, removeComposioBackend, resolveBackendKey };
|
|
@@ -21,11 +21,14 @@ export declare class ManagedComposioEventPoller {
|
|
|
21
21
|
private syncing?;
|
|
22
22
|
constructor(input: {
|
|
23
23
|
getConfig: () => Config;
|
|
24
|
-
|
|
24
|
+
ingestEvent: (event: {
|
|
25
|
+
id: string;
|
|
25
26
|
type: string;
|
|
26
27
|
source: string;
|
|
27
28
|
payload: Record<string, unknown>;
|
|
28
|
-
|
|
29
|
+
dedupeKey: string;
|
|
30
|
+
trust: 'connector';
|
|
31
|
+
}) => unknown;
|
|
29
32
|
requestLearning: (toolkit: string) => void;
|
|
30
33
|
setLearningPaused: (connectionId: string, paused: boolean) => void;
|
|
31
34
|
client?: ManagedEventClient;
|
|
@@ -89,9 +89,12 @@ var ManagedComposioEventPoller = class {
|
|
|
89
89
|
await appendComposioTriggerEvent(config, payload);
|
|
90
90
|
const toolkit = normalized.toolkit ?? event.toolkit;
|
|
91
91
|
if (toolkit) this.input.requestLearning(toolkit);
|
|
92
|
-
|
|
92
|
+
this.input.ingestEvent({
|
|
93
|
+
id: `connector:composio:${event.id}`,
|
|
93
94
|
type: `connector.${normalized.trigger ?? normalized.type}`,
|
|
94
95
|
source: toolkit ? `composio:${toolkit}` : "composio",
|
|
96
|
+
dedupeKey: event.id,
|
|
97
|
+
trust: "connector",
|
|
95
98
|
payload: {
|
|
96
99
|
...normalized.data,
|
|
97
100
|
connectorId: toolkit ? `composio-${toolkit}` : "composio",
|
|
@@ -8,11 +8,12 @@ export type ConnectionAction = {
|
|
|
8
8
|
expectedTranscriptId: string;
|
|
9
9
|
expectedVersion: number;
|
|
10
10
|
idempotencyKey: string;
|
|
11
|
-
action: '
|
|
11
|
+
action: 'install_complete' | 'connect' | 'check' | 'skip' | 'cancel' | 'select_account' | 'confirm_scope' | 'replace_source' | 'submit_callback';
|
|
12
12
|
needKey?: string;
|
|
13
13
|
accountId?: string;
|
|
14
14
|
candidateRef?: string;
|
|
15
15
|
callbackUrl?: string;
|
|
16
|
+
instanceId?: string;
|
|
16
17
|
};
|
|
17
18
|
/** Authorization lives at click time. Chat history contains only immutable explanations. */
|
|
18
19
|
export declare class ConnectionRecoveryService {
|
|
@@ -16,8 +16,8 @@ import { getInstalledConnectorDefinition, listConnectorInstances } from "./insta
|
|
|
16
16
|
import { describeCliAction, verifyCliConnection } from "./cli/runtime.js";
|
|
17
17
|
import { connectorPrincipalForSession } from "./principal.js";
|
|
18
18
|
import { capabilityActions, isToolInputSchema, missingConnectionCapabilities } from "./connection-capabilities.js";
|
|
19
|
-
import { resolveConnectionCandidate } from "./connection-candidates.js";
|
|
20
19
|
import { installConnector } from "./install.js";
|
|
20
|
+
import { resolveConnectionCandidate } from "./connection-candidates.js";
|
|
21
21
|
import { persistConfigMutation } from "../config/config-mutation.js";
|
|
22
22
|
import { HostPluginMcpRecovery } from "./plugin-mcp-recovery.js";
|
|
23
23
|
import { randomUUID } from "node:crypto";
|
|
@@ -108,6 +108,32 @@ var ConnectionRecoveryService = class {
|
|
|
108
108
|
...availability.reason || need.capabilityError ? { reason: availability.reason ?? need.capabilityError } : {}
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
|
+
if (need.target.type === "store-connector") {
|
|
112
|
+
const target = need.target;
|
|
113
|
+
const instance = listConnectorInstances(this.deps.getConfig()).find((item) => item.connectorId === target.connectorId);
|
|
114
|
+
const definition = instance ? getInstalledConnectorDefinition(this.deps.getConfig(), instance.instanceId) : void 0;
|
|
115
|
+
const digestMatches = definition?.provenance?.packageName === target.packageName && definition.provenance.sha256 === target.sha256 && definition.version === target.version;
|
|
116
|
+
const unhealthy = instance && (!instance.enabled || [
|
|
117
|
+
"failed",
|
|
118
|
+
"disabled",
|
|
119
|
+
"not_configured",
|
|
120
|
+
"unauthorized",
|
|
121
|
+
"degraded"
|
|
122
|
+
].includes(instance.status) || [
|
|
123
|
+
"missing",
|
|
124
|
+
"expired",
|
|
125
|
+
"unauthorized"
|
|
126
|
+
].includes(instance.authStatus ?? ""));
|
|
127
|
+
const phase = !instance ? "install" : !digestMatches || unhealthy ? "blocked" : "ready";
|
|
128
|
+
return {
|
|
129
|
+
...need,
|
|
130
|
+
...instance ? { connectionId: instance.instanceId } : {},
|
|
131
|
+
phase,
|
|
132
|
+
accounts: [],
|
|
133
|
+
alternatives: [],
|
|
134
|
+
...phase === "blocked" ? { reason: !digestMatches ? "The installed Connector does not match the reviewed Store package." : "Connector setup is incomplete. Review its settings and try again." } : {}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
111
137
|
const id = need.target.connectorId;
|
|
112
138
|
const instance = listConnectorInstances(this.deps.getConfig()).find((instance) => instance.connectorId === id);
|
|
113
139
|
const installation = getConnectorInstallation(`${id}-${wait.principalId}`);
|
|
@@ -193,7 +219,7 @@ var ConnectionRecoveryService = class {
|
|
|
193
219
|
}))
|
|
194
220
|
}, verified).needs;
|
|
195
221
|
return Promise.all(wait.needs.map(async (need) => {
|
|
196
|
-
if (need.target.type === "plugin-mcp") return need;
|
|
222
|
+
if (need.target.type === "plugin-mcp" || need.target.type === "store-connector") return need;
|
|
197
223
|
if (views.find((view) => view.key === need.key)?.phase !== "ready") return {
|
|
198
224
|
...need,
|
|
199
225
|
capabilityError: void 0
|
|
@@ -370,6 +396,50 @@ var ConnectionRecoveryService = class {
|
|
|
370
396
|
intent: void 0
|
|
371
397
|
}, "skipped");
|
|
372
398
|
this.deps.drain(conversationId);
|
|
399
|
+
} else if (action.action === "install_complete") {
|
|
400
|
+
const need = wait.needs.find((need) => need.key === action.needKey);
|
|
401
|
+
if (!need || need.target.type !== "store-connector" || !action.instanceId) throw new Error("Unknown Store Connector installation.");
|
|
402
|
+
const instance = listConnectorInstances(this.deps.getConfig()).find((item) => item.instanceId === action.instanceId);
|
|
403
|
+
const definition = instance ? getInstalledConnectorDefinition(this.deps.getConfig(), instance.instanceId) : void 0;
|
|
404
|
+
if (!instance || instance.connectorId !== need.target.connectorId || !instance.enabled || definition?.provenance?.packageName !== need.target.packageName || definition.provenance.sha256 !== need.target.sha256 || definition.version !== need.target.version) throw new Error("The installed Connector does not match the reviewed package.");
|
|
405
|
+
if ([
|
|
406
|
+
"failed",
|
|
407
|
+
"disabled",
|
|
408
|
+
"not_configured",
|
|
409
|
+
"unauthorized",
|
|
410
|
+
"degraded"
|
|
411
|
+
].includes(instance.status) || [
|
|
412
|
+
"missing",
|
|
413
|
+
"expired",
|
|
414
|
+
"unauthorized"
|
|
415
|
+
].includes(instance.authStatus ?? "")) throw new Error("Connector setup is incomplete. Finish setup before continuing.");
|
|
416
|
+
wait = updateConnectionWait({
|
|
417
|
+
...wait,
|
|
418
|
+
needs: wait.needs.map((item) => item.key === need.key ? {
|
|
419
|
+
...item,
|
|
420
|
+
connectionId: instance.instanceId,
|
|
421
|
+
unavailable: false,
|
|
422
|
+
capabilityError: void 0
|
|
423
|
+
} : item),
|
|
424
|
+
intent: {
|
|
425
|
+
objectiveRevision: wait.objectiveRevision,
|
|
426
|
+
validUntil: Date.now() + INTENT_TTL
|
|
427
|
+
}
|
|
428
|
+
}, wait.version);
|
|
429
|
+
const view = this.view(wait);
|
|
430
|
+
if (view.phase === "ready") {
|
|
431
|
+
queueConnectionResolution({
|
|
432
|
+
...wait,
|
|
433
|
+
needs: view.needs.map(({ phase: _phase, accounts: _accounts, reason: _reason, alternatives: _alternatives, ...item }) => item)
|
|
434
|
+
}, "continued");
|
|
435
|
+
log.info({
|
|
436
|
+
conversationId,
|
|
437
|
+
waitId: wait.id,
|
|
438
|
+
objectiveRevision: wait.objectiveRevision,
|
|
439
|
+
phase: "resume_queued"
|
|
440
|
+
}, "Connector installation continuation queued");
|
|
441
|
+
this.deps.drain(conversationId);
|
|
442
|
+
}
|
|
373
443
|
} else if (action.action === "connect") {
|
|
374
444
|
const need = wait.needs.find((need) => need.key === action.needKey);
|
|
375
445
|
if (!need) throw new Error("Unknown connection requirement.");
|
|
@@ -498,6 +568,18 @@ var ConnectionRecoveryService = class {
|
|
|
498
568
|
if (!latest || latest.version !== wait.version || latest.status !== "open") throw new Error("WAIT_CHANGED");
|
|
499
569
|
let needs = wait.needs.map((need) => {
|
|
500
570
|
if (need.target.type === "plugin-mcp") return need;
|
|
571
|
+
if (need.target.type === "store-connector") {
|
|
572
|
+
const selected = this.view({
|
|
573
|
+
...wait,
|
|
574
|
+
needs
|
|
575
|
+
}).needs.find((item) => item.key === need.key);
|
|
576
|
+
return selected?.phase === "ready" ? {
|
|
577
|
+
...need,
|
|
578
|
+
connectionId: selected.connectionId,
|
|
579
|
+
unavailable: false,
|
|
580
|
+
capabilityError: void 0
|
|
581
|
+
} : need;
|
|
582
|
+
}
|
|
501
583
|
const id = need.target.connectorId;
|
|
502
584
|
const authorized = fresh.find((item) => item.providerConnectionId === need.attempt?.connectionId && item.status === "active" && item.connectorId === id && (!need.accountId || item.accountId === need.accountId));
|
|
503
585
|
return authorized ? {
|
|
@@ -540,7 +622,10 @@ var ConnectionRecoveryService = class {
|
|
|
540
622
|
needs
|
|
541
623
|
}, verified);
|
|
542
624
|
if (getConnectionWait(wait.id)?.version !== wait.version) throw new Error("WAIT_CHANGED");
|
|
543
|
-
const
|
|
625
|
+
const readyWithoutReview = this.view({
|
|
626
|
+
...wait,
|
|
627
|
+
needs
|
|
628
|
+
}, verified).phase === "ready";
|
|
544
629
|
wait = updateConnectionWait({
|
|
545
630
|
...wait,
|
|
546
631
|
needs,
|
|
@@ -548,7 +633,7 @@ var ConnectionRecoveryService = class {
|
|
|
548
633
|
scopeConfirmedAt: Date.now(),
|
|
549
634
|
reviewRequired: false
|
|
550
635
|
} : {},
|
|
551
|
-
...needs.some((need) => need.capabilityError) ? { intent: void 0 } :
|
|
636
|
+
...needs.some((need) => need.capabilityError) ? { intent: void 0 } : readyWithoutReview || action.action === "confirm_scope" ? { intent: {
|
|
552
637
|
objectiveRevision: wait.objectiveRevision,
|
|
553
638
|
validUntil: Date.now() + INTENT_TTL
|
|
554
639
|
} } : {}
|
|
@@ -188,7 +188,7 @@ async function analyzeDiscussion(input) {
|
|
|
188
188
|
maxTokens: 8e3,
|
|
189
189
|
temperature: .1,
|
|
190
190
|
signal: input.signal
|
|
191
|
-
})).content)));
|
|
191
|
+
}, void 0, { operation: "discussion.analyze" })).content)));
|
|
192
192
|
validateDiscussionEvidence(organization, new Set(batch.map((segment) => segment.sequence)));
|
|
193
193
|
organization.chapters = [{
|
|
194
194
|
title: organization.title,
|
|
@@ -234,7 +234,7 @@ async function analyzeDiscussion(input) {
|
|
|
234
234
|
maxTokens: 2e3,
|
|
235
235
|
temperature: 0,
|
|
236
236
|
signal: input.signal
|
|
237
|
-
});
|
|
237
|
+
}, void 0, { operation: "discussion.analyze" });
|
|
238
238
|
const parsed = MeetingChangesSchema.parse(parseJsonObject(extractText(response.content)));
|
|
239
239
|
if (parsed.changes.some((change) => change.fromId === change.toId || !earlier.some((item) => item.id === change.fromId) || !later.some((item) => item.id === change.toId))) throw new Error("Invalid meeting change evidence");
|
|
240
240
|
getSqliteDatabase().prepare("INSERT OR REPLACE INTO discussion_analysis_chunks (discussion_id,input_hash,result_json) VALUES (?,?,?)").run(input.discussionId, cacheKey, JSON.stringify(parsed));
|
|
@@ -260,7 +260,7 @@ async function analyzeDiscussion(input) {
|
|
|
260
260
|
maxTokens: 2e3,
|
|
261
261
|
temperature: .1,
|
|
262
262
|
signal: input.signal
|
|
263
|
-
});
|
|
263
|
+
}, void 0, { operation: "discussion.analyze" });
|
|
264
264
|
return z.object({
|
|
265
265
|
title: z.string().min(1).max(200),
|
|
266
266
|
summary: z.string().min(1).max(2e3)
|
|
@@ -295,7 +295,7 @@ async function enrichLiveDiscussion(input) {
|
|
|
295
295
|
maxTokens: 400,
|
|
296
296
|
temperature: .1,
|
|
297
297
|
signal: input.signal
|
|
298
|
-
});
|
|
298
|
+
}, void 0, { operation: "discussion.analyze" });
|
|
299
299
|
return {
|
|
300
300
|
modelRef,
|
|
301
301
|
...LiveEnrichmentSchema.parse(parseJsonObject(extractText(response.content)))
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { init_paths, resolveBundledExtensionsDir, resolveExtensionsDir } from "../config/paths.js";
|
|
4
|
-
import { computeExtensionDirectoryIntegrity, getExtensionLockfileManager } from "./lockfile.js";
|
|
5
4
|
import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, verifyStoreArtifactSha256 } from "../agent/skills/marketplace/adapters/store/store-api-client.js";
|
|
5
|
+
import { computeExtensionDirectoryIntegrity, getExtensionLockfileManager } from "./lockfile.js";
|
|
6
6
|
import { loadConfig } from "../config/loader.js";
|
|
7
7
|
import { commitStagedExtensionInstall, finalizeStagedExtensionInstall, rollbackStagedExtensionInstall, stageExtensionNpm, stageExtensionStoreZip } from "./install-transaction.js";
|
|
8
8
|
import { findExtension } from "./marketplace.js";
|