@xopcai/xopc 0.0.136 → 0.0.138
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 +4 -0
- package/README.zh-CN.md +4 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/demo-memory/src/index.js +4 -0
- 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/{agent-avatar-dicebear-CER17NHM.js → agent-avatar-dicebear-CIsGDJzd.js} +1 -1
- package/dist/gateway/static/root/assets/agents-fX97A6iN.js +2 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B3Ap_wpX.js → app-management-settings-panel-ByM4Bzwm.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-3kBO22Xd.js → appearance-settings-BF_poRd3.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BHYbGQcZ.js → apps-page-BssdA5Qc.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-D_vGeNB8.js → archive-plugin-DJaYoyGn.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-hWV_8pHL.js → attachment-load-xx6dBaZU.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-DVKmVTIo.js → automation-suggestion-card-BMvGqYob.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BCTXpOBp.js → automations-page-Dip8ZFmx.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-BuXIeSPc.js → binary-plugins-CuPLWibr.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C1m0u-UU.js → block-editor-bzfvlJnh.js} +58 -54
- package/dist/gateway/static/root/assets/{browser-settings-page-ChUF08V5.js → browser-settings-page-lbx_8Dku.js} +4 -4
- package/dist/gateway/static/root/assets/{capability-presets-api-B7WWYaEh.js → capability-presets-api-X4Imbf8n.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-D_Bh1PnA.js → capability-presets-settings-panel-v9JgKjJu.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-sV06LCht.js → channel-recipient-api-DllrPmp-.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-BI2ChQc7.js → channels-settings-CED7Oy5Y.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-EUwWYx8l.js +1 -0
- package/dist/gateway/static/root/assets/{connectors-page-qgvEp09M.js → connectors-page-BMfp0jWL.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BxMJlvb-.js → desktop-pet-oTig6qFO.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DCvpDImn.js → desktop-pet-settings-DXJiPL_H.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-D1nxs9PA.js → directory-picker-path-field-CltkXSR2.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-EAWkpOgw.js → dreaming-settings-CYrZQxoL.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-LUQ8dE8z.js → extension-debug-page-C-4BOy1R.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-B_mnhoRd.js → extension-page-C8nMpXqh.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BWQsGmvW.js → extension-settings-page-CXWYOwka.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-BWXmBizE.js → fetch-BID89uCH.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-M9bzPASf.js → gateway-config-api-B3TGdim5.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CbgtpprN.js → gateway-settings-D7tOnGAJ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BALL91S7.js → gateway-startup-retry-BkrLLlpE.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-CbP4t9aM.js → goal-create-dialog-BL_cRshf.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-DlwI-MZZ.js → goal-detail-page-T1vg6Ng_.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-BBhFVzBS.js → goals-config-api-D-WZWhP2.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-D26r7knp.js → goals-page-1vzWXl5W.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-DdmVG_TR.js → goals-settings-DgGwvLVC.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-DZW2Xq-U.js → heartbeat-settings-yh0bEIwQ.js} +1 -1
- package/dist/gateway/static/root/assets/index-B8s8Pq5U.css +1 -0
- package/dist/gateway/static/root/assets/index-NwiCnzI-.js +262 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-1IWd88-T.js → keyboard-shortcuts-settings-CnxRFbgA.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DxoKJO7-.js → logs-page-DebnvTpD.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BtdBj32h.js → markdown-split-BU69Nof8.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CpoPj3s8.js → media-plugins-CDs7OvWt.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DbNQuFdA.js +3 -0
- package/dist/gateway/static/root/assets/{models-hub-panel-D1Rp__dV.js → models-hub-panel-Ca_jy26S.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CgR1bO2W.js → notes-page-DTpeaI65.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-ozsnmDTV.js → notes-workbench-uKMYsjUU.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-CVLqCfQB.js → page-tabs-CROo8Vgz.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CKUXJk2t.js → preview-open-alternatives-BxsS9i1G.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-B4dqFAQF.js → project-detail-page-BWKOhshy.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DlRGXv4a.js → projects-page-CoowiCLe.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-rZEYQMZV.js → remote-access-hub-CiOaX1wd.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-BtGni268.js → save-bar-controls-B4N17dMG.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-BDGzKVWn.js → schedule-field-ClJzQ2vz.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DQJsKMCE.js → schema-form-oZvQUfDg.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-DxGoCGU8.js → sessions-page-Sx9Gc0cv.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CnbVdze4.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-c8XGd4-8.js → settings-collapsible-section-B0kOLXUf.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-By0YiDWo.js → settings-form-section-DoVPlVFd.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-SYCPY-WM.js → settings-loading-skeleton-C7J96bLc.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-D9NwvnBt.js → settings-page-CXiAByF0.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CrICyGob.js → settings-page-layout-R-6ArlMI.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-IjK-hDxf.js → setup-status-panel-Drz23n9l.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Dfnk9M_m.js → share-preview-page-Bn1umseg.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-vQiRBra7.js → shares-settings-Bb-pcMWg.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DE9HCHct.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CruV215G.js → skills-page-B6cDPqkk.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BBVbSDFD.js → system-settings-panel-CtEddAy-.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-CwFayhxu.js → typed-models-lib-BkhSnYq7.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-BKtHOM50.js → use-channel-catalog-EA4hfbsP.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-_KDWzagh.js → user-profile-settings-panel-BssTVOBS.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-BiUjIHb4.js → utils-CI3ywKLT.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-agJqlm4o.js → voice-api-key-field-DXMEGw9O.js} +1 -1
- package/dist/gateway/static/root/assets/{work-item-detail-page-Bdw4ATCb.js → work-item-detail-page-DsFqU0tK.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D-Dy6mTy.js → workflow-run-setup-panel-DImBi-m6.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-start-dialog-GammZ2GK.js → workflow-start-dialog-DuPpKAAc.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-Cw5zrqti.js → workflows-page-DfTVzTNY.js} +1 -1
- package/dist/gateway/static/root/index.html +5 -5
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +3 -3
- package/dist/src/agent/agent-manager.d.ts +7 -8
- package/dist/src/agent/agent-manager.js +24 -25
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/background-review/coordinator.d.ts +9 -23
- package/dist/src/agent/background-review/coordinator.js +45 -54
- package/dist/src/agent/background-review/coordinator.js.map +1 -1
- package/dist/src/agent/background-review/prompts.d.ts +2 -4
- package/dist/src/agent/background-review/prompts.js +7 -19
- package/dist/src/agent/background-review/prompts.js.map +1 -1
- package/dist/src/agent/background-review/run-background-review.d.ts +0 -8
- package/dist/src/agent/background-review/run-background-review.js +87 -72
- package/dist/src/agent/background-review/run-background-review.js.map +1 -1
- package/dist/src/agent/background-review/settings.d.ts +4 -4
- package/dist/src/agent/background-review/settings.js +25 -10
- package/dist/src/agent/background-review/settings.js.map +1 -1
- package/dist/src/agent/code-intelligence/binary.d.ts +1 -0
- package/dist/src/agent/code-intelligence/binary.js +42 -0
- package/dist/src/agent/code-intelligence/binary.js.map +1 -0
- package/dist/src/agent/code-intelligence/index.d.ts +4 -0
- package/dist/src/agent/code-intelligence/index.js +4 -0
- package/dist/src/agent/code-intelligence/runtime.d.ts +34 -0
- package/dist/src/agent/code-intelligence/runtime.js +282 -0
- package/dist/src/agent/code-intelligence/runtime.js.map +1 -0
- package/dist/src/agent/code-intelligence/tools.d.ts +6 -0
- package/dist/src/agent/code-intelligence/tools.js +268 -0
- package/dist/src/agent/code-intelligence/tools.js.map +1 -0
- package/dist/src/agent/code-intelligence/types.d.ts +22 -0
- package/dist/src/agent/code-intelligence/types.js +1 -0
- package/dist/src/agent/memory/builtin-provider.d.ts +1 -2
- package/dist/src/agent/memory/builtin-provider.js +31 -12
- package/dist/src/agent/memory/builtin-provider.js.map +1 -1
- package/dist/src/agent/memory/context/planner.d.ts +11 -0
- package/dist/src/agent/memory/context/planner.js +163 -0
- package/dist/src/agent/memory/context/planner.js.map +1 -0
- package/dist/src/agent/memory/context/types.d.ts +19 -0
- package/dist/src/agent/memory/context/types.js +1 -0
- package/dist/src/agent/memory/context-fence.d.ts +3 -3
- package/dist/src/agent/memory/context-fence.js +9 -9
- package/dist/src/agent/memory/context-fence.js.map +1 -1
- package/dist/src/agent/memory/index.d.ts +6 -4
- package/dist/src/agent/memory/index.js +5 -5
- package/dist/src/agent/memory/manager.d.ts +16 -4
- package/dist/src/agent/memory/manager.js +32 -34
- package/dist/src/agent/memory/manager.js.map +1 -1
- package/dist/src/agent/memory/memory-config.d.ts +1 -1
- package/dist/src/agent/memory/memory-config.js +2 -2
- package/dist/src/agent/memory/memory-config.js.map +1 -1
- package/dist/src/agent/memory/provider.d.ts +1 -3
- package/dist/src/agent/memory/stub-memory-provider.d.ts +0 -1
- package/dist/src/agent/memory/stub-memory-provider.js +0 -5
- package/dist/src/agent/memory/stub-memory-provider.js.map +1 -1
- package/dist/src/agent/memory/types.d.ts +31 -2
- package/dist/src/agent/memory/understanding/correction.d.ts +3 -0
- package/dist/src/agent/memory/understanding/correction.js +41 -0
- package/dist/src/agent/memory/understanding/correction.js.map +1 -0
- package/dist/src/agent/memory/understanding/quality.d.ts +8 -0
- package/dist/src/agent/memory/understanding/quality.js +20 -0
- package/dist/src/agent/memory/understanding/quality.js.map +1 -0
- package/dist/src/agent/memory/understanding/service.d.ts +26 -0
- package/dist/src/agent/memory/understanding/service.js +233 -0
- package/dist/src/agent/memory/understanding/service.js.map +1 -0
- package/dist/src/agent/memory/understanding/types.d.ts +22 -0
- package/dist/src/agent/memory/understanding/types.js +1 -0
- package/dist/src/agent/memory/user-context-coordinator.d.ts +21 -0
- package/dist/src/agent/memory/user-context-coordinator.js +90 -0
- package/dist/src/agent/memory/user-context-coordinator.js.map +1 -0
- package/dist/src/agent/orchestration/agent-event-handler.d.ts +1 -0
- package/dist/src/agent/orchestration/agent-event-handler.js +1 -1
- package/dist/src/agent/orchestration/agent-event-handler.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/orchestration/index.d.ts +1 -1
- package/dist/src/agent/orchestration/index.js +2 -2
- package/dist/src/agent/prompt/sections/tooling.js +10 -0
- package/dist/src/agent/prompt/sections/tooling.js.map +1 -1
- package/dist/src/agent/prompt/system-prompt.js +2 -0
- package/dist/src/agent/prompt/system-prompt.js.map +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +2 -2
- package/dist/src/agent/service/direct-turn-helpers.js.map +1 -1
- package/dist/src/agent/service.js +7 -1
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/session/session-inspector.d.ts +1 -0
- package/dist/src/agent/session/session-inspector.js +8 -2
- package/dist/src/agent/session/session-inspector.js.map +1 -1
- package/dist/src/agent/tools/factory.d.ts +3 -0
- package/dist/src/agent/tools/factory.js +17 -10
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/workspace-runtime/registry.d.ts +2 -0
- package/dist/src/agent/workspace-runtime/registry.js +11 -3
- 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/schema.d.ts +91 -0
- package/dist/src/agent-manifest/schema.js +27 -5
- package/dist/src/agent-manifest/schema.js.map +1 -1
- package/dist/src/agent-runtime/memory-runtime.d.ts +1 -1
- package/dist/src/agent-runtime/memory-runtime.js.map +1 -1
- package/dist/src/automations/domain/validation.d.ts +22 -22
- package/dist/src/automations/draft/automation-draft-validator.d.ts +4 -4
- package/dist/src/cli/command-loaders.js +1 -0
- package/dist/src/cli/command-loaders.js.map +1 -1
- package/dist/src/cli/command-manifest.js +4 -0
- package/dist/src/cli/command-manifest.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/resume.d.ts +1 -0
- package/dist/src/cli/commands/resume.js +31 -0
- package/dist/src/cli/commands/resume.js.map +1 -0
- package/dist/src/cli/commands/tui-runner.d.ts +9 -0
- package/dist/src/cli/commands/tui-runner.js +40 -0
- package/dist/src/cli/commands/tui-runner.js.map +1 -0
- package/dist/src/cli/commands/tui.js +4 -28
- package/dist/src/cli/commands/tui.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/schema.d.ts +115 -0
- package/dist/src/config/schema.js +53 -4
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +5 -0
- package/dist/src/gateway/agent-builtin-tools.js.map +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +18 -4
- package/dist/src/gateway/hono/routes/home.js +37 -2
- package/dist/src/gateway/hono/routes/home.js.map +1 -1
- package/dist/src/gateway/hono/routes/memory.js +129 -4
- package/dist/src/gateway/hono/routes/memory.js.map +1 -1
- package/dist/src/gateway/hono/routes/projects.js +16 -0
- package/dist/src/gateway/hono/routes/projects.js.map +1 -1
- package/dist/src/knowledge/index.d.ts +2 -0
- package/dist/src/knowledge/index.js +2 -0
- package/dist/src/knowledge/ingestion-service.d.ts +20 -0
- package/dist/src/knowledge/ingestion-service.js +75 -0
- package/dist/src/knowledge/ingestion-service.js.map +1 -0
- package/dist/src/knowledge/types.d.ts +70 -0
- package/dist/src/knowledge/types.js +1 -0
- package/dist/src/projects/project-kind.js +0 -1
- package/dist/src/projects/project-kind.js.map +1 -1
- package/dist/src/providers/presentation.js +1 -1
- package/dist/src/providers/presentation.js.map +1 -1
- package/dist/src/storage/sqlite/index.d.ts +2 -1
- package/dist/src/storage/sqlite/index.js +3 -2
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +50 -0
- package/dist/src/storage/sqlite/knowledge-repository.js +237 -0
- package/dist/src/storage/sqlite/knowledge-repository.js.map +1 -0
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +80 -2
- package/dist/src/storage/sqlite/memory-records-repository.js +271 -9
- package/dist/src/storage/sqlite/memory-records-repository.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/029_user_understanding.sql +133 -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/tui/tui-picker-overlay.d.ts +6 -1
- package/dist/src/tui/tui-picker-overlay.js +4 -1
- package/dist/src/tui/tui-picker-overlay.js.map +1 -1
- package/dist/src/tui/tui-types.d.ts +2 -0
- package/dist/src/tui/tui-types.js.map +1 -1
- package/dist/src/tui/tui.js +17 -2
- package/dist/src/tui/tui.js.map +1 -1
- package/dist/src/work-items/work-item-service.d.ts +1 -0
- package/dist/src/work-items/work-item-service.js +3 -0
- package/dist/src/work-items/work-item-service.js.map +1 -1
- package/dist/src/work-items/work-item-store.d.ts +1 -0
- package/dist/src/work-items/work-item-store.js +13 -0
- package/dist/src/work-items/work-item-store.js.map +1 -1
- package/package.json +2 -1
- package/dist/gateway/static/root/assets/agents-Bv5R-N8Q.js +0 -2
- package/dist/gateway/static/root/assets/channels-status-swr-MY4Xh4fM.js +0 -1
- package/dist/gateway/static/root/assets/index-CPwVzi9x.css +0 -1
- package/dist/gateway/static/root/assets/index-DZOm5_ex.js +0 -262
- package/dist/gateway/static/root/assets/messages-CQ_k8RHj.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-4e8ZQwxr.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BIWv778A.js +0 -1
- package/dist/src/agent/memory/candidate-extractor.d.ts +0 -6
- package/dist/src/agent/memory/candidate-extractor.js +0 -60
- package/dist/src/agent/memory/candidate-extractor.js.map +0 -1
- package/dist/src/agent/memory/context-assembler.d.ts +0 -10
- package/dist/src/agent/memory/context-assembler.js +0 -26
- package/dist/src/agent/memory/context-assembler.js.map +0 -1
- package/dist/src/agent/memory/inject-prefetch.d.ts +0 -6
- package/dist/src/agent/memory/inject-prefetch.js +0 -48
- package/dist/src/agent/memory/inject-prefetch.js.map +0 -1
- package/dist/src/agent/memory/prefetch-coordinator.d.ts +0 -37
- package/dist/src/agent/memory/prefetch-coordinator.js +0 -45
- package/dist/src/agent/memory/prefetch-coordinator.js.map +0 -1
|
@@ -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 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']))\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 })\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 'agent_note',\n 'workspace_fact',\n 'daily_note',\n 'session_summary',\n 'derived_insight',\n ]),\n )\n .optional(),\n })\n .strict()\n .optional(),\n dreaming: DreamingPolicySchema,\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,SAAS,6CAA6C,MAAM,MAAM;GAClE,MAAM,CAAC,QAAQ;GAChB,CAAC;AAEJ,OAAK,MAAM,CAAC,OAAO,cA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YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,UAAU;EAClD,CAAC,CACD,QAAQ;AAEE,uBAAsB,EAChC,OAAO;EACN,IAAI;EACJ,SAAS,EAAE,SAAS,CAAC,QAAQ,KAAK;EAClC,SAAS,EAAE,MAAM,SAAS,CAAC,UAAU;EACrC,UAAU;EACV,kBAAkB;EAClB,WAAW;EACX,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,WAAW;EACX,YAAY;EACZ,SAAS;EACT,QAAQ;EACT,CAAC,CACD,QAAQ;AAEE,0BAAyB,oBAAoB,OAAO,EAC/D,QAAQ,kBAAkB,UAAU,EACrC,CAAC,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,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 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 })\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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AO,EAC/D,QAAQ,kBAAkB,UAAU,EACrC,CAAC,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,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,5 +1,5 @@
|
|
|
1
1
|
import type { EffectiveAgentManifest } from '../agent-manifest/schema.js';
|
|
2
|
-
export type MemorySource = 'session' | 'userProfile' | 'agentProfile' | 'curated' | 'workspace';
|
|
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';
|
|
5
5
|
export interface MemoryCandidate {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-runtime.js","names":[],"sources":["../../../src/agent-runtime/memory-runtime.ts"],"sourcesContent":["import type { EffectiveAgentManifest } from '../agent-manifest/schema.js';\n\nexport type MemorySource
|
|
1
|
+
{"version":3,"file":"memory-runtime.js","names":[],"sources":["../../../src/agent-runtime/memory-runtime.ts"],"sourcesContent":["import type { EffectiveAgentManifest } from '../agent-manifest/schema.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(manifest: EffectiveAgentManifest): MemoryRuntime {\n const readableSources = manifest.memory.mode === 'off' ? [] : [...manifest.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 (manifest.memory.mode === 'off') {\n return { decision: 'deny', reason: 'memory is disabled' };\n }\n if (READ_ONLY_MODES.has(manifest.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 = manifest.memory.privacy?.sensitiveWritePolicy ?? 'confirm';\n if (candidate.sensitive && sensitivePolicy !== 'allow') {\n return {\n decision: sensitivePolicy,\n reason: 'memory candidate is sensitive',\n };\n }\n const targetPolicy = manifest.memory.writePolicy?.[candidate.target] ?? 'deny';\n if (manifest.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,UAAiD;CAClF,MAAM,kBAAkB,SAAS,OAAO,SAAS,QAAQ,EAAE,GAAG,CAAC,GAAG,SAAS,OAAO,QAAQ;CAC1F,MAAM,YAAY,IAAI,IAAkB,gBAAgB;AAExD,QAAO;EACL;EACA,UAAU,WAAW,UAAU,IAAI,OAAO;EAC1C,aAAa,cAAc;AACzB,OAAI,SAAS,OAAO,SAAS,MAC3B,QAAO;IAAE,UAAU;IAAQ,QAAQ;IAAsB;AAE3D,OAAI,gBAAgB,IAAI,SAAS,OAAO,KAAK,CAC3C,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,SAAS,OAAO,SAAS,wBAAwB;AACzE,OAAI,UAAU,aAAa,oBAAoB,QAC7C,QAAO;IACL,UAAU;IACV,QAAQ;IACT;GAEH,MAAM,eAAe,SAAS,OAAO,cAAc,UAAU,WAAW;AACxE,OAAI,SAAS,OAAO,SAAS,kBAAkB,iBAAiB,QAC9D,QAAO;IAAE,UAAU;IAAW,QAAQ;IAA2C;AAEnF,UAAO;IACL,UAAU;IACV,QAAQ,oBAAoB;IAC7B;;EAEJ"}
|
|
@@ -86,11 +86,11 @@ export declare const AutomationStateSchema: z.ZodObject<{
|
|
|
86
86
|
lastRunAtMs: z.ZodOptional<z.ZodNumber>;
|
|
87
87
|
lastRunStatus: z.ZodOptional<z.ZodEnum<{
|
|
88
88
|
queued: "queued";
|
|
89
|
-
timeout: "timeout";
|
|
90
|
-
failed: "failed";
|
|
91
89
|
running: "running";
|
|
92
90
|
succeeded: "succeeded";
|
|
91
|
+
failed: "failed";
|
|
93
92
|
cancelled: "cancelled";
|
|
93
|
+
timeout: "timeout";
|
|
94
94
|
}>>;
|
|
95
95
|
lastError: z.ZodOptional<z.ZodString>;
|
|
96
96
|
consecutiveFailures: z.ZodOptional<z.ZodNumber>;
|
|
@@ -176,11 +176,11 @@ export declare const AutomationSchema: z.ZodObject<{
|
|
|
176
176
|
lastRunAtMs: z.ZodOptional<z.ZodNumber>;
|
|
177
177
|
lastRunStatus: z.ZodOptional<z.ZodEnum<{
|
|
178
178
|
queued: "queued";
|
|
179
|
-
timeout: "timeout";
|
|
180
|
-
failed: "failed";
|
|
181
179
|
running: "running";
|
|
182
180
|
succeeded: "succeeded";
|
|
181
|
+
failed: "failed";
|
|
183
182
|
cancelled: "cancelled";
|
|
183
|
+
timeout: "timeout";
|
|
184
184
|
}>>;
|
|
185
185
|
lastError: z.ZodOptional<z.ZodString>;
|
|
186
186
|
consecutiveFailures: z.ZodOptional<z.ZodNumber>;
|
|
@@ -214,6 +214,13 @@ export declare const CreateAutomationSchema: z.ZodObject<{
|
|
|
214
214
|
maxSubagents: z.ZodOptional<z.ZodNumber>;
|
|
215
215
|
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
216
216
|
}, z.core.$strict>], "kind">;
|
|
217
|
+
safety: z.ZodOptional<z.ZodObject<{
|
|
218
|
+
mode: z.ZodEnum<{
|
|
219
|
+
suggest_only: "suggest_only";
|
|
220
|
+
ask_before_apply: "ask_before_apply";
|
|
221
|
+
auto_apply: "auto_apply";
|
|
222
|
+
}>;
|
|
223
|
+
}, z.core.$strict>>;
|
|
217
224
|
description: z.ZodOptional<z.ZodString>;
|
|
218
225
|
trigger: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
219
226
|
kind: z.ZodLiteral<"manual">;
|
|
@@ -240,13 +247,6 @@ export declare const CreateAutomationSchema: z.ZodObject<{
|
|
|
240
247
|
source: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
241
248
|
payloadMatch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
242
249
|
}, z.core.$strict>], "kind">;
|
|
243
|
-
safety: z.ZodOptional<z.ZodObject<{
|
|
244
|
-
mode: z.ZodEnum<{
|
|
245
|
-
suggest_only: "suggest_only";
|
|
246
|
-
ask_before_apply: "ask_before_apply";
|
|
247
|
-
auto_apply: "auto_apply";
|
|
248
|
-
}>;
|
|
249
|
-
}, z.core.$strict>>;
|
|
250
250
|
afterRun: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
251
251
|
kind: z.ZodLiteral<"none">;
|
|
252
252
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -269,11 +269,11 @@ export declare const CreateAutomationSchema: z.ZodObject<{
|
|
|
269
269
|
lastRunAtMs: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
270
270
|
lastRunStatus: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
|
|
271
271
|
queued: "queued";
|
|
272
|
-
timeout: "timeout";
|
|
273
|
-
failed: "failed";
|
|
274
272
|
running: "running";
|
|
275
273
|
succeeded: "succeeded";
|
|
274
|
+
failed: "failed";
|
|
276
275
|
cancelled: "cancelled";
|
|
276
|
+
timeout: "timeout";
|
|
277
277
|
}>>>;
|
|
278
278
|
lastError: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
279
279
|
consecutiveFailures: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
@@ -306,6 +306,13 @@ export declare const UpdateAutomationSchema: z.ZodObject<{
|
|
|
306
306
|
maxSubagents: z.ZodOptional<z.ZodNumber>;
|
|
307
307
|
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
308
308
|
}, z.core.$strict>], "kind">>;
|
|
309
|
+
safety: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
310
|
+
mode: z.ZodEnum<{
|
|
311
|
+
suggest_only: "suggest_only";
|
|
312
|
+
ask_before_apply: "ask_before_apply";
|
|
313
|
+
auto_apply: "auto_apply";
|
|
314
|
+
}>;
|
|
315
|
+
}, z.core.$strict>>>;
|
|
309
316
|
description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
310
317
|
trigger: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
311
318
|
kind: z.ZodLiteral<"manual">;
|
|
@@ -338,22 +345,15 @@ export declare const UpdateAutomationSchema: z.ZodObject<{
|
|
|
338
345
|
lastRunAtMs: z.ZodOptional<z.ZodNumber>;
|
|
339
346
|
lastRunStatus: z.ZodOptional<z.ZodEnum<{
|
|
340
347
|
queued: "queued";
|
|
341
|
-
timeout: "timeout";
|
|
342
|
-
failed: "failed";
|
|
343
348
|
running: "running";
|
|
344
349
|
succeeded: "succeeded";
|
|
350
|
+
failed: "failed";
|
|
345
351
|
cancelled: "cancelled";
|
|
352
|
+
timeout: "timeout";
|
|
346
353
|
}>>;
|
|
347
354
|
lastError: z.ZodOptional<z.ZodString>;
|
|
348
355
|
consecutiveFailures: z.ZodOptional<z.ZodNumber>;
|
|
349
356
|
}, z.core.$strict>>>;
|
|
350
|
-
safety: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
351
|
-
mode: z.ZodEnum<{
|
|
352
|
-
suggest_only: "suggest_only";
|
|
353
|
-
ask_before_apply: "ask_before_apply";
|
|
354
|
-
auto_apply: "auto_apply";
|
|
355
|
-
}>;
|
|
356
|
-
}, z.core.$strict>>>;
|
|
357
357
|
afterRun: z.ZodOptional<z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
358
358
|
kind: z.ZodLiteral<"none">;
|
|
359
359
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -35,6 +35,9 @@ export declare function buildAutomationDraftResponse(draft: GeneratedAutomationD
|
|
|
35
35
|
maxSubagents?: number;
|
|
36
36
|
timeoutSeconds?: number;
|
|
37
37
|
};
|
|
38
|
+
safety?: {
|
|
39
|
+
mode: "suggest_only" | "ask_before_apply" | "auto_apply";
|
|
40
|
+
};
|
|
38
41
|
description?: string;
|
|
39
42
|
trigger?: {
|
|
40
43
|
kind: "manual";
|
|
@@ -61,9 +64,6 @@ export declare function buildAutomationDraftResponse(draft: GeneratedAutomationD
|
|
|
61
64
|
source?: string;
|
|
62
65
|
payloadMatch?: Record<string, string | number | boolean>;
|
|
63
66
|
};
|
|
64
|
-
safety?: {
|
|
65
|
-
mode: "suggest_only" | "ask_before_apply" | "auto_apply";
|
|
66
|
-
};
|
|
67
67
|
afterRun?: {
|
|
68
68
|
kind: "none";
|
|
69
69
|
} | {
|
|
@@ -84,7 +84,7 @@ export declare function buildAutomationDraftResponse(draft: GeneratedAutomationD
|
|
|
84
84
|
nextRunAtMs?: number;
|
|
85
85
|
runningRunId?: string;
|
|
86
86
|
lastRunAtMs?: number;
|
|
87
|
-
lastRunStatus?: "queued" | "
|
|
87
|
+
lastRunStatus?: "queued" | "running" | "succeeded" | "failed" | "cancelled" | "timeout";
|
|
88
88
|
lastError?: string;
|
|
89
89
|
consecutiveFailures?: number;
|
|
90
90
|
};
|
|
@@ -9,6 +9,7 @@ const REGISTRY_COMMAND_MODULES = {
|
|
|
9
9
|
onboard: () => import("./commands/onboard.js"),
|
|
10
10
|
agent: () => import("./commands/agent.js"),
|
|
11
11
|
tui: () => import("./commands/tui.js"),
|
|
12
|
+
resume: () => import("./commands/resume.js"),
|
|
12
13
|
gateway: () => import("./commands/gateway.js"),
|
|
13
14
|
session: () => import("./commands/session.js"),
|
|
14
15
|
project: () => import("./commands/project.js"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-loaders.js","names":[],"sources":["../../../src/cli/command-loaders.ts"],"sourcesContent":["/**\n * Lazy command loaders.\n *\n * Modules here trigger their `register({...})` side effect on import; the\n * caller then mounts the requested command via `registry.installOne` (or via\n * the explicit registrar functions for non-registry commands).\n *\n * Keeping this map static-but-thunked means `bin.ts` short-circuits and\n * `runCli` can resolve a single subcommand without paying for unrelated\n * command modules.\n */\nimport type { Command } from 'commander';\nimport { resolveCliCatalogCommandPath } from './command-path-policy.js';\nimport { shouldLoadExtensionCliForCommandPath } from './command-startup-policy.js';\nimport { registry, type CLIContext } from './registry.js';\n\nexport type CommandLoader = () => Promise<unknown>;\n\nexport const REGISTRY_COMMAND_MODULES: Record<string, CommandLoader> = {\n init: () => import('./commands/init.js'),\n profile: () => import('./commands/profile.js'),\n setup: () => import('./commands/setup.js'),\n onboard: () => import('./commands/onboard.js'),\n agent: () => import('./commands/agent.js'),\n tui: () => import('./commands/tui.js'),\n gateway: () => import('./commands/gateway.js'),\n session: () => import('./commands/session.js'),\n project: () => import('./commands/project.js'),\n goal: () => import('./commands/goal.js'),\n config: () => import('./commands/config.js'),\n doctor: () => import('./commands/doctor/index.js'),\n image: () => import('./commands/image.js'),\n channels: () => import('./commands/channels.js'),\n models: () => import('./commands/models.js'),\n providers: () => import('./commands/providers.js'),\n voice: () => import('./commands/voice.js'),\n search: () => import('./commands/search.js'),\n auth: () => import('./commands/auth.js'),\n skills: () => import('./commands/skills.js'),\n connectors: () => import('./commands/connectors.js'),\n browser: () => import('./commands/browser.js'),\n update: () => import('./commands/update.js'),\n logs: () => import('./commands/logs.js'),\n tunnel: () => import('./commands/tunnel.js'),\n tailscale: () => import('./commands/tailscale.js'),\n};\n\nexport interface NonRegistryMatcher {\n matches: (name: string) => boolean;\n load: (program: Command) => Promise<void>;\n}\n\nexport const NON_REGISTRY_COMMAND_MATCHERS: NonRegistryMatcher[] = [\n {\n matches: (name) => name === 'agents' || name.startsWith('agents:'),\n load: async (program) => {\n const { registerAgentsCli } = await import('./commands/agents.js');\n registerAgentsCli(program);\n },\n },\n {\n matches: (name) => name === 'extensions',\n load: async (program) => {\n const { registerExtensionCommands } = await import('./commands/extension.js');\n registerExtensionCommands(program);\n const commandPath = resolveCliCatalogCommandPath(process.argv);\n if (shouldLoadExtensionCliForCommandPath(commandPath)) {\n const { registerExtensionCliCommands } = await import('./extension-cli-register.js');\n await registerExtensionCliCommands(program);\n }\n },\n },\n];\n\nconst FLAGS_WITH_VALUE = new Set(['--config', '--workspace']);\n\n/**\n * Resolve which command module to load based on argv. Skips global flags\n * (`--verbose`/`--config <path>`/`--workspace <path>`) and treats\n * `help <cmd>` as if the user had typed `<cmd>`, so that `xopc help gateway`\n * loads only the gateway module.\n */\nexport function resolveCommandName(argv: string[]): string | undefined {\n let i = 2;\n let firstSubcommand: string | undefined;\n while (i < argv.length) {\n const arg = argv[i];\n if (!arg) {\n i += 1;\n continue;\n }\n if (arg.startsWith('-')) {\n i += FLAGS_WITH_VALUE.has(arg) ? 2 : 1;\n continue;\n }\n if (firstSubcommand === undefined) {\n firstSubcommand = arg;\n if (arg === 'help') {\n i += 1;\n continue;\n }\n return arg;\n }\n return arg;\n }\n return firstSubcommand;\n}\n\nexport async function tryLoadCommand(\n program: Command,\n ctx: CLIContext,\n name: string,\n getCtx?: () => CLIContext,\n): Promise<boolean> {\n const moduleLoader = REGISTRY_COMMAND_MODULES[name];\n if (moduleLoader) {\n await moduleLoader();\n const installed = registry.installOne(program, name, ctx, getCtx);\n if (installed && name === 'gateway') {\n const gatewayCmd = program.commands.find((command) => command.name() === 'gateway');\n if (gatewayCmd) {\n const { prepareGatewayCommandForArgv } = await import('./commands/gateway.js');\n await prepareGatewayCommandForArgv(gatewayCmd, ctx);\n }\n }\n return installed;\n }\n const matcher = NON_REGISTRY_COMMAND_MATCHERS.find((m) => m.matches(name));\n if (matcher) {\n await matcher.load(program);\n return true;\n }\n return false;\n}\n\nexport async function loadAllCommands(\n program: Command,\n ctx: CLIContext,\n getCtx?: () => CLIContext,\n): Promise<void> {\n // Sequential to keep registration order deterministic; registry.install\n // sorts by category and is stable within a category.\n for (const loader of Object.values(REGISTRY_COMMAND_MODULES)) {\n await loader();\n }\n registry.install(program, ctx, getCtx);\n for (const matcher of NON_REGISTRY_COMMAND_MATCHERS) {\n await matcher.load(program);\n }\n const gatewayCmd = program.commands.find((command) => command.name() === 'gateway');\n if (gatewayCmd) {\n const { prepareGatewayCommandForArgv } = await import('./commands/gateway.js');\n await prepareGatewayCommandForArgv(gatewayCmd, ctx);\n }\n}\n"],"mappings":";;;;AAkBA,MAAa,2BAA0D;CACrE,YAAY,OAAO;CACnB,eAAe,OAAO;CACtB,aAAa,OAAO;CACpB,eAAe,OAAO;CACtB,aAAa,OAAO;CACpB,WAAW,OAAO;CAClB,eAAe,OAAO;CACtB,eAAe,OAAO;CACtB,eAAe,OAAO;CACtB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,cAAc,OAAO;CACrB,aAAa,OAAO;CACpB,gBAAgB,OAAO;CACvB,cAAc,OAAO;CACrB,iBAAiB,OAAO;CACxB,aAAa,OAAO;CACpB,cAAc,OAAO;CACrB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,kBAAkB,OAAO;CACzB,eAAe,OAAO;CACtB,cAAc,OAAO;CACrB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,iBAAiB,OAAO;CACzB;AAOD,MAAa,gCAAsD,CACjE;CACE,UAAU,SAAS,SAAS,YAAY,KAAK,WAAW,UAAU;CAClE,MAAM,OAAO,YAAY;EACvB,MAAM,EAAE,sBAAsB,MAAM,OAAO;AAC3C,oBAAkB,QAAQ;;CAE7B,EACD;CACE,UAAU,SAAS,SAAS;CAC5B,MAAM,OAAO,YAAY;EACvB,MAAM,EAAE,8BAA8B,MAAM,OAAO;AACnD,4BAA0B,QAAQ;AAElC,MAAI,qCADgB,6BAA6B,QAAQ,KACL,CAAC,EAAE;GACrD,MAAM,EAAE,iCAAi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,QAAQ,MAAM,KAAK,UAAU;AACnF,KAAI,YAAY;EACd,MAAM,EAAE,iCAAiC,MAAM,OAAO;AACtD,QAAM,6BAA6B,YAAY,IAAI"}
|
|
1
|
+
{"version":3,"file":"command-loaders.js","names":[],"sources":["../../../src/cli/command-loaders.ts"],"sourcesContent":["/**\n * Lazy command loaders.\n *\n * Modules here trigger their `register({...})` side effect on import; the\n * caller then mounts the requested command via `registry.installOne` (or via\n * the explicit registrar functions for non-registry commands).\n *\n * Keeping this map static-but-thunked means `bin.ts` short-circuits and\n * `runCli` can resolve a single subcommand without paying for unrelated\n * command modules.\n */\nimport type { Command } from 'commander';\nimport { resolveCliCatalogCommandPath } from './command-path-policy.js';\nimport { shouldLoadExtensionCliForCommandPath } from './command-startup-policy.js';\nimport { registry, type CLIContext } from './registry.js';\n\nexport type CommandLoader = () => Promise<unknown>;\n\nexport const REGISTRY_COMMAND_MODULES: Record<string, CommandLoader> = {\n init: () => import('./commands/init.js'),\n profile: () => import('./commands/profile.js'),\n setup: () => import('./commands/setup.js'),\n onboard: () => import('./commands/onboard.js'),\n agent: () => import('./commands/agent.js'),\n tui: () => import('./commands/tui.js'),\n resume: () => import('./commands/resume.js'),\n gateway: () => import('./commands/gateway.js'),\n session: () => import('./commands/session.js'),\n project: () => import('./commands/project.js'),\n goal: () => import('./commands/goal.js'),\n config: () => import('./commands/config.js'),\n doctor: () => import('./commands/doctor/index.js'),\n image: () => import('./commands/image.js'),\n channels: () => import('./commands/channels.js'),\n models: () => import('./commands/models.js'),\n providers: () => import('./commands/providers.js'),\n voice: () => import('./commands/voice.js'),\n search: () => import('./commands/search.js'),\n auth: () => import('./commands/auth.js'),\n skills: () => import('./commands/skills.js'),\n connectors: () => import('./commands/connectors.js'),\n browser: () => import('./commands/browser.js'),\n update: () => import('./commands/update.js'),\n logs: () => import('./commands/logs.js'),\n tunnel: () => import('./commands/tunnel.js'),\n tailscale: () => import('./commands/tailscale.js'),\n};\n\nexport interface NonRegistryMatcher {\n matches: (name: string) => boolean;\n load: (program: Command) => Promise<void>;\n}\n\nexport const NON_REGISTRY_COMMAND_MATCHERS: NonRegistryMatcher[] = [\n {\n matches: (name) => name === 'agents' || name.startsWith('agents:'),\n load: async (program) => {\n const { registerAgentsCli } = await import('./commands/agents.js');\n registerAgentsCli(program);\n },\n },\n {\n matches: (name) => name === 'extensions',\n load: async (program) => {\n const { registerExtensionCommands } = await import('./commands/extension.js');\n registerExtensionCommands(program);\n const commandPath = resolveCliCatalogCommandPath(process.argv);\n if (shouldLoadExtensionCliForCommandPath(commandPath)) {\n const { registerExtensionCliCommands } = await import('./extension-cli-register.js');\n await registerExtensionCliCommands(program);\n }\n },\n },\n];\n\nconst FLAGS_WITH_VALUE = new Set(['--config', '--workspace']);\n\n/**\n * Resolve which command module to load based on argv. Skips global flags\n * (`--verbose`/`--config <path>`/`--workspace <path>`) and treats\n * `help <cmd>` as if the user had typed `<cmd>`, so that `xopc help gateway`\n * loads only the gateway module.\n */\nexport function resolveCommandName(argv: string[]): string | undefined {\n let i = 2;\n let firstSubcommand: string | undefined;\n while (i < argv.length) {\n const arg = argv[i];\n if (!arg) {\n i += 1;\n continue;\n }\n if (arg.startsWith('-')) {\n i += FLAGS_WITH_VALUE.has(arg) ? 2 : 1;\n continue;\n }\n if (firstSubcommand === undefined) {\n firstSubcommand = arg;\n if (arg === 'help') {\n i += 1;\n continue;\n }\n return arg;\n }\n return arg;\n }\n return firstSubcommand;\n}\n\nexport async function tryLoadCommand(\n program: Command,\n ctx: CLIContext,\n name: string,\n getCtx?: () => CLIContext,\n): Promise<boolean> {\n const moduleLoader = REGISTRY_COMMAND_MODULES[name];\n if (moduleLoader) {\n await moduleLoader();\n const installed = registry.installOne(program, name, ctx, getCtx);\n if (installed && name === 'gateway') {\n const gatewayCmd = program.commands.find((command) => command.name() === 'gateway');\n if (gatewayCmd) {\n const { prepareGatewayCommandForArgv } = await import('./commands/gateway.js');\n await prepareGatewayCommandForArgv(gatewayCmd, ctx);\n }\n }\n return installed;\n }\n const matcher = NON_REGISTRY_COMMAND_MATCHERS.find((m) => m.matches(name));\n if (matcher) {\n await matcher.load(program);\n return true;\n }\n return false;\n}\n\nexport async function loadAllCommands(\n program: Command,\n ctx: CLIContext,\n getCtx?: () => CLIContext,\n): Promise<void> {\n // Sequential to keep registration order deterministic; registry.install\n // sorts by category and is stable within a category.\n for (const loader of Object.values(REGISTRY_COMMAND_MODULES)) {\n await loader();\n }\n registry.install(program, ctx, getCtx);\n for (const matcher of NON_REGISTRY_COMMAND_MATCHERS) {\n await matcher.load(program);\n }\n const gatewayCmd = program.commands.find((command) => command.name() === 'gateway');\n if (gatewayCmd) {\n const { prepareGatewayCommandForArgv } = await import('./commands/gateway.js');\n await prepareGatewayCommandForArgv(gatewayCmd, ctx);\n }\n}\n"],"mappings":";;;;AAkBA,MAAa,2BAA0D;CACrE,YAAY,OAAO;CACnB,eAAe,OAAO;CACtB,aAAa,OAAO;CACpB,eAAe,OAAO;CACtB,aAAa,OAAO;CACpB,WAAW,OAAO;CAClB,cAAc,OAAO;CACrB,eAAe,OAAO;CACtB,eAAe,OAAO;CACtB,eAAe,OAAO;CACtB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,cAAc,OAAO;CACrB,aAAa,OAAO;CACpB,gBAAgB,OAAO;CACvB,cAAc,OAAO;CACrB,iBAAiB,OAAO;CACxB,aAAa,OAAO;CACpB,cAAc,OAAO;CACrB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,kBAAkB,OAAO;CACzB,eAAe,OAAO;CACtB,cAAc,OAAO;CACrB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,iBAAiB,OAAO;CACzB;AAOD,MAAa,gCAAsD,CACjE;CACE,UAAU,SAAS,SAAS,YAAY,KAAK,WAAW,UAAU;CAClE,MAAM,OAAO,YAAY;EACvB,MAAM,EAAE,sBAAsB,MAAM,OAAO;AAC3C,oBAAkB,QAAQ;;CAE7B,EACD;CACE,UAAU,SAAS,SAAS;CAC5B,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,OAAM,QAAQ;AAEhB,UAAS,QAAQ,SAAS,KAAK,OAAO;AACtC,MAAK,MAAM,WAAW,8BACpB,OAAM,QAAQ,KAAK,QAAQ;CAE7B,MAAM,aAAa,QAAQ,SAAS,MAAM,YAAY,QAAQ,MAAM,KAAK,UAAU;AACnF,KAAI,YAAY;EACd,MAAM,EAAE,iCAAiC,MAAM,OAAO;AACtD,QAAM,6BAA6B,YAAY,IAAI"}
|
|
@@ -55,6 +55,10 @@ const ROOT_HELP_COMMANDS = [
|
|
|
55
55
|
name: "tui [options]",
|
|
56
56
|
description: "Interactive terminal UI (pi-tui)"
|
|
57
57
|
},
|
|
58
|
+
{
|
|
59
|
+
name: "resume [options] [sessionKey]",
|
|
60
|
+
description: "Resume a previous TUI session"
|
|
61
|
+
},
|
|
58
62
|
{
|
|
59
63
|
name: "tunnel",
|
|
60
64
|
description: "Manage FRP remote access tunnel"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-manifest.js","names":[],"sources":["../../../src/cli/command-manifest.ts"],"sourcesContent":["export type RootHelpOption = {\n flags: string;\n description: string;\n};\n\nexport type RootHelpCommand = {\n name: string;\n description: string;\n};\n\nexport const ROOT_COMMAND_DESCRIPTION = 'Ultra-Lightweight Personal AI Assistant. Run `xopc` with no command to open the local TUI.';\n\nexport const ROOT_HELP_OPTIONS: RootHelpOption[] = [\n { flags: '-V, --version', description: 'output the version number' },\n { flags: '--verbose', description: 'Enable verbose logging (default: false)' },\n { flags: '--config <path>', description: 'Config file path' },\n { flags: '--workspace <path>', description: 'Workspace directory' },\n { flags: '-h, --help', description: 'display help for command' },\n];\n\nexport const ROOT_HELP_COMMANDS: RootHelpCommand[] = [\n { name: 'init [options]', description: 'Initialize xopc state directories, config, and agent workspace' },\n { name: 'setup [options]', description: 'Initialize config file and workspace directory' },\n { name: 'profile', description: 'Manage xopc state profiles (~/.xopc vs ~/.xopc-<name>)' },\n { name: 'onboard [options]', description: 'Interactive setup wizard for xopc (gateway uses schema defaults)' },\n { name: 'channels', description: 'Messaging channel configuration' },\n { name: 'auth', description: 'Manage authentication credentials' },\n { name: 'agent [options]', description: 'Chat with the AI agent' },\n { name: 'tui [options]', description: 'Interactive terminal UI (pi-tui)' },\n { name: 'tunnel', description: 'Manage FRP remote access tunnel' },\n { name: 'gateway [options]', description: 'Start the xopc gateway server' },\n { name: 'session', description: 'Session management commands' },\n { name: 'project', description: 'Manage long-running projects' },\n { name: 'doctor [options]', description: 'Check xopc installation health and diagnose common issues' },\n { name: 'update [options]', description: 'Check for and install xopc updates' },\n { name: 'logs', description: 'Manage and query logs' },\n { name: 'goal', description: 'Manage durable goals' },\n { name: 'config [options]', description: 'View and edit configuration' },\n { name: 'image', description: 'Inspect image provider availability' },\n { name: 'models [options]', description: 'List and manage models and model auth' },\n { name: 'providers', description: 'Manage LLM provider credentials (user-friendly hub over `xopc auth`)' },\n { name: 'voice', description: 'Configure text-to-speech (TTS) output' },\n { name: 'search', description: 'Manage web-search providers (brave / tavily / bing / searxng)' },\n { name: 'skills', description: 'Manage skills' },\n { name: 'connectors', description: 'Browse and install verified connector capabilities from xopc-store' },\n { name: 'tailscale', description: 'Tailscale status for gateway remote access' },\n { name: 'browser', description: 'Browser automation commands (uses Playwright)' },\n { name: 'agents', description: 'Manage agents (config + workspace)' },\n { name: 'extensions', description: 'Manage extensions' },\n { name: 'help [command]', description: 'display help for command' },\n];\n\nfunction formatRows(rows: Array<{ label: string; description: string }>): string {\n const labelWidth = Math.max(...rows.map((row) => row.label.length)) + 2;\n return rows.map((row) => ` ${row.label.padEnd(labelWidth)}${row.description}`).join('\\n');\n}\n\nexport function formatRootHelp(): string {\n const options = formatRows(ROOT_HELP_OPTIONS.map((option) => ({ label: option.flags, description: option.description })));\n const commands = formatRows(\n ROOT_HELP_COMMANDS.map((command) => ({ label: command.name, description: command.description })),\n );\n return `Usage: xopc [options] [command]\n\n${ROOT_COMMAND_DESCRIPTION}\n\nOptions:\n${options}\n\nCommands:\n${commands}`;\n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ChF;EAAE,MAAM;EAAW,aAAa;EAAiD;CACjF;EAAE,MAAM;EAAU,aAAa;EAAsC;CACrE;EAAE,MAAM;EAAc,aAAa;EAAqB;CACxD;EAAE,MAAM;EAAkB,aAAa;EAA4B;CACpE;AAED,SAAS,WAAW,MAA6D;CAC/E,MAAM,aAAa,KAAK,IAAI,GAAG,KAAK,KAAK,QAAQ,IAAI,MAAM,OAAO,CAAC,GAAG;AACtE,QAAO,KAAK,KAAK,QAAQ,KAAK,IAAI,MAAM,OAAO,WAAW,GAAG,IAAI,cAAc,CAAC,KAAK,KAAK;;AAG5F,SAAgB,iBAAyB;AAKvC,QAAO;;EAEP,yBAAyB;;;EANT,WAAW,kBAAkB,KAAK,YAAY;EAAE,OAAO,OAAO;EAAO,aAAa,OAAO;EAAa,EAAE,CASjH,CAAC;;;EARS,WACf,mBAAmB,KAAK,aAAa;EAAE,OAAO,QAAQ;EAAM,aAAa,QAAQ;EAAa,EAAE,CAU1F"}
|
|
1
|
+
{"version":3,"file":"command-manifest.js","names":[],"sources":["../../../src/cli/command-manifest.ts"],"sourcesContent":["export type RootHelpOption = {\n flags: string;\n description: string;\n};\n\nexport type RootHelpCommand = {\n name: string;\n description: string;\n};\n\nexport const ROOT_COMMAND_DESCRIPTION = 'Ultra-Lightweight Personal AI Assistant. Run `xopc` with no command to open the local TUI.';\n\nexport const ROOT_HELP_OPTIONS: RootHelpOption[] = [\n { flags: '-V, --version', description: 'output the version number' },\n { flags: '--verbose', description: 'Enable verbose logging (default: false)' },\n { flags: '--config <path>', description: 'Config file path' },\n { flags: '--workspace <path>', description: 'Workspace directory' },\n { flags: '-h, --help', description: 'display help for command' },\n];\n\nexport const ROOT_HELP_COMMANDS: RootHelpCommand[] = [\n { name: 'init [options]', description: 'Initialize xopc state directories, config, and agent workspace' },\n { name: 'setup [options]', description: 'Initialize config file and workspace directory' },\n { name: 'profile', description: 'Manage xopc state profiles (~/.xopc vs ~/.xopc-<name>)' },\n { name: 'onboard [options]', description: 'Interactive setup wizard for xopc (gateway uses schema defaults)' },\n { name: 'channels', description: 'Messaging channel configuration' },\n { name: 'auth', description: 'Manage authentication credentials' },\n { name: 'agent [options]', description: 'Chat with the AI agent' },\n { name: 'tui [options]', description: 'Interactive terminal UI (pi-tui)' },\n { name: 'resume [options] [sessionKey]', description: 'Resume a previous TUI session' },\n { name: 'tunnel', description: 'Manage FRP remote access tunnel' },\n { name: 'gateway [options]', description: 'Start the xopc gateway server' },\n { name: 'session', description: 'Session management commands' },\n { name: 'project', description: 'Manage long-running projects' },\n { name: 'doctor [options]', description: 'Check xopc installation health and diagnose common issues' },\n { name: 'update [options]', description: 'Check for and install xopc updates' },\n { name: 'logs', description: 'Manage and query logs' },\n { name: 'goal', description: 'Manage durable goals' },\n { name: 'config [options]', description: 'View and edit configuration' },\n { name: 'image', description: 'Inspect image provider availability' },\n { name: 'models [options]', description: 'List and manage models and model auth' },\n { name: 'providers', description: 'Manage LLM provider credentials (user-friendly hub over `xopc auth`)' },\n { name: 'voice', description: 'Configure text-to-speech (TTS) output' },\n { name: 'search', description: 'Manage web-search providers (brave / tavily / bing / searxng)' },\n { name: 'skills', description: 'Manage skills' },\n { name: 'connectors', description: 'Browse and install verified connector capabilities from xopc-store' },\n { name: 'tailscale', description: 'Tailscale status for gateway remote access' },\n { name: 'browser', description: 'Browser automation commands (uses Playwright)' },\n { name: 'agents', description: 'Manage agents (config + workspace)' },\n { name: 'extensions', description: 'Manage extensions' },\n { name: 'help [command]', description: 'display help for command' },\n];\n\nfunction formatRows(rows: Array<{ label: string; description: string }>): string {\n const labelWidth = Math.max(...rows.map((row) => row.label.length)) + 2;\n return rows.map((row) => ` ${row.label.padEnd(labelWidth)}${row.description}`).join('\\n');\n}\n\nexport function formatRootHelp(): string {\n const options = formatRows(ROOT_HELP_OPTIONS.map((option) => ({ label: option.flags, description: option.description })));\n const commands = formatRows(\n ROOT_HELP_COMMANDS.map((command) => ({ label: command.name, description: command.description })),\n );\n return `Usage: xopc [options] [command]\n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,MAAM;EAAU,aAAa;EAAiB;CAChD;EAAE,MAAM;EAAc,aAAa;EAAsE;CACzG;EAAE,MAAM;EAAa,aAAa;EAA8C;CAChF;EAAE,MAAM;EAAW,aAAa;EAAiD;CACjF;EAAE,MAAM;EAAU,aAAa;EAAsC;CACrE;EAAE,MAAM;EAAc,aAAa;EAAqB;CACxD;EAAE,MAAM;EAAkB,aAAa;EAA4B;CACpE;AAED,SAAS,WAAW,MAA6D;CAC/E,MAAM,aAAa,KAAK,IAAI,GAAG,KAAK,KAAK,QAAQ,IAAI,MAAM,OAAO,CAAC,GAAG;AACtE,QAAO,KAAK,KAAK,QAAQ,KAAK,IAAI,MAAM,OAAO,WAAW,GAAG,IAAI,cAAc,CAAC,KAAK,KAAK;;AAG5F,SAAgB,iBAAyB;AAKvC,QAAO;;EAEP,yBAAyB;;;EANT,WAAW,kBAAkB,KAAK,YAAY;EAAE,OAAO,OAAO;EAAO,aAAa,OAAO;EAAa,EAAE,CASjH,CAAC;;;EARS,WACf,mBAAmB,KAAK,aAAa;EAAE,OAAO,QAAQ;EAAM,aAAa,QAAQ;EAAa,EAAE,CAU1F"}
|
|
@@ -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 v29).`,
|
|
56
56
|
hints: []
|
|
57
57
|
};
|
|
58
58
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { formatExamples, register } from "../registry.js";
|
|
2
|
+
import { prepareTuiStartup, runTuiFromCliOptions } from "./tui-runner.js";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
//#region src/cli/commands/resume.ts
|
|
5
|
+
function createResumeCommand(ctx) {
|
|
6
|
+
return new Command("resume").description("Resume a previous TUI session").argument("[sessionKey]", "Session key to resume directly").addHelpText("after", formatExamples([
|
|
7
|
+
"xopc resume # Choose a session interactively",
|
|
8
|
+
"xopc resume agent:main:tui-... # Resume a specific session",
|
|
9
|
+
"xopc resume --gateway --url http://host:3120 # Choose a remote session"
|
|
10
|
+
])).option("--url <url>", "Gateway URL (default: http://localhost:3120)").option("--token <token>", "Gateway bearer token").option("--password-env <name>", "Environment variable holding the gateway password").option("--workdir <dir>", "Workspace directory for the resumed TUI session").option("--no-cwd", "Do not use the launch directory as the resumed TUI session workspace").option("--local", "Run in embedded mode (no gateway required)").option("--gateway", "Force gateway mode even without an explicit URL or credential").option("--theme <name>", "Theme: auto, dark, light, or custom name from ~/.xopc/themes/").option("--thinking <level>", "Thinking level override").action(async (sessionKey, options) => {
|
|
11
|
+
prepareTuiStartup(ctx.configPath);
|
|
12
|
+
await runTuiFromCliOptions(options, {
|
|
13
|
+
session: sessionKey,
|
|
14
|
+
openSessionPickerOnStart: sessionKey === void 0
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
register({
|
|
19
|
+
id: "resume",
|
|
20
|
+
name: "resume",
|
|
21
|
+
description: "Resume a previous TUI session",
|
|
22
|
+
factory: createResumeCommand,
|
|
23
|
+
metadata: {
|
|
24
|
+
category: "runtime",
|
|
25
|
+
examples: ["xopc resume", "xopc resume agent:main:tui-..."]
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export {};
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=resume.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume.js","names":[],"sources":["../../../../src/cli/commands/resume.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport { register, formatExamples, type CLIContext } from '../registry.js';\nimport { prepareTuiStartup, runTuiFromCliOptions, type TuiCliOptions } from './tui-runner.js';\n\nfunction createResumeCommand(ctx: CLIContext): Command {\n return new Command('resume')\n .description('Resume a previous TUI session')\n .argument('[sessionKey]', 'Session key to resume directly')\n .addHelpText(\n 'after',\n formatExamples([\n 'xopc resume # Choose a session interactively',\n 'xopc resume agent:main:tui-... # Resume a specific session',\n 'xopc resume --gateway --url http://host:3120 # Choose a remote session',\n ]),\n )\n .option('--url <url>', 'Gateway URL (default: http://localhost:3120)')\n .option('--token <token>', 'Gateway bearer token')\n .option('--password-env <name>', 'Environment variable holding the gateway password')\n .option('--workdir <dir>', 'Workspace directory for the resumed TUI session')\n .option('--no-cwd', 'Do not use the launch directory as the resumed TUI session workspace')\n .option('--local', 'Run in embedded mode (no gateway required)')\n .option('--gateway', 'Force gateway mode even without an explicit URL or credential')\n .option('--theme <name>', 'Theme: auto, dark, light, or custom name from ~/.xopc/themes/')\n .option('--thinking <level>', 'Thinking level override')\n .action(async (sessionKey: string | undefined, options: TuiCliOptions) => {\n prepareTuiStartup(ctx.configPath);\n await runTuiFromCliOptions(options, {\n session: sessionKey,\n openSessionPickerOnStart: sessionKey === undefined,\n });\n });\n}\n\nregister({\n id: 'resume',\n name: 'resume',\n description: 'Resume a previous TUI session',\n factory: createResumeCommand,\n metadata: {\n category: 'runtime',\n examples: ['xopc resume', 'xopc resume agent:main:tui-...'],\n },\n});\n"],"mappings":";;;;AAKA,SAAS,oBAAoB,KAA0B;AACrD,QAAO,IAAI,QAAQ,SAAS,CACzB,YAAY,gCAAgC,CAC5C,SAAS,gBAAgB,iCAAiC,CAC1D,YACC,SACA,eAAe;EACb;EACA;EACA;EACD,CAAC,CACH,CACA,OAAO,eAAe,+CAA+C,CACrE,OAAO,mBAAmB,uBAAuB,CACjD,OAAO,yBAAyB,oDAAoD,CACpF,OAAO,mBAAmB,kDAAkD,CAC5E,OAAO,YAAY,uEAAuE,CAC1F,OAAO,WAAW,6CAA6C,CAC/D,OAAO,aAAa,gEAAgE,CACpF,OAAO,kBAAkB,gEAAgE,CACzF,OAAO,sBAAsB,0BAA0B,CACvD,OAAO,OAAO,YAAgC,YAA2B;AACxE,oBAAkB,IAAI,WAAW;AACjC,QAAM,qBAAqB,SAAS;GAClC,SAAS;GACT,0BAA0B,eAAe,KAAA;GAC1C,CAAC;GACF;;AAGN,SAAS;CACP,IAAI;CACJ,MAAM;CACN,aAAa;CACb,SAAS;CACT,UAAU;EACR,UAAU;EACV,UAAU,CAAC,eAAe,iCAAiC;EAC5D;CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TuiOptions } from '../../tui/tui-types.js';
|
|
2
|
+
export type TuiCliOptions = Record<string, string | boolean | undefined>;
|
|
3
|
+
export interface TuiLaunchOverrides {
|
|
4
|
+
session?: string;
|
|
5
|
+
openSessionPickerOnStart?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function prepareTuiStartup(configPath: string): void;
|
|
8
|
+
export declare function resolveTuiOptions(options: TuiCliOptions, overrides?: TuiLaunchOverrides): TuiOptions;
|
|
9
|
+
export declare function runTuiFromCliOptions(options: TuiCliOptions, overrides?: TuiLaunchOverrides): Promise<void>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createGatewayCredential } from "../../gateway/credential.js";
|
|
2
|
+
import { detectMigrations, runBootstrapMigrationsSync } from "../../migrations/runner.js";
|
|
3
|
+
//#region src/cli/commands/tui-runner.ts
|
|
4
|
+
function prepareTuiStartup(configPath) {
|
|
5
|
+
runBootstrapMigrationsSync(configPath);
|
|
6
|
+
const pendingMigrations = detectMigrations(configPath);
|
|
7
|
+
if (pendingMigrations.length > 0) console.warn(`xopc has ${pendingMigrations.length} pending migration(s). Run \`xopc doctor --fix\` or open Settings → App management.`);
|
|
8
|
+
}
|
|
9
|
+
function resolveTuiOptions(options, overrides = {}) {
|
|
10
|
+
const token = typeof options.token === "string" ? options.token : void 0;
|
|
11
|
+
const passwordEnv = typeof options.passwordEnv === "string" ? options.passwordEnv.trim() : void 0;
|
|
12
|
+
if (token && passwordEnv) throw new Error("Use either --token or --password-env, not both.");
|
|
13
|
+
const password = passwordEnv ? process.env[passwordEnv] : void 0;
|
|
14
|
+
if (passwordEnv && !password) throw new Error(`Gateway password environment variable ${passwordEnv} is not set.`);
|
|
15
|
+
const credential = token ? createGatewayCredential("token", token) : createGatewayCredential("password", password);
|
|
16
|
+
const useLocal = options.local === true;
|
|
17
|
+
const useGateway = options.gateway === true || typeof options.url === "string" || credential !== void 0;
|
|
18
|
+
if (useLocal && useGateway) console.log("`--local` and gateway flags both set. Using local mode.");
|
|
19
|
+
return {
|
|
20
|
+
url: typeof options.url === "string" ? options.url : void 0,
|
|
21
|
+
credential,
|
|
22
|
+
session: overrides.session ?? (typeof options.session === "string" ? options.session : void 0),
|
|
23
|
+
agentId: typeof options.agent === "string" ? options.agent : void 0,
|
|
24
|
+
message: typeof options.message === "string" ? options.message : void 0,
|
|
25
|
+
workdir: typeof options.workdir === "string" ? options.workdir : void 0,
|
|
26
|
+
useStartupCwd: options.cwd !== false,
|
|
27
|
+
local: useLocal || !useGateway,
|
|
28
|
+
thinking: typeof options.thinking === "string" ? options.thinking : void 0,
|
|
29
|
+
theme: typeof options.theme === "string" ? options.theme : void 0,
|
|
30
|
+
openSessionPickerOnStart: overrides.openSessionPickerOnStart
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async function runTuiFromCliOptions(options, overrides) {
|
|
34
|
+
const { runTui } = await import("../../tui/tui.js");
|
|
35
|
+
await runTui(resolveTuiOptions(options, overrides));
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { prepareTuiStartup, resolveTuiOptions, runTuiFromCliOptions };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=tui-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tui-runner.js","names":[],"sources":["../../../../src/cli/commands/tui-runner.ts"],"sourcesContent":["import { createGatewayCredential } from '../../gateway/credential.js';\nimport { detectMigrations, runBootstrapMigrationsSync } from '../../migrations/runner.js';\nimport type { TuiOptions } from '../../tui/tui-types.js';\n\nexport type TuiCliOptions = Record<string, string | boolean | undefined>;\n\nexport interface TuiLaunchOverrides {\n session?: string;\n openSessionPickerOnStart?: boolean;\n}\n\nexport function prepareTuiStartup(configPath: string): void {\n runBootstrapMigrationsSync(configPath);\n const pendingMigrations = detectMigrations(configPath);\n if (pendingMigrations.length > 0) {\n console.warn(\n `xopc has ${pendingMigrations.length} pending migration(s). Run \\`xopc doctor --fix\\` or open Settings → App management.`,\n );\n }\n}\n\nexport function resolveTuiOptions(\n options: TuiCliOptions,\n overrides: TuiLaunchOverrides = {},\n): TuiOptions {\n const token = typeof options.token === 'string' ? options.token : undefined;\n const passwordEnv = typeof options.passwordEnv === 'string' ? options.passwordEnv.trim() : undefined;\n if (token && passwordEnv) {\n throw new Error('Use either --token or --password-env, not both.');\n }\n\n const password = passwordEnv ? process.env[passwordEnv] : undefined;\n if (passwordEnv && !password) {\n throw new Error(`Gateway password environment variable ${passwordEnv} is not set.`);\n }\n\n const credential = token\n ? createGatewayCredential('token', token)\n : createGatewayCredential('password', password);\n const useLocal = options.local === true;\n const useGateway = options.gateway === true || typeof options.url === 'string' || credential !== undefined;\n if (useLocal && useGateway) {\n console.log('`--local` and gateway flags both set. Using local mode.');\n }\n\n return {\n url: typeof options.url === 'string' ? options.url : undefined,\n credential,\n session: overrides.session ?? (typeof options.session === 'string' ? options.session : undefined),\n agentId: typeof options.agent === 'string' ? options.agent : undefined,\n message: typeof options.message === 'string' ? options.message : undefined,\n workdir: typeof options.workdir === 'string' ? options.workdir : undefined,\n useStartupCwd: options.cwd !== false,\n local: useLocal || !useGateway,\n thinking: typeof options.thinking === 'string' ? options.thinking : undefined,\n theme: typeof options.theme === 'string' ? options.theme : undefined,\n openSessionPickerOnStart: overrides.openSessionPickerOnStart,\n };\n}\n\nexport async function runTuiFromCliOptions(\n options: TuiCliOptions,\n overrides?: TuiLaunchOverrides,\n): Promise<void> {\n const { runTui } = await import('../../tui/tui.js');\n await runTui(resolveTuiOptions(options, overrides));\n}\n"],"mappings":";;;AAW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,UAAU;EACrC;;AAGH,eAAsB,qBACpB,SACA,WACe;CACf,MAAM,EAAE,WAAW,MAAM,OAAO;AAChC,OAAM,OAAO,kBAAkB,SAAS,UAAU,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
|
|
2
2
|
import { setTuiDefaultAgentConfig } from "../../commands/agents.config.js";
|
|
3
3
|
import { formatExamples, register } from "../registry.js";
|
|
4
|
-
import {
|
|
5
|
-
import { detectMigrations, runBootstrapMigrationsSync } from "../../migrations/runner.js";
|
|
4
|
+
import { prepareTuiStartup, runTuiFromCliOptions } from "./tui-runner.js";
|
|
6
5
|
import { Command } from "commander";
|
|
7
6
|
//#region src/cli/commands/tui.ts
|
|
8
7
|
init_loader();
|
|
@@ -10,6 +9,7 @@ function createTuiCommand(ctx) {
|
|
|
10
9
|
return new Command("tui").description("Interactive terminal UI (pi-tui)").addHelpText("after", formatExamples([
|
|
11
10
|
"xopc # Open embedded TUI (default command)",
|
|
12
11
|
"xopc tui # Embedded mode (default)",
|
|
12
|
+
"xopc resume # Choose a session to resume",
|
|
13
13
|
"xopc tui --gateway # Force gateway mode",
|
|
14
14
|
"XOPC_GATEWAY_PASSWORD=xxx xopc tui --url http://host:3120 --password-env XOPC_GATEWAY_PASSWORD",
|
|
15
15
|
"xopc tui -s agent:main:tui-... # Resume a session",
|
|
@@ -17,9 +17,7 @@ function createTuiCommand(ctx) {
|
|
|
17
17
|
"xopc tui --set-default-agent coder # Persist default agent for new TUI sessions",
|
|
18
18
|
"xopc tui -m \"Summarize my inbox\" # Send a message on launch"
|
|
19
19
|
])).option("--url <url>", "Gateway URL (default: http://localhost:3120)").option("--token <token>", "Gateway bearer token").option("--password-env <name>", "Environment variable holding the gateway password").option("-s, --session <key>", "Session key to resume (omitted: start a fresh TUI session)").option("--agent <id>", "Agent id for a fresh TUI session").option("--set-default-agent <id>", "Persist default agent for new TUI sessions and exit").option("-m, --message <text>", "Send a message on launch").option("--workdir <dir>", "Workspace directory for the new TUI session").option("--no-cwd", "Do not use the launch directory as the new TUI session workspace").option("--local", "Run in embedded mode (no gateway required)").option("--gateway", "Force gateway mode even without an explicit URL or credential").option("--theme <name>", "Theme: auto, dark, light, or custom name from ~/.xopc/themes/").option("--thinking <level>", "Thinking level override").action(async (options) => {
|
|
20
|
-
|
|
21
|
-
const pendingMigrations = detectMigrations(ctx.configPath);
|
|
22
|
-
if (pendingMigrations.length > 0) console.warn(`xopc has ${pendingMigrations.length} pending migration(s). Run \`xopc doctor --fix\` or open Settings → App management.`);
|
|
20
|
+
prepareTuiStartup(ctx.configPath);
|
|
23
21
|
if (typeof options.setDefaultAgent === "string") {
|
|
24
22
|
const result = setTuiDefaultAgentConfig(loadConfig(ctx.configPath), options.setDefaultAgent);
|
|
25
23
|
if (result.ok === false) {
|
|
@@ -30,29 +28,7 @@ function createTuiCommand(ctx) {
|
|
|
30
28
|
console.log(`TUI default agent set to "${result.agentId}".`);
|
|
31
29
|
return;
|
|
32
30
|
}
|
|
33
|
-
|
|
34
|
-
const token = typeof options.token === "string" ? options.token : void 0;
|
|
35
|
-
const passwordEnv = typeof options.passwordEnv === "string" ? options.passwordEnv.trim() : void 0;
|
|
36
|
-
if (token && passwordEnv) throw new Error("Use either --token or --password-env, not both.");
|
|
37
|
-
const password = passwordEnv ? process.env[passwordEnv] : void 0;
|
|
38
|
-
if (passwordEnv && !password) throw new Error(`Gateway password environment variable ${passwordEnv} is not set.`);
|
|
39
|
-
const credential = token ? createGatewayCredential("token", token) : createGatewayCredential("password", password);
|
|
40
|
-
const useLocal = options.local === true;
|
|
41
|
-
const useGateway = options.gateway === true || typeof options.url === "string" || credential !== void 0;
|
|
42
|
-
if (useLocal && useGateway) console.log("`--local` and gateway flags both set. Using local mode.");
|
|
43
|
-
const localMode = useLocal || !useGateway;
|
|
44
|
-
await runTui({
|
|
45
|
-
url: typeof options.url === "string" ? options.url : void 0,
|
|
46
|
-
credential,
|
|
47
|
-
session: typeof options.session === "string" ? options.session : void 0,
|
|
48
|
-
agentId: typeof options.agent === "string" ? options.agent : void 0,
|
|
49
|
-
message: typeof options.message === "string" ? options.message : void 0,
|
|
50
|
-
workdir: typeof options.workdir === "string" ? options.workdir : void 0,
|
|
51
|
-
useStartupCwd: options.cwd !== false,
|
|
52
|
-
local: localMode,
|
|
53
|
-
thinking: typeof options.thinking === "string" ? options.thinking : void 0,
|
|
54
|
-
theme: typeof options.theme === "string" ? options.theme : void 0
|
|
55
|
-
});
|
|
31
|
+
await runTuiFromCliOptions(options);
|
|
56
32
|
});
|
|
57
33
|
}
|
|
58
34
|
register({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui.js","names":[],"sources":["../../../../src/cli/commands/tui.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport { setTuiDefaultAgentConfig } from '../../commands/agents.config.js';\nimport { loadConfig, saveConfig } from '../../config/loader.js';\nimport {
|
|
1
|
+
{"version":3,"file":"tui.js","names":[],"sources":["../../../../src/cli/commands/tui.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport { setTuiDefaultAgentConfig } from '../../commands/agents.config.js';\nimport { loadConfig, saveConfig } from '../../config/loader.js';\nimport { register, formatExamples, type CLIContext } from '../registry.js';\nimport { prepareTuiStartup, runTuiFromCliOptions, type TuiCliOptions } from './tui-runner.js';\n\nfunction createTuiCommand(ctx: CLIContext): Command {\n const cmd = new Command('tui')\n .description('Interactive terminal UI (pi-tui)')\n .addHelpText(\n 'after',\n formatExamples([\n 'xopc # Open embedded TUI (default command)',\n 'xopc tui # Embedded mode (default)',\n 'xopc resume # Choose a session to resume',\n 'xopc tui --gateway # Force gateway mode',\n 'XOPC_GATEWAY_PASSWORD=xxx xopc tui --url http://host:3120 --password-env XOPC_GATEWAY_PASSWORD',\n 'xopc tui -s agent:main:tui-... # Resume a session',\n 'xopc tui --agent coder # Start with a specific agent',\n 'xopc tui --set-default-agent coder # Persist default agent for new TUI sessions',\n 'xopc tui -m \"Summarize my inbox\" # Send a message on launch',\n ]),\n )\n .option('--url <url>', 'Gateway URL (default: http://localhost:3120)')\n .option('--token <token>', 'Gateway bearer token')\n .option('--password-env <name>', 'Environment variable holding the gateway password')\n .option('-s, --session <key>', 'Session key to resume (omitted: start a fresh TUI session)')\n .option('--agent <id>', 'Agent id for a fresh TUI session')\n .option('--set-default-agent <id>', 'Persist default agent for new TUI sessions and exit')\n .option('-m, --message <text>', 'Send a message on launch')\n .option('--workdir <dir>', 'Workspace directory for the new TUI session')\n .option('--no-cwd', 'Do not use the launch directory as the new TUI session workspace')\n .option('--local', 'Run in embedded mode (no gateway required)')\n .option('--gateway', 'Force gateway mode even without an explicit URL or credential')\n .option('--theme <name>', 'Theme: auto, dark, light, or custom name from ~/.xopc/themes/')\n .option('--thinking <level>', 'Thinking level override')\n .action(async (options: TuiCliOptions) => {\n prepareTuiStartup(ctx.configPath);\n if (typeof options.setDefaultAgent === 'string') {\n const cfg = loadConfig(ctx.configPath);\n const result = setTuiDefaultAgentConfig(cfg, options.setDefaultAgent);\n if (result.ok === false) {\n console.error(`Error: ${result.message}`);\n process.exit(1);\n }\n await saveConfig(result.config, ctx.configPath);\n console.log(`TUI default agent set to \"${result.agentId}\".`);\n return;\n }\n await runTuiFromCliOptions(options);\n });\n\n return cmd;\n}\n\nregister({\n id: 'tui',\n name: 'tui',\n description: 'Interactive terminal UI (pi-tui)',\n factory: createTuiCommand,\n metadata: {\n category: 'runtime',\n examples: [\n 'xopc',\n 'xopc tui',\n 'xopc tui --agent coder',\n 'xopc tui --set-default-agent coder',\n 'xopc tui --gateway',\n 'xopc tui --url http://host:3120',\n ],\n },\n});\n"],"mappings":";;;;;;aAGgE;AAIhE,SAAS,iBAAiB,KAA0B;AA8ClD,QA7CY,IAAI,QAAQ,MAAM,CAC3B,YAAY,mCAAmC,CAC/C,YACC,SACA,eAAe;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,CACH,CACA,OAAO,eAAe,+CAA+C,CACrE,OAAO,mBAAmB,uBAAuB,CACjD,OAAO,yBAAyB,oDAAoD,CACpF,OAAO,uBAAuB,6DAA6D,CAC3F,OAAO,gBAAgB,mCAAmC,CAC1D,OAAO,4BAA4B,sDAAsD,CACzF,OAAO,wBAAwB,2BAA2B,CAC1D,OAAO,mBAAmB,8CAA8C,CACxE,OAAO,YAAY,mEAAmE,CACtF,OAAO,WAAW,6CAA6C,CAC/D,OAAO,aAAa,gEAAgE,CACpF,OAAO,kBAAkB,gEAAgE,CACzF,OAAO,sBAAsB,0BAA0B,CACvD,OAAO,OAAO,YAA2B;AACxC,oBAAkB,IAAI,WAAW;AACjC,MAAI,OAAO,QAAQ,oBAAoB,UAAU;GAE/C,MAAM,SAAS,yBADH,WAAW,IAAI,WACgB,EAAE,QAAQ,gBAAgB;AACrE,OAAI,OAAO,OAAO,OAAO;AACvB,YAAQ,MAAM,UAAU,OAAO,UAAU;AACzC,YAAQ,KAAK,EAAE;;AAEjB,SAAM,WAAW,OAAO,QAAQ,IAAI,WAAW;AAC/C,WAAQ,IAAI,6BAA6B,OAAO,QAAQ,IAAI;AAC5D;;AAEF,QAAM,qBAAqB,QAAQ;GAG7B;;AAGZ,SAAS;CACP,IAAI;CACJ,MAAM;CACN,aAAa;CACb,SAAS;CACT,UAAU;EACR,UAAU;EACV,UAAU;GACR;GACA;GACA;GACA;GACA;GACA;GACD;EACF;CACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
1
2
|
import { resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
2
3
|
import "../agent-manifest/index.js";
|
|
3
|
-
import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
4
4
|
import { init_session_key, parseSessionKey } from "../routing/session-key.js";
|
|
5
5
|
import { agentExists, getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
6
6
|
//#region src/config/agent-profile.ts
|