@xopcai/xopc 0.0.178 → 0.0.180
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-DFKtQDgE.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BzxntcaZ.js → agent-avatar-dicebear-CcTvB_4W.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DgGj9bu6.js +2 -0
- package/dist/gateway/static/root/assets/{api-hi6f2Xtp.js → api-CUClAvuL.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-fTY1F7ac.js → app-management-settings-panel-Ib-cWKHM.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BZ-IxQfB.js → appearance-settings-CRSN8WuA.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-B5xahuT-.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-ZSLLG8wB.js → archive-plugin-BBF9zspN.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D4YktqIF.js → attachment-load-D3QQfA7w.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BUYrvMmD.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BIkPxfxj.js → binary-plugins-D78XOjJ3.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Q3v_YQom.js → block-editor-D_VVXlYX.js} +46 -46
- package/dist/gateway/static/root/assets/browser-settings-page-Cjw07q9h.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-M5lTEW1I.js → browser-workflow-inputs-_gu08MA4.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-B3T1KYk4.js → browser-workflows-page-58DBMXgG.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-D_dfVxHY.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-DE09c0VB.js → capability-presets-api-DhCn9rPv.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-LWWIYUT7.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-CFR5FBfS.js → channel-recipient-api-DYtoNV5A.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Cyj5OunL.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-TEFnV0IG.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-B1mD-3pM.js → connector-logo-CxIXnifA.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-0TobCpBB.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-CwVSLL6N.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-BOIp4q0Z.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BYQJ2XUS.js → directory-picker-path-field-C8_lsW6S.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-BXcb8fwx.js → dreaming-settings-Da9FeWQl.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-O1Xu1r4Q.js → extension-debug-page-CMNnSJP6.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C2Jraq8l.js → extension-page-t0pJqLvM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DcXQDTpG.js → extension-settings-page-aiR-tKnW.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DmPIZrvg.js → gateway-config-api-CkyQBD6r.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BIZfAgfB.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BZEkOdPm.js → gateway-startup-retry-CSU7UvzG.js} +1 -1
- package/dist/gateway/static/root/assets/goals-settings-Dx9uTyWF.js +1 -0
- package/dist/gateway/static/root/assets/{heartbeat-settings-BtKu2NWT.js → heartbeat-settings-Cnr5ORXL.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-05Gg8wsU.js → image-generation-api-BR6Kb77X.js} +1 -1
- package/dist/gateway/static/root/assets/index-B0Tdge_q.css +1 -0
- package/dist/gateway/static/root/assets/index-BA56bQ68.js +224 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CfmDR9Sc.js → keyboard-shortcuts-settings-D76uYKeQ.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DSUNtLHg.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Df8BW1A_.js → local-apps-page-BsLnojTh.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CTwSy7yW.js → locale-store-BNC8HUCI.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-yI8kpQtO.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-B3FvKbaP.js → markdown-split-D6smTQWD.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DsjrvvB6.js → media-plugins-D1TmMF0A.js} +1 -1
- package/dist/gateway/static/root/assets/messages-H_iJjnEM.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-tuzIwy3c.js → notes-page-Vt-diFf0.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-BD297EZt.js +4 -0
- package/dist/gateway/static/root/assets/outcome-detail-page-C5i_ZR9a.js +1 -0
- package/dist/gateway/static/root/assets/{page-tabs-ke9s4nYi.js → page-tabs-BnSzIjH0.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cp1eI4S9.js → preview-open-alternatives-CF12Eqi4.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-Du0TE_CU.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-D1HGz7Dy.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-CqP2TnW-.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BXdVJLS3.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-Bl30zjHc.js → save-bar-controls-B53UNtDM.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-DqhmXQKo.js → schedule-field-C3dIMN5q.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DkUCy6vf.js → schema-form-BKvpxqof.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-CPAwDdl5.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-C-jGsoft.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-C6ZbNpdy.js → settings-form-section-kt6GIS32.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-Bk58_cr7.js → settings-loading-skeleton-85eUPcKz.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-k8iE_NdX.js → settings-page-Di5x6Xrc.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DgFSya2e.js → settings-page-layout-CkkCee_x.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-B_KDlyZA.js → setup-status-panel-uxEE6gAB.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CV7nL_J9.js → share-preview-page-BtLEstaI.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-2mcsMWgn.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-ocDwsrEt.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-9_jfsFU5.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-kahBIHg0.js → skills-page.utils-C2SHvq8V.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-JV3-MG5F.js → system-settings-panel-CIJ66cUy.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DFLyzoLO.js → theme-store-ClDa_Bci.js} +1 -1
- package/dist/gateway/static/root/assets/time-picker-D0zAsHOo.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-60Aqo-UJ.js → typed-models-lib-GsmwmB40.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CnTkHDnw.js → use-channel-catalog-BQz3K7xj.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Bn4BLg4W.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CNa8qUgS.js → voice-api-key-field-Blaxsbb3.js} +1 -1
- package/dist/gateway/static/root/assets/work-copy-Cwyan9Sn.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-iJ9RBSpu.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-CqTH7PQX.js +1 -0
- package/dist/gateway/static/root/assets/work-page-H3m99ccS.js +3 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-yV_x595t.js → workflow-run-setup-panel-CTG4RpRE.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BxZSKMfv.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/agent-manager.d.ts +4 -1
- package/dist/src/agent/agent-manager.js +21 -7
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -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 +1 -1
- package/dist/src/agent/embedded/run-for-session.d.ts +2 -0
- package/dist/src/agent/embedded/run-for-session.js +3 -1
- package/dist/src/agent/goals/post-turn.js +7 -6
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +6 -1
- package/dist/src/agent/inbound/turn-dispatcher.js +5 -2
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/lifecycle/timeout-wrapper.d.ts +2 -0
- package/dist/src/agent/lifecycle/timeout-wrapper.js +39 -9
- package/dist/src/agent/mcp/bundle-mcp-materialize.js +2 -2
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +6 -1
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +1 -1
- package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
- package/dist/src/agent/mcp/mcp-transport-config.d.ts +2 -0
- package/dist/src/agent/mcp/mcp-transport-config.js +10 -3
- package/dist/src/agent/mcp/mcp-transport.d.ts +1 -0
- package/dist/src/agent/mcp/mcp-transport.js +5 -2
- package/dist/src/agent/memory/dreaming/config.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/orchestration/run-agent-turn-with-timeout.d.ts +1 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +6 -2
- 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/direct-turn-helpers.d.ts +1 -0
- package/dist/src/agent/service/direct-turn-helpers.js +1 -0
- package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -0
- package/dist/src/agent/service/process-direct-one-shot.js +4 -1
- package/dist/src/agent/service/process-direct-streaming.js +3 -1
- package/dist/src/agent/service.d.ts +1 -0
- package/dist/src/agent/service.js +5 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/config.js +6 -0
- package/dist/src/agent/skills/filesystem-watcher.d.ts +4 -0
- package/dist/src/agent/skills/filesystem-watcher.js +16 -7
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/index.d.ts +10 -7
- package/dist/src/agent/skills/index.js +56 -47
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/skills/skill-manager.d.ts +5 -2
- package/dist/src/agent/skills/skill-manager.js +10 -5
- package/dist/src/agent/skills/skill-sources.d.ts +18 -0
- package/dist/src/agent/skills/skill-sources.js +143 -0
- package/dist/src/agent/skills/types.d.ts +25 -2
- package/dist/src/agent/tools/delegate-tool.js +2 -1
- package/dist/src/agent/tools/executor.d.ts +2 -0
- package/dist/src/agent/tools/executor.js +18 -11
- package/dist/src/agent/tools/factory.js +18 -1
- package/dist/src/agent/tools/goal-tool.js +5 -3
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/managed-job-tool.d.ts +2 -0
- package/dist/src/agent/tools/managed-job-tool.js +160 -0
- 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/agent/workspace-runtime/registry.d.ts +3 -0
- package/dist/src/agent/workspace-runtime/registry.js +3 -1
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/auth/credentials.d.ts +9 -1
- package/dist/src/auth/credentials.js +112 -56
- package/dist/src/auth/model-credential-store.js +7 -22
- package/dist/src/auth/oauth-provider-lock.d.ts +5 -0
- package/dist/src/auth/oauth-provider-lock.js +91 -0
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/automations/domain/defaults.d.ts +8 -1
- package/dist/src/automations/domain/defaults.js +9 -2
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +33 -7
- package/dist/src/automations/domain/validation.d.ts +8 -0
- package/dist/src/automations/domain/validation.js +2 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -1
- package/dist/src/automations/index.js +2 -2
- package/dist/src/automations/service/action-executor.d.ts +2 -2
- package/dist/src/automations/service/action-executor.js +144 -34
- package/dist/src/automations/service/automation-service.d.ts +4 -0
- package/dist/src/automations/service/automation-service.js +197 -18
- package/dist/src/automations/storage/automation-run-repository.d.ts +1 -0
- package/dist/src/automations/storage/automation-run-repository.js +37 -7
- package/dist/src/automations/storage/index.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- 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/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/goal.js +6 -5
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/tunnel.js +3 -3
- package/dist/src/cli/utils/oauth-login.js +1 -7
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +3 -0
- package/dist/src/config/schema.js +2 -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/lockfile.js +1 -1
- package/dist/src/extensions/sdk/testing.js +1 -1
- package/dist/src/gateway/agents-admin.js +3 -3
- 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/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/app.js +8 -3
- package/dist/src/gateway/hono/lib/config-payload.js +2 -2
- 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/oauth-async.js +1 -7
- package/dist/src/gateway/hono/oauth.js +1 -7
- 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/models.js +1 -1
- 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 +13 -15
- 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 +2 -2
- 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 +142 -15
- 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/goal-workflow-judge.js +1 -1
- 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 +10 -1
- 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/projects/project-loop.js +3 -3
- package/dist/src/providers/auth-runtime/oauth.js +12 -0
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- 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/088_automation_execution_deadlines.sql +5 -0
- package/dist/src/storage/sqlite/migrations/089_automation_run_leases.sql +8 -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.d.ts +2 -0
- package/dist/src/tui/backends/embedded-backend.js +12 -8
- package/dist/src/tui/tui-backend.d.ts +2 -0
- package/dist/src/tui/tui-oauth-login.js +1 -7
- package/dist/src/tui/tui-picker-overlay.js +1 -0
- package/dist/src/tui/tui-picker-services.d.ts +1 -0
- package/dist/src/tui/tui-skills-autocomplete.d.ts +6 -2
- package/dist/src/tui/tui-skills-autocomplete.js +10 -6
- package/dist/src/tui/tui-startup-resources.d.ts +3 -1
- package/dist/src/tui/tui-startup-resources.js +4 -3
- package/dist/src/tui/tui.js +4 -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 +147 -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 +2 -2
- package/dist/src/workflows/service/workflow-run-service.types.d.ts +3 -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
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { createLogger } from "../../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { listKnowledgeSourceItems } from "../../storage/sqlite/knowledge-repository.js";
|
|
4
|
+
import { getConnectorSyncPolicy } from "../../storage/sqlite/connector-sync-policy-repository.js";
|
|
5
|
+
//#region src/proactive/temporal/worker.ts
|
|
6
|
+
init_logger();
|
|
7
|
+
const log = createLogger("Proactive:Temporal");
|
|
8
|
+
const MEETING_SCENARIO = "meeting_preparation";
|
|
9
|
+
function metadataString(metadata, key) {
|
|
10
|
+
const value = metadata[key];
|
|
11
|
+
return typeof value === "string" && value.trim() ? value : void 0;
|
|
12
|
+
}
|
|
13
|
+
function meetingWindow(startMs, nowMs) {
|
|
14
|
+
const untilStart = startMs - nowMs;
|
|
15
|
+
if (untilStart <= 0) return null;
|
|
16
|
+
if (untilStart <= 120 * 6e4) return "2h";
|
|
17
|
+
if (untilStart <= 1440 * 6e4) return "24h";
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
var ProactiveTemporalWorker = class {
|
|
21
|
+
timer = null;
|
|
22
|
+
running = false;
|
|
23
|
+
constructor(events, intervalMs = 6e4) {
|
|
24
|
+
this.events = events;
|
|
25
|
+
this.intervalMs = intervalMs;
|
|
26
|
+
}
|
|
27
|
+
start() {
|
|
28
|
+
if (this.timer) return;
|
|
29
|
+
this.tick();
|
|
30
|
+
this.timer = setInterval(() => void this.tick(), Math.max(5e3, this.intervalMs));
|
|
31
|
+
this.timer.unref?.();
|
|
32
|
+
}
|
|
33
|
+
stop() {
|
|
34
|
+
if (this.timer) clearInterval(this.timer);
|
|
35
|
+
this.timer = null;
|
|
36
|
+
}
|
|
37
|
+
async tick(now = /* @__PURE__ */ new Date()) {
|
|
38
|
+
if (this.running) return {
|
|
39
|
+
scanned: 0,
|
|
40
|
+
published: 0,
|
|
41
|
+
skipped: 0
|
|
42
|
+
};
|
|
43
|
+
this.running = true;
|
|
44
|
+
const result = {
|
|
45
|
+
scanned: 0,
|
|
46
|
+
published: 0,
|
|
47
|
+
skipped: 0
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
const nowMs = now.getTime();
|
|
51
|
+
const pageSize = 500;
|
|
52
|
+
for (let offset = 0;; offset += pageSize) {
|
|
53
|
+
const items = listKnowledgeSourceItems({
|
|
54
|
+
itemType: "calendar_event",
|
|
55
|
+
occurredAfterMs: nowMs,
|
|
56
|
+
occurredBeforeMs: nowMs + 1440 * 6e4,
|
|
57
|
+
orderBy: "occurred_asc",
|
|
58
|
+
limit: pageSize,
|
|
59
|
+
offset
|
|
60
|
+
});
|
|
61
|
+
for (const item of items) {
|
|
62
|
+
result.scanned += 1;
|
|
63
|
+
const connectionId = metadataString(item.metadata, "connectionId");
|
|
64
|
+
const workspaceId = metadataString(item.metadata, "workspaceId");
|
|
65
|
+
const connectorId = metadataString(item.metadata, "connectorId");
|
|
66
|
+
const agentId = metadataString(item.metadata, "agentId");
|
|
67
|
+
const window = meetingWindow(item.occurredAt ? Date.parse(item.occurredAt) : NaN, nowMs);
|
|
68
|
+
const policy = connectionId ? getConnectorSyncPolicy(connectionId) : void 0;
|
|
69
|
+
const scenarioAllowed = !policy?.allowedScenarioKeys.length || policy.allowedScenarioKeys.includes(MEETING_SCENARIO);
|
|
70
|
+
if (!connectionId || !workspaceId || !connectorId || !window || !policy?.scanEnabled || !policy.proactiveEnabled || !scenarioAllowed || item.sensitivity === "secret" || item.sensitivity === "regulated") {
|
|
71
|
+
result.skipped += 1;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (this.events.publish({
|
|
75
|
+
type: "connected_source.calendar_window.v1",
|
|
76
|
+
schemaVersion: 1,
|
|
77
|
+
source: {
|
|
78
|
+
kind: "connector",
|
|
79
|
+
id: connectionId
|
|
80
|
+
},
|
|
81
|
+
subject: {
|
|
82
|
+
kind: "knowledge_source_item",
|
|
83
|
+
id: item.id
|
|
84
|
+
},
|
|
85
|
+
actor: { kind: "system" },
|
|
86
|
+
scope: {
|
|
87
|
+
workspaceId,
|
|
88
|
+
...agentId ? { agentId } : {}
|
|
89
|
+
},
|
|
90
|
+
occurredAt: now.toISOString(),
|
|
91
|
+
dedupeKey: `calendar-window:${item.id}:${item.occurredAt}:${window}`,
|
|
92
|
+
sensitivity: item.sensitivity === "normal" ? "personal" : item.sensitivity,
|
|
93
|
+
payload: {
|
|
94
|
+
sourceItemId: item.id,
|
|
95
|
+
meetingStartsAt: item.occurredAt,
|
|
96
|
+
window
|
|
97
|
+
}
|
|
98
|
+
}, now).inserted) result.published += 1;
|
|
99
|
+
}
|
|
100
|
+
if (items.length < pageSize) break;
|
|
101
|
+
}
|
|
102
|
+
if (result.published > 0) log.info(result, "Temporal meeting signals published");
|
|
103
|
+
return result;
|
|
104
|
+
} finally {
|
|
105
|
+
this.running = false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
//#endregion
|
|
110
|
+
export { ProactiveTemporalWorker };
|
|
@@ -36,7 +36,7 @@ function buildProjectLoopOverview(input) {
|
|
|
36
36
|
title: goal.title,
|
|
37
37
|
detail: compactText(goal.blockedReason || goal.nextAction || goal.description),
|
|
38
38
|
status: goal.status,
|
|
39
|
-
href: `/
|
|
39
|
+
href: `/work/${encodeURIComponent(goal.outcomeId)}`,
|
|
40
40
|
updatedAt: goal.updatedAt
|
|
41
41
|
})),
|
|
42
42
|
...staleGoals.map((goal) => ({
|
|
@@ -45,7 +45,7 @@ function buildProjectLoopOverview(input) {
|
|
|
45
45
|
title: goal.title,
|
|
46
46
|
detail: compactText(goal.nextAction || goal.description || "Goal has not changed recently."),
|
|
47
47
|
status: goal.status,
|
|
48
|
-
href: `/
|
|
48
|
+
href: `/work/${encodeURIComponent(goal.outcomeId)}`,
|
|
49
49
|
updatedAt: goal.updatedAt
|
|
50
50
|
})),
|
|
51
51
|
...failedWorkflowRuns.map((run) => ({
|
|
@@ -74,7 +74,7 @@ function buildProjectLoopOverview(input) {
|
|
|
74
74
|
detail: compactText(goal.nextAction || goal.blockedReason || goal.description),
|
|
75
75
|
timestamp: goal.updatedAt,
|
|
76
76
|
status: goal.status,
|
|
77
|
-
href: `/
|
|
77
|
+
href: `/work/${encodeURIComponent(goal.outcomeId)}`
|
|
78
78
|
})),
|
|
79
79
|
...input.recentWorkflowRuns.map((run) => ({
|
|
80
80
|
id: `workflow:${run.runId}`,
|
|
@@ -3,6 +3,7 @@ import { init_logger } from "../../utils/logger.js";
|
|
|
3
3
|
//#region src/providers/auth-runtime/oauth.ts
|
|
4
4
|
init_logger();
|
|
5
5
|
const log = createLogger("AuthOAuthRefresh");
|
|
6
|
+
const pendingProfileRefreshes = /* @__PURE__ */ new Map();
|
|
6
7
|
/** Number of ms before {@link AuthProfile.expiresAt} we treat the token as stale. */
|
|
7
8
|
const REFRESH_SKEW_MS = 6e4;
|
|
8
9
|
function isOAuthAccessTokenExpired(profile, nowMs) {
|
|
@@ -23,6 +24,17 @@ async function refreshOAuthProfile(profile, options = {}) {
|
|
|
23
24
|
if (profile.mode !== "oauth") throw new Error(`refreshOAuthProfile: profile mode is "${profile.mode}", expected "oauth"`);
|
|
24
25
|
if (!profile.oauthRefreshToken) throw new Error("refreshOAuthProfile: profile is missing oauthRefreshToken");
|
|
25
26
|
if (!profile.oauthTokenEndpoint) throw new Error("refreshOAuthProfile: profile is missing oauthTokenEndpoint");
|
|
27
|
+
const refreshKey = `${profile.provider}\0${profile.profileId}\0${profile.oauthRefreshToken}`;
|
|
28
|
+
const existing = pendingProfileRefreshes.get(refreshKey);
|
|
29
|
+
if (existing) return existing;
|
|
30
|
+
let pending;
|
|
31
|
+
pending = refreshOAuthProfileOnce(profile, options).finally(() => {
|
|
32
|
+
if (pendingProfileRefreshes.get(refreshKey) === pending) pendingProfileRefreshes.delete(refreshKey);
|
|
33
|
+
});
|
|
34
|
+
pendingProfileRefreshes.set(refreshKey, pending);
|
|
35
|
+
return pending;
|
|
36
|
+
}
|
|
37
|
+
async function refreshOAuthProfileOnce(profile, options) {
|
|
26
38
|
const body = new URLSearchParams();
|
|
27
39
|
body.set("grant_type", "refresh_token");
|
|
28
40
|
body.set("refresh_token", profile.oauthRefreshToken);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
|
|
2
1
|
import { getApiKeyFromEnv, init_env_keys } from "../env-keys.js";
|
|
2
|
+
import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
|
|
3
3
|
import { getDefaultAuthProfileStore } from "./auth-profile-store.js";
|
|
4
4
|
//#region src/providers/auth-runtime/resolve-auth.ts
|
|
5
5
|
init_env_keys();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __esmMin, __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
3
|
-
import { getOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
|
|
4
|
-
import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
|
|
5
3
|
import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
6
4
|
import { init_model_ref, splitProviderModelRef } from "./model-ref.js";
|
|
7
5
|
import { ModelRegistry, getModelRegistry, init_model_registry, prewarmModelRegistry, resetModelRegistry } from "./model-registry.js";
|
|
6
|
+
import { getOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
|
|
8
7
|
import { CredentialResolver, hasCredentials, init_credentials } from "../auth/credentials.js";
|
|
8
|
+
import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
|
|
9
9
|
import { EXTENSION_PROVIDER_BASE_URL, init_constants } from "./constants.js";
|
|
10
10
|
import { getSupplementalModels, init_model_supplements } from "./model-supplements.js";
|
|
11
11
|
import { getProviderRegistry, init_plugin_registry } from "./plugin-registry.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
|
-
import { resolveModelsJsonPath } from "../config/paths.js";
|
|
5
4
|
import { init_resolve_config_value, resolveConfigValue, resolveHeaders } from "../config/resolve-config-value.js";
|
|
5
|
+
import { resolveModelsJsonPath } from "../config/paths.js";
|
|
6
6
|
import { getDefaultModelValues, init_models_json, validateModelsConfig } from "../config/models-json.js";
|
|
7
7
|
import { getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
8
8
|
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { getOAuthProviderDefinition, init_registry } from "../auth/oauth/registry.js";
|
|
3
2
|
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
3
|
+
import { getOAuthProviderDefinition, init_registry } from "../auth/oauth/registry.js";
|
|
4
4
|
import { XOPC_CLOUD_PROVIDER_ID, init_xopc_cloud_config, resolveXopcModelRouterUrl } from "./xopc-cloud-config.js";
|
|
5
5
|
//#region src/providers/register-runtime-providers.ts
|
|
6
6
|
function registerRuntimeProvider(modelRuntime, source) {
|
|
@@ -2,8 +2,8 @@ import { isPathUnderWorkspace } from "../gateway/workspace-editor-path.js";
|
|
|
2
2
|
import { relative, resolve } from "node:path";
|
|
3
3
|
import { createReadStream } from "node:fs";
|
|
4
4
|
import { lstat, readdir, realpath, stat } from "node:fs/promises";
|
|
5
|
-
import { Readable, Transform } from "node:stream";
|
|
6
5
|
import { pipeline } from "node:stream/promises";
|
|
6
|
+
import { Readable, Transform } from "node:stream";
|
|
7
7
|
import { crc32, createDeflateRaw } from "node:zlib";
|
|
8
8
|
//#region src/share/share-zip.ts
|
|
9
9
|
const SIG_LOCAL = 67324752;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { request } from "undici";
|
|
4
3
|
import { Readable } from "node:stream";
|
|
4
|
+
import { request } from "undici";
|
|
5
5
|
import * as ws from "ws";
|
|
6
6
|
//#region src/share/site-proxy.ts
|
|
7
7
|
init_logger();
|
|
@@ -6,3 +6,4 @@ export declare function listObjectActivityRecords(options: ListObjectActivityOpt
|
|
|
6
6
|
export declare function listProjectActivityRecords(options: ListProjectActivityOptions): ActivityListResult;
|
|
7
7
|
export declare function createObjectLinkRecord(input: CreateObjectLinkInput): ObjectLink;
|
|
8
8
|
export declare function listObjectLinkRecords(object: ActivityObjectRef): ObjectLink[];
|
|
9
|
+
export declare function deleteObjectLinkRecord(id: string): boolean;
|
|
@@ -202,5 +202,8 @@ function listObjectLinkRecords(object) {
|
|
|
202
202
|
WHERE (from_kind = ? AND from_id = ?) OR (to_kind = ? AND to_id = ?)
|
|
203
203
|
ORDER BY created_at DESC, id DESC`).all(object.kind, object.id, object.kind, object.id).map((row) => objectLinkFromRow(row));
|
|
204
204
|
}
|
|
205
|
+
function deleteObjectLinkRecord(id) {
|
|
206
|
+
return runSqliteWriteTransaction((db) => db.prepare("DELETE FROM object_links WHERE id = ?").run(id).changes > 0);
|
|
207
|
+
}
|
|
205
208
|
//#endregion
|
|
206
|
-
export { createObjectLinkRecord, getActivityEventRecord, listActivityRecords, listObjectActivityRecords, listObjectLinkRecords, listProjectActivityRecords, recordActivityEvent };
|
|
209
|
+
export { createObjectLinkRecord, deleteObjectLinkRecord, getActivityEventRecord, listActivityRecords, listObjectActivityRecords, listObjectLinkRecords, listProjectActivityRecords, recordActivityEvent };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ConnectorSyncPolicy = {
|
|
2
|
+
connectionId: string;
|
|
3
|
+
scanEnabled: boolean;
|
|
4
|
+
proactiveEnabled: boolean;
|
|
5
|
+
intervalMinutes?: number;
|
|
6
|
+
allowedScenarioKeys: string[];
|
|
7
|
+
revision: number;
|
|
8
|
+
updatedAt: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function getConnectorSyncPolicy(connectionId: string): ConnectorSyncPolicy | undefined;
|
|
11
|
+
export declare function listConnectorSyncPolicies(): ConnectorSyncPolicy[];
|
|
12
|
+
export declare function upsertConnectorSyncPolicy(input: {
|
|
13
|
+
connectionId: string;
|
|
14
|
+
scanEnabled?: boolean;
|
|
15
|
+
proactiveEnabled?: boolean;
|
|
16
|
+
intervalMinutes?: number | null;
|
|
17
|
+
defaultIntervalMinutes?: number;
|
|
18
|
+
allowedScenarioKeys?: string[];
|
|
19
|
+
nowMs?: number;
|
|
20
|
+
}): ConnectorSyncPolicy;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { getSqliteDatabase, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
|
+
//#region src/storage/sqlite/connector-sync-policy-repository.ts
|
|
3
|
+
function stringArray(value) {
|
|
4
|
+
try {
|
|
5
|
+
const parsed = JSON.parse(value);
|
|
6
|
+
return Array.isArray(parsed) ? parsed.filter((item) => typeof item === "string") : [];
|
|
7
|
+
} catch {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function fromRow(row) {
|
|
12
|
+
return {
|
|
13
|
+
connectionId: row.connection_id,
|
|
14
|
+
scanEnabled: row.scan_enabled === 1,
|
|
15
|
+
proactiveEnabled: row.proactive_enabled === 1,
|
|
16
|
+
...row.interval_minutes == null ? {} : { intervalMinutes: row.interval_minutes },
|
|
17
|
+
allowedScenarioKeys: stringArray(row.allowed_scenario_keys_json),
|
|
18
|
+
revision: row.revision,
|
|
19
|
+
updatedAt: new Date(row.updated_at).toISOString()
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function getConnectorSyncPolicy(connectionId) {
|
|
23
|
+
const row = getSqliteDatabase().prepare("SELECT * FROM connector_sync_policies WHERE connection_id = ?").get(connectionId);
|
|
24
|
+
return row ? fromRow(row) : void 0;
|
|
25
|
+
}
|
|
26
|
+
function listConnectorSyncPolicies() {
|
|
27
|
+
return getSqliteDatabase().prepare("SELECT * FROM connector_sync_policies ORDER BY connection_id ASC").all().map(fromRow);
|
|
28
|
+
}
|
|
29
|
+
function upsertConnectorSyncPolicy(input) {
|
|
30
|
+
const current = getConnectorSyncPolicy(input.connectionId);
|
|
31
|
+
const now = input.nowMs ?? Date.now();
|
|
32
|
+
const intervalMinutes = input.intervalMinutes === null ? null : Math.max(5, Math.min(1440, input.intervalMinutes ?? current?.intervalMinutes ?? input.defaultIntervalMinutes ?? 30));
|
|
33
|
+
const allowedScenarioKeys = [...new Set((input.allowedScenarioKeys ?? current?.allowedScenarioKeys ?? []).map((key) => key.trim()).filter(Boolean))].sort();
|
|
34
|
+
runSqliteWriteTransaction((db) => {
|
|
35
|
+
db.prepare(`INSERT INTO connector_sync_policies (
|
|
36
|
+
connection_id, scan_enabled, proactive_enabled, interval_minutes,
|
|
37
|
+
allowed_scenario_keys_json, revision, updated_at
|
|
38
|
+
) VALUES (?, ?, ?, ?, ?, 1, ?)
|
|
39
|
+
ON CONFLICT(connection_id) DO UPDATE SET
|
|
40
|
+
scan_enabled = excluded.scan_enabled,
|
|
41
|
+
proactive_enabled = excluded.proactive_enabled,
|
|
42
|
+
interval_minutes = excluded.interval_minutes,
|
|
43
|
+
allowed_scenario_keys_json = excluded.allowed_scenario_keys_json,
|
|
44
|
+
revision = connector_sync_policies.revision + 1,
|
|
45
|
+
updated_at = excluded.updated_at`).run(input.connectionId, input.scanEnabled ?? current?.scanEnabled ?? true ? 1 : 0, input.proactiveEnabled ?? current?.proactiveEnabled ?? false ? 1 : 0, intervalMinutes, JSON.stringify(allowedScenarioKeys), now);
|
|
46
|
+
});
|
|
47
|
+
return getConnectorSyncPolicy(input.connectionId);
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { getConnectorSyncPolicy, listConnectorSyncPolicies, upsertConnectorSyncPolicy };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { type ExecutionFailureCode, type ExecutionFailurePhase, type ExecutionRecoveryAction, type ExecutionVerification } from '../../agent/outcomes/execution-verifier.js';
|
|
2
|
+
export type ExecutionReceiptStatus = 'running' | 'succeeded' | 'failed' | 'cancelled';
|
|
3
|
+
export type ExecutionFeedbackOutcome = 'helpful' | 'not_helpful';
|
|
4
|
+
export type ExecutionVerdict = 'achieved' | 'partial' | 'not_achieved';
|
|
5
|
+
export type ExecutionReceiptOrigin = 'chat' | 'goal' | 'workflow' | 'automation' | 'browser' | 'proactive';
|
|
6
|
+
export type ExecutionReceiptTrigger = 'user' | 'schedule' | 'webhook' | 'proactive' | 'retry';
|
|
7
|
+
export interface ExecutionReceiptContext {
|
|
8
|
+
outcomeId?: string;
|
|
9
|
+
projectId?: string;
|
|
10
|
+
goalId?: string;
|
|
11
|
+
workItemId?: string;
|
|
12
|
+
origin?: ExecutionReceiptOrigin;
|
|
13
|
+
triggerKind?: ExecutionReceiptTrigger;
|
|
14
|
+
parentRunId?: string;
|
|
15
|
+
contextTraceId?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ExecutionContract {
|
|
18
|
+
objective: string;
|
|
19
|
+
deliverables: string[];
|
|
20
|
+
acceptanceCriteria: string[];
|
|
21
|
+
constraints: string[];
|
|
22
|
+
approvalRequired: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface ExecutionEvidence {
|
|
25
|
+
kind: 'artifact' | 'test' | 'state' | 'source';
|
|
26
|
+
title: string;
|
|
27
|
+
summary: string;
|
|
28
|
+
uri?: string;
|
|
29
|
+
verifies?: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface ExecutionReceipt {
|
|
32
|
+
runId: string;
|
|
33
|
+
sessionKey: string;
|
|
34
|
+
channel: string;
|
|
35
|
+
objective: string;
|
|
36
|
+
status: ExecutionReceiptStatus;
|
|
37
|
+
summary?: string;
|
|
38
|
+
contract?: ExecutionContract;
|
|
39
|
+
contractVersion?: number;
|
|
40
|
+
attempt: number;
|
|
41
|
+
strategy?: string;
|
|
42
|
+
evidence: ExecutionEvidence[];
|
|
43
|
+
verification: ExecutionVerification;
|
|
44
|
+
context: ExecutionReceiptContext;
|
|
45
|
+
nextAction?: string;
|
|
46
|
+
needsUser: boolean;
|
|
47
|
+
completionVerdict?: ExecutionVerdict;
|
|
48
|
+
completionVerdictSource?: 'system' | 'user';
|
|
49
|
+
correctionText?: string;
|
|
50
|
+
projectionVersion: number;
|
|
51
|
+
projectedAt?: number;
|
|
52
|
+
failure?: {
|
|
53
|
+
code: ExecutionFailureCode;
|
|
54
|
+
phase: ExecutionFailurePhase;
|
|
55
|
+
recoveryAction: ExecutionRecoveryAction;
|
|
56
|
+
};
|
|
57
|
+
feedback?: {
|
|
58
|
+
outcome: ExecutionFeedbackOutcome;
|
|
59
|
+
reason?: string;
|
|
60
|
+
needsCorrection?: boolean;
|
|
61
|
+
supportFit?: boolean;
|
|
62
|
+
};
|
|
63
|
+
startedAt: number;
|
|
64
|
+
completedAt?: number;
|
|
65
|
+
updatedAt: number;
|
|
66
|
+
}
|
|
67
|
+
export interface ExecutionReceiptMetrics {
|
|
68
|
+
total: number;
|
|
69
|
+
completed: number;
|
|
70
|
+
succeeded: number;
|
|
71
|
+
verified: number;
|
|
72
|
+
helpful: number;
|
|
73
|
+
notHelpful: number;
|
|
74
|
+
completionRate: number;
|
|
75
|
+
successRate: number;
|
|
76
|
+
verificationRate: number;
|
|
77
|
+
helpfulRate: number;
|
|
78
|
+
}
|
|
79
|
+
export declare function startExecutionReceipt(input: {
|
|
80
|
+
runId: string;
|
|
81
|
+
sessionKey: string;
|
|
82
|
+
channel: string;
|
|
83
|
+
objective: string;
|
|
84
|
+
context?: ExecutionReceiptContext;
|
|
85
|
+
contract?: ExecutionContract;
|
|
86
|
+
contractVersion?: number;
|
|
87
|
+
attempt?: number;
|
|
88
|
+
strategy?: string;
|
|
89
|
+
now?: number;
|
|
90
|
+
}): ExecutionReceipt;
|
|
91
|
+
export declare function completeExecutionReceipt(input: {
|
|
92
|
+
runId: string;
|
|
93
|
+
status: Exclude<ExecutionReceiptStatus, 'running'>;
|
|
94
|
+
summary: string;
|
|
95
|
+
now?: number;
|
|
96
|
+
}): ExecutionReceipt | undefined;
|
|
97
|
+
export declare function setExecutionVerdict(input: {
|
|
98
|
+
runId: string;
|
|
99
|
+
verdict: ExecutionVerdict;
|
|
100
|
+
correctionText?: string;
|
|
101
|
+
now?: number;
|
|
102
|
+
}): ExecutionReceipt | undefined;
|
|
103
|
+
export declare function markExecutionReceiptProjected(input: {
|
|
104
|
+
runId: string;
|
|
105
|
+
projectionVersion: number;
|
|
106
|
+
now?: number;
|
|
107
|
+
}): ExecutionReceipt | undefined;
|
|
108
|
+
export declare function listUnprojectedExecutionReceipts(input: {
|
|
109
|
+
projectionVersion: number;
|
|
110
|
+
limit?: number;
|
|
111
|
+
}): ExecutionReceipt[];
|
|
112
|
+
export declare function updateExecutionReceipt(input: {
|
|
113
|
+
runId: string;
|
|
114
|
+
contract?: ExecutionContract;
|
|
115
|
+
evidence?: ExecutionEvidence[];
|
|
116
|
+
summary?: string;
|
|
117
|
+
nextAction?: string | null;
|
|
118
|
+
needsUser?: boolean;
|
|
119
|
+
contextTraceId?: string | null;
|
|
120
|
+
now?: number;
|
|
121
|
+
}): ExecutionReceipt | undefined;
|
|
122
|
+
type ExecutionReceiptFeedbackInput = {
|
|
123
|
+
outcome: ExecutionFeedbackOutcome;
|
|
124
|
+
reason?: string;
|
|
125
|
+
needsCorrection?: boolean;
|
|
126
|
+
supportFit?: boolean;
|
|
127
|
+
now?: number;
|
|
128
|
+
};
|
|
129
|
+
export declare function setExecutionReceiptFeedback(input: ExecutionReceiptFeedbackInput & {
|
|
130
|
+
sessionKey: string;
|
|
131
|
+
assistantTimestamp: number;
|
|
132
|
+
}): ExecutionReceipt | undefined;
|
|
133
|
+
export declare function setExecutionReceiptFeedbackByRunId(input: ExecutionReceiptFeedbackInput & {
|
|
134
|
+
runId: string;
|
|
135
|
+
}): ExecutionReceipt | undefined;
|
|
136
|
+
export declare function getExecutionReceipt(runId: string): ExecutionReceipt | undefined;
|
|
137
|
+
export declare function findExecutionReceiptForAssistant(sessionKey: string, assistantTimestamp: number): ExecutionReceipt | undefined;
|
|
138
|
+
export declare function listExecutionReceipts(input?: {
|
|
139
|
+
outcomeId?: string;
|
|
140
|
+
sessionKey?: string;
|
|
141
|
+
projectId?: string;
|
|
142
|
+
workItemId?: string;
|
|
143
|
+
limit?: number;
|
|
144
|
+
}): ExecutionReceipt[];
|
|
145
|
+
export declare function summarizeExecutionReceipts(): ExecutionReceiptMetrics;
|
|
146
|
+
export {};
|