@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
|
@@ -6,7 +6,11 @@ import { ActivityService } from "../activity/service.js";
|
|
|
6
6
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
7
7
|
import { buildSessionKey, init_session_key } from "../routing/session-key.js";
|
|
8
8
|
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
9
|
-
import {
|
|
9
|
+
import { init_providers, resolveModel } from "../providers/index.js";
|
|
10
|
+
import { isLocalModelBaseUrl } from "../providers/model-call.js";
|
|
11
|
+
import { createUnderstandingSourceRun, getUnderstandingSourceRun, updateUnderstandingSourceGrantCheckpoint, updateUnderstandingSourceGrantPolicies, updateUnderstandingSourceRun, upsertUnderstandingSourceGrant, upsertUserFocus } from "../user-context/sources/repository.js";
|
|
12
|
+
import { focusLifecycle } from "../user-context/focus-lifecycle.js";
|
|
13
|
+
import { allowsRemoteSourceProcessing } from "../user-context/sources/processing-policy.js";
|
|
10
14
|
import { analyzeUnderstandingSources, analyzeWorkContext, workDiscoveryResultMarkdown } from "./analyzer.js";
|
|
11
15
|
import { previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, summarizeWorkContextSnapshot } from "./probe.js";
|
|
12
16
|
import { clusterActivityTopics } from "../user-context/sources/activity-clustering.js";
|
|
@@ -22,14 +26,141 @@ import { getWorkDiscoveryDirectorySource, listWorkDiscoveryDirectorySources, rev
|
|
|
22
26
|
import { createHash, randomUUID } from "node:crypto";
|
|
23
27
|
//#region src/work-discovery/service.ts
|
|
24
28
|
init_schema();
|
|
29
|
+
init_providers();
|
|
25
30
|
init_session_key();
|
|
26
31
|
init_resolve_route();
|
|
27
32
|
init_logger();
|
|
28
33
|
const log = createLogger("WorkDiscovery");
|
|
34
|
+
const MAX_UNDERSTANDING_ITEMS = 150;
|
|
35
|
+
const MAX_UNDERSTANDING_INPUT_ITEMS = 1200;
|
|
36
|
+
const MAX_UNDERSTANDING_ITEM_CHARS = 12e3;
|
|
37
|
+
const MAX_UNDERSTANDING_TOTAL_CHARS = 3e5;
|
|
38
|
+
function modelProcessingTarget(config) {
|
|
39
|
+
const modelRef = getAgentDefaultModelRef(config);
|
|
40
|
+
if (!modelRef) throw new Error("No default model configured");
|
|
41
|
+
const model = resolveModel(modelRef);
|
|
42
|
+
return {
|
|
43
|
+
provider: model.provider,
|
|
44
|
+
remoteModel: !isLocalModelBaseUrl(model.baseUrl)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function fairTextBudgets(lengths, budget) {
|
|
48
|
+
const allocations = lengths.map(() => 0);
|
|
49
|
+
let remaining = budget;
|
|
50
|
+
let active = lengths.map((length, index) => ({
|
|
51
|
+
length,
|
|
52
|
+
index
|
|
53
|
+
})).filter((item) => item.length > 0);
|
|
54
|
+
while (remaining > 0 && active.length > 0) {
|
|
55
|
+
const share = Math.max(1, Math.floor(remaining / active.length));
|
|
56
|
+
const next = [];
|
|
57
|
+
for (const item of active) {
|
|
58
|
+
const needed = item.length - allocations[item.index];
|
|
59
|
+
const granted = Math.min(needed, share, remaining);
|
|
60
|
+
allocations[item.index] = allocations[item.index] + granted;
|
|
61
|
+
remaining -= granted;
|
|
62
|
+
if (allocations[item.index] < item.length) next.push(item);
|
|
63
|
+
if (remaining === 0) break;
|
|
64
|
+
}
|
|
65
|
+
active = next;
|
|
66
|
+
}
|
|
67
|
+
return allocations;
|
|
68
|
+
}
|
|
69
|
+
/** Sanitize and round-robin local sources so one verbose source cannot starve the rest. */
|
|
70
|
+
function normalizeUnderstandingSourceItems(rawItems) {
|
|
71
|
+
const itemTypes = new Set([
|
|
72
|
+
"document",
|
|
73
|
+
"calendar_event",
|
|
74
|
+
"task",
|
|
75
|
+
"note",
|
|
76
|
+
"mail",
|
|
77
|
+
"message",
|
|
78
|
+
"code_activity",
|
|
79
|
+
"bookmark"
|
|
80
|
+
]);
|
|
81
|
+
const ownerAttributions = new Set([
|
|
82
|
+
"user",
|
|
83
|
+
"other",
|
|
84
|
+
"shared",
|
|
85
|
+
"unknown"
|
|
86
|
+
]);
|
|
87
|
+
const sensitivities = new Set([
|
|
88
|
+
"normal",
|
|
89
|
+
"personal",
|
|
90
|
+
"secret",
|
|
91
|
+
"regulated"
|
|
92
|
+
]);
|
|
93
|
+
const sanitized = rawItems.slice(0, MAX_UNDERSTANDING_INPUT_ITEMS).flatMap((value) => {
|
|
94
|
+
if (!value || typeof value !== "object") return [];
|
|
95
|
+
const raw = value;
|
|
96
|
+
const id = typeof raw.id === "string" ? raw.id.trim().slice(0, 500) : "";
|
|
97
|
+
const sourceId = typeof raw.sourceId === "string" ? raw.sourceId.trim().slice(0, 200) : "";
|
|
98
|
+
const title = typeof raw.title === "string" ? raw.title.trim().slice(0, 300) : "";
|
|
99
|
+
const type = typeof raw.type === "string" && itemTypes.has(raw.type) ? raw.type : null;
|
|
100
|
+
const evidenceRef = typeof raw.evidenceRef === "string" ? raw.evidenceRef.trim().slice(0, 1e3) : "";
|
|
101
|
+
const ownerAttribution = typeof raw.ownerAttribution === "string" && ownerAttributions.has(raw.ownerAttribution) ? raw.ownerAttribution : "unknown";
|
|
102
|
+
const sensitivity = typeof raw.sensitivity === "string" && sensitivities.has(raw.sensitivity) ? raw.sensitivity : "personal";
|
|
103
|
+
if (!id || !isLocalUnderstandingSourceId(sourceId) || !title || !type || !evidenceRef.startsWith(`${sourceId}://`) || sensitivity === "secret" || sensitivity === "regulated") return [];
|
|
104
|
+
const timestamp = (key) => {
|
|
105
|
+
const candidate = raw[key];
|
|
106
|
+
return typeof candidate === "number" && Number.isFinite(candidate) ? candidate : void 0;
|
|
107
|
+
};
|
|
108
|
+
const resourceUri = (() => {
|
|
109
|
+
if (typeof raw.resourceUri !== "string") return void 0;
|
|
110
|
+
try {
|
|
111
|
+
const url = new URL(raw.resourceUri.trim());
|
|
112
|
+
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash || url.pathname && url.pathname !== "/") return void 0;
|
|
113
|
+
return url.origin.slice(0, 1e3);
|
|
114
|
+
} catch {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
})();
|
|
118
|
+
const text = typeof raw.text === "string" ? raw.text.trim().slice(0, MAX_UNDERSTANDING_ITEM_CHARS) : "";
|
|
119
|
+
return [{
|
|
120
|
+
id,
|
|
121
|
+
sourceId,
|
|
122
|
+
type,
|
|
123
|
+
title,
|
|
124
|
+
ownerAttribution,
|
|
125
|
+
sensitivity,
|
|
126
|
+
evidenceRef,
|
|
127
|
+
...text ? { text } : {},
|
|
128
|
+
...typeof raw.group === "string" && raw.group.trim() ? { group: raw.group.trim().slice(0, 200) } : {},
|
|
129
|
+
...resourceUri ? { resourceUri } : {},
|
|
130
|
+
...timestamp("occurredAt") != null ? { occurredAt: timestamp("occurredAt") } : {},
|
|
131
|
+
...timestamp("modifiedAt") != null ? { modifiedAt: timestamp("modifiedAt") } : {},
|
|
132
|
+
...timestamp("startsAt") != null ? { startsAt: timestamp("startsAt") } : {},
|
|
133
|
+
...timestamp("endsAt") != null ? { endsAt: timestamp("endsAt") } : {}
|
|
134
|
+
}];
|
|
135
|
+
});
|
|
136
|
+
const bySource = /* @__PURE__ */ new Map();
|
|
137
|
+
for (const item of sanitized) bySource.set(item.sourceId, [...bySource.get(item.sourceId) ?? [], item]);
|
|
138
|
+
const selected = [];
|
|
139
|
+
let round = 0;
|
|
140
|
+
while (selected.length < MAX_UNDERSTANDING_ITEMS) {
|
|
141
|
+
let added = false;
|
|
142
|
+
for (const sourceItems of bySource.values()) {
|
|
143
|
+
const item = sourceItems[round];
|
|
144
|
+
if (!item) continue;
|
|
145
|
+
selected.push(item);
|
|
146
|
+
added = true;
|
|
147
|
+
if (selected.length === MAX_UNDERSTANDING_ITEMS) break;
|
|
148
|
+
}
|
|
149
|
+
if (!added) break;
|
|
150
|
+
round += 1;
|
|
151
|
+
}
|
|
152
|
+
const budgets = fairTextBudgets(selected.map((item) => item.text?.length ?? 0), MAX_UNDERSTANDING_TOTAL_CHARS);
|
|
153
|
+
return selected.map((item, index) => {
|
|
154
|
+
const text = item.text?.slice(0, budgets[index]);
|
|
155
|
+
return {
|
|
156
|
+
...item,
|
|
157
|
+
...text ? { text } : { text: void 0 }
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
}
|
|
29
161
|
function understandingKind(category) {
|
|
30
162
|
if (category === "preference") return "preference";
|
|
31
|
-
if (category === "
|
|
32
|
-
if (category === "focus") return "current_state";
|
|
163
|
+
if (category === "routine") return "routine";
|
|
33
164
|
return "project_context";
|
|
34
165
|
}
|
|
35
166
|
function understandingKey(candidate) {
|
|
@@ -56,7 +187,7 @@ function persistUnderstandingCandidate(candidate, scope, sourceRef) {
|
|
|
56
187
|
status: "candidate",
|
|
57
188
|
scope,
|
|
58
189
|
explicitness: "inferred",
|
|
59
|
-
durability: candidate.category === "
|
|
190
|
+
durability: candidate.category === "routine" ? "recurring" : "durable",
|
|
60
191
|
sensitivity: "normal",
|
|
61
192
|
disclosurePolicy: "referenceable",
|
|
62
193
|
confidence: candidate.confidence === "high" ? .9 : candidate.confidence === "medium" ? .72 : .58,
|
|
@@ -174,12 +305,17 @@ var WorkDiscoveryService = class {
|
|
|
174
305
|
listDirectorySources() {
|
|
175
306
|
return listWorkDiscoveryDirectorySources();
|
|
176
307
|
}
|
|
177
|
-
|
|
308
|
+
getModelProcessingTarget() {
|
|
309
|
+
return modelProcessingTarget(this.options.getConfig());
|
|
310
|
+
}
|
|
311
|
+
async grantDirectorySource(rootPath, processingPolicy) {
|
|
178
312
|
const preview = await previewWorkDiscoveryRoot(rootPath);
|
|
313
|
+
const target = this.getModelProcessingTarget();
|
|
179
314
|
return upsertWorkDiscoveryDirectorySource({
|
|
180
315
|
rootPath: preview.canonicalRootPath,
|
|
181
316
|
displayName: preview.displayName,
|
|
182
|
-
fingerprint: preview.fingerprint
|
|
317
|
+
fingerprint: preview.fingerprint,
|
|
318
|
+
processingPolicy: target.remoteModel ? processingPolicy : "local_only"
|
|
183
319
|
});
|
|
184
320
|
}
|
|
185
321
|
async checkDirectorySources() {
|
|
@@ -243,75 +379,11 @@ var WorkDiscoveryService = class {
|
|
|
243
379
|
revokeDirectorySource(id) {
|
|
244
380
|
return revokeWorkDiscoveryDirectorySource(id);
|
|
245
381
|
}
|
|
246
|
-
async importUnderstandingSources(rawItems, signal, runId, rawCheckpoints) {
|
|
247
|
-
|
|
248
|
-
const itemTypes = new Set([
|
|
249
|
-
"document",
|
|
250
|
-
"calendar_event",
|
|
251
|
-
"task",
|
|
252
|
-
"note",
|
|
253
|
-
"mail",
|
|
254
|
-
"message",
|
|
255
|
-
"code_activity",
|
|
256
|
-
"bookmark"
|
|
257
|
-
]);
|
|
258
|
-
const ownerAttributions = new Set([
|
|
259
|
-
"user",
|
|
260
|
-
"other",
|
|
261
|
-
"shared",
|
|
262
|
-
"unknown"
|
|
263
|
-
]);
|
|
264
|
-
const sensitivities = new Set([
|
|
265
|
-
"normal",
|
|
266
|
-
"personal",
|
|
267
|
-
"secret",
|
|
268
|
-
"regulated"
|
|
269
|
-
]);
|
|
270
|
-
const items = rawItems.flatMap((value) => {
|
|
271
|
-
if (!value || typeof value !== "object" || remaining <= 0) return [];
|
|
272
|
-
const raw = value;
|
|
273
|
-
const id = typeof raw.id === "string" ? raw.id.trim().slice(0, 500) : "";
|
|
274
|
-
const sourceId = typeof raw.sourceId === "string" ? raw.sourceId.trim().slice(0, 200) : "";
|
|
275
|
-
const title = typeof raw.title === "string" ? raw.title.trim().slice(0, 300) : "";
|
|
276
|
-
const type = typeof raw.type === "string" && itemTypes.has(raw.type) ? raw.type : null;
|
|
277
|
-
const evidenceRef = typeof raw.evidenceRef === "string" ? raw.evidenceRef.trim().slice(0, 1e3) : "";
|
|
278
|
-
const ownerAttribution = typeof raw.ownerAttribution === "string" && ownerAttributions.has(raw.ownerAttribution) ? raw.ownerAttribution : "unknown";
|
|
279
|
-
const sensitivity = typeof raw.sensitivity === "string" && sensitivities.has(raw.sensitivity) ? raw.sensitivity : "personal";
|
|
280
|
-
if (!id || !isLocalUnderstandingSourceId(sourceId) || !title || !type || !evidenceRef.startsWith(`${sourceId}://`) || sensitivity === "secret" || sensitivity === "regulated") return [];
|
|
281
|
-
const text = typeof raw.text === "string" ? raw.text.trim().slice(0, Math.min(12e3, remaining)) : "";
|
|
282
|
-
remaining -= text.length;
|
|
283
|
-
const timestamp = (key) => {
|
|
284
|
-
const candidate = raw[key];
|
|
285
|
-
return typeof candidate === "number" && Number.isFinite(candidate) ? candidate : void 0;
|
|
286
|
-
};
|
|
287
|
-
const resourceUri = (() => {
|
|
288
|
-
if (typeof raw.resourceUri !== "string") return void 0;
|
|
289
|
-
try {
|
|
290
|
-
const url = new URL(raw.resourceUri.trim());
|
|
291
|
-
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash || url.pathname && url.pathname !== "/") return void 0;
|
|
292
|
-
return url.origin.slice(0, 1e3);
|
|
293
|
-
} catch {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
})();
|
|
297
|
-
return [{
|
|
298
|
-
id,
|
|
299
|
-
sourceId,
|
|
300
|
-
type,
|
|
301
|
-
title,
|
|
302
|
-
ownerAttribution,
|
|
303
|
-
sensitivity,
|
|
304
|
-
evidenceRef,
|
|
305
|
-
...text ? { text } : {},
|
|
306
|
-
...typeof raw.group === "string" && raw.group.trim() ? { group: raw.group.trim().slice(0, 200) } : {},
|
|
307
|
-
...resourceUri ? { resourceUri } : {},
|
|
308
|
-
...timestamp("occurredAt") != null ? { occurredAt: timestamp("occurredAt") } : {},
|
|
309
|
-
...timestamp("modifiedAt") != null ? { modifiedAt: timestamp("modifiedAt") } : {},
|
|
310
|
-
...timestamp("startsAt") != null ? { startsAt: timestamp("startsAt") } : {},
|
|
311
|
-
...timestamp("endsAt") != null ? { endsAt: timestamp("endsAt") } : {}
|
|
312
|
-
}];
|
|
313
|
-
}).slice(0, 150);
|
|
382
|
+
async importUnderstandingSources(rawItems, processingPolicy, signal, runId, rawCheckpoints) {
|
|
383
|
+
const items = normalizeUnderstandingSourceItems(rawItems);
|
|
314
384
|
if (!items.length) throw new Error("No readable understanding source items were provided");
|
|
385
|
+
const target = this.getModelProcessingTarget();
|
|
386
|
+
const effectiveProcessingPolicy = target.remoteModel ? processingPolicy : "local_only";
|
|
315
387
|
const checkpoints = /* @__PURE__ */ new Map();
|
|
316
388
|
for (const [sourceId, value] of Object.entries(rawCheckpoints ?? {})) {
|
|
317
389
|
if (!isLocalUnderstandingSourceId(sourceId) || !value || typeof value !== "object") continue;
|
|
@@ -329,7 +401,7 @@ var WorkDiscoveryService = class {
|
|
|
329
401
|
const sourceItems = items.filter((item) => item.sourceId === sourceId);
|
|
330
402
|
const category = sourceItems.some((item) => item.type === "calendar_event") ? "calendar" : sourceItems.some((item) => item.type === "task") ? "tasks" : sourceItems.some((item) => item.type === "note") ? "notes" : sourceItems.some((item) => item.type === "mail") ? "mail" : sourceItems.some((item) => item.type === "message") ? "messages" : sourceItems.some((item) => item.type === "code_activity") ? "code_activity" : "recent_documents";
|
|
331
403
|
const platform = sourceId.startsWith("apple-") ? "darwin" : sourceId.startsWith("windows-") ? "win32" : sourceId.startsWith("linux-") ? "linux" : "all";
|
|
332
|
-
|
|
404
|
+
let grant = upsertUnderstandingSourceGrant({
|
|
333
405
|
sourceKey: `understanding-source:${sourceId}`,
|
|
334
406
|
adapterId: sourceId,
|
|
335
407
|
category,
|
|
@@ -337,9 +409,10 @@ var WorkDiscoveryService = class {
|
|
|
337
409
|
displayName: sourceId,
|
|
338
410
|
accessMode: "once",
|
|
339
411
|
retentionPolicy: "derived_only",
|
|
340
|
-
processingPolicy:
|
|
412
|
+
processingPolicy: effectiveProcessingPolicy,
|
|
341
413
|
config: { readOnly: true }
|
|
342
414
|
});
|
|
415
|
+
if (grant.processingPolicy !== effectiveProcessingPolicy) grant = updateUnderstandingSourceGrantPolicies(grant.id, { processingPolicy: effectiveProcessingPolicy }) ?? grant;
|
|
343
416
|
sourceGrants.set(sourceId, grant);
|
|
344
417
|
const checkpoint = checkpoints.get(sourceId);
|
|
345
418
|
const previousFingerprint = typeof grant.checkpoint.fingerprint === "string" ? grant.checkpoint.fingerprint : void 0;
|
|
@@ -393,7 +466,7 @@ var WorkDiscoveryService = class {
|
|
|
393
466
|
const linkedRun = runId ? getWorkDiscoveryRun(runId) : null;
|
|
394
467
|
let analysis;
|
|
395
468
|
try {
|
|
396
|
-
analysis = await analyzeUnderstandingSources({
|
|
469
|
+
analysis = !target.remoteModel || allowsRemoteSourceProcessing([...changedSourceIds].map((sourceId) => sourceGrants.get(sourceId)?.processingPolicy ?? "local_only")) ? await analyzeUnderstandingSources({
|
|
397
470
|
config: this.options.getConfig(),
|
|
398
471
|
items: analysisItems,
|
|
399
472
|
...linkedRun?.result ? { workContext: {
|
|
@@ -403,7 +476,15 @@ var WorkDiscoveryService = class {
|
|
|
403
476
|
workThreads: linkedRun.result.workThreads
|
|
404
477
|
} } : {},
|
|
405
478
|
signal
|
|
406
|
-
})
|
|
479
|
+
}) : {
|
|
480
|
+
modelRef: "local-only",
|
|
481
|
+
profileCandidates: [],
|
|
482
|
+
workThreadCandidates: [],
|
|
483
|
+
sourceStatuses: [...changedSourceIds].map((sourceId) => ({
|
|
484
|
+
sourceId,
|
|
485
|
+
status: "completed"
|
|
486
|
+
}))
|
|
487
|
+
};
|
|
407
488
|
const statusBySource = new Map(analysis.sourceStatuses.map((item) => [item.sourceId, item]));
|
|
408
489
|
for (const [sourceId, sourceRunId] of sourceRuns) {
|
|
409
490
|
if (!changedSourceIds.has(sourceId)) continue;
|
|
@@ -526,7 +607,8 @@ var WorkDiscoveryService = class {
|
|
|
526
607
|
status: "candidate",
|
|
527
608
|
confidence: topic.confidence,
|
|
528
609
|
evidenceRefs: topic.evidenceRefs,
|
|
529
|
-
sourceRunId: sourceRuns.get(topic.sourceIds[0] ?? "")
|
|
610
|
+
sourceRunId: sourceRuns.get(topic.sourceIds[0] ?? ""),
|
|
611
|
+
...focusLifecycle(topic.horizon)
|
|
530
612
|
}));
|
|
531
613
|
const modelFocuses = safeWorkThreadCandidates.filter((candidate) => !candidate.evidenceRefs.some((ref) => activityEvidence.has(ref))).map((candidate) => upsertUserFocus({
|
|
532
614
|
canonicalKey: `source-focus:${candidate.topicKey}`,
|
|
@@ -536,7 +618,8 @@ var WorkDiscoveryService = class {
|
|
|
536
618
|
status: "candidate",
|
|
537
619
|
confidence: candidate.confidence === "high" ? .9 : candidate.confidence === "medium" ? .72 : .55,
|
|
538
620
|
evidenceRefs: candidate.evidenceRefs,
|
|
539
|
-
sourceRunId: sourceRuns.get(candidate.evidenceRefs[0]?.split("://", 1)[0] ?? "")
|
|
621
|
+
sourceRunId: sourceRuns.get(candidate.evidenceRefs[0]?.split("://", 1)[0] ?? ""),
|
|
622
|
+
...focusLifecycle(candidate.horizon)
|
|
540
623
|
}));
|
|
541
624
|
const focuses = [...activityFocuses, ...modelFocuses];
|
|
542
625
|
log.info({
|
|
@@ -570,7 +653,8 @@ var WorkDiscoveryService = class {
|
|
|
570
653
|
upsertWorkDiscoveryDirectorySource({
|
|
571
654
|
rootPath: preview.canonicalRootPath,
|
|
572
655
|
displayName: preview.displayName,
|
|
573
|
-
fingerprint: preview.fingerprint
|
|
656
|
+
fingerprint: preview.fingerprint,
|
|
657
|
+
processingPolicy: source.processingPolicy
|
|
574
658
|
});
|
|
575
659
|
return this.startRun({
|
|
576
660
|
rootPath: preview.canonicalRootPath,
|
|
@@ -582,6 +666,7 @@ var WorkDiscoveryService = class {
|
|
|
582
666
|
const candidates = await this.discoverCandidates();
|
|
583
667
|
const primary = candidates[0];
|
|
584
668
|
if (!primary) throw new Error("No accessible work projects were found");
|
|
669
|
+
await this.grantDirectorySource(primary.rootPath, input.processingPolicy);
|
|
585
670
|
return this.startRun({
|
|
586
671
|
rootPath: primary.rootPath,
|
|
587
672
|
source: "onboarding_selected_directory",
|
|
@@ -596,6 +681,9 @@ var WorkDiscoveryService = class {
|
|
|
596
681
|
const modelRef = getAgentDefaultModelRef(config);
|
|
597
682
|
if (!modelRef) throw new Error("No default model configured");
|
|
598
683
|
const rootPath = (await previewWorkDiscoveryRoot(input.rootPath)).canonicalRootPath;
|
|
684
|
+
const approvedSource = listWorkDiscoveryDirectorySources().find((source) => source.rootPath === rootPath && source.status === "active");
|
|
685
|
+
if (!approvedSource) throw new Error("Selected folder must be approved before analysis");
|
|
686
|
+
if (modelProcessingTarget(config).remoteModel && approvedSource.processingPolicy !== "remote_allowed") throw new Error("Remote model analysis requires explicit processing permission for this folder");
|
|
599
687
|
const agentId = getDefaultAgentId(config);
|
|
600
688
|
const match = this.options.projects.resolveOrCreateForWorkspacePath({
|
|
601
689
|
workspacePath: rootPath,
|
|
@@ -785,8 +873,12 @@ var WorkDiscoveryService = class {
|
|
|
785
873
|
horizon: thread.horizon,
|
|
786
874
|
status: "candidate",
|
|
787
875
|
confidence: thread.confidence,
|
|
788
|
-
|
|
789
|
-
|
|
876
|
+
scope: {
|
|
877
|
+
type: "project",
|
|
878
|
+
id: run.projectId
|
|
879
|
+
},
|
|
880
|
+
evidenceRefs: thread.evidenceIds,
|
|
881
|
+
...focusLifecycle(thread.horizon)
|
|
790
882
|
}));
|
|
791
883
|
const result = this.persistProfileCandidates(run, {
|
|
792
884
|
...baseResult,
|
|
@@ -1020,8 +1112,13 @@ var WorkDiscoveryService = class {
|
|
|
1020
1112
|
horizon: "current",
|
|
1021
1113
|
status: "active",
|
|
1022
1114
|
confidence: 1,
|
|
1023
|
-
|
|
1024
|
-
|
|
1115
|
+
scope: {
|
|
1116
|
+
type: "project",
|
|
1117
|
+
id: run.projectId
|
|
1118
|
+
},
|
|
1119
|
+
explicitness: "explicit",
|
|
1120
|
+
evidenceRefs: [`session://${createHash("sha256").update(run.sessionKey).digest("hex").slice(0, 16)}/recognition`],
|
|
1121
|
+
...focusLifecycle("current")
|
|
1025
1122
|
});
|
|
1026
1123
|
const investigation = getWorkUnderstandingInvestigationForRun(run.id);
|
|
1027
1124
|
if (investigation && input.decision !== "dismissed") {
|
|
@@ -1126,4 +1223,4 @@ var WorkDiscoveryService = class {
|
|
|
1126
1223
|
}
|
|
1127
1224
|
};
|
|
1128
1225
|
//#endregion
|
|
1129
|
-
export { WorkDiscoveryService };
|
|
1226
|
+
export { WorkDiscoveryService, normalizeUnderstandingSourceItems };
|
|
@@ -7,6 +7,7 @@ export declare function upsertWorkDiscoveryDirectorySource(input: {
|
|
|
7
7
|
rootPath: string;
|
|
8
8
|
displayName: string;
|
|
9
9
|
fingerprint?: WorkDiscoveryPreview['fingerprint'];
|
|
10
|
+
processingPolicy?: 'local_only' | 'remote_allowed';
|
|
10
11
|
scanned?: boolean;
|
|
11
12
|
nowMs?: number;
|
|
12
13
|
}): WorkDiscoveryDirectorySource;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getUnderstandingSourceGrant, listUnderstandingSourceGrants, revokeUnderstandingSourceGrant, upsertUnderstandingSourceGrant } from "../user-context/sources/repository.js";
|
|
1
|
+
import { getUnderstandingSourceGrant, listUnderstandingSourceGrants, revokeUnderstandingSourceGrant, updateUnderstandingSourceGrantPolicies, upsertUnderstandingSourceGrant } from "../user-context/sources/repository.js";
|
|
2
2
|
//#region src/work-discovery/source-repository.ts
|
|
3
3
|
const ADAPTER_ID = "local-work-folders";
|
|
4
4
|
function fingerprint(value) {
|
|
@@ -15,6 +15,7 @@ function directorySource(grant) {
|
|
|
15
15
|
displayName: grant.displayName,
|
|
16
16
|
status: grant.status,
|
|
17
17
|
scope: { readOnly: true },
|
|
18
|
+
processingPolicy: grant.processingPolicy,
|
|
18
19
|
...fingerprint(grant.checkpoint) ? { fingerprint: fingerprint(grant.checkpoint) } : {},
|
|
19
20
|
...grant.lastCollectedAt != null ? { lastScannedAt: grant.lastCollectedAt } : {},
|
|
20
21
|
createdAt: grant.createdAt,
|
|
@@ -32,7 +33,7 @@ function getWorkDiscoveryDirectorySource(id) {
|
|
|
32
33
|
}
|
|
33
34
|
function upsertWorkDiscoveryDirectorySource(input) {
|
|
34
35
|
const existing = listUnderstandingSourceGrants({ includeRevoked: true }).find((grant) => grant.adapterId === ADAPTER_ID && grant.config.rootPath === input.rootPath);
|
|
35
|
-
|
|
36
|
+
let grant = upsertUnderstandingSourceGrant({
|
|
36
37
|
sourceKey: `local-work-folder:${input.rootPath}`,
|
|
37
38
|
adapterId: ADAPTER_ID,
|
|
38
39
|
category: "files",
|
|
@@ -40,7 +41,7 @@ function upsertWorkDiscoveryDirectorySource(input) {
|
|
|
40
41
|
displayName: input.displayName,
|
|
41
42
|
accessMode: "continuous",
|
|
42
43
|
retentionPolicy: "derived_only",
|
|
43
|
-
processingPolicy: "
|
|
44
|
+
processingPolicy: input.processingPolicy ?? existing?.processingPolicy ?? "local_only",
|
|
44
45
|
config: {
|
|
45
46
|
rootPath: input.rootPath,
|
|
46
47
|
readOnly: true
|
|
@@ -51,7 +52,12 @@ function upsertWorkDiscoveryDirectorySource(input) {
|
|
|
51
52
|
} : existing?.checkpoint,
|
|
52
53
|
...input.scanned ? { lastCollectedAt: input.nowMs ?? Date.now() } : {},
|
|
53
54
|
...input.nowMs != null ? { nowMs: input.nowMs } : {}
|
|
54
|
-
})
|
|
55
|
+
});
|
|
56
|
+
if (input.processingPolicy && grant.processingPolicy !== input.processingPolicy) grant = updateUnderstandingSourceGrantPolicies(grant.id, {
|
|
57
|
+
processingPolicy: input.processingPolicy,
|
|
58
|
+
...input.nowMs != null ? { nowMs: input.nowMs } : {}
|
|
59
|
+
}) ?? grant;
|
|
60
|
+
return directorySource(grant);
|
|
55
61
|
}
|
|
56
62
|
function revokeWorkDiscoveryDirectorySource(id, nowMs = Date.now()) {
|
|
57
63
|
if (!getWorkDiscoveryDirectorySource(id)) return null;
|
|
@@ -34,6 +34,7 @@ export interface WorkDiscoveryDirectorySource {
|
|
|
34
34
|
scope: {
|
|
35
35
|
readOnly: true;
|
|
36
36
|
};
|
|
37
|
+
processingPolicy: 'local_only' | 'remote_allowed';
|
|
37
38
|
fingerprint?: WorkDiscoveryPreview['fingerprint'];
|
|
38
39
|
lastScannedAt?: number;
|
|
39
40
|
createdAt: number;
|
|
@@ -165,7 +166,7 @@ export interface WorkDiscoveryResult {
|
|
|
165
166
|
export interface WorkDiscoveryProfileCandidate {
|
|
166
167
|
id: string;
|
|
167
168
|
understandingId?: string;
|
|
168
|
-
category: 'role' | '
|
|
169
|
+
category: 'role' | 'responsibility' | 'preference' | 'routine';
|
|
169
170
|
statement: string;
|
|
170
171
|
confidence: 'high' | 'medium' | 'low';
|
|
171
172
|
evidence: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getDefaultAgentId, init_resolve_route } from "../../routing/resolve-route.js";
|
|
2
|
-
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
3
2
|
import { extractProfileAgentId, resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
3
|
+
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
4
4
|
import { TaskRepository } from "../../tasks/task-repository.js";
|
|
5
5
|
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
6
6
|
import { TaskRunRepository } from "../../tasks/task-run-repository.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.220",
|
|
4
4
|
"description": "Local-first personal AI assistant with reviewable user understanding, durable tasks, workflows, automations, and local or cloud models.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -164,9 +164,9 @@
|
|
|
164
164
|
"vitest": "4.1.5",
|
|
165
165
|
"vue": "^3.5.35",
|
|
166
166
|
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
167
|
-
"@xopcai/gateway-contract": "0.0.0",
|
|
168
167
|
"@xopcai/realtime-protocol": "0.0.0",
|
|
169
|
-
"@xopcai/realtime-client": "0.0.0"
|
|
168
|
+
"@xopcai/realtime-client": "0.0.0",
|
|
169
|
+
"@xopcai/gateway-contract": "0.0.0"
|
|
170
170
|
},
|
|
171
171
|
"scripts": {
|
|
172
172
|
"assets:brand": "node scripts/generate-brand-assets.mjs",
|