@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
|
@@ -3,6 +3,7 @@ import { init_logger } from "../utils/logger.js";
|
|
|
3
3
|
import { GoalService } from "./goal-service.js";
|
|
4
4
|
import { GoalQueueStore } from "./goal-queue-store.js";
|
|
5
5
|
import { mediaRefsToUserTurnAttachments } from "../gateway/user-turn-input.js";
|
|
6
|
+
import { OutcomeRepository } from "../work/outcome-repository.js";
|
|
6
7
|
//#region src/goals/goal-runner.ts
|
|
7
8
|
init_logger();
|
|
8
9
|
const log = createLogger("GoalRunner");
|
|
@@ -11,11 +12,12 @@ function terminalGoalStatus(status) {
|
|
|
11
12
|
}
|
|
12
13
|
function buildInitialGoalTurn(goal) {
|
|
13
14
|
const context = goal.contextMessage;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
if (
|
|
15
|
+
const contract = new OutcomeRepository().getContract(goal.outcomeId, goal.outcomeContractVersion);
|
|
16
|
+
const parts = [`Outcome:\n${contract?.objective ?? goal.title}`];
|
|
17
|
+
if (contract?.constraints.length) parts.push(`Constraints:\n${contract.constraints.map((item) => `- ${item}`).join("\n")}`);
|
|
18
|
+
if (contract?.deliverables.length) parts.push(`Deliverables:\n${contract.deliverables.map((item) => `- ${item}`).join("\n")}`);
|
|
17
19
|
if (context?.text.trim()) parts.push(`Context:\n${context.text.trim()}`);
|
|
18
|
-
if (goal.checklist.length > 0) parts.push(`
|
|
20
|
+
if (goal.checklist.length > 0) parts.push(`Acceptance criteria:\n${goal.checklist.map((item, index) => `${index + 1}. ${item.text}`).join("\n")}`);
|
|
19
21
|
return {
|
|
20
22
|
text: parts.join("\n\n"),
|
|
21
23
|
attachments: mediaRefsToUserTurnAttachments(context?.attachments),
|
|
@@ -47,7 +49,8 @@ var GoalRunner = class {
|
|
|
47
49
|
text: options.userTurn.text.trim(),
|
|
48
50
|
clientCreatedAtMs: options.userTurn.clientCreatedAtMs ?? Date.now()
|
|
49
51
|
} : void 0,
|
|
50
|
-
source: options.source ?? "api"
|
|
52
|
+
source: options.source ?? "api",
|
|
53
|
+
executionContext: options.executionContext
|
|
51
54
|
});
|
|
52
55
|
this.emit("goal.queue.updated", item);
|
|
53
56
|
this.schedulePump(0);
|
|
@@ -94,11 +97,12 @@ var GoalRunner = class {
|
|
|
94
97
|
this.finish(item, "failed", "Goal not found");
|
|
95
98
|
return;
|
|
96
99
|
}
|
|
97
|
-
const sessionKey = activeGoal.activeSessionKey ?? await this.opts.ensureSession(activeGoal);
|
|
100
|
+
const sessionKey = activeGoal.activeSessionKey ?? await this.opts.ensureSession(activeGoal, item.executionContext);
|
|
98
101
|
item = this.store.setSessionKey(item.id, sessionKey) ?? {
|
|
99
102
|
...item,
|
|
100
103
|
sessionKey
|
|
101
104
|
};
|
|
105
|
+
await this.opts.bindExecutionContext?.(sessionKey, activeGoal, item.executionContext);
|
|
102
106
|
if (this.opts.hasActiveRun(sessionKey)) {
|
|
103
107
|
this.retry(item, "Goal session already has an active run");
|
|
104
108
|
return;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { Config } from '../config/schema.js';
|
|
2
2
|
import { GoalStore } from './goal-store.js';
|
|
3
|
-
import type { CreateGoalInput, Goal, GoalChecklistAddedBy, GoalChecklistStatus, GoalContextAttachment,
|
|
3
|
+
import type { CreateGoalInput, Goal, GoalChecklistAddedBy, GoalChecklistStatus, GoalContextAttachment, GoalJudgeDecision, GoalListQuery, GoalSource, GoalStatus, GoalUiLocale, GoalWithDetails } from './types.js';
|
|
4
4
|
export interface GoalCompletionReadiness {
|
|
5
5
|
ready: boolean;
|
|
6
|
-
|
|
7
|
-
pendingApproval: string[];
|
|
8
|
-
pendingOutcome: string[];
|
|
6
|
+
pendingCriteria: string[];
|
|
9
7
|
}
|
|
10
8
|
export declare class GoalService {
|
|
11
9
|
private readonly store;
|
|
@@ -23,7 +21,6 @@ export declare class GoalService {
|
|
|
23
21
|
text: string;
|
|
24
22
|
attachments?: GoalContextAttachment[];
|
|
25
23
|
}): GoalWithDetails | null;
|
|
26
|
-
setContract(goalId: string, input: GoalContractInput): GoalWithDetails | null;
|
|
27
24
|
update(goalId: string, patch: Partial<Pick<Goal, 'title' | 'description' | 'priority' | 'deadlineAt' | 'maxTurns' | 'judgeModelRef' | 'nextAction' | 'blockedReason' | 'activeSessionKey' | 'uiLocale' | 'projectId'>>): GoalWithDetails | null;
|
|
28
25
|
setStatus(goalId: string, status: GoalStatus, opts?: {
|
|
29
26
|
reason?: string;
|
|
@@ -85,16 +82,6 @@ export declare class GoalService {
|
|
|
85
82
|
listEvents(goalId: string, limit?: number): import("./types.js").GoalEvent[];
|
|
86
83
|
addEvidence(input: Parameters<GoalStore['addEvidence']>[0]): import("./types.js").GoalEvidence;
|
|
87
84
|
listEvidence(goalId: string, limit?: number): import("./types.js").GoalEvidence[];
|
|
88
|
-
listEvidenceRequirements(goalId: string): import("./types.js").GoalEvidenceRequirement[];
|
|
89
|
-
linkEvidenceRequirement(input: Parameters<GoalStore['linkEvidenceRequirement']>[0]): import("./types.js").GoalEvidenceRequirement;
|
|
90
|
-
reviewEvidenceRequirement(input: {
|
|
91
|
-
goalId: string;
|
|
92
|
-
requirementId: string;
|
|
93
|
-
status: GoalEvidenceRequirementStatus;
|
|
94
|
-
reason: string;
|
|
95
|
-
confidence?: number;
|
|
96
|
-
reviewedBy: GoalEvidenceReviewSource;
|
|
97
|
-
}): import("./types.js").GoalEvidenceRequirement;
|
|
98
85
|
getCompletionReadiness(goalId: string): GoalCompletionReadiness | null;
|
|
99
86
|
}
|
|
100
87
|
export declare function normalizeGoalUiLocale(raw: unknown): GoalUiLocale | undefined;
|
|
@@ -14,11 +14,7 @@ function toTerminalStatus(verdict) {
|
|
|
14
14
|
return "active";
|
|
15
15
|
}
|
|
16
16
|
function completionReviewReason(readiness) {
|
|
17
|
-
const pending =
|
|
18
|
-
...readiness.missingEvidence,
|
|
19
|
-
...readiness.pendingApproval,
|
|
20
|
-
...readiness.pendingOutcome
|
|
21
|
-
];
|
|
17
|
+
const pending = readiness.pendingCriteria;
|
|
22
18
|
return pending.length ? `Completion review required: ${pending.join("; ")}` : "Completion review required.";
|
|
23
19
|
}
|
|
24
20
|
function publishGoalEvent(type, goal, extra) {
|
|
@@ -53,6 +49,8 @@ var GoalService = class {
|
|
|
53
49
|
const sessionKey = input.sessionKey;
|
|
54
50
|
const cfg = input.config?.goals;
|
|
55
51
|
const goal = this.store.create({
|
|
52
|
+
outcomeId: input.outcomeId,
|
|
53
|
+
outcomeContractVersion: input.outcomeContractVersion,
|
|
56
54
|
title: normalizeTitle(input.title),
|
|
57
55
|
description: input.description,
|
|
58
56
|
agentId: input.agentId ?? "main",
|
|
@@ -63,8 +61,7 @@ var GoalService = class {
|
|
|
63
61
|
maxTurns: input.maxTurns ?? defaultMaxTurns(cfg),
|
|
64
62
|
uiLocale: input.uiLocale,
|
|
65
63
|
source: input.source,
|
|
66
|
-
projectId: input.projectId
|
|
67
|
-
contract: input.contract
|
|
64
|
+
projectId: input.projectId
|
|
68
65
|
});
|
|
69
66
|
publishGoalEvent("goal.created", goal);
|
|
70
67
|
return goal;
|
|
@@ -76,9 +73,7 @@ var GoalService = class {
|
|
|
76
73
|
...goal,
|
|
77
74
|
checklist: this.store.listChecklist(goalId),
|
|
78
75
|
latestRun: this.store.listRuns(goalId, 1)[0],
|
|
79
|
-
contextMessage: this.store.getContextMessage(goalId) ?? void 0
|
|
80
|
-
contract: this.store.getContract(goalId) ?? void 0,
|
|
81
|
-
evidenceRequirements: this.store.listEvidenceRequirements(goalId)
|
|
76
|
+
contextMessage: this.store.getContextMessage(goalId) ?? void 0
|
|
82
77
|
};
|
|
83
78
|
}
|
|
84
79
|
getActiveForSession(sessionKey) {
|
|
@@ -90,9 +85,7 @@ var GoalService = class {
|
|
|
90
85
|
...goal,
|
|
91
86
|
checklist: this.store.listChecklist(goal.id),
|
|
92
87
|
latestRun: this.store.listRuns(goal.id, 1)[0],
|
|
93
|
-
contextMessage: this.store.getContextMessage(goal.id) ?? void 0
|
|
94
|
-
contract: this.store.getContract(goal.id) ?? void 0,
|
|
95
|
-
evidenceRequirements: this.store.listEvidenceRequirements(goal.id)
|
|
88
|
+
contextMessage: this.store.getContextMessage(goal.id) ?? void 0
|
|
96
89
|
}));
|
|
97
90
|
}
|
|
98
91
|
setContextMessage(input) {
|
|
@@ -100,16 +93,6 @@ var GoalService = class {
|
|
|
100
93
|
this.store.setContextMessage(input);
|
|
101
94
|
return this.get(input.goalId);
|
|
102
95
|
}
|
|
103
|
-
setContract(goalId, input) {
|
|
104
|
-
if (!this.store.get(goalId)) return null;
|
|
105
|
-
this.store.setContract(goalId, input);
|
|
106
|
-
if (input.criteria) this.store.replaceChecklist(goalId, input.criteria.map((text) => text.trim()).filter(Boolean).map((text) => ({
|
|
107
|
-
text,
|
|
108
|
-
status: "pending",
|
|
109
|
-
addedBy: "user"
|
|
110
|
-
})));
|
|
111
|
-
return this.get(goalId);
|
|
112
|
-
}
|
|
113
96
|
update(goalId, patch) {
|
|
114
97
|
const normalized = { ...patch };
|
|
115
98
|
if (typeof normalized.title === "string") normalized.title = normalizeTitle(normalized.title);
|
|
@@ -323,29 +306,13 @@ var GoalService = class {
|
|
|
323
306
|
listEvidence(goalId, limit) {
|
|
324
307
|
return this.store.listEvidence(goalId, limit);
|
|
325
308
|
}
|
|
326
|
-
listEvidenceRequirements(goalId) {
|
|
327
|
-
return this.store.listEvidenceRequirements(goalId);
|
|
328
|
-
}
|
|
329
|
-
linkEvidenceRequirement(input) {
|
|
330
|
-
return this.store.linkEvidenceRequirement(input);
|
|
331
|
-
}
|
|
332
|
-
reviewEvidenceRequirement(input) {
|
|
333
|
-
return this.store.reviewEvidenceRequirement(input);
|
|
334
|
-
}
|
|
335
309
|
getCompletionReadiness(goalId) {
|
|
336
310
|
const goal = this.get(goalId);
|
|
337
311
|
if (!goal) return null;
|
|
338
|
-
const
|
|
339
|
-
const missingEvidence = required.filter((item) => item.evidenceIds.length === 0).map((item) => item.text);
|
|
340
|
-
const pendingApproval = required.filter((item) => item.evidenceIds.length > 0 && item.status !== "approved").map((item) => item.text);
|
|
341
|
-
const metric = goal.contract?.outcomeMetric;
|
|
342
|
-
const outcomeAchieved = metric?.currentValue != null && (metric.direction === "increase" ? metric.currentValue >= metric.targetValue : metric.currentValue <= metric.targetValue);
|
|
343
|
-
const pendingOutcome = metric && !outcomeAchieved ? [metric.currentValue == null ? `${metric.name}: current value is not recorded` : `${metric.name}: current value ${metric.currentValue} has not reached target ${metric.targetValue}`] : [];
|
|
312
|
+
const pendingCriteria = goal.checklist.filter((item) => item.status === "pending").map((item) => item.text);
|
|
344
313
|
return {
|
|
345
|
-
ready:
|
|
346
|
-
|
|
347
|
-
pendingApproval,
|
|
348
|
-
pendingOutcome
|
|
314
|
+
ready: pendingCriteria.length === 0,
|
|
315
|
+
pendingCriteria
|
|
349
316
|
};
|
|
350
317
|
}
|
|
351
318
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CreateGoalInput, Goal, GoalChecklistAddedBy, GoalChecklistItem, GoalChecklistStatus, GoalContextAttachment, GoalContextMessage,
|
|
1
|
+
import type { CreateGoalInput, Goal, GoalChecklistAddedBy, GoalChecklistItem, GoalChecklistStatus, GoalContextAttachment, GoalContextMessage, GoalEvent, GoalEvidence, GoalListQuery, GoalRun } from './types.js';
|
|
2
2
|
export declare class GoalStore {
|
|
3
3
|
create(input: CreateGoalInput): Goal;
|
|
4
4
|
get(goalId: string): Goal | null;
|
|
@@ -8,8 +8,6 @@ export declare class GoalStore {
|
|
|
8
8
|
attachments?: GoalContextAttachment[];
|
|
9
9
|
}): GoalContextMessage;
|
|
10
10
|
getContextMessage(goalId: string): GoalContextMessage | null;
|
|
11
|
-
getContract(goalId: string): GoalContract | null;
|
|
12
|
-
setContract(goalId: string, input: GoalContractInput): GoalContract | null;
|
|
13
11
|
getActiveForSession(sessionKey: string): Goal | null;
|
|
14
12
|
list(query?: GoalListQuery): Goal[];
|
|
15
13
|
update(goalId: string, patch: Partial<Pick<Goal, 'title' | 'description' | 'status' | 'priority' | 'deadlineAt' | 'completedAt' | 'archivedAt' | 'activeSessionKey' | 'currentRunId' | 'nextAction' | 'blockedReason' | 'judgeModelRef' | 'maxTurns' | 'turnsUsed' | 'uiLocale' | 'projectId'>>): Goal | null;
|
|
@@ -43,19 +41,4 @@ export declare class GoalStore {
|
|
|
43
41
|
createdAt?: number;
|
|
44
42
|
}): GoalEvidence;
|
|
45
43
|
listEvidence(goalId: string, limit?: number): GoalEvidence[];
|
|
46
|
-
listEvidenceRequirements(goalId: string): GoalEvidenceRequirement[];
|
|
47
|
-
linkEvidenceRequirement(input: {
|
|
48
|
-
goalId: string;
|
|
49
|
-
requirementId: string;
|
|
50
|
-
evidenceId: string;
|
|
51
|
-
linkedBy: 'user' | 'agent' | 'system';
|
|
52
|
-
}): GoalEvidenceRequirement | null;
|
|
53
|
-
reviewEvidenceRequirement(input: {
|
|
54
|
-
goalId: string;
|
|
55
|
-
requirementId: string;
|
|
56
|
-
status: GoalEvidenceRequirementStatus;
|
|
57
|
-
reason: string;
|
|
58
|
-
confidence?: number;
|
|
59
|
-
reviewedBy: GoalEvidenceReviewSource;
|
|
60
|
-
}): GoalEvidenceRequirement | null;
|
|
61
44
|
}
|
|
@@ -4,6 +4,8 @@ import { randomUUID } from "node:crypto";
|
|
|
4
4
|
function goalFromRow(row) {
|
|
5
5
|
return {
|
|
6
6
|
id: row.goal_id,
|
|
7
|
+
outcomeId: row.outcome_id,
|
|
8
|
+
outcomeContractVersion: row.outcome_contract_version,
|
|
7
9
|
title: row.title,
|
|
8
10
|
description: row.description ?? void 0,
|
|
9
11
|
status: row.status,
|
|
@@ -94,79 +96,6 @@ function goalContextFromRow(row) {
|
|
|
94
96
|
updatedAt: row.updated_at
|
|
95
97
|
};
|
|
96
98
|
}
|
|
97
|
-
function goalContractFromRow(row) {
|
|
98
|
-
return {
|
|
99
|
-
goalId: row.goal_id,
|
|
100
|
-
version: row.version,
|
|
101
|
-
objective: row.objective,
|
|
102
|
-
scopeBoundary: row.scope_boundary ?? void 0,
|
|
103
|
-
evidencePlan: parseJsonStringArray(row.evidence_plan_json) ?? [],
|
|
104
|
-
outcomeMetric: parseGoalOutcomeMetric(row.outcome_metric_json),
|
|
105
|
-
createdAt: row.created_at,
|
|
106
|
-
updatedAt: row.updated_at
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function parseGoalOutcomeMetric(raw) {
|
|
110
|
-
const value = parseJsonField(raw);
|
|
111
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
112
|
-
const metric = value;
|
|
113
|
-
if (typeof metric.name !== "string" || !metric.name.trim() || typeof metric.baselineValue !== "number" || !Number.isFinite(metric.baselineValue) || typeof metric.targetValue !== "number" || !Number.isFinite(metric.targetValue) || metric.direction !== "increase" && metric.direction !== "decrease") return void 0;
|
|
114
|
-
return {
|
|
115
|
-
name: metric.name.trim(),
|
|
116
|
-
baselineValue: metric.baselineValue,
|
|
117
|
-
targetValue: metric.targetValue,
|
|
118
|
-
currentValue: typeof metric.currentValue === "number" && Number.isFinite(metric.currentValue) ? metric.currentValue : void 0,
|
|
119
|
-
unit: typeof metric.unit === "string" && metric.unit.trim() ? metric.unit.trim() : void 0,
|
|
120
|
-
direction: metric.direction,
|
|
121
|
-
sourceUrl: typeof metric.sourceUrl === "string" && metric.sourceUrl.trim() ? metric.sourceUrl.trim() : void 0,
|
|
122
|
-
measuredAt: typeof metric.measuredAt === "number" && Number.isFinite(metric.measuredAt) ? metric.measuredAt : void 0
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
function normalizeGoalOutcomeMetric(input) {
|
|
126
|
-
if (!input) return void 0;
|
|
127
|
-
return {
|
|
128
|
-
name: input.name.trim(),
|
|
129
|
-
baselineValue: input.baselineValue,
|
|
130
|
-
targetValue: input.targetValue,
|
|
131
|
-
currentValue: input.currentValue,
|
|
132
|
-
unit: input.unit?.trim() || void 0,
|
|
133
|
-
direction: input.direction ?? (input.targetValue >= input.baselineValue ? "increase" : "decrease"),
|
|
134
|
-
sourceUrl: input.sourceUrl?.trim() || void 0,
|
|
135
|
-
measuredAt: input.measuredAt
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function normalizeStringList(items, limit = 20) {
|
|
139
|
-
if (!items) return [];
|
|
140
|
-
const seen = /* @__PURE__ */ new Set();
|
|
141
|
-
const result = [];
|
|
142
|
-
for (const item of items) {
|
|
143
|
-
const text = item.trim();
|
|
144
|
-
const key = text.toLocaleLowerCase();
|
|
145
|
-
if (!text || seen.has(key)) continue;
|
|
146
|
-
seen.add(key);
|
|
147
|
-
result.push(text);
|
|
148
|
-
if (result.length >= limit) break;
|
|
149
|
-
}
|
|
150
|
-
return result;
|
|
151
|
-
}
|
|
152
|
-
function normalizeContract(input, goalId, fallbackObjective, now, version = 1, createdAt = now) {
|
|
153
|
-
if (!input) return void 0;
|
|
154
|
-
return {
|
|
155
|
-
goalId,
|
|
156
|
-
version,
|
|
157
|
-
objective: input.objective?.trim() || fallbackObjective,
|
|
158
|
-
scopeBoundary: input.scopeBoundary?.trim() || void 0,
|
|
159
|
-
evidencePlan: normalizeStringList(input.evidencePlan),
|
|
160
|
-
outcomeMetric: normalizeGoalOutcomeMetric(input.outcomeMetric),
|
|
161
|
-
createdAt,
|
|
162
|
-
updatedAt: now
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
function insertGoalContract(db, contract) {
|
|
166
|
-
db.prepare(`INSERT INTO goal_contracts (
|
|
167
|
-
goal_id, version, objective, scope_boundary, evidence_plan_json, outcome_metric_json, created_at, updated_at
|
|
168
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(contract.goalId, contract.version, contract.objective, contract.scopeBoundary ?? null, JSON.stringify(contract.evidencePlan), contract.outcomeMetric ? JSON.stringify(contract.outcomeMetric) : null, contract.createdAt, contract.updatedAt);
|
|
169
|
-
}
|
|
170
99
|
function eventFromRow(row) {
|
|
171
100
|
return {
|
|
172
101
|
id: row.event_id,
|
|
@@ -191,38 +120,6 @@ function evidenceFromRow(row) {
|
|
|
191
120
|
createdAt: row.created_at
|
|
192
121
|
};
|
|
193
122
|
}
|
|
194
|
-
function evidenceRequirementFromRow(row, evidenceIds = []) {
|
|
195
|
-
return {
|
|
196
|
-
id: row.requirement_id,
|
|
197
|
-
goalId: row.goal_id,
|
|
198
|
-
text: row.text,
|
|
199
|
-
status: row.status,
|
|
200
|
-
evidenceIds,
|
|
201
|
-
reviewReason: row.review_reason ?? void 0,
|
|
202
|
-
reviewConfidence: row.review_confidence ?? void 0,
|
|
203
|
-
reviewedBy: row.reviewed_by ?? void 0,
|
|
204
|
-
reviewedAt: row.reviewed_at ?? void 0,
|
|
205
|
-
requiresHumanApproval: Boolean(row.requires_human_approval),
|
|
206
|
-
createdAt: row.created_at,
|
|
207
|
-
updatedAt: row.updated_at,
|
|
208
|
-
sortOrder: row.sort_order
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
function syncEvidenceRequirements(db, goalId, evidencePlan, now) {
|
|
212
|
-
const existing = db.prepare(`SELECT * FROM goal_evidence_requirements WHERE goal_id = ?`).all(goalId);
|
|
213
|
-
const byText = new Map(existing.map((item) => [item.text.toLocaleLowerCase(), item]));
|
|
214
|
-
const desired = new Set(evidencePlan.map((text) => text.toLocaleLowerCase()));
|
|
215
|
-
for (const item of existing) if (!desired.has(item.text.toLocaleLowerCase())) db.prepare(`DELETE FROM goal_evidence_requirements WHERE requirement_id = ?`).run(item.requirement_id);
|
|
216
|
-
for (const [index, text] of evidencePlan.entries()) {
|
|
217
|
-
const current = byText.get(text.toLocaleLowerCase());
|
|
218
|
-
if (current) db.prepare(`UPDATE goal_evidence_requirements
|
|
219
|
-
SET text = ?, sort_order = ?, updated_at = ?
|
|
220
|
-
WHERE requirement_id = ?`).run(text, index + 1, now, current.requirement_id);
|
|
221
|
-
else db.prepare(`INSERT INTO goal_evidence_requirements (
|
|
222
|
-
requirement_id, goal_id, text, status, requires_human_approval, created_at, updated_at, sort_order
|
|
223
|
-
) VALUES (?, ?, ?, 'pending', 1, ?, ?, ?)`).run(randomUUID(), goalId, text, now, now, index + 1);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
123
|
function clampLimit(n, fallback) {
|
|
227
124
|
return Math.min(500, Math.max(1, Math.floor(n ?? fallback)));
|
|
228
125
|
}
|
|
@@ -245,6 +142,8 @@ var GoalStore = class {
|
|
|
245
142
|
const now = Date.now();
|
|
246
143
|
const goal = {
|
|
247
144
|
id: randomUUID(),
|
|
145
|
+
outcomeId: input.outcomeId,
|
|
146
|
+
outcomeContractVersion: input.outcomeContractVersion,
|
|
248
147
|
title: input.title.trim(),
|
|
249
148
|
description: input.description?.trim() || void 0,
|
|
250
149
|
status: "active",
|
|
@@ -261,34 +160,32 @@ var GoalStore = class {
|
|
|
261
160
|
source: input.source ?? "chat",
|
|
262
161
|
projectId: input.projectId?.trim() || void 0
|
|
263
162
|
};
|
|
264
|
-
const contract = normalizeContract(input.contract, goal.id, goal.title, now);
|
|
265
|
-
const criteria = normalizeStringList(input.contract?.criteria);
|
|
266
163
|
runSqliteWriteTransaction((db) => {
|
|
164
|
+
const contract = db.prepare(`SELECT acceptance_criteria_json
|
|
165
|
+
FROM outcome_contracts
|
|
166
|
+
WHERE outcome_id = ? AND version = ?`).get(goal.outcomeId, goal.outcomeContractVersion);
|
|
167
|
+
if (!contract) throw new Error("Outcome contract not found");
|
|
168
|
+
const criteria = parseJsonStringArray(contract.acceptance_criteria_json) ?? [];
|
|
267
169
|
db.prepare(`INSERT INTO goals (
|
|
268
|
-
goal_id, title, description, status, agent_id, priority, deadline_at,
|
|
170
|
+
goal_id, outcome_id, outcome_contract_version, title, description, status, agent_id, priority, deadline_at,
|
|
269
171
|
created_at, updated_at, active_session_key, judge_model_ref,
|
|
270
172
|
max_turns, turns_used, ui_locale, source, project_id
|
|
271
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(goal.id, goal.title, goal.description ?? null, goal.status, goal.agentId, goal.priority, goal.deadlineAt ?? null, goal.createdAt, goal.updatedAt, goal.activeSessionKey ?? null, goal.judgeModelRef ?? null, goal.maxTurns, goal.turnsUsed, goal.uiLocale ?? null, goal.source, goal.projectId ?? null);
|
|
173
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(goal.id, goal.outcomeId, goal.outcomeContractVersion, goal.title, goal.description ?? null, goal.status, goal.agentId, goal.priority, goal.deadlineAt ?? null, goal.createdAt, goal.updatedAt, goal.activeSessionKey ?? null, goal.judgeModelRef ?? null, goal.maxTurns, goal.turnsUsed, goal.uiLocale ?? null, goal.source, goal.projectId ?? null);
|
|
272
174
|
if (goal.activeSessionKey) db.prepare(`INSERT OR REPLACE INTO goal_session_links (goal_id, session_key, linked_at)
|
|
273
175
|
VALUES (?, ?, ?)`).run(goal.id, goal.activeSessionKey, now);
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
evidenceCount: contract.evidencePlan.length
|
|
288
|
-
},
|
|
289
|
-
createdAt: now
|
|
290
|
-
});
|
|
291
|
-
}
|
|
176
|
+
for (const [index, text] of criteria.entries()) db.prepare(`INSERT INTO goal_checklist_items (
|
|
177
|
+
item_id, goal_id, text, status, added_by, added_at, sort_order
|
|
178
|
+
) VALUES (?, ?, ?, 'pending', 'user', ?, ?)`).run(randomUUID(), goal.id, text, now, index + 1);
|
|
179
|
+
insertGoalEvent(db, {
|
|
180
|
+
goalId: goal.id,
|
|
181
|
+
kind: "outcome_bound",
|
|
182
|
+
message: goal.outcomeId,
|
|
183
|
+
data: {
|
|
184
|
+
contractVersion: goal.outcomeContractVersion,
|
|
185
|
+
criteriaCount: criteria.length
|
|
186
|
+
},
|
|
187
|
+
createdAt: now
|
|
188
|
+
});
|
|
292
189
|
insertGoalEvent(db, {
|
|
293
190
|
goalId: goal.id,
|
|
294
191
|
kind: "created",
|
|
@@ -326,49 +223,6 @@ var GoalStore = class {
|
|
|
326
223
|
const row = getSqliteDatabase().prepare(`SELECT * FROM goal_context_messages WHERE goal_id = ?`).get(goalId);
|
|
327
224
|
return row ? goalContextFromRow(row) : null;
|
|
328
225
|
}
|
|
329
|
-
getContract(goalId) {
|
|
330
|
-
const row = getSqliteDatabase().prepare(`SELECT * FROM goal_contracts WHERE goal_id = ?`).get(goalId);
|
|
331
|
-
return row ? goalContractFromRow(row) : null;
|
|
332
|
-
}
|
|
333
|
-
setContract(goalId, input) {
|
|
334
|
-
const goal = this.get(goalId);
|
|
335
|
-
if (!goal) return null;
|
|
336
|
-
return runSqliteWriteTransaction((db) => {
|
|
337
|
-
const existing = db.prepare(`SELECT * FROM goal_contracts WHERE goal_id = ?`).get(goalId);
|
|
338
|
-
const now = Date.now();
|
|
339
|
-
const contract = normalizeContract({
|
|
340
|
-
...input,
|
|
341
|
-
objective: input.objective ?? existing?.objective,
|
|
342
|
-
scopeBoundary: input.scopeBoundary ?? existing?.scope_boundary ?? void 0,
|
|
343
|
-
evidencePlan: input.evidencePlan ?? parseJsonStringArray(existing?.evidence_plan_json ?? null) ?? [],
|
|
344
|
-
outcomeMetric: input.outcomeMetric === void 0 ? parseGoalOutcomeMetric(existing?.outcome_metric_json ?? null) : input.outcomeMetric
|
|
345
|
-
}, goalId, goal.title, now, (existing?.version ?? 0) + 1, existing?.created_at ?? now);
|
|
346
|
-
if (!contract) return null;
|
|
347
|
-
db.prepare(`INSERT INTO goal_contracts (
|
|
348
|
-
goal_id, version, objective, scope_boundary, evidence_plan_json, outcome_metric_json, created_at, updated_at
|
|
349
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
350
|
-
ON CONFLICT(goal_id) DO UPDATE SET
|
|
351
|
-
version = excluded.version,
|
|
352
|
-
objective = excluded.objective,
|
|
353
|
-
scope_boundary = excluded.scope_boundary,
|
|
354
|
-
evidence_plan_json = excluded.evidence_plan_json,
|
|
355
|
-
outcome_metric_json = excluded.outcome_metric_json,
|
|
356
|
-
updated_at = excluded.updated_at`).run(contract.goalId, contract.version, contract.objective, contract.scopeBoundary ?? null, JSON.stringify(contract.evidencePlan), contract.outcomeMetric ? JSON.stringify(contract.outcomeMetric) : null, contract.createdAt, contract.updatedAt);
|
|
357
|
-
syncEvidenceRequirements(db, goalId, contract.evidencePlan, now);
|
|
358
|
-
insertGoalEvent(db, {
|
|
359
|
-
goalId,
|
|
360
|
-
kind: "contract_updated",
|
|
361
|
-
message: contract.objective,
|
|
362
|
-
data: {
|
|
363
|
-
version: contract.version,
|
|
364
|
-
evidenceCount: contract.evidencePlan.length,
|
|
365
|
-
hasOutcomeMetric: Boolean(contract.outcomeMetric)
|
|
366
|
-
},
|
|
367
|
-
createdAt: now
|
|
368
|
-
});
|
|
369
|
-
return contract;
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
226
|
getActiveForSession(sessionKey) {
|
|
373
227
|
const row = getSqliteDatabase().prepare(`SELECT * FROM goals
|
|
374
228
|
WHERE active_session_key = ?
|
|
@@ -611,67 +465,7 @@ var GoalStore = class {
|
|
|
611
465
|
return evidence;
|
|
612
466
|
}
|
|
613
467
|
listEvidence(goalId, limit) {
|
|
614
|
-
|
|
615
|
-
const db = getSqliteDatabase();
|
|
616
|
-
return rows.map((row) => ({
|
|
617
|
-
...evidenceFromRow(row),
|
|
618
|
-
requirementIds: db.prepare(`SELECT requirement_id FROM goal_evidence_requirement_links WHERE evidence_id = ? ORDER BY requirement_id`).all(row.evidence_id).map((item) => item.requirement_id)
|
|
619
|
-
}));
|
|
620
|
-
}
|
|
621
|
-
listEvidenceRequirements(goalId) {
|
|
622
|
-
const db = getSqliteDatabase();
|
|
623
|
-
return db.prepare(`SELECT * FROM goal_evidence_requirements WHERE goal_id = ? ORDER BY sort_order ASC`).all(goalId).map((row) => evidenceRequirementFromRow(row, db.prepare(`SELECT evidence_id FROM goal_evidence_requirement_links WHERE requirement_id = ? ORDER BY created_at ASC`).all(row.requirement_id).map((item) => item.evidence_id)));
|
|
624
|
-
}
|
|
625
|
-
linkEvidenceRequirement(input) {
|
|
626
|
-
return runSqliteWriteTransaction((db) => {
|
|
627
|
-
const requirement = db.prepare(`SELECT * FROM goal_evidence_requirements WHERE requirement_id = ? AND goal_id = ?`).get(input.requirementId, input.goalId);
|
|
628
|
-
const evidence = db.prepare(`SELECT evidence_id FROM goal_evidence WHERE evidence_id = ? AND goal_id = ?`).get(input.evidenceId, input.goalId);
|
|
629
|
-
if (!requirement || !evidence) return null;
|
|
630
|
-
const now = Date.now();
|
|
631
|
-
db.prepare(`INSERT OR IGNORE INTO goal_evidence_requirement_links (requirement_id, evidence_id, linked_by, created_at)
|
|
632
|
-
VALUES (?, ?, ?, ?)`).run(input.requirementId, input.evidenceId, input.linkedBy, now);
|
|
633
|
-
db.prepare(`UPDATE goal_evidence_requirements
|
|
634
|
-
SET status = CASE WHEN status = 'rejected' THEN 'pending' ELSE status END,
|
|
635
|
-
updated_at = ?
|
|
636
|
-
WHERE requirement_id = ?`).run(now, input.requirementId);
|
|
637
|
-
insertGoalEvent(db, {
|
|
638
|
-
goalId: input.goalId,
|
|
639
|
-
kind: "evidence_requirement_linked",
|
|
640
|
-
message: requirement.text,
|
|
641
|
-
data: {
|
|
642
|
-
requirementId: input.requirementId,
|
|
643
|
-
evidenceId: input.evidenceId,
|
|
644
|
-
linkedBy: input.linkedBy
|
|
645
|
-
},
|
|
646
|
-
createdAt: now
|
|
647
|
-
});
|
|
648
|
-
const ids = db.prepare(`SELECT evidence_id FROM goal_evidence_requirement_links WHERE requirement_id = ? ORDER BY created_at ASC`).all(input.requirementId).map((item) => item.evidence_id);
|
|
649
|
-
return evidenceRequirementFromRow(db.prepare(`SELECT * FROM goal_evidence_requirements WHERE requirement_id = ?`).get(input.requirementId), ids);
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
reviewEvidenceRequirement(input) {
|
|
653
|
-
return runSqliteWriteTransaction((db) => {
|
|
654
|
-
const current = db.prepare(`SELECT * FROM goal_evidence_requirements WHERE requirement_id = ? AND goal_id = ?`).get(input.requirementId, input.goalId);
|
|
655
|
-
if (!current) return null;
|
|
656
|
-
const now = Date.now();
|
|
657
|
-
db.prepare(`UPDATE goal_evidence_requirements
|
|
658
|
-
SET status = ?, review_reason = ?, review_confidence = ?, reviewed_by = ?, reviewed_at = ?, updated_at = ?
|
|
659
|
-
WHERE requirement_id = ?`).run(input.status, input.reason.trim(), input.confidence ?? null, input.reviewedBy, now, now, input.requirementId);
|
|
660
|
-
insertGoalEvent(db, {
|
|
661
|
-
goalId: input.goalId,
|
|
662
|
-
kind: input.reviewedBy === "user" ? "evidence_requirement_approved" : "evidence_requirement_reviewed",
|
|
663
|
-
message: current.text,
|
|
664
|
-
data: {
|
|
665
|
-
requirementId: input.requirementId,
|
|
666
|
-
status: input.status,
|
|
667
|
-
reason: input.reason.trim(),
|
|
668
|
-
confidence: input.confidence
|
|
669
|
-
},
|
|
670
|
-
createdAt: now
|
|
671
|
-
});
|
|
672
|
-
const ids = db.prepare(`SELECT evidence_id FROM goal_evidence_requirement_links WHERE requirement_id = ? ORDER BY created_at ASC`).all(input.requirementId).map((item) => item.evidence_id);
|
|
673
|
-
return evidenceRequirementFromRow(db.prepare(`SELECT * FROM goal_evidence_requirements WHERE requirement_id = ?`).get(input.requirementId), ids);
|
|
674
|
-
});
|
|
468
|
+
return getSqliteDatabase().prepare(`SELECT * FROM goal_evidence WHERE goal_id = ? ORDER BY created_at DESC LIMIT ?`).all(goalId, clampLimit(limit, 100)).map(evidenceFromRow);
|
|
675
469
|
}
|
|
676
470
|
};
|
|
677
471
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
4
|
+
import { resolveGoalUiLocale } from "../agent/goals/goal-locale.js";
|
|
4
5
|
import { GoalService } from "./goal-service.js";
|
|
5
6
|
import { renderWorkflowText } from "../agent/workflow/snapshot.js";
|
|
6
|
-
import { resolveGoalUiLocale } from "../agent/goals/goal-locale.js";
|
|
7
7
|
import { evaluateAfterTurnHermesLike } from "../agent/goals/evaluate-turn.js";
|
|
8
8
|
import { runViewToSnapshot } from "../workflows/service/run-view-to-snapshot.js";
|
|
9
9
|
//#region src/goals/goal-workflow-judge.ts
|
|
@@ -4,10 +4,6 @@ export { GoalRunner } from './goal-runner.js';
|
|
|
4
4
|
export { GoalQueueStore } from './goal-queue-store.js';
|
|
5
5
|
export { GoalNotificationService } from './goal-notifications.js';
|
|
6
6
|
export { GoalWorkflowJudge } from './goal-workflow-judge.js';
|
|
7
|
-
export { draftGoalContract } from './goal-contract-draft.js';
|
|
8
|
-
export { reviewGoalEvidenceRequirement } from './goal-evidence-review.js';
|
|
9
|
-
export type * from './goal-contract-draft.js';
|
|
10
|
-
export type * from './goal-evidence-review.js';
|
|
11
7
|
export type * from './types.js';
|
|
12
8
|
export type * from './goal-queue-types.js';
|
|
13
9
|
export type * from './goal-notifications.js';
|
package/dist/src/goals/index.js
CHANGED
|
@@ -4,6 +4,4 @@ import { GoalQueueStore } from "./goal-queue-store.js";
|
|
|
4
4
|
import { GoalRunner } from "./goal-runner.js";
|
|
5
5
|
import { GoalNotificationService } from "./goal-notifications.js";
|
|
6
6
|
import { GoalWorkflowJudge } from "./goal-workflow-judge.js";
|
|
7
|
-
|
|
8
|
-
import { reviewGoalEvidenceRequirement } from "./goal-evidence-review.js";
|
|
9
|
-
export { GoalNotificationService, GoalQueueStore, GoalRunner, GoalService, GoalStore, GoalWorkflowJudge, draftGoalContract, normalizeGoalUiLocale, reviewGoalEvidenceRequirement };
|
|
7
|
+
export { GoalNotificationService, GoalQueueStore, GoalRunner, GoalService, GoalStore, GoalWorkflowJudge, normalizeGoalUiLocale };
|