@xopcai/xopc 0.0.178 → 0.0.179
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/{activity-store-BzGX__8I.js → activity-store-A5FUMjeV.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BzxntcaZ.js → agent-avatar-dicebear-NghNiDWx.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Baq8Shzy.js +2 -0
- package/dist/gateway/static/root/assets/{api-hi6f2Xtp.js → api-Bmzslx0Z.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-fTY1F7ac.js → app-management-settings-panel-DDWS_BBJ.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BZ-IxQfB.js → appearance-settings-C6znvVtX.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-d-Y0Jbe1.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-ZSLLG8wB.js → archive-plugin-fvTZhPUr.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D4YktqIF.js → attachment-load-BFEgvg-Q.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-CFYOCBlQ.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BIkPxfxj.js → binary-plugins-CuI2bOc7.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Q3v_YQom.js → block-editor-Z_k8W0al.js} +46 -46
- package/dist/gateway/static/root/assets/browser-settings-page-CGApoYPr.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-M5lTEW1I.js → browser-workflow-inputs-gs6b5e9-.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-B3T1KYk4.js → browser-workflows-page-Cq5qXStp.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BC-8n4Hl.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-DE09c0VB.js → capability-presets-api-BTKhPoDC.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D7WQ0oBN.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-CFR5FBfS.js → channel-recipient-api-TwMak0SE.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DysELlO_.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-BAC-R8IK.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-B1mD-3pM.js → connector-logo-DBKotvNr.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-QH-0WnOo.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-Dwml8znf.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-CyIg2jJp.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BYQJ2XUS.js → directory-picker-path-field-B6fc_7SL.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-BXcb8fwx.js → dreaming-settings-CUQxGnDf.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-O1Xu1r4Q.js → extension-debug-page-AbRNi2ON.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C2Jraq8l.js → extension-page-ClYfiLXC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DcXQDTpG.js → extension-settings-page-BGVP2hw1.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DmPIZrvg.js → gateway-config-api-B7GqtklK.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BMeK8igT.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BZEkOdPm.js → gateway-startup-retry-CKKL96r_.js} +1 -1
- package/dist/gateway/static/root/assets/goals-settings-Dj0ao2qA.js +1 -0
- package/dist/gateway/static/root/assets/{heartbeat-settings-BtKu2NWT.js → heartbeat-settings-CTI2nPKa.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-05Gg8wsU.js → image-generation-api-BY3VQ5Mv.js} +1 -1
- package/dist/gateway/static/root/assets/index-B0Tdge_q.css +1 -0
- package/dist/gateway/static/root/assets/index-BDzspHrg.js +224 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CfmDR9Sc.js → keyboard-shortcuts-settings-CELtDFz3.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-m8CTSGix.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Df8BW1A_.js → local-apps-page-CF5uUd1n.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CTwSy7yW.js → locale-store-DIVc0AQs.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DmH7Tk4k.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-B3FvKbaP.js → markdown-split-CN85EdB8.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DsjrvvB6.js → media-plugins-CxYEc-b8.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DYqBwJAK.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-tuzIwy3c.js → notes-page-Goab4781.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-C4jDBVBN.js +4 -0
- package/dist/gateway/static/root/assets/outcome-detail-page-DNRfeLZp.js +1 -0
- package/dist/gateway/static/root/assets/{page-tabs-ke9s4nYi.js → page-tabs-tQNQcAts.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cp1eI4S9.js → preview-open-alternatives-BSTlgsDB.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-BVG-eWQO.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-dXQCMAtH.js → product-open-page-iQ5gTCip.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-D7anK-eu.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BePESKWy.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-CHrzBKIs.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-Bl30zjHc.js → save-bar-controls-BsPf5Gkk.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-DqhmXQKo.js → schedule-field-kAytH7mq.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DkUCy6vf.js → schema-form-Bbw8l2ri.js} +1 -1
- package/dist/gateway/static/root/assets/{schemas-DgQq6Z5S.js → schemas-C6onAggk.js} +2 -2
- package/dist/gateway/static/root/assets/sessions-page-He5YAczL.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-2eAC9GCP.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-C6ZbNpdy.js → settings-form-section-BqbibcnJ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-Bk58_cr7.js → settings-loading-skeleton-DNLNCEGT.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-k8iE_NdX.js → settings-page-BR6Ss0bK.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DgFSya2e.js → settings-page-layout-Cdb1e2Cz.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-B_KDlyZA.js → setup-status-panel-moT-D-ia.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CV7nL_J9.js → share-preview-page-CkrASny2.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-X49zY21H.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CjpnFfOH.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DEwfSOUE.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-kahBIHg0.js → skills-page.utils-BG5dGkyA.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-JV3-MG5F.js → system-settings-panel-XdY8eyYf.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DFLyzoLO.js → theme-store-DtwI_VLT.js} +1 -1
- package/dist/gateway/static/root/assets/time-picker-UghsQu_I.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-60Aqo-UJ.js → typed-models-lib-DOnpwsrE.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CnTkHDnw.js → use-channel-catalog-BWDtfNvQ.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-BtNBEtKj.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CNa8qUgS.js → voice-api-key-field-DP80jW-W.js} +1 -1
- package/dist/gateway/static/root/assets/work-copy-hQmivDgT.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-CkDOVZBr.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-CqvkcFcR.js +1 -0
- package/dist/gateway/static/root/assets/work-page-BL8TZW4Z.js +3 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-yV_x595t.js → workflow-run-setup-panel-BLlVqKdA.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BgsdRu3_.js +11 -0
- package/dist/gateway/static/root/index.html +9 -10
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/outcomes.js +137 -0
- package/dist/packages/gateway-contract/src/product-delivery.js +1 -0
- package/dist/packages/gateway-contract/src/work-intake.js +85 -0
- package/dist/src/activity/service.d.ts +1 -0
- package/dist/src/activity/service.js +4 -1
- package/dist/src/agent/code-intelligence/binary.js +1 -1
- package/dist/src/agent/context/execution-scope.d.ts +1 -1
- package/dist/src/agent/context/execution-scope.js +6 -4
- package/dist/src/agent/goals/post-turn.js +6 -5
- package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
- package/dist/src/agent/memory/user-context-coordinator.d.ts +1 -0
- package/dist/src/agent/memory/user-context-coordinator.js +17 -1
- package/dist/src/agent/outcomes/{task-evaluation.d.ts → execution-evaluation.d.ts} +3 -3
- package/dist/src/agent/outcomes/{task-evaluation.js → execution-evaluation.js} +5 -5
- package/dist/src/agent/outcomes/execution-verifier.d.ts +29 -0
- package/dist/src/agent/outcomes/{task-verifier.js → execution-verifier.js} +4 -4
- package/dist/src/agent/service/process-direct-streaming.js +3 -1
- package/dist/src/agent/tools/factory.js +16 -1
- package/dist/src/agent/tools/goal-tool.js +5 -3
- package/dist/src/agent/tools/todo-tool.d.ts +5 -0
- package/dist/src/agent/tools/todo-tool.js +16 -4
- package/dist/src/agent/tools/update-plan-tool.d.ts +1 -0
- package/dist/src/agent/tools/update-plan-tool.js +6 -0
- package/dist/src/browser/providers/cloakbrowser.js +2 -2
- package/dist/src/channels/attachments/voice-stt-webchat.d.ts +0 -3
- package/dist/src/channels/attachments/voice-stt-webchat.js +1 -24
- package/dist/src/chat-commands/builtins/goal.js +5 -4
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/goal.js +6 -5
- package/dist/src/cli/commands/tunnel.js +3 -3
- package/dist/src/connectors/learning-coordinator.js +7 -1
- package/dist/src/connectors/source-change-publisher.d.ts +17 -0
- package/dist/src/connectors/source-change-publisher.js +148 -0
- package/dist/src/discussions/analyzer.d.ts +35 -0
- package/dist/src/discussions/analyzer.js +127 -0
- package/dist/src/discussions/index.d.ts +7 -0
- package/dist/src/discussions/index.js +7 -0
- package/dist/src/discussions/live-worker.d.ts +33 -0
- package/dist/src/discussions/live-worker.js +148 -0
- package/dist/src/discussions/pipeline.d.ts +33 -0
- package/dist/src/discussions/pipeline.js +205 -0
- package/dist/src/discussions/project-inference.d.ts +13 -0
- package/dist/src/discussions/project-inference.js +19 -0
- package/dist/src/discussions/repository.d.ts +29 -0
- package/dist/src/discussions/repository.js +255 -0
- package/dist/src/discussions/service.d.ts +51 -0
- package/dist/src/discussions/service.js +335 -0
- package/dist/src/discussions/transcript.d.ts +3 -0
- package/dist/src/discussions/transcript.js +15 -0
- package/dist/src/discussions/types.d.ts +116 -0
- package/dist/src/discussions/types.js +10 -0
- package/dist/src/discussions/worker.d.ts +18 -0
- package/dist/src/discussions/worker.js +74 -0
- package/dist/src/extensions/activation-context.js +2 -1
- package/dist/src/extensions/sdk/testing.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +53 -3
- package/dist/src/gateway/chat-stream/protocol.d.ts +17 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/app.js +8 -3
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/middleware/auth.js +2 -2
- package/dist/src/gateway/hono/middleware/logger.js +1 -1
- package/dist/src/gateway/hono/middleware/strict-rate-limit.js +1 -1
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/connectors.js +79 -0
- package/dist/src/gateway/hono/routes/discussions.d.ts +3 -0
- package/dist/src/gateway/hono/routes/discussions.js +177 -0
- package/dist/src/gateway/hono/routes/execution-receipts.d.ts +3 -0
- package/dist/src/gateway/hono/routes/execution-receipts.js +163 -0
- package/dist/src/gateway/hono/routes/exposure.js +1 -1
- package/dist/src/gateway/hono/routes/goals.js +3 -288
- package/dist/src/gateway/hono/routes/home.d.ts +2 -102
- package/dist/src/gateway/hono/routes/home.js +8 -424
- package/dist/src/gateway/hono/routes/index.js +6 -2
- package/dist/src/gateway/hono/routes/memory.js +7 -7
- package/dist/src/gateway/hono/routes/notes.js +30 -0
- package/dist/src/gateway/hono/routes/projects.js +8 -152
- package/dist/src/gateway/hono/routes/shares.js +1 -1
- package/dist/src/gateway/hono/routes/status.js +2 -2
- package/dist/src/gateway/hono/routes/tunnel.js +3 -3
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/hono/routes/work.d.ts +3 -0
- package/dist/src/gateway/hono/routes/work.js +207 -0
- package/dist/src/gateway/hono/routes/you.js +12 -14
- package/dist/src/gateway/index.js +2 -2
- package/dist/src/gateway/runtime-config.js +2 -2
- package/dist/src/gateway/security/audit.js +2 -2
- package/dist/src/gateway/security/index.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +46 -51
- package/dist/src/gateway/service.d.ts +8 -1
- package/dist/src/gateway/service.js +139 -12
- package/dist/src/goals/goal-queue-store.d.ts +1 -0
- package/dist/src/goals/goal-queue-store.js +5 -1
- package/dist/src/goals/goal-queue-types.d.ts +11 -1
- package/dist/src/goals/goal-runner.js +10 -6
- package/dist/src/goals/goal-service.d.ts +2 -15
- package/dist/src/goals/goal-service.js +9 -42
- package/dist/src/goals/goal-store.d.ts +1 -18
- package/dist/src/goals/goal-store.js +25 -231
- package/dist/src/goals/index.d.ts +0 -4
- package/dist/src/goals/index.js +1 -3
- package/dist/src/goals/types.d.ts +4 -66
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/notes/agent-context.js +1 -1
- package/dist/src/notes/service.d.ts +1 -0
- package/dist/src/notes/service.js +9 -0
- package/dist/src/notes/types.d.ts +1 -0
- package/dist/src/proactive/events/product-event-bridge.d.ts +7 -0
- package/dist/src/proactive/events/product-event-bridge.js +84 -0
- package/dist/src/proactive/execution/context.d.ts +27 -11
- package/dist/src/proactive/execution/context.js +259 -25
- package/dist/src/proactive/execution/repository.js +18 -5
- package/dist/src/proactive/execution/types.d.ts +7 -1
- package/dist/src/proactive/execution/worker.js +7 -6
- package/dist/src/proactive/inbox/repository.js +8 -2
- package/dist/src/proactive/index.d.ts +4 -2
- package/dist/src/proactive/index.js +5 -3
- package/dist/src/proactive/temporal/worker.d.ts +16 -0
- package/dist/src/proactive/temporal/worker.js +110 -0
- package/dist/src/share/share-zip.js +1 -1
- package/dist/src/share/site-proxy.js +1 -1
- package/dist/src/storage/sqlite/activity-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/activity-repository.js +4 -1
- package/dist/src/storage/sqlite/connector-sync-policy-repository.d.ts +20 -0
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +50 -0
- package/dist/src/storage/sqlite/execution-receipt-repository.d.ts +146 -0
- package/dist/src/storage/sqlite/execution-receipt-repository.js +235 -0
- package/dist/src/storage/sqlite/index.d.ts +4 -2
- package/dist/src/storage/sqlite/index.js +6 -4
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/knowledge-repository.js +9 -1
- package/dist/src/storage/sqlite/memory-records-repository.js +1 -1
- package/dist/src/storage/sqlite/migrations/075_connector_sync_policies.sql +13 -0
- package/dist/src/storage/sqlite/migrations/076_meeting_preparation_scenario.sql +29 -0
- package/dist/src/storage/sqlite/migrations/077_proactive_insight_fingerprints.sql +4 -0
- package/dist/src/storage/sqlite/migrations/078_discussion_captures.sql +64 -0
- package/dist/src/storage/sqlite/migrations/079_discussion_follow_up_scenario.sql +29 -0
- package/dist/src/storage/sqlite/migrations/080_task_outcome_context.sql +15 -0
- package/dist/src/storage/sqlite/migrations/081_project_monitoring_policies.sql +10 -0
- package/dist/src/storage/sqlite/migrations/082_one_click_live_discussions.sql +100 -0
- package/dist/src/storage/sqlite/migrations/083_session_task_plans.sql +9 -0
- package/dist/src/storage/sqlite/migrations/084_work_intake_lifecycle.sql +26 -0
- package/dist/src/storage/sqlite/migrations/085_task_outcome_projection.sql +19 -0
- package/dist/src/storage/sqlite/migrations/086_outcome_aggregates.sql +168 -0
- package/dist/src/storage/sqlite/migrations/087_context_snapshots.sql +21 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/notes-repository.js +9 -0
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +89 -44
- package/dist/src/storage/sqlite/session-repository.js +1 -1
- package/dist/src/storage/sqlite/session-task-plan-repository.d.ts +20 -0
- package/dist/src/storage/sqlite/session-task-plan-repository.js +77 -0
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tunnel/frpc-binary.js +1 -1
- package/dist/src/tunnel/frpc-extract.js +1 -1
- package/dist/src/tunnel/index.js +2 -2
- package/dist/src/user-context/context-compiler.d.ts +31 -0
- package/dist/src/user-context/context-compiler.js +51 -0
- package/dist/src/voice/local/model-files.js +1 -1
- package/dist/src/voice/stt/config.d.ts +4 -0
- package/dist/src/voice/stt/config.js +26 -0
- package/dist/src/voice/stt/index.d.ts +1 -0
- package/dist/src/voice/stt/index.js +2 -1
- package/dist/src/voice/stt/list-providers.js +1 -1
- package/dist/src/work/attention-governor.d.ts +20 -0
- package/dist/src/work/attention-governor.js +46 -0
- package/dist/src/work/execution-context.d.ts +16 -0
- package/dist/src/work/execution-context.js +66 -0
- package/dist/src/work/home-query-service.d.ts +118 -0
- package/dist/src/work/home-query-service.js +389 -0
- package/dist/src/work/index.d.ts +14 -0
- package/dist/src/work/index.js +15 -0
- package/dist/src/work/outcome-contract-definition.d.ts +8 -0
- package/dist/src/work/outcome-contract-definition.js +15 -0
- package/dist/src/work/outcome-execution-service.d.ts +27 -0
- package/dist/src/work/outcome-execution-service.js +60 -0
- package/dist/src/work/outcome-projection-service.d.ts +7 -0
- package/dist/src/work/outcome-projection-service.js +51 -0
- package/dist/src/work/outcome-receipt-service.d.ts +13 -0
- package/dist/src/work/outcome-receipt-service.js +55 -0
- package/dist/src/work/outcome-repository.d.ts +50 -0
- package/dist/src/work/outcome-repository.js +112 -0
- package/dist/src/work/outcome-run-coordinator.d.ts +25 -0
- package/dist/src/work/outcome-run-coordinator.js +117 -0
- package/dist/src/work/project-monitoring-service.d.ts +21 -0
- package/dist/src/work/project-monitoring-service.js +76 -0
- package/dist/src/work/project-operating-view-service.d.ts +10 -0
- package/dist/src/work/project-operating-view-service.js +46 -0
- package/dist/src/work/work-intake-repository.d.ts +49 -0
- package/dist/src/work/work-intake-repository.js +97 -0
- package/dist/src/work/work-intake-service.d.ts +26 -0
- package/dist/src/work/work-intake-service.js +171 -0
- package/dist/src/work/work-value-metrics-service.d.ts +4 -0
- package/dist/src/work/work-value-metrics-service.js +88 -0
- package/dist/src/work-items/work-item-service.d.ts +0 -2
- package/dist/src/work-items/work-item-service.js +0 -28
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/dist/src/workflows/service/workflow-session-bridge.js +2 -2
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agents-DC9F12Kw.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-5bKr05Fa.js +0 -1
- package/dist/gateway/static/root/assets/automation-suggestion-card-B7mxFRtf.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-Dg6dmt5g.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BHoo6Rpq.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BlsqN8Fu.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DJeT8_B4.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-C4VVjYEm.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-vdf8kB16.js +0 -1
- package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DNcrDThX.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-B1urphOZ.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DTL6J3EP.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DmObBx9b.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-BRhmmBe9.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-C1k7_s_O.js +0 -4
- package/dist/gateway/static/root/assets/goals-config-api-Fwu1wjEP.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-hOu9uA3q.js +0 -2
- package/dist/gateway/static/root/assets/goals-settings-DY-JjvHz.js +0 -1
- package/dist/gateway/static/root/assets/index-C0CGebQ1.js +0 -212
- package/dist/gateway/static/root/assets/index-eqq25gvV.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-EjsNT7nJ.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-Dswjlraa.js +0 -7
- package/dist/gateway/static/root/assets/messages-DP6tPKk-.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-DSh3-hMY.js +0 -4
- package/dist/gateway/static/root/assets/product-delivery-BTRT9kCS.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-D0QPRHR_.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CI5Vz62F.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-S1jpzBS5.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CTm66k7h.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CU52AUVD.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DK6XK95e.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Bvv_u4ii.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BGHvVbay.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-XwpxdZFr.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-DBCMk-Vn.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-C1UIdsCl.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DEAQepB8.js +0 -1
- package/dist/gateway/static/root/assets/work-page-D5qYmCTq.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-yrK17ZZ5.js +0 -11
- package/dist/src/agent/outcomes/task-verifier.d.ts +0 -29
- package/dist/src/gateway/hono/routes/task-outcomes.d.ts +0 -3
- package/dist/src/gateway/hono/routes/task-outcomes.js +0 -109
- package/dist/src/goals/goal-contract-draft.d.ts +0 -15
- package/dist/src/goals/goal-contract-draft.js +0 -112
- package/dist/src/goals/goal-evidence-review.d.ts +0 -15
- package/dist/src/goals/goal-evidence-review.js +0 -89
- package/dist/src/storage/sqlite/task-outcome-repository.d.ts +0 -90
- package/dist/src/storage/sqlite/task-outcome-repository.js +0 -138
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AutomationEvent } from '../../automations/domain/types.js';
|
|
2
|
+
import type { PublishEventInput } from './types.js';
|
|
3
|
+
export declare function mapProductEventToProactive(input: {
|
|
4
|
+
event: AutomationEvent;
|
|
5
|
+
workspaceId: string;
|
|
6
|
+
defaultAgentId: string;
|
|
7
|
+
}): PublishEventInput | null;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//#region src/proactive/events/product-event-bridge.ts
|
|
2
|
+
const SUPPORTED_EVENT_TYPES = new Set([
|
|
3
|
+
"goal.created",
|
|
4
|
+
"goal.status_changed",
|
|
5
|
+
"note.created",
|
|
6
|
+
"note.updated",
|
|
7
|
+
"workflow.run.completed",
|
|
8
|
+
"session.transcript.updated",
|
|
9
|
+
"discussion.completed"
|
|
10
|
+
]);
|
|
11
|
+
function stringValue(payload, key) {
|
|
12
|
+
const value = payload[key];
|
|
13
|
+
return typeof value === "string" && value.trim() ? value : void 0;
|
|
14
|
+
}
|
|
15
|
+
function subjectFor(event) {
|
|
16
|
+
const payload = event.payload ?? {};
|
|
17
|
+
if (event.type.startsWith("goal.")) {
|
|
18
|
+
const id = stringValue(payload, "goalId");
|
|
19
|
+
return id ? {
|
|
20
|
+
kind: "goal",
|
|
21
|
+
id
|
|
22
|
+
} : null;
|
|
23
|
+
}
|
|
24
|
+
if (event.type.startsWith("note.")) {
|
|
25
|
+
const id = stringValue(payload, "noteId");
|
|
26
|
+
return id ? {
|
|
27
|
+
kind: "note",
|
|
28
|
+
id
|
|
29
|
+
} : null;
|
|
30
|
+
}
|
|
31
|
+
if (event.type === "workflow.run.completed") {
|
|
32
|
+
const id = stringValue(payload, "runId");
|
|
33
|
+
return id ? {
|
|
34
|
+
kind: "workflow_run",
|
|
35
|
+
id
|
|
36
|
+
} : null;
|
|
37
|
+
}
|
|
38
|
+
if (event.type === "session.transcript.updated") {
|
|
39
|
+
const id = stringValue(payload, "sessionKey");
|
|
40
|
+
return id ? {
|
|
41
|
+
kind: "session",
|
|
42
|
+
id
|
|
43
|
+
} : null;
|
|
44
|
+
}
|
|
45
|
+
if (event.type === "discussion.completed") {
|
|
46
|
+
const id = stringValue(payload, "discussionId");
|
|
47
|
+
return id ? {
|
|
48
|
+
kind: "discussion",
|
|
49
|
+
id
|
|
50
|
+
} : null;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
function mapProductEventToProactive(input) {
|
|
55
|
+
if (!SUPPORTED_EVENT_TYPES.has(input.event.type)) return null;
|
|
56
|
+
const subject = subjectFor(input.event);
|
|
57
|
+
if (!subject) return null;
|
|
58
|
+
const payload = input.event.payload ?? {};
|
|
59
|
+
const occurredAtMs = Number.isFinite(input.event.occurredAtMs) ? input.event.occurredAtMs : Date.now();
|
|
60
|
+
const versionId = stringValue(payload, "messageId") ?? stringValue(payload, "runId") ?? String(occurredAtMs);
|
|
61
|
+
const agentId = stringValue(payload, "agentId") ?? input.defaultAgentId;
|
|
62
|
+
const projectId = stringValue(payload, "projectId");
|
|
63
|
+
return {
|
|
64
|
+
type: `${input.event.type}.v1`,
|
|
65
|
+
schemaVersion: 1,
|
|
66
|
+
source: {
|
|
67
|
+
kind: "internal",
|
|
68
|
+
id: input.event.source ?? "xopc"
|
|
69
|
+
},
|
|
70
|
+
subject,
|
|
71
|
+
actor: { kind: "system" },
|
|
72
|
+
scope: {
|
|
73
|
+
workspaceId: input.workspaceId,
|
|
74
|
+
agentId,
|
|
75
|
+
...projectId ? { projectId } : {}
|
|
76
|
+
},
|
|
77
|
+
occurredAt: new Date(occurredAtMs).toISOString(),
|
|
78
|
+
dedupeKey: `product-event:${input.event.type}:${subject.id}:${versionId}`,
|
|
79
|
+
sensitivity: "personal",
|
|
80
|
+
payload
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { mapProductEventToProactive };
|
|
@@ -1,24 +1,39 @@
|
|
|
1
|
-
import type { ContextProvider } from './types.js';
|
|
1
|
+
import type { ContextProvider, ResolvedContext } from './types.js';
|
|
2
|
+
type ContextInput = Parameters<ContextProvider['collect']>[0];
|
|
2
3
|
export declare class EventBatchContextProvider implements ContextProvider {
|
|
3
4
|
readonly id = "event_batch";
|
|
4
5
|
supports(): boolean;
|
|
5
|
-
collect(input:
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
collect(input: ContextInput): Promise<ResolvedContext>;
|
|
7
|
+
}
|
|
8
|
+
export declare class ConnectedSourceContextProvider implements ContextProvider {
|
|
9
|
+
readonly id = "connected_source";
|
|
10
|
+
supports(): boolean;
|
|
11
|
+
collect(input: ContextInput): Promise<ResolvedContext>;
|
|
12
|
+
}
|
|
13
|
+
export declare class InternalObjectContextProvider implements ContextProvider {
|
|
14
|
+
readonly id = "internal_objects";
|
|
15
|
+
supports(): boolean;
|
|
16
|
+
collect(input: ContextInput): Promise<ResolvedContext>;
|
|
17
|
+
}
|
|
18
|
+
export declare class UserUnderstandingContextProvider implements ContextProvider {
|
|
19
|
+
readonly id = "user_understanding";
|
|
20
|
+
supports(): boolean;
|
|
21
|
+
collect(input: ContextInput): Promise<ResolvedContext>;
|
|
22
|
+
}
|
|
23
|
+
export declare class MeetingWorkspaceContextProvider implements ContextProvider {
|
|
24
|
+
readonly id = "meeting_workspace";
|
|
25
|
+
supports(scenarioKey: string): boolean;
|
|
26
|
+
collect(input: ContextInput): Promise<ResolvedContext>;
|
|
8
27
|
}
|
|
9
28
|
export declare class ProjectStateContextProvider implements ContextProvider {
|
|
10
29
|
readonly id = "project_state";
|
|
11
30
|
supports(scenarioKey: string): boolean;
|
|
12
|
-
collect(input:
|
|
13
|
-
eventIds: string[];
|
|
14
|
-
}): Promise<Record<string, unknown>>;
|
|
31
|
+
collect(input: ContextInput): Promise<ResolvedContext>;
|
|
15
32
|
}
|
|
16
33
|
export declare class AutomationStateContextProvider implements ContextProvider {
|
|
17
34
|
readonly id = "automation_state";
|
|
18
35
|
supports(scenarioKey: string): boolean;
|
|
19
|
-
collect(input:
|
|
20
|
-
eventIds: string[];
|
|
21
|
-
}): Promise<Record<string, unknown>>;
|
|
36
|
+
collect(input: ContextInput): Promise<ResolvedContext>;
|
|
22
37
|
}
|
|
23
38
|
export declare class ContextProviderRegistry {
|
|
24
39
|
private readonly providers;
|
|
@@ -27,5 +42,6 @@ export declare class ContextProviderRegistry {
|
|
|
27
42
|
batchId: string;
|
|
28
43
|
eventIds: string[];
|
|
29
44
|
subscriptionId: string;
|
|
30
|
-
}): Promise<
|
|
45
|
+
}): Promise<ResolvedContext>;
|
|
31
46
|
}
|
|
47
|
+
export {};
|
|
@@ -1,23 +1,226 @@
|
|
|
1
1
|
import { getSqliteDatabase } from "../../storage/sqlite/transaction.js";
|
|
2
|
+
import { listMemoryRecords } from "../../storage/sqlite/memory-records-repository.js";
|
|
3
|
+
import { getKnowledgeSourceItem } from "../../storage/sqlite/knowledge-repository.js";
|
|
4
|
+
import { getConnectorSyncPolicy } from "../../storage/sqlite/connector-sync-policy-repository.js";
|
|
5
|
+
import { wrapExternalContent } from "../../gateway/security/external-content.js";
|
|
2
6
|
//#region src/proactive/execution/context.ts
|
|
7
|
+
const MAX_EVENT_COUNT = 50;
|
|
8
|
+
function boundedText(value, limit) {
|
|
9
|
+
if (typeof value !== "string") return void 0;
|
|
10
|
+
const normalized = value.trim();
|
|
11
|
+
if (!normalized) return void 0;
|
|
12
|
+
return normalized.length > limit ? `${normalized.slice(0, limit)}…` : normalized;
|
|
13
|
+
}
|
|
14
|
+
function eventRows(eventIds) {
|
|
15
|
+
const ids = [...new Set(eventIds)].slice(0, MAX_EVENT_COUNT);
|
|
16
|
+
if (ids.length === 0) return [];
|
|
17
|
+
return getSqliteDatabase().prepare(`SELECT event_id, type, subject_kind, subject_id, payload_json,
|
|
18
|
+
workspace_id, project_id, agent_id, occurred_at FROM proactive_events
|
|
19
|
+
WHERE event_id IN (${ids.map(() => "?").join(",")}) ORDER BY occurred_at`).all(...ids);
|
|
20
|
+
}
|
|
21
|
+
function emptyContext() {
|
|
22
|
+
return {
|
|
23
|
+
content: {},
|
|
24
|
+
snapshotContent: {},
|
|
25
|
+
evidenceIds: []
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function authorizedConnectedSourceItem(event, scenarioKey) {
|
|
29
|
+
const item = getKnowledgeSourceItem(event.subject_id);
|
|
30
|
+
const connectionId = typeof item?.metadata.connectionId === "string" ? item.metadata.connectionId : void 0;
|
|
31
|
+
if (!item || item.deletedAt || !connectionId) return null;
|
|
32
|
+
if (item.sensitivity === "secret" || item.sensitivity === "regulated") return null;
|
|
33
|
+
if (item.metadata.workspaceId !== event.workspace_id) return null;
|
|
34
|
+
if (event.agent_id && item.metadata.agentId && item.metadata.agentId !== event.agent_id) return null;
|
|
35
|
+
const policy = getConnectorSyncPolicy(connectionId);
|
|
36
|
+
const scenarioAllowed = !policy?.allowedScenarioKeys.length || policy.allowedScenarioKeys.includes(scenarioKey);
|
|
37
|
+
return policy?.scanEnabled && policy.proactiveEnabled && scenarioAllowed ? item : null;
|
|
38
|
+
}
|
|
3
39
|
var EventBatchContextProvider = class {
|
|
4
40
|
id = "event_batch";
|
|
5
41
|
supports() {
|
|
6
42
|
return true;
|
|
7
43
|
}
|
|
8
44
|
async collect(input) {
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
45
|
+
const rows = eventRows(input.eventIds).filter((row) => !row.type.startsWith("connected_source.") || Boolean(authorizedConnectedSourceItem(row, input.scenarioKey)));
|
|
46
|
+
return {
|
|
47
|
+
content: { events: rows.map((row) => ({
|
|
48
|
+
evidenceId: row.event_id,
|
|
49
|
+
type: row.type,
|
|
50
|
+
subject: {
|
|
51
|
+
kind: row.subject_kind,
|
|
52
|
+
id: row.subject_id
|
|
53
|
+
},
|
|
54
|
+
payload: JSON.parse(row.payload_json),
|
|
55
|
+
occurredAt: row.occurred_at
|
|
56
|
+
})) },
|
|
57
|
+
evidenceIds: rows.map((row) => row.event_id)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var ConnectedSourceContextProvider = class {
|
|
62
|
+
id = "connected_source";
|
|
63
|
+
supports() {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
async collect(input) {
|
|
67
|
+
const items = [];
|
|
68
|
+
const snapshotItems = [];
|
|
69
|
+
const evidenceIds = [];
|
|
70
|
+
for (const event of eventRows(input.eventIds)) {
|
|
71
|
+
if (!event.type.startsWith("connected_source.") || event.type.includes("_deleted.")) continue;
|
|
72
|
+
const item = authorizedConnectedSourceItem(event, input.scenarioKey);
|
|
73
|
+
if (!item) continue;
|
|
74
|
+
const evidenceId = `source-item:${item.id}`;
|
|
75
|
+
const common = {
|
|
76
|
+
evidenceId,
|
|
77
|
+
sourceItemId: item.id,
|
|
78
|
+
sourceInstanceId: item.sourceInstanceId,
|
|
79
|
+
collectionScope: item.collectionScope,
|
|
80
|
+
itemType: item.itemType,
|
|
81
|
+
occurredAt: item.occurredAt,
|
|
82
|
+
sourceUpdatedAt: item.sourceUpdatedAt
|
|
83
|
+
};
|
|
84
|
+
const content = boundedText(item.normalizedText, 6e3);
|
|
85
|
+
items.push({
|
|
86
|
+
...common,
|
|
87
|
+
...content ? { content: wrapExternalContent(content, { source: item.itemType === "email" || item.itemType === "message" ? "email" : "api" }) } : {}
|
|
88
|
+
});
|
|
89
|
+
snapshotItems.push({
|
|
90
|
+
...common,
|
|
91
|
+
contentHash: item.contentHash,
|
|
92
|
+
sensitivity: item.sensitivity
|
|
93
|
+
});
|
|
94
|
+
evidenceIds.push(evidenceId);
|
|
95
|
+
if (items.length >= 20) break;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
content: { items },
|
|
99
|
+
snapshotContent: { items: snapshotItems },
|
|
100
|
+
evidenceIds
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
var InternalObjectContextProvider = class {
|
|
105
|
+
id = "internal_objects";
|
|
106
|
+
supports() {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
async collect(input) {
|
|
110
|
+
const db = getSqliteDatabase();
|
|
111
|
+
const objects = [];
|
|
112
|
+
const evidenceIds = [];
|
|
113
|
+
for (const event of eventRows(input.eventIds)) {
|
|
114
|
+
if (event.subject_kind === "goal") {
|
|
115
|
+
const goal = db.prepare(`SELECT goal_id, title, description, status, agent_id, priority,
|
|
116
|
+
deadline_at, updated_at, next_action, blocked_reason FROM goals WHERE goal_id = ?`).get(event.subject_id);
|
|
117
|
+
if (goal) {
|
|
118
|
+
const evidenceId = `goal:${event.subject_id}`;
|
|
119
|
+
objects.push({
|
|
120
|
+
evidenceId,
|
|
121
|
+
kind: "goal",
|
|
122
|
+
...goal
|
|
123
|
+
});
|
|
124
|
+
evidenceIds.push(evidenceId);
|
|
125
|
+
}
|
|
126
|
+
} else if (event.subject_kind === "note") {
|
|
127
|
+
const note = db.prepare(`SELECT note_id, title, kind, status, snippet, pinned, tags_json,
|
|
128
|
+
task_done, task_due_at, unchecked_task_count, updated_at FROM notes WHERE note_id = ?`).get(event.subject_id);
|
|
129
|
+
if (note) {
|
|
130
|
+
const evidenceId = `note:${event.subject_id}`;
|
|
131
|
+
objects.push({
|
|
132
|
+
...note,
|
|
133
|
+
evidenceId,
|
|
134
|
+
kind: "note",
|
|
135
|
+
snippet: boundedText(note.snippet, 1500)
|
|
136
|
+
});
|
|
137
|
+
evidenceIds.push(evidenceId);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (objects.length >= 20) break;
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
content: { objects },
|
|
144
|
+
evidenceIds
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
var UserUnderstandingContextProvider = class {
|
|
149
|
+
id = "user_understanding";
|
|
150
|
+
supports() {
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
async collect(input) {
|
|
154
|
+
const scope = eventRows(input.eventIds).at(-1);
|
|
155
|
+
if (!scope) return emptyContext();
|
|
156
|
+
const records = listMemoryRecords({
|
|
157
|
+
workspaceId: scope.workspace_id,
|
|
158
|
+
...scope.project_id ? { visibleToProjectId: scope.project_id } : { unscopedProjectOnly: true },
|
|
159
|
+
status: "active",
|
|
160
|
+
limit: 20
|
|
161
|
+
}).filter((record) => {
|
|
162
|
+
const now = Date.now();
|
|
163
|
+
return record.disclosurePolicy === "referenceable" && record.sensitivity !== "secret" && record.sensitivity !== "regulated" && !record.tags?.includes("playbook:disabled") && (!record.validFrom || Date.parse(record.validFrom) <= now) && (!record.validTo || Date.parse(record.validTo) >= now) && (!record.expiresAt || Date.parse(record.expiresAt) >= now) && (!record.reviewAfter || Date.parse(record.reviewAfter) >= now) && !record.conflictGroupId && (record.explicitness === "explicit" || record.importance >= .7);
|
|
164
|
+
});
|
|
165
|
+
return {
|
|
166
|
+
content: { records: records.map((record) => ({
|
|
167
|
+
evidenceId: `memory:${record.id}`,
|
|
168
|
+
kind: record.kind,
|
|
169
|
+
content: boundedText(record.content, 1e3),
|
|
170
|
+
confidence: record.confidence,
|
|
171
|
+
importance: record.importance,
|
|
172
|
+
updatedAt: record.updatedAt
|
|
173
|
+
})) },
|
|
174
|
+
evidenceIds: records.map((record) => `memory:${record.id}`)
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
var MeetingWorkspaceContextProvider = class {
|
|
179
|
+
id = "meeting_workspace";
|
|
180
|
+
supports(scenarioKey) {
|
|
181
|
+
return scenarioKey === "meeting_preparation";
|
|
182
|
+
}
|
|
183
|
+
async collect(input) {
|
|
184
|
+
const scope = eventRows(input.eventIds).at(-1);
|
|
185
|
+
if (!scope) return emptyContext();
|
|
186
|
+
const calendarItem = authorizedConnectedSourceItem(scope, input.scenarioKey);
|
|
187
|
+
if (!calendarItem?.normalizedText) return emptyContext();
|
|
188
|
+
let title = "";
|
|
189
|
+
try {
|
|
190
|
+
const parsed = JSON.parse(calendarItem.normalizedText);
|
|
191
|
+
title = typeof parsed.title === "string" ? parsed.title : "";
|
|
192
|
+
} catch {
|
|
193
|
+
return emptyContext();
|
|
194
|
+
}
|
|
195
|
+
const terms = [...new Set(title.toLocaleLowerCase().match(/[\p{L}\p{N}]{2,}/gu) ?? [])].slice(0, 6);
|
|
196
|
+
if (terms.length === 0) return emptyContext();
|
|
197
|
+
const db = getSqliteDatabase();
|
|
198
|
+
const goalMatches = terms.map(() => `LOWER(COALESCE(title, '') || ' ' || COALESCE(description, '')
|
|
199
|
+
|| ' ' || COALESCE(next_action, '')) LIKE ?`).join(" OR ");
|
|
200
|
+
const goals = db.prepare(`SELECT goal_id, title, description, status, priority, deadline_at,
|
|
201
|
+
next_action, blocked_reason, project_id, updated_at FROM goals
|
|
202
|
+
WHERE status NOT IN ('done', 'archived') AND agent_id = ? AND (${goalMatches})
|
|
203
|
+
ORDER BY updated_at DESC LIMIT 10`).all(scope.agent_id ?? "main", ...terms.map((term) => `%${term}%`));
|
|
204
|
+
const noteMatches = terms.map(() => `LOWER(COALESCE(title, '') || ' ' || COALESCE(snippet, '')) LIKE ?`).join(" OR ");
|
|
205
|
+
const notes = db.prepare(`SELECT note_id, title, kind, status, snippet, tags_json, task_due_at,
|
|
206
|
+
unchecked_task_count, updated_at FROM notes WHERE status NOT IN ('archived', 'trashed')
|
|
207
|
+
AND (${noteMatches}) ORDER BY updated_at DESC LIMIT 10`).all(...terms.map((term) => `%${term}%`));
|
|
208
|
+
const goalEvidenceIds = goals.map((goal) => `goal:${String(goal.goal_id)}`);
|
|
209
|
+
const noteEvidenceIds = notes.map((note) => `note:${String(note.note_id)}`);
|
|
210
|
+
return {
|
|
211
|
+
content: {
|
|
212
|
+
activeGoals: goals.map((goal, index) => ({
|
|
213
|
+
evidenceId: goalEvidenceIds[index],
|
|
214
|
+
...goal
|
|
215
|
+
})),
|
|
216
|
+
recentNotes: notes.map((note, index) => ({
|
|
217
|
+
evidenceId: noteEvidenceIds[index],
|
|
218
|
+
...note,
|
|
219
|
+
snippet: boundedText(note.snippet, 1500)
|
|
220
|
+
}))
|
|
17
221
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})) };
|
|
222
|
+
evidenceIds: [...goalEvidenceIds, ...noteEvidenceIds]
|
|
223
|
+
};
|
|
21
224
|
}
|
|
22
225
|
};
|
|
23
226
|
var ProjectStateContextProvider = class {
|
|
@@ -26,15 +229,27 @@ var ProjectStateContextProvider = class {
|
|
|
26
229
|
return scenarioKey === "project_delivery_risk" || scenarioKey === "blocked_work";
|
|
27
230
|
}
|
|
28
231
|
async collect(input) {
|
|
29
|
-
if (!input.eventIds.length) return
|
|
232
|
+
if (!input.eventIds.length) return emptyContext();
|
|
30
233
|
const project = getSqliteDatabase().prepare(`SELECT p.* FROM proactive_events e JOIN projects p ON p.project_id = e.project_id
|
|
31
234
|
WHERE e.event_id IN (${input.eventIds.map(() => "?").join(",")}) AND e.project_id IS NOT NULL ORDER BY e.occurred_at DESC LIMIT 1`).get(...input.eventIds);
|
|
32
|
-
if (!project) return
|
|
33
|
-
|
|
34
|
-
project,
|
|
35
|
-
workItems: getSqliteDatabase().prepare(`SELECT id, title, status, priority, owner_agent_id, next_action,
|
|
235
|
+
if (!project) return emptyContext();
|
|
236
|
+
const workItems = getSqliteDatabase().prepare(`SELECT id, title, status, priority, owner_agent_id, next_action,
|
|
36
237
|
blocked_reason, due_at, updated_at FROM work_items WHERE project_id = ? AND archived_at IS NULL
|
|
37
|
-
ORDER BY CASE status WHEN 'blocked' THEN 0 ELSE 1 END, updated_at DESC LIMIT 100`).all(String(project.project_id))
|
|
238
|
+
ORDER BY CASE status WHEN 'blocked' THEN 0 ELSE 1 END, updated_at DESC LIMIT 100`).all(String(project.project_id));
|
|
239
|
+
const projectEvidenceId = `project:${String(project.project_id)}`;
|
|
240
|
+
const workItemEvidenceIds = workItems.map((item) => `work-item:${String(item.id)}`);
|
|
241
|
+
return {
|
|
242
|
+
content: {
|
|
243
|
+
project: {
|
|
244
|
+
evidenceId: projectEvidenceId,
|
|
245
|
+
...project
|
|
246
|
+
},
|
|
247
|
+
workItems: workItems.map((item, index) => ({
|
|
248
|
+
evidenceId: workItemEvidenceIds[index],
|
|
249
|
+
...item
|
|
250
|
+
}))
|
|
251
|
+
},
|
|
252
|
+
evidenceIds: [projectEvidenceId, ...workItemEvidenceIds]
|
|
38
253
|
};
|
|
39
254
|
}
|
|
40
255
|
};
|
|
@@ -44,29 +259,48 @@ var AutomationStateContextProvider = class {
|
|
|
44
259
|
return scenarioKey === "automation_failure_impact";
|
|
45
260
|
}
|
|
46
261
|
async collect(input) {
|
|
47
|
-
if (!input.eventIds.length) return
|
|
262
|
+
if (!input.eventIds.length) return emptyContext();
|
|
48
263
|
const run = getSqliteDatabase().prepare(`SELECT r.* FROM proactive_events e JOIN automation_runs r ON r.run_id = e.subject_id
|
|
49
264
|
WHERE e.event_id IN (${input.eventIds.map(() => "?").join(",")}) ORDER BY e.occurred_at DESC LIMIT 1`).get(...input.eventIds);
|
|
50
|
-
if (!run) return
|
|
265
|
+
if (!run) return emptyContext();
|
|
266
|
+
const automation = getSqliteDatabase().prepare(`SELECT automation_id, name, description, enabled, reliability_json, state_json, project_id
|
|
267
|
+
FROM automations WHERE automation_id = ?`).get(String(run.automation_id));
|
|
268
|
+
const runEvidenceId = `automation-run:${String(run.run_id)}`;
|
|
51
269
|
return {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
270
|
+
content: {
|
|
271
|
+
automation,
|
|
272
|
+
failedRun: {
|
|
273
|
+
evidenceId: runEvidenceId,
|
|
274
|
+
...run
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
evidenceIds: [runEvidenceId]
|
|
55
278
|
};
|
|
56
279
|
}
|
|
57
280
|
};
|
|
58
281
|
var ContextProviderRegistry = class {
|
|
59
282
|
constructor(providers = [
|
|
60
283
|
new EventBatchContextProvider(),
|
|
284
|
+
new ConnectedSourceContextProvider(),
|
|
285
|
+
new InternalObjectContextProvider(),
|
|
286
|
+
new UserUnderstandingContextProvider(),
|
|
287
|
+
new MeetingWorkspaceContextProvider(),
|
|
61
288
|
new ProjectStateContextProvider(),
|
|
62
289
|
new AutomationStateContextProvider()
|
|
63
290
|
]) {
|
|
64
291
|
this.providers = providers;
|
|
65
292
|
}
|
|
66
293
|
async collect(scenarioKey, input) {
|
|
67
|
-
const entries = await Promise.all(this.providers.filter((provider) => provider.supports(scenarioKey)).map(async (provider) => [provider.id, await provider.collect(
|
|
68
|
-
|
|
294
|
+
const entries = await Promise.all(this.providers.filter((provider) => provider.supports(scenarioKey)).map(async (provider) => [provider.id, await provider.collect({
|
|
295
|
+
...input,
|
|
296
|
+
scenarioKey
|
|
297
|
+
})]));
|
|
298
|
+
return {
|
|
299
|
+
content: Object.fromEntries(entries.map(([id, result]) => [id, result.content])),
|
|
300
|
+
snapshotContent: Object.fromEntries(entries.map(([id, result]) => [id, result.snapshotContent ?? result.content])),
|
|
301
|
+
evidenceIds: [...new Set(entries.flatMap(([, result]) => result.evidenceIds))]
|
|
302
|
+
};
|
|
69
303
|
}
|
|
70
304
|
};
|
|
71
305
|
//#endregion
|
|
72
|
-
export { AutomationStateContextProvider, ContextProviderRegistry, EventBatchContextProvider, ProjectStateContextProvider };
|
|
306
|
+
export { AutomationStateContextProvider, ConnectedSourceContextProvider, ContextProviderRegistry, EventBatchContextProvider, InternalObjectContextProvider, MeetingWorkspaceContextProvider, ProjectStateContextProvider, UserUnderstandingContextProvider };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSqliteDatabase, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
2
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
3
3
|
//#region src/proactive/execution/repository.ts
|
|
4
4
|
const str = (row, key) => String(row[key]);
|
|
5
5
|
function claimNextRun(owner, now = /* @__PURE__ */ new Date(), leaseSeconds = 120) {
|
|
@@ -69,11 +69,23 @@ function attachSnapshot(runId, snapshotId) {
|
|
|
69
69
|
function finishRun(input, now = /* @__PURE__ */ new Date()) {
|
|
70
70
|
return runSqliteWriteTransaction((db) => {
|
|
71
71
|
const nowIso = now.toISOString();
|
|
72
|
-
const
|
|
72
|
+
const subjectScope = db.prepare(`SELECT DISTINCT e.subject_kind, e.subject_id
|
|
73
|
+
FROM proactive_batch_events be
|
|
74
|
+
JOIN proactive_events e ON e.event_id = be.event_id
|
|
75
|
+
WHERE be.batch_id = ?
|
|
76
|
+
ORDER BY e.subject_kind, e.subject_id`).all(input.run.batchId).map((row) => `${str(row, "subject_kind")}:${str(row, "subject_id")}`);
|
|
77
|
+
const fingerprint = input.candidate ? createHash("sha256").update([...subjectScope, ...[
|
|
78
|
+
input.candidate.title,
|
|
79
|
+
input.candidate.summary,
|
|
80
|
+
input.candidate.recommendation
|
|
81
|
+
].map((value) => value.trim().toLowerCase().replace(/\s+/g, " "))].join("\n")).digest("hex") : void 0;
|
|
82
|
+
const duplicate = fingerprint ? db.prepare(`SELECT 1 FROM proactive_insights
|
|
83
|
+
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() - 10080 * 6e4)).toISOString()) : void 0;
|
|
84
|
+
const valuable = Boolean(input.candidate) && !duplicate;
|
|
73
85
|
db.prepare(`UPDATE proactive_runs SET status = ?, raw_output = ?, model_ref = ?, lease_owner = NULL,
|
|
74
86
|
lease_expires_at = NULL, completed_at = ?, updated_at = ? WHERE run_id = ?`).run(valuable ? "completed" : "discarded", input.rawOutput.slice(0, 2e4), input.modelRef ?? null, nowIso, nowIso, input.run.id);
|
|
75
87
|
db.prepare(`UPDATE proactive_signal_batches SET status = ?, updated_at = ? WHERE batch_id = ?`).run(valuable ? "processed" : "ignored", nowIso, input.run.batchId);
|
|
76
|
-
if (!input.candidate) return null;
|
|
88
|
+
if (!input.candidate || duplicate) return null;
|
|
77
89
|
const insight = {
|
|
78
90
|
...input.candidate,
|
|
79
91
|
id: randomUUID(),
|
|
@@ -84,8 +96,9 @@ function finishRun(input, now = /* @__PURE__ */ new Date()) {
|
|
|
84
96
|
createdAt: nowIso
|
|
85
97
|
};
|
|
86
98
|
db.prepare(`INSERT INTO proactive_insights (insight_id, run_id, subscription_id, scenario_key, title, summary,
|
|
87
|
-
why_now, impact, recommendation, work_done, decision_json, urgency, confidence, value_score,
|
|
88
|
-
|
|
99
|
+
why_now, impact, recommendation, work_done, decision_json, urgency, confidence, value_score,
|
|
100
|
+
evidence_ids_json, content_fingerprint, created_at)
|
|
101
|
+
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.urgency, insight.confidence, insight.valueScore, JSON.stringify(insight.evidenceIds), fingerprint, insight.createdAt);
|
|
89
102
|
return insight;
|
|
90
103
|
});
|
|
91
104
|
}
|
|
@@ -47,8 +47,14 @@ export interface ContextProvider {
|
|
|
47
47
|
id: string;
|
|
48
48
|
supports(scenarioKey: string): boolean;
|
|
49
49
|
collect(input: {
|
|
50
|
+
scenarioKey: string;
|
|
50
51
|
batchId: string;
|
|
51
52
|
eventIds: string[];
|
|
52
53
|
subscriptionId: string;
|
|
53
|
-
}): Promise<
|
|
54
|
+
}): Promise<ResolvedContext>;
|
|
55
|
+
}
|
|
56
|
+
export interface ResolvedContext {
|
|
57
|
+
content: Record<string, unknown>;
|
|
58
|
+
snapshotContent?: Record<string, unknown>;
|
|
59
|
+
evidenceIds: string[];
|
|
54
60
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { markReadyBatches } from "../routing/batch-repository.js";
|
|
4
3
|
import { getPromptRevision, getScenario } from "../scenarios/repository.js";
|
|
5
4
|
import { composeScenarioPrompt } from "../scenarios/prompt-composer.js";
|
|
5
|
+
import { markReadyBatches } from "../routing/batch-repository.js";
|
|
6
6
|
import { ContextProviderRegistry } from "./context.js";
|
|
7
7
|
import { attachSnapshot, claimNextRun, eventIdsForBatch, failRun, finishRun, saveSnapshot } from "./repository.js";
|
|
8
8
|
import { isValuableInsight, parseInsightCandidate, scoreInsight } from "./insight.js";
|
|
@@ -49,7 +49,7 @@ var ProactiveWorker = class {
|
|
|
49
49
|
eventIds,
|
|
50
50
|
subscriptionId: run.subscriptionId
|
|
51
51
|
});
|
|
52
|
-
const snapshot = saveSnapshot(run.batchId, context,
|
|
52
|
+
const snapshot = saveSnapshot(run.batchId, context.snapshotContent ?? context.content, context.evidenceIds);
|
|
53
53
|
attachSnapshot(run.id, snapshot.id);
|
|
54
54
|
const prompt = composeScenarioPrompt({
|
|
55
55
|
scenario,
|
|
@@ -59,9 +59,9 @@ var ProactiveWorker = class {
|
|
|
59
59
|
const output = await this.executor.execute({
|
|
60
60
|
systemPrompt: prompt.platformSafety,
|
|
61
61
|
userPrompt: prompt.text,
|
|
62
|
-
authorizedContext: context
|
|
62
|
+
authorizedContext: context.content
|
|
63
63
|
});
|
|
64
|
-
const candidate = parseInsightCandidate(output.text, new Set(
|
|
64
|
+
const candidate = parseInsightCandidate(output.text, new Set(context.evidenceIds));
|
|
65
65
|
const valuable = isValuableInsight(candidate);
|
|
66
66
|
const insight = finishRun({
|
|
67
67
|
run,
|
|
@@ -72,12 +72,13 @@ var ProactiveWorker = class {
|
|
|
72
72
|
rawOutput: output.text,
|
|
73
73
|
modelRef: output.modelRef
|
|
74
74
|
});
|
|
75
|
+
const disposition = insight ? "created" : valuable ? "duplicate_suppressed" : "value_gate_discarded";
|
|
75
76
|
log.info({
|
|
76
77
|
runId: run.id,
|
|
77
78
|
scenarioKey: run.scenarioKey,
|
|
78
|
-
|
|
79
|
+
disposition,
|
|
79
80
|
insightId: insight?.id
|
|
80
|
-
},
|
|
81
|
+
}, insight ? "Proactive insight created" : "Proactive output discarded");
|
|
81
82
|
} catch (error) {
|
|
82
83
|
failRun(run, error, !(error instanceof Error && /Pinned scenario/.test(error.message)));
|
|
83
84
|
log.warn({
|
|
@@ -32,8 +32,14 @@ const SELECT_ITEM = `SELECT i.*, x.subscription_id, x.scenario_key, x.title, x.s
|
|
|
32
32
|
JOIN proactive_insights x ON x.insight_id = i.insight_id`;
|
|
33
33
|
function projectInsightsToInbox(now = /* @__PURE__ */ new Date()) {
|
|
34
34
|
return runSqliteWriteTransaction((db) => {
|
|
35
|
-
const missing = db.prepare(`SELECT insight_id FROM proactive_insights
|
|
36
|
-
|
|
35
|
+
const missing = db.prepare(`SELECT x.insight_id FROM proactive_insights x
|
|
36
|
+
JOIN proactive_runs r ON r.run_id = x.run_id
|
|
37
|
+
JOIN proactive_signal_batches b ON b.batch_id = r.batch_id
|
|
38
|
+
LEFT JOIN project_monitoring_policies p
|
|
39
|
+
ON b.aggregation_key = 'project:' || p.project_id
|
|
40
|
+
WHERE x.insight_id NOT IN (SELECT insight_id FROM proactive_inbox_items)
|
|
41
|
+
AND (p.project_id IS NULL OR (p.mode != 'observe' AND x.confidence >= p.confidence_threshold))
|
|
42
|
+
ORDER BY x.created_at`).all();
|
|
37
43
|
for (const row of missing) {
|
|
38
44
|
const id = randomUUID();
|
|
39
45
|
const nowIso = now.toISOString();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { normalizeEventEnvelope } from './events/envelope.js';
|
|
2
|
+
export { mapProductEventToProactive } from './events/product-event-bridge.js';
|
|
2
3
|
export type { EventEnvelope, PublishEventInput, PublishedEvent } from './events/types.js';
|
|
3
4
|
export type { ProactiveSignalPublisher } from './events/publisher.js';
|
|
4
5
|
export { matchesCondition, matchScenario } from './routing/matcher.js';
|
|
@@ -7,11 +8,12 @@ export type { SignalBatch } from './routing/batch-repository.js';
|
|
|
7
8
|
export { ProactiveEventService } from './service.js';
|
|
8
9
|
export { ProactiveScenarioService } from './scenarios/service.js';
|
|
9
10
|
export type { PromptRevision, ScenarioDefinition, ScenarioSubscription } from './scenarios/types.js';
|
|
10
|
-
export { AutomationStateContextProvider, ContextProviderRegistry, EventBatchContextProvider, ProjectStateContextProvider } from './execution/context.js';
|
|
11
|
+
export { AutomationStateContextProvider, ConnectedSourceContextProvider, ContextProviderRegistry, EventBatchContextProvider, InternalObjectContextProvider, MeetingWorkspaceContextProvider, ProjectStateContextProvider, UserUnderstandingContextProvider, } from './execution/context.js';
|
|
11
12
|
export { ReadonlyProactiveAgentExecutor } from './execution/agent-executor.js';
|
|
12
13
|
export { listInsights } from './execution/repository.js';
|
|
13
14
|
export { ProactiveWorker } from './execution/worker.js';
|
|
14
|
-
export
|
|
15
|
+
export { ProactiveTemporalWorker, type TemporalTickResult } from './temporal/worker.js';
|
|
16
|
+
export type { ContextProvider, ContextSnapshot, InsightCandidate, ProactiveAgentExecutor, ProactiveInsight, ResolvedContext, } from './execution/types.js';
|
|
15
17
|
export { ProactiveInboxService } from './inbox/service.js';
|
|
16
18
|
export { ProactiveInboxWorker } from './inbox/worker.js';
|
|
17
19
|
export type { InboxDelivery, InboxDeliveryAdapter, InboxItem, InboxStatus } from './inbox/types.js';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { ProactiveScenarioService } from "./scenarios/service.js";
|
|
1
2
|
import { normalizeEventEnvelope } from "./events/envelope.js";
|
|
3
|
+
import { mapProductEventToProactive } from "./events/product-event-bridge.js";
|
|
2
4
|
import { matchScenario, matchesCondition } from "./routing/matcher.js";
|
|
3
5
|
import { ProactiveEventService } from "./service.js";
|
|
4
|
-
import {
|
|
5
|
-
import { AutomationStateContextProvider, ContextProviderRegistry, EventBatchContextProvider, ProjectStateContextProvider } from "./execution/context.js";
|
|
6
|
+
import { AutomationStateContextProvider, ConnectedSourceContextProvider, ContextProviderRegistry, EventBatchContextProvider, InternalObjectContextProvider, MeetingWorkspaceContextProvider, ProjectStateContextProvider, UserUnderstandingContextProvider } from "./execution/context.js";
|
|
6
7
|
import { ReadonlyProactiveAgentExecutor } from "./execution/agent-executor.js";
|
|
7
8
|
import { listInsights } from "./execution/repository.js";
|
|
8
9
|
import { ProactiveWorker } from "./execution/worker.js";
|
|
10
|
+
import { ProactiveTemporalWorker } from "./temporal/worker.js";
|
|
9
11
|
import { ProactiveInboxService } from "./inbox/service.js";
|
|
10
12
|
import { ProactiveInboxWorker } from "./inbox/worker.js";
|
|
11
|
-
export { AutomationStateContextProvider, ContextProviderRegistry, EventBatchContextProvider, ProactiveEventService, ProactiveInboxService, ProactiveInboxWorker, ProactiveScenarioService, ProactiveWorker, ProjectStateContextProvider, ReadonlyProactiveAgentExecutor, listInsights, matchScenario, matchesCondition, normalizeEventEnvelope };
|
|
13
|
+
export { AutomationStateContextProvider, ConnectedSourceContextProvider, ContextProviderRegistry, EventBatchContextProvider, InternalObjectContextProvider, MeetingWorkspaceContextProvider, ProactiveEventService, ProactiveInboxService, ProactiveInboxWorker, ProactiveScenarioService, ProactiveTemporalWorker, ProactiveWorker, ProjectStateContextProvider, ReadonlyProactiveAgentExecutor, UserUnderstandingContextProvider, listInsights, mapProductEventToProactive, matchScenario, matchesCondition, normalizeEventEnvelope };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ProactiveEventService } from '../service.js';
|
|
2
|
+
export type TemporalTickResult = {
|
|
3
|
+
scanned: number;
|
|
4
|
+
published: number;
|
|
5
|
+
skipped: number;
|
|
6
|
+
};
|
|
7
|
+
export declare class ProactiveTemporalWorker {
|
|
8
|
+
private readonly events;
|
|
9
|
+
private readonly intervalMs;
|
|
10
|
+
private timer;
|
|
11
|
+
private running;
|
|
12
|
+
constructor(events: ProactiveEventService, intervalMs?: number);
|
|
13
|
+
start(): void;
|
|
14
|
+
stop(): void;
|
|
15
|
+
tick(now?: Date): Promise<TemporalTickResult>;
|
|
16
|
+
}
|