@xopcai/xopc 0.0.218 → 0.0.220
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DF2dYXG1.js → activity-store-DeKZ36Jy.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Dw9rF5o1.js → agent-avatar-dicebear-D0hZfdkn.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Bu0NfWuh.js +68 -0
- package/dist/gateway/static/root/assets/{api-_H0Bam-t.js → api-yLnYUedB.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-C2kZNEHz.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-DQ7H35sN.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-Tty2xaUG.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DZCOhXch.js → archive-plugin-CBArbTPH.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-Bjb0FH2B.js → attachment-load-oc6DRj4G.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-D4N3ZDhu.js → automations-page-CHPEUpz8.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-9uYkHmdI.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-uXPt0s47.js → binary-plugins-BRBd0X7_.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-gukkIEro.js → block-editor-ZgM-Z4Qv.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-BT3mEm00.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-DAhdS-XZ.js → browser-workflow-inputs-DxD74a4c.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-LKjYzXS_.js → browser-workflows-page-Dpc7NqZf.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DHlfRj4M.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BBUkH833.js → capability-presets-api-B9ID97j6.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D2FkREUX.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-E5mo8M3a.js → channel-recipient-api-DCNn6MWL.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-D4YcKMtf.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-B8XWrzKM.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-MvNpjcUs.js +36 -0
- package/dist/gateway/static/root/assets/connectors-page-Bd6K9bDk.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-BGNuaqvI.js → cron-expression-BSXX9uY0.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-k7mkklMU.js → date-picker-CiHNkkIS.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-DQyh2ZXE.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-p9EZyGzV.js → desktop-pet-DnAHU-zA.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DUdhIBBB.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-B3gFQt8x.js +1 -0
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-Cd4BMKm_.js → extension-debug-page-Lq-gRApw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CzEGCkOa.js → extension-page-D0ROxJmY.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-B2tS6mFy.js +1 -0
- package/dist/gateway/static/root/assets/eye-CABVeTq0.js +1 -0
- package/dist/gateway/static/root/assets/eye-off-DEAzt3g1.js +1 -0
- package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +1 -0
- package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +1 -0
- package/dist/gateway/static/root/assets/gateway-config-api-DJqWfVi6.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-DNrttVr2.js → gateway-config-swr-CnwF9Vso.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-B3thenPX.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B1vD3vRb.js → gateway-startup-retry-DdJJZR8M.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-C_g-ZGSE.js +1 -0
- package/dist/gateway/static/root/assets/home-page-Cgwx66kc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BTR0Wk_k.js → image-generation-api-Dtt9M5qz.js} +1 -1
- package/dist/gateway/static/root/assets/index-Cf0qTkBK.css +2 -0
- package/dist/gateway/static/root/assets/index-V9g9-SWT.js +108 -0
- package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +1 -0
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CYlS4RGA.js → keyboard-shortcuts-settings-cJqkmQdP.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CmjLMdly.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CNppYVew.js → local-apps-page-BiuP2pkl.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-gf9Bg2gb.js → locale-store-D3Q2yEAb.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-BTlxGPho.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-IYk9xLgt.js → management-settings-Z1gJUwP_.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-D8e6pRMH.js → markdown-split-DuOmpGgE.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-D0fiJjBQ.js → markdown-view-WYArkdrc.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CCq6TtEf.js → media-plugins-DKPh3Mud.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BQHpB4VI.js +3 -0
- package/dist/gateway/static/root/assets/{notes-api-BBtWnlUU.js → notes-api-DMEon7Zv.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BKe1xa3U.js → notes-page-BG4gV8WG.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-D3LMBO2X.js +4 -0
- package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-CsNVTKC0.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DXe5iWI6.js → product-open-page-BjJf4QOB.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-C59tYJG-.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Di7W-Fg8.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-xj5gOva_.js → registry-api-DRyvynb5.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BYOKveWT.js +1 -0
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BJTvmBCA.js → runtime-tools-settings-panel-DC6t_-db.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DvGBa_7R.js → schema-form-DSTWtpjp.js} +1 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-CJMNQsxK.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-FJxZw08y.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-ZzEMNLYS.js +1 -0
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-sbef7GTm.js → settings-loading-skeleton-D7-bkbcW.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BNGxxXZe.js → settings-page-PaTpLbmi.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Bnpim6NY.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-C1523ij3.js → share-preview-page-Cxcw0ksa.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DBqmV7ZY.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-UgLQaWoz.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-Dby4iAYe.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-Ditgz7Vo.js → skills-page.utils-nlzJ5Y1V.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-vOsgnzDl.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-CRy8Wl5g.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-DgSjes3O.js → theme-store-CvnEHGyP.js} +1 -1
- package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-Bp_qFZkl.js → use-autosave-BTNZHulv.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-BT8F4mh5.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-hbzDfErG.js → voice-api-key-field-DDJ2-3Tx.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DZVib-04.js → work-discovery-overlay-DV_qiKSD.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C2RKay1p.js → workflow-run-setup-panel--AcvRw1w.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CwvskVvU.js +5 -0
- package/dist/gateway/static/root/index.html +21 -12
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/new-session.js +99 -0
- package/dist/packages/gateway-contract/src/tasks.js +5 -0
- package/dist/packages/gateway-contract/src/user-message-display.js +55 -0
- package/dist/src/agent/agent-manager.js +5 -4
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +2 -2
- package/dist/src/agent/background-review/run-background-review.js +144 -16
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +3 -1
- package/dist/src/agent/inbound/turn-dispatcher.js +2 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/memory/context/types.d.ts +1 -1
- package/dist/src/agent/memory/manager.d.ts +2 -1
- package/dist/src/agent/memory/manager.js +2 -6
- package/dist/src/agent/memory/understanding/service.d.ts +1 -0
- package/dist/src/agent/memory/understanding/service.js +179 -36
- package/dist/src/agent/memory/understanding/types.d.ts +6 -0
- package/dist/src/agent/messaging/command-handler.d.ts +2 -0
- package/dist/src/agent/messaging/command-handler.js +3 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +3 -0
- package/dist/src/agent/service/direct-turn-helpers.js +13 -3
- package/dist/src/agent/service/process-direct-streaming.d.ts +2 -1
- package/dist/src/agent/service/process-direct-streaming.js +12 -11
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-config-service.d.ts +1 -0
- package/dist/src/agent/session/session-config-service.js +11 -0
- package/dist/src/agent/session/session-inspector.d.ts +1 -0
- package/dist/src/agent/session/session-inspector.js +2 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/source-context/budget.d.ts +3 -0
- package/dist/src/agent/source-context/budget.js +21 -0
- package/dist/src/agent/source-context/index.js +3 -3
- package/dist/src/agent/source-context/injector.d.ts +2 -2
- package/dist/src/agent/source-context/injector.js +19 -9
- package/dist/src/agent/source-context/types.d.ts +16 -0
- package/dist/src/agent/source-context/types.js +25 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +19 -2
- package/dist/src/agent/tools/xopc-use-tool.js +62 -2
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/backend-from-config.d.ts +8 -0
- package/dist/src/browser/backend-from-config.js +16 -1
- package/dist/src/browser/providers/browser-ext-install.d.ts +3 -2
- package/dist/src/browser/providers/browser-ext-install.js +5 -3
- package/dist/src/chat-commands/builtins/review.js +11 -2
- package/dist/src/chat-commands/builtins/understanding.js +11 -4
- package/dist/src/chat-commands/types.d.ts +4 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.d.ts +20 -20
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/connectors/connected-source-understanding.d.ts +1 -0
- package/dist/src/connectors/connected-source-understanding.js +87 -38
- package/dist/src/connectors/learning-coordinator.js +68 -13
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +18 -0
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +12 -2
- package/dist/src/gateway/hono/routes/commands-skills.js +1 -0
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +46 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +23 -3
- package/dist/src/gateway/hono/routes/sessions.js +17 -20
- package/dist/src/gateway/hono/routes/tasks.js +25 -0
- package/dist/src/gateway/hono/routes/understanding-sources.d.ts +18 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +165 -36
- package/dist/src/gateway/hono/routes/work-discovery.js +13 -3
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/hono/routes/you.js +71 -4
- package/dist/src/gateway/service/agent-runner.d.ts +11 -2
- package/dist/src/gateway/service/agent-runner.js +27 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.d.ts +2 -0
- package/dist/src/gateway/service/run-gateway-agent.js +15 -9
- package/dist/src/gateway/service/session-input-coordinator.d.ts +8 -2
- package/dist/src/gateway/service/session-input-coordinator.js +62 -3
- package/dist/src/gateway/service/sessions-api.d.ts +10 -0
- package/dist/src/gateway/service/sessions-api.js +3 -0
- package/dist/src/gateway/service.d.ts +3 -2
- package/dist/src/gateway/service.js +27 -16
- package/dist/src/gateway/user-turn-input.d.ts +2 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +3 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.js +16 -3
- package/dist/src/knowledge/connected-knowledge-pipeline.d.ts +6 -0
- package/dist/src/knowledge/connected-knowledge-pipeline.js +35 -4
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +1 -1
- package/dist/src/knowledge/connected-understanding-pipeline.js +4 -2
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/retrieval/queryProfile.d.ts +3 -0
- package/dist/src/retrieval/queryProfile.js +20 -2
- package/dist/src/session/client-history.d.ts +11 -0
- package/dist/src/session/client-history.js +24 -2
- package/dist/src/session/config-types.d.ts +1 -1
- package/dist/src/session/session-title.js +2 -3
- package/dist/src/session/store.js +1 -0
- package/dist/src/session/transcript-outline.js +5 -2
- package/dist/src/session/types.d.ts +1 -0
- package/dist/src/session/user-message-display.d.ts +4 -0
- package/dist/src/session/user-message-display.js +22 -0
- package/dist/src/storage/sqlite/context-extraction-repository.d.ts +57 -0
- package/dist/src/storage/sqlite/context-extraction-repository.js +119 -0
- package/dist/src/storage/sqlite/context-relation-repository.d.ts +50 -0
- package/dist/src/storage/sqlite/context-relation-repository.js +97 -0
- package/dist/src/storage/sqlite/index.d.ts +6 -4
- package/dist/src/storage/sqlite/index.js +7 -5
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +5 -1
- package/dist/src/storage/sqlite/knowledge-repository.js +16 -1
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/memory-records-repository.js +21 -1
- package/dist/src/storage/sqlite/migrations/126_focus_context_governance.sql +72 -0
- package/dist/src/storage/sqlite/migrations/127_context_object_origin.sql +36 -0
- package/dist/src/storage/sqlite/migrations/128_context_extraction.sql +73 -0
- package/dist/src/storage/sqlite/migrations/129_focus_versions.sql +51 -0
- package/dist/src/storage/sqlite/migrations/130_context_evidence_provenance.sql +18 -0
- package/dist/src/storage/sqlite/migrations/131_session_input_contexts.sql +2 -0
- package/dist/src/storage/sqlite/migrations/132_transcript_source_context_metadata.sql +34 -0
- package/dist/src/storage/sqlite/migrations/133_archive_legacy_work_discovery_profile_facts.sql +11 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/session-input-repository.js +19 -7
- package/dist/src/storage/sqlite/session-repository.js +2 -2
- package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/session-turn-replace-repository.js +3 -2
- package/dist/src/storage/sqlite/transcript-repository.js +29 -3
- package/dist/src/storage/sqlite/user-context-repository.d.ts +4 -1
- package/dist/src/storage/sqlite/user-context-repository.js +65 -29
- package/dist/src/tasks/home-query-service.d.ts +14 -0
- package/dist/src/tasks/home-query-service.js +19 -2
- package/dist/src/tasks/index.d.ts +1 -0
- package/dist/src/tasks/index.js +2 -1
- package/dist/src/tasks/task-deletion-service.d.ts +21 -0
- package/dist/src/tasks/task-deletion-service.js +35 -0
- package/dist/src/tasks/task-repository.js +22 -1
- package/dist/src/tui/backends/embedded-backend.js +5 -3
- package/dist/src/tui/backends/gateway-realtime-backend.js +5 -3
- package/dist/src/tui/chat-history.js +2 -1
- package/dist/src/tui/tui-agent-events.js +4 -2
- package/dist/src/tui/tui-commands.d.ts +1 -0
- package/dist/src/tui/tui-commands.js +8 -3
- package/dist/src/tui/tui-empty-session-cleanup.d.ts +0 -1
- package/dist/src/tui/tui-empty-session-cleanup.js +1 -11
- package/dist/src/tui/tui-new-session-preferences.d.ts +10 -0
- package/dist/src/tui/tui-new-session-preferences.js +32 -0
- package/dist/src/tui/tui-session-actions.d.ts +1 -0
- package/dist/src/tui/tui-session-actions.js +2 -1
- package/dist/src/tui/tui-settings.d.ts +2 -0
- package/dist/src/tui/tui-settings.js +4 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui-types.d.ts +1 -0
- package/dist/src/tui/tui.js +58 -5
- package/dist/src/tunnel/frpc-process.js +3 -0
- package/dist/src/tunnel/tunnel-service.d.ts +2 -0
- package/dist/src/tunnel/tunnel-service.js +40 -28
- package/dist/src/user-context/consolidation.d.ts +1 -0
- package/dist/src/user-context/consolidation.js +62 -2
- package/dist/src/user-context/context-objects.d.ts +17 -0
- package/dist/src/user-context/context-objects.js +99 -0
- package/dist/src/user-context/domain.d.ts +13 -1
- package/dist/src/user-context/evaluation/harness.d.ts +13 -0
- package/dist/src/user-context/evaluation/harness.js +31 -0
- package/dist/src/user-context/extraction/registry.d.ts +26 -0
- package/dist/src/user-context/extraction/registry.js +113 -0
- package/dist/src/user-context/extraction/repair.d.ts +19 -0
- package/dist/src/user-context/extraction/repair.js +68 -0
- package/dist/src/user-context/focus-lifecycle.d.ts +2 -0
- package/dist/src/user-context/focus-lifecycle.js +26 -0
- package/dist/src/user-context/planner.js +252 -62
- package/dist/src/user-context/retriever.js +69 -9
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/processing-policy.d.ts +2 -0
- package/dist/src/user-context/sources/processing-policy.js +7 -0
- package/dist/src/user-context/sources/repository.d.ts +23 -4
- package/dist/src/user-context/sources/repository.js +122 -12
- package/dist/src/user-context/sources/types.d.ts +10 -1
- package/dist/src/user-context/understanding.js +1 -1
- package/dist/src/work-discovery/analyzer.js +6 -4
- package/dist/src/work-discovery/index.js +2 -2
- package/dist/src/work-discovery/service.d.ts +12 -3
- package/dist/src/work-discovery/service.js +183 -86
- package/dist/src/work-discovery/source-repository.d.ts +1 -0
- package/dist/src/work-discovery/source-repository.js +10 -4
- package/dist/src/work-discovery/types.d.ts +2 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-Dj86bHkl.js +0 -68
- package/dist/gateway/static/root/assets/app-management-settings-panel-D-M6GN-8.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-XDhmzdIc.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-sfO835uz.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-PptuZgoo.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BoCmzMFV.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DhkJsU8Z.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Dm7T61fE.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-dG6UFVqt.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DgJxfNyK.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-CT5yoSMD.js +0 -36
- package/dist/gateway/static/root/assets/connectors-page-BC6Ft9SU.js +0 -2
- package/dist/gateway/static/root/assets/dependency-picker-DZVSgLXH.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-Bw4cCFzI.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-Cbst7IXR.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-C1PAKSy2.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-api-Bch9vO6t.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DkDxZFGG.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DXNMxy5b.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CYcpVFNT.js +0 -1
- package/dist/gateway/static/root/assets/index-Dgb1R07E.css +0 -2
- package/dist/gateway/static/root/assets/index-DlOYwVFK.js +0 -108
- package/dist/gateway/static/root/assets/local-app-workbench-page-BFrgPwGE.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-CPweLw3k.js +0 -2
- package/dist/gateway/static/root/assets/messages-B9WQcZ1V.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-wieRAd1y.js +0 -4
- package/dist/gateway/static/root/assets/page-tabs-Bsluqyfb.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-BrpTWv44.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-Cww6V7HJ.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D0LKhCCw.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Sf4Pde6Z.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-S5gvgfu5.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-B3XvdEy8.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-CiGFtdD8.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CGU_Mxjr.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-k0UQ8WxO.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DQ1GvL1w.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-OuHd9GcN.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-CERqCsz2.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-BnRNL2sn.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-abEJNkCO.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnkaiky5.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-B_VlcKiK.js +0 -5
|
@@ -1,9 +1,67 @@
|
|
|
1
1
|
import { finishContextConsolidationRun, recordContextConsolidationDecision, startContextConsolidationRun } from "../storage/sqlite/context-consolidation-repository.js";
|
|
2
|
-
import { listUnderstandingEvidence, listUnderstandings, setUnderstandingStatus } from "../storage/sqlite/user-context-repository.js";
|
|
2
|
+
import { createUnderstanding, linkUnderstandingEvidence, listUnderstandingEvidence, listUnderstandings, setUnderstandingStatus } from "../storage/sqlite/user-context-repository.js";
|
|
3
3
|
import "../storage/sqlite/index.js";
|
|
4
4
|
//#region src/user-context/consolidation.ts
|
|
5
5
|
const USER_CONTEXT_CONSOLIDATION_TOKEN = "__xopc_user_context_consolidation__";
|
|
6
6
|
const USER_CONTEXT_CONSOLIDATION_AUTOMATION_ID = "system-user-context-consolidation";
|
|
7
|
+
const GLOBAL_CANDIDATE_KINDS = new Set(["preference", "routine"]);
|
|
8
|
+
function stricterSensitivity(items) {
|
|
9
|
+
const order = [
|
|
10
|
+
"normal",
|
|
11
|
+
"personal",
|
|
12
|
+
"secret",
|
|
13
|
+
"regulated"
|
|
14
|
+
];
|
|
15
|
+
return order[Math.max(...items.map((item) => order.indexOf(item.sensitivity)))] ?? "personal";
|
|
16
|
+
}
|
|
17
|
+
function stricterDisclosurePolicy(items) {
|
|
18
|
+
if (items.some((item) => item.disclosurePolicy === "silent")) return "silent";
|
|
19
|
+
if (items.some((item) => item.disclosurePolicy === "ask_before_reference")) return "ask_before_reference";
|
|
20
|
+
return "referenceable";
|
|
21
|
+
}
|
|
22
|
+
function createCrossProjectGlobalCandidates(minProjects) {
|
|
23
|
+
const all = listUnderstandings();
|
|
24
|
+
const existingGlobalKeys = new Set(all.filter((item) => item.scope.type === "global" && item.status !== "archived" && item.status !== "rejected").map((item) => item.canonicalKey));
|
|
25
|
+
const groups = /* @__PURE__ */ new Map();
|
|
26
|
+
for (const item of all) {
|
|
27
|
+
if (item.status !== "active" || item.scope.type !== "project" || !item.scope.id || !GLOBAL_CANDIDATE_KINDS.has(item.kind)) continue;
|
|
28
|
+
const normalizedStatement = item.statement.normalize("NFKC").toLocaleLowerCase().replace(/\s+/g, " ").trim();
|
|
29
|
+
const groupKey = `${item.canonicalKey}\u0000${normalizedStatement}`;
|
|
30
|
+
const group = groups.get(groupKey) ?? [];
|
|
31
|
+
group.push(item);
|
|
32
|
+
groups.set(groupKey, group);
|
|
33
|
+
}
|
|
34
|
+
let created = 0;
|
|
35
|
+
for (const items of groups.values()) {
|
|
36
|
+
const canonicalKey = items[0].canonicalKey;
|
|
37
|
+
const projectCount = new Set(items.map((item) => item.scope.id)).size;
|
|
38
|
+
if (projectCount < Math.max(2, minProjects) || existingGlobalKeys.has(canonicalKey)) continue;
|
|
39
|
+
const exemplar = [...items].sort((left, right) => right.confidence - left.confidence)[0];
|
|
40
|
+
const global = createUnderstanding({
|
|
41
|
+
kind: exemplar.kind,
|
|
42
|
+
canonicalKey,
|
|
43
|
+
status: "candidate",
|
|
44
|
+
scope: { type: "global" },
|
|
45
|
+
explicitness: "inferred",
|
|
46
|
+
durability: exemplar.durability,
|
|
47
|
+
sensitivity: stricterSensitivity(items),
|
|
48
|
+
disclosurePolicy: stricterDisclosurePolicy(items),
|
|
49
|
+
confidence: items.reduce((sum, item) => sum + item.confidence, 0) / items.length,
|
|
50
|
+
statement: exemplar.statement,
|
|
51
|
+
createdBy: "consolidation",
|
|
52
|
+
changeReason: `Repeated across ${projectCount} projects`
|
|
53
|
+
});
|
|
54
|
+
const linked = /* @__PURE__ */ new Set();
|
|
55
|
+
for (const item of items) for (const evidence of listUnderstandingEvidence(item.id, "supports")) {
|
|
56
|
+
if (linked.has(evidence.id)) continue;
|
|
57
|
+
linkUnderstandingEvidence(global.versionId, evidence.id, "supports", item.confidence);
|
|
58
|
+
linked.add(evidence.id);
|
|
59
|
+
}
|
|
60
|
+
existingGlobalKeys.add(canonicalKey);
|
|
61
|
+
created += 1;
|
|
62
|
+
}
|
|
63
|
+
return created;
|
|
64
|
+
}
|
|
7
65
|
function distinctEvidenceCount(understandingId, relation) {
|
|
8
66
|
return new Set(listUnderstandingEvidence(understandingId, relation).map((evidence) => `${evidence.sourceType}:${evidence.sourceInstanceId ?? ""}:${evidence.sourceRef}`)).size;
|
|
9
67
|
}
|
|
@@ -29,7 +87,8 @@ async function runContextConsolidation(input) {
|
|
|
29
87
|
const metrics = {
|
|
30
88
|
scanned: 0,
|
|
31
89
|
needsReview: 0,
|
|
32
|
-
stale: 0
|
|
90
|
+
stale: 0,
|
|
91
|
+
globalCandidates: 0
|
|
33
92
|
};
|
|
34
93
|
try {
|
|
35
94
|
const understandings = listUnderstandings(["candidate", "active"]).slice(0, resolved.limit);
|
|
@@ -89,6 +148,7 @@ async function runContextConsolidation(input) {
|
|
|
89
148
|
metrics.needsReview += 1;
|
|
90
149
|
}
|
|
91
150
|
}
|
|
151
|
+
metrics.globalCandidates = createCrossProjectGlobalCandidates(resolved.minEvidenceSources);
|
|
92
152
|
return {
|
|
93
153
|
run: finishContextConsolidationRun({
|
|
94
154
|
runId: run.runId,
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { hasIndependentExtractionOutput, listContextExtractionOutputs, listContextExtractionRuns } from "../../storage/sqlite/context-extraction-repository.js";
|
|
2
|
+
import { getUnderstanding, setUnderstandingStatus } from "../../storage/sqlite/user-context-repository.js";
|
|
3
|
+
import "../../storage/sqlite/index.js";
|
|
4
|
+
import { listUserFocuses, updateUserFocus } from "../sources/repository.js";
|
|
5
|
+
//#region src/user-context/extraction/repair.ts
|
|
6
|
+
function repairExtractedContext(filter) {
|
|
7
|
+
const runs = listContextExtractionRuns({
|
|
8
|
+
...filter.sourceRef ? { sourceRef: filter.sourceRef } : {},
|
|
9
|
+
...filter.extractorId ? { extractorId: filter.extractorId } : {},
|
|
10
|
+
...filter.extractorVersion ? { extractorVersion: filter.extractorVersion } : {},
|
|
11
|
+
limit: 500
|
|
12
|
+
}).filter((run) => !filter.runId || run.id === filter.runId);
|
|
13
|
+
const repaired = [];
|
|
14
|
+
const retained = [];
|
|
15
|
+
const seen = /* @__PURE__ */ new Set();
|
|
16
|
+
const targetRunIds = runs.map((run) => run.id);
|
|
17
|
+
for (const run of runs) for (const output of listContextExtractionOutputs(run.id)) {
|
|
18
|
+
if (output.objectType !== "focus" && output.objectType !== "understanding" || !output.objectId) continue;
|
|
19
|
+
if (filter.objectVersionId && output.versionId !== filter.objectVersionId) continue;
|
|
20
|
+
const key = `${output.objectType}:${output.objectId}`;
|
|
21
|
+
if (seen.has(key)) continue;
|
|
22
|
+
seen.add(key);
|
|
23
|
+
if (hasIndependentExtractionOutput(targetRunIds, output.objectType, output.objectId)) {
|
|
24
|
+
retained.push({
|
|
25
|
+
objectType: output.objectType,
|
|
26
|
+
objectId: output.objectId,
|
|
27
|
+
reason: "independent_extraction"
|
|
28
|
+
});
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (output.objectType === "understanding") {
|
|
32
|
+
const understanding = getUnderstanding(output.objectId);
|
|
33
|
+
if (!understanding) continue;
|
|
34
|
+
if (understanding.explicitness === "explicit") {
|
|
35
|
+
retained.push({
|
|
36
|
+
objectType: "understanding",
|
|
37
|
+
objectId: output.objectId,
|
|
38
|
+
reason: "user_explicit"
|
|
39
|
+
});
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
setUnderstandingStatus(output.objectId, "archived");
|
|
43
|
+
} else {
|
|
44
|
+
const focus = listUserFocuses().find((item) => item.id === output.objectId);
|
|
45
|
+
if (!focus) continue;
|
|
46
|
+
if (focus.explicitness === "explicit") {
|
|
47
|
+
retained.push({
|
|
48
|
+
objectType: "focus",
|
|
49
|
+
objectId: output.objectId,
|
|
50
|
+
reason: "user_explicit"
|
|
51
|
+
});
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
updateUserFocus(output.objectId, { status: "paused" });
|
|
55
|
+
}
|
|
56
|
+
repaired.push({
|
|
57
|
+
objectType: output.objectType,
|
|
58
|
+
objectId: output.objectId
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
runIds: runs.map((run) => run.id),
|
|
63
|
+
repaired,
|
|
64
|
+
retained
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { repairExtractedContext };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/user-context/focus-lifecycle.ts
|
|
2
|
+
const DAY_MS = 1440 * 60 * 1e3;
|
|
3
|
+
const HORIZON_DAYS = {
|
|
4
|
+
current: {
|
|
5
|
+
review: 14,
|
|
6
|
+
valid: 30
|
|
7
|
+
},
|
|
8
|
+
ongoing: {
|
|
9
|
+
review: 30,
|
|
10
|
+
valid: 120
|
|
11
|
+
},
|
|
12
|
+
long_term: {
|
|
13
|
+
review: 90,
|
|
14
|
+
valid: 365
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
function focusLifecycle(horizon, now = Date.now()) {
|
|
18
|
+
const days = HORIZON_DAYS[horizon];
|
|
19
|
+
return {
|
|
20
|
+
validFrom: now,
|
|
21
|
+
reviewAt: now + days.review * DAY_MS,
|
|
22
|
+
validTo: now + days.valid * DAY_MS
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { focusLifecycle };
|