@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,26 @@
|
|
|
1
|
+
CREATE TABLE work_intakes (
|
|
2
|
+
intake_id TEXT PRIMARY KEY,
|
|
3
|
+
idempotency_key TEXT NOT NULL UNIQUE,
|
|
4
|
+
request_fingerprint TEXT NOT NULL,
|
|
5
|
+
objective TEXT NOT NULL,
|
|
6
|
+
proposal_json TEXT NOT NULL,
|
|
7
|
+
session_key TEXT,
|
|
8
|
+
agent_id TEXT,
|
|
9
|
+
status TEXT NOT NULL CHECK (status IN ('proposed', 'confirmed', 'expired', 'cancelled')),
|
|
10
|
+
execution_mode TEXT NOT NULL DEFAULT 'run_now' CHECK (execution_mode IN ('create_only', 'run_now')),
|
|
11
|
+
project_id TEXT,
|
|
12
|
+
goal_id TEXT,
|
|
13
|
+
queue_id TEXT,
|
|
14
|
+
expires_at INTEGER NOT NULL,
|
|
15
|
+
created_at INTEGER NOT NULL,
|
|
16
|
+
confirmed_at INTEGER,
|
|
17
|
+
updated_at INTEGER NOT NULL,
|
|
18
|
+
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE SET NULL,
|
|
19
|
+
FOREIGN KEY (goal_id) REFERENCES goals(goal_id) ON DELETE SET NULL
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
CREATE INDEX idx_work_intakes_status_updated
|
|
23
|
+
ON work_intakes(status, updated_at DESC);
|
|
24
|
+
|
|
25
|
+
CREATE INDEX idx_work_intakes_expires
|
|
26
|
+
ON work_intakes(status, expires_at);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
ALTER TABLE task_outcomes ADD COLUMN completion_verdict TEXT
|
|
2
|
+
CHECK (completion_verdict IN ('achieved', 'partial', 'not_achieved'));
|
|
3
|
+
ALTER TABLE task_outcomes ADD COLUMN completion_verdict_source TEXT
|
|
4
|
+
CHECK (completion_verdict_source IN ('system', 'user'));
|
|
5
|
+
ALTER TABLE task_outcomes ADD COLUMN correction_text TEXT;
|
|
6
|
+
ALTER TABLE task_outcomes ADD COLUMN projection_version INTEGER NOT NULL DEFAULT 0;
|
|
7
|
+
ALTER TABLE task_outcomes ADD COLUMN projected_at INTEGER;
|
|
8
|
+
|
|
9
|
+
CREATE INDEX idx_task_outcomes_projection
|
|
10
|
+
ON task_outcomes(status, projection_version, completed_at);
|
|
11
|
+
|
|
12
|
+
UPDATE task_outcomes
|
|
13
|
+
SET completion_verdict = CASE
|
|
14
|
+
WHEN status = 'succeeded' AND verification_status = 'passed' THEN 'achieved'
|
|
15
|
+
WHEN status = 'succeeded' THEN 'partial'
|
|
16
|
+
ELSE 'not_achieved'
|
|
17
|
+
END,
|
|
18
|
+
completion_verdict_source = 'system'
|
|
19
|
+
WHERE status != 'running';
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
CREATE TABLE outcomes (
|
|
2
|
+
outcome_id TEXT PRIMARY KEY,
|
|
3
|
+
objective TEXT NOT NULL,
|
|
4
|
+
user_status TEXT NOT NULL DEFAULT 'running'
|
|
5
|
+
CHECK (user_status IN ('running', 'needs_user', 'completed')),
|
|
6
|
+
internal_status TEXT NOT NULL DEFAULT 'captured'
|
|
7
|
+
CHECK (internal_status IN (
|
|
8
|
+
'captured', 'planning', 'running', 'verifying', 'continuing',
|
|
9
|
+
'needs_user', 'blocked', 'paused', 'completed', 'cancelled'
|
|
10
|
+
)),
|
|
11
|
+
importance TEXT NOT NULL DEFAULT 'normal'
|
|
12
|
+
CHECK (importance IN ('low', 'normal', 'high', 'critical')),
|
|
13
|
+
due_at INTEGER,
|
|
14
|
+
latest_contract_version INTEGER NOT NULL DEFAULT 1,
|
|
15
|
+
latest_receipt_run_id TEXT,
|
|
16
|
+
created_at INTEGER NOT NULL,
|
|
17
|
+
updated_at INTEGER NOT NULL
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
CREATE INDEX idx_outcomes_status_updated
|
|
21
|
+
ON outcomes(user_status, updated_at DESC);
|
|
22
|
+
|
|
23
|
+
CREATE TABLE outcome_contracts (
|
|
24
|
+
outcome_id TEXT NOT NULL,
|
|
25
|
+
version INTEGER NOT NULL,
|
|
26
|
+
objective TEXT NOT NULL,
|
|
27
|
+
deliverables_json TEXT NOT NULL DEFAULT '[]',
|
|
28
|
+
acceptance_criteria_json TEXT NOT NULL DEFAULT '[]',
|
|
29
|
+
constraints_json TEXT NOT NULL DEFAULT '[]',
|
|
30
|
+
approval_required_json TEXT NOT NULL DEFAULT '[]',
|
|
31
|
+
context_snapshot_id TEXT,
|
|
32
|
+
created_by TEXT NOT NULL DEFAULT 'system'
|
|
33
|
+
CHECK (created_by IN ('user', 'system')),
|
|
34
|
+
created_at INTEGER NOT NULL,
|
|
35
|
+
PRIMARY KEY (outcome_id, version),
|
|
36
|
+
FOREIGN KEY (outcome_id) REFERENCES outcomes(outcome_id) ON DELETE CASCADE
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
CREATE TABLE outcome_links (
|
|
40
|
+
outcome_id TEXT NOT NULL,
|
|
41
|
+
subject_kind TEXT NOT NULL
|
|
42
|
+
CHECK (subject_kind IN (
|
|
43
|
+
'project', 'goal', 'work_item', 'session', 'workflow',
|
|
44
|
+
'automation', 'artifact', 'source'
|
|
45
|
+
)),
|
|
46
|
+
subject_id TEXT NOT NULL,
|
|
47
|
+
relation TEXT NOT NULL DEFAULT 'supports',
|
|
48
|
+
created_at INTEGER NOT NULL,
|
|
49
|
+
PRIMARY KEY (outcome_id, subject_kind, subject_id),
|
|
50
|
+
FOREIGN KEY (outcome_id) REFERENCES outcomes(outcome_id) ON DELETE CASCADE
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
CREATE INDEX idx_outcome_links_subject
|
|
54
|
+
ON outcome_links(subject_kind, subject_id);
|
|
55
|
+
|
|
56
|
+
ALTER TABLE task_outcomes RENAME TO execution_receipts;
|
|
57
|
+
|
|
58
|
+
DROP INDEX IF EXISTS idx_task_outcomes_session_started;
|
|
59
|
+
DROP INDEX IF EXISTS idx_task_outcomes_status_started;
|
|
60
|
+
DROP INDEX IF EXISTS idx_task_outcomes_project_updated;
|
|
61
|
+
DROP INDEX IF EXISTS idx_task_outcomes_work_item_updated;
|
|
62
|
+
DROP INDEX IF EXISTS idx_task_outcomes_unprojected;
|
|
63
|
+
|
|
64
|
+
CREATE INDEX idx_execution_receipts_session_started
|
|
65
|
+
ON execution_receipts(session_key, started_at DESC);
|
|
66
|
+
CREATE INDEX idx_execution_receipts_status_started
|
|
67
|
+
ON execution_receipts(status, started_at DESC);
|
|
68
|
+
CREATE INDEX idx_execution_receipts_project_updated
|
|
69
|
+
ON execution_receipts(project_id, updated_at DESC);
|
|
70
|
+
CREATE INDEX idx_execution_receipts_work_item_updated
|
|
71
|
+
ON execution_receipts(work_item_id, updated_at DESC);
|
|
72
|
+
CREATE INDEX idx_execution_receipts_unprojected
|
|
73
|
+
ON execution_receipts(projection_version, completed_at DESC);
|
|
74
|
+
|
|
75
|
+
ALTER TABLE work_intakes ADD COLUMN outcome_id TEXT;
|
|
76
|
+
ALTER TABLE goals ADD COLUMN outcome_id TEXT;
|
|
77
|
+
ALTER TABLE goals ADD COLUMN outcome_contract_version INTEGER NOT NULL DEFAULT 1;
|
|
78
|
+
ALTER TABLE execution_receipts ADD COLUMN outcome_id TEXT;
|
|
79
|
+
ALTER TABLE execution_receipts ADD COLUMN contract_version INTEGER;
|
|
80
|
+
ALTER TABLE execution_receipts ADD COLUMN attempt INTEGER NOT NULL DEFAULT 1;
|
|
81
|
+
ALTER TABLE execution_receipts ADD COLUMN strategy TEXT;
|
|
82
|
+
|
|
83
|
+
CREATE INDEX idx_execution_receipts_outcome_started
|
|
84
|
+
ON execution_receipts(outcome_id, started_at DESC);
|
|
85
|
+
|
|
86
|
+
CREATE UNIQUE INDEX idx_goals_outcome
|
|
87
|
+
ON goals(outcome_id)
|
|
88
|
+
WHERE outcome_id IS NOT NULL;
|
|
89
|
+
|
|
90
|
+
INSERT INTO outcomes (
|
|
91
|
+
outcome_id, objective, user_status, internal_status, importance,
|
|
92
|
+
latest_contract_version, created_at, updated_at
|
|
93
|
+
)
|
|
94
|
+
SELECT
|
|
95
|
+
'outcome-goal-' || goals.goal_id,
|
|
96
|
+
COALESCE(goal_contracts.objective, goals.title),
|
|
97
|
+
CASE
|
|
98
|
+
WHEN goals.status IN ('done', 'archived') THEN 'completed'
|
|
99
|
+
WHEN goals.status IN ('blocked', 'needs_input') THEN 'needs_user'
|
|
100
|
+
ELSE 'running'
|
|
101
|
+
END,
|
|
102
|
+
CASE
|
|
103
|
+
WHEN goals.status IN ('done', 'archived') THEN 'completed'
|
|
104
|
+
WHEN goals.status = 'blocked' THEN 'blocked'
|
|
105
|
+
WHEN goals.status = 'needs_input' THEN 'needs_user'
|
|
106
|
+
WHEN goals.status = 'paused' THEN 'paused'
|
|
107
|
+
ELSE 'running'
|
|
108
|
+
END,
|
|
109
|
+
'normal',
|
|
110
|
+
COALESCE(goal_contracts.version, 1),
|
|
111
|
+
goals.created_at,
|
|
112
|
+
goals.updated_at
|
|
113
|
+
FROM goals
|
|
114
|
+
LEFT JOIN goal_contracts ON goal_contracts.goal_id = goals.goal_id;
|
|
115
|
+
|
|
116
|
+
INSERT INTO outcome_contracts (
|
|
117
|
+
outcome_id, version, objective, deliverables_json, acceptance_criteria_json,
|
|
118
|
+
constraints_json, approval_required_json, created_by, created_at
|
|
119
|
+
)
|
|
120
|
+
SELECT
|
|
121
|
+
'outcome-goal-' || goals.goal_id,
|
|
122
|
+
COALESCE(goal_contracts.version, 1),
|
|
123
|
+
COALESCE(goal_contracts.objective, goals.title),
|
|
124
|
+
json_array(COALESCE(goal_contracts.objective, goals.title)),
|
|
125
|
+
COALESCE((
|
|
126
|
+
SELECT json_group_array(goal_checklist_items.text)
|
|
127
|
+
FROM goal_checklist_items
|
|
128
|
+
WHERE goal_checklist_items.goal_id = goals.goal_id
|
|
129
|
+
), '[]'),
|
|
130
|
+
CASE
|
|
131
|
+
WHEN goal_contracts.scope_boundary IS NULL THEN '[]'
|
|
132
|
+
ELSE json_array(goal_contracts.scope_boundary)
|
|
133
|
+
END,
|
|
134
|
+
'[]',
|
|
135
|
+
'system',
|
|
136
|
+
goals.created_at
|
|
137
|
+
FROM goals
|
|
138
|
+
LEFT JOIN goal_contracts ON goal_contracts.goal_id = goals.goal_id;
|
|
139
|
+
|
|
140
|
+
UPDATE goals
|
|
141
|
+
SET outcome_id = 'outcome-goal-' || goal_id,
|
|
142
|
+
outcome_contract_version = COALESCE((
|
|
143
|
+
SELECT version FROM goal_contracts WHERE goal_contracts.goal_id = goals.goal_id
|
|
144
|
+
), 1);
|
|
145
|
+
|
|
146
|
+
INSERT INTO outcome_links (outcome_id, subject_kind, subject_id, relation, created_at)
|
|
147
|
+
SELECT outcome_id, 'project', project_id, 'contains', created_at
|
|
148
|
+
FROM goals WHERE project_id IS NOT NULL;
|
|
149
|
+
|
|
150
|
+
INSERT INTO outcome_links (outcome_id, subject_kind, subject_id, relation, created_at)
|
|
151
|
+
SELECT outcome_id, 'goal', goal_id, 'drives', created_at
|
|
152
|
+
FROM goals;
|
|
153
|
+
|
|
154
|
+
UPDATE work_intakes
|
|
155
|
+
SET outcome_id = (
|
|
156
|
+
SELECT goals.outcome_id FROM goals WHERE goals.goal_id = work_intakes.goal_id
|
|
157
|
+
)
|
|
158
|
+
WHERE goal_id IS NOT NULL;
|
|
159
|
+
|
|
160
|
+
UPDATE execution_receipts
|
|
161
|
+
SET outcome_id = (
|
|
162
|
+
SELECT goals.outcome_id FROM goals WHERE goals.goal_id = execution_receipts.goal_id
|
|
163
|
+
)
|
|
164
|
+
WHERE goal_id IS NOT NULL;
|
|
165
|
+
|
|
166
|
+
DROP TABLE goal_evidence_requirement_links;
|
|
167
|
+
DROP TABLE goal_evidence_requirements;
|
|
168
|
+
DROP TABLE goal_contracts;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
CREATE TABLE context_snapshots (
|
|
2
|
+
snapshot_id TEXT PRIMARY KEY,
|
|
3
|
+
trace_id TEXT NOT NULL UNIQUE,
|
|
4
|
+
session_key TEXT NOT NULL,
|
|
5
|
+
query TEXT NOT NULL,
|
|
6
|
+
selected_items_json TEXT NOT NULL DEFAULT '[]',
|
|
7
|
+
rejected_items_json TEXT NOT NULL DEFAULT '[]',
|
|
8
|
+
consent_requests_json TEXT NOT NULL DEFAULT '[]',
|
|
9
|
+
relationship_policy_json TEXT NOT NULL DEFAULT '{}',
|
|
10
|
+
estimated_tokens INTEGER NOT NULL DEFAULT 0,
|
|
11
|
+
outcome_id TEXT,
|
|
12
|
+
run_id TEXT,
|
|
13
|
+
created_at INTEGER NOT NULL,
|
|
14
|
+
FOREIGN KEY (outcome_id) REFERENCES outcomes(outcome_id) ON DELETE SET NULL,
|
|
15
|
+
FOREIGN KEY (run_id) REFERENCES execution_receipts(run_id) ON DELETE SET NULL
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
CREATE INDEX idx_context_snapshots_session_created
|
|
19
|
+
ON context_snapshots(session_key, created_at DESC);
|
|
20
|
+
CREATE INDEX idx_context_snapshots_outcome
|
|
21
|
+
ON context_snapshots(outcome_id, created_at DESC);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
ALTER TABLE automation_runs ADD COLUMN deadline_at_ms INTEGER;
|
|
2
|
+
ALTER TABLE automation_runs ADD COLUMN current_phase TEXT;
|
|
3
|
+
ALTER TABLE automation_runs ADD COLUMN cancel_requested_at_ms INTEGER;
|
|
4
|
+
ALTER TABLE automation_runs ADD COLUMN cancel_confirmed_at_ms INTEGER;
|
|
5
|
+
ALTER TABLE automation_runs ADD COLUMN termination_json TEXT;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
ALTER TABLE automation_runs ADD COLUMN heartbeat_at_ms INTEGER;
|
|
2
|
+
ALTER TABLE automation_runs ADD COLUMN lease_owner TEXT;
|
|
3
|
+
ALTER TABLE automation_runs ADD COLUMN lease_expires_at_ms INTEGER;
|
|
4
|
+
ALTER TABLE automation_runs ADD COLUMN attempt_number INTEGER NOT NULL DEFAULT 1;
|
|
5
|
+
ALTER TABLE automation_runs ADD COLUMN root_run_id TEXT;
|
|
6
|
+
|
|
7
|
+
CREATE INDEX IF NOT EXISTS idx_automation_runs_lease
|
|
8
|
+
ON automation_runs(status, lease_expires_at_ms);
|
|
@@ -3,7 +3,7 @@ import type { ApplyMigrationsOptions } from './types.js';
|
|
|
3
3
|
/** Baseline schema version applied from schema.sql on first open. */
|
|
4
4
|
export declare const XOPC_DB_BASELINE_SCHEMA_VERSION = 11;
|
|
5
5
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
6
|
-
export declare const XOPC_DB_SCHEMA_VERSION =
|
|
6
|
+
export declare const XOPC_DB_SCHEMA_VERSION = 89;
|
|
7
7
|
export declare function resolveMigrationsDir(override?: string): string;
|
|
8
8
|
/**
|
|
9
9
|
* Apply sequential SQL migrations from (currentVersion + 1) through targetVersion.
|
|
@@ -12,7 +12,7 @@ const log = createLogger("Sqlite:Migrations");
|
|
|
12
12
|
/** Baseline schema version applied from schema.sql on first open. */
|
|
13
13
|
const XOPC_DB_BASELINE_SCHEMA_VERSION = 11;
|
|
14
14
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
15
|
-
const XOPC_DB_SCHEMA_VERSION =
|
|
15
|
+
const XOPC_DB_SCHEMA_VERSION = 89;
|
|
16
16
|
const MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
17
17
|
function resolveMigrationsDir(override) {
|
|
18
18
|
if (override) return override;
|
|
@@ -46,7 +46,7 @@ function applySingleMigration(db, migration) {
|
|
|
46
46
|
* Each step runs in its own transaction and updates schema_meta on success.
|
|
47
47
|
*/
|
|
48
48
|
function applyPendingMigrations(db, options = {}) {
|
|
49
|
-
const targetVersion = options.targetVersion ??
|
|
49
|
+
const targetVersion = options.targetVersion ?? 89;
|
|
50
50
|
let currentVersion = readSchemaVersion(db);
|
|
51
51
|
if (currentVersion > targetVersion) throw new DatabaseSchemaTooNewError(currentVersion, targetVersion);
|
|
52
52
|
if (currentVersion >= targetVersion) return currentVersion;
|
|
@@ -62,7 +62,7 @@ function applyPendingMigrations(db, options = {}) {
|
|
|
62
62
|
}
|
|
63
63
|
/** Inspect schema version without mutating the database. */
|
|
64
64
|
function inspectSchemaMigrationStatus(db, options = {}) {
|
|
65
|
-
const appVersion = options.targetVersion ??
|
|
65
|
+
const appVersion = options.targetVersion ?? 89;
|
|
66
66
|
const dbVersion = readSchemaVersion(db);
|
|
67
67
|
if (dbVersion > appVersion) return {
|
|
68
68
|
dbVersion,
|
|
@@ -19,7 +19,7 @@ const log = createLogger('Sqlite:Migrations');
|
|
|
19
19
|
export const XOPC_DB_BASELINE_SCHEMA_VERSION = 11;
|
|
20
20
|
|
|
21
21
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
22
|
-
export const XOPC_DB_SCHEMA_VERSION =
|
|
22
|
+
export const XOPC_DB_SCHEMA_VERSION = 89;
|
|
23
23
|
|
|
24
24
|
const MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
25
25
|
|
|
@@ -177,6 +177,15 @@ function listNoteRecords(query = {}) {
|
|
|
177
177
|
params.push(query.groupId);
|
|
178
178
|
}
|
|
179
179
|
if (query.pendingTasksOnly) conditions.push(`kind = 'task' AND (task_done IS NULL OR task_done = 0)`);
|
|
180
|
+
if (query.projectId) {
|
|
181
|
+
conditions.push(`EXISTS (
|
|
182
|
+
SELECT 1 FROM object_links
|
|
183
|
+
WHERE relation = 'belongs_to'
|
|
184
|
+
AND from_kind = 'note' AND from_id = notes.note_id
|
|
185
|
+
AND to_kind = 'project' AND to_id = ?
|
|
186
|
+
)`);
|
|
187
|
+
params.push(query.projectId);
|
|
188
|
+
}
|
|
180
189
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
181
190
|
const rows = db.prepare(`SELECT note_id, title, kind, status, payload_json, created_at, updated_at,
|
|
182
191
|
pinned, tags_json, snippet, cover_attachment_id, voice_attachment_id,
|
|
@@ -31,7 +31,7 @@ function ensureXopcDatabaseSchema(db) {
|
|
|
31
31
|
bootstrapFreshDatabase(db);
|
|
32
32
|
currentVersion = 11;
|
|
33
33
|
}
|
|
34
|
-
applyPendingMigrations(db, { targetVersion:
|
|
34
|
+
applyPendingMigrations(db, { targetVersion: 89 });
|
|
35
35
|
}
|
|
36
36
|
//#endregion
|
|
37
37
|
export { SCHEMA_META_SCHEMA_VERSION_KEY, XOPC_DB_BASELINE_SCHEMA_VERSION, XOPC_DB_SCHEMA_VERSION, ensureSchemaMetaTable, ensureXopcDatabaseSchema, readSchemaVersion, readSchemaVersionForTest, setSchemaVersion };
|
|
@@ -536,6 +536,95 @@ CREATE TABLE IF NOT EXISTS activity_related_projects (
|
|
|
536
536
|
CREATE INDEX IF NOT EXISTS idx_activity_related_projects_project
|
|
537
537
|
ON activity_related_projects(project_id, activity_id);
|
|
538
538
|
|
|
539
|
+
CREATE TABLE IF NOT EXISTS discussion_captures (
|
|
540
|
+
id TEXT PRIMARY KEY,
|
|
541
|
+
client_request_id TEXT NOT NULL UNIQUE,
|
|
542
|
+
note_id TEXT NOT NULL UNIQUE,
|
|
543
|
+
project_id TEXT,
|
|
544
|
+
audio_attachment_id TEXT,
|
|
545
|
+
source TEXT NOT NULL CHECK (source IN ('web', 'electron')),
|
|
546
|
+
status TEXT NOT NULL CHECK (status IN (
|
|
547
|
+
'recording',
|
|
548
|
+
'finalizing',
|
|
549
|
+
'completed',
|
|
550
|
+
'failed',
|
|
551
|
+
'cancelled'
|
|
552
|
+
)),
|
|
553
|
+
processing_stage TEXT CHECK (processing_stage IN (
|
|
554
|
+
'original_upload',
|
|
555
|
+
'final_transcription',
|
|
556
|
+
'analysis',
|
|
557
|
+
'note_write'
|
|
558
|
+
)),
|
|
559
|
+
duration_ms INTEGER,
|
|
560
|
+
expected_last_sequence INTEGER,
|
|
561
|
+
mime_type TEXT,
|
|
562
|
+
audio_size_bytes INTEGER,
|
|
563
|
+
audio_sha256 TEXT,
|
|
564
|
+
transcript_raw TEXT,
|
|
565
|
+
transcript_sha256 TEXT,
|
|
566
|
+
transcript_language TEXT,
|
|
567
|
+
stt_provider TEXT,
|
|
568
|
+
analysis_json TEXT,
|
|
569
|
+
analysis_input_hash TEXT,
|
|
570
|
+
analyzer_model_ref TEXT,
|
|
571
|
+
generated_title TEXT,
|
|
572
|
+
project_inference_score REAL,
|
|
573
|
+
project_inference_source TEXT,
|
|
574
|
+
finalization_revision INTEGER NOT NULL DEFAULT 0,
|
|
575
|
+
attempt_count INTEGER NOT NULL DEFAULT 0,
|
|
576
|
+
next_attempt_at INTEGER,
|
|
577
|
+
lease_owner TEXT,
|
|
578
|
+
lease_expires_at INTEGER,
|
|
579
|
+
last_error_code TEXT,
|
|
580
|
+
last_error_message TEXT,
|
|
581
|
+
recording_started_at INTEGER NOT NULL,
|
|
582
|
+
recording_finished_at INTEGER,
|
|
583
|
+
created_at INTEGER NOT NULL,
|
|
584
|
+
updated_at INTEGER NOT NULL,
|
|
585
|
+
completed_at INTEGER,
|
|
586
|
+
audio_deleted_at INTEGER,
|
|
587
|
+
FOREIGN KEY (note_id) REFERENCES notes(note_id) ON DELETE CASCADE,
|
|
588
|
+
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE SET NULL
|
|
589
|
+
);
|
|
590
|
+
|
|
591
|
+
CREATE INDEX IF NOT EXISTS idx_discussion_captures_queue
|
|
592
|
+
ON discussion_captures(status, next_attempt_at, created_at);
|
|
593
|
+
|
|
594
|
+
CREATE INDEX IF NOT EXISTS idx_discussion_captures_project
|
|
595
|
+
ON discussion_captures(project_id, updated_at DESC);
|
|
596
|
+
|
|
597
|
+
CREATE TABLE IF NOT EXISTS discussion_transcript_segments (
|
|
598
|
+
discussion_id TEXT NOT NULL,
|
|
599
|
+
sequence INTEGER NOT NULL,
|
|
600
|
+
audio_sha256 TEXT NOT NULL,
|
|
601
|
+
audio_blob BLOB,
|
|
602
|
+
started_at_ms INTEGER NOT NULL,
|
|
603
|
+
ended_at_ms INTEGER NOT NULL,
|
|
604
|
+
status TEXT NOT NULL CHECK (status IN ('uploaded', 'transcribing', 'completed', 'failed')),
|
|
605
|
+
transcript TEXT,
|
|
606
|
+
provider TEXT,
|
|
607
|
+
attempt_count INTEGER NOT NULL DEFAULT 0,
|
|
608
|
+
next_attempt_at INTEGER,
|
|
609
|
+
lease_owner TEXT,
|
|
610
|
+
lease_expires_at INTEGER,
|
|
611
|
+
last_error TEXT,
|
|
612
|
+
created_at INTEGER NOT NULL,
|
|
613
|
+
updated_at INTEGER NOT NULL,
|
|
614
|
+
PRIMARY KEY (discussion_id, sequence),
|
|
615
|
+
FOREIGN KEY (discussion_id) REFERENCES discussion_captures(id) ON DELETE CASCADE
|
|
616
|
+
);
|
|
617
|
+
|
|
618
|
+
CREATE INDEX IF NOT EXISTS idx_discussion_segments_queue
|
|
619
|
+
ON discussion_transcript_segments(status, next_attempt_at, created_at);
|
|
620
|
+
|
|
621
|
+
CREATE TABLE IF NOT EXISTS discussion_capture_settings (
|
|
622
|
+
workspace_id TEXT PRIMARY KEY,
|
|
623
|
+
consent_policy_version INTEGER NOT NULL,
|
|
624
|
+
consent_acknowledged_at INTEGER,
|
|
625
|
+
updated_at INTEGER NOT NULL
|
|
626
|
+
);
|
|
627
|
+
|
|
539
628
|
CREATE TABLE IF NOT EXISTS goal_context_messages (
|
|
540
629
|
goal_id TEXT PRIMARY KEY,
|
|
541
630
|
text TEXT NOT NULL DEFAULT '',
|
|
@@ -545,17 +634,6 @@ CREATE TABLE IF NOT EXISTS goal_context_messages (
|
|
|
545
634
|
FOREIGN KEY (goal_id) REFERENCES goals(goal_id) ON DELETE CASCADE
|
|
546
635
|
);
|
|
547
636
|
|
|
548
|
-
CREATE TABLE IF NOT EXISTS goal_contracts (
|
|
549
|
-
goal_id TEXT PRIMARY KEY,
|
|
550
|
-
version INTEGER NOT NULL DEFAULT 1,
|
|
551
|
-
objective TEXT NOT NULL,
|
|
552
|
-
scope_boundary TEXT,
|
|
553
|
-
evidence_plan_json TEXT NOT NULL DEFAULT '[]',
|
|
554
|
-
created_at INTEGER NOT NULL,
|
|
555
|
-
updated_at INTEGER NOT NULL,
|
|
556
|
-
FOREIGN KEY (goal_id) REFERENCES goals(goal_id) ON DELETE CASCADE
|
|
557
|
-
);
|
|
558
|
-
|
|
559
637
|
CREATE TABLE IF NOT EXISTS goal_queue (
|
|
560
638
|
queue_id TEXT PRIMARY KEY,
|
|
561
639
|
goal_id TEXT NOT NULL,
|
|
@@ -652,39 +730,6 @@ CREATE TABLE IF NOT EXISTS goal_evidence (
|
|
|
652
730
|
CREATE INDEX IF NOT EXISTS idx_goal_evidence_goal_created
|
|
653
731
|
ON goal_evidence(goal_id, created_at DESC);
|
|
654
732
|
|
|
655
|
-
CREATE TABLE IF NOT EXISTS goal_evidence_requirements (
|
|
656
|
-
requirement_id TEXT PRIMARY KEY,
|
|
657
|
-
goal_id TEXT NOT NULL,
|
|
658
|
-
text TEXT NOT NULL,
|
|
659
|
-
status TEXT NOT NULL DEFAULT 'pending',
|
|
660
|
-
review_reason TEXT,
|
|
661
|
-
review_confidence REAL,
|
|
662
|
-
reviewed_by TEXT,
|
|
663
|
-
reviewed_at INTEGER,
|
|
664
|
-
requires_human_approval INTEGER NOT NULL DEFAULT 1,
|
|
665
|
-
created_at INTEGER NOT NULL,
|
|
666
|
-
updated_at INTEGER NOT NULL,
|
|
667
|
-
sort_order INTEGER NOT NULL,
|
|
668
|
-
UNIQUE(goal_id, text),
|
|
669
|
-
FOREIGN KEY (goal_id) REFERENCES goals(goal_id) ON DELETE CASCADE
|
|
670
|
-
);
|
|
671
|
-
|
|
672
|
-
CREATE INDEX IF NOT EXISTS idx_goal_evidence_requirements_goal_order
|
|
673
|
-
ON goal_evidence_requirements(goal_id, sort_order ASC);
|
|
674
|
-
|
|
675
|
-
CREATE TABLE IF NOT EXISTS goal_evidence_requirement_links (
|
|
676
|
-
requirement_id TEXT NOT NULL,
|
|
677
|
-
evidence_id TEXT NOT NULL,
|
|
678
|
-
linked_by TEXT NOT NULL,
|
|
679
|
-
created_at INTEGER NOT NULL,
|
|
680
|
-
PRIMARY KEY (requirement_id, evidence_id),
|
|
681
|
-
FOREIGN KEY (requirement_id) REFERENCES goal_evidence_requirements(requirement_id) ON DELETE CASCADE,
|
|
682
|
-
FOREIGN KEY (evidence_id) REFERENCES goal_evidence(evidence_id) ON DELETE CASCADE
|
|
683
|
-
);
|
|
684
|
-
|
|
685
|
-
CREATE INDEX IF NOT EXISTS idx_goal_evidence_requirement_links_evidence
|
|
686
|
-
ON goal_evidence_requirement_links(evidence_id);
|
|
687
|
-
|
|
688
733
|
CREATE TABLE IF NOT EXISTS goal_session_links (
|
|
689
734
|
goal_id TEXT NOT NULL,
|
|
690
735
|
session_key TEXT NOT NULL,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getSqliteDatabase, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
|
+
import { validateSessionId } from "../../session/session-id.js";
|
|
2
3
|
import { buildDefaultSessionMetadata } from "./session-metadata.js";
|
|
3
4
|
import { buildGlobalSessionStats, metadataToSessionInsert, sessionRowToMetadata } from "./row-mappers.js";
|
|
4
|
-
import { validateSessionId } from "../../session/session-id.js";
|
|
5
5
|
import { escapeFts5Query } from "./fts.js";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
//#region src/storage/sqlite/session-repository.ts
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type SessionTaskPlanItemStatus = 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
|
2
|
+
export type SessionTaskPlanItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
content: string;
|
|
5
|
+
status: SessionTaskPlanItemStatus;
|
|
6
|
+
};
|
|
7
|
+
export type SessionTaskPlan = {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
planId: string;
|
|
10
|
+
items: SessionTaskPlanItem[];
|
|
11
|
+
revision: number;
|
|
12
|
+
updatedAt: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function getSessionTaskPlan(sessionKey: string, planId?: string): SessionTaskPlan | undefined;
|
|
15
|
+
export declare function setSessionTaskPlan(input: {
|
|
16
|
+
sessionKey: string;
|
|
17
|
+
planId?: string;
|
|
18
|
+
items: SessionTaskPlanItem[];
|
|
19
|
+
now?: number;
|
|
20
|
+
}): SessionTaskPlan | undefined;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { getSqliteDatabase, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
|
+
import { getCurrentSessionId } from "./session-repository.js";
|
|
3
|
+
//#region src/storage/sqlite/session-task-plan-repository.ts
|
|
4
|
+
const VALID_STATUSES = new Set([
|
|
5
|
+
"pending",
|
|
6
|
+
"in_progress",
|
|
7
|
+
"completed",
|
|
8
|
+
"cancelled"
|
|
9
|
+
]);
|
|
10
|
+
function parseItems(value) {
|
|
11
|
+
try {
|
|
12
|
+
const raw = JSON.parse(value);
|
|
13
|
+
if (!Array.isArray(raw)) return [];
|
|
14
|
+
return raw.flatMap((value) => {
|
|
15
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return [];
|
|
16
|
+
const item = value;
|
|
17
|
+
const id = typeof item.id === "string" ? item.id.trim() : "";
|
|
18
|
+
const content = typeof item.content === "string" ? item.content.trim() : "";
|
|
19
|
+
const status = item.status;
|
|
20
|
+
return id && content && VALID_STATUSES.has(status) ? [{
|
|
21
|
+
id,
|
|
22
|
+
content,
|
|
23
|
+
status
|
|
24
|
+
}] : [];
|
|
25
|
+
});
|
|
26
|
+
} catch {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function fromRow(row) {
|
|
31
|
+
return {
|
|
32
|
+
sessionId: row.session_id,
|
|
33
|
+
planId: row.plan_id,
|
|
34
|
+
items: parseItems(row.items_json),
|
|
35
|
+
revision: row.revision,
|
|
36
|
+
updatedAt: row.updated_at
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function getSessionTaskPlan(sessionKey, planId = "todo") {
|
|
40
|
+
const sessionId = getCurrentSessionId(sessionKey);
|
|
41
|
+
if (!sessionId) return void 0;
|
|
42
|
+
const row = getSqliteDatabase().prepare(`SELECT session_id, plan_id, items_json, revision, updated_at
|
|
43
|
+
FROM session_task_plans
|
|
44
|
+
WHERE session_id = ? AND plan_id = ?`).get(sessionId, planId);
|
|
45
|
+
return row ? fromRow(row) : void 0;
|
|
46
|
+
}
|
|
47
|
+
function setSessionTaskPlan(input) {
|
|
48
|
+
const planId = input.planId?.trim() || "todo";
|
|
49
|
+
if (!input.items.some((item) => item.status === "pending" || item.status === "in_progress")) {
|
|
50
|
+
deleteSessionTaskPlan(input.sessionKey, planId);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const sessionId = getCurrentSessionId(input.sessionKey);
|
|
54
|
+
if (!sessionId) return void 0;
|
|
55
|
+
const now = input.now ?? Date.now();
|
|
56
|
+
runSqliteWriteTransaction((db) => {
|
|
57
|
+
db.prepare(`INSERT INTO session_task_plans (session_id, plan_id, items_json, revision, updated_at)
|
|
58
|
+
VALUES (?, ?, ?, 1, ?)
|
|
59
|
+
ON CONFLICT(session_id, plan_id) DO UPDATE SET
|
|
60
|
+
items_json = excluded.items_json,
|
|
61
|
+
revision = session_task_plans.revision + 1,
|
|
62
|
+
updated_at = excluded.updated_at`).run(sessionId, planId, JSON.stringify(input.items), now);
|
|
63
|
+
});
|
|
64
|
+
return getSessionTaskPlan(input.sessionKey, planId);
|
|
65
|
+
}
|
|
66
|
+
function deleteSessionTaskPlan(sessionKey, planId = "todo") {
|
|
67
|
+
const sessionId = getCurrentSessionId(sessionKey);
|
|
68
|
+
if (!sessionId) return false;
|
|
69
|
+
let deleted = false;
|
|
70
|
+
runSqliteWriteTransaction((db) => {
|
|
71
|
+
deleted = db.prepare(`DELETE FROM session_task_plans
|
|
72
|
+
WHERE session_id = ? AND plan_id = ?`).run(sessionId, planId).changes > 0;
|
|
73
|
+
});
|
|
74
|
+
return deleted;
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { getSessionTaskPlan, setSessionTaskPlan };
|
|
@@ -43,7 +43,9 @@ export declare class EmbeddedBackend implements TuiBackend {
|
|
|
43
43
|
getActiveSignal(): AbortSignal | undefined;
|
|
44
44
|
private getWorkflowRunService;
|
|
45
45
|
private activeConfig;
|
|
46
|
+
private isWorkspaceTrusted;
|
|
46
47
|
getStartupResources(sessionKey: string): Promise<import("../tui-backend.js").TuiStartupResources>;
|
|
48
|
+
refreshWorkspaceTrust(): void;
|
|
47
49
|
startWorkflowRun(opts: TuiWorkflowRunStartRequest): Promise<TuiWorkflowRunStartResult>;
|
|
48
50
|
resolveStartupProject(opts: {
|
|
49
51
|
workspacePath: string;
|
|
@@ -10,6 +10,7 @@ import { init_agent_scope, listAgentEntries, normalizeAgentId } from "../../agen
|
|
|
10
10
|
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
11
11
|
import { effectiveWorkspacePathForSession } from "../../session/session-workspace.js";
|
|
12
12
|
import { createCreateShareTool, isShareToolAvailable } from "../../agent/tools/create-share-tool.js";
|
|
13
|
+
import { setTuiDefaultAgentConfig } from "../../commands/agents.config.js";
|
|
13
14
|
import { ProjectService } from "../../projects/project-service.js";
|
|
14
15
|
import { inferSuggestedProjectDefaultAgentId } from "../../projects/project-agent-suggestion.js";
|
|
15
16
|
import "../../projects/index.js";
|
|
@@ -23,7 +24,6 @@ import { parseModelRef } from "../../agent/models/selection.js";
|
|
|
23
24
|
import { buildReviewContext, resolveGitRoot } from "../../review/review-git.js";
|
|
24
25
|
import { MessageBus, MessageBusShutdownError } from "../../infra/bus/queue.js";
|
|
25
26
|
import "../../infra/bus/index.js";
|
|
26
|
-
import { setTuiDefaultAgentConfig } from "../../commands/agents.config.js";
|
|
27
27
|
import { getWorkspacePath } from "../../config/workspace-path-helpers.js";
|
|
28
28
|
import "../../config/index.js";
|
|
29
29
|
import { buildWorkflowChildTools } from "../../agent/workflow/workflow-child-tools.js";
|
|
@@ -140,12 +140,7 @@ var EmbeddedBackend = class {
|
|
|
140
140
|
sessionStore: sessionIndex.getStore(),
|
|
141
141
|
getWorkflowRunService: () => this.getWorkflowRunService(),
|
|
142
142
|
extensionRegistry: this.opts?.extensionRegistry,
|
|
143
|
-
isWorkspaceTrusted: (workspaceDir) =>
|
|
144
|
-
const explicit = this.opts?.isWorkspaceTrusted?.(workspaceDir);
|
|
145
|
-
if (explicit !== void 0 && explicit !== null) return explicit;
|
|
146
|
-
const implicit = this.opts?.implicitTrustedWorkspace;
|
|
147
|
-
if (implicit && isPathSameOrInside(implicit, workspaceDir)) return true;
|
|
148
|
-
}
|
|
143
|
+
isWorkspaceTrusted: (workspaceDir) => this.isWorkspaceTrusted(workspaceDir)
|
|
149
144
|
});
|
|
150
145
|
this.agent = agent;
|
|
151
146
|
await agent.start();
|
|
@@ -204,8 +199,17 @@ var EmbeddedBackend = class {
|
|
|
204
199
|
activeConfig() {
|
|
205
200
|
return this.config ?? this.opts?.config ?? loadConfig();
|
|
206
201
|
}
|
|
202
|
+
isWorkspaceTrusted(workspaceDir) {
|
|
203
|
+
const explicit = this.opts?.isWorkspaceTrusted?.(workspaceDir);
|
|
204
|
+
if (explicit !== void 0 && explicit !== null) return explicit;
|
|
205
|
+
const implicit = this.opts?.implicitTrustedWorkspace;
|
|
206
|
+
return Boolean(implicit && isPathSameOrInside(implicit, workspaceDir));
|
|
207
|
+
}
|
|
207
208
|
async getStartupResources(sessionKey) {
|
|
208
|
-
return collectTuiStartupResources(this.activeConfig(), sessionKey);
|
|
209
|
+
return collectTuiStartupResources(this.activeConfig(), sessionKey, { isWorkspaceTrusted: (workspaceDir) => this.isWorkspaceTrusted(workspaceDir) });
|
|
210
|
+
}
|
|
211
|
+
refreshWorkspaceTrust() {
|
|
212
|
+
this.agent?.refreshSkillsAfterTrustChange();
|
|
209
213
|
}
|
|
210
214
|
async startWorkflowRun(opts) {
|
|
211
215
|
await this.sessionIndexReady;
|
|
@@ -226,6 +226,8 @@ export interface TuiBackend {
|
|
|
226
226
|
}): Promise<TuiStartupProjectResult>;
|
|
227
227
|
/** Load startup resources shown in `/start` and initial help. */
|
|
228
228
|
getStartupResources?(sessionKey: string): Promise<TuiStartupResources>;
|
|
229
|
+
/** Re-evaluate project-scoped resources after a local trust decision changes. */
|
|
230
|
+
refreshWorkspaceTrust?(): void | Promise<void>;
|
|
229
231
|
/** Fuzzy search files in this session's effective workspace. */
|
|
230
232
|
searchWorkspaceFiles?(sessionKey: string, query: string, options?: {
|
|
231
233
|
limit?: number;
|