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
|
@@ -1,157 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { projectCanonicalAgentManifestToSeed } from './canonical-agent-projection.js';
|
|
3
|
-
const requiredManagerName = 'vgxness-manager';
|
|
4
|
-
export class AgentSeedService {
|
|
5
|
-
database;
|
|
6
|
-
agents;
|
|
7
|
-
constructor(database) {
|
|
8
|
-
this.database = database;
|
|
9
|
-
this.agents = new AgentRepository(database);
|
|
10
|
-
}
|
|
11
|
-
loadBuiltInDefaults() {
|
|
12
|
-
try {
|
|
13
|
-
return this.loadManifest(projectCanonicalAgentManifestToSeed());
|
|
14
|
-
}
|
|
15
|
-
catch (cause) {
|
|
16
|
-
const message = cause instanceof Error ? cause.message : String(cause);
|
|
17
|
-
return { ok: false, error: { code: 'validation_failed', message } };
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
loadManifest(manifest) {
|
|
21
|
-
const validation = this.validateManifest(manifest);
|
|
22
|
-
if (!validation.ok)
|
|
23
|
-
return validation;
|
|
24
|
-
const existingNames = new Map();
|
|
25
|
-
for (const definition of [...manifest.agents, ...manifest.subagents]) {
|
|
26
|
-
const existing = this.agents.getByName(manifest.project, manifest.scope, definition.name);
|
|
27
|
-
if (existing.ok)
|
|
28
|
-
existingNames.set(definition.name, true);
|
|
29
|
-
else
|
|
30
|
-
existingNames.set(definition.name, false);
|
|
31
|
-
}
|
|
32
|
-
const transaction = this.database.transaction(() => {
|
|
33
|
-
const agents = [];
|
|
34
|
-
const subagents = [];
|
|
35
|
-
const nameToId = new Map();
|
|
36
|
-
const created = [];
|
|
37
|
-
const updated = [];
|
|
38
|
-
for (const definition of manifest.agents) {
|
|
39
|
-
const registered = this.agents.register(toRegisterInput(manifest, definition, 'agent'));
|
|
40
|
-
if (!registered.ok)
|
|
41
|
-
throw new SeedLoadError(registered.error);
|
|
42
|
-
agents.push(registered.value);
|
|
43
|
-
nameToId.set(registered.value.name, registered.value.id);
|
|
44
|
-
(existingNames.get(definition.name) ? updated : created).push(definition.name);
|
|
45
|
-
}
|
|
46
|
-
for (const definition of manifest.subagents) {
|
|
47
|
-
const parentAgentId = nameToId.get(definition.parentAgentName) ?? this.resolveExistingParentId(manifest, definition.parentAgentName);
|
|
48
|
-
if (parentAgentId === undefined) {
|
|
49
|
-
throw new SeedLoadError({ code: 'validation_failed', message: `Unresolved parentAgentName: ${definition.parentAgentName}` });
|
|
50
|
-
}
|
|
51
|
-
const registered = this.agents.register(toRegisterInput(manifest, definition, 'subagent', parentAgentId));
|
|
52
|
-
if (!registered.ok)
|
|
53
|
-
throw new SeedLoadError(registered.error);
|
|
54
|
-
subagents.push(registered.value);
|
|
55
|
-
(existingNames.get(definition.name) ? updated : created).push(definition.name);
|
|
56
|
-
}
|
|
57
|
-
return { created, updated, agents, subagents, warnings: [] };
|
|
58
|
-
});
|
|
59
|
-
if (!transaction.ok) {
|
|
60
|
-
if (transaction.error.cause instanceof SeedLoadError)
|
|
61
|
-
return { ok: false, error: transaction.error.cause.failure };
|
|
62
|
-
return transaction;
|
|
63
|
-
}
|
|
64
|
-
return transaction;
|
|
65
|
-
}
|
|
66
|
-
validateManifest(manifest) {
|
|
67
|
-
if (manifest.version !== 1)
|
|
68
|
-
return validationFailure('Agent seed manifest version must be 1');
|
|
69
|
-
if (!manifest.project?.trim())
|
|
70
|
-
return validationFailure('Agent seed manifest project is required');
|
|
71
|
-
if (manifest.scope !== 'project' && manifest.scope !== 'personal')
|
|
72
|
-
return validationFailure('Agent seed manifest scope must be project or personal');
|
|
73
|
-
if (!Array.isArray(manifest.agents))
|
|
74
|
-
return validationFailure('Agent seed manifest agents must be an array');
|
|
75
|
-
if (!Array.isArray(manifest.subagents))
|
|
76
|
-
return validationFailure('Agent seed manifest subagents must be an array');
|
|
77
|
-
const managerCount = manifest.agents.filter((agent) => agent.name === requiredManagerName).length;
|
|
78
|
-
if (managerCount !== 1)
|
|
79
|
-
return validationFailure(`Agent seed manifest must declare exactly one ${requiredManagerName} agent`);
|
|
80
|
-
const seenNames = new Set();
|
|
81
|
-
for (const definition of manifest.agents) {
|
|
82
|
-
const validation = validateDefinition(definition, 'agent');
|
|
83
|
-
if (!validation.ok)
|
|
84
|
-
return validation;
|
|
85
|
-
if (seenNames.has(definition.name))
|
|
86
|
-
return validationFailure(`Duplicate seed agent name: ${definition.name}`);
|
|
87
|
-
seenNames.add(definition.name);
|
|
88
|
-
}
|
|
89
|
-
for (const definition of manifest.subagents) {
|
|
90
|
-
const validation = validateDefinition(definition, 'subagent');
|
|
91
|
-
if (!validation.ok)
|
|
92
|
-
return validation;
|
|
93
|
-
if (seenNames.has(definition.name))
|
|
94
|
-
return validationFailure(`Duplicate seed agent name: ${definition.name}`);
|
|
95
|
-
seenNames.add(definition.name);
|
|
96
|
-
if (!definition.parentAgentName.trim())
|
|
97
|
-
return validationFailure(`Subagent ${definition.name} parentAgentName is required`);
|
|
98
|
-
if (!manifest.agents.some((agent) => agent.name === definition.parentAgentName) &&
|
|
99
|
-
this.resolveExistingParentId(manifest, definition.parentAgentName) === undefined) {
|
|
100
|
-
return validationFailure(`Unresolved parentAgentName: ${definition.parentAgentName}`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return { ok: true, value: undefined };
|
|
104
|
-
}
|
|
105
|
-
resolveExistingParentId(manifest, parentAgentName) {
|
|
106
|
-
const parent = this.agents.getByName(manifest.project, manifest.scope, parentAgentName);
|
|
107
|
-
if (!parent.ok || parent.value.mode !== 'agent')
|
|
108
|
-
return undefined;
|
|
109
|
-
return parent.value.id;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
function validateDefinition(definition, mode) {
|
|
113
|
-
if (!definition.name?.trim())
|
|
114
|
-
return validationFailure(`Seed ${mode} name is required`);
|
|
115
|
-
if (!definition.description?.trim())
|
|
116
|
-
return validationFailure(`Seed ${mode} ${definition.name} description is required`);
|
|
117
|
-
if (definition.instructions?.kind !== 'inline' && definition.instructions?.kind !== 'path')
|
|
118
|
-
return validationFailure(`Seed ${mode} ${definition.name} instructions kind is invalid`);
|
|
119
|
-
if (!definition.instructions.value.trim())
|
|
120
|
-
return validationFailure(`Seed ${mode} ${definition.name} instructions are required`);
|
|
121
|
-
return { ok: true, value: undefined };
|
|
122
|
-
}
|
|
123
|
-
function toRegisterInput(manifest, definition, mode, parentAgentId) {
|
|
124
|
-
const input = {
|
|
125
|
-
project: manifest.project,
|
|
126
|
-
scope: manifest.scope,
|
|
127
|
-
mode,
|
|
128
|
-
name: definition.name,
|
|
129
|
-
description: definition.description,
|
|
130
|
-
instructions: definition.instructions,
|
|
131
|
-
};
|
|
132
|
-
if (definition.capabilities !== undefined)
|
|
133
|
-
input.capabilities = definition.capabilities;
|
|
134
|
-
if (definition.permissions !== undefined)
|
|
135
|
-
input.permissions = definition.permissions;
|
|
136
|
-
if (definition.memory !== undefined)
|
|
137
|
-
input.memory = definition.memory;
|
|
138
|
-
if (definition.workflows !== undefined)
|
|
139
|
-
input.workflows = definition.workflows;
|
|
140
|
-
if (definition.skills !== undefined)
|
|
141
|
-
input.skills = definition.skills;
|
|
142
|
-
if (definition.adapters !== undefined)
|
|
143
|
-
input.adapters = definition.adapters;
|
|
144
|
-
if (parentAgentId !== undefined)
|
|
145
|
-
input.parentAgentId = parentAgentId;
|
|
146
|
-
return input;
|
|
147
|
-
}
|
|
148
|
-
function validationFailure(message) {
|
|
149
|
-
return { ok: false, error: { code: 'validation_failed', message } };
|
|
150
|
-
}
|
|
151
|
-
class SeedLoadError extends Error {
|
|
152
|
-
failure;
|
|
153
|
-
constructor(failure) {
|
|
154
|
-
super(failure.message);
|
|
155
|
-
this.failure = failure;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
1
|
+
export * from '../application/agents/agent-seed-service.js';
|
|
@@ -1,231 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { projectCanonicalAgentManifestToSeed } from './canonical-agent-projection.js';
|
|
3
|
-
export class AgentSeedUpgradeService {
|
|
4
|
-
agents;
|
|
5
|
-
history;
|
|
6
|
-
database;
|
|
7
|
-
constructor(dependencies) {
|
|
8
|
-
this.agents = dependencies.agents;
|
|
9
|
-
this.history = dependencies.history;
|
|
10
|
-
this.database = dependencies.database;
|
|
11
|
-
}
|
|
12
|
-
upgrade(input) {
|
|
13
|
-
if (!input.project.trim())
|
|
14
|
-
return validationFailure('Agent seed upgrade project is required');
|
|
15
|
-
if (input.scope !== 'project' && input.scope !== 'personal')
|
|
16
|
-
return validationFailure('Agent seed upgrade scope is invalid');
|
|
17
|
-
const seed = projectCanonicalAgentManifestToSeed();
|
|
18
|
-
const canonicalByName = new Map();
|
|
19
|
-
for (const agent of seed.agents)
|
|
20
|
-
canonicalByName.set(agent.name, agent);
|
|
21
|
-
for (const subagent of seed.subagents)
|
|
22
|
-
canonicalByName.set(subagent.name, subagent);
|
|
23
|
-
const source = input.source ?? 'boot-upgrade';
|
|
24
|
-
const summary = {
|
|
25
|
-
created: [],
|
|
26
|
-
upgraded: [],
|
|
27
|
-
noop: [],
|
|
28
|
-
overwritten: [],
|
|
29
|
-
errors: [],
|
|
30
|
-
skipped: false,
|
|
31
|
-
};
|
|
32
|
-
const expected = canonicalPromptContractVersion;
|
|
33
|
-
const transaction = this.database.transaction(() => {
|
|
34
|
-
for (const [name, definition] of canonicalByName) {
|
|
35
|
-
const outcome = this.upgradeOne(input.project, input.scope, name, definition, source, expected);
|
|
36
|
-
if (outcome.ok) {
|
|
37
|
-
switch (outcome.value.outcome) {
|
|
38
|
-
case 'created':
|
|
39
|
-
summary.created.push(name);
|
|
40
|
-
break;
|
|
41
|
-
case 'upgraded':
|
|
42
|
-
summary.upgraded.push(name);
|
|
43
|
-
break;
|
|
44
|
-
case 'overwrote-custom-instructions':
|
|
45
|
-
summary.overwritten.push(name);
|
|
46
|
-
break;
|
|
47
|
-
case 'noop':
|
|
48
|
-
summary.noop.push(name);
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
const failureOutcome = outcome.error.code === 'validation_failed' ? 'validation_failed' : 'db_error';
|
|
54
|
-
summary.errors.push({ agentName: name, outcome: failureOutcome, reason: outcome.error.message });
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return summary;
|
|
58
|
-
});
|
|
59
|
-
if (!transaction.ok) {
|
|
60
|
-
return { ok: false, error: transaction.error };
|
|
61
|
-
}
|
|
62
|
-
return transaction;
|
|
63
|
-
}
|
|
64
|
-
hasDrift(input) {
|
|
65
|
-
const expected = input.expectedVersion ?? canonicalPromptContractVersion;
|
|
66
|
-
try {
|
|
67
|
-
const canonicalNames = [canonicalAgentManifest.defaultAgentName, ...canonicalSddSubagentNames];
|
|
68
|
-
const placeholders = canonicalNames.map(() => '?').join(', ');
|
|
69
|
-
const row = this.database.connection
|
|
70
|
-
.prepare(`
|
|
71
|
-
SELECT COUNT(*) AS stale_count
|
|
72
|
-
FROM agents
|
|
73
|
-
WHERE project = ? AND scope = ? AND name IN (${placeholders})
|
|
74
|
-
AND json_extract(adapters_json, '$.opencode.config.options.vgxnessPromptContractVersion') <> ?
|
|
75
|
-
`)
|
|
76
|
-
.get(input.project, input.scope, ...canonicalNames, expected);
|
|
77
|
-
return ok((row?.stale_count ?? 0) > 0);
|
|
78
|
-
}
|
|
79
|
-
catch (cause) {
|
|
80
|
-
return fail('Failed to detect agent seed drift', cause);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
upgradeOne(project, scope, name, definition, source, expected) {
|
|
84
|
-
const existing = this.agents.getByName(project, scope, name);
|
|
85
|
-
const fromVersion = existing.ok ? readPromptContractVersion(existing.value) : null;
|
|
86
|
-
if (existing.ok && fromVersion === expected && isByteEqualToCanonical(existing.value, definition)) {
|
|
87
|
-
return ok({ outcome: 'noop', fromVersion: expected });
|
|
88
|
-
}
|
|
89
|
-
const parentAgentId = 'parentAgentName' in definition ? this.resolveParentId(project, scope, definition.parentAgentName) : undefined;
|
|
90
|
-
if ('parentAgentName' in definition && parentAgentId === undefined) {
|
|
91
|
-
return validationFailure(`Unresolved parentAgentName: ${definition.parentAgentName}`);
|
|
92
|
-
}
|
|
93
|
-
const registerInput = toRegisterInput(project, scope, definition, parentAgentId);
|
|
94
|
-
const registered = this.agents.register(registerInput);
|
|
95
|
-
if (!registered.ok) {
|
|
96
|
-
this.appendHistory({
|
|
97
|
-
project,
|
|
98
|
-
scope,
|
|
99
|
-
agentName: name,
|
|
100
|
-
fromVersion,
|
|
101
|
-
toVersion: expected,
|
|
102
|
-
outcome: registered.error.code === 'validation_failed' ? 'validation_failed' : 'db_error',
|
|
103
|
-
reason: registered.error.message,
|
|
104
|
-
source,
|
|
105
|
-
});
|
|
106
|
-
return registered;
|
|
107
|
-
}
|
|
108
|
-
let outcome;
|
|
109
|
-
if (!existing.ok) {
|
|
110
|
-
outcome = 'created';
|
|
111
|
-
}
|
|
112
|
-
else if (fromVersion !== null && fromVersion !== expected) {
|
|
113
|
-
outcome = 'upgraded';
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
outcome = 'overwrote-custom-instructions';
|
|
117
|
-
}
|
|
118
|
-
this.appendHistory({
|
|
119
|
-
project,
|
|
120
|
-
scope,
|
|
121
|
-
agentName: name,
|
|
122
|
-
fromVersion,
|
|
123
|
-
toVersion: expected,
|
|
124
|
-
outcome,
|
|
125
|
-
reason: outcomeReason(outcome, fromVersion, expected, existing.ok),
|
|
126
|
-
source,
|
|
127
|
-
});
|
|
128
|
-
return ok({ outcome, fromVersion });
|
|
129
|
-
}
|
|
130
|
-
resolveParentId(project, scope, parentAgentName) {
|
|
131
|
-
const parent = this.agents.getByName(project, scope, parentAgentName);
|
|
132
|
-
if (!parent.ok || parent.value.mode !== 'agent')
|
|
133
|
-
return undefined;
|
|
134
|
-
return parent.value.id;
|
|
135
|
-
}
|
|
136
|
-
appendHistory(input) {
|
|
137
|
-
this.history.append({
|
|
138
|
-
project: input.project,
|
|
139
|
-
scope: input.scope,
|
|
140
|
-
agentName: input.agentName,
|
|
141
|
-
fromVersion: input.fromVersion,
|
|
142
|
-
toVersion: input.toVersion,
|
|
143
|
-
outcome: input.outcome,
|
|
144
|
-
reason: input.reason,
|
|
145
|
-
source: input.source,
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function toRegisterInput(project, scope, definition, parentAgentId) {
|
|
150
|
-
const input = {
|
|
151
|
-
project,
|
|
152
|
-
scope,
|
|
153
|
-
mode: 'parentAgentName' in definition ? 'subagent' : 'agent',
|
|
154
|
-
name: definition.name,
|
|
155
|
-
description: definition.description,
|
|
156
|
-
instructions: definition.instructions,
|
|
157
|
-
};
|
|
158
|
-
if (definition.capabilities !== undefined)
|
|
159
|
-
input.capabilities = definition.capabilities;
|
|
160
|
-
if (definition.permissions !== undefined)
|
|
161
|
-
input.permissions = definition.permissions;
|
|
162
|
-
if (definition.memory !== undefined)
|
|
163
|
-
input.memory = definition.memory;
|
|
164
|
-
if (definition.workflows !== undefined)
|
|
165
|
-
input.workflows = definition.workflows;
|
|
166
|
-
if (definition.skills !== undefined)
|
|
167
|
-
input.skills = definition.skills;
|
|
168
|
-
if (definition.adapters !== undefined)
|
|
169
|
-
input.adapters = definition.adapters;
|
|
170
|
-
if (parentAgentId !== undefined)
|
|
171
|
-
input.parentAgentId = parentAgentId;
|
|
172
|
-
return input;
|
|
173
|
-
}
|
|
174
|
-
function isByteEqualToCanonical(existing, definition) {
|
|
175
|
-
if (existing.description !== definition.description)
|
|
176
|
-
return false;
|
|
177
|
-
if (existing.instructions.value !== definition.instructions.value)
|
|
178
|
-
return false;
|
|
179
|
-
if (!adaptersEqual(existing.adapters, definition.adapters ?? {}))
|
|
180
|
-
return false;
|
|
181
|
-
if (!arraysEqual(existing.capabilities, definition.capabilities ?? []))
|
|
182
|
-
return false;
|
|
183
|
-
if (!arraysEqual(existing.workflows, definition.workflows ?? []))
|
|
184
|
-
return false;
|
|
185
|
-
if (!arraysEqual(existing.skills, definition.skills ?? []))
|
|
186
|
-
return false;
|
|
187
|
-
return true;
|
|
188
|
-
}
|
|
189
|
-
function adaptersEqual(a, b) {
|
|
190
|
-
return JSON.stringify(a ?? {}) === JSON.stringify(b ?? {});
|
|
191
|
-
}
|
|
192
|
-
function arraysEqual(a, b) {
|
|
193
|
-
if (a.length !== b.length)
|
|
194
|
-
return false;
|
|
195
|
-
for (let i = 0; i < a.length; i += 1) {
|
|
196
|
-
if (a[i] !== b[i])
|
|
197
|
-
return false;
|
|
198
|
-
}
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
function readPromptContractVersion(agent) {
|
|
202
|
-
const opencode = agent.adapters?.opencode;
|
|
203
|
-
if (opencode === undefined)
|
|
204
|
-
return null;
|
|
205
|
-
const options = opencode.config?.options;
|
|
206
|
-
const value = options?.vgxnessPromptContractVersion;
|
|
207
|
-
if (typeof value !== 'number' || !Number.isInteger(value))
|
|
208
|
-
return null;
|
|
209
|
-
return value;
|
|
210
|
-
}
|
|
211
|
-
function outcomeReason(outcome, fromVersion, toVersion, existed) {
|
|
212
|
-
if (outcome === 'created')
|
|
213
|
-
return `created canonical row at v${toVersion}`;
|
|
214
|
-
if (outcome === 'upgraded')
|
|
215
|
-
return `upgraded v${fromVersion ?? 'unknown'} -> v${toVersion}`;
|
|
216
|
-
if (outcome === 'overwrote-custom-instructions')
|
|
217
|
-
return `overwrote customized row (was v${fromVersion ?? 'unknown'}) with v${toVersion} canonical`;
|
|
218
|
-
return existed ? `noop at v${toVersion}` : `noop at v${toVersion}`;
|
|
219
|
-
}
|
|
220
|
-
function ok(value) {
|
|
221
|
-
return { ok: true, value };
|
|
222
|
-
}
|
|
223
|
-
function validationFailure(message) {
|
|
224
|
-
return { ok: false, error: { code: 'validation_failed', message } };
|
|
225
|
-
}
|
|
226
|
-
function fail(message, cause) {
|
|
227
|
-
const error = { code: 'validation_failed', message };
|
|
228
|
-
if (cause !== undefined)
|
|
229
|
-
error.cause = cause;
|
|
230
|
-
return { ok: false, error };
|
|
231
|
-
}
|
|
1
|
+
export * from '../application/agents/agent-seed-upgrade-service.js';
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const agentSelectorNameFallbackCode = 'AGENT_SELECTOR_NAME_FALLBACK';
|
|
3
|
-
export function resolveAgentSelector(input, lookup) {
|
|
4
|
-
const byId = lookup.getById(input.selector);
|
|
5
|
-
if (byId.ok)
|
|
6
|
-
return ok({ agent: byId.value });
|
|
7
|
-
for (const context of agentLookupContexts(input.project, input.scope)) {
|
|
8
|
-
const byName = lookup.getByName(context.project, context.scope, input.selector);
|
|
9
|
-
if (byName.ok) {
|
|
10
|
-
return ok({
|
|
11
|
-
agent: byName.value,
|
|
12
|
-
warning: `${agentSelectorNameFallbackCode}: selector "${input.selector}" matched agent name in ${context.project}/${context.scope}; using canonical agent id "${byName.value.id}" name "${byName.value.name}".`,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
if (byName.error.code !== 'not_found')
|
|
16
|
-
return byName;
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
ok: false,
|
|
20
|
-
error: {
|
|
21
|
-
code: 'not_found',
|
|
22
|
-
message: `Agent selector not found: "${input.selector}". Looked up registry id first, then agent name across project, personal, and VGXNESS global contexts for project "${input.project}" and scope "${input.scope}". Accepted forms: canonical agent id or visible agent name.`,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function ok(value) {
|
|
27
|
-
return { ok: true, value };
|
|
28
|
-
}
|
|
1
|
+
export * from '../application/agents/agent-selector-resolver.js';
|
|
@@ -1,59 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { AgentRepository } from './repositories/agents.js';
|
|
3
|
-
import { AgentSeedHistoryRepository } from './repositories/agent-seed-history.js';
|
|
4
|
-
import { canonicalAgentManifest } from './canonical-agent-manifest.js';
|
|
5
|
-
const skipEnvVar = 'VGXNESS_SKIP_AGENT_SEED_AUTO_UPGRADE';
|
|
6
|
-
export function runBootAgentSeedUpgrade(database, env = process.env, project = canonicalAgentManifest.project, scope = canonicalAgentManifest.scope) {
|
|
7
|
-
if (isOptOut(env)) {
|
|
8
|
-
return { ok: true, skipped: true, created: 0, upgraded: 0, overwritten: 0, noop: 0, errors: 0 };
|
|
9
|
-
}
|
|
10
|
-
try {
|
|
11
|
-
const service = new AgentSeedUpgradeService({
|
|
12
|
-
agents: new AgentRepository(database),
|
|
13
|
-
history: new AgentSeedHistoryRepository(database),
|
|
14
|
-
database,
|
|
15
|
-
});
|
|
16
|
-
const result = service.upgrade({ project, scope, source: 'boot-upgrade' });
|
|
17
|
-
if (!result.ok) {
|
|
18
|
-
const message = `boot-upgrade failed: ${result.error.message} (code=${result.error.code})`;
|
|
19
|
-
process.stderr.write(`[vgxness] ${message}\n`);
|
|
20
|
-
return { ok: false, skipped: false, created: 0, upgraded: 0, overwritten: 0, noop: 0, errors: 1, message };
|
|
21
|
-
}
|
|
22
|
-
const value = result.value;
|
|
23
|
-
const touched = value.created.length + value.upgraded.length + value.overwritten.length + value.errors.length;
|
|
24
|
-
if (touched > 0) {
|
|
25
|
-
const parts = [];
|
|
26
|
-
if (value.created.length > 0)
|
|
27
|
-
parts.push(`created ${value.created.length}`);
|
|
28
|
-
if (value.upgraded.length > 0)
|
|
29
|
-
parts.push(`upgraded ${value.upgraded.length}`);
|
|
30
|
-
if (value.overwritten.length > 0)
|
|
31
|
-
parts.push(`overwrote ${value.overwritten.length}`);
|
|
32
|
-
if (value.errors.length > 0)
|
|
33
|
-
parts.push(`errors ${value.errors.length}`);
|
|
34
|
-
process.stderr.write(`[vgxness] boot-upgrade: ${parts.join(', ')}\n`);
|
|
35
|
-
for (const error of value.errors) {
|
|
36
|
-
process.stderr.write(`[vgxness] boot-upgrade: ${error.agentName} ${error.outcome}: ${error.reason}\n`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
ok: true,
|
|
41
|
-
skipped: false,
|
|
42
|
-
created: value.created.length,
|
|
43
|
-
upgraded: value.upgraded.length,
|
|
44
|
-
overwritten: value.overwritten.length,
|
|
45
|
-
noop: value.noop.length,
|
|
46
|
-
errors: value.errors.length,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
catch (cause) {
|
|
50
|
-
const detail = cause instanceof Error ? `${cause.name}: ${cause.message}` : String(cause);
|
|
51
|
-
const message = `boot-upgrade threw: ${detail}`;
|
|
52
|
-
process.stderr.write(`[vgxness] ${message}\n`);
|
|
53
|
-
return { ok: false, skipped: false, created: 0, upgraded: 0, overwritten: 0, noop: 0, errors: 1, message };
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function isOptOut(env) {
|
|
57
|
-
const value = env[skipEnvVar];
|
|
58
|
-
return value === '1' || value === 'true';
|
|
59
|
-
}
|
|
1
|
+
export * from '../application/agents/boot-upgrade.js';
|