@xopcai/xopc 0.0.217 → 0.0.219
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-D6trMTyZ.js → activity-store-slG02hSm.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CAQdFrcu.js → agent-avatar-dicebear-DZ6ETNIk.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DxaIH0Ep.js +68 -0
- package/dist/gateway/static/root/assets/{api-B9pZAyMB.js → api-Tz57QxiN.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-DdR1L4LR.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-wYbwqmee.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-CyWr6KyO.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BF0q7N24.js → archive-plugin-DKXa160O.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D1qmjGDo.js → attachment-load-CzwA9g2y.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Ccu4yRFa.js → automations-page-DwAXyWAY.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CL7ieYIt.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DooqxEZz.js → binary-plugins-DoQ_DnT7.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Dqg9kvb9.js → block-editor-Bj_Uxxng.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-BYa_FNC1.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-CsIh8ySc.js → browser-workflow-inputs-D4roXE6r.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-BXQFxT0p.js → browser-workflows-page-CleKTAKD.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DYG37N0k.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BX9U0FRh.js → capability-presets-api-wtEN6Ss6.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-C0Q4dFq-.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-CUBTQ0Bz.js → channel-recipient-api-DhuS2RJ3.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-CpO6Xg0n.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-CXhPeiNj.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-ClQMDe2n.js +36 -0
- package/dist/gateway/static/root/assets/connectors-page-BvyiPdKU.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-XzPZhzVM.js → cron-expression-4DvCFs-v.js} +1 -1
- package/dist/gateway/static/root/assets/date-picker-B6FSjt4Z.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-Za18eMp1.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-DZjW-7Tw.js → desktop-pet-DUUf3yyJ.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-Dwx3GfB8.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-C6dfTCsl.js +1 -0
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-D7APnE3n.js → extension-debug-page-Cordpg4X.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BhV5hz70.js → extension-page-Dw0dGyMl.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-B2pUMaXm.js +1 -0
- package/dist/gateway/static/root/assets/eye-CABVeTq0.js +1 -0
- package/dist/gateway/static/root/assets/eye-off-DEAzt3g1.js +1 -0
- package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +1 -0
- package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +1 -0
- package/dist/gateway/static/root/assets/gateway-config-api-DAZUOEQh.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-BTH9HVUk.js → gateway-config-swr-BIqRg-zo.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-ik2f-pmV.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DAEk_tnd.js → gateway-startup-retry-BFjWYOCS.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-BE81XJ8F.js +1 -0
- package/dist/gateway/static/root/assets/home-page-BTWXJu_m.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-HqcQrSed.js → image-generation-api-HXAWlgm6.js} +1 -1
- package/dist/gateway/static/root/assets/index-B6gWYy08.js +108 -0
- package/dist/gateway/static/root/assets/index-CDkuz_YC.css +2 -0
- package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +1 -0
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BG6lShzn.js → keyboard-shortcuts-settings-ROqQ_Xlo.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Dcaf190G.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-vaz8ewe2.js → local-apps-page-Be79cyMG.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-De8wYkd7.js → locale-store-DfK-Hofd.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-C2pjbXno.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-tqTGCHt0.js → management-settings-CRspx0oY.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BGx8Aao0.js → markdown-split-G3PTpGw3.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-ybRARsPs.js → markdown-view-D4FPJZ91.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-xbM-SSP5.js → media-plugins-DT0P7j7u.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B701TEZ5.js +3 -0
- package/dist/gateway/static/root/assets/{notes-api-D9CCwyWK.js → notes-api-q7HjYO07.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CMNBbg6g.js → notes-page-Cgl2h7AR.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DFMQYyGJ.js +4 -0
- package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-CsNVTKC0.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CZdzgPZW.js → product-open-page-ComKLO4D.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DUFmQscH.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-CTWxt3dv.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-DYmKEwiG.js → registry-api-BBoJ7khF.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-qmG-3qjj.js +1 -0
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DQ12tLCL.js → runtime-tools-settings-panel-CXHQc53b.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DNCDIkqC.js → schema-form-3jTDF2lJ.js} +1 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-D_We4_MV.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-B_QhPgU0.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-CUDozALU.js +1 -0
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-xgo41cfo.js → settings-loading-skeleton-H3ZH6a6l.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-8astk_1U.js → settings-page-tx29z21o.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-VunfXpTX.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BBZV4AGy.js → share-preview-page-MyThymEx.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DkZvY1cr.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DVDOh1iY.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BOOyMnno.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-HmoDhJVh.js → skills-page.utils-Bl5Yv3Cx.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-DwQ3O1ta.js +1 -0
- package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +1 -0
- package/dist/gateway/static/root/assets/tab-completion-input.utils-BP3NH_du.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-BwOyrADL.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-STx6jo38.js → theme-store-Br4BtK4x.js} +1 -1
- package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-CqFVx92z.js → use-autosave-DRS3RwS9.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-ClV2r3Cr.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-pYDiKKMo.js → voice-api-key-field-CGTE5156.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-LJLw9zf0.js → work-discovery-overlay-CW-HKD7h.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D0WhQ3kI.js → workflow-run-setup-panel-Dtr9fDC8.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CDOyNgZf.js +5 -0
- package/dist/gateway/static/root/index.html +20 -11
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/new-session.js +99 -0
- package/dist/packages/gateway-contract/src/tasks.js +5 -0
- package/dist/packages/gateway-contract/src/user-message-display.js +55 -0
- package/dist/src/agent/agent-manager.js +3 -2
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +6 -3
- package/dist/src/agent/background-review/run-background-review.js +144 -16
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +3 -1
- package/dist/src/agent/inbound/turn-dispatcher.js +2 -1
- package/dist/src/agent/memory/context/types.d.ts +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent/memory/manager.d.ts +2 -1
- package/dist/src/agent/memory/manager.js +2 -6
- package/dist/src/agent/memory/understanding/service.d.ts +1 -0
- package/dist/src/agent/memory/understanding/service.js +179 -36
- package/dist/src/agent/memory/understanding/types.d.ts +6 -0
- package/dist/src/agent/messaging/command-handler.d.ts +2 -0
- package/dist/src/agent/messaging/command-handler.js +3 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +3 -0
- package/dist/src/agent/service/direct-turn-helpers.js +13 -3
- package/dist/src/agent/service/process-direct-streaming.d.ts +2 -1
- package/dist/src/agent/service/process-direct-streaming.js +12 -11
- package/dist/src/agent/session/session-config-service.d.ts +1 -0
- package/dist/src/agent/session/session-config-service.js +11 -0
- package/dist/src/agent/session/session-inspector.d.ts +1 -0
- package/dist/src/agent/session/session-inspector.js +1 -0
- package/dist/src/agent/source-context/budget.d.ts +3 -0
- package/dist/src/agent/source-context/budget.js +21 -0
- package/dist/src/agent/source-context/index.js +3 -3
- package/dist/src/agent/source-context/injector.d.ts +2 -2
- package/dist/src/agent/source-context/injector.js +19 -9
- package/dist/src/agent/source-context/types.d.ts +16 -0
- package/dist/src/agent/source-context/types.js +25 -1
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +19 -2
- package/dist/src/agent/tools/xopc-use-tool.js +62 -2
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/browser/backend-from-config.d.ts +8 -0
- package/dist/src/browser/backend-from-config.js +16 -1
- package/dist/src/browser/providers/browser-ext-install.d.ts +3 -2
- package/dist/src/browser/providers/browser-ext-install.js +4 -2
- package/dist/src/chat-commands/builtins/review.js +11 -2
- package/dist/src/chat-commands/builtins/understanding.js +11 -4
- package/dist/src/chat-commands/types.d.ts +4 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/models-json.d.ts +20 -20
- package/dist/src/connectors/connected-source-ingestion.js +21 -4
- package/dist/src/connectors/connected-source-normalizers.js +51 -4
- package/dist/src/connectors/connected-source-understanding.d.ts +20 -0
- package/dist/src/connectors/connected-source-understanding.js +180 -0
- package/dist/src/connectors/content-enrichment.d.ts +1 -0
- package/dist/src/connectors/content-enrichment.js +11 -7
- package/dist/src/connectors/learning-coordinator.js +112 -15
- package/dist/src/connectors/learning-recipes.js +2 -2
- package/dist/src/document-understanding/extract.d.ts +1 -1
- package/dist/src/document-understanding/extract.js +54 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +18 -0
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +12 -2
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +1 -0
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +46 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +23 -3
- package/dist/src/gateway/hono/routes/sessions.js +17 -20
- package/dist/src/gateway/hono/routes/tasks.js +25 -0
- package/dist/src/gateway/hono/routes/understanding-sources.d.ts +9 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +138 -24
- package/dist/src/gateway/hono/routes/you.js +71 -4
- package/dist/src/gateway/rate-limit/buckets.d.ts +1 -1
- package/dist/src/gateway/rate-limit/buckets.js +2 -2
- package/dist/src/gateway/service/agent-runner.d.ts +7 -2
- package/dist/src/gateway/service/agent-runner.js +21 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.d.ts +2 -0
- package/dist/src/gateway/service/run-gateway-agent.js +2 -1
- package/dist/src/gateway/service/session-input-coordinator.d.ts +8 -2
- package/dist/src/gateway/service/session-input-coordinator.js +62 -3
- package/dist/src/gateway/service/sessions-api.d.ts +1 -0
- package/dist/src/gateway/service.d.ts +3 -2
- package/dist/src/gateway/service.js +16 -6
- package/dist/src/gateway/user-turn-input.d.ts +2 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +3 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.js +16 -3
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +1 -1
- package/dist/src/knowledge/connected-understanding-pipeline.js +4 -2
- package/dist/src/retrieval/queryProfile.d.ts +1 -0
- package/dist/src/retrieval/queryProfile.js +9 -1
- package/dist/src/session/client-history.d.ts +11 -0
- package/dist/src/session/client-history.js +24 -2
- package/dist/src/session/config-types.d.ts +1 -1
- package/dist/src/session/session-title.js +2 -3
- package/dist/src/session/store.js +1 -0
- package/dist/src/session/transcript-outline.js +5 -2
- package/dist/src/session/types.d.ts +1 -0
- package/dist/src/session/user-message-display.d.ts +4 -0
- package/dist/src/session/user-message-display.js +22 -0
- package/dist/src/storage/sqlite/context-extraction-repository.d.ts +57 -0
- package/dist/src/storage/sqlite/context-extraction-repository.js +119 -0
- package/dist/src/storage/sqlite/context-relation-repository.d.ts +50 -0
- package/dist/src/storage/sqlite/context-relation-repository.js +97 -0
- package/dist/src/storage/sqlite/index.d.ts +4 -2
- package/dist/src/storage/sqlite/index.js +5 -3
- package/dist/src/storage/sqlite/migrations/126_focus_context_governance.sql +72 -0
- package/dist/src/storage/sqlite/migrations/127_context_object_origin.sql +36 -0
- package/dist/src/storage/sqlite/migrations/128_context_extraction.sql +73 -0
- package/dist/src/storage/sqlite/migrations/129_focus_versions.sql +51 -0
- package/dist/src/storage/sqlite/migrations/130_context_evidence_provenance.sql +18 -0
- package/dist/src/storage/sqlite/migrations/131_session_input_contexts.sql +2 -0
- package/dist/src/storage/sqlite/migrations/132_transcript_source_context_metadata.sql +34 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/session-input-repository.js +19 -7
- package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/session-turn-replace-repository.js +3 -2
- package/dist/src/storage/sqlite/transcript-repository.js +29 -3
- package/dist/src/storage/sqlite/user-context-repository.d.ts +4 -1
- package/dist/src/storage/sqlite/user-context-repository.js +65 -29
- package/dist/src/tasks/index.d.ts +1 -0
- package/dist/src/tasks/index.js +2 -1
- package/dist/src/tasks/task-deletion-service.d.ts +21 -0
- package/dist/src/tasks/task-deletion-service.js +35 -0
- package/dist/src/tasks/task-repository.js +22 -1
- package/dist/src/tui/backends/embedded-backend.js +5 -3
- package/dist/src/tui/backends/gateway-realtime-backend.js +5 -3
- package/dist/src/tui/chat-history.js +2 -1
- package/dist/src/tui/tui-agent-events.js +4 -2
- package/dist/src/tui/tui-commands.d.ts +1 -0
- package/dist/src/tui/tui-commands.js +8 -3
- package/dist/src/tui/tui-empty-session-cleanup.d.ts +0 -1
- package/dist/src/tui/tui-empty-session-cleanup.js +1 -11
- package/dist/src/tui/tui-new-session-preferences.d.ts +10 -0
- package/dist/src/tui/tui-new-session-preferences.js +32 -0
- package/dist/src/tui/tui-session-actions.d.ts +1 -0
- package/dist/src/tui/tui-session-actions.js +2 -1
- package/dist/src/tui/tui-settings.d.ts +2 -0
- package/dist/src/tui/tui-settings.js +4 -1
- package/dist/src/tui/tui-types.d.ts +1 -0
- package/dist/src/tui/tui.js +57 -4
- package/dist/src/tunnel/frpc-process.js +3 -0
- package/dist/src/tunnel/tunnel-service.d.ts +2 -0
- package/dist/src/tunnel/tunnel-service.js +40 -28
- package/dist/src/user-context/context-objects.d.ts +17 -0
- package/dist/src/user-context/context-objects.js +99 -0
- package/dist/src/user-context/domain.d.ts +13 -1
- package/dist/src/user-context/evaluation/harness.d.ts +13 -0
- package/dist/src/user-context/evaluation/harness.js +31 -0
- package/dist/src/user-context/extraction/registry.d.ts +26 -0
- package/dist/src/user-context/extraction/registry.js +113 -0
- package/dist/src/user-context/extraction/repair.d.ts +19 -0
- package/dist/src/user-context/extraction/repair.js +68 -0
- package/dist/src/user-context/planner.js +214 -57
- package/dist/src/user-context/retriever.js +69 -9
- package/dist/src/user-context/sources/catalog.js +9 -2
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/local-source-contract.d.ts +1 -1
- package/dist/src/user-context/sources/local-source-contract.js +1 -0
- package/dist/src/user-context/sources/processing-policy.d.ts +2 -0
- package/dist/src/user-context/sources/processing-policy.js +7 -0
- package/dist/src/user-context/sources/repository.d.ts +23 -4
- package/dist/src/user-context/sources/repository.js +122 -12
- package/dist/src/user-context/sources/types.d.ts +10 -1
- package/dist/src/user-context/understanding-writing.d.ts +1 -0
- package/dist/src/user-context/understanding-writing.js +4 -0
- package/dist/src/user-context/understanding.js +1 -1
- package/dist/src/work-discovery/analyzer.d.ts +6 -0
- package/dist/src/work-discovery/analyzer.js +181 -57
- package/dist/src/work-discovery/index.js +1 -1
- package/dist/src/work-discovery/probe.js +20 -0
- package/dist/src/work-discovery/service.d.ts +9 -0
- package/dist/src/work-discovery/service.js +39 -11
- package/dist/src/work-discovery/source-repository.js +1 -1
- package/dist/src/work-discovery/types.d.ts +5 -0
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-C6q_vDzP.js +0 -68
- package/dist/gateway/static/root/assets/app-management-settings-panel-DRsTwFbF.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-B99NaPTf.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Dx66anqa.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CHbA8d-P.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CpRc-9Jy.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C89FGECN.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-XT6WEz9E.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-DhKk1oNT.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CiwOOoVL.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-CTbkTsc2.js +0 -36
- package/dist/gateway/static/root/assets/connectors-page-BDn3HTzX.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-BmZjs4Bq.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-ndtb88_T.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-C7BLs783.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-BWiap88p.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BhbcGuiJ.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-api-CUt9bIpL.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-RafSECLG.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CwVPlPLB.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CbdBcCwC.js +0 -1
- package/dist/gateway/static/root/assets/index-AbNnQyKk.css +0 -2
- package/dist/gateway/static/root/assets/index-CMLkr37Y.js +0 -108
- package/dist/gateway/static/root/assets/local-app-workbench-page-DdaPtQ5M.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-CjxMHTQO.js +0 -2
- package/dist/gateway/static/root/assets/messages-VI9m1xJl.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-V9C-8vSn.js +0 -4
- package/dist/gateway/static/root/assets/page-tabs-e99j9S9K.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-DW9MDOva.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DHmAUggu.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D0EiN69Y.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BuAVFk2O.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-hzlTfgOl.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BlCoA_9h.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-z0JH53Fu.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-fZQfoJAk.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-B5dPMq3Y.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-i1PGf1V2.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BSN2VaqR.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-CSibO8vj.js +0 -1
- package/dist/gateway/static/root/assets/tab-completion-input-B-VsxKhC.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-HCKZ11E8.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-zrYg51t3.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-CqG56cDS.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DQAJzV5w.js +0 -5
|
@@ -249,13 +249,13 @@ export declare const CustomModelSchema: z.ZodObject<{
|
|
|
249
249
|
api: z.ZodOptional<z.ZodEnum<{
|
|
250
250
|
"openai-completions": "openai-completions";
|
|
251
251
|
"openai-responses": "openai-responses";
|
|
252
|
-
"anthropic-messages": "anthropic-messages";
|
|
253
|
-
"google-generative-ai": "google-generative-ai";
|
|
254
252
|
"azure-openai-responses": "azure-openai-responses";
|
|
255
|
-
"bedrock-converse-stream": "bedrock-converse-stream";
|
|
256
253
|
"openai-codex-responses": "openai-codex-responses";
|
|
257
|
-
"
|
|
254
|
+
"anthropic-messages": "anthropic-messages";
|
|
255
|
+
"bedrock-converse-stream": "bedrock-converse-stream";
|
|
256
|
+
"google-generative-ai": "google-generative-ai";
|
|
258
257
|
"google-vertex": "google-vertex";
|
|
258
|
+
"google-gemini-cli": "google-gemini-cli";
|
|
259
259
|
}>>;
|
|
260
260
|
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
261
261
|
input: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
@@ -351,13 +351,13 @@ export declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
351
351
|
api: z.ZodOptional<z.ZodEnum<{
|
|
352
352
|
"openai-completions": "openai-completions";
|
|
353
353
|
"openai-responses": "openai-responses";
|
|
354
|
-
"anthropic-messages": "anthropic-messages";
|
|
355
|
-
"google-generative-ai": "google-generative-ai";
|
|
356
354
|
"azure-openai-responses": "azure-openai-responses";
|
|
357
|
-
"bedrock-converse-stream": "bedrock-converse-stream";
|
|
358
355
|
"openai-codex-responses": "openai-codex-responses";
|
|
359
|
-
"
|
|
356
|
+
"anthropic-messages": "anthropic-messages";
|
|
357
|
+
"bedrock-converse-stream": "bedrock-converse-stream";
|
|
358
|
+
"google-generative-ai": "google-generative-ai";
|
|
360
359
|
"google-vertex": "google-vertex";
|
|
360
|
+
"google-gemini-cli": "google-gemini-cli";
|
|
361
361
|
}>>;
|
|
362
362
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
363
363
|
authHeader: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -367,13 +367,13 @@ export declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
367
367
|
api: z.ZodOptional<z.ZodEnum<{
|
|
368
368
|
"openai-completions": "openai-completions";
|
|
369
369
|
"openai-responses": "openai-responses";
|
|
370
|
-
"anthropic-messages": "anthropic-messages";
|
|
371
|
-
"google-generative-ai": "google-generative-ai";
|
|
372
370
|
"azure-openai-responses": "azure-openai-responses";
|
|
373
|
-
"bedrock-converse-stream": "bedrock-converse-stream";
|
|
374
371
|
"openai-codex-responses": "openai-codex-responses";
|
|
375
|
-
"
|
|
372
|
+
"anthropic-messages": "anthropic-messages";
|
|
373
|
+
"bedrock-converse-stream": "bedrock-converse-stream";
|
|
374
|
+
"google-generative-ai": "google-generative-ai";
|
|
376
375
|
"google-vertex": "google-vertex";
|
|
376
|
+
"google-gemini-cli": "google-gemini-cli";
|
|
377
377
|
}>>;
|
|
378
378
|
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
379
379
|
input: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
@@ -550,13 +550,13 @@ export declare const ModelsJsonSchema: z.ZodObject<{
|
|
|
550
550
|
api: z.ZodOptional<z.ZodEnum<{
|
|
551
551
|
"openai-completions": "openai-completions";
|
|
552
552
|
"openai-responses": "openai-responses";
|
|
553
|
-
"anthropic-messages": "anthropic-messages";
|
|
554
|
-
"google-generative-ai": "google-generative-ai";
|
|
555
553
|
"azure-openai-responses": "azure-openai-responses";
|
|
556
|
-
"bedrock-converse-stream": "bedrock-converse-stream";
|
|
557
554
|
"openai-codex-responses": "openai-codex-responses";
|
|
558
|
-
"
|
|
555
|
+
"anthropic-messages": "anthropic-messages";
|
|
556
|
+
"bedrock-converse-stream": "bedrock-converse-stream";
|
|
557
|
+
"google-generative-ai": "google-generative-ai";
|
|
559
558
|
"google-vertex": "google-vertex";
|
|
559
|
+
"google-gemini-cli": "google-gemini-cli";
|
|
560
560
|
}>>;
|
|
561
561
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
562
562
|
authHeader: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -566,13 +566,13 @@ export declare const ModelsJsonSchema: z.ZodObject<{
|
|
|
566
566
|
api: z.ZodOptional<z.ZodEnum<{
|
|
567
567
|
"openai-completions": "openai-completions";
|
|
568
568
|
"openai-responses": "openai-responses";
|
|
569
|
-
"anthropic-messages": "anthropic-messages";
|
|
570
|
-
"google-generative-ai": "google-generative-ai";
|
|
571
569
|
"azure-openai-responses": "azure-openai-responses";
|
|
572
|
-
"bedrock-converse-stream": "bedrock-converse-stream";
|
|
573
570
|
"openai-codex-responses": "openai-codex-responses";
|
|
574
|
-
"
|
|
571
|
+
"anthropic-messages": "anthropic-messages";
|
|
572
|
+
"bedrock-converse-stream": "bedrock-converse-stream";
|
|
573
|
+
"google-generative-ai": "google-generative-ai";
|
|
575
574
|
"google-vertex": "google-vertex";
|
|
575
|
+
"google-gemini-cli": "google-gemini-cli";
|
|
576
576
|
}>>;
|
|
577
577
|
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
578
578
|
input: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
@@ -31,6 +31,9 @@ function asRecord(value) {
|
|
|
31
31
|
function boundedPersonValue(value, maxLength = 320) {
|
|
32
32
|
return typeof value === "string" ? value.trim().slice(0, maxLength) : "";
|
|
33
33
|
}
|
|
34
|
+
function normalizedEmail(value) {
|
|
35
|
+
return /<([^<>\s]+@[^<>\s]+)>/.exec(value)?.[1]?.toLowerCase() ?? value.toLowerCase();
|
|
36
|
+
}
|
|
34
37
|
function personEntities(record) {
|
|
35
38
|
if (!record) return [];
|
|
36
39
|
const extractPerson = (value, role) => {
|
|
@@ -39,7 +42,7 @@ function personEntities(record) {
|
|
|
39
42
|
if (!normalized) return [];
|
|
40
43
|
return normalized.includes("@") ? [{
|
|
41
44
|
role,
|
|
42
|
-
email: normalized
|
|
45
|
+
email: normalizedEmail(normalized)
|
|
43
46
|
}] : [{
|
|
44
47
|
role,
|
|
45
48
|
name: normalized
|
|
@@ -91,6 +94,20 @@ function peopleSignals(entities) {
|
|
|
91
94
|
function connectionIdentities(identity) {
|
|
92
95
|
return [...new Set(Object.values(identity).filter((value) => typeof value === "string").map((value) => value.trim().toLowerCase()).filter(Boolean))];
|
|
93
96
|
}
|
|
97
|
+
function hasOwnerAttribution(toolkit, people, ownerIdentities) {
|
|
98
|
+
const attributableRoles = toolkit === "gmail" ? new Set(["sender", "from"]) : toolkit === "googlecalendar" ? new Set(["organizer"]) : new Set([
|
|
99
|
+
"author",
|
|
100
|
+
"user",
|
|
101
|
+
"username",
|
|
102
|
+
"owner",
|
|
103
|
+
"owners"
|
|
104
|
+
]);
|
|
105
|
+
return people.filter((person) => attributableRoles.has(person.role)).flatMap((person) => [
|
|
106
|
+
person.email,
|
|
107
|
+
person.username,
|
|
108
|
+
person.name
|
|
109
|
+
]).filter((value) => Boolean(value)).some((value) => ownerIdentities.includes(value.trim().toLowerCase()));
|
|
110
|
+
}
|
|
94
111
|
function resultPayload(value) {
|
|
95
112
|
const root = asRecord(value) ?? {};
|
|
96
113
|
return asRecord(root.data) ?? root;
|
|
@@ -119,10 +136,10 @@ function resultToSourceItems(input) {
|
|
|
119
136
|
const record = entity.value;
|
|
120
137
|
const people = personEntities(record);
|
|
121
138
|
const ownerIdentities = connectionIdentities(input.connectionIdentity);
|
|
122
|
-
const
|
|
123
|
-
const actorAttributed = entity.metadata.actorAttributed === true || input.toolkit === "gmail" || input.toolkit === "googlecalendar" || ["github", "googledrive"].includes(input.toolkit) && observedIdentities.some((value) => ownerIdentities.includes(value));
|
|
139
|
+
const actorAttributed = entity.metadata.actorAttributed === true || hasOwnerAttribution(input.toolkit, people, ownerIdentities);
|
|
124
140
|
const serialized = JSON.stringify(sanitizeConnectedSourceValue(entity.value), null, 2);
|
|
125
|
-
const
|
|
141
|
+
const contentChars = typeof entity.value.content === "string" ? 24e3 : 8e3;
|
|
142
|
+
const normalizedText = serialized.length > contentChars ? `${serialized.slice(0, contentChars)}\n…` : serialized;
|
|
126
143
|
const contentHash = createHash("sha256").update(serialized).digest("hex");
|
|
127
144
|
return {
|
|
128
145
|
sourceInstanceId: input.sourceInstanceId,
|
|
@@ -32,11 +32,57 @@ function rows(data, ...keys) {
|
|
|
32
32
|
function compact(value) {
|
|
33
33
|
return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0 && item !== null && item !== ""));
|
|
34
34
|
}
|
|
35
|
+
const MAX_EMAIL_CONTENT_CHARS = 24e3;
|
|
36
|
+
function gmailHeaders(message) {
|
|
37
|
+
const messagePayload = record(message.payload);
|
|
38
|
+
const values = Array.isArray(messagePayload?.headers) ? messagePayload.headers : [];
|
|
39
|
+
const headers = /* @__PURE__ */ new Map();
|
|
40
|
+
for (const value of values) {
|
|
41
|
+
const header = record(value);
|
|
42
|
+
const name = text(header, "name")?.toLowerCase();
|
|
43
|
+
const headerValue = text(header, "value");
|
|
44
|
+
if (name && headerValue) headers.set(name, headerValue);
|
|
45
|
+
}
|
|
46
|
+
return headers;
|
|
47
|
+
}
|
|
48
|
+
function decodeGmailBody(value) {
|
|
49
|
+
if (typeof value !== "string" || !value.trim() || value.length > 256e3) return void 0;
|
|
50
|
+
try {
|
|
51
|
+
return Buffer.from(value.replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf8").trim() || void 0;
|
|
52
|
+
} catch {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function stripHtml(value) {
|
|
57
|
+
return value.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, " ").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, " ").replace(/<[^>]+>/g, " ").replace(/ /gi, " ").replace(/&/gi, "&").replace(/</gi, "<").replace(/>/gi, ">").replace(/\s+/g, " ").trim();
|
|
58
|
+
}
|
|
59
|
+
function gmailContent(message) {
|
|
60
|
+
const direct = text(message, "plainText", "plain_text", "text", "content", "body");
|
|
61
|
+
if (direct) return direct.slice(0, MAX_EMAIL_CONTENT_CHARS);
|
|
62
|
+
const plain = [];
|
|
63
|
+
const html = [];
|
|
64
|
+
const visit = (value, depth = 0) => {
|
|
65
|
+
if (depth > 10 || plain.join("").length >= MAX_EMAIL_CONTENT_CHARS) return;
|
|
66
|
+
const part = record(value);
|
|
67
|
+
if (!part) return;
|
|
68
|
+
const mimeType = text(part, "mimeType", "mime_type")?.toLowerCase();
|
|
69
|
+
const decoded = decodeGmailBody(record(part.body)?.data);
|
|
70
|
+
if (decoded) {
|
|
71
|
+
if (mimeType === "text/html") html.push(stripHtml(decoded));
|
|
72
|
+
else if (!mimeType || mimeType === "text/plain") plain.push(decoded);
|
|
73
|
+
}
|
|
74
|
+
if (Array.isArray(part.parts)) for (const nested of part.parts) visit(nested, depth + 1);
|
|
75
|
+
};
|
|
76
|
+
visit(message.payload);
|
|
77
|
+
const content = (plain.length ? plain : html).filter(Boolean).join("\n\n").trim();
|
|
78
|
+
return content ? content.slice(0, MAX_EMAIL_CONTENT_CHARS) : void 0;
|
|
79
|
+
}
|
|
35
80
|
function normalizeGmail(result) {
|
|
36
81
|
return rows(payload(result), "messages").flatMap((message) => {
|
|
37
82
|
const externalId = text(message, "id", "messageId", "message_id");
|
|
38
83
|
if (!externalId) return [];
|
|
39
84
|
const occurredAt = time(message.internalDate ?? message.internal_date ?? message.date ?? message.timestamp);
|
|
85
|
+
const headers = gmailHeaders(message);
|
|
40
86
|
return [{
|
|
41
87
|
externalId,
|
|
42
88
|
itemType: "email",
|
|
@@ -45,12 +91,13 @@ function normalizeGmail(result) {
|
|
|
45
91
|
value: compact({
|
|
46
92
|
id: externalId,
|
|
47
93
|
threadId: text(message, "threadId", "thread_id"),
|
|
48
|
-
subject: text(message, "subject"),
|
|
49
|
-
sender: message.sender ?? message.from,
|
|
50
|
-
recipients: message.recipients ?? message.to,
|
|
94
|
+
subject: text(message, "subject") ?? headers.get("subject"),
|
|
95
|
+
sender: message.sender ?? message.from ?? headers.get("from"),
|
|
96
|
+
recipients: message.recipients ?? message.to ?? headers.get("to"),
|
|
51
97
|
date: occurredAt,
|
|
52
98
|
labels: message.labelIds ?? message.label_ids ?? message.labels,
|
|
53
|
-
snippet: text(message, "snippet", "preview")
|
|
99
|
+
snippet: text(message, "snippet", "preview"),
|
|
100
|
+
content: gmailContent(message)
|
|
54
101
|
}),
|
|
55
102
|
metadata: {
|
|
56
103
|
observationKind: "message",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { MemoryManager } from '../agent/memory/manager.js';
|
|
2
|
+
import type { Config } from '../config/schema.js';
|
|
3
|
+
import type { KnowledgeSourceItem } from '../knowledge/types.js';
|
|
4
|
+
import type { UnderstandingSourceItem } from '../user-context/sources/types.js';
|
|
5
|
+
import { analyzeUnderstandingSources } from '../work-discovery/analyzer.js';
|
|
6
|
+
export declare function connectedItemsForUnderstanding(items: KnowledgeSourceItem[]): UnderstandingSourceItem[];
|
|
7
|
+
export declare function deriveConnectedSourceUnderstanding(input: {
|
|
8
|
+
config: Config;
|
|
9
|
+
agentId: string;
|
|
10
|
+
sourceInstanceId: string;
|
|
11
|
+
sourceRunId: string;
|
|
12
|
+
processingPolicy: 'local_only' | 'remote_allowed';
|
|
13
|
+
memoryManager: MemoryManager;
|
|
14
|
+
analyze?: typeof analyzeUnderstandingSources;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
created: number;
|
|
17
|
+
focusCount: number;
|
|
18
|
+
status: 'completed' | 'partial' | 'failed';
|
|
19
|
+
error?: string;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { finishContextExtractionRun } from "../storage/sqlite/context-extraction-repository.js";
|
|
2
|
+
import { listKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
|
|
3
|
+
import "../storage/sqlite/index.js";
|
|
4
|
+
import { upsertUserFocus } from "../user-context/sources/repository.js";
|
|
5
|
+
import { claimRegisteredExtraction } from "../user-context/extraction/registry.js";
|
|
6
|
+
import { allowsRemoteSourceProcessing } from "../user-context/sources/processing-policy.js";
|
|
7
|
+
import { analyzeUnderstandingSources } from "../work-discovery/analyzer.js";
|
|
8
|
+
import { createHash } from "node:crypto";
|
|
9
|
+
//#region src/connectors/connected-source-understanding.ts
|
|
10
|
+
const MAX_CONNECTED_ITEMS = 150;
|
|
11
|
+
function normalizedValue(item) {
|
|
12
|
+
if (!item.normalizedText) return {};
|
|
13
|
+
try {
|
|
14
|
+
const value = JSON.parse(item.normalizedText);
|
|
15
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
16
|
+
} catch {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function text(value) {
|
|
21
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
22
|
+
}
|
|
23
|
+
function itemType(itemType) {
|
|
24
|
+
if (itemType === "email") return "mail";
|
|
25
|
+
if (itemType === "calendar_event") return "calendar_event";
|
|
26
|
+
if (itemType === "external_task") return "task";
|
|
27
|
+
if (itemType === "development_activity" || itemType === "repository") return "code_activity";
|
|
28
|
+
return "document";
|
|
29
|
+
}
|
|
30
|
+
function timestamp(value) {
|
|
31
|
+
if (!value) return void 0;
|
|
32
|
+
const parsed = Date.parse(value);
|
|
33
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
34
|
+
}
|
|
35
|
+
function contentPriority(item) {
|
|
36
|
+
const value = normalizedValue(item);
|
|
37
|
+
if (item.itemType === "connected_content") return 3;
|
|
38
|
+
if (text(value.content)) return 2;
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
function connectedItemsForUnderstanding(items) {
|
|
42
|
+
return [...items].sort((left, right) => contentPriority(right) - contentPriority(left)).slice(0, MAX_CONNECTED_ITEMS).flatMap((item) => {
|
|
43
|
+
const value = normalizedValue(item);
|
|
44
|
+
const title = text(value.title) ?? text(value.subject) ?? text(value.fullName) ?? text(value.repository) ?? `${text(item.metadata.toolkit) ?? "Connected source"} ${item.itemType}`;
|
|
45
|
+
const normalizedText = item.normalizedText?.trim();
|
|
46
|
+
if (!title && !normalizedText) return [];
|
|
47
|
+
return [{
|
|
48
|
+
id: item.id,
|
|
49
|
+
sourceId: "connected-work",
|
|
50
|
+
type: itemType(item.itemType),
|
|
51
|
+
title,
|
|
52
|
+
...normalizedText ? { text: normalizedText.slice(0, 24e3) } : {},
|
|
53
|
+
...text(item.metadata.toolkit) ? { group: text(item.metadata.toolkit) } : {},
|
|
54
|
+
...timestamp(item.occurredAt) ? { occurredAt: timestamp(item.occurredAt) } : {},
|
|
55
|
+
...timestamp(item.sourceUpdatedAt) ? { modifiedAt: timestamp(item.sourceUpdatedAt) } : {},
|
|
56
|
+
ownerAttribution: item.metadata.actorAttributed === true ? "user" : "shared",
|
|
57
|
+
sensitivity: item.sensitivity,
|
|
58
|
+
evidenceRef: `knowledge-source://${item.id}`
|
|
59
|
+
}];
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function understandingKind(category) {
|
|
63
|
+
if (category === "preference") return "preference";
|
|
64
|
+
if (category === "workflow") return "routine";
|
|
65
|
+
if (category === "focus") return "current_state";
|
|
66
|
+
return "project_context";
|
|
67
|
+
}
|
|
68
|
+
function understandingCandidate(candidate) {
|
|
69
|
+
const normalized = candidate.statement.toLocaleLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim();
|
|
70
|
+
return {
|
|
71
|
+
kind: understandingKind(candidate.category),
|
|
72
|
+
content: candidate.statement,
|
|
73
|
+
canonicalKey: `connected-semantic:${candidate.category}:${createHash("sha256").update(normalized).digest("hex").slice(0, 20)}`,
|
|
74
|
+
confidence: candidate.confidence === "high" ? .9 : candidate.confidence === "medium" ? .72 : .55,
|
|
75
|
+
importance: candidate.category === "focus" ? .8 : .68,
|
|
76
|
+
explicitness: "inferred",
|
|
77
|
+
durability: candidate.category === "focus" ? "ephemeral" : candidate.category === "workflow" ? "recurring" : "durable",
|
|
78
|
+
sensitivity: "personal",
|
|
79
|
+
disclosurePolicy: "referenceable"
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function hasLongVerbatimOverlap(value, sourceTexts, minimumLength = 32) {
|
|
83
|
+
const normalized = value.replace(/\s+/g, " ").trim();
|
|
84
|
+
if (normalized.length < minimumLength) return false;
|
|
85
|
+
return sourceTexts.some((source) => source.replace(/\s+/g, " ").includes(normalized));
|
|
86
|
+
}
|
|
87
|
+
async function deriveConnectedSourceUnderstanding(input) {
|
|
88
|
+
const knowledgeItems = listKnowledgeSourceItems({
|
|
89
|
+
agentId: input.agentId,
|
|
90
|
+
sourceInstanceId: input.sourceInstanceId,
|
|
91
|
+
includeDeleted: false,
|
|
92
|
+
limit: MAX_CONNECTED_ITEMS
|
|
93
|
+
});
|
|
94
|
+
const items = connectedItemsForUnderstanding(knowledgeItems);
|
|
95
|
+
if (!items.length) return {
|
|
96
|
+
created: 0,
|
|
97
|
+
focusCount: 0,
|
|
98
|
+
status: "completed"
|
|
99
|
+
};
|
|
100
|
+
const extraction = claimRegisteredExtraction({
|
|
101
|
+
extractorId: "connector-semantic",
|
|
102
|
+
sourceRef: `understanding-source-run:${input.sourceRunId}`,
|
|
103
|
+
contentForHash: knowledgeItems.map((item) => `${item.id}:${item.sourceUpdatedAt ?? ""}`).join("\n"),
|
|
104
|
+
processingPolicy: input.processingPolicy,
|
|
105
|
+
destination: "remote_model"
|
|
106
|
+
});
|
|
107
|
+
if (!allowsRemoteSourceProcessing([input.processingPolicy]) || !extraction.shouldExecute) return {
|
|
108
|
+
created: 0,
|
|
109
|
+
focusCount: 0,
|
|
110
|
+
status: "completed"
|
|
111
|
+
};
|
|
112
|
+
try {
|
|
113
|
+
const analysis = await (input.analyze ?? analyzeUnderstandingSources)({
|
|
114
|
+
config: input.config,
|
|
115
|
+
items
|
|
116
|
+
});
|
|
117
|
+
const rawTexts = items.flatMap((item) => item.text ? [item.text] : []);
|
|
118
|
+
const profileCandidates = analysis.profileCandidates.filter((candidate) => !hasLongVerbatimOverlap(candidate.statement, rawTexts));
|
|
119
|
+
const sourceItemIds = [...new Set([...profileCandidates.flatMap((candidate) => candidate.evidenceRefs ?? []), ...analysis.workThreadCandidates.flatMap((candidate) => candidate.evidenceRefs)].map((ref) => ref.startsWith("knowledge-source://") ? ref.slice(19) : ""))].filter(Boolean).slice(0, 20);
|
|
120
|
+
const reviewed = profileCandidates.length ? await input.memoryManager.applyUnderstandingCandidates(profileCandidates.map(understandingCandidate), {
|
|
121
|
+
agentId: input.agentId,
|
|
122
|
+
sourceItemIds,
|
|
123
|
+
sourceText: "Bounded semantic synthesis from explicitly connected work sources.",
|
|
124
|
+
source: {
|
|
125
|
+
provider: "connected-sources",
|
|
126
|
+
sourceInstanceId: input.sourceInstanceId
|
|
127
|
+
},
|
|
128
|
+
reviewSource: "background",
|
|
129
|
+
extractionRunId: extraction.run.id
|
|
130
|
+
}) : {
|
|
131
|
+
created: 0,
|
|
132
|
+
writeOutputs: []
|
|
133
|
+
};
|
|
134
|
+
const focuses = analysis.workThreadCandidates.filter((candidate) => !hasLongVerbatimOverlap(candidate.title, rawTexts) && !hasLongVerbatimOverlap(candidate.summary, rawTexts)).map((candidate) => upsertUserFocus({
|
|
135
|
+
canonicalKey: `connected-focus:${candidate.topicKey}`,
|
|
136
|
+
title: candidate.title,
|
|
137
|
+
summary: candidate.summary,
|
|
138
|
+
horizon: candidate.horizon,
|
|
139
|
+
status: "candidate",
|
|
140
|
+
confidence: candidate.confidence === "high" ? .9 : candidate.confidence === "medium" ? .72 : .55,
|
|
141
|
+
evidenceRefs: candidate.evidenceRefs,
|
|
142
|
+
sourceRunId: input.sourceRunId
|
|
143
|
+
}));
|
|
144
|
+
finishContextExtractionRun({
|
|
145
|
+
runId: extraction.run.id,
|
|
146
|
+
status: "completed",
|
|
147
|
+
outputs: [...(reviewed.writeOutputs ?? []).map((output) => ({
|
|
148
|
+
candidateKey: output.candidateKey,
|
|
149
|
+
...output.objectId ? {
|
|
150
|
+
objectType: "understanding",
|
|
151
|
+
objectId: output.objectId
|
|
152
|
+
} : {},
|
|
153
|
+
...output.versionId ? { versionId: output.versionId } : {},
|
|
154
|
+
outcome: output.outcome
|
|
155
|
+
})), ...focuses.map((focus) => ({
|
|
156
|
+
candidateKey: focus.canonicalKey,
|
|
157
|
+
objectType: "focus",
|
|
158
|
+
objectId: focus.id,
|
|
159
|
+
versionId: focus.versionId,
|
|
160
|
+
outcome: "created"
|
|
161
|
+
}))]
|
|
162
|
+
});
|
|
163
|
+
const sourceStatus = analysis.sourceStatuses.find((item) => item.sourceId === "connected-work");
|
|
164
|
+
return {
|
|
165
|
+
created: reviewed.created,
|
|
166
|
+
focusCount: focuses.length,
|
|
167
|
+
status: sourceStatus?.status ?? "failed",
|
|
168
|
+
...sourceStatus?.error ? { error: sourceStatus.error } : {}
|
|
169
|
+
};
|
|
170
|
+
} catch (error) {
|
|
171
|
+
finishContextExtractionRun({
|
|
172
|
+
runId: extraction.run.id,
|
|
173
|
+
status: "failed",
|
|
174
|
+
errorCode: "extractor_failed"
|
|
175
|
+
});
|
|
176
|
+
throw error;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
export { connectedItemsForUnderstanding, deriveConnectedSourceUnderstanding };
|
|
@@ -19,6 +19,7 @@ export type ConnectedContentReadResult = {
|
|
|
19
19
|
};
|
|
20
20
|
export declare function listConnectedContentCandidates(options: {
|
|
21
21
|
agentId: string;
|
|
22
|
+
sourceInstanceId?: string;
|
|
22
23
|
limit?: number;
|
|
23
24
|
}): ConnectedContentCandidate[];
|
|
24
25
|
export declare function readConnectedContent(input: {
|
|
@@ -43,13 +43,16 @@ function candidateFor(item) {
|
|
|
43
43
|
const value = normalizedRecord(item);
|
|
44
44
|
const title = text(value.title) ?? text(value.subject);
|
|
45
45
|
if (!title) return void 0;
|
|
46
|
-
if (toolkit === "gmail" && item.itemType === "email")
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
if (toolkit === "gmail" && item.itemType === "email") {
|
|
47
|
+
if (text(value.content)) return void 0;
|
|
48
|
+
return {
|
|
49
|
+
sourceItemId: item.id,
|
|
50
|
+
sourceInstanceId: item.sourceInstanceId,
|
|
51
|
+
toolkit,
|
|
52
|
+
title,
|
|
53
|
+
occurredAt: item.occurredAt
|
|
54
|
+
};
|
|
55
|
+
}
|
|
53
56
|
const mimeType = text(item.metadata.mimeType) ?? text(value.mimeType);
|
|
54
57
|
if (toolkit === "googledrive" && item.itemType === "cloud_document" && mimeType && (mimeType === GOOGLE_DOCUMENT_MIME || DOWNLOADABLE_TEXT_MIMES.has(mimeType))) return {
|
|
55
58
|
sourceItemId: item.id,
|
|
@@ -64,6 +67,7 @@ function listConnectedContentCandidates(options) {
|
|
|
64
67
|
const limit = Math.max(1, Math.min(20, options.limit ?? 10));
|
|
65
68
|
const items = listKnowledgeSourceItems({
|
|
66
69
|
agentId: options.agentId,
|
|
70
|
+
...options.sourceInstanceId ? { sourceInstanceId: options.sourceInstanceId } : {},
|
|
67
71
|
includeDeleted: false,
|
|
68
72
|
limit: 500
|
|
69
73
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { finishContextExtractionRun } from "../storage/sqlite/context-extraction-repository.js";
|
|
3
4
|
import { claimNextConnectorLearningJob, enqueueConnectorLearningJob, listConnectorLearningJobs, recoverStaleConnectorLearningJobs, setConnectorLearningPaused, updateConnectorLearningJob } from "../storage/sqlite/connector-learning-repository.js";
|
|
4
5
|
import { pruneBoundedKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
|
|
5
6
|
import { getConnectorInstallation, listConnectorConnections, upsertConnectorConnection } from "../storage/sqlite/connector-repository.js";
|
|
@@ -10,15 +11,19 @@ import { connectorIdentityKey, normalizeConnectorIdentity } from "./connector-id
|
|
|
10
11
|
import { ComposioSessionsAdapter } from "./composio-sessions.js";
|
|
11
12
|
import { buildConnectorLearningArguments, getConnectorLearningPlan } from "./learning-recipes.js";
|
|
12
13
|
import { getConnectorDefinition } from "./catalog.js";
|
|
13
|
-
import { createUnderstandingSourceRun, listUnderstandingSourceRuns, updateUnderstandingSourceGrantCheckpoint, updateUnderstandingSourceRun, upsertUnderstandingSourceGrant, upsertUserFocus } from "../user-context/sources/repository.js";
|
|
14
|
+
import { createUnderstandingSourceRun, getUnderstandingSourceGrant, listUnderstandingSourceRuns, updateUnderstandingSourceGrantCheckpoint, updateUnderstandingSourceRun, upsertUnderstandingSourceGrant, upsertUserFocus } from "../user-context/sources/repository.js";
|
|
15
|
+
import { claimRegisteredExtraction } from "../user-context/extraction/registry.js";
|
|
14
16
|
import { ConnectedUnderstandingPipeline } from "../knowledge/connected-understanding-pipeline.js";
|
|
15
17
|
import "../knowledge/index.js";
|
|
16
18
|
import { ingestComposioConnectedSource } from "./connected-source-ingestion.js";
|
|
19
|
+
import { deriveConnectedSourceUnderstanding } from "./connected-source-understanding.js";
|
|
20
|
+
import { listConnectedContentCandidates, readConnectedContent } from "./content-enrichment.js";
|
|
17
21
|
//#region src/connectors/learning-coordinator.ts
|
|
18
22
|
init_logger();
|
|
19
23
|
const log = createLogger("ConnectorLearning");
|
|
20
24
|
const CONNECTED_ACCOUNT_UNAVAILABLE = "connected_account_unavailable";
|
|
21
25
|
const CONNECTED_SOURCE_SYNC_FAILED = "connected_source_sync_failed";
|
|
26
|
+
const CONNECTED_SOURCE_ANALYSIS_FAILED = "connected_source_analysis_failed";
|
|
22
27
|
function learningFailureCode(error) {
|
|
23
28
|
const message = error instanceof Error ? error.message : String(error);
|
|
24
29
|
return message.includes("ToolRouterV2_InvalidConnectedAccountIds") || message.includes("Could not find connected account(s)") || message.includes("missing its provider identity") ? CONNECTED_ACCOUNT_UNAVAILABLE : CONNECTED_SOURCE_SYNC_FAILED;
|
|
@@ -178,6 +183,22 @@ function startConnectorLearningCoordinator(options) {
|
|
|
178
183
|
itemsSeen += synced.itemsSeen;
|
|
179
184
|
itemsIndexed += synced.itemsIndexed;
|
|
180
185
|
}
|
|
186
|
+
const enrichmentErrors = [];
|
|
187
|
+
if (plan.toolkit === "googledrive") {
|
|
188
|
+
const candidates = listConnectedContentCandidates({
|
|
189
|
+
agentId: job.agentId,
|
|
190
|
+
sourceInstanceId: job.sourceInstanceId,
|
|
191
|
+
limit: 5
|
|
192
|
+
});
|
|
193
|
+
if (candidates.length) {
|
|
194
|
+
const enriched = await readConnectedContent({
|
|
195
|
+
agentId: job.agentId,
|
|
196
|
+
sourceItemIds: candidates.map((candidate) => candidate.sourceItemId)
|
|
197
|
+
});
|
|
198
|
+
enrichmentErrors.push(...enriched.failed.map((failure) => failure.error));
|
|
199
|
+
itemsIndexed += enriched.completed;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
181
202
|
if (listConnectorLearningJobs({
|
|
182
203
|
accountId: job.accountId,
|
|
183
204
|
limit: 100
|
|
@@ -188,33 +209,109 @@ function startConnectorLearningCoordinator(options) {
|
|
|
188
209
|
itemsIndexed
|
|
189
210
|
}));
|
|
190
211
|
publish(updateConnectorLearningJob(job.id, { phase: "deriving" }));
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
status: "candidate",
|
|
198
|
-
confidence: .72,
|
|
199
|
-
evidenceRefs: [`connector-account:${job.accountId}`],
|
|
200
|
-
sourceRunId: sourceRun.id
|
|
212
|
+
const structuralExtraction = claimRegisteredExtraction({
|
|
213
|
+
extractorId: "connector-structural",
|
|
214
|
+
sourceRef: `understanding-source-run:${sourceRun.id}`,
|
|
215
|
+
contentForHash: `${job.sourceInstanceId}:${itemsSeen}:${itemsIndexed}`,
|
|
216
|
+
processingPolicy: "local_only",
|
|
217
|
+
destination: "deterministic"
|
|
201
218
|
});
|
|
219
|
+
let understanding = {
|
|
220
|
+
proposed: 0,
|
|
221
|
+
created: 0,
|
|
222
|
+
deduplicated: 0,
|
|
223
|
+
rejected: 0,
|
|
224
|
+
createdRecords: [],
|
|
225
|
+
writeOutputs: []
|
|
226
|
+
};
|
|
227
|
+
if (structuralExtraction.shouldExecute) try {
|
|
228
|
+
understanding = await new ConnectedUnderstandingPipeline(options.getMemoryManager()).process(job.agentId, structuralExtraction.run.id);
|
|
229
|
+
const structuralFocuses = understanding.createdRecords.filter((item) => item.kind === "project_context").map((record) => upsertUserFocus({
|
|
230
|
+
canonicalKey: `connector-focus:${job.accountId}:${record.id}`,
|
|
231
|
+
title: record.content.slice(0, 120),
|
|
232
|
+
summary: record.content,
|
|
233
|
+
horizon: "ongoing",
|
|
234
|
+
status: "candidate",
|
|
235
|
+
confidence: .72,
|
|
236
|
+
evidenceRefs: [`connector-account:${job.accountId}`],
|
|
237
|
+
sourceRunId: sourceRun.id
|
|
238
|
+
}));
|
|
239
|
+
finishContextExtractionRun({
|
|
240
|
+
runId: structuralExtraction.run.id,
|
|
241
|
+
status: "completed",
|
|
242
|
+
outputs: [...(understanding.writeOutputs ?? []).map((output) => ({
|
|
243
|
+
candidateKey: output.candidateKey,
|
|
244
|
+
...output.objectId ? {
|
|
245
|
+
objectType: "understanding",
|
|
246
|
+
objectId: output.objectId
|
|
247
|
+
} : {},
|
|
248
|
+
...output.versionId ? { versionId: output.versionId } : {},
|
|
249
|
+
outcome: output.outcome
|
|
250
|
+
})), ...structuralFocuses.map((focus) => ({
|
|
251
|
+
candidateKey: focus.canonicalKey,
|
|
252
|
+
objectType: "focus",
|
|
253
|
+
objectId: focus.id,
|
|
254
|
+
versionId: focus.versionId,
|
|
255
|
+
outcome: "created"
|
|
256
|
+
}))]
|
|
257
|
+
});
|
|
258
|
+
} catch (error) {
|
|
259
|
+
finishContextExtractionRun({
|
|
260
|
+
runId: structuralExtraction.run.id,
|
|
261
|
+
status: "failed",
|
|
262
|
+
errorCode: "extractor_failed"
|
|
263
|
+
});
|
|
264
|
+
throw error;
|
|
265
|
+
}
|
|
266
|
+
let semantic = {
|
|
267
|
+
created: 0,
|
|
268
|
+
focusCount: 0,
|
|
269
|
+
status: "completed"
|
|
270
|
+
};
|
|
271
|
+
try {
|
|
272
|
+
semantic = await deriveConnectedSourceUnderstanding({
|
|
273
|
+
config: options.getConfig(),
|
|
274
|
+
agentId: job.agentId,
|
|
275
|
+
sourceInstanceId: job.sourceInstanceId,
|
|
276
|
+
sourceRunId: sourceRun.id,
|
|
277
|
+
processingPolicy: getUnderstandingSourceGrant(sourceRun.grantId)?.processingPolicy ?? "local_only",
|
|
278
|
+
memoryManager: options.getMemoryManager()
|
|
279
|
+
});
|
|
280
|
+
} catch (error) {
|
|
281
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
282
|
+
semantic = {
|
|
283
|
+
created: 0,
|
|
284
|
+
focusCount: 0,
|
|
285
|
+
status: "failed",
|
|
286
|
+
error: CONNECTED_SOURCE_ANALYSIS_FAILED
|
|
287
|
+
};
|
|
288
|
+
log.warn({
|
|
289
|
+
err: error,
|
|
290
|
+
jobId: job.id,
|
|
291
|
+
connectorId: job.connectorId
|
|
292
|
+
}, `Connected source semantic analysis failed: ${errorMessage}`);
|
|
293
|
+
}
|
|
294
|
+
const candidatesCreated = understanding.created + semantic.created + semantic.focusCount;
|
|
295
|
+
const incomplete = enrichmentErrors.length > 0 || semantic.status !== "completed";
|
|
202
296
|
const completed = updateConnectorLearningJob(job.id, {
|
|
203
297
|
status: "completed",
|
|
204
298
|
phase: "completed",
|
|
205
|
-
candidatesCreated
|
|
299
|
+
candidatesCreated,
|
|
206
300
|
nextRunAt: null,
|
|
207
301
|
finished: true
|
|
208
302
|
});
|
|
209
303
|
updateUnderstandingSourceRun(sourceRun.id, {
|
|
210
|
-
status: "completed",
|
|
304
|
+
status: incomplete ? "partial" : "completed",
|
|
211
305
|
itemsSeen,
|
|
212
306
|
cursorAfter: (/* @__PURE__ */ new Date()).toISOString(),
|
|
213
307
|
completed: true,
|
|
214
308
|
metadata: {
|
|
215
309
|
...sourceRun.metadata,
|
|
216
310
|
itemsIndexed,
|
|
217
|
-
candidatesCreated
|
|
311
|
+
candidatesCreated,
|
|
312
|
+
semanticStatus: semantic.status,
|
|
313
|
+
...semantic.error ? { semanticError: semantic.error } : {},
|
|
314
|
+
...enrichmentErrors.length ? { enrichmentFailureCount: enrichmentErrors.length } : {}
|
|
218
315
|
}
|
|
219
316
|
});
|
|
220
317
|
updateUnderstandingSourceGrantCheckpoint(sourceRun.grantId, {
|
|
@@ -258,7 +355,7 @@ function startConnectorLearningCoordinator(options) {
|
|
|
258
355
|
const definition = getConnectorDefinition(job.connectorId);
|
|
259
356
|
if (definition?.runtime.type === "composio" && definition.runtime.role === "toolkit") updateUnderstandingSourceRun(ensureUnderstandingSourceRun(job, definition.runtime.toolkit, definition.displayName).id, {
|
|
260
357
|
status: "failed",
|
|
261
|
-
errorMessage,
|
|
358
|
+
errorMessage: learningFailureCode(err),
|
|
262
359
|
completed: true
|
|
263
360
|
});
|
|
264
361
|
log.warn({
|