@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
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { getSqliteDatabase, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
|
+
import { diagnoseExecutionFailure, verifyExecutionCompletion } from "../../agent/outcomes/execution-verifier.js";
|
|
3
|
+
//#region src/storage/sqlite/execution-receipt-repository.ts
|
|
4
|
+
function fromRow(row) {
|
|
5
|
+
const contract = row.contract_json ? JSON.parse(row.contract_json) : void 0;
|
|
6
|
+
const evidence = JSON.parse(row.evidence_json);
|
|
7
|
+
const feedback = row.feedback_outcome ? {
|
|
8
|
+
outcome: row.feedback_outcome,
|
|
9
|
+
...row.feedback_reason ? { reason: row.feedback_reason } : {},
|
|
10
|
+
...row.needs_correction === null ? {} : { needsCorrection: row.needs_correction === 1 },
|
|
11
|
+
...row.support_fit === null ? {} : { supportFit: row.support_fit === 1 }
|
|
12
|
+
} : void 0;
|
|
13
|
+
return {
|
|
14
|
+
runId: row.run_id,
|
|
15
|
+
sessionKey: row.session_key,
|
|
16
|
+
channel: row.channel,
|
|
17
|
+
objective: row.objective,
|
|
18
|
+
status: row.status,
|
|
19
|
+
...row.summary ? { summary: row.summary } : {},
|
|
20
|
+
...contract ? { contract } : {},
|
|
21
|
+
...row.contract_version === null ? {} : { contractVersion: row.contract_version },
|
|
22
|
+
attempt: row.attempt,
|
|
23
|
+
...row.strategy ? { strategy: row.strategy } : {},
|
|
24
|
+
evidence,
|
|
25
|
+
verification: {
|
|
26
|
+
...JSON.parse(row.verification_json),
|
|
27
|
+
status: row.verification_status
|
|
28
|
+
},
|
|
29
|
+
context: {
|
|
30
|
+
...row.outcome_id ? { outcomeId: row.outcome_id } : {},
|
|
31
|
+
...row.project_id ? { projectId: row.project_id } : {},
|
|
32
|
+
...row.goal_id ? { goalId: row.goal_id } : {},
|
|
33
|
+
...row.work_item_id ? { workItemId: row.work_item_id } : {},
|
|
34
|
+
...row.origin ? { origin: row.origin } : {},
|
|
35
|
+
...row.trigger_kind ? { triggerKind: row.trigger_kind } : {},
|
|
36
|
+
...row.parent_run_id ? { parentRunId: row.parent_run_id } : {},
|
|
37
|
+
...row.context_trace_id ? { contextTraceId: row.context_trace_id } : {}
|
|
38
|
+
},
|
|
39
|
+
...row.next_action ? { nextAction: row.next_action } : {},
|
|
40
|
+
needsUser: row.needs_user === 1,
|
|
41
|
+
...row.completion_verdict ? { completionVerdict: row.completion_verdict } : {},
|
|
42
|
+
...row.completion_verdict_source ? { completionVerdictSource: row.completion_verdict_source } : {},
|
|
43
|
+
...row.correction_text ? { correctionText: row.correction_text } : {},
|
|
44
|
+
projectionVersion: row.projection_version,
|
|
45
|
+
...row.projected_at === null ? {} : { projectedAt: row.projected_at },
|
|
46
|
+
...row.failure_code && row.failure_phase && row.recovery_action ? { failure: {
|
|
47
|
+
code: row.failure_code,
|
|
48
|
+
phase: row.failure_phase,
|
|
49
|
+
recoveryAction: row.recovery_action
|
|
50
|
+
} } : {},
|
|
51
|
+
...feedback ? { feedback } : {},
|
|
52
|
+
startedAt: row.started_at,
|
|
53
|
+
...row.completed_at === null ? {} : { completedAt: row.completed_at },
|
|
54
|
+
updatedAt: row.updated_at
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const SELECT_COLUMNS = `run_id, session_key, channel, objective, status, summary,
|
|
58
|
+
contract_json, evidence_json, feedback_outcome, feedback_reason,
|
|
59
|
+
needs_correction, support_fit, started_at, completed_at, updated_at,
|
|
60
|
+
verification_status, verification_json, failure_code, failure_phase, recovery_action,
|
|
61
|
+
project_id, goal_id, work_item_id, origin, trigger_kind, parent_run_id,
|
|
62
|
+
next_action, needs_user, context_trace_id, completion_verdict, completion_verdict_source, correction_text,
|
|
63
|
+
projection_version, projected_at, outcome_id, contract_version, attempt, strategy`;
|
|
64
|
+
function startExecutionReceipt(input) {
|
|
65
|
+
const now = input.now ?? Date.now();
|
|
66
|
+
runSqliteWriteTransaction((db) => {
|
|
67
|
+
const previousAttempt = input.context?.outcomeId ? db.prepare("SELECT COALESCE(MAX(attempt), 0) AS attempt FROM execution_receipts WHERE outcome_id = ?").get(input.context.outcomeId).attempt : 0;
|
|
68
|
+
const attempt = input.attempt ?? previousAttempt + 1;
|
|
69
|
+
const strategy = input.strategy ?? (attempt === 1 ? "primary" : `continuation_${attempt}`);
|
|
70
|
+
db.prepare(`INSERT INTO execution_receipts (
|
|
71
|
+
run_id, session_key, channel, objective, status, contract_json, started_at, updated_at,
|
|
72
|
+
project_id, goal_id, work_item_id, origin, trigger_kind, parent_run_id, context_trace_id,
|
|
73
|
+
outcome_id, contract_version, attempt, strategy
|
|
74
|
+
) VALUES (?, ?, ?, ?, 'running', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(input.runId, input.sessionKey, input.channel, input.objective, input.contract ? JSON.stringify(input.contract) : null, now, now, input.context?.projectId ?? null, input.context?.goalId ?? null, input.context?.workItemId ?? null, input.context?.origin ?? null, input.context?.triggerKind ?? null, input.context?.parentRunId ?? null, input.context?.contextTraceId ?? null, input.context?.outcomeId ?? null, input.contractVersion ?? null, attempt, strategy);
|
|
75
|
+
});
|
|
76
|
+
return getExecutionReceipt(input.runId);
|
|
77
|
+
}
|
|
78
|
+
function completeExecutionReceipt(input) {
|
|
79
|
+
const now = input.now ?? Date.now();
|
|
80
|
+
const current = getExecutionReceipt(input.runId);
|
|
81
|
+
if (!current) return void 0;
|
|
82
|
+
const verification = verifyExecutionCompletion({
|
|
83
|
+
status: input.status,
|
|
84
|
+
acceptanceCriteria: current.contract?.acceptanceCriteria ?? [],
|
|
85
|
+
evidence: current.evidence
|
|
86
|
+
});
|
|
87
|
+
const failure = input.status === "succeeded" ? void 0 : diagnoseExecutionFailure({
|
|
88
|
+
status: input.status,
|
|
89
|
+
summary: input.summary
|
|
90
|
+
});
|
|
91
|
+
const completionVerdict = input.status === "succeeded" ? verification.status === "passed" ? "achieved" : "partial" : "not_achieved";
|
|
92
|
+
runSqliteWriteTransaction((db) => {
|
|
93
|
+
db.prepare(`UPDATE execution_receipts
|
|
94
|
+
SET status = ?, summary = ?, completed_at = ?, updated_at = ?,
|
|
95
|
+
verification_status = ?, verification_json = ?, failure_code = ?,
|
|
96
|
+
failure_phase = ?, recovery_action = ?, completion_verdict = ?,
|
|
97
|
+
completion_verdict_source = 'system', correction_text = NULL,
|
|
98
|
+
projection_version = 0, projected_at = NULL
|
|
99
|
+
WHERE run_id = ?`).run(input.status, input.summary, now, now, verification.status, JSON.stringify({ checks: verification.checks }), failure?.code ?? null, failure?.phase ?? null, failure?.recoveryAction ?? null, completionVerdict, input.runId);
|
|
100
|
+
});
|
|
101
|
+
return getExecutionReceipt(input.runId);
|
|
102
|
+
}
|
|
103
|
+
function setExecutionVerdict(input) {
|
|
104
|
+
const current = getExecutionReceipt(input.runId);
|
|
105
|
+
if (!current || current.status === "running") return void 0;
|
|
106
|
+
const now = input.now ?? Date.now();
|
|
107
|
+
runSqliteWriteTransaction((db) => {
|
|
108
|
+
db.prepare(`UPDATE execution_receipts
|
|
109
|
+
SET completion_verdict = ?, completion_verdict_source = 'user', correction_text = ?, projection_version = 0,
|
|
110
|
+
projected_at = NULL, updated_at = ?
|
|
111
|
+
WHERE run_id = ?`).run(input.verdict, input.correctionText?.trim() || null, now, input.runId);
|
|
112
|
+
});
|
|
113
|
+
return getExecutionReceipt(input.runId);
|
|
114
|
+
}
|
|
115
|
+
function markExecutionReceiptProjected(input) {
|
|
116
|
+
const now = input.now ?? Date.now();
|
|
117
|
+
runSqliteWriteTransaction((db) => {
|
|
118
|
+
db.prepare(`UPDATE execution_receipts
|
|
119
|
+
SET projection_version = ?, projected_at = ?, updated_at = ?
|
|
120
|
+
WHERE run_id = ? AND status != 'running'`).run(input.projectionVersion, now, now, input.runId);
|
|
121
|
+
});
|
|
122
|
+
return getExecutionReceipt(input.runId);
|
|
123
|
+
}
|
|
124
|
+
function listUnprojectedExecutionReceipts(input) {
|
|
125
|
+
const limit = Math.max(1, Math.min(500, Math.floor(input.limit ?? 100)));
|
|
126
|
+
return getSqliteDatabase().prepare(`SELECT ${SELECT_COLUMNS} FROM execution_receipts
|
|
127
|
+
WHERE status != 'running' AND projection_version < ?
|
|
128
|
+
ORDER BY completed_at ASC
|
|
129
|
+
LIMIT ?`).all(input.projectionVersion, limit).map(fromRow);
|
|
130
|
+
}
|
|
131
|
+
function updateExecutionReceipt(input) {
|
|
132
|
+
const current = getExecutionReceipt(input.runId);
|
|
133
|
+
if (!current) return void 0;
|
|
134
|
+
const now = input.now ?? Date.now();
|
|
135
|
+
const contract = input.contract === void 0 ? current.contract : input.contract;
|
|
136
|
+
const evidence = input.evidence === void 0 ? current.evidence : input.evidence;
|
|
137
|
+
const summary = input.summary === void 0 ? current.summary : input.summary;
|
|
138
|
+
const nextAction = input.nextAction === void 0 ? current.nextAction : input.nextAction ?? void 0;
|
|
139
|
+
const needsUser = input.needsUser === void 0 ? current.needsUser : input.needsUser;
|
|
140
|
+
const contextTraceId = input.contextTraceId === void 0 ? current.context.contextTraceId : input.contextTraceId ?? void 0;
|
|
141
|
+
const verification = current.status !== "running" && current.completionVerdictSource !== "user" ? verifyExecutionCompletion({
|
|
142
|
+
status: current.status,
|
|
143
|
+
acceptanceCriteria: contract?.acceptanceCriteria ?? [],
|
|
144
|
+
evidence
|
|
145
|
+
}) : current.verification;
|
|
146
|
+
const completionVerdict = current.status !== "running" && current.completionVerdictSource !== "user" ? current.status === "succeeded" ? verification.status === "passed" ? "achieved" : "partial" : "not_achieved" : current.completionVerdict;
|
|
147
|
+
runSqliteWriteTransaction((db) => {
|
|
148
|
+
db.prepare(`UPDATE execution_receipts
|
|
149
|
+
SET contract_json = ?, evidence_json = ?, summary = ?, next_action = ?,
|
|
150
|
+
needs_user = ?, context_trace_id = ?, verification_status = ?,
|
|
151
|
+
verification_json = ?, completion_verdict = ?,
|
|
152
|
+
projection_version = CASE WHEN status = 'running' THEN projection_version ELSE 0 END,
|
|
153
|
+
projected_at = CASE WHEN status = 'running' THEN projected_at ELSE NULL END,
|
|
154
|
+
updated_at = ?
|
|
155
|
+
WHERE run_id = ?`).run(contract ? JSON.stringify(contract) : null, JSON.stringify(evidence), summary ?? null, nextAction ?? null, Number(needsUser), contextTraceId ?? null, verification.status, JSON.stringify({ checks: verification.checks }), completionVerdict ?? null, now, input.runId);
|
|
156
|
+
});
|
|
157
|
+
return getExecutionReceipt(input.runId);
|
|
158
|
+
}
|
|
159
|
+
function persistExecutionReceiptFeedback(runId, input) {
|
|
160
|
+
const now = input.now ?? Date.now();
|
|
161
|
+
runSqliteWriteTransaction((db) => {
|
|
162
|
+
db.prepare(`UPDATE execution_receipts
|
|
163
|
+
SET feedback_outcome = ?, feedback_reason = ?, needs_correction = ?, support_fit = ?, updated_at = ?
|
|
164
|
+
WHERE run_id = ?`).run(input.outcome, input.reason ?? null, input.needsCorrection === void 0 ? null : Number(input.needsCorrection), input.supportFit === void 0 ? null : Number(input.supportFit), now, runId);
|
|
165
|
+
});
|
|
166
|
+
return getExecutionReceipt(runId);
|
|
167
|
+
}
|
|
168
|
+
function setExecutionReceiptFeedback(input) {
|
|
169
|
+
const matched = findExecutionReceiptForAssistant(input.sessionKey, input.assistantTimestamp);
|
|
170
|
+
return matched ? persistExecutionReceiptFeedback(matched.runId, input) : void 0;
|
|
171
|
+
}
|
|
172
|
+
function setExecutionReceiptFeedbackByRunId(input) {
|
|
173
|
+
return getExecutionReceipt(input.runId) ? persistExecutionReceiptFeedback(input.runId, input) : void 0;
|
|
174
|
+
}
|
|
175
|
+
function getExecutionReceipt(runId) {
|
|
176
|
+
const row = getSqliteDatabase().prepare(`SELECT ${SELECT_COLUMNS} FROM execution_receipts WHERE run_id = ?`).get(runId);
|
|
177
|
+
return row ? fromRow(row) : void 0;
|
|
178
|
+
}
|
|
179
|
+
function findExecutionReceiptForAssistant(sessionKey, assistantTimestamp) {
|
|
180
|
+
const row = getSqliteDatabase().prepare(`SELECT ${SELECT_COLUMNS}
|
|
181
|
+
FROM execution_receipts
|
|
182
|
+
WHERE session_key = ?
|
|
183
|
+
AND started_at <= ?
|
|
184
|
+
ORDER BY started_at DESC
|
|
185
|
+
LIMIT 1`).get(sessionKey, assistantTimestamp);
|
|
186
|
+
return row ? fromRow(row) : void 0;
|
|
187
|
+
}
|
|
188
|
+
function listExecutionReceipts(input = {}) {
|
|
189
|
+
const limit = Math.max(1, Math.min(100, Math.floor(input.limit ?? 50)));
|
|
190
|
+
const filters = [];
|
|
191
|
+
const values = [];
|
|
192
|
+
if (input.outcomeId) {
|
|
193
|
+
filters.push("outcome_id = ?");
|
|
194
|
+
values.push(input.outcomeId);
|
|
195
|
+
}
|
|
196
|
+
if (input.sessionKey) {
|
|
197
|
+
filters.push("session_key = ?");
|
|
198
|
+
values.push(input.sessionKey);
|
|
199
|
+
}
|
|
200
|
+
if (input.projectId) {
|
|
201
|
+
filters.push("project_id = ?");
|
|
202
|
+
values.push(input.projectId);
|
|
203
|
+
}
|
|
204
|
+
if (input.workItemId) {
|
|
205
|
+
filters.push("work_item_id = ?");
|
|
206
|
+
values.push(input.workItemId);
|
|
207
|
+
}
|
|
208
|
+
const where = filters.length > 0 ? `WHERE ${filters.join(" AND ")}` : "";
|
|
209
|
+
return getSqliteDatabase().prepare(`SELECT ${SELECT_COLUMNS} FROM execution_receipts ${where} ORDER BY started_at DESC LIMIT ?`).all(...values, limit).map((row) => fromRow(row));
|
|
210
|
+
}
|
|
211
|
+
function summarizeExecutionReceipts() {
|
|
212
|
+
const row = getSqliteDatabase().prepare(`SELECT
|
|
213
|
+
COUNT(*) AS total,
|
|
214
|
+
SUM(CASE WHEN status != 'running' THEN 1 ELSE 0 END) AS completed,
|
|
215
|
+
SUM(CASE WHEN status = 'succeeded' THEN 1 ELSE 0 END) AS succeeded,
|
|
216
|
+
SUM(CASE WHEN verification_status = 'passed' THEN 1 ELSE 0 END) AS verified,
|
|
217
|
+
SUM(CASE WHEN feedback_outcome = 'helpful' THEN 1 ELSE 0 END) AS helpful,
|
|
218
|
+
SUM(CASE WHEN feedback_outcome = 'not_helpful' THEN 1 ELSE 0 END) AS not_helpful
|
|
219
|
+
FROM execution_receipts`).get();
|
|
220
|
+
const rated = row.helpful + row.not_helpful;
|
|
221
|
+
return {
|
|
222
|
+
total: row.total,
|
|
223
|
+
completed: row.completed,
|
|
224
|
+
succeeded: row.succeeded,
|
|
225
|
+
verified: row.verified,
|
|
226
|
+
helpful: row.helpful,
|
|
227
|
+
notHelpful: row.not_helpful,
|
|
228
|
+
completionRate: row.total ? row.completed / row.total : 0,
|
|
229
|
+
successRate: row.completed ? row.succeeded / row.completed : 0,
|
|
230
|
+
verificationRate: row.completed ? row.verified / row.completed : 0,
|
|
231
|
+
helpfulRate: rated ? row.helpful / rated : 0
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
//#endregion
|
|
235
|
+
export { completeExecutionReceipt, findExecutionReceiptForAssistant, getExecutionReceipt, listExecutionReceipts, listUnprojectedExecutionReceipts, markExecutionReceiptProjected, setExecutionReceiptFeedback, setExecutionReceiptFeedbackByRunId, setExecutionVerdict, startExecutionReceipt, summarizeExecutionReceipts, updateExecutionReceipt };
|
|
@@ -10,8 +10,9 @@ export { getUserClaim, linkUserClaimMemoryRecord, listUserClaimEvidence, listUse
|
|
|
10
10
|
export { claimNextConnectorLearningJob, enqueueConnectorLearningJob, listConnectorLearningJobs, recoverStaleConnectorLearningJobs, setConnectorLearningPaused, updateConnectorLearningJob, type ConnectorLearningJob, type ConnectorLearningMode, type ConnectorLearningPhase, type ConnectorLearningStatus, } from './connector-learning-repository.js';
|
|
11
11
|
export { appendComposerInputHistory, clearComposerInputHistory, listComposerInputHistory, COMPOSER_INPUT_HISTORY_LIMIT, type ComposerInputHistoryItem, } from './composer-input-history-repository.js';
|
|
12
12
|
export { getInteractionState, setInteractionState, updateInteractionStateFromMessage, type InteractionState, } from './interaction-state-repository.js';
|
|
13
|
+
export { getSessionTaskPlan, setSessionTaskPlan, type SessionTaskPlan, type SessionTaskPlanItem, type SessionTaskPlanItemStatus, } from './session-task-plan-repository.js';
|
|
13
14
|
export { buildRelationshipPrompt, getRelationshipSettings, isProactiveSupportAllowed, updateRelationshipSettings, type RelationshipSettings, type SupportMode, } from './relationship-settings-repository.js';
|
|
14
|
-
export {
|
|
15
|
+
export { completeExecutionReceipt, findExecutionReceiptForAssistant, getExecutionReceipt, listExecutionReceipts, listUnprojectedExecutionReceipts, markExecutionReceiptProjected, setExecutionVerdict, setExecutionReceiptFeedback, setExecutionReceiptFeedbackByRunId, startExecutionReceipt, summarizeExecutionReceipts, updateExecutionReceipt, type ExecutionContract, type ExecutionVerdict, type ExecutionEvidence, type ExecutionFeedbackOutcome, type ExecutionReceipt, type ExecutionReceiptContext, type ExecutionReceiptMetrics, type ExecutionReceiptOrigin, type ExecutionReceiptStatus, type ExecutionReceiptTrigger, } from './execution-receipt-repository.js';
|
|
15
16
|
export { buildDefaultSessionMetadata, type SessionMetadataSeed, } from './session-metadata.js';
|
|
16
17
|
export { buildGlobalSessionStats, classifyStoredRow, estimateTokensFromMessages, extractFtsContent, metadataToSessionInsert, sessionConfigRowToConfig, sessionRowToMetadata, transcriptEntryRowToStoredRow, type SessionConfigRow, type SessionRow, type TranscriptEntryRow, } from './row-mappers.js';
|
|
17
18
|
export { deleteSessionRecord, ensureSessionRecord, getCurrentSessionId, getGlobalSessionStats, findSessionKeyBySessionId, getSessionPersistedLevels, getSessionMetadata, incrementSessionStatsOnAppend, listSessionMetadata, listSessionsByAgent, patchSessionMetadata, resetSessionRecord, resolveSessionAgentId, updateSessionStats, } from './session-repository.js';
|
|
@@ -22,8 +23,9 @@ export { searchMemoryIndex, syncMemoryIndex, type MemorySearchHit, } from './mem
|
|
|
22
23
|
export { appendMemorySignal, appendMemoryTraceEvent, deleteMemoryRecord, findLatestMemoryInjectTrace, getMemoryProviderState, getMemoryRecord, hasUnresolvedMemoryConflict, listMemorySignals, listMemoryTraceEvents, listMemoryRecords, markMemoryRecordsConflicted, searchMemoryRecords, setMemoryProviderState, setMemoryTraceFeedback, setLatestMemoryInjectFeedback, summarizeMemoryRecallFeedback, summarizeUserUnderstandingQuality, USER_UNDERSTANDING_REMEDIATION_POLICY, upsertMemoryRecord, type AppendMemorySignalInput, type AppendMemoryTraceEventInput, type FindLatestMemoryInjectTraceInput, type ListMemoryRecordsOptions, type MemoryRecallFeedbackSummary, type MemoryFeedbackRemediationResult, type MemorySignalRowPayload, type MemoryTraceFeedback, type MemoryTraceEventPayload, type UserUnderstandingQualityMetrics, type SearchMemoryRecordsOptions, type SetMemoryTraceFeedbackInput, type SetLatestMemoryInjectFeedbackInput, type UpsertMemoryRecordInput, } from './memory-records-repository.js';
|
|
23
24
|
export { attachMemoryEvidence, claimKnowledgeSourceItems, completeKnowledgeSourceItemSynthesis, deleteMemoryEvidenceForRecord, finishKnowledgeSyncRun, getKnowledgeConsumerWatermark, getKnowledgeSourceCursor, getKnowledgeSourceItem, listKnowledgeSourceItems, listKnowledgeSourceChanges, listKnowledgeSyncRuns, listMemoryEvidence, pruneBoundedKnowledgeSourceItems, setKnowledgeSourceItemSynthesisStatus, setKnowledgeConsumerWatermark, setKnowledgeSourceCursor, startKnowledgeSyncRun, upsertKnowledgeSourceItems, } from './knowledge-repository.js';
|
|
24
25
|
export { deleteSessionConfig, getSessionConfig, hasSessionConfig, setSessionConfig, updateSessionConfig, } from './config-repository.js';
|
|
25
|
-
export { createObjectLinkRecord, getActivityEventRecord, listActivityRecords, listObjectActivityRecords, listObjectLinkRecords, listProjectActivityRecords, recordActivityEvent, } from './activity-repository.js';
|
|
26
|
+
export { createObjectLinkRecord, deleteObjectLinkRecord, getActivityEventRecord, listActivityRecords, listObjectActivityRecords, listObjectLinkRecords, listProjectActivityRecords, recordActivityEvent, } from './activity-repository.js';
|
|
26
27
|
export { appendConnectorExecutionAudit, claimConnectorWebhookDelivery, completeConnectorWebhookDelivery, consumeConnectorApproval, createConnectorApproval, decideConnectorApproval, deleteConnectorConnection, deleteConnectorInstallation, getConnectorConnection, getConnectorApproval, getConnectorInstallation, getCachedConnectorCatalogEntry, listCachedConnectorCatalogEntries, listConnectorActionMetadata, listConnectorApprovals, listConnectorConnections, listConnectorExecutionAudit, listConnectorInstallations, releaseConnectorWebhookDelivery, replaceConnectorCatalogEntries, upsertConnectorActionMetadata, upsertConnectorCatalogEntry, upsertConnectorConnection, upsertConnectorInstallation, type CachedConnectorCatalogEntry, } from './connector-repository.js';
|
|
28
|
+
export { getConnectorSyncPolicy, listConnectorSyncPolicies, upsertConnectorSyncPolicy, type ConnectorSyncPolicy, } from './connector-sync-policy-repository.js';
|
|
27
29
|
export { getUserTrustPolicy, setUserTrustPolicy, } from './user-trust-repository.js';
|
|
28
30
|
export { consumeMemoryReferenceConsent, decideMemoryReferenceConsent, ensureMemoryReferenceConsentRequest, hasMemoryReferenceConsent, listMemoryReferenceConsents, revokeMemoryReferenceConsent, type MemoryReferenceConsent, type MemoryReferenceGrantScope, } from './memory-reference-consent-repository.js';
|
|
29
31
|
export { getUserProfilePromptState, setUserProfilePromptState, } from './user-profile-setup-repository.js';
|
|
@@ -11,11 +11,12 @@ import { getUserClaim, linkUserClaimMemoryRecord, listUserClaimEvidence, listUse
|
|
|
11
11
|
import { claimNextConnectorLearningJob, enqueueConnectorLearningJob, listConnectorLearningJobs, recoverStaleConnectorLearningJobs, setConnectorLearningPaused, updateConnectorLearningJob } from "./connector-learning-repository.js";
|
|
12
12
|
import { COMPOSER_INPUT_HISTORY_LIMIT, appendComposerInputHistory, clearComposerInputHistory, listComposerInputHistory } from "./composer-input-history-repository.js";
|
|
13
13
|
import { getInteractionState, setInteractionState, updateInteractionStateFromMessage } from "./interaction-state-repository.js";
|
|
14
|
-
import { buildRelationshipPrompt, getRelationshipSettings, isProactiveSupportAllowed, updateRelationshipSettings } from "./relationship-settings-repository.js";
|
|
15
|
-
import { completeTaskOutcome, findTaskOutcomeForAssistant, getTaskOutcome, listTaskOutcomes, setTaskOutcomeFeedback, startTaskOutcome, summarizeTaskOutcomes, updateTaskOutcome } from "./task-outcome-repository.js";
|
|
16
14
|
import { buildDefaultSessionMetadata } from "./session-metadata.js";
|
|
17
15
|
import { buildGlobalSessionStats, classifyStoredRow, estimateTokensFromMessages, extractFtsContent, metadataToSessionInsert, sessionConfigRowToConfig, sessionRowToMetadata, transcriptEntryRowToStoredRow } from "./row-mappers.js";
|
|
18
16
|
import { deleteSessionRecord, ensureSessionRecord, findSessionKeyBySessionId, getCurrentSessionId, getGlobalSessionStats, getSessionMetadata, getSessionPersistedLevels, incrementSessionStatsOnAppend, listSessionMetadata, listSessionsByAgent, patchSessionMetadata, resetSessionRecord, resolveSessionAgentId, updateSessionStats } from "./session-repository.js";
|
|
17
|
+
import { getSessionTaskPlan, setSessionTaskPlan } from "./session-task-plan-repository.js";
|
|
18
|
+
import { buildRelationshipPrompt, getRelationshipSettings, isProactiveSupportAllowed, updateRelationshipSettings } from "./relationship-settings-repository.js";
|
|
19
|
+
import { completeExecutionReceipt, findExecutionReceiptForAssistant, getExecutionReceipt, listExecutionReceipts, listUnprojectedExecutionReceipts, markExecutionReceiptProjected, setExecutionReceiptFeedback, setExecutionReceiptFeedbackByRunId, setExecutionVerdict, startExecutionReceipt, summarizeExecutionReceipts, updateExecutionReceipt } from "./execution-receipt-repository.js";
|
|
19
20
|
import { appendCompactionBoundary, appendTranscriptEntry, listCompactionBoundaries, loadLlmMessagesForSession, loadTranscriptHistoryRowsForSession, loadTranscriptRows, loadTranscriptRowsForSession, paginateTranscriptMessages, replaceTranscriptRows, restoreBeforeCompactionBoundary } from "./transcript-repository.js";
|
|
20
21
|
import { deleteNoteRecord, getNoteRecord, listNoteRecords, upsertNoteRecord } from "./notes-repository.js";
|
|
21
22
|
import { deleteNoteAgentContextRecord, getNoteAgentContextRecord, upsertNoteAgentContextRecord } from "./note-agent-context-repository.js";
|
|
@@ -23,9 +24,10 @@ import { searchMemoryIndex, syncMemoryIndex } from "./memory-index-repository.js
|
|
|
23
24
|
import { USER_UNDERSTANDING_REMEDIATION_POLICY, appendMemorySignal, appendMemoryTraceEvent, deleteMemoryRecord, findLatestMemoryInjectTrace, getMemoryProviderState, getMemoryRecord, hasUnresolvedMemoryConflict, listMemoryRecords, listMemorySignals, listMemoryTraceEvents, markMemoryRecordsConflicted, searchMemoryRecords, setLatestMemoryInjectFeedback, setMemoryProviderState, setMemoryTraceFeedback, summarizeMemoryRecallFeedback, summarizeUserUnderstandingQuality, upsertMemoryRecord } from "./memory-records-repository.js";
|
|
24
25
|
import { attachMemoryEvidence, claimKnowledgeSourceItems, completeKnowledgeSourceItemSynthesis, deleteMemoryEvidenceForRecord, finishKnowledgeSyncRun, getKnowledgeConsumerWatermark, getKnowledgeSourceCursor, getKnowledgeSourceItem, listKnowledgeSourceChanges, listKnowledgeSourceItems, listKnowledgeSyncRuns, listMemoryEvidence, pruneBoundedKnowledgeSourceItems, setKnowledgeConsumerWatermark, setKnowledgeSourceCursor, setKnowledgeSourceItemSynthesisStatus, startKnowledgeSyncRun, upsertKnowledgeSourceItems } from "./knowledge-repository.js";
|
|
25
26
|
import { deleteSessionConfig, getSessionConfig, hasSessionConfig, setSessionConfig, updateSessionConfig } from "./config-repository.js";
|
|
26
|
-
import { createObjectLinkRecord, getActivityEventRecord, listActivityRecords, listObjectActivityRecords, listObjectLinkRecords, listProjectActivityRecords, recordActivityEvent } from "./activity-repository.js";
|
|
27
|
+
import { createObjectLinkRecord, deleteObjectLinkRecord, getActivityEventRecord, listActivityRecords, listObjectActivityRecords, listObjectLinkRecords, listProjectActivityRecords, recordActivityEvent } from "./activity-repository.js";
|
|
27
28
|
import { appendConnectorExecutionAudit, claimConnectorWebhookDelivery, completeConnectorWebhookDelivery, consumeConnectorApproval, createConnectorApproval, decideConnectorApproval, deleteConnectorConnection, deleteConnectorInstallation, getCachedConnectorCatalogEntry, getConnectorApproval, getConnectorConnection, getConnectorInstallation, listCachedConnectorCatalogEntries, listConnectorActionMetadata, listConnectorApprovals, listConnectorConnections, listConnectorExecutionAudit, listConnectorInstallations, releaseConnectorWebhookDelivery, replaceConnectorCatalogEntries, upsertConnectorActionMetadata, upsertConnectorCatalogEntry, upsertConnectorConnection, upsertConnectorInstallation } from "./connector-repository.js";
|
|
29
|
+
import { getConnectorSyncPolicy, listConnectorSyncPolicies, upsertConnectorSyncPolicy } from "./connector-sync-policy-repository.js";
|
|
28
30
|
import { getUserTrustPolicy, setUserTrustPolicy } from "./user-trust-repository.js";
|
|
29
31
|
import { consumeMemoryReferenceConsent, decideMemoryReferenceConsent, ensureMemoryReferenceConsentRequest, hasMemoryReferenceConsent, listMemoryReferenceConsents, revokeMemoryReferenceConsent } from "./memory-reference-consent-repository.js";
|
|
30
32
|
import { getUserProfilePromptState, setUserProfilePromptState } from "./user-profile-setup-repository.js";
|
|
31
|
-
export { COMPOSER_INPUT_HISTORY_LIMIT, DatabaseSchemaMigrationGapError, DatabaseSchemaTooNewError, SCHEMA_META_SCHEMA_VERSION_KEY, USER_UNDERSTANDING_REMEDIATION_POLICY, XOPC_DB_BASELINE_SCHEMA_VERSION, XOPC_DB_FILENAME, XOPC_DB_SCHEMA_VERSION, acknowledgeHomeAttention, appendCompactionBoundary, appendComposerInputHistory, appendConnectorExecutionAudit, appendMemorySignal, appendMemoryTraceEvent, appendTranscriptEntry, applyPendingMigrations, attachMemoryEvidence, buildDefaultSessionMetadata, buildGlobalSessionStats, buildRelationshipPrompt, claimConnectorWebhookDelivery, claimKnowledgeSourceItems, claimNextConnectorLearningJob, classifyStoredRow, clearComposerInputHistory, closeXopcDatabase, completeConnectorWebhookDelivery,
|
|
33
|
+
export { COMPOSER_INPUT_HISTORY_LIMIT, DatabaseSchemaMigrationGapError, DatabaseSchemaTooNewError, SCHEMA_META_SCHEMA_VERSION_KEY, USER_UNDERSTANDING_REMEDIATION_POLICY, XOPC_DB_BASELINE_SCHEMA_VERSION, XOPC_DB_FILENAME, XOPC_DB_SCHEMA_VERSION, acknowledgeHomeAttention, appendCompactionBoundary, appendComposerInputHistory, appendConnectorExecutionAudit, appendMemorySignal, appendMemoryTraceEvent, appendTranscriptEntry, applyPendingMigrations, attachMemoryEvidence, buildDefaultSessionMetadata, buildGlobalSessionStats, buildRelationshipPrompt, claimConnectorWebhookDelivery, claimKnowledgeSourceItems, claimNextConnectorLearningJob, classifyStoredRow, clearComposerInputHistory, closeXopcDatabase, completeConnectorWebhookDelivery, completeExecutionReceipt, completeKnowledgeSourceItemSynthesis, consumeConnectorApproval, consumeMemoryReferenceConsent, createConnectorApproval, createObjectLinkRecord, decideConnectorApproval, decideMemoryReferenceConsent, deleteConnectorConnection, deleteConnectorInstallation, deleteMemoryEvidenceForRecord, deleteMemoryRecord, deleteNoteAgentContextRecord, deleteNoteRecord, deleteObjectLinkRecord, deleteSessionConfig, deleteSessionRecord, discoverSqlMigrations, enqueueConnectorLearningJob, ensureMemoryReferenceConsentRequest, ensureSessionRecord, ensureXopcDatabaseSchema, estimateTokensFromMessages, extractFtsContent, findExecutionReceiptForAssistant, findLatestMemoryInjectTrace, findSessionKeyBySessionId, finishKnowledgeSyncRun, getActivityEventRecord, getCachedConnectorCatalogEntry, getConnectorApproval, getConnectorConnection, getConnectorInstallation, getConnectorSyncPolicy, getCurrentSessionId, getExecutionReceipt, getGlobalSessionStats, getInteractionState, getKnowledgeConsumerWatermark, getKnowledgeSourceCursor, getKnowledgeSourceItem, getMemoryProviderState, getMemoryRecord, getNoteAgentContextRecord, getNoteRecord, getRelationshipSettings, getSessionConfig, getSessionMetadata, getSessionPersistedLevels, getSessionTaskPlan, getSqliteDatabase, getUserClaim, getUserProfilePromptState, getUserTrustPolicy, getXopcDatabase, hasMemoryReferenceConsent, hasSessionConfig, hasUnresolvedMemoryConflict, incrementSessionStatsOnAppend, inspectSchemaMigrationStatus, isHomeAttentionAcknowledged, isProactiveSupportAllowed, isXopcDatabaseOpen, linkUserClaimMemoryRecord, listActivityRecords, listCachedConnectorCatalogEntries, listCompactionBoundaries, listComposerInputHistory, listConnectorActionMetadata, listConnectorApprovals, listConnectorConnections, listConnectorExecutionAudit, listConnectorInstallations, listConnectorLearningJobs, listConnectorSyncPolicies, listExecutionReceipts, listKnowledgeSourceChanges, listKnowledgeSourceItems, listKnowledgeSyncRuns, listMemoryEvidence, listMemoryRecords, listMemoryReferenceConsents, listMemorySignals, listMemoryTraceEvents, listNoteRecords, listObjectActivityRecords, listObjectLinkRecords, listProjectActivityRecords, listRegisteredMigrationTargets, listSessionMetadata, listSessionsByAgent, listUnprojectedExecutionReceipts, listUserClaimEvidence, listUserClaimStatsBySource, listUserClaims, listUserPeopleGraphRows, loadLlmMessagesForSession, loadTranscriptHistoryRowsForSession, loadTranscriptRows, loadTranscriptRowsForSession, markExecutionReceiptProjected, markMemoryRecordsConflicted, metadataToSessionInsert, openXopcDatabase, paginateTranscriptMessages, patchSessionMetadata, pruneBoundedKnowledgeSourceItems, readSchemaVersion, readSchemaVersionForTest, recordActivityEvent, recoverStaleConnectorLearningJobs, reinforceUserClaim, releaseConnectorWebhookDelivery, removeUserClaimEvidenceForSource, replaceConnectorCatalogEntries, replaceTranscriptRows, requireXopcDatabase, resetSessionRecord, resetXopcDatabaseSingletonForTest, resolveMigrationsDir, resolveSessionAgentId, resolveUserEntity, resolveXopcDatabasePath, restoreBeforeCompactionBoundary, revokeMemoryReferenceConsent, runSqliteWriteTransaction, searchMemoryIndex, searchMemoryRecords, sessionConfigRowToConfig, sessionRowToMetadata, setConnectorLearningPaused, setExecutionReceiptFeedback, setExecutionReceiptFeedbackByRunId, setExecutionVerdict, setInteractionState, setKnowledgeConsumerWatermark, setKnowledgeSourceCursor, setKnowledgeSourceItemSynthesisStatus, setLatestMemoryInjectFeedback, setMemoryProviderState, setMemoryTraceFeedback, setSessionConfig, setSessionTaskPlan, setUserClaimDecision, setUserProfilePromptState, setUserTrustPolicy, startExecutionReceipt, startKnowledgeSyncRun, summarizeExecutionReceipts, summarizeMemoryRecallFeedback, summarizeUserUnderstandingQuality, syncMemoryIndex, transcriptEntryRowToStoredRow, updateConnectorLearningJob, updateExecutionReceipt, updateInteractionStateFromMessage, updateRelationshipSettings, updateSessionConfig, updateSessionStats, upsertConnectorActionMetadata, upsertConnectorCatalogEntry, upsertConnectorConnection, upsertConnectorInstallation, upsertConnectorSyncPolicy, upsertKnowledgeSourceItems, upsertMemoryRecord, upsertNoteAgentContextRecord, upsertNoteRecord };
|
|
@@ -42,6 +42,9 @@ export declare function listKnowledgeSourceItems(options?: {
|
|
|
42
42
|
collectionScope?: string;
|
|
43
43
|
itemType?: string;
|
|
44
44
|
synthesisStatus?: KnowledgeSynthesisStatus;
|
|
45
|
+
occurredAfterMs?: number;
|
|
46
|
+
occurredBeforeMs?: number;
|
|
47
|
+
orderBy?: 'recency_desc' | 'occurred_asc';
|
|
45
48
|
includeDeleted?: boolean;
|
|
46
49
|
limit?: number;
|
|
47
50
|
offset?: number;
|
|
@@ -252,12 +252,20 @@ function listKnowledgeSourceItems(options = {}) {
|
|
|
252
252
|
where.push("synthesis_status = ?");
|
|
253
253
|
params.push(options.synthesisStatus);
|
|
254
254
|
}
|
|
255
|
+
if (options.occurredAfterMs !== void 0) {
|
|
256
|
+
where.push("occurred_at > ?");
|
|
257
|
+
params.push(options.occurredAfterMs);
|
|
258
|
+
}
|
|
259
|
+
if (options.occurredBeforeMs !== void 0) {
|
|
260
|
+
where.push("occurred_at <= ?");
|
|
261
|
+
params.push(options.occurredBeforeMs);
|
|
262
|
+
}
|
|
255
263
|
if (!options.includeDeleted) where.push("deleted_at IS NULL");
|
|
256
264
|
const limit = Math.max(1, Math.min(500, options.limit ?? 100));
|
|
257
265
|
const offset = Math.max(0, options.offset ?? 0);
|
|
258
266
|
return getSqliteDatabase().prepare(`SELECT * FROM knowledge_source_items
|
|
259
267
|
${where.length > 0 ? `WHERE ${where.join(" AND ")}` : ""}
|
|
260
|
-
ORDER BY COALESCE(source_updated_at, occurred_at, updated_at) DESC
|
|
268
|
+
ORDER BY ${options.orderBy === "occurred_asc" ? "occurred_at ASC, item_id ASC" : "COALESCE(source_updated_at, occurred_at, updated_at) DESC"}
|
|
261
269
|
LIMIT ? OFFSET ?`).all(...params, limit, offset).map(sourceItemFromRow);
|
|
262
270
|
}
|
|
263
271
|
function pruneBoundedKnowledgeSourceItems(sourceInstanceId, olderThanMs) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSqliteDatabase, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
|
-
import { LOCAL_USER_ID } from "../../user-context/owner.js";
|
|
3
2
|
import { buildFts5SearchQuery, fts5RankToScore, memoryLexicalSimilarity } from "./fts.js";
|
|
3
|
+
import { LOCAL_USER_ID } from "../../user-context/owner.js";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
//#region src/storage/sqlite/memory-records-repository.ts
|
|
6
6
|
const USER_UNDERSTANDING_REMEDIATION_POLICY = {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
CREATE TABLE connector_sync_policies (
|
|
2
|
+
connection_id TEXT PRIMARY KEY,
|
|
3
|
+
scan_enabled INTEGER NOT NULL DEFAULT 1 CHECK(scan_enabled IN (0, 1)),
|
|
4
|
+
proactive_enabled INTEGER NOT NULL DEFAULT 0 CHECK(proactive_enabled IN (0, 1)),
|
|
5
|
+
interval_minutes INTEGER CHECK(interval_minutes IS NULL OR interval_minutes BETWEEN 5 AND 1440),
|
|
6
|
+
allowed_scenario_keys_json TEXT NOT NULL DEFAULT '[]',
|
|
7
|
+
revision INTEGER NOT NULL DEFAULT 1,
|
|
8
|
+
updated_at INTEGER NOT NULL,
|
|
9
|
+
FOREIGN KEY(connection_id) REFERENCES connector_connections(id) ON DELETE CASCADE
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
CREATE INDEX idx_connector_sync_policies_proactive
|
|
13
|
+
ON connector_sync_policies(proactive_enabled, connection_id);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
INSERT INTO proactive_scenarios (
|
|
2
|
+
scenario_key,
|
|
3
|
+
version,
|
|
4
|
+
title,
|
|
5
|
+
description,
|
|
6
|
+
base_prompt,
|
|
7
|
+
base_template_version,
|
|
8
|
+
event_types_json,
|
|
9
|
+
condition_json,
|
|
10
|
+
aggregation,
|
|
11
|
+
debounce_seconds,
|
|
12
|
+
max_window_seconds,
|
|
13
|
+
created_at,
|
|
14
|
+
updated_at
|
|
15
|
+
) VALUES (
|
|
16
|
+
'meeting_preparation',
|
|
17
|
+
1,
|
|
18
|
+
'Meeting preparation',
|
|
19
|
+
'Prepare for an upcoming meeting using authorized calendar and internal context.',
|
|
20
|
+
'Assess whether the upcoming meeting needs preparation. Produce a concise brief only when it adds material value. Connect calendar facts to goals, notes, and user understanding only when the evidence explicitly supports the relationship. Never invent attendees, intent, commitments, or missing context.',
|
|
21
|
+
1,
|
|
22
|
+
'["connected_source.calendar_window.v1"]',
|
|
23
|
+
NULL,
|
|
24
|
+
'subject',
|
|
25
|
+
60,
|
|
26
|
+
300,
|
|
27
|
+
datetime('now'),
|
|
28
|
+
datetime('now')
|
|
29
|
+
);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS discussion_captures (
|
|
2
|
+
id TEXT PRIMARY KEY,
|
|
3
|
+
client_request_id TEXT NOT NULL UNIQUE,
|
|
4
|
+
note_id TEXT NOT NULL UNIQUE,
|
|
5
|
+
project_id TEXT,
|
|
6
|
+
audio_attachment_id TEXT,
|
|
7
|
+
status TEXT NOT NULL CHECK (status IN (
|
|
8
|
+
'awaiting_upload',
|
|
9
|
+
'queued',
|
|
10
|
+
'transcribing',
|
|
11
|
+
'analyzing',
|
|
12
|
+
'review_required',
|
|
13
|
+
'completed',
|
|
14
|
+
'failed',
|
|
15
|
+
'cancelled'
|
|
16
|
+
)),
|
|
17
|
+
failed_stage TEXT,
|
|
18
|
+
capture_mode TEXT NOT NULL CHECK (capture_mode IN ('solo', 'conversation')),
|
|
19
|
+
consent_confirmed INTEGER NOT NULL DEFAULT 0,
|
|
20
|
+
language_hint TEXT,
|
|
21
|
+
duration_ms INTEGER,
|
|
22
|
+
mime_type TEXT,
|
|
23
|
+
audio_size_bytes INTEGER,
|
|
24
|
+
audio_sha256 TEXT,
|
|
25
|
+
transcript_raw TEXT,
|
|
26
|
+
transcript_sha256 TEXT,
|
|
27
|
+
transcript_language TEXT,
|
|
28
|
+
stt_provider TEXT,
|
|
29
|
+
analysis_json TEXT,
|
|
30
|
+
analysis_version INTEGER NOT NULL DEFAULT 0,
|
|
31
|
+
analysis_input_hash TEXT,
|
|
32
|
+
analyzer_model_ref TEXT,
|
|
33
|
+
review_json TEXT,
|
|
34
|
+
review_revision INTEGER NOT NULL DEFAULT 0,
|
|
35
|
+
attempt_count INTEGER NOT NULL DEFAULT 0,
|
|
36
|
+
next_attempt_at INTEGER,
|
|
37
|
+
lease_owner TEXT,
|
|
38
|
+
lease_expires_at INTEGER,
|
|
39
|
+
last_error_code TEXT,
|
|
40
|
+
last_error_message TEXT,
|
|
41
|
+
created_at INTEGER NOT NULL,
|
|
42
|
+
updated_at INTEGER NOT NULL,
|
|
43
|
+
completed_at INTEGER,
|
|
44
|
+
reviewed_at INTEGER,
|
|
45
|
+
audio_deleted_at INTEGER,
|
|
46
|
+
FOREIGN KEY (note_id) REFERENCES notes(note_id) ON DELETE CASCADE,
|
|
47
|
+
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE SET NULL
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
CREATE INDEX IF NOT EXISTS idx_discussion_captures_queue
|
|
51
|
+
ON discussion_captures(status, next_attempt_at, created_at);
|
|
52
|
+
|
|
53
|
+
CREATE INDEX IF NOT EXISTS idx_discussion_captures_project
|
|
54
|
+
ON discussion_captures(project_id, updated_at DESC);
|
|
55
|
+
|
|
56
|
+
CREATE TABLE IF NOT EXISTS discussion_action_conversions (
|
|
57
|
+
discussion_id TEXT NOT NULL,
|
|
58
|
+
action_id TEXT NOT NULL,
|
|
59
|
+
work_item_id TEXT NOT NULL UNIQUE,
|
|
60
|
+
created_at INTEGER NOT NULL,
|
|
61
|
+
PRIMARY KEY (discussion_id, action_id),
|
|
62
|
+
FOREIGN KEY (discussion_id) REFERENCES discussion_captures(id) ON DELETE CASCADE,
|
|
63
|
+
FOREIGN KEY (work_item_id) REFERENCES work_items(id) ON DELETE CASCADE
|
|
64
|
+
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
INSERT OR IGNORE INTO proactive_scenarios (
|
|
2
|
+
scenario_key,
|
|
3
|
+
version,
|
|
4
|
+
title,
|
|
5
|
+
description,
|
|
6
|
+
base_prompt,
|
|
7
|
+
base_template_version,
|
|
8
|
+
event_types_json,
|
|
9
|
+
condition_json,
|
|
10
|
+
aggregation,
|
|
11
|
+
debounce_seconds,
|
|
12
|
+
max_window_seconds,
|
|
13
|
+
created_at,
|
|
14
|
+
updated_at
|
|
15
|
+
) VALUES (
|
|
16
|
+
'discussion_follow_up',
|
|
17
|
+
1,
|
|
18
|
+
'Discussion follow-up',
|
|
19
|
+
'Identify useful next steps after a user-reviewed discussion.',
|
|
20
|
+
'Assess whether the reviewed discussion needs a concise follow-up suggestion. Prioritize missing owners, missing dates, unresolved questions, and material risks. Use only authorized context, never invent commitments or people, and never perform external actions automatically.',
|
|
21
|
+
1,
|
|
22
|
+
'["discussion.completed.v1"]',
|
|
23
|
+
NULL,
|
|
24
|
+
'subject',
|
|
25
|
+
60,
|
|
26
|
+
300,
|
|
27
|
+
datetime('now'),
|
|
28
|
+
datetime('now')
|
|
29
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ALTER TABLE task_outcomes ADD COLUMN project_id TEXT;
|
|
2
|
+
ALTER TABLE task_outcomes ADD COLUMN goal_id TEXT;
|
|
3
|
+
ALTER TABLE task_outcomes ADD COLUMN work_item_id TEXT;
|
|
4
|
+
ALTER TABLE task_outcomes ADD COLUMN origin TEXT;
|
|
5
|
+
ALTER TABLE task_outcomes ADD COLUMN trigger_kind TEXT;
|
|
6
|
+
ALTER TABLE task_outcomes ADD COLUMN parent_run_id TEXT;
|
|
7
|
+
ALTER TABLE task_outcomes ADD COLUMN next_action TEXT;
|
|
8
|
+
ALTER TABLE task_outcomes ADD COLUMN needs_user INTEGER NOT NULL DEFAULT 0;
|
|
9
|
+
ALTER TABLE task_outcomes ADD COLUMN context_trace_id TEXT;
|
|
10
|
+
|
|
11
|
+
CREATE INDEX idx_task_outcomes_project_updated
|
|
12
|
+
ON task_outcomes(project_id, updated_at DESC);
|
|
13
|
+
|
|
14
|
+
CREATE INDEX idx_task_outcomes_work_item_updated
|
|
15
|
+
ON task_outcomes(work_item_id, updated_at DESC);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
CREATE TABLE project_monitoring_policies (
|
|
2
|
+
project_id TEXT PRIMARY KEY,
|
|
3
|
+
mode TEXT NOT NULL CHECK (mode IN ('observe', 'ask_before_action', 'auto_low_risk')),
|
|
4
|
+
quiet_hours_json TEXT,
|
|
5
|
+
allowed_actions_json TEXT NOT NULL DEFAULT '[]',
|
|
6
|
+
confidence_threshold REAL NOT NULL DEFAULT 0.75 CHECK (confidence_threshold >= 0 AND confidence_threshold <= 1),
|
|
7
|
+
created_at INTEGER NOT NULL,
|
|
8
|
+
updated_at INTEGER NOT NULL,
|
|
9
|
+
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE CASCADE
|
|
10
|
+
);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
DROP TABLE IF EXISTS discussion_action_conversions;
|
|
2
|
+
DROP TABLE IF EXISTS discussion_transcript_segments;
|
|
3
|
+
DROP TABLE IF EXISTS discussion_capture_settings;
|
|
4
|
+
DROP TABLE IF EXISTS discussion_captures;
|
|
5
|
+
|
|
6
|
+
CREATE TABLE discussion_captures (
|
|
7
|
+
id TEXT PRIMARY KEY,
|
|
8
|
+
client_request_id TEXT NOT NULL UNIQUE,
|
|
9
|
+
note_id TEXT NOT NULL UNIQUE,
|
|
10
|
+
project_id TEXT,
|
|
11
|
+
audio_attachment_id TEXT,
|
|
12
|
+
source TEXT NOT NULL CHECK (source IN ('web', 'electron')),
|
|
13
|
+
status TEXT NOT NULL CHECK (status IN (
|
|
14
|
+
'recording',
|
|
15
|
+
'finalizing',
|
|
16
|
+
'completed',
|
|
17
|
+
'failed',
|
|
18
|
+
'cancelled'
|
|
19
|
+
)),
|
|
20
|
+
processing_stage TEXT CHECK (processing_stage IN (
|
|
21
|
+
'original_upload',
|
|
22
|
+
'final_transcription',
|
|
23
|
+
'analysis',
|
|
24
|
+
'note_write'
|
|
25
|
+
)),
|
|
26
|
+
duration_ms INTEGER,
|
|
27
|
+
expected_last_sequence INTEGER,
|
|
28
|
+
mime_type TEXT,
|
|
29
|
+
audio_size_bytes INTEGER,
|
|
30
|
+
audio_sha256 TEXT,
|
|
31
|
+
transcript_raw TEXT,
|
|
32
|
+
transcript_sha256 TEXT,
|
|
33
|
+
transcript_language TEXT,
|
|
34
|
+
stt_provider TEXT,
|
|
35
|
+
analysis_json TEXT,
|
|
36
|
+
analysis_input_hash TEXT,
|
|
37
|
+
analyzer_model_ref TEXT,
|
|
38
|
+
generated_title TEXT,
|
|
39
|
+
project_inference_score REAL,
|
|
40
|
+
project_inference_source TEXT,
|
|
41
|
+
finalization_revision INTEGER NOT NULL DEFAULT 0,
|
|
42
|
+
attempt_count INTEGER NOT NULL DEFAULT 0,
|
|
43
|
+
next_attempt_at INTEGER,
|
|
44
|
+
lease_owner TEXT,
|
|
45
|
+
lease_expires_at INTEGER,
|
|
46
|
+
last_error_code TEXT,
|
|
47
|
+
last_error_message TEXT,
|
|
48
|
+
recording_started_at INTEGER NOT NULL,
|
|
49
|
+
recording_finished_at INTEGER,
|
|
50
|
+
created_at INTEGER NOT NULL,
|
|
51
|
+
updated_at INTEGER NOT NULL,
|
|
52
|
+
completed_at INTEGER,
|
|
53
|
+
audio_deleted_at INTEGER,
|
|
54
|
+
FOREIGN KEY (note_id) REFERENCES notes(note_id) ON DELETE CASCADE,
|
|
55
|
+
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE SET NULL
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
CREATE INDEX idx_discussion_captures_queue
|
|
59
|
+
ON discussion_captures(status, next_attempt_at, created_at);
|
|
60
|
+
|
|
61
|
+
CREATE INDEX idx_discussion_captures_project
|
|
62
|
+
ON discussion_captures(project_id, updated_at DESC);
|
|
63
|
+
|
|
64
|
+
CREATE TABLE discussion_transcript_segments (
|
|
65
|
+
discussion_id TEXT NOT NULL,
|
|
66
|
+
sequence INTEGER NOT NULL,
|
|
67
|
+
audio_sha256 TEXT NOT NULL,
|
|
68
|
+
audio_blob BLOB,
|
|
69
|
+
started_at_ms INTEGER NOT NULL,
|
|
70
|
+
ended_at_ms INTEGER NOT NULL,
|
|
71
|
+
status TEXT NOT NULL CHECK (status IN ('uploaded', 'transcribing', 'completed', 'failed')),
|
|
72
|
+
transcript TEXT,
|
|
73
|
+
provider TEXT,
|
|
74
|
+
attempt_count INTEGER NOT NULL DEFAULT 0,
|
|
75
|
+
next_attempt_at INTEGER,
|
|
76
|
+
lease_owner TEXT,
|
|
77
|
+
lease_expires_at INTEGER,
|
|
78
|
+
last_error TEXT,
|
|
79
|
+
created_at INTEGER NOT NULL,
|
|
80
|
+
updated_at INTEGER NOT NULL,
|
|
81
|
+
PRIMARY KEY (discussion_id, sequence),
|
|
82
|
+
FOREIGN KEY (discussion_id) REFERENCES discussion_captures(id) ON DELETE CASCADE
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
CREATE INDEX idx_discussion_segments_queue
|
|
86
|
+
ON discussion_transcript_segments(status, next_attempt_at, created_at);
|
|
87
|
+
|
|
88
|
+
CREATE TABLE discussion_capture_settings (
|
|
89
|
+
workspace_id TEXT PRIMARY KEY,
|
|
90
|
+
consent_policy_version INTEGER NOT NULL,
|
|
91
|
+
consent_acknowledged_at INTEGER,
|
|
92
|
+
updated_at INTEGER NOT NULL
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
INSERT INTO discussion_capture_settings (
|
|
96
|
+
workspace_id,
|
|
97
|
+
consent_policy_version,
|
|
98
|
+
consent_acknowledged_at,
|
|
99
|
+
updated_at
|
|
100
|
+
) VALUES ('default', 1, NULL, CAST(unixepoch('subsec') * 1000 AS INTEGER));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
CREATE TABLE session_task_plans (
|
|
2
|
+
session_id TEXT NOT NULL,
|
|
3
|
+
plan_id TEXT NOT NULL,
|
|
4
|
+
items_json TEXT NOT NULL,
|
|
5
|
+
revision INTEGER NOT NULL DEFAULT 1,
|
|
6
|
+
updated_at INTEGER NOT NULL,
|
|
7
|
+
PRIMARY KEY (session_id, plan_id),
|
|
8
|
+
FOREIGN KEY (session_id) REFERENCES transcripts(session_id) ON DELETE CASCADE
|
|
9
|
+
);
|