@xopcai/xopc 0.0.188 → 0.0.190
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/README.md +1 -4
- package/README.zh-CN.md +0 -3
- 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--QoUGhiS.js → activity-store-DstnJCS5.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0yweLNQ.js → agent-avatar-dicebear-9vAbkroX.js} +1 -1
- package/dist/gateway/static/root/assets/agents-D1t4SfMQ.js +68 -0
- package/dist/gateway/static/root/assets/{api-5laWqfiE.js → api-BTL9kayv.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BXJ8Jiv_.js → app-management-settings-panel-DkFeIdBf.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DG9n9D1M.js → appearance-settings-Bxs8Fpaj.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Cgrgu5OW.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Ceh5qrZf.js → archive-plugin-Ch2RmLCC.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-jFW7uYf7.js → attachment-load-BhMQM_Ky.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-CtJxstKh.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-XDlkI1r4.js → binary-plugins-D6CqlymH.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-kyKc2IhE.js → block-editor-ClL6HEg9.js} +56 -56
- package/dist/gateway/static/root/assets/browser-settings-page-DW99iDmD.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BJa5Iz_v.js → browser-workflow-inputs-BYy48VhN.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CTQQOsn5.js → browser-workflows-page-zgLibuMH.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CHUrT9EB.js +7 -0
- package/dist/gateway/static/root/assets/capability-presets-api-BB8t4Ja7.js +1 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Cycrv0YV.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-BgIkWq01.js → channel-recipient-api-BThDGiO3.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-V96gPUAU.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-Cz7SAAkm.js +1 -0
- package/dist/gateway/static/root/assets/connectors-api-DS9ED-EL.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BhlyQoQI.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CkgsvhtW.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CSwd00CV.js → desktop-pet-Cv8rGhYW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CuNQvHGu.js → desktop-pet-settings-CIeJdwfV.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ct0n5Rje.js → directory-picker-path-field-D8jXEiAY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BeRBuMUU.js → extension-debug-page-CCZ9u6TZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DbK-Cwao.js → extension-page-CV36ILRG.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-IyQrSILY.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-CC7EvEFp.js → gateway-config-api-D4_r5iJM.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-CYlntpBH.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B2DmdlwO.js → gateway-startup-retry-EO9mKvzE.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-D4SyWob8.js +1 -0
- package/dist/gateway/static/root/assets/home-page-B2Kagoh8.js +3 -0
- package/dist/gateway/static/root/assets/{image-generation-api-GMTaS6eI.js → image-generation-api-Bu7PyVSh.js} +1 -1
- package/dist/gateway/static/root/assets/index-CYT5DOzr.js +150 -0
- package/dist/gateway/static/root/assets/index-D6e3tPL-.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DhGYddbI.js → keyboard-shortcuts-settings-BMhCuVBZ.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BHYbFjqy.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CmnrBmWi.js → local-apps-page-ijIe7_y2.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-deR2zRaE.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-IIn8Tess.js +2 -0
- package/dist/gateway/static/root/assets/management-settings--V_fovKD.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-split-CZaBPOVn.js → markdown-split-Dt9-in6W.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CiKvSgCv.js → media-plugins-B3pj_iO0.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B4XqB8I6.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-Bisbzqlz.js → notes-page-DZ366lIT.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-S2sBVOLw.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-BxlwhAbH.js → page-tabs-C5ge434C.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-RM8wXxfT.js → preview-open-alternatives-BFa9DgSV.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-tRr-7IxY.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DdBlibek.js → product-open-page-Dc9CcWdu.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BilzoCJ7.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BoQUyacP.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-DUyUaCRF.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-BDKbpmXv.js → schema-form-B84DckWe.js} +1 -1
- package/dist/gateway/static/root/assets/{schemas-C6onAggk.js → schemas-zIBW3wiV.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-Dzxlq1F0.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-TzwlZxU6.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-Dp9itvdy.js +1 -0
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DgIp8_S6.js → settings-loading-skeleton-CCtlhoy7.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-DQmMKf8r.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-97LmwrzC.js → settings-page-layout-EQIOJa_L.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cwi-SPja.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BH7i3g1S.js → share-preview-page-C4_B2jvf.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CkyuGlZK.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BJCePQK5.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BYWLfmJi.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-s-a5WV9j.js → skills-page.utils-Jhm24i4h.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BxjeMT5k.js → system-settings-panel-Dpx2ags2.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BahycnfW.js → task-detail-page-DLAdxI6e.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BRxdsmic.js → theme-store-DnBOcGXi.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-39MjwPSq.js → typed-models-lib-DULmTHUB.js} +1 -1
- package/dist/gateway/static/root/assets/use-autosave-BrjVk5VH.js +1 -0
- package/dist/gateway/static/root/assets/user-context-page-9AAFpGAL.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-XU-7sBSg.js → voice-api-key-field-BISTPfq_.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CJqu8UHq.js → work-discovery-overlay-Wr-uF7VA.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BWds95sL.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DXtg8Qxl.js → workflow-run-setup-panel-DHqHP8_6.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-0b4_DFHr.js +11 -0
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/endpoint-tools-protocol/src/index.js +184 -0
- package/dist/packages/gateway-contract/src/tool-activity.js +0 -36
- package/dist/packages/realtime-client/src/index.js +256 -0
- package/dist/packages/realtime-protocol/src/index.js +88 -0
- package/dist/src/agent/agent-manager.d.ts +1 -1
- package/dist/src/agent/agent-manager.js +7 -13
- package/dist/src/agent/background-review/coordinator.js +1 -1
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +3 -1
- package/dist/src/agent/background-review/run-background-review.d.ts +2 -0
- package/dist/src/agent/background-review/run-background-review.js +10 -9
- package/dist/src/agent/bootstrap/bootstrap-cache.d.ts +0 -1
- package/dist/src/agent/bootstrap/bootstrap-cache.js +3 -4
- package/dist/src/agent/bootstrap/bootstrap-files.d.ts +0 -4
- package/dist/src/agent/bootstrap/bootstrap-files.js +3 -4
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -4
- package/dist/src/agent/bootstrap/load-bootstrap-files.d.ts +0 -1
- package/dist/src/agent/bootstrap/load-bootstrap-files.js +1 -14
- package/dist/src/agent/bootstrap/types.d.ts +1 -1
- package/dist/src/agent/client-error-format.d.ts +1 -1
- package/dist/src/agent/client-error-format.js +1 -1
- package/dist/src/agent/context/workspace-templates/SOUL.md +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.d.ts +17 -0
- package/dist/src/agent/external-tools/endpoint-provider.js +93 -0
- package/dist/src/agent/external-tools/gateway-tools.js +1 -1
- package/dist/src/agent/external-tools/index.d.ts +4 -5
- package/dist/src/agent/external-tools/index.js +8 -2
- package/dist/src/agent/external-tools/types.d.ts +8 -1
- package/dist/src/agent/external-tools/types.js +2 -1
- package/dist/src/agent/inbound/inbound-loop.js +4 -0
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +9 -8
- package/dist/src/agent/inbound/turn-dispatcher.js +13 -11
- package/dist/src/agent/memory/builtin-provider.d.ts +2 -4
- package/dist/src/agent/memory/builtin-provider.js +35 -15
- package/dist/src/agent/memory/context/types.d.ts +3 -1
- package/dist/src/agent/memory/create-memory-manager.js +2 -0
- package/dist/src/agent/memory/index.d.ts +1 -1
- package/dist/src/agent/memory/index.js +1 -1
- package/dist/src/agent/memory/manager.d.ts +9 -1
- package/dist/src/agent/memory/manager.js +39 -9
- package/dist/src/agent/memory/memory-config.d.ts +1 -1
- package/dist/src/agent/memory/memory-config.js +1 -1
- package/dist/src/agent/memory/source-origin.js +0 -2
- package/dist/src/agent/memory/types.d.ts +5 -1
- package/dist/src/agent/memory/understanding/service.d.ts +10 -10
- package/dist/src/agent/memory/understanding/service.js +108 -176
- package/dist/src/agent/memory/understanding/types.d.ts +7 -8
- package/dist/src/agent/memory/user-context-coordinator.d.ts +2 -1
- package/dist/src/agent/memory/user-context-coordinator.js +27 -41
- package/dist/src/agent/messaging/command-handler.d.ts +2 -2
- package/dist/src/agent/messaging/command-handler.js +3 -3
- package/dist/src/agent/orchestration/agent-orchestrator.js +4 -7
- package/dist/src/agent/prompt/sections/memory-skills.js +4 -4
- package/dist/src/agent/prompt/sections/tooling.js +0 -10
- package/dist/src/agent/prompt/service-prompt-builder.d.ts +0 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +4 -33
- package/dist/src/agent/prompt/system-prompt.js +1 -2
- package/dist/src/agent/service/async-queue.d.ts +1 -1
- package/dist/src/agent/service/async-queue.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +2 -2
- package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -1
- package/dist/src/agent/service/process-direct-one-shot.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.d.ts +7 -5
- package/dist/src/agent/service/process-direct-streaming.js +5 -5
- package/dist/src/agent/service.d.ts +2 -3
- package/dist/src/agent/service.js +10 -21
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/session/index.d.ts +1 -1
- package/dist/src/agent/session/session-context.d.ts +2 -0
- package/dist/src/agent/session/session-context.js +4 -0
- package/dist/src/agent/session/session-state-bag.d.ts +4 -4
- package/dist/src/agent/session/session-state-bag.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js +1 -1
- package/dist/src/agent/streaming/reasoning-visibility.d.ts +6 -0
- package/dist/src/agent/streaming/{reasoning-visibility-sse.js → reasoning-visibility.js} +3 -6
- package/dist/src/agent/tools/dreaming-tool.d.ts +0 -2
- package/dist/src/agent/tools/dreaming-tool.js +13 -38
- package/dist/src/agent/tools/factory.d.ts +4 -3
- package/dist/src/agent/tools/factory.js +2 -10
- package/dist/src/agent/tools/index.d.ts +0 -1
- package/dist/src/agent/tools/index.js +1 -2
- package/dist/src/agent/tools/memory-tool.js +1 -1
- package/dist/src/agent/workspace-runtime/registry.d.ts +3 -5
- package/dist/src/agent/workspace-runtime/registry.js +2 -15
- package/dist/src/agent-manifest/schema.d.ts +17 -17
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/memory-runtime.d.ts +2 -2
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/automations/domain/types.d.ts +2 -1
- package/dist/src/automations/domain/validation.d.ts +29 -29
- package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -3
- package/dist/src/automations/service/action-executor.js +4 -1
- package/dist/src/channels/pairing/pairing-challenge.d.ts +1 -1
- package/dist/src/channels/pairing/pairing-challenge.js +1 -1
- package/dist/src/chat-commands/builtins/understanding.js +2 -5
- package/dist/src/cli/commands/agent/stream-renderer.js +4 -1
- 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/init.js +3 -22
- package/dist/src/cli/templates.js +1 -1
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/paths.d.ts +0 -5
- package/dist/src/config/paths.js +2 -11
- package/dist/src/config/rules.js +0 -5
- package/dist/src/config/schema.d.ts +27 -122
- package/dist/src/config/schema.js +9 -42
- package/dist/src/config/web-patch.js +0 -1
- package/dist/src/connectors/learning-coordinator.js +75 -3
- package/dist/src/endpoint-tools/auth.d.ts +20 -0
- package/dist/src/endpoint-tools/auth.js +51 -0
- package/dist/src/endpoint-tools/index.d.ts +5 -0
- package/dist/src/endpoint-tools/index.js +6 -0
- package/dist/src/endpoint-tools/invocation-service.d.ts +68 -0
- package/dist/src/endpoint-tools/invocation-service.js +190 -0
- package/dist/src/endpoint-tools/policy.d.ts +10 -0
- package/dist/src/endpoint-tools/policy.js +18 -0
- package/dist/src/endpoint-tools/registry.d.ts +45 -0
- package/dist/src/endpoint-tools/registry.js +121 -0
- package/dist/src/endpoint-tools/runtime.d.ts +23 -0
- package/dist/src/endpoint-tools/runtime.js +86 -0
- package/dist/src/endpoint-tools/upload-service.d.ts +41 -0
- package/dist/src/endpoint-tools/upload-service.js +103 -0
- package/dist/src/extensions/types/hooks.d.ts +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +0 -5
- package/dist/src/gateway/agents-admin.d.ts +0 -7
- package/dist/src/gateway/agents-admin.js +3 -32
- package/dist/src/gateway/chat-stream/protocol.d.ts +0 -1
- package/dist/src/gateway/clarify-bridge.d.ts +5 -4
- package/dist/src/gateway/clarify-bridge.js +3 -4
- package/dist/src/gateway/dreaming-automation-reconciler.d.ts +3 -3
- package/dist/src/gateway/dreaming-automation-reconciler.js +48 -88
- package/dist/src/gateway/heartbeat/service.js +4 -1
- package/dist/src/gateway/hono/app.js +1 -5
- package/dist/src/gateway/hono/index.d.ts +0 -1
- package/dist/src/gateway/hono/index.js +1 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +20 -9
- package/dist/src/gateway/hono/lib/config-payload.js +3 -2
- package/dist/src/gateway/hono/middleware/auth.js +3 -5
- package/dist/src/gateway/hono/oauth-async.d.ts +1 -0
- package/dist/src/gateway/hono/oauth-async.js +17 -2
- package/dist/src/gateway/hono/routes/agent-stream.js +49 -6
- package/dist/src/gateway/hono/routes/agents.js +1 -33
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +2 -2
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +0 -19
- package/dist/src/gateway/hono/routes/config-patch/misc.js +17 -1
- package/dist/src/gateway/hono/routes/connectors.js +13 -12
- package/dist/src/gateway/hono/routes/deps.d.ts +0 -2
- package/dist/src/gateway/hono/routes/endpoint-tools.d.ts +3 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.js +196 -0
- package/dist/src/gateway/hono/routes/index.js +6 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -5
- package/dist/src/gateway/hono/routes/logs.js +0 -4
- package/dist/src/gateway/hono/routes/public-gateway.js +2 -2
- package/dist/src/gateway/hono/routes/realtime.d.ts +3 -0
- package/dist/src/gateway/hono/routes/realtime.js +35 -0
- package/dist/src/gateway/hono/routes/status.js +0 -7
- package/dist/src/gateway/hono/routes/understanding-sources.d.ts +3 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +203 -0
- package/dist/src/gateway/hono/routes/work-discovery.d.ts +2 -0
- package/dist/src/gateway/hono/routes/work-discovery.js +3 -134
- package/dist/src/gateway/hono/routes/workflows.js +1 -1
- package/dist/src/gateway/hono/routes/you.d.ts +0 -31
- package/dist/src/gateway/hono/routes/you.js +230 -1161
- package/dist/src/gateway/index.d.ts +1 -1
- package/dist/src/gateway/index.js +1 -2
- package/dist/src/gateway/protocol.d.ts +1 -7
- package/dist/src/gateway/security/index.js +1 -1
- package/dist/src/gateway/security/operator-scopes.js +1 -1
- package/dist/src/gateway/server.js +4 -4
- package/dist/src/gateway/service/agent-runner.d.ts +11 -9
- package/dist/src/gateway/service/agent-runner.js +18 -18
- package/dist/src/gateway/service/config-coordinator.d.ts +3 -3
- package/dist/src/gateway/service/run-gateway-agent.d.ts +4 -3
- package/dist/src/gateway/service/run-gateway-agent.js +15 -17
- package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
- package/dist/src/gateway/service/session-input-coordinator.js +4 -2
- package/dist/src/gateway/service/types.d.ts +0 -5
- package/dist/src/gateway/service.d.ts +7 -6
- package/dist/src/gateway/service.js +43 -26
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +2 -4
- package/dist/src/knowledge/connected-understanding-pipeline.js +31 -81
- package/dist/src/knowledge/index.js +2 -2
- package/dist/src/knowledge/people-graph.d.ts +22 -25
- package/dist/src/knowledge/people-graph.js +76 -43
- package/dist/src/mcp/channel-bridge.d.ts +6 -9
- package/dist/src/mcp/channel-bridge.js +48 -76
- package/dist/src/mcp/channel-server.js +2 -6
- package/dist/src/proactive/execution/context.js +8 -13
- package/dist/src/realtime/broker.d.ts +31 -0
- package/dist/src/realtime/broker.js +114 -0
- package/dist/src/realtime/runtime.d.ts +20 -0
- package/dist/src/realtime/runtime.js +263 -0
- package/dist/src/realtime/tickets.d.ts +15 -0
- package/dist/src/realtime/tickets.js +38 -0
- package/dist/src/realtime/writer.d.ts +15 -0
- package/dist/src/realtime/writer.js +78 -0
- package/dist/src/share/share-config.js +0 -1
- package/dist/src/share/site-share-config.js +0 -1
- package/dist/src/storage/sqlite/connector-account-repository.js +0 -1
- package/dist/src/storage/sqlite/context-consolidation-repository.d.ts +37 -0
- package/dist/src/storage/sqlite/context-consolidation-repository.js +64 -0
- package/dist/src/storage/sqlite/endpoint-principal-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/endpoint-principal-repository.js +54 -0
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.d.ts +25 -0
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +42 -0
- package/dist/src/storage/sqlite/fts.d.ts +2 -0
- package/dist/src/storage/sqlite/fts.js +29 -1
- package/dist/src/storage/sqlite/index.d.ts +6 -6
- package/dist/src/storage/sqlite/index.js +7 -7
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +9 -2
- package/dist/src/storage/sqlite/knowledge-repository.js +58 -10
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +7 -56
- package/dist/src/storage/sqlite/memory-records-repository.js +68 -218
- package/dist/src/storage/sqlite/migrations/109_endpoint_principals.sql +14 -0
- package/dist/src/storage/sqlite/migrations/110_session_input_origin.sql +43 -0
- package/dist/src/storage/sqlite/migrations/111_endpoint_tool_invocations.sql +18 -0
- package/dist/src/storage/sqlite/migrations/112_endpoint_instance_bindings.sql +8 -0
- package/dist/src/storage/sqlite/migrations/113_memory_evidence_single_source.sql +54 -0
- package/dist/src/storage/sqlite/migrations/114_user_context_domain.sql +193 -0
- package/dist/src/storage/sqlite/migrations/115_remove_legacy_user_context.sql +6 -0
- package/dist/src/storage/sqlite/migrations/116_structured_context_consolidation.sql +38 -0
- package/dist/src/storage/sqlite/migrations/117_unified_understanding_sources.sql +110 -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/schema.sql +0 -20
- package/dist/src/storage/sqlite/session-input-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/session-input-repository.js +5 -3
- package/dist/src/storage/sqlite/user-context-quality-repository.d.ts +34 -0
- package/dist/src/storage/sqlite/user-context-quality-repository.js +74 -0
- package/dist/src/storage/sqlite/user-context-repository.d.ts +64 -0
- package/dist/src/storage/sqlite/user-context-repository.js +383 -0
- package/dist/src/tasks/home-query-service.d.ts +1 -1
- package/dist/src/tui/backends/embedded-backend.js +5 -2
- package/dist/src/tui/backends/{gateway-sse-backend.d.ts → gateway-realtime-backend.d.ts} +13 -10
- package/dist/src/tui/backends/{gateway-sse-backend.js → gateway-realtime-backend.js} +114 -151
- package/dist/src/tui/tool-summary.js +1 -7
- package/dist/src/tui/tui-agent-events.d.ts +0 -1
- package/dist/src/tui/tui-agent-events.js +2 -15
- package/dist/src/tui/tui-backend.d.ts +4 -4
- package/dist/src/tui/tui-run-state.js +0 -4
- package/dist/src/tui/tui-startup-resources.js +1 -2
- package/dist/src/tui/tui-types.d.ts +2 -9
- package/dist/src/tui/tui-types.js +0 -1
- package/dist/src/tui/tui.js +5 -5
- package/dist/src/tunnel/gateway-lifecycle.d.ts +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/user-context/config.d.ts +17 -210
- package/dist/src/user-context/config.js +19 -85
- package/dist/src/user-context/consolidation.d.ts +26 -0
- package/dist/src/user-context/consolidation.js +115 -0
- package/dist/src/user-context/domain.d.ts +75 -0
- package/dist/src/user-context/domain.js +4 -0
- package/dist/src/user-context/manual-understanding.d.ts +7 -14
- package/dist/src/user-context/manual-understanding.js +19 -49
- package/dist/src/{agent/memory/context → user-context}/planner.d.ts +5 -6
- package/dist/src/user-context/planner.js +311 -0
- package/dist/src/user-context/relationship-continuity.d.ts +3 -6
- package/dist/src/user-context/relationship-continuity.js +39 -32
- package/dist/src/user-context/sources/catalog.d.ts +2 -0
- package/dist/src/user-context/sources/catalog.js +149 -0
- package/dist/src/user-context/sources/index.d.ts +3 -0
- package/dist/src/user-context/sources/index.js +3 -0
- package/dist/src/user-context/sources/repository.d.ts +40 -0
- package/dist/src/user-context/sources/repository.js +164 -0
- package/dist/src/user-context/sources/types.d.ts +83 -0
- package/dist/src/user-context/understandingQuality.d.ts +5 -0
- package/dist/src/user-context/understandingQuality.js +44 -0
- package/dist/src/utils/logger/log-stream.d.ts +3 -10
- package/dist/src/utils/logger/log-stream.js +2 -73
- package/dist/src/utils/logger/pino-record.d.ts +1 -1
- package/dist/src/utils/logger/streams.js +1 -1
- package/dist/src/work-discovery/analyzer.d.ts +4 -3
- package/dist/src/work-discovery/analyzer.js +21 -16
- package/dist/src/work-discovery/incremental-repository.js +42 -40
- package/dist/src/work-discovery/index.js +3 -3
- package/dist/src/work-discovery/service.d.ts +7 -7
- package/dist/src/work-discovery/service.js +241 -190
- package/dist/src/work-discovery/source-repository.js +42 -53
- package/dist/src/work-discovery/types.d.ts +2 -14
- package/package.json +5 -7
- package/dist/gateway/static/root/assets/agents-C6OV-gMm.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-Ci14lDeO.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-Q1xmb4Rh.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DbowrHXD.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DoZPFdKF.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-Dn-7MMEo.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Bt8Hnx0h.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-Bpsebsru.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DFmdYRE5.js +0 -1
- package/dist/gateway/static/root/assets/connector-logo-TRr9ybf6.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Tg5kl22i.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-B3B1eqnr.js +0 -2
- package/dist/gateway/static/root/assets/extension-settings-page-C9ag5tb5.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-9g8uIry9.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-fl1oC_-5.js +0 -1
- package/dist/gateway/static/root/assets/home-page-Bao9jq_z.js +0 -3
- package/dist/gateway/static/root/assets/index-Cl5n1f_U.css +0 -1
- package/dist/gateway/static/root/assets/index-OJgiMh07.js +0 -223
- package/dist/gateway/static/root/assets/local-app-workbench-page-B69NvtvH.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-D6hs74o5.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-Cq3cABqg.js +0 -7
- package/dist/gateway/static/root/assets/messages-D02NNLCZ.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-BOZfJFhE.js +0 -4
- package/dist/gateway/static/root/assets/product-delivery-C8JbSj5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-TSKFb2tN.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BokeBrTT.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C56anxCX.js +0 -1
- package/dist/gateway/static/root/assets/segmented-styles-BL8oLBEp.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-C7TQADrD.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BDOPKeAX.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-zxo5ZGOu.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BUPSIa9P.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BRg766eW.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DhEAviQ_.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Ct7AV8ls.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DoVuprZm.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-BGk_Tbsj.js +0 -1
- package/dist/gateway/static/root/assets/use-save-bar-registration-5aVSjTjO.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-B9K41qmy.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BBVnRHju.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-Bs_tYfst.js +0 -11
- package/dist/src/agent/code-intelligence/binary.d.ts +0 -15
- package/dist/src/agent/code-intelligence/binary.js +0 -372
- package/dist/src/agent/code-intelligence/index.d.ts +0 -4
- package/dist/src/agent/code-intelligence/index.js +0 -4
- package/dist/src/agent/code-intelligence/runtime.d.ts +0 -34
- package/dist/src/agent/code-intelligence/runtime.js +0 -280
- package/dist/src/agent/code-intelligence/tool-gating.d.ts +0 -5
- package/dist/src/agent/code-intelligence/tool-gating.js +0 -6
- package/dist/src/agent/code-intelligence/tools.d.ts +0 -6
- package/dist/src/agent/code-intelligence/tools.js +0 -266
- package/dist/src/agent/code-intelligence/types.d.ts +0 -22
- package/dist/src/agent/memory/context/planner.js +0 -286
- package/dist/src/agent/memory/dreaming/config.d.ts +0 -48
- package/dist/src/agent/memory/dreaming/config.js +0 -98
- package/dist/src/agent/memory/dreaming/constants.d.ts +0 -12
- package/dist/src/agent/memory/dreaming/constants.js +0 -18
- package/dist/src/agent/memory/dreaming/deep-promotion.d.ts +0 -19
- package/dist/src/agent/memory/dreaming/deep-promotion.js +0 -152
- package/dist/src/agent/memory/dreaming/light-sweep.d.ts +0 -16
- package/dist/src/agent/memory/dreaming/light-sweep.js +0 -115
- package/dist/src/agent/memory/dreaming/preview.d.ts +0 -23
- package/dist/src/agent/memory/dreaming/preview.js +0 -52
- package/dist/src/agent/memory/dreaming/promotion-lifecycle.d.ts +0 -16
- package/dist/src/agent/memory/dreaming/promotion-lifecycle.js +0 -44
- package/dist/src/agent/memory/dreaming/rem-patterns.d.ts +0 -19
- package/dist/src/agent/memory/dreaming/rem-patterns.js +0 -150
- package/dist/src/agent/memory/dreaming/runner.d.ts +0 -10
- package/dist/src/agent/memory/dreaming/runner.js +0 -78
- package/dist/src/agent/memory/dreaming/schedule.d.ts +0 -23
- package/dist/src/agent/memory/dreaming/schedule.js +0 -38
- package/dist/src/agent/memory/dreaming/scope.d.ts +0 -11
- package/dist/src/agent/memory/dreaming/scope.js +0 -33
- package/dist/src/agent/memory/dreaming/utils.d.ts +0 -3
- package/dist/src/agent/memory/dreaming/utils.js +0 -31
- package/dist/src/agent/streaming/reasoning-visibility-sse.d.ts +0 -15
- package/dist/src/gateway/agent-run-relay.d.ts +0 -19
- package/dist/src/gateway/agent-run-relay.js +0 -169
- package/dist/src/gateway/hono/routes/memory.d.ts +0 -3
- package/dist/src/gateway/hono/routes/memory.js +0 -460
- package/dist/src/gateway/hono/sse.d.ts +0 -53
- package/dist/src/gateway/hono/sse.js +0 -207
- package/dist/src/gateway/service/sse-hub.d.ts +0 -10
- package/dist/src/gateway/service/sse-hub.js +0 -53
- package/dist/src/storage/sqlite/dreaming-repository.d.ts +0 -61
- package/dist/src/storage/sqlite/dreaming-repository.js +0 -88
- package/dist/src/storage/sqlite/memory-readiness-repository.d.ts +0 -7
- package/dist/src/storage/sqlite/memory-readiness-repository.js +0 -30
- package/dist/src/storage/sqlite/memory-reference-consent-repository.d.ts +0 -27
- package/dist/src/storage/sqlite/memory-reference-consent-repository.js +0 -107
- package/dist/src/storage/sqlite/user-claims-repository.d.ts +0 -101
- package/dist/src/storage/sqlite/user-claims-repository.js +0 -241
- package/dist/src/storage/sqlite/user-profile-setup-repository.d.ts +0 -3
- package/dist/src/storage/sqlite/user-profile-setup-repository.js +0 -32
- package/dist/src/tui/sse-consumer.d.ts +0 -15
- package/dist/src/tui/sse-consumer.js +0 -73
- package/dist/src/user-context/context-compiler.d.ts +0 -27
- package/dist/src/user-context/context-compiler.js +0 -48
- package/dist/src/user-context/import.d.ts +0 -12
- package/dist/src/user-context/import.js +0 -51
- package/dist/src/user-context/memory-episode-evaluator.d.ts +0 -32
- package/dist/src/user-context/memory-episode-evaluator.js +0 -35
- package/dist/src/user-context/memory-readiness.d.ts +0 -33
- package/dist/src/user-context/memory-readiness.js +0 -41
- package/dist/src/user-context/memory-use-audit.d.ts +0 -10
- package/dist/src/user-context/memory-use-audit.js +0 -26
- package/dist/src/user-context/personal-playbook.d.ts +0 -11
- package/dist/src/user-context/personal-playbook.js +0 -41
- package/dist/src/user-context/profile.d.ts +0 -37
- package/dist/src/user-context/profile.js +0 -163
- package/dist/src/user-context/projection.d.ts +0 -120
- package/dist/src/user-context/projection.js +0 -262
- package/dist/src/user-context/source-recommendations.d.ts +0 -13
- package/dist/src/user-context/source-recommendations.js +0 -85
- /package/dist/src/{agent/code-intelligence → user-context/sources}/types.js +0 -0
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import {
|
|
4
|
-
import { upsertKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
|
|
3
|
+
import { createContextEvidence, createUnderstanding, getUnderstanding, linkUnderstandingEvidence, listUnderstandingEvidence, listUnderstandings, rejectUnderstanding, reviseUnderstanding, setUnderstandingStatus } from "../storage/sqlite/user-context-repository.js";
|
|
5
4
|
import "../storage/sqlite/index.js";
|
|
6
5
|
import { ActivityService } from "../activity/service.js";
|
|
7
6
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
8
7
|
import { buildSessionKey, init_session_key } from "../routing/session-key.js";
|
|
9
8
|
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
10
|
-
import {
|
|
9
|
+
import { createUnderstandingSourceRun, getUnderstandingSourceRun, listUserFocuses, setUserFocusStatus, updateUnderstandingSourceGrantCheckpoint, updateUnderstandingSourceRun, upsertUnderstandingSourceGrant, upsertUserFocus } from "../user-context/sources/repository.js";
|
|
11
10
|
import { previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, summarizeWorkContextSnapshot } from "./probe.js";
|
|
12
|
-
import {
|
|
11
|
+
import { analyzeUnderstandingSources, analyzeWorkContext, workDiscoveryResultMarkdown } from "./analyzer.js";
|
|
13
12
|
import { discoverWorkCandidates } from "./candidate-discovery.js";
|
|
14
13
|
import { workDiscoveryFingerprintsEqual } from "./incremental.js";
|
|
14
|
+
import { createWorkDiscoveryRun, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, updateWorkDiscoveryRun } from "./repository.js";
|
|
15
15
|
import { findActiveWorkDiscoverySourceRefresh, recordWorkDiscoverySourceRefresh, updateWorkDiscoverySourceRefreshForRun } from "./incremental-repository.js";
|
|
16
16
|
import { appendWorkUnderstandingEvidence, getWorkUnderstandingInvestigationForRun, listWorkUnderstandingEvidence } from "./investigation-repository.js";
|
|
17
17
|
import { investigateWorkContext } from "./investigator.js";
|
|
18
18
|
import { persistWorkThreadsFromDiscovery } from "./thread-service.js";
|
|
19
|
-
import { createWorkDiscoveryRun, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, updateWorkDiscoveryRun } from "./repository.js";
|
|
20
19
|
import { getWorkDiscoveryDirectorySource, listWorkDiscoveryDirectorySources, revokeWorkDiscoveryDirectorySource, upsertWorkDiscoveryDirectorySource } from "./source-repository.js";
|
|
21
20
|
import { createHash, randomUUID } from "node:crypto";
|
|
22
21
|
//#region src/work-discovery/service.ts
|
|
@@ -25,6 +24,70 @@ init_session_key();
|
|
|
25
24
|
init_resolve_route();
|
|
26
25
|
init_logger();
|
|
27
26
|
const log = createLogger("WorkDiscovery");
|
|
27
|
+
const LOCAL_BOOTSTRAP_SOURCE_IDS = new Set([
|
|
28
|
+
"apple-notes",
|
|
29
|
+
"apple-calendar",
|
|
30
|
+
"apple-reminders",
|
|
31
|
+
"windows-recent-documents",
|
|
32
|
+
"linux-recent-documents"
|
|
33
|
+
]);
|
|
34
|
+
function understandingKind(category) {
|
|
35
|
+
if (category === "preference") return "preference";
|
|
36
|
+
if (category === "workflow") return "routine";
|
|
37
|
+
if (category === "focus") return "current_state";
|
|
38
|
+
return "project_context";
|
|
39
|
+
}
|
|
40
|
+
function understandingKey(candidate) {
|
|
41
|
+
const normalized = candidate.statement.toLocaleLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim();
|
|
42
|
+
return `work-discovery:${candidate.category}:${createHash("sha256").update(normalized).digest("hex").slice(0, 20)}`;
|
|
43
|
+
}
|
|
44
|
+
function sameScope(left, right) {
|
|
45
|
+
return left.type === right.type && left.id === right.id;
|
|
46
|
+
}
|
|
47
|
+
function persistUnderstandingCandidate(candidate, scope, sourceRef) {
|
|
48
|
+
const canonicalKey = understandingKey(candidate);
|
|
49
|
+
const existing = listUnderstandings().find((item) => item.canonicalKey === canonicalKey && sameScope(item.scope, scope));
|
|
50
|
+
if (existing) return existing;
|
|
51
|
+
const evidence = createContextEvidence({
|
|
52
|
+
sourceType: "runtime",
|
|
53
|
+
sourceRef: `${sourceRef}:${candidate.id}`,
|
|
54
|
+
redactedExcerpt: candidate.evidence.join(" · ").slice(0, 600),
|
|
55
|
+
trustLevel: "trusted",
|
|
56
|
+
observedAt: Date.now()
|
|
57
|
+
});
|
|
58
|
+
const understanding = createUnderstanding({
|
|
59
|
+
kind: understandingKind(candidate.category),
|
|
60
|
+
canonicalKey,
|
|
61
|
+
status: "candidate",
|
|
62
|
+
scope,
|
|
63
|
+
explicitness: "inferred",
|
|
64
|
+
durability: candidate.category === "focus" ? "ephemeral" : candidate.category === "workflow" ? "recurring" : "durable",
|
|
65
|
+
sensitivity: "normal",
|
|
66
|
+
disclosurePolicy: "referenceable",
|
|
67
|
+
confidence: candidate.confidence === "high" ? .9 : candidate.confidence === "medium" ? .72 : .58,
|
|
68
|
+
statement: candidate.statement,
|
|
69
|
+
createdBy: "runtime",
|
|
70
|
+
changeReason: "work discovery inference"
|
|
71
|
+
});
|
|
72
|
+
linkUnderstandingEvidence(understanding.versionId, evidence.id, "supports", understanding.confidence);
|
|
73
|
+
return understanding;
|
|
74
|
+
}
|
|
75
|
+
function decideUnderstanding(input, expectedSourcePrefix) {
|
|
76
|
+
const current = getUnderstanding(input.understandingId);
|
|
77
|
+
const owned = current && listUnderstandingEvidence(current.id).some((evidence) => evidence.sourceRef.startsWith(expectedSourcePrefix));
|
|
78
|
+
if (!current || !owned || current.status === "archived") return void 0;
|
|
79
|
+
if (input.status === "rejected") return rejectUnderstanding(current.id, "Rejected from work discovery review");
|
|
80
|
+
const statement = input.status === "edited" ? input.statement?.trim().slice(0, 500) : void 0;
|
|
81
|
+
if (input.status === "edited" && !statement) return void 0;
|
|
82
|
+
return setUnderstandingStatus((statement ? reviseUnderstanding(current.id, statement, {
|
|
83
|
+
explicitness: "explicit",
|
|
84
|
+
confidence: 1,
|
|
85
|
+
changeReason: "Edited during work discovery review"
|
|
86
|
+
}) : current).id, "active", {
|
|
87
|
+
explicitness: "explicit",
|
|
88
|
+
confidence: 1
|
|
89
|
+
});
|
|
90
|
+
}
|
|
28
91
|
function sessionMetadata(agentId, peerId) {
|
|
29
92
|
return {
|
|
30
93
|
sourceChannel: "webchat",
|
|
@@ -185,112 +248,140 @@ var WorkDiscoveryService = class {
|
|
|
185
248
|
revokeDirectorySource(id) {
|
|
186
249
|
return revokeWorkDiscoveryDirectorySource(id);
|
|
187
250
|
}
|
|
188
|
-
async
|
|
251
|
+
async importUnderstandingSources(rawItems, signal, runId) {
|
|
189
252
|
let remaining = 3e5;
|
|
190
|
-
const
|
|
191
|
-
"
|
|
192
|
-
"
|
|
193
|
-
"
|
|
253
|
+
const itemTypes = new Set([
|
|
254
|
+
"document",
|
|
255
|
+
"calendar_event",
|
|
256
|
+
"task",
|
|
257
|
+
"note",
|
|
258
|
+
"mail",
|
|
259
|
+
"message",
|
|
260
|
+
"code_activity"
|
|
261
|
+
]);
|
|
262
|
+
const ownerAttributions = new Set([
|
|
263
|
+
"user",
|
|
264
|
+
"other",
|
|
265
|
+
"shared",
|
|
266
|
+
"unknown"
|
|
267
|
+
]);
|
|
268
|
+
const sensitivities = new Set([
|
|
269
|
+
"normal",
|
|
270
|
+
"personal",
|
|
271
|
+
"secret",
|
|
272
|
+
"regulated"
|
|
194
273
|
]);
|
|
195
274
|
const items = rawItems.flatMap((value) => {
|
|
196
275
|
if (!value || typeof value !== "object" || remaining <= 0) return [];
|
|
197
276
|
const raw = value;
|
|
198
277
|
const id = typeof raw.id === "string" ? raw.id.trim().slice(0, 500) : "";
|
|
278
|
+
const sourceId = typeof raw.sourceId === "string" ? raw.sourceId.trim().slice(0, 200) : "";
|
|
199
279
|
const title = typeof raw.title === "string" ? raw.title.trim().slice(0, 300) : "";
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
const
|
|
203
|
-
|
|
280
|
+
const type = typeof raw.type === "string" && itemTypes.has(raw.type) ? raw.type : null;
|
|
281
|
+
const evidenceRef = typeof raw.evidenceRef === "string" ? raw.evidenceRef.trim().slice(0, 1e3) : "";
|
|
282
|
+
const ownerAttribution = typeof raw.ownerAttribution === "string" && ownerAttributions.has(raw.ownerAttribution) ? raw.ownerAttribution : "unknown";
|
|
283
|
+
const sensitivity = typeof raw.sensitivity === "string" && sensitivities.has(raw.sensitivity) ? raw.sensitivity : "personal";
|
|
284
|
+
if (!id || !LOCAL_BOOTSTRAP_SOURCE_IDS.has(sourceId) || !title || !type || !evidenceRef.startsWith(`${sourceId}://`) || sensitivity === "secret" || sensitivity === "regulated") return [];
|
|
285
|
+
const text = typeof raw.text === "string" ? raw.text.trim().slice(0, Math.min(12e3, remaining)) : "";
|
|
286
|
+
remaining -= text.length;
|
|
204
287
|
const timestamp = (key) => {
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
return Number.isFinite(new Date(value).getTime()) ? value : void 0;
|
|
288
|
+
const candidate = raw[key];
|
|
289
|
+
return typeof candidate === "number" && Number.isFinite(candidate) ? candidate : void 0;
|
|
208
290
|
};
|
|
209
291
|
return [{
|
|
210
292
|
id,
|
|
211
|
-
|
|
293
|
+
sourceId,
|
|
294
|
+
type,
|
|
212
295
|
title,
|
|
296
|
+
ownerAttribution,
|
|
297
|
+
sensitivity,
|
|
298
|
+
evidenceRef,
|
|
299
|
+
...text ? { text } : {},
|
|
213
300
|
...typeof raw.group === "string" && raw.group.trim() ? { group: raw.group.trim().slice(0, 200) } : {},
|
|
214
|
-
|
|
215
|
-
...timestamp("
|
|
216
|
-
...timestamp("
|
|
217
|
-
...timestamp("
|
|
218
|
-
...timestamp("endsAt") ? { endsAt: timestamp("endsAt") } : {}
|
|
301
|
+
...timestamp("occurredAt") != null ? { occurredAt: timestamp("occurredAt") } : {},
|
|
302
|
+
...timestamp("modifiedAt") != null ? { modifiedAt: timestamp("modifiedAt") } : {},
|
|
303
|
+
...timestamp("startsAt") != null ? { startsAt: timestamp("startsAt") } : {},
|
|
304
|
+
...timestamp("endsAt") != null ? { endsAt: timestamp("endsAt") } : {}
|
|
219
305
|
}];
|
|
220
306
|
}).slice(0, 150);
|
|
221
|
-
if (!items.length) throw new Error("No readable
|
|
307
|
+
if (!items.length) throw new Error("No readable understanding source items were provided");
|
|
308
|
+
const sourceRuns = /* @__PURE__ */ new Map();
|
|
309
|
+
for (const sourceId of new Set(items.map((item) => item.sourceId))) {
|
|
310
|
+
const sourceItems = items.filter((item) => item.sourceId === sourceId);
|
|
311
|
+
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";
|
|
312
|
+
const platform = sourceId.startsWith("apple-") ? "darwin" : sourceId.startsWith("windows-") ? "win32" : sourceId.startsWith("linux-") ? "linux" : "all";
|
|
313
|
+
const sourceRun = createUnderstandingSourceRun({
|
|
314
|
+
grantId: upsertUnderstandingSourceGrant({
|
|
315
|
+
sourceKey: `understanding-source:${sourceId}`,
|
|
316
|
+
adapterId: sourceId,
|
|
317
|
+
category,
|
|
318
|
+
platform,
|
|
319
|
+
displayName: sourceId,
|
|
320
|
+
accessMode: "once",
|
|
321
|
+
retentionPolicy: "derived_only",
|
|
322
|
+
processingPolicy: "remote_allowed",
|
|
323
|
+
config: { readOnly: true }
|
|
324
|
+
}).id,
|
|
325
|
+
kind: "bootstrap"
|
|
326
|
+
});
|
|
327
|
+
sourceRuns.set(sourceId, sourceRun.id);
|
|
328
|
+
}
|
|
222
329
|
const linkedRun = runId ? getWorkDiscoveryRun(runId) : null;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if (calendarItems.length > 0) upsertKnowledgeSourceItems(calendarItems.map((item) => {
|
|
236
|
-
const normalizedText = JSON.stringify({
|
|
237
|
-
title: item.title,
|
|
238
|
-
description: item.content,
|
|
239
|
-
start: new Date(item.startsAt).toISOString(),
|
|
240
|
-
...item.endsAt != null ? { end: new Date(item.endsAt).toISOString() } : {},
|
|
241
|
-
...item.group ? { calendar: item.group } : {}
|
|
330
|
+
let analysis;
|
|
331
|
+
try {
|
|
332
|
+
analysis = await analyzeUnderstandingSources({
|
|
333
|
+
config: this.options.getConfig(),
|
|
334
|
+
items,
|
|
335
|
+
...linkedRun?.result ? { workContext: {
|
|
336
|
+
projectSummary: linkedRun.result.projectSummary,
|
|
337
|
+
currentState: linkedRun.result.currentState,
|
|
338
|
+
uncertainties: linkedRun.result.uncertainties,
|
|
339
|
+
workThreads: linkedRun.result.workThreads
|
|
340
|
+
} } : {},
|
|
341
|
+
signal
|
|
242
342
|
});
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
|
|
343
|
+
for (const [sourceId, sourceRunId] of sourceRuns) {
|
|
344
|
+
updateUnderstandingSourceRun(sourceRunId, {
|
|
345
|
+
status: "completed",
|
|
346
|
+
itemsSeen: items.filter((item) => item.sourceId === sourceId).length,
|
|
347
|
+
completed: true,
|
|
348
|
+
metadata: { sourceId }
|
|
349
|
+
});
|
|
350
|
+
const sourceRun = getUnderstandingSourceRun(sourceRunId);
|
|
351
|
+
if (sourceRun) updateUnderstandingSourceGrantCheckpoint(sourceRun.grantId, {
|
|
352
|
+
checkpoint: { lastBootstrapRunId: sourceRunId },
|
|
353
|
+
lastCollectedAt: Date.now()
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
} catch (error) {
|
|
357
|
+
for (const sourceRunId of sourceRuns.values()) updateUnderstandingSourceRun(sourceRunId, {
|
|
358
|
+
status: signal?.aborted ? "canceled" : "failed",
|
|
359
|
+
errorMessage: error instanceof Error ? error.message : String(error),
|
|
360
|
+
completed: true
|
|
361
|
+
});
|
|
362
|
+
throw error;
|
|
363
|
+
}
|
|
364
|
+
const rawContents = items.flatMap((item) => item.text ? [item.text] : []);
|
|
264
365
|
const safeProfileCandidates = analysis.profileCandidates.filter((candidate) => !hasLongVerbatimOverlap(candidate.statement, rawContents));
|
|
265
366
|
const safeWorkThreadCandidates = analysis.workThreadCandidates.filter((candidate) => !hasLongVerbatimOverlap(candidate.title, rawContents) && !hasLongVerbatimOverlap(candidate.summary, rawContents));
|
|
266
|
-
const agentId = getDefaultAgentId(this.options.getConfig());
|
|
267
367
|
const profileCandidates = safeProfileCandidates.map((candidate) => {
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
`work-discovery:${candidate.category}`
|
|
282
|
-
],
|
|
283
|
-
status: "candidate",
|
|
284
|
-
sensitivity: "normal",
|
|
285
|
-
explicitness: "inferred",
|
|
286
|
-
durability: candidate.category === "focus" ? "ephemeral" : candidate.category === "workflow" ? "recurring" : "durable",
|
|
287
|
-
importance: candidate.category === "focus" ? .75 : .65,
|
|
288
|
-
disclosurePolicy: "referenceable"
|
|
289
|
-
});
|
|
368
|
+
const understanding = persistUnderstandingCandidate(candidate, { type: "global" }, "understanding-source:onboarding");
|
|
369
|
+
for (const sourceRunId of sourceRuns.values()) {
|
|
370
|
+
const sourceRun = getUnderstandingSourceRun(sourceRunId);
|
|
371
|
+
if (!sourceRun) continue;
|
|
372
|
+
const evidence = createContextEvidence({
|
|
373
|
+
sourceType: "runtime",
|
|
374
|
+
sourceRef: `understanding-source-grant:${sourceRun.grantId}:${candidate.id}`,
|
|
375
|
+
redactedExcerpt: candidate.evidence.join(" · ").slice(0, 600),
|
|
376
|
+
trustLevel: "trusted",
|
|
377
|
+
observedAt: Date.now()
|
|
378
|
+
});
|
|
379
|
+
linkUnderstandingEvidence(understanding.versionId, evidence.id, "supports", understanding.confidence);
|
|
380
|
+
}
|
|
290
381
|
return {
|
|
291
382
|
...candidate,
|
|
292
|
-
status: "pending",
|
|
293
|
-
|
|
383
|
+
status: understanding.status === "rejected" ? "rejected" : "pending",
|
|
384
|
+
understandingId: understanding.id
|
|
294
385
|
};
|
|
295
386
|
});
|
|
296
387
|
const investigation = linkedRun ? getWorkUnderstandingInvestigationForRun(linkedRun.id) : null;
|
|
@@ -299,8 +390,8 @@ var WorkDiscoveryService = class {
|
|
|
299
390
|
return appendWorkUnderstandingEvidence({
|
|
300
391
|
investigationId: investigation.id,
|
|
301
392
|
projectId: linkedRun.projectId,
|
|
302
|
-
sourceType: "
|
|
303
|
-
sourceRef: `
|
|
393
|
+
sourceType: "understanding_source",
|
|
394
|
+
sourceRef: `understanding-source://thread/${topicHash}`,
|
|
304
395
|
observation: candidate.summary,
|
|
305
396
|
contentHash: createHash("sha256").update(JSON.stringify(candidate.evidenceRefs)).digest("hex"),
|
|
306
397
|
sensitivity: "normal"
|
|
@@ -309,8 +400,8 @@ var WorkDiscoveryService = class {
|
|
|
309
400
|
const workThreads = linkedRun && contextEvidence.length ? persistWorkThreadsFromDiscovery({
|
|
310
401
|
projectId: linkedRun.projectId,
|
|
311
402
|
result: {
|
|
312
|
-
projectSummary: "
|
|
313
|
-
currentState: "Work streams inferred from explicitly connected
|
|
403
|
+
projectSummary: "Connected source context",
|
|
404
|
+
currentState: "Work streams inferred from sources the user explicitly connected.",
|
|
314
405
|
uncertainties: [],
|
|
315
406
|
suggestions: [],
|
|
316
407
|
workThreadCandidates: safeWorkThreadCandidates.map((candidate, index) => ({
|
|
@@ -320,9 +411,9 @@ var WorkDiscoveryService = class {
|
|
|
320
411
|
},
|
|
321
412
|
snapshot: {
|
|
322
413
|
root: {
|
|
323
|
-
displayName: "
|
|
414
|
+
displayName: "Connected Sources",
|
|
324
415
|
projectKind: "general",
|
|
325
|
-
markerReasons: ["
|
|
416
|
+
markerReasons: ["explicitly_connected_understanding_sources"]
|
|
326
417
|
},
|
|
327
418
|
structure: {
|
|
328
419
|
sampledPaths: [],
|
|
@@ -339,38 +430,36 @@ var WorkDiscoveryService = class {
|
|
|
339
430
|
},
|
|
340
431
|
evidence: contextEvidence
|
|
341
432
|
}) : [];
|
|
433
|
+
const focuses = safeWorkThreadCandidates.map((candidate) => upsertUserFocus({
|
|
434
|
+
canonicalKey: `source-focus:${candidate.topicKey}`,
|
|
435
|
+
title: candidate.title,
|
|
436
|
+
summary: candidate.summary,
|
|
437
|
+
horizon: candidate.horizon,
|
|
438
|
+
status: "candidate",
|
|
439
|
+
confidence: candidate.confidence === "high" ? .9 : candidate.confidence === "medium" ? .72 : .55,
|
|
440
|
+
evidenceRefs: candidate.evidenceRefs,
|
|
441
|
+
sourceRunId: sourceRuns.get(items[0].sourceId)
|
|
442
|
+
}));
|
|
342
443
|
log.info({
|
|
343
444
|
runId,
|
|
344
445
|
itemCount: items.length,
|
|
345
446
|
candidateCount: profileCandidates.length,
|
|
346
|
-
|
|
347
|
-
}, "
|
|
447
|
+
focusCount: focuses.length
|
|
448
|
+
}, "Understanding sources analyzed");
|
|
348
449
|
return {
|
|
349
450
|
profileCandidates,
|
|
350
|
-
workThreads
|
|
451
|
+
workThreads,
|
|
452
|
+
focuses
|
|
351
453
|
};
|
|
352
454
|
}
|
|
353
|
-
|
|
455
|
+
updateUnderstandingSourceProfile(input) {
|
|
354
456
|
return input.decisions.flatMap((decision) => {
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
if (decision.status === "edited" && !statement) return [];
|
|
359
|
-
const updated = this.preserveMemoryRecord(record, {
|
|
360
|
-
providerId: "local",
|
|
361
|
-
status: decision.status === "rejected" ? "rejected" : "active",
|
|
362
|
-
...statement ? {
|
|
363
|
-
content: statement,
|
|
364
|
-
explicitness: "explicit",
|
|
365
|
-
confidence: 1
|
|
366
|
-
} : {},
|
|
367
|
-
...decision.status !== "rejected" ? { reviewAfter: nextMemoryReviewAt(record) } : {}
|
|
368
|
-
});
|
|
369
|
-
return [{
|
|
370
|
-
memoryRecordId: updated.id,
|
|
457
|
+
const updated = decideUnderstanding(decision, "understanding-source:");
|
|
458
|
+
return updated ? [{
|
|
459
|
+
understandingId: updated.id,
|
|
371
460
|
status: decision.status,
|
|
372
|
-
statement: updated.
|
|
373
|
-
}];
|
|
461
|
+
statement: updated.statement
|
|
462
|
+
}] : [];
|
|
374
463
|
});
|
|
375
464
|
}
|
|
376
465
|
async rescanDirectorySource(input) {
|
|
@@ -588,6 +677,16 @@ var WorkDiscoveryService = class {
|
|
|
588
677
|
snapshot: investigatedSnapshot,
|
|
589
678
|
evidence: unifiedEvidence
|
|
590
679
|
});
|
|
680
|
+
for (const thread of workThreads) upsertUserFocus({
|
|
681
|
+
canonicalKey: `work-focus:${thread.canonicalKey}`,
|
|
682
|
+
title: thread.title,
|
|
683
|
+
summary: thread.summary,
|
|
684
|
+
horizon: thread.horizon,
|
|
685
|
+
status: "candidate",
|
|
686
|
+
confidence: thread.confidence,
|
|
687
|
+
projectId: run.projectId,
|
|
688
|
+
evidenceRefs: thread.evidenceIds
|
|
689
|
+
});
|
|
591
690
|
const result = this.persistProfileCandidates(run, {
|
|
592
691
|
...baseResult,
|
|
593
692
|
...workThreads.length ? { workThreads } : {}
|
|
@@ -730,36 +829,13 @@ var WorkDiscoveryService = class {
|
|
|
730
829
|
persistProfileCandidates(run, result) {
|
|
731
830
|
if (!result.profileCandidates?.length) return result;
|
|
732
831
|
const profileCandidates = result.profileCandidates.map((candidate) => {
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
providerId: "local",
|
|
738
|
-
kind,
|
|
739
|
-
sourceAgentId: run.agentId,
|
|
740
|
-
sessionKey: run.sessionKey,
|
|
741
|
-
projectId: run.projectId,
|
|
742
|
-
content: candidate.statement,
|
|
743
|
-
source: {
|
|
744
|
-
provider: "work-discovery",
|
|
745
|
-
path: `work-discovery://${run.id}`
|
|
746
|
-
},
|
|
747
|
-
confidence,
|
|
748
|
-
tags: [
|
|
749
|
-
"user-understanding",
|
|
750
|
-
"work-discovery",
|
|
751
|
-
`work-discovery:${candidate.category}`
|
|
752
|
-
],
|
|
753
|
-
status: "candidate",
|
|
754
|
-
sensitivity: "normal",
|
|
755
|
-
explicitness: "inferred",
|
|
756
|
-
durability,
|
|
757
|
-
importance: candidate.category === "focus" ? .75 : .65,
|
|
758
|
-
disclosurePolicy: "referenceable"
|
|
759
|
-
});
|
|
832
|
+
const understanding = persistUnderstandingCandidate(candidate, {
|
|
833
|
+
type: "project",
|
|
834
|
+
id: run.projectId
|
|
835
|
+
}, `work-discovery:${run.id}`);
|
|
760
836
|
return {
|
|
761
837
|
...candidate,
|
|
762
|
-
|
|
838
|
+
understandingId: understanding.id
|
|
763
839
|
};
|
|
764
840
|
});
|
|
765
841
|
return {
|
|
@@ -773,23 +849,15 @@ var WorkDiscoveryService = class {
|
|
|
773
849
|
const decisions = new Map(input.decisions.map((decision) => [decision.id, decision]));
|
|
774
850
|
const profileCandidates = run.result.profileCandidates.map((candidate) => {
|
|
775
851
|
const decision = decisions.get(candidate.id);
|
|
776
|
-
if (!decision || !candidate.
|
|
777
|
-
const
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
status: decision.status === "rejected" ? "rejected" : "active",
|
|
783
|
-
...statement ? {
|
|
784
|
-
content: statement,
|
|
785
|
-
explicitness: "explicit",
|
|
786
|
-
confidence: 1
|
|
787
|
-
} : {},
|
|
788
|
-
...decision.status !== "rejected" ? { reviewAfter: nextMemoryReviewAt(record) } : {}
|
|
789
|
-
});
|
|
852
|
+
if (!decision || !candidate.understandingId) return candidate;
|
|
853
|
+
const updated = decideUnderstanding({
|
|
854
|
+
understandingId: candidate.understandingId,
|
|
855
|
+
...decision
|
|
856
|
+
}, `work-discovery:${run.id}:`);
|
|
857
|
+
if (!updated) return candidate;
|
|
790
858
|
return {
|
|
791
859
|
...candidate,
|
|
792
|
-
|
|
860
|
+
statement: updated.statement,
|
|
793
861
|
status: decision.status
|
|
794
862
|
};
|
|
795
863
|
});
|
|
@@ -798,36 +866,6 @@ var WorkDiscoveryService = class {
|
|
|
798
866
|
profileCandidates
|
|
799
867
|
} });
|
|
800
868
|
}
|
|
801
|
-
preserveMemoryRecord(record, patch) {
|
|
802
|
-
return upsertMemoryRecord({
|
|
803
|
-
id: record.id,
|
|
804
|
-
providerId: record.providerId,
|
|
805
|
-
kind: record.kind,
|
|
806
|
-
sourceAgentId: record.provenance.sourceAgentId,
|
|
807
|
-
workspaceId: record.scope.workspaceId,
|
|
808
|
-
sessionKey: record.scope.sessionKey,
|
|
809
|
-
projectId: record.scope.projectId,
|
|
810
|
-
content: record.content,
|
|
811
|
-
source: record.source,
|
|
812
|
-
confidence: record.confidence,
|
|
813
|
-
tags: record.tags,
|
|
814
|
-
status: record.status,
|
|
815
|
-
sensitivity: record.sensitivity,
|
|
816
|
-
canonicalKey: record.canonicalKey,
|
|
817
|
-
explicitness: record.explicitness,
|
|
818
|
-
durability: record.durability,
|
|
819
|
-
importance: record.importance,
|
|
820
|
-
disclosurePolicy: record.disclosurePolicy,
|
|
821
|
-
evidence: record.evidence,
|
|
822
|
-
reviewAfter: record.reviewAfter,
|
|
823
|
-
expiresAt: record.expiresAt,
|
|
824
|
-
validFrom: record.validFrom,
|
|
825
|
-
validTo: record.validTo,
|
|
826
|
-
supersedesRecordId: record.supersedesRecordId,
|
|
827
|
-
conflictGroupId: record.conflictGroupId,
|
|
828
|
-
...patch
|
|
829
|
-
});
|
|
830
|
-
}
|
|
831
869
|
cancelRun(id) {
|
|
832
870
|
const run = getWorkDiscoveryRun(id);
|
|
833
871
|
if (!run) return null;
|
|
@@ -873,6 +911,19 @@ var WorkDiscoveryService = class {
|
|
|
873
911
|
recognitionDecision: input.decision,
|
|
874
912
|
...correctedIntent ? { correctedIntent } : {}
|
|
875
913
|
});
|
|
914
|
+
if (input.decision === "confirmed") {
|
|
915
|
+
const focusKeys = new Set((run.result.workThreads ?? []).map((thread) => `work-focus:${thread.canonicalKey}`));
|
|
916
|
+
for (const focus of listUserFocuses(["candidate"])) if (focusKeys.has(focus.canonicalKey)) setUserFocusStatus(focus.id, "active");
|
|
917
|
+
} else if ((input.decision === "corrected" || input.decision === "different_goal") && correctedIntent) upsertUserFocus({
|
|
918
|
+
canonicalKey: `user-focus:${createHash("sha256").update(correctedIntent.toLocaleLowerCase()).digest("hex").slice(0, 20)}`,
|
|
919
|
+
title: correctedIntent.slice(0, 120),
|
|
920
|
+
summary: correctedIntent,
|
|
921
|
+
horizon: "current",
|
|
922
|
+
status: "active",
|
|
923
|
+
confidence: 1,
|
|
924
|
+
projectId: run.projectId,
|
|
925
|
+
evidenceRefs: [`session://${createHash("sha256").update(run.sessionKey).digest("hex").slice(0, 16)}/recognition`]
|
|
926
|
+
});
|
|
876
927
|
const investigation = getWorkUnderstandingInvestigationForRun(run.id);
|
|
877
928
|
if (investigation && input.decision !== "dismissed") {
|
|
878
929
|
const observation = correctedIntent ? `The user explicitly stated their current intent: ${correctedIntent}` : "The user explicitly confirmed the inferred current work understanding.";
|