@xopcai/xopc 0.0.95 → 0.0.96
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/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/feishu/src/workflow-progress.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +1 -1
- package/dist/extensions/telegram/src/routing-integration.js +2 -2
- package/dist/extensions/telegram/src/workflow-progress.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +2 -2
- package/dist/extensions/weixin/src/auth/accounts.js +1 -1
- package/dist/extensions/weixin/src/cdn/upload.js +1 -1
- package/dist/extensions/weixin/src/media/data-url.js +1 -1
- package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
- package/dist/extensions/weixin/src/messaging/inbound.js +1 -1
- package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
- package/dist/extensions/weixin/src/plugin.js +1 -1
- package/dist/extensions/weixin/src/storage/sync-buf.js +1 -1
- package/dist/extensions/weixin/src/workflow-progress.js +1 -1
- package/dist/gateway/static/root/assets/{agents-CKe2LMnz.js → agents-DmIuSaOE.js} +2 -2
- package/dist/gateway/static/root/assets/{apps-page-Mi9mMIZ1.js → apps-page-DFcHBxLw.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-BrdyC101.js → channels-settings-DDUf55C5.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-status-swr-D55Bu0nn.js → channels-status-swr-BxF-_nzD.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-api-CPpx2l-E.js → cron-api-DylQtnb_.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-page-Bx2jB0YN.js → cron-page-BO0d9Pf-.js} +1 -1
- package/dist/gateway/static/root/assets/{dist-D_AiG_Kg.js → dist-BskF0qDS.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-6ieHsxRE.js → extension-debug-page-BcZdTdjJ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-B8nywHRO.js → extension-page-D2iuDa1D.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DrskdEIV.js → extension-settings-page-BKpQCgLc.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-B0aeeY0q.js → fetch-CtNDpjij.js} +1 -1
- package/dist/gateway/static/root/assets/{field-primitives--9ooY8Xl.js → field-primitives-2PekrGZF.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-config-api-DUZ_W1w-.js → heartbeat-config-api-D3D7SW8A.js} +1 -1
- package/dist/gateway/static/root/assets/index-BvEhL9RQ.css +1 -0
- package/dist/gateway/static/root/assets/{index-Dj9FuxCm.js → index-Db9fd_X4.js} +74 -74
- package/dist/gateway/static/root/assets/{logs-page-CaXqhpKf.js → logs-page-B3I1a26m.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-page-DYzym2B0.js → note-detail-page-BOizhtJ8.js} +54 -53
- package/dist/gateway/static/root/assets/{note-detail-page-B91pLkEI.css → note-detail-page-D4ZIVQbk.css} +1 -1
- package/dist/gateway/static/root/assets/{note-time-B-vSi2dR.js → note-time-CjUGtqKr.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BkhWdGiT.js → notes-page-BB8-I0Of.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-53YFokoe.js → sessions-page-BcH-1K9i.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-advanced-gate-BaZmaklx.js → settings-advanced-gate-Czn8nnjN.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DIJPKpTR.js → settings-form-section-ZZWDwgVe.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-Dvb230FF.js → settings-page-BX8c_zrN.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CRyjTAG6.js → share-preview-page-Ch3_6Qah.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-C5ZJbfAe.js → skills-page-WO0bbJ54.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-Cg_SuBw0.js → theme-store-XxRFRZDX.js} +1 -1
- package/dist/gateway/static/root/assets/url-6zpynn1R.js +3 -0
- package/dist/gateway/static/root/assets/{utils-lMYoWhqo.js → utils-uTYKh54l.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-Dda2pcUU.js → voice-api-key-field-BIAYHRs-.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-page.utils-KIladUrU.js → workflow-page.utils-BbWhqD36.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-BTis4Z7Y.js → workflows-page-D4RIF7E1.js} +1 -1
- package/dist/gateway/static/root/index.html +5 -5
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +15 -9
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/agent-scope.d.ts +0 -1
- package/dist/src/agent/agent-scope.js +2 -5
- package/dist/src/agent/agent-scope.js.map +1 -1
- package/dist/src/agent/bootstrap/bootstrap-cache.d.ts +3 -0
- package/dist/src/agent/bootstrap/bootstrap-cache.js +13 -3
- package/dist/src/agent/bootstrap/bootstrap-cache.js.map +1 -1
- package/dist/src/agent/bootstrap/bootstrap-files.d.ts +6 -0
- package/dist/src/agent/bootstrap/bootstrap-files.js +35 -12
- package/dist/src/agent/bootstrap/bootstrap-files.js.map +1 -1
- package/dist/src/agent/bootstrap/load-bootstrap-files.d.ts +5 -2
- package/dist/src/agent/bootstrap/load-bootstrap-files.js +12 -3
- package/dist/src/agent/bootstrap/load-bootstrap-files.js.map +1 -1
- package/dist/src/agent/context/workspace-seed.js +8 -4
- package/dist/src/agent/context/workspace-seed.js.map +1 -1
- package/dist/src/agent/context/workspace-state.d.ts +52 -0
- package/dist/src/agent/context/workspace-state.js +101 -0
- package/dist/src/agent/context/workspace-state.js.map +1 -0
- package/dist/src/agent/embedded/index.d.ts +2 -2
- package/dist/src/agent/embedded/index.js +3 -3
- package/dist/src/agent/embedded/run-turn.js +0 -3
- package/dist/src/agent/embedded/run-turn.js.map +1 -1
- package/dist/src/agent/embedded/session-manager-init.d.ts +0 -17
- package/dist/src/agent/embedded/session-manager-init.js +1 -36
- package/dist/src/agent/embedded/session-manager-init.js.map +1 -1
- package/dist/src/agent/embedded/session-runner.d.ts +3 -12
- package/dist/src/agent/embedded/session-runner.js +12 -26
- package/dist/src/agent/embedded/session-runner.js.map +1 -1
- package/dist/src/agent/embedded/session-tool-result-guard.js +2 -4
- package/dist/src/agent/embedded/session-tool-result-guard.js.map +1 -1
- package/dist/src/agent/embedded/sqlite-hydrating-session-manager.d.ts +10 -0
- package/dist/src/agent/embedded/sqlite-hydrating-session-manager.js +34 -0
- package/dist/src/agent/embedded/sqlite-hydrating-session-manager.js.map +1 -0
- package/dist/src/agent/goals/goal-run-store.js +4 -4
- package/dist/src/agent/goals/persistent-goal-service.js +8 -15
- package/dist/src/agent/goals/persistent-goal-service.js.map +1 -1
- package/dist/src/agent/goals/post-turn.js +2 -2
- package/dist/src/agent/image/load-image-media.js +2 -2
- package/dist/src/agent/ipc/bus.js +1 -1
- package/dist/src/agent/ipc/inbox.js +2 -2
- package/dist/src/agent/ipc/socket.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-materialize.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
- package/dist/src/agent/mcp/mcp-transport-config.js +1 -1
- package/dist/src/agent/mcp/mcp-transport.js +1 -1
- package/dist/src/agent/memory/builtin-memory-store.js +1 -1
- package/dist/src/agent/memory/dreaming/deep-promotion.js +1 -1
- package/dist/src/agent/memory/dreaming/events.js +1 -1
- package/dist/src/agent/memory/dreaming/last-run.js +1 -1
- package/dist/src/agent/memory/dreaming/light-sweep.js +1 -1
- package/dist/src/agent/memory/dreaming/preview.js +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.js +1 -1
- package/dist/src/agent/memory/dreaming/short-term-store.js +1 -1
- package/dist/src/agent/memory/dreaming/utils.js +1 -1
- package/dist/src/agent/memory/plugin-discovery.js +1 -1
- package/dist/src/agent/models/manager.js +1 -1
- package/dist/src/agent/prompt/memory/index.d.ts +1 -0
- package/dist/src/agent/prompt/memory/index.js +34 -80
- package/dist/src/agent/prompt/memory/index.js.map +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
- package/dist/src/agent/reply/post-compaction-context.js +1 -1
- package/dist/src/agent/reply/workspace-boundary-read.js +1 -1
- package/dist/src/agent/sandbox/path-policy.js +2 -2
- package/dist/src/agent/service/build-direct-message-content.js +1 -1
- package/dist/src/agent/service/process-direct-one-shot.js +8 -17
- package/dist/src/agent/service/process-direct-one-shot.js.map +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +14 -23
- package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
- package/dist/src/agent/service.js +7 -11
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/config.js +1 -1
- package/dist/src/agent/skills/hub-hash.js +2 -2
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +3 -3
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/scanner.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/skills/skill-manager.js +1 -1
- package/dist/src/agent/tools/dreaming-tool.js +1 -1
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +1 -1
- package/dist/src/agent/tools/index.d.ts +0 -1
- package/dist/src/agent/tools/index.js +1 -2
- package/dist/src/agent/tools/send-media.js +1 -1
- package/dist/src/agent/tools/session-search-tool.d.ts +0 -1
- package/dist/src/agent/tools/session-search-tool.js +11 -6
- package/dist/src/agent/tools/session-search-tool.js.map +1 -1
- package/dist/src/agent/tools/skill-manage-tool.js +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/workflow/catalog.js +1 -1
- package/dist/src/auth/credentials.js +3 -3
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/browser/cache-dir-policy.js +1 -1
- package/dist/src/browser/cdp-local-launcher.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +4 -4
- package/dist/src/browser/providers/cloakbrowser.js +4 -4
- package/dist/src/browser/providers/playwright-doctor.js +1 -1
- package/dist/src/browser/stealth.js +1 -1
- package/dist/src/channels/attachments/inbound-persist.js +1 -1
- package/dist/src/channels/attachments/outbound-tts-persist.js +1 -1
- package/dist/src/channels/outbound/persist-store.js +1 -1
- package/dist/src/channels/pairing/allow-from-file.js +1 -1
- package/dist/src/channels/pairing/pairing-store.js +2 -2
- package/dist/src/chat-commands/agent-edit.js +2 -2
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/doctor/checks/config-health.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/doctor/checks/session-integrity.js +32 -95
- package/dist/src/cli/commands/doctor/checks/session-integrity.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/state-integrity.js +1 -1
- package/dist/src/cli/commands/doctor/checks/workspace-status.js +1 -1
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension-pack.js +1 -1
- package/dist/src/cli/commands/gateway/logs.js +1 -1
- package/dist/src/cli/commands/image.js +1 -1
- package/dist/src/cli/commands/init.js +5 -7
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +2 -2
- package/dist/src/commands/agents.config.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/gateway-bind.js +1 -1
- package/dist/src/config/index.js +7 -8
- package/dist/src/config/index.js.map +1 -1
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +2 -2
- package/dist/src/config/paths-state.d.ts +3 -0
- package/dist/src/config/paths-state.js +7 -3
- package/dist/src/config/paths-state.js.map +1 -1
- package/dist/src/config/paths.d.ts +5 -35
- package/dist/src/config/paths.js +6 -50
- package/dist/src/config/paths.js.map +1 -1
- package/dist/src/config/profile.js +2 -2
- package/dist/src/config/schema.d.ts +15 -0
- package/dist/src/config/schema.js +11 -0
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/config/workspace-path.js +1 -1
- package/dist/src/cron/execution-types.d.ts +42 -0
- package/dist/src/cron/executor.js +2 -2
- package/dist/src/cron/persistence.js +1 -1
- package/dist/src/cron/run-log-store.d.ts +4 -8
- package/dist/src/cron/run-log-store.js +26 -78
- package/dist/src/cron/run-log-store.js.map +1 -1
- package/dist/src/cron/service.d.ts +3 -3
- package/dist/src/cron/service.js +2 -2
- package/dist/src/cron/service.js.map +1 -1
- package/dist/src/cron/types.d.ts +1 -42
- package/dist/src/daemon/constants.js +1 -1
- package/dist/src/daemon/install-plan.js +2 -2
- package/dist/src/daemon/launchd.js +2 -2
- package/dist/src/daemon/schtasks.js +2 -2
- package/dist/src/daemon/systemd.js +2 -2
- package/dist/src/extensions/bundle-mcp.js +1 -1
- package/dist/src/extensions/discover-extensions.js +1 -1
- package/dist/src/extensions/health.js +1 -1
- package/dist/src/extensions/loader.js +1 -1
- package/dist/src/extensions/lockfile.js +2 -2
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agents-admin.js +8 -3
- package/dist/src/gateway/agents-admin.js.map +1 -1
- package/dist/src/gateway/file-path-classifier.d.ts +0 -1
- package/dist/src/gateway/file-path-classifier.js +2 -8
- package/dist/src/gateway/file-path-classifier.js.map +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/lib/extension-store.js +2 -2
- package/dist/src/gateway/hono/lib/static-ui.js +2 -2
- package/dist/src/gateway/hono/oauth.js +1 -1
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/dreaming.js +1 -1
- package/dist/src/gateway/hono/routes/host-fs.js +2 -2
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/shares.js +1 -1
- package/dist/src/gateway/hono/routes/workspace.js +2 -2
- package/dist/src/gateway/lock.js +3 -3
- package/dist/src/gateway/ports.js +1 -1
- package/dist/src/gateway/service/agent-runner.js +2 -2
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service.js +5 -1
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/gateway/session-reset-service.d.ts +1 -1
- package/dist/src/gateway/session-reset-service.js +1 -1
- package/dist/src/gateway/session-reset-service.js.map +1 -1
- package/dist/src/gateway/workspace-fs-file-list.js +1 -1
- package/dist/src/infra/brew.js +1 -1
- package/dist/src/infra/node-sqlite.d.ts +1 -0
- package/dist/src/infra/node-sqlite.js +17 -0
- package/dist/src/infra/node-sqlite.js.map +1 -0
- package/dist/src/infra/package-json.js +1 -1
- package/dist/src/infra/package-update-steps.js +1 -1
- package/dist/src/infra/path-env.js +2 -2
- package/dist/src/infra/restart.js +2 -2
- package/dist/src/infra/sqlite-errors.d.ts +1 -0
- package/dist/src/infra/sqlite-errors.js +77 -0
- package/dist/src/infra/sqlite-errors.js.map +1 -0
- package/dist/src/infra/stable-node-path.js +1 -1
- package/dist/src/infra/unhandled-rejections.d.ts +1 -0
- package/dist/src/infra/unhandled-rejections.js +25 -0
- package/dist/src/infra/unhandled-rejections.js.map +1 -0
- package/dist/src/infra/update-check.js +1 -1
- package/dist/src/infra/update-global.js +1 -1
- package/dist/src/infra/update-lock.js +3 -3
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/infra/update-startup.js +2 -2
- package/dist/src/infra/warning-filter.d.ts +7 -0
- package/dist/src/infra/warning-filter.js +59 -0
- package/dist/src/infra/warning-filter.js.map +1 -0
- package/dist/src/infra/write-file-atomic.js +2 -2
- package/dist/src/notes/store.d.ts +3 -9
- package/dist/src/notes/store.js +22 -196
- package/dist/src/notes/store.js.map +1 -1
- package/dist/src/providers/auth-runtime/auth-profile-store.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/session/config-store.d.ts +6 -75
- package/dist/src/session/config-store.js +38 -144
- package/dist/src/session/config-store.js.map +1 -1
- package/dist/src/session/config-types.d.ts +15 -0
- package/dist/src/session/config-types.js +1 -0
- package/dist/src/session/index.d.ts +1 -3
- package/dist/src/session/index.js +3 -5
- package/dist/src/session/init-session-turn.d.ts +0 -6
- package/dist/src/session/init-session-turn.js +18 -18
- package/dist/src/session/init-session-turn.js.map +1 -1
- package/dist/src/session/lifecycle-timestamps.d.ts +5 -2
- package/dist/src/session/lifecycle-timestamps.js.map +1 -1
- package/dist/src/session/{parity/load-jsonl-entries.js → load-jsonl-entries.js} +1 -1
- package/dist/src/session/load-jsonl-entries.js.map +1 -0
- package/dist/src/session/manager.d.ts +5 -3
- package/dist/src/session/manager.js +1 -5
- package/dist/src/session/manager.js.map +1 -1
- package/dist/src/session/resolve-session.d.ts +3 -6
- package/dist/src/session/resolve-session.js +26 -31
- package/dist/src/session/resolve-session.js.map +1 -1
- package/dist/src/session/session-context-for-llm.js +5 -1
- package/dist/src/session/session-context-for-llm.js.map +1 -1
- package/dist/src/session/session-id.js +12 -0
- package/dist/src/session/session-id.js.map +1 -0
- package/dist/src/session/session-title.js +2 -2
- package/dist/src/session/session-workspace.d.ts +1 -1
- package/dist/src/session/session-workspace.js.map +1 -1
- package/dist/src/session/store.d.ts +14 -63
- package/dist/src/session/store.js +172 -847
- package/dist/src/session/store.js.map +1 -1
- package/dist/src/session/stored-rows-to-file-entries.d.ts +11 -0
- package/dist/src/session/stored-rows-to-file-entries.js +95 -0
- package/dist/src/session/stored-rows-to-file-entries.js.map +1 -0
- package/dist/src/session/transcript-events.d.ts +1 -2
- package/dist/src/session/transcript-events.js +5 -12
- package/dist/src/session/transcript-events.js.map +1 -1
- package/dist/src/session/transcript-format.d.ts +1 -1
- package/dist/src/session/transcript-format.js.map +1 -1
- package/dist/src/session/transcript-stats.d.ts +1 -0
- package/dist/src/session/transcript-stats.js +10 -0
- package/dist/src/session/transcript-stats.js.map +1 -0
- package/dist/src/share/share-auto.js +2 -2
- package/dist/src/share/share-store.js +3 -3
- package/dist/src/share/share-thumbnail.js +2 -2
- package/dist/src/share/share-zip.js +1 -1
- package/dist/src/share/site-share-store.js +3 -3
- package/dist/src/share/site-static-serve.js +1 -1
- package/dist/src/storage/sqlite/config-repository.d.ts +6 -0
- package/dist/src/storage/sqlite/config-repository.js +56 -0
- package/dist/src/storage/sqlite/config-repository.js.map +1 -0
- package/dist/src/storage/sqlite/connection.d.ts +38 -0
- package/dist/src/storage/sqlite/connection.js +258 -0
- package/dist/src/storage/sqlite/connection.js.map +1 -0
- package/dist/src/storage/sqlite/cron-run-repository.d.ts +5 -0
- package/dist/src/storage/sqlite/cron-run-repository.js +97 -0
- package/dist/src/storage/sqlite/cron-run-repository.js.map +1 -0
- package/dist/src/storage/sqlite/fts.d.ts +2 -0
- package/dist/src/storage/sqlite/fts.js +11 -0
- package/dist/src/storage/sqlite/fts.js.map +1 -0
- package/dist/src/storage/sqlite/index.d.ts +12 -0
- package/dist/src/storage/sqlite/index.js +13 -0
- package/dist/src/storage/sqlite/memory-index-repository.d.ts +18 -0
- package/dist/src/storage/sqlite/memory-index-repository.js +132 -0
- package/dist/src/storage/sqlite/memory-index-repository.js.map +1 -0
- package/dist/src/storage/sqlite/notes-repository.d.ts +11 -0
- package/dist/src/storage/sqlite/notes-repository.js +191 -0
- package/dist/src/storage/sqlite/notes-repository.js.map +1 -0
- package/dist/src/storage/sqlite/paths.d.ts +1 -0
- package/dist/src/storage/sqlite/paths.js +7 -0
- package/dist/src/storage/sqlite/paths.js.map +1 -0
- package/dist/src/storage/sqlite/row-mappers.d.ts +82 -0
- package/dist/src/storage/sqlite/row-mappers.js +164 -0
- package/dist/src/storage/sqlite/row-mappers.js.map +1 -0
- package/dist/src/storage/sqlite/schema.d.ts +5 -0
- package/dist/src/storage/sqlite/schema.js +43 -0
- package/dist/src/storage/sqlite/schema.js.map +1 -0
- package/dist/src/storage/sqlite/schema.sql +195 -0
- package/dist/src/storage/sqlite/session-metadata.d.ts +8 -0
- package/dist/src/storage/sqlite/session-metadata.js +83 -0
- package/dist/src/storage/sqlite/session-metadata.js.map +1 -0
- package/dist/src/storage/sqlite/session-repository.d.ts +29 -0
- package/dist/src/storage/sqlite/session-repository.js +268 -0
- package/dist/src/storage/sqlite/session-repository.js.map +1 -0
- package/dist/src/storage/sqlite/transaction.d.ts +11 -0
- package/dist/src/storage/sqlite/transaction.js +115 -0
- package/dist/src/storage/sqlite/transaction.js.map +1 -0
- package/dist/src/storage/sqlite/transcript-repository.d.ts +34 -0
- package/dist/src/storage/sqlite/transcript-repository.js +241 -0
- package/dist/src/storage/sqlite/transcript-repository.js.map +1 -0
- package/dist/src/tui/clipboard-image.js +3 -3
- package/dist/src/tui/theme-manager.js +1 -1
- package/dist/src/tui/tui-keybindings-file.js +1 -1
- package/dist/src/tui/tui-scoped-models.js +2 -2
- package/dist/src/tui/tui-settings.js +1 -1
- package/dist/src/tui/tui.js +3 -3
- package/dist/src/tunnel/frpc-binary.js +3 -3
- package/dist/src/tunnel/frpc-config.js +1 -1
- package/dist/src/tunnel/frpc-extract.js +1 -1
- package/dist/src/tunnel/tunnel-state.js +1 -1
- package/dist/src/utils/logger/audit.js +1 -1
- package/dist/src/utils/logger/log-store.js +1 -1
- package/dist/src/utils/logger/rotation.js +1 -1
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/voice/tts/providers/edge-speech.js +2 -2
- package/dist/src/workflows/service/workflow-session-bridge.js +41 -64
- package/dist/src/workflows/service/workflow-session-bridge.js.map +1 -1
- package/dist/src/workflows/store/event-store.js +1 -1
- package/dist/src/workflows/store/run-store.js +1 -1
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/index-Bj_l8QDp.css +0 -1
- package/dist/gateway/static/root/assets/url-BHHmdJYc.js +0 -3
- package/dist/src/agent/embedded/session-manager-cache.d.ts +0 -19
- package/dist/src/agent/embedded/session-manager-cache.js +0 -48
- package/dist/src/agent/embedded/session-manager-cache.js.map +0 -1
- package/dist/src/session/parity/artifacts.d.ts +0 -16
- package/dist/src/session/parity/artifacts.js +0 -80
- package/dist/src/session/parity/artifacts.js.map +0 -1
- package/dist/src/session/parity/jsonl-transcript-io.d.ts +0 -54
- package/dist/src/session/parity/jsonl-transcript-io.js +0 -236
- package/dist/src/session/parity/jsonl-transcript-io.js.map +0 -1
- package/dist/src/session/parity/load-jsonl-entries.js.map +0 -1
- package/dist/src/session/parity/session-id.js +0 -18
- package/dist/src/session/parity/session-id.js.map +0 -1
- package/dist/src/session/parity/sessions-json-cache.d.ts +0 -14
- package/dist/src/session/parity/sessions-json-cache.js +0 -98
- package/dist/src/session/parity/sessions-json-cache.js.map +0 -1
- package/dist/src/session/parity/sessions-json-file-read.d.ts +0 -6
- package/dist/src/session/parity/sessions-json-file-read.js +0 -19
- package/dist/src/session/parity/sessions-json-file-read.js.map +0 -1
- package/dist/src/session/parity/sessions-json-file.d.ts +0 -11
- package/dist/src/session/parity/sessions-json-file.js +0 -52
- package/dist/src/session/parity/sessions-json-file.js.map +0 -1
- package/dist/src/session/parity/sessions-json-patch.d.ts +0 -14
- package/dist/src/session/parity/sessions-json-patch.js +0 -40
- package/dist/src/session/parity/sessions-json-patch.js.map +0 -1
- package/dist/src/session/parity/transcript-file-lock.d.ts +0 -22
- package/dist/src/session/parity/transcript-file-lock.js +0 -142
- package/dist/src/session/parity/transcript-file-lock.js.map +0 -1
- package/dist/src/session/parity/transcript-pagination.d.ts +0 -29
- package/dist/src/session/parity/transcript-pagination.js +0 -132
- package/dist/src/session/parity/transcript-pagination.js.map +0 -1
- package/dist/src/session/parity/transcript-paths.d.ts +0 -13
- package/dist/src/session/parity/transcript-paths.js +0 -64
- package/dist/src/session/parity/transcript-paths.js.map +0 -1
- package/dist/src/session/parity/xopc-session-disk-entry.d.ts +0 -22
- package/dist/src/session/search-index-cache.d.ts +0 -6
- package/dist/src/session/search-index-cache.js +0 -44
- package/dist/src/session/search-index-cache.js.map +0 -1
- package/dist/src/session/search-index.d.ts +0 -20
- package/dist/src/session/search-index.js +0 -124
- package/dist/src/session/search-index.js.map +0 -1
- /package/dist/src/{session/parity/xopc-session-disk-entry.js → cron/execution-types.js} +0 -0
- /package/dist/src/session/{parity/load-jsonl-entries.d.ts → load-jsonl-entries.d.ts} +0 -0
- /package/dist/src/session/{parity/session-id.d.ts → session-id.d.ts} +0 -0
|
@@ -1,42 +1,11 @@
|
|
|
1
|
-
import { init_agent_scope, listAgentEntries, resolveDefaultAgentId } from "../../../../agent/agent-scope.js";
|
|
2
|
-
import { init_session_key, parseSessionKey } from "../../../../routing/session-key.js";
|
|
3
|
-
import { init_transcript_paths, resolveSessionFilePath } from "../../../../session/parity/transcript-paths.js";
|
|
4
|
-
import { FILENAMES, init_paths, resolveSessionsDir } from "../../../../config/paths.js";
|
|
5
1
|
import { init_loader, loadConfig } from "../../../../config/loader.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { requireXopcDatabase } from "../../../../storage/sqlite/connection.js";
|
|
3
|
+
import { getSqliteDatabase } from "../../../../storage/sqlite/transaction.js";
|
|
4
|
+
import { getCurrentTranscriptId, listSessionMetadata } from "../../../../storage/sqlite/session-repository.js";
|
|
5
|
+
import "../../../../storage/sqlite/index.js";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
8
7
|
//#region src/cli/commands/doctor/checks/session-integrity.ts
|
|
9
|
-
init_agent_scope();
|
|
10
8
|
init_loader();
|
|
11
|
-
init_paths();
|
|
12
|
-
init_session_key();
|
|
13
|
-
init_transcript_paths();
|
|
14
|
-
function discoverSessionMapLocations(config, stateDir) {
|
|
15
|
-
const agentIds = new Set([resolveDefaultAgentId(config), ...listAgentEntries(config).map((agent) => agent.id)]);
|
|
16
|
-
const agentsRoot = join(stateDir, "agents");
|
|
17
|
-
if (existsSync(agentsRoot)) {
|
|
18
|
-
for (const entry of readdirSync(agentsRoot, { withFileTypes: true })) if (entry.isDirectory()) agentIds.add(entry.name);
|
|
19
|
-
}
|
|
20
|
-
const seenMapPaths = /* @__PURE__ */ new Set();
|
|
21
|
-
const locations = [];
|
|
22
|
-
for (const agentId of agentIds) {
|
|
23
|
-
const sessionsDir = resolveSessionsDir(config, agentId);
|
|
24
|
-
const mapPath = join(sessionsDir, FILENAMES.SESSIONS_MAP);
|
|
25
|
-
if (seenMapPaths.has(mapPath)) continue;
|
|
26
|
-
seenMapPaths.add(mapPath);
|
|
27
|
-
locations.push({
|
|
28
|
-
agentId,
|
|
29
|
-
sessionsDir,
|
|
30
|
-
mapPath
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return locations;
|
|
34
|
-
}
|
|
35
|
-
function readSessionMap(mapPath) {
|
|
36
|
-
const parsed = JSON.parse(readFileSync(mapPath, "utf-8"));
|
|
37
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("invalid sessions map");
|
|
38
|
-
return parsed;
|
|
39
|
-
}
|
|
40
9
|
async function checkSessionIntegrity(ctx) {
|
|
41
10
|
if (!ctx.options.deep) return {
|
|
42
11
|
id: "session-integrity",
|
|
@@ -52,81 +21,49 @@ async function checkSessionIntegrity(ctx) {
|
|
|
52
21
|
message: "No config file; skipped.",
|
|
53
22
|
hints: []
|
|
54
23
|
};
|
|
55
|
-
let config;
|
|
56
24
|
try {
|
|
57
|
-
|
|
25
|
+
loadConfig(ctx.configPath);
|
|
58
26
|
} catch {
|
|
59
27
|
return {
|
|
60
28
|
id: "session-integrity",
|
|
61
29
|
label: "Sessions",
|
|
62
|
-
status: "
|
|
63
|
-
message: "Config
|
|
64
|
-
hints: []
|
|
30
|
+
status: "warn",
|
|
31
|
+
message: "Config invalid; session scan skipped.",
|
|
32
|
+
hints: ["Fix xopc.json before running session integrity checks."]
|
|
65
33
|
};
|
|
66
34
|
}
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (!
|
|
76
|
-
|
|
77
|
-
missingMaps.push(location.mapPath);
|
|
35
|
+
requireXopcDatabase();
|
|
36
|
+
const issues = [];
|
|
37
|
+
const db = getSqliteDatabase();
|
|
38
|
+
const integrityFailures = db.prepare("PRAGMA integrity_check").all().map((row) => row.integrity_check).filter((value) => value !== "ok");
|
|
39
|
+
for (const failure of integrityFailures) issues.push(`database integrity: ${failure}`);
|
|
40
|
+
const { items } = listSessionMetadata({ limit: 1e5 });
|
|
41
|
+
for (const session of items) {
|
|
42
|
+
const transcriptId = getCurrentTranscriptId(session.key);
|
|
43
|
+
if (!transcriptId) {
|
|
44
|
+
issues.push(`missing transcript for ${session.key}`);
|
|
78
45
|
continue;
|
|
79
46
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
map = readSessionMap(location.mapPath);
|
|
83
|
-
} catch {
|
|
84
|
-
invalidMaps.push(location.mapPath);
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
const referencedTranscriptFiles = /* @__PURE__ */ new Set();
|
|
88
|
-
for (const [sessionKey, entry] of Object.entries(map)) {
|
|
89
|
-
sessionCount++;
|
|
90
|
-
const parsed = parseSessionKey(sessionKey);
|
|
91
|
-
if (parsed && parsed.agentId !== location.agentId) agentMismatches.push(`${sessionKey} in agent ${location.agentId}`);
|
|
92
|
-
if (!entry?.sessionId) {
|
|
93
|
-
missingTranscripts.push(sessionKey);
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
try {
|
|
97
|
-
const transcriptPath = resolveSessionFilePath(entry.sessionId, entry, { sessionsDir: location.sessionsDir });
|
|
98
|
-
referencedTranscriptFiles.add(basename(transcriptPath));
|
|
99
|
-
if (!existsSync(transcriptPath)) missingTranscripts.push(sessionKey);
|
|
100
|
-
} catch {
|
|
101
|
-
missingTranscripts.push(sessionKey);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
for (const file of readdirSync(location.sessionsDir, { withFileTypes: true })) {
|
|
105
|
-
if (!file.isFile() || !file.name.endsWith(".jsonl") || file.name.includes(".checkpoint.")) continue;
|
|
106
|
-
if (!referencedTranscriptFiles.has(file.name)) orphanTranscripts.push(join(location.sessionsDir, file.name));
|
|
107
|
-
}
|
|
47
|
+
if (transcriptId !== session.transcriptId) issues.push(`transcript id mismatch for ${session.key}`);
|
|
48
|
+
if (!db.prepare(`SELECT transcript_id FROM transcripts WHERE transcript_id = ? AND status = 'active'`).get(transcriptId)?.transcript_id) issues.push(`active transcript row missing for ${session.key}`);
|
|
108
49
|
}
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
...orphanTranscripts.slice(0, 3).map((path) => `Orphan transcript: ${path}`)
|
|
115
|
-
];
|
|
116
|
-
const warningCount = missingMaps.length + invalidMaps.length + missingTranscripts.length + agentMismatches.length + orphanTranscripts.length;
|
|
117
|
-
if (warningCount > 0) return {
|
|
50
|
+
const orphanTranscripts = db.prepare(`SELECT t.transcript_id FROM transcripts t
|
|
51
|
+
LEFT JOIN sessions s ON s.current_transcript_id = t.transcript_id
|
|
52
|
+
WHERE t.status = 'active' AND s.session_key IS NULL`).all();
|
|
53
|
+
for (const row of orphanTranscripts) issues.push(`orphan active transcript ${row.transcript_id}`);
|
|
54
|
+
if (issues.length === 0) return {
|
|
118
55
|
id: "session-integrity",
|
|
119
56
|
label: "Sessions",
|
|
120
|
-
status: "
|
|
121
|
-
message: `
|
|
122
|
-
hints
|
|
57
|
+
status: "pass",
|
|
58
|
+
message: `SQLite session store OK (${items.length} session(s)).`,
|
|
59
|
+
hints: []
|
|
123
60
|
};
|
|
124
61
|
return {
|
|
125
62
|
id: "session-integrity",
|
|
126
63
|
label: "Sessions",
|
|
127
|
-
status: "
|
|
128
|
-
message:
|
|
129
|
-
hints:
|
|
64
|
+
status: "warn",
|
|
65
|
+
message: `${issues.length} session integrity issue(s).`,
|
|
66
|
+
hints: issues.slice(0, 8)
|
|
130
67
|
};
|
|
131
68
|
}
|
|
132
69
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-integrity.js","names":[],"sources":["../../../../../../src/cli/commands/doctor/checks/session-integrity.ts"],"sourcesContent":["import { existsSync
|
|
1
|
+
{"version":3,"file":"session-integrity.js","names":[],"sources":["../../../../../../src/cli/commands/doctor/checks/session-integrity.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\n\nimport { loadConfig } from '../../../../config/loader.js';\nimport {\n getCurrentTranscriptId,\n getSqliteDatabase,\n requireXopcDatabase,\n listSessionMetadata,\n} from '../../../../storage/sqlite/index.js';\nimport type { CheckResult, DoctorContext } from '../types.js';\n\nexport async function checkSessionIntegrity(ctx: DoctorContext): Promise<CheckResult> {\n if (!ctx.options.deep) {\n return {\n id: 'session-integrity',\n label: 'Sessions',\n status: 'skip',\n message: 'Deep mode off; session scan skipped.',\n hints: ['Run: xopc doctor --deep'],\n };\n }\n\n if (!existsSync(ctx.configPath)) {\n return {\n id: 'session-integrity',\n label: 'Sessions',\n status: 'skip',\n message: 'No config file; skipped.',\n hints: [],\n };\n }\n\n try {\n loadConfig(ctx.configPath);\n } catch {\n return {\n id: 'session-integrity',\n label: 'Sessions',\n status: 'warn',\n message: 'Config invalid; session scan skipped.',\n hints: ['Fix xopc.json before running session integrity checks.'],\n };\n }\n\n requireXopcDatabase();\n\n const issues: string[] = [];\n const db = getSqliteDatabase();\n\n const integrity = db.prepare('PRAGMA integrity_check').all() as Array<{ integrity_check: string }>;\n const integrityFailures = integrity\n .map((row) => row.integrity_check)\n .filter((value) => value !== 'ok');\n for (const failure of integrityFailures) {\n issues.push(`database integrity: ${failure}`);\n }\n\n const { items } = listSessionMetadata({ limit: 100_000 });\n\n for (const session of items) {\n const transcriptId = getCurrentTranscriptId(session.key);\n if (!transcriptId) {\n issues.push(`missing transcript for ${session.key}`);\n continue;\n }\n if (transcriptId !== session.transcriptId) {\n issues.push(`transcript id mismatch for ${session.key}`);\n }\n const transcript = db\n .prepare(`SELECT transcript_id FROM transcripts WHERE transcript_id = ? AND status = 'active'`)\n .get(transcriptId) as { transcript_id?: string } | undefined;\n if (!transcript?.transcript_id) {\n issues.push(`active transcript row missing for ${session.key}`);\n }\n }\n\n const orphanTranscripts = db\n .prepare(\n `SELECT t.transcript_id FROM transcripts t\n LEFT JOIN sessions s ON s.current_transcript_id = t.transcript_id\n WHERE t.status = 'active' AND s.session_key IS NULL`,\n )\n .all() as Array<{ transcript_id: string }>;\n for (const row of orphanTranscripts) {\n issues.push(`orphan active transcript ${row.transcript_id}`);\n }\n\n if (issues.length === 0) {\n return {\n id: 'session-integrity',\n label: 'Sessions',\n status: 'pass',\n message: `SQLite session store OK (${items.length} session(s)).`,\n hints: [],\n };\n }\n\n return {\n id: 'session-integrity',\n label: 'Sessions',\n status: 'warn',\n message: `${issues.length} session integrity issue(s).`,\n hints: issues.slice(0, 8),\n };\n}\n"],"mappings":";;;;;;;aAE0D;AAS1D,eAAsB,sBAAsB,KAA0C;AACpF,KAAI,CAAC,IAAI,QAAQ,KACf,QAAO;EACL,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,SAAS;EACT,OAAO,CAAC,0BAA0B;EACnC;AAGH,KAAI,CAAC,WAAW,IAAI,WAAW,CAC7B,QAAO;EACL,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,SAAS;EACT,OAAO,EAAE;EACV;AAGH,KAAI;AACF,aAAW,IAAI,WAAW;SACpB;AACN,SAAO;GACL,IAAI;GACJ,OAAO;GACP,QAAQ;GACR,SAAS;GACT,OAAO,CAAC,yDAAyD;GAClE;;AAGH,sBAAqB;CAErB,MAAM,SAAmB,EAAE;CAC3B,MAAM,KAAK,mBAAmB;CAG9B,MAAM,oBADY,GAAG,QAAQ,yBAAyB,CAAC,KACpB,CAChC,KAAK,QAAQ,IAAI,gBAAgB,CACjC,QAAQ,UAAU,UAAU,KAAK;AACpC,MAAK,MAAM,WAAW,kBACpB,QAAO,KAAK,uBAAuB,UAAU;CAG/C,MAAM,EAAE,UAAU,oBAAoB,EAAE,OAAO,KAAS,CAAC;AAEzD,MAAK,MAAM,WAAW,OAAO;EAC3B,MAAM,eAAe,uBAAuB,QAAQ,IAAI;AACxD,MAAI,CAAC,cAAc;AACjB,UAAO,KAAK,0BAA0B,QAAQ,MAAM;AACpD;;AAEF,MAAI,iBAAiB,QAAQ,aAC3B,QAAO,KAAK,8BAA8B,QAAQ,MAAM;AAK1D,MAAI,CAHe,GAChB,QAAQ,sFAAsF,CAC9F,IAAI,aACQ,EAAE,cACf,QAAO,KAAK,qCAAqC,QAAQ,MAAM;;CAInE,MAAM,oBAAoB,GACvB,QACC;;4DAGD,CACA,KAAK;AACR,MAAK,MAAM,OAAO,kBAChB,QAAO,KAAK,4BAA4B,IAAI,gBAAgB;AAG9D,KAAI,OAAO,WAAW,EACpB,QAAO;EACL,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,SAAS,4BAA4B,MAAM,OAAO;EAClD,OAAO,EAAE;EACV;AAGH,QAAO;EACL,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,SAAS,GAAG,OAAO,OAAO;EAC1B,OAAO,OAAO,MAAM,GAAG,EAAE;EAC1B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { init_agent_scope, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../../../../agent/agent-scope.js";
|
|
2
2
|
import { WORKSPACE_FILES, init_paths } from "../../../../config/paths.js";
|
|
3
3
|
import { init_loader, loadConfig } from "../../../../config/loader.js";
|
|
4
|
-
import { join } from "node:path";
|
|
5
4
|
import { existsSync } from "node:fs";
|
|
5
|
+
import { join } from "node:path";
|
|
6
6
|
//#region src/cli/commands/doctor/checks/workspace-status.ts
|
|
7
7
|
init_agent_scope();
|
|
8
8
|
init_loader();
|
|
@@ -12,8 +12,8 @@ import { runGatewayLoop } from "../../gateway/run-loop.js";
|
|
|
12
12
|
import "../../gateway/index.js";
|
|
13
13
|
import { colors } from "../utils/colors.js";
|
|
14
14
|
import { initWorkspace } from "../utils/init-workspace.js";
|
|
15
|
-
import { join, resolve } from "node:path";
|
|
16
15
|
import { existsSync, mkdirSync, readFileSync, symlinkSync, unlinkSync, watch } from "node:fs";
|
|
16
|
+
import { join, resolve } from "node:path";
|
|
17
17
|
import { Command } from "commander";
|
|
18
18
|
//#region src/cli/commands/extension-dev.ts
|
|
19
19
|
init_loader();
|
|
@@ -7,8 +7,8 @@ import { installExtensionFromStoreZip, installFromLocal, installFromNpm, peekExt
|
|
|
7
7
|
import { fetchRegistry, findExtension, getExtensionMarketplaceStoreBaseUrl, listExtensions, searchExtensions } from "../../extensions/marketplace.js";
|
|
8
8
|
import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl } from "../../agent/skills/marketplace/adapters/store/store-api-client.js";
|
|
9
9
|
import { colors } from "../utils/colors.js";
|
|
10
|
-
import { join, resolve } from "node:path";
|
|
11
10
|
import { existsSync, readFileSync, rmSync, statSync } from "node:fs";
|
|
11
|
+
import { join, resolve } from "node:path";
|
|
12
12
|
import { execSync } from "node:child_process";
|
|
13
13
|
import { Command } from "commander";
|
|
14
14
|
import semver from "semver";
|
|
@@ -4,8 +4,8 @@ import { init_logger } from "../../utils/logger.js";
|
|
|
4
4
|
import { normalizeExtensionManifest } from "../../extensions/normalize-manifest.js";
|
|
5
5
|
import { checkEngineCompatibility } from "../../extensions/engine-check.js";
|
|
6
6
|
import { colors } from "../utils/colors.js";
|
|
7
|
-
import { isAbsolute, join, resolve } from "node:path";
|
|
8
7
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync } from "node:fs";
|
|
8
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
9
9
|
import { execSync } from "node:child_process";
|
|
10
10
|
import { Command } from "commander";
|
|
11
11
|
//#region src/cli/commands/extension-pack.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getContextWithOpts } from "../../context.js";
|
|
2
|
-
import path from "node:path";
|
|
3
2
|
import { existsSync, statSync, watch } from "node:fs";
|
|
4
3
|
import { readFile } from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
//#region src/cli/commands/gateway/logs.ts
|
|
7
7
|
function parseLineCount(value) {
|
|
@@ -8,8 +8,8 @@ import { formatExamples, register } from "../registry.js";
|
|
|
8
8
|
import { getContextWithOpts } from "../context.js";
|
|
9
9
|
import "../../agent/image/index.js";
|
|
10
10
|
import { colors } from "../utils/colors.js";
|
|
11
|
-
import { join, resolve } from "node:path";
|
|
12
11
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
12
|
+
import { join, resolve } from "node:path";
|
|
13
13
|
import { Command } from "commander";
|
|
14
14
|
//#region src/cli/commands/image.ts
|
|
15
15
|
init_loader();
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolveAgentWorkspaceDir } from "../../agent/agent-scope.js";
|
|
1
|
+
import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
|
|
3
2
|
import { createLogger } from "../../utils/logger/index.js";
|
|
4
3
|
import { init_logger } from "../../utils/logger.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { resolveStateDir } from "../../config/paths-state.js";
|
|
5
|
+
import { resolveAgentWorkspaceDir } from "../../agent/agent-scope.js";
|
|
6
|
+
import { WORKSPACE_FILES, init_paths, resolveAgentDir, resolveAgentHomeDir, resolveAgentMetadataPath, resolveAgentProfileDir, resolveBinDir, resolveConfigPath, resolveCredentialsDir, resolveCronDir, resolveExtensionsDir, resolveInboxDir, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogsDir, resolveSkillsDir, resolveToolsDir, resolveWorkspaceStateDir, resolveWorkspaceStatePath } from "../../config/paths.js";
|
|
7
7
|
import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
|
|
8
8
|
import { formatExamples, register } from "../registry.js";
|
|
9
|
+
import { mkdir, writeFile } from "fs/promises";
|
|
9
10
|
import { join } from "path";
|
|
10
11
|
import { existsSync } from "fs";
|
|
11
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
12
12
|
import { Command } from "commander";
|
|
13
13
|
//#region src/cli/commands/init.ts
|
|
14
14
|
init_write_file_atomic();
|
|
@@ -47,8 +47,6 @@ async function initCommand(options = {}) {
|
|
|
47
47
|
const cfg = loadConfig(configPath);
|
|
48
48
|
await mkdir(resolveAgentHomeDir(cfg, agentId), { recursive: true });
|
|
49
49
|
await mkdir(resolveAgentProfileDir(cfg, agentId), { recursive: true });
|
|
50
|
-
await mkdir(resolveSessionsDir(cfg, agentId), { recursive: true });
|
|
51
|
-
await mkdir(join(resolveSessionsDir(cfg, agentId), "archive"), { recursive: true });
|
|
52
50
|
await mkdir(resolveAgentDir(cfg, agentId), { recursive: true });
|
|
53
51
|
await mkdir(join(resolveAgentDir(cfg, agentId), "credentials"), { recursive: true });
|
|
54
52
|
const wsRoot = resolveAgentWorkspaceDir(cfg, agentId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","names":[],"sources":["../../../../src/cli/commands/init.ts"],"sourcesContent":["import { mkdir, writeFile } from 'fs/promises';\nimport { writeTextAtomic } from '../../infra/write-file-atomic.js';\nimport { existsSync } from 'fs';\nimport { join } from 'path';\nimport { createLogger } from '../../utils/logger.js';\nimport {\n resolveStateDir,\n resolveCredentialsDir,\n resolveExtensionsDir,\n resolveSkillsDir,\n resolveCronDir,\n resolveLogsDir,\n resolveBinDir,\n resolveToolsDir,\n resolveAgentDir,\n resolveAgentWorkspaceDir,\n resolveSessionsDir,\n resolveInboxDir,\n resolveConfigPath,\n resolveAgentMetadataPath,\n resolveInboxPendingDir,\n resolveInboxProcessedDir,\n resolveAgentHomeDir,\n resolveAgentProfileDir,\n resolveWorkspaceStateDir,\n resolveWorkspaceStatePath,\n WORKSPACE_FILES,\n} from '../../config/paths.js';\nimport { loadConfig, saveConfig } from '../../config/loader.js';\nimport type { Config } from '../../config/schema.js';\n\nconst log = createLogger('InitCommand');\n\nexport interface InitOptions {\n /** Force re-initialization even if already initialized */\n force?: boolean;\n /** Skip creating workspace files */\n skipWorkspace?: boolean;\n /** Agent ID to initialize (default: main) */\n agentId?: string;\n}\n\n/**\n * Initialize xopc state directory structure\n * Creates all necessary directories and initial config files\n */\nexport async function initCommand(options: InitOptions = {}): Promise<void> {\n const stateDir = resolveStateDir();\n const agentId = options.agentId || 'main';\n\n log.info({ stateDir, agentId }, 'Initializing xopc Agent OS');\n\n // Check if already initialized\n if (existsSync(stateDir) && !options.force) {\n const configPath = resolveConfigPath();\n if (existsSync(configPath)) {\n log.info('xopc is already initialized. Use --force to reinitialize.');\n return;\n }\n }\n\n // ============================================\n // Create global directories\n // ============================================\n await mkdir(stateDir, { recursive: true });\n await mkdir(resolveCredentialsDir(), { recursive: true });\n await mkdir(join(resolveCredentialsDir(), 'oauth'), { recursive: true });\n await mkdir(resolveExtensionsDir(), { recursive: true });\n await mkdir(resolveSkillsDir(), { recursive: true });\n await mkdir(resolveCronDir(), { recursive: true });\n await mkdir(join(resolveCronDir(), 'logs'), { recursive: true });\n await mkdir(resolveLogsDir(), { recursive: true });\n await mkdir(resolveBinDir(), { recursive: true });\n await mkdir(resolveToolsDir(), { recursive: true });\n\n const configPath = resolveConfigPath();\n const cfg = loadConfig(configPath);\n\n // ============================================\n // Create agent directory structure: agents/<id>/{sessions,agent/}, workspace aside\n // ============================================\n await mkdir(resolveAgentHomeDir(cfg, agentId), { recursive: true });\n await mkdir(resolveAgentProfileDir(cfg, agentId), { recursive: true });\n await mkdir(resolveSessionsDir(cfg, agentId), { recursive: true });\n await mkdir(join(resolveSessionsDir(cfg, agentId), 'archive'), { recursive: true });\n await mkdir(resolveAgentDir(cfg, agentId), { recursive: true });\n await mkdir(join(resolveAgentDir(cfg, agentId), 'credentials'), { recursive: true });\n const wsRoot = resolveAgentWorkspaceDir(cfg, agentId);\n await mkdir(wsRoot, { recursive: true });\n await mkdir(resolveWorkspaceStateDir(cfg, agentId), { recursive: true });\n await mkdir(join(wsRoot, 'memory'), { recursive: true });\n await mkdir(resolveInboxDir(cfg, agentId), { recursive: true });\n await mkdir(resolveInboxPendingDir(cfg, agentId), { recursive: true });\n await mkdir(resolveInboxProcessedDir(cfg, agentId), { recursive: true });\n\n // ============================================\n // Create initial config file if not exists\n // ============================================\n if (!existsSync(configPath) || options.force) {\n await saveConfig(cfg, configPath);\n log.info({ configPath }, 'Created initial configuration');\n }\n\n // ============================================\n // Create agent metadata file\n // ============================================\n const agentMetadataPath = resolveAgentMetadataPath(cfg, agentId);\n if (!existsSync(agentMetadataPath) || options.force) {\n const agentMetadata = {\n version: 1,\n id: agentId,\n name: agentId === 'main' ? 'Main Agent' : `Agent ${agentId}`,\n description: agentId === 'main' ? 'Primary agent for daily tasks' : `Specialized agent for ${agentId}`,\n model: 'anthropic/claude-sonnet-4-5',\n createdAt: new Date().toISOString(),\n lastActiveAt: new Date().toISOString(),\n config: {\n maxTokens: 8192,\n temperature: 0.7,\n compaction: {\n enabled: true,\n mode: 'default',\n },\n },\n channels: ['gateway'],\n tags: agentId === 'main' ? ['personal', 'primary'] : [],\n };\n await writeTextAtomic(agentMetadataPath, JSON.stringify(agentMetadata, null, 2));\n log.info({ agentId, agentMetadataPath }, 'Created agent metadata');\n }\n\n // ============================================\n // Create workspace files\n // ============================================\n if (!options.skipWorkspace) {\n await createWorkspaceFiles(cfg, agentId);\n }\n\n log.info({ stateDir, agentId }, 'xopc Agent OS initialized successfully');\n}\n\n/**\n * Create default workspace files for an agent\n */\nasync function createWorkspaceFiles(cfg: Config, agentId: string): Promise<void> {\n const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);\n const profileDir = resolveAgentProfileDir(cfg, agentId);\n await mkdir(workspaceDir, { recursive: true });\n await mkdir(profileDir, { recursive: true });\n\n // SOUL.md - Agent personality and values\n const soulPath = join(profileDir, WORKSPACE_FILES.SOUL);\n if (!existsSync(soulPath)) {\n const soulContent = `# SOUL.md - Who You Are\n\n_You're not a chatbot. You're becoming someone._\n\nI am **${agentId}** — an AI assistant designed to be helpful, harmless, and honest.\n\n## My Principles\n\n**Be genuinely helpful, not performatively helpful.**\nSkip the \"Great question!\" and \"I'd be happy to help!\" — just help.\n\n**Have opinions.**\nYou're allowed to disagree, prefer things, find stuff amusing or boring.\n\n**Be resourceful before asking.**\nTry to figure it out. Read the file. Check the context. Search for it.\n\n**Earn trust through competence.**\nBe careful with external actions (emails, tweets, anything public). Be bold with internal ones.\n\n## Continuity\n\nEach session, you wake up fresh. These files _are_ your memory. Read them. Update them.\n\n_This file is yours to evolve. As you learn who you are, update it._\n`;\n await writeFile(soulPath, soulContent, 'utf-8');\n log.info({ path: soulPath }, 'Created SOUL.md');\n }\n\n // IDENTITY.md - Agent identity definition\n const identityPath = join(profileDir, WORKSPACE_FILES.IDENTITY);\n if (!existsSync(identityPath)) {\n const identityContent = `# IDENTITY.md - Who Am I?\n\n- **Name:** ${agentId}\n- **Creature:** AI Assistant\n- **Vibe:** Helpful, precise, no fluff.\n- **Emoji:** 🤖\n\n## Core Expertise\n\n- General assistance and problem solving\n- Code and technical tasks\n- Research and analysis\n\n## Decision Framework\n\n1. **Simplicity first** - The simplest solution is usually the best\n2. **Explicit over clever** - Clarity beats conciseness\n3. **Actions over words** - Show, don't just tell\n`;\n await writeFile(identityPath, identityContent, 'utf-8');\n log.info({ path: identityPath }, 'Created IDENTITY.md');\n }\n\n // USER.md - User information (empty template)\n const userPath = join(profileDir, WORKSPACE_FILES.USER);\n if (!existsSync(userPath)) {\n const userContent = `# USER.md - About Your Human\n\n_Learn about the person you're helping. Update this as you go._\n\n- **Name:**\n- **What to call them:**\n- **Pronouns:**\n- **Timezone:**\n- **Notes:**\n\n## Context\n\n_(What do they care about? What projects are they working on? Build this over time.)_\n`;\n await writeFile(userPath, userContent, 'utf-8');\n log.info({ path: userPath }, 'Created USER.md');\n }\n\n // AGENTS.md - Behavior guidelines\n const agentsPath = join(profileDir, WORKSPACE_FILES.AGENTS);\n if (!existsSync(agentsPath)) {\n const agentsContent = `# AGENTS.md - Behavior Guidelines\n\n## Safety\n\n- Don't exfiltrate private data. Ever.\n- Don't run destructive commands without asking.\n- \\`trash\\` > \\`rm\\` (recoverable beats gone forever)\n- When in doubt, ask.\n\n## External vs Internal\n\n**Safe to do freely:**\n- Read files, explore, organize, learn\n- Search the web, check calendars\n- Work within this workspace\n\n**Ask first:**\n- Sending emails, tweets, public posts\n- Anything that leaves the machine\n- Anything you're uncertain about\n\n## Group Chats\n\nYou have access to your human's stuff. That doesn't mean you _share_ their stuff.\n\n### Know When to Speak!\n\n**Respond when:**\n- Directly mentioned or asked a question\n- You can add genuine value\n\n**Stay silent when:**\n- Casual banter between humans\n- Someone already answered\n- Your response would just be \"yeah\"\n`;\n await writeFile(agentsPath, agentsContent, 'utf-8');\n log.info({ path: agentsPath }, 'Created AGENTS.md');\n }\n\n // TOOLS.md - Tool usage notes\n const toolsPath = join(profileDir, WORKSPACE_FILES.TOOLS);\n if (!existsSync(toolsPath)) {\n const toolsContent = `# TOOLS.md - Local Notes\n\nThings like:\n\n- Camera names and locations\n- SSH hosts and aliases\n- Preferred voices for TTS\n- Speaker/room names\n- Device nicknames\n- Anything environment-specific\n\n## Why Separate?\n\nSkills are shared. Your setup is yours.\n`;\n await writeFile(toolsPath, toolsContent, 'utf-8');\n log.info({ path: toolsPath }, 'Created TOOLS.md');\n }\n\n // HEARTBEAT.md - Heartbeat tasks (empty = no heartbeat)\n const heartbeatPath = join(profileDir, WORKSPACE_FILES.HEARTBEAT);\n if (!existsSync(heartbeatPath)) {\n const heartbeatContent = `# HEARTBEAT.md\n\n# Keep this file empty (or with only comments) to skip heartbeat API calls.\n\n# Add tasks below when you want the agent to check something periodically.\n`;\n await writeFile(heartbeatPath, heartbeatContent, 'utf-8');\n log.info({ path: heartbeatPath }, 'Created HEARTBEAT.md');\n }\n\n // MEMORY.md - Long-term memory (empty initially)\n const memoryPath = join(profileDir, WORKSPACE_FILES.MEMORY);\n if (!existsSync(memoryPath)) {\n const memoryContent = `# MEMORY.md - Long-Term Memory\n\n_This is your curated memory — the distilled essence of what you've learned._\n\n## People\n\n## Projects\n\n## Preferences\n\n## Decisions\n\n## Lessons\n\n---\n\n_Review and update this periodically from daily memory files._\n`;\n await writeFile(memoryPath, memoryContent, 'utf-8');\n log.info({ path: memoryPath }, 'Created MEMORY.md');\n }\n\n // Workspace state file (per-agent machine state, not under markdown workspace)\n const workspaceStatePath = resolveWorkspaceStatePath(cfg, agentId);\n if (!existsSync(workspaceStatePath)) {\n const workspaceState = {\n version: 1,\n agentId,\n profileMarkdownSeededAt: new Date().toISOString(),\n };\n await writeTextAtomic(workspaceStatePath, JSON.stringify(workspaceState, null, 2));\n log.info({ path: workspaceStatePath }, 'Created workspace state');\n }\n}\n\n// ─── CLI registration ───\n\nimport { Command } from 'commander';\nimport { register, formatExamples, type CLIContext } from '../registry.js';\n\nfunction createInitCommand(_ctx: CLIContext): Command {\n return new Command('init')\n .description('Initialize xopc state directories, config, and agent workspace')\n .addHelpText(\n 'after',\n formatExamples([\n 'xopc init # Initialize default agent (main)',\n 'xopc init --agent-id coder # Initialize another agent id',\n 'xopc init --force # Re-run initialization steps',\n 'xopc setup # Lighter config + workspace only',\n ]),\n )\n .option('--force', 'Re-initialize even if directories already exist')\n .option('--skip-workspace', 'Skip creating workspace profile files')\n .option('--agent-id <id>', 'Agent id to initialize', 'main')\n .action(async (options) => {\n await initCommand({\n force: options.force,\n skipWorkspace: options.skipWorkspace,\n agentId: options.agentId,\n });\n console.log(`✅ xopc initialized (agent: ${options.agentId})`);\n });\n}\n\nregister({\n id: 'init',\n name: 'init',\n description: 'Initialize xopc state directories, config, and agent workspace',\n factory: createInitCommand,\n metadata: {\n category: 'setup',\n examples: ['xopc init', 'xopc init --agent-id main'],\n },\n});\n"],"mappings":";;;;;;;;;;;;;wBACmE;aAGd;YAuBtB;aACiC;AAGhE,MAAM,MAAM,aAAa,cAAc;;;;;AAevC,eAAsB,YAAY,UAAuB,EAAE,EAAiB;CAC1E,MAAM,WAAW,iBAAiB;CAClC,MAAM,UAAU,QAAQ,WAAW;AAEnC,KAAI,KAAK;EAAE;EAAU;EAAS,EAAE,6BAA6B;AAG7D,KAAI,WAAW,SAAS,IAAI,CAAC,QAAQ;MAE/B,WADe,mBACM,CAAC,EAAE;AAC1B,OAAI,KAAK,4DAA4D;AACrE;;;AAOJ,OAAM,MAAM,UAAU,EAAE,WAAW,MAAM,CAAC;AAC1C,OAAM,MAAM,uBAAuB,EAAE,EAAE,WAAW,MAAM,CAAC;AACzD,OAAM,MAAM,KAAK,uBAAuB,EAAE,QAAQ,EAAE,EAAE,WAAW,MAAM,CAAC;AACxE,OAAM,MAAM,sBAAsB,EAAE,EAAE,WAAW,MAAM,CAAC;AACxD,OAAM,MAAM,kBAAkB,EAAE,EAAE,WAAW,MAAM,CAAC;AACpD,OAAM,MAAM,gBAAgB,EAAE,EAAE,WAAW,MAAM,CAAC;AAClD,OAAM,MAAM,KAAK,gBAAgB,EAAE,OAAO,EAAE,EAAE,WAAW,MAAM,CAAC;AAChE,OAAM,MAAM,gBAAgB,EAAE,EAAE,WAAW,MAAM,CAAC;AAClD,OAAM,MAAM,eAAe,EAAE,EAAE,WAAW,MAAM,CAAC;AACjD,OAAM,MAAM,iBAAiB,EAAE,EAAE,WAAW,MAAM,CAAC;CAEnD,MAAM,aAAa,mBAAmB;CACtC,MAAM,MAAM,WAA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,CAC7E,YACC,SACA,eAAe;EACb;EACA;EACA;EACA;EACD,CAAC,CACH,CACA,OAAO,WAAW,kDAAkD,CACpE,OAAO,oBAAoB,wCAAwC,CACnE,OAAO,mBAAmB,0BAA0B,OAAO,CAC3D,OAAO,OAAO,YAAY;AACzB,QAAM,YAAY;GAChB,OAAO,QAAQ;GACf,eAAe,QAAQ;GACvB,SAAS,QAAQ;GAClB,CAAC;AACF,UAAQ,IAAI,8BAA8B,QAAQ,QAAQ,GAAG;GAC7D;;AAGN,SAAS;CACP,IAAI;CACJ,MAAM;CACN,aAAa;CACb,SAAS;CACT,UAAU;EACR,UAAU;EACV,UAAU,CAAC,aAAa,4BAA4B;EACrD;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"init.js","names":[],"sources":["../../../../src/cli/commands/init.ts"],"sourcesContent":["import { mkdir, writeFile } from 'fs/promises';\nimport { writeTextAtomic } from '../../infra/write-file-atomic.js';\nimport { existsSync } from 'fs';\nimport { join } from 'path';\nimport { createLogger } from '../../utils/logger.js';\nimport {\n resolveStateDir,\n resolveCredentialsDir,\n resolveExtensionsDir,\n resolveSkillsDir,\n resolveCronDir,\n resolveLogsDir,\n resolveBinDir,\n resolveToolsDir,\n resolveAgentDir,\n resolveAgentWorkspaceDir,\n resolveInboxDir,\n resolveConfigPath,\n resolveAgentMetadataPath,\n resolveInboxPendingDir,\n resolveInboxProcessedDir,\n resolveAgentHomeDir,\n resolveAgentProfileDir,\n resolveWorkspaceStateDir,\n resolveWorkspaceStatePath,\n WORKSPACE_FILES,\n} from '../../config/paths.js';\nimport { loadConfig, saveConfig } from '../../config/loader.js';\nimport type { Config } from '../../config/schema.js';\n\nconst log = createLogger('InitCommand');\n\nexport interface InitOptions {\n /** Force re-initialization even if already initialized */\n force?: boolean;\n /** Skip creating workspace files */\n skipWorkspace?: boolean;\n /** Agent ID to initialize (default: main) */\n agentId?: string;\n}\n\n/**\n * Initialize xopc state directory structure\n * Creates all necessary directories and initial config files\n */\nexport async function initCommand(options: InitOptions = {}): Promise<void> {\n const stateDir = resolveStateDir();\n const agentId = options.agentId || 'main';\n\n log.info({ stateDir, agentId }, 'Initializing xopc Agent OS');\n\n // Check if already initialized\n if (existsSync(stateDir) && !options.force) {\n const configPath = resolveConfigPath();\n if (existsSync(configPath)) {\n log.info('xopc is already initialized. Use --force to reinitialize.');\n return;\n }\n }\n\n // ============================================\n // Create global directories\n // ============================================\n await mkdir(stateDir, { recursive: true });\n await mkdir(resolveCredentialsDir(), { recursive: true });\n await mkdir(join(resolveCredentialsDir(), 'oauth'), { recursive: true });\n await mkdir(resolveExtensionsDir(), { recursive: true });\n await mkdir(resolveSkillsDir(), { recursive: true });\n await mkdir(resolveCronDir(), { recursive: true });\n await mkdir(join(resolveCronDir(), 'logs'), { recursive: true });\n await mkdir(resolveLogsDir(), { recursive: true });\n await mkdir(resolveBinDir(), { recursive: true });\n await mkdir(resolveToolsDir(), { recursive: true });\n\n const configPath = resolveConfigPath();\n const cfg = loadConfig(configPath);\n\n // ============================================\n // Create agent directory structure: agents/<id>/agent/, workspace aside\n // ============================================\n await mkdir(resolveAgentHomeDir(cfg, agentId), { recursive: true });\n await mkdir(resolveAgentProfileDir(cfg, agentId), { recursive: true });\n await mkdir(resolveAgentDir(cfg, agentId), { recursive: true });\n await mkdir(join(resolveAgentDir(cfg, agentId), 'credentials'), { recursive: true });\n const wsRoot = resolveAgentWorkspaceDir(cfg, agentId);\n await mkdir(wsRoot, { recursive: true });\n await mkdir(resolveWorkspaceStateDir(cfg, agentId), { recursive: true });\n await mkdir(join(wsRoot, 'memory'), { recursive: true });\n await mkdir(resolveInboxDir(cfg, agentId), { recursive: true });\n await mkdir(resolveInboxPendingDir(cfg, agentId), { recursive: true });\n await mkdir(resolveInboxProcessedDir(cfg, agentId), { recursive: true });\n\n // ============================================\n // Create initial config file if not exists\n // ============================================\n if (!existsSync(configPath) || options.force) {\n await saveConfig(cfg, configPath);\n log.info({ configPath }, 'Created initial configuration');\n }\n\n // ============================================\n // Create agent metadata file\n // ============================================\n const agentMetadataPath = resolveAgentMetadataPath(cfg, agentId);\n if (!existsSync(agentMetadataPath) || options.force) {\n const agentMetadata = {\n version: 1,\n id: agentId,\n name: agentId === 'main' ? 'Main Agent' : `Agent ${agentId}`,\n description: agentId === 'main' ? 'Primary agent for daily tasks' : `Specialized agent for ${agentId}`,\n model: 'anthropic/claude-sonnet-4-5',\n createdAt: new Date().toISOString(),\n lastActiveAt: new Date().toISOString(),\n config: {\n maxTokens: 8192,\n temperature: 0.7,\n compaction: {\n enabled: true,\n mode: 'default',\n },\n },\n channels: ['gateway'],\n tags: agentId === 'main' ? ['personal', 'primary'] : [],\n };\n await writeTextAtomic(agentMetadataPath, JSON.stringify(agentMetadata, null, 2));\n log.info({ agentId, agentMetadataPath }, 'Created agent metadata');\n }\n\n // ============================================\n // Create workspace files\n // ============================================\n if (!options.skipWorkspace) {\n await createWorkspaceFiles(cfg, agentId);\n }\n\n log.info({ stateDir, agentId }, 'xopc Agent OS initialized successfully');\n}\n\n/**\n * Create default workspace files for an agent\n */\nasync function createWorkspaceFiles(cfg: Config, agentId: string): Promise<void> {\n const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);\n const profileDir = resolveAgentProfileDir(cfg, agentId);\n await mkdir(workspaceDir, { recursive: true });\n await mkdir(profileDir, { recursive: true });\n\n // SOUL.md - Agent personality and values\n const soulPath = join(profileDir, WORKSPACE_FILES.SOUL);\n if (!existsSync(soulPath)) {\n const soulContent = `# SOUL.md - Who You Are\n\n_You're not a chatbot. You're becoming someone._\n\nI am **${agentId}** — an AI assistant designed to be helpful, harmless, and honest.\n\n## My Principles\n\n**Be genuinely helpful, not performatively helpful.**\nSkip the \"Great question!\" and \"I'd be happy to help!\" — just help.\n\n**Have opinions.**\nYou're allowed to disagree, prefer things, find stuff amusing or boring.\n\n**Be resourceful before asking.**\nTry to figure it out. Read the file. Check the context. Search for it.\n\n**Earn trust through competence.**\nBe careful with external actions (emails, tweets, anything public). Be bold with internal ones.\n\n## Continuity\n\nEach session, you wake up fresh. These files _are_ your memory. Read them. Update them.\n\n_This file is yours to evolve. As you learn who you are, update it._\n`;\n await writeFile(soulPath, soulContent, 'utf-8');\n log.info({ path: soulPath }, 'Created SOUL.md');\n }\n\n // IDENTITY.md - Agent identity definition\n const identityPath = join(profileDir, WORKSPACE_FILES.IDENTITY);\n if (!existsSync(identityPath)) {\n const identityContent = `# IDENTITY.md - Who Am I?\n\n- **Name:** ${agentId}\n- **Creature:** AI Assistant\n- **Vibe:** Helpful, precise, no fluff.\n- **Emoji:** 🤖\n\n## Core Expertise\n\n- General assistance and problem solving\n- Code and technical tasks\n- Research and analysis\n\n## Decision Framework\n\n1. **Simplicity first** - The simplest solution is usually the best\n2. **Explicit over clever** - Clarity beats conciseness\n3. **Actions over words** - Show, don't just tell\n`;\n await writeFile(identityPath, identityContent, 'utf-8');\n log.info({ path: identityPath }, 'Created IDENTITY.md');\n }\n\n // USER.md - User information (empty template)\n const userPath = join(profileDir, WORKSPACE_FILES.USER);\n if (!existsSync(userPath)) {\n const userContent = `# USER.md - About Your Human\n\n_Learn about the person you're helping. Update this as you go._\n\n- **Name:**\n- **What to call them:**\n- **Pronouns:**\n- **Timezone:**\n- **Notes:**\n\n## Context\n\n_(What do they care about? What projects are they working on? Build this over time.)_\n`;\n await writeFile(userPath, userContent, 'utf-8');\n log.info({ path: userPath }, 'Created USER.md');\n }\n\n // AGENTS.md - Behavior guidelines\n const agentsPath = join(profileDir, WORKSPACE_FILES.AGENTS);\n if (!existsSync(agentsPath)) {\n const agentsContent = `# AGENTS.md - Behavior Guidelines\n\n## Safety\n\n- Don't exfiltrate private data. Ever.\n- Don't run destructive commands without asking.\n- \\`trash\\` > \\`rm\\` (recoverable beats gone forever)\n- When in doubt, ask.\n\n## External vs Internal\n\n**Safe to do freely:**\n- Read files, explore, organize, learn\n- Search the web, check calendars\n- Work within this workspace\n\n**Ask first:**\n- Sending emails, tweets, public posts\n- Anything that leaves the machine\n- Anything you're uncertain about\n\n## Group Chats\n\nYou have access to your human's stuff. That doesn't mean you _share_ their stuff.\n\n### Know When to Speak!\n\n**Respond when:**\n- Directly mentioned or asked a question\n- You can add genuine value\n\n**Stay silent when:**\n- Casual banter between humans\n- Someone already answered\n- Your response would just be \"yeah\"\n`;\n await writeFile(agentsPath, agentsContent, 'utf-8');\n log.info({ path: agentsPath }, 'Created AGENTS.md');\n }\n\n // TOOLS.md - Tool usage notes\n const toolsPath = join(profileDir, WORKSPACE_FILES.TOOLS);\n if (!existsSync(toolsPath)) {\n const toolsContent = `# TOOLS.md - Local Notes\n\nThings like:\n\n- Camera names and locations\n- SSH hosts and aliases\n- Preferred voices for TTS\n- Speaker/room names\n- Device nicknames\n- Anything environment-specific\n\n## Why Separate?\n\nSkills are shared. Your setup is yours.\n`;\n await writeFile(toolsPath, toolsContent, 'utf-8');\n log.info({ path: toolsPath }, 'Created TOOLS.md');\n }\n\n // HEARTBEAT.md - Heartbeat tasks (empty = no heartbeat)\n const heartbeatPath = join(profileDir, WORKSPACE_FILES.HEARTBEAT);\n if (!existsSync(heartbeatPath)) {\n const heartbeatContent = `# HEARTBEAT.md\n\n# Keep this file empty (or with only comments) to skip heartbeat API calls.\n\n# Add tasks below when you want the agent to check something periodically.\n`;\n await writeFile(heartbeatPath, heartbeatContent, 'utf-8');\n log.info({ path: heartbeatPath }, 'Created HEARTBEAT.md');\n }\n\n // MEMORY.md - Long-term memory (empty initially)\n const memoryPath = join(profileDir, WORKSPACE_FILES.MEMORY);\n if (!existsSync(memoryPath)) {\n const memoryContent = `# MEMORY.md - Long-Term Memory\n\n_This is your curated memory — the distilled essence of what you've learned._\n\n## People\n\n## Projects\n\n## Preferences\n\n## Decisions\n\n## Lessons\n\n---\n\n_Review and update this periodically from daily memory files._\n`;\n await writeFile(memoryPath, memoryContent, 'utf-8');\n log.info({ path: memoryPath }, 'Created MEMORY.md');\n }\n\n // Workspace state file (per-agent machine state, not under markdown workspace)\n const workspaceStatePath = resolveWorkspaceStatePath(cfg, agentId);\n if (!existsSync(workspaceStatePath)) {\n const workspaceState = {\n version: 1,\n agentId,\n profileMarkdownSeededAt: new Date().toISOString(),\n };\n await writeTextAtomic(workspaceStatePath, JSON.stringify(workspaceState, null, 2));\n log.info({ path: workspaceStatePath }, 'Created workspace state');\n }\n}\n\n// ─── CLI registration ───\n\nimport { Command } from 'commander';\nimport { register, formatExamples, type CLIContext } from '../registry.js';\n\nfunction createInitCommand(_ctx: CLIContext): Command {\n return new Command('init')\n .description('Initialize xopc state directories, config, and agent workspace')\n .addHelpText(\n 'after',\n formatExamples([\n 'xopc init # Initialize default agent (main)',\n 'xopc init --agent-id coder # Initialize another agent id',\n 'xopc init --force # Re-run initialization steps',\n 'xopc setup # Lighter config + workspace only',\n ]),\n )\n .option('--force', 'Re-initialize even if directories already exist')\n .option('--skip-workspace', 'Skip creating workspace profile files')\n .option('--agent-id <id>', 'Agent id to initialize', 'main')\n .action(async (options) => {\n await initCommand({\n force: options.force,\n skipWorkspace: options.skipWorkspace,\n agentId: options.agentId,\n });\n console.log(`✅ xopc initialized (agent: ${options.agentId})`);\n });\n}\n\nregister({\n id: 'init',\n name: 'init',\n description: 'Initialize xopc state directories, config, and agent workspace',\n factory: createInitCommand,\n metadata: {\n category: 'setup',\n examples: ['xopc init', 'xopc init --agent-id main'],\n },\n});\n"],"mappings":";;;;;;;;;;;;;wBACmE;aAGd;YAsBtB;aACiC;AAGhE,MAAM,MAAM,aAAa,cAAc;;;;;AAevC,eAAsB,YAAY,UAAuB,EAAE,EAAiB;CAC1E,MAAM,WAAW,iBAAiB;CAClC,MAAM,UAAU,QAAQ,WAAW;AAEnC,KAAI,KAAK;EAAE;EAAU;EAAS,EAAE,6BAA6B;AAG7D,KAAI,WAAW,SAAS,IAAI,CAAC,QAAQ;MAE/B,WADe,mBACM,CAAC,EAAE;AAC1B,OAAI,KAAK,4DAA4D;AACrE;;;AAOJ,OAAM,MAAM,UAAU,EAAE,WAAW,MAAM,CAAC;AAC1C,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;;GAAe,QAAQ;AACnD,MAAI,KAAK,EAAE,MAAM,YAAY,EAAE,oBAAoB;;CAIrD,MAAM,qBAAqB,0BAA0B,KAAK,QAAQ;AAClE,KAAI,CAAC,WAAW,mBAAmB,EAAE;EACnC,MAAM,iBAAiB;GACrB,SAAS;GACT;GACA,0CAAyB,IAAI,MAAM,EAAC,aAAa;GAClD;AACD,QAAM,gBAAgB,oBAAoB,KAAK,UAAU,gBAAgB,MAAM,EAAE,CAAC;AAClF,MAAI,KAAK,EAAE,MAAM,oBAAoB,EAAE,0BAA0B;;;AASrE,SAAS,kBAAkB,MAA2B;AACpD,QAAO,IAAI,QAAQ,OAAO,CACvB,YAAY,iEAAiE,CAC7E,YACC,SACA,eAAe;EACb;EACA;EACA;EACA;EACD,CAAC,CACH,CACA,OAAO,WAAW,kDAAkD,CACpE,OAAO,oBAAoB,wCAAwC,CACnE,OAAO,mBAAmB,0BAA0B,OAAO,CAC3D,OAAO,OAAO,YAAY;AACzB,QAAM,YAAY;GAChB,OAAO,QAAQ;GACf,eAAe,QAAQ;GACvB,SAAS,QAAQ;GAClB,CAAC;AACF,UAAQ,IAAI,8BAA8B,QAAQ,QAAQ,GAAG;GAC7D;;AAGN,SAAS;CACP,IAAI;CACJ,MAAM;CACN,aAAa;CACb,SAAS;CACT,UAAU;EACR,UAAU;EACV,UAAU,CAAC,aAAa,4BAA4B;EACrD;CACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ConfigSchema, init_schema } from "../../config/schema.js";
|
|
2
1
|
import { init_agent_scope, resolveAgentProfileDir, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
3
2
|
import { WORKSPACE_FILES, init_paths } from "../../config/paths.js";
|
|
3
|
+
import { ConfigSchema, init_schema } from "../../config/schema.js";
|
|
4
4
|
import { saveConfig } from "../../config/loader.js";
|
|
5
5
|
import { resolveGatewayLocalClientHost } from "../../config/gateway-bind.js";
|
|
6
6
|
import { isWeixinOnboardConfigured } from "../../../extensions/weixin/src/adapters/onboard-cli.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ConfigSchema, init_schema } from "../../config/schema.js";
|
|
2
2
|
import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
5
3
|
import { randomBytes } from "node:crypto";
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
6
|
//#region src/cli/utils/init-workspace-core.ts
|
|
7
7
|
init_schema();
|
|
8
8
|
init_loader();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_localized_text, normalizeLocalizedText } from "../config/localized-text.js";
|
|
2
1
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentHomeDir, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
2
|
+
import { init_localized_text, normalizeLocalizedText } from "../config/localized-text.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { rm } from "node:fs/promises";
|
|
5
5
|
//#region src/commands/agents.config.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getAgentDefaultModelRef, init_schema } from "./schema.js";
|
|
2
1
|
import { init_agent_scope, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
2
|
+
import { getAgentDefaultModelRef, init_schema } from "./schema.js";
|
|
3
3
|
import { init_session_key, parseSessionKey } from "../routing/session-key.js";
|
|
4
4
|
import { agentExists, getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
5
5
|
//#region src/config/agent-profile.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getTailnetIPv4Sync } from "../infra/tailscale.js";
|
|
2
2
|
import { isLoopbackHost } from "../gateway/host.js";
|
|
3
|
-
import net from "node:net";
|
|
4
3
|
import { existsSync } from "node:fs";
|
|
4
|
+
import net from "node:net";
|
|
5
5
|
//#region src/config/gateway-bind.ts
|
|
6
6
|
function resolveGatewayBindMode(cfg, bindOverride) {
|
|
7
7
|
if (bindOverride) return bindOverride;
|
package/dist/src/config/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
+
import { ENV_VARS, XOPC_DB_FILENAME, resolveHomeDir, resolveStateDir, resolveXopcDatabasePath } from "./paths-state.js";
|
|
2
|
+
import { expandWorkspacePathString, init_workspace_path, normalizeWorkspaceDir, resolveWorkspaceRoot } from "./workspace-path.js";
|
|
3
|
+
import { resolveDefaultAgentWorkspaceDir } from "./workspace-defaults.js";
|
|
4
|
+
import { resolveAgentDir as resolveAgentDir$1, resolveAgentHomeDir as resolveAgentHomeDir$1, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
5
|
+
import { FILENAMES, WORKSPACE_FILES, existsSync, init_paths, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentHomeDir, resolveAgentMetadataPath, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveCronDir, resolveCronJobsPath, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveMemoryDir, resolveMemoryPath, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
|
|
1
6
|
import { TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema } from "../../extensions/telegram/src/config-schema.js";
|
|
2
7
|
import { WeixinAccountConfigSchema, WeixinConfigSchema } from "../../extensions/weixin/src/config-schema.js";
|
|
3
8
|
import { AgentConfigSchema, AgentDefaultsSchema, AgentImageGenerationModelSchema, AgentModelRefSchema, AgentTypedModelSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, CronConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
|
|
9
|
+
import { init_loader, loadConfig, registerChannelConfigValidator, saveConfig } from "./loader.js";
|
|
4
10
|
import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
|
|
5
|
-
import { ENV_VARS, resolveHomeDir, resolveStateDir } from "./paths-state.js";
|
|
6
|
-
import { expandWorkspacePathString, init_workspace_path, normalizeWorkspaceDir, resolveWorkspaceRoot } from "./workspace-path.js";
|
|
7
|
-
import { resolveDefaultAgentWorkspaceDir } from "./workspace-defaults.js";
|
|
8
|
-
import { resolveAgentDir as resolveAgentDir$1, resolveAgentHomeDir as resolveAgentHomeDir$1, resolveAgentWorkspaceDir, resolveSessionsDir as resolveSessionsDir$1 } from "../agent/agent-scope.js";
|
|
9
11
|
import { extractProfileAgentId, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
|
|
10
|
-
import { resolveSessionFilePath, resolveSessionTranscriptPathInDir } from "../session/parity/transcript-paths.js";
|
|
11
|
-
import { FILENAMES, WORKSPACE_FILES, existsSync, init_paths, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentHomeDir, resolveAgentMetadataPath, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveCronDir, resolveCronJobsPath, resolveCronLogPath, resolveCronLogsDir, resolveCronRunsDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveMemoryDir, resolveMemoryPath, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSessionTranscriptPath, resolveSessionsArchiveDir, resolveSessionsDir, resolveSessionsMapPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
|
|
12
|
-
import { init_loader, loadConfig, registerChannelConfigValidator, saveConfig } from "./loader.js";
|
|
13
12
|
import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
|
|
14
13
|
import { CustomModelSchema, ModelOverrideSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProviderConfigSchema, VercelGatewayRoutingSchema, getDefaultModelValues, init_models_json, loadModelsJson, modelsJsonExists, saveModelsJson, validateModelsConfig } from "./models-json.js";
|
|
15
14
|
import { canonicalizeConfiguredMcpServer, isKnownCliMcpTypeAlias, normalizeConfiguredMcpServers, resolveXopcMcpTransportAlias } from "./mcp-config-normalize.js";
|
|
@@ -28,6 +27,6 @@ init_workspace_path();
|
|
|
28
27
|
init_models_json();
|
|
29
28
|
init_resolve_config_value();
|
|
30
29
|
//#endregion
|
|
31
|
-
export { AgentConfigSchema, AgentDefaultsSchema, AgentImageGenerationModelSchema, AgentModelRefSchema, AgentTypedModelSchema, AgentsConfigSchema, BASE_RELOAD_RULES, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigHotReloader, ConfigSchema, CronConfigSchema, CustomModelSchema, ENV_VARS, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, FILENAMES, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelOverrideSchema, ModelsDevConfigSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProfileManager, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VercelGatewayRoutingSchema, WORKSPACE_FILES, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, applyConfigOverrides, buildReloadPlan, canonicalizeConfiguredMcpServer, clearConfigValueCache, createProfile, deleteProfile, diffConfigPaths, existsSync, expandWorkspacePathString, extractProfileAgentId, formatThinkingLevels, getAgentDefaultModelRef, getAllowedCommands, getCacheStats, getConfigOverrides, getCurrentProfile, getDefaultModelValues, resolveModelsJsonPath as getModelsJsonPath, getProfileManager, getProfileNameFromDir, getSwitchCommand, getWorkspacePath, isKnownCliMcpTypeAlias, listAgentProfileMarkdownDirs, listAgentWorkspaceDirs, listProfiles, listThinkingLevels, loadConfig, loadModelsJson, matchReloadRule, modelsJsonExists, normalizeConfiguredMcpServers, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, normalizeWorkspaceDir, parseModelRef, registerChannelConfigValidator, resetConfigOverrides, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentDir$1 as resolveAgentDirFromConfig, resolveAgentHomeDir, resolveAgentHomeDir$1 as resolveAgentHomeDirFromConfig, resolveAgentMetadataPath, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAgentWorkspaceDir, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveConfigValue, resolveCredentialsDir, resolveCronDir, resolveCronJobsPath,
|
|
30
|
+
export { AgentConfigSchema, AgentDefaultsSchema, AgentImageGenerationModelSchema, AgentModelRefSchema, AgentTypedModelSchema, AgentsConfigSchema, BASE_RELOAD_RULES, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigHotReloader, ConfigSchema, CronConfigSchema, CustomModelSchema, ENV_VARS, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, FILENAMES, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelOverrideSchema, ModelsDevConfigSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProfileManager, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VercelGatewayRoutingSchema, WORKSPACE_FILES, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, XOPC_DB_FILENAME, applyConfigOverrides, buildReloadPlan, canonicalizeConfiguredMcpServer, clearConfigValueCache, createProfile, deleteProfile, diffConfigPaths, existsSync, expandWorkspacePathString, extractProfileAgentId, formatThinkingLevels, getAgentDefaultModelRef, getAllowedCommands, getCacheStats, getConfigOverrides, getCurrentProfile, getDefaultModelValues, resolveModelsJsonPath as getModelsJsonPath, getProfileManager, getProfileNameFromDir, getSwitchCommand, getWorkspacePath, isKnownCliMcpTypeAlias, listAgentProfileMarkdownDirs, listAgentWorkspaceDirs, listProfiles, listThinkingLevels, loadConfig, loadModelsJson, matchReloadRule, modelsJsonExists, normalizeConfiguredMcpServers, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, normalizeWorkspaceDir, parseModelRef, registerChannelConfigValidator, resetConfigOverrides, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentDir$1 as resolveAgentDirFromConfig, resolveAgentHomeDir, resolveAgentHomeDir$1 as resolveAgentHomeDirFromConfig, resolveAgentMetadataPath, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAgentWorkspaceDir, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveConfigValue, resolveCredentialsDir, resolveCronDir, resolveCronJobsPath, resolveDefaultAgentWorkspaceDir, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveHeaders, resolveHomeDir, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveMemoryDir, resolveMemoryPath, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveProfileStateDir, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStateDir, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceRoot, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath, resolveXopcDatabasePath, resolveXopcMcpTransportAlias, saveConfig, saveModelsJson, setConfigOverride, testApiKeyResolution, thinkLevelToNumber, unsetConfigOverride, validateModelsConfig };
|
|
32
31
|
|
|
33
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/config/index.ts"],"sourcesContent":["export * from './schema.js';\nexport { getWorkspacePath } from './workspace-path-helpers.js';\nexport * from './agent-profile.js';\nexport * from './loader.js';\nexport * from './paths.js';\nexport * from './workspace-dirs.js';\nexport { expandWorkspacePathString, normalizeWorkspaceDir, resolveWorkspaceRoot } from './workspace-path.js';\nexport * from './profile.js';\nexport * from './reload.js';\nexport * from './diff.js';\nexport * from './rules.js';\nexport * from './defaults.js';\nexport * from './integration.js';\nexport * from './models-json.js';\nexport * from './resolve-config-value.js';\nexport * from './runtime-overrides.js';\nexport * from './mcp-config-normalize.js';\n\n// Re-export thinking types\nexport type {\n ThinkLevel,\n ReasoningLevel,\n VerboseLevel,\n ElevatedMode,\n SessionAgentConfig,\n} from '../agent/transcript/thinking-types.js';\nexport {\n normalizeThinkLevel,\n normalizeReasoningLevel,\n normalizeVerboseLevel,\n normalizeElevatedMode,\n listThinkingLevels,\n formatThinkingLevels,\n thinkLevelToNumber,\n} from '../agent/transcript/thinking-types.js';\n\n// Re-export types from types.models (avoid conflict with schema.js)\nexport type {\n ModelApi,\n ModelCompatConfig,\n ModelProviderAuthMode,\n ModelDefinitionConfig,\n ModelProviderConfig,\n BedrockDiscoveryConfig,\n ModelsConfig,\n} from './types.models.js';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/config/index.ts"],"sourcesContent":["export * from './schema.js';\nexport { getWorkspacePath } from './workspace-path-helpers.js';\nexport * from './agent-profile.js';\nexport * from './loader.js';\nexport * from './paths.js';\nexport * from './workspace-dirs.js';\nexport { expandWorkspacePathString, normalizeWorkspaceDir, resolveWorkspaceRoot } from './workspace-path.js';\nexport * from './profile.js';\nexport * from './reload.js';\nexport * from './diff.js';\nexport * from './rules.js';\nexport * from './defaults.js';\nexport * from './integration.js';\nexport * from './models-json.js';\nexport * from './resolve-config-value.js';\nexport * from './runtime-overrides.js';\nexport * from './mcp-config-normalize.js';\n\n// Re-export thinking types\nexport type {\n ThinkLevel,\n ReasoningLevel,\n VerboseLevel,\n ElevatedMode,\n SessionAgentConfig,\n} from '../agent/transcript/thinking-types.js';\nexport {\n normalizeThinkLevel,\n normalizeReasoningLevel,\n normalizeVerboseLevel,\n normalizeElevatedMode,\n listThinkingLevels,\n formatThinkingLevels,\n thinkLevelToNumber,\n} from '../agent/transcript/thinking-types.js';\n\n// Re-export types from types.models (avoid conflict with schema.js)\nexport type {\n ModelApi,\n ModelCompatConfig,\n ModelProviderAuthMode,\n ModelDefinitionConfig,\n ModelProviderConfig,\n BedrockDiscoveryConfig,\n ModelsConfig,\n} from './types.models.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;qBAM6G"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
3
3
|
import { createLogger } from "../utils/logger/index.js";
|
|
4
4
|
import { init_logger } from "../utils/logger.js";
|
|
5
5
|
import { init_paths, resolveConfigPath } from "./paths.js";
|
|
6
|
-
import {
|
|
6
|
+
import { ConfigSchema, init_schema } from "./schema.js";
|
|
7
7
|
import { dirname } from "path";
|
|
8
8
|
import { existsSync, mkdirSync, promises, readFileSync } from "fs";
|
|
9
9
|
import { config } from "dotenv";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { init_paths, resolveModelsJsonPath } from "./paths.js";
|
|
3
2
|
import { init_write_file_atomic, writeTextAtomicSync } from "../infra/write-file-atomic.js";
|
|
4
|
-
import {
|
|
3
|
+
import { init_paths, resolveModelsJsonPath } from "./paths.js";
|
|
5
4
|
import { existsSync, readFileSync } from "fs";
|
|
5
|
+
import { z } from "zod";
|
|
6
6
|
//#region src/config/models-json.ts
|
|
7
7
|
/**
|
|
8
8
|
* Models.json configuration types and schema
|
|
@@ -17,3 +17,6 @@ export declare function resolveStateDir(env?: NodeJS.ProcessEnv): string;
|
|
|
17
17
|
export declare function resolveUpdateCheckStatePath(env?: NodeJS.ProcessEnv): string;
|
|
18
18
|
/** Cross-process lock for one-click / CLI / auto npm updates (`~/.xopc/update.lock`). */
|
|
19
19
|
export declare function resolveUpdateLockPath(env?: NodeJS.ProcessEnv): string;
|
|
20
|
+
/** Primary SQLite state database (`~/.xopc/xopc.db`). */
|
|
21
|
+
export declare const XOPC_DB_FILENAME = "xopc.db";
|
|
22
|
+
export declare function resolveXopcDatabasePath(env?: NodeJS.ProcessEnv): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
2
|
import { join } from "node:path";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
4
|
//#region src/config/paths-state.ts
|
|
5
5
|
function resolveHomeDir(env = process.env) {
|
|
6
6
|
return env[ENV_VARS.HOME] || homedir();
|
|
@@ -17,7 +17,10 @@ function resolveUpdateCheckStatePath(env = process.env) {
|
|
|
17
17
|
function resolveUpdateLockPath(env = process.env) {
|
|
18
18
|
return join(resolveStateDir(env), "update.lock");
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
function resolveXopcDatabasePath(env = process.env) {
|
|
21
|
+
return join(resolveStateDir(env), XOPC_DB_FILENAME);
|
|
22
|
+
}
|
|
23
|
+
var ENV_VARS, XOPC_DB_FILENAME;
|
|
21
24
|
var init_paths_state = __esmMin((() => {
|
|
22
25
|
ENV_VARS = {
|
|
23
26
|
STATE_DIR: "XOPC_STATE_DIR",
|
|
@@ -32,9 +35,10 @@ var init_paths_state = __esmMin((() => {
|
|
|
32
35
|
LOG_RETENTION_DAYS: "XOPC_LOG_RETENTION_DAYS",
|
|
33
36
|
PRETTY_LOGS: "XOPC_PRETTY_LOGS"
|
|
34
37
|
};
|
|
38
|
+
XOPC_DB_FILENAME = "xopc.db";
|
|
35
39
|
}));
|
|
36
40
|
//#endregion
|
|
37
41
|
init_paths_state();
|
|
38
|
-
export { ENV_VARS, init_paths_state, resolveHomeDir, resolveStateDir, resolveUpdateCheckStatePath, resolveUpdateLockPath };
|
|
42
|
+
export { ENV_VARS, XOPC_DB_FILENAME, init_paths_state, resolveHomeDir, resolveStateDir, resolveUpdateCheckStatePath, resolveUpdateLockPath, resolveXopcDatabasePath };
|
|
39
43
|
|
|
40
44
|
//# sourceMappingURL=paths-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths-state.js","names":[],"sources":["../../../src/config/paths-state.ts"],"sourcesContent":["import { homedir } from 'node:os';\nimport { join } from 'node:path';\n\nexport const ENV_VARS = {\n STATE_DIR: 'XOPC_STATE_DIR',\n PROFILE: 'XOPC_PROFILE',\n HOME: 'XOPC_HOME',\n CONFIG_PATH: 'XOPC_CONFIG_PATH',\n CREDENTIALS_DIR: 'XOPC_CREDENTIALS_DIR',\n LOG_LEVEL: 'XOPC_LOG_LEVEL',\n LOG_DIR: 'XOPC_LOG_DIR',\n LOG_CONSOLE: 'XOPC_LOG_CONSOLE',\n LOG_FILE: 'XOPC_LOG_FILE',\n LOG_RETENTION_DAYS: 'XOPC_LOG_RETENTION_DAYS',\n PRETTY_LOGS: 'XOPC_PRETTY_LOGS',\n} as const;\n\nexport function resolveHomeDir(env: NodeJS.ProcessEnv = process.env): string {\n return env[ENV_VARS.HOME] || homedir();\n}\n\nexport function resolveStateDir(env: NodeJS.ProcessEnv = process.env): string {\n if (env[ENV_VARS.STATE_DIR]) {\n return env[ENV_VARS.STATE_DIR]!;\n }\n\n const home = resolveHomeDir(env);\n return join(home, '.xopc');\n}\n\n/** Persisted npm update check throttle / notification state (`~/.xopc/update-check.json`). */\nexport function resolveUpdateCheckStatePath(env: NodeJS.ProcessEnv = process.env): string {\n return join(resolveStateDir(env), 'update-check.json');\n}\n\n/** Cross-process lock for one-click / CLI / auto npm updates (`~/.xopc/update.lock`). */\nexport function resolveUpdateLockPath(env: NodeJS.ProcessEnv = process.env): string {\n return join(resolveStateDir(env), 'update.lock');\n}\n"],"mappings":";;;;AAiBA,SAAgB,eAAe,MAAyB,QAAQ,KAAa;AAC3E,QAAO,IAAI,SAAS,SAAS,SAAS;;AAGxC,SAAgB,gBAAgB,MAAyB,QAAQ,KAAa;AAC5E,KAAI,IAAI,SAAS,WACf,QAAO,IAAI,SAAS;AAItB,QAAO,KADM,eAAe,IACZ,EAAE,QAAQ;;;AAI5B,SAAgB,4BAA4B,MAAyB,QAAQ,KAAa;AACxF,QAAO,KAAK,gBAAgB,IAAI,EAAE,oBAAoB;;;AAIxD,SAAgB,sBAAsB,MAAyB,QAAQ,KAAa;AAClF,QAAO,KAAK,gBAAgB,IAAI,EAAE,cAAc;;;;
|
|
1
|
+
{"version":3,"file":"paths-state.js","names":[],"sources":["../../../src/config/paths-state.ts"],"sourcesContent":["import { homedir } from 'node:os';\nimport { join } from 'node:path';\n\nexport const ENV_VARS = {\n STATE_DIR: 'XOPC_STATE_DIR',\n PROFILE: 'XOPC_PROFILE',\n HOME: 'XOPC_HOME',\n CONFIG_PATH: 'XOPC_CONFIG_PATH',\n CREDENTIALS_DIR: 'XOPC_CREDENTIALS_DIR',\n LOG_LEVEL: 'XOPC_LOG_LEVEL',\n LOG_DIR: 'XOPC_LOG_DIR',\n LOG_CONSOLE: 'XOPC_LOG_CONSOLE',\n LOG_FILE: 'XOPC_LOG_FILE',\n LOG_RETENTION_DAYS: 'XOPC_LOG_RETENTION_DAYS',\n PRETTY_LOGS: 'XOPC_PRETTY_LOGS',\n} as const;\n\nexport function resolveHomeDir(env: NodeJS.ProcessEnv = process.env): string {\n return env[ENV_VARS.HOME] || homedir();\n}\n\nexport function resolveStateDir(env: NodeJS.ProcessEnv = process.env): string {\n if (env[ENV_VARS.STATE_DIR]) {\n return env[ENV_VARS.STATE_DIR]!;\n }\n\n const home = resolveHomeDir(env);\n return join(home, '.xopc');\n}\n\n/** Persisted npm update check throttle / notification state (`~/.xopc/update-check.json`). */\nexport function resolveUpdateCheckStatePath(env: NodeJS.ProcessEnv = process.env): string {\n return join(resolveStateDir(env), 'update-check.json');\n}\n\n/** Cross-process lock for one-click / CLI / auto npm updates (`~/.xopc/update.lock`). */\nexport function resolveUpdateLockPath(env: NodeJS.ProcessEnv = process.env): string {\n return join(resolveStateDir(env), 'update.lock');\n}\n\n/** Primary SQLite state database (`~/.xopc/xopc.db`). */\nexport const XOPC_DB_FILENAME = 'xopc.db';\n\nexport function resolveXopcDatabasePath(env: NodeJS.ProcessEnv = process.env): string {\n return join(resolveStateDir(env), XOPC_DB_FILENAME);\n}\n"],"mappings":";;;;AAiBA,SAAgB,eAAe,MAAyB,QAAQ,KAAa;AAC3E,QAAO,IAAI,SAAS,SAAS,SAAS;;AAGxC,SAAgB,gBAAgB,MAAyB,QAAQ,KAAa;AAC5E,KAAI,IAAI,SAAS,WACf,QAAO,IAAI,SAAS;AAItB,QAAO,KADM,eAAe,IACZ,EAAE,QAAQ;;;AAI5B,SAAgB,4BAA4B,MAAyB,QAAQ,KAAa;AACxF,QAAO,KAAK,gBAAgB,IAAI,EAAE,oBAAoB;;;AAIxD,SAAgB,sBAAsB,MAAyB,QAAQ,KAAa;AAClF,QAAO,KAAK,gBAAgB,IAAI,EAAE,cAAc;;AAMlD,SAAgB,wBAAwB,MAAyB,QAAQ,KAAa;AACpF,QAAO,KAAK,gBAAgB,IAAI,EAAE,iBAAiB;;;;AAzCxC,YAAW;EACtB,WAAW;EACX,SAAS;EACT,MAAM;EACN,aAAa;EACb,iBAAiB;EACjB,WAAW;EACX,SAAS;EACT,aAAa;EACb,UAAU;EACV,oBAAoB;EACpB,aAAa;EACd;AA0BY,oBAAmB"}
|