@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,7 +1,7 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/agent-manifest/schema.ts
|
|
4
|
-
var IdSchema, DEFAULT_CAPABILITY_PRESET_ID, ManifestModelRoleSchema, AgentToolModelSchema, ModelPolicySchema, ModelPolicyPatchSchema, ToolModeSchema, ToolScopeSchema, ToolPolicySchema, ToolPolicySetSchema, SkillPolicySchema,
|
|
4
|
+
var IdSchema, DEFAULT_CAPABILITY_PRESET_ID, ManifestModelRoleSchema, AgentToolModelSchema, ModelPolicySchema, ModelPolicyPatchSchema, ToolModeSchema, ToolScopeSchema, ToolPolicySchema, ToolPolicySetSchema, SkillPolicySchema, WorkflowPolicySchema, BoundaryPolicySchema, WorkspacePolicySchema, RuntimePolicySchema, PromptPolicySchema, AgentIdentitySchema, AgentResponsibilitiesSchema, AgentManifestSchema, AgentConfigEntrySchema, CapabilityPresetSchema;
|
|
5
5
|
var init_schema = __esmMin((() => {
|
|
6
6
|
IdSchema = z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/);
|
|
7
7
|
DEFAULT_CAPABILITY_PRESET_ID = "default";
|
|
@@ -111,145 +111,6 @@ var init_schema = __esmMin((() => {
|
|
|
111
111
|
allow: z.array(z.string().min(1)).optional(),
|
|
112
112
|
deny: z.array(z.string().min(1)).optional()
|
|
113
113
|
}).strict().default({ mode: "all" });
|
|
114
|
-
DreamingPhasePolicySchema = z.object({
|
|
115
|
-
enabled: z.boolean().optional(),
|
|
116
|
-
cron: z.string().min(1).optional()
|
|
117
|
-
}).strict();
|
|
118
|
-
DreamingLightPolicySchema = DreamingPhasePolicySchema.extend({
|
|
119
|
-
lookbackDays: z.number().int().positive().optional(),
|
|
120
|
-
limit: z.number().int().nonnegative().optional(),
|
|
121
|
-
dedupeSimilarity: z.number().min(0).max(1).optional()
|
|
122
|
-
}).strict();
|
|
123
|
-
DreamingDeepPolicySchema = DreamingPhasePolicySchema.extend({
|
|
124
|
-
minScore: z.number().min(0).max(1).optional(),
|
|
125
|
-
minRecallCount: z.number().int().positive().optional(),
|
|
126
|
-
minUniqueQueries: z.number().int().positive().optional(),
|
|
127
|
-
limit: z.number().int().nonnegative().optional(),
|
|
128
|
-
recencyHalfLifeDays: z.number().positive().optional(),
|
|
129
|
-
maxAgeDays: z.number().positive().optional()
|
|
130
|
-
}).strict();
|
|
131
|
-
DreamingRemPolicySchema = DreamingPhasePolicySchema.extend({
|
|
132
|
-
lookbackDays: z.number().int().positive().optional(),
|
|
133
|
-
limit: z.number().int().nonnegative().optional(),
|
|
134
|
-
minPatternStrength: z.number().min(0).max(1).optional()
|
|
135
|
-
}).strict();
|
|
136
|
-
DreamingPolicySchema = z.object({
|
|
137
|
-
enabled: z.boolean().default(false),
|
|
138
|
-
frequency: z.string().min(1).optional(),
|
|
139
|
-
timezone: z.string().optional(),
|
|
140
|
-
phases: z.object({
|
|
141
|
-
light: DreamingLightPolicySchema.optional(),
|
|
142
|
-
deep: DreamingDeepPolicySchema.optional(),
|
|
143
|
-
rem: DreamingRemPolicySchema.optional()
|
|
144
|
-
}).strict().optional()
|
|
145
|
-
}).strict().optional();
|
|
146
|
-
UserUnderstandingPolicySchema = z.object({
|
|
147
|
-
enabled: z.boolean().optional(),
|
|
148
|
-
adaptiveCadence: z.boolean().optional(),
|
|
149
|
-
reviewIntervalTurns: z.number().int().min(1).max(1e3).optional(),
|
|
150
|
-
maxHistoryMessages: z.number().int().min(1).max(200).optional(),
|
|
151
|
-
maxDurationMs: z.number().int().min(1e3).max(6e5).optional()
|
|
152
|
-
}).strict();
|
|
153
|
-
MemoryPolicySchema = z.object({
|
|
154
|
-
mode: z.enum([
|
|
155
|
-
"off",
|
|
156
|
-
"readOnly",
|
|
157
|
-
"confirmWrite",
|
|
158
|
-
"auto"
|
|
159
|
-
]).default("off"),
|
|
160
|
-
sources: z.array(z.enum([
|
|
161
|
-
"session",
|
|
162
|
-
"userProfile",
|
|
163
|
-
"agentProfile",
|
|
164
|
-
"curated",
|
|
165
|
-
"workspace",
|
|
166
|
-
"connectedSources"
|
|
167
|
-
])).default(["session"]),
|
|
168
|
-
writePolicy: z.object({
|
|
169
|
-
userProfile: z.enum([
|
|
170
|
-
"deny",
|
|
171
|
-
"confirm",
|
|
172
|
-
"allow"
|
|
173
|
-
]).optional(),
|
|
174
|
-
agentProfile: z.enum([
|
|
175
|
-
"deny",
|
|
176
|
-
"confirm",
|
|
177
|
-
"allow"
|
|
178
|
-
]).optional(),
|
|
179
|
-
curated: z.enum([
|
|
180
|
-
"deny",
|
|
181
|
-
"confirm",
|
|
182
|
-
"allow"
|
|
183
|
-
]).optional(),
|
|
184
|
-
workspace: z.enum([
|
|
185
|
-
"deny",
|
|
186
|
-
"confirm",
|
|
187
|
-
"allow"
|
|
188
|
-
]).optional()
|
|
189
|
-
}).strict().optional(),
|
|
190
|
-
retention: z.object({
|
|
191
|
-
compaction: z.boolean().default(true),
|
|
192
|
-
maxAgeDays: z.number().int().positive().optional(),
|
|
193
|
-
maxItems: z.number().int().positive().optional(),
|
|
194
|
-
maxChars: z.number().int().positive().optional()
|
|
195
|
-
}).strict().optional(),
|
|
196
|
-
privacy: z.object({
|
|
197
|
-
crossAgentSharing: z.enum([
|
|
198
|
-
"deny",
|
|
199
|
-
"readOnly",
|
|
200
|
-
"allow"
|
|
201
|
-
]).default("deny"),
|
|
202
|
-
sensitiveWritePolicy: z.enum([
|
|
203
|
-
"deny",
|
|
204
|
-
"confirm",
|
|
205
|
-
"allow"
|
|
206
|
-
]).default("confirm")
|
|
207
|
-
}).strict().optional(),
|
|
208
|
-
providerRouting: z.object({
|
|
209
|
-
searchStrategy: z.enum([
|
|
210
|
-
"local-first",
|
|
211
|
-
"external-first",
|
|
212
|
-
"fanout",
|
|
213
|
-
"local-only",
|
|
214
|
-
"external-only"
|
|
215
|
-
]).default("fanout"),
|
|
216
|
-
writeStrategy: z.enum([
|
|
217
|
-
"local-first",
|
|
218
|
-
"external-first",
|
|
219
|
-
"write-through",
|
|
220
|
-
"local-only",
|
|
221
|
-
"external-only"
|
|
222
|
-
]).default("local-first"),
|
|
223
|
-
allowExternalWrites: z.boolean().default(false),
|
|
224
|
-
allowedProviderIds: z.array(z.string().min(1)).optional(),
|
|
225
|
-
autoWriteKinds: z.array(z.enum([
|
|
226
|
-
"user_profile",
|
|
227
|
-
"preference",
|
|
228
|
-
"boundary",
|
|
229
|
-
"relationship",
|
|
230
|
-
"project_context",
|
|
231
|
-
"commitment",
|
|
232
|
-
"routine",
|
|
233
|
-
"personal_logistics",
|
|
234
|
-
"open_question",
|
|
235
|
-
"milestone",
|
|
236
|
-
"current_state",
|
|
237
|
-
"agent_note",
|
|
238
|
-
"workspace_fact",
|
|
239
|
-
"daily_note",
|
|
240
|
-
"session_summary",
|
|
241
|
-
"derived_insight",
|
|
242
|
-
"task_lesson",
|
|
243
|
-
"tool_preference",
|
|
244
|
-
"long_term_goal"
|
|
245
|
-
])).optional()
|
|
246
|
-
}).strict().optional(),
|
|
247
|
-
dreaming: DreamingPolicySchema,
|
|
248
|
-
understanding: UserUnderstandingPolicySchema.optional()
|
|
249
|
-
}).strict().default({
|
|
250
|
-
mode: "off",
|
|
251
|
-
sources: ["session"]
|
|
252
|
-
});
|
|
253
114
|
WorkflowPolicySchema = z.object({
|
|
254
115
|
default: z.string().min(1).optional(),
|
|
255
116
|
allowed: z.array(z.string().min(1)).optional(),
|
|
@@ -297,7 +158,6 @@ var init_schema = __esmMin((() => {
|
|
|
297
158
|
models: ModelPolicySchema,
|
|
298
159
|
tools: ToolPolicySetSchema,
|
|
299
160
|
skills: SkillPolicySchema,
|
|
300
|
-
memory: MemoryPolicySchema,
|
|
301
161
|
workflows: WorkflowPolicySchema,
|
|
302
162
|
boundaries: BoundaryPolicySchema,
|
|
303
163
|
runtime: RuntimePolicySchema,
|
|
@@ -313,7 +173,6 @@ var init_schema = __esmMin((() => {
|
|
|
313
173
|
models: ModelPolicyPatchSchema.optional(),
|
|
314
174
|
tools: ToolPolicySetSchema.optional(),
|
|
315
175
|
skills: SkillPolicySchema.optional(),
|
|
316
|
-
memory: MemoryPolicySchema.optional(),
|
|
317
176
|
workflows: WorkflowPolicySchema.optional(),
|
|
318
177
|
boundaries: BoundaryPolicySchema.optional(),
|
|
319
178
|
runtime: RuntimePolicySchema,
|
|
@@ -322,6 +181,6 @@ var init_schema = __esmMin((() => {
|
|
|
322
181
|
}));
|
|
323
182
|
//#endregion
|
|
324
183
|
init_schema();
|
|
325
|
-
export { AgentConfigEntrySchema, AgentIdentitySchema, AgentManifestSchema, AgentResponsibilitiesSchema, AgentToolModelSchema, BoundaryPolicySchema, CapabilityPresetSchema, DEFAULT_CAPABILITY_PRESET_ID,
|
|
184
|
+
export { AgentConfigEntrySchema, AgentIdentitySchema, AgentManifestSchema, AgentResponsibilitiesSchema, AgentToolModelSchema, BoundaryPolicySchema, CapabilityPresetSchema, DEFAULT_CAPABILITY_PRESET_ID, ManifestModelRoleSchema, ModelPolicyPatchSchema, ModelPolicySchema, PromptPolicySchema, RuntimePolicySchema, SkillPolicySchema, ToolModeSchema, ToolPolicySchema, ToolPolicySetSchema, ToolScopeSchema, WorkflowPolicySchema, WorkspacePolicySchema, init_schema };
|
|
326
185
|
|
|
327
186
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":[],"sources":["../../../src/agent-manifest/schema.ts"],"sourcesContent":["import { z } from 'zod';\n\nconst IdSchema = z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/);\n\nexport const DEFAULT_CAPABILITY_PRESET_ID = 'default';\n\nexport const ManifestModelRoleSchema = z\n .object({\n model: z.string().min(1),\n fallbacks: z.array(z.string().min(1)).optional(),\n description: z.string().max(500).optional(),\n })\n .strict()\n .superRefine((entry, ctx) => {\n const validateRef = (ref: string) => {\n const trimmed = ref.trim();\n const idx = trimmed.indexOf('/');\n return idx > 0 && idx < trimmed.length - 1;\n };\n if (!validateRef(entry.model)) {\n ctx.addIssue({\n code: 'custom',\n message: `model must be provider/model format (got '${entry.model}')`,\n path: ['model'],\n });\n }\n for (const [index, fallback] of (entry.fallbacks ?? []).entries()) {\n if (!validateRef(fallback)) {\n ctx.addIssue({\n code: 'custom',\n message: `fallback must be provider/model format (got '${fallback}')`,\n path: ['fallbacks', index],\n });\n }\n }\n });\n\nexport const AgentToolModelSchema = z\n .object({\n primary: z.string().min(1),\n fallbacks: z.array(z.string().min(1)).optional(),\n timeoutMs: z.number().int().positive().optional(),\n autoProviderFallback: z.boolean().optional(),\n })\n .strict()\n .superRefine((entry, ctx) => {\n const validateRef = (ref: string) => {\n const trimmed = ref.trim();\n const idx = trimmed.indexOf('/');\n return idx > 0 && idx < trimmed.length - 1;\n };\n if (!validateRef(entry.primary)) {\n ctx.addIssue({\n code: 'custom',\n message: `primary must be provider/model format (got '${entry.primary}')`,\n path: ['primary'],\n });\n }\n for (const [index, fallback] of (entry.fallbacks ?? []).entries()) {\n if (!validateRef(fallback)) {\n ctx.addIssue({\n code: 'custom',\n message: `fallback must be provider/model format (got '${fallback}')`,\n path: ['fallbacks', index],\n });\n }\n }\n });\n\nexport const ModelPolicySchema = z\n .object({\n defaultRole: IdSchema,\n roles: z.record(IdSchema, ManifestModelRoleSchema).default({}),\n imageModel: AgentToolModelSchema.optional(),\n imageGenerationModel: AgentToolModelSchema.optional(),\n policy: z\n .object({\n allowFallbacks: z.boolean().optional(),\n maxCostTier: z.enum(['low', 'medium', 'high']).optional(),\n })\n .strict()\n .optional(),\n })\n .strict();\n\nexport const ModelPolicyPatchSchema = z\n .object({\n defaultRole: IdSchema.optional(),\n roles: z.record(IdSchema, ManifestModelRoleSchema).optional(),\n imageModel: AgentToolModelSchema.optional(),\n imageGenerationModel: AgentToolModelSchema.optional(),\n policy: z\n .object({\n allowFallbacks: z.boolean().optional(),\n maxCostTier: z.enum(['low', 'medium', 'high']).optional(),\n })\n .strict()\n .optional(),\n })\n .strict();\n\nexport const ToolModeSchema = z.enum(['allow', 'confirm', 'deny']);\nexport const ToolScopeSchema = z.enum(['readonly', 'workspace', 'unrestricted']);\n\nexport const ToolPolicySchema = z\n .object({\n mode: ToolModeSchema,\n scope: ToolScopeSchema.optional(),\n limits: z\n .object({\n maxCallsPerTurn: z.number().int().positive().optional(),\n timeoutMs: z.number().int().positive().optional(),\n })\n .strict()\n .optional(),\n })\n .strict();\n\nexport const ToolPolicySetSchema = z\n .object({\n builtin: z.record(z.string().min(1), ToolPolicySchema).default({}),\n mcp: z\n .object({\n servers: z.record(z.string().min(1), ToolPolicySchema).optional(),\n tools: z.record(z.string().min(1), ToolPolicySchema).optional(),\n })\n .strict()\n .optional(),\n })\n .strict()\n .default({ builtin: {} });\n\nexport const SkillPolicySchema = z\n .object({\n mode: z.enum(['all', 'allowlist', 'denylist', 'off']).default('all'),\n allow: z.array(z.string().min(1)).optional(),\n deny: z.array(z.string().min(1)).optional(),\n })\n .strict()\n .default({ mode: 'all' });\n\nexport const DreamingPhasePolicySchema = z\n .object({\n enabled: z.boolean().optional(),\n cron: z.string().min(1).optional(),\n })\n .strict();\n\nexport const DreamingLightPolicySchema = DreamingPhasePolicySchema.extend({\n lookbackDays: z.number().int().positive().optional(),\n limit: z.number().int().nonnegative().optional(),\n dedupeSimilarity: z.number().min(0).max(1).optional(),\n}).strict();\n\nexport const DreamingDeepPolicySchema = DreamingPhasePolicySchema.extend({\n minScore: z.number().min(0).max(1).optional(),\n minRecallCount: z.number().int().positive().optional(),\n minUniqueQueries: z.number().int().positive().optional(),\n limit: z.number().int().nonnegative().optional(),\n recencyHalfLifeDays: z.number().positive().optional(),\n maxAgeDays: z.number().positive().optional(),\n}).strict();\n\nexport const DreamingRemPolicySchema = DreamingPhasePolicySchema.extend({\n lookbackDays: z.number().int().positive().optional(),\n limit: z.number().int().nonnegative().optional(),\n minPatternStrength: z.number().min(0).max(1).optional(),\n}).strict();\n\nexport const DreamingPolicySchema = z\n .object({\n enabled: z.boolean().default(false),\n frequency: z.string().min(1).optional(),\n timezone: z.string().optional(),\n phases: z\n .object({\n light: DreamingLightPolicySchema.optional(),\n deep: DreamingDeepPolicySchema.optional(),\n rem: DreamingRemPolicySchema.optional(),\n })\n .strict()\n .optional(),\n })\n .strict()\n .optional();\n\nexport const UserUnderstandingPolicySchema = z\n .object({\n enabled: z.boolean().optional(),\n adaptiveCadence: z.boolean().optional(),\n reviewIntervalTurns: z.number().int().min(1).max(1_000).optional(),\n maxHistoryMessages: z.number().int().min(1).max(200).optional(),\n maxDurationMs: z.number().int().min(1_000).max(600_000).optional(),\n })\n .strict();\n\nexport const MemoryPolicySchema = z\n .object({\n mode: z.enum(['off', 'readOnly', 'confirmWrite', 'auto']).default('off'),\n sources: z\n .array(z.enum(['session', 'userProfile', 'agentProfile', 'curated', 'workspace', 'connectedSources']))\n .default(['session']),\n writePolicy: z\n .object({\n userProfile: z.enum(['deny', 'confirm', 'allow']).optional(),\n agentProfile: z.enum(['deny', 'confirm', 'allow']).optional(),\n curated: z.enum(['deny', 'confirm', 'allow']).optional(),\n workspace: z.enum(['deny', 'confirm', 'allow']).optional(),\n })\n .strict()\n .optional(),\n retention: z\n .object({\n compaction: z.boolean().default(true),\n maxAgeDays: z.number().int().positive().optional(),\n maxItems: z.number().int().positive().optional(),\n maxChars: z.number().int().positive().optional(),\n })\n .strict()\n .optional(),\n privacy: z\n .object({\n crossAgentSharing: z.enum(['deny', 'readOnly', 'allow']).default('deny'),\n sensitiveWritePolicy: z.enum(['deny', 'confirm', 'allow']).default('confirm'),\n })\n .strict()\n .optional(),\n providerRouting: z\n .object({\n searchStrategy: z\n .enum(['local-first', 'external-first', 'fanout', 'local-only', 'external-only'])\n .default('fanout'),\n writeStrategy: z\n .enum(['local-first', 'external-first', 'write-through', 'local-only', 'external-only'])\n .default('local-first'),\n allowExternalWrites: z.boolean().default(false),\n allowedProviderIds: z.array(z.string().min(1)).optional(),\n autoWriteKinds: z\n .array(\n z.enum([\n 'user_profile',\n 'preference',\n 'boundary',\n 'relationship',\n 'project_context',\n 'commitment',\n 'routine',\n 'personal_logistics',\n 'open_question',\n 'milestone',\n 'current_state',\n 'agent_note',\n 'workspace_fact',\n 'daily_note',\n 'session_summary',\n 'derived_insight',\n 'task_lesson',\n 'tool_preference',\n 'long_term_goal',\n ]),\n )\n .optional(),\n })\n .strict()\n .optional(),\n dreaming: DreamingPolicySchema,\n understanding: UserUnderstandingPolicySchema.optional(),\n })\n .strict()\n .default({ mode: 'off', sources: ['session'] });\n\nexport const WorkflowPolicySchema = z\n .object({\n default: z.string().min(1).optional(),\n allowed: z.array(z.string().min(1)).optional(),\n suggested: z\n .array(\n z\n .object({\n intent: z.string().min(1),\n workflow: z.string().min(1),\n })\n .strict(),\n )\n .optional(),\n })\n .strict()\n .default({});\n\nexport const BoundaryPolicySchema = z\n .object({\n requiresConfirmation: z.array(z.string().min(1)).default([]),\n forbidden: z.array(z.string().min(1)).default([]),\n escalation: z.array(z.string().min(1)).default([]),\n })\n .strict()\n .default({ requiresConfirmation: [], forbidden: [], escalation: [] });\n\nexport const WorkspacePolicySchema = z\n .object({\n root: z.string().min(1),\n })\n .strict();\n\nexport const RuntimePolicySchema = z\n .object({\n maxTurns: z.number().int().positive().optional(),\n timeoutMs: z.number().int().positive().optional(),\n maxToolFailuresPerTurn: z.number().int().positive().optional(),\n })\n .strict()\n .optional();\n\nexport const PromptPolicySchema = z\n .object({\n customInstructions: z.string().optional(),\n })\n .strict()\n .optional();\n\nexport const AgentIdentitySchema = z\n .object({\n name: z.string().min(1),\n description: z.string().optional(),\n role: z.string().min(1),\n language: z.string().min(1).default('en'),\n tone: z.string().min(1).default('direct'),\n avatar: z.string().optional(),\n })\n .strict();\n\nexport const AgentResponsibilitiesSchema = z\n .object({\n primary: z.array(z.string().min(1)).min(1),\n secondary: z.array(z.string().min(1)).optional(),\n outOfScope: z.array(z.string().min(1)).optional(),\n })\n .strict();\n\nexport const AgentManifestSchema = z\n .object({\n id: IdSchema,\n enabled: z.boolean().default(true),\n extends: z.array(IdSchema).optional(),\n identity: AgentIdentitySchema,\n responsibilities: AgentResponsibilitiesSchema,\n workspace: WorkspacePolicySchema,\n models: ModelPolicySchema,\n tools: ToolPolicySetSchema,\n skills: SkillPolicySchema,\n memory: MemoryPolicySchema,\n workflows: WorkflowPolicySchema,\n boundaries: BoundaryPolicySchema,\n runtime: RuntimePolicySchema,\n prompt: PromptPolicySchema,\n })\n .strict();\n\nexport const AgentConfigEntrySchema = AgentManifestSchema.extend({\n models: ModelPolicySchema.optional(),\n}).strict();\n\nexport const CapabilityPresetSchema = z\n .object({\n id: IdSchema,\n name: z.string().min(1),\n description: z.string().optional(),\n version: z.number().int().positive().default(1),\n extends: z.array(IdSchema).optional(),\n models: ModelPolicyPatchSchema.optional(),\n tools: ToolPolicySetSchema.optional(),\n skills: SkillPolicySchema.optional(),\n memory: MemoryPolicySchema.optional(),\n workflows: WorkflowPolicySchema.optional(),\n boundaries: BoundaryPolicySchema.optional(),\n runtime: RuntimePolicySchema,\n locks: z.array(z.string().min(1)).optional(),\n })\n .strict();\n\nexport type AgentManifest = z.infer<typeof AgentManifestSchema>;\nexport type AgentConfigEntry = z.infer<typeof AgentConfigEntrySchema>;\nexport type CapabilityPreset = z.infer<typeof CapabilityPresetSchema>;\nexport type EffectiveAgentManifest = AgentManifest;\nexport type ToolPolicy = z.infer<typeof ToolPolicySchema>;\n"],"mappings":";;;;;AAEM,YAAW,EAAE,QAAQ,CAAC,MAAM,0BAA0B;AAE/C,gCAA+B;AAE/B,2BAA0B,EACpC,OAAO;EACN,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE;EACxB,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,UAAU;EAChD,aAAa,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,UAAU;EAC5C,CAAC,CACD,QAAQ,CACR,aAAa,OAAO,QAAQ;EAC3B,MAAM,eAAe,QAAgB;GACnC,MAAM,UAAU,IAAI,MAAM;GAC1B,MAAM,MAAM,QAAQ,QAAQ,IAAI;AAChC,UAAO,MAAM,KAAK,MAAM,QAAQ,SAAS;;AAE3C,MAAI,CAAC,YAAY,MAAM,MAAM,CAC3B,KAAI,SAAS;GACX,MAAM;GACN,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AAQ,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE;EAC/C,SAAS,EAAE,MAAM,SAAS,CAAC,UAAU;EACrC,QAAQ,uBAAuB,UAAU;EACzC,OAAO,oBAAoB,UAAU;EACrC,QAAQ,kBAAkB,UAAU;EACpC,QAAQ,mBAAmB,UAAU;EACrC,WAAW,qBAAqB,UAAU;EAC1C,YAAY,qBAAqB,UAAU;EAC3C,SAAS;EACT,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,UAAU;EAC7C,CAAC,CACD,QAAQ"}
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../../../src/agent-manifest/schema.ts"],"sourcesContent":["import { z } from 'zod';\n\nconst IdSchema = z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/);\n\nexport const DEFAULT_CAPABILITY_PRESET_ID = 'default';\n\nexport const ManifestModelRoleSchema = z\n .object({\n model: z.string().min(1),\n fallbacks: z.array(z.string().min(1)).optional(),\n description: z.string().max(500).optional(),\n })\n .strict()\n .superRefine((entry, ctx) => {\n const validateRef = (ref: string) => {\n const trimmed = ref.trim();\n const idx = trimmed.indexOf('/');\n return idx > 0 && idx < trimmed.length - 1;\n };\n if (!validateRef(entry.model)) {\n ctx.addIssue({\n code: 'custom',\n message: `model must be provider/model format (got '${entry.model}')`,\n path: ['model'],\n });\n }\n for (const [index, fallback] of (entry.fallbacks ?? []).entries()) {\n if (!validateRef(fallback)) {\n ctx.addIssue({\n code: 'custom',\n message: `fallback must be provider/model format (got '${fallback}')`,\n path: ['fallbacks', index],\n });\n }\n }\n });\n\nexport const AgentToolModelSchema = z\n .object({\n primary: z.string().min(1),\n fallbacks: z.array(z.string().min(1)).optional(),\n timeoutMs: z.number().int().positive().optional(),\n autoProviderFallback: z.boolean().optional(),\n })\n .strict()\n .superRefine((entry, ctx) => {\n const validateRef = (ref: string) => {\n const trimmed = ref.trim();\n const idx = trimmed.indexOf('/');\n return idx > 0 && idx < trimmed.length - 1;\n };\n if (!validateRef(entry.primary)) {\n ctx.addIssue({\n code: 'custom',\n message: `primary must be provider/model format (got '${entry.primary}')`,\n path: ['primary'],\n });\n }\n for (const [index, fallback] of (entry.fallbacks ?? []).entries()) {\n if (!validateRef(fallback)) {\n ctx.addIssue({\n code: 'custom',\n message: `fallback must be provider/model format (got '${fallback}')`,\n path: ['fallbacks', index],\n });\n }\n }\n });\n\nexport const ModelPolicySchema = z\n .object({\n defaultRole: IdSchema,\n roles: z.record(IdSchema, ManifestModelRoleSchema).default({}),\n imageModel: AgentToolModelSchema.optional(),\n imageGenerationModel: AgentToolModelSchema.optional(),\n policy: z\n .object({\n allowFallbacks: z.boolean().optional(),\n maxCostTier: z.enum(['low', 'medium', 'high']).optional(),\n })\n .strict()\n .optional(),\n })\n .strict();\n\nexport const ModelPolicyPatchSchema = z\n .object({\n defaultRole: IdSchema.optional(),\n roles: z.record(IdSchema, ManifestModelRoleSchema).optional(),\n imageModel: AgentToolModelSchema.optional(),\n imageGenerationModel: AgentToolModelSchema.optional(),\n policy: z\n .object({\n allowFallbacks: z.boolean().optional(),\n maxCostTier: z.enum(['low', 'medium', 'high']).optional(),\n })\n .strict()\n .optional(),\n })\n .strict();\n\nexport const ToolModeSchema = z.enum(['allow', 'confirm', 'deny']);\nexport const ToolScopeSchema = z.enum(['readonly', 'workspace', 'unrestricted']);\n\nexport const ToolPolicySchema = z\n .object({\n mode: ToolModeSchema,\n scope: ToolScopeSchema.optional(),\n limits: z\n .object({\n maxCallsPerTurn: z.number().int().positive().optional(),\n timeoutMs: z.number().int().positive().optional(),\n })\n .strict()\n .optional(),\n })\n .strict();\n\nexport const ToolPolicySetSchema = z\n .object({\n builtin: z.record(z.string().min(1), ToolPolicySchema).default({}),\n mcp: z\n .object({\n servers: z.record(z.string().min(1), ToolPolicySchema).optional(),\n tools: z.record(z.string().min(1), ToolPolicySchema).optional(),\n })\n .strict()\n .optional(),\n })\n .strict()\n .default({ builtin: {} });\n\nexport const SkillPolicySchema = z\n .object({\n mode: z.enum(['all', 'allowlist', 'denylist', 'off']).default('all'),\n allow: z.array(z.string().min(1)).optional(),\n deny: z.array(z.string().min(1)).optional(),\n })\n .strict()\n .default({ mode: 'all' });\n\nexport const WorkflowPolicySchema = z\n .object({\n default: z.string().min(1).optional(),\n allowed: z.array(z.string().min(1)).optional(),\n suggested: z\n .array(\n z\n .object({\n intent: z.string().min(1),\n workflow: z.string().min(1),\n })\n .strict(),\n )\n .optional(),\n })\n .strict()\n .default({});\n\nexport const BoundaryPolicySchema = z\n .object({\n requiresConfirmation: z.array(z.string().min(1)).default([]),\n forbidden: z.array(z.string().min(1)).default([]),\n escalation: z.array(z.string().min(1)).default([]),\n })\n .strict()\n .default({ requiresConfirmation: [], forbidden: [], escalation: [] });\n\nexport const WorkspacePolicySchema = z\n .object({\n root: z.string().min(1),\n })\n .strict();\n\nexport const RuntimePolicySchema = z\n .object({\n maxTurns: z.number().int().positive().optional(),\n timeoutMs: z.number().int().positive().optional(),\n maxToolFailuresPerTurn: z.number().int().positive().optional(),\n })\n .strict()\n .optional();\n\nexport const PromptPolicySchema = z\n .object({\n customInstructions: z.string().optional(),\n })\n .strict()\n .optional();\n\nexport const AgentIdentitySchema = z\n .object({\n name: z.string().min(1),\n description: z.string().optional(),\n role: z.string().min(1),\n language: z.string().min(1).default('en'),\n tone: z.string().min(1).default('direct'),\n avatar: z.string().optional(),\n })\n .strict();\n\nexport const AgentResponsibilitiesSchema = z\n .object({\n primary: z.array(z.string().min(1)).min(1),\n secondary: z.array(z.string().min(1)).optional(),\n outOfScope: z.array(z.string().min(1)).optional(),\n })\n .strict();\n\nexport const AgentManifestSchema = z\n .object({\n id: IdSchema,\n enabled: z.boolean().default(true),\n extends: z.array(IdSchema).optional(),\n identity: AgentIdentitySchema,\n responsibilities: AgentResponsibilitiesSchema,\n workspace: WorkspacePolicySchema,\n models: ModelPolicySchema,\n tools: ToolPolicySetSchema,\n skills: SkillPolicySchema,\n workflows: WorkflowPolicySchema,\n boundaries: BoundaryPolicySchema,\n runtime: RuntimePolicySchema,\n prompt: PromptPolicySchema,\n })\n .strict();\n\nexport const AgentConfigEntrySchema = AgentManifestSchema.extend({\n models: ModelPolicySchema.optional(),\n}).strict();\n\nexport const CapabilityPresetSchema = z\n .object({\n id: IdSchema,\n name: z.string().min(1),\n description: z.string().optional(),\n version: z.number().int().positive().default(1),\n extends: z.array(IdSchema).optional(),\n models: ModelPolicyPatchSchema.optional(),\n tools: ToolPolicySetSchema.optional(),\n skills: SkillPolicySchema.optional(),\n workflows: WorkflowPolicySchema.optional(),\n boundaries: BoundaryPolicySchema.optional(),\n runtime: RuntimePolicySchema,\n locks: z.array(z.string().min(1)).optional(),\n })\n .strict();\n\nexport type AgentManifest = z.infer<typeof AgentManifestSchema>;\nexport type AgentConfigEntry = z.infer<typeof AgentConfigEntrySchema>;\nexport type CapabilityPreset = z.infer<typeof CapabilityPresetSchema>;\nexport type EffectiveAgentManifest = AgentManifest;\nexport type ToolPolicy = z.infer<typeof ToolPolicySchema>;\n"],"mappings":";;;;;AAEM,YAAW,EAAE,QAAQ,CAAC,MAAM,0BAA0B;AAE/C,gCAA+B;AAE/B,2BAA0B,EACpC,OAAO;EACN,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE;EACxB,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,UAAU;EAChD,aAAa,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,UAAU;EAC5C,CAAC,CACD,QAAQ,CACR,aAAa,OAAO,QAAQ;EAC3B,MAAM,eAAe,QAAgB;GACnC,MAAM,UAAU,IAAI,MAAM;GAC1B,MAAM,MAAM,QAAQ,QAAQ,IAAI;AAChC,UAAO,MAAM,KAAK,MAAM,QAAQ,SAAS;;AAE3C,MAAI,CAAC,YAAY,MAAM,MAAM,CAC3B,KAAI,SAAS;GACX,MAAM;GACN,SAAS,6CAA6C,MAAM,MAAM;GAClE,MAAM,CAAC,QAA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,CAAC,QAAQ;AAEE,0BAAyB,EACnC,OAAO;EACN,IAAI;EACJ,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE;EACvB,aAAa,EAAE,QAAQ,CAAC,UAAU;EAClC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE;EAC/C,SAAS,EAAE,MAAM,SAAS,CAAC,UAAU;EACrC,QAAQ,uBAAuB,UAAU;EACzC,OAAO,oBAAoB,UAAU;EACrC,QAAQ,kBAAkB,UAAU;EACpC,WAAW,qBAAqB,UAAU;EAC1C,YAAY,qBAAqB,UAAU;EAC3C,SAAS;EACT,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,UAAU;EAC7C,CAAC,CACD,QAAQ"}
|
|
@@ -32,17 +32,6 @@ function validateSkills(manifest, issues, catalogs) {
|
|
|
32
32
|
for (const name of manifest.skills.deny ?? []) if (!hasValue(skills, name)) addIssue(issues, "warning", `skills.deny`, `skill "${name}" is not installed`);
|
|
33
33
|
if (manifest.skills.mode === "allowlist" && (manifest.skills.allow?.length ?? 0) === 0) addIssue(issues, "warning", "skills.allow", "allowlist mode has no allowed skills");
|
|
34
34
|
}
|
|
35
|
-
function validateMemory(manifest, issues) {
|
|
36
|
-
if (manifest.memory.mode === "off" && manifest.memory.sources.some((source) => source !== "session")) addIssue(issues, "warning", "memory.sources", "memory sources are configured while memory mode is off");
|
|
37
|
-
if (manifest.memory.mode === "auto") {
|
|
38
|
-
const privacy = manifest.memory.privacy;
|
|
39
|
-
if (!privacy || privacy.sensitiveWritePolicy === "allow") addIssue(issues, "warning", "memory.privacy", "auto memory writes should configure sensitiveWritePolicy");
|
|
40
|
-
}
|
|
41
|
-
if (manifest.memory.mode !== "off") {
|
|
42
|
-
const policy = manifest.memory.writePolicy ?? {};
|
|
43
|
-
if (!Object.values(policy).some(Boolean) && manifest.memory.mode !== "readOnly") addIssue(issues, "warning", "memory.writePolicy", "write-capable memory mode has no write policy");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
35
|
function validateWorkflows(manifest, issues, catalogs) {
|
|
47
36
|
const workflows = toSet(catalogs.workflows);
|
|
48
37
|
const check = (path, value) => {
|
|
@@ -74,7 +63,6 @@ function validateAgentManifest(params) {
|
|
|
74
63
|
validateModels(manifest, issues);
|
|
75
64
|
validateTools(manifest, issues, params.catalogs ?? {});
|
|
76
65
|
validateSkills(manifest, issues, params.catalogs ?? {});
|
|
77
|
-
validateMemory(manifest, issues);
|
|
78
66
|
validateWorkflows(manifest, issues, params.catalogs ?? {});
|
|
79
67
|
return {
|
|
80
68
|
ok: issues.every((issue) => issue.severity !== "error"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","names":[],"sources":["../../../src/agent-manifest/validator.ts"],"sourcesContent":["import type { AgentConfigEntry, CapabilityPreset, EffectiveAgentManifest } from './schema.js';\nimport { resolveEffectiveAgentManifest } from './resolver.js';\n\nexport type ManifestIssueSeverity = 'error' | 'warning';\n\nexport interface ManifestIssue {\n severity: ManifestIssueSeverity;\n path: string;\n message: string;\n}\n\nexport interface ManifestCatalogs {\n tools?: Iterable<string>;\n skills?: Iterable<string>;\n workflows?: Iterable<string>;\n mcpServers?: Iterable<string>;\n}\n\nexport interface ValidateManifestParams {\n agent: AgentConfigEntry;\n presets?: Record<string, CapabilityPreset>;\n defaultPresetId?: string;\n catalogs?: ManifestCatalogs;\n}\n\nexport interface ValidateManifestResult {\n ok: boolean;\n manifest?: EffectiveAgentManifest;\n issues: ManifestIssue[];\n}\n\nfunction toSet(values: Iterable<string> | undefined): Set<string> | undefined {\n if (!values) return undefined;\n return new Set([...values].map((value) => value.toLowerCase()));\n}\n\nfunction hasValue(set: Set<string> | undefined, value: string): boolean {\n return set === undefined || set.has(value.toLowerCase());\n}\n\nfunction addIssue(issues: ManifestIssue[], severity: ManifestIssueSeverity, path: string, message: string): void {\n issues.push({ severity, path, message });\n}\n\nfunction validateModels(manifest: EffectiveAgentManifest, issues: ManifestIssue[]): void {\n if (!manifest.models.roles[manifest.models.defaultRole]) {\n addIssue(\n issues,\n 'error',\n 'models.defaultRole',\n `defaultRole \"${manifest.models.defaultRole}\" does not exist in models.roles`,\n );\n }\n}\n\nfunction validateTools(manifest: EffectiveAgentManifest, issues: ManifestIssue[], catalogs: ManifestCatalogs): void {\n const tools = toSet(catalogs.tools);\n for (const [name, policy] of Object.entries(manifest.tools.builtin)) {\n if (!hasValue(tools, name)) {\n addIssue(issues, 'error', `tools.builtin.${name}`, `tool \"${name}\" is not in the tool catalog`);\n }\n if (policy.mode === 'allow' && policy.scope === 'unrestricted') {\n addIssue(\n issues,\n 'warning',\n `tools.builtin.${name}.scope`,\n `tool \"${name}\" is unrestricted; consider using confirm or a narrower scope`,\n );\n }\n }\n\n const mcpServers = toSet(catalogs.mcpServers);\n for (const serverName of Object.keys(manifest.tools.mcp?.servers ?? {})) {\n if (!hasValue(mcpServers, serverName)) {\n addIssue(issues, 'error', `tools.mcp.servers.${serverName}`, `MCP server \"${serverName}\" is not configured`);\n }\n }\n}\n\nfunction validateSkills(manifest: EffectiveAgentManifest, issues: ManifestIssue[], catalogs: ManifestCatalogs): void {\n const skills = toSet(catalogs.skills);\n for (const name of manifest.skills.allow ?? []) {\n if (!hasValue(skills, name)) {\n addIssue(issues, 'error', `skills.allow`, `skill \"${name}\" is not installed`);\n }\n }\n for (const name of manifest.skills.deny ?? []) {\n if (!hasValue(skills, name)) {\n addIssue(issues, 'warning', `skills.deny`, `skill \"${name}\" is not installed`);\n }\n }\n if (manifest.skills.mode === 'allowlist' && (manifest.skills.allow?.length ?? 0) === 0) {\n addIssue(issues, 'warning', 'skills.allow', 'allowlist mode has no allowed skills');\n }\n}\n\nfunction
|
|
1
|
+
{"version":3,"file":"validator.js","names":[],"sources":["../../../src/agent-manifest/validator.ts"],"sourcesContent":["import type { AgentConfigEntry, CapabilityPreset, EffectiveAgentManifest } from './schema.js';\nimport { resolveEffectiveAgentManifest } from './resolver.js';\n\nexport type ManifestIssueSeverity = 'error' | 'warning';\n\nexport interface ManifestIssue {\n severity: ManifestIssueSeverity;\n path: string;\n message: string;\n}\n\nexport interface ManifestCatalogs {\n tools?: Iterable<string>;\n skills?: Iterable<string>;\n workflows?: Iterable<string>;\n mcpServers?: Iterable<string>;\n}\n\nexport interface ValidateManifestParams {\n agent: AgentConfigEntry;\n presets?: Record<string, CapabilityPreset>;\n defaultPresetId?: string;\n catalogs?: ManifestCatalogs;\n}\n\nexport interface ValidateManifestResult {\n ok: boolean;\n manifest?: EffectiveAgentManifest;\n issues: ManifestIssue[];\n}\n\nfunction toSet(values: Iterable<string> | undefined): Set<string> | undefined {\n if (!values) return undefined;\n return new Set([...values].map((value) => value.toLowerCase()));\n}\n\nfunction hasValue(set: Set<string> | undefined, value: string): boolean {\n return set === undefined || set.has(value.toLowerCase());\n}\n\nfunction addIssue(issues: ManifestIssue[], severity: ManifestIssueSeverity, path: string, message: string): void {\n issues.push({ severity, path, message });\n}\n\nfunction validateModels(manifest: EffectiveAgentManifest, issues: ManifestIssue[]): void {\n if (!manifest.models.roles[manifest.models.defaultRole]) {\n addIssue(\n issues,\n 'error',\n 'models.defaultRole',\n `defaultRole \"${manifest.models.defaultRole}\" does not exist in models.roles`,\n );\n }\n}\n\nfunction validateTools(manifest: EffectiveAgentManifest, issues: ManifestIssue[], catalogs: ManifestCatalogs): void {\n const tools = toSet(catalogs.tools);\n for (const [name, policy] of Object.entries(manifest.tools.builtin)) {\n if (!hasValue(tools, name)) {\n addIssue(issues, 'error', `tools.builtin.${name}`, `tool \"${name}\" is not in the tool catalog`);\n }\n if (policy.mode === 'allow' && policy.scope === 'unrestricted') {\n addIssue(\n issues,\n 'warning',\n `tools.builtin.${name}.scope`,\n `tool \"${name}\" is unrestricted; consider using confirm or a narrower scope`,\n );\n }\n }\n\n const mcpServers = toSet(catalogs.mcpServers);\n for (const serverName of Object.keys(manifest.tools.mcp?.servers ?? {})) {\n if (!hasValue(mcpServers, serverName)) {\n addIssue(issues, 'error', `tools.mcp.servers.${serverName}`, `MCP server \"${serverName}\" is not configured`);\n }\n }\n}\n\nfunction validateSkills(manifest: EffectiveAgentManifest, issues: ManifestIssue[], catalogs: ManifestCatalogs): void {\n const skills = toSet(catalogs.skills);\n for (const name of manifest.skills.allow ?? []) {\n if (!hasValue(skills, name)) {\n addIssue(issues, 'error', `skills.allow`, `skill \"${name}\" is not installed`);\n }\n }\n for (const name of manifest.skills.deny ?? []) {\n if (!hasValue(skills, name)) {\n addIssue(issues, 'warning', `skills.deny`, `skill \"${name}\" is not installed`);\n }\n }\n if (manifest.skills.mode === 'allowlist' && (manifest.skills.allow?.length ?? 0) === 0) {\n addIssue(issues, 'warning', 'skills.allow', 'allowlist mode has no allowed skills');\n }\n}\n\nfunction validateWorkflows(manifest: EffectiveAgentManifest, issues: ManifestIssue[], catalogs: ManifestCatalogs): void {\n const workflows = toSet(catalogs.workflows);\n const check = (path: string, value: string | undefined) => {\n if (value && !hasValue(workflows, value)) {\n addIssue(issues, 'error', path, `workflow \"${value}\" is not in the workflow catalog`);\n }\n };\n check('workflows.default', manifest.workflows.default);\n for (const [index, value] of (manifest.workflows.allowed ?? []).entries()) {\n check(`workflows.allowed.${index}`, value);\n }\n for (const [index, entry] of (manifest.workflows.suggested ?? []).entries()) {\n check(`workflows.suggested.${index}.workflow`, entry.workflow);\n }\n}\n\nexport function validateAgentManifest(params: ValidateManifestParams): ValidateManifestResult {\n const issues: ManifestIssue[] = [];\n let manifest: EffectiveAgentManifest;\n try {\n manifest = resolveEffectiveAgentManifest({\n agent: params.agent,\n presets: params.presets,\n defaultPresetId: params.defaultPresetId,\n }).manifest;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return {\n ok: false,\n issues: [{ severity: 'error', path: 'manifest', message }],\n };\n }\n\n validateModels(manifest, issues);\n validateTools(manifest, issues, params.catalogs ?? {});\n validateSkills(manifest, issues, params.catalogs ?? {});\n validateWorkflows(manifest, issues, params.catalogs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,CAAC;AACtD,gBAAe,UAAU,QAAQ,OAAO,YAAY,EAAE,CAAC;AACvD,mBAAkB,UAAU,QAAQ,OAAO,YAAY,EAAE,CAAC;AAE1D,QAAO;EACL,IAAI,OAAO,OAAO,UAAU,MAAM,aAAa,QAAQ;EACvD;EACA;EACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
1
2
|
import { checkBoundary } from "./boundary-guard.js";
|
|
2
3
|
import { resolveModelRole } from "./model-router.js";
|
|
3
4
|
import { buildRuntimeToolRegistry } from "./tool-registry.js";
|
|
4
|
-
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
5
5
|
import { resolveWorkflow, validateWorkflowForRuntime } from "./workflow-runtime.js";
|
|
6
6
|
import { buildAgentRuntimeProfile } from "./runtime-profile.js";
|
|
7
7
|
import { appendAgentRunEvent, createAgentRunTrace, finishAgentRunTrace, hashEffectiveManifest } from "./run-trace.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UserContextConfig } from '../user-context/config.js';
|
|
2
2
|
export type MemorySource = 'session' | 'userProfile' | 'agentProfile' | 'curated' | 'workspace' | 'connectedSources';
|
|
3
3
|
export type MemoryWriteTarget = 'userProfile' | 'agentProfile' | 'curated' | 'workspace';
|
|
4
4
|
export type MemoryWriteDecision = 'allow' | 'confirm' | 'deny';
|
|
@@ -18,4 +18,4 @@ export interface MemoryRuntime {
|
|
|
18
18
|
canRead: (source: MemorySource) => boolean;
|
|
19
19
|
checkWrite: (candidate: MemoryCandidate) => MemoryWriteCheckResult;
|
|
20
20
|
}
|
|
21
|
-
export declare function buildMemoryRuntime(
|
|
21
|
+
export declare function buildMemoryRuntime(userContext: UserContextConfig): MemoryRuntime;
|
|
@@ -4,18 +4,19 @@ function normalizeConfidence(value) {
|
|
|
4
4
|
if (typeof value !== "number" || !Number.isFinite(value)) return .5;
|
|
5
5
|
return Math.max(0, Math.min(1, value));
|
|
6
6
|
}
|
|
7
|
-
function buildMemoryRuntime(
|
|
8
|
-
const
|
|
7
|
+
function buildMemoryRuntime(userContext) {
|
|
8
|
+
const memory = userContext.memory;
|
|
9
|
+
const readableSources = !userContext.enabled || memory.mode === "off" ? [] : [...memory.sources];
|
|
9
10
|
const sourceSet = new Set(readableSources);
|
|
10
11
|
return {
|
|
11
12
|
readableSources,
|
|
12
13
|
canRead: (source) => sourceSet.has(source),
|
|
13
14
|
checkWrite: (candidate) => {
|
|
14
|
-
if (
|
|
15
|
+
if (!userContext.enabled || memory.mode === "off") return {
|
|
15
16
|
decision: "deny",
|
|
16
17
|
reason: "memory is disabled"
|
|
17
18
|
};
|
|
18
|
-
if (READ_ONLY_MODES.has(
|
|
19
|
+
if (READ_ONLY_MODES.has(memory.mode)) return {
|
|
19
20
|
decision: "deny",
|
|
20
21
|
reason: "memory is read-only"
|
|
21
22
|
};
|
|
@@ -27,13 +28,13 @@ function buildMemoryRuntime(manifest) {
|
|
|
27
28
|
decision: "deny",
|
|
28
29
|
reason: "memory confidence is too low"
|
|
29
30
|
};
|
|
30
|
-
const sensitivePolicy =
|
|
31
|
+
const sensitivePolicy = userContext.privacy.sensitiveWritePolicy;
|
|
31
32
|
if (candidate.sensitive && sensitivePolicy !== "allow") return {
|
|
32
33
|
decision: sensitivePolicy,
|
|
33
34
|
reason: "memory candidate is sensitive"
|
|
34
35
|
};
|
|
35
|
-
const targetPolicy =
|
|
36
|
-
if (
|
|
36
|
+
const targetPolicy = memory.writePolicy?.[candidate.target] ?? "deny";
|
|
37
|
+
if (memory.mode === "confirmWrite" && targetPolicy === "allow") return {
|
|
37
38
|
decision: "confirm",
|
|
38
39
|
reason: "agent memory mode requires confirmation"
|
|
39
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-runtime.js","names":[],"sources":["../../../src/agent-runtime/memory-runtime.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"memory-runtime.js","names":[],"sources":["../../../src/agent-runtime/memory-runtime.ts"],"sourcesContent":["import type { UserContextConfig } from '../user-context/config.js';\n\nexport type MemorySource =\n | 'session'\n | 'userProfile'\n | 'agentProfile'\n | 'curated'\n | 'workspace'\n | 'connectedSources';\nexport type MemoryWriteTarget = 'userProfile' | 'agentProfile' | 'curated' | 'workspace';\nexport type MemoryWriteDecision = 'allow' | 'confirm' | 'deny';\n\nexport interface MemoryCandidate {\n target: MemoryWriteTarget;\n content: string;\n source: string;\n confidence?: number;\n sensitive?: boolean;\n}\n\nexport interface MemoryWriteCheckResult {\n decision: MemoryWriteDecision;\n reason: string;\n}\n\nexport interface MemoryRuntime {\n readableSources: MemorySource[];\n canRead: (source: MemorySource) => boolean;\n checkWrite: (candidate: MemoryCandidate) => MemoryWriteCheckResult;\n}\n\nconst READ_ONLY_MODES = new Set(['readOnly']);\n\nfunction normalizeConfidence(value: number | undefined): number {\n if (typeof value !== 'number' || !Number.isFinite(value)) return 0.5;\n return Math.max(0, Math.min(1, value));\n}\n\nexport function buildMemoryRuntime(userContext: UserContextConfig): MemoryRuntime {\n const memory = userContext.memory;\n const readableSources = !userContext.enabled || memory.mode === 'off' ? [] : [...memory.sources];\n const sourceSet = new Set<MemorySource>(readableSources);\n\n return {\n readableSources,\n canRead: (source) => sourceSet.has(source),\n checkWrite: (candidate) => {\n if (!userContext.enabled || memory.mode === 'off') {\n return { decision: 'deny', reason: 'memory is disabled' };\n }\n if (READ_ONLY_MODES.has(memory.mode)) {\n return { decision: 'deny', reason: 'memory is read-only' };\n }\n if (!candidate.content.trim()) {\n return { decision: 'deny', reason: 'memory content is empty' };\n }\n const confidence = normalizeConfidence(candidate.confidence);\n if (confidence < 0.3) {\n return { decision: 'deny', reason: 'memory confidence is too low' };\n }\n const sensitivePolicy = userContext.privacy.sensitiveWritePolicy;\n if (candidate.sensitive && sensitivePolicy !== 'allow') {\n return {\n decision: sensitivePolicy,\n reason: 'memory candidate is sensitive',\n };\n }\n const targetPolicy = memory.writePolicy?.[candidate.target] ?? 'deny';\n if (memory.mode === 'confirmWrite' && targetPolicy === 'allow') {\n return { decision: 'confirm', reason: 'agent memory mode requires confirmation' };\n }\n return {\n decision: targetPolicy,\n reason: `target policy is ${targetPolicy}`,\n };\n },\n };\n}\n"],"mappings":";AA+BA,MAAM,kBAAkB,IAAI,IAAI,CAAC,WAAW,CAAC;AAE7C,SAAS,oBAAoB,OAAmC;AAC9D,KAAI,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,MAAM,CAAE,QAAO;AACjE,QAAO,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,MAAM,CAAC;;AAGxC,SAAgB,mBAAmB,aAA+C;CAChF,MAAM,SAAS,YAAY;CAC3B,MAAM,kBAAkB,CAAC,YAAY,WAAW,OAAO,SAAS,QAAQ,EAAE,GAAG,CAAC,GAAG,OAAO,QAAQ;CAChG,MAAM,YAAY,IAAI,IAAkB,gBAAgB;AAExD,QAAO;EACL;EACA,UAAU,WAAW,UAAU,IAAI,OAAO;EAC1C,aAAa,cAAc;AACzB,OAAI,CAAC,YAAY,WAAW,OAAO,SAAS,MAC1C,QAAO;IAAE,UAAU;IAAQ,QAAQ;IAAsB;AAE3D,OAAI,gBAAgB,IAAI,OAAO,KAAK,CAClC,QAAO;IAAE,UAAU;IAAQ,QAAQ;IAAuB;AAE5D,OAAI,CAAC,UAAU,QAAQ,MAAM,CAC3B,QAAO;IAAE,UAAU;IAAQ,QAAQ;IAA2B;AAGhE,OADmB,oBAAoB,UAAU,WACnC,GAAG,GACf,QAAO;IAAE,UAAU;IAAQ,QAAQ;IAAgC;GAErE,MAAM,kBAAkB,YAAY,QAAQ;AAC5C,OAAI,UAAU,aAAa,oBAAoB,QAC7C,QAAO;IACL,UAAU;IACV,QAAQ;IACT;GAEH,MAAM,eAAe,OAAO,cAAc,UAAU,WAAW;AAC/D,OAAI,OAAO,SAAS,kBAAkB,iBAAiB,QACrD,QAAO;IAAE,UAAU;IAAW,QAAQ;IAA2C;AAEnF,UAAO;IACL,UAAU;IACV,QAAQ,oBAAoB;IAC7B;;EAEJ"}
|
|
@@ -4,6 +4,7 @@ import { type MemoryRuntime } from './memory-runtime.js';
|
|
|
4
4
|
import { resolveModelRole } from './model-router.js';
|
|
5
5
|
import { type RuntimeToolRegistry, type ToolCatalogEntry } from './tool-registry.js';
|
|
6
6
|
import { type WorkflowCatalogEntry, type WorkflowResolution, type WorkflowValidationIssue } from './workflow-runtime.js';
|
|
7
|
+
import type { UserContextConfig } from '../user-context/config.js';
|
|
7
8
|
export interface AgentRuntimeProfile<TTool = unknown> {
|
|
8
9
|
manifest: EffectiveAgentManifest;
|
|
9
10
|
promptSections: {
|
|
@@ -18,6 +19,7 @@ export interface AgentRuntimeProfile<TTool = unknown> {
|
|
|
18
19
|
}
|
|
19
20
|
export interface BuildAgentRuntimeProfileParams<TTool = unknown> {
|
|
20
21
|
manifest: EffectiveAgentManifest;
|
|
22
|
+
userContext: UserContextConfig;
|
|
21
23
|
toolCatalog: Iterable<ToolCatalogEntry<TTool>>;
|
|
22
24
|
workflowCatalog?: Iterable<WorkflowCatalogEntry>;
|
|
23
25
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { buildAgentManifestPromptSection } from "../agent-manifest/prompt.js";
|
|
2
2
|
import "../agent-manifest/index.js";
|
|
3
|
+
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
3
4
|
import { checkBoundary } from "./boundary-guard.js";
|
|
4
5
|
import { resolveModelRole } from "./model-router.js";
|
|
5
6
|
import { buildRuntimeToolRegistry } from "./tool-registry.js";
|
|
6
|
-
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
7
7
|
import { resolveWorkflow, validateWorkflowForRuntime } from "./workflow-runtime.js";
|
|
8
8
|
//#region src/agent-runtime/runtime-profile.ts
|
|
9
9
|
function buildAgentRuntimeProfile(params) {
|
|
@@ -16,7 +16,7 @@ function buildAgentRuntimeProfile(params) {
|
|
|
16
16
|
manifest: params.manifest,
|
|
17
17
|
promptSections: { capability: buildAgentManifestPromptSection(params.manifest) },
|
|
18
18
|
tools,
|
|
19
|
-
memory: buildMemoryRuntime(params.
|
|
19
|
+
memory: buildMemoryRuntime(params.userContext),
|
|
20
20
|
resolveModel: (role) => resolveModelRole({
|
|
21
21
|
manifest: params.manifest,
|
|
22
22
|
role
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-profile.js","names":[],"sources":["../../../src/agent-runtime/runtime-profile.ts"],"sourcesContent":["import {\n buildAgentManifestPromptSection,\n type EffectiveAgentManifest,\n} from '../agent-manifest/index.js';\nimport { checkBoundary } from './boundary-guard.js';\nimport { buildMemoryRuntime, type MemoryRuntime } from './memory-runtime.js';\nimport { resolveModelRole } from './model-router.js';\nimport {\n buildRuntimeToolRegistry,\n type RuntimeToolRegistry,\n type ToolCatalogEntry,\n} from './tool-registry.js';\nimport {\n resolveWorkflow,\n validateWorkflowForRuntime,\n type WorkflowCatalogEntry,\n type WorkflowResolution,\n type WorkflowValidationIssue,\n} from './workflow-runtime.js';\n\nexport interface AgentRuntimeProfile<TTool = unknown> {\n manifest: EffectiveAgentManifest;\n promptSections: {\n capability: string;\n };\n tools: RuntimeToolRegistry<TTool>;\n memory: MemoryRuntime;\n resolveModel: (role?: string) => ReturnType<typeof resolveModelRole>;\n checkBoundary: (action: string, detail?: string) => ReturnType<typeof checkBoundary>;\n resolveWorkflow: (intent?: string) => WorkflowResolution;\n validateWorkflow: (workflow: WorkflowCatalogEntry) => WorkflowValidationIssue[];\n}\n\nexport interface BuildAgentRuntimeProfileParams<TTool = unknown> {\n manifest: EffectiveAgentManifest;\n toolCatalog: Iterable<ToolCatalogEntry<TTool>>;\n workflowCatalog?: Iterable<WorkflowCatalogEntry>;\n}\n\nexport function buildAgentRuntimeProfile<TTool = unknown>(\n params: BuildAgentRuntimeProfileParams<TTool>,\n): AgentRuntimeProfile<TTool> {\n const workflowCatalog = [...(params.workflowCatalog ?? [])];\n const tools = buildRuntimeToolRegistry({\n manifest: params.manifest,\n catalog: params.toolCatalog,\n });\n return {\n manifest: params.manifest,\n promptSections: {\n capability: buildAgentManifestPromptSection(params.manifest),\n },\n tools,\n memory: buildMemoryRuntime(params.
|
|
1
|
+
{"version":3,"file":"runtime-profile.js","names":[],"sources":["../../../src/agent-runtime/runtime-profile.ts"],"sourcesContent":["import {\n buildAgentManifestPromptSection,\n type EffectiveAgentManifest,\n} from '../agent-manifest/index.js';\nimport { checkBoundary } from './boundary-guard.js';\nimport { buildMemoryRuntime, type MemoryRuntime } from './memory-runtime.js';\nimport { resolveModelRole } from './model-router.js';\nimport {\n buildRuntimeToolRegistry,\n type RuntimeToolRegistry,\n type ToolCatalogEntry,\n} from './tool-registry.js';\nimport {\n resolveWorkflow,\n validateWorkflowForRuntime,\n type WorkflowCatalogEntry,\n type WorkflowResolution,\n type WorkflowValidationIssue,\n} from './workflow-runtime.js';\nimport type { UserContextConfig } from '../user-context/config.js';\n\nexport interface AgentRuntimeProfile<TTool = unknown> {\n manifest: EffectiveAgentManifest;\n promptSections: {\n capability: string;\n };\n tools: RuntimeToolRegistry<TTool>;\n memory: MemoryRuntime;\n resolveModel: (role?: string) => ReturnType<typeof resolveModelRole>;\n checkBoundary: (action: string, detail?: string) => ReturnType<typeof checkBoundary>;\n resolveWorkflow: (intent?: string) => WorkflowResolution;\n validateWorkflow: (workflow: WorkflowCatalogEntry) => WorkflowValidationIssue[];\n}\n\nexport interface BuildAgentRuntimeProfileParams<TTool = unknown> {\n manifest: EffectiveAgentManifest;\n userContext: UserContextConfig;\n toolCatalog: Iterable<ToolCatalogEntry<TTool>>;\n workflowCatalog?: Iterable<WorkflowCatalogEntry>;\n}\n\nexport function buildAgentRuntimeProfile<TTool = unknown>(\n params: BuildAgentRuntimeProfileParams<TTool>,\n): AgentRuntimeProfile<TTool> {\n const workflowCatalog = [...(params.workflowCatalog ?? [])];\n const tools = buildRuntimeToolRegistry({\n manifest: params.manifest,\n catalog: params.toolCatalog,\n });\n return {\n manifest: params.manifest,\n promptSections: {\n capability: buildAgentManifestPromptSection(params.manifest),\n },\n tools,\n memory: buildMemoryRuntime(params.userContext),\n resolveModel: (role?: string) => resolveModelRole({ manifest: params.manifest, role }),\n checkBoundary: (action: string, detail?: string) => checkBoundary({ manifest: params.manifest, action, detail }),\n resolveWorkflow: (intent?: string) => resolveWorkflow({ manifest: params.manifest, catalog: workflowCatalog, intent }),\n validateWorkflow: (workflow: WorkflowCatalogEntry) =>\n validateWorkflowForRuntime({ manifest: params.manifest, workflow, tools }),\n };\n}\n"],"mappings":";;;;;;;;AAyCA,SAAgB,yBACd,QAC4B;CAC5B,MAAM,kBAAkB,CAAC,GAAI,OAAO,mBAAmB,EAAE,CAAE;CAC3D,MAAM,QAAQ,yBAAyB;EACrC,UAAU,OAAO;EACjB,SAAS,OAAO;EACjB,CAAC;AACF,QAAO;EACL,UAAU,OAAO;EACjB,gBAAgB,EACd,YAAY,gCAAgC,OAAO,SAAS,EAC7D;EACD;EACA,QAAQ,mBAAmB,OAAO,YAAY;EAC9C,eAAe,SAAkB,iBAAiB;GAAE,UAAU,OAAO;GAAU;GAAM,CAAC;EACtF,gBAAgB,QAAgB,WAAoB,cAAc;GAAE,UAAU,OAAO;GAAU;GAAQ;GAAQ,CAAC;EAChH,kBAAkB,WAAoB,gBAAgB;GAAE,UAAU,OAAO;GAAU,SAAS;GAAiB;GAAQ,CAAC;EACtH,mBAAmB,aACjB,2BAA2B;GAAE,UAAU,OAAO;GAAU;GAAU;GAAO,CAAC;EAC7E"}
|
|
@@ -16,8 +16,7 @@ const PROFILE_FILE_NAMES = [
|
|
|
16
16
|
WORKSPACE_FILES.IDENTITY,
|
|
17
17
|
WORKSPACE_FILES.TOOLS,
|
|
18
18
|
WORKSPACE_FILES.AGENTS,
|
|
19
|
-
WORKSPACE_FILES.HEARTBEAT
|
|
20
|
-
WORKSPACE_FILES.MEMORY
|
|
19
|
+
WORKSPACE_FILES.HEARTBEAT
|
|
21
20
|
];
|
|
22
21
|
const DEFAULT_PREVIEW_CHARS = 900;
|
|
23
22
|
const MAX_PREVIEW_CHARS = 4e3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-edit.js","names":[],"sources":["../../../src/chat-commands/agent-edit.ts"],"sourcesContent":["/**\n * /agent-edit — open the current chat as an agent profile editing session.\n */\n\nimport { readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport type { CommandContext, CommandDefinition } from './types.js';\nimport { commandRegistry } from './registry.js';\nimport { resolveAgentIdFromSessionKey } from '../routing/agent-session-key.js';\nimport { normalizeAgentId, resolveAgentProfileDir } from '../agent/agent-scope.js';\nimport { WORKSPACE_FILES } from '../config/paths.js';\n\nconst PROFILE_FILE_NAMES = [\n WORKSPACE_FILES.SOUL,\n WORKSPACE_FILES.IDENTITY,\n WORKSPACE_FILES.TOOLS,\n WORKSPACE_FILES.AGENTS,\n WORKSPACE_FILES.HEARTBEAT,\n
|
|
1
|
+
{"version":3,"file":"agent-edit.js","names":[],"sources":["../../../src/chat-commands/agent-edit.ts"],"sourcesContent":["/**\n * /agent-edit — open the current chat as an agent profile editing session.\n */\n\nimport { readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport type { CommandContext, CommandDefinition } from './types.js';\nimport { commandRegistry } from './registry.js';\nimport { resolveAgentIdFromSessionKey } from '../routing/agent-session-key.js';\nimport { normalizeAgentId, resolveAgentProfileDir } from '../agent/agent-scope.js';\nimport { WORKSPACE_FILES } from '../config/paths.js';\n\nconst PROFILE_FILE_NAMES = [\n WORKSPACE_FILES.SOUL,\n WORKSPACE_FILES.IDENTITY,\n WORKSPACE_FILES.TOOLS,\n WORKSPACE_FILES.AGENTS,\n WORKSPACE_FILES.HEARTBEAT,\n] as const;\n\nconst DEFAULT_PREVIEW_CHARS = 900;\nconst MAX_PREVIEW_CHARS = 4_000;\n\nfunction parseArgs(args: string): { fileName?: string; previewChars: number } {\n const trimmed = args.trim();\n if (!trimmed) {\n return { previewChars: DEFAULT_PREVIEW_CHARS };\n }\n\n const parts = trimmed.split(/\\s+/);\n let fileName: string | undefined;\n let previewChars = DEFAULT_PREVIEW_CHARS;\n\n for (const part of parts) {\n const limitMatch = /^--limit=(\\d+)$/.exec(part);\n if (limitMatch) {\n previewChars = Math.min(Number(limitMatch[1]), MAX_PREVIEW_CHARS);\n continue;\n }\n if (!fileName) {\n fileName = part;\n }\n }\n\n return { fileName, previewChars };\n}\n\nfunction normalizeProfileFileName(input: string | undefined): string | undefined {\n if (!input) {\n return undefined;\n }\n const basename = input.trim().replace(/\\\\/g, '/').split('/').pop();\n const matched = PROFILE_FILE_NAMES.find((name) => name.toLowerCase() === basename?.toLowerCase());\n return matched;\n}\n\nasync function readPreview(path: string, limit: number): Promise<{ content: string; missing: boolean }> {\n try {\n const content = await readFile(path, 'utf-8');\n const trimmed = content.trimEnd();\n if (trimmed.length <= limit) {\n return { content: trimmed, missing: false };\n }\n return {\n content: `${trimmed.slice(0, limit)}\\n\\n… truncated, ask me to read the full file before editing …`,\n missing: false,\n };\n } catch {\n return { content: '', missing: true };\n }\n}\n\nfunction buildEditInstructions(agentId: string, fileNames: readonly string[]): string {\n const files = fileNames.map((name) => `\\`${name}\\``).join(', ');\n return [\n `You are editing agent \\`${agentId}\\`.`,\n '',\n 'Tell me what to change, or say things like:',\n '- “Refine `SOUL.md` to sound warmer and more concise.”',\n '- “Update `IDENTITY.md` so this agent is focused on data analysis.”',\n '- “Read `SOUL.md` first, propose changes, then write them back.”',\n '',\n `Editable profile files: ${files}.`,\n 'I can read and update these by bare filename with `read_file`, `apply_patch`, and `write_file`.',\n ].join('\\n');\n}\n\nconst agentEditCommand: CommandDefinition = {\n id: 'agent.edit',\n name: 'agent-edit',\n aliases: ['agentedit'],\n description: 'Show editable profile files for the current agent and prepare this chat for profile edits.',\n category: 'system',\n scope: ['global', 'private', 'group'],\n acceptsArgs: true,\n examples: ['/agent-edit', '/agent-edit SOUL.md', '/agent-edit IDENTITY.md --limit=2000'],\n handler: async (ctx: CommandContext, args: string) => {\n await ctx.setTyping(true);\n\n const { fileName: rawFileName, previewChars } = parseArgs(args);\n const fileName = normalizeProfileFileName(rawFileName);\n if (rawFileName && !fileName) {\n return {\n content: `⚠️ Unsupported profile file: \\`${rawFileName}\\`. Use one of: ${PROFILE_FILE_NAMES.map((name) => `\\`${name}\\``).join(', ')}.`,\n success: false,\n };\n }\n\n const agentId = normalizeAgentId(resolveAgentIdFromSessionKey(ctx.sessionKey));\n const profileDir = resolveAgentProfileDir(ctx.config, agentId);\n const namesToShow = fileName ? [fileName] : [WORKSPACE_FILES.SOUL, WORKSPACE_FILES.IDENTITY];\n\n const sections: string[] = [];\n for (const name of namesToShow) {\n const preview = await readPreview(join(profileDir, name), previewChars);\n if (preview.missing) {\n sections.push(`## ${name}\\n_missing_`);\n } else {\n sections.push(`## ${name}\\n\\`\\`\\`markdown\\n${preview.content}\\n\\`\\`\\``);\n }\n }\n\n return {\n content: [\n '🛠️ Agent editor mode',\n '',\n buildEditInstructions(agentId, PROFILE_FILE_NAMES),\n '',\n `Profile directory: \\`${profileDir}\\``,\n '',\n ...sections,\n ].join('\\n'),\n success: true,\n };\n },\n};\n\nexport function registerAgentEditCommand(): void {\n commandRegistry.register(agentEditCommand);\n}\n"],"mappings":";;;;;;;;;;wBAS+E;kBACI;YAC9B;AAErD,MAAM,qBAAqB;CACzB,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CACjB;AAED,MAAM,wBAAwB;AAC9B,MAAM,oBAAoB;AAE1B,SAAS,UAAU,MAA2D;CAC5E,MAAM,UAAU,KAAK,MAAM;AAC3B,KAAI,CAAC,QACH,QAAO,EAAE,cAAc,uBAAuB;CAGhD,MAAM,QAAQ,QAAQ,MAAM,MAAM;CAClC,IAAI;CACJ,IAAI,eAAe;AAEnB,MAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,aAAa,kBAAkB,KAAK,KAAK;AAC/C,MAAI,YAAY;AACd,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AAkB,mBAAmB,KAAK,SAAS,KAAK,KAAK,IAAI,CAAC,KAAK,KAAK,CAAC;GACpI,SAAS;GACV;EAGH,MAAM,UAAU,iBAAiB,6BAA6B,IAAI,WAAW,CAAC;EAC9E,MAAM,aAAa,uBAAuB,IAAI,QAAQ,QAAQ;EAC9D,MAAM,cAAc,WAAW,CAAC,SAAS,GAAG,CAAC,gBAAgB,MAAM,gBAAgB,SAAS;EAE5F,MAAM,WAAqB,EAAE;AAC7B,OAAK,MAAM,QAAQ,aAAa;GAC9B,MAAM,UAAU,MAAM,YAAY,KAAK,YAAY,KAAK,EAAE,aAAa;AACvE,OAAI,QAAQ,QACV,UAAS,KAAK,MAAM,KAAK,aAAa;OAEtC,UAAS,KAAK,MAAM,KAAK,oBAAoB,QAAQ,QAAQ,UAAU;;AAI3E,SAAO;GACL,SAAS;IACP;IACA;IACA,sBAAsB,SAAS,mBAAmB;IAClD;IACA,wBAAwB,WAAW;IACnC;IACA,GAAG;IACJ,CAAC,KAAK,KAAK;GACZ,SAAS;GACV;;CAEJ;AAED,SAAgB,2BAAiC;AAC/C,iBAAgB,SAAS,iBAAiB"}
|
|
@@ -52,7 +52,7 @@ async function checkDatabaseSchema(ctx) {
|
|
|
52
52
|
id: "database-schema",
|
|
53
53
|
label: "Database schema",
|
|
54
54
|
status: "pass",
|
|
55
|
-
message: `SQLite schema v${status.dbVersion} (current release
|
|
55
|
+
message: `SQLite schema v${status.dbVersion} (current release v45).`,
|
|
56
56
|
hints: []
|
|
57
57
|
};
|
|
58
58
|
}
|
|
@@ -215,28 +215,6 @@ Skills are shared. Your setup is yours.
|
|
|
215
215
|
`, "utf-8");
|
|
216
216
|
log.info({ path: heartbeatPath }, "Created HEARTBEAT.md");
|
|
217
217
|
}
|
|
218
|
-
const memoryPath = join(profileDir, WORKSPACE_FILES.MEMORY);
|
|
219
|
-
if (!existsSync(memoryPath)) {
|
|
220
|
-
await writeFile(memoryPath, `# MEMORY.md - Long-Term Memory
|
|
221
|
-
|
|
222
|
-
_This is your curated memory — the distilled essence of what you've learned._
|
|
223
|
-
|
|
224
|
-
## People
|
|
225
|
-
|
|
226
|
-
## Projects
|
|
227
|
-
|
|
228
|
-
## Preferences
|
|
229
|
-
|
|
230
|
-
## Decisions
|
|
231
|
-
|
|
232
|
-
## Lessons
|
|
233
|
-
|
|
234
|
-
---
|
|
235
|
-
|
|
236
|
-
_Review and update this periodically from curated memory signals._
|
|
237
|
-
`, "utf-8");
|
|
238
|
-
log.info({ path: memoryPath }, "Created MEMORY.md");
|
|
239
|
-
}
|
|
240
218
|
}
|
|
241
219
|
function createInitCommand(_ctx) {
|
|
242
220
|
return new Command("init").description("Initialize xopc state directories, config, and agent workspace").addHelpText("after", formatExamples([
|