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,28 @@
|
|
|
1
|
+
import { agentLookupContexts } from './agent-lookup-contexts.js';
|
|
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
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { canonicalAgentManifest } from '../../domain/agents/canonical-agent-manifest.js';
|
|
2
|
+
import { AgentSeedHistoryRepository } from '../../storage/agents/repositories/agent-seed-history.js';
|
|
3
|
+
import { AgentRepository } from '../../storage/agents/repositories/agents.js';
|
|
4
|
+
import { AgentSeedUpgradeService } from './agent-seed-upgrade-service.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
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { canonicalAgentManifest, canonicalDefaultAgentName, canonicalOpenCodeManagerPrompt, canonicalOpenCodeManagerReasoningEffort, canonicalPromptContractVersion, canonicalSddSubagentNames, createCanonicalOpenCodeSddSubagentPrompt, createCanonicalOpenCodeSddTaskPermissions, validateCanonicalAgentManifest, } from '../../domain/agents/canonical-agent-manifest.js';
|
|
2
|
+
import { composeManagerInstructions } from './manager-profile-overlay-service.js';
|
|
3
|
+
export function canonicalManifestValidationErrors(manifest = canonicalAgentManifest) {
|
|
4
|
+
const validation = validateCanonicalAgentManifest(manifest);
|
|
5
|
+
return validation.ok ? [] : validation.errors;
|
|
6
|
+
}
|
|
7
|
+
export function projectCanonicalAgentManifestToSeed(manifest = canonicalAgentManifest) {
|
|
8
|
+
assertValidCanonicalManifest(manifest);
|
|
9
|
+
const agents = manifest.agents.filter((agent) => agent.mode === 'agent').map(toSeedAgent);
|
|
10
|
+
const subagents = manifest.agents.filter((agent) => agent.mode === 'subagent').map(toSeedSubagent);
|
|
11
|
+
return { version: 1, project: manifest.project, scope: manifest.scope, agents, subagents };
|
|
12
|
+
}
|
|
13
|
+
export function projectCanonicalAgentManifestToOpenCode(manifest = canonicalAgentManifest) {
|
|
14
|
+
assertValidCanonicalManifest(manifest);
|
|
15
|
+
const manager = manifest.agents.find((agent) => agent.name === manifest.defaultAgentName && agent.mode === 'agent');
|
|
16
|
+
if (manager === undefined)
|
|
17
|
+
throw new Error(`Canonical OpenCode projection missing manager agent: ${manifest.defaultAgentName}`);
|
|
18
|
+
const agents = {
|
|
19
|
+
[canonicalDefaultAgentName]: {
|
|
20
|
+
description: 'VGXNESS SDD Manager - coordinates MCP state and SDD sub-agents, avoids inline execution when delegation is safer',
|
|
21
|
+
mode: 'primary',
|
|
22
|
+
...(manager.adapters?.opencode?.model !== undefined ? { model: manager.adapters.opencode.model } : {}),
|
|
23
|
+
options: { reasoningEffort: canonicalOpenCodeManagerReasoningEffort, vgxnessPromptContractVersion: canonicalPromptContractVersion },
|
|
24
|
+
permission: openCodeManagerPermissionsFor(manager),
|
|
25
|
+
prompt: canonicalOpenCodeManagerPrompt,
|
|
26
|
+
reasoningEffort: canonicalOpenCodeManagerReasoningEffort,
|
|
27
|
+
tools: openCodeManagerTools(),
|
|
28
|
+
variant: '',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
for (const name of canonicalSddSubagentNames) {
|
|
32
|
+
const subagent = manifest.agents.find((agent) => agent.name === name && agent.mode === 'subagent');
|
|
33
|
+
if (subagent === undefined)
|
|
34
|
+
throw new Error(`Canonical OpenCode projection missing subagent: ${name}`);
|
|
35
|
+
agents[name] = {
|
|
36
|
+
description: openCodeSubagentDescriptions[name],
|
|
37
|
+
hidden: true,
|
|
38
|
+
mode: 'subagent',
|
|
39
|
+
...(subagent.adapters?.opencode?.model !== undefined ? { model: subagent.adapters.opencode.model } : {}),
|
|
40
|
+
options: { vgxnessPromptContractVersion: canonicalPromptContractVersion },
|
|
41
|
+
prompt: createCanonicalOpenCodeSddSubagentPrompt(name),
|
|
42
|
+
permission: openCodePermissionsFor(subagent),
|
|
43
|
+
tools: { bash: true, edit: true, read: true, write: true },
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return { defaultAgent: canonicalDefaultAgentName, agents };
|
|
47
|
+
}
|
|
48
|
+
export function withEffectiveOpenCodeManagerInstructions(projection, instructions) {
|
|
49
|
+
const trimmed = instructions?.trim() ?? '';
|
|
50
|
+
if (trimmed === '')
|
|
51
|
+
return projection;
|
|
52
|
+
const manager = projection.agents[projection.defaultAgent];
|
|
53
|
+
if (manager === undefined)
|
|
54
|
+
return projection;
|
|
55
|
+
return {
|
|
56
|
+
defaultAgent: projection.defaultAgent,
|
|
57
|
+
agents: {
|
|
58
|
+
...projection.agents,
|
|
59
|
+
[projection.defaultAgent]: { ...manager, prompt: composeManagerInstructions(manager.prompt, trimmed) },
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export function projectCanonicalAgentManifestToClaudeCode(manifest = canonicalAgentManifest) {
|
|
64
|
+
assertValidCanonicalManifest(manifest);
|
|
65
|
+
const manager = manifest.agents.find((agent) => agent.name === manifest.defaultAgentName && agent.mode === 'agent');
|
|
66
|
+
if (manager === undefined)
|
|
67
|
+
throw new Error(`Canonical Claude projection missing manager agent: ${manifest.defaultAgentName}`);
|
|
68
|
+
const agents = [
|
|
69
|
+
{
|
|
70
|
+
name: canonicalDefaultAgentName,
|
|
71
|
+
canonicalName: canonicalDefaultAgentName,
|
|
72
|
+
description: manager.description,
|
|
73
|
+
fileName: `${canonicalDefaultAgentName}.md`,
|
|
74
|
+
instructions: canonicalOpenCodeManagerPrompt,
|
|
75
|
+
promptContractVersion: canonicalPromptContractVersion,
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
for (const mapping of claudeSddNameMappings) {
|
|
79
|
+
const subagent = manifest.agents.find((agent) => agent.name === mapping.canonical && agent.mode === 'subagent');
|
|
80
|
+
if (subagent === undefined)
|
|
81
|
+
throw new Error(`Canonical Claude projection missing subagent: ${mapping.canonical}`);
|
|
82
|
+
agents.push({
|
|
83
|
+
name: mapping.claude,
|
|
84
|
+
canonicalName: mapping.canonical,
|
|
85
|
+
description: claudeSubagentDescriptions[mapping.claude],
|
|
86
|
+
fileName: `${mapping.claude}.md`,
|
|
87
|
+
instructions: createCanonicalOpenCodeSddSubagentPrompt(mapping.canonical),
|
|
88
|
+
promptContractVersion: canonicalPromptContractVersion,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return { defaultAgent: canonicalDefaultAgentName, agents };
|
|
92
|
+
}
|
|
93
|
+
export function withEffectiveManagerInstructions(projection, instructions) {
|
|
94
|
+
const trimmed = instructions?.trim() ?? '';
|
|
95
|
+
if (trimmed === '')
|
|
96
|
+
return projection;
|
|
97
|
+
const agents = projection.agents.map((agent) => agent.canonicalName === projection.defaultAgent ? { ...agent, instructions: composeManagerInstructions(agent.instructions, trimmed) } : agent);
|
|
98
|
+
return { defaultAgent: projection.defaultAgent, agents };
|
|
99
|
+
}
|
|
100
|
+
export function projectCanonicalAgentManifestToClaudeProjectMemory(manifest = canonicalAgentManifest) {
|
|
101
|
+
assertValidCanonicalManifest(manifest);
|
|
102
|
+
return {
|
|
103
|
+
defaultAgent: canonicalDefaultAgentName,
|
|
104
|
+
promptContractVersion: canonicalPromptContractVersion,
|
|
105
|
+
repositoryInstructions: 'AGENTS.md',
|
|
106
|
+
guidance: [
|
|
107
|
+
`Use \`${canonicalDefaultAgentName}\` as the VGXNESS project manager/personality for this project.`,
|
|
108
|
+
'Follow project-root `AGENTS.md` when present.',
|
|
109
|
+
'Use VGXNESS MCP as durable state for SDD artifacts, runs, memory, agents, permissions, and provider diagnostics.',
|
|
110
|
+
'SDD artifact acceptance is human-only; never infer acceptance from generated output or file presence.',
|
|
111
|
+
'Before phase advancement, check VGXNESS SDD readiness/status.',
|
|
112
|
+
'Preserve confirmation and preflight requirements for risky side effects.',
|
|
113
|
+
'Do not tell users to run terminal SDD phase commands for normal daily SDD flow.',
|
|
114
|
+
'Be concise, evidence-grounded, user-controlled, practical, and willing to challenge unsafe assumptions.',
|
|
115
|
+
],
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export function canonicalProviderProjection(provider, manifest = canonicalAgentManifest) {
|
|
119
|
+
assertValidCanonicalManifest(manifest);
|
|
120
|
+
const normalized = provider.trim().toLowerCase();
|
|
121
|
+
if (normalized === 'opencode')
|
|
122
|
+
return { provider: normalized, level: 'managed', manifest, projection: projectCanonicalAgentManifestToOpenCode(manifest) };
|
|
123
|
+
if (normalized === 'claude')
|
|
124
|
+
return { provider: normalized, level: 'managed', manifest, projection: projectCanonicalAgentManifestToClaudeCode(manifest) };
|
|
125
|
+
return { provider: normalized, level: 'unsupported', manifest, reason: `Unsupported provider projection: ${provider}` };
|
|
126
|
+
}
|
|
127
|
+
function assertValidCanonicalManifest(manifest) {
|
|
128
|
+
const errors = canonicalManifestValidationErrors(manifest);
|
|
129
|
+
if (errors.length > 0)
|
|
130
|
+
throw new Error(`Invalid canonical agent manifest: ${errors.join('; ')}`);
|
|
131
|
+
}
|
|
132
|
+
function openCodePermissionsFor(agent, additional = {}) {
|
|
133
|
+
const adapterPermission = asRecord(agent.adapters?.opencode?.config?.permission);
|
|
134
|
+
return { ...adapterPermission, ...additional, ...mapCanonicalPermissionsToOpenCode(agent.permissions) };
|
|
135
|
+
}
|
|
136
|
+
function openCodeManagerPermissionsFor(agent) {
|
|
137
|
+
return {
|
|
138
|
+
...openCodePermissionsFor(agent, { task: createCanonicalOpenCodeSddTaskPermissions() }),
|
|
139
|
+
bash: 'deny',
|
|
140
|
+
edit: 'deny',
|
|
141
|
+
read: 'allow',
|
|
142
|
+
write: 'deny',
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function openCodeManagerTools() {
|
|
146
|
+
return {
|
|
147
|
+
bash: false,
|
|
148
|
+
delegate: true,
|
|
149
|
+
delegation_list: true,
|
|
150
|
+
delegation_read: true,
|
|
151
|
+
edit: false,
|
|
152
|
+
glob: true,
|
|
153
|
+
grep: true,
|
|
154
|
+
read: true,
|
|
155
|
+
write: false,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function mapCanonicalPermissionsToOpenCode(permissions) {
|
|
159
|
+
const mapped = {};
|
|
160
|
+
if (permissions === undefined)
|
|
161
|
+
return mapped;
|
|
162
|
+
for (const [canonical, openCode] of openCodePermissionMappings) {
|
|
163
|
+
const decision = permissions[canonical];
|
|
164
|
+
if (decision !== undefined)
|
|
165
|
+
mapped[openCode] = decision;
|
|
166
|
+
}
|
|
167
|
+
return mapped;
|
|
168
|
+
}
|
|
169
|
+
function asRecord(value) {
|
|
170
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
171
|
+
return {};
|
|
172
|
+
return value;
|
|
173
|
+
}
|
|
174
|
+
const openCodePermissionMappings = [
|
|
175
|
+
['read', 'read'],
|
|
176
|
+
['edit', 'edit'],
|
|
177
|
+
['shell', 'bash'],
|
|
178
|
+
['external-directory', 'external_directory'],
|
|
179
|
+
];
|
|
180
|
+
function toSeedAgent(agent) {
|
|
181
|
+
const seed = {
|
|
182
|
+
name: agent.name,
|
|
183
|
+
description: agent.description,
|
|
184
|
+
instructions: agent.instructions,
|
|
185
|
+
};
|
|
186
|
+
if (agent.capabilities !== undefined)
|
|
187
|
+
seed.capabilities = agent.capabilities;
|
|
188
|
+
if (agent.permissions !== undefined)
|
|
189
|
+
seed.permissions = agent.permissions;
|
|
190
|
+
if (agent.memory !== undefined)
|
|
191
|
+
seed.memory = agent.memory;
|
|
192
|
+
if (agent.workflows !== undefined)
|
|
193
|
+
seed.workflows = agent.workflows;
|
|
194
|
+
if (agent.skills !== undefined)
|
|
195
|
+
seed.skills = agent.skills;
|
|
196
|
+
if (agent.adapters !== undefined)
|
|
197
|
+
seed.adapters = agent.adapters;
|
|
198
|
+
return seed;
|
|
199
|
+
}
|
|
200
|
+
function toSeedSubagent(agent) {
|
|
201
|
+
if (agent.parentAgentName === undefined)
|
|
202
|
+
throw new Error(`Canonical subagent ${agent.name} is missing parentAgentName`);
|
|
203
|
+
return { ...toSeedAgent(agent), parentAgentName: agent.parentAgentName };
|
|
204
|
+
}
|
|
205
|
+
const openCodeSubagentDescriptions = {
|
|
206
|
+
'vgxness-sdd-explore': 'Investigate codebase and think through ideas',
|
|
207
|
+
'vgxness-sdd-propose': 'Create change proposals from explorations',
|
|
208
|
+
'vgxness-sdd-spec': 'Write detailed specifications from proposals',
|
|
209
|
+
'vgxness-sdd-design': 'Create technical design from proposals',
|
|
210
|
+
'vgxness-sdd-tasks': 'Break down specs and designs into implementation tasks',
|
|
211
|
+
'vgxness-sdd-apply': 'Implement code changes from task definitions',
|
|
212
|
+
'vgxness-sdd-verify': 'Validate implementation against specs',
|
|
213
|
+
'vgxness-sdd-archive': 'Archive completed change artifacts',
|
|
214
|
+
'vgxness-sdd-init': 'Bootstrap SDD context and project configuration',
|
|
215
|
+
'vgxness-sdd-onboard': 'Guide user through a complete SDD cycle using their real codebase',
|
|
216
|
+
};
|
|
217
|
+
const claudeSddNameMappings = [
|
|
218
|
+
{ canonical: 'vgxness-sdd-explore', claude: 'vgxness-sdd-explore' },
|
|
219
|
+
{ canonical: 'vgxness-sdd-propose', claude: 'vgxness-sdd-proposal' },
|
|
220
|
+
{ canonical: 'vgxness-sdd-spec', claude: 'vgxness-sdd-spec' },
|
|
221
|
+
{ canonical: 'vgxness-sdd-design', claude: 'vgxness-sdd-design' },
|
|
222
|
+
{ canonical: 'vgxness-sdd-tasks', claude: 'vgxness-sdd-tasks' },
|
|
223
|
+
{ canonical: 'vgxness-sdd-apply', claude: 'vgxness-sdd-apply-progress' },
|
|
224
|
+
{ canonical: 'vgxness-sdd-verify', claude: 'vgxness-sdd-verify' },
|
|
225
|
+
{ canonical: 'vgxness-sdd-archive', claude: 'vgxness-sdd-archive' },
|
|
226
|
+
];
|
|
227
|
+
const claudeSubagentDescriptions = {
|
|
228
|
+
'vgxness-sdd-explore': 'Investigate codebase context and risks for VGXNESS SDD changes.',
|
|
229
|
+
'vgxness-sdd-proposal': 'Create focused proposals for VGXNESS SDD changes.',
|
|
230
|
+
'vgxness-sdd-spec': 'Write detailed specifications for VGXNESS SDD changes.',
|
|
231
|
+
'vgxness-sdd-design': 'Create technical designs for VGXNESS SDD changes.',
|
|
232
|
+
'vgxness-sdd-tasks': 'Break accepted designs into implementation tasks.',
|
|
233
|
+
'vgxness-sdd-apply-progress': 'Implement accepted VGXNESS SDD tasks and report apply progress.',
|
|
234
|
+
'vgxness-sdd-verify': 'Verify VGXNESS SDD implementation evidence and risks.',
|
|
235
|
+
'vgxness-sdd-archive': 'Archive completed VGXNESS SDD outcomes and follow-ups.',
|
|
236
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ManagerProfileOverlayRepository } from '../../storage/agents/repositories/manager-profile-overlays.js';
|
|
2
|
+
import { AgentRegistryService } from './agent-registry-service.js';
|
|
3
|
+
export class ManagerProfileOverlayService {
|
|
4
|
+
dependencies;
|
|
5
|
+
constructor(dependencies) {
|
|
6
|
+
this.dependencies = dependencies;
|
|
7
|
+
}
|
|
8
|
+
save(input) {
|
|
9
|
+
return this.dependencies.overlays.save(input);
|
|
10
|
+
}
|
|
11
|
+
get(project, scope, managerName) {
|
|
12
|
+
return this.dependencies.overlays.get(project, scope, managerName);
|
|
13
|
+
}
|
|
14
|
+
resolveEffectiveManager(input) {
|
|
15
|
+
const manager = this.dependencies.agents.getAgentByName(input.project, input.scope, input.managerName);
|
|
16
|
+
if (!manager.ok)
|
|
17
|
+
return manager;
|
|
18
|
+
if (manager.value.mode !== 'agent')
|
|
19
|
+
return validationFailure('Effective manager requires a top-level agent');
|
|
20
|
+
const overlay = this.dependencies.overlays.get(input.project, input.scope, input.managerName);
|
|
21
|
+
if (!overlay.ok) {
|
|
22
|
+
if (overlay.error.code === 'not_found')
|
|
23
|
+
return ok({ manager: manager.value });
|
|
24
|
+
return overlay;
|
|
25
|
+
}
|
|
26
|
+
return ok({
|
|
27
|
+
manager: {
|
|
28
|
+
...manager.value,
|
|
29
|
+
instructions: { kind: 'inline', value: composeManagerInstructions(manager.value.instructions.value, overlay.value.instructions) },
|
|
30
|
+
},
|
|
31
|
+
overlay: overlay.value,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const managerProfileOverlayMarker = '## Manager profile overlay';
|
|
36
|
+
export function composeManagerInstructions(baseline, overlay) {
|
|
37
|
+
const baselineInstructions = baseline.trim();
|
|
38
|
+
const overlayInstructions = normalizeManagerOverlayInstructions(overlay);
|
|
39
|
+
if (baselineInstructions === '')
|
|
40
|
+
return overlayInstructions;
|
|
41
|
+
if (overlayInstructions === '')
|
|
42
|
+
return baselineInstructions;
|
|
43
|
+
if (overlayInstructions.includes(baselineInstructions))
|
|
44
|
+
return overlayInstructions;
|
|
45
|
+
return `${baselineInstructions}\n\n${managerProfileOverlayMarker}\n${overlayInstructions}`;
|
|
46
|
+
}
|
|
47
|
+
function normalizeManagerOverlayInstructions(overlay) {
|
|
48
|
+
const overlayInstructions = overlay.trim();
|
|
49
|
+
const markerIndex = overlayInstructions.lastIndexOf(managerProfileOverlayMarker);
|
|
50
|
+
if (markerIndex === -1)
|
|
51
|
+
return overlayInstructions;
|
|
52
|
+
return overlayInstructions.slice(markerIndex + managerProfileOverlayMarker.length).trim();
|
|
53
|
+
}
|
|
54
|
+
function ok(value) {
|
|
55
|
+
return { ok: true, value };
|
|
56
|
+
}
|
|
57
|
+
function validationFailure(message) {
|
|
58
|
+
return { ok: false, error: { code: 'validation_failed', message } };
|
|
59
|
+
}
|
|
60
|
+
export function computeEffectiveManagerInstructions(database, project = 'vgxness', scope = 'project', managerName = 'vgxness-manager') {
|
|
61
|
+
const registry = new AgentRegistryService(database);
|
|
62
|
+
const overlays = new ManagerProfileOverlayRepository(database);
|
|
63
|
+
const service = new ManagerProfileOverlayService({ agents: registry, overlays });
|
|
64
|
+
const resolved = service.resolveEffectiveManager({ project, scope, managerName });
|
|
65
|
+
if (!resolved.ok || resolved.value.overlay === undefined)
|
|
66
|
+
return undefined;
|
|
67
|
+
return resolved.value.manager.instructions.value.trim() || undefined;
|
|
68
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export function resolveAgentProfileModel(input) {
|
|
2
|
+
const providerAdapter = input.providerAdapter?.trim() || 'opencode';
|
|
3
|
+
const adapters = input.agent.adapters;
|
|
4
|
+
const adapterNames = Object.keys(adapters);
|
|
5
|
+
const adapter = adapters[providerAdapter];
|
|
6
|
+
if (adapterNames.length > 0 && adapter === undefined) {
|
|
7
|
+
return validationFailure(`Agent ${input.agent.name} does not declare provider adapter: ${providerAdapter}`);
|
|
8
|
+
}
|
|
9
|
+
const model = adapter?.model?.trim();
|
|
10
|
+
if (model !== undefined && model.length > 0) {
|
|
11
|
+
const profile = profileFromAdapter(adapter?.config);
|
|
12
|
+
return ok({ providerAdapter, model, ...(profile === undefined ? {} : { profile }), source: 'agent-adapter-model', warnings: [] });
|
|
13
|
+
}
|
|
14
|
+
const previewModel = `${providerAdapter}-preview`;
|
|
15
|
+
const warnings = adapter === undefined
|
|
16
|
+
? [`Agent does not declare adapters; using provider-neutral preview model ${previewModel}.`]
|
|
17
|
+
: [`Adapter ${providerAdapter} does not declare a model; using ${previewModel}.`];
|
|
18
|
+
const profile = profileFromAdapter(adapter?.config);
|
|
19
|
+
return ok({ providerAdapter, model: previewModel, ...(profile === undefined ? {} : { profile }), source: 'provider-preview-default', warnings });
|
|
20
|
+
}
|
|
21
|
+
function profileFromAdapter(config) {
|
|
22
|
+
const profile = config?.profile;
|
|
23
|
+
return typeof profile === 'string' && profile.trim().length > 0 ? profile.trim() : undefined;
|
|
24
|
+
}
|
|
25
|
+
function ok(value) {
|
|
26
|
+
return { ok: true, value };
|
|
27
|
+
}
|
|
28
|
+
function validationFailure(message) {
|
|
29
|
+
return { ok: false, error: { code: 'validation_failed', message } };
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../adapters/claude/agent-renderer.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ClaudeAgentRenderer } from '../../../adapters/claude/agent-renderer.js';
|
|
2
|
+
import { JsonAgentRenderer } from '../../../adapters/json/agent-renderer.js';
|
|
3
|
+
import { OpenCodeAgentRenderer } from '../../../adapters/opencode/agent-renderer.js';
|
|
4
|
+
import { ok, validationFailure } from '../../../adapters/provider-renderer.js';
|
|
5
|
+
const renderers = {
|
|
6
|
+
json: new JsonAgentRenderer(),
|
|
7
|
+
opencode: new OpenCodeAgentRenderer(),
|
|
8
|
+
claude: new ClaudeAgentRenderer(),
|
|
9
|
+
};
|
|
10
|
+
export function getProviderRenderer(provider) {
|
|
11
|
+
const normalized = provider.trim().toLowerCase();
|
|
12
|
+
const renderer = renderers[normalized];
|
|
13
|
+
return renderer === undefined ? validationFailure(`Unknown provider renderer: ${provider}`) : ok(renderer);
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../adapters/json/agent-renderer.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../adapters/opencode/agent-renderer.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../adapters/provider-renderer.js';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { activeWorkCurrentSegments, activeWorkRecommendedMemoryTypes, activeWorkTopicRoot, parseActiveWorkTopicKey, } from '../../domain/memory/active-work-topics.js';
|
|
2
|
+
const sourceLimit = 50;
|
|
3
|
+
const maxItems = 8;
|
|
4
|
+
const maxPreviewChars = 160;
|
|
5
|
+
const currentPriority = new Map(activeWorkCurrentSegments.map((segment, index) => [segment, index]));
|
|
6
|
+
export class ActiveWorkPreviewService {
|
|
7
|
+
source;
|
|
8
|
+
constructor(source) {
|
|
9
|
+
this.source = source;
|
|
10
|
+
}
|
|
11
|
+
build(input) {
|
|
12
|
+
const found = this.source.searchObservationPreviewsNoTrace({ project: input.project, topicKey: activeWorkTopicRoot, limit: sourceLimit });
|
|
13
|
+
if (!found.ok)
|
|
14
|
+
return found;
|
|
15
|
+
return { ok: true, value: formatActiveWorkPreview(found.value, input.change) };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function formatActiveWorkPreview(records, change) {
|
|
19
|
+
const parsed = records
|
|
20
|
+
.map((record) => ({ record, parsed: parseActiveWorkTopicKey(record.topicKey) }))
|
|
21
|
+
.filter((entry) => entry.parsed !== undefined)
|
|
22
|
+
.filter((entry) => change === undefined || entry.parsed.change === change);
|
|
23
|
+
const changes = [...new Set(parsed.map((entry) => entry.parsed.change))].sort();
|
|
24
|
+
const notes = [
|
|
25
|
+
'Active-work memory is advisory only; canonical SDD status/readiness, runs, artifacts, and explicit human acceptance remain authoritative.',
|
|
26
|
+
'Previews are bounded and may omit full context; use memory_get for a selected memory when safe.',
|
|
27
|
+
'Do not store secrets, credentials, raw large logs, hidden reasoning, or sensitive user data in active-work memory.',
|
|
28
|
+
];
|
|
29
|
+
if (change === undefined && changes.length > 1) {
|
|
30
|
+
return {
|
|
31
|
+
advisory: true,
|
|
32
|
+
items: [],
|
|
33
|
+
truncated: true,
|
|
34
|
+
notes: [...notes, `Multiple active-work changes found (${changes.join(', ')}); provide an explicit change to avoid mixing narratives.`],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const resolvedChange = change ?? changes[0];
|
|
38
|
+
const candidates = parsed.filter((entry) => resolvedChange === undefined || entry.parsed.change === resolvedChange).sort(compareActiveWorkEntries);
|
|
39
|
+
const items = candidates.slice(0, maxItems).map(({ record }) => toPreviewItem(record));
|
|
40
|
+
const truncated = candidates.length > items.length || records.length >= sourceLimit;
|
|
41
|
+
return {
|
|
42
|
+
advisory: true,
|
|
43
|
+
...(resolvedChange === undefined ? {} : { change: resolvedChange }),
|
|
44
|
+
items,
|
|
45
|
+
truncated,
|
|
46
|
+
notes: items.length === 0 ? [...notes, 'No active-work memory found for this context.'] : notes,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function compareActiveWorkEntries(left, right) {
|
|
50
|
+
const leftPriority = currentPriority.get(left.parsed.segment) ?? 100;
|
|
51
|
+
const rightPriority = currentPriority.get(right.parsed.segment) ?? 100;
|
|
52
|
+
if (leftPriority !== rightPriority)
|
|
53
|
+
return leftPriority - rightPriority;
|
|
54
|
+
const expectedLeft = activeWorkRecommendedMemoryTypes[left.parsed.segment] === left.record.type ? 0 : 1;
|
|
55
|
+
const expectedRight = activeWorkRecommendedMemoryTypes[right.parsed.segment] === right.record.type ? 0 : 1;
|
|
56
|
+
if (expectedLeft !== expectedRight)
|
|
57
|
+
return expectedLeft - expectedRight;
|
|
58
|
+
return right.record.updatedAt.localeCompare(left.record.updatedAt);
|
|
59
|
+
}
|
|
60
|
+
function toPreviewItem(record) {
|
|
61
|
+
return {
|
|
62
|
+
id: record.id,
|
|
63
|
+
topicKey: record.topicKey ?? '',
|
|
64
|
+
title: record.title,
|
|
65
|
+
type: record.type,
|
|
66
|
+
preview: redactSensitivePreview(record.preview).slice(0, maxPreviewChars),
|
|
67
|
+
...(record.updatedAt === undefined ? {} : { updatedAt: record.updatedAt }),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function redactSensitivePreview(value) {
|
|
71
|
+
return value
|
|
72
|
+
.replace(/\b([A-Za-z0-9._%+-]+)@([A-Za-z0-9.-]+\.[A-Za-z]{2,})\b/g, '[redacted-email]')
|
|
73
|
+
.replace(/\b(api[_-]?key|token|secret|password|credential)\s*[:=]\s*\S+/gi, '$1=[redacted]')
|
|
74
|
+
.replace(/\b(sk-[A-Za-z0-9_-]{8,}|ghp_[A-Za-z0-9_]{8,})\b/g, '[redacted-token]');
|
|
75
|
+
}
|