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,700 @@
|
|
|
1
|
+
import { AgentRegistryService } from '../../../agents/agent-registry-service.js';
|
|
2
|
+
import { AgentSeedService } from '../../../agents/agent-seed-service.js';
|
|
3
|
+
import { ManagerProfileOverlayService } from '../../../agents/manager-profile-overlay-service.js';
|
|
4
|
+
import { getProviderRenderer } from '../../../agents/renderers/index.js';
|
|
5
|
+
import { ManagerProfileOverlayRepository } from '../../../agents/repositories/manager-profile-overlays.js';
|
|
6
|
+
import { createAgentRegistryToolHandlers } from '../../../harness/tools/agents.js';
|
|
7
|
+
import { runBootSkillSeed } from '../../../skills/boot-seed.js';
|
|
8
|
+
import { SkillExportService } from '../../../skills/skill-export-service.js';
|
|
9
|
+
import { SkillIndexService } from '../../../skills/skill-index-service.js';
|
|
10
|
+
import { SkillRegistryService } from '../../../skills/skill-registry-service.js';
|
|
11
|
+
import { SkillStatusService } from '../../../skills/skill-status-service.js';
|
|
12
|
+
import { csvFlag, instructionKindFlag, jsonFlag, optionalJsonFlag, optionalModeFlag, optionalScopeFlag, optionalSkillEvaluationResultStatusFlag, optionalSkillImprovementProposalStatusFlag, optionalSkillResolutionUsageFlag, optionalSkillTargetTypeFlag, optionalSkillVersionStatusFlag, optionalStringFlag, requiredFlag, scopeFlag, skillEvaluationResultStatusFlag, skillSourceFromFlags, skillTargetTypeFlag, skillUsageOutcomeFlag, } from '../cli-flags.js';
|
|
13
|
+
import { usageFailure, validationFailure } from '../cli-help.js';
|
|
14
|
+
import { jsonResult, readJsonFile, resultFailure } from '../cli-helpers.js';
|
|
15
|
+
function resolveSkill(parsed, registry) {
|
|
16
|
+
const id = optionalStringFlag(parsed.flags, 'id');
|
|
17
|
+
if (id !== undefined)
|
|
18
|
+
return registry.getSkill(id);
|
|
19
|
+
const project = requiredFlag(parsed.flags, 'project');
|
|
20
|
+
const scope = scopeFlag(parsed.flags, 'scope', 'project');
|
|
21
|
+
const name = requiredFlag(parsed.flags, 'name');
|
|
22
|
+
if (!project.ok)
|
|
23
|
+
return project;
|
|
24
|
+
if (!scope.ok)
|
|
25
|
+
return scope;
|
|
26
|
+
if (!name.ok)
|
|
27
|
+
return name;
|
|
28
|
+
return registry.getSkillByName(project.value, scope.value, name.value);
|
|
29
|
+
}
|
|
30
|
+
function resolveSkillsInput(flags) {
|
|
31
|
+
const scope = optionalScopeFlag(flags, 'scope');
|
|
32
|
+
if (!scope.ok)
|
|
33
|
+
return scope;
|
|
34
|
+
const recordUsage = optionalSkillResolutionUsageFlag(flags, 'record-usage');
|
|
35
|
+
if (!recordUsage.ok)
|
|
36
|
+
return recordUsage;
|
|
37
|
+
const input = {};
|
|
38
|
+
const project = optionalStringFlag(flags, 'project');
|
|
39
|
+
const agentId = optionalStringFlag(flags, 'agent-id');
|
|
40
|
+
const agentName = optionalStringFlag(flags, 'agent');
|
|
41
|
+
const workflow = optionalStringFlag(flags, 'workflow');
|
|
42
|
+
const phase = optionalStringFlag(flags, 'phase');
|
|
43
|
+
const intentSignals = csvFlag(flags, 'intent-signals');
|
|
44
|
+
const providerAdapter = optionalStringFlag(flags, 'provider');
|
|
45
|
+
const runId = optionalStringFlag(flags, 'run');
|
|
46
|
+
if (project !== undefined)
|
|
47
|
+
input.project = project;
|
|
48
|
+
if (scope.value !== undefined)
|
|
49
|
+
input.scope = scope.value;
|
|
50
|
+
if (agentId !== undefined)
|
|
51
|
+
input.agentId = agentId;
|
|
52
|
+
if (agentName !== undefined)
|
|
53
|
+
input.agentName = agentName;
|
|
54
|
+
if (workflow !== undefined)
|
|
55
|
+
input.workflow = workflow;
|
|
56
|
+
if (phase !== undefined)
|
|
57
|
+
input.phase = phase;
|
|
58
|
+
if (intentSignals.length > 0)
|
|
59
|
+
input.intentSignals = intentSignals;
|
|
60
|
+
if (providerAdapter !== undefined)
|
|
61
|
+
input.providerAdapter = providerAdapter;
|
|
62
|
+
if (runId !== undefined)
|
|
63
|
+
input.runId = runId;
|
|
64
|
+
if (recordUsage.value !== undefined)
|
|
65
|
+
input.recordUsage = recordUsage.value;
|
|
66
|
+
if (input.recordUsage !== undefined && input.runId === undefined)
|
|
67
|
+
return validationFailure('--run is required when --record-usage is set');
|
|
68
|
+
return { ok: true, value: input };
|
|
69
|
+
}
|
|
70
|
+
function skillStatusInput(flags) {
|
|
71
|
+
const project = requiredFlag(flags, 'project');
|
|
72
|
+
const scope = scopeFlag(flags, 'scope', 'project');
|
|
73
|
+
const mode = optionalModeFlag(flags, 'mode');
|
|
74
|
+
if (!project.ok)
|
|
75
|
+
return project;
|
|
76
|
+
if (!scope.ok)
|
|
77
|
+
return scope;
|
|
78
|
+
if (!mode.ok)
|
|
79
|
+
return mode;
|
|
80
|
+
const provider = optionalStringFlag(flags, 'provider') ?? 'opencode';
|
|
81
|
+
const agent = optionalStringFlag(flags, 'agent');
|
|
82
|
+
return {
|
|
83
|
+
ok: true,
|
|
84
|
+
value: {
|
|
85
|
+
project: project.value,
|
|
86
|
+
scope: scope.value,
|
|
87
|
+
provider,
|
|
88
|
+
...(mode.value !== undefined ? { mode: mode.value } : {}),
|
|
89
|
+
...(agent !== undefined ? { agent } : {}),
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function skillIndexInput(flags) {
|
|
94
|
+
const project = requiredFlag(flags, 'project');
|
|
95
|
+
const scope = requiredFlag(flags, 'scope');
|
|
96
|
+
if (!project.ok)
|
|
97
|
+
return project;
|
|
98
|
+
if (!scope.ok)
|
|
99
|
+
return scope;
|
|
100
|
+
if (scope.value !== 'project' && scope.value !== 'personal')
|
|
101
|
+
return validationFailure('--scope must be project or personal');
|
|
102
|
+
return { ok: true, value: { project: project.value, scope: scope.value } };
|
|
103
|
+
}
|
|
104
|
+
function skillPayloadInput(flags) {
|
|
105
|
+
if (flags['record-usage'] !== undefined)
|
|
106
|
+
return validationFailure('skills payload is read-only; use skills resolve with --record-usage for explicit usage writes');
|
|
107
|
+
const input = resolveSkillsInput(flags);
|
|
108
|
+
if (!input.ok)
|
|
109
|
+
return input;
|
|
110
|
+
return { ok: true, value: input.value };
|
|
111
|
+
}
|
|
112
|
+
function proposalActorInput(flags) {
|
|
113
|
+
const proposalId = requiredFlag(flags, 'proposal');
|
|
114
|
+
const actor = requiredFlag(flags, 'actor');
|
|
115
|
+
if (!proposalId.ok)
|
|
116
|
+
return proposalId;
|
|
117
|
+
if (!actor.ok)
|
|
118
|
+
return actor;
|
|
119
|
+
const reason = optionalStringFlag(flags, 'reason');
|
|
120
|
+
return { ok: true, value: { proposalId: proposalId.value, actor: actor.value, ...(reason !== undefined ? { reason } : {}) } };
|
|
121
|
+
}
|
|
122
|
+
function scenarioNameFlag(flags) {
|
|
123
|
+
const scenarioName = optionalStringFlag(flags, 'scenario-name');
|
|
124
|
+
if (scenarioName !== undefined)
|
|
125
|
+
return { ok: true, value: scenarioName };
|
|
126
|
+
const id = optionalStringFlag(flags, 'id');
|
|
127
|
+
if (id !== undefined)
|
|
128
|
+
return requiredFlag(flags, 'name');
|
|
129
|
+
return validationFailure('Missing required --scenario-name');
|
|
130
|
+
}
|
|
131
|
+
function registerPayload(parsed, environment, subagent) {
|
|
132
|
+
const file = optionalStringFlag(parsed.flags, 'file');
|
|
133
|
+
if (file !== undefined) {
|
|
134
|
+
const mergeValidation = validateFileInputIsComplete(parsed.flags, subagent);
|
|
135
|
+
if (!mergeValidation.ok)
|
|
136
|
+
return mergeValidation;
|
|
137
|
+
return readJsonFile(file, environment);
|
|
138
|
+
}
|
|
139
|
+
const project = requiredFlag(parsed.flags, 'project');
|
|
140
|
+
const scope = scopeFlag(parsed.flags, 'scope', 'project');
|
|
141
|
+
const name = requiredFlag(parsed.flags, 'name');
|
|
142
|
+
const description = requiredFlag(parsed.flags, 'description');
|
|
143
|
+
const instructionKind = instructionKindFlag(parsed.flags);
|
|
144
|
+
const instructions = requiredFlag(parsed.flags, 'instructions');
|
|
145
|
+
if (!project.ok)
|
|
146
|
+
return project;
|
|
147
|
+
if (!scope.ok)
|
|
148
|
+
return scope;
|
|
149
|
+
if (!name.ok)
|
|
150
|
+
return name;
|
|
151
|
+
if (!description.ok)
|
|
152
|
+
return description;
|
|
153
|
+
if (!instructionKind.ok)
|
|
154
|
+
return instructionKind;
|
|
155
|
+
if (!instructions.ok)
|
|
156
|
+
return instructions;
|
|
157
|
+
const payload = {
|
|
158
|
+
project: project.value,
|
|
159
|
+
scope: scope.value,
|
|
160
|
+
name: name.value,
|
|
161
|
+
description: description.value,
|
|
162
|
+
instructions: { kind: instructionKind.value, value: instructions.value },
|
|
163
|
+
};
|
|
164
|
+
const capabilities = csvFlag(parsed.flags, 'capabilities');
|
|
165
|
+
if (capabilities.length)
|
|
166
|
+
payload.capabilities = capabilities;
|
|
167
|
+
const skills = csvFlag(parsed.flags, 'skills');
|
|
168
|
+
if (skills.length)
|
|
169
|
+
payload.skills = skills;
|
|
170
|
+
if (subagent) {
|
|
171
|
+
const parentAgentId = requiredFlag(parsed.flags, 'parent-agent-id');
|
|
172
|
+
if (!parentAgentId.ok)
|
|
173
|
+
return parentAgentId;
|
|
174
|
+
payload.parentAgentId = parentAgentId.value;
|
|
175
|
+
}
|
|
176
|
+
return { ok: true, value: payload };
|
|
177
|
+
}
|
|
178
|
+
function expectAgentMode(result, mode) {
|
|
179
|
+
if (!result.ok)
|
|
180
|
+
return result;
|
|
181
|
+
if (result.value.mode === mode)
|
|
182
|
+
return result;
|
|
183
|
+
return validationFailure(`Expected ${mode}, found ${result.value.mode}`);
|
|
184
|
+
}
|
|
185
|
+
function validateFileInputIsComplete(flags, subagent) {
|
|
186
|
+
const definitionFlags = ['project', 'scope', 'name', 'description', 'instructions', 'instructions-kind', 'capabilities'];
|
|
187
|
+
if (subagent)
|
|
188
|
+
definitionFlags.push('parent-agent-id');
|
|
189
|
+
const mixed = definitionFlags.filter((name) => flags[name] !== undefined);
|
|
190
|
+
return mixed.length
|
|
191
|
+
? validationFailure(`--file is a complete definition; do not combine it with ${mixed.map((name) => `--${name}`).join(', ')}`)
|
|
192
|
+
: { ok: true, value: undefined };
|
|
193
|
+
}
|
|
194
|
+
function resolveAgentForRender(parsed, registry, managerProfiles) {
|
|
195
|
+
const id = optionalStringFlag(parsed.flags, 'id');
|
|
196
|
+
if (id !== undefined)
|
|
197
|
+
return registry.getAgent(id);
|
|
198
|
+
const project = requiredFlag(parsed.flags, 'project');
|
|
199
|
+
const scope = scopeFlag(parsed.flags, 'scope', 'project');
|
|
200
|
+
const name = requiredFlag(parsed.flags, 'name');
|
|
201
|
+
if (!project.ok)
|
|
202
|
+
return project;
|
|
203
|
+
if (!scope.ok)
|
|
204
|
+
return scope;
|
|
205
|
+
if (!name.ok)
|
|
206
|
+
return name;
|
|
207
|
+
if (name.value === 'vgxness-manager' && managerProfiles !== undefined) {
|
|
208
|
+
const effective = managerProfiles.resolveEffectiveManager({ project: project.value, scope: scope.value, managerName: name.value });
|
|
209
|
+
return effective.ok ? { ok: true, value: effective.value.manager } : effective;
|
|
210
|
+
}
|
|
211
|
+
return registry.getAgentByName(project.value, scope.value, name.value);
|
|
212
|
+
}
|
|
213
|
+
function resolveSubagentsForRender(agent, registry) {
|
|
214
|
+
if (agent.mode !== 'agent')
|
|
215
|
+
return { ok: true, value: [] };
|
|
216
|
+
const summaries = registry.listSubagents(agent.id);
|
|
217
|
+
if (!summaries.ok)
|
|
218
|
+
return summaries;
|
|
219
|
+
const subagents = [];
|
|
220
|
+
for (const summary of summaries.value) {
|
|
221
|
+
const subagent = registry.getAgent(summary.id);
|
|
222
|
+
if (!subagent.ok)
|
|
223
|
+
return subagent;
|
|
224
|
+
subagents.push(subagent.value);
|
|
225
|
+
}
|
|
226
|
+
return { ok: true, value: subagents };
|
|
227
|
+
}
|
|
228
|
+
function resolveAgentsInput(flags) {
|
|
229
|
+
const scope = optionalScopeFlag(flags, 'scope');
|
|
230
|
+
if (!scope.ok)
|
|
231
|
+
return scope;
|
|
232
|
+
const mode = optionalModeFlag(flags, 'mode');
|
|
233
|
+
if (!mode.ok)
|
|
234
|
+
return mode;
|
|
235
|
+
const input = {};
|
|
236
|
+
const project = optionalStringFlag(flags, 'project');
|
|
237
|
+
const taskDescription = optionalStringFlag(flags, 'task') ?? optionalStringFlag(flags, 'task-description');
|
|
238
|
+
const intent = optionalStringFlag(flags, 'intent');
|
|
239
|
+
const desiredCapabilities = csvFlag(flags, 'capabilities');
|
|
240
|
+
const workflow = optionalStringFlag(flags, 'workflow');
|
|
241
|
+
const phase = optionalStringFlag(flags, 'phase');
|
|
242
|
+
const providerAdapter = optionalStringFlag(flags, 'provider') ?? optionalStringFlag(flags, 'provider-adapter');
|
|
243
|
+
if (project !== undefined)
|
|
244
|
+
input.project = project;
|
|
245
|
+
if (scope.value !== undefined)
|
|
246
|
+
input.scope = scope.value;
|
|
247
|
+
if (taskDescription !== undefined)
|
|
248
|
+
input.taskDescription = taskDescription;
|
|
249
|
+
if (intent !== undefined)
|
|
250
|
+
input.intent = intent;
|
|
251
|
+
if (desiredCapabilities.length > 0)
|
|
252
|
+
input.desiredCapabilities = desiredCapabilities;
|
|
253
|
+
if (workflow !== undefined)
|
|
254
|
+
input.workflow = workflow;
|
|
255
|
+
if (phase !== undefined)
|
|
256
|
+
input.phase = phase;
|
|
257
|
+
if (providerAdapter !== undefined)
|
|
258
|
+
input.providerAdapter = providerAdapter;
|
|
259
|
+
if (mode.value !== undefined)
|
|
260
|
+
input.mode = mode.value;
|
|
261
|
+
return { ok: true, value: input };
|
|
262
|
+
}
|
|
263
|
+
function managerProfileInput(flags) {
|
|
264
|
+
const scope = scopeFlag(flags, 'scope', 'project');
|
|
265
|
+
if (!scope.ok)
|
|
266
|
+
return scope;
|
|
267
|
+
return {
|
|
268
|
+
ok: true,
|
|
269
|
+
value: {
|
|
270
|
+
project: optionalStringFlag(flags, 'project') ?? 'vgxness',
|
|
271
|
+
scope: scope.value,
|
|
272
|
+
managerName: optionalStringFlag(flags, 'manager') ?? 'vgxness-manager',
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function managerProfileOverlayInput(flags) {
|
|
277
|
+
return managerProfileInput(flags);
|
|
278
|
+
}
|
|
279
|
+
export function runAgentCommand(command, parsed, database, environment) {
|
|
280
|
+
const handlers = createAgentRegistryToolHandlers({ service: new AgentRegistryService(database) });
|
|
281
|
+
const registry = new AgentRegistryService(database);
|
|
282
|
+
const managerProfiles = new ManagerProfileOverlayService({ agents: registry, overlays: new ManagerProfileOverlayRepository(database) });
|
|
283
|
+
if (command === 'seed') {
|
|
284
|
+
if (parsed.positionals[2] !== 'load')
|
|
285
|
+
return usageFailure('agents seed requires load');
|
|
286
|
+
const file = optionalStringFlag(parsed.flags, 'file');
|
|
287
|
+
const seed = new AgentSeedService(database);
|
|
288
|
+
if (file === undefined)
|
|
289
|
+
return jsonResult(seed.loadBuiltInDefaults());
|
|
290
|
+
const manifest = readJsonFile(file, environment);
|
|
291
|
+
if (!manifest.ok)
|
|
292
|
+
return resultFailure(manifest);
|
|
293
|
+
return jsonResult(seed.loadManifest(manifest.value));
|
|
294
|
+
}
|
|
295
|
+
if (command === 'register') {
|
|
296
|
+
const payload = registerPayload(parsed, environment, false);
|
|
297
|
+
return payload.ok ? jsonResult(handlers.registerAgent(payload.value)) : resultFailure(payload);
|
|
298
|
+
}
|
|
299
|
+
if (command === 'list') {
|
|
300
|
+
const filters = {};
|
|
301
|
+
const project = optionalStringFlag(parsed.flags, 'project');
|
|
302
|
+
if (project !== undefined)
|
|
303
|
+
filters.project = project;
|
|
304
|
+
const scope = optionalScopeFlag(parsed.flags, 'scope');
|
|
305
|
+
if (!scope.ok)
|
|
306
|
+
return resultFailure(scope);
|
|
307
|
+
if (scope.value !== undefined)
|
|
308
|
+
filters.scope = scope.value;
|
|
309
|
+
const mode = optionalModeFlag(parsed.flags, 'mode');
|
|
310
|
+
if (!mode.ok)
|
|
311
|
+
return resultFailure(mode);
|
|
312
|
+
filters.mode = mode.value ?? 'agent';
|
|
313
|
+
return jsonResult(handlers.listAgents(filters));
|
|
314
|
+
}
|
|
315
|
+
if (command === 'get') {
|
|
316
|
+
const id = optionalStringFlag(parsed.flags, 'id');
|
|
317
|
+
if (id !== undefined)
|
|
318
|
+
return jsonResult(expectAgentMode(handlers.getAgent({ id }), 'agent'));
|
|
319
|
+
const project = requiredFlag(parsed.flags, 'project');
|
|
320
|
+
const scope = scopeFlag(parsed.flags, 'scope', 'project');
|
|
321
|
+
const name = requiredFlag(parsed.flags, 'name');
|
|
322
|
+
if (!project.ok)
|
|
323
|
+
return resultFailure(project);
|
|
324
|
+
if (!scope.ok)
|
|
325
|
+
return resultFailure(scope);
|
|
326
|
+
if (!name.ok)
|
|
327
|
+
return resultFailure(name);
|
|
328
|
+
return jsonResult(expectAgentMode(handlers.getAgentByName({ project: project.value, scope: scope.value, name: name.value }), 'agent'));
|
|
329
|
+
}
|
|
330
|
+
if (command === 'resolve') {
|
|
331
|
+
const input = resolveAgentsInput(parsed.flags);
|
|
332
|
+
return input.ok ? jsonResult(registry.resolveAgents(input.value)) : resultFailure(input);
|
|
333
|
+
}
|
|
334
|
+
if (command === 'manager-profile') {
|
|
335
|
+
const action = parsed.positionals[2];
|
|
336
|
+
if (action !== 'get' && action !== 'set')
|
|
337
|
+
return usageFailure('agents manager-profile requires get or set');
|
|
338
|
+
const input = managerProfileInput(parsed.flags);
|
|
339
|
+
if (!input.ok)
|
|
340
|
+
return resultFailure(input);
|
|
341
|
+
if (action === 'get')
|
|
342
|
+
return jsonResult(managerProfiles.resolveEffectiveManager(input.value));
|
|
343
|
+
const baseline = managerProfiles.resolveEffectiveManager(input.value);
|
|
344
|
+
if (!baseline.ok)
|
|
345
|
+
return resultFailure(baseline);
|
|
346
|
+
const instructions = requiredFlag(parsed.flags, 'instructions');
|
|
347
|
+
if (!instructions.ok)
|
|
348
|
+
return resultFailure(instructions);
|
|
349
|
+
const saved = managerProfiles.save({ ...input.value, instructions: instructions.value });
|
|
350
|
+
if (!saved.ok)
|
|
351
|
+
return resultFailure(saved);
|
|
352
|
+
return jsonResult(managerProfiles.resolveEffectiveManager(input.value));
|
|
353
|
+
}
|
|
354
|
+
if (command === 'render') {
|
|
355
|
+
const provider = requiredFlag(parsed.flags, 'provider');
|
|
356
|
+
if (!provider.ok)
|
|
357
|
+
return resultFailure(provider);
|
|
358
|
+
const renderer = getProviderRenderer(provider.value);
|
|
359
|
+
if (!renderer.ok)
|
|
360
|
+
return resultFailure(renderer);
|
|
361
|
+
const agent = resolveAgentForRender(parsed, registry, managerProfiles);
|
|
362
|
+
if (!agent.ok)
|
|
363
|
+
return resultFailure(agent);
|
|
364
|
+
const subagents = resolveSubagentsForRender(agent.value, registry);
|
|
365
|
+
if (!subagents.ok)
|
|
366
|
+
return resultFailure(subagents);
|
|
367
|
+
return jsonResult(renderer.value.render({ agent: agent.value, subagents: subagents.value }));
|
|
368
|
+
}
|
|
369
|
+
return usageFailure(`Unknown agents command: ${command}`);
|
|
370
|
+
}
|
|
371
|
+
export function runSubagentCommand(command, parsed, database, environment) {
|
|
372
|
+
const handlers = createAgentRegistryToolHandlers({ service: new AgentRegistryService(database) });
|
|
373
|
+
if (command === 'register') {
|
|
374
|
+
const payload = registerPayload(parsed, environment, true);
|
|
375
|
+
return payload.ok ? jsonResult(handlers.registerSubagent(payload.value)) : resultFailure(payload);
|
|
376
|
+
}
|
|
377
|
+
if (command === 'list') {
|
|
378
|
+
const parentAgentId = requiredFlag(parsed.flags, 'parent-agent-id');
|
|
379
|
+
if (!parentAgentId.ok)
|
|
380
|
+
return resultFailure(parentAgentId);
|
|
381
|
+
return jsonResult(handlers.listSubagents({ parentAgentId: parentAgentId.value }));
|
|
382
|
+
}
|
|
383
|
+
if (command === 'get') {
|
|
384
|
+
const id = optionalStringFlag(parsed.flags, 'id');
|
|
385
|
+
if (id !== undefined)
|
|
386
|
+
return jsonResult(expectAgentMode(handlers.getAgent({ id }), 'subagent'));
|
|
387
|
+
const project = requiredFlag(parsed.flags, 'project');
|
|
388
|
+
const scope = scopeFlag(parsed.flags, 'scope', 'project');
|
|
389
|
+
const name = requiredFlag(parsed.flags, 'name');
|
|
390
|
+
if (!project.ok)
|
|
391
|
+
return resultFailure(project);
|
|
392
|
+
if (!scope.ok)
|
|
393
|
+
return resultFailure(scope);
|
|
394
|
+
if (!name.ok)
|
|
395
|
+
return resultFailure(name);
|
|
396
|
+
return jsonResult(expectAgentMode(handlers.getAgentByName({ project: project.value, scope: scope.value, name: name.value }), 'subagent'));
|
|
397
|
+
}
|
|
398
|
+
return usageFailure(`Unknown subagents command: ${command}`);
|
|
399
|
+
}
|
|
400
|
+
export function runSkillCommand(command, parsed, database, environment) {
|
|
401
|
+
const registry = new SkillRegistryService(database);
|
|
402
|
+
if (command === 'register') {
|
|
403
|
+
const project = requiredFlag(parsed.flags, 'project');
|
|
404
|
+
const scope = scopeFlag(parsed.flags, 'scope', 'project');
|
|
405
|
+
const name = requiredFlag(parsed.flags, 'name');
|
|
406
|
+
const description = requiredFlag(parsed.flags, 'description');
|
|
407
|
+
if (!project.ok)
|
|
408
|
+
return resultFailure(project);
|
|
409
|
+
if (!scope.ok)
|
|
410
|
+
return resultFailure(scope);
|
|
411
|
+
if (!name.ok)
|
|
412
|
+
return resultFailure(name);
|
|
413
|
+
if (!description.ok)
|
|
414
|
+
return resultFailure(description);
|
|
415
|
+
return jsonResult(registry.registerSkill({ project: project.value, scope: scope.value, name: name.value, description: description.value }));
|
|
416
|
+
}
|
|
417
|
+
if (command === 'list') {
|
|
418
|
+
const filters = {};
|
|
419
|
+
const project = optionalStringFlag(parsed.flags, 'project');
|
|
420
|
+
if (project !== undefined)
|
|
421
|
+
filters.project = project;
|
|
422
|
+
const scope = optionalScopeFlag(parsed.flags, 'scope');
|
|
423
|
+
if (!scope.ok)
|
|
424
|
+
return resultFailure(scope);
|
|
425
|
+
if (scope.value !== undefined)
|
|
426
|
+
filters.scope = scope.value;
|
|
427
|
+
return jsonResult(registry.listSkills(filters));
|
|
428
|
+
}
|
|
429
|
+
if (command === 'get') {
|
|
430
|
+
const skill = resolveSkill(parsed, registry);
|
|
431
|
+
return skill.ok ? jsonResult(registry.getSkillDetails(skill.value.id)) : resultFailure(skill);
|
|
432
|
+
}
|
|
433
|
+
if (command === 'add-version') {
|
|
434
|
+
const skill = resolveSkill(parsed, registry);
|
|
435
|
+
if (!skill.ok)
|
|
436
|
+
return resultFailure(skill);
|
|
437
|
+
const version = requiredFlag(parsed.flags, 'version');
|
|
438
|
+
const source = skillSourceFromFlags(parsed.flags);
|
|
439
|
+
const status = optionalSkillVersionStatusFlag(parsed.flags, 'status');
|
|
440
|
+
if (!version.ok)
|
|
441
|
+
return resultFailure(version);
|
|
442
|
+
if (!source.ok)
|
|
443
|
+
return resultFailure(source);
|
|
444
|
+
if (!status.ok)
|
|
445
|
+
return resultFailure(status);
|
|
446
|
+
const compatibility = optionalJsonFlag(parsed.flags, 'compatibility');
|
|
447
|
+
if (!compatibility.ok)
|
|
448
|
+
return resultFailure(compatibility);
|
|
449
|
+
return jsonResult(registry.addSkillVersion({
|
|
450
|
+
skillId: skill.value.id,
|
|
451
|
+
version: version.value,
|
|
452
|
+
source: source.value,
|
|
453
|
+
...(compatibility.value !== undefined ? { compatibility: compatibility.value } : {}),
|
|
454
|
+
...(status.value !== undefined ? { status: status.value } : {}),
|
|
455
|
+
...(parsed.flags.activate === true ? { activate: true } : {}),
|
|
456
|
+
}));
|
|
457
|
+
}
|
|
458
|
+
if (command === 'attach') {
|
|
459
|
+
const skill = resolveSkill(parsed, registry);
|
|
460
|
+
const targetType = skillTargetTypeFlag(parsed.flags, 'target-type');
|
|
461
|
+
const targetKey = requiredFlag(parsed.flags, 'target-key');
|
|
462
|
+
if (!skill.ok)
|
|
463
|
+
return resultFailure(skill);
|
|
464
|
+
if (!targetType.ok)
|
|
465
|
+
return resultFailure(targetType);
|
|
466
|
+
if (!targetKey.ok)
|
|
467
|
+
return resultFailure(targetKey);
|
|
468
|
+
const versionId = optionalStringFlag(parsed.flags, 'version-id') ?? skill.value.currentVersionId;
|
|
469
|
+
const metadata = jsonFlag(parsed.flags, 'metadata', {});
|
|
470
|
+
if (!metadata.ok)
|
|
471
|
+
return resultFailure(metadata);
|
|
472
|
+
return jsonResult(registry.attachSkill({
|
|
473
|
+
skillId: skill.value.id,
|
|
474
|
+
targetType: targetType.value,
|
|
475
|
+
targetKey: targetKey.value,
|
|
476
|
+
...(versionId !== undefined ? { versionId } : {}),
|
|
477
|
+
metadata: metadata.value,
|
|
478
|
+
}));
|
|
479
|
+
}
|
|
480
|
+
if (command === 'detach') {
|
|
481
|
+
const skill = resolveSkill(parsed, registry);
|
|
482
|
+
const targetType = skillTargetTypeFlag(parsed.flags, 'target-type');
|
|
483
|
+
const targetKey = requiredFlag(parsed.flags, 'target-key');
|
|
484
|
+
if (!skill.ok)
|
|
485
|
+
return resultFailure(skill);
|
|
486
|
+
if (!targetType.ok)
|
|
487
|
+
return resultFailure(targetType);
|
|
488
|
+
if (!targetKey.ok)
|
|
489
|
+
return resultFailure(targetKey);
|
|
490
|
+
return jsonResult(registry.detachSkill(skill.value.id, targetType.value, targetKey.value));
|
|
491
|
+
}
|
|
492
|
+
if (command === 'record-usage') {
|
|
493
|
+
const skill = resolveSkill(parsed, registry);
|
|
494
|
+
const outcome = skillUsageOutcomeFlag(parsed.flags, 'outcome');
|
|
495
|
+
if (!skill.ok)
|
|
496
|
+
return resultFailure(skill);
|
|
497
|
+
if (!outcome.ok)
|
|
498
|
+
return resultFailure(outcome);
|
|
499
|
+
const targetType = optionalSkillTargetTypeFlag(parsed.flags, 'target-type');
|
|
500
|
+
if (!targetType.ok)
|
|
501
|
+
return resultFailure(targetType);
|
|
502
|
+
const targetKey = optionalStringFlag(parsed.flags, 'target-key');
|
|
503
|
+
const versionId = optionalStringFlag(parsed.flags, 'version-id') ?? skill.value.currentVersionId;
|
|
504
|
+
const runId = optionalStringFlag(parsed.flags, 'run-id');
|
|
505
|
+
const notes = optionalStringFlag(parsed.flags, 'notes');
|
|
506
|
+
return jsonResult(registry.recordSkillUsage({
|
|
507
|
+
skillId: skill.value.id,
|
|
508
|
+
...(versionId !== undefined ? { versionId } : {}),
|
|
509
|
+
...(runId !== undefined ? { runId } : {}),
|
|
510
|
+
...(targetType.value !== undefined ? { targetType: targetType.value } : {}),
|
|
511
|
+
...(targetKey !== undefined ? { targetKey } : {}),
|
|
512
|
+
outcome: outcome.value,
|
|
513
|
+
...(notes !== undefined ? { notes } : {}),
|
|
514
|
+
}));
|
|
515
|
+
}
|
|
516
|
+
if (command === 'resolve') {
|
|
517
|
+
const input = resolveSkillsInput(parsed.flags);
|
|
518
|
+
return input.ok ? jsonResult(registry.resolveSkills(input.value)) : resultFailure(input);
|
|
519
|
+
}
|
|
520
|
+
if (command === 'index') {
|
|
521
|
+
const input = skillIndexInput(parsed.flags);
|
|
522
|
+
if (!input.ok)
|
|
523
|
+
return resultFailure(input);
|
|
524
|
+
return jsonResult(new SkillIndexService(registry).getIndex(input.value));
|
|
525
|
+
}
|
|
526
|
+
if (command === 'export') {
|
|
527
|
+
const input = skillIndexInput(parsed.flags);
|
|
528
|
+
if (!input.ok)
|
|
529
|
+
return resultFailure(input);
|
|
530
|
+
return jsonResult(new SkillExportService(new SkillIndexService(registry)).export(input.value));
|
|
531
|
+
}
|
|
532
|
+
if (command === 'status') {
|
|
533
|
+
const input = skillStatusInput(parsed.flags);
|
|
534
|
+
if (!input.ok)
|
|
535
|
+
return resultFailure(input);
|
|
536
|
+
return jsonResult(new SkillStatusService(registry, new AgentRegistryService(database)).getStatus(input.value));
|
|
537
|
+
}
|
|
538
|
+
if (command === 'propose') {
|
|
539
|
+
const skill = resolveSkill(parsed, registry);
|
|
540
|
+
if (!skill.ok)
|
|
541
|
+
return resultFailure(skill);
|
|
542
|
+
const baseVersionId = optionalStringFlag(parsed.flags, 'base-version-id') ?? skill.value.currentVersionId;
|
|
543
|
+
if (baseVersionId === undefined)
|
|
544
|
+
return resultFailure(validationFailure('Missing required --base-version-id because the skill has no current version'));
|
|
545
|
+
const proposedVersion = requiredFlag(parsed.flags, 'proposed-version');
|
|
546
|
+
const proposedSource = skillSourceFromFlags(parsed.flags);
|
|
547
|
+
const rationale = requiredFlag(parsed.flags, 'rationale');
|
|
548
|
+
const compatibility = optionalJsonFlag(parsed.flags, 'compatibility');
|
|
549
|
+
const sourceSignal = jsonFlag(parsed.flags, 'source-signal', {});
|
|
550
|
+
if (!proposedVersion.ok)
|
|
551
|
+
return resultFailure(proposedVersion);
|
|
552
|
+
if (!proposedSource.ok)
|
|
553
|
+
return resultFailure(proposedSource);
|
|
554
|
+
if (!rationale.ok)
|
|
555
|
+
return resultFailure(rationale);
|
|
556
|
+
if (!compatibility.ok)
|
|
557
|
+
return resultFailure(compatibility);
|
|
558
|
+
if (!sourceSignal.ok)
|
|
559
|
+
return resultFailure(sourceSignal);
|
|
560
|
+
return jsonResult(registry.createSkillImprovementProposal({
|
|
561
|
+
skillId: skill.value.id,
|
|
562
|
+
baseVersionId,
|
|
563
|
+
proposedVersion: proposedVersion.value,
|
|
564
|
+
proposedSource: proposedSource.value,
|
|
565
|
+
...(compatibility.value !== undefined ? { proposedCompatibility: compatibility.value } : {}),
|
|
566
|
+
rationale: rationale.value,
|
|
567
|
+
sourceSignal: sourceSignal.value,
|
|
568
|
+
}));
|
|
569
|
+
}
|
|
570
|
+
if (command === 'proposals') {
|
|
571
|
+
const filters = {};
|
|
572
|
+
const skillId = optionalStringFlag(parsed.flags, 'skill-id');
|
|
573
|
+
if (skillId !== undefined)
|
|
574
|
+
filters.skillId = skillId;
|
|
575
|
+
const status = optionalSkillImprovementProposalStatusFlag(parsed.flags, 'status');
|
|
576
|
+
if (!status.ok)
|
|
577
|
+
return resultFailure(status);
|
|
578
|
+
if (status.value !== undefined)
|
|
579
|
+
filters.status = status.value;
|
|
580
|
+
return jsonResult(registry.listSkillImprovementProposals(filters));
|
|
581
|
+
}
|
|
582
|
+
if (command === 'create-scenario') {
|
|
583
|
+
const skill = resolveSkill(parsed, registry);
|
|
584
|
+
if (!skill.ok)
|
|
585
|
+
return resultFailure(skill);
|
|
586
|
+
const name = scenarioNameFlag(parsed.flags);
|
|
587
|
+
const criteria = jsonFlag(parsed.flags, 'criteria', {});
|
|
588
|
+
const createdBy = requiredFlag(parsed.flags, 'created-by');
|
|
589
|
+
if (!name.ok)
|
|
590
|
+
return resultFailure(name);
|
|
591
|
+
if (!criteria.ok)
|
|
592
|
+
return resultFailure(criteria);
|
|
593
|
+
if (!createdBy.ok)
|
|
594
|
+
return resultFailure(createdBy);
|
|
595
|
+
const proposalId = optionalStringFlag(parsed.flags, 'proposal');
|
|
596
|
+
const versionId = optionalStringFlag(parsed.flags, 'version-id');
|
|
597
|
+
return jsonResult(registry.createSkillEvaluationScenario({
|
|
598
|
+
skillId: skill.value.id,
|
|
599
|
+
name: name.value,
|
|
600
|
+
criteria: criteria.value,
|
|
601
|
+
createdBy: createdBy.value,
|
|
602
|
+
...(proposalId !== undefined ? { proposalId } : {}),
|
|
603
|
+
...(versionId !== undefined ? { versionId } : {}),
|
|
604
|
+
}));
|
|
605
|
+
}
|
|
606
|
+
if (command === 'list-scenarios') {
|
|
607
|
+
const skill = resolveSkill(parsed, registry);
|
|
608
|
+
if (!skill.ok)
|
|
609
|
+
return resultFailure(skill);
|
|
610
|
+
const proposalId = optionalStringFlag(parsed.flags, 'proposal');
|
|
611
|
+
const versionId = optionalStringFlag(parsed.flags, 'version-id');
|
|
612
|
+
return jsonResult(registry.listSkillEvaluationScenarios({
|
|
613
|
+
skillId: skill.value.id,
|
|
614
|
+
...(proposalId !== undefined ? { proposalId } : {}),
|
|
615
|
+
...(versionId !== undefined ? { versionId } : {}),
|
|
616
|
+
}));
|
|
617
|
+
}
|
|
618
|
+
if (command === 'record-evaluation-result') {
|
|
619
|
+
const scenarioId = requiredFlag(parsed.flags, 'scenario');
|
|
620
|
+
const status = skillEvaluationResultStatusFlag(parsed.flags, 'status');
|
|
621
|
+
const result = jsonFlag(parsed.flags, 'result', {});
|
|
622
|
+
const observedBehavior = requiredFlag(parsed.flags, 'observed-behavior');
|
|
623
|
+
const evaluator = requiredFlag(parsed.flags, 'evaluator');
|
|
624
|
+
if (!scenarioId.ok)
|
|
625
|
+
return resultFailure(scenarioId);
|
|
626
|
+
if (!status.ok)
|
|
627
|
+
return resultFailure(status);
|
|
628
|
+
if (!result.ok)
|
|
629
|
+
return resultFailure(result);
|
|
630
|
+
if (!observedBehavior.ok)
|
|
631
|
+
return resultFailure(observedBehavior);
|
|
632
|
+
if (!evaluator.ok)
|
|
633
|
+
return resultFailure(evaluator);
|
|
634
|
+
const proposalId = optionalStringFlag(parsed.flags, 'proposal');
|
|
635
|
+
const versionId = optionalStringFlag(parsed.flags, 'version-id');
|
|
636
|
+
const notes = optionalStringFlag(parsed.flags, 'notes');
|
|
637
|
+
return jsonResult(registry.recordSkillEvaluationResult({
|
|
638
|
+
scenarioId: scenarioId.value,
|
|
639
|
+
status: status.value,
|
|
640
|
+
result: result.value,
|
|
641
|
+
observedBehavior: observedBehavior.value,
|
|
642
|
+
evaluator: evaluator.value,
|
|
643
|
+
...(proposalId !== undefined ? { proposalId } : {}),
|
|
644
|
+
...(versionId !== undefined ? { versionId } : {}),
|
|
645
|
+
...(notes !== undefined ? { notes } : {}),
|
|
646
|
+
}));
|
|
647
|
+
}
|
|
648
|
+
if (command === 'list-evaluation-results') {
|
|
649
|
+
const status = optionalSkillEvaluationResultStatusFlag(parsed.flags, 'status');
|
|
650
|
+
if (!status.ok)
|
|
651
|
+
return resultFailure(status);
|
|
652
|
+
const scenarioId = optionalStringFlag(parsed.flags, 'scenario');
|
|
653
|
+
const skillId = optionalStringFlag(parsed.flags, 'skill-id');
|
|
654
|
+
const proposalId = optionalStringFlag(parsed.flags, 'proposal');
|
|
655
|
+
const versionId = optionalStringFlag(parsed.flags, 'version-id');
|
|
656
|
+
const evaluator = optionalStringFlag(parsed.flags, 'evaluator');
|
|
657
|
+
return jsonResult(registry.listSkillEvaluationResults({
|
|
658
|
+
...(scenarioId !== undefined ? { scenarioId } : {}),
|
|
659
|
+
...(skillId !== undefined ? { skillId } : {}),
|
|
660
|
+
...(proposalId !== undefined ? { proposalId } : {}),
|
|
661
|
+
...(versionId !== undefined ? { versionId } : {}),
|
|
662
|
+
...(evaluator !== undefined ? { evaluator } : {}),
|
|
663
|
+
...(status.value !== undefined ? { status: status.value } : {}),
|
|
664
|
+
}));
|
|
665
|
+
}
|
|
666
|
+
if (command === 'get-proposal') {
|
|
667
|
+
const proposalId = requiredFlag(parsed.flags, 'proposal');
|
|
668
|
+
return proposalId.ok ? jsonResult(registry.getSkillImprovementProposal(proposalId.value)) : resultFailure(proposalId);
|
|
669
|
+
}
|
|
670
|
+
if (command === 'submit-proposal' ||
|
|
671
|
+
command === 'approve-proposal' ||
|
|
672
|
+
command === 'reject-proposal' ||
|
|
673
|
+
command === 'cancel-proposal' ||
|
|
674
|
+
command === 'apply-proposal') {
|
|
675
|
+
const input = proposalActorInput(parsed.flags);
|
|
676
|
+
if (!input.ok)
|
|
677
|
+
return resultFailure(input);
|
|
678
|
+
if (command === 'submit-proposal')
|
|
679
|
+
return jsonResult(registry.submitSkillImprovementProposal(input.value));
|
|
680
|
+
if (command === 'approve-proposal')
|
|
681
|
+
return jsonResult(registry.approveSkillImprovementProposal(input.value));
|
|
682
|
+
if (command === 'reject-proposal')
|
|
683
|
+
return jsonResult(registry.rejectSkillImprovementProposal(input.value));
|
|
684
|
+
if (command === 'cancel-proposal')
|
|
685
|
+
return jsonResult(registry.cancelSkillImprovementProposal(input.value));
|
|
686
|
+
return jsonResult(registry.applySkillImprovementProposal(input.value));
|
|
687
|
+
}
|
|
688
|
+
if (command === 'payload') {
|
|
689
|
+
const input = skillPayloadInput(parsed.flags);
|
|
690
|
+
if (!input.ok)
|
|
691
|
+
return resultFailure(input);
|
|
692
|
+
const seeded = runBootSkillSeed(database, environment.env);
|
|
693
|
+
if (!seeded.ok)
|
|
694
|
+
return resultFailure(seeded);
|
|
695
|
+
return jsonResult(registry.buildSkillPayload(input.value, { workspaceRoot: environment.cwd }));
|
|
696
|
+
}
|
|
697
|
+
return usageFailure(`Unknown skills command: ${command}`);
|
|
698
|
+
}
|
|
699
|
+
// Re-export helpers for external use
|
|
700
|
+
export { expectAgentMode, managerProfileInput, managerProfileOverlayInput, proposalActorInput, registerPayload, resolveAgentForRender, resolveAgentsInput, resolveSkill, resolveSkillsInput, resolveSubagentsForRender, scenarioNameFlag, skillIndexInput, skillPayloadInput, skillStatusInput, validateFileInputIsComplete, };
|