@xopcai/xopc 0.0.177 → 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-Wu2ikfbM.js → activity-store-A5FUMjeV.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0_biISn.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-DljBt-N5.js → api-Bmzslx0Z.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CKoZRi7Y.js → app-management-settings-panel-DDWS_BBJ.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DOdXhNDo.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-D18gyP76.js → archive-plugin-fvTZhPUr.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CZh9fc8u.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-DdSyGL6M.js → binary-plugins-CuI2bOc7.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BOpNApiX.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-C0SnSj_R.js → browser-workflow-inputs-gs6b5e9-.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CzlzH7HA.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-RM6S7ES5.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-B4sha-30.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-BPsKIyoM.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-BoZGualI.js → directory-picker-path-field-B6fc_7SL.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-s3gn3f9h.js → dreaming-settings-CUQxGnDf.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-DIbMngCF.js → extension-debug-page-AbRNi2ON.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D94f2bWQ.js → extension-page-ClYfiLXC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-B7TI13ex.js → extension-settings-page-BGVP2hw1.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-Do77rV8R.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-WaXTw3fi.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-C3kzg6ai.js → heartbeat-settings-CTI2nPKa.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-BgISY8i-.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-0KSmaPu0.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-BMrU8u7w.js → local-apps-page-CF5uUd1n.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DVGhFXRz.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-BVqbtN9o.js → markdown-split-CN85EdB8.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Dr_wtkNJ.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-BWZRXsq6.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-DWWgy0bF.js → page-tabs-tQNQcAts.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Bnfs93ZP.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-BR7QFmT-.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-BzS-rRTP.js → save-bar-controls-BsPf5Gkk.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-Cl2IIDAN.js → schedule-field-kAytH7mq.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BjKjp5eZ.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-BSDNBfHn.js → settings-form-section-BqbibcnJ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BD4peoAv.js → settings-loading-skeleton-DNLNCEGT.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-S-P3U7at.js → settings-page-BR6Ss0bK.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BQTLh-86.js → settings-page-layout-Cdb1e2Cz.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-W3p6kNyA.js → setup-status-panel-moT-D-ia.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DQjMxyvw.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-CXnpudm6.js → skills-page.utils-BG5dGkyA.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BhFwdYJP.js → system-settings-panel-XdY8eyYf.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DQI-HPL-.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-C-M3Fv2N.js → typed-models-lib-DOnpwsrE.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-Bndq4y4I.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-p_g4UI1-.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-CHEXVvhH.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/embedded/model-runtime.js +3 -0
- package/dist/src/agent/embedded/run-for-session.js +18 -5
- package/dist/src/agent/embedded/run-turn.js +6 -3
- package/dist/src/agent/embedded/types.d.ts +2 -0
- 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/config/agent-profile.js +1 -1
- package/dist/src/connectors/composio-sessions.js +1 -1
- 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 +2 -2
- 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/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/browser-install.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/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/providers/provider-auth-service.js +3 -0
- package/dist/src/providers/register-bundled-oauth-flows.d.ts +2 -0
- package/dist/src/providers/register-bundled-oauth-flows.js +16 -0
- package/dist/src/session/store.d.ts +2 -0
- package/dist/src/session/store.js +30 -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 +3 -11
- package/dist/gateway/static/root/assets/agents-TpIpJk59.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-Cxbn5hy8.js +0 -1
- package/dist/gateway/static/root/assets/automation-suggestion-card-DKrVoiiK.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-DYv16QMU.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DlcqaGu1.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-QPX4wsGZ.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DmCeusO8.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-HcKoP1wm.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-D3xr2enH.js +0 -1
- package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DwbThFvd.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-DjL1GWON.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-u_abAXh7.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-Dt1PNJmb.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-DEiOOLGU.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-C1Qj4o1K.js +0 -4
- package/dist/gateway/static/root/assets/goals-config-api-BL0fAEns.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-qJDcEDzc.js +0 -2
- package/dist/gateway/static/root/assets/goals-settings-DV3ZlrdI.js +0 -1
- package/dist/gateway/static/root/assets/index-C1h0zkNo.js +0 -212
- package/dist/gateway/static/root/assets/index-Da36E3WH.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DcD4mVId.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-CW5m9Cov.js +0 -7
- package/dist/gateway/static/root/assets/messages-r8L6Ur3A.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-DdnwNz9x.js +0 -4
- package/dist/gateway/static/root/assets/product-delivery-BTRT9kCS.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-B8GeS4dl.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DOeu1Hk_.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-De94rxnE.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-A7p8G0OJ.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BsGzjmqx.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Xo3N99PO.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-ByPEG5t1.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-C019Ml5q.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-C0DCya4U.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-fYBzpus-.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-DI0gCZRw.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DnBRP2wI.js +0 -1
- package/dist/gateway/static/root/assets/work-page-Z-nUaS_n.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-BDfwnM-Y.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
|
@@ -2,9 +2,10 @@ import { inboundCorrelationMetadataFromAsyncLogContext, updateAsyncLogContext }
|
|
|
2
2
|
import { createLogger } from "../../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../../utils/logger.js";
|
|
4
4
|
import { updateInteractionStateFromMessage } from "../../storage/sqlite/interaction-state-repository.js";
|
|
5
|
-
import { completeTaskOutcome, startTaskOutcome, updateTaskOutcome } from "../../storage/sqlite/task-outcome-repository.js";
|
|
6
5
|
import "../../storage/sqlite/index.js";
|
|
7
6
|
import { init_session_key, parseSessionKey } from "../../routing/session-key.js";
|
|
7
|
+
import { resolveExecutionContext } from "../../work/execution-context.js";
|
|
8
|
+
import { OutcomeRunCoordinator } from "../../work/outcome-run-coordinator.js";
|
|
8
9
|
import { recordExplicitRelationshipFollowUp } from "../../user-context/relationship-continuity.js";
|
|
9
10
|
import { formatAgentRunErrorForClient } from "../../agent/client-error-format.js";
|
|
10
11
|
import { prependEnvelopeTimestamp } from "../../channels/envelope-timestamp.js";
|
|
@@ -30,13 +31,12 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
30
31
|
const runId = crypto.randomUUID();
|
|
31
32
|
const { agentService, bus, runRelay, runAbortControllers, activeWebchatRunBySession, sessionIndex: sessionIndexFromDeps, emit } = deps;
|
|
32
33
|
const sessionIndex = sessionIndexFromDeps;
|
|
33
|
-
let
|
|
34
|
-
let
|
|
35
|
-
let
|
|
36
|
-
let taskContract;
|
|
37
|
-
const taskEvidence = [];
|
|
34
|
+
let outcomeRun;
|
|
35
|
+
let executionReceiptStatus = "failed";
|
|
36
|
+
let executionReceiptSummary = "Agent run ended unexpectedly";
|
|
38
37
|
let webchatSessionKey;
|
|
39
38
|
let webchatSessionId;
|
|
39
|
+
let webchatMetadata;
|
|
40
40
|
let webchatStaleSkip = false;
|
|
41
41
|
if (channel === "webchat") {
|
|
42
42
|
const resolved = resolveWebchatSessionKey({ sessionKey: chatId });
|
|
@@ -45,6 +45,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
45
45
|
const meta = await sessionIndex.getSessionMetadata(webchatSessionKey);
|
|
46
46
|
if (!meta) throw new Error("Session not found; create sessions via POST /api/sessions");
|
|
47
47
|
webchatSessionId = meta?.sessionId;
|
|
48
|
+
webchatMetadata = meta;
|
|
48
49
|
webchatStaleSkip = shouldSkipWebchatInboundByAbortCutoff(meta, runOptions?.clientCreatedAtMs);
|
|
49
50
|
if (!webchatStaleSkip && meta?.abortCutoffTimestamp !== void 0) await sessionIndex.updateSessionMetadata(webchatSessionKey, { abortCutoffTimestamp: void 0 }).catch(() => {});
|
|
50
51
|
runRelay.ensureRun(runId, webchatSessionKey);
|
|
@@ -52,6 +53,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
52
53
|
}
|
|
53
54
|
const streamSessionKey = webchatSessionKey ?? chatId;
|
|
54
55
|
if (webchatSessionKey) {
|
|
56
|
+
if (!webchatMetadata) throw new Error("Session metadata is unavailable");
|
|
55
57
|
const parsedSession = parseSessionKey(webchatSessionKey);
|
|
56
58
|
if (!parsedSession) throw new Error("Resolved webchat session key is invalid");
|
|
57
59
|
updateInteractionStateFromMessage({
|
|
@@ -63,13 +65,17 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
63
65
|
sourceAgentId: parsedSession.agentId,
|
|
64
66
|
message
|
|
65
67
|
});
|
|
66
|
-
|
|
68
|
+
const executionContext = resolveExecutionContext({
|
|
67
69
|
runId,
|
|
68
70
|
sessionKey: webchatSessionKey,
|
|
69
71
|
channel,
|
|
70
|
-
|
|
72
|
+
metadata: webchatMetadata
|
|
73
|
+
});
|
|
74
|
+
outcomeRun = OutcomeRunCoordinator.start({
|
|
75
|
+
runId,
|
|
76
|
+
context: executionContext,
|
|
77
|
+
fallbackObjective: message
|
|
71
78
|
});
|
|
72
|
-
taskOutcomeStarted = true;
|
|
73
79
|
}
|
|
74
80
|
const mapper = new ChatStreamMapper({
|
|
75
81
|
runId,
|
|
@@ -77,39 +83,28 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
77
83
|
channel
|
|
78
84
|
});
|
|
79
85
|
let registeredActiveWebchatRun = false;
|
|
80
|
-
const addTaskEvidence = (evidence) => {
|
|
81
|
-
if (taskEvidence.some((item) => item.kind === evidence.kind && item.title === evidence.title)) return;
|
|
82
|
-
taskEvidence.push(evidence);
|
|
83
|
-
};
|
|
84
86
|
const captureTaskEvent = (event) => {
|
|
87
|
+
if (event.type === "task_plan_updated") {
|
|
88
|
+
outcomeRun?.capturePlan(event.payload.items);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
85
91
|
if (event.type === "turn_plan") {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
constraints: [],
|
|
91
|
-
approvalRequired: []
|
|
92
|
-
};
|
|
92
|
+
outcomeRun?.capturePlan(event.payload.plan.map((item) => ({
|
|
93
|
+
title: item.step,
|
|
94
|
+
status: item.status
|
|
95
|
+
})));
|
|
93
96
|
return;
|
|
94
97
|
}
|
|
95
98
|
if (event.type === "patch_applied") {
|
|
96
|
-
|
|
97
|
-
kind: "state",
|
|
98
|
-
title: "Changes applied",
|
|
99
|
-
summary: `${event.payload.added} additions and ${event.payload.removed} removals`
|
|
100
|
-
});
|
|
99
|
+
outcomeRun?.capturePatch(event.payload.added, event.payload.removed);
|
|
101
100
|
return;
|
|
102
101
|
}
|
|
103
|
-
if (event.type === "command_completed" && event.payload.exitCode === 0 && /(^|\s)(test|vitest|jest|pytest|lint|typecheck|build)(\s|$|:)/i.test(event.payload.command))
|
|
104
|
-
kind: "test",
|
|
105
|
-
title: event.payload.command.slice(0, 120),
|
|
106
|
-
summary: event.payload.durationMs === void 0 ? "Command completed successfully" : `Command completed successfully in ${event.payload.durationMs} ms`
|
|
107
|
-
});
|
|
102
|
+
if (event.type === "command_completed" && event.payload.exitCode === 0 && /(^|\s)(test|vitest|jest|pytest|lint|typecheck|build)(\s|$|:)/i.test(event.payload.command)) outcomeRun?.captureCommand(event.payload.command, event.payload.durationMs);
|
|
108
103
|
};
|
|
109
104
|
const publishStreamEvent = (event) => channel === "webchat" ? runRelay.publish(runId, event) ?? event : event;
|
|
110
105
|
const emitAndYield = function* (events) {
|
|
111
106
|
for (const event of events) {
|
|
112
|
-
if (
|
|
107
|
+
if (outcomeRun) captureTaskEvent(event);
|
|
113
108
|
const relayedEvent = publishStreamEvent(event);
|
|
114
109
|
if (channel === "webchat") emit("agent.stream", {
|
|
115
110
|
sessionKey: streamSessionKey,
|
|
@@ -122,8 +117,8 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
122
117
|
try {
|
|
123
118
|
if (channel === "webchat" && webchatSessionKey) {
|
|
124
119
|
if (webchatStaleSkip) {
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
executionReceiptStatus = "cancelled";
|
|
121
|
+
executionReceiptSummary = "Stale inbound message skipped";
|
|
127
122
|
yield* emitAndYield(mapper.end("cancelled", "Stale inbound after abort (clientCreatedAtMs before cutoff)"));
|
|
128
123
|
runRelay.complete(runId);
|
|
129
124
|
runAbortControllers.delete(runId);
|
|
@@ -160,8 +155,8 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
160
155
|
for await (const event of coalesceThinkingDeltas(mappedEvents)) yield* emitAndYield([event]);
|
|
161
156
|
const endStatus = mergedSignal.aborted ? "cancelled" : "success";
|
|
162
157
|
const endSummary = mergedSignal.aborted ? "Interrupted" : "Message processed successfully";
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
executionReceiptStatus = mergedSignal.aborted ? "cancelled" : "succeeded";
|
|
159
|
+
executionReceiptSummary = endSummary;
|
|
165
160
|
yield* emitAndYield(mapper.end(endStatus, endSummary));
|
|
166
161
|
runRelay.complete(runId);
|
|
167
162
|
try {
|
|
@@ -186,8 +181,8 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
186
181
|
channel: "webchat"
|
|
187
182
|
}, `Agent processing failed: ${em}`);
|
|
188
183
|
streamError = em;
|
|
189
|
-
|
|
190
|
-
|
|
184
|
+
executionReceiptStatus = "failed";
|
|
185
|
+
executionReceiptSummary = em;
|
|
191
186
|
const errorContent = formatAgentRunErrorForClient(streamError);
|
|
192
187
|
yield* emitAndYield(mapper.error(errorContent));
|
|
193
188
|
yield* emitAndYield(mapper.end("error", streamError));
|
|
@@ -265,16 +260,16 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
265
260
|
payload: { messageId }
|
|
266
261
|
}]);
|
|
267
262
|
yield* emitAndYield(mapper.end("success", "Message processed"));
|
|
268
|
-
|
|
269
|
-
|
|
263
|
+
executionReceiptStatus = "succeeded";
|
|
264
|
+
executionReceiptSummary = "Message processed";
|
|
270
265
|
return {
|
|
271
266
|
status: "ok",
|
|
272
267
|
summary: "Message processed"
|
|
273
268
|
};
|
|
274
269
|
} catch (error) {
|
|
275
270
|
const em = error instanceof Error ? error.message : String(error);
|
|
276
|
-
|
|
277
|
-
|
|
271
|
+
executionReceiptStatus = "failed";
|
|
272
|
+
executionReceiptSummary = em;
|
|
278
273
|
log.error({
|
|
279
274
|
err: error,
|
|
280
275
|
errorMessage: em,
|
|
@@ -285,17 +280,17 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
285
280
|
}, `Agent run failed: ${em}`);
|
|
286
281
|
throw error;
|
|
287
282
|
} finally {
|
|
288
|
-
if (
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
evidence: taskEvidence
|
|
293
|
-
});
|
|
294
|
-
completeTaskOutcome({
|
|
295
|
-
runId,
|
|
296
|
-
status: taskOutcomeStatus,
|
|
297
|
-
summary: taskOutcomeSummary
|
|
283
|
+
if (outcomeRun) try {
|
|
284
|
+
outcomeRun.finalize({
|
|
285
|
+
status: executionReceiptStatus,
|
|
286
|
+
summary: executionReceiptSummary
|
|
298
287
|
});
|
|
288
|
+
} catch (err) {
|
|
289
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
290
|
+
log.warn({
|
|
291
|
+
err,
|
|
292
|
+
runId
|
|
293
|
+
}, `Outcome run finalization failed: ${errorMessage}`);
|
|
299
294
|
}
|
|
300
295
|
}
|
|
301
296
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AgentService } from '../agent/service.js';
|
|
2
2
|
import { MessageBus } from '../infra/bus/index.js';
|
|
3
3
|
import { AutomationService } from '../automations/index.js';
|
|
4
|
+
import { DiscussionLiveWorker, DiscussionService, DiscussionWorker } from '../discussions/index.js';
|
|
4
5
|
import { NotesService } from '../notes/index.js';
|
|
5
6
|
import { WorkflowRunService } from '../workflows/service/workflow-run-service.js';
|
|
6
7
|
import { ExtensionLoader } from '../extensions/index.js';
|
|
@@ -14,7 +15,7 @@ import { ProjectService } from '../projects/index.js';
|
|
|
14
15
|
import { LocalAppService } from '../local-apps/index.js';
|
|
15
16
|
import { WorkItemService } from '../work-items/index.js';
|
|
16
17
|
import { type BrowserRecipeService } from '../browser/recipes/index.js';
|
|
17
|
-
import { listInsights, ProactiveEventService, ProactiveInboxService, ProactiveInboxWorker, ProactiveScenarioService, ProactiveWorker } from '../proactive/index.js';
|
|
18
|
+
import { listInsights, ProactiveEventService, ProactiveInboxService, ProactiveInboxWorker, ProactiveScenarioService, ProactiveTemporalWorker, ProactiveWorker } from '../proactive/index.js';
|
|
18
19
|
import { GatewaySessionsApi } from './service/sessions-api.js';
|
|
19
20
|
import { GatewayMarketplaceService } from './service/marketplace-service.js';
|
|
20
21
|
import { GatewayAgentRunner } from './service/agent-runner.js';
|
|
@@ -67,6 +68,7 @@ export declare class GatewayService {
|
|
|
67
68
|
private mobileNotifications;
|
|
68
69
|
private connectorSupervisor;
|
|
69
70
|
private connectorLearningCoordinator;
|
|
71
|
+
private connectedSourceChangePublisher;
|
|
70
72
|
private connectedKnowledgeCoordinator;
|
|
71
73
|
private stopAutomationProductEventBridge;
|
|
72
74
|
private stopSessionTranscriptAutomationEvents;
|
|
@@ -92,6 +94,9 @@ export declare class GatewayService {
|
|
|
92
94
|
/** First-class project grouping surface. */
|
|
93
95
|
readonly projects: ProjectService;
|
|
94
96
|
readonly workItems: WorkItemService;
|
|
97
|
+
readonly discussions: DiscussionService;
|
|
98
|
+
readonly discussionWorker: DiscussionWorker;
|
|
99
|
+
readonly discussionLiveWorker: DiscussionLiveWorker;
|
|
95
100
|
/** Local user-created apps, their coder projects, previews, and installs. */
|
|
96
101
|
readonly localApps: LocalAppService;
|
|
97
102
|
/** Unified durable event spine for proactive scenarios. */
|
|
@@ -100,6 +105,7 @@ export declare class GatewayService {
|
|
|
100
105
|
readonly proactiveInbox: ProactiveInboxService;
|
|
101
106
|
readonly proactiveInsights: typeof listInsights;
|
|
102
107
|
readonly proactiveWorker: ProactiveWorker;
|
|
108
|
+
readonly proactiveTemporalWorker: ProactiveTemporalWorker;
|
|
103
109
|
readonly proactiveInboxWorker: ProactiveInboxWorker;
|
|
104
110
|
constructor(serviceConfig?: GatewayServiceConfig);
|
|
105
111
|
/** Lazy AgentService — constructed on first use or during `start()`. */
|
|
@@ -130,6 +136,7 @@ export declare class GatewayService {
|
|
|
130
136
|
private schedulePostReadySidecars;
|
|
131
137
|
private runPostReadySidecars;
|
|
132
138
|
start(): Promise<void>;
|
|
139
|
+
private ensureDefaultProactiveScenarioSubscriptions;
|
|
133
140
|
/** Called when the HTTP listener is bound (before deferred channel work). */
|
|
134
141
|
markHttpListening(): void;
|
|
135
142
|
isGatewayReady(): boolean;
|
|
@@ -22,8 +22,22 @@ import { GoalRunner } from "../goals/goal-runner.js";
|
|
|
22
22
|
import { GoalNotificationService } from "../goals/goal-notifications.js";
|
|
23
23
|
import "../goals/index.js";
|
|
24
24
|
import { resolveEffectiveGatewayPort } from "./host.js";
|
|
25
|
+
import { sanitizeTunnelConfig } from "../tunnel/tunnel-config.js";
|
|
26
|
+
import { wireTunnelEventsToGateway } from "../tunnel/gateway-lifecycle.js";
|
|
27
|
+
import { buckets } from "./rate-limit/buckets.js";
|
|
28
|
+
import { isGatewayStrictSecurityEnabled } from "./rate-limit/env-flags.js";
|
|
29
|
+
import "./rate-limit/index.js";
|
|
30
|
+
import { AutomationService } from "../automations/service/automation-service.js";
|
|
31
|
+
import "../automations/index.js";
|
|
32
|
+
import { WorkItemService } from "../work-items/work-item-service.js";
|
|
33
|
+
import { buildWorkItemAgentContext } from "../work-items/agent-context.js";
|
|
34
|
+
import "../work-items/index.js";
|
|
35
|
+
import { OutcomeProjectionService } from "../work/outcome-projection-service.js";
|
|
25
36
|
import { ProjectService } from "../projects/project-service.js";
|
|
26
37
|
import "../projects/index.js";
|
|
38
|
+
import { ProactiveScenarioService } from "../proactive/scenarios/service.js";
|
|
39
|
+
import { WorkIntakeService } from "../work/work-intake-service.js";
|
|
40
|
+
import "../work/index.js";
|
|
27
41
|
import { disposeAllSessionMcpRuntimes } from "../agent/mcp/bundle-mcp-runtime.js";
|
|
28
42
|
import "../agent/mcp/bundle-mcp-tools.js";
|
|
29
43
|
import { onSessionTranscriptUpdate } from "../session/transcript-events.js";
|
|
@@ -35,8 +49,6 @@ import { MessageBus, MessageBusShutdownError } from "../infra/bus/queue.js";
|
|
|
35
49
|
import "../infra/bus/index.js";
|
|
36
50
|
import { AgentService } from "../agent/service.js";
|
|
37
51
|
import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
38
|
-
import { AutomationService } from "../automations/service/automation-service.js";
|
|
39
|
-
import "../automations/index.js";
|
|
40
52
|
import { setPairingBroadcastSink } from "../channels/pairing/pairing-events.js";
|
|
41
53
|
import { registerClarifyBridge } from "./clarify-runtime.js";
|
|
42
54
|
import { ChannelManager } from "../channels/manager.js";
|
|
@@ -45,7 +57,13 @@ import "../config/index.js";
|
|
|
45
57
|
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
46
58
|
import "../knowledge/index.js";
|
|
47
59
|
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
60
|
+
import { ConnectedSourceChangePublisher } from "../connectors/source-change-publisher.js";
|
|
48
61
|
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
62
|
+
import { DiscussionService } from "../discussions/service.js";
|
|
63
|
+
import { DiscussionPipeline } from "../discussions/pipeline.js";
|
|
64
|
+
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
65
|
+
import { DiscussionWorker } from "../discussions/worker.js";
|
|
66
|
+
import "../discussions/index.js";
|
|
49
67
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
50
68
|
import { reconcileDreamingAutomations } from "./dreaming-automation-reconciler.js";
|
|
51
69
|
import { NotesStore } from "../notes/store.js";
|
|
@@ -54,20 +72,12 @@ import { NotesService } from "../notes/service.js";
|
|
|
54
72
|
import "../notes/index.js";
|
|
55
73
|
import { buildWorkflowChildTools } from "../agent/workflow/workflow-child-tools.js";
|
|
56
74
|
import { WorkflowRunService } from "../workflows/service/workflow-run-service.js";
|
|
57
|
-
import { WorkItemService } from "../work-items/work-item-service.js";
|
|
58
|
-
import { buildWorkItemAgentContext } from "../work-items/agent-context.js";
|
|
59
|
-
import "../work-items/index.js";
|
|
60
75
|
import { WorkflowSessionBridge } from "../workflows/service/workflow-session-bridge.js";
|
|
61
76
|
import { HeartbeatService, heartbeatRunnerConfigFromConfig } from "./heartbeat/service.js";
|
|
62
77
|
import "./heartbeat/index.js";
|
|
63
|
-
import { wireTunnelEventsToGateway } from "../tunnel/gateway-lifecycle.js";
|
|
64
78
|
import { stopTailscaleExposure } from "./tailscale-lifecycle.js";
|
|
65
79
|
import { getExposureManager } from "../remote-access/exposure-manager.js";
|
|
66
|
-
import { sanitizeTunnelConfig } from "../tunnel/tunnel-config.js";
|
|
67
80
|
import { assertGatewayAuthNotKnownWeak } from "./security/known-weak-secrets.js";
|
|
68
|
-
import { buckets } from "./rate-limit/buckets.js";
|
|
69
|
-
import { isGatewayStrictSecurityEnabled } from "./rate-limit/env-flags.js";
|
|
70
|
-
import "./rate-limit/index.js";
|
|
71
81
|
import { assertGatewayRuntimeConfig } from "./runtime-config.js";
|
|
72
82
|
import { auditGatewayConfig } from "./security/audit.js";
|
|
73
83
|
import { ModelCatalogSyncService } from "../providers/model-catalog-sync-service.js";
|
|
@@ -77,11 +87,12 @@ import { LocalAppService } from "../local-apps/service.js";
|
|
|
77
87
|
import "../local-apps/index.js";
|
|
78
88
|
import { createRuntimeBrowserRecipeService } from "../browser/recipes/runtime-service.js";
|
|
79
89
|
import "../browser/recipes/index.js";
|
|
90
|
+
import { mapProductEventToProactive } from "../proactive/events/product-event-bridge.js";
|
|
80
91
|
import { ProactiveEventService } from "../proactive/service.js";
|
|
81
|
-
import { ProactiveScenarioService } from "../proactive/scenarios/service.js";
|
|
82
92
|
import { ReadonlyProactiveAgentExecutor } from "../proactive/execution/agent-executor.js";
|
|
83
93
|
import { listInsights } from "../proactive/execution/repository.js";
|
|
84
94
|
import { ProactiveWorker } from "../proactive/execution/worker.js";
|
|
95
|
+
import { ProactiveTemporalWorker } from "../proactive/temporal/worker.js";
|
|
85
96
|
import { ProactiveInboxService } from "../proactive/inbox/service.js";
|
|
86
97
|
import { ProactiveInboxWorker } from "../proactive/inbox/worker.js";
|
|
87
98
|
import "../proactive/index.js";
|
|
@@ -164,6 +175,7 @@ var GatewayService = class {
|
|
|
164
175
|
mobileNotifications = null;
|
|
165
176
|
connectorSupervisor = null;
|
|
166
177
|
connectorLearningCoordinator = null;
|
|
178
|
+
connectedSourceChangePublisher = null;
|
|
167
179
|
connectedKnowledgeCoordinator = null;
|
|
168
180
|
stopAutomationProductEventBridge = null;
|
|
169
181
|
stopSessionTranscriptAutomationEvents = null;
|
|
@@ -191,6 +203,9 @@ var GatewayService = class {
|
|
|
191
203
|
/** First-class project grouping surface. */
|
|
192
204
|
projects;
|
|
193
205
|
workItems;
|
|
206
|
+
discussions;
|
|
207
|
+
discussionWorker;
|
|
208
|
+
discussionLiveWorker;
|
|
194
209
|
/** Local user-created apps, their coder projects, previews, and installs. */
|
|
195
210
|
localApps;
|
|
196
211
|
/** Unified durable event spine for proactive scenarios. */
|
|
@@ -199,6 +214,7 @@ var GatewayService = class {
|
|
|
199
214
|
proactiveInbox = new ProactiveInboxService();
|
|
200
215
|
proactiveInsights = listInsights;
|
|
201
216
|
proactiveWorker;
|
|
217
|
+
proactiveTemporalWorker;
|
|
202
218
|
proactiveInboxWorker;
|
|
203
219
|
constructor(serviceConfig = {}) {
|
|
204
220
|
this.serviceConfig = serviceConfig;
|
|
@@ -207,6 +223,7 @@ var GatewayService = class {
|
|
|
207
223
|
runBootstrapMigrationsSync(this.configPath);
|
|
208
224
|
this.config = loadConfig(this.configPath);
|
|
209
225
|
this.proactiveWorker = new ProactiveWorker(new ReadonlyProactiveAgentExecutor(() => this.config));
|
|
226
|
+
this.proactiveTemporalWorker = new ProactiveTemporalWorker(this.proactive);
|
|
210
227
|
this.proactiveInboxWorker = new ProactiveInboxWorker({ deliver: async ({ inboxItem }) => {
|
|
211
228
|
this.sse.emit("proactive.inbox.created", inboxItem);
|
|
212
229
|
await this.createMobileNotificationService().deliverGatewayEvent("proactive.inbox.created", inboxItem);
|
|
@@ -268,6 +285,50 @@ var GatewayService = class {
|
|
|
268
285
|
this.notesService = new NotesService(new NotesStore());
|
|
269
286
|
this.projects = new ProjectService(void 0, this.proactive);
|
|
270
287
|
this.workItems = new WorkItemService(void 0, this.proactive);
|
|
288
|
+
const emitDiscussion = (capture) => {
|
|
289
|
+
this.sse.emit("discussion.updated", capture);
|
|
290
|
+
};
|
|
291
|
+
this.discussions = new DiscussionService(this.notesService, this.projects, (type, payload) => {
|
|
292
|
+
this.sse.emit(type, payload);
|
|
293
|
+
});
|
|
294
|
+
this.discussionWorker = new DiscussionWorker(new DiscussionPipeline({
|
|
295
|
+
notes: this.notesService,
|
|
296
|
+
projects: this.projects,
|
|
297
|
+
getConfig: () => this.config,
|
|
298
|
+
onUpdated: emitDiscussion,
|
|
299
|
+
onCompleted: (capture, analysis) => {
|
|
300
|
+
const payload = {
|
|
301
|
+
discussionId: capture.id,
|
|
302
|
+
noteId: capture.noteId,
|
|
303
|
+
projectId: capture.projectId,
|
|
304
|
+
completedAt: capture.completedAt,
|
|
305
|
+
actionCount: analysis.actionItems.length,
|
|
306
|
+
unownedActionCount: analysis.actionItems.filter((item) => !item.owner).length,
|
|
307
|
+
undatedActionCount: analysis.actionItems.filter((item) => !item.dueDate).length,
|
|
308
|
+
riskCount: analysis.risks.length,
|
|
309
|
+
openQuestionCount: analysis.openQuestions.length
|
|
310
|
+
};
|
|
311
|
+
this.sse.emit("discussion.completed", payload);
|
|
312
|
+
publishAutomationProductEvent({
|
|
313
|
+
type: "discussion.completed",
|
|
314
|
+
source: "discussions",
|
|
315
|
+
payload,
|
|
316
|
+
occurredAtMs: capture.completedAt
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
}), emitDiscussion);
|
|
320
|
+
this.discussionLiveWorker = new DiscussionLiveWorker({
|
|
321
|
+
notes: this.notesService,
|
|
322
|
+
projects: this.projects,
|
|
323
|
+
getConfig: () => this.config,
|
|
324
|
+
onDiscussionUpdated: emitDiscussion,
|
|
325
|
+
onTranscriptUpdated: (discussionId, sequence) => {
|
|
326
|
+
this.sse.emit("discussion.transcript.updated", {
|
|
327
|
+
discussionId,
|
|
328
|
+
sequence
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
});
|
|
271
332
|
this.localApps = new LocalAppService({
|
|
272
333
|
projects: this.projects,
|
|
273
334
|
workspaceRoot: this.workspacePath,
|
|
@@ -430,7 +491,7 @@ var GatewayService = class {
|
|
|
430
491
|
if (!this.goalRunner) this.goalRunner = new GoalRunner({
|
|
431
492
|
maxConcurrent: 1,
|
|
432
493
|
defaultMaxRetries: 2,
|
|
433
|
-
ensureSession: async (goal) => {
|
|
494
|
+
ensureSession: async (goal, executionContext) => {
|
|
434
495
|
const existing = goal.activeSessionKey?.trim();
|
|
435
496
|
if (existing) return existing;
|
|
436
497
|
const agentId = goal.agentId || getDefaultAgentId(this.config);
|
|
@@ -452,6 +513,16 @@ var GatewayService = class {
|
|
|
452
513
|
accountId: "default",
|
|
453
514
|
peerKind: "direct",
|
|
454
515
|
peerId
|
|
516
|
+
},
|
|
517
|
+
projectId: goal.projectId,
|
|
518
|
+
customData: {
|
|
519
|
+
goalId: goal.id,
|
|
520
|
+
origin: "goal",
|
|
521
|
+
triggerKind: executionContext?.triggerKind ?? "user",
|
|
522
|
+
...executionContext?.outcomeId ? { outcomeId: executionContext.outcomeId } : {},
|
|
523
|
+
...executionContext?.workItemId ? { workItemId: executionContext.workItemId } : {},
|
|
524
|
+
...executionContext?.contextTraceId ? { contextTraceId: executionContext.contextTraceId } : {},
|
|
525
|
+
...executionContext?.parentRunId ? { parentRunId: executionContext.parentRunId } : {}
|
|
455
526
|
}
|
|
456
527
|
} });
|
|
457
528
|
if (goal.projectId) this.projects.attachSession(sessionKey, goal.projectId);
|
|
@@ -459,6 +530,22 @@ var GatewayService = class {
|
|
|
459
530
|
new GoalService().attachSession(goal.id, sessionKey);
|
|
460
531
|
return sessionKey;
|
|
461
532
|
},
|
|
533
|
+
bindExecutionContext: async (sessionKey, goal, executionContext) => {
|
|
534
|
+
const metadata = await this.sessionIndex.getSessionMetadata(sessionKey);
|
|
535
|
+
await this.sessionIndex.updateSessionMetadata(sessionKey, {
|
|
536
|
+
projectId: goal.projectId ?? metadata?.projectId,
|
|
537
|
+
customData: {
|
|
538
|
+
...metadata?.customData,
|
|
539
|
+
goalId: goal.id,
|
|
540
|
+
origin: "goal",
|
|
541
|
+
triggerKind: executionContext?.triggerKind ?? "user",
|
|
542
|
+
...executionContext?.outcomeId ? { outcomeId: executionContext.outcomeId } : {},
|
|
543
|
+
...executionContext?.workItemId ? { workItemId: executionContext.workItemId } : {},
|
|
544
|
+
...executionContext?.contextTraceId ? { contextTraceId: executionContext.contextTraceId } : {},
|
|
545
|
+
...executionContext?.parentRunId ? { parentRunId: executionContext.parentRunId } : {}
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
},
|
|
462
549
|
hasActiveRun: (sessionKey) => this.agentRunner.hasActiveRun(sessionKey),
|
|
463
550
|
runTurn: (sessionKey, userTurn) => this.agentRunner.runScheduledWebchatTurn(sessionKey, userTurn),
|
|
464
551
|
emit: (type, payload) => this.emit(type, payload)
|
|
@@ -628,9 +715,13 @@ var GatewayService = class {
|
|
|
628
715
|
});
|
|
629
716
|
log.debug("Starting gateway service...");
|
|
630
717
|
openXopcDatabase();
|
|
718
|
+
new WorkIntakeService(this.projects, { enqueue: (goalId, options) => this.enqueueGoalRun(goalId, options) }).reconcilePendingExecutions();
|
|
719
|
+
new OutcomeProjectionService().reconcile();
|
|
631
720
|
this.startTime = Date.now();
|
|
632
721
|
this.running = true;
|
|
722
|
+
this.ensureDefaultProactiveScenarioSubscriptions();
|
|
633
723
|
this.proactiveWorker.start();
|
|
724
|
+
this.proactiveTemporalWorker.start();
|
|
634
725
|
this.proactiveInboxWorker.start();
|
|
635
726
|
prepareConfiguredLocalVoiceModel(this.config);
|
|
636
727
|
this.startupTrace = createGatewayStartupTrace();
|
|
@@ -726,6 +817,8 @@ var GatewayService = class {
|
|
|
726
817
|
await trace.measure("automations.initialize", () => this.automationService.initialize());
|
|
727
818
|
await trace.measure("dreaming.reconcile", () => this.reconcileDreamingAutomations());
|
|
728
819
|
await this.notesService.initialize();
|
|
820
|
+
this.discussionWorker.start();
|
|
821
|
+
this.discussionLiveWorker.start();
|
|
729
822
|
this.ensureHeartbeatService().start(heartbeatRunnerConfigFromConfig(this.config));
|
|
730
823
|
this.connectorSupervisor = startConnectorSupervisor({
|
|
731
824
|
getConfig: () => this.config,
|
|
@@ -737,6 +830,8 @@ var GatewayService = class {
|
|
|
737
830
|
getMemoryManager: () => this.agentService.getMemoryManager(),
|
|
738
831
|
emit: (type, payload) => this.emit(type, payload)
|
|
739
832
|
});
|
|
833
|
+
this.connectedSourceChangePublisher = new ConnectedSourceChangePublisher(this.proactive);
|
|
834
|
+
this.connectedSourceChangePublisher.start();
|
|
740
835
|
this.connectedKnowledgeCoordinator = startConnectedKnowledgeCoordinator({ resolvePipelineOptions: () => ({
|
|
741
836
|
agentId: resolveDefaultAgentId(this.config),
|
|
742
837
|
workspaceId: this.currentWorkspacePath
|
|
@@ -763,6 +858,18 @@ var GatewayService = class {
|
|
|
763
858
|
else trace.mark("service.started-awaiting-http");
|
|
764
859
|
log.debug("Gateway service started");
|
|
765
860
|
}
|
|
861
|
+
ensureDefaultProactiveScenarioSubscriptions() {
|
|
862
|
+
for (const scenarioKey of ["meeting_preparation", "discussion_follow_up"]) {
|
|
863
|
+
if (this.proactiveScenarios.subscriptions(scenarioKey).some((subscription) => subscription.workspaceId === this.currentWorkspacePath)) continue;
|
|
864
|
+
this.proactiveScenarios.subscribe({
|
|
865
|
+
scenarioKey,
|
|
866
|
+
workspaceId: this.currentWorkspacePath,
|
|
867
|
+
scopeKind: "workspace",
|
|
868
|
+
scopeId: this.currentWorkspacePath,
|
|
869
|
+
enabled: true
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
}
|
|
766
873
|
/** Called when the HTTP listener is bound (before deferred channel work). */
|
|
767
874
|
markHttpListening() {
|
|
768
875
|
this.readiness.markHttpListening();
|
|
@@ -850,6 +957,9 @@ var GatewayService = class {
|
|
|
850
957
|
log.debug("Stopping gateway service...");
|
|
851
958
|
this.readiness.markStarting();
|
|
852
959
|
await this.proactiveWorker.stop();
|
|
960
|
+
await this.discussionWorker.stop();
|
|
961
|
+
await this.discussionLiveWorker.stop();
|
|
962
|
+
this.proactiveTemporalWorker.stop();
|
|
853
963
|
await this.proactiveInboxWorker.stop();
|
|
854
964
|
await stopTailscaleExposure().catch((err) => {
|
|
855
965
|
log.warn({ err }, "Tailscale exposure shutdown failed");
|
|
@@ -865,6 +975,8 @@ var GatewayService = class {
|
|
|
865
975
|
this.connectorSupervisor = null;
|
|
866
976
|
this.connectorLearningCoordinator?.stop();
|
|
867
977
|
this.connectorLearningCoordinator = null;
|
|
978
|
+
this.connectedSourceChangePublisher?.stop();
|
|
979
|
+
this.connectedSourceChangePublisher = null;
|
|
868
980
|
this.connectedKnowledgeCoordinator?.stop();
|
|
869
981
|
this.connectedKnowledgeCoordinator = null;
|
|
870
982
|
await this.browserRecipeService?.shutdown();
|
|
@@ -1296,6 +1408,21 @@ var GatewayService = class {
|
|
|
1296
1408
|
this.stopAutomationProductEventBridge?.();
|
|
1297
1409
|
this.stopSessionTranscriptAutomationEvents?.();
|
|
1298
1410
|
this.stopAutomationProductEventBridge = onAutomationProductEvent((event) => {
|
|
1411
|
+
const proactiveEvent = mapProductEventToProactive({
|
|
1412
|
+
event,
|
|
1413
|
+
workspaceId: this.currentWorkspacePath,
|
|
1414
|
+
defaultAgentId: resolveDefaultAgentId(this.config)
|
|
1415
|
+
});
|
|
1416
|
+
if (proactiveEvent) try {
|
|
1417
|
+
this.proactive.publish(proactiveEvent);
|
|
1418
|
+
} catch (err) {
|
|
1419
|
+
const em = err instanceof Error ? err.message : String(err);
|
|
1420
|
+
log.warn({
|
|
1421
|
+
err,
|
|
1422
|
+
eventType: event.type,
|
|
1423
|
+
source: event.source
|
|
1424
|
+
}, `Proactive product event publication failed: ${em}`);
|
|
1425
|
+
}
|
|
1299
1426
|
this.automationService.triggerEvent(event).catch((err) => {
|
|
1300
1427
|
const em = err instanceof Error ? err.message : String(err);
|
|
1301
1428
|
log.warn({
|
|
@@ -23,6 +23,7 @@ function rowToSnapshot(row) {
|
|
|
23
23
|
nextRunAt: row.next_run_at ?? void 0,
|
|
24
24
|
sessionKey: row.session_key ?? void 0,
|
|
25
25
|
userTurn: payload.userTurn,
|
|
26
|
+
executionContext: payload.executionContext,
|
|
26
27
|
lastError: row.last_error ?? void 0,
|
|
27
28
|
source: row.source
|
|
28
29
|
};
|
|
@@ -41,7 +42,10 @@ var GoalQueueStore = class {
|
|
|
41
42
|
queue_id: randomUUID(),
|
|
42
43
|
goal_id: input.goalId,
|
|
43
44
|
status: "queued",
|
|
44
|
-
payload_json: JSON.stringify({
|
|
45
|
+
payload_json: JSON.stringify({
|
|
46
|
+
userTurn: input.userTurn,
|
|
47
|
+
executionContext: input.executionContext
|
|
48
|
+
}),
|
|
45
49
|
attempts: 0,
|
|
46
50
|
max_retries: input.maxRetries,
|
|
47
51
|
enqueued_at: now,
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { GoalWithDetails } from './types.js';
|
|
2
2
|
import type { UserTurnInput } from '../gateway/user-turn-input.js';
|
|
3
3
|
export type GoalQueueStatus = 'queued' | 'running' | 'retry_waiting' | 'succeeded' | 'failed' | 'skipped';
|
|
4
|
+
export interface GoalRunExecutionContext {
|
|
5
|
+
outcomeId?: string;
|
|
6
|
+
workItemId?: string;
|
|
7
|
+
contextTraceId?: string;
|
|
8
|
+
parentRunId?: string;
|
|
9
|
+
triggerKind: 'user' | 'schedule' | 'webhook' | 'proactive' | 'retry';
|
|
10
|
+
}
|
|
4
11
|
export interface GoalQueueItemSnapshot {
|
|
5
12
|
id: string;
|
|
6
13
|
goalId: string;
|
|
@@ -13,6 +20,7 @@ export interface GoalQueueItemSnapshot {
|
|
|
13
20
|
nextRunAt?: number;
|
|
14
21
|
sessionKey?: string;
|
|
15
22
|
userTurn?: UserTurnInput;
|
|
23
|
+
executionContext?: GoalRunExecutionContext;
|
|
16
24
|
lastError?: string;
|
|
17
25
|
source: 'api' | 'cron' | 'workflow' | 'system';
|
|
18
26
|
}
|
|
@@ -20,7 +28,8 @@ export interface GoalRunnerOptions {
|
|
|
20
28
|
maxConcurrent?: number;
|
|
21
29
|
defaultMaxRetries?: number;
|
|
22
30
|
retryBaseMs?: number;
|
|
23
|
-
ensureSession: (goal: GoalWithDetails) => Promise<string>;
|
|
31
|
+
ensureSession: (goal: GoalWithDetails, context?: GoalRunExecutionContext) => Promise<string>;
|
|
32
|
+
bindExecutionContext?: (sessionKey: string, goal: GoalWithDetails, context?: GoalRunExecutionContext) => Promise<void>;
|
|
24
33
|
hasActiveRun: (sessionKey: string) => boolean;
|
|
25
34
|
runTurn: (sessionKey: string, userTurn: UserTurnInput) => Promise<void>;
|
|
26
35
|
emit?: (type: string, payload: unknown) => void;
|
|
@@ -29,4 +38,5 @@ export interface EnqueueGoalRunOptions {
|
|
|
29
38
|
userTurn?: UserTurnInput;
|
|
30
39
|
maxRetries?: number;
|
|
31
40
|
source?: GoalQueueItemSnapshot['source'];
|
|
41
|
+
executionContext?: GoalRunExecutionContext;
|
|
32
42
|
}
|
|
@@ -3,6 +3,7 @@ import { init_logger } from "../utils/logger.js";
|
|
|
3
3
|
import { GoalService } from "./goal-service.js";
|
|
4
4
|
import { GoalQueueStore } from "./goal-queue-store.js";
|
|
5
5
|
import { mediaRefsToUserTurnAttachments } from "../gateway/user-turn-input.js";
|
|
6
|
+
import { OutcomeRepository } from "../work/outcome-repository.js";
|
|
6
7
|
//#region src/goals/goal-runner.ts
|
|
7
8
|
init_logger();
|
|
8
9
|
const log = createLogger("GoalRunner");
|
|
@@ -11,11 +12,12 @@ function terminalGoalStatus(status) {
|
|
|
11
12
|
}
|
|
12
13
|
function buildInitialGoalTurn(goal) {
|
|
13
14
|
const context = goal.contextMessage;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
if (
|
|
15
|
+
const contract = new OutcomeRepository().getContract(goal.outcomeId, goal.outcomeContractVersion);
|
|
16
|
+
const parts = [`Outcome:\n${contract?.objective ?? goal.title}`];
|
|
17
|
+
if (contract?.constraints.length) parts.push(`Constraints:\n${contract.constraints.map((item) => `- ${item}`).join("\n")}`);
|
|
18
|
+
if (contract?.deliverables.length) parts.push(`Deliverables:\n${contract.deliverables.map((item) => `- ${item}`).join("\n")}`);
|
|
17
19
|
if (context?.text.trim()) parts.push(`Context:\n${context.text.trim()}`);
|
|
18
|
-
if (goal.checklist.length > 0) parts.push(`
|
|
20
|
+
if (goal.checklist.length > 0) parts.push(`Acceptance criteria:\n${goal.checklist.map((item, index) => `${index + 1}. ${item.text}`).join("\n")}`);
|
|
19
21
|
return {
|
|
20
22
|
text: parts.join("\n\n"),
|
|
21
23
|
attachments: mediaRefsToUserTurnAttachments(context?.attachments),
|
|
@@ -47,7 +49,8 @@ var GoalRunner = class {
|
|
|
47
49
|
text: options.userTurn.text.trim(),
|
|
48
50
|
clientCreatedAtMs: options.userTurn.clientCreatedAtMs ?? Date.now()
|
|
49
51
|
} : void 0,
|
|
50
|
-
source: options.source ?? "api"
|
|
52
|
+
source: options.source ?? "api",
|
|
53
|
+
executionContext: options.executionContext
|
|
51
54
|
});
|
|
52
55
|
this.emit("goal.queue.updated", item);
|
|
53
56
|
this.schedulePump(0);
|
|
@@ -94,11 +97,12 @@ var GoalRunner = class {
|
|
|
94
97
|
this.finish(item, "failed", "Goal not found");
|
|
95
98
|
return;
|
|
96
99
|
}
|
|
97
|
-
const sessionKey = activeGoal.activeSessionKey ?? await this.opts.ensureSession(activeGoal);
|
|
100
|
+
const sessionKey = activeGoal.activeSessionKey ?? await this.opts.ensureSession(activeGoal, item.executionContext);
|
|
98
101
|
item = this.store.setSessionKey(item.id, sessionKey) ?? {
|
|
99
102
|
...item,
|
|
100
103
|
sessionKey
|
|
101
104
|
};
|
|
105
|
+
await this.opts.bindExecutionContext?.(sessionKey, activeGoal, item.executionContext);
|
|
102
106
|
if (this.opts.hasActiveRun(sessionKey)) {
|
|
103
107
|
this.retry(item, "Goal session already has an active run");
|
|
104
108
|
return;
|