vgxness 1.20.4 → 1.20.6
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/adapters/claude/agent-renderer.js +82 -0
- package/dist/{mcp → adapters/claude/install}/claude-code-agent-config.js +64 -9
- package/dist/{mcp → adapters/claude/install}/claude-code-config.js +28 -6
- package/dist/{mcp → adapters/claude/install}/claude-code-project-memory.js +35 -5
- package/dist/{mcp → adapters/claude/install}/claude-code-scope.js +12 -3
- package/dist/{mcp → adapters/claude/install}/claude-code-user-config.js +26 -5
- package/dist/{mcp → adapters/claude/install}/claude-code-user-memory.js +47 -7
- package/dist/{mcp → adapters/claude/install}/client-install-claude-code-contract.js +45 -8
- package/dist/{mcp → adapters/claude/install}/client-install-claude-code.js +98 -14
- package/dist/adapters/json/agent-renderer.js +104 -0
- package/dist/adapters/opencode/agent-renderer.js +113 -0
- package/dist/{mcp → adapters/opencode/install}/client-install-opencode-contract.js +2 -2
- package/dist/{mcp → adapters/opencode/install}/client-install-opencode.js +1 -1
- package/dist/{mcp → adapters/opencode/install}/opencode-default-agent-config.js +2 -2
- package/dist/{mcp → adapters/opencode/install}/opencode-handoff-preview.js +60 -7
- package/dist/{mcp → adapters/opencode/install}/opencode-visibility.js +1 -1
- package/dist/adapters/provider-renderer.js +6 -0
- package/dist/agents/agent-activation-service.js +1 -263
- package/dist/agents/agent-lookup-contexts.js +1 -28
- package/dist/agents/agent-registry-service.js +1 -81
- package/dist/agents/agent-resolver.js +1 -287
- package/dist/agents/agent-seed-service.js +1 -157
- package/dist/agents/agent-seed-upgrade-service.js +1 -231
- package/dist/agents/agent-selector-resolver.js +1 -28
- package/dist/agents/boot-upgrade.js +1 -59
- package/dist/agents/canonical-agent-manifest.js +1 -245
- package/dist/agents/canonical-agent-projection.js +1 -236
- package/dist/agents/manager-profile-overlay-service.js +1 -60
- package/dist/agents/profile-model-routing.js +1 -30
- package/dist/agents/renderers/claude-renderer.js +1 -82
- package/dist/agents/renderers/index.js +1 -14
- package/dist/agents/renderers/json-renderer.js +1 -104
- package/dist/agents/renderers/opencode-renderer.js +1 -113
- package/dist/agents/renderers/provider-adapter.js +1 -6
- package/dist/agents/repositories/agent-seed-history.js +1 -128
- package/dist/agents/repositories/agents.js +1 -200
- package/dist/agents/repositories/manager-profile-overlays.js +1 -90
- package/dist/agents/schema.js +1 -1
- package/dist/application/agents/agent-activation-service.js +261 -0
- package/dist/application/agents/agent-lookup-contexts.js +28 -0
- package/dist/application/agents/agent-registry-service.js +81 -0
- package/dist/application/agents/agent-resolver.js +287 -0
- package/dist/application/agents/agent-seed-service.js +157 -0
- package/dist/application/agents/agent-seed-upgrade-service.js +231 -0
- package/dist/application/agents/agent-selector-resolver.js +28 -0
- package/dist/application/agents/boot-upgrade.js +59 -0
- package/dist/application/agents/canonical-agent-projection.js +236 -0
- package/dist/application/agents/manager-profile-overlay-service.js +68 -0
- package/dist/application/agents/profile-model-routing.js +30 -0
- package/dist/application/agents/renderers/claude-renderer.js +1 -0
- package/dist/application/agents/renderers/index.js +14 -0
- package/dist/application/agents/renderers/json-renderer.js +1 -0
- package/dist/application/agents/renderers/opencode-renderer.js +1 -0
- package/dist/application/agents/renderers/provider-adapter.js +1 -0
- package/dist/application/memory/active-work-preview.js +75 -0
- package/dist/application/memory/agent-memory-capture-service.js +498 -0
- package/dist/application/memory/import/dry-run-planner.js +58 -0
- package/dist/application/memory/import/index.js +3 -0
- package/dist/application/memory/import/observation-writer.js +226 -0
- package/dist/application/memory/import/package.js +179 -0
- package/dist/application/memory/memory-service.js +202 -0
- package/dist/application/memory/search.js +11 -0
- package/dist/{mcp → application/provider-setup}/provider-change-plan.js +74 -13
- package/dist/{mcp → application/provider-setup}/provider-doctor.js +201 -31
- package/dist/{mcp → application/provider-setup}/provider-health-types.js +1 -1
- package/dist/{mcp → application/provider-setup}/provider-status.js +170 -33
- package/dist/application/runs/execution-planning.js +180 -0
- package/dist/application/runs/operation-execution.js +1 -0
- package/dist/application/runs/operation-retry.js +129 -0
- package/dist/application/runs/resume-after-approval-result.js +88 -0
- package/dist/application/runs/run-insights.js +270 -0
- package/dist/application/runs/run-service.js +1480 -0
- package/dist/application/runs/run-snapshot-export-service.js +31 -0
- package/dist/application/runs/sandbox-process-execution.js +244 -0
- package/dist/application/runs/sandbox-worktree-planning.js +59 -0
- package/dist/application/runs/task-scoped-command-grant-service.js +224 -0
- package/dist/application/sdd/artifact-portability-service.js +137 -0
- package/dist/application/sdd/cockpit-read-model.js +195 -0
- package/dist/application/sdd/sdd-continuation-plan.js +265 -0
- package/dist/application/sdd/sdd-workflow-service.js +892 -0
- package/dist/application/skills/boot-seed.js +42 -0
- package/dist/application/skills/personal-skills.js +41 -0
- package/dist/application/skills/skill-export-service.js +34 -0
- package/dist/application/skills/skill-index-service.js +126 -0
- package/dist/application/skills/skill-payload.js +186 -0
- package/dist/application/skills/skill-registry-service.js +648 -0
- package/dist/application/skills/skill-resolver.js +368 -0
- package/dist/application/skills/skill-seed-service.js +242 -0
- package/dist/application/skills/skill-status-service.js +147 -0
- package/dist/cli/bun-bin.js +0 -0
- package/dist/cli/cli-flags.js +1 -387
- package/dist/cli/cli-help.js +1 -173
- package/dist/cli/cli-helpers.js +1 -77
- package/dist/cli/cli-types.js +1 -1
- package/dist/cli/commands/agent-skill-dispatcher.js +1 -700
- package/dist/cli/commands/index.js +1 -9
- package/dist/cli/commands/interactive-entrypoint-dispatcher.js +1 -14
- package/dist/cli/commands/mcp-dispatcher.js +1 -232
- package/dist/cli/commands/memory-sdd-dispatcher.js +1 -367
- package/dist/cli/commands/run-permission-dispatcher.js +1 -455
- package/dist/cli/commands/setup-dispatcher.js +1 -496
- package/dist/cli/commands/status-dispatcher.js +1 -130
- package/dist/cli/commands/verification-dispatcher.js +1 -47
- package/dist/cli/commands/workflow-dispatcher.js +1 -566
- package/dist/cli/dispatcher.js +1 -247
- package/dist/cli/doctor-renderer.js +1 -26
- package/dist/cli/home-tui-app.js +1 -411
- package/dist/cli/home-tui-controller.js +1 -314
- package/dist/cli/mcp-start-path.js +1 -21
- package/dist/cli/product-resume-renderer.js +1 -32
- package/dist/cli/product-status-renderer.js +1 -81
- package/dist/cli/sdd-renderer.js +1 -247
- package/dist/cli/setup-plan-renderer.js +1 -79
- package/dist/cli/setup-status-renderer.js +1 -50
- package/dist/cli/setup-tui-app.js +1 -130
- package/dist/cli/setup-tui-controller.js +1 -89
- package/dist/cli/tui/focus-reducer.js +1 -0
- package/dist/cli/tui/focus-types.js +1 -0
- package/dist/cli/tui/ink/app-shell.js +1 -0
- package/dist/cli/tui/ink/components.js +1 -38
- package/dist/cli/tui/ink/help-overlay.js +1 -0
- package/dist/cli/tui/ink/state-components.js +1 -0
- package/dist/cli/tui/ink/theme.js +1 -36
- package/dist/cli/tui/key-intents.js +1 -0
- package/dist/cli/tui/keymap.js +1 -20
- package/dist/cli/tui/navigation.js +1 -10
- package/dist/cli/tui/screen-registry.js +1 -0
- package/dist/cli/tui/terminal-capabilities.js +1 -12
- package/dist/cli/tui/tui-types.js +1 -1
- package/dist/cli/tui/visual/badges.js +1 -19
- package/dist/cli/tui/visual/footer.js +1 -27
- package/dist/cli/tui/visual/index.js +1 -3
- package/dist/cli/tui/visual/viewport.js +1 -11
- package/dist/cli/tui-render-helpers.js +1 -200
- package/dist/cli/verification-plan-renderer.js +1 -25
- package/dist/cli/verification-report-renderer.js +1 -19
- package/dist/domain/agents/canonical-agent-manifest.js +355 -0
- package/dist/domain/agents/schema.js +1 -0
- package/dist/domain/memory/active-work-topics.js +64 -0
- package/dist/domain/memory/memory-capture-schema.js +1 -0
- package/dist/domain/memory/schema.js +1 -0
- package/dist/domain/runs/schema.js +5 -0
- package/dist/domain/sdd/cockpit-types.js +1 -0
- package/dist/domain/sdd/schema.js +111 -0
- package/dist/domain/skills/schema.js +1 -0
- package/dist/governance/risk-classifier.js +2 -0
- package/dist/interfaces/cli/bun-bin.js +46 -0
- package/dist/interfaces/cli/cli-flags.js +391 -0
- package/dist/interfaces/cli/cli-help.js +173 -0
- package/dist/interfaces/cli/cli-helpers.js +77 -0
- package/dist/interfaces/cli/cli-types.js +1 -0
- package/dist/interfaces/cli/commands/agent-skill-dispatcher.js +700 -0
- package/dist/interfaces/cli/commands/index.js +9 -0
- package/dist/interfaces/cli/commands/interactive-entrypoint-dispatcher.js +14 -0
- package/dist/interfaces/cli/commands/mcp-dispatcher.js +252 -0
- package/dist/interfaces/cli/commands/memory-sdd-dispatcher.js +367 -0
- package/dist/interfaces/cli/commands/run-permission-dispatcher.js +460 -0
- package/dist/interfaces/cli/commands/setup-dispatcher.js +496 -0
- package/dist/interfaces/cli/commands/status-dispatcher.js +130 -0
- package/dist/interfaces/cli/commands/verification-dispatcher.js +47 -0
- package/dist/interfaces/cli/commands/workflow-dispatcher.js +566 -0
- package/dist/interfaces/cli/dispatcher.js +247 -0
- package/dist/interfaces/cli/doctor-renderer.js +26 -0
- package/dist/interfaces/cli/home-tui-app.js +462 -0
- package/dist/interfaces/cli/home-tui-controller.js +341 -0
- package/dist/interfaces/cli/index.js +27 -0
- package/dist/interfaces/cli/mcp-start-path.js +21 -0
- package/dist/interfaces/cli/product-resume-renderer.js +32 -0
- package/dist/interfaces/cli/product-status-renderer.js +81 -0
- package/dist/interfaces/cli/sdd-renderer.js +247 -0
- package/dist/interfaces/cli/setup-plan-renderer.js +79 -0
- package/dist/interfaces/cli/setup-status-renderer.js +50 -0
- package/dist/interfaces/cli/setup-tui-app.js +135 -0
- package/dist/interfaces/cli/setup-tui-controller.js +89 -0
- package/dist/interfaces/cli/tui/focus-reducer.js +60 -0
- package/dist/interfaces/cli/tui/focus-types.js +10 -0
- package/dist/interfaces/cli/tui/ink/app-shell.js +16 -0
- package/dist/interfaces/cli/tui/ink/components.js +38 -0
- package/dist/interfaces/cli/tui/ink/help-overlay.js +6 -0
- package/dist/interfaces/cli/tui/ink/state-components.js +22 -0
- package/dist/interfaces/cli/tui/ink/theme.js +36 -0
- package/dist/interfaces/cli/tui/key-intents.js +33 -0
- package/dist/interfaces/cli/tui/keymap.js +20 -0
- package/dist/interfaces/cli/tui/navigation.js +10 -0
- package/dist/interfaces/cli/tui/screen-registry.js +43 -0
- package/dist/interfaces/cli/tui/terminal-capabilities.js +12 -0
- package/dist/interfaces/cli/tui/tui-types.js +1 -0
- package/dist/interfaces/cli/tui/visual/badges.js +19 -0
- package/dist/interfaces/cli/tui/visual/footer.js +27 -0
- package/dist/interfaces/cli/tui/visual/index.js +3 -0
- package/dist/interfaces/cli/tui/visual/viewport.js +11 -0
- package/dist/interfaces/cli/tui-render-helpers.js +200 -0
- package/dist/interfaces/cli/verification-plan-renderer.js +25 -0
- package/dist/interfaces/cli/verification-report-renderer.js +19 -0
- package/dist/interfaces/mcp/contracts/agents.js +1 -0
- package/dist/interfaces/mcp/contracts/context.js +1 -0
- package/dist/interfaces/mcp/contracts/governance.js +1 -0
- package/dist/interfaces/mcp/contracts/index.js +1 -0
- package/dist/interfaces/mcp/contracts/memory.js +1 -0
- package/dist/interfaces/mcp/contracts/providers.js +1 -0
- package/dist/interfaces/mcp/contracts/runs.js +1 -0
- package/dist/interfaces/mcp/contracts/sdd.js +1 -0
- package/dist/interfaces/mcp/contracts/sessions.js +1 -0
- package/dist/interfaces/mcp/contracts/skills.js +1 -0
- package/dist/interfaces/mcp/contracts/verification.js +1 -0
- package/dist/interfaces/mcp/control-plane/handlers/agents.js +38 -0
- package/dist/interfaces/mcp/control-plane/handlers/context.js +12 -0
- package/dist/interfaces/mcp/control-plane/handlers/memory.js +95 -0
- package/dist/interfaces/mcp/control-plane/handlers/providers.js +19 -0
- package/dist/interfaces/mcp/control-plane/handlers/runs.js +134 -0
- package/dist/interfaces/mcp/control-plane/handlers/sdd.js +225 -0
- package/dist/interfaces/mcp/control-plane/handlers/sessions.js +39 -0
- package/dist/interfaces/mcp/control-plane/handlers/skills.js +82 -0
- package/dist/interfaces/mcp/control-plane/handlers/verification.js +11 -0
- package/dist/interfaces/mcp/control-plane/types.js +1 -0
- package/dist/interfaces/mcp/control-plane.js +235 -0
- package/dist/interfaces/mcp/schema.js +174 -0
- package/dist/interfaces/mcp/schemas/common.js +121 -0
- package/dist/interfaces/mcp/schemas/inputs/agents.js +69 -0
- package/dist/interfaces/mcp/schemas/inputs/context.js +32 -0
- package/dist/interfaces/mcp/schemas/inputs/governance.js +23 -0
- package/dist/interfaces/mcp/schemas/inputs/index.js +10 -0
- package/dist/interfaces/mcp/schemas/inputs/memory.js +50 -0
- package/dist/interfaces/mcp/schemas/inputs/providers.js +35 -0
- package/dist/interfaces/mcp/schemas/inputs/runs.js +146 -0
- package/dist/interfaces/mcp/schemas/inputs/sdd.js +102 -0
- package/dist/interfaces/mcp/schemas/inputs/sessions.js +32 -0
- package/dist/interfaces/mcp/schemas/inputs/skills.js +231 -0
- package/dist/interfaces/mcp/schemas/inputs/verification.js +9 -0
- package/dist/interfaces/mcp/schemas/outputs/index.js +2 -0
- package/dist/interfaces/mcp/schemas/outputs/providers.js +28 -0
- package/dist/interfaces/mcp/schemas/outputs/sdd.js +166 -0
- package/dist/interfaces/mcp/stdio-server.js +116 -0
- package/dist/interfaces/mcp/validation/agents.js +189 -0
- package/dist/interfaces/mcp/validation/common.js +415 -0
- package/dist/interfaces/mcp/validation/governance.js +50 -0
- package/dist/interfaces/mcp/validation/memory.js +133 -0
- package/dist/interfaces/mcp/validation/providers.js +94 -0
- package/dist/interfaces/mcp/validation/runs.js +514 -0
- package/dist/interfaces/mcp/validation/sdd.js +247 -0
- package/dist/interfaces/mcp/validation/sessions.js +51 -0
- package/dist/interfaces/mcp/validation/skills.js +685 -0
- package/dist/interfaces/mcp/validation/verification.js +24 -0
- package/dist/interfaces/mcp/validation.js +149 -0
- package/dist/mcp/control-plane-snapshot-service.js +65 -2
- package/dist/mcp/control-plane.js +1 -646
- package/dist/mcp/doctor.js +1 -1
- package/dist/mcp/index.js +17 -17
- package/dist/mcp/schema.js +1 -1072
- package/dist/mcp/stdio-server.js +1 -116
- package/dist/mcp/validation.js +1 -2239
- package/dist/memory/active-work-preview.js +1 -75
- package/dist/memory/active-work-topics.js +1 -64
- package/dist/memory/agent-memory-capture-service.js +1 -497
- package/dist/memory/import/dry-run-planner.js +1 -58
- package/dist/memory/import/index.js +1 -3
- package/dist/memory/import/observation-writer.js +1 -226
- package/dist/memory/import/package.js +1 -179
- package/dist/memory/memory-capture-schema.js +1 -1
- package/dist/memory/memory-service.js +1 -201
- package/dist/memory/repositories/artifacts.js +1 -67
- package/dist/memory/repositories/observations.js +1 -217
- package/dist/memory/repositories/sessions.js +1 -125
- package/dist/memory/repositories/traces.js +1 -78
- package/dist/memory/schema.js +1 -1
- package/dist/memory/search.js +1 -11
- package/dist/memory/sqlite/database.js +1 -228
- package/dist/memory/storage-paths.js +1 -72
- package/dist/payload/context-budget-policy.js +10 -0
- package/dist/payload/context-budget-service.js +26 -0
- package/dist/payload/payload-diagnostics.js +50 -0
- package/dist/permissions/explicit-request-authorization.js +126 -0
- package/dist/permissions/policy-evaluator.js +54 -14
- package/dist/runs/execution-planning.js +1 -178
- package/dist/runs/operation-execution.js +1 -1
- package/dist/runs/operation-retry.js +1 -129
- package/dist/runs/repositories/runs.js +1 -676
- package/dist/runs/repositories/task-scoped-command-grants.js +1 -462
- package/dist/runs/resume-after-approval-result.js +1 -84
- package/dist/runs/run-insights.js +1 -270
- package/dist/runs/run-service.js +1 -1439
- package/dist/runs/run-snapshot-export-service.js +1 -31
- package/dist/runs/sandbox-process-execution.js +1 -240
- package/dist/runs/sandbox-worktree-planning.js +1 -59
- package/dist/runs/schema.js +1 -5
- package/dist/runs/task-scoped-command-grant-service.js +1 -216
- package/dist/sdd/artifact-portability-service.js +1 -137
- package/dist/sdd/cockpit-read-model.js +1 -195
- package/dist/sdd/cockpit-types.js +1 -1
- package/dist/sdd/schema.js +1 -111
- package/dist/sdd/sdd-continuation-plan.js +1 -265
- package/dist/sdd/sdd-workflow-service.js +1 -822
- package/dist/setup/providers/claude-setup-adapter.js +11 -4
- package/dist/setup/providers/opencode-setup-adapter.js +10 -7
- package/dist/setup/setup-plan.js +20 -7
- package/dist/skills/boot-seed.js +1 -42
- package/dist/skills/personal-skills.js +1 -41
- package/dist/skills/repositories/skill-evaluation-requests.js +1 -190
- package/dist/skills/repositories/skill-evaluation-scenarios.js +1 -305
- package/dist/skills/repositories/skill-improvement-proposals.js +1 -355
- package/dist/skills/repositories/skills.js +1 -1077
- package/dist/skills/schema.js +1 -1
- package/dist/skills/skill-export-service.js +1 -34
- package/dist/skills/skill-index-service.js +1 -126
- package/dist/skills/skill-payload.js +1 -186
- package/dist/skills/skill-registry-service.js +1 -644
- package/dist/skills/skill-resolver.js +1 -368
- package/dist/skills/skill-seed-service.js +1 -242
- package/dist/skills/skill-status-service.js +1 -147
- package/dist/storage/agents/repositories/agent-seed-history.js +128 -0
- package/dist/storage/agents/repositories/agents.js +200 -0
- package/dist/storage/agents/repositories/manager-profile-overlays.js +90 -0
- package/dist/storage/memory/repositories/artifacts.js +67 -0
- package/dist/storage/memory/repositories/observations.js +217 -0
- package/dist/storage/memory/repositories/sessions.js +125 -0
- package/dist/storage/memory/repositories/traces.js +78 -0
- package/dist/storage/memory/sqlite/database.js +228 -0
- package/dist/storage/memory/storage-paths.js +72 -0
- package/dist/storage/runs/repositories/runs.js +676 -0
- package/dist/storage/runs/repositories/task-scoped-command-grants.js +464 -0
- package/dist/storage/skills/repositories/skill-evaluation-requests.js +190 -0
- package/dist/storage/skills/repositories/skill-evaluation-scenarios.js +305 -0
- package/dist/storage/skills/repositories/skill-improvement-proposals.js +355 -0
- package/dist/storage/skills/repositories/skills.js +1084 -0
- package/docs/architecture.md +2 -2
- package/docs/glossary.md +1 -1
- package/docs/mcp.md +1 -1
- package/docs/module-boundaries.md +114 -0
- package/docs/prd.md +1 -1
- package/docs/project-health-audit-v1.10.x.md +1 -1
- package/docs/providers.md +2 -2
- package/docs/safety.md +3 -3
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/apply-progress.md +122 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/archive-report.md +61 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/design.md +66 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/proposal.md +79 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/spec.md +67 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/tasks.md +63 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/verify-report.md +71 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/apply-progress.md +68 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/archive-report.md +61 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/design.md +43 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/proposal.md +61 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/spec.md +31 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/tasks.md +27 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/verify-report.md +58 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/apply-progress.md +65 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/archive-report.md +53 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/design.md +64 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/proposal.md +62 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/spec.md +51 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/tasks.md +50 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/verify-report.md +66 -0
- package/docs/storage.md +2 -2
- package/package.json +2 -2
- /package/dist/{mcp → adapters/claude/install}/claude-code-cli.js +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/001_initial.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/002_observation_revisions.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/003_agent_registry.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/004_run_runtime.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/005_run_approvals.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/006_run_operation_attempts.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/007_abandoned_operation_attempts.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/008_run_execution_plan_events.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/009_multiple_operation_attempts.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/010_skill_registry.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/011_skill_usage_resolution_outcomes.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/012_skill_improvement_proposals.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/013_skill_evaluation_scenarios.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/014_manager_profile_overlays.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/015_artifact_metadata.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/016_agent_seed_history.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/017_intent_signal_skill_targets.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/018_skill_system_v2.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/019_task_scoped_command_grants.sql +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { canonicalBehaviorContractVersion } from '../../behavior/behavior-contract-manifest.js';
|
|
2
|
+
import { canonicalPromptContractVersion } from '../../domain/agents/canonical-agent-manifest.js';
|
|
3
|
+
import { ok, validationFailure } from '../provider-renderer.js';
|
|
4
|
+
const previewWarnings = [
|
|
5
|
+
'Claude rendering returns installable preview artifacts only; it does not install and does not write provider configuration.',
|
|
6
|
+
'VGX does not execute Claude or run Claude Code from this preview.',
|
|
7
|
+
'VGXNESS does not install Claude Code or write provider configuration from renderer previews; project-root CLAUDE.md is only managed by confirmed/preflighted Claude project install.',
|
|
8
|
+
'VGX does not guarantee exact Claude Code configuration compatibility; this output is a neutral preview only.',
|
|
9
|
+
];
|
|
10
|
+
const _previewSafety = {
|
|
11
|
+
executesProvider: false,
|
|
12
|
+
writesProviderConfig: false,
|
|
13
|
+
installable: true,
|
|
14
|
+
previewOnly: true,
|
|
15
|
+
};
|
|
16
|
+
const claudeCapabilities = {
|
|
17
|
+
supportedAgentFields: ['name', 'description', 'instructions', 'mode', 'adapter model', 'adapter profile', 'permissions', 'memory', 'skills'],
|
|
18
|
+
skillInjectionModes: ['included as neutral skill identifiers in preview output'],
|
|
19
|
+
permissionCategories: ['included as registry permission metadata in preview output'],
|
|
20
|
+
memoryInjectionModes: ['included as registry memory metadata in preview output'],
|
|
21
|
+
delegationModel: 'registry agents and subagents are represented in preview output without executing Claude delegation',
|
|
22
|
+
lifecycleHooks: ['preview render/export only; confirmed install is handled by MCP install service'],
|
|
23
|
+
configFileLocations: ['rendered/claude/.../.mcp.json', 'rendered/claude/.../.claude/agents/*.md'],
|
|
24
|
+
limitations: [
|
|
25
|
+
'Preview artifacts only; does not execute Claude or Claude Code.',
|
|
26
|
+
'Does not install Claude Code or provider tooling.',
|
|
27
|
+
'Renderer preview does not write .claude/, CLAUDE.md, or provider configuration.',
|
|
28
|
+
'Confirmed apply writes only project .mcp.json, .claude/agents/*.md, and the project-root CLAUDE.md managed block.',
|
|
29
|
+
'Claude Code compatibility can drift; validate with provider doctor after confirmed install.',
|
|
30
|
+
],
|
|
31
|
+
render: {
|
|
32
|
+
format: 'claude-code-project-preview',
|
|
33
|
+
artifactContentTypes: ['application/json', 'text/markdown'],
|
|
34
|
+
installable: true,
|
|
35
|
+
previewOnly: true,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export class ClaudeAgentRenderer {
|
|
39
|
+
provider = 'claude';
|
|
40
|
+
capabilities = claudeCapabilities;
|
|
41
|
+
render(input) {
|
|
42
|
+
const agents = [input.agent, ...(input.subagents ?? [])];
|
|
43
|
+
const artifacts = [
|
|
44
|
+
{
|
|
45
|
+
relativePath: `rendered/claude/${pathSegment(input.agent.project)}/${input.agent.scope}/${pathSegment(input.agent.name)}/.mcp.json`,
|
|
46
|
+
contentType: 'application/json',
|
|
47
|
+
contents: `${JSON.stringify({ mcpServers: { vgxness: { type: 'stdio', command: 'vgxness', args: ['mcp', 'start'] } } }, null, 2)}\n`,
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
const renderedKeys = new Set();
|
|
51
|
+
for (const agent of agents) {
|
|
52
|
+
const key = claudeAgentKey(agent.name);
|
|
53
|
+
if (renderedKeys.has(key))
|
|
54
|
+
return validationFailure(`Rendered Claude agent key collision: ${key}`);
|
|
55
|
+
renderedKeys.add(key);
|
|
56
|
+
artifacts.push({
|
|
57
|
+
relativePath: `rendered/claude/${pathSegment(input.agent.project)}/${input.agent.scope}/${pathSegment(input.agent.name)}/.claude/agents/${key}.md`,
|
|
58
|
+
contentType: 'text/markdown',
|
|
59
|
+
contents: renderClaudeAgentMarkdown(agent, key),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return ok({
|
|
63
|
+
provider: this.provider,
|
|
64
|
+
installable: true,
|
|
65
|
+
artifacts,
|
|
66
|
+
warnings: previewWarnings,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function renderClaudeAgentMarkdown(agent, key) {
|
|
71
|
+
return `---\nname: ${JSON.stringify(key)}\ndescription: ${JSON.stringify(agent.description)}\n---\n\n<!-- VGXNESS-GENERATED claude-code-provider-support provider=claude artifact=claude-code-subagent promptContractVersion=${canonicalPromptContractVersion} behaviorContractVersion=${canonicalBehaviorContractVersion} safe-update=true -->\n\n${agent.instructions.value.trim()}\n`;
|
|
72
|
+
}
|
|
73
|
+
function claudeAgentKey(value) {
|
|
74
|
+
return pathSegment(value);
|
|
75
|
+
}
|
|
76
|
+
function pathSegment(value) {
|
|
77
|
+
return (value
|
|
78
|
+
.trim()
|
|
79
|
+
.toLowerCase()
|
|
80
|
+
.replace(/[^a-z0-9._-]+/g, '-')
|
|
81
|
+
.replace(/^-+|-+$/g, '') || 'unnamed');
|
|
82
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join, parse, resolve } from 'node:path';
|
|
4
|
-
import { projectCanonicalAgentManifestToClaudeCode } from '
|
|
4
|
+
import { projectCanonicalAgentManifestToClaudeCode } from '../../../agents/canonical-agent-projection.js';
|
|
5
5
|
import { assertInsideWorkspace } from './claude-code-config.js';
|
|
6
6
|
export const claudeCodeGeneratedMarker = 'VGXNESS-GENERATED';
|
|
7
7
|
export function expectedClaudeCodeAgentFiles(input) {
|
|
@@ -18,13 +18,28 @@ export function renderClaudeCodeAgentMarkdown(agent) {
|
|
|
18
18
|
}
|
|
19
19
|
export function inspectClaudeCodeAgents(input) {
|
|
20
20
|
const target = typeof input === 'string' ? resolveClaudeAgentTarget({ workspaceRoot: input, scope: 'project' }) : resolveClaudeAgentTarget(input);
|
|
21
|
-
const expected = expectedClaudeCodeAgentFiles({
|
|
22
|
-
|
|
21
|
+
const expected = expectedClaudeCodeAgentFiles({
|
|
22
|
+
workspaceRoot: target.workspaceRoot,
|
|
23
|
+
scope: target.scope,
|
|
24
|
+
...(target.env === undefined ? {} : { env: target.env }),
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
scope: target.scope,
|
|
28
|
+
directoryPath: target.directoryPath,
|
|
29
|
+
directoryExists: existsSync(target.directoryPath),
|
|
30
|
+
external: target.scope === 'user',
|
|
31
|
+
agents: expected.map(inspectAgent),
|
|
32
|
+
};
|
|
23
33
|
}
|
|
24
34
|
export function resolveClaudeAgentTarget(input) {
|
|
25
35
|
const scope = input.scope ?? 'project';
|
|
26
36
|
if (scope === 'project')
|
|
27
|
-
return {
|
|
37
|
+
return {
|
|
38
|
+
workspaceRoot: input.workspaceRoot,
|
|
39
|
+
scope,
|
|
40
|
+
directoryPath: join(input.workspaceRoot, '.claude', 'agents'),
|
|
41
|
+
...(input.env === undefined ? {} : { env: input.env }),
|
|
42
|
+
};
|
|
28
43
|
const home = safeHomeDirectory(input.env);
|
|
29
44
|
return { workspaceRoot: input.workspaceRoot, scope, directoryPath: join(home, '.claude', 'agents'), ...(input.env === undefined ? {} : { env: input.env }) };
|
|
30
45
|
}
|
|
@@ -67,7 +82,15 @@ export function parseClaudeAgentFrontmatter(contents) {
|
|
|
67
82
|
}
|
|
68
83
|
function inspectAgent(agent) {
|
|
69
84
|
if (!existsSync(agent.path))
|
|
70
|
-
return {
|
|
85
|
+
return {
|
|
86
|
+
agentName: agent.name,
|
|
87
|
+
path: agent.path,
|
|
88
|
+
exists: false,
|
|
89
|
+
status: 'missing',
|
|
90
|
+
frontmatter: 'missing',
|
|
91
|
+
generatedMarker: false,
|
|
92
|
+
detail: 'Expected Claude agent file is missing.',
|
|
93
|
+
};
|
|
71
94
|
try {
|
|
72
95
|
const contents = readFileSync(agent.path, 'utf8');
|
|
73
96
|
const frontmatter = parseClaudeAgentFrontmatter(contents);
|
|
@@ -75,14 +98,46 @@ function inspectAgent(agent) {
|
|
|
75
98
|
if (!frontmatter.ok)
|
|
76
99
|
return { agentName: agent.name, path: agent.path, exists: true, status: 'invalid', frontmatter: 'invalid', generatedMarker, detail: frontmatter.reason };
|
|
77
100
|
if (frontmatter.data.name !== agent.name)
|
|
78
|
-
return {
|
|
101
|
+
return {
|
|
102
|
+
agentName: agent.name,
|
|
103
|
+
path: agent.path,
|
|
104
|
+
exists: true,
|
|
105
|
+
status: 'conflicting',
|
|
106
|
+
frontmatter: 'valid',
|
|
107
|
+
generatedMarker,
|
|
108
|
+
detail: `Frontmatter name ${frontmatter.data.name} does not match expected ${agent.name}.`,
|
|
109
|
+
};
|
|
79
110
|
if (!generatedMarker)
|
|
80
|
-
return {
|
|
81
|
-
|
|
111
|
+
return {
|
|
112
|
+
agentName: agent.name,
|
|
113
|
+
path: agent.path,
|
|
114
|
+
exists: true,
|
|
115
|
+
status: 'conflicting',
|
|
116
|
+
frontmatter: 'valid',
|
|
117
|
+
generatedMarker,
|
|
118
|
+
detail: 'Existing agent file is not marked as VGXNESS-generated.',
|
|
119
|
+
};
|
|
120
|
+
return {
|
|
121
|
+
agentName: agent.name,
|
|
122
|
+
path: agent.path,
|
|
123
|
+
exists: true,
|
|
124
|
+
status: 'managed',
|
|
125
|
+
frontmatter: 'valid',
|
|
126
|
+
generatedMarker,
|
|
127
|
+
detail: 'Claude agent file is VGXNESS-managed.',
|
|
128
|
+
};
|
|
82
129
|
}
|
|
83
130
|
catch (cause) {
|
|
84
131
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
85
|
-
return {
|
|
132
|
+
return {
|
|
133
|
+
agentName: agent.name,
|
|
134
|
+
path: agent.path,
|
|
135
|
+
exists: true,
|
|
136
|
+
status: 'invalid',
|
|
137
|
+
frontmatter: 'invalid',
|
|
138
|
+
generatedMarker: false,
|
|
139
|
+
detail: `Unable to read Claude agent file: ${message}`,
|
|
140
|
+
};
|
|
86
141
|
}
|
|
87
142
|
}
|
|
88
143
|
function yamlScalar(value) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
2
|
import { join, relative, resolve } from 'node:path';
|
|
3
|
-
import { providerConfigPathDiagnostics } from '
|
|
3
|
+
import { providerConfigPathDiagnostics, } from '../../../application/provider-setup/provider-health-types.js';
|
|
4
4
|
export function resolveClaudeCodeMcpJsonPath(workspaceRoot) {
|
|
5
5
|
const target = resolve(workspaceRoot, '.mcp.json');
|
|
6
6
|
assertInsideWorkspace(workspaceRoot, target);
|
|
@@ -19,7 +19,8 @@ export function isManagedClaudeArgs(value) {
|
|
|
19
19
|
if (!Array.isArray(value) || !value.every((item) => typeof item === 'string'))
|
|
20
20
|
return false;
|
|
21
21
|
const dbPath = value[3];
|
|
22
|
-
return arraysEqual(value, ['mcp', 'start']) ||
|
|
22
|
+
return (arraysEqual(value, ['mcp', 'start']) ||
|
|
23
|
+
(value.length === 4 && value[0] === 'mcp' && value[1] === 'start' && value[2] === '--db' && typeof dbPath === 'string' && dbPath.trim().length > 0));
|
|
23
24
|
}
|
|
24
25
|
export function inspectClaudeCodeMcpConfig(workspaceRoot) {
|
|
25
26
|
const path = resolveClaudeCodeMcpJsonPath(workspaceRoot);
|
|
@@ -34,10 +35,31 @@ export function inspectClaudeCodeMcpConfig(workspaceRoot) {
|
|
|
34
35
|
}
|
|
35
36
|
const entry = isRecord(parsed.mcpServers) ? parsed.mcpServers.vgxness : undefined;
|
|
36
37
|
if (entry === undefined)
|
|
37
|
-
return {
|
|
38
|
+
return {
|
|
39
|
+
status: 'stale',
|
|
40
|
+
path,
|
|
41
|
+
exists: true,
|
|
42
|
+
parsed: true,
|
|
43
|
+
config: parsed,
|
|
44
|
+
message: 'Claude project .mcp.json is readable but mcpServers.vgxness is missing.',
|
|
45
|
+
};
|
|
38
46
|
if (isManagedClaudeCodeMcpServer(entry))
|
|
39
|
-
return {
|
|
40
|
-
|
|
47
|
+
return {
|
|
48
|
+
status: 'configured',
|
|
49
|
+
path,
|
|
50
|
+
exists: true,
|
|
51
|
+
parsed: true,
|
|
52
|
+
config: parsed,
|
|
53
|
+
message: 'Claude project .mcp.json has a managed mcpServers.vgxness entry.',
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
status: 'conflicting',
|
|
57
|
+
path,
|
|
58
|
+
exists: true,
|
|
59
|
+
parsed: true,
|
|
60
|
+
config: parsed,
|
|
61
|
+
message: 'Claude project .mcp.json has a conflicting mcpServers.vgxness entry.',
|
|
62
|
+
};
|
|
41
63
|
}
|
|
42
64
|
catch (cause) {
|
|
43
65
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
@@ -72,7 +94,7 @@ export function assertInsideWorkspace(workspaceRoot, targetPath) {
|
|
|
72
94
|
const root = resolve(workspaceRoot);
|
|
73
95
|
const target = resolve(targetPath);
|
|
74
96
|
const rel = relative(root, target);
|
|
75
|
-
if (rel === '..' || rel.startsWith(`..${process.platform === 'win32' ? '\\' : '/'}`) || rel === '' && target !== root)
|
|
97
|
+
if (rel === '..' || rel.startsWith(`..${process.platform === 'win32' ? '\\' : '/'}`) || (rel === '' && target !== root))
|
|
76
98
|
throw new Error(`Target path is outside workspace root: ${targetPath}`);
|
|
77
99
|
}
|
|
78
100
|
export function claudeAdvisoryPaths(workspaceRoot) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
|
-
import { projectCanonicalAgentManifestToClaudeProjectMemory } from '
|
|
3
|
+
import { projectCanonicalAgentManifestToClaudeProjectMemory } from '../../../agents/canonical-agent-projection.js';
|
|
4
4
|
import { assertInsideWorkspace } from './claude-code-config.js';
|
|
5
5
|
export const claudeProjectMemoryBeginMarker = '<!-- BEGIN VGXNESS-MANAGED CLAUDE PROJECT MEMORY -->';
|
|
6
6
|
export const claudeProjectMemoryEndMarker = '<!-- END VGXNESS-MANAGED CLAUDE PROJECT MEMORY -->';
|
|
@@ -47,7 +47,15 @@ export function inspectClaudeProjectMemory(workspaceRoot) {
|
|
|
47
47
|
const beginCount = countOccurrences(contents, claudeProjectMemoryBeginMarker);
|
|
48
48
|
const endCount = countOccurrences(contents, claudeProjectMemoryEndMarker);
|
|
49
49
|
if (beginCount === 0 && endCount === 0)
|
|
50
|
-
return {
|
|
50
|
+
return {
|
|
51
|
+
status: 'unmanaged',
|
|
52
|
+
path,
|
|
53
|
+
exists: true,
|
|
54
|
+
action: 'append-managed-block',
|
|
55
|
+
backupRequired: true,
|
|
56
|
+
message: 'Claude project memory exists without a VGXNESS managed block; future apply would append one after backup.',
|
|
57
|
+
contents,
|
|
58
|
+
};
|
|
51
59
|
if (beginCount === 0)
|
|
52
60
|
return blocked(path, true, 'missing_begin_marker', 'Claude project memory has an end marker without a begin marker.');
|
|
53
61
|
if (endCount === 0)
|
|
@@ -71,8 +79,27 @@ export function inspectClaudeProjectMemory(workspaceRoot) {
|
|
|
71
79
|
const expected = renderClaudeProjectMemoryBlock();
|
|
72
80
|
const actual = contents.slice(start, end);
|
|
73
81
|
if (actual === expected)
|
|
74
|
-
return {
|
|
75
|
-
|
|
82
|
+
return {
|
|
83
|
+
status: 'managed-current',
|
|
84
|
+
path,
|
|
85
|
+
exists: true,
|
|
86
|
+
action: 'none',
|
|
87
|
+
backupRequired: false,
|
|
88
|
+
message: 'Claude project memory has the current VGXNESS managed block.',
|
|
89
|
+
blockRange: { start, end },
|
|
90
|
+
contents,
|
|
91
|
+
};
|
|
92
|
+
return {
|
|
93
|
+
status: 'managed-stale',
|
|
94
|
+
path,
|
|
95
|
+
exists: true,
|
|
96
|
+
action: 'update-managed-block',
|
|
97
|
+
backupRequired: true,
|
|
98
|
+
message: 'Claude project memory has a stale VGXNESS managed block; future apply would update only that block after backup.',
|
|
99
|
+
blockRange: { start, end },
|
|
100
|
+
staleReasons: ['managed_block_differs_from_canonical_render'],
|
|
101
|
+
contents,
|
|
102
|
+
};
|
|
76
103
|
}
|
|
77
104
|
export function mergeClaudeProjectMemory(state) {
|
|
78
105
|
const block = renderClaudeProjectMemoryBlock();
|
|
@@ -83,7 +110,10 @@ export function mergeClaudeProjectMemory(state) {
|
|
|
83
110
|
return { ok: true, value: { path: state.path, contents: `${state.contents}${separator}${block}\n` } };
|
|
84
111
|
}
|
|
85
112
|
if (state.status === 'managed-stale')
|
|
86
|
-
return {
|
|
113
|
+
return {
|
|
114
|
+
ok: true,
|
|
115
|
+
value: { path: state.path, contents: state.contents.slice(0, state.blockRange.start) + block + state.contents.slice(state.blockRange.end) },
|
|
116
|
+
};
|
|
87
117
|
if (state.status === 'managed-current')
|
|
88
118
|
return { ok: true, value: { path: state.path, contents: state.contents } };
|
|
89
119
|
return { ok: false, error: { code: 'validation_failed', message: state.message } };
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
export const claudeCodeCanonicalScopes = ['local', 'project', 'user'];
|
|
2
2
|
export function resolveClaudeCodeScope(input, fallback = 'project') {
|
|
3
3
|
if (input !== undefined && input.trim().length === 0)
|
|
4
|
-
return {
|
|
4
|
+
return {
|
|
5
|
+
ok: false,
|
|
6
|
+
error: { code: 'validation_failed', message: '--scope for Claude must be local, project, or user (compatibility aliases: personal, global).' },
|
|
7
|
+
};
|
|
5
8
|
const raw = input?.trim() || fallback;
|
|
6
9
|
if (raw === 'local' || raw === 'project' || raw === 'user')
|
|
7
10
|
return { ok: true, value: { canonical: raw, input: raw, warnings: [] } };
|
|
8
11
|
if (raw === 'personal') {
|
|
9
|
-
return {
|
|
12
|
+
return {
|
|
13
|
+
ok: true,
|
|
14
|
+
value: { canonical: 'user', input: raw, warnings: ['Claude Code scope `personal` is accepted for VGXNESS compatibility and maps to Claude `user`.'] },
|
|
15
|
+
};
|
|
10
16
|
}
|
|
11
17
|
if (raw === 'global') {
|
|
12
18
|
return { ok: true, value: { canonical: 'user', input: raw, warnings: ['Claude Code legacy scope `global` is deprecated and maps to Claude `user`.'] } };
|
|
13
19
|
}
|
|
14
|
-
return {
|
|
20
|
+
return {
|
|
21
|
+
ok: false,
|
|
22
|
+
error: { code: 'validation_failed', message: '--scope for Claude must be local, project, or user (compatibility aliases: personal, global).' },
|
|
23
|
+
};
|
|
15
24
|
}
|
|
16
25
|
export function isClaudeCodeUserScope(scope) {
|
|
17
26
|
return scope === 'user';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
import { providerConfigPathDiagnostics } from '
|
|
4
|
-
import { isManagedClaudeCodeMcpServer } from './claude-code-config.js';
|
|
3
|
+
import { providerConfigPathDiagnostics, } from '../../../application/provider-setup/provider-health-types.js';
|
|
5
4
|
import { safeHomeDirectory } from './claude-code-agent-config.js';
|
|
5
|
+
import { isManagedClaudeCodeMcpServer } from './claude-code-config.js';
|
|
6
6
|
export function resolveClaudeCodeUserMcpJsonPath(env = process.env) {
|
|
7
7
|
return join(safeHomeDirectory(env), '.claude.json');
|
|
8
8
|
}
|
|
@@ -18,10 +18,31 @@ export function inspectClaudeCodeUserMcpConfig(env = process.env) {
|
|
|
18
18
|
return { status: 'invalid', path, exists: true, parsed: false, message: 'Claude user ~/.claude.json mcpServers must be a JSON object.' };
|
|
19
19
|
const entry = isRecord(parsed.mcpServers) ? parsed.mcpServers.vgxness : undefined;
|
|
20
20
|
if (entry === undefined)
|
|
21
|
-
return {
|
|
21
|
+
return {
|
|
22
|
+
status: 'stale',
|
|
23
|
+
path,
|
|
24
|
+
exists: true,
|
|
25
|
+
parsed: true,
|
|
26
|
+
config: parsed,
|
|
27
|
+
message: 'Claude user ~/.claude.json is readable but mcpServers.vgxness is missing.',
|
|
28
|
+
};
|
|
22
29
|
if (isManagedClaudeCodeMcpServer(entry))
|
|
23
|
-
return {
|
|
24
|
-
|
|
30
|
+
return {
|
|
31
|
+
status: 'configured',
|
|
32
|
+
path,
|
|
33
|
+
exists: true,
|
|
34
|
+
parsed: true,
|
|
35
|
+
config: parsed,
|
|
36
|
+
message: 'Claude user ~/.claude.json has a managed mcpServers.vgxness entry.',
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
status: 'conflicting',
|
|
40
|
+
path,
|
|
41
|
+
exists: true,
|
|
42
|
+
parsed: true,
|
|
43
|
+
config: parsed,
|
|
44
|
+
message: 'Claude user ~/.claude.json has a conflicting mcpServers.vgxness entry.',
|
|
45
|
+
};
|
|
25
46
|
}
|
|
26
47
|
catch (cause) {
|
|
27
48
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
import { projectCanonicalAgentManifestToClaudeProjectMemory } from '
|
|
3
|
+
import { projectCanonicalAgentManifestToClaudeProjectMemory } from '../../../agents/canonical-agent-projection.js';
|
|
4
4
|
import { safeHomeDirectory } from './claude-code-agent-config.js';
|
|
5
5
|
export const claudeUserMemoryBeginMarker = '<!-- BEGIN VGXNESS-MANAGED CLAUDE USER MEMORY -->';
|
|
6
6
|
export const claudeUserMemoryEndMarker = '<!-- END VGXNESS-MANAGED CLAUDE USER MEMORY -->';
|
|
@@ -25,7 +25,14 @@ export function renderClaudeUserMemoryBlock() {
|
|
|
25
25
|
export function inspectClaudeUserMemory(env = process.env) {
|
|
26
26
|
const path = resolveClaudeUserMemoryPath(env);
|
|
27
27
|
if (!existsSync(path))
|
|
28
|
-
return {
|
|
28
|
+
return {
|
|
29
|
+
status: 'missing',
|
|
30
|
+
path,
|
|
31
|
+
exists: false,
|
|
32
|
+
action: 'create',
|
|
33
|
+
backupRequired: false,
|
|
34
|
+
message: 'Claude user memory ~/.claude/CLAUDE.md does not exist.',
|
|
35
|
+
};
|
|
29
36
|
let contents;
|
|
30
37
|
try {
|
|
31
38
|
const bytes = readFileSync(path);
|
|
@@ -39,7 +46,15 @@ export function inspectClaudeUserMemory(env = process.env) {
|
|
|
39
46
|
const beginCount = countOccurrences(contents, claudeUserMemoryBeginMarker);
|
|
40
47
|
const endCount = countOccurrences(contents, claudeUserMemoryEndMarker);
|
|
41
48
|
if (beginCount === 0 && endCount === 0)
|
|
42
|
-
return {
|
|
49
|
+
return {
|
|
50
|
+
status: 'unmanaged',
|
|
51
|
+
path,
|
|
52
|
+
exists: true,
|
|
53
|
+
action: 'append-managed-block',
|
|
54
|
+
backupRequired: true,
|
|
55
|
+
message: 'Claude user memory exists without a VGXNESS managed block; apply would append one after backup.',
|
|
56
|
+
contents,
|
|
57
|
+
};
|
|
43
58
|
if (beginCount === 0)
|
|
44
59
|
return blocked(path, true, 'missing_begin_marker', 'Claude user memory has an end marker without a begin marker.');
|
|
45
60
|
if (endCount === 0)
|
|
@@ -54,13 +69,35 @@ export function inspectClaudeUserMemory(env = process.env) {
|
|
|
54
69
|
const inner = contents.slice(start + claudeUserMemoryBeginMarker.length, endMarkerStart);
|
|
55
70
|
if (inner.includes(claudeUserMemoryBeginMarker) || inner.includes(claudeUserMemoryEndMarker))
|
|
56
71
|
return blocked(path, true, 'nested_markers', 'Claude user memory has nested VGXNESS managed-block markers.');
|
|
57
|
-
if (!inner.includes('owner=vgxness') ||
|
|
72
|
+
if (!inner.includes('owner=vgxness') ||
|
|
73
|
+
!inner.includes('provider=claude') ||
|
|
74
|
+
!inner.includes('artifact=claude-user-memory') ||
|
|
75
|
+
!inner.includes('safe-update=true'))
|
|
58
76
|
return blocked(path, true, 'conflicting_ownership', 'Claude user memory managed block is not a VGXNESS-owned user-memory block.');
|
|
59
77
|
const expected = renderClaudeUserMemoryBlock();
|
|
60
78
|
const actual = contents.slice(start, end);
|
|
61
79
|
if (actual === expected)
|
|
62
|
-
return {
|
|
63
|
-
|
|
80
|
+
return {
|
|
81
|
+
status: 'managed-current',
|
|
82
|
+
path,
|
|
83
|
+
exists: true,
|
|
84
|
+
action: 'none',
|
|
85
|
+
backupRequired: false,
|
|
86
|
+
message: 'Claude user memory has the current VGXNESS managed block.',
|
|
87
|
+
blockRange: { start, end },
|
|
88
|
+
contents,
|
|
89
|
+
};
|
|
90
|
+
return {
|
|
91
|
+
status: 'managed-stale',
|
|
92
|
+
path,
|
|
93
|
+
exists: true,
|
|
94
|
+
action: 'update-managed-block',
|
|
95
|
+
backupRequired: true,
|
|
96
|
+
message: 'Claude user memory has a stale VGXNESS managed block; apply would update only that block after backup.',
|
|
97
|
+
blockRange: { start, end },
|
|
98
|
+
staleReasons: ['managed_block_differs_from_canonical_render'],
|
|
99
|
+
contents,
|
|
100
|
+
};
|
|
64
101
|
}
|
|
65
102
|
export function mergeClaudeUserMemory(state) {
|
|
66
103
|
const block = renderClaudeUserMemoryBlock();
|
|
@@ -71,7 +108,10 @@ export function mergeClaudeUserMemory(state) {
|
|
|
71
108
|
return { ok: true, value: { path: state.path, contents: `${state.contents}${separator}${block}\n` } };
|
|
72
109
|
}
|
|
73
110
|
if (state.status === 'managed-stale')
|
|
74
|
-
return {
|
|
111
|
+
return {
|
|
112
|
+
ok: true,
|
|
113
|
+
value: { path: state.path, contents: state.contents.slice(0, state.blockRange.start) + block + state.contents.slice(state.blockRange.end) },
|
|
114
|
+
};
|
|
75
115
|
if (state.status === 'managed-current')
|
|
76
116
|
return { ok: true, value: { path: state.path, contents: state.contents } };
|
|
77
117
|
return { ok: false, error: { code: 'validation_failed', message: state.message } };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { withEffectiveManagerInstructions } from '
|
|
1
|
+
import { withEffectiveManagerInstructions } from '../../../agents/canonical-agent-projection.js';
|
|
2
2
|
import { expectedClaudeCodeAgentFiles, inspectClaudeCodeAgents, renderClaudeCodeAgentMarkdown } from './claude-code-agent-config.js';
|
|
3
3
|
import { buildClaudeCodeMcpAddCommand } from './claude-code-cli.js';
|
|
4
4
|
import { createClaudeCodeMcpDoctorCommand, createClaudeCodeMcpServerConfig } from './claude-code-config.js';
|
|
@@ -58,23 +58,53 @@ function planUserInstall(input, server, overwriteVgxness, cliCommand, scopeWarni
|
|
|
58
58
|
else if (agent.status === 'managed')
|
|
59
59
|
targets.push({ kind: 'agent-file', path: agent.path, agentName: agent.agentName, scope: 'user', external: true, action: 'update-vgxness' });
|
|
60
60
|
else
|
|
61
|
-
targets.push({
|
|
61
|
+
targets.push({
|
|
62
|
+
kind: 'agent-file',
|
|
63
|
+
path: agent.path,
|
|
64
|
+
agentName: agent.agentName,
|
|
65
|
+
scope: 'user',
|
|
66
|
+
external: true,
|
|
67
|
+
action: 'blocked',
|
|
68
|
+
reason: agent.detail,
|
|
69
|
+
});
|
|
62
70
|
}
|
|
63
71
|
const userMemory = inspectClaudeUserMemory(input.env);
|
|
64
|
-
targets.push({
|
|
72
|
+
targets.push({
|
|
73
|
+
kind: 'user-memory',
|
|
74
|
+
path: userMemory.path,
|
|
75
|
+
external: true,
|
|
76
|
+
action: userMemory.action,
|
|
77
|
+
status: userMemory.status,
|
|
78
|
+
backupRequired: userMemory.backupRequired,
|
|
79
|
+
...(userMemory.status === 'blocked' ? { reason: userMemory.message } : {}),
|
|
80
|
+
});
|
|
65
81
|
const blocked = targets.find((target) => target.action === 'blocked');
|
|
66
82
|
if (blocked !== undefined) {
|
|
67
|
-
const reason = blocked.kind === 'user-mcp-json'
|
|
83
|
+
const reason = blocked.kind === 'user-mcp-json'
|
|
84
|
+
? userMcpRefusalReason(mcpState.status)
|
|
85
|
+
: blocked.kind === 'user-memory'
|
|
86
|
+
? userMemoryRefusalReason(userMemory)
|
|
87
|
+
: 'existing_vgxness_agent';
|
|
68
88
|
return refused(input, server, reason, blocked.reason ?? 'Claude user install plan is blocked by an existing conflicting target.', targets, preservedTopLevelKeys, overwriteVgxness);
|
|
69
89
|
}
|
|
70
|
-
const backupRequired = targets.some((target) => (target.kind === 'user-mcp-json' && target.action !== 'create') ||
|
|
71
|
-
|
|
90
|
+
const backupRequired = targets.some((target) => (target.kind === 'user-mcp-json' && target.action !== 'create') ||
|
|
91
|
+
(target.kind === 'agent-file' && target.action === 'update-vgxness') ||
|
|
92
|
+
(target.kind === 'user-memory' && target.backupRequired));
|
|
93
|
+
return {
|
|
94
|
+
...base(input, server, targets, preservedTopLevelKeys, backupRequired, overwriteVgxness, 'user', cliCommand, scopeWarnings),
|
|
95
|
+
status: 'would_install',
|
|
96
|
+
};
|
|
72
97
|
}
|
|
73
98
|
function refused(input, server, reason, message, targets, preservedTopLevelKeys, overwriteVgxness) {
|
|
74
99
|
const resolved = resolveClaudeCodeScope(input.scope, 'user');
|
|
75
100
|
const canonical = resolved.ok ? resolved.value.canonical : 'user';
|
|
76
101
|
const cli = canonical === 'user' ? buildClaudeCodeMcpAddCommand({ scope: canonical }) : undefined;
|
|
77
|
-
return {
|
|
102
|
+
return {
|
|
103
|
+
...base(input, server, targets, preservedTopLevelKeys, false, overwriteVgxness, canonical, cli?.ok ? cli.value : undefined, resolved.ok ? resolved.value.warnings : []),
|
|
104
|
+
status: 'refused',
|
|
105
|
+
reason,
|
|
106
|
+
message,
|
|
107
|
+
};
|
|
78
108
|
}
|
|
79
109
|
function base(input, server, targets, preservedTopLevelKeys, backupRequired, overwriteVgxness, canonicalClaudeScope, cliCommand, scopeWarnings) {
|
|
80
110
|
const source = input.databasePathSource ?? 'flag';
|
|
@@ -89,7 +119,14 @@ function base(input, server, targets, preservedTopLevelKeys, backupRequired, ove
|
|
|
89
119
|
targetPath,
|
|
90
120
|
targets,
|
|
91
121
|
backupRequired,
|
|
92
|
-
safety: {
|
|
122
|
+
safety: {
|
|
123
|
+
operation: 'plan',
|
|
124
|
+
mutating: false,
|
|
125
|
+
writesProviderConfig: false,
|
|
126
|
+
targetPath,
|
|
127
|
+
backupRequired,
|
|
128
|
+
mergePolicy: backupRequired ? 'merge-preserve-existing' : 'create',
|
|
129
|
+
},
|
|
93
130
|
warnings: [
|
|
94
131
|
...scopeWarnings,
|
|
95
132
|
'Claude Code MCP registration is modeled as structured config/argv, never shell strings.',
|