@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
|
@@ -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;
|
|
@@ -55,6 +57,10 @@ export declare class GatewayAgentRunner {
|
|
|
55
57
|
/** True when a webchat agent run is currently in-flight for `sessionKey`. */
|
|
56
58
|
hasActiveRun(sessionKey: string): boolean;
|
|
57
59
|
getActiveRunId(sessionKey: string): string | undefined;
|
|
60
|
+
listActiveRuns(): Array<{
|
|
61
|
+
sessionKey: string;
|
|
62
|
+
runId: string;
|
|
63
|
+
}>;
|
|
58
64
|
getClarifyBridge(): ClarifyBridge;
|
|
59
65
|
/** Called from `GatewayService.stop()` so the bridge gets cleaned up. */
|
|
60
66
|
disposeClarifyBridge(): void;
|
|
@@ -64,6 +70,7 @@ export declare class GatewayAgentRunner {
|
|
|
64
70
|
runAgent(message: string, channel: string, chatId: string, origin: TurnOrigin, attachments?: UserTurnAttachment[], thinking?: string, runOptions?: {
|
|
65
71
|
signal?: AbortSignal;
|
|
66
72
|
runId?: string;
|
|
73
|
+
sourceContexts?: AgentSourceContext[];
|
|
67
74
|
}): AsyncGenerator<{
|
|
68
75
|
type: string;
|
|
69
76
|
[key: string]: unknown;
|
|
@@ -77,7 +84,7 @@ export declare class GatewayAgentRunner {
|
|
|
77
84
|
state: import("../../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
78
85
|
} | {
|
|
79
86
|
ok: false;
|
|
80
|
-
code: "BAD_REQUEST" | "QUEUE_FULL";
|
|
87
|
+
code: "BAD_REQUEST" | "QUEUE_FULL" | "CONTEXT_UNAVAILABLE";
|
|
81
88
|
}>;
|
|
82
89
|
replaceLatestSessionTurn(input: ReplaceLatestTurnInput): Promise<{
|
|
83
90
|
ok: true;
|
|
@@ -85,18 +92,20 @@ export declare class GatewayAgentRunner {
|
|
|
85
92
|
state: import("../../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
86
93
|
} | {
|
|
87
94
|
ok: false;
|
|
88
|
-
code: "BAD_REQUEST" | "TARGET_NOT_FOUND" | "NOT_LATEST" | "SESSION_BUSY";
|
|
95
|
+
code: "BAD_REQUEST" | "TARGET_NOT_FOUND" | "NOT_LATEST" | "SESSION_BUSY" | "CONTEXT_UNAVAILABLE";
|
|
89
96
|
}>;
|
|
90
97
|
getSessionInputState(sessionKey: string): import("../../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
91
98
|
updateSessionInput(sessionKey: string, id: string, body: {
|
|
92
99
|
version: number;
|
|
93
100
|
content?: string;
|
|
94
101
|
attachments?: UserTurnAttachment[];
|
|
102
|
+
contextRefs?: TurnContextRef[];
|
|
95
103
|
thinking?: string;
|
|
96
104
|
position?: number;
|
|
97
105
|
}): Promise<{
|
|
98
106
|
ok: boolean;
|
|
99
107
|
state: import("../../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
108
|
+
contextUnavailable?: boolean;
|
|
100
109
|
}>;
|
|
101
110
|
removeSessionInput(sessionKey: string, id: string, version: number): {
|
|
102
111
|
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
|
});
|
|
@@ -57,6 +77,12 @@ var GatewayAgentRunner = class {
|
|
|
57
77
|
getActiveRunId(sessionKey) {
|
|
58
78
|
return this.activeWebchatRunBySession.get(sessionKey);
|
|
59
79
|
}
|
|
80
|
+
listActiveRuns() {
|
|
81
|
+
return [...this.activeWebchatRunBySession.entries()].map(([sessionKey, runId]) => ({
|
|
82
|
+
sessionKey,
|
|
83
|
+
runId
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
60
86
|
getClarifyBridge() {
|
|
61
87
|
return this.clarifyBridge;
|
|
62
88
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { getModelRegistry } from "../../providers/model-registry.js";
|
|
4
3
|
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
4
|
+
import { getModelRegistry } from "../../providers/model-registry.js";
|
|
5
5
|
import { init_providers } from "../../providers/index.js";
|
|
6
6
|
import { disposeAllSessionMcpRuntimes } from "../../agent/mcp/bundle-mcp-runtime.js";
|
|
7
7
|
import { reloadImageGenerationProviders } from "../../agent/image/generation/provider-registry.js";
|
|
@@ -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;
|
|
@@ -98,13 +98,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
98
98
|
const emitAndYield = function* (events) {
|
|
99
99
|
for (const event of events) {
|
|
100
100
|
if (taskRun) captureTaskEvent(event);
|
|
101
|
-
if (channel === "webchat") {
|
|
102
|
-
publishRealtime(`run:${runId}`, event.type, event);
|
|
103
|
-
if (event.type === "run_start") publishRealtime("sessions", "run.started", {
|
|
104
|
-
sessionKey: streamSessionKey,
|
|
105
|
-
runId
|
|
106
|
-
});
|
|
107
|
-
}
|
|
101
|
+
if (channel === "webchat") publishRealtime(`run:${runId}`, event.type, event);
|
|
108
102
|
yield event;
|
|
109
103
|
}
|
|
110
104
|
};
|
|
@@ -126,12 +120,17 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
126
120
|
if (!activeWebchatRunBySession.has(sessionKey)) {
|
|
127
121
|
activeWebchatRunBySession.set(sessionKey, runId);
|
|
128
122
|
registeredActiveWebchatRun = true;
|
|
123
|
+
publishRealtime("sessions", "run.started", {
|
|
124
|
+
sessionKey,
|
|
125
|
+
runId
|
|
126
|
+
});
|
|
129
127
|
}
|
|
130
128
|
let streamError;
|
|
131
129
|
try {
|
|
132
130
|
const eventStream = agentService.turnDispatcher.processDirectStreaming(stampedMessage, sessionKey, origin, prepared, thinking, {
|
|
133
131
|
signal: mergedSignal,
|
|
134
|
-
runId
|
|
132
|
+
runId,
|
|
133
|
+
sourceContexts: runOptions?.sourceContexts
|
|
135
134
|
});
|
|
136
135
|
const mappedEvents = (async function* () {
|
|
137
136
|
for await (const event of eventStream) yield* mapper.map(event);
|
|
@@ -171,7 +170,14 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
171
170
|
summary: streamError
|
|
172
171
|
};
|
|
173
172
|
} finally {
|
|
174
|
-
if (registeredActiveWebchatRun && activeWebchatRunBySession.get(sessionKey) === runId)
|
|
173
|
+
if (registeredActiveWebchatRun && activeWebchatRunBySession.get(sessionKey) === runId) {
|
|
174
|
+
activeWebchatRunBySession.delete(sessionKey);
|
|
175
|
+
publishRealtime("sessions", "run.completed", {
|
|
176
|
+
sessionKey,
|
|
177
|
+
runId,
|
|
178
|
+
status: terminalStatus
|
|
179
|
+
});
|
|
180
|
+
}
|
|
175
181
|
runAbortControllers.delete(runId);
|
|
176
182
|
const assistantPlainText = agentService.getLastAssistantPlainText(sessionKey);
|
|
177
183
|
const reviewHint = agentService.takeTaskReviewStreamHint(sessionKey);
|
|
@@ -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;
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { cancelQueuedSessionInput, claimNextSessionInput, findSessionInput, finishSessionInputRun, getSessionInputState, insertSessionInput, mutateQueuedSessionInput, recoverSessionInputState, setSessionInputStatus } from "../../storage/sqlite/session-input-repository.js";
|
|
3
|
+
import { cancelQueuedSessionInput, claimNextSessionInput, findSessionInput, finishSessionInputRun, getSessionInputById, getSessionInputState, insertSessionInput, mutateQueuedSessionInput, recoverSessionInputState, setSessionInputStatus } from "../../storage/sqlite/session-input-repository.js";
|
|
4
4
|
import { replaceLatestSessionTurnAndQueueInput, validateLatestSessionTurnTarget } from "../../storage/sqlite/session-turn-replace-repository.js";
|
|
5
5
|
import "../../storage/sqlite/index.js";
|
|
6
|
+
import { summarizeSourceContext } from "../../agent/source-context/types.js";
|
|
6
7
|
import { deleteMediaUrisNoLongerReferenced } from "../../media/session-references.js";
|
|
7
8
|
import crypto from "node:crypto";
|
|
8
9
|
//#region src/gateway/service/session-input-coordinator.ts
|
|
9
10
|
init_logger();
|
|
10
11
|
const log = createLogger("SessionInputCoordinator");
|
|
11
12
|
const MAX_PENDING_INPUTS = 10;
|
|
13
|
+
function contextRefsMatchFrozenSnapshot(requested, frozen) {
|
|
14
|
+
if (requested.length !== (frozen?.length ?? 0)) return false;
|
|
15
|
+
return requested.every((ref, index) => {
|
|
16
|
+
const snapshot = frozen?.[index];
|
|
17
|
+
return snapshot?.kind === ref.kind && snapshot.sourceId === ref.sourceId && ref.expectedVersion === snapshot.version;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
12
20
|
var SessionInputCoordinator = class {
|
|
13
21
|
draining = /* @__PURE__ */ new Set();
|
|
14
22
|
submissionTails = /* @__PURE__ */ new Map();
|
|
@@ -69,12 +77,27 @@ var SessionInputCoordinator = class {
|
|
|
69
77
|
if (target.ok === false) return target;
|
|
70
78
|
await beforeReplace();
|
|
71
79
|
const attachments = await this.deps.prepareAttachments(sessionKey, input.attachments);
|
|
80
|
+
let sourceContexts;
|
|
81
|
+
try {
|
|
82
|
+
sourceContexts = await this.deps.prepareContexts(input.contextRefs);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
log.warn({
|
|
85
|
+
err,
|
|
86
|
+
sessionKey
|
|
87
|
+
}, "Session input context preparation failed");
|
|
88
|
+
return {
|
|
89
|
+
ok: false,
|
|
90
|
+
code: "CONTEXT_UNAVAILABLE"
|
|
91
|
+
};
|
|
92
|
+
}
|
|
72
93
|
const result = replaceLatestSessionTurnAndQueueInput({
|
|
73
94
|
sessionKey,
|
|
74
95
|
targetTurnId,
|
|
75
96
|
clientMessageId,
|
|
76
97
|
content,
|
|
77
98
|
attachments,
|
|
99
|
+
contextRefs: sourceContexts?.map(summarizeSourceContext),
|
|
100
|
+
contextSnapshots: sourceContexts,
|
|
78
101
|
thinking: input.thinking,
|
|
79
102
|
origin: input.origin
|
|
80
103
|
});
|
|
@@ -121,8 +144,21 @@ var SessionInputCoordinator = class {
|
|
|
121
144
|
code: "QUEUE_FULL"
|
|
122
145
|
};
|
|
123
146
|
const attachments = await this.deps.prepareAttachments(sessionKey, input.attachments);
|
|
147
|
+
let sourceContexts;
|
|
148
|
+
try {
|
|
149
|
+
sourceContexts = await this.deps.prepareContexts(input.contextRefs);
|
|
150
|
+
} catch (err) {
|
|
151
|
+
log.warn({
|
|
152
|
+
err,
|
|
153
|
+
sessionKey
|
|
154
|
+
}, "Session input context preparation failed");
|
|
155
|
+
return {
|
|
156
|
+
ok: false,
|
|
157
|
+
code: "CONTEXT_UNAVAILABLE"
|
|
158
|
+
};
|
|
159
|
+
}
|
|
124
160
|
const runtime = this.snapshot(sessionKey);
|
|
125
|
-
const canSteer = input.origin.type !== "endpoint" && input.delivery === "steer" && runtime.activeRunId !== void 0 && !attachments?.length;
|
|
161
|
+
const canSteer = input.origin.type !== "endpoint" && input.delivery === "steer" && runtime.activeRunId !== void 0 && !attachments?.length && !sourceContexts?.length;
|
|
126
162
|
const effectiveDelivery = canSteer ? "steer" : "next";
|
|
127
163
|
const row = insertSessionInput({
|
|
128
164
|
id: crypto.randomUUID(),
|
|
@@ -133,6 +169,8 @@ var SessionInputCoordinator = class {
|
|
|
133
169
|
status: canSteer ? "injecting" : "queued",
|
|
134
170
|
content,
|
|
135
171
|
attachments,
|
|
172
|
+
contextRefs: sourceContexts?.map(summarizeSourceContext),
|
|
173
|
+
contextSnapshots: sourceContexts,
|
|
136
174
|
thinking: input.thinking,
|
|
137
175
|
origin: input.origin,
|
|
138
176
|
targetRunId: canSteer ? runtime.activeRunId : void 0
|
|
@@ -179,6 +217,7 @@ var SessionInputCoordinator = class {
|
|
|
179
217
|
sessionKey,
|
|
180
218
|
content: input.content,
|
|
181
219
|
attachments: input.attachments,
|
|
220
|
+
sourceContexts: input.contextSnapshots,
|
|
182
221
|
thinking: input.thinking,
|
|
183
222
|
origin: input.origin
|
|
184
223
|
});
|
|
@@ -204,11 +243,31 @@ var SessionInputCoordinator = class {
|
|
|
204
243
|
}
|
|
205
244
|
async update(sessionKey, id, body) {
|
|
206
245
|
const attachments = body.attachments === void 0 ? void 0 : await this.deps.prepareAttachments(sessionKey, body.attachments);
|
|
246
|
+
let sourceContexts;
|
|
247
|
+
if (body.contextRefs !== void 0) {
|
|
248
|
+
const existing = getSessionInputById(sessionKey, id);
|
|
249
|
+
if (!contextRefsMatchFrozenSnapshot(body.contextRefs, existing?.contextRefs)) try {
|
|
250
|
+
sourceContexts = await this.deps.prepareContexts(body.contextRefs) ?? [];
|
|
251
|
+
} catch (err) {
|
|
252
|
+
log.warn({
|
|
253
|
+
err,
|
|
254
|
+
sessionKey,
|
|
255
|
+
inputId: id
|
|
256
|
+
}, "Queued input context preparation failed");
|
|
257
|
+
return {
|
|
258
|
+
ok: false,
|
|
259
|
+
contextUnavailable: true,
|
|
260
|
+
state: this.snapshot(sessionKey)
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
}
|
|
207
264
|
const ok = mutateQueuedSessionInput({
|
|
208
265
|
sessionKey,
|
|
209
266
|
id,
|
|
210
267
|
...body,
|
|
211
|
-
attachments
|
|
268
|
+
attachments,
|
|
269
|
+
contextRefs: sourceContexts?.map(summarizeSourceContext),
|
|
270
|
+
contextSnapshots: sourceContexts
|
|
212
271
|
});
|
|
213
272
|
return {
|
|
214
273
|
ok,
|
|
@@ -22,6 +22,11 @@ export interface GatewaySessionsApiOptions {
|
|
|
22
22
|
getAgentService: () => AgentService;
|
|
23
23
|
/** Read-only view of in-flight webchat runs (per session key → run id). */
|
|
24
24
|
getActiveWebchatRunId: (sessionKey: string) => string | undefined;
|
|
25
|
+
/** Snapshot of all in-flight webchat runs for workspace briefing surfaces. */
|
|
26
|
+
listActiveWebchatRuns: () => Array<{
|
|
27
|
+
sessionKey: string;
|
|
28
|
+
runId: string;
|
|
29
|
+
}>;
|
|
25
30
|
}
|
|
26
31
|
export declare class GatewaySessionsApi {
|
|
27
32
|
private readonly opts;
|
|
@@ -47,6 +52,10 @@ export declare class GatewaySessionsApi {
|
|
|
47
52
|
active: boolean;
|
|
48
53
|
runId?: string;
|
|
49
54
|
};
|
|
55
|
+
listActiveRuns(): Array<{
|
|
56
|
+
sessionKey: string;
|
|
57
|
+
runId: string;
|
|
58
|
+
}>;
|
|
50
59
|
getMessagePage(key: string, options?: {
|
|
51
60
|
offset?: number;
|
|
52
61
|
limit?: number;
|
|
@@ -93,6 +102,7 @@ export declare class GatewaySessionsApi {
|
|
|
93
102
|
verboseLevel?: string;
|
|
94
103
|
workingDirectory?: string;
|
|
95
104
|
responseLanguage?: string | null;
|
|
105
|
+
userContextMode?: 'enabled' | 'off' | 'temporary';
|
|
96
106
|
}): Promise<import("../../agent/session/session-config-service.js").PatchSessionAgentConfigResult>;
|
|
97
107
|
listCompactionBoundaries(key: string): Promise<import("../../session/types.js").CompactionBoundarySummary[]>;
|
|
98
108
|
restoreBeforeCompactionBoundary(key: string, compactionId: string): Promise<void>;
|
|
@@ -139,7 +139,7 @@ export declare class GatewayService {
|
|
|
139
139
|
state: import("../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
140
140
|
} | {
|
|
141
141
|
ok: false;
|
|
142
|
-
code: "BAD_REQUEST" | "QUEUE_FULL";
|
|
142
|
+
code: "BAD_REQUEST" | "QUEUE_FULL" | "CONTEXT_UNAVAILABLE";
|
|
143
143
|
}>;
|
|
144
144
|
replaceLatestSessionTurn(...args: Parameters<GatewayAgentRunner['replaceLatestSessionTurn']>): Promise<{
|
|
145
145
|
ok: true;
|
|
@@ -147,12 +147,13 @@ export declare class GatewayService {
|
|
|
147
147
|
state: import("../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
148
148
|
} | {
|
|
149
149
|
ok: false;
|
|
150
|
-
code: "BAD_REQUEST" | "TARGET_NOT_FOUND" | "NOT_LATEST" | "SESSION_BUSY";
|
|
150
|
+
code: "BAD_REQUEST" | "TARGET_NOT_FOUND" | "NOT_LATEST" | "SESSION_BUSY" | "CONTEXT_UNAVAILABLE";
|
|
151
151
|
}>;
|
|
152
152
|
getSessionInputState(...args: Parameters<GatewayAgentRunner['getSessionInputState']>): import("../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
153
153
|
updateSessionInput(...args: Parameters<GatewayAgentRunner['updateSessionInput']>): Promise<{
|
|
154
154
|
ok: boolean;
|
|
155
155
|
state: import("../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
156
|
+
contextUnavailable?: boolean;
|
|
156
157
|
}>;
|
|
157
158
|
removeSessionInput(...args: Parameters<GatewayAgentRunner['removeSessionInput']>): {
|
|
158
159
|
ok: boolean;
|
|
@@ -9,14 +9,14 @@ import { closeXopcDatabase, openXopcDatabase } from "../storage/sqlite/connectio
|
|
|
9
9
|
import "../storage/sqlite/index.js";
|
|
10
10
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
11
11
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
12
|
+
import { buildSessionKey, init_session_key, sanitizeSegment } from "../routing/session-key.js";
|
|
13
|
+
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
12
14
|
import { init_paths, resolveAgentDir, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
13
|
-
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
14
15
|
import { areExtensionsGloballyDisabled } from "../extensions/discover-extensions.js";
|
|
15
16
|
import { buildExtensionMetadataSnapshot } from "../extensions/extension-metadata-snapshot.js";
|
|
16
17
|
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, init_channel_catalog_service } from "../channels/catalog/channel-catalog-service.js";
|
|
17
18
|
import { loadConfig, saveConfig } from "../config/loader.js";
|
|
18
|
-
import {
|
|
19
|
-
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
19
|
+
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
20
20
|
import { init_providers, providers_exports } from "../providers/index.js";
|
|
21
21
|
import { TaskRepository } from "../tasks/task-repository.js";
|
|
22
22
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
@@ -50,18 +50,18 @@ import { registerClarifyBridge } from "./clarify-runtime.js";
|
|
|
50
50
|
import { ChannelManager } from "../channels/manager.js";
|
|
51
51
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
52
52
|
import "../config/index.js";
|
|
53
|
-
import { DiscussionService } from "../discussions/service.js";
|
|
54
|
-
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
55
|
-
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
56
|
-
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
57
|
-
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
58
|
-
import "../discussions/index.js";
|
|
59
53
|
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
60
54
|
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
61
55
|
import "../knowledge/index.js";
|
|
62
56
|
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
63
57
|
import { ConnectedSourceChangePublisher } from "../connectors/source-change-publisher.js";
|
|
64
58
|
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
59
|
+
import { DiscussionService } from "../discussions/service.js";
|
|
60
|
+
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
61
|
+
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
62
|
+
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
63
|
+
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
64
|
+
import "../discussions/index.js";
|
|
65
65
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
66
66
|
import "../endpoint-tools/index.js";
|
|
67
67
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
@@ -369,6 +369,18 @@ var GatewayService = class {
|
|
|
369
369
|
getAgentService: () => this.ensureAgentService(),
|
|
370
370
|
getChannelManager: () => this.channelManager,
|
|
371
371
|
getConfig: () => this.config,
|
|
372
|
+
resolveTurnContext: async (ref) => {
|
|
373
|
+
if (ref.kind !== "note") return null;
|
|
374
|
+
const note = await this.notesService.getNote(ref.sourceId);
|
|
375
|
+
if (!note || note.status === "trashed") return null;
|
|
376
|
+
if (ref.expectedVersion && ref.expectedVersion !== String(note.updatedAt)) return null;
|
|
377
|
+
const { images: _images, ...snapshot } = await buildNoteAgentContext({
|
|
378
|
+
note,
|
|
379
|
+
notesService: this.notesService,
|
|
380
|
+
config: this.config
|
|
381
|
+
});
|
|
382
|
+
return snapshot;
|
|
383
|
+
},
|
|
372
384
|
emit: (type, payload) => this.emit(type, payload),
|
|
373
385
|
publishRealtime: (topic, event, data) => {
|
|
374
386
|
this.realtime.broker.publish(topic, event, data);
|
|
@@ -393,7 +405,8 @@ var GatewayService = class {
|
|
|
393
405
|
this.sessions = new GatewaySessionsApi({
|
|
394
406
|
sessionIndex: this.sessionIndex,
|
|
395
407
|
getAgentService: () => this.ensureAgentService(),
|
|
396
|
-
getActiveWebchatRunId: (sk) => this.agentRunner.getActiveRunId(sk)
|
|
408
|
+
getActiveWebchatRunId: (sk) => this.agentRunner.getActiveRunId(sk),
|
|
409
|
+
listActiveWebchatRuns: () => this.agentRunner.listActiveRuns()
|
|
397
410
|
});
|
|
398
411
|
this.marketplace = new GatewayMarketplaceService({
|
|
399
412
|
getConfig: () => this.config,
|
|
@@ -1161,8 +1174,9 @@ var GatewayService = class {
|
|
|
1161
1174
|
* PATCH saves update config in memory without re-running gateway startup, so this must run on save too.
|
|
1162
1175
|
*/
|
|
1163
1176
|
async reconcileBrowserExtensionServer() {
|
|
1164
|
-
const {
|
|
1165
|
-
|
|
1177
|
+
const { resolveExtensionBridgeServerConfig } = await import("../browser/backend-from-config.js");
|
|
1178
|
+
const bridgeConfig = resolveExtensionBridgeServerConfig(this.config);
|
|
1179
|
+
if (!bridgeConfig) {
|
|
1166
1180
|
if (this.browserExtensionRelease) {
|
|
1167
1181
|
await this.browserExtensionRelease();
|
|
1168
1182
|
this.browserExtensionRelease = null;
|
|
@@ -1172,10 +1186,7 @@ var GatewayService = class {
|
|
|
1172
1186
|
}
|
|
1173
1187
|
return;
|
|
1174
1188
|
}
|
|
1175
|
-
const port =
|
|
1176
|
-
const host = "127.0.0.1";
|
|
1177
|
-
const connectionTimeout = void 0;
|
|
1178
|
-
const commandTimeout = void 0;
|
|
1189
|
+
const { port, host, connectionTimeout, commandTimeout } = bridgeConfig;
|
|
1179
1190
|
const bindKey = `${host}:${port}`;
|
|
1180
1191
|
if (this.browserExtensionRelease && this.browserExtensionBindKey === bindKey) return;
|
|
1181
1192
|
if (this.browserExtensionRelease) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MediaRef } from '../media/types.js';
|
|
2
|
+
import type { TurnContextRef } from '../agent/source-context/types.js';
|
|
2
3
|
export interface UserTurnAttachment {
|
|
3
4
|
id?: string;
|
|
4
5
|
type: string;
|
|
@@ -13,5 +14,6 @@ export interface UserTurnAttachment {
|
|
|
13
14
|
export interface UserTurnInput {
|
|
14
15
|
text: string;
|
|
15
16
|
attachments?: UserTurnAttachment[];
|
|
17
|
+
contextRefs?: TurnContextRef[];
|
|
16
18
|
}
|
|
17
19
|
export declare function mediaRefsToUserTurnAttachments(media: MediaRef[] | undefined): UserTurnAttachment[] | undefined;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Config } from '../config/schema.js';
|
|
2
2
|
import type { CatalogSource } from '../providers/model-catalog-store.js';
|
|
3
|
-
type CloudCapability = 'vision' | 'image-generation' | 'stt' | 'tts';
|
|
3
|
+
type CloudCapability = 'chat' | 'vision' | 'image-generation' | 'stt' | 'tts';
|
|
4
4
|
export interface XopcCloudCapabilitySelection {
|
|
5
|
+
chat: string;
|
|
5
6
|
vision: string;
|
|
6
7
|
imageGeneration: string;
|
|
7
8
|
stt: string;
|
|
@@ -29,7 +30,7 @@ export declare function selectXopcCloudCapabilities(source: CatalogSource): {
|
|
|
29
30
|
selection?: XopcCloudCapabilitySelection;
|
|
30
31
|
missing: CloudCapability[];
|
|
31
32
|
};
|
|
32
|
-
/** Build one atomic config update for
|
|
33
|
+
/** Build one atomic config update for the managed XOPC Cloud chat and media capabilities. */
|
|
33
34
|
export declare function prepareXopcCloudCapabilitySetup(config: Config, source: CatalogSource): PrepareXopcCloudCapabilitySetupResult;
|
|
34
35
|
export declare function applyXopcCloudCapabilitySetup(service: {
|
|
35
36
|
currentConfig: Config;
|
|
@@ -5,29 +5,33 @@ import { ensureGlobalDefaultsConfig, prepareUpdateGlobalDefaults } from "./globa
|
|
|
5
5
|
init_model_catalog_store();
|
|
6
6
|
function supportsCapability(model, capability) {
|
|
7
7
|
if (model.availability !== "available") return false;
|
|
8
|
+
if (capability === "chat") return model.kind === "language" && (model.operations.includes("chat.completions") || model.operations.includes("responses"));
|
|
8
9
|
if (capability === "vision") return model.kind === "language" && model.input.includes("image");
|
|
9
10
|
if (capability === "image-generation") return model.kind === "image" && model.operations.includes("images.generate");
|
|
10
11
|
if (capability === "stt") return model.kind === "stt" && model.operations.includes("audio.transcription");
|
|
11
12
|
return model.kind === "tts" && model.operations.includes("audio.speech") && Boolean(model.tts?.defaultVoice);
|
|
12
13
|
}
|
|
13
14
|
function recommendedModel(source, capability) {
|
|
14
|
-
const recommendation = source.recommended?.[capability];
|
|
15
|
+
const recommendation = capability === "chat" ? source.recommendedModel ?? void 0 : source.recommended?.[capability];
|
|
15
16
|
return source.models.filter((model) => supportsCapability(model, capability)).sort((left, right) => compareCatalogModels(left, right, recommendation))[0];
|
|
16
17
|
}
|
|
17
18
|
function selectXopcCloudCapabilities(source) {
|
|
19
|
+
const chat = recommendedModel(source, "chat");
|
|
18
20
|
const vision = recommendedModel(source, "vision");
|
|
19
21
|
const imageGeneration = recommendedModel(source, "image-generation");
|
|
20
22
|
const stt = recommendedModel(source, "stt");
|
|
21
23
|
const tts = recommendedModel(source, "tts");
|
|
22
24
|
const missing = [];
|
|
25
|
+
if (!chat) missing.push("chat");
|
|
23
26
|
if (!vision) missing.push("vision");
|
|
24
27
|
if (!imageGeneration) missing.push("image-generation");
|
|
25
28
|
if (!stt) missing.push("stt");
|
|
26
29
|
if (!tts) missing.push("tts");
|
|
27
|
-
if (!vision || !imageGeneration || !stt || !tts || !tts.tts?.defaultVoice) return { missing };
|
|
30
|
+
if (!chat || !vision || !imageGeneration || !stt || !tts || !tts.tts?.defaultVoice) return { missing };
|
|
28
31
|
return {
|
|
29
32
|
missing,
|
|
30
33
|
selection: {
|
|
34
|
+
chat: chat.id,
|
|
31
35
|
vision: vision.id,
|
|
32
36
|
imageGeneration: imageGeneration.id,
|
|
33
37
|
stt: stt.id,
|
|
@@ -36,7 +40,7 @@ function selectXopcCloudCapabilities(source) {
|
|
|
36
40
|
}
|
|
37
41
|
};
|
|
38
42
|
}
|
|
39
|
-
/** Build one atomic config update for
|
|
43
|
+
/** Build one atomic config update for the managed XOPC Cloud chat and media capabilities. */
|
|
40
44
|
function prepareXopcCloudCapabilitySetup(config, source) {
|
|
41
45
|
const selected = selectXopcCloudCapabilities(source);
|
|
42
46
|
if (!selected.selection) return {
|
|
@@ -48,8 +52,17 @@ function prepareXopcCloudCapabilitySetup(config, source) {
|
|
|
48
52
|
const normalized = ensureGlobalDefaultsConfig(config);
|
|
49
53
|
const presetId = normalized.agents.defaultPreset;
|
|
50
54
|
const currentModels = normalized.agents.capabilityPresets[presetId]?.models;
|
|
55
|
+
const defaultRole = currentModels?.defaultRole ?? "deep";
|
|
51
56
|
const defaultsUpdate = prepareUpdateGlobalDefaults(normalized, { models: {
|
|
52
57
|
...currentModels,
|
|
58
|
+
defaultRole,
|
|
59
|
+
roles: {
|
|
60
|
+
...currentModels?.roles ?? {},
|
|
61
|
+
[defaultRole]: {
|
|
62
|
+
...currentModels?.roles?.[defaultRole],
|
|
63
|
+
model: `xopc-cloud/${selection.chat}`
|
|
64
|
+
}
|
|
65
|
+
},
|
|
53
66
|
imageModel: {
|
|
54
67
|
...currentModels?.imageModel,
|
|
55
68
|
primary: `xopc-cloud/${selection.vision}`
|