@xopcai/xopc 0.0.217 → 0.0.219
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-D6trMTyZ.js → activity-store-slG02hSm.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CAQdFrcu.js → agent-avatar-dicebear-DZ6ETNIk.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DxaIH0Ep.js +68 -0
- package/dist/gateway/static/root/assets/{api-B9pZAyMB.js → api-Tz57QxiN.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-DdR1L4LR.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-wYbwqmee.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-CyWr6KyO.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BF0q7N24.js → archive-plugin-DKXa160O.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D1qmjGDo.js → attachment-load-CzwA9g2y.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Ccu4yRFa.js → automations-page-DwAXyWAY.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CL7ieYIt.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DooqxEZz.js → binary-plugins-DoQ_DnT7.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Dqg9kvb9.js → block-editor-Bj_Uxxng.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-BYa_FNC1.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-CsIh8ySc.js → browser-workflow-inputs-D4roXE6r.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-BXQFxT0p.js → browser-workflows-page-CleKTAKD.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DYG37N0k.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BX9U0FRh.js → capability-presets-api-wtEN6Ss6.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-C0Q4dFq-.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-CUBTQ0Bz.js → channel-recipient-api-DhuS2RJ3.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-CpO6Xg0n.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-CXhPeiNj.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-ClQMDe2n.js +36 -0
- package/dist/gateway/static/root/assets/connectors-page-BvyiPdKU.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-XzPZhzVM.js → cron-expression-4DvCFs-v.js} +1 -1
- package/dist/gateway/static/root/assets/date-picker-B6FSjt4Z.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-Za18eMp1.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-DZjW-7Tw.js → desktop-pet-DUUf3yyJ.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-Dwx3GfB8.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-C6dfTCsl.js +1 -0
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-D7APnE3n.js → extension-debug-page-Cordpg4X.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BhV5hz70.js → extension-page-Dw0dGyMl.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-B2pUMaXm.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-DAZUOEQh.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-BTH9HVUk.js → gateway-config-swr-BIqRg-zo.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-ik2f-pmV.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DAEk_tnd.js → gateway-startup-retry-BFjWYOCS.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-BE81XJ8F.js +1 -0
- package/dist/gateway/static/root/assets/home-page-BTWXJu_m.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-HqcQrSed.js → image-generation-api-HXAWlgm6.js} +1 -1
- package/dist/gateway/static/root/assets/index-B6gWYy08.js +108 -0
- package/dist/gateway/static/root/assets/index-CDkuz_YC.css +2 -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-BG6lShzn.js → keyboard-shortcuts-settings-ROqQ_Xlo.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Dcaf190G.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-vaz8ewe2.js → local-apps-page-Be79cyMG.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-De8wYkd7.js → locale-store-DfK-Hofd.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-C2pjbXno.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-tqTGCHt0.js → management-settings-CRspx0oY.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BGx8Aao0.js → markdown-split-G3PTpGw3.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-ybRARsPs.js → markdown-view-D4FPJZ91.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-xbM-SSP5.js → media-plugins-DT0P7j7u.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B701TEZ5.js +3 -0
- package/dist/gateway/static/root/assets/{notes-api-D9CCwyWK.js → notes-api-q7HjYO07.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CMNBbg6g.js → notes-page-Cgl2h7AR.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DFMQYyGJ.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-CZdzgPZW.js → product-open-page-ComKLO4D.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DUFmQscH.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-CTWxt3dv.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-DYmKEwiG.js → registry-api-BBoJ7khF.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-qmG-3qjj.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-DQ12tLCL.js → runtime-tools-settings-panel-CXHQc53b.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DNCDIkqC.js → schema-form-3jTDF2lJ.js} +1 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-D_We4_MV.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-B_QhPgU0.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-CUDozALU.js +1 -0
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-xgo41cfo.js → settings-loading-skeleton-H3ZH6a6l.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-8astk_1U.js → settings-page-tx29z21o.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-VunfXpTX.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BBZV4AGy.js → share-preview-page-MyThymEx.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DkZvY1cr.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DVDOh1iY.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BOOyMnno.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-HmoDhJVh.js → skills-page.utils-Bl5Yv3Cx.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-DwQ3O1ta.js +1 -0
- package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +1 -0
- package/dist/gateway/static/root/assets/tab-completion-input.utils-BP3NH_du.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-BwOyrADL.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-STx6jo38.js → theme-store-Br4BtK4x.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-CqFVx92z.js → use-autosave-DRS3RwS9.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-ClV2r3Cr.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-pYDiKKMo.js → voice-api-key-field-CGTE5156.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-LJLw9zf0.js → work-discovery-overlay-CW-HKD7h.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D0WhQ3kI.js → workflow-run-setup-panel-Dtr9fDC8.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CDOyNgZf.js +5 -0
- package/dist/gateway/static/root/index.html +20 -11
- 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 +3 -2
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +6 -3
- package/dist/src/agent/background-review/run-background-review.js +144 -16
- 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/memory/context/types.d.ts +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +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/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 +1 -0
- 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/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/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- 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 +4 -2
- 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/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/models-json.d.ts +20 -20
- package/dist/src/connectors/connected-source-ingestion.js +21 -4
- package/dist/src/connectors/connected-source-normalizers.js +51 -4
- package/dist/src/connectors/connected-source-understanding.d.ts +20 -0
- package/dist/src/connectors/connected-source-understanding.js +180 -0
- package/dist/src/connectors/content-enrichment.d.ts +1 -0
- package/dist/src/connectors/content-enrichment.js +11 -7
- package/dist/src/connectors/learning-coordinator.js +112 -15
- package/dist/src/connectors/learning-recipes.js +2 -2
- package/dist/src/document-understanding/extract.d.ts +1 -1
- package/dist/src/document-understanding/extract.js +54 -1
- package/dist/src/extensions/update.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/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +12 -2
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +1 -0
- 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 +9 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +138 -24
- package/dist/src/gateway/hono/routes/you.js +71 -4
- package/dist/src/gateway/rate-limit/buckets.d.ts +1 -1
- package/dist/src/gateway/rate-limit/buckets.js +2 -2
- package/dist/src/gateway/service/agent-runner.d.ts +7 -2
- package/dist/src/gateway/service/agent-runner.js +21 -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 +2 -1
- 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 +1 -0
- package/dist/src/gateway/service.d.ts +3 -2
- package/dist/src/gateway/service.js +16 -6
- 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/heartbeat/index.js +1 -1
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +1 -1
- package/dist/src/knowledge/connected-understanding-pipeline.js +4 -2
- package/dist/src/retrieval/queryProfile.d.ts +1 -0
- package/dist/src/retrieval/queryProfile.js +9 -1
- 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 +4 -2
- package/dist/src/storage/sqlite/index.js +5 -3
- 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/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-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/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-types.d.ts +1 -0
- package/dist/src/tui/tui.js +57 -4
- 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/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/planner.js +214 -57
- package/dist/src/user-context/retriever.js +69 -9
- package/dist/src/user-context/sources/catalog.js +9 -2
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/local-source-contract.d.ts +1 -1
- package/dist/src/user-context/sources/local-source-contract.js +1 -0
- 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-writing.d.ts +1 -0
- package/dist/src/user-context/understanding-writing.js +4 -0
- package/dist/src/user-context/understanding.js +1 -1
- package/dist/src/work-discovery/analyzer.d.ts +6 -0
- package/dist/src/work-discovery/analyzer.js +181 -57
- package/dist/src/work-discovery/index.js +1 -1
- package/dist/src/work-discovery/probe.js +20 -0
- package/dist/src/work-discovery/service.d.ts +9 -0
- package/dist/src/work-discovery/service.js +39 -11
- package/dist/src/work-discovery/source-repository.js +1 -1
- package/dist/src/work-discovery/types.d.ts +5 -0
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-C6q_vDzP.js +0 -68
- package/dist/gateway/static/root/assets/app-management-settings-panel-DRsTwFbF.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-B99NaPTf.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Dx66anqa.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CHbA8d-P.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CpRc-9Jy.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C89FGECN.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-XT6WEz9E.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-DhKk1oNT.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CiwOOoVL.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-CTbkTsc2.js +0 -36
- package/dist/gateway/static/root/assets/connectors-page-BDn3HTzX.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-BmZjs4Bq.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-ndtb88_T.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-C7BLs783.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-BWiap88p.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BhbcGuiJ.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-api-CUt9bIpL.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-RafSECLG.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CwVPlPLB.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CbdBcCwC.js +0 -1
- package/dist/gateway/static/root/assets/index-AbNnQyKk.css +0 -2
- package/dist/gateway/static/root/assets/index-CMLkr37Y.js +0 -108
- package/dist/gateway/static/root/assets/local-app-workbench-page-DdaPtQ5M.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-CjxMHTQO.js +0 -2
- package/dist/gateway/static/root/assets/messages-VI9m1xJl.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-V9C-8vSn.js +0 -4
- package/dist/gateway/static/root/assets/page-tabs-e99j9S9K.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-DW9MDOva.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DHmAUggu.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D0EiN69Y.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BuAVFk2O.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-hzlTfgOl.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BlCoA_9h.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-z0JH53Fu.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-fZQfoJAk.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-B5dPMq3Y.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-i1PGf1V2.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BSN2VaqR.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-CSibO8vj.js +0 -1
- package/dist/gateway/static/root/assets/tab-completion-input-B-VsxKhC.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-HCKZ11E8.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-zrYg51t3.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-CqG56cDS.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DQAJzV5w.js +0 -5
|
@@ -1,8 +1,8 @@
|
|
|
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
2
|
import { getConnectorAccount } from "../../../storage/sqlite/connector-account-repository.js";
|
|
3
3
|
import "../../../storage/sqlite/index.js";
|
|
4
4
|
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
5
|
-
import { deleteUserFocus, getUnderstandingSourceGrant, listUnderstandingSourceGrants, listUserFocuses, revokeUnderstandingSourceGrant,
|
|
5
|
+
import { deleteUserFocus, getUnderstandingSourceGrant, getUnderstandingSourceRun, listUnderstandingSourceGrants, listUnderstandingSourceRuns, listUserFocusEvidence, listUserFocuses, revokeUnderstandingSourceGrant, updateUnderstandingSourceGrantPolicies, updateUserFocus } from "../../../user-context/sources/repository.js";
|
|
6
6
|
import { listConnectedContentCandidates, readConnectedContent } from "../../../connectors/content-enrichment.js";
|
|
7
7
|
import { getWorkDiscoveryService } from "./work-discovery.js";
|
|
8
8
|
import { listUnderstandingSourceDefinitions } from "../../../user-context/sources/catalog.js";
|
|
@@ -27,6 +27,33 @@ function decisionsFrom(body) {
|
|
|
27
27
|
}];
|
|
28
28
|
}).slice(0, 20);
|
|
29
29
|
}
|
|
30
|
+
function sourceRevocationImpact(grantId) {
|
|
31
|
+
const grant = getUnderstandingSourceGrant(grantId);
|
|
32
|
+
if (!grant) return null;
|
|
33
|
+
const accountId = typeof grant.config.accountId === "string" ? grant.config.accountId : void 0;
|
|
34
|
+
const connectorId = typeof grant.config.connectorId === "string" ? grant.config.connectorId : void 0;
|
|
35
|
+
const sourceInstanceId = accountId && connectorId ? `composio:${connectorId}:${accountId}` : void 0;
|
|
36
|
+
const belongs = (evidence) => evidence.sourceRef.startsWith(`understanding-source-grant:${grantId}:`) || Boolean(sourceInstanceId && evidence.sourceInstanceId === sourceInstanceId);
|
|
37
|
+
const understandings = listUnderstandings().flatMap((item) => {
|
|
38
|
+
if (item.explicitness === "explicit") return [];
|
|
39
|
+
const evidence = listUnderstandingEvidence(item.id);
|
|
40
|
+
return evidence.some(belongs) && !evidence.some((entry) => !belongs(entry)) ? [item] : [];
|
|
41
|
+
});
|
|
42
|
+
const focuses = listUserFocuses().flatMap((focus) => {
|
|
43
|
+
if (focus.explicitness === "explicit") return [];
|
|
44
|
+
if ((focus.sourceRunId ? getUnderstandingSourceRun(focus.sourceRunId) : null)?.grantId !== grantId) return [];
|
|
45
|
+
return listUserFocusEvidence(focus.id).some((entry) => !belongs(entry)) ? [] : [focus];
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
grant,
|
|
49
|
+
understandingIds: understandings.map((item) => item.id),
|
|
50
|
+
focusIds: focuses.map((item) => item.id),
|
|
51
|
+
derivedCount: understandings.length + focuses.length,
|
|
52
|
+
understandingCount: understandings.length,
|
|
53
|
+
focusCount: focuses.length,
|
|
54
|
+
boundedRawCount: 0
|
|
55
|
+
};
|
|
56
|
+
}
|
|
30
57
|
function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
31
58
|
const service = getWorkDiscoveryService(deps);
|
|
32
59
|
const limited = deps.strictRateLimitMiddleware;
|
|
@@ -38,10 +65,65 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
|
38
65
|
sources: listUnderstandingSourceDefinitions(platform)
|
|
39
66
|
});
|
|
40
67
|
});
|
|
41
|
-
authenticated.get("/api/understanding/sources/grants", (c) =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
68
|
+
authenticated.get("/api/understanding/sources/grants", (c) => {
|
|
69
|
+
const grants = listUnderstandingSourceGrants({ includeRevoked: c.req.query("includeRevoked") === "true" });
|
|
70
|
+
return c.json({
|
|
71
|
+
ok: true,
|
|
72
|
+
grants,
|
|
73
|
+
latestRuns: Object.fromEntries(grants.flatMap((grant) => {
|
|
74
|
+
const run = listUnderstandingSourceRuns(grant.id, 1)[0];
|
|
75
|
+
return run ? [[grant.id, run]] : [];
|
|
76
|
+
}))
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
authenticated.patch("/api/understanding/sources/grants/:grantId", limited, async (c) => {
|
|
80
|
+
const body = await c.req.json().catch(() => null);
|
|
81
|
+
if (!body) return c.json({
|
|
82
|
+
ok: false,
|
|
83
|
+
error: "Invalid JSON"
|
|
84
|
+
}, 400);
|
|
85
|
+
const accessMode = body.accessMode;
|
|
86
|
+
const retentionPolicy = body.retentionPolicy;
|
|
87
|
+
const processingPolicy = body.processingPolicy;
|
|
88
|
+
if (accessMode !== void 0 && accessMode !== "once" && accessMode !== "continuous") return c.json({
|
|
89
|
+
ok: false,
|
|
90
|
+
error: "Invalid access mode"
|
|
91
|
+
}, 400);
|
|
92
|
+
if (retentionPolicy !== void 0 && retentionPolicy !== "metadata_only" && retentionPolicy !== "derived_only" && retentionPolicy !== "bounded_raw") return c.json({
|
|
93
|
+
ok: false,
|
|
94
|
+
error: "Invalid retention policy"
|
|
95
|
+
}, 400);
|
|
96
|
+
if (processingPolicy !== void 0 && processingPolicy !== "local_only" && processingPolicy !== "remote_allowed") return c.json({
|
|
97
|
+
ok: false,
|
|
98
|
+
error: "Invalid processing policy"
|
|
99
|
+
}, 400);
|
|
100
|
+
if (accessMode === void 0 && retentionPolicy === void 0 && processingPolicy === void 0) return c.json({
|
|
101
|
+
ok: false,
|
|
102
|
+
error: "At least one policy change is required"
|
|
103
|
+
}, 400);
|
|
104
|
+
const grant = updateUnderstandingSourceGrantPolicies(c.req.param("grantId"), {
|
|
105
|
+
...accessMode ? { accessMode } : {},
|
|
106
|
+
...retentionPolicy ? { retentionPolicy } : {},
|
|
107
|
+
...processingPolicy ? { processingPolicy } : {}
|
|
108
|
+
});
|
|
109
|
+
return grant ? c.json({
|
|
110
|
+
ok: true,
|
|
111
|
+
grant
|
|
112
|
+
}) : c.json({
|
|
113
|
+
ok: false,
|
|
114
|
+
error: "Source grant not found"
|
|
115
|
+
}, 404);
|
|
116
|
+
});
|
|
117
|
+
authenticated.get("/api/understanding/sources/grants/:grantId/impact", (c) => {
|
|
118
|
+
const impact = sourceRevocationImpact(c.req.param("grantId"));
|
|
119
|
+
return impact ? c.json({
|
|
120
|
+
ok: true,
|
|
121
|
+
impact
|
|
122
|
+
}) : c.json({
|
|
123
|
+
ok: false,
|
|
124
|
+
error: "Source grant not found"
|
|
125
|
+
}, 404);
|
|
126
|
+
});
|
|
45
127
|
authenticated.get("/api/understanding/sources/content-candidates", (c) => {
|
|
46
128
|
const agentId = resolveDefaultAgentId(deps.service.currentConfig);
|
|
47
129
|
return c.json({
|
|
@@ -69,21 +151,34 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
|
69
151
|
}
|
|
70
152
|
});
|
|
71
153
|
authenticated.delete("/api/understanding/sources/grants/:grantId", limited, (c) => {
|
|
72
|
-
const
|
|
154
|
+
const grantId = c.req.param("grantId");
|
|
155
|
+
const impact = sourceRevocationImpact(grantId);
|
|
156
|
+
const derived = c.req.query("derived");
|
|
157
|
+
const raw = c.req.query("raw");
|
|
158
|
+
if (derived !== "delete" && derived !== "retain") return c.json({
|
|
159
|
+
ok: false,
|
|
160
|
+
error: "derived must be delete or retain"
|
|
161
|
+
}, 400);
|
|
162
|
+
if (raw !== "delete" && raw !== "retain") return c.json({
|
|
163
|
+
ok: false,
|
|
164
|
+
error: "raw must be delete or retain"
|
|
165
|
+
}, 400);
|
|
166
|
+
const current = impact?.grant;
|
|
73
167
|
const accountId = typeof current?.config.accountId === "string" ? current.config.accountId : void 0;
|
|
74
168
|
const connectionId = accountId ? getConnectorAccount(accountId)?.currentConnectionId : void 0;
|
|
75
169
|
if (connectionId) deps.service.setConnectorLearningPaused(connectionId, true);
|
|
76
|
-
const grant = revokeUnderstandingSourceGrant(
|
|
77
|
-
if (grant &&
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
170
|
+
const grant = revokeUnderstandingSourceGrant(grantId);
|
|
171
|
+
if (grant && impact) {
|
|
172
|
+
for (const id of impact.focusIds) if (derived === "delete") deleteUserFocus(id);
|
|
173
|
+
else updateUserFocus(id, { status: "paused" });
|
|
174
|
+
for (const id of impact.understandingIds) if (derived === "delete") deleteUnderstanding(id);
|
|
175
|
+
else setUnderstandingStatus(id, "needs_review");
|
|
83
176
|
}
|
|
84
177
|
return grant ? c.json({
|
|
85
178
|
ok: true,
|
|
86
|
-
grant
|
|
179
|
+
grant,
|
|
180
|
+
impact,
|
|
181
|
+
rawDeleted: 0
|
|
87
182
|
}) : c.json({
|
|
88
183
|
ok: false,
|
|
89
184
|
error: "Source grant not found"
|
|
@@ -208,18 +303,41 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
|
208
303
|
focuses: listUserFocuses()
|
|
209
304
|
}));
|
|
210
305
|
authenticated.patch("/api/understanding/focuses/:focusId", limited, async (c) => {
|
|
211
|
-
const
|
|
212
|
-
|
|
306
|
+
const body = await c.req.json().catch(() => null);
|
|
307
|
+
const requestedStatus = stringField(body, "status");
|
|
308
|
+
const title = stringField(body, "title");
|
|
309
|
+
const summary = stringField(body, "summary");
|
|
310
|
+
if (requestedStatus && !new Set([
|
|
213
311
|
"candidate",
|
|
214
312
|
"active",
|
|
215
313
|
"paused",
|
|
216
314
|
"completed",
|
|
217
315
|
"rejected"
|
|
218
|
-
]).has(
|
|
316
|
+
]).has(requestedStatus)) return c.json({
|
|
219
317
|
ok: false,
|
|
220
318
|
error: "Invalid focus status"
|
|
221
319
|
}, 400);
|
|
222
|
-
|
|
320
|
+
if (body?.title !== void 0 && !title) return c.json({
|
|
321
|
+
ok: false,
|
|
322
|
+
error: "Focus title cannot be empty"
|
|
323
|
+
}, 400);
|
|
324
|
+
if (body?.summary !== void 0 && !summary) return c.json({
|
|
325
|
+
ok: false,
|
|
326
|
+
error: "Focus summary cannot be empty"
|
|
327
|
+
}, 400);
|
|
328
|
+
if (title.length > 300 || summary.length > 2e3) return c.json({
|
|
329
|
+
ok: false,
|
|
330
|
+
error: "Focus title or summary is too long"
|
|
331
|
+
}, 400);
|
|
332
|
+
if (!requestedStatus && !title && !summary) return c.json({
|
|
333
|
+
ok: false,
|
|
334
|
+
error: "At least one focus change is required"
|
|
335
|
+
}, 400);
|
|
336
|
+
const focus = updateUserFocus(c.req.param("focusId"), {
|
|
337
|
+
...requestedStatus ? { status: requestedStatus } : {},
|
|
338
|
+
...title ? { title } : {},
|
|
339
|
+
...summary ? { summary } : {}
|
|
340
|
+
});
|
|
223
341
|
return focus ? c.json({
|
|
224
342
|
ok: true,
|
|
225
343
|
focus
|
|
@@ -228,10 +346,6 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
|
228
346
|
error: "Focus not found"
|
|
229
347
|
}, 404);
|
|
230
348
|
});
|
|
231
|
-
authenticated.delete("/api/understanding/focuses/:focusId", limited, (c) => deleteUserFocus(c.req.param("focusId")) ? c.json({ ok: true }) : c.json({
|
|
232
|
-
ok: false,
|
|
233
|
-
error: "Focus not found"
|
|
234
|
-
}, 404));
|
|
235
349
|
}
|
|
236
350
|
//#endregion
|
|
237
|
-
export { registerUnderstandingSourceRoutes };
|
|
351
|
+
export { registerUnderstandingSourceRoutes, sourceRevocationImpact };
|
|
@@ -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) => {
|
|
@@ -50,7 +50,7 @@ declare class BucketRegistry {
|
|
|
50
50
|
* config read.
|
|
51
51
|
*/
|
|
52
52
|
authFailure(cfg: ResolvedAuthRateLimitConfig): FailureLimiter;
|
|
53
|
-
/**
|
|
53
|
+
/** Authenticated admin / mutation endpoints — 150 req / 60 s per client IP. */
|
|
54
54
|
strictApi(): RateLimiter;
|
|
55
55
|
/** Interactive chat actions — 180 req / 60 s per client IP. */
|
|
56
56
|
chatApi(): RateLimiter;
|
|
@@ -75,10 +75,10 @@ var BucketRegistry = class {
|
|
|
75
75
|
}
|
|
76
76
|
return this.authFailureLimiter;
|
|
77
77
|
}
|
|
78
|
-
/**
|
|
78
|
+
/** Authenticated admin / mutation endpoints — 150 req / 60 s per client IP. */
|
|
79
79
|
strictApi() {
|
|
80
80
|
if (!this.strictApiLimiter) this.strictApiLimiter = new RateLimiter({
|
|
81
|
-
maxRequests:
|
|
81
|
+
maxRequests: 150,
|
|
82
82
|
windowMs: 6e4
|
|
83
83
|
});
|
|
84
84
|
return this.strictApiLimiter;
|
|
@@ -27,6 +27,7 @@ import type { SessionIndex } from '../../session/index.js';
|
|
|
27
27
|
import type { ClarifyStreamEvent } from '../clarify-bridge.js';
|
|
28
28
|
import { ClarifyBridge, type ClarifyBridgeRequest } from '../clarify-bridge.js';
|
|
29
29
|
import type { UserTurnAttachment, UserTurnInput } from '../user-turn-input.js';
|
|
30
|
+
import type { AgentSourceContext, TurnContextRef } from '../../agent/source-context/types.js';
|
|
30
31
|
import { SessionInputCoordinator, type ReplaceLatestTurnInput, type SubmitSessionInput } from './session-input-coordinator.js';
|
|
31
32
|
export interface GatewayAgentRunnerOptions {
|
|
32
33
|
bus: MessageBus;
|
|
@@ -39,6 +40,7 @@ export interface GatewayAgentRunnerOptions {
|
|
|
39
40
|
emit: (type: string, payload: unknown) => void;
|
|
40
41
|
publishRealtime: (topic: string, event: string, data: unknown) => void;
|
|
41
42
|
completeRealtimeTopic: (topic: string) => void;
|
|
43
|
+
resolveTurnContext: (ref: TurnContextRef) => Promise<AgentSourceContext | null>;
|
|
42
44
|
}
|
|
43
45
|
export declare class GatewayAgentRunner {
|
|
44
46
|
private readonly opts;
|
|
@@ -64,6 +66,7 @@ export declare class GatewayAgentRunner {
|
|
|
64
66
|
runAgent(message: string, channel: string, chatId: string, origin: TurnOrigin, attachments?: UserTurnAttachment[], thinking?: string, runOptions?: {
|
|
65
67
|
signal?: AbortSignal;
|
|
66
68
|
runId?: string;
|
|
69
|
+
sourceContexts?: AgentSourceContext[];
|
|
67
70
|
}): AsyncGenerator<{
|
|
68
71
|
type: string;
|
|
69
72
|
[key: string]: unknown;
|
|
@@ -77,7 +80,7 @@ export declare class GatewayAgentRunner {
|
|
|
77
80
|
state: import("../../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
78
81
|
} | {
|
|
79
82
|
ok: false;
|
|
80
|
-
code: "BAD_REQUEST" | "QUEUE_FULL";
|
|
83
|
+
code: "BAD_REQUEST" | "QUEUE_FULL" | "CONTEXT_UNAVAILABLE";
|
|
81
84
|
}>;
|
|
82
85
|
replaceLatestSessionTurn(input: ReplaceLatestTurnInput): Promise<{
|
|
83
86
|
ok: true;
|
|
@@ -85,18 +88,20 @@ export declare class GatewayAgentRunner {
|
|
|
85
88
|
state: import("../../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
86
89
|
} | {
|
|
87
90
|
ok: false;
|
|
88
|
-
code: "BAD_REQUEST" | "TARGET_NOT_FOUND" | "NOT_LATEST" | "SESSION_BUSY";
|
|
91
|
+
code: "BAD_REQUEST" | "TARGET_NOT_FOUND" | "NOT_LATEST" | "SESSION_BUSY" | "CONTEXT_UNAVAILABLE";
|
|
89
92
|
}>;
|
|
90
93
|
getSessionInputState(sessionKey: string): import("../../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
91
94
|
updateSessionInput(sessionKey: string, id: string, body: {
|
|
92
95
|
version: number;
|
|
93
96
|
content?: string;
|
|
94
97
|
attachments?: UserTurnAttachment[];
|
|
98
|
+
contextRefs?: TurnContextRef[];
|
|
95
99
|
thinking?: string;
|
|
96
100
|
position?: number;
|
|
97
101
|
}): Promise<{
|
|
98
102
|
ok: boolean;
|
|
99
103
|
state: import("../../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
104
|
+
contextUnavailable?: boolean;
|
|
100
105
|
}>;
|
|
101
106
|
removeSessionInput(sessionKey: string, id: string, version: number): {
|
|
102
107
|
ok: boolean;
|
|
@@ -2,11 +2,13 @@ import { createLogger } from "../../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { ClarifyBridge } from "../clarify-bridge.js";
|
|
4
4
|
import { runGatewayAgent } from "./run-gateway-agent.js";
|
|
5
|
+
import { fitSourceContextsToBudget } from "../../agent/source-context/budget.js";
|
|
5
6
|
import { SessionInputCoordinator } from "./session-input-coordinator.js";
|
|
6
7
|
import crypto from "node:crypto";
|
|
7
8
|
//#region src/gateway/service/agent-runner.ts
|
|
8
9
|
init_logger();
|
|
9
10
|
const log = createLogger("Gateway:AgentRunner");
|
|
11
|
+
const MAX_TURN_CONTEXTS = 5;
|
|
10
12
|
var GatewayAgentRunner = class {
|
|
11
13
|
opts;
|
|
12
14
|
/** Per-run abort for webchat (POST /api/agent/abort or client disconnect). */
|
|
@@ -23,7 +25,10 @@ var GatewayAgentRunner = class {
|
|
|
23
25
|
this.inputs = new SessionInputCoordinator({
|
|
24
26
|
sessionExists: async (sessionKey) => Boolean(await opts.sessionIndex.getSessionMetadata(sessionKey)),
|
|
25
27
|
execute: async (input) => {
|
|
26
|
-
const generator = this.runAgent(input.content, "webchat", input.sessionKey, input.origin, input.attachments, input.thinking, {
|
|
28
|
+
const generator = this.runAgent(input.content, "webchat", input.sessionKey, input.origin, input.attachments, input.thinking, {
|
|
29
|
+
runId: input.runId,
|
|
30
|
+
sourceContexts: input.sourceContexts
|
|
31
|
+
});
|
|
27
32
|
let result;
|
|
28
33
|
while (true) {
|
|
29
34
|
const step = await generator.next();
|
|
@@ -46,6 +51,21 @@ var GatewayAgentRunner = class {
|
|
|
46
51
|
size: ref.size
|
|
47
52
|
}));
|
|
48
53
|
},
|
|
54
|
+
prepareContexts: async (refs) => {
|
|
55
|
+
if (!refs?.length) return void 0;
|
|
56
|
+
const unique = /* @__PURE__ */ new Map();
|
|
57
|
+
for (const ref of refs) {
|
|
58
|
+
const sourceId = ref.sourceId.trim();
|
|
59
|
+
if (sourceId) unique.set(`${ref.kind}:${sourceId}`, {
|
|
60
|
+
...ref,
|
|
61
|
+
sourceId
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (unique.size > MAX_TURN_CONTEXTS) throw new Error(`A message can reference at most ${MAX_TURN_CONTEXTS} notes`);
|
|
65
|
+
const contexts = await Promise.all([...unique.values()].map((ref) => opts.resolveTurnContext(ref)));
|
|
66
|
+
if (contexts.some((context) => context === null)) throw new Error("A referenced note is no longer available");
|
|
67
|
+
return fitSourceContextsToBudget(contexts.filter((context) => context !== null));
|
|
68
|
+
},
|
|
49
69
|
steer: (sessionKey, content) => opts.getAgentService().turnDispatcher.steerWebchatSession(sessionKey, content),
|
|
50
70
|
emit: opts.emit
|
|
51
71
|
});
|
|
@@ -8,8 +8,8 @@ import { reloadImageGenerationProviders } from "../../agent/image/generation/pro
|
|
|
8
8
|
import "../../agent/mcp/bundle-mcp-tools.js";
|
|
9
9
|
import { ConfigHotReloader } from "../../config/reload.js";
|
|
10
10
|
import "../../config/index.js";
|
|
11
|
-
import { computeBundledExtensionExtensionsPatch } from "../../extensions/bundled-extension-activation.js";
|
|
12
11
|
import { sanitizeTunnelConfig } from "../../tunnel/tunnel-config.js";
|
|
12
|
+
import { computeBundledExtensionExtensionsPatch } from "../../extensions/bundled-extension-activation.js";
|
|
13
13
|
//#region src/gateway/service/config-coordinator.ts
|
|
14
14
|
init_providers();
|
|
15
15
|
init_logger();
|
|
@@ -5,6 +5,7 @@ import type { MessageBus } from '../../infra/bus/index.js';
|
|
|
5
5
|
import type { SessionIndex } from '../../session/index.js';
|
|
6
6
|
import type { ChatStreamEvent } from '../chat-stream/protocol.js';
|
|
7
7
|
import type { UserTurnAttachment } from '../user-turn-input.js';
|
|
8
|
+
import type { AgentSourceContext } from '../../agent/source-context/types.js';
|
|
8
9
|
export type RunGatewayAgentYield = ChatStreamEvent;
|
|
9
10
|
export type RunGatewayAgentDeps = {
|
|
10
11
|
config: Config;
|
|
@@ -23,6 +24,7 @@ export type RunGatewayAgentDeps = {
|
|
|
23
24
|
export declare function runGatewayAgent(deps: RunGatewayAgentDeps, message: string, channel: string, chatId: string, origin: TurnOrigin, attachments?: UserTurnAttachment[], thinking?: string, runOptions?: {
|
|
24
25
|
signal?: AbortSignal;
|
|
25
26
|
runId?: string;
|
|
27
|
+
sourceContexts?: AgentSourceContext[];
|
|
26
28
|
}): AsyncGenerator<RunGatewayAgentYield, {
|
|
27
29
|
status: string;
|
|
28
30
|
summary: string;
|
|
@@ -131,7 +131,8 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
131
131
|
try {
|
|
132
132
|
const eventStream = agentService.turnDispatcher.processDirectStreaming(stampedMessage, sessionKey, origin, prepared, thinking, {
|
|
133
133
|
signal: mergedSignal,
|
|
134
|
-
runId
|
|
134
|
+
runId,
|
|
135
|
+
sourceContexts: runOptions?.sourceContexts
|
|
135
136
|
});
|
|
136
137
|
const mappedEvents = (async function* () {
|
|
137
138
|
for await (const event of eventStream) yield* mapper.map(event);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
2
2
|
import type { UserTurnAttachment } from '../user-turn-input.js';
|
|
3
|
+
import { type AgentSourceContext, type TurnContextRef } from '../../agent/source-context/types.js';
|
|
3
4
|
import { type SessionInputDelivery, type SessionInputState } from '../../storage/sqlite/index.js';
|
|
4
5
|
export type SubmitSessionInput = {
|
|
5
6
|
sessionKey: string;
|
|
@@ -7,6 +8,7 @@ export type SubmitSessionInput = {
|
|
|
7
8
|
delivery: SessionInputDelivery;
|
|
8
9
|
content: string;
|
|
9
10
|
attachments?: UserTurnAttachment[];
|
|
11
|
+
contextRefs?: TurnContextRef[];
|
|
10
12
|
thinking?: string;
|
|
11
13
|
origin: TurnOrigin;
|
|
12
14
|
};
|
|
@@ -24,6 +26,7 @@ export declare class SessionInputCoordinator {
|
|
|
24
26
|
sessionKey: string;
|
|
25
27
|
content: string;
|
|
26
28
|
attachments?: UserTurnAttachment[];
|
|
29
|
+
sourceContexts?: AgentSourceContext[];
|
|
27
30
|
thinking?: string;
|
|
28
31
|
origin: TurnOrigin;
|
|
29
32
|
}) => Promise<{
|
|
@@ -31,6 +34,7 @@ export declare class SessionInputCoordinator {
|
|
|
31
34
|
summary: string;
|
|
32
35
|
}>;
|
|
33
36
|
prepareAttachments: (sessionKey: string, attachments?: UserTurnAttachment[]) => Promise<UserTurnAttachment[] | undefined>;
|
|
37
|
+
prepareContexts: (contextRefs?: TurnContextRef[]) => Promise<AgentSourceContext[] | undefined>;
|
|
34
38
|
steer: (sessionKey: string, content: string) => Promise<boolean>;
|
|
35
39
|
emit: (type: string, payload: unknown) => void;
|
|
36
40
|
});
|
|
@@ -43,7 +47,7 @@ export declare class SessionInputCoordinator {
|
|
|
43
47
|
state: SessionInputState;
|
|
44
48
|
} | {
|
|
45
49
|
ok: false;
|
|
46
|
-
code: 'BAD_REQUEST' | 'QUEUE_FULL';
|
|
50
|
+
code: 'BAD_REQUEST' | 'QUEUE_FULL' | 'CONTEXT_UNAVAILABLE';
|
|
47
51
|
}>;
|
|
48
52
|
replaceLatestTurn(input: ReplaceLatestTurnInput, beforeReplace: () => Promise<void>): Promise<{
|
|
49
53
|
ok: true;
|
|
@@ -51,7 +55,7 @@ export declare class SessionInputCoordinator {
|
|
|
51
55
|
state: SessionInputState;
|
|
52
56
|
} | {
|
|
53
57
|
ok: false;
|
|
54
|
-
code: 'BAD_REQUEST' | 'TARGET_NOT_FOUND' | 'NOT_LATEST' | 'SESSION_BUSY';
|
|
58
|
+
code: 'BAD_REQUEST' | 'TARGET_NOT_FOUND' | 'NOT_LATEST' | 'SESSION_BUSY' | 'CONTEXT_UNAVAILABLE';
|
|
55
59
|
}>;
|
|
56
60
|
private submitLocked;
|
|
57
61
|
drain(sessionKey: string): Promise<void>;
|
|
@@ -59,11 +63,13 @@ export declare class SessionInputCoordinator {
|
|
|
59
63
|
version: number;
|
|
60
64
|
content?: string;
|
|
61
65
|
attachments?: UserTurnAttachment[];
|
|
66
|
+
contextRefs?: TurnContextRef[];
|
|
62
67
|
thinking?: string;
|
|
63
68
|
position?: number;
|
|
64
69
|
}): Promise<{
|
|
65
70
|
ok: boolean;
|
|
66
71
|
state: SessionInputState;
|
|
72
|
+
contextUnavailable?: boolean;
|
|
67
73
|
}>;
|
|
68
74
|
remove(sessionKey: string, id: string, version: number): {
|
|
69
75
|
ok: boolean;
|