@xopcai/xopc 0.0.218 → 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-DF2dYXG1.js → activity-store-slG02hSm.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Dw9rF5o1.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-_H0Bam-t.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-DZCOhXch.js → archive-plugin-DKXa160O.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-Bjb0FH2B.js → attachment-load-CzwA9g2y.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-D4N3ZDhu.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-uXPt0s47.js → binary-plugins-DoQ_DnT7.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-gukkIEro.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-DAhdS-XZ.js → browser-workflow-inputs-D4roXE6r.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-LKjYzXS_.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-BBUkH833.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-E5mo8M3a.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-BGNuaqvI.js → cron-expression-4DvCFs-v.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-k7mkklMU.js → date-picker-B6FSjt4Z.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-Za18eMp1.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-p9EZyGzV.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-Cd4BMKm_.js → extension-debug-page-Cordpg4X.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CzEGCkOa.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-DNrttVr2.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-B1vD3vRb.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-BTR0Wk_k.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-CYlS4RGA.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-CNppYVew.js → local-apps-page-Be79cyMG.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-gf9Bg2gb.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-IYk9xLgt.js → management-settings-CRspx0oY.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-D8e6pRMH.js → markdown-split-G3PTpGw3.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-D0fiJjBQ.js → markdown-view-D4FPJZ91.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CCq6TtEf.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-BBtWnlUU.js → notes-api-q7HjYO07.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BKe1xa3U.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-DXe5iWI6.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-xj5gOva_.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-BJTvmBCA.js → runtime-tools-settings-panel-CXHQc53b.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DvGBa_7R.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-sbef7GTm.js → settings-loading-skeleton-H3ZH6a6l.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BNGxxXZe.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-C1523ij3.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-Ditgz7Vo.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/task-detail-page-BwOyrADL.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-DgSjes3O.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-Bp_qFZkl.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-hbzDfErG.js → voice-api-key-field-CGTE5156.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DZVib-04.js → work-discovery-overlay-CW-HKD7h.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C2RKay1p.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 +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/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension.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 +82 -34
- package/dist/src/connectors/learning-coordinator.js +57 -11
- package/dist/src/extensions/lockfile.js +1 -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/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/auth-registry-extensions.js +1 -1
- 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 +9 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +127 -31
- 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 +7 -2
- package/dist/src/gateway/service/agent-runner.js +21 -1
- package/dist/src/gateway/service/config-coordinator.js +2 -2
- 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 +25 -15
- 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/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/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 +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-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/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/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/service.js +21 -5
- package/dist/src/work-discovery/source-repository.js +1 -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
package/dist/src/tui/tui.js
CHANGED
|
@@ -2,10 +2,10 @@ import { version } from "../../package.js";
|
|
|
2
2
|
import { resolveStateDir, resolveXopcDatabasePath } from "../config/paths-state.js";
|
|
3
3
|
import { parseAgentSessionKey } from "../routing/session-key-utils.js";
|
|
4
4
|
import { init_agent_session_key, normalizeAgentId } from "../routing/agent-session-key.js";
|
|
5
|
+
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
5
6
|
import { init_paths } from "../config/paths.js";
|
|
6
7
|
import { loadConfig } from "../config/loader.js";
|
|
7
8
|
import { getAllModels, getAllProviders, getApiKey, init_providers, isProviderConfiguredSync } from "../providers/index.js";
|
|
8
|
-
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
9
9
|
import { ProjectTrustStore, hasTrustRequiringProjectResources } from "../project-trust/trust-store.js";
|
|
10
10
|
import { renderWorkflowFinalSummary, renderWorkflowPanel } from "../agent/workflow/snapshot.js";
|
|
11
11
|
import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
@@ -27,13 +27,14 @@ import { transcriptTreeEntryIdToRowNumber } from "./tui-transcript-tree.js";
|
|
|
27
27
|
import { formatTuiCompactionResult, formatTuiShareResult } from "./tui-command-formatters.js";
|
|
28
28
|
import { formatTuiStartupText } from "./tui-startup-text.js";
|
|
29
29
|
import { createTuiCommandHandler, getSlashCommands } from "./tui-commands.js";
|
|
30
|
-
import { GENERATED_TUI_SESSION_SHELL_PATCH, cleanupAbandonedTuiSessions, deleteGeneratedTuiSessionIfEmpty,
|
|
30
|
+
import { GENERATED_TUI_SESSION_SHELL_PATCH, cleanupAbandonedTuiSessions, deleteGeneratedTuiSessionIfEmpty, isGeneratedTuiSessionKey } from "./tui-empty-session-cleanup.js";
|
|
31
31
|
import { extensionCustomMessageContentToText, extensionCustomMessageToTurnText, extensionUserMessageContentToText } from "./tui-extension-user-message.js";
|
|
32
32
|
import { resolveFdPath } from "./tui-fd-path.js";
|
|
33
33
|
import { createBackspaceDeduper, drainAndStopTuiSafely, isIgnorableTuiStopError, resolveCtrlCAction, stopTuiSafely } from "./tui-lifecycle.js";
|
|
34
34
|
import { createLocalShellRunner } from "./tui-local-shell.js";
|
|
35
35
|
import { filterModelsForCycle, loadScopedModelRefs, saveScopedModelRefs } from "./tui-scoped-models.js";
|
|
36
36
|
import { openModelPickerOverlay } from "./tui-model-picker.js";
|
|
37
|
+
import { getTuiNewSessionPreferences, rememberTuiAgentModel, rememberTuiSessionContext, tuiGatewayPreferenceKey, tuiInitialAgentConfig } from "./tui-new-session-preferences.js";
|
|
37
38
|
import { runTuiOAuthLogin } from "./tui-oauth-login.js";
|
|
38
39
|
import { openAgentPickerOverlay, openProjectTrustOverlay, openReviewLauncherOverlay, openScopedModelsOverlay, openSessionPickerOverlay, openSessionTreeOverlay, openSettingsOverlay, openThinkingSelectorOverlay, openTimelineOverlay, openTranscriptTreeOverlay, openUserMessageForkOverlay } from "./tui-picker-overlay.js";
|
|
39
40
|
import { formatActiveRunStatus, formatRunDuration } from "./tui-run-status-format.js";
|
|
@@ -195,6 +196,7 @@ async function runTui(opts) {
|
|
|
195
196
|
sessionMainKey
|
|
196
197
|
});
|
|
197
198
|
let tuiSettings = loadTuiSettings();
|
|
199
|
+
const newSessionPreferenceKey = isLocalMode ? tuiGatewayPreferenceKey() : tuiGatewayPreferenceKey(opts.url ?? "http://localhost:3120");
|
|
198
200
|
initTuiTheme({ themeId: opts.theme ?? tuiSettings.theme });
|
|
199
201
|
const state = createInitialState(startup.sessionKey);
|
|
200
202
|
const generatedStartupSessionKey = !opts.session?.trim() && isGeneratedTuiSessionKey(startup.sessionKey) ? startup.sessionKey : null;
|
|
@@ -722,7 +724,7 @@ async function runTui(opts) {
|
|
|
722
724
|
};
|
|
723
725
|
const runExtensionNewSession = async (options) => {
|
|
724
726
|
await abortActive({ clearUi: false });
|
|
725
|
-
await
|
|
727
|
+
await startPreferredNewSession("session");
|
|
726
728
|
await options?.setup?.(sessionSnapshot.manager());
|
|
727
729
|
await runWithReplacementContext(options?.withSession);
|
|
728
730
|
return { cancelled: false };
|
|
@@ -989,8 +991,34 @@ async function runTui(opts) {
|
|
|
989
991
|
sessionSnapshot,
|
|
990
992
|
onAgentIdChange: (agentId) => {
|
|
991
993
|
currentAgentId = agentId;
|
|
992
|
-
}
|
|
994
|
+
},
|
|
995
|
+
onSessionInfoChange: () => persistCurrentNewSessionContext()
|
|
993
996
|
});
|
|
997
|
+
const persistCurrentNewSessionContext = () => {
|
|
998
|
+
const current = getTuiNewSessionPreferences(tuiSettings, newSessionPreferenceKey);
|
|
999
|
+
const normalizedProjectId = state.sessionInfo.projectId?.trim() || null;
|
|
1000
|
+
const currentProjectId = current.lastChatScope.kind === "project" ? current.lastChatScope.projectId : null;
|
|
1001
|
+
if (current.selectedAgentId === currentAgentId && currentProjectId === normalizedProjectId) return;
|
|
1002
|
+
tuiSettings = rememberTuiSessionContext(tuiSettings, newSessionPreferenceKey, {
|
|
1003
|
+
agentId: currentAgentId,
|
|
1004
|
+
projectId: normalizedProjectId
|
|
1005
|
+
});
|
|
1006
|
+
saveTuiSettings(tuiSettings);
|
|
1007
|
+
};
|
|
1008
|
+
const startPreferredNewSession = async (prefix = "tui") => {
|
|
1009
|
+
const projectId = state.sessionInfo.projectId?.trim() || void 0;
|
|
1010
|
+
await setSession(resolveSessionKey(`${prefix}-${randomUUID()}`));
|
|
1011
|
+
const initialAgentConfig = tuiInitialAgentConfig(tuiSettings, newSessionPreferenceKey, currentAgentId);
|
|
1012
|
+
if (initialAgentConfig || projectId) {
|
|
1013
|
+
await client.patchSession(state.currentSessionKey, {
|
|
1014
|
+
...initialAgentConfig,
|
|
1015
|
+
...projectId ? { projectId } : {},
|
|
1016
|
+
...isGeneratedTuiSessionKey(state.currentSessionKey) ? GENERATED_TUI_SESSION_SHELL_PATCH : {}
|
|
1017
|
+
});
|
|
1018
|
+
await refreshSessionInfo();
|
|
1019
|
+
}
|
|
1020
|
+
persistCurrentNewSessionContext();
|
|
1021
|
+
};
|
|
994
1022
|
const refreshSessionInfoWithBorder = async () => {
|
|
995
1023
|
await refreshSessionInfo();
|
|
996
1024
|
updateEditorBorderColor();
|
|
@@ -1115,6 +1143,14 @@ async function runTui(opts) {
|
|
|
1115
1143
|
try {
|
|
1116
1144
|
await client.patchSession(state.currentSessionKey, { thinkingLevel: level });
|
|
1117
1145
|
state.sessionInfo.thinkingLevel = level;
|
|
1146
|
+
const currentModelRef = state.sessionInfo.modelProvider && state.sessionInfo.model ? `${state.sessionInfo.modelProvider}/${state.sessionInfo.model}` : state.sessionInfo.model;
|
|
1147
|
+
if (currentModelRef) {
|
|
1148
|
+
tuiSettings = rememberTuiAgentModel(tuiSettings, newSessionPreferenceKey, currentAgentId, {
|
|
1149
|
+
modelRef: currentModelRef,
|
|
1150
|
+
thinkingLevel: level
|
|
1151
|
+
});
|
|
1152
|
+
saveTuiSettings(tuiSettings);
|
|
1153
|
+
}
|
|
1118
1154
|
await refreshSessionInfoWithBorder();
|
|
1119
1155
|
updateFooter();
|
|
1120
1156
|
chatLog.addStatus(theme.dim(`Thinking level: ${level}`));
|
|
@@ -1250,6 +1286,11 @@ async function runTui(opts) {
|
|
|
1250
1286
|
await client.patchSession(state.currentSessionKey, { model: trimmed });
|
|
1251
1287
|
state.sessionInfo.modelProvider = selected.provider;
|
|
1252
1288
|
state.sessionInfo.model = selected.id;
|
|
1289
|
+
tuiSettings = rememberTuiAgentModel(tuiSettings, newSessionPreferenceKey, currentAgentId, {
|
|
1290
|
+
modelRef: trimmed,
|
|
1291
|
+
...state.sessionInfo.thinkingLevel ? { thinkingLevel: state.sessionInfo.thinkingLevel } : {}
|
|
1292
|
+
});
|
|
1293
|
+
saveTuiSettings(tuiSettings);
|
|
1253
1294
|
if (selected.contextWindow != null) state.sessionInfo.contextWindow = selected.contextWindow;
|
|
1254
1295
|
await refreshSessionInfoWithBorder();
|
|
1255
1296
|
updateFooter();
|
|
@@ -1706,6 +1747,10 @@ async function runTui(opts) {
|
|
|
1706
1747
|
await setSession(rawKey);
|
|
1707
1748
|
await refreshStartupResources();
|
|
1708
1749
|
},
|
|
1750
|
+
newSession: async () => {
|
|
1751
|
+
await startPreferredNewSession();
|
|
1752
|
+
await refreshStartupResources();
|
|
1753
|
+
},
|
|
1709
1754
|
resetSession: resetCurrentSession,
|
|
1710
1755
|
projectTrust: {
|
|
1711
1756
|
cwd: process.cwd(),
|
|
@@ -2158,7 +2203,15 @@ async function runTui(opts) {
|
|
|
2158
2203
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
2159
2204
|
chatLog.addSystem(`Project not selected: ${errorMessage}`);
|
|
2160
2205
|
}
|
|
2206
|
+
if (!opts.session?.trim() && isGeneratedTuiSessionKey(state.currentSessionKey)) {
|
|
2207
|
+
const initialAgentConfig = tuiInitialAgentConfig(tuiSettings, newSessionPreferenceKey, currentAgentId);
|
|
2208
|
+
if (initialAgentConfig || opts.thinking?.trim()) await client.patchSession(state.currentSessionKey, {
|
|
2209
|
+
...initialAgentConfig,
|
|
2210
|
+
...opts.thinking?.trim() ? { thinkingLevel: opts.thinking.trim() } : {}
|
|
2211
|
+
});
|
|
2212
|
+
}
|
|
2161
2213
|
await refreshSessionInfoWithBorder();
|
|
2214
|
+
persistCurrentNewSessionContext();
|
|
2162
2215
|
try {
|
|
2163
2216
|
state.pendingInputCount = countPendingChatInputs((await client.getChatInputState(state.currentSessionKey)).inputs);
|
|
2164
2217
|
} catch {
|
|
@@ -2166,7 +2219,7 @@ async function runTui(opts) {
|
|
|
2166
2219
|
}
|
|
2167
2220
|
await refreshModelChoices();
|
|
2168
2221
|
await loadSessionHistory({ merge: true });
|
|
2169
|
-
cleanupAbandonedTuiSessions(client, state.currentSessionKey).
|
|
2222
|
+
cleanupAbandonedTuiSessions(client, state.currentSessionKey).catch(() => {});
|
|
2170
2223
|
showStartupCardOnce();
|
|
2171
2224
|
refreshStartupResources().then(() => {
|
|
2172
2225
|
updateFooter();
|
|
@@ -45,6 +45,9 @@ function spawnFrpcProcess(frpcBin, configPath) {
|
|
|
45
45
|
loginReject = void 0;
|
|
46
46
|
});
|
|
47
47
|
child.on("exit", (code, signal) => {
|
|
48
|
+
loginReject?.(/* @__PURE__ */ new Error(`frpc exited before login (code=${code ?? "null"}, signal=${signal ?? "null"})`));
|
|
49
|
+
loginResolve = void 0;
|
|
50
|
+
loginReject = void 0;
|
|
48
51
|
for (const h of exitHandlers) h(code, signal);
|
|
49
52
|
});
|
|
50
53
|
if (!child.pid) throw new Error("Failed to spawn frpc process");
|
|
@@ -18,6 +18,7 @@ export declare class TunnelService extends EventEmitter {
|
|
|
18
18
|
private lastError;
|
|
19
19
|
private state;
|
|
20
20
|
private reconnectAttempt;
|
|
21
|
+
private reconnectTask;
|
|
21
22
|
private stopping;
|
|
22
23
|
private startContext;
|
|
23
24
|
private frpcDownload;
|
|
@@ -36,6 +37,7 @@ export declare class TunnelService extends EventEmitter {
|
|
|
36
37
|
private resolveRegistration;
|
|
37
38
|
private spawnAndWait;
|
|
38
39
|
private scheduleReconnect;
|
|
40
|
+
private runReconnectLoop;
|
|
39
41
|
private startHeartbeat;
|
|
40
42
|
private clearHeartbeat;
|
|
41
43
|
}
|
|
@@ -36,6 +36,7 @@ var TunnelService = class extends EventEmitter {
|
|
|
36
36
|
lastError = null;
|
|
37
37
|
state = "disconnected";
|
|
38
38
|
reconnectAttempt = 0;
|
|
39
|
+
reconnectTask = null;
|
|
39
40
|
stopping = false;
|
|
40
41
|
startContext = null;
|
|
41
42
|
frpcDownload = null;
|
|
@@ -240,13 +241,14 @@ var TunnelService = class extends EventEmitter {
|
|
|
240
241
|
}
|
|
241
242
|
async spawnAndWait(frpcBin, configPath, broker, state, heartbeatIntervalMs) {
|
|
242
243
|
if (this.frpcHandle) {
|
|
243
|
-
|
|
244
|
+
const previousHandle = this.frpcHandle;
|
|
244
245
|
this.frpcHandle = null;
|
|
246
|
+
await previousHandle.kill();
|
|
245
247
|
}
|
|
246
248
|
const handle = spawnFrpcProcess(frpcBin, configPath);
|
|
247
249
|
this.frpcHandle = handle;
|
|
248
250
|
handle.onExit((code, signal) => {
|
|
249
|
-
if (this.stopping) return;
|
|
251
|
+
if (this.stopping || this.frpcHandle !== handle) return;
|
|
250
252
|
log.warn({
|
|
251
253
|
code,
|
|
252
254
|
signal,
|
|
@@ -261,33 +263,43 @@ var TunnelService = class extends EventEmitter {
|
|
|
261
263
|
}
|
|
262
264
|
async scheduleReconnect(frpcBin, configPath, broker, state, heartbeatIntervalMs) {
|
|
263
265
|
if (this.stopping) return;
|
|
266
|
+
if (this.reconnectTask) return this.reconnectTask;
|
|
267
|
+
const task = this.runReconnectLoop(frpcBin, configPath, broker, state, heartbeatIntervalMs).finally(() => {
|
|
268
|
+
if (this.reconnectTask === task) this.reconnectTask = null;
|
|
269
|
+
});
|
|
270
|
+
this.reconnectTask = task;
|
|
271
|
+
return task;
|
|
272
|
+
}
|
|
273
|
+
async runReconnectLoop(frpcBin, configPath, broker, state, heartbeatIntervalMs) {
|
|
264
274
|
const maxAttempts = 5;
|
|
265
|
-
this.
|
|
266
|
-
|
|
267
|
-
this.
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
275
|
+
while (!this.stopping) {
|
|
276
|
+
this.reconnectAttempt += 1;
|
|
277
|
+
if (this.reconnectAttempt > maxAttempts) {
|
|
278
|
+
this.state = "error";
|
|
279
|
+
this.lastError = "frpc reconnect failed after maximum attempts";
|
|
280
|
+
log.error({ attempts: maxAttempts }, this.lastError);
|
|
281
|
+
this.emit("tunnel:error", this.lastError);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
this.state = "reconnecting";
|
|
285
|
+
this.setStartPhase("reconnecting_frpc", { publicUrl: state.publicUrl ?? null });
|
|
286
|
+
const delayMs = Math.min(16e3, 1e3 * 2 ** (this.reconnectAttempt - 1));
|
|
287
|
+
log.info({
|
|
288
|
+
attempt: this.reconnectAttempt,
|
|
289
|
+
delayMs
|
|
290
|
+
}, "Scheduling frpc reconnect");
|
|
291
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
292
|
+
if (this.stopping) return;
|
|
293
|
+
try {
|
|
294
|
+
await this.spawnAndWait(frpcBin, configPath, broker, state, heartbeatIntervalMs);
|
|
295
|
+
this.clearStartProgress();
|
|
296
|
+
this.state = "connected";
|
|
297
|
+
this.reconnectAttempt = 0;
|
|
298
|
+
this.emit("tunnel:connected");
|
|
299
|
+
return;
|
|
300
|
+
} catch (err) {
|
|
301
|
+
this.lastError = err instanceof Error ? err.message : String(err);
|
|
302
|
+
}
|
|
291
303
|
}
|
|
292
304
|
}
|
|
293
305
|
startHeartbeat(broker, state, intervalMs) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContextEvidence, UserContextScope } from './domain.js';
|
|
2
|
+
export type ContextObjectView = 'current' | 'review' | 'history';
|
|
3
|
+
export type ContextObjectOrigin = 'told_by_user' | 'observed' | 'inferred' | 'connected_source';
|
|
4
|
+
export type ContextObject = {
|
|
5
|
+
objectType: 'profile' | 'rule' | 'focus' | 'understanding';
|
|
6
|
+
objectId: string;
|
|
7
|
+
status: string;
|
|
8
|
+
content: string;
|
|
9
|
+
scope: UserContextScope;
|
|
10
|
+
origin: ContextObjectOrigin;
|
|
11
|
+
confidence: number;
|
|
12
|
+
evidence: ContextEvidence[] | Array<{
|
|
13
|
+
sourceRef: string;
|
|
14
|
+
}>;
|
|
15
|
+
updatedAt: number;
|
|
16
|
+
};
|
|
17
|
+
export declare function listContextObjects(view: ContextObjectView): ContextObject[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { getUserProfile, listCollaborationRules, listUnderstandingEvidence, listUnderstandings } from "../storage/sqlite/user-context-repository.js";
|
|
2
|
+
import "../storage/sqlite/index.js";
|
|
3
|
+
import { getUnderstandingSourceGrant, getUnderstandingSourceRun, listUserFocusEvidence, listUserFocuses } from "./sources/repository.js";
|
|
4
|
+
//#region src/user-context/context-objects.ts
|
|
5
|
+
function understandingOrigin(item, evidence) {
|
|
6
|
+
if (item.explicitness === "explicit") return "told_by_user";
|
|
7
|
+
if (evidence.some((entry) => entry.sourceType === "connector")) return "connected_source";
|
|
8
|
+
return item.explicitness === "observed" ? "observed" : "inferred";
|
|
9
|
+
}
|
|
10
|
+
function includesStatus(view, objectType, status) {
|
|
11
|
+
if (view === "current") return status === "active";
|
|
12
|
+
if (view === "review") return objectType === "understanding" ? [
|
|
13
|
+
"candidate",
|
|
14
|
+
"needs_review",
|
|
15
|
+
"stale"
|
|
16
|
+
].includes(status) : objectType === "focus" && status === "candidate";
|
|
17
|
+
return objectType === "understanding" ? ["archived", "rejected"].includes(status) : objectType === "focus" ? [
|
|
18
|
+
"paused",
|
|
19
|
+
"completed",
|
|
20
|
+
"rejected"
|
|
21
|
+
].includes(status) : objectType === "rule" && ["disabled", "archived"].includes(status);
|
|
22
|
+
}
|
|
23
|
+
function listContextObjects(view) {
|
|
24
|
+
const objects = [];
|
|
25
|
+
if (view === "current") {
|
|
26
|
+
const profile = getUserProfile();
|
|
27
|
+
const fields = [
|
|
28
|
+
["callName", profile.callName],
|
|
29
|
+
["role", profile.role],
|
|
30
|
+
["primaryGoal", profile.primaryGoal],
|
|
31
|
+
["pronouns", profile.pronouns],
|
|
32
|
+
["timezone", profile.timezone],
|
|
33
|
+
["locale", profile.locale]
|
|
34
|
+
];
|
|
35
|
+
for (const [field, value] of fields) {
|
|
36
|
+
if (!value) continue;
|
|
37
|
+
objects.push({
|
|
38
|
+
objectType: "profile",
|
|
39
|
+
objectId: field,
|
|
40
|
+
status: "active",
|
|
41
|
+
content: value,
|
|
42
|
+
scope: { type: "global" },
|
|
43
|
+
origin: "told_by_user",
|
|
44
|
+
confidence: 1,
|
|
45
|
+
evidence: [{ sourceRef: `user-profile://${field}` }],
|
|
46
|
+
updatedAt: profile.updatedAt
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
for (const rule of listCollaborationRules()) {
|
|
51
|
+
if (!includesStatus(view, "rule", rule.status)) continue;
|
|
52
|
+
objects.push({
|
|
53
|
+
objectType: "rule",
|
|
54
|
+
objectId: rule.id,
|
|
55
|
+
status: rule.status,
|
|
56
|
+
content: rule.statement,
|
|
57
|
+
scope: rule.scope,
|
|
58
|
+
origin: "told_by_user",
|
|
59
|
+
confidence: 1,
|
|
60
|
+
evidence: [{ sourceRef: `collaboration-rule://${rule.revisionId}` }],
|
|
61
|
+
updatedAt: rule.updatedAt
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
for (const focus of listUserFocuses()) {
|
|
65
|
+
if (!includesStatus(view, "focus", focus.status)) continue;
|
|
66
|
+
const sourceRun = focus.sourceRunId ? getUnderstandingSourceRun(focus.sourceRunId) : null;
|
|
67
|
+
const sourceGrant = sourceRun ? getUnderstandingSourceGrant(sourceRun.grantId) : null;
|
|
68
|
+
const linkedEvidence = listUserFocusEvidence(focus.id);
|
|
69
|
+
objects.push({
|
|
70
|
+
objectType: "focus",
|
|
71
|
+
objectId: focus.id,
|
|
72
|
+
status: focus.status,
|
|
73
|
+
content: `${focus.title}: ${focus.summary}`,
|
|
74
|
+
scope: focus.scope,
|
|
75
|
+
origin: focus.explicitness === "explicit" ? "told_by_user" : sourceGrant?.adapterId.startsWith("connector:") ? "connected_source" : focus.explicitness === "observed" ? "observed" : "inferred",
|
|
76
|
+
confidence: focus.confidence,
|
|
77
|
+
evidence: linkedEvidence.length ? linkedEvidence : focus.evidenceRefs.map((sourceRef) => ({ sourceRef })),
|
|
78
|
+
updatedAt: focus.updatedAt
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
for (const understanding of listUnderstandings()) {
|
|
82
|
+
if (!includesStatus(view, "understanding", understanding.status)) continue;
|
|
83
|
+
const evidence = listUnderstandingEvidence(understanding.id);
|
|
84
|
+
objects.push({
|
|
85
|
+
objectType: "understanding",
|
|
86
|
+
objectId: understanding.id,
|
|
87
|
+
status: understanding.status,
|
|
88
|
+
content: understanding.statement,
|
|
89
|
+
scope: understanding.scope,
|
|
90
|
+
origin: understandingOrigin(understanding, evidence),
|
|
91
|
+
confidence: understanding.confidence,
|
|
92
|
+
evidence,
|
|
93
|
+
updatedAt: understanding.updatedAt
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return objects.sort((left, right) => right.updatedAt - left.updatedAt);
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { listContextObjects };
|
|
@@ -53,13 +53,14 @@ export type CollaborationRule = {
|
|
|
53
53
|
updatedAt: number;
|
|
54
54
|
};
|
|
55
55
|
export type PersonalizationItem = {
|
|
56
|
-
objectType: 'profile' | 'rule' | 'understanding';
|
|
56
|
+
objectType: 'profile' | 'rule' | 'focus' | 'understanding';
|
|
57
57
|
objectId: string;
|
|
58
58
|
versionId?: string;
|
|
59
59
|
decision: 'selected' | 'irrelevant' | 'expired' | 'scope_mismatch' | 'sensitive' | 'needs_consent' | 'budget_exceeded' | 'conflicted' | 'disabled';
|
|
60
60
|
reason: string;
|
|
61
61
|
content: string;
|
|
62
62
|
sourceLabel: string;
|
|
63
|
+
origin: 'told_by_user' | 'observed' | 'inferred' | 'connected_source';
|
|
63
64
|
rank?: number;
|
|
64
65
|
score?: number;
|
|
65
66
|
injectedChars: number;
|
|
@@ -69,8 +70,19 @@ export type ContextEvidence = {
|
|
|
69
70
|
sourceType: 'conversation' | 'connector' | 'user' | 'runtime';
|
|
70
71
|
sourceInstanceId?: string;
|
|
71
72
|
sourceRef: string;
|
|
73
|
+
sourceRunId?: string;
|
|
74
|
+
sourceItemId?: string;
|
|
75
|
+
sessionId?: string;
|
|
76
|
+
turnId?: string;
|
|
77
|
+
messageId?: string;
|
|
78
|
+
contentHash?: string;
|
|
79
|
+
retentionPolicy?: 'metadata_only' | 'derived_only' | 'bounded_raw';
|
|
80
|
+
processingPolicy?: 'local_only' | 'remote_allowed';
|
|
81
|
+
extractorId?: string;
|
|
82
|
+
extractorVersion?: string;
|
|
72
83
|
redactedExcerpt?: string;
|
|
73
84
|
trustLevel: 'owner' | 'trusted' | 'untrusted';
|
|
74
85
|
observedAt: number;
|
|
86
|
+
ingestedAt: number;
|
|
75
87
|
createdAt: number;
|
|
76
88
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type RetrievalEvaluationCase = {
|
|
2
|
+
id: string;
|
|
3
|
+
expectedIds: string[];
|
|
4
|
+
shouldAbstain?: boolean;
|
|
5
|
+
retrieve: () => string[];
|
|
6
|
+
};
|
|
7
|
+
export type RetrievalEvaluationMetrics = {
|
|
8
|
+
cases: number;
|
|
9
|
+
recallAtK: number;
|
|
10
|
+
precisionAtK: number;
|
|
11
|
+
abstentionAccuracy: number;
|
|
12
|
+
};
|
|
13
|
+
export declare function evaluateRetrievalCases(cases: RetrievalEvaluationCase[], k?: number): RetrievalEvaluationMetrics;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/user-context/evaluation/harness.ts
|
|
2
|
+
function evaluateRetrievalCases(cases, k = 3) {
|
|
3
|
+
let expected = 0;
|
|
4
|
+
let recalled = 0;
|
|
5
|
+
let returned = 0;
|
|
6
|
+
let relevantReturned = 0;
|
|
7
|
+
let abstentionCases = 0;
|
|
8
|
+
let correctAbstentions = 0;
|
|
9
|
+
for (const item of cases) {
|
|
10
|
+
const results = [...new Set(item.retrieve())].slice(0, Math.max(1, k));
|
|
11
|
+
const expectedIds = new Set(item.expectedIds);
|
|
12
|
+
if (item.shouldAbstain) {
|
|
13
|
+
abstentionCases += 1;
|
|
14
|
+
if (results.length === 0) correctAbstentions += 1;
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
expected += expectedIds.size;
|
|
18
|
+
returned += results.length;
|
|
19
|
+
const matches = results.filter((id) => expectedIds.has(id)).length;
|
|
20
|
+
recalled += matches;
|
|
21
|
+
relevantReturned += matches;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
cases: cases.length,
|
|
25
|
+
recallAtK: expected ? recalled / expected : 1,
|
|
26
|
+
precisionAtK: returned ? relevantReturned / returned : 1,
|
|
27
|
+
abstentionAccuracy: abstentionCases ? correctAbstentions / abstentionCases : 1
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { evaluateRetrievalCases };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ContextExtractionRun } from '../../storage/sqlite/index.js';
|
|
2
|
+
import type { UnderstandingKind } from '../domain.js';
|
|
3
|
+
export type ExtractorId = 'explicit-command' | 'deterministic-signal' | 'transcript-synthesis' | 'connector-structural' | 'connector-semantic';
|
|
4
|
+
export type ExtractorDefinition = {
|
|
5
|
+
id: ExtractorId;
|
|
6
|
+
version: string;
|
|
7
|
+
inputKinds: Array<'conversation' | 'connector' | 'file' | 'task'>;
|
|
8
|
+
requiredProcessingPolicy: 'local_only' | 'remote_allowed';
|
|
9
|
+
authorityCeiling: 'user_explicit' | 'user_observed' | 'system_inferred' | 'external_untrusted';
|
|
10
|
+
candidateKinds: UnderstandingKind[];
|
|
11
|
+
maxAutomaticStatus: 'active' | 'candidate';
|
|
12
|
+
timeoutMs: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function getExtractorDefinition(id: ExtractorId): ExtractorDefinition;
|
|
15
|
+
export declare function getRegisteredExtractorDefinition(id: string): ExtractorDefinition | undefined;
|
|
16
|
+
export declare function extractionInputHash(input: string): string;
|
|
17
|
+
export declare function claimRegisteredExtraction(input: {
|
|
18
|
+
extractorId: ExtractorId;
|
|
19
|
+
sourceRef: string;
|
|
20
|
+
contentForHash: string;
|
|
21
|
+
processingPolicy: 'local_only' | 'remote_allowed';
|
|
22
|
+
destination: ContextExtractionRun['destination'];
|
|
23
|
+
}): {
|
|
24
|
+
run: ContextExtractionRun;
|
|
25
|
+
shouldExecute: boolean;
|
|
26
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { claimContextExtractionRun, finishContextExtractionRun } from "../../storage/sqlite/context-extraction-repository.js";
|
|
2
|
+
import "../../storage/sqlite/index.js";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
//#region src/user-context/extraction/registry.ts
|
|
5
|
+
const UNDERSTANDING_KINDS = [
|
|
6
|
+
"preference",
|
|
7
|
+
"boundary",
|
|
8
|
+
"relationship",
|
|
9
|
+
"routine",
|
|
10
|
+
"current_state",
|
|
11
|
+
"long_term_goal",
|
|
12
|
+
"project_context",
|
|
13
|
+
"task_lesson",
|
|
14
|
+
"derived_insight"
|
|
15
|
+
];
|
|
16
|
+
const DEFINITIONS = {
|
|
17
|
+
"explicit-command": {
|
|
18
|
+
id: "explicit-command",
|
|
19
|
+
version: "1",
|
|
20
|
+
inputKinds: ["conversation"],
|
|
21
|
+
requiredProcessingPolicy: "local_only",
|
|
22
|
+
authorityCeiling: "user_explicit",
|
|
23
|
+
candidateKinds: UNDERSTANDING_KINDS,
|
|
24
|
+
maxAutomaticStatus: "active",
|
|
25
|
+
timeoutMs: 500
|
|
26
|
+
},
|
|
27
|
+
"deterministic-signal": {
|
|
28
|
+
id: "deterministic-signal",
|
|
29
|
+
version: "1",
|
|
30
|
+
inputKinds: ["conversation", "task"],
|
|
31
|
+
requiredProcessingPolicy: "local_only",
|
|
32
|
+
authorityCeiling: "user_observed",
|
|
33
|
+
candidateKinds: UNDERSTANDING_KINDS,
|
|
34
|
+
maxAutomaticStatus: "candidate",
|
|
35
|
+
timeoutMs: 500
|
|
36
|
+
},
|
|
37
|
+
"transcript-synthesis": {
|
|
38
|
+
id: "transcript-synthesis",
|
|
39
|
+
version: "1",
|
|
40
|
+
inputKinds: ["conversation"],
|
|
41
|
+
requiredProcessingPolicy: "remote_allowed",
|
|
42
|
+
authorityCeiling: "system_inferred",
|
|
43
|
+
candidateKinds: UNDERSTANDING_KINDS,
|
|
44
|
+
maxAutomaticStatus: "candidate",
|
|
45
|
+
timeoutMs: 3e4
|
|
46
|
+
},
|
|
47
|
+
"connector-structural": {
|
|
48
|
+
id: "connector-structural",
|
|
49
|
+
version: "1",
|
|
50
|
+
inputKinds: ["connector"],
|
|
51
|
+
requiredProcessingPolicy: "local_only",
|
|
52
|
+
authorityCeiling: "external_untrusted",
|
|
53
|
+
candidateKinds: [
|
|
54
|
+
"project_context",
|
|
55
|
+
"current_state",
|
|
56
|
+
"routine"
|
|
57
|
+
],
|
|
58
|
+
maxAutomaticStatus: "candidate",
|
|
59
|
+
timeoutMs: 1e4
|
|
60
|
+
},
|
|
61
|
+
"connector-semantic": {
|
|
62
|
+
id: "connector-semantic",
|
|
63
|
+
version: "1",
|
|
64
|
+
inputKinds: ["connector", "file"],
|
|
65
|
+
requiredProcessingPolicy: "remote_allowed",
|
|
66
|
+
authorityCeiling: "external_untrusted",
|
|
67
|
+
candidateKinds: [
|
|
68
|
+
"preference",
|
|
69
|
+
"routine",
|
|
70
|
+
"current_state",
|
|
71
|
+
"project_context"
|
|
72
|
+
],
|
|
73
|
+
maxAutomaticStatus: "candidate",
|
|
74
|
+
timeoutMs: 3e4
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
function getExtractorDefinition(id) {
|
|
78
|
+
return DEFINITIONS[id];
|
|
79
|
+
}
|
|
80
|
+
function getRegisteredExtractorDefinition(id) {
|
|
81
|
+
return DEFINITIONS[id];
|
|
82
|
+
}
|
|
83
|
+
function extractionInputHash(input) {
|
|
84
|
+
return createHash("sha256").update(input).digest("hex");
|
|
85
|
+
}
|
|
86
|
+
function claimRegisteredExtraction(input) {
|
|
87
|
+
const definition = getExtractorDefinition(input.extractorId);
|
|
88
|
+
const claimed = claimContextExtractionRun({
|
|
89
|
+
sourceRef: input.sourceRef,
|
|
90
|
+
extractorId: definition.id,
|
|
91
|
+
extractorVersion: definition.version,
|
|
92
|
+
processingPolicy: input.processingPolicy,
|
|
93
|
+
destination: input.destination,
|
|
94
|
+
inputHash: extractionInputHash(input.contentForHash)
|
|
95
|
+
});
|
|
96
|
+
if (definition.requiredProcessingPolicy === "remote_allowed" && input.processingPolicy !== "remote_allowed") {
|
|
97
|
+
if (claimed.run.status === "running") finishContextExtractionRun({
|
|
98
|
+
runId: claimed.run.id,
|
|
99
|
+
status: "skipped",
|
|
100
|
+
errorCode: "processing_policy"
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
run: {
|
|
104
|
+
...claimed.run,
|
|
105
|
+
status: "skipped"
|
|
106
|
+
},
|
|
107
|
+
shouldExecute: false
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return claimed;
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { claimRegisteredExtraction, extractionInputHash, getExtractorDefinition, getRegisteredExtractorDefinition };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type ContextRepairFilter = {
|
|
2
|
+
runId?: string;
|
|
3
|
+
sourceRef?: string;
|
|
4
|
+
extractorId?: string;
|
|
5
|
+
extractorVersion?: string;
|
|
6
|
+
objectVersionId?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function repairExtractedContext(filter: ContextRepairFilter): {
|
|
9
|
+
runIds: string[];
|
|
10
|
+
repaired: Array<{
|
|
11
|
+
objectType: 'focus' | 'understanding';
|
|
12
|
+
objectId: string;
|
|
13
|
+
}>;
|
|
14
|
+
retained: Array<{
|
|
15
|
+
objectType: 'focus' | 'understanding';
|
|
16
|
+
objectId: string;
|
|
17
|
+
reason: string;
|
|
18
|
+
}>;
|
|
19
|
+
};
|