@xopcai/xopc 0.0.218 → 0.0.220
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-DF2dYXG1.js → activity-store-DeKZ36Jy.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Dw9rF5o1.js → agent-avatar-dicebear-D0hZfdkn.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Bu0NfWuh.js +68 -0
- package/dist/gateway/static/root/assets/{api-_H0Bam-t.js → api-yLnYUedB.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-C2kZNEHz.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-DQ7H35sN.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-Tty2xaUG.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DZCOhXch.js → archive-plugin-CBArbTPH.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-Bjb0FH2B.js → attachment-load-oc6DRj4G.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-D4N3ZDhu.js → automations-page-CHPEUpz8.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-9uYkHmdI.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-uXPt0s47.js → binary-plugins-BRBd0X7_.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-gukkIEro.js → block-editor-ZgM-Z4Qv.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-BT3mEm00.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-DAhdS-XZ.js → browser-workflow-inputs-DxD74a4c.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-LKjYzXS_.js → browser-workflows-page-Dpc7NqZf.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DHlfRj4M.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BBUkH833.js → capability-presets-api-B9ID97j6.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D2FkREUX.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-E5mo8M3a.js → channel-recipient-api-DCNn6MWL.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-D4YcKMtf.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-B8XWrzKM.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-MvNpjcUs.js +36 -0
- package/dist/gateway/static/root/assets/connectors-page-Bd6K9bDk.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-BGNuaqvI.js → cron-expression-BSXX9uY0.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-k7mkklMU.js → date-picker-CiHNkkIS.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-DQyh2ZXE.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-p9EZyGzV.js → desktop-pet-DnAHU-zA.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DUdhIBBB.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-B3gFQt8x.js +1 -0
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-Cd4BMKm_.js → extension-debug-page-Lq-gRApw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CzEGCkOa.js → extension-page-D0ROxJmY.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-B2tS6mFy.js +1 -0
- package/dist/gateway/static/root/assets/eye-CABVeTq0.js +1 -0
- package/dist/gateway/static/root/assets/eye-off-DEAzt3g1.js +1 -0
- package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +1 -0
- package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +1 -0
- package/dist/gateway/static/root/assets/gateway-config-api-DJqWfVi6.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-DNrttVr2.js → gateway-config-swr-CnwF9Vso.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-B3thenPX.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B1vD3vRb.js → gateway-startup-retry-DdJJZR8M.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-C_g-ZGSE.js +1 -0
- package/dist/gateway/static/root/assets/home-page-Cgwx66kc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BTR0Wk_k.js → image-generation-api-Dtt9M5qz.js} +1 -1
- package/dist/gateway/static/root/assets/index-Cf0qTkBK.css +2 -0
- package/dist/gateway/static/root/assets/index-V9g9-SWT.js +108 -0
- package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +1 -0
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CYlS4RGA.js → keyboard-shortcuts-settings-cJqkmQdP.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CmjLMdly.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CNppYVew.js → local-apps-page-BiuP2pkl.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-gf9Bg2gb.js → locale-store-D3Q2yEAb.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-BTlxGPho.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-IYk9xLgt.js → management-settings-Z1gJUwP_.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-D8e6pRMH.js → markdown-split-DuOmpGgE.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-D0fiJjBQ.js → markdown-view-WYArkdrc.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CCq6TtEf.js → media-plugins-DKPh3Mud.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BQHpB4VI.js +3 -0
- package/dist/gateway/static/root/assets/{notes-api-BBtWnlUU.js → notes-api-DMEon7Zv.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BKe1xa3U.js → notes-page-BG4gV8WG.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-D3LMBO2X.js +4 -0
- package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-CsNVTKC0.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DXe5iWI6.js → product-open-page-BjJf4QOB.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-C59tYJG-.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Di7W-Fg8.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-xj5gOva_.js → registry-api-DRyvynb5.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BYOKveWT.js +1 -0
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BJTvmBCA.js → runtime-tools-settings-panel-DC6t_-db.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DvGBa_7R.js → schema-form-DSTWtpjp.js} +1 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-CJMNQsxK.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-FJxZw08y.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-ZzEMNLYS.js +1 -0
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-sbef7GTm.js → settings-loading-skeleton-D7-bkbcW.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BNGxxXZe.js → settings-page-PaTpLbmi.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Bnpim6NY.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-C1523ij3.js → share-preview-page-Cxcw0ksa.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DBqmV7ZY.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-UgLQaWoz.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-Dby4iAYe.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-Ditgz7Vo.js → skills-page.utils-nlzJ5Y1V.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-vOsgnzDl.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-CRy8Wl5g.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-DgSjes3O.js → theme-store-CvnEHGyP.js} +1 -1
- package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-Bp_qFZkl.js → use-autosave-BTNZHulv.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-BT8F4mh5.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-hbzDfErG.js → voice-api-key-field-DDJ2-3Tx.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DZVib-04.js → work-discovery-overlay-DV_qiKSD.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C2RKay1p.js → workflow-run-setup-panel--AcvRw1w.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CwvskVvU.js +5 -0
- package/dist/gateway/static/root/index.html +21 -12
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/new-session.js +99 -0
- package/dist/packages/gateway-contract/src/tasks.js +5 -0
- package/dist/packages/gateway-contract/src/user-message-display.js +55 -0
- package/dist/src/agent/agent-manager.js +5 -4
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +2 -2
- package/dist/src/agent/background-review/run-background-review.js +144 -16
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +3 -1
- package/dist/src/agent/inbound/turn-dispatcher.js +2 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/memory/context/types.d.ts +1 -1
- package/dist/src/agent/memory/manager.d.ts +2 -1
- package/dist/src/agent/memory/manager.js +2 -6
- package/dist/src/agent/memory/understanding/service.d.ts +1 -0
- package/dist/src/agent/memory/understanding/service.js +179 -36
- package/dist/src/agent/memory/understanding/types.d.ts +6 -0
- package/dist/src/agent/messaging/command-handler.d.ts +2 -0
- package/dist/src/agent/messaging/command-handler.js +3 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +3 -0
- package/dist/src/agent/service/direct-turn-helpers.js +13 -3
- package/dist/src/agent/service/process-direct-streaming.d.ts +2 -1
- package/dist/src/agent/service/process-direct-streaming.js +12 -11
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-config-service.d.ts +1 -0
- package/dist/src/agent/session/session-config-service.js +11 -0
- package/dist/src/agent/session/session-inspector.d.ts +1 -0
- package/dist/src/agent/session/session-inspector.js +2 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/source-context/budget.d.ts +3 -0
- package/dist/src/agent/source-context/budget.js +21 -0
- package/dist/src/agent/source-context/index.js +3 -3
- package/dist/src/agent/source-context/injector.d.ts +2 -2
- package/dist/src/agent/source-context/injector.js +19 -9
- package/dist/src/agent/source-context/types.d.ts +16 -0
- package/dist/src/agent/source-context/types.js +25 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +19 -2
- package/dist/src/agent/tools/xopc-use-tool.js +62 -2
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/backend-from-config.d.ts +8 -0
- package/dist/src/browser/backend-from-config.js +16 -1
- package/dist/src/browser/providers/browser-ext-install.d.ts +3 -2
- package/dist/src/browser/providers/browser-ext-install.js +5 -3
- package/dist/src/chat-commands/builtins/review.js +11 -2
- package/dist/src/chat-commands/builtins/understanding.js +11 -4
- package/dist/src/chat-commands/types.d.ts +4 -0
- 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/models.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.d.ts +20 -20
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/connectors/connected-source-understanding.d.ts +1 -0
- package/dist/src/connectors/connected-source-understanding.js +87 -38
- package/dist/src/connectors/learning-coordinator.js +68 -13
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +18 -0
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +12 -2
- package/dist/src/gateway/hono/routes/commands-skills.js +1 -0
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +46 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +23 -3
- package/dist/src/gateway/hono/routes/sessions.js +17 -20
- package/dist/src/gateway/hono/routes/tasks.js +25 -0
- package/dist/src/gateway/hono/routes/understanding-sources.d.ts +18 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +165 -36
- package/dist/src/gateway/hono/routes/work-discovery.js +13 -3
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/hono/routes/you.js +71 -4
- package/dist/src/gateway/service/agent-runner.d.ts +11 -2
- package/dist/src/gateway/service/agent-runner.js +27 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.d.ts +2 -0
- package/dist/src/gateway/service/run-gateway-agent.js +15 -9
- package/dist/src/gateway/service/session-input-coordinator.d.ts +8 -2
- package/dist/src/gateway/service/session-input-coordinator.js +62 -3
- package/dist/src/gateway/service/sessions-api.d.ts +10 -0
- package/dist/src/gateway/service/sessions-api.js +3 -0
- package/dist/src/gateway/service.d.ts +3 -2
- package/dist/src/gateway/service.js +27 -16
- package/dist/src/gateway/user-turn-input.d.ts +2 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +3 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.js +16 -3
- package/dist/src/knowledge/connected-knowledge-pipeline.d.ts +6 -0
- package/dist/src/knowledge/connected-knowledge-pipeline.js +35 -4
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +1 -1
- package/dist/src/knowledge/connected-understanding-pipeline.js +4 -2
- 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/retrieval/queryProfile.d.ts +3 -0
- package/dist/src/retrieval/queryProfile.js +20 -2
- package/dist/src/session/client-history.d.ts +11 -0
- package/dist/src/session/client-history.js +24 -2
- package/dist/src/session/config-types.d.ts +1 -1
- package/dist/src/session/session-title.js +2 -3
- package/dist/src/session/store.js +1 -0
- package/dist/src/session/transcript-outline.js +5 -2
- package/dist/src/session/types.d.ts +1 -0
- package/dist/src/session/user-message-display.d.ts +4 -0
- package/dist/src/session/user-message-display.js +22 -0
- package/dist/src/storage/sqlite/context-extraction-repository.d.ts +57 -0
- package/dist/src/storage/sqlite/context-extraction-repository.js +119 -0
- package/dist/src/storage/sqlite/context-relation-repository.d.ts +50 -0
- package/dist/src/storage/sqlite/context-relation-repository.js +97 -0
- package/dist/src/storage/sqlite/index.d.ts +6 -4
- package/dist/src/storage/sqlite/index.js +7 -5
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +5 -1
- package/dist/src/storage/sqlite/knowledge-repository.js +16 -1
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/memory-records-repository.js +21 -1
- package/dist/src/storage/sqlite/migrations/126_focus_context_governance.sql +72 -0
- package/dist/src/storage/sqlite/migrations/127_context_object_origin.sql +36 -0
- package/dist/src/storage/sqlite/migrations/128_context_extraction.sql +73 -0
- package/dist/src/storage/sqlite/migrations/129_focus_versions.sql +51 -0
- package/dist/src/storage/sqlite/migrations/130_context_evidence_provenance.sql +18 -0
- package/dist/src/storage/sqlite/migrations/131_session_input_contexts.sql +2 -0
- package/dist/src/storage/sqlite/migrations/132_transcript_source_context_metadata.sql +34 -0
- package/dist/src/storage/sqlite/migrations/133_archive_legacy_work_discovery_profile_facts.sql +11 -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/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/session-input-repository.js +19 -7
- package/dist/src/storage/sqlite/session-repository.js +2 -2
- package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/session-turn-replace-repository.js +3 -2
- package/dist/src/storage/sqlite/transcript-repository.js +29 -3
- package/dist/src/storage/sqlite/user-context-repository.d.ts +4 -1
- package/dist/src/storage/sqlite/user-context-repository.js +65 -29
- package/dist/src/tasks/home-query-service.d.ts +14 -0
- package/dist/src/tasks/home-query-service.js +19 -2
- package/dist/src/tasks/index.d.ts +1 -0
- package/dist/src/tasks/index.js +2 -1
- package/dist/src/tasks/task-deletion-service.d.ts +21 -0
- package/dist/src/tasks/task-deletion-service.js +35 -0
- package/dist/src/tasks/task-repository.js +22 -1
- package/dist/src/tui/backends/embedded-backend.js +5 -3
- package/dist/src/tui/backends/gateway-realtime-backend.js +5 -3
- package/dist/src/tui/chat-history.js +2 -1
- package/dist/src/tui/tui-agent-events.js +4 -2
- package/dist/src/tui/tui-commands.d.ts +1 -0
- package/dist/src/tui/tui-commands.js +8 -3
- package/dist/src/tui/tui-empty-session-cleanup.d.ts +0 -1
- package/dist/src/tui/tui-empty-session-cleanup.js +1 -11
- package/dist/src/tui/tui-new-session-preferences.d.ts +10 -0
- package/dist/src/tui/tui-new-session-preferences.js +32 -0
- package/dist/src/tui/tui-session-actions.d.ts +1 -0
- package/dist/src/tui/tui-session-actions.js +2 -1
- package/dist/src/tui/tui-settings.d.ts +2 -0
- package/dist/src/tui/tui-settings.js +4 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui-types.d.ts +1 -0
- package/dist/src/tui/tui.js +58 -5
- package/dist/src/tunnel/frpc-process.js +3 -0
- package/dist/src/tunnel/tunnel-service.d.ts +2 -0
- package/dist/src/tunnel/tunnel-service.js +40 -28
- package/dist/src/user-context/consolidation.d.ts +1 -0
- package/dist/src/user-context/consolidation.js +62 -2
- package/dist/src/user-context/context-objects.d.ts +17 -0
- package/dist/src/user-context/context-objects.js +99 -0
- package/dist/src/user-context/domain.d.ts +13 -1
- package/dist/src/user-context/evaluation/harness.d.ts +13 -0
- package/dist/src/user-context/evaluation/harness.js +31 -0
- package/dist/src/user-context/extraction/registry.d.ts +26 -0
- package/dist/src/user-context/extraction/registry.js +113 -0
- package/dist/src/user-context/extraction/repair.d.ts +19 -0
- package/dist/src/user-context/extraction/repair.js +68 -0
- package/dist/src/user-context/focus-lifecycle.d.ts +2 -0
- package/dist/src/user-context/focus-lifecycle.js +26 -0
- package/dist/src/user-context/planner.js +252 -62
- package/dist/src/user-context/retriever.js +69 -9
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/processing-policy.d.ts +2 -0
- package/dist/src/user-context/sources/processing-policy.js +7 -0
- package/dist/src/user-context/sources/repository.d.ts +23 -4
- package/dist/src/user-context/sources/repository.js +122 -12
- package/dist/src/user-context/sources/types.d.ts +10 -1
- package/dist/src/user-context/understanding.js +1 -1
- package/dist/src/work-discovery/analyzer.js +6 -4
- package/dist/src/work-discovery/index.js +2 -2
- package/dist/src/work-discovery/service.d.ts +12 -3
- package/dist/src/work-discovery/service.js +183 -86
- package/dist/src/work-discovery/source-repository.d.ts +1 -0
- package/dist/src/work-discovery/source-repository.js +10 -4
- package/dist/src/work-discovery/types.d.ts +2 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-Dj86bHkl.js +0 -68
- package/dist/gateway/static/root/assets/app-management-settings-panel-D-M6GN-8.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-XDhmzdIc.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-sfO835uz.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-PptuZgoo.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BoCmzMFV.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DhkJsU8Z.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Dm7T61fE.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-dG6UFVqt.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DgJxfNyK.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-CT5yoSMD.js +0 -36
- package/dist/gateway/static/root/assets/connectors-page-BC6Ft9SU.js +0 -2
- package/dist/gateway/static/root/assets/dependency-picker-DZVSgLXH.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-Bw4cCFzI.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-Cbst7IXR.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-C1PAKSy2.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-api-Bch9vO6t.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DkDxZFGG.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DXNMxy5b.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CYcpVFNT.js +0 -1
- package/dist/gateway/static/root/assets/index-Dgb1R07E.css +0 -2
- package/dist/gateway/static/root/assets/index-DlOYwVFK.js +0 -108
- package/dist/gateway/static/root/assets/local-app-workbench-page-BFrgPwGE.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-CPweLw3k.js +0 -2
- package/dist/gateway/static/root/assets/messages-B9WQcZ1V.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-wieRAd1y.js +0 -4
- package/dist/gateway/static/root/assets/page-tabs-Bsluqyfb.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-BrpTWv44.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-Cww6V7HJ.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D0LKhCCw.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Sf4Pde6Z.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-S5gvgfu5.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-B3XvdEy8.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-CiGFtdD8.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CGU_Mxjr.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-k0UQ8WxO.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DQ1GvL1w.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-OuHd9GcN.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-CERqCsz2.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-BnRNL2sn.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-abEJNkCO.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnkaiky5.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-B_VlcKiK.js +0 -5
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { endpointTurnClaimSchema } from "../../../../packages/endpoint-tools-protocol/src/index.js";
|
|
2
|
+
import { parseTurnContextRefs } from "../../../agent/source-context/types.js";
|
|
2
3
|
import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
|
|
3
4
|
//#region src/gateway/hono/routes/session-input-handler.ts
|
|
5
|
+
const MAX_TURN_CONTEXTS = 5;
|
|
4
6
|
async function submitSessionInput(c, deps, sessionKey) {
|
|
5
7
|
const body = await c.req.json().catch(() => null);
|
|
6
8
|
if (!body || !sessionKey) return c.json({
|
|
@@ -11,6 +13,14 @@ async function submitSessionInput(c, deps, sessionKey) {
|
|
|
11
13
|
}
|
|
12
14
|
}, 400);
|
|
13
15
|
const attachments = Array.isArray(body.attachments) ? body.attachments : void 0;
|
|
16
|
+
const contextRefs = parseTurnContextRefs(body.contextRefs, MAX_TURN_CONTEXTS);
|
|
17
|
+
if (contextRefs === null) return c.json({
|
|
18
|
+
ok: false,
|
|
19
|
+
error: {
|
|
20
|
+
code: "BAD_REQUEST",
|
|
21
|
+
message: `contextRefs must contain at most ${MAX_TURN_CONTEXTS} valid notes`
|
|
22
|
+
}
|
|
23
|
+
}, 400);
|
|
14
24
|
const content = typeof body.content === "string" ? body.content : "";
|
|
15
25
|
const contentError = validateWebchatContent(content);
|
|
16
26
|
if (contentError) return c.json({
|
|
@@ -57,6 +67,7 @@ async function submitSessionInput(c, deps, sessionKey) {
|
|
|
57
67
|
delivery,
|
|
58
68
|
content,
|
|
59
69
|
attachments,
|
|
70
|
+
contextRefs,
|
|
60
71
|
thinking: typeof body.thinking === "string" ? body.thinking : void 0,
|
|
61
72
|
origin: {
|
|
62
73
|
type: "endpoint",
|
|
@@ -67,9 +78,9 @@ async function submitSessionInput(c, deps, sessionKey) {
|
|
|
67
78
|
ok: false,
|
|
68
79
|
error: {
|
|
69
80
|
code: result.code,
|
|
70
|
-
message: "Input was not accepted"
|
|
81
|
+
message: result.code === "CONTEXT_UNAVAILABLE" ? "A referenced Note changed or is no longer available. Select it again." : "Input was not accepted"
|
|
71
82
|
}
|
|
72
|
-
}, result.code === "QUEUE_FULL" ? 409 : 400);
|
|
83
|
+
}, result.code === "QUEUE_FULL" || result.code === "CONTEXT_UNAVAILABLE" ? 409 : 400);
|
|
73
84
|
return c.json({
|
|
74
85
|
ok: true,
|
|
75
86
|
payload: {
|
|
@@ -88,6 +99,14 @@ async function replaceLatestSessionTurn(c, deps, sessionKey, targetTurnId) {
|
|
|
88
99
|
}
|
|
89
100
|
}, 400);
|
|
90
101
|
const attachments = Array.isArray(body.attachments) ? body.attachments : void 0;
|
|
102
|
+
const contextRefs = parseTurnContextRefs(body.contextRefs, MAX_TURN_CONTEXTS);
|
|
103
|
+
if (contextRefs === null) return c.json({
|
|
104
|
+
ok: false,
|
|
105
|
+
error: {
|
|
106
|
+
code: "BAD_REQUEST",
|
|
107
|
+
message: `contextRefs must contain at most ${MAX_TURN_CONTEXTS} valid notes`
|
|
108
|
+
}
|
|
109
|
+
}, 400);
|
|
91
110
|
const content = typeof body.content === "string" ? body.content : "";
|
|
92
111
|
const contentError = validateWebchatContent(content);
|
|
93
112
|
if (contentError) return c.json({
|
|
@@ -127,6 +146,7 @@ async function replaceLatestSessionTurn(c, deps, sessionKey, targetTurnId) {
|
|
|
127
146
|
delivery: "next",
|
|
128
147
|
content,
|
|
129
148
|
attachments,
|
|
149
|
+
contextRefs,
|
|
130
150
|
thinking: typeof body.thinking === "string" ? body.thinking : void 0,
|
|
131
151
|
origin: {
|
|
132
152
|
type: "endpoint",
|
|
@@ -135,7 +155,7 @@ async function replaceLatestSessionTurn(c, deps, sessionKey, targetTurnId) {
|
|
|
135
155
|
});
|
|
136
156
|
if (result.ok === false) {
|
|
137
157
|
const status = result.code === "TARGET_NOT_FOUND" ? 404 : result.code === "BAD_REQUEST" ? 400 : 409;
|
|
138
|
-
const message = result.code === "NOT_LATEST" ? "Only the latest user turn can be replaced" : result.code === "SESSION_BUSY" ? "Session has pending input" : result.code === "TARGET_NOT_FOUND" ? "User turn was not found" : "Replacement input was not accepted";
|
|
158
|
+
const message = result.code === "NOT_LATEST" ? "Only the latest user turn can be replaced" : result.code === "SESSION_BUSY" ? "Session has pending input" : result.code === "TARGET_NOT_FOUND" ? "User turn was not found" : result.code === "CONTEXT_UNAVAILABLE" ? "A referenced Note changed or is no longer available. Select it again." : "Replacement input was not accepted";
|
|
139
159
|
return c.json({
|
|
140
160
|
ok: false,
|
|
141
161
|
error: {
|
|
@@ -121,7 +121,7 @@ function registerSessionsRoutes(authenticated, deps) {
|
|
|
121
121
|
});
|
|
122
122
|
authenticated.post("/api/sessions", async (c) => {
|
|
123
123
|
const body = await c.req.json().catch(() => ({}));
|
|
124
|
-
const channel = body.channel
|
|
124
|
+
const channel = typeof body.channel === "string" && body.channel.trim() ? body.channel.trim() : "webchat";
|
|
125
125
|
const projectId = typeof body.projectId === "string" && body.projectId.trim() ? body.projectId.trim() : void 0;
|
|
126
126
|
const routingCfg = service.currentConfig;
|
|
127
127
|
if (projectId && !service.projects.get(projectId)) return c.json({
|
|
@@ -134,25 +134,7 @@ function registerSessionsRoutes(authenticated, deps) {
|
|
|
134
134
|
explicitAgentId: typeof body.agentId === "string" ? body.agentId : void 0,
|
|
135
135
|
projectId
|
|
136
136
|
});
|
|
137
|
-
|
|
138
|
-
const sessionKey = buildSessionKey({
|
|
139
|
-
agentId,
|
|
140
|
-
source: channel,
|
|
141
|
-
accountId: "default",
|
|
142
|
-
peerKind: "direct",
|
|
143
|
-
peerId: body.chat_id
|
|
144
|
-
});
|
|
145
|
-
await service.sessionIndexInstance.saveMessages(sessionKey, [], { metadata: buildDirectSessionMetadata({
|
|
146
|
-
agentId,
|
|
147
|
-
source: channel,
|
|
148
|
-
accountId: "default",
|
|
149
|
-
peerId: body.chat_id
|
|
150
|
-
}) });
|
|
151
|
-
if (projectId) service.projects.attachSession(sessionKey, projectId);
|
|
152
|
-
const session = await service.sessions.getSession(sessionKey);
|
|
153
|
-
return c.json({ session }, 201);
|
|
154
|
-
}
|
|
155
|
-
const chatId = `chat_${randomUUID()}`;
|
|
137
|
+
const chatId = (typeof body.chat_id === "string" && body.chat_id.trim() ? body.chat_id.trim() : void 0) ?? `chat_${randomUUID()}`;
|
|
156
138
|
const sessionKey = buildSessionKey({
|
|
157
139
|
agentId,
|
|
158
140
|
source: channel,
|
|
@@ -167,6 +149,21 @@ function registerSessionsRoutes(authenticated, deps) {
|
|
|
167
149
|
peerId: chatId
|
|
168
150
|
}) });
|
|
169
151
|
if (projectId) service.projects.attachSession(sessionKey, projectId);
|
|
152
|
+
const rawInitialConfig = body.initialAgentConfig && typeof body.initialAgentConfig === "object" ? body.initialAgentConfig : {};
|
|
153
|
+
const model = typeof rawInitialConfig.model === "string" && rawInitialConfig.model.trim() ? rawInitialConfig.model.trim() : void 0;
|
|
154
|
+
const thinkingLevel = typeof rawInitialConfig.thinkingLevel === "string" && rawInitialConfig.thinkingLevel.trim() ? rawInitialConfig.thinkingLevel.trim() : void 0;
|
|
155
|
+
const initialAgentConfig = {
|
|
156
|
+
...model ? { model } : {},
|
|
157
|
+
...thinkingLevel ? { thinkingLevel } : {},
|
|
158
|
+
...body.temporary === true ? { userContextMode: "temporary" } : {}
|
|
159
|
+
};
|
|
160
|
+
if (Object.keys(initialAgentConfig).length > 0) {
|
|
161
|
+
const result = await service.sessions.patchAgentConfig(sessionKey, initialAgentConfig);
|
|
162
|
+
if (!result.ok) return c.json({
|
|
163
|
+
ok: false,
|
|
164
|
+
error: result.error
|
|
165
|
+
}, 400);
|
|
166
|
+
}
|
|
170
167
|
const session = await service.sessions.getSession(sessionKey);
|
|
171
168
|
return c.json({ session }, 201);
|
|
172
169
|
});
|
|
@@ -15,6 +15,7 @@ import { ProjectMonitoringService } from "../../../tasks/project-monitoring-serv
|
|
|
15
15
|
import { ProjectOperatingViewService } from "../../../tasks/project-operating-view-service.js";
|
|
16
16
|
import { TaskValueMetricsService } from "../../../tasks/task-value-metrics-service.js";
|
|
17
17
|
import { TaskHandoffService } from "../../../tasks/task-handoff-service.js";
|
|
18
|
+
import { TaskDeletionService } from "../../../tasks/task-deletion-service.js";
|
|
18
19
|
import { TaskSignalService } from "../../../tasks/task-signal-service.js";
|
|
19
20
|
import { submitSessionInput } from "./session-input-handler.js";
|
|
20
21
|
import { TaskConversationQueryService } from "../../service/task-conversation-query-service.js";
|
|
@@ -33,6 +34,7 @@ function registerTaskRoutes(authenticated, deps) {
|
|
|
33
34
|
const projector = new TaskReadModelProjector();
|
|
34
35
|
const signals = new TaskSignalService(() => deps.service.dispatchTaskRuns());
|
|
35
36
|
const dependencies = new TaskDependencyService();
|
|
37
|
+
const deletion = new TaskDeletionService(tasks, runs);
|
|
36
38
|
const handoffs = new TaskHandoffService({
|
|
37
39
|
getConfig: () => deps.service.currentConfig,
|
|
38
40
|
sessionIndex: deps.service.sessionIndexInstance,
|
|
@@ -289,6 +291,29 @@ function registerTaskRoutes(authenticated, deps) {
|
|
|
289
291
|
task: updated
|
|
290
292
|
});
|
|
291
293
|
});
|
|
294
|
+
authenticated.delete("/api/tasks/:id", taskRateLimit, (c) => {
|
|
295
|
+
const taskId = c.req.param("id");
|
|
296
|
+
const result = deletion.delete(taskId);
|
|
297
|
+
if (result.ok === true) {
|
|
298
|
+
deps.service.dispatchTaskEvents();
|
|
299
|
+
return c.json({
|
|
300
|
+
ok: true,
|
|
301
|
+
deleted: true,
|
|
302
|
+
taskId
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
if (result.reason === "active_run") return c.json({
|
|
306
|
+
ok: false,
|
|
307
|
+
code: "task_active",
|
|
308
|
+
error: "Cancel the active TaskRun before deleting the Task",
|
|
309
|
+
runId: result.run.id
|
|
310
|
+
}, 409);
|
|
311
|
+
return c.json({
|
|
312
|
+
ok: false,
|
|
313
|
+
code: "task_not_found",
|
|
314
|
+
error: "Task not found"
|
|
315
|
+
}, 404);
|
|
316
|
+
});
|
|
292
317
|
authenticated.put("/api/tasks/:id/dependencies", taskRateLimit, async (c) => {
|
|
293
318
|
const parsed = TaskDependencyUpdateRequestSchema.safeParse(await c.req.json().catch(() => ({})));
|
|
294
319
|
if (!parsed.success) return c.json({
|
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
import type { Hono } from 'hono';
|
|
2
2
|
import type { AuthenticatedRouteDeps } from './deps.js';
|
|
3
|
+
export declare function sourceRevocationImpact(grantId: string): {
|
|
4
|
+
grant: import("../../../user-context/sources/types.js").UnderstandingSourceGrant;
|
|
5
|
+
sourceInstanceId: string;
|
|
6
|
+
understandingIds: string[];
|
|
7
|
+
focusIds: string[];
|
|
8
|
+
derivedCount: number;
|
|
9
|
+
understandingCount: number;
|
|
10
|
+
focusCount: number;
|
|
11
|
+
memoryRecordCount: number;
|
|
12
|
+
boundedRawCount: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function applySourceRevocationChoices(impact: NonNullable<ReturnType<typeof sourceRevocationImpact>>, options: {
|
|
15
|
+
derived: 'delete' | 'retain';
|
|
16
|
+
raw: 'delete' | 'retain';
|
|
17
|
+
}): {
|
|
18
|
+
derivedDeleted: number;
|
|
19
|
+
rawDeleted: number;
|
|
20
|
+
};
|
|
3
21
|
export declare function registerUnderstandingSourceRoutes(authenticated: Hono, deps: AuthenticatedRouteDeps): void;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { deleteUnderstanding, listUnderstandingEvidence, listUnderstandings } from "../../../storage/sqlite/user-context-repository.js";
|
|
1
|
+
import { deleteUnderstanding, listUnderstandingEvidence, listUnderstandings, setUnderstandingStatus } from "../../../storage/sqlite/user-context-repository.js";
|
|
2
|
+
import { countKnowledgeSourceItems, deleteKnowledgeSourceItems } from "../../../storage/sqlite/knowledge-repository.js";
|
|
3
|
+
import { countMemoryRecordsBySourceInstanceId, deleteMemoryRecordsBySourceInstanceId } from "../../../storage/sqlite/memory-records-repository.js";
|
|
2
4
|
import { getConnectorAccount } from "../../../storage/sqlite/connector-account-repository.js";
|
|
3
5
|
import "../../../storage/sqlite/index.js";
|
|
4
6
|
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
5
|
-
import { deleteUserFocus, getUnderstandingSourceGrant, listUnderstandingSourceGrants, listUnderstandingSourceRuns, listUserFocuses, revokeUnderstandingSourceGrant,
|
|
7
|
+
import { deleteUserFocus, getUnderstandingSourceGrant, getUnderstandingSourceRun, listUnderstandingSourceGrants, listUnderstandingSourceRuns, listUserFocusEvidence, listUserFocuses, revokeUnderstandingSourceGrant, updateUnderstandingSourceGrantPolicies, updateUserFocus } from "../../../user-context/sources/repository.js";
|
|
6
8
|
import { listConnectedContentCandidates, readConnectedContent } from "../../../connectors/content-enrichment.js";
|
|
7
9
|
import { getWorkDiscoveryService } from "./work-discovery.js";
|
|
8
10
|
import { listUnderstandingSourceDefinitions } from "../../../user-context/sources/catalog.js";
|
|
@@ -27,6 +29,52 @@ function decisionsFrom(body) {
|
|
|
27
29
|
}];
|
|
28
30
|
}).slice(0, 20);
|
|
29
31
|
}
|
|
32
|
+
function sourceRevocationImpact(grantId) {
|
|
33
|
+
const grant = getUnderstandingSourceGrant(grantId);
|
|
34
|
+
if (!grant) return null;
|
|
35
|
+
const accountId = typeof grant.config.accountId === "string" ? grant.config.accountId : void 0;
|
|
36
|
+
const connectorId = typeof grant.config.connectorId === "string" ? grant.config.connectorId : void 0;
|
|
37
|
+
const sourceInstanceId = accountId && connectorId ? `composio:${connectorId}:${accountId}` : void 0;
|
|
38
|
+
const belongs = (evidence) => evidence.sourceRef.startsWith(`understanding-source-grant:${grantId}:`) || Boolean(sourceInstanceId && evidence.sourceInstanceId === sourceInstanceId);
|
|
39
|
+
const understandings = listUnderstandings().flatMap((item) => {
|
|
40
|
+
if (item.explicitness === "explicit") return [];
|
|
41
|
+
const evidence = listUnderstandingEvidence(item.id);
|
|
42
|
+
return evidence.some(belongs) && !evidence.some((entry) => !belongs(entry)) ? [item] : [];
|
|
43
|
+
});
|
|
44
|
+
const focuses = listUserFocuses().flatMap((focus) => {
|
|
45
|
+
if (focus.explicitness === "explicit") return [];
|
|
46
|
+
if ((focus.sourceRunId ? getUnderstandingSourceRun(focus.sourceRunId) : null)?.grantId !== grantId) return [];
|
|
47
|
+
return listUserFocusEvidence(focus.id).some((entry) => !belongs(entry)) ? [] : [focus];
|
|
48
|
+
});
|
|
49
|
+
const memoryRecordCount = sourceInstanceId ? countMemoryRecordsBySourceInstanceId(sourceInstanceId) : 0;
|
|
50
|
+
const boundedRawCount = sourceInstanceId ? countKnowledgeSourceItems(sourceInstanceId) : 0;
|
|
51
|
+
return {
|
|
52
|
+
grant,
|
|
53
|
+
sourceInstanceId,
|
|
54
|
+
understandingIds: understandings.map((item) => item.id),
|
|
55
|
+
focusIds: focuses.map((item) => item.id),
|
|
56
|
+
derivedCount: understandings.length + focuses.length + memoryRecordCount,
|
|
57
|
+
understandingCount: understandings.length,
|
|
58
|
+
focusCount: focuses.length,
|
|
59
|
+
memoryRecordCount,
|
|
60
|
+
boundedRawCount
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function applySourceRevocationChoices(impact, options) {
|
|
64
|
+
let derivedDeleted = 0;
|
|
65
|
+
for (const id of impact.focusIds) if (options.derived === "delete") {
|
|
66
|
+
if (deleteUserFocus(id)) derivedDeleted += 1;
|
|
67
|
+
} else updateUserFocus(id, { status: "paused" });
|
|
68
|
+
for (const id of impact.understandingIds) if (options.derived === "delete") {
|
|
69
|
+
if (deleteUnderstanding(id)) derivedDeleted += 1;
|
|
70
|
+
} else setUnderstandingStatus(id, "needs_review");
|
|
71
|
+
if (options.derived === "delete" && impact.sourceInstanceId) derivedDeleted += deleteMemoryRecordsBySourceInstanceId(impact.sourceInstanceId);
|
|
72
|
+
const rawDeleted = options.raw === "delete" && impact.sourceInstanceId ? deleteKnowledgeSourceItems(impact.sourceInstanceId) : 0;
|
|
73
|
+
return {
|
|
74
|
+
derivedDeleted,
|
|
75
|
+
rawDeleted
|
|
76
|
+
};
|
|
77
|
+
}
|
|
30
78
|
function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
31
79
|
const service = getWorkDiscoveryService(deps);
|
|
32
80
|
const limited = deps.strictRateLimitMiddleware;
|
|
@@ -49,6 +97,54 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
|
49
97
|
}))
|
|
50
98
|
});
|
|
51
99
|
});
|
|
100
|
+
authenticated.patch("/api/understanding/sources/grants/:grantId", limited, async (c) => {
|
|
101
|
+
const body = await c.req.json().catch(() => null);
|
|
102
|
+
if (!body) return c.json({
|
|
103
|
+
ok: false,
|
|
104
|
+
error: "Invalid JSON"
|
|
105
|
+
}, 400);
|
|
106
|
+
const accessMode = body.accessMode;
|
|
107
|
+
const retentionPolicy = body.retentionPolicy;
|
|
108
|
+
const processingPolicy = body.processingPolicy;
|
|
109
|
+
if (accessMode !== void 0 && accessMode !== "once" && accessMode !== "continuous") return c.json({
|
|
110
|
+
ok: false,
|
|
111
|
+
error: "Invalid access mode"
|
|
112
|
+
}, 400);
|
|
113
|
+
if (retentionPolicy !== void 0 && retentionPolicy !== "metadata_only" && retentionPolicy !== "derived_only" && retentionPolicy !== "bounded_raw") return c.json({
|
|
114
|
+
ok: false,
|
|
115
|
+
error: "Invalid retention policy"
|
|
116
|
+
}, 400);
|
|
117
|
+
if (processingPolicy !== void 0 && processingPolicy !== "local_only" && processingPolicy !== "remote_allowed") return c.json({
|
|
118
|
+
ok: false,
|
|
119
|
+
error: "Invalid processing policy"
|
|
120
|
+
}, 400);
|
|
121
|
+
if (accessMode === void 0 && retentionPolicy === void 0 && processingPolicy === void 0) return c.json({
|
|
122
|
+
ok: false,
|
|
123
|
+
error: "At least one policy change is required"
|
|
124
|
+
}, 400);
|
|
125
|
+
const grant = updateUnderstandingSourceGrantPolicies(c.req.param("grantId"), {
|
|
126
|
+
...accessMode ? { accessMode } : {},
|
|
127
|
+
...retentionPolicy ? { retentionPolicy } : {},
|
|
128
|
+
...processingPolicy ? { processingPolicy } : {}
|
|
129
|
+
});
|
|
130
|
+
return grant ? c.json({
|
|
131
|
+
ok: true,
|
|
132
|
+
grant
|
|
133
|
+
}) : c.json({
|
|
134
|
+
ok: false,
|
|
135
|
+
error: "Source grant not found"
|
|
136
|
+
}, 404);
|
|
137
|
+
});
|
|
138
|
+
authenticated.get("/api/understanding/sources/grants/:grantId/impact", (c) => {
|
|
139
|
+
const impact = sourceRevocationImpact(c.req.param("grantId"));
|
|
140
|
+
return impact ? c.json({
|
|
141
|
+
ok: true,
|
|
142
|
+
impact
|
|
143
|
+
}) : c.json({
|
|
144
|
+
ok: false,
|
|
145
|
+
error: "Source grant not found"
|
|
146
|
+
}, 404);
|
|
147
|
+
});
|
|
52
148
|
authenticated.get("/api/understanding/sources/content-candidates", (c) => {
|
|
53
149
|
const agentId = resolveDefaultAgentId(deps.service.currentConfig);
|
|
54
150
|
return c.json({
|
|
@@ -76,32 +172,35 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
|
76
172
|
}
|
|
77
173
|
});
|
|
78
174
|
authenticated.delete("/api/understanding/sources/grants/:grantId", limited, (c) => {
|
|
79
|
-
const
|
|
175
|
+
const grantId = c.req.param("grantId");
|
|
176
|
+
const impact = sourceRevocationImpact(grantId);
|
|
177
|
+
const derived = c.req.query("derived");
|
|
178
|
+
const raw = c.req.query("raw");
|
|
179
|
+
if (derived !== "delete" && derived !== "retain") return c.json({
|
|
180
|
+
ok: false,
|
|
181
|
+
error: "derived must be delete or retain"
|
|
182
|
+
}, 400);
|
|
183
|
+
if (raw !== "delete" && raw !== "retain") return c.json({
|
|
184
|
+
ok: false,
|
|
185
|
+
error: "raw must be delete or retain"
|
|
186
|
+
}, 400);
|
|
187
|
+
const current = impact?.grant;
|
|
80
188
|
const accountId = typeof current?.config.accountId === "string" ? current.config.accountId : void 0;
|
|
81
|
-
const connectorId = typeof current?.config.connectorId === "string" ? current.config.connectorId : void 0;
|
|
82
|
-
const sourceInstanceId = accountId && connectorId ? `composio:${connectorId}:${accountId}` : void 0;
|
|
83
189
|
const connectionId = accountId ? getConnectorAccount(accountId)?.currentConnectionId : void 0;
|
|
84
190
|
if (connectionId) deps.service.setConnectorLearningPaused(connectionId, true);
|
|
85
|
-
const grant = revokeUnderstandingSourceGrant(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
for (const understanding of listUnderstandings()) {
|
|
94
|
-
const evidence = listUnderstandingEvidence(understanding.id);
|
|
95
|
-
const grantEvidence = evidence.map((evidence) => /^understanding-source-grant:([^:]+):/.exec(evidence.sourceRef)?.[1]).filter((id) => Boolean(id));
|
|
96
|
-
const connectorEvidence = evidence.map((item) => item.sourceInstanceId).filter((id) => Boolean(id));
|
|
97
|
-
const belongsToRevokedSource = grantEvidence.includes(grant.id) || Boolean(sourceInstanceId && connectorEvidence.includes(sourceInstanceId));
|
|
98
|
-
const hasActiveAlternative = grantEvidence.some((id) => id !== grant.id && activeGrantIds.has(id)) || connectorEvidence.some((id) => id !== sourceInstanceId && activeSourceInstanceIds.has(id));
|
|
99
|
-
if (belongsToRevokedSource && !hasActiveAlternative) deleteUnderstanding(understanding.id);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
191
|
+
const grant = revokeUnderstandingSourceGrant(grantId);
|
|
192
|
+
const deleted = grant && impact ? applySourceRevocationChoices(impact, {
|
|
193
|
+
derived,
|
|
194
|
+
raw
|
|
195
|
+
}) : {
|
|
196
|
+
derivedDeleted: 0,
|
|
197
|
+
rawDeleted: 0
|
|
198
|
+
};
|
|
102
199
|
return grant ? c.json({
|
|
103
200
|
ok: true,
|
|
104
|
-
grant
|
|
201
|
+
grant,
|
|
202
|
+
impact,
|
|
203
|
+
...deleted
|
|
105
204
|
}) : c.json({
|
|
106
205
|
ok: false,
|
|
107
206
|
error: "Source grant not found"
|
|
@@ -155,15 +254,21 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
|
155
254
|
sources: service.listDirectorySources()
|
|
156
255
|
}));
|
|
157
256
|
authenticated.post("/api/understanding/sources/work-folders", limited, async (c) => {
|
|
158
|
-
const
|
|
257
|
+
const body = await c.req.json().catch(() => null);
|
|
258
|
+
const rootPath = stringField(body, "rootPath");
|
|
259
|
+
const processingPolicy = stringField(body, "processingPolicy");
|
|
159
260
|
if (!rootPath) return c.json({
|
|
160
261
|
ok: false,
|
|
161
262
|
error: "Missing rootPath"
|
|
162
263
|
}, 400);
|
|
264
|
+
if (processingPolicy !== "local_only" && processingPolicy !== "remote_allowed") return c.json({
|
|
265
|
+
ok: false,
|
|
266
|
+
error: "Explicit processingPolicy is required"
|
|
267
|
+
}, 400);
|
|
163
268
|
try {
|
|
164
269
|
return c.json({
|
|
165
270
|
ok: true,
|
|
166
|
-
source: await service.grantDirectorySource(rootPath)
|
|
271
|
+
source: await service.grantDirectorySource(rootPath, processingPolicy)
|
|
167
272
|
}, 201);
|
|
168
273
|
} catch (error) {
|
|
169
274
|
return c.json({
|
|
@@ -191,14 +296,19 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
|
191
296
|
});
|
|
192
297
|
authenticated.post("/api/understanding/bootstrap", limited, async (c) => {
|
|
193
298
|
const body = await c.req.json().catch(() => null);
|
|
194
|
-
const items = body && typeof body === "object" && Array.isArray(body.items) ? body.items.slice(0,
|
|
299
|
+
const items = body && typeof body === "object" && Array.isArray(body.items) ? body.items.slice(0, 1200) : [];
|
|
300
|
+
const processingPolicy = stringField(body, "processingPolicy");
|
|
195
301
|
if (!items.length) return c.json({
|
|
196
302
|
ok: false,
|
|
197
303
|
error: "No understanding source items were provided"
|
|
198
304
|
}, 400);
|
|
305
|
+
if (processingPolicy !== "local_only" && processingPolicy !== "remote_allowed") return c.json({
|
|
306
|
+
ok: false,
|
|
307
|
+
error: "Explicit processingPolicy is required"
|
|
308
|
+
}, 400);
|
|
199
309
|
try {
|
|
200
310
|
const checkpoints = body && typeof body === "object" && body.sourceCheckpoints && typeof body.sourceCheckpoints === "object" ? body.sourceCheckpoints : void 0;
|
|
201
|
-
const result = await service.importUnderstandingSources(items, c.req.raw.signal, stringField(body, "workDiscoveryRunId") || void 0, checkpoints);
|
|
311
|
+
const result = await service.importUnderstandingSources(items, processingPolicy, c.req.raw.signal, stringField(body, "workDiscoveryRunId") || void 0, checkpoints);
|
|
202
312
|
return c.json({
|
|
203
313
|
ok: true,
|
|
204
314
|
...result
|
|
@@ -226,18 +336,41 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
|
226
336
|
focuses: listUserFocuses()
|
|
227
337
|
}));
|
|
228
338
|
authenticated.patch("/api/understanding/focuses/:focusId", limited, async (c) => {
|
|
229
|
-
const
|
|
230
|
-
|
|
339
|
+
const body = await c.req.json().catch(() => null);
|
|
340
|
+
const requestedStatus = stringField(body, "status");
|
|
341
|
+
const title = stringField(body, "title");
|
|
342
|
+
const summary = stringField(body, "summary");
|
|
343
|
+
if (requestedStatus && !new Set([
|
|
231
344
|
"candidate",
|
|
232
345
|
"active",
|
|
233
346
|
"paused",
|
|
234
347
|
"completed",
|
|
235
348
|
"rejected"
|
|
236
|
-
]).has(
|
|
349
|
+
]).has(requestedStatus)) return c.json({
|
|
237
350
|
ok: false,
|
|
238
351
|
error: "Invalid focus status"
|
|
239
352
|
}, 400);
|
|
240
|
-
|
|
353
|
+
if (body?.title !== void 0 && !title) return c.json({
|
|
354
|
+
ok: false,
|
|
355
|
+
error: "Focus title cannot be empty"
|
|
356
|
+
}, 400);
|
|
357
|
+
if (body?.summary !== void 0 && !summary) return c.json({
|
|
358
|
+
ok: false,
|
|
359
|
+
error: "Focus summary cannot be empty"
|
|
360
|
+
}, 400);
|
|
361
|
+
if (title.length > 300 || summary.length > 2e3) return c.json({
|
|
362
|
+
ok: false,
|
|
363
|
+
error: "Focus title or summary is too long"
|
|
364
|
+
}, 400);
|
|
365
|
+
if (!requestedStatus && !title && !summary) return c.json({
|
|
366
|
+
ok: false,
|
|
367
|
+
error: "At least one focus change is required"
|
|
368
|
+
}, 400);
|
|
369
|
+
const focus = updateUserFocus(c.req.param("focusId"), {
|
|
370
|
+
...requestedStatus ? { status: requestedStatus } : {},
|
|
371
|
+
...title ? { title } : {},
|
|
372
|
+
...summary ? { summary } : {}
|
|
373
|
+
});
|
|
241
374
|
return focus ? c.json({
|
|
242
375
|
ok: true,
|
|
243
376
|
focus
|
|
@@ -246,10 +379,6 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
|
246
379
|
error: "Focus not found"
|
|
247
380
|
}, 404);
|
|
248
381
|
});
|
|
249
|
-
authenticated.delete("/api/understanding/focuses/:focusId", limited, (c) => deleteUserFocus(c.req.param("focusId")) ? c.json({ ok: true }) : c.json({
|
|
250
|
-
ok: false,
|
|
251
|
-
error: "Focus not found"
|
|
252
|
-
}, 404));
|
|
253
382
|
}
|
|
254
383
|
//#endregion
|
|
255
|
-
export { registerUnderstandingSourceRoutes };
|
|
384
|
+
export { applySourceRevocationChoices, registerUnderstandingSourceRoutes, sourceRevocationImpact };
|
|
@@ -86,7 +86,8 @@ function registerWorkDiscoveryRoutes(authenticated, deps) {
|
|
|
86
86
|
const candidates = await service.discoverCandidates(c.req.raw.signal);
|
|
87
87
|
return c.json({
|
|
88
88
|
ok: true,
|
|
89
|
-
candidates
|
|
89
|
+
candidates,
|
|
90
|
+
processingTarget: service.getModelProcessingTarget()
|
|
90
91
|
});
|
|
91
92
|
} catch (error) {
|
|
92
93
|
return c.json({
|
|
@@ -100,13 +101,22 @@ function registerWorkDiscoveryRoutes(authenticated, deps) {
|
|
|
100
101
|
ok: false,
|
|
101
102
|
error: "Work discovery is disabled"
|
|
102
103
|
}, 404);
|
|
103
|
-
const
|
|
104
|
+
const body = await c.req.json().catch(() => null);
|
|
105
|
+
const idempotencyKey = stringField(body, "idempotencyKey");
|
|
106
|
+
const processingPolicy = stringField(body, "processingPolicy");
|
|
104
107
|
if (!idempotencyKey) return c.json({
|
|
105
108
|
ok: false,
|
|
106
109
|
error: "Missing idempotencyKey"
|
|
107
110
|
}, 400);
|
|
111
|
+
if (processingPolicy !== "local_only" && processingPolicy !== "remote_allowed") return c.json({
|
|
112
|
+
ok: false,
|
|
113
|
+
error: "Explicit processingPolicy is required"
|
|
114
|
+
}, 400);
|
|
108
115
|
try {
|
|
109
|
-
const run = await service.startQuickRun({
|
|
116
|
+
const run = await service.startQuickRun({
|
|
117
|
+
idempotencyKey,
|
|
118
|
+
processingPolicy
|
|
119
|
+
});
|
|
110
120
|
return c.json({
|
|
111
121
|
ok: true,
|
|
112
122
|
run
|
|
@@ -7,10 +7,10 @@ import { messagesToClientHistory } from "../../../session/client-history.js";
|
|
|
7
7
|
import "../../../workflows/domain/index.js";
|
|
8
8
|
import { resolveWorkflowRunArtifactsDir } from "../../../workflows/store/paths.js";
|
|
9
9
|
import { WorkflowDraftService } from "../../../workflows/draft/workflow-draft-service.js";
|
|
10
|
-
import "../../../workflows/draft/index.js";
|
|
11
|
-
import { ProjectWorkflowPresetRepository } from "../../../workflows/project-presets/project-workflow-preset-repository.js";
|
|
12
10
|
import { WorkflowDraftConflictError, WorkflowDraftStore } from "../../../workflows/authoring/workflow-draft-store.js";
|
|
13
11
|
import "../../../workflows/authoring/index.js";
|
|
12
|
+
import "../../../workflows/draft/index.js";
|
|
13
|
+
import { ProjectWorkflowPresetRepository } from "../../../workflows/project-presets/project-workflow-preset-repository.js";
|
|
14
14
|
import { basename, join } from "node:path";
|
|
15
15
|
import { readFile, stat } from "node:fs/promises";
|
|
16
16
|
//#region src/gateway/hono/routes/workflows.ts
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { listContextConsolidationRuns } from "../../../storage/sqlite/context-consolidation-repository.js";
|
|
2
1
|
import { UNDERSTANDING_KINDS } from "../../../user-context/domain.js";
|
|
3
|
-
import {
|
|
2
|
+
import { listContextExtractionRuns } from "../../../storage/sqlite/context-extraction-repository.js";
|
|
3
|
+
import { listContextConsolidationRuns } from "../../../storage/sqlite/context-consolidation-repository.js";
|
|
4
4
|
import { createCollaborationRule, createUnderstanding, decideContextConsent, deleteCollaborationRule, deleteUnderstanding, getCollaborationRule, getTurnPersonalization, getUnderstanding, getUserProfile, listCollaborationRules, listUnderstandingEvidence, listUnderstandings, recordContextFeedback, rejectUnderstanding, reviseCollaborationRule, reviseUnderstanding, setCollaborationRuleStatus, setUnderstandingStatus, updateUserProfile } from "../../../storage/sqlite/user-context-repository.js";
|
|
5
5
|
import "../../../storage/sqlite/index.js";
|
|
6
|
+
import { listUserFocuses, updateUserFocus } from "../../../user-context/sources/repository.js";
|
|
6
7
|
import { canonicalUnderstandingKey, findDuplicateUnderstanding } from "../../../user-context/understanding.js";
|
|
8
|
+
import { listContextObjects } from "../../../user-context/context-objects.js";
|
|
9
|
+
import { repairExtractedContext } from "../../../user-context/extraction/repair.js";
|
|
7
10
|
import { userInfo } from "node:os";
|
|
8
11
|
//#region src/gateway/hono/routes/you.ts
|
|
9
12
|
const UNDERSTANDING_KIND_SET = new Set(UNDERSTANDING_KINDS);
|
|
@@ -34,6 +37,11 @@ const FEEDBACK_RATINGS = new Set([
|
|
|
34
37
|
"stale",
|
|
35
38
|
"sensitive"
|
|
36
39
|
]);
|
|
40
|
+
const CONTEXT_OBJECT_VIEWS = new Set([
|
|
41
|
+
"current",
|
|
42
|
+
"review",
|
|
43
|
+
"history"
|
|
44
|
+
]);
|
|
37
45
|
function asRecord(value) {
|
|
38
46
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
39
47
|
}
|
|
@@ -87,10 +95,64 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
87
95
|
authenticated.get("/api/you", (c) => c.json({
|
|
88
96
|
profile: getUserProfile(),
|
|
89
97
|
understandings: listUnderstandings(),
|
|
98
|
+
focuses: listUserFocuses(),
|
|
90
99
|
rules: listCollaborationRules(),
|
|
91
|
-
consolidation: { lastRun: listContextConsolidationRuns(1)[0] ?? null }
|
|
92
|
-
quality: summarizeUserUnderstandingQuality()
|
|
100
|
+
consolidation: { lastRun: listContextConsolidationRuns(1)[0] ?? null }
|
|
93
101
|
}));
|
|
102
|
+
authenticated.get("/api/you/context-objects", (c) => {
|
|
103
|
+
const view = c.req.query("view") ?? "current";
|
|
104
|
+
if (!CONTEXT_OBJECT_VIEWS.has(view)) return c.json({ error: "Invalid context object view" }, 400);
|
|
105
|
+
return c.json({ objects: listContextObjects(view) });
|
|
106
|
+
});
|
|
107
|
+
authenticated.get("/api/you/extraction-runs", (c) => c.json({ runs: listContextExtractionRuns({
|
|
108
|
+
...c.req.query("sourceRef") ? { sourceRef: c.req.query("sourceRef") } : {},
|
|
109
|
+
...c.req.query("extractorId") ? { extractorId: c.req.query("extractorId") } : {},
|
|
110
|
+
...c.req.query("extractorVersion") ? { extractorVersion: c.req.query("extractorVersion") } : {},
|
|
111
|
+
limit: 100
|
|
112
|
+
}) }));
|
|
113
|
+
authenticated.post("/api/you/context-repair", write, async (c) => {
|
|
114
|
+
const body = await readBody(c);
|
|
115
|
+
if (!body) return c.json({ error: "Invalid JSON" }, 400);
|
|
116
|
+
const filter = Object.fromEntries([
|
|
117
|
+
"runId",
|
|
118
|
+
"sourceRef",
|
|
119
|
+
"extractorId",
|
|
120
|
+
"extractorVersion",
|
|
121
|
+
"objectVersionId"
|
|
122
|
+
].flatMap((field) => typeof body[field] === "string" && body[field].trim() ? [[field, body[field].trim()]] : []));
|
|
123
|
+
if (!Object.keys(filter).length) return c.json({ error: "At least one repair filter is required" }, 400);
|
|
124
|
+
return c.json({ result: repairExtractedContext(filter) });
|
|
125
|
+
});
|
|
126
|
+
authenticated.post("/api/you/context-objects/batch-review", write, async (c) => {
|
|
127
|
+
const decisions = (await readBody(c))?.decisions;
|
|
128
|
+
if (!Array.isArray(decisions) || decisions.length < 1 || decisions.length > 50) return c.json({ error: "decisions must contain 1-50 items" }, 400);
|
|
129
|
+
const normalized = [];
|
|
130
|
+
const targets = /* @__PURE__ */ new Set();
|
|
131
|
+
for (const value of decisions) {
|
|
132
|
+
const item = asRecord(value);
|
|
133
|
+
const objectType = item?.objectType;
|
|
134
|
+
const objectId = nonEmptyString(item?.objectId, 200);
|
|
135
|
+
const action = item?.action;
|
|
136
|
+
if (objectType !== "focus" && objectType !== "understanding" || !objectId || action !== "accept" && action !== "reject" && action !== "pause") return c.json({ error: "Each decision must contain a valid objectType, objectId, and action" }, 400);
|
|
137
|
+
if (!(objectType === "understanding" ? Boolean(getUnderstanding(objectId)) : listUserFocuses().some((focus) => focus.id === objectId))) return c.json({ error: `Context object not found: ${objectId}` }, 404);
|
|
138
|
+
const target = `${objectType}:${objectId}`;
|
|
139
|
+
if (targets.has(target)) return c.json({ error: `Duplicate context object decision: ${objectId}` }, 400);
|
|
140
|
+
targets.add(target);
|
|
141
|
+
normalized.push({
|
|
142
|
+
objectType,
|
|
143
|
+
objectId,
|
|
144
|
+
action
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
const objects = normalized.map(({ objectType, objectId, action }) => {
|
|
148
|
+
if (objectType === "understanding") return action === "accept" ? setUnderstandingStatus(objectId, "active", {
|
|
149
|
+
explicitness: "explicit",
|
|
150
|
+
confidence: 1
|
|
151
|
+
}) : action === "reject" ? rejectUnderstanding(objectId, "Rejected during context review") : setUnderstandingStatus(objectId, "needs_review");
|
|
152
|
+
return updateUserFocus(objectId, { status: action === "accept" ? "active" : action === "reject" ? "rejected" : "paused" });
|
|
153
|
+
});
|
|
154
|
+
return c.json({ objects });
|
|
155
|
+
});
|
|
94
156
|
authenticated.get("/api/you/profile", (c) => {
|
|
95
157
|
const profile = getUserProfile();
|
|
96
158
|
return c.json({
|
|
@@ -244,6 +306,7 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
244
306
|
if (objectType === void 0 !== (objectId === void 0) || objectType !== void 0 && ![
|
|
245
307
|
"profile",
|
|
246
308
|
"rule",
|
|
309
|
+
"focus",
|
|
247
310
|
"understanding"
|
|
248
311
|
].includes(String(objectType)) || objectId !== void 0 && typeof objectId !== "string") return c.json({ error: "objectType and objectId must be valid and provided together" }, 400);
|
|
249
312
|
if (objectType !== void 0 && !run.items.some((item) => item.objectType === objectType && item.objectId === objectId)) return c.json({ error: "The context object was not part of this turn" }, 400);
|
|
@@ -263,6 +326,10 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
263
326
|
if (rating === "stale") setUnderstandingStatus(objectId, "stale");
|
|
264
327
|
if (rating === "sensitive") setUnderstandingStatus(objectId, "needs_review");
|
|
265
328
|
}
|
|
329
|
+
if (objectType === "focus" && typeof objectId === "string") {
|
|
330
|
+
if (rating === "wrong") updateUserFocus(objectId, { status: "rejected" });
|
|
331
|
+
if (rating === "stale" || rating === "sensitive") updateUserFocus(objectId, { status: "paused" });
|
|
332
|
+
}
|
|
266
333
|
return c.json({ ok: true });
|
|
267
334
|
});
|
|
268
335
|
authenticated.patch("/api/you/consents/:id", write, async (c) => {
|