@xopcai/xopc 0.0.145 → 0.0.147
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 +2 -2
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/demo-memory/src/index.js +6 -4
- package/dist/extensions/demo-memory/src/index.js.map +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/Combination-14nmIgxH.js +41 -0
- package/dist/gateway/static/root/assets/activity-store-DXeSSlw1.js +1 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BEUxdhZx.js → agent-avatar-dicebear-CFdJKSjY.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DKjbRpbA.js +2 -0
- package/dist/gateway/static/root/assets/api-Bs69B5zA.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CRHSZJWi.js → app-management-settings-panel-ag1ViXT_.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BunADYJb.js → appearance-settings-C6iMpwOM.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-CpX3lBFF.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-B6vTkH2A.js → archive-plugin-Dwi3mIBy.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BjZXzaNv.js → attachment-load-BaCDoq40.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-ZDA-Stg1.js → automation-suggestion-card-CwqtFgnw.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-DlupOxFQ.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DYZfLvPz.js → binary-plugins-DoAYhsxa.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C3MUlYC9.js → block-editor-Bw72pO7S.js} +31 -31
- package/dist/gateway/static/root/assets/browser-settings-page-BwLoUBcZ.js +8 -0
- package/dist/gateway/static/root/assets/capability-presets-api-vdbAR65Q.js +1 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-BAsKbJgm.js +2 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-fTlTnWB4.js → channel-recipient-api-rTG26jpV.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-CxFWy0cE.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-OKlqTtKJ.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-BVFNT2zW.js → connector-logo-DIMP4NWY.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BjQQwX62.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-_jUmoXd3.js → desktop-pet-kQq2e0BN.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DwGOy4AQ.js → desktop-pet-settings-B6vtozMY.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-akvF0F-u.js → directory-picker-path-field-Dn5-e3v4.js} +1 -1
- package/dist/gateway/static/root/assets/dist-C230izr8.js +1 -0
- package/dist/gateway/static/root/assets/dist-CxGUk8J-.js +1 -0
- package/dist/gateway/static/root/assets/dreaming-settings-BzwIujPG.js +3 -0
- package/dist/gateway/static/root/assets/extension-debug-page-D_e_hsEy.js +1 -0
- package/dist/gateway/static/root/assets/{extension-page-CwWktRNz.js → extension-page-D15CWHBd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CuggWOIl.js → extension-settings-page-D4P0n1om.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-B7sxIbza.js → gateway-config-api-B4qZctjG.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DIv0eKMf.js → gateway-settings-BvndV7TP.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DtoLihQE.js → gateway-startup-retry-BpgMunEb.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-C4Kw0mfS.js → goal-create-dialog-DrVHKXHq.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-PHlCwv68.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-B0jm5JaA.js → goals-config-api-B6YJB_ct.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-Hg9uyO6e.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-N5_iL7es.js → goals-settings-BROWCIcL.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-XzH3lbRR.js → heartbeat-settings-CoCwIOIg.js} +1 -1
- package/dist/gateway/static/root/assets/index-CxkNzw3e.js +259 -0
- package/dist/gateway/static/root/assets/index-DjCSOyaN.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-Bm_AIYQ7.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-BJWFcxwG.js +2 -0
- package/dist/gateway/static/root/assets/local-apps-page-BsiZMrEf.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-CiM-D9jA.js → locale-store-Bp8joZck.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DOmK61ey.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-5rJx5flj.js → markdown-split-Dy7QpaAz.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DYXccwAd.js → media-plugins-3Lxliy9D.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CQGpD-dC.js +5 -0
- package/dist/gateway/static/root/assets/models-hub-panel-DGCZom4o.js +2 -0
- package/dist/gateway/static/root/assets/{notes-page-BgLyndCO.js → notes-page-BJtT4vSf.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-B_bN7cOR.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-6Al9_sGz.js → page-tabs-DKB6RDre.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cm3G72Hv.js → preview-open-alternatives-Br_YhYHp.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Dq8JouJj.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DvfL7fSe.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-DqwMXSXP.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BYtfzu_F.js → save-bar-controls-BgIE9BBh.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-CvIRc6yK.js → schedule-field-BXDP-oMz.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CQuKx0n7.js → schema-form-Dhv-SmjG.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-B_mOZkQk.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BHGmH6YS.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-CF3HHM-t.js → settings-collapsible-section-CUTExnlK.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-CwWjoRN6.js → settings-form-section-CmnDhsf0.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-aUFmJa13.js → settings-loading-skeleton-B79dq-XY.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B2UUU9TF.js → settings-page-Db8uAv3X.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DqpbTWqI.js → settings-page-layout-DaFwstQw.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BUSEj0KK.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BOhlPsS1.js → share-preview-page-Bi00uXzV.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DzsTYfuX.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DSsdU081.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DeB1tQZL.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-CWxSvuwD.js → system-settings-panel-Cxaph7hW.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-C9Dxcppm.js → theme-store-eCTN1RpG.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-qROAvqTw.js → typed-models-lib-CcZ_tyFY.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-DE9cpn4G.js → use-channel-catalog-C4PWbNoi.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-QTVMx_hG.js +1 -0
- package/dist/gateway/static/root/assets/{user-profile-fields-editor-CWxc0ghP.js → user-profile-fields-editor-CPOO9Jz5.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-DW-Up6vt.js → user-profile-settings-panel-C8cgtSF7.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-D53uRXVr.js → utils-CiZK2KwH.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-b-YZtvUu.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-4zVDOl2G.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-CHe2tfkc.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D_x9ELJp.js → workflow-run-setup-panel-8SLCYeXE.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DEOFqiWn.js +11 -0
- package/dist/gateway/static/root/index.html +10 -9
- package/dist/package.js +1 -1
- package/dist/src/activity/types.d.ts +1 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -1
- package/dist/src/agent/agent-manager.js +5 -4
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/background-review/coordinator.js +0 -1
- package/dist/src/agent/background-review/coordinator.js.map +1 -1
- package/dist/src/agent/background-review/settings.d.ts +1 -1
- package/dist/src/agent/background-review/settings.js +10 -17
- package/dist/src/agent/background-review/settings.js.map +1 -1
- package/dist/src/agent/bootstrap/filter-bootstrap-files.d.ts +1 -1
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js.map +1 -1
- package/dist/src/agent/bootstrap/load-bootstrap-files.js +2 -3
- package/dist/src/agent/bootstrap/load-bootstrap-files.js.map +1 -1
- package/dist/src/agent/code-intelligence/binary.js +1 -1
- package/dist/src/agent/context/project-context.d.ts +14 -0
- package/dist/src/agent/context/project-context.js +23 -1
- package/dist/src/agent/context/project-context.js.map +1 -1
- package/dist/src/agent/context/workspace-templates/AGENTS.md +1 -1
- package/dist/src/agent/context/workspace.d.ts +1 -2
- package/dist/src/agent/context/workspace.js +2 -4
- package/dist/src/agent/context/workspace.js.map +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -2
- package/dist/src/agent/embedded/run-for-session.js.map +1 -1
- package/dist/src/agent/embedded/run-turn.js +6 -1
- package/dist/src/agent/embedded/run-turn.js.map +1 -1
- package/dist/src/agent/embedded/types.d.ts +17 -0
- package/dist/src/agent/memory/builtin-memory-store.d.ts +2 -2
- package/dist/src/agent/memory/builtin-memory-store.js +2 -2
- package/dist/src/agent/memory/builtin-memory-store.js.map +1 -1
- package/dist/src/agent/memory/builtin-provider.d.ts +1 -3
- package/dist/src/agent/memory/builtin-provider.js +21 -48
- package/dist/src/agent/memory/builtin-provider.js.map +1 -1
- package/dist/src/agent/memory/context/planner.js +48 -9
- package/dist/src/agent/memory/context/planner.js.map +1 -1
- package/dist/src/agent/memory/context/types.d.ts +7 -1
- package/dist/src/agent/memory/context-fence.js +1 -1
- package/dist/src/agent/memory/context-fence.js.map +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +2 -9
- package/dist/src/agent/memory/create-memory-manager.js.map +1 -1
- package/dist/src/agent/memory/dreaming/config.js +5 -10
- package/dist/src/agent/memory/dreaming/config.js.map +1 -1
- package/dist/src/agent/memory/dreaming/promotion-lifecycle.js +2 -2
- package/dist/src/agent/memory/dreaming/promotion-lifecycle.js.map +1 -1
- package/dist/src/agent/memory/dreaming/scope.d.ts +2 -3
- package/dist/src/agent/memory/dreaming/scope.js +8 -8
- package/dist/src/agent/memory/dreaming/scope.js.map +1 -1
- package/dist/src/agent/memory/manager.d.ts +1 -5
- package/dist/src/agent/memory/manager.js +2 -23
- package/dist/src/agent/memory/manager.js.map +1 -1
- package/dist/src/agent/memory/memory-config.d.ts +3 -3
- package/dist/src/agent/memory/memory-config.js +9 -14
- package/dist/src/agent/memory/memory-config.js.map +1 -1
- package/dist/src/agent/memory/types.d.ts +9 -5
- package/dist/src/agent/memory/understanding/service.js +21 -8
- package/dist/src/agent/memory/understanding/service.js.map +1 -1
- package/dist/src/agent/memory/understanding/types.d.ts +5 -0
- package/dist/src/agent/memory/user-context-coordinator.d.ts +1 -1
- package/dist/src/agent/memory/user-context-coordinator.js +6 -2
- package/dist/src/agent/memory/user-context-coordinator.js.map +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +2 -2
- package/dist/src/agent/orchestration/agent-orchestrator.js.map +1 -1
- package/dist/src/agent/prompt/memory/index.d.ts +1 -2
- package/dist/src/agent/prompt/memory/index.js +6 -7
- package/dist/src/agent/prompt/memory/index.js.map +1 -1
- package/dist/src/agent/prompt/sections/tooling.js +1 -1
- package/dist/src/agent/prompt/sections/tooling.js.map +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +13 -2
- package/dist/src/agent/service/direct-turn-helpers.js.map +1 -1
- package/dist/src/agent/tools/curated-memory-tool.js +4 -4
- package/dist/src/agent/tools/curated-memory-tool.js.map +1 -1
- package/dist/src/agent/tools/factory.d.ts +1 -1
- package/dist/src/agent/tools/factory.js +2 -2
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/memory-tool.js +1 -1
- package/dist/src/agent/tools/memory-tool.js.map +1 -1
- package/dist/src/agent/workflow/workflow-child-tools.js +2 -3
- package/dist/src/agent/workflow/workflow-child-tools.js.map +1 -1
- package/dist/src/agent/workspace-runtime/registry.d.ts +5 -5
- package/dist/src/agent/workspace-runtime/registry.js +6 -11
- package/dist/src/agent/workspace-runtime/registry.js.map +1 -1
- package/dist/src/agent-manifest/index.js +2 -2
- package/dist/src/agent-manifest/prompt.js +1 -7
- package/dist/src/agent-manifest/prompt.js.map +1 -1
- package/dist/src/agent-manifest/schema.d.ts +0 -598
- package/dist/src/agent-manifest/schema.js +2 -143
- package/dist/src/agent-manifest/schema.js.map +1 -1
- package/dist/src/agent-manifest/validator.js +0 -12
- package/dist/src/agent-manifest/validator.js.map +1 -1
- 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/memory-runtime.js +8 -7
- package/dist/src/agent-runtime/memory-runtime.js.map +1 -1
- package/dist/src/agent-runtime/runtime-profile.d.ts +2 -0
- package/dist/src/agent-runtime/runtime-profile.js +2 -2
- package/dist/src/agent-runtime/runtime-profile.js.map +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -2
- package/dist/src/chat-commands/agent-edit.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/init.js +0 -22
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/templates.d.ts +1 -1
- package/dist/src/cli/templates.js +1 -16
- package/dist/src/cli/templates.js.map +1 -1
- package/dist/src/commands/agents.config.js +0 -10
- package/dist/src/commands/agents.config.js.map +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/paths.d.ts +0 -1
- package/dist/src/config/paths.js +1 -2
- package/dist/src/config/paths.js.map +1 -1
- package/dist/src/config/schema.d.ts +118 -532
- package/dist/src/config/schema.js +32 -26
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/extensions/loader.js +2 -1
- package/dist/src/extensions/loader.js.map +1 -1
- package/dist/src/gateway/agents-admin.d.ts +0 -2
- package/dist/src/gateway/agents-admin.js +1 -7
- package/dist/src/gateway/agents-admin.js.map +1 -1
- package/dist/src/gateway/capability-presets-admin.d.ts +0 -2
- package/dist/src/gateway/capability-presets-admin.js.map +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +26 -0
- package/dist/src/gateway/chat-stream/mapper.js.map +1 -1
- package/dist/src/gateway/chat-stream/protocol.d.ts +16 -1
- package/dist/src/gateway/dreaming-automation-reconciler.d.ts +0 -1
- package/dist/src/gateway/dreaming-automation-reconciler.js +41 -63
- package/dist/src/gateway/dreaming-automation-reconciler.js.map +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/app.js +3 -1
- package/dist/src/gateway/hono/app.js.map +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +0 -130
- package/dist/src/gateway/hono/lib/config-payload.js +0 -1
- package/dist/src/gateway/hono/lib/config-payload.js.map +1 -1
- package/dist/src/gateway/hono/routes/agents.js +6 -12
- package/dist/src/gateway/hono/routes/agents.js.map +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +6 -0
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js.map +1 -1
- package/dist/src/gateway/hono/routes/capability-presets.js +2 -2
- package/dist/src/gateway/hono/routes/capability-presets.js.map +1 -1
- package/dist/src/gateway/hono/routes/dreaming.js +9 -20
- package/dist/src/gateway/hono/routes/dreaming.js.map +1 -1
- package/dist/src/gateway/hono/routes/index.js +4 -0
- package/dist/src/gateway/hono/routes/index.js.map +1 -1
- package/dist/src/gateway/hono/routes/local-apps.d.ts +5 -0
- package/dist/src/gateway/hono/routes/local-apps.js +99 -0
- package/dist/src/gateway/hono/routes/local-apps.js.map +1 -0
- package/dist/src/gateway/hono/routes/memory.js +48 -65
- package/dist/src/gateway/hono/routes/memory.js.map +1 -1
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js.map +1 -1
- package/dist/src/gateway/hono/routes/work-discovery.d.ts +3 -0
- package/dist/src/gateway/hono/routes/work-discovery.js +150 -0
- package/dist/src/gateway/hono/routes/work-discovery.js.map +1 -0
- package/dist/src/gateway/hono/routes/you.d.ts +3 -0
- package/dist/src/gateway/hono/routes/you.js +358 -91
- package/dist/src/gateway/hono/routes/you.js.map +1 -1
- package/dist/src/gateway/service.d.ts +3 -0
- package/dist/src/gateway/service.js +12 -0
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.js +9 -5
- package/dist/src/knowledge/connected-knowledge-pipeline.js.map +1 -1
- package/dist/src/local-apps/acceptance.d.ts +30 -0
- package/dist/src/local-apps/acceptance.js +93 -0
- package/dist/src/local-apps/acceptance.js.map +1 -0
- package/dist/src/local-apps/index.d.ts +5 -0
- package/dist/src/local-apps/index.js +4 -0
- package/dist/src/local-apps/preview-runtime-bridge.d.ts +4 -0
- package/dist/src/local-apps/preview-runtime-bridge.js +171 -0
- package/dist/src/local-apps/preview-runtime-bridge.js.map +1 -0
- package/dist/src/local-apps/runtime-entry.d.ts +8 -0
- package/dist/src/local-apps/runtime-entry.js +25 -0
- package/dist/src/local-apps/runtime-entry.js.map +1 -0
- package/dist/src/local-apps/scaffold.d.ts +8 -0
- package/dist/src/local-apps/scaffold.js +122 -0
- package/dist/src/local-apps/scaffold.js.map +1 -0
- package/dist/src/local-apps/service.d.ts +37 -0
- package/dist/src/local-apps/service.js +553 -0
- package/dist/src/local-apps/service.js.map +1 -0
- package/dist/src/local-apps/store.d.ts +44 -0
- package/dist/src/local-apps/store.js +195 -0
- package/dist/src/local-apps/store.js.map +1 -0
- package/dist/src/local-apps/types.d.ts +105 -0
- package/dist/src/local-apps/types.js +1 -0
- package/dist/src/storage/sqlite/index.d.ts +3 -2
- package/dist/src/storage/sqlite/index.js +4 -3
- package/dist/src/storage/sqlite/memory-index-repository.d.ts +2 -3
- package/dist/src/storage/sqlite/memory-index-repository.js +16 -20
- package/dist/src/storage/sqlite/memory-index-repository.js.map +1 -1
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +18 -10
- package/dist/src/storage/sqlite/memory-records-repository.js +79 -34
- package/dist/src/storage/sqlite/memory-records-repository.js.map +1 -1
- package/dist/src/storage/sqlite/memory-reference-consent-repository.d.ts +27 -0
- package/dist/src/storage/sqlite/memory-reference-consent-repository.js +109 -0
- package/dist/src/storage/sqlite/memory-reference-consent-repository.js.map +1 -0
- package/dist/src/storage/sqlite/migrations/038_user_owned_memory.sql +68 -0
- package/dist/src/storage/sqlite/migrations/039_memory_reference_consents.sql +19 -0
- package/dist/src/storage/sqlite/migrations/040_local_apps.sql +32 -0
- package/dist/src/storage/sqlite/migrations/041_local_app_release_lifecycle.sql +17 -0
- package/dist/src/storage/sqlite/migrations/042_work_discovery.sql +41 -0
- package/dist/src/storage/sqlite/migrations/043_local_app_acceptance_runs.sql +16 -0
- package/dist/src/storage/sqlite/migrations/044_repair_work_discovery_foreign_keys.sql +75 -0
- package/dist/src/storage/sqlite/migrations/045_extension_ui_grants.sql +13 -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.js.map +1 -1
- 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 +20 -0
- package/dist/src/user-context/config.d.ts +227 -0
- package/dist/src/user-context/config.js +158 -0
- package/dist/src/user-context/config.js.map +1 -0
- package/dist/src/user-context/import.d.ts +1 -1
- package/dist/src/user-context/import.js +6 -1
- package/dist/src/user-context/import.js.map +1 -1
- package/dist/src/user-context/owner.d.ts +5 -0
- package/dist/src/user-context/owner.js +9 -0
- package/dist/src/user-context/owner.js.map +1 -0
- package/dist/src/user-context/projection.d.ts +11 -9
- package/dist/src/user-context/projection.js +74 -47
- package/dist/src/user-context/projection.js.map +1 -1
- package/dist/src/user-context/runtime.d.ts +13 -0
- package/dist/src/user-context/runtime.js +36 -0
- package/dist/src/user-context/runtime.js.map +1 -0
- package/dist/src/work-discovery/analyzer.d.ts +11 -0
- package/dist/src/work-discovery/analyzer.js +171 -0
- package/dist/src/work-discovery/analyzer.js.map +1 -0
- package/dist/src/work-discovery/index.d.ts +5 -0
- package/dist/src/work-discovery/index.js +5 -0
- package/dist/src/work-discovery/probe.d.ts +12 -0
- package/dist/src/work-discovery/probe.js +335 -0
- package/dist/src/work-discovery/probe.js.map +1 -0
- package/dist/src/work-discovery/repository.d.ts +11 -0
- package/dist/src/work-discovery/repository.js +100 -0
- package/dist/src/work-discovery/repository.js.map +1 -0
- package/dist/src/work-discovery/service.d.ts +30 -0
- package/dist/src/work-discovery/service.js +387 -0
- package/dist/src/work-discovery/service.js.map +1 -0
- package/dist/src/work-discovery/types.d.ts +114 -0
- package/dist/src/work-discovery/types.js +1 -0
- package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
- package/dist/src/workflows/service/workflow-session-bridge.js.map +1 -1
- package/package.json +5 -3
- package/skills/engineering/build-xopc-local-app/SKILL.md +45 -0
- package/skills/engineering/build-xopc-local-app/references/app-contract.md +33 -0
- package/skills/engineering/build-xopc-local-app/scripts/validate-local-app.mjs +72 -0
- package/dist/gateway/static/root/assets/Combination-DolwnuKi.js +0 -41
- package/dist/gateway/static/root/assets/activity-center-store-3l9ahUqb.js +0 -1
- package/dist/gateway/static/root/assets/agents-1bpT0xRO.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-Cc4JgVUQ.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-mb0fdVpq.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Bb0xhaMN.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-api-BV76yN9a.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-CUcGKZqC.js +0 -2
- package/dist/gateway/static/root/assets/channels-settings-BlSDMGdy.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CJauF1CW.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CMgAFGvb.js +0 -2
- package/dist/gateway/static/root/assets/dist-C99RGfAH.js +0 -1
- package/dist/gateway/static/root/assets/dreaming-settings-BLetQiYY.js +0 -3
- package/dist/gateway/static/root/assets/extension-debug-page-Cof2ncxE.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-BMmzYpZL.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-CGeT77PC.js +0 -2
- package/dist/gateway/static/root/assets/index-CSLF84-Q.css +0 -1
- package/dist/gateway/static/root/assets/index-I-ZCenVw.js +0 -259
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-x_v0nrIi.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-BSh1t8cD.js +0 -7
- package/dist/gateway/static/root/assets/messages-Cb1VMeqP.js +0 -5
- package/dist/gateway/static/root/assets/models-hub-panel-BNpTenAI.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-teklkhcE.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-CCB_dKoh.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-VOAFAHYj.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-USYu64Ru.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-oGC8O5h_.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D4rP66R1.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Ck9keROI.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BYLsCuqj.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BNHUyVML.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-CpXbQH4n.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-DbNEK4Yp.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-Cs7MOrg0.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-D1ziG1Pp.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DHGV_n6i.js +0 -11
- package/dist/src/agent/context/workspace-templates/MEMORY.md +0 -33
- package/dist/src/agent/memory/access-policy.d.ts +0 -12
- package/dist/src/agent/memory/access-policy.js +0 -44
- package/dist/src/agent/memory/access-policy.js.map +0 -1
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import { runSqliteWriteTransaction } from "../../../storage/sqlite/transaction.js";
|
|
2
2
|
import { deleteMemoryRecord, getMemoryRecord, listMemoryRecords, upsertMemoryRecord } from "../../../storage/sqlite/memory-records-repository.js";
|
|
3
3
|
import { listKnowledgeSourceItems, listKnowledgeSyncRuns } from "../../../storage/sqlite/knowledge-repository.js";
|
|
4
|
+
import { getConnectorConnection, listConnectorConnections } from "../../../storage/sqlite/connector-repository.js";
|
|
4
5
|
import { USER_TRUST_LEVELS, isUserTrustLevel } from "../../../user-context/trust-policy.js";
|
|
5
6
|
import { getUserTrustPolicy, setUserTrustPolicy } from "../../../storage/sqlite/user-trust-repository.js";
|
|
7
|
+
import { decideMemoryReferenceConsent, listMemoryReferenceConsents, revokeMemoryReferenceConsent } from "../../../storage/sqlite/memory-reference-consent-repository.js";
|
|
6
8
|
import { getUserProfilePromptState, setUserProfilePromptState } from "../../../storage/sqlite/user-profile-setup-repository.js";
|
|
7
9
|
import "../../../storage/sqlite/index.js";
|
|
8
|
-
import {
|
|
10
|
+
import { UserContextConfigSchema, init_config } from "../../../user-context/config.js";
|
|
9
11
|
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
10
|
-
import { resolveEffectiveAgentManifestForAgent } from "../../../config/agent-profile.js";
|
|
11
12
|
import { GoalService } from "../../../goals/goal-service.js";
|
|
12
13
|
import { draftGoalContract } from "../../../goals/goal-contract-draft.js";
|
|
13
14
|
import "../../../goals/index.js";
|
|
15
|
+
import { revokeComposioConnection } from "../../../connectors/composio.js";
|
|
14
16
|
import { listConnectorCatalog } from "../../../connectors/catalog.js";
|
|
15
17
|
import { nextMemoryReviewAt, resolveMemoryStability } from "../../../agent/memory/lifecycle.js";
|
|
16
18
|
import { listConnectorInstances } from "../../../connectors/instances.js";
|
|
17
19
|
import { uninstallConnector } from "../../../connectors/install.js";
|
|
18
|
-
import {
|
|
19
|
-
import { isUserContextRecord, projectPersonalContextSources, projectUserContextRecord, recordsDerivedFromPersonalContextSource } from "../../../user-context/projection.js";
|
|
20
|
+
import { readUserProfileFile, writeUserProfileFile } from "../../agents-admin.js";
|
|
21
|
+
import { isUserContextMemoryKind, isUserContextRecord, projectPersonalContextSources, projectUserContextRecord, recordsDerivedFromPersonalContextSource } from "../../../user-context/projection.js";
|
|
20
22
|
import { prepareUserContextImport } from "../../../user-context/import.js";
|
|
21
23
|
import { buildUserProfileSetup, parseUserProfileMarkdown, patchUserProfileMarkdown } from "../../../user-context/profile.js";
|
|
22
24
|
import { buildGoalSourceRecommendations } from "../../../user-context/source-recommendations.js";
|
|
23
25
|
//#region src/gateway/hono/routes/you.ts
|
|
24
26
|
init_agent_scope();
|
|
25
|
-
|
|
27
|
+
init_config();
|
|
26
28
|
const VISIBLE_STATUSES = new Set([
|
|
27
29
|
"active",
|
|
28
30
|
"candidate",
|
|
@@ -42,6 +44,8 @@ const PLAYBOOK_IDS = [
|
|
|
42
44
|
"execution",
|
|
43
45
|
"routines"
|
|
44
46
|
];
|
|
47
|
+
const PLAYBOOK_DISABLED_TAG = "playbook:disabled";
|
|
48
|
+
const PLAYBOOK_ORDER_PREFIX = "playbook:order:";
|
|
45
49
|
const PROFILE_FIELD_LIMITS = {
|
|
46
50
|
callName: 80,
|
|
47
51
|
pronouns: 80,
|
|
@@ -57,13 +61,28 @@ const ALL_MEMORY_STATUSES = [
|
|
|
57
61
|
"archived",
|
|
58
62
|
"rejected"
|
|
59
63
|
];
|
|
60
|
-
|
|
64
|
+
const MEMORY_SENSITIVITIES = new Set([
|
|
65
|
+
"normal",
|
|
66
|
+
"personal",
|
|
67
|
+
"secret",
|
|
68
|
+
"regulated"
|
|
69
|
+
]);
|
|
70
|
+
const MEMORY_DURABILITIES = new Set([
|
|
71
|
+
"ephemeral",
|
|
72
|
+
"durable",
|
|
73
|
+
"recurring"
|
|
74
|
+
]);
|
|
75
|
+
const MEMORY_DISCLOSURE_POLICIES = new Set([
|
|
76
|
+
"silent",
|
|
77
|
+
"referenceable",
|
|
78
|
+
"ask_before_reference"
|
|
79
|
+
]);
|
|
80
|
+
function listAllUserContextRecords(statuses) {
|
|
61
81
|
return statuses.flatMap((status) => {
|
|
62
82
|
const records = [];
|
|
63
83
|
let offset = 0;
|
|
64
84
|
while (true) {
|
|
65
85
|
const page = listMemoryRecords({
|
|
66
|
-
agentId,
|
|
67
86
|
status,
|
|
68
87
|
limit: 500,
|
|
69
88
|
offset
|
|
@@ -75,6 +94,38 @@ function listAllAgentMemoryRecords(agentId, statuses) {
|
|
|
75
94
|
return records;
|
|
76
95
|
});
|
|
77
96
|
}
|
|
97
|
+
function projectReferenceConsent(consent, record) {
|
|
98
|
+
return {
|
|
99
|
+
id: consent.id,
|
|
100
|
+
recordId: consent.recordId,
|
|
101
|
+
sessionKey: consent.sessionKey,
|
|
102
|
+
purpose: consent.purpose,
|
|
103
|
+
statement: record.content,
|
|
104
|
+
sourceName: record.source.provider ?? "local",
|
|
105
|
+
status: consent.status,
|
|
106
|
+
grantScope: consent.grantScope,
|
|
107
|
+
expiresAt: consent.expiresAt,
|
|
108
|
+
createdAt: consent.createdAt,
|
|
109
|
+
updatedAt: consent.updatedAt
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function buildConflictGroups(records) {
|
|
113
|
+
const groups = /* @__PURE__ */ new Map();
|
|
114
|
+
for (const record of records) {
|
|
115
|
+
if (!record.conflictGroupId) continue;
|
|
116
|
+
const group = groups.get(record.conflictGroupId) ?? [];
|
|
117
|
+
group.push(record);
|
|
118
|
+
groups.set(record.conflictGroupId, group);
|
|
119
|
+
}
|
|
120
|
+
return [...groups.entries()].filter(([, group]) => group.length > 1 && group.some((record) => VISIBLE_STATUSES.has(record.status))).map(([id, group]) => ({
|
|
121
|
+
id,
|
|
122
|
+
records: group.sort((left, right) => Date.parse(right.updatedAt) - Date.parse(left.updatedAt)).map((record) => ({
|
|
123
|
+
...projectUserContextRecord(record),
|
|
124
|
+
storedStatus: record.status
|
|
125
|
+
})),
|
|
126
|
+
unresolved: group.filter((record) => VISIBLE_STATUSES.has(record.status)).length > 1
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
78
129
|
async function readProfileBundle(config) {
|
|
79
130
|
const result = await readUserProfileFile();
|
|
80
131
|
const profileContent = result.ok ? result.data.content : "";
|
|
@@ -107,20 +158,33 @@ function playbookForRecord(record) {
|
|
|
107
158
|
if (record.kind === "task_lesson" || record.kind === "derived_insight") return "execution";
|
|
108
159
|
if (record.kind === "routine") return "routines";
|
|
109
160
|
}
|
|
161
|
+
function playbookRuleOrder(record) {
|
|
162
|
+
const tag = record.tags?.find((value) => value.startsWith(PLAYBOOK_ORDER_PREFIX));
|
|
163
|
+
const parsed = tag ? Number.parseInt(tag.slice(15), 10) : NaN;
|
|
164
|
+
return Number.isFinite(parsed) ? parsed : 1e3;
|
|
165
|
+
}
|
|
166
|
+
function patchPlaybookRuleTags(record, patch) {
|
|
167
|
+
let tags = (record.tags ?? []).filter((tag) => !tag.startsWith(PLAYBOOK_ORDER_PREFIX));
|
|
168
|
+
if (patch.enabled === true) tags = tags.filter((tag) => tag !== PLAYBOOK_DISABLED_TAG);
|
|
169
|
+
if (patch.enabled === false) tags.push(PLAYBOOK_DISABLED_TAG);
|
|
170
|
+
if (patch.order !== void 0) tags.push(`${PLAYBOOK_ORDER_PREFIX}${patch.order}`);
|
|
171
|
+
return [...new Set(tags)];
|
|
172
|
+
}
|
|
110
173
|
function buildPersonalPlaybooks(records) {
|
|
111
|
-
return PLAYBOOK_IDS.
|
|
112
|
-
const rules = records.filter((record) => playbookForRecord(record) === id);
|
|
113
|
-
|
|
114
|
-
return [{
|
|
174
|
+
return PLAYBOOK_IDS.map((id) => {
|
|
175
|
+
const rules = records.filter((record) => playbookForRecord(record) === id).sort((left, right) => playbookRuleOrder(left) - playbookRuleOrder(right) || left.updatedAt.localeCompare(right.updatedAt));
|
|
176
|
+
return {
|
|
115
177
|
id,
|
|
116
|
-
enabled: rules.some((record) => record.
|
|
178
|
+
enabled: rules.some((record) => !record.tags?.includes(PLAYBOOK_DISABLED_TAG)),
|
|
117
179
|
rules: rules.map((record) => ({
|
|
118
180
|
id: record.id,
|
|
119
181
|
statement: record.content,
|
|
120
|
-
origin: record.explicitness
|
|
182
|
+
origin: record.explicitness,
|
|
183
|
+
enabled: !record.tags?.includes(PLAYBOOK_DISABLED_TAG),
|
|
184
|
+
order: playbookRuleOrder(record)
|
|
121
185
|
})),
|
|
122
186
|
updatedAt: rules.map((record) => record.updatedAt).sort().at(-1)
|
|
123
|
-
}
|
|
187
|
+
};
|
|
124
188
|
});
|
|
125
189
|
}
|
|
126
190
|
function buildInsightSuggestions(records) {
|
|
@@ -137,12 +201,19 @@ function buildInsightSuggestions(records) {
|
|
|
137
201
|
sourceName: record.source.provider ?? "local"
|
|
138
202
|
}));
|
|
139
203
|
}
|
|
204
|
+
function buildRoutineAutomationDraftHref(record) {
|
|
205
|
+
return `/automations?${new URLSearchParams({
|
|
206
|
+
draft: record.content,
|
|
207
|
+
autogenerate: "1",
|
|
208
|
+
insight: record.id
|
|
209
|
+
}).toString()}`;
|
|
210
|
+
}
|
|
140
211
|
function selectedAgentId(config) {
|
|
141
212
|
return resolveDefaultAgentId(config);
|
|
142
213
|
}
|
|
143
|
-
function editableRecord(recordId
|
|
214
|
+
function editableRecord(recordId) {
|
|
144
215
|
const record = getMemoryRecord(recordId);
|
|
145
|
-
if (!record ||
|
|
216
|
+
if (!record || !VISIBLE_STATUSES.has(record.status) || !isUserContextRecord(record)) return null;
|
|
146
217
|
return record;
|
|
147
218
|
}
|
|
148
219
|
function preserveRecord(record, patch) {
|
|
@@ -150,7 +221,7 @@ function preserveRecord(record, patch) {
|
|
|
150
221
|
id: record.id,
|
|
151
222
|
providerId: record.source.provider ?? "local",
|
|
152
223
|
kind: record.kind,
|
|
153
|
-
|
|
224
|
+
sourceAgentId: record.provenance.sourceAgentId,
|
|
154
225
|
workspaceId: record.scope.workspaceId,
|
|
155
226
|
sessionKey: record.scope.sessionKey,
|
|
156
227
|
projectId: record.scope.projectId,
|
|
@@ -180,20 +251,17 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
180
251
|
const config = deps.service.currentConfig;
|
|
181
252
|
const agentId = selectedAgentId(config);
|
|
182
253
|
const profileBundle = await readProfileBundle(config);
|
|
183
|
-
const allUserContextRecords =
|
|
254
|
+
const allUserContextRecords = listAllUserContextRecords(ALL_MEMORY_STATUSES).filter(isUserContextRecord);
|
|
184
255
|
const records = allUserContextRecords.filter((record) => VISIBLE_STATUSES.has(record.status));
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
status: "archived",
|
|
188
|
-
limit: 200
|
|
189
|
-
}).filter(isUserContextRecord).filter((record) => record.tags?.some((tag) => tag.startsWith("playbook:paused:")));
|
|
190
|
-
const manifest = resolveEffectiveAgentManifestForAgent(config, agentId);
|
|
256
|
+
const recordById = new Map(allUserContextRecords.map((record) => [record.id, record]));
|
|
257
|
+
const consents = listMemoryReferenceConsents();
|
|
191
258
|
const trustPolicy = getUserTrustPolicy();
|
|
192
259
|
const sourceDefinitions = listConnectorCatalog();
|
|
193
260
|
const sourceInstances = listConnectorInstances(config);
|
|
194
261
|
const sources = projectPersonalContextSources(sourceDefinitions, sourceInstances, allUserContextRecords, {
|
|
195
262
|
sourceItems: listKnowledgeSourceItems({ limit: 500 }),
|
|
196
|
-
syncRuns: listKnowledgeSyncRuns({ limit: 500 })
|
|
263
|
+
syncRuns: listKnowledgeSyncRuns({ limit: 500 }),
|
|
264
|
+
connections: listConnectorConnections({ principalId: "local-owner" })
|
|
197
265
|
});
|
|
198
266
|
const activeGoals = new GoalService().list({
|
|
199
267
|
agentId,
|
|
@@ -206,23 +274,29 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
206
274
|
limit: 20
|
|
207
275
|
});
|
|
208
276
|
return c.json({
|
|
209
|
-
agentId,
|
|
210
277
|
scope: {
|
|
211
278
|
profile: "global",
|
|
212
|
-
memory: "
|
|
213
|
-
trust: "global"
|
|
214
|
-
agentId
|
|
279
|
+
memory: "global",
|
|
280
|
+
trust: "global"
|
|
215
281
|
},
|
|
216
282
|
...profileBundle,
|
|
217
283
|
understanding: records.map(projectUserContextRecord),
|
|
284
|
+
consentRequests: consents.filter((consent) => consent.status === "pending").flatMap((consent) => {
|
|
285
|
+
const record = recordById.get(consent.recordId);
|
|
286
|
+
return record ? [projectReferenceConsent(consent, record)] : [];
|
|
287
|
+
}),
|
|
288
|
+
referenceGrants: consents.filter((consent) => consent.status === "granted" && (!consent.expiresAt || Date.parse(consent.expiresAt) > Date.now())).flatMap((consent) => {
|
|
289
|
+
const record = recordById.get(consent.recordId);
|
|
290
|
+
return record ? [projectReferenceConsent(consent, record)] : [];
|
|
291
|
+
}),
|
|
292
|
+
conflictGroups: buildConflictGroups(allUserContextRecords),
|
|
218
293
|
insights: buildInsightSuggestions(records),
|
|
219
|
-
playbooks: buildPersonalPlaybooks(
|
|
294
|
+
playbooks: buildPersonalPlaybooks(records.filter((record) => record.status === "active")),
|
|
220
295
|
sources,
|
|
221
296
|
sourceRecommendations: buildGoalSourceRecommendations(sourceDefinitions.filter((definition) => definition.capabilities.includes("context") || definition.capabilities.includes("memory_source")), new Set(sourceInstances.map((instance) => instance.connectorId)), activeGoals),
|
|
222
297
|
controls: {
|
|
223
|
-
mode:
|
|
224
|
-
sensitiveWritePolicy:
|
|
225
|
-
crossAgentSharing: manifest.memory.privacy?.crossAgentSharing ?? "deny"
|
|
298
|
+
mode: config.userContext.memory.mode,
|
|
299
|
+
sensitiveWritePolicy: config.userContext.privacy.sensitiveWritePolicy
|
|
226
300
|
},
|
|
227
301
|
trust: {
|
|
228
302
|
defaultActionLevel: trustPolicy.defaultActionLevel,
|
|
@@ -236,39 +310,37 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
236
310
|
});
|
|
237
311
|
authenticated.get("/api/you/export", async (c) => {
|
|
238
312
|
const config = deps.service.currentConfig;
|
|
239
|
-
const agentId = selectedAgentId(config);
|
|
240
313
|
const profileBundle = await readProfileBundle(config);
|
|
241
|
-
const understanding =
|
|
314
|
+
const understanding = listAllUserContextRecords(ALL_MEMORY_STATUSES).filter(isUserContextRecord).map((record) => ({
|
|
242
315
|
statement: record.content,
|
|
243
316
|
kind: record.kind,
|
|
244
317
|
status: record.status,
|
|
245
318
|
sensitivity: record.sensitivity ?? "normal",
|
|
246
319
|
durability: record.durability,
|
|
247
|
-
|
|
320
|
+
disclosurePolicy: record.disclosurePolicy,
|
|
248
321
|
sourceName: record.source.provider ?? "local",
|
|
249
322
|
updatedAt: record.updatedAt
|
|
250
323
|
}));
|
|
251
324
|
return c.json({
|
|
252
|
-
version:
|
|
325
|
+
version: 2,
|
|
253
326
|
exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
254
|
-
agentId,
|
|
255
327
|
profile: profileBundle.profile,
|
|
256
328
|
understanding
|
|
257
329
|
});
|
|
258
330
|
});
|
|
259
331
|
authenticated.post("/api/you/import", deps.strictRateLimitMiddleware, async (c) => {
|
|
260
332
|
const body = await c.req.json().catch(() => null);
|
|
261
|
-
if (!body || typeof body !== "object" || Array.isArray(body) || body.version !==
|
|
333
|
+
if (!body || typeof body !== "object" || Array.isArray(body) || body.version !== 2 || !Array.isArray(body.understanding)) return c.json({ error: "Invalid About You export" }, 400);
|
|
262
334
|
if (body.understanding.length > 500) return c.json({ error: "Import is limited to 500 understandings" }, 400);
|
|
263
335
|
const config = deps.service.currentConfig;
|
|
264
336
|
const agentId = selectedAgentId(config);
|
|
265
|
-
const existingStatements =
|
|
337
|
+
const existingStatements = listAllUserContextRecords(ALL_MEMORY_STATUSES).filter(isUserContextRecord).map((record) => record.content);
|
|
266
338
|
const { imports, skippedCount } = prepareUserContextImport(body.understanding, existingStatements);
|
|
267
339
|
runSqliteWriteTransaction(() => {
|
|
268
340
|
for (const item of imports) upsertMemoryRecord({
|
|
269
341
|
providerId: "local",
|
|
270
342
|
kind: item.kind,
|
|
271
|
-
agentId,
|
|
343
|
+
sourceAgentId: agentId,
|
|
272
344
|
content: item.statement,
|
|
273
345
|
source: {
|
|
274
346
|
provider: "local",
|
|
@@ -281,7 +353,7 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
281
353
|
explicitness: "explicit",
|
|
282
354
|
durability: item.durability,
|
|
283
355
|
importance: .7,
|
|
284
|
-
disclosurePolicy: item.
|
|
356
|
+
disclosurePolicy: item.disclosurePolicy
|
|
285
357
|
});
|
|
286
358
|
});
|
|
287
359
|
return c.json({
|
|
@@ -290,6 +362,114 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
290
362
|
skippedCount
|
|
291
363
|
});
|
|
292
364
|
});
|
|
365
|
+
authenticated.post("/api/you/understanding", deps.strictRateLimitMiddleware, async (c) => {
|
|
366
|
+
const body = await c.req.json().catch(() => ({}));
|
|
367
|
+
const content = typeof body.content === "string" ? body.content.trim() : "";
|
|
368
|
+
const kind = isUserContextMemoryKind(body.kind) ? body.kind : void 0;
|
|
369
|
+
if (!content || content.length > 5e3) return c.json({ error: "Understanding content must be 1-5000 characters" }, 400);
|
|
370
|
+
if (!kind) return c.json({ error: "A valid user understanding kind is required" }, 400);
|
|
371
|
+
const duplicate = listAllUserContextRecords(ALL_MEMORY_STATUSES).filter(isUserContextRecord).find((record) => record.content.trim().toLocaleLowerCase() === content.toLocaleLowerCase());
|
|
372
|
+
if (duplicate) return c.json({
|
|
373
|
+
error: "This understanding already exists",
|
|
374
|
+
understanding: projectUserContextRecord(duplicate)
|
|
375
|
+
}, 409);
|
|
376
|
+
const sensitivity = MEMORY_SENSITIVITIES.has(body.sensitivity) ? body.sensitivity : "normal";
|
|
377
|
+
const durability = MEMORY_DURABILITIES.has(body.durability) ? body.durability : "durable";
|
|
378
|
+
const disclosurePolicy = MEMORY_DISCLOSURE_POLICIES.has(body.disclosurePolicy) ? body.disclosurePolicy : "referenceable";
|
|
379
|
+
const config = deps.service.currentConfig;
|
|
380
|
+
const created = upsertMemoryRecord({
|
|
381
|
+
providerId: "local",
|
|
382
|
+
kind,
|
|
383
|
+
sourceAgentId: selectedAgentId(config),
|
|
384
|
+
content,
|
|
385
|
+
source: {
|
|
386
|
+
provider: "local",
|
|
387
|
+
path: "you://manual"
|
|
388
|
+
},
|
|
389
|
+
confidence: 1,
|
|
390
|
+
tags: ["user-understanding", "explicit-user-memory"],
|
|
391
|
+
status: "active",
|
|
392
|
+
sensitivity,
|
|
393
|
+
explicitness: "explicit",
|
|
394
|
+
durability,
|
|
395
|
+
importance: .8,
|
|
396
|
+
disclosurePolicy,
|
|
397
|
+
reviewAfter: nextMemoryReviewAt({
|
|
398
|
+
durability,
|
|
399
|
+
explicitness: "explicit"
|
|
400
|
+
})
|
|
401
|
+
});
|
|
402
|
+
return c.json({ understanding: projectUserContextRecord(created) }, 201);
|
|
403
|
+
});
|
|
404
|
+
authenticated.get("/api/you/understanding/:id/history", (c) => {
|
|
405
|
+
const all = listAllUserContextRecords(ALL_MEMORY_STATUSES).filter(isUserContextRecord);
|
|
406
|
+
const target = all.find((record) => record.id === c.req.param("id"));
|
|
407
|
+
if (!target) return c.json({ error: "Understanding not found" }, 404);
|
|
408
|
+
const relatedIds = new Set([target.id]);
|
|
409
|
+
let changed = true;
|
|
410
|
+
while (changed) {
|
|
411
|
+
changed = false;
|
|
412
|
+
for (const record of all) if (record.supersedesRecordId && relatedIds.has(record.supersedesRecordId) || record.supersedesRecordId && relatedIds.has(record.id)) {
|
|
413
|
+
if (!relatedIds.has(record.id)) {
|
|
414
|
+
relatedIds.add(record.id);
|
|
415
|
+
changed = true;
|
|
416
|
+
}
|
|
417
|
+
if (record.supersedesRecordId && !relatedIds.has(record.supersedesRecordId)) {
|
|
418
|
+
relatedIds.add(record.supersedesRecordId);
|
|
419
|
+
changed = true;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
const history = all.filter((record) => relatedIds.has(record.id)).sort((left, right) => Date.parse(right.updatedAt) - Date.parse(left.updatedAt)).map((record) => ({
|
|
424
|
+
...projectUserContextRecord(record),
|
|
425
|
+
storedStatus: record.status
|
|
426
|
+
}));
|
|
427
|
+
return c.json({ history });
|
|
428
|
+
});
|
|
429
|
+
authenticated.post("/api/you/understanding/batch", deps.strictRateLimitMiddleware, async (c) => {
|
|
430
|
+
const body = await c.req.json().catch(() => ({}));
|
|
431
|
+
const ids = Array.isArray(body.ids) ? [...new Set(body.ids.filter((id) => typeof id === "string" && id.trim().length > 0).slice(0, 100))] : [];
|
|
432
|
+
const action = body.action === "confirm" || body.action === "reject" || body.action === "forget" ? body.action : void 0;
|
|
433
|
+
if (!ids.length || !action) return c.json({ error: "ids and a valid action are required" }, 400);
|
|
434
|
+
let updatedCount = 0;
|
|
435
|
+
runSqliteWriteTransaction(() => {
|
|
436
|
+
for (const id of ids) {
|
|
437
|
+
const record = editableRecord(id);
|
|
438
|
+
if (!record) continue;
|
|
439
|
+
if (action === "forget") deleteMemoryRecord(id);
|
|
440
|
+
else preserveRecord(record, {
|
|
441
|
+
status: action === "confirm" ? "active" : "rejected",
|
|
442
|
+
...action === "confirm" ? { reviewAfter: nextMemoryReviewAt(record) } : {}
|
|
443
|
+
});
|
|
444
|
+
updatedCount += 1;
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
return c.json({
|
|
448
|
+
ok: true,
|
|
449
|
+
updatedCount
|
|
450
|
+
});
|
|
451
|
+
});
|
|
452
|
+
authenticated.post("/api/you/conflicts/:id/resolve", deps.strictRateLimitMiddleware, async (c) => {
|
|
453
|
+
const body = await c.req.json().catch(() => ({}));
|
|
454
|
+
const winnerId = typeof body.winnerId === "string" ? body.winnerId : "";
|
|
455
|
+
const group = listAllUserContextRecords(ALL_MEMORY_STATUSES).filter(isUserContextRecord).filter((record) => record.conflictGroupId === c.req.param("id"));
|
|
456
|
+
const winner = group.find((record) => record.id === winnerId && VISIBLE_STATUSES.has(record.status));
|
|
457
|
+
if (group.length < 2 || !winner) return c.json({ error: "Conflict group or winner not found" }, 404);
|
|
458
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
459
|
+
runSqliteWriteTransaction(() => {
|
|
460
|
+
for (const record of group) preserveRecord(record, record.id === winnerId ? {
|
|
461
|
+
status: "active",
|
|
462
|
+
reviewAfter: nextMemoryReviewAt(record)
|
|
463
|
+
} : {
|
|
464
|
+
status: "archived",
|
|
465
|
+
validTo: record.validTo ?? now
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
return c.json({
|
|
469
|
+
ok: true,
|
|
470
|
+
understanding: projectUserContextRecord(getMemoryRecord(winnerId))
|
|
471
|
+
});
|
|
472
|
+
});
|
|
293
473
|
authenticated.patch("/api/you/profile", deps.strictRateLimitMiddleware, async (c) => {
|
|
294
474
|
const config = deps.service.currentConfig;
|
|
295
475
|
const parsed = parseProfilePatch(await c.req.json().catch(() => null));
|
|
@@ -338,38 +518,87 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
338
518
|
if (!PLAYBOOK_IDS.includes(id)) return c.json({ error: "Playbook not found" }, 404);
|
|
339
519
|
const enabled = (await c.req.json().catch(() => ({}))).enabled;
|
|
340
520
|
if (typeof enabled !== "boolean") return c.json({ error: "enabled must be a boolean" }, 400);
|
|
341
|
-
const config = deps.service.currentConfig;
|
|
342
|
-
const agentId = selectedAgentId(config);
|
|
343
|
-
const pauseTag = `playbook:paused:${id}`;
|
|
344
521
|
const active = listMemoryRecords({
|
|
345
|
-
agentId,
|
|
346
522
|
status: "active",
|
|
347
523
|
limit: 500
|
|
348
524
|
}).filter(isUserContextRecord).filter((record) => playbookForRecord(record) === id);
|
|
349
|
-
const paused = listMemoryRecords({
|
|
350
|
-
agentId,
|
|
351
|
-
status: "archived",
|
|
352
|
-
limit: 500
|
|
353
|
-
}).filter(isUserContextRecord).filter((record) => record.tags?.includes(pauseTag));
|
|
354
|
-
const targets = enabled ? paused : active;
|
|
355
525
|
runSqliteWriteTransaction(() => {
|
|
356
|
-
for (const record of
|
|
357
|
-
status: enabled ? "active" : "archived",
|
|
358
|
-
tags: enabled ? (record.tags ?? []).filter((tag) => tag !== pauseTag) : [...new Set([...record.tags ?? [], pauseTag])]
|
|
359
|
-
});
|
|
526
|
+
for (const record of active) preserveRecord(record, { tags: patchPlaybookRuleTags(record, { enabled }) });
|
|
360
527
|
});
|
|
361
|
-
const current = active.
|
|
528
|
+
const current = active.map((record) => ({
|
|
529
|
+
...record,
|
|
530
|
+
tags: patchPlaybookRuleTags(record, { enabled })
|
|
531
|
+
}));
|
|
362
532
|
return c.json({
|
|
363
533
|
ok: true,
|
|
364
|
-
playbook: buildPersonalPlaybooks(current.
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
534
|
+
playbook: buildPersonalPlaybooks(current).find((playbook) => playbook.id === id)
|
|
535
|
+
});
|
|
536
|
+
});
|
|
537
|
+
authenticated.post("/api/you/playbooks/:id/rules", deps.strictRateLimitMiddleware, async (c) => {
|
|
538
|
+
const id = c.req.param("id");
|
|
539
|
+
if (!PLAYBOOK_IDS.includes(id)) return c.json({ error: "Playbook not found" }, 404);
|
|
540
|
+
const body = await c.req.json().catch(() => ({}));
|
|
541
|
+
const statement = typeof body.statement === "string" ? body.statement.trim() : "";
|
|
542
|
+
if (!statement || statement.length > 5e3) return c.json({ error: "Rule statement is required" }, 400);
|
|
543
|
+
const record = upsertMemoryRecord({
|
|
544
|
+
providerId: "local",
|
|
545
|
+
kind: id === "communication" ? "preference" : id === "execution" ? "task_lesson" : "routine",
|
|
546
|
+
sourceAgentId: selectedAgentId(deps.service.currentConfig),
|
|
547
|
+
content: statement,
|
|
548
|
+
source: {
|
|
549
|
+
provider: "local",
|
|
550
|
+
path: "you://playbook"
|
|
551
|
+
},
|
|
552
|
+
confidence: 1,
|
|
553
|
+
tags: [
|
|
554
|
+
"user-understanding",
|
|
555
|
+
"playbook:explicit",
|
|
556
|
+
`${PLAYBOOK_ORDER_PREFIX}${Number.isInteger(body.order) ? body.order : 1e3}`
|
|
557
|
+
],
|
|
558
|
+
status: "active",
|
|
559
|
+
sensitivity: "normal",
|
|
560
|
+
explicitness: "explicit",
|
|
561
|
+
durability: id === "routines" ? "recurring" : "durable",
|
|
562
|
+
importance: .85,
|
|
563
|
+
disclosurePolicy: "referenceable"
|
|
368
564
|
});
|
|
565
|
+
return c.json({
|
|
566
|
+
ok: true,
|
|
567
|
+
rule: buildPersonalPlaybooks([record]).find((playbook) => playbook.id === id)?.rules[0]
|
|
568
|
+
}, 201);
|
|
569
|
+
});
|
|
570
|
+
authenticated.patch("/api/you/playbooks/:id/rules/:recordId", deps.strictRateLimitMiddleware, async (c) => {
|
|
571
|
+
const id = c.req.param("id");
|
|
572
|
+
const record = editableRecord(c.req.param("recordId"));
|
|
573
|
+
if (!PLAYBOOK_IDS.includes(id) || !record || playbookForRecord(record) !== id) return c.json({ error: "Playbook rule not found" }, 404);
|
|
574
|
+
const body = await c.req.json().catch(() => ({}));
|
|
575
|
+
const content = body.statement === void 0 ? record.content : typeof body.statement === "string" ? body.statement.trim() : "";
|
|
576
|
+
if (!content || content.length > 5e3) return c.json({ error: "Rule statement is required" }, 400);
|
|
577
|
+
if (body.enabled !== void 0 && typeof body.enabled !== "boolean") return c.json({ error: "enabled must be boolean" }, 400);
|
|
578
|
+
if (body.order !== void 0 && (!Number.isInteger(body.order) || body.order < 0 || body.order > 1e4)) return c.json({ error: "order must be an integer between 0 and 10000" }, 400);
|
|
579
|
+
const updated = preserveRecord(record, {
|
|
580
|
+
content,
|
|
581
|
+
tags: patchPlaybookRuleTags(record, {
|
|
582
|
+
enabled: body.enabled,
|
|
583
|
+
order: body.order
|
|
584
|
+
}),
|
|
585
|
+
explicitness: body.statement === void 0 ? record.explicitness : "explicit"
|
|
586
|
+
});
|
|
587
|
+
return c.json({
|
|
588
|
+
ok: true,
|
|
589
|
+
rule: buildPersonalPlaybooks([updated]).find((playbook) => playbook.id === id)?.rules[0]
|
|
590
|
+
});
|
|
591
|
+
});
|
|
592
|
+
authenticated.delete("/api/you/playbooks/:id/rules/:recordId", deps.strictRateLimitMiddleware, (c) => {
|
|
593
|
+
const id = c.req.param("id");
|
|
594
|
+
const record = editableRecord(c.req.param("recordId"));
|
|
595
|
+
if (!PLAYBOOK_IDS.includes(id) || !record || playbookForRecord(record) !== id) return c.json({ error: "Playbook rule not found" }, 404);
|
|
596
|
+
deleteMemoryRecord(record.id);
|
|
597
|
+
return c.json({ ok: true });
|
|
369
598
|
});
|
|
370
599
|
authenticated.patch("/api/you/insights/:id", deps.strictRateLimitMiddleware, async (c) => {
|
|
371
600
|
const config = deps.service.currentConfig;
|
|
372
|
-
const existing = editableRecord(c.req.param("id")
|
|
601
|
+
const existing = editableRecord(c.req.param("id"));
|
|
373
602
|
if (!existing || existing.status !== "active" || !ACTIONABLE_INSIGHT_KINDS.has(existing.kind)) return c.json({ error: "Insight not found" }, 404);
|
|
374
603
|
const body = await c.req.json().catch(() => ({}));
|
|
375
604
|
const action = typeof body.action === "string" ? body.action : "";
|
|
@@ -380,7 +609,19 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
380
609
|
status: "dismissed"
|
|
381
610
|
});
|
|
382
611
|
}
|
|
383
|
-
if (action
|
|
612
|
+
if (action === "complete" && existing.kind === "routine") {
|
|
613
|
+
preserveRecord(existing, { tags: [...new Set([...existing.tags ?? [], INSIGHT_ACCEPTED_TAG])] });
|
|
614
|
+
return c.json({
|
|
615
|
+
ok: true,
|
|
616
|
+
status: "saved"
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
if (action !== "apply") return c.json({ error: "Action must be apply, complete, or dismiss" }, 400);
|
|
620
|
+
if (existing.kind === "routine") return c.json({
|
|
621
|
+
ok: true,
|
|
622
|
+
status: "drafting",
|
|
623
|
+
href: buildRoutineAutomationDraftHref(existing)
|
|
624
|
+
});
|
|
384
625
|
const title = existing.content.trim().split(/\r?\n/)[0].slice(0, 72);
|
|
385
626
|
const uiLocale = body.uiLocale === "zh" ? "zh" : "en";
|
|
386
627
|
const contractDraft = await draftGoalContract({
|
|
@@ -422,51 +663,79 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
422
663
|
});
|
|
423
664
|
authenticated.patch("/api/you/controls", deps.strictRateLimitMiddleware, async (c) => {
|
|
424
665
|
const config = deps.service.currentConfig;
|
|
425
|
-
const agentId = selectedAgentId(config);
|
|
426
|
-
const manifest = resolveEffectiveAgentManifestForAgent(config, agentId);
|
|
427
666
|
const body = await c.req.json().catch(() => ({}));
|
|
428
|
-
const parsed =
|
|
429
|
-
...
|
|
430
|
-
|
|
667
|
+
const parsed = UserContextConfigSchema.safeParse({
|
|
668
|
+
...config.userContext,
|
|
669
|
+
memory: {
|
|
670
|
+
...config.userContext.memory,
|
|
671
|
+
mode: body.mode
|
|
672
|
+
},
|
|
431
673
|
privacy: {
|
|
432
|
-
...
|
|
433
|
-
sensitiveWritePolicy: body.sensitiveWritePolicy
|
|
434
|
-
crossAgentSharing: body.crossAgentSharing
|
|
674
|
+
...config.userContext.privacy,
|
|
675
|
+
sensitiveWritePolicy: body.sensitiveWritePolicy
|
|
435
676
|
}
|
|
436
677
|
});
|
|
437
678
|
if (!parsed.success) return c.json({ error: parsed.error.issues[0]?.message ?? "Invalid personal context controls" }, 400);
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
|
|
679
|
+
const saved = await deps.service.saveConfig({
|
|
680
|
+
...config,
|
|
681
|
+
userContext: parsed.data
|
|
682
|
+
});
|
|
441
683
|
if (!saved.saved) return c.json({ error: saved.error ?? "save failed" }, 500);
|
|
442
|
-
const updated =
|
|
684
|
+
const updated = deps.service.currentConfig.userContext;
|
|
443
685
|
return c.json({ controls: {
|
|
444
686
|
mode: updated.memory.mode,
|
|
445
|
-
sensitiveWritePolicy: updated.
|
|
446
|
-
crossAgentSharing: updated.memory.privacy?.crossAgentSharing ?? "deny"
|
|
687
|
+
sensitiveWritePolicy: updated.privacy.sensitiveWritePolicy
|
|
447
688
|
} });
|
|
448
689
|
});
|
|
690
|
+
authenticated.patch("/api/you/consents/:id", deps.strictRateLimitMiddleware, async (c) => {
|
|
691
|
+
const body = await c.req.json().catch(() => ({}));
|
|
692
|
+
const decision = typeof body.decision === "string" ? body.decision : "";
|
|
693
|
+
if (![
|
|
694
|
+
"once",
|
|
695
|
+
"session",
|
|
696
|
+
"always",
|
|
697
|
+
"deny"
|
|
698
|
+
].includes(decision)) return c.json({ error: "Decision must be once, session, always, or deny" }, 400);
|
|
699
|
+
const consent = decideMemoryReferenceConsent(c.req.param("id"), decision);
|
|
700
|
+
if (!consent) return c.json({ error: "Pending consent not found" }, 404);
|
|
701
|
+
return c.json({
|
|
702
|
+
ok: true,
|
|
703
|
+
consent
|
|
704
|
+
});
|
|
705
|
+
});
|
|
706
|
+
authenticated.delete("/api/you/consents/:id", deps.strictRateLimitMiddleware, (c) => {
|
|
707
|
+
const consent = revokeMemoryReferenceConsent(c.req.param("id"));
|
|
708
|
+
if (!consent) return c.json({ error: "Active reference grant not found" }, 404);
|
|
709
|
+
return c.json({
|
|
710
|
+
ok: true,
|
|
711
|
+
consent
|
|
712
|
+
});
|
|
713
|
+
});
|
|
449
714
|
authenticated.delete("/api/you/sources/:instanceId", deps.strictRateLimitMiddleware, async (c) => {
|
|
450
715
|
const config = deps.service.currentConfig;
|
|
451
716
|
const instanceId = c.req.param("instanceId");
|
|
452
717
|
const installedInstances = listConnectorInstances(config);
|
|
718
|
+
const connection = getConnectorConnection(instanceId);
|
|
453
719
|
const instance = installedInstances.find((item) => item.instanceId === instanceId);
|
|
454
|
-
const
|
|
455
|
-
|
|
720
|
+
const connectorId = connection?.connectorId ?? instance?.connectorId;
|
|
721
|
+
const definition = connectorId ? listConnectorCatalog().find((item) => item.id === connectorId) : void 0;
|
|
722
|
+
if (!instance && !connection || !definition || !definition.capabilities.some((capability) => capability === "context" || capability === "memory_source")) return c.json({ error: "Personal context source not found" }, 404);
|
|
456
723
|
const body = await c.req.json().catch(() => ({}));
|
|
457
724
|
if (typeof body.deleteDerivedUnderstanding !== "boolean") return c.json({ error: "deleteDerivedUnderstanding must be a boolean" }, 400);
|
|
458
725
|
try {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
726
|
+
if (connection) await revokeComposioConnection(connection.id);
|
|
727
|
+
else if (instance) {
|
|
728
|
+
uninstallConnector(config, instance.instanceId);
|
|
729
|
+
const saved = await deps.service.saveConfig(config);
|
|
730
|
+
if (!saved.saved) return c.json({ error: saved.error ?? "save failed" }, 500);
|
|
731
|
+
}
|
|
463
732
|
} catch (error) {
|
|
464
733
|
return c.json({ error: error instanceof Error ? error.message : String(error) }, 400);
|
|
465
734
|
}
|
|
466
735
|
let deletedUnderstandingCount = 0;
|
|
467
736
|
if (body.deleteDerivedUnderstanding) {
|
|
468
|
-
const
|
|
469
|
-
const targets = recordsDerivedFromPersonalContextSource(
|
|
737
|
+
const sourceInstanceId = connection ? `composio:${connection.connectorId}:${connection.id}` : instanceId;
|
|
738
|
+
const targets = recordsDerivedFromPersonalContextSource(listAllUserContextRecords(ALL_MEMORY_STATUSES), sourceInstanceId);
|
|
470
739
|
runSqliteWriteTransaction(() => {
|
|
471
740
|
for (const record of targets) deleteMemoryRecord(record.id);
|
|
472
741
|
});
|
|
@@ -478,8 +747,7 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
478
747
|
});
|
|
479
748
|
});
|
|
480
749
|
authenticated.patch("/api/you/understanding/:id", deps.strictRateLimitMiddleware, async (c) => {
|
|
481
|
-
const
|
|
482
|
-
const existing = editableRecord(c.req.param("id"), config);
|
|
750
|
+
const existing = editableRecord(c.req.param("id"));
|
|
483
751
|
if (!existing) return c.json({ error: "Understanding not found" }, 404);
|
|
484
752
|
const body = await c.req.json().catch(() => ({}));
|
|
485
753
|
const action = typeof body.action === "string" ? body.action : "";
|
|
@@ -494,7 +762,7 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
494
762
|
const replacement = upsertMemoryRecord({
|
|
495
763
|
providerId: "local",
|
|
496
764
|
kind: existing.kind,
|
|
497
|
-
|
|
765
|
+
sourceAgentId: existing.provenance.sourceAgentId,
|
|
498
766
|
workspaceId: existing.scope.workspaceId,
|
|
499
767
|
sessionKey: existing.scope.sessionKey,
|
|
500
768
|
projectId: existing.scope.projectId,
|
|
@@ -529,14 +797,13 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
529
797
|
return c.json({ error: "Action must be confirm, reject, or update" }, 400);
|
|
530
798
|
});
|
|
531
799
|
authenticated.delete("/api/you/understanding/:id", deps.strictRateLimitMiddleware, (c) => {
|
|
532
|
-
const
|
|
533
|
-
const existing = editableRecord(c.req.param("id"), config);
|
|
800
|
+
const existing = editableRecord(c.req.param("id"));
|
|
534
801
|
if (!existing) return c.json({ error: "Understanding not found" }, 404);
|
|
535
802
|
deleteMemoryRecord(existing.id);
|
|
536
803
|
return c.json({ ok: true });
|
|
537
804
|
});
|
|
538
805
|
}
|
|
539
806
|
//#endregion
|
|
540
|
-
export { buildInsightSuggestions, buildPersonalPlaybooks, registerYouRoutes };
|
|
807
|
+
export { buildInsightSuggestions, buildPersonalPlaybooks, buildRoutineAutomationDraftHref, registerYouRoutes };
|
|
541
808
|
|
|
542
809
|
//# sourceMappingURL=you.js.map
|