@xopcai/xopc 0.0.189 → 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 +0 -3
- 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-DTFKTPs8.js → activity-store-DstnJCS5.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DqO25Qe5.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-DWeXfwVU.js → api-BTL9kayv.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BRpV8PXG.js → app-management-settings-panel-DkFeIdBf.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-3ntKM9nQ.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-Df7Ycj_7.js → archive-plugin-Ch2RmLCC.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-UHgfZYtj.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-BJah99wE.js → binary-plugins-D6CqlymH.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DNlY5KqF.js → block-editor-ClL6HEg9.js} +48 -48
- package/dist/gateway/static/root/assets/browser-settings-page-DW99iDmD.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-vyUfdzAd.js → browser-workflow-inputs-BYy48VhN.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-C1cKZjx-.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-BGG2kpJB.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-BUuBEJuP.js → desktop-pet-Cv8rGhYW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BGfVIJM3.js → desktop-pet-settings-CIeJdwfV.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DrQFfHH_.js → directory-picker-path-field-D8jXEiAY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CEnIFOX-.js → extension-debug-page-CCZ9u6TZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CCqHbexs.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-CgUE2Ii1.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-DxhKNiCF.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-DCFdc-HD.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-Bf2VLtXW.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-Ca1RuI13.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-B3Eop1zn.js → management-settings--V_fovKD.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BGOYjgnM.js → markdown-split-Dt9-in6W.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CT0txyM4.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-DfKgAe78.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-DNrbCgmC.js → page-tabs-C5ge434C.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BTqViDOR.js → preview-open-alternatives-BFa9DgSV.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-C_2L4_Iu.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-BFLfkDGG.js → schema-form-B84DckWe.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-C9a-EbTZ.js → settings-loading-skeleton-CCtlhoy7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DI9qDH5x.js → settings-page-DQmMKf8r.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-D-LWQdI5.js → settings-page-layout-EQIOJa_L.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CJwmPvgs.js → setup-status-panel-Cwi-SPja.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BKSMG9r5.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-zsz2HIlZ.js → skills-page.utils-Jhm24i4h.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-IWNDBI1O.js → system-settings-panel-Dpx2ags2.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-CgtK02kP.js → task-detail-page-DLAdxI6e.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BkJe7UDo.js → theme-store-DnBOcGXi.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-C07LGthO.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-Boue1D46.js → voice-api-key-field-BISTPfq_.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-bbmvCmc8.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-DlHv-GZC.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 +7 -7
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/tool-activity.js +0 -36
- package/dist/packages/realtime-client/src/index.js +105 -48
- package/dist/packages/realtime-protocol/src/index.js +6 -1
- package/dist/src/agent/agent-manager.d.ts +0 -1
- package/dist/src/agent/agent-manager.js +6 -13
- package/dist/src/agent/background-review/coordinator.js +1 -1
- package/dist/src/agent/background-review/run-background-review.js +5 -7
- 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/context/workspace-templates/SOUL.md +1 -1
- 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/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/direct-turn-helpers.js +1 -1
- package/dist/src/agent/service.d.ts +1 -2
- package/dist/src/agent/service.js +4 -17
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js +1 -1
- 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 +0 -3
- package/dist/src/agent/tools/factory.js +1 -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/validation.d.ts +28 -28
- package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -3
- package/dist/src/chat-commands/builtins/understanding.js +2 -5
- package/dist/src/cli/commands/doctor/checks/database-schema.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/schema.d.ts +24 -117
- package/dist/src/config/schema.js +9 -39
- package/dist/src/connectors/learning-coordinator.js +75 -3
- 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/dreaming-automation-reconciler.d.ts +3 -3
- package/dist/src/gateway/dreaming-automation-reconciler.js +48 -88
- package/dist/src/gateway/hono/lib/config-payload.d.ts +19 -7
- package/dist/src/gateway/hono/lib/config-payload.js +3 -1
- 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/agents.js +1 -33
- 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/index.js +2 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -5
- 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/you.d.ts +0 -22
- package/dist/src/gateway/hono/routes/you.js +234 -1118
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +2 -4
- 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/proactive/execution/context.js +8 -13
- package/dist/src/realtime/broker.d.ts +1 -0
- package/dist/src/realtime/broker.js +19 -2
- package/dist/src/realtime/runtime.js +6 -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/fts.d.ts +2 -0
- package/dist/src/storage/sqlite/fts.js +29 -1
- package/dist/src/storage/sqlite/index.d.ts +4 -6
- package/dist/src/storage/sqlite/index.js +5 -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/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/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/tui/tool-summary.js +1 -7
- package/dist/src/tui/tui-startup-resources.js +1 -2
- 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 -54
- 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/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 +3 -8
- package/dist/gateway/static/root/assets/agents-BvdqdER9.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-nKLsfy6C.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-Dh5bdZiN.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CRJ_nAuh.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DeQR5BZt.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-D7tkhDMv.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D7uK3q1p.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-Bw6Dniyq.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-BrUTz4uU.js +0 -1
- package/dist/gateway/static/root/assets/connector-logo-8YU53RUT.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-k9tMiOL5.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-B3B1eqnr.js +0 -2
- package/dist/gateway/static/root/assets/extension-settings-page-DEZw_7zN.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-Dg8qCiIp.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-27tRzDEo.js +0 -1
- package/dist/gateway/static/root/assets/home-page-VA511kMr.js +0 -3
- package/dist/gateway/static/root/assets/index-BvR-i-m6.js +0 -216
- package/dist/gateway/static/root/assets/index-zybP34zk.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CaJq4-wV.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-DUW5YE3R.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-BLTCg69e.js +0 -2
- package/dist/gateway/static/root/assets/messages-CMjnbdbn.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-Bp1w9UM1.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-CZmbPDQN.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D5pzqfm5.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CC-XhVGI.js +0 -1
- package/dist/gateway/static/root/assets/segmented-styles-BL8oLBEp.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-B2eTLVDV.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CRuZ_bl0.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-C4GXGeA4.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-YzSDS4G_.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CwOo8zZk.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-xd1cgSGN.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-CstQ___Y.js +0 -1
- package/dist/gateway/static/root/assets/use-save-bar-registration-CQYE0l6z.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-BnQAWS_B.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CAszL1y8.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DxGzo3-x.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/gateway/hono/routes/memory.d.ts +0 -3
- package/dist/src/gateway/hono/routes/memory.js +0 -460
- 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/user-context/actionableInsights.d.ts +0 -14
- package/dist/src/user-context/actionableInsights.js +0 -34
- 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,7 +1,7 @@
|
|
|
1
1
|
import { ToolPolicySetSchema, init_schema } from "../../../agent-manifest/schema.js";
|
|
2
2
|
import { AgentModelsSchema, init_schema as init_schema$1 } from "../../../config/schema.js";
|
|
3
3
|
import { init_agent_scope, normalizeAgentId } from "../../../agent/agent-scope.js";
|
|
4
|
-
import { deleteAgentAvatarFile, finalizeCreateAgentDirs, getGatewayAgentEffectiveManifest, listAgentProfileFiles, listGatewayAgents, prepareCreateAgent, prepareDeleteAgent, prepareUpdateAgent, readAgentAvatarFile, readAgentProfileFile,
|
|
4
|
+
import { deleteAgentAvatarFile, finalizeCreateAgentDirs, getGatewayAgentEffectiveManifest, listAgentProfileFiles, listGatewayAgents, prepareCreateAgent, prepareDeleteAgent, prepareUpdateAgent, readAgentAvatarFile, readAgentProfileFile, runAfterDeletePurge, writeAgentAvatarFromBase64, writeAgentProfileFile } from "../../agents-admin.js";
|
|
5
5
|
import { getVoiceModelsConfig } from "../../../config/voice.js";
|
|
6
6
|
//#region src/gateway/hono/routes/agents.ts
|
|
7
7
|
init_schema$1();
|
|
@@ -89,38 +89,6 @@ function registerAgentsRoutes(authenticated, deps) {
|
|
|
89
89
|
payload
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
|
-
authenticated.get("/api/user-profile", async (c) => {
|
|
93
|
-
const res = await readUserProfileFile();
|
|
94
|
-
if (res.ok === false) return c.json({
|
|
95
|
-
ok: false,
|
|
96
|
-
error: { message: res.error }
|
|
97
|
-
}, res.status ?? 400);
|
|
98
|
-
return c.json({
|
|
99
|
-
ok: true,
|
|
100
|
-
payload: res.data
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
authenticated.put("/api/user-profile", strictRateLimitMiddleware, async (c) => {
|
|
104
|
-
let content = "";
|
|
105
|
-
try {
|
|
106
|
-
const body = await c.req.json();
|
|
107
|
-
content = typeof body.content === "string" ? body.content : "";
|
|
108
|
-
} catch {
|
|
109
|
-
return c.json({
|
|
110
|
-
ok: false,
|
|
111
|
-
error: { message: "Invalid JSON" }
|
|
112
|
-
}, 400);
|
|
113
|
-
}
|
|
114
|
-
const res = await writeUserProfileFile(content);
|
|
115
|
-
if (res.ok === false) return c.json({
|
|
116
|
-
ok: false,
|
|
117
|
-
error: { message: res.error }
|
|
118
|
-
}, res.status ?? 400);
|
|
119
|
-
return c.json({
|
|
120
|
-
ok: true,
|
|
121
|
-
payload: res.data
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
92
|
authenticated.post("/api/agents", strictRateLimitMiddleware, async (c) => {
|
|
125
93
|
let body = {};
|
|
126
94
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContextCompactionPolicySchema, init_config } from "../../../../user-context/config.js";
|
|
1
|
+
import { ContextCompactionPolicySchema, UserContextDreamingSchema, UserContextPrivacySchema, init_config } from "../../../../user-context/config.js";
|
|
2
2
|
import { BindingsConfigSchema, BrowserConfigSchema, McpConfigSchema, VoiceConfigSchema, init_schema } from "../../../../config/schema.js";
|
|
3
3
|
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
4
4
|
import { canonicalizeConfiguredMcpServer } from "../../../../config/mcp-config-normalize.js";
|
|
@@ -28,6 +28,22 @@ async function applyMiscPatch(config, body) {
|
|
|
28
28
|
if (body.userContext !== void 0) {
|
|
29
29
|
if (typeof body.userContext !== "object" || body.userContext === null || Array.isArray(body.userContext)) return patchError("userContext must be an object");
|
|
30
30
|
const userContextPatch = body.userContext;
|
|
31
|
+
if (userContextPatch.dreaming !== void 0) {
|
|
32
|
+
const parsed = UserContextDreamingSchema.safeParse(userContextPatch.dreaming);
|
|
33
|
+
if (!parsed.success) return patchError(parsed.error.issues.map((issue) => issue.message).join("; "));
|
|
34
|
+
config.userContext = {
|
|
35
|
+
...config.userContext,
|
|
36
|
+
dreaming: parsed.data
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (userContextPatch.privacy !== void 0) {
|
|
40
|
+
const parsed = UserContextPrivacySchema.safeParse(userContextPatch.privacy);
|
|
41
|
+
if (!parsed.success) return patchError(parsed.error.issues.map((issue) => issue.message).join("; "));
|
|
42
|
+
config.userContext = {
|
|
43
|
+
...config.userContext,
|
|
44
|
+
privacy: parsed.data
|
|
45
|
+
};
|
|
46
|
+
}
|
|
31
47
|
if (userContextPatch.memory !== void 0) {
|
|
32
48
|
if (typeof userContextPatch.memory !== "object" || userContextPatch.memory === null || Array.isArray(userContextPatch.memory)) return patchError("userContext.memory must be an object");
|
|
33
49
|
const memoryPatch = userContextPatch.memory;
|
|
@@ -11,6 +11,7 @@ import { createConnectorSetupSecretRequest, submitConnectorSetupSecret } from ".
|
|
|
11
11
|
import { configureComposioApiKey, executeComposioTool, getComposioInstallationPolicy, getComposioToolkitScope, inspectComposioConnectorHealth, listComposioConnections, listComposioTools, refreshComposioConnection, revokeComposioConnection, setComposioToolkitScope, updateComposioConnection, updateComposioInstallationPolicy } from "../../../connectors/composio.js";
|
|
12
12
|
import { listConnectorProviders } from "../../../connectors/providers.js";
|
|
13
13
|
import { getConnectorDefinition, listConnectorCatalog } from "../../../connectors/catalog.js";
|
|
14
|
+
import { listUnderstandingSourceGrants, revokeUnderstandingSourceGrant } from "../../../user-context/sources/repository.js";
|
|
14
15
|
import { recordConnectorHealthUsage } from "../../../connectors/usage.js";
|
|
15
16
|
import { getConnectorInstance, listConnectorInstances } from "../../../connectors/instances.js";
|
|
16
17
|
import { installConnector, installConnectorDefinition, uninstallConnector, updateConnectorConfig } from "../../../connectors/install.js";
|
|
@@ -159,8 +160,11 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
159
160
|
...allowedScenarioKeys ? { allowedScenarioKeys } : {}
|
|
160
161
|
});
|
|
161
162
|
const connectionId = account.currentConnectionId;
|
|
162
|
-
if (connectionId && !policy.scanEnabled)
|
|
163
|
-
|
|
163
|
+
if (connectionId && !policy.scanEnabled) {
|
|
164
|
+
service.setConnectorLearningPaused(connectionId, true);
|
|
165
|
+
const grant = listUnderstandingSourceGrants().find((item) => item.sourceKey === `connector-account:${account.id}`);
|
|
166
|
+
if (grant) revokeUnderstandingSourceGrant(grant.id);
|
|
167
|
+
} else if (connectionId && previous?.scanEnabled === false) {
|
|
164
168
|
if (service.setConnectorLearningPaused(connectionId, false) === 0) service.requestConnectorLearning(connectionId, {
|
|
165
169
|
mode: "incremental",
|
|
166
170
|
reason: "schedule"
|
|
@@ -179,15 +183,6 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
179
183
|
ok: false,
|
|
180
184
|
error: "Connector account has no usable authorization."
|
|
181
185
|
}, 409);
|
|
182
|
-
const config = service.currentConfig;
|
|
183
|
-
if (!config.userContext.memory.sources.includes("connectedSources")) {
|
|
184
|
-
config.userContext.memory.sources = [...config.userContext.memory.sources, "connectedSources"];
|
|
185
|
-
const saved = await service.saveConfig(config);
|
|
186
|
-
if (!saved.saved) return c.json({
|
|
187
|
-
ok: false,
|
|
188
|
-
error: saved.error
|
|
189
|
-
}, 500);
|
|
190
|
-
}
|
|
191
186
|
const job = service.requestConnectorLearning(account.currentConnectionId, { reason: "manual" });
|
|
192
187
|
if (!job) return c.json({
|
|
193
188
|
ok: false,
|
|
@@ -255,7 +250,13 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
255
250
|
});
|
|
256
251
|
authenticated.delete("/api/connectors/composio/connections/:id", strictRateLimitMiddleware, async (c) => {
|
|
257
252
|
try {
|
|
258
|
-
|
|
253
|
+
const connectionId = c.req.param("id");
|
|
254
|
+
const connection = listConnectorConnections().find((item) => item.id === connectionId);
|
|
255
|
+
await revokeComposioConnection(connectionId);
|
|
256
|
+
if (connection?.accountId) {
|
|
257
|
+
const grant = listUnderstandingSourceGrants().find((item) => item.sourceKey === `connector-account:${connection.accountId}`);
|
|
258
|
+
if (grant) revokeUnderstandingSourceGrant(grant.id);
|
|
259
|
+
}
|
|
259
260
|
return c.json({
|
|
260
261
|
ok: true,
|
|
261
262
|
payload: { revoked: true }
|
|
@@ -3,7 +3,6 @@ import { registerAgentStreamRoutes } from "./agent-stream.js";
|
|
|
3
3
|
import { registerDiscussionRoutes } from "./discussions.js";
|
|
4
4
|
import { registerSessionsRoutes } from "./sessions.js";
|
|
5
5
|
import { registerStatusRoutes } from "./status.js";
|
|
6
|
-
import { registerMemoryRoutes } from "./memory.js";
|
|
7
6
|
import { registerProjectsRoutes } from "./projects.js";
|
|
8
7
|
import { registerProjectSkillRoutes } from "./project-skills.js";
|
|
9
8
|
import { registerSearchRoutes } from "./search.js";
|
|
@@ -14,6 +13,7 @@ import { registerEndpointToolRoutes } from "./endpoint-tools.js";
|
|
|
14
13
|
import { registerRealtimeRoutes } from "./realtime.js";
|
|
15
14
|
import { registerLocalAppsRoutes } from "./local-apps.js";
|
|
16
15
|
import { registerWorkDiscoveryRoutes } from "./work-discovery.js";
|
|
16
|
+
import { registerUnderstandingSourceRoutes } from "./understanding-sources.js";
|
|
17
17
|
import { registerTaskRoutes } from "./tasks.js";
|
|
18
18
|
import { registerProactiveRoutes } from "./proactive.js";
|
|
19
19
|
import { mountAppLazyRoutePrefixes, registerAuthenticatedLazyRouteFallback } from "./lazy-fallback.js";
|
|
@@ -22,13 +22,13 @@ function registerCoreAuthenticatedRoutes(authenticated, deps) {
|
|
|
22
22
|
registerStatusRoutes(authenticated, deps);
|
|
23
23
|
registerAgentStreamRoutes(authenticated, deps);
|
|
24
24
|
registerSessionsRoutes(authenticated, deps);
|
|
25
|
-
registerMemoryRoutes(authenticated, deps);
|
|
26
25
|
registerActivityRoutes(authenticated, deps);
|
|
27
26
|
registerDiscussionRoutes(authenticated, deps);
|
|
28
27
|
registerProjectsRoutes(authenticated, deps);
|
|
29
28
|
registerProjectSkillRoutes(authenticated, deps);
|
|
30
29
|
registerLocalAppsRoutes(authenticated, deps);
|
|
31
30
|
registerWorkDiscoveryRoutes(authenticated, deps);
|
|
31
|
+
registerUnderstandingSourceRoutes(authenticated, deps);
|
|
32
32
|
registerTaskRoutes(authenticated, deps);
|
|
33
33
|
registerProactiveRoutes(authenticated, deps);
|
|
34
34
|
registerSearchRoutes(authenticated, deps);
|
|
@@ -94,11 +94,7 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
id: "agents",
|
|
97
|
-
match: (path) => startsWithAny(path, [
|
|
98
|
-
"/api/agents",
|
|
99
|
-
"/api/user-profile",
|
|
100
|
-
"/api/voice/models"
|
|
101
|
-
]),
|
|
97
|
+
match: (path) => startsWithAny(path, ["/api/agents", "/api/voice/models"]),
|
|
102
98
|
load: async () => {
|
|
103
99
|
const { registerAgentsRoutes } = await import("./agents.js");
|
|
104
100
|
return { register: registerAgentsRoutes };
|
|
@@ -34,7 +34,6 @@ function buildEvalRuntimeIdentity(service, agentId) {
|
|
|
34
34
|
const models = asRecord(manifest.models);
|
|
35
35
|
const tools = asRecord(manifest.tools);
|
|
36
36
|
const skills = manifest.skills ?? [];
|
|
37
|
-
const codeIntelligence = config.codeIntelligence;
|
|
38
37
|
return {
|
|
39
38
|
ok: true,
|
|
40
39
|
payload: {
|
|
@@ -48,12 +47,6 @@ function buildEvalRuntimeIdentity(service, agentId) {
|
|
|
48
47
|
systemPromptConfigHash: contentHash(manifest.systemPrompt ?? null),
|
|
49
48
|
toolPolicyHash: contentHash(tools),
|
|
50
49
|
skillPolicyHash: contentHash(skills),
|
|
51
|
-
codeIntelligence: {
|
|
52
|
-
enabled: codeIntelligence?.enabled === true,
|
|
53
|
-
configuredForAgent: codeIntelligence?.agentIds?.includes(agentId) === true,
|
|
54
|
-
indexMode: codeIntelligence?.indexMode ?? null,
|
|
55
|
-
configHash: contentHash(codeIntelligence ?? null)
|
|
56
|
-
},
|
|
57
50
|
presetChain: effective.data.sources
|
|
58
51
|
}
|
|
59
52
|
};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { deleteUnderstanding, listUnderstandingEvidence, listUnderstandings } from "../../../storage/sqlite/user-context-repository.js";
|
|
2
|
+
import { getConnectorAccount } from "../../../storage/sqlite/connector-account-repository.js";
|
|
3
|
+
import "../../../storage/sqlite/index.js";
|
|
4
|
+
import { getUnderstandingSourceGrant, listUnderstandingSourceGrants, listUserFocuses, revokeUnderstandingSourceGrant, setUserFocusStatus } from "../../../user-context/sources/repository.js";
|
|
5
|
+
import { getWorkDiscoveryService } from "./work-discovery.js";
|
|
6
|
+
import { listUnderstandingSourceDefinitions } from "../../../user-context/sources/catalog.js";
|
|
7
|
+
//#region src/gateway/hono/routes/understanding-sources.ts
|
|
8
|
+
function stringField(body, field) {
|
|
9
|
+
if (!body || typeof body !== "object") return "";
|
|
10
|
+
const value = body[field];
|
|
11
|
+
return typeof value === "string" ? value.trim() : "";
|
|
12
|
+
}
|
|
13
|
+
function decisionsFrom(body) {
|
|
14
|
+
return (body && typeof body === "object" && Array.isArray(body.decisions) ? body.decisions : []).flatMap((value) => {
|
|
15
|
+
if (!value || typeof value !== "object") return [];
|
|
16
|
+
const item = value;
|
|
17
|
+
const understandingId = typeof item.understandingId === "string" ? item.understandingId.trim() : "";
|
|
18
|
+
const status = item.status === "accepted" || item.status === "edited" || item.status === "rejected" ? item.status : null;
|
|
19
|
+
if (!understandingId || !status) return [];
|
|
20
|
+
return [{
|
|
21
|
+
understandingId,
|
|
22
|
+
status,
|
|
23
|
+
...typeof item.statement === "string" ? { statement: item.statement } : {}
|
|
24
|
+
}];
|
|
25
|
+
}).slice(0, 20);
|
|
26
|
+
}
|
|
27
|
+
function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
28
|
+
const service = getWorkDiscoveryService(deps);
|
|
29
|
+
const limited = deps.strictRateLimitMiddleware;
|
|
30
|
+
authenticated.get("/api/understanding/sources/catalog", (c) => {
|
|
31
|
+
const requested = c.req.query("platform");
|
|
32
|
+
const platform = requested === "darwin" || requested === "win32" || requested === "linux" ? requested : process.platform;
|
|
33
|
+
return c.json({
|
|
34
|
+
ok: true,
|
|
35
|
+
sources: listUnderstandingSourceDefinitions(platform)
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
authenticated.get("/api/understanding/sources/grants", (c) => c.json({
|
|
39
|
+
ok: true,
|
|
40
|
+
grants: listUnderstandingSourceGrants({ includeRevoked: c.req.query("includeRevoked") === "true" })
|
|
41
|
+
}));
|
|
42
|
+
authenticated.delete("/api/understanding/sources/grants/:grantId", limited, (c) => {
|
|
43
|
+
const current = getUnderstandingSourceGrant(c.req.param("grantId"));
|
|
44
|
+
const accountId = typeof current?.config.accountId === "string" ? current.config.accountId : void 0;
|
|
45
|
+
const connectionId = accountId ? getConnectorAccount(accountId)?.currentConnectionId : void 0;
|
|
46
|
+
if (connectionId) deps.service.setConnectorLearningPaused(connectionId, true);
|
|
47
|
+
const grant = revokeUnderstandingSourceGrant(c.req.param("grantId"));
|
|
48
|
+
if (grant && c.req.query("deleteDerived") === "true") {
|
|
49
|
+
const activeGrantIds = new Set(listUnderstandingSourceGrants().map((item) => item.id));
|
|
50
|
+
for (const understanding of listUnderstandings()) {
|
|
51
|
+
const grantEvidence = listUnderstandingEvidence(understanding.id).map((evidence) => /^understanding-source-grant:([^:]+):/.exec(evidence.sourceRef)?.[1]).filter((id) => Boolean(id));
|
|
52
|
+
if (grantEvidence.includes(grant.id) && !grantEvidence.some((id) => id !== grant.id && activeGrantIds.has(id))) deleteUnderstanding(understanding.id);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return grant ? c.json({
|
|
56
|
+
ok: true,
|
|
57
|
+
grant
|
|
58
|
+
}) : c.json({
|
|
59
|
+
ok: false,
|
|
60
|
+
error: "Source grant not found"
|
|
61
|
+
}, 404);
|
|
62
|
+
});
|
|
63
|
+
authenticated.post("/api/understanding/sources/grants/:grantId/refresh", limited, async (c) => {
|
|
64
|
+
const grant = getUnderstandingSourceGrant(c.req.param("grantId"));
|
|
65
|
+
if (!grant || grant.status !== "active") return c.json({
|
|
66
|
+
ok: false,
|
|
67
|
+
error: "Active source grant not found"
|
|
68
|
+
}, 404);
|
|
69
|
+
try {
|
|
70
|
+
if (grant.adapterId === "local-work-folders") {
|
|
71
|
+
const result = await service.refreshDirectorySourceIfChanged({
|
|
72
|
+
id: grant.id,
|
|
73
|
+
idempotencyKey: crypto.randomUUID()
|
|
74
|
+
});
|
|
75
|
+
return c.json({
|
|
76
|
+
ok: true,
|
|
77
|
+
result
|
|
78
|
+
}, result.changed ? 202 : 200);
|
|
79
|
+
}
|
|
80
|
+
const accountId = typeof grant.config.accountId === "string" ? grant.config.accountId : "";
|
|
81
|
+
const connectionId = accountId ? getConnectorAccount(accountId)?.currentConnectionId : void 0;
|
|
82
|
+
if (connectionId) {
|
|
83
|
+
const job = deps.service.requestConnectorLearning(connectionId, {
|
|
84
|
+
mode: "incremental",
|
|
85
|
+
reason: "manual"
|
|
86
|
+
});
|
|
87
|
+
return job ? c.json({
|
|
88
|
+
ok: true,
|
|
89
|
+
job
|
|
90
|
+
}, 202) : c.json({
|
|
91
|
+
ok: false,
|
|
92
|
+
error: "Source does not support learning"
|
|
93
|
+
}, 409);
|
|
94
|
+
}
|
|
95
|
+
return c.json({
|
|
96
|
+
ok: false,
|
|
97
|
+
error: "This source is collected from the desktop app"
|
|
98
|
+
}, 409);
|
|
99
|
+
} catch (error) {
|
|
100
|
+
return c.json({
|
|
101
|
+
ok: false,
|
|
102
|
+
error: error instanceof Error ? error.message : String(error)
|
|
103
|
+
}, 400);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
authenticated.get("/api/understanding/sources/work-folders", (c) => c.json({
|
|
107
|
+
ok: true,
|
|
108
|
+
sources: service.listDirectorySources()
|
|
109
|
+
}));
|
|
110
|
+
authenticated.post("/api/understanding/sources/work-folders", limited, async (c) => {
|
|
111
|
+
const rootPath = stringField(await c.req.json().catch(() => null), "rootPath");
|
|
112
|
+
if (!rootPath) return c.json({
|
|
113
|
+
ok: false,
|
|
114
|
+
error: "Missing rootPath"
|
|
115
|
+
}, 400);
|
|
116
|
+
try {
|
|
117
|
+
return c.json({
|
|
118
|
+
ok: true,
|
|
119
|
+
source: await service.grantDirectorySource(rootPath)
|
|
120
|
+
}, 201);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
return c.json({
|
|
123
|
+
ok: false,
|
|
124
|
+
error: error instanceof Error ? error.message : String(error)
|
|
125
|
+
}, 400);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
authenticated.post("/api/understanding/sources/work-folders/:grantId/runs", limited, async (c) => {
|
|
129
|
+
try {
|
|
130
|
+
const run = await service.rescanDirectorySource({
|
|
131
|
+
id: c.req.param("grantId"),
|
|
132
|
+
idempotencyKey: crypto.randomUUID()
|
|
133
|
+
});
|
|
134
|
+
return c.json({
|
|
135
|
+
ok: true,
|
|
136
|
+
run
|
|
137
|
+
}, 202);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
return c.json({
|
|
140
|
+
ok: false,
|
|
141
|
+
error: error instanceof Error ? error.message : String(error)
|
|
142
|
+
}, 400);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
authenticated.post("/api/understanding/bootstrap", limited, async (c) => {
|
|
146
|
+
const body = await c.req.json().catch(() => null);
|
|
147
|
+
const items = body && typeof body === "object" && Array.isArray(body.items) ? body.items.slice(0, 150) : [];
|
|
148
|
+
if (!items.length) return c.json({
|
|
149
|
+
ok: false,
|
|
150
|
+
error: "No understanding source items were provided"
|
|
151
|
+
}, 400);
|
|
152
|
+
try {
|
|
153
|
+
const result = await service.importUnderstandingSources(items, c.req.raw.signal, stringField(body, "workDiscoveryRunId") || void 0);
|
|
154
|
+
return c.json({
|
|
155
|
+
ok: true,
|
|
156
|
+
...result
|
|
157
|
+
}, 201);
|
|
158
|
+
} catch (error) {
|
|
159
|
+
return c.json({
|
|
160
|
+
ok: false,
|
|
161
|
+
error: error instanceof Error ? error.message : String(error)
|
|
162
|
+
}, 400);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
authenticated.post("/api/understanding/review", limited, async (c) => {
|
|
166
|
+
const decisions = decisionsFrom(await c.req.json().catch(() => null));
|
|
167
|
+
if (!decisions.length) return c.json({
|
|
168
|
+
ok: false,
|
|
169
|
+
error: "At least one valid decision is required"
|
|
170
|
+
}, 400);
|
|
171
|
+
return c.json({
|
|
172
|
+
ok: true,
|
|
173
|
+
decisions: service.updateUnderstandingSourceProfile({ decisions })
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
authenticated.get("/api/understanding/focuses", (c) => c.json({
|
|
177
|
+
ok: true,
|
|
178
|
+
focuses: listUserFocuses()
|
|
179
|
+
}));
|
|
180
|
+
authenticated.patch("/api/understanding/focuses/:focusId", limited, async (c) => {
|
|
181
|
+
const requested = stringField(await c.req.json().catch(() => null), "status");
|
|
182
|
+
if (!new Set([
|
|
183
|
+
"candidate",
|
|
184
|
+
"active",
|
|
185
|
+
"paused",
|
|
186
|
+
"completed",
|
|
187
|
+
"rejected"
|
|
188
|
+
]).has(requested)) return c.json({
|
|
189
|
+
ok: false,
|
|
190
|
+
error: "Invalid focus status"
|
|
191
|
+
}, 400);
|
|
192
|
+
const focus = setUserFocusStatus(c.req.param("focusId"), requested);
|
|
193
|
+
return focus ? c.json({
|
|
194
|
+
ok: true,
|
|
195
|
+
focus
|
|
196
|
+
}) : c.json({
|
|
197
|
+
ok: false,
|
|
198
|
+
error: "Focus not found"
|
|
199
|
+
}, 404);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
//#endregion
|
|
203
|
+
export { registerUnderstandingSourceRoutes };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { Hono } from 'hono';
|
|
2
|
+
import { WorkDiscoveryService } from '../../../work-discovery/service.js';
|
|
2
3
|
import type { AuthenticatedRouteDeps } from './deps.js';
|
|
4
|
+
export declare function getWorkDiscoveryService(deps: AuthenticatedRouteDeps): WorkDiscoveryService;
|
|
3
5
|
export declare function registerWorkDiscoveryRoutes(authenticated: Hono, deps: AuthenticatedRouteDeps): void;
|
|
@@ -7,7 +7,7 @@ import { WorkDiscoveryService } from "../../../work-discovery/service.js";
|
|
|
7
7
|
init_schema();
|
|
8
8
|
init_providers();
|
|
9
9
|
const services = /* @__PURE__ */ new WeakMap();
|
|
10
|
-
function
|
|
10
|
+
function getWorkDiscoveryService(deps) {
|
|
11
11
|
const existing = services.get(deps.service);
|
|
12
12
|
if (existing) return existing;
|
|
13
13
|
const service = new WorkDiscoveryService({
|
|
@@ -25,7 +25,7 @@ function stringField(body, field) {
|
|
|
25
25
|
return typeof value === "string" ? value.trim() : "";
|
|
26
26
|
}
|
|
27
27
|
function registerWorkDiscoveryRoutes(authenticated, deps) {
|
|
28
|
-
const service =
|
|
28
|
+
const service = getWorkDiscoveryService(deps);
|
|
29
29
|
const limited = deps.strictRateLimitMiddleware;
|
|
30
30
|
authenticated.get("/api/onboarding/work-discovery", (c) => c.json({
|
|
31
31
|
enabled: service.isEnabled(),
|
|
@@ -95,137 +95,6 @@ function registerWorkDiscoveryRoutes(authenticated, deps) {
|
|
|
95
95
|
}, 500);
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
|
-
authenticated.get("/api/work-discovery/sources/directories", (c) => c.json({
|
|
99
|
-
ok: true,
|
|
100
|
-
sources: service.listDirectorySources()
|
|
101
|
-
}));
|
|
102
|
-
authenticated.post("/api/work-discovery/sources/directories", limited, async (c) => {
|
|
103
|
-
const rootPath = stringField(await c.req.json().catch(() => null), "rootPath");
|
|
104
|
-
if (!rootPath) return c.json({
|
|
105
|
-
ok: false,
|
|
106
|
-
error: "Missing rootPath"
|
|
107
|
-
}, 400);
|
|
108
|
-
try {
|
|
109
|
-
const source = await service.grantDirectorySource(rootPath);
|
|
110
|
-
return c.json({
|
|
111
|
-
ok: true,
|
|
112
|
-
source
|
|
113
|
-
}, 201);
|
|
114
|
-
} catch (error) {
|
|
115
|
-
return c.json({
|
|
116
|
-
ok: false,
|
|
117
|
-
error: error instanceof Error ? error.message : String(error)
|
|
118
|
-
}, 400);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
authenticated.delete("/api/work-discovery/sources/directories/:sourceId", limited, (c) => {
|
|
122
|
-
const source = service.revokeDirectorySource(c.req.param("sourceId"));
|
|
123
|
-
return source ? c.json({
|
|
124
|
-
ok: true,
|
|
125
|
-
source
|
|
126
|
-
}) : c.json({
|
|
127
|
-
ok: false,
|
|
128
|
-
error: "Source not found"
|
|
129
|
-
}, 404);
|
|
130
|
-
});
|
|
131
|
-
authenticated.post("/api/work-discovery/sources/directories/:sourceId/runs", limited, async (c) => {
|
|
132
|
-
const idempotencyKey = stringField(await c.req.json().catch(() => null), "idempotencyKey");
|
|
133
|
-
if (!idempotencyKey) return c.json({
|
|
134
|
-
ok: false,
|
|
135
|
-
error: "Missing idempotencyKey"
|
|
136
|
-
}, 400);
|
|
137
|
-
try {
|
|
138
|
-
const run = await service.rescanDirectorySource({
|
|
139
|
-
id: c.req.param("sourceId"),
|
|
140
|
-
idempotencyKey
|
|
141
|
-
});
|
|
142
|
-
return c.json({
|
|
143
|
-
ok: true,
|
|
144
|
-
run
|
|
145
|
-
}, 202);
|
|
146
|
-
} catch (error) {
|
|
147
|
-
return c.json({
|
|
148
|
-
ok: false,
|
|
149
|
-
error: error instanceof Error ? error.message : String(error)
|
|
150
|
-
}, 400);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
authenticated.post("/api/work-discovery/sources/directories/check", limited, async (c) => {
|
|
154
|
-
return c.json({
|
|
155
|
-
ok: true,
|
|
156
|
-
checks: await service.checkDirectorySources()
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
authenticated.post("/api/work-discovery/sources/directories/:sourceId/refresh-if-changed", limited, async (c) => {
|
|
160
|
-
const idempotencyKey = stringField(await c.req.json().catch(() => null), "idempotencyKey");
|
|
161
|
-
if (!idempotencyKey) return c.json({
|
|
162
|
-
ok: false,
|
|
163
|
-
error: "Missing idempotencyKey"
|
|
164
|
-
}, 400);
|
|
165
|
-
try {
|
|
166
|
-
const result = await service.refreshDirectorySourceIfChanged({
|
|
167
|
-
id: c.req.param("sourceId"),
|
|
168
|
-
idempotencyKey
|
|
169
|
-
});
|
|
170
|
-
return c.json({
|
|
171
|
-
ok: true,
|
|
172
|
-
...result
|
|
173
|
-
}, result.changed ? 202 : 200);
|
|
174
|
-
} catch (error) {
|
|
175
|
-
return c.json({
|
|
176
|
-
ok: false,
|
|
177
|
-
error: error instanceof Error ? error.message : String(error)
|
|
178
|
-
}, 400);
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
authenticated.post("/api/work-discovery/personal-context/import", limited, async (c) => {
|
|
182
|
-
if (!service.isEnabled()) return c.json({
|
|
183
|
-
ok: false,
|
|
184
|
-
error: "Work discovery is disabled"
|
|
185
|
-
}, 404);
|
|
186
|
-
const body = await c.req.json().catch(() => null);
|
|
187
|
-
const items = body && typeof body === "object" && Array.isArray(body.items) ? body.items.slice(0, 150) : [];
|
|
188
|
-
const runId = stringField(body, "runId");
|
|
189
|
-
if (!items.length) return c.json({
|
|
190
|
-
ok: false,
|
|
191
|
-
error: "No personal context was provided"
|
|
192
|
-
}, 400);
|
|
193
|
-
try {
|
|
194
|
-
const result = await service.importPersonalContext(items, c.req.raw.signal, runId || void 0);
|
|
195
|
-
return c.json({
|
|
196
|
-
ok: true,
|
|
197
|
-
...result
|
|
198
|
-
}, 201);
|
|
199
|
-
} catch (error) {
|
|
200
|
-
return c.json({
|
|
201
|
-
ok: false,
|
|
202
|
-
error: error instanceof Error ? error.message : String(error)
|
|
203
|
-
}, 400);
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
authenticated.post("/api/work-discovery/personal-context/profile", limited, async (c) => {
|
|
207
|
-
const body = await c.req.json().catch(() => null);
|
|
208
|
-
const decisions = (body && typeof body === "object" && Array.isArray(body.decisions) ? body.decisions : []).flatMap((value) => {
|
|
209
|
-
if (!value || typeof value !== "object") return [];
|
|
210
|
-
const item = value;
|
|
211
|
-
const memoryRecordId = typeof item.memoryRecordId === "string" ? item.memoryRecordId.trim() : "";
|
|
212
|
-
const status = item.status === "accepted" || item.status === "edited" || item.status === "rejected" ? item.status : void 0;
|
|
213
|
-
if (!memoryRecordId || !status) return [];
|
|
214
|
-
return [{
|
|
215
|
-
memoryRecordId,
|
|
216
|
-
status,
|
|
217
|
-
...typeof item.statement === "string" ? { statement: item.statement } : {}
|
|
218
|
-
}];
|
|
219
|
-
}).slice(0, 10);
|
|
220
|
-
if (!decisions.length) return c.json({
|
|
221
|
-
ok: false,
|
|
222
|
-
error: "At least one valid decision is required"
|
|
223
|
-
}, 400);
|
|
224
|
-
return c.json({
|
|
225
|
-
ok: true,
|
|
226
|
-
decisions: service.updatePersonalContextProfile({ decisions })
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
98
|
authenticated.post("/api/work-discovery/quick-runs", limited, async (c) => {
|
|
230
99
|
if (!service.isEnabled()) return c.json({
|
|
231
100
|
ok: false,
|
|
@@ -389,4 +258,4 @@ function registerWorkDiscoveryRoutes(authenticated, deps) {
|
|
|
389
258
|
});
|
|
390
259
|
}
|
|
391
260
|
//#endregion
|
|
392
|
-
export { registerWorkDiscoveryRoutes };
|
|
261
|
+
export { getWorkDiscoveryService, registerWorkDiscoveryRoutes };
|
|
@@ -1,25 +1,3 @@
|
|
|
1
1
|
import type { Hono } from 'hono';
|
|
2
|
-
import type { MemoryRecord } from '../../../agent/memory/types.js';
|
|
3
|
-
import { type PersonalPlaybookContext } from '../../../user-context/personal-playbook.js';
|
|
4
2
|
import type { AuthenticatedRouteDeps } from './deps.js';
|
|
5
|
-
export declare function buildPersonalPlaybooks(records: MemoryRecord[]): {
|
|
6
|
-
id: "communication" | "execution" | "routines";
|
|
7
|
-
enabled: boolean;
|
|
8
|
-
rules: {
|
|
9
|
-
id: string;
|
|
10
|
-
statement: string;
|
|
11
|
-
origin: import("../../../agent/memory/types.js").MemoryExplicitness;
|
|
12
|
-
enabled: boolean;
|
|
13
|
-
order: number;
|
|
14
|
-
context: PersonalPlaybookContext;
|
|
15
|
-
versions: {
|
|
16
|
-
id: string;
|
|
17
|
-
statement: string;
|
|
18
|
-
updatedAt: string;
|
|
19
|
-
current: boolean;
|
|
20
|
-
}[];
|
|
21
|
-
}[];
|
|
22
|
-
updatedAt: string;
|
|
23
|
-
}[];
|
|
24
|
-
export declare function buildRoutineAutomationDraftHref(record: Pick<MemoryRecord, 'id' | 'content'>): string;
|
|
25
3
|
export declare function registerYouRoutes(authenticated: Hono, deps: AuthenticatedRouteDeps): void;
|