@xopcai/xopc 0.0.309 → 0.0.312
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/README.md +2 -1
- package/README.zh-CN.md +2 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-XKNYlFUI.js → activity-store-DVUTs1fk.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-1S2TFECE.js → agent-avatar-dicebear-BVIJMP8w.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-K3hTmu9d.js +1 -0
- package/dist/gateway/static/root/assets/{agents-CPqUMtCL.js → agents-D6g_SeWI.js} +1 -1
- package/dist/gateway/static/root/assets/{api-BEUEE4f2.js → api-_aHQA8bd.js} +1 -1
- package/dist/gateway/static/root/assets/app-link-CKueEVbT.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CgVBSqzu.js → app-management-settings-panel-CLg_aXYG.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CoWdCokb.js → appearance-settings-CU52MfIT.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-ZpA1-6ad.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-C3ZA6LRS.js → archive-plugin-CHO3heHX.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CdgS6_zy.js → attachment-load-BsmsBCI2.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BtHL2hpg.js → automations-page-CftigJlf.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-IEAxKRME.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CiDhtq_H.js → binary-plugins-CRCLWBo2.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Br00T83w.js → block-editor-D0LDiOTT.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-D2tILykA.js → browser-automation-inputs-C611KRBx.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BVuEmryB.js → browser-automations-page-Djyv3vy-.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CU4VWsmX.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C9XQk3HL.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-Bqlhjooi.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-JsMtzDao.js → chat-terminal-dock-CIsKqdET.js} +2 -2
- package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-Cq1tE_3b.js → chunk-KS7C4IRE-BMYIfy9x.js} +2 -2
- package/dist/gateway/static/root/assets/computer-settings-page-C0YL9J7m.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-DZFNUTiN.js → connector-service-page-BmH17JnO.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-zkx8Q-e6.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-CDsfv8R0.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-B-BcuG1y.js → dependency-picker-DvhPj3CZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CdBBhhdY.js → desktop-pet-Cyg8XMpL.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-CE4GOlMM.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-CdKJqnnw.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BFp5eKtY.js → extension-debug-page-D-AVJU3q.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DL3vyyH6.js → extension-page-DrFoQ9xt.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BXtvdAsY.js → extension-settings-page-DxWjESC1.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-xAOGtenO.js → gateway-config-swr-DUDX42qY.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-BuaTsMSi.js → gateway-realtime-CGOW0-b4.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-D4um_sV7.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CgXp2zq4.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BwDxKHd4.js → gateway-startup-retry-Cf8OxlvY.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-D6Idk732.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-wGMeI_yW.js → image-generation-api-D2YorS--.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-zexFT5Rq.js → imports-page-BKucJlXI.js} +1 -1
- package/dist/gateway/static/root/assets/index-1wIKA-kM.css +1 -0
- package/dist/gateway/static/root/assets/index-PFQHPGgi.js +79 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CutG9zLh.js → keyboard-shortcuts-settings-BxLXD-yU.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BmAqTRb4.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CJy6I7Dt.js → local-apps-page-BAsQJQKJ.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DPZ79W1-.js → locale-store-DA0Z5jM_.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-egGcPHNi.js → logs-page-ZjVYXXyM.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-BQhIOELc.js → management-settings-CSTkYVOZ.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-DSjfHfaW.css +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-p2P5hP1U.js → markdown-view-DYGPxPee.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CsBylqlN.js → media-plugins-CQtQzLyg.js} +1 -1
- package/dist/gateway/static/root/assets/messages-4BtQKYlM.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-DuXCt-MM.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-BjOgBVq5.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-ChQ4jJFs.js → page-tabs-B6DjkyMM.js} +1 -1
- package/dist/gateway/static/root/assets/{popover-select-9i-ZtHXL.js → popover-select-B-GDnZO9.js} +1 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-Dn57uLhr.js +1 -0
- package/dist/gateway/static/root/assets/product-delivery-CrAI8ZEa.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-BADxWEdP.js → product-open-page-H2YMk8TY.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-0zi4-i9X.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-B18OxmJj.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-B_e_nZSN.js → registry-api-C0DCx3wv.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-z-DxbuaE.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-D-pwiIyp.js → runtime-tools-settings-panel-DGsBTbo6.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-Bgba03B_.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-IWmb05DX.js → schema-form-CblI9WUA.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-B1t3bMsm.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CBX0Ezhf.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-B0veRBZs.js → settings-form-section-BAaVyxJH.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-CKNPbm5q.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-layout-DqNCGKxQ.js +1 -0
- package/dist/gateway/static/root/assets/{settings-shell-layer-context-DCp6ykjQ.js → settings-shell-layer-context-BTQUDoJ2.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Bw71C2X3.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CirpgkfD.js → share-preview-page-BzMfp_HM.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BoVDQolc.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DtTptpAt.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DIht92q6.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-B42mpWKV.js → skills-page.utils-DLYRiEn3.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-yYs4YgYk.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-vgkiGo-D.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-BFbj_2Tu.js → theme-store-CegIlB8d.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-BasDYxvx.js +1 -0
- package/dist/gateway/static/root/assets/use-autosave-CWAUHhcb.js +1 -0
- package/dist/gateway/static/root/assets/user-model-page-CAGafNfP.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BZbKQ8HT.js → voice-api-key-field-Kc4UlxZs.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-SKCeQLrH.js → voice-config-api-DTyMdGOR.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BRVTTXNG.js → work-discovery-overlay-BPC_c9dO.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D2kuwv5e.js → workflow-run-setup-panel-DBTciOrq.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CSxHVs1p.js +6 -0
- package/dist/gateway/static/root/connector-icons/SOURCES.md +0 -2
- package/dist/gateway/static/root/index.html +18 -21
- package/dist/gateway/static/root/notification-sw.js +1 -1
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/notifications.js +12 -11
- package/dist/packages/gateway-contract/src/proactive.js +6 -6
- package/dist/packages/gateway-contract/src/product-delivery.js +1 -0
- package/dist/packages/gateway-contract/src/project-monitoring.js +4 -4
- package/dist/packages/gateway-contract/src/project-operating.js +1 -4
- package/dist/src/agent/agent-manager.d.ts +2 -6
- package/dist/src/agent/agent-manager.js +2 -1
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/commands/command-registry.js +1 -1
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/external-tools/cliProvider.d.ts +47 -0
- package/dist/src/agent/external-tools/cliProvider.js +317 -0
- package/dist/src/agent/external-tools/composio-provider.js +3 -3
- package/dist/src/agent/external-tools/gateway-tools.js +8 -2
- package/dist/src/agent/external-tools/index.js +6 -0
- package/dist/src/agent/external-tools/service.js +1 -1
- package/dist/src/agent/external-tools/types.d.ts +1 -1
- package/dist/src/agent/external-tools/types.js +1 -0
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
- package/dist/src/agent/memory/turn-provenance.js +2 -1
- package/dist/src/agent/service/parse-outbound-session-key.js +1 -1
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +43 -16
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +3 -2
- package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +20 -0
- package/dist/src/agent/tools/search/providers/xopc-cloud.js +56 -0
- package/dist/src/agent/tools/search/registry.d.ts +4 -2
- package/dist/src/agent/tools/search/registry.js +5 -3
- package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
- package/dist/src/agent/tools/xopc-use-tool.js +104 -44
- package/dist/src/automations/service/automation-service.d.ts +0 -4
- package/dist/src/automations/service/automation-service.js +0 -31
- package/dist/src/capabilities/store-connector.js +46 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/project.js +1 -1
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/schema.d.ts +13 -4
- package/dist/src/config/schema.js +10 -14
- package/dist/src/config/web-patch.js +0 -5
- package/dist/src/connectors/account-selection.d.ts +14 -0
- package/dist/src/connectors/account-selection.js +26 -0
- package/dist/src/connectors/china-catalog.js +93 -226
- package/dist/src/connectors/cli/adapterRegistry.d.ts +4 -0
- package/dist/src/connectors/cli/adapterRegistry.js +26 -0
- package/dist/src/connectors/cli/adapters/lark.d.ts +2 -0
- package/dist/src/connectors/cli/adapters/lark.js +143 -0
- package/dist/src/connectors/cli/adapters/larkShortcuts.d.ts +3 -0
- package/dist/src/connectors/cli/adapters/larkShortcuts.js +64 -0
- package/dist/src/connectors/cli/adapters/wecom.d.ts +2 -0
- package/dist/src/connectors/cli/adapters/wecom.js +97 -0
- package/dist/src/connectors/cli/adapters/wps365/bundle.js +575 -0
- package/dist/src/connectors/cli/adapters/wps365.d.ts +2 -0
- package/dist/src/connectors/cli/adapters/wps365.js +115 -0
- package/dist/src/connectors/cli/assets.d.ts +3 -0
- package/dist/src/connectors/cli/assets.js +44 -0
- package/dist/src/connectors/cli/authorization.d.ts +16 -0
- package/dist/src/connectors/cli/authorization.js +184 -0
- package/dist/src/connectors/cli/distributions.d.ts +4 -0
- package/dist/src/connectors/cli/distributions.js +69 -0
- package/dist/src/connectors/cli/installer.d.ts +5 -0
- package/dist/src/connectors/cli/installer.js +102 -0
- package/dist/src/connectors/cli/lifecycle.d.ts +1 -0
- package/dist/src/connectors/cli/lifecycle.js +19 -0
- package/dist/src/connectors/cli/process.d.ts +18 -0
- package/dist/src/connectors/cli/process.js +100 -0
- package/dist/src/connectors/cli/protocol.d.ts +10 -0
- package/dist/src/connectors/cli/protocol.js +63 -0
- package/dist/src/connectors/cli/runtime.d.ts +10 -0
- package/dist/src/connectors/cli/runtime.js +93 -0
- package/dist/src/connectors/cli/store.d.ts +35 -0
- package/dist/src/connectors/cli/store.js +121 -0
- package/dist/src/connectors/cli/types.d.ts +73 -0
- package/dist/src/connectors/composio-backends.js +1 -1
- package/dist/src/connectors/composio-sessions.d.ts +1 -0
- package/dist/src/connectors/composio-sessions.js +8 -3
- package/dist/src/connectors/composio.js +1 -1
- package/dist/src/connectors/connection-candidates.js +22 -3
- package/dist/src/connectors/connection-recovery-service.d.ts +1 -0
- package/dist/src/connectors/connection-recovery-service.js +53 -8
- package/dist/src/connectors/health.js +52 -0
- package/dist/src/connectors/instances.js +5 -1
- package/dist/src/connectors/lifecycle.js +2 -0
- package/dist/src/connectors/principal.js +2 -1
- package/dist/src/connectors/runtime-adapter-registry.js +31 -0
- package/dist/src/connectors/types.d.ts +13 -1
- package/dist/src/connectors/usage.js +1 -1
- package/dist/src/connectors/workflow-preflight.js +8 -4
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/gateway/hono/app.d.ts +2 -0
- package/dist/src/gateway/hono/app.js +4 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -15
- package/dist/src/gateway/hono/lib/config-payload.js +1 -11
- package/dist/src/gateway/hono/routes/cli-connectors.d.ts +3 -0
- package/dist/src/gateway/hono/routes/cli-connectors.js +219 -0
- package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +2 -2
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +0 -59
- package/dist/src/gateway/hono/routes/config.js +0 -16
- package/dist/src/gateway/hono/routes/connectors.js +21 -22
- package/dist/src/gateway/hono/routes/deps.d.ts +2 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +4 -17
- package/dist/src/gateway/hono/routes/projects.js +1 -1
- package/dist/src/gateway/hono/routes/public-gateway.js +0 -1
- package/dist/src/gateway/hono/routes/scenes.d.ts +3 -0
- package/dist/src/gateway/hono/routes/scenes.js +142 -0
- package/dist/src/gateway/hono/routes/tasks.js +0 -46
- package/dist/src/gateway/hono/routes/user-model.js +54 -1
- package/dist/src/gateway/scenes/browserNotifications.d.ts +4 -0
- package/dist/src/gateway/scenes/browserNotifications.js +54 -0
- package/dist/src/gateway/scenes/host.d.ts +34 -0
- package/dist/src/gateway/scenes/host.js +130 -0
- package/dist/src/gateway/scenes/mailContext.d.ts +32 -0
- package/dist/src/gateway/scenes/mailContext.js +235 -0
- package/dist/src/gateway/security/gateway-scopes.js +0 -4
- package/dist/src/gateway/security/index.js +1 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -10
- package/dist/src/gateway/service/config-coordinator.js +0 -16
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service.d.ts +4 -25
- package/dist/src/gateway/service.js +44 -99
- package/dist/src/gateway/session-context-summary.js +2 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/unhandled-rejections.js +1 -1
- package/dist/src/migrations/runner.js +1 -4
- package/dist/src/notifications/browser-endpoint.d.ts +2 -0
- package/dist/src/notifications/browser-endpoint.js +13 -0
- package/dist/src/notifications/browserSubscriptions.d.ts +20 -0
- package/dist/src/notifications/browserSubscriptions.js +59 -0
- package/dist/src/notifications/browserTransport.d.ts +9 -0
- package/dist/src/notifications/browserTransport.js +64 -0
- package/dist/src/notifications/dispatch.d.ts +46 -0
- package/dist/src/notifications/dispatch.js +109 -0
- package/dist/src/notifications/domain-delivery.d.ts +21 -0
- package/dist/src/notifications/planner.js +0 -36
- package/dist/src/notifications/quietHours.d.ts +6 -0
- package/dist/src/notifications/quietHours.js +23 -0
- package/dist/src/notifications/resultOutbox.d.ts +23 -0
- package/dist/src/notifications/resultOutbox.js +49 -0
- package/dist/src/notifications/service.d.ts +18 -4
- package/dist/src/notifications/service.js +42 -61
- package/dist/src/notifications/store.d.ts +2 -1
- package/dist/src/notifications/store.js +7 -8
- package/dist/src/projects/project-service.d.ts +1 -4
- package/dist/src/projects/project-service.js +2 -30
- package/dist/src/projects/workspace.js +1 -1
- package/dist/src/providers/model-catalog-persistence.js +19 -1
- package/dist/src/providers/model-catalog-store.js +1 -0
- package/dist/src/providers/model-catalog-types.d.ts +17 -0
- package/dist/src/providers/xopc-cloud-model-source.js +27 -0
- package/dist/src/scenes/agentExecutor.d.ts +8 -0
- package/dist/src/scenes/agentExecutor.js +63 -0
- package/dist/src/scenes/contracts.d.ts +118 -0
- package/dist/src/scenes/contracts.js +145 -0
- package/dist/src/scenes/execution.d.ts +56 -0
- package/dist/src/scenes/execution.js +168 -0
- package/dist/src/scenes/httpServices.d.ts +34 -0
- package/dist/src/scenes/inbox.d.ts +16 -0
- package/dist/src/scenes/inbox.js +68 -0
- package/dist/src/scenes/mailContext.d.ts +20 -0
- package/dist/src/scenes/mailContext.js +106 -0
- package/dist/src/scenes/mailObservations.d.ts +20 -0
- package/dist/src/scenes/mailObservations.js +107 -0
- package/dist/src/scenes/maintenance.d.ts +3 -0
- package/dist/src/scenes/maintenance.js +24 -0
- package/dist/src/scenes/metrics.d.ts +37 -0
- package/dist/src/scenes/metrics.js +100 -0
- package/dist/src/scenes/model.d.ts +3 -0
- package/dist/src/scenes/model.js +10 -0
- package/dist/src/scenes/notificationEligibility.d.ts +17 -0
- package/dist/src/scenes/notificationEligibility.js +72 -0
- package/dist/src/scenes/notificationPublication.d.ts +7 -0
- package/dist/src/scenes/notificationPublication.js +43 -0
- package/dist/src/scenes/preferences.d.ts +40 -0
- package/dist/src/scenes/preferences.js +108 -0
- package/dist/src/scenes/readiness.d.ts +7 -0
- package/dist/src/scenes/readiness.js +20 -0
- package/dist/src/scenes/repository.d.ts +174 -0
- package/dist/src/scenes/repository.js +740 -0
- package/dist/src/scenes/resultNotifications.d.ts +17 -0
- package/dist/src/scenes/resultNotifications.js +204 -0
- package/dist/src/scenes/runtime.d.ts +25 -0
- package/dist/src/scenes/runtime.js +101 -0
- package/dist/src/scenes/schedule.d.ts +9 -0
- package/dist/src/scenes/schedule.js +45 -0
- package/dist/src/scenes/service.d.ts +29 -0
- package/dist/src/scenes/service.js +116 -0
- package/dist/src/scenes/templates.d.ts +64 -0
- package/dist/src/scenes/templates.js +76 -0
- package/dist/src/scenes/userNotes.d.ts +10 -0
- package/dist/src/scenes/userNotes.js +34 -0
- package/dist/src/session/resolve-session.js +2 -1
- package/dist/src/session/store.js +2 -1
- package/dist/src/share/share-config.js +0 -5
- package/dist/src/share/site-share-config.js +0 -5
- package/dist/src/storage/sqlite/connection-wait-repository.js +20 -7
- package/dist/src/storage/sqlite/connection.js +1 -1
- package/dist/src/storage/sqlite/connector-account-repository.js +1 -0
- package/dist/src/storage/sqlite/connector-sync-policy-repository.d.ts +0 -4
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +3 -17
- package/dist/src/storage/sqlite/conversation-repository.js +2 -1
- package/dist/src/storage/sqlite/index.js +2 -1
- package/dist/src/storage/sqlite/migrations/187_cli_connectors.sql +34 -0
- package/dist/src/storage/sqlite/migrations/188_scene_storage.sql +2 -0
- package/dist/src/storage/sqlite/migrations/189_scene_source_health.sql +8 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +2 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.js +7 -3
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +20 -44
- package/dist/src/storage/sqlite/migrations/scene-reset.d.ts +5 -0
- package/dist/src/storage/sqlite/migrations/scene-reset.js +40 -0
- package/dist/src/storage/sqlite/scenes-schema.d.ts +8 -0
- package/dist/src/storage/sqlite/scenes-schema.js +61 -0
- package/dist/src/storage/sqlite/schema.js +4 -10
- package/dist/src/storage/sqlite/schemas/notifications.sql +65 -0
- package/dist/src/storage/sqlite/schemas/scenes.sql +212 -0
- package/dist/src/storage/sqlite/session-read-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/session-read-repository.js +35 -0
- package/dist/src/storage/sqlite/session-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/session-repository.js +2 -25
- package/dist/src/storage/sqlite/sql-assets.d.ts +2 -0
- package/dist/src/storage/sqlite/sql-assets.js +18 -0
- package/dist/src/storage/sqlite/transaction.d.ts +2 -0
- package/dist/src/storage/sqlite/transaction.js +20 -1
- package/dist/src/tasks/home-query-service.d.ts +0 -2
- package/dist/src/tasks/home-query-service.js +13 -43
- package/dist/src/tasks/index.d.ts +0 -1
- package/dist/src/tasks/index.js +4 -5
- package/dist/src/tasks/project-operating-view-service.js +1 -4
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/user-model/goals.d.ts +10 -0
- package/dist/src/user-model/goals.js +29 -1
- package/dist/src/user-model/index.js +2 -2
- package/dist/src/voice/realtime/memory-context.js +2 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +5 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-f0-YFMUz.js +0 -1
- package/dist/gateway/static/root/assets/api-CN4id43t.js +0 -1
- package/dist/gateway/static/root/assets/app-link-BiBXVEvp.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-CexHOcWg.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-onJPfmO6.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BgVTyPFY.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Dra8wj1S.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-CkxiMDJ4.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-Dtder4G_.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-DHerePwo.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-cl9ZrV4D.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-DAhdv_Xv.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-PacO1m3a.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-Gy03NgMI.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-aV25nKag.js +0 -1
- package/dist/gateway/static/root/assets/external-link-DjqjBmc3.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BG95uGVW.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-Dcr2Ikeh.js +0 -1
- package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DOy3alvT.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CDm3dGVy.js +0 -1
- package/dist/gateway/static/root/assets/index-D-vczw_0.css +0 -1
- package/dist/gateway/static/root/assets/index-DJo4DimT.js +0 -79
- package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CwLvTwjn.js +0 -2
- package/dist/gateway/static/root/assets/markdown-view-Y68dCxuc.css +0 -1
- package/dist/gateway/static/root/assets/messages-BiYTyLJr.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-c2k5Uz6X.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BLQWJMhf.js +0 -8
- package/dist/gateway/static/root/assets/preview-open-alternatives-9B5W7nVE.js +0 -1
- package/dist/gateway/static/root/assets/proactive-page-iOjI0d_e.js +0 -1
- package/dist/gateway/static/root/assets/product-delivery-CCC4FJ3Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BcxbQn2M.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BuSvld0O.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CFS8LQKW.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DZjc__ok.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-C1SM5B93.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-CxRWyWYe.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D9Rl7Tec.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-CwCThBs0.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DG6VGbOX.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BdRJ2vnL.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-DXIZpAvU.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-QXo9LJly.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-Db2guRdW.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-DDY9qoXZ.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-CzPmMkaO.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-CQXtiYtq.js +0 -6
- package/dist/gateway/static/root/connector-icons/wps-calendar.svg +0 -14
- package/dist/gateway/static/root/connector-icons/wps-mail.svg +0 -7
- package/dist/src/connectors/source-change-publisher.d.ts +0 -17
- package/dist/src/connectors/source-change-publisher.js +0 -151
- package/dist/src/gateway/heartbeat/check-store.d.ts +0 -18
- package/dist/src/gateway/heartbeat/check-store.js +0 -74
- package/dist/src/gateway/heartbeat/index.d.ts +0 -1
- package/dist/src/gateway/heartbeat/index.js +0 -2
- package/dist/src/gateway/heartbeat/service.d.ts +0 -55
- package/dist/src/gateway/heartbeat/service.js +0 -228
- package/dist/src/gateway/hono/routes/proactive-control.d.ts +0 -3
- package/dist/src/gateway/hono/routes/proactive-control.js +0 -135
- package/dist/src/gateway/hono/routes/proactive.d.ts +0 -4
- package/dist/src/gateway/hono/routes/proactive.js +0 -164
- package/dist/src/gateway/hono/routes/workspace.d.ts +0 -3
- package/dist/src/gateway/hono/routes/workspace.js +0 -62
- package/dist/src/gateway/workspace-heartbeat-path.d.ts +0 -3
- package/dist/src/gateway/workspace-heartbeat-path.js +0 -14
- package/dist/src/migrations/conversation-routing-config.d.ts +0 -2
- package/dist/src/migrations/conversation-routing-config.js +0 -42
- package/dist/src/notifications/proactive-channel.d.ts +0 -8
- package/dist/src/notifications/proactive-channel.js +0 -60
- package/dist/src/notifications/proactive-policy.d.ts +0 -3
- package/dist/src/notifications/proactive-policy.js +0 -35
- package/dist/src/notifications/web-push.d.ts +0 -19
- package/dist/src/notifications/web-push.js +0 -185
- package/dist/src/proactive/actions/service.d.ts +0 -1
- package/dist/src/proactive/actions/service.js +0 -82
- package/dist/src/proactive/events/envelope.d.ts +0 -2
- package/dist/src/proactive/events/envelope.js +0 -54
- package/dist/src/proactive/events/product-event-bridge.d.ts +0 -7
- package/dist/src/proactive/events/product-event-bridge.js +0 -87
- package/dist/src/proactive/events/publisher.d.ts +0 -4
- package/dist/src/proactive/events/repository.d.ts +0 -9
- package/dist/src/proactive/events/repository.js +0 -63
- package/dist/src/proactive/events/types.d.ts +0 -44
- package/dist/src/proactive/events/types.js +0 -15
- package/dist/src/proactive/execution/agent-executor.d.ts +0 -21
- package/dist/src/proactive/execution/agent-executor.js +0 -125
- package/dist/src/proactive/execution/authorization.d.ts +0 -7
- package/dist/src/proactive/execution/authorization.js +0 -71
- package/dist/src/proactive/execution/context.d.ts +0 -49
- package/dist/src/proactive/execution/context.js +0 -408
- package/dist/src/proactive/execution/insight.d.ts +0 -14
- package/dist/src/proactive/execution/insight.js +0 -132
- package/dist/src/proactive/execution/repository.d.ts +0 -28
- package/dist/src/proactive/execution/repository.js +0 -211
- package/dist/src/proactive/execution/types.d.ts +0 -80
- package/dist/src/proactive/execution/worker.d.ts +0 -15
- package/dist/src/proactive/execution/worker.js +0 -146
- package/dist/src/proactive/experience.d.ts +0 -89
- package/dist/src/proactive/experience.js +0 -195
- package/dist/src/proactive/follow-ups.d.ts +0 -128
- package/dist/src/proactive/follow-ups.js +0 -182
- package/dist/src/proactive/inbox/cards.d.ts +0 -21
- package/dist/src/proactive/inbox/cards.js +0 -276
- package/dist/src/proactive/inbox/delivery.d.ts +0 -6
- package/dist/src/proactive/inbox/delivery.js +0 -54
- package/dist/src/proactive/inbox/digest.d.ts +0 -8
- package/dist/src/proactive/inbox/digest.js +0 -123
- package/dist/src/proactive/inbox/lifecycle.d.ts +0 -4
- package/dist/src/proactive/inbox/lifecycle.js +0 -62
- package/dist/src/proactive/inbox/notification-policy.d.ts +0 -1
- package/dist/src/proactive/inbox/notification-policy.js +0 -25
- package/dist/src/proactive/inbox/repository.d.ts +0 -25
- package/dist/src/proactive/inbox/repository.js +0 -244
- package/dist/src/proactive/inbox/service.d.ts +0 -23
- package/dist/src/proactive/inbox/service.js +0 -46
- package/dist/src/proactive/inbox/types.d.ts +0 -64
- package/dist/src/proactive/inbox/worker.d.ts +0 -13
- package/dist/src/proactive/inbox/worker.js +0 -71
- package/dist/src/proactive/index.d.ts +0 -20
- package/dist/src/proactive/index.js +0 -14
- package/dist/src/proactive/mail-thread.d.ts +0 -13
- package/dist/src/proactive/mail-thread.js +0 -55
- package/dist/src/proactive/maintenance.d.ts +0 -4
- package/dist/src/proactive/maintenance.js +0 -28
- package/dist/src/proactive/metrics.d.ts +0 -10
- package/dist/src/proactive/metrics.js +0 -28
- package/dist/src/proactive/policy/presence.d.ts +0 -2
- package/dist/src/proactive/policy/presence.js +0 -30
- package/dist/src/proactive/policy/service.d.ts +0 -54
- package/dist/src/proactive/policy/service.js +0 -123
- package/dist/src/proactive/routing/batch-repository.d.ts +0 -27
- package/dist/src/proactive/routing/batch-repository.js +0 -57
- package/dist/src/proactive/routing/matcher.d.ts +0 -5
- package/dist/src/proactive/routing/matcher.js +0 -57
- package/dist/src/proactive/routing/types.d.ts +0 -44
- package/dist/src/proactive/routing/types.js +0 -1
- package/dist/src/proactive/scenarios/control.d.ts +0 -52
- package/dist/src/proactive/scenarios/control.js +0 -75
- package/dist/src/proactive/scenarios/prompt-composer.d.ts +0 -14
- package/dist/src/proactive/scenarios/prompt-composer.js +0 -26
- package/dist/src/proactive/scenarios/repository.d.ts +0 -23
- package/dist/src/proactive/scenarios/repository.js +0 -174
- package/dist/src/proactive/scenarios/service.d.ts +0 -15
- package/dist/src/proactive/scenarios/service.js +0 -26
- package/dist/src/proactive/scenarios/types.d.ts +0 -43
- package/dist/src/proactive/scenarios/types.js +0 -1
- package/dist/src/proactive/service.d.ts +0 -25
- package/dist/src/proactive/service.js +0 -78
- package/dist/src/proactive/source-freshness.d.ts +0 -8
- package/dist/src/proactive/source-freshness.js +0 -28
- package/dist/src/proactive/status.d.ts +0 -2
- package/dist/src/proactive/status.js +0 -22
- package/dist/src/proactive/temporal/schedule.d.ts +0 -3
- package/dist/src/proactive/temporal/schedule.js +0 -68
- package/dist/src/proactive/temporal/worker.d.ts +0 -17
- package/dist/src/proactive/temporal/worker.js +0 -129
- package/dist/src/tasks/project-monitoring-service.d.ts +0 -32
- package/dist/src/tasks/project-monitoring-service.js +0 -118
- /package/dist/src/{proactive/execution → connectors/cli}/types.js +0 -0
- /package/dist/src/{proactive/events/publisher.js → notifications/domain-delivery.js} +0 -0
- /package/dist/src/{proactive/inbox/types.js → scenes/httpServices.js} +0 -0
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
2
|
-
import { effectiveProactivePolicy } from "../policy/service.js";
|
|
3
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
4
|
-
//#region src/proactive/execution/repository.ts
|
|
5
|
-
init_transaction();
|
|
6
|
-
const str = (row, key) => String(row[key]);
|
|
7
|
-
function claimNextRun(owner, now = /* @__PURE__ */ new Date(), leaseSeconds = 120) {
|
|
8
|
-
return runSqliteWriteTransaction((db) => {
|
|
9
|
-
const nowIso = now.toISOString();
|
|
10
|
-
for (const row of db.prepare("SELECT run_id, batch_id, subscription_id FROM proactive_runs WHERE status IN ('retryable', 'running')").all()) if (!effectiveProactivePolicy(str(row, "subscription_id"), now).enabled) {
|
|
11
|
-
db.prepare("UPDATE proactive_runs SET status = 'discarded', outcome_reason = 'disabled', updated_at = ? WHERE run_id = ?").run(nowIso, str(row, "run_id"));
|
|
12
|
-
db.prepare("UPDATE proactive_signal_batches SET status = 'ignored', updated_at = ? WHERE batch_id = ?").run(nowIso, str(row, "batch_id"));
|
|
13
|
-
}
|
|
14
|
-
for (const row of db.prepare("SELECT batch_id, subscription_id FROM proactive_signal_batches WHERE status = 'ready'").all()) if (!effectiveProactivePolicy(str(row, "subscription_id"), now).enabled) db.prepare("UPDATE proactive_signal_batches SET status = 'ignored' WHERE batch_id = ?").run(str(row, "batch_id"));
|
|
15
|
-
const dayStart = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate())).toISOString();
|
|
16
|
-
db.prepare(`UPDATE proactive_signal_batches SET status = 'ignored', updated_at = ? WHERE status = 'ready'
|
|
17
|
-
AND subscription_id IN (SELECT subscription_id FROM proactive_scenario_subscriptions WHERE enabled = 0)`).run(nowIso);
|
|
18
|
-
db.prepare(`UPDATE proactive_signal_batches AS batch SET status = 'ignored', updated_at = ?
|
|
19
|
-
WHERE batch.status = 'ready' AND EXISTS (
|
|
20
|
-
SELECT 1 FROM proactive_scenario_versions scenario
|
|
21
|
-
WHERE scenario.scenario_key = batch.scenario_key AND scenario.version = batch.scenario_version
|
|
22
|
-
AND (SELECT COUNT(*) FROM proactive_runs run
|
|
23
|
-
WHERE run.scenario_key = batch.scenario_key AND run.started_at >= ?) >= scenario.max_runs_per_day
|
|
24
|
-
)`).run(nowIso, dayStart);
|
|
25
|
-
db.prepare(`UPDATE proactive_signal_batches SET status = 'failed_permanent', updated_at = ?
|
|
26
|
-
WHERE status = 'processing' AND batch_id IN (
|
|
27
|
-
SELECT batch_id FROM proactive_runs WHERE status = 'running' AND lease_expires_at <= ? AND attempt >= 3
|
|
28
|
-
)`).run(nowIso, nowIso);
|
|
29
|
-
db.prepare(`UPDATE proactive_runs SET status = 'failed', error_message = 'Lease expired after maximum attempts',
|
|
30
|
-
lease_owner = NULL, lease_expires_at = NULL, updated_at = ?
|
|
31
|
-
WHERE status = 'running' AND lease_expires_at <= ? AND attempt >= 3`).run(nowIso, nowIso);
|
|
32
|
-
const retry = db.prepare(`SELECT * FROM proactive_runs WHERE status = 'retryable' AND next_attempt_at <= ? ORDER BY next_attempt_at LIMIT 1`).get(nowIso);
|
|
33
|
-
if (retry) {
|
|
34
|
-
db.prepare(`UPDATE proactive_runs SET status = 'running', attempt = attempt + CASE WHEN outcome_reason = 'source_stale' THEN 0 ELSE 1 END, lease_owner = ?, lease_expires_at = ?, next_attempt_at = NULL, updated_at = ? WHERE run_id = ?`).run(owner, new Date(now.getTime() + leaseSeconds * 1e3).toISOString(), nowIso, str(retry, "run_id"));
|
|
35
|
-
db.prepare("UPDATE proactive_signal_batches SET status = 'processing', updated_at = ? WHERE batch_id = ?").run(nowIso, str(retry, "batch_id"));
|
|
36
|
-
return runFromRow(db.prepare("SELECT * FROM proactive_runs WHERE run_id = ?").get(str(retry, "run_id")));
|
|
37
|
-
}
|
|
38
|
-
const expired = db.prepare(`SELECT * FROM proactive_runs WHERE status = 'running' AND lease_expires_at <= ? AND attempt < 3 ORDER BY updated_at LIMIT 1`).get(nowIso);
|
|
39
|
-
if (expired) {
|
|
40
|
-
db.prepare(`UPDATE proactive_runs SET attempt = attempt + 1, lease_owner = ?, lease_expires_at = ?, updated_at = ? WHERE run_id = ?`).run(owner, new Date(now.getTime() + leaseSeconds * 1e3).toISOString(), nowIso, str(expired, "run_id"));
|
|
41
|
-
return runFromRow(db.prepare("SELECT * FROM proactive_runs WHERE run_id = ?").get(str(expired, "run_id")));
|
|
42
|
-
}
|
|
43
|
-
const batch = db.prepare(`SELECT b.*, s.active_prompt_revision_id FROM proactive_signal_batches b
|
|
44
|
-
JOIN proactive_scenario_subscriptions s ON s.subscription_id = b.subscription_id
|
|
45
|
-
WHERE b.status = 'ready' ORDER BY b.ready_at LIMIT 1`).get();
|
|
46
|
-
if (!batch) return null;
|
|
47
|
-
const id = randomUUID();
|
|
48
|
-
const policy = effectiveProactivePolicy(str(batch, "subscription_id"), now);
|
|
49
|
-
db.prepare(`INSERT INTO proactive_runs (run_id, batch_id, subscription_id, scenario_key, scenario_version,
|
|
50
|
-
prompt_revision_id, status, attempt, lease_owner, lease_expires_at, started_at, updated_at, policy_revision, subscription_revision, policy_snapshot_json)
|
|
51
|
-
VALUES (?, ?, ?, ?, ?, ?, 'running', 1, ?, ?, ?, ?, ?, ?, ?)`).run(id, str(batch, "batch_id"), str(batch, "subscription_id"), str(batch, "scenario_key"), Number(batch.scenario_version), batch.active_prompt_revision_id ? String(batch.active_prompt_revision_id) : null, owner, new Date(now.getTime() + leaseSeconds * 1e3).toISOString(), nowIso, nowIso, policy.preferences.revision, policy.settings.revision, JSON.stringify({
|
|
52
|
-
level: policy.level,
|
|
53
|
-
delivery: policy.settings.delivery,
|
|
54
|
-
scanIntervalMinutes: policy.scanIntervalMinutes
|
|
55
|
-
}));
|
|
56
|
-
db.prepare("UPDATE proactive_signal_batches SET status = 'processing', updated_at = ? WHERE batch_id = ?").run(nowIso, str(batch, "batch_id"));
|
|
57
|
-
return runFromRow(db.prepare("SELECT * FROM proactive_runs WHERE run_id = ?").get(id));
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
function runFromRow(row) {
|
|
61
|
-
return {
|
|
62
|
-
id: str(row, "run_id"),
|
|
63
|
-
batchId: str(row, "batch_id"),
|
|
64
|
-
subscriptionId: str(row, "subscription_id"),
|
|
65
|
-
scenarioKey: str(row, "scenario_key"),
|
|
66
|
-
scenarioVersion: Number(row.scenario_version),
|
|
67
|
-
attempt: Number(row.attempt),
|
|
68
|
-
subscriptionRevision: Number(row.subscription_revision),
|
|
69
|
-
...row.prompt_revision_id ? { promptRevisionId: str(row, "prompt_revision_id") } : {}
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function eventIdsForBatch(batchId) {
|
|
73
|
-
return getSqliteDatabase().prepare("SELECT event_id FROM proactive_batch_events WHERE batch_id = ? ORDER BY added_at DESC LIMIT 100").all(batchId).map((row) => row.event_id);
|
|
74
|
-
}
|
|
75
|
-
function saveSnapshot(batchId, content, evidenceIds, now = /* @__PURE__ */ new Date()) {
|
|
76
|
-
const snapshot = {
|
|
77
|
-
id: randomUUID(),
|
|
78
|
-
batchId,
|
|
79
|
-
content,
|
|
80
|
-
evidenceIds,
|
|
81
|
-
createdAt: now.toISOString()
|
|
82
|
-
};
|
|
83
|
-
runSqliteWriteTransaction((db) => db.prepare(`INSERT INTO proactive_context_snapshots
|
|
84
|
-
(snapshot_id, batch_id, content_json, evidence_ids_json, created_at) VALUES (?, ?, ?, ?, ?)`).run(snapshot.id, batchId, JSON.stringify(content), JSON.stringify(evidenceIds), snapshot.createdAt));
|
|
85
|
-
return snapshot;
|
|
86
|
-
}
|
|
87
|
-
function attachSnapshot(runId, snapshotId) {
|
|
88
|
-
runSqliteWriteTransaction((db) => db.prepare("UPDATE proactive_runs SET context_snapshot_id = ?, updated_at = ? WHERE run_id = ?").run(snapshotId, (/* @__PURE__ */ new Date()).toISOString(), runId));
|
|
89
|
-
}
|
|
90
|
-
function finishRun(input, now = /* @__PURE__ */ new Date()) {
|
|
91
|
-
return runSqliteWriteTransaction((db) => {
|
|
92
|
-
const nowIso = now.toISOString();
|
|
93
|
-
const current = db.prepare("SELECT status, attempt FROM proactive_runs WHERE run_id = ?").get(input.run.id);
|
|
94
|
-
if (!current || current.status !== "running" || current.attempt !== input.run.attempt) return null;
|
|
95
|
-
const currentPolicy = effectiveProactivePolicy(input.run.subscriptionId, now);
|
|
96
|
-
if (!currentPolicy.enabled) input = {
|
|
97
|
-
...input,
|
|
98
|
-
candidate: void 0,
|
|
99
|
-
outcomeReason: "disabled"
|
|
100
|
-
};
|
|
101
|
-
else if (input.run.subscriptionRevision !== void 0 && input.run.subscriptionRevision !== currentPolicy.settings.revision) input = {
|
|
102
|
-
...input,
|
|
103
|
-
candidate: void 0,
|
|
104
|
-
outcomeReason: "policy_changed"
|
|
105
|
-
};
|
|
106
|
-
const subjectScope = db.prepare(`SELECT DISTINCT e.subject_kind, e.subject_id
|
|
107
|
-
FROM proactive_batch_events be
|
|
108
|
-
JOIN proactive_events e ON e.event_id = be.event_id
|
|
109
|
-
WHERE be.batch_id = ?
|
|
110
|
-
ORDER BY e.subject_kind, e.subject_id`).all(input.run.batchId).map((row) => `${str(row, "subject_kind")}:${str(row, "subject_id")}`);
|
|
111
|
-
const snapshot = db.prepare(`SELECT c.content_json FROM proactive_runs r JOIN proactive_context_snapshots c
|
|
112
|
-
ON c.snapshot_id = r.context_snapshot_id WHERE r.run_id = ?`).get(input.run.id);
|
|
113
|
-
const sourceVersions = snapshot ? JSON.parse(snapshot.content_json) : {};
|
|
114
|
-
const fingerprint = input.candidate ? createHash("sha256").update([
|
|
115
|
-
...subjectScope,
|
|
116
|
-
JSON.stringify(input.candidate.artifact ?? null),
|
|
117
|
-
JSON.stringify(sourceVersions.connected_source ?? sourceVersions.project_state ?? sourceVersions.follow_up ?? null),
|
|
118
|
-
...[
|
|
119
|
-
input.candidate.title,
|
|
120
|
-
input.candidate.summary,
|
|
121
|
-
input.candidate.recommendation
|
|
122
|
-
].map((value) => value.trim().toLowerCase().replace(/\s+/g, " "))
|
|
123
|
-
].join("\n")).digest("hex") : void 0;
|
|
124
|
-
const duplicate = fingerprint ? db.prepare(`SELECT 1 FROM proactive_insights
|
|
125
|
-
WHERE subscription_id = ? AND scenario_key = ? AND content_fingerprint = ? AND created_at >= ? LIMIT 1`).get(input.run.subscriptionId, input.run.scenarioKey, fingerprint, (/* @__PURE__ */ new Date(now.getTime() - (input.cooldownSeconds ?? 10080 * 60) * 1e3)).toISOString()) : void 0;
|
|
126
|
-
const valuable = Boolean(input.candidate) && !duplicate;
|
|
127
|
-
const reason = duplicate ? "duplicate" : input.outcomeReason;
|
|
128
|
-
const completed = valuable || [
|
|
129
|
-
"unchanged",
|
|
130
|
-
"routine",
|
|
131
|
-
"insufficient_evidence",
|
|
132
|
-
"duplicate",
|
|
133
|
-
"below_threshold"
|
|
134
|
-
].includes(reason ?? "");
|
|
135
|
-
db.prepare("UPDATE proactive_runs SET outcome_reason = ? WHERE run_id = ?").run(reason ?? null, input.run.id);
|
|
136
|
-
db.prepare(`UPDATE proactive_runs SET status = ?, raw_output = ?, model_ref = ?, lease_owner = NULL,
|
|
137
|
-
lease_expires_at = NULL, completed_at = ?, updated_at = ? WHERE run_id = ?`).run(completed ? "completed" : "discarded", input.rawOutput.slice(0, 2e4), input.modelRef ?? null, nowIso, nowIso, input.run.id);
|
|
138
|
-
db.prepare(`UPDATE proactive_signal_batches SET status = ?, updated_at = ? WHERE batch_id = ?`).run(valuable ? "processed" : "ignored", nowIso, input.run.batchId);
|
|
139
|
-
if (!input.candidate || duplicate) return null;
|
|
140
|
-
const insight = {
|
|
141
|
-
...input.candidate,
|
|
142
|
-
id: randomUUID(),
|
|
143
|
-
runId: input.run.id,
|
|
144
|
-
subscriptionId: input.run.subscriptionId,
|
|
145
|
-
scenarioKey: input.run.scenarioKey,
|
|
146
|
-
valueScore: input.valueScore ?? 0,
|
|
147
|
-
createdAt: nowIso
|
|
148
|
-
};
|
|
149
|
-
db.prepare(`INSERT INTO proactive_insights (insight_id, run_id, subscription_id, scenario_key, title, summary,
|
|
150
|
-
why_now, impact, recommendation, work_done, decision_json, proposed_action_json, urgency, confidence, value_score,
|
|
151
|
-
evidence_ids_json, content_fingerprint, created_at)
|
|
152
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(insight.id, insight.runId, insight.subscriptionId, insight.scenarioKey, insight.title, insight.summary, insight.whyNow, insight.impact, insight.recommendation, insight.workDone, insight.decision ? JSON.stringify(insight.decision) : null, insight.proposedAction ? JSON.stringify(insight.proposedAction) : null, insight.urgency, insight.confidence, insight.valueScore, JSON.stringify(insight.evidenceIds), fingerprint, insight.createdAt);
|
|
153
|
-
if (insight.artifact) db.prepare("UPDATE proactive_insights SET artifact_json = ? WHERE insight_id = ?").run(JSON.stringify(insight.artifact), insight.id);
|
|
154
|
-
return insight;
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
/** Stale evidence waits without spending model attempts; never retain work indefinitely. */
|
|
158
|
-
function deferRunForSource(run, now = /* @__PURE__ */ new Date()) {
|
|
159
|
-
runSqliteWriteTransaction((db) => {
|
|
160
|
-
const row = db.prepare("SELECT started_at FROM proactive_runs WHERE run_id = ?").get(run.id);
|
|
161
|
-
if (now.getTime() - Date.parse(row.started_at) >= 864e5) {
|
|
162
|
-
finishRun({
|
|
163
|
-
run,
|
|
164
|
-
rawOutput: "",
|
|
165
|
-
outcomeReason: "source_unavailable"
|
|
166
|
-
}, now);
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
if (db.prepare(`UPDATE proactive_runs SET status = 'retryable', outcome_reason = 'source_stale',
|
|
170
|
-
lease_owner = NULL, lease_expires_at = NULL, next_attempt_at = ?, updated_at = ?
|
|
171
|
-
WHERE run_id = ? AND status = 'running' AND attempt = ?`).run(new Date(now.getTime() + 6e4).toISOString(), now.toISOString(), run.id, run.attempt).changes) db.prepare("UPDATE proactive_signal_batches SET status = 'failed_retryable', updated_at = ? WHERE batch_id = ?").run(now.toISOString(), run.batchId);
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
function failRun(run, error, retryable, now = /* @__PURE__ */ new Date()) {
|
|
175
|
-
runSqliteWriteTransaction((db) => {
|
|
176
|
-
const finalRetryable = retryable && run.attempt < 3;
|
|
177
|
-
const nowIso = now.toISOString();
|
|
178
|
-
const nextAttemptAt = finalRetryable ? new Date(now.getTime() + 15e3 * run.attempt).toISOString() : null;
|
|
179
|
-
if (!db.prepare(`UPDATE proactive_runs SET status = ?, error_message = ?, lease_owner = NULL, lease_expires_at = NULL, next_attempt_at = ?, updated_at = ? WHERE run_id = ? AND status = 'running' AND attempt = ?`).run(finalRetryable ? "retryable" : "failed", String(error instanceof Error ? error.message : error).slice(0, 2e3), nextAttemptAt, nowIso, run.id, run.attempt).changes) return;
|
|
180
|
-
db.prepare(`UPDATE proactive_signal_batches SET status = ?, updated_at = ? WHERE batch_id = ?`).run(finalRetryable ? "failed_retryable" : "failed_permanent", nowIso, run.batchId);
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
function listInsights(limit = 50) {
|
|
184
|
-
return getSqliteDatabase().prepare("SELECT * FROM proactive_insights ORDER BY created_at DESC LIMIT ?").all(Math.min(200, Math.max(1, limit))).map((row) => ({
|
|
185
|
-
id: str(row, "insight_id"),
|
|
186
|
-
runId: str(row, "run_id"),
|
|
187
|
-
subscriptionId: str(row, "subscription_id"),
|
|
188
|
-
scenarioKey: str(row, "scenario_key"),
|
|
189
|
-
title: str(row, "title"),
|
|
190
|
-
summary: str(row, "summary"),
|
|
191
|
-
whyNow: str(row, "why_now"),
|
|
192
|
-
impact: str(row, "impact"),
|
|
193
|
-
recommendation: str(row, "recommendation"),
|
|
194
|
-
workDone: str(row, "work_done"),
|
|
195
|
-
...row.artifact_json ? { artifact: JSON.parse(str(row, "artifact_json")) } : {},
|
|
196
|
-
...row.decision_json ? { decision: JSON.parse(str(row, "decision_json")) } : {},
|
|
197
|
-
...row.proposed_action_json ? { proposedAction: JSON.parse(str(row, "proposed_action_json")) } : {},
|
|
198
|
-
urgency: str(row, "urgency"),
|
|
199
|
-
confidence: Number(row.confidence),
|
|
200
|
-
valueScore: Number(row.value_score),
|
|
201
|
-
...row.disposition ? { disposition: str(row, "disposition") } : {},
|
|
202
|
-
...row.disposition_reason ? { dispositionReason: str(row, "disposition_reason") } : {},
|
|
203
|
-
...row.action_status ? { actionStatus: str(row, "action_status") } : {},
|
|
204
|
-
...row.action_result_json ? { actionResult: JSON.parse(str(row, "action_result_json")) } : {},
|
|
205
|
-
...row.action_error ? { actionError: str(row, "action_error") } : {},
|
|
206
|
-
evidenceIds: JSON.parse(str(row, "evidence_ids_json")),
|
|
207
|
-
createdAt: str(row, "created_at")
|
|
208
|
-
}));
|
|
209
|
-
}
|
|
210
|
-
//#endregion
|
|
211
|
-
export { attachSnapshot, claimNextRun, deferRunForSource, eventIdsForBatch, failRun, finishRun, listInsights, saveSnapshot };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { ProactiveArtifact } from '@xopcai/gateway-contract';
|
|
2
|
-
export interface ContextSnapshot {
|
|
3
|
-
id: string;
|
|
4
|
-
batchId: string;
|
|
5
|
-
content: Record<string, unknown>;
|
|
6
|
-
evidenceIds: string[];
|
|
7
|
-
createdAt: string;
|
|
8
|
-
}
|
|
9
|
-
export interface InsightCandidate {
|
|
10
|
-
artifact?: ProactiveArtifact;
|
|
11
|
-
title: string;
|
|
12
|
-
summary: string;
|
|
13
|
-
whyNow: string;
|
|
14
|
-
impact: string;
|
|
15
|
-
recommendation: string;
|
|
16
|
-
workDone: string;
|
|
17
|
-
decision?: {
|
|
18
|
-
question: string;
|
|
19
|
-
options: Array<{
|
|
20
|
-
id: string;
|
|
21
|
-
label: string;
|
|
22
|
-
consequence: string;
|
|
23
|
-
}>;
|
|
24
|
-
};
|
|
25
|
-
proposedAction?: {
|
|
26
|
-
id: 'create_project_task';
|
|
27
|
-
risk: 'low';
|
|
28
|
-
rationale: string;
|
|
29
|
-
input: {
|
|
30
|
-
title: string;
|
|
31
|
-
objective: string;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
urgency: 'low' | 'medium' | 'high' | 'critical';
|
|
35
|
-
confidence: number;
|
|
36
|
-
evidenceIds: string[];
|
|
37
|
-
}
|
|
38
|
-
export interface ProactiveInsight extends InsightCandidate {
|
|
39
|
-
id: string;
|
|
40
|
-
runId: string;
|
|
41
|
-
subscriptionId: string;
|
|
42
|
-
scenarioKey: string;
|
|
43
|
-
valueScore: number;
|
|
44
|
-
disposition?: 'record_silently' | 'show_in_work' | 'request_approval' | 'auto_execute';
|
|
45
|
-
dispositionReason?: string;
|
|
46
|
-
actionStatus?: 'not_authorized' | 'approval_required' | 'pending' | 'executing' | 'completed' | 'rejected' | 'failed';
|
|
47
|
-
actionResult?: Record<string, unknown>;
|
|
48
|
-
actionError?: string;
|
|
49
|
-
createdAt: string;
|
|
50
|
-
}
|
|
51
|
-
export interface ProactiveAgentExecutor {
|
|
52
|
-
execute(input: {
|
|
53
|
-
systemPrompt: string;
|
|
54
|
-
userPrompt: string;
|
|
55
|
-
authorizedContext: Record<string, unknown>;
|
|
56
|
-
signal?: AbortSignal;
|
|
57
|
-
}): Promise<{
|
|
58
|
-
text: string;
|
|
59
|
-
modelRef?: string;
|
|
60
|
-
usage?: {
|
|
61
|
-
inputTokens: number;
|
|
62
|
-
outputTokens: number;
|
|
63
|
-
estimatedCostUsd?: number;
|
|
64
|
-
};
|
|
65
|
-
}>;
|
|
66
|
-
}
|
|
67
|
-
export interface ContextProvider {
|
|
68
|
-
id: string;
|
|
69
|
-
collect(input: {
|
|
70
|
-
scenarioKey: string;
|
|
71
|
-
batchId: string;
|
|
72
|
-
eventIds: string[];
|
|
73
|
-
subscriptionId: string;
|
|
74
|
-
}): Promise<ResolvedContext>;
|
|
75
|
-
}
|
|
76
|
-
export interface ResolvedContext {
|
|
77
|
-
content: Record<string, unknown>;
|
|
78
|
-
snapshotContent?: Record<string, unknown>;
|
|
79
|
-
evidenceIds: string[];
|
|
80
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ContextProviderRegistry } from './context.js';
|
|
2
|
-
import type { ProactiveAgentExecutor } from './types.js';
|
|
3
|
-
export declare class ProactiveWorker {
|
|
4
|
-
private readonly executor;
|
|
5
|
-
private readonly contexts;
|
|
6
|
-
private readonly intervalMs;
|
|
7
|
-
private readonly owner;
|
|
8
|
-
private timer?;
|
|
9
|
-
private running;
|
|
10
|
-
private stoppedWaiters;
|
|
11
|
-
constructor(executor: ProactiveAgentExecutor, contexts?: ContextProviderRegistry, intervalMs?: number);
|
|
12
|
-
start(): void;
|
|
13
|
-
stop(): Promise<void>;
|
|
14
|
-
tick(): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { createLogger } from "../../utils/logger/index.js";
|
|
2
|
-
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { getSqliteDatabase, init_transaction } from "../../storage/sqlite/transaction.js";
|
|
4
|
-
import { evidenceSourcesFresh } from "../source-freshness.js";
|
|
5
|
-
import { authorizedConnectedSource } from "./authorization.js";
|
|
6
|
-
import { effectiveProactivePolicy } from "../policy/service.js";
|
|
7
|
-
import { getPromptRevision, getScenario } from "../scenarios/repository.js";
|
|
8
|
-
import { composeScenarioPrompt } from "../scenarios/prompt-composer.js";
|
|
9
|
-
import { markReadyBatches } from "../routing/batch-repository.js";
|
|
10
|
-
import { ContextProviderRegistry } from "./context.js";
|
|
11
|
-
import { attachSnapshot, claimNextRun, deferRunForSource, eventIdsForBatch, failRun, finishRun, saveSnapshot } from "./repository.js";
|
|
12
|
-
import { isValuableInsight, parseAnalysisResult, scoreInsight } from "./insight.js";
|
|
13
|
-
import { randomUUID } from "node:crypto";
|
|
14
|
-
import { isDeepStrictEqual } from "node:util";
|
|
15
|
-
//#region src/proactive/execution/worker.ts
|
|
16
|
-
init_transaction();
|
|
17
|
-
init_logger();
|
|
18
|
-
const log = createLogger("ProactiveWorker");
|
|
19
|
-
var ProactiveWorker = class {
|
|
20
|
-
owner = randomUUID();
|
|
21
|
-
timer;
|
|
22
|
-
running = false;
|
|
23
|
-
stoppedWaiters = [];
|
|
24
|
-
constructor(executor, contexts = new ContextProviderRegistry(), intervalMs = 5e3) {
|
|
25
|
-
this.executor = executor;
|
|
26
|
-
this.contexts = contexts;
|
|
27
|
-
this.intervalMs = intervalMs;
|
|
28
|
-
}
|
|
29
|
-
start() {
|
|
30
|
-
if (this.timer) return;
|
|
31
|
-
this.timer = setInterval(() => void this.tick(), this.intervalMs);
|
|
32
|
-
this.timer.unref();
|
|
33
|
-
this.tick();
|
|
34
|
-
}
|
|
35
|
-
async stop() {
|
|
36
|
-
if (this.timer) clearInterval(this.timer);
|
|
37
|
-
this.timer = void 0;
|
|
38
|
-
if (!this.running) return;
|
|
39
|
-
await new Promise((resolve) => this.stoppedWaiters.push(resolve));
|
|
40
|
-
}
|
|
41
|
-
async tick() {
|
|
42
|
-
if (this.running) return;
|
|
43
|
-
this.running = true;
|
|
44
|
-
try {
|
|
45
|
-
markReadyBatches();
|
|
46
|
-
const run = claimNextRun(this.owner);
|
|
47
|
-
if (!run) return;
|
|
48
|
-
try {
|
|
49
|
-
const scenario = getScenario(run.scenarioKey, run.scenarioVersion);
|
|
50
|
-
if (!scenario) throw new Error("Pinned scenario version is unavailable");
|
|
51
|
-
if (!effectiveProactivePolicy(run.subscriptionId).enabled) {
|
|
52
|
-
finishRun({
|
|
53
|
-
run,
|
|
54
|
-
rawOutput: "",
|
|
55
|
-
outcomeReason: "disabled"
|
|
56
|
-
});
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
const revision = run.promptRevisionId ? getPromptRevision(run.promptRevisionId) ?? void 0 : void 0;
|
|
60
|
-
const eventIds = eventIdsForBatch(run.batchId);
|
|
61
|
-
const context = await this.contexts.collect(scenario, {
|
|
62
|
-
batchId: run.batchId,
|
|
63
|
-
eventIds,
|
|
64
|
-
subscriptionId: run.subscriptionId
|
|
65
|
-
});
|
|
66
|
-
if (context.evidenceIds.length === 0) {
|
|
67
|
-
finishRun({
|
|
68
|
-
run,
|
|
69
|
-
rawOutput: "",
|
|
70
|
-
outcomeReason: "source_unavailable"
|
|
71
|
-
});
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (!evidenceSourcesFresh(context.evidenceIds, context.content)) {
|
|
75
|
-
deferRunForSource(run);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const snapshot = saveSnapshot(run.batchId, context.snapshotContent ?? context.content, context.evidenceIds);
|
|
79
|
-
attachSnapshot(run.id, snapshot.id);
|
|
80
|
-
const prompt = composeScenarioPrompt({
|
|
81
|
-
scenario,
|
|
82
|
-
...revision ? { revision } : {},
|
|
83
|
-
runtimeContext: "Use the read-only inspection tool to examine the authorized evidence."
|
|
84
|
-
});
|
|
85
|
-
const output = await this.executor.execute({
|
|
86
|
-
systemPrompt: prompt.platformSafety,
|
|
87
|
-
userPrompt: prompt.text,
|
|
88
|
-
authorizedContext: context.content
|
|
89
|
-
});
|
|
90
|
-
if (output.usage) getSqliteDatabase().prepare("UPDATE proactive_runs SET input_tokens = ?, output_tokens = ?, estimated_cost_usd = ? WHERE run_id = ? AND attempt = ?").run(output.usage.inputTokens, output.usage.outputTokens, output.usage.estimatedCostUsd ?? null, run.id, run.attempt);
|
|
91
|
-
const latestContext = await this.contexts.collect(scenario, {
|
|
92
|
-
batchId: run.batchId,
|
|
93
|
-
eventIds,
|
|
94
|
-
subscriptionId: run.subscriptionId
|
|
95
|
-
});
|
|
96
|
-
const revoked = context.evidenceIds.some((id) => !latestContext.evidenceIds.includes(id));
|
|
97
|
-
const changed = !isDeepStrictEqual(context.snapshotContent ?? context.content, latestContext.snapshotContent ?? latestContext.content);
|
|
98
|
-
const stale = !evidenceSourcesFresh(latestContext.evidenceIds, latestContext.content);
|
|
99
|
-
if (stale && !revoked) {
|
|
100
|
-
deferRunForSource(run);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const unavailable = context.evidenceIds.some((id) => id.startsWith("source-item:") && !authorizedConnectedSource(id.slice(12), effectiveProactivePolicy(run.subscriptionId).workspaceId, run.scenarioKey));
|
|
104
|
-
const result = revoked || changed || stale ? {
|
|
105
|
-
result: "no_insight",
|
|
106
|
-
reason: unavailable ? "source_unavailable" : stale ? "source_stale" : "source_changed"
|
|
107
|
-
} : parseAnalysisResult(output.text, new Set(latestContext.evidenceIds));
|
|
108
|
-
const candidate = result.result === "insight" ? result.candidate : void 0;
|
|
109
|
-
if (run.scenarioKey === "communication_follow_up" && (candidate?.decision || candidate?.proposedAction)) throw new Error("Communication preparation must return a draft or update; actions require the conversation confirmation flow");
|
|
110
|
-
const valueScore = candidate ? scoreInsight(candidate) : 0;
|
|
111
|
-
const enabled = effectiveProactivePolicy(run.subscriptionId).enabled;
|
|
112
|
-
const valuable = enabled && candidate && isValuableInsight(candidate, scenario.valuePolicy);
|
|
113
|
-
const insight = finishRun({
|
|
114
|
-
run,
|
|
115
|
-
...valuable ? {
|
|
116
|
-
candidate,
|
|
117
|
-
valueScore
|
|
118
|
-
} : {},
|
|
119
|
-
cooldownSeconds: scenario.valuePolicy.cooldownSeconds,
|
|
120
|
-
outcomeReason: !enabled ? "disabled" : result.result === "no_insight" ? result.reason : valuable ? "insight" : "below_threshold",
|
|
121
|
-
rawOutput: revoked ? "" : output.text,
|
|
122
|
-
modelRef: output.modelRef
|
|
123
|
-
});
|
|
124
|
-
const disposition = insight ? "created" : valuable ? "duplicate_suppressed" : result.result === "no_insight" ? result.reason : "value_gate_discarded";
|
|
125
|
-
log.info({
|
|
126
|
-
runId: run.id,
|
|
127
|
-
scenarioKey: run.scenarioKey,
|
|
128
|
-
disposition,
|
|
129
|
-
insightId: insight?.id
|
|
130
|
-
}, insight ? "Proactive insight created" : "Proactive check completed without a card");
|
|
131
|
-
} catch (error) {
|
|
132
|
-
failRun(run, error, !(error instanceof Error && /Pinned scenario/.test(error.message)));
|
|
133
|
-
log.warn({
|
|
134
|
-
err: error,
|
|
135
|
-
runId: run.id,
|
|
136
|
-
scenarioKey: run.scenarioKey
|
|
137
|
-
}, "Proactive run failed");
|
|
138
|
-
}
|
|
139
|
-
} finally {
|
|
140
|
-
this.running = false;
|
|
141
|
-
for (const resolve of this.stoppedWaiters.splice(0)) resolve();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
//#endregion
|
|
146
|
-
export { ProactiveWorker };
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { getCard } from './inbox/cards.js';
|
|
2
|
-
type SceneKind = 'project_momentum' | 'meeting_preparation' | 'communication_follow_up';
|
|
3
|
-
type SceneStatus = 'needs_decision' | 'prepared' | 'changed' | 'following';
|
|
4
|
-
interface SceneMoment {
|
|
5
|
-
id: string;
|
|
6
|
-
kind: SceneKind;
|
|
7
|
-
status: SceneStatus;
|
|
8
|
-
title: string;
|
|
9
|
-
promise: string;
|
|
10
|
-
moment: string;
|
|
11
|
-
relevance: string;
|
|
12
|
-
help: string;
|
|
13
|
-
arrangementId: string;
|
|
14
|
-
manageRoute: string;
|
|
15
|
-
object: {
|
|
16
|
-
label: string;
|
|
17
|
-
route: string;
|
|
18
|
-
} | null;
|
|
19
|
-
card: ReturnType<typeof getCard> | null;
|
|
20
|
-
updatedAt: string;
|
|
21
|
-
}
|
|
22
|
-
export declare function startDelegation(workspace: string, value: unknown): {
|
|
23
|
-
revision: number;
|
|
24
|
-
level: "active" | "quiet" | "balanced";
|
|
25
|
-
delivery: "digest" | "inbox" | "important";
|
|
26
|
-
completedAt: string;
|
|
27
|
-
scanIntervalMinutes: number;
|
|
28
|
-
userInstructions: string;
|
|
29
|
-
id: string;
|
|
30
|
-
scenarioKey: string;
|
|
31
|
-
workspaceId: string;
|
|
32
|
-
scopeKind: "workspace" | "project";
|
|
33
|
-
scopeId: string;
|
|
34
|
-
enabled: boolean;
|
|
35
|
-
activePromptRevisionId?: string;
|
|
36
|
-
createdAt: string;
|
|
37
|
-
updatedAt: string;
|
|
38
|
-
};
|
|
39
|
-
/** Queue work in the existing worker; HTTP and conversation requests do not own model runs. */
|
|
40
|
-
export declare function checkDelegation(workspace: string, id: string): {
|
|
41
|
-
status: "queued";
|
|
42
|
-
};
|
|
43
|
-
export declare function delegationOverview(workspace: string): {
|
|
44
|
-
scenes: SceneMoment[];
|
|
45
|
-
followUps: {
|
|
46
|
-
id: string;
|
|
47
|
-
subscriptionId: string;
|
|
48
|
-
instructions: string;
|
|
49
|
-
dueAt: string;
|
|
50
|
-
status: "completed" | "paused" | "watching";
|
|
51
|
-
revision: number;
|
|
52
|
-
lastCheckedAt: string;
|
|
53
|
-
conversationId: string;
|
|
54
|
-
sourceAvailable: boolean;
|
|
55
|
-
enabled: boolean;
|
|
56
|
-
subject: string;
|
|
57
|
-
latestMessageAt: string;
|
|
58
|
-
latestDirection: string;
|
|
59
|
-
lastSyncedAt: string;
|
|
60
|
-
syncFailed: boolean;
|
|
61
|
-
sourceFresh: boolean;
|
|
62
|
-
}[];
|
|
63
|
-
delegations: {
|
|
64
|
-
id: string;
|
|
65
|
-
scenarioKey: string;
|
|
66
|
-
scopeKind: "project" | "workspace";
|
|
67
|
-
scopeId: string;
|
|
68
|
-
enabled: boolean;
|
|
69
|
-
revision: number;
|
|
70
|
-
delivery: "digest" | "inbox" | "important";
|
|
71
|
-
scanIntervalMinutes: number;
|
|
72
|
-
checkStatus: import("@xopcai/gateway-contract/src/proactive.js").ProactiveCheckStatus;
|
|
73
|
-
completedAt: string;
|
|
74
|
-
userInstructions: string;
|
|
75
|
-
updatedAt: string;
|
|
76
|
-
effectiveEnabled: boolean;
|
|
77
|
-
project: {
|
|
78
|
-
name: string;
|
|
79
|
-
status: string;
|
|
80
|
-
};
|
|
81
|
-
projectMonitoring: {
|
|
82
|
-
mode: "observe" | "ask_before_action" | "auto_low_risk";
|
|
83
|
-
allowedActions: string[];
|
|
84
|
-
};
|
|
85
|
-
checking: boolean;
|
|
86
|
-
}[];
|
|
87
|
-
};
|
|
88
|
-
export declare function completeDeliveredProjects(now?: Date): void;
|
|
89
|
-
export {};
|