vgxness 1.20.4 → 1.20.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/claude/agent-renderer.js +82 -0
- package/dist/{mcp → adapters/claude/install}/claude-code-agent-config.js +64 -9
- package/dist/{mcp → adapters/claude/install}/claude-code-config.js +28 -6
- package/dist/{mcp → adapters/claude/install}/claude-code-project-memory.js +35 -5
- package/dist/{mcp → adapters/claude/install}/claude-code-scope.js +12 -3
- package/dist/{mcp → adapters/claude/install}/claude-code-user-config.js +26 -5
- package/dist/{mcp → adapters/claude/install}/claude-code-user-memory.js +47 -7
- package/dist/{mcp → adapters/claude/install}/client-install-claude-code-contract.js +45 -8
- package/dist/{mcp → adapters/claude/install}/client-install-claude-code.js +98 -14
- package/dist/adapters/json/agent-renderer.js +104 -0
- package/dist/adapters/opencode/agent-renderer.js +113 -0
- package/dist/{mcp → adapters/opencode/install}/client-install-opencode-contract.js +2 -2
- package/dist/{mcp → adapters/opencode/install}/client-install-opencode.js +1 -1
- package/dist/{mcp → adapters/opencode/install}/opencode-default-agent-config.js +2 -2
- package/dist/{mcp → adapters/opencode/install}/opencode-handoff-preview.js +60 -7
- package/dist/{mcp → adapters/opencode/install}/opencode-visibility.js +1 -1
- package/dist/adapters/provider-renderer.js +6 -0
- package/dist/agents/agent-activation-service.js +1 -263
- package/dist/agents/agent-lookup-contexts.js +1 -28
- package/dist/agents/agent-registry-service.js +1 -81
- package/dist/agents/agent-resolver.js +1 -287
- package/dist/agents/agent-seed-service.js +1 -157
- package/dist/agents/agent-seed-upgrade-service.js +1 -231
- package/dist/agents/agent-selector-resolver.js +1 -28
- package/dist/agents/boot-upgrade.js +1 -59
- package/dist/agents/canonical-agent-manifest.js +1 -245
- package/dist/agents/canonical-agent-projection.js +1 -236
- package/dist/agents/manager-profile-overlay-service.js +1 -60
- package/dist/agents/profile-model-routing.js +1 -30
- package/dist/agents/renderers/claude-renderer.js +1 -82
- package/dist/agents/renderers/index.js +1 -14
- package/dist/agents/renderers/json-renderer.js +1 -104
- package/dist/agents/renderers/opencode-renderer.js +1 -113
- package/dist/agents/renderers/provider-adapter.js +1 -6
- package/dist/agents/repositories/agent-seed-history.js +1 -128
- package/dist/agents/repositories/agents.js +1 -200
- package/dist/agents/repositories/manager-profile-overlays.js +1 -90
- package/dist/agents/schema.js +1 -1
- package/dist/application/agents/agent-activation-service.js +261 -0
- package/dist/application/agents/agent-lookup-contexts.js +28 -0
- package/dist/application/agents/agent-registry-service.js +81 -0
- package/dist/application/agents/agent-resolver.js +287 -0
- package/dist/application/agents/agent-seed-service.js +157 -0
- package/dist/application/agents/agent-seed-upgrade-service.js +231 -0
- package/dist/application/agents/agent-selector-resolver.js +28 -0
- package/dist/application/agents/boot-upgrade.js +59 -0
- package/dist/application/agents/canonical-agent-projection.js +236 -0
- package/dist/application/agents/manager-profile-overlay-service.js +68 -0
- package/dist/application/agents/profile-model-routing.js +30 -0
- package/dist/application/agents/renderers/claude-renderer.js +1 -0
- package/dist/application/agents/renderers/index.js +14 -0
- package/dist/application/agents/renderers/json-renderer.js +1 -0
- package/dist/application/agents/renderers/opencode-renderer.js +1 -0
- package/dist/application/agents/renderers/provider-adapter.js +1 -0
- package/dist/application/memory/active-work-preview.js +75 -0
- package/dist/application/memory/agent-memory-capture-service.js +498 -0
- package/dist/application/memory/import/dry-run-planner.js +58 -0
- package/dist/application/memory/import/index.js +3 -0
- package/dist/application/memory/import/observation-writer.js +226 -0
- package/dist/application/memory/import/package.js +179 -0
- package/dist/application/memory/memory-service.js +202 -0
- package/dist/application/memory/search.js +11 -0
- package/dist/{mcp → application/provider-setup}/provider-change-plan.js +74 -13
- package/dist/{mcp → application/provider-setup}/provider-doctor.js +201 -31
- package/dist/{mcp → application/provider-setup}/provider-health-types.js +1 -1
- package/dist/{mcp → application/provider-setup}/provider-status.js +170 -33
- package/dist/application/runs/execution-planning.js +180 -0
- package/dist/application/runs/operation-execution.js +1 -0
- package/dist/application/runs/operation-retry.js +129 -0
- package/dist/application/runs/resume-after-approval-result.js +88 -0
- package/dist/application/runs/run-insights.js +270 -0
- package/dist/application/runs/run-service.js +1480 -0
- package/dist/application/runs/run-snapshot-export-service.js +31 -0
- package/dist/application/runs/sandbox-process-execution.js +244 -0
- package/dist/application/runs/sandbox-worktree-planning.js +59 -0
- package/dist/application/runs/task-scoped-command-grant-service.js +224 -0
- package/dist/application/sdd/artifact-portability-service.js +137 -0
- package/dist/application/sdd/cockpit-read-model.js +195 -0
- package/dist/application/sdd/sdd-continuation-plan.js +265 -0
- package/dist/application/sdd/sdd-workflow-service.js +892 -0
- package/dist/application/skills/boot-seed.js +42 -0
- package/dist/application/skills/personal-skills.js +41 -0
- package/dist/application/skills/skill-export-service.js +34 -0
- package/dist/application/skills/skill-index-service.js +126 -0
- package/dist/application/skills/skill-payload.js +186 -0
- package/dist/application/skills/skill-registry-service.js +648 -0
- package/dist/application/skills/skill-resolver.js +368 -0
- package/dist/application/skills/skill-seed-service.js +242 -0
- package/dist/application/skills/skill-status-service.js +147 -0
- package/dist/cli/bun-bin.js +0 -0
- package/dist/cli/cli-flags.js +1 -387
- package/dist/cli/cli-help.js +1 -173
- package/dist/cli/cli-helpers.js +1 -77
- package/dist/cli/cli-types.js +1 -1
- package/dist/cli/commands/agent-skill-dispatcher.js +1 -700
- package/dist/cli/commands/index.js +1 -9
- package/dist/cli/commands/interactive-entrypoint-dispatcher.js +1 -14
- package/dist/cli/commands/mcp-dispatcher.js +1 -232
- package/dist/cli/commands/memory-sdd-dispatcher.js +1 -367
- package/dist/cli/commands/run-permission-dispatcher.js +1 -455
- package/dist/cli/commands/setup-dispatcher.js +1 -496
- package/dist/cli/commands/status-dispatcher.js +1 -130
- package/dist/cli/commands/verification-dispatcher.js +1 -47
- package/dist/cli/commands/workflow-dispatcher.js +1 -566
- package/dist/cli/dispatcher.js +1 -247
- package/dist/cli/doctor-renderer.js +1 -26
- package/dist/cli/home-tui-app.js +1 -411
- package/dist/cli/home-tui-controller.js +1 -314
- package/dist/cli/mcp-start-path.js +1 -21
- package/dist/cli/product-resume-renderer.js +1 -32
- package/dist/cli/product-status-renderer.js +1 -81
- package/dist/cli/sdd-renderer.js +1 -247
- package/dist/cli/setup-plan-renderer.js +1 -79
- package/dist/cli/setup-status-renderer.js +1 -50
- package/dist/cli/setup-tui-app.js +1 -130
- package/dist/cli/setup-tui-controller.js +1 -89
- package/dist/cli/tui/focus-reducer.js +1 -0
- package/dist/cli/tui/focus-types.js +1 -0
- package/dist/cli/tui/ink/app-shell.js +1 -0
- package/dist/cli/tui/ink/components.js +1 -38
- package/dist/cli/tui/ink/help-overlay.js +1 -0
- package/dist/cli/tui/ink/state-components.js +1 -0
- package/dist/cli/tui/ink/theme.js +1 -36
- package/dist/cli/tui/key-intents.js +1 -0
- package/dist/cli/tui/keymap.js +1 -20
- package/dist/cli/tui/navigation.js +1 -10
- package/dist/cli/tui/screen-registry.js +1 -0
- package/dist/cli/tui/terminal-capabilities.js +1 -12
- package/dist/cli/tui/tui-types.js +1 -1
- package/dist/cli/tui/visual/badges.js +1 -19
- package/dist/cli/tui/visual/footer.js +1 -27
- package/dist/cli/tui/visual/index.js +1 -3
- package/dist/cli/tui/visual/viewport.js +1 -11
- package/dist/cli/tui-render-helpers.js +1 -200
- package/dist/cli/verification-plan-renderer.js +1 -25
- package/dist/cli/verification-report-renderer.js +1 -19
- package/dist/domain/agents/canonical-agent-manifest.js +355 -0
- package/dist/domain/agents/schema.js +1 -0
- package/dist/domain/memory/active-work-topics.js +64 -0
- package/dist/domain/memory/memory-capture-schema.js +1 -0
- package/dist/domain/memory/schema.js +1 -0
- package/dist/domain/runs/schema.js +5 -0
- package/dist/domain/sdd/cockpit-types.js +1 -0
- package/dist/domain/sdd/schema.js +111 -0
- package/dist/domain/skills/schema.js +1 -0
- package/dist/governance/risk-classifier.js +2 -0
- package/dist/interfaces/cli/bun-bin.js +46 -0
- package/dist/interfaces/cli/cli-flags.js +391 -0
- package/dist/interfaces/cli/cli-help.js +173 -0
- package/dist/interfaces/cli/cli-helpers.js +77 -0
- package/dist/interfaces/cli/cli-types.js +1 -0
- package/dist/interfaces/cli/commands/agent-skill-dispatcher.js +700 -0
- package/dist/interfaces/cli/commands/index.js +9 -0
- package/dist/interfaces/cli/commands/interactive-entrypoint-dispatcher.js +14 -0
- package/dist/interfaces/cli/commands/mcp-dispatcher.js +252 -0
- package/dist/interfaces/cli/commands/memory-sdd-dispatcher.js +367 -0
- package/dist/interfaces/cli/commands/run-permission-dispatcher.js +460 -0
- package/dist/interfaces/cli/commands/setup-dispatcher.js +496 -0
- package/dist/interfaces/cli/commands/status-dispatcher.js +130 -0
- package/dist/interfaces/cli/commands/verification-dispatcher.js +47 -0
- package/dist/interfaces/cli/commands/workflow-dispatcher.js +566 -0
- package/dist/interfaces/cli/dispatcher.js +247 -0
- package/dist/interfaces/cli/doctor-renderer.js +26 -0
- package/dist/interfaces/cli/home-tui-app.js +462 -0
- package/dist/interfaces/cli/home-tui-controller.js +341 -0
- package/dist/interfaces/cli/index.js +27 -0
- package/dist/interfaces/cli/mcp-start-path.js +21 -0
- package/dist/interfaces/cli/product-resume-renderer.js +32 -0
- package/dist/interfaces/cli/product-status-renderer.js +81 -0
- package/dist/interfaces/cli/sdd-renderer.js +247 -0
- package/dist/interfaces/cli/setup-plan-renderer.js +79 -0
- package/dist/interfaces/cli/setup-status-renderer.js +50 -0
- package/dist/interfaces/cli/setup-tui-app.js +135 -0
- package/dist/interfaces/cli/setup-tui-controller.js +89 -0
- package/dist/interfaces/cli/tui/focus-reducer.js +60 -0
- package/dist/interfaces/cli/tui/focus-types.js +10 -0
- package/dist/interfaces/cli/tui/ink/app-shell.js +16 -0
- package/dist/interfaces/cli/tui/ink/components.js +38 -0
- package/dist/interfaces/cli/tui/ink/help-overlay.js +6 -0
- package/dist/interfaces/cli/tui/ink/state-components.js +22 -0
- package/dist/interfaces/cli/tui/ink/theme.js +36 -0
- package/dist/interfaces/cli/tui/key-intents.js +33 -0
- package/dist/interfaces/cli/tui/keymap.js +20 -0
- package/dist/interfaces/cli/tui/navigation.js +10 -0
- package/dist/interfaces/cli/tui/screen-registry.js +43 -0
- package/dist/interfaces/cli/tui/terminal-capabilities.js +12 -0
- package/dist/interfaces/cli/tui/tui-types.js +1 -0
- package/dist/interfaces/cli/tui/visual/badges.js +19 -0
- package/dist/interfaces/cli/tui/visual/footer.js +27 -0
- package/dist/interfaces/cli/tui/visual/index.js +3 -0
- package/dist/interfaces/cli/tui/visual/viewport.js +11 -0
- package/dist/interfaces/cli/tui-render-helpers.js +200 -0
- package/dist/interfaces/cli/verification-plan-renderer.js +25 -0
- package/dist/interfaces/cli/verification-report-renderer.js +19 -0
- package/dist/interfaces/mcp/contracts/agents.js +1 -0
- package/dist/interfaces/mcp/contracts/context.js +1 -0
- package/dist/interfaces/mcp/contracts/governance.js +1 -0
- package/dist/interfaces/mcp/contracts/index.js +1 -0
- package/dist/interfaces/mcp/contracts/memory.js +1 -0
- package/dist/interfaces/mcp/contracts/providers.js +1 -0
- package/dist/interfaces/mcp/contracts/runs.js +1 -0
- package/dist/interfaces/mcp/contracts/sdd.js +1 -0
- package/dist/interfaces/mcp/contracts/sessions.js +1 -0
- package/dist/interfaces/mcp/contracts/skills.js +1 -0
- package/dist/interfaces/mcp/contracts/verification.js +1 -0
- package/dist/interfaces/mcp/control-plane/handlers/agents.js +38 -0
- package/dist/interfaces/mcp/control-plane/handlers/context.js +12 -0
- package/dist/interfaces/mcp/control-plane/handlers/memory.js +95 -0
- package/dist/interfaces/mcp/control-plane/handlers/providers.js +19 -0
- package/dist/interfaces/mcp/control-plane/handlers/runs.js +134 -0
- package/dist/interfaces/mcp/control-plane/handlers/sdd.js +225 -0
- package/dist/interfaces/mcp/control-plane/handlers/sessions.js +39 -0
- package/dist/interfaces/mcp/control-plane/handlers/skills.js +82 -0
- package/dist/interfaces/mcp/control-plane/handlers/verification.js +11 -0
- package/dist/interfaces/mcp/control-plane/types.js +1 -0
- package/dist/interfaces/mcp/control-plane.js +235 -0
- package/dist/interfaces/mcp/schema.js +174 -0
- package/dist/interfaces/mcp/schemas/common.js +121 -0
- package/dist/interfaces/mcp/schemas/inputs/agents.js +69 -0
- package/dist/interfaces/mcp/schemas/inputs/context.js +32 -0
- package/dist/interfaces/mcp/schemas/inputs/governance.js +23 -0
- package/dist/interfaces/mcp/schemas/inputs/index.js +10 -0
- package/dist/interfaces/mcp/schemas/inputs/memory.js +50 -0
- package/dist/interfaces/mcp/schemas/inputs/providers.js +35 -0
- package/dist/interfaces/mcp/schemas/inputs/runs.js +146 -0
- package/dist/interfaces/mcp/schemas/inputs/sdd.js +102 -0
- package/dist/interfaces/mcp/schemas/inputs/sessions.js +32 -0
- package/dist/interfaces/mcp/schemas/inputs/skills.js +231 -0
- package/dist/interfaces/mcp/schemas/inputs/verification.js +9 -0
- package/dist/interfaces/mcp/schemas/outputs/index.js +2 -0
- package/dist/interfaces/mcp/schemas/outputs/providers.js +28 -0
- package/dist/interfaces/mcp/schemas/outputs/sdd.js +166 -0
- package/dist/interfaces/mcp/stdio-server.js +116 -0
- package/dist/interfaces/mcp/validation/agents.js +189 -0
- package/dist/interfaces/mcp/validation/common.js +415 -0
- package/dist/interfaces/mcp/validation/governance.js +50 -0
- package/dist/interfaces/mcp/validation/memory.js +133 -0
- package/dist/interfaces/mcp/validation/providers.js +94 -0
- package/dist/interfaces/mcp/validation/runs.js +514 -0
- package/dist/interfaces/mcp/validation/sdd.js +247 -0
- package/dist/interfaces/mcp/validation/sessions.js +51 -0
- package/dist/interfaces/mcp/validation/skills.js +685 -0
- package/dist/interfaces/mcp/validation/verification.js +24 -0
- package/dist/interfaces/mcp/validation.js +149 -0
- package/dist/mcp/control-plane-snapshot-service.js +65 -2
- package/dist/mcp/control-plane.js +1 -646
- package/dist/mcp/doctor.js +1 -1
- package/dist/mcp/index.js +17 -17
- package/dist/mcp/schema.js +1 -1072
- package/dist/mcp/stdio-server.js +1 -116
- package/dist/mcp/validation.js +1 -2239
- package/dist/memory/active-work-preview.js +1 -75
- package/dist/memory/active-work-topics.js +1 -64
- package/dist/memory/agent-memory-capture-service.js +1 -497
- package/dist/memory/import/dry-run-planner.js +1 -58
- package/dist/memory/import/index.js +1 -3
- package/dist/memory/import/observation-writer.js +1 -226
- package/dist/memory/import/package.js +1 -179
- package/dist/memory/memory-capture-schema.js +1 -1
- package/dist/memory/memory-service.js +1 -201
- package/dist/memory/repositories/artifacts.js +1 -67
- package/dist/memory/repositories/observations.js +1 -217
- package/dist/memory/repositories/sessions.js +1 -125
- package/dist/memory/repositories/traces.js +1 -78
- package/dist/memory/schema.js +1 -1
- package/dist/memory/search.js +1 -11
- package/dist/memory/sqlite/database.js +1 -228
- package/dist/memory/storage-paths.js +1 -72
- package/dist/payload/context-budget-policy.js +10 -0
- package/dist/payload/context-budget-service.js +26 -0
- package/dist/payload/payload-diagnostics.js +50 -0
- package/dist/permissions/explicit-request-authorization.js +126 -0
- package/dist/permissions/policy-evaluator.js +54 -14
- package/dist/runs/execution-planning.js +1 -178
- package/dist/runs/operation-execution.js +1 -1
- package/dist/runs/operation-retry.js +1 -129
- package/dist/runs/repositories/runs.js +1 -676
- package/dist/runs/repositories/task-scoped-command-grants.js +1 -462
- package/dist/runs/resume-after-approval-result.js +1 -84
- package/dist/runs/run-insights.js +1 -270
- package/dist/runs/run-service.js +1 -1439
- package/dist/runs/run-snapshot-export-service.js +1 -31
- package/dist/runs/sandbox-process-execution.js +1 -240
- package/dist/runs/sandbox-worktree-planning.js +1 -59
- package/dist/runs/schema.js +1 -5
- package/dist/runs/task-scoped-command-grant-service.js +1 -216
- package/dist/sdd/artifact-portability-service.js +1 -137
- package/dist/sdd/cockpit-read-model.js +1 -195
- package/dist/sdd/cockpit-types.js +1 -1
- package/dist/sdd/schema.js +1 -111
- package/dist/sdd/sdd-continuation-plan.js +1 -265
- package/dist/sdd/sdd-workflow-service.js +1 -822
- package/dist/setup/providers/claude-setup-adapter.js +11 -4
- package/dist/setup/providers/opencode-setup-adapter.js +10 -7
- package/dist/setup/setup-plan.js +20 -7
- package/dist/skills/boot-seed.js +1 -42
- package/dist/skills/personal-skills.js +1 -41
- package/dist/skills/repositories/skill-evaluation-requests.js +1 -190
- package/dist/skills/repositories/skill-evaluation-scenarios.js +1 -305
- package/dist/skills/repositories/skill-improvement-proposals.js +1 -355
- package/dist/skills/repositories/skills.js +1 -1077
- package/dist/skills/schema.js +1 -1
- package/dist/skills/skill-export-service.js +1 -34
- package/dist/skills/skill-index-service.js +1 -126
- package/dist/skills/skill-payload.js +1 -186
- package/dist/skills/skill-registry-service.js +1 -644
- package/dist/skills/skill-resolver.js +1 -368
- package/dist/skills/skill-seed-service.js +1 -242
- package/dist/skills/skill-status-service.js +1 -147
- package/dist/storage/agents/repositories/agent-seed-history.js +128 -0
- package/dist/storage/agents/repositories/agents.js +200 -0
- package/dist/storage/agents/repositories/manager-profile-overlays.js +90 -0
- package/dist/storage/memory/repositories/artifacts.js +67 -0
- package/dist/storage/memory/repositories/observations.js +217 -0
- package/dist/storage/memory/repositories/sessions.js +125 -0
- package/dist/storage/memory/repositories/traces.js +78 -0
- package/dist/storage/memory/sqlite/database.js +228 -0
- package/dist/storage/memory/storage-paths.js +72 -0
- package/dist/storage/runs/repositories/runs.js +676 -0
- package/dist/storage/runs/repositories/task-scoped-command-grants.js +464 -0
- package/dist/storage/skills/repositories/skill-evaluation-requests.js +190 -0
- package/dist/storage/skills/repositories/skill-evaluation-scenarios.js +305 -0
- package/dist/storage/skills/repositories/skill-improvement-proposals.js +355 -0
- package/dist/storage/skills/repositories/skills.js +1084 -0
- package/docs/architecture.md +2 -2
- package/docs/glossary.md +1 -1
- package/docs/mcp.md +1 -1
- package/docs/module-boundaries.md +114 -0
- package/docs/prd.md +1 -1
- package/docs/project-health-audit-v1.10.x.md +1 -1
- package/docs/providers.md +2 -2
- package/docs/safety.md +3 -3
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/apply-progress.md +122 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/archive-report.md +61 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/design.md +66 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/proposal.md +79 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/spec.md +67 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/tasks.md +63 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/verify-report.md +71 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/apply-progress.md +68 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/archive-report.md +61 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/design.md +43 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/proposal.md +61 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/spec.md +31 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/tasks.md +27 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/verify-report.md +58 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/apply-progress.md +65 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/archive-report.md +53 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/design.md +64 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/proposal.md +62 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/spec.md +51 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/tasks.md +50 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/verify-report.md +66 -0
- package/docs/storage.md +2 -2
- package/package.json +2 -2
- /package/dist/{mcp → adapters/claude/install}/claude-code-cli.js +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/001_initial.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/002_observation_revisions.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/003_agent_registry.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/004_run_runtime.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/005_run_approvals.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/006_run_operation_attempts.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/007_abandoned_operation_attempts.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/008_run_execution_plan_events.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/009_multiple_operation_attempts.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/010_skill_registry.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/011_skill_usage_resolution_outcomes.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/012_skill_improvement_proposals.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/013_skill_evaluation_scenarios.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/014_manager_profile_overlays.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/015_artifact_metadata.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/016_agent_seed_history.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/017_intent_signal_skill_targets.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/018_skill_system_v2.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/019_task_scoped_command_grants.sql +0 -0
|
@@ -1,566 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { canonicalOpenCodeDefaultModel } from '../../agents/canonical-agent-manifest.js';
|
|
3
|
-
import { createNaturalLanguagePlan } from '../../orchestrator/natural-language-planner.js';
|
|
4
|
-
import { RunService } from '../../runs/run-service.js';
|
|
5
|
-
import { normalizeSddPhaseInput, sddPhases } from '../../sdd/schema.js';
|
|
6
|
-
import { CommandAllowlistAdapter, commandAllowlistIds } from '../../workflows/command-allowlist-adapter.js';
|
|
7
|
-
import { GuardedProviderWorkflowExecutor, operationMetadataForWorkflowExecution, SafeNonDispatchingWorkflowExecutor, workflowExecutorSafety, } from '../../workflows/workflow-executor.js';
|
|
8
|
-
import { getWorkflowDefinition, listWorkflows } from '../../workflows/workflow-registry.js';
|
|
9
|
-
import { optionalStringFlag, requiredFlag } from '../cli-flags.js';
|
|
10
|
-
import { validationFailure } from '../cli-help.js';
|
|
11
|
-
import { jsonResult, resultFailure, toJsonValue } from '../cli-helpers.js';
|
|
12
|
-
function resolveWorkflowRunAgent(input) {
|
|
13
|
-
if (input.explicitAgentId !== undefined) {
|
|
14
|
-
const agent = input.registry.getAgent(input.explicitAgentId);
|
|
15
|
-
if (!agent.ok) {
|
|
16
|
-
return { ok: false, value: workflowRunBlockedAgentResolution(input, `Explicit --agent-id could not be resolved: ${agent.error.message}`) };
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
ok: true,
|
|
20
|
-
value: {
|
|
21
|
-
agent: agent.value,
|
|
22
|
-
summary: workflowRunAgentSummary(agent.value, {
|
|
23
|
-
policy: 'explicit-agent-id',
|
|
24
|
-
reasons: ['explicit --agent-id selected a registry agent'],
|
|
25
|
-
fallbackReason: null,
|
|
26
|
-
}),
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
const resolution = input.registry.resolveAgents({
|
|
31
|
-
project: input.project,
|
|
32
|
-
scope: 'project',
|
|
33
|
-
mode: 'agent',
|
|
34
|
-
workflow: input.workflow,
|
|
35
|
-
phase: input.phase,
|
|
36
|
-
providerAdapter: input.providerAdapter,
|
|
37
|
-
intent: input.intent,
|
|
38
|
-
taskDescription: input.intent,
|
|
39
|
-
desiredCapabilities: [],
|
|
40
|
-
});
|
|
41
|
-
if (!resolution.ok)
|
|
42
|
-
return { ok: false, value: workflowRunBlockedAgentResolution(input, resolution.error.message) };
|
|
43
|
-
const manager = resolution.value.candidates.find((candidate) => candidate.agent.name === 'vgxness-manager');
|
|
44
|
-
const selected = manager ?? resolution.value.candidates[0];
|
|
45
|
-
if (selected === undefined) {
|
|
46
|
-
return {
|
|
47
|
-
ok: false,
|
|
48
|
-
value: workflowRunBlockedAgentResolution(input, 'No project agent matched the requested workflow, phase, provider adapter, and project scope. Seed or register vgxness-manager before running workflows.', resolution.value.skipped.map((skipped) => ({ agent: skipped.agent, reasons: skipped.reasons }))),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
ok: true,
|
|
53
|
-
value: {
|
|
54
|
-
agent: selected.agent,
|
|
55
|
-
summary: workflowRunAgentSummary(selected.agent, {
|
|
56
|
-
policy: 'project-manager-preferred',
|
|
57
|
-
reasons: selected.reasons,
|
|
58
|
-
fallbackReason: manager === undefined && selected.agent.name !== 'vgxness-manager'
|
|
59
|
-
? 'vgxness-manager was not resolvable for this workflow/phase/provider; selected the highest-scoring project agent instead.'
|
|
60
|
-
: null,
|
|
61
|
-
score: selected.score,
|
|
62
|
-
}),
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function workflowRunAgentSummary(agent, details) {
|
|
67
|
-
return {
|
|
68
|
-
id: agent.id,
|
|
69
|
-
name: agent.name,
|
|
70
|
-
mode: agent.mode,
|
|
71
|
-
project: agent.project,
|
|
72
|
-
scope: agent.scope,
|
|
73
|
-
workflows: agent.workflows,
|
|
74
|
-
policy: details.policy,
|
|
75
|
-
reasons: details.reasons,
|
|
76
|
-
fallbackReason: details.fallbackReason ?? null,
|
|
77
|
-
...(details.score !== undefined ? { score: details.score } : {}),
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function workflowRunBlockedAgentResolution(input, reason, skipped) {
|
|
81
|
-
return {
|
|
82
|
-
ok: false,
|
|
83
|
-
status: 'blocked',
|
|
84
|
-
reason,
|
|
85
|
-
workflow: input.workflow,
|
|
86
|
-
phase: input.phase,
|
|
87
|
-
providerAdapter: input.providerAdapter,
|
|
88
|
-
selectedAgent: null,
|
|
89
|
-
safety: {
|
|
90
|
-
executed: false,
|
|
91
|
-
recordsRuns: false,
|
|
92
|
-
callsProvider: false,
|
|
93
|
-
editsFiles: false,
|
|
94
|
-
writesProviderConfig: false,
|
|
95
|
-
mutatesSddArtifacts: false,
|
|
96
|
-
},
|
|
97
|
-
nextAction: 'Register or seed a real project agent such as vgxness-manager, then retry the workflow run.',
|
|
98
|
-
...(skipped !== undefined ? { skipped } : {}),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function workflowRunSafety(workflow) {
|
|
102
|
-
return {
|
|
103
|
-
executed: true,
|
|
104
|
-
recordsRuns: true,
|
|
105
|
-
callsProvider: false,
|
|
106
|
-
editsFiles: false,
|
|
107
|
-
writesProviderConfig: false,
|
|
108
|
-
mutability: workflow.mutability,
|
|
109
|
-
safetyProfile: workflow.safetyProfile,
|
|
110
|
-
requiresSddArtifacts: workflow.requiresSddArtifacts,
|
|
111
|
-
notes: [
|
|
112
|
-
'Safe run slice: recorded run intent and checkpoint only.',
|
|
113
|
-
'No provider tools were called, no user files were edited, no provider config was written, and no SDD artifacts were mutated.',
|
|
114
|
-
],
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function workflowRunRecommendation(selected, recommended, planner) {
|
|
118
|
-
if (selected.id === recommended.id) {
|
|
119
|
-
return {
|
|
120
|
-
status: 'aligned',
|
|
121
|
-
recommendedWorkflow: recommended.id,
|
|
122
|
-
message: `Planner agrees with explicit ${selected.id} workflow.`,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
return {
|
|
126
|
-
status: recommended.id === 'sdd' ? 'escalation-recommended' : 'workflow-mismatch',
|
|
127
|
-
explicitWorkflow: selected.id,
|
|
128
|
-
recommendedWorkflow: recommended.id,
|
|
129
|
-
reason: planner.reason,
|
|
130
|
-
message: recommended.id === 'sdd'
|
|
131
|
-
? `Planner recommends formal SDD instead of ${selected.id}; do not continue with mutable lightweight work until reviewed.`
|
|
132
|
-
: `Planner recommends ${recommended.id} instead of explicit ${selected.id}; review before continuing.`,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
function workflowRunNextAction(selected, recommended, planner) {
|
|
136
|
-
if (recommended.id === 'sdd' && selected.id !== 'sdd') {
|
|
137
|
-
return {
|
|
138
|
-
type: 'review-escalation',
|
|
139
|
-
command: planner.suggestedChangeId === undefined ? null : `vgxness sdd next --project ${planner.project} --change ${planner.suggestedChangeId}`,
|
|
140
|
-
reason: 'Planner detected broad or risky work and recommends the formal SDD workflow before any edits.',
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
type: selected.id === 'sdd' ? 'continue-sdd' : 'manual-continuation',
|
|
145
|
-
command: selected.id === 'sdd' && planner.suggestedChangeId !== undefined
|
|
146
|
-
? `vgxness sdd next --project ${planner.project} --change ${planner.suggestedChangeId}`
|
|
147
|
-
: null,
|
|
148
|
-
reason: selected.id === 'sdd'
|
|
149
|
-
? 'Use existing SDD commands to inspect readiness; this run command did not mutate artifacts.'
|
|
150
|
-
: 'Inspect the recorded checkpoint, then continue manually or through a future approved executor slice.',
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
function appendWorkflowExecutionCheckpoint(service, runId, label, state) {
|
|
154
|
-
return service.appendCheckpoint({ runId, label, state: toJsonValue(state) });
|
|
155
|
-
}
|
|
156
|
-
function workflowExecutionSafety(preflightRecorded) {
|
|
157
|
-
return workflowExecutorSafety(preflightRecorded);
|
|
158
|
-
}
|
|
159
|
-
function workflowExecutionBlockedValue(runId, workflow, reason, message, checkpoint, recommendation) {
|
|
160
|
-
return {
|
|
161
|
-
ok: false,
|
|
162
|
-
runId,
|
|
163
|
-
workflow,
|
|
164
|
-
status: 'blocked',
|
|
165
|
-
dispatched: false,
|
|
166
|
-
reason,
|
|
167
|
-
message,
|
|
168
|
-
...(checkpoint.ok ? { checkpointId: checkpoint.value.id } : {}),
|
|
169
|
-
...(recommendation === undefined ? {} : { recommendation }),
|
|
170
|
-
safety: workflowExecutionSafety(false),
|
|
171
|
-
nextAction: 'Resolve the blocking safety gate, then re-run the explicit execute command.',
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
function validateWorkflowExecutionAgent(agent, run, workflow) {
|
|
175
|
-
if (agent.mode !== 'agent')
|
|
176
|
-
return {
|
|
177
|
-
ok: false,
|
|
178
|
-
reason: 'selected-agent-not-primary-agent',
|
|
179
|
-
message: `Selected registry entry ${agent.id} is ${agent.mode}; delegated workflow execution requires a primary agent.`,
|
|
180
|
-
};
|
|
181
|
-
if (agent.id !== run.selectedAgentId)
|
|
182
|
-
return { ok: false, reason: 'selected-agent-mismatch', message: 'Resolved selected agent does not match run.selectedAgentId.' };
|
|
183
|
-
if (agent.project !== run.project)
|
|
184
|
-
return {
|
|
185
|
-
ok: false,
|
|
186
|
-
reason: 'selected-agent-project-mismatch',
|
|
187
|
-
message: `Selected agent belongs to project ${agent.project}, not run project ${run.project}.`,
|
|
188
|
-
};
|
|
189
|
-
if (agent.adapters[run.providerAdapter] === undefined)
|
|
190
|
-
return { ok: false, reason: 'selected-agent-provider-mismatch', message: `Selected agent has no ${run.providerAdapter} adapter.` };
|
|
191
|
-
if (!agent.workflows.includes(workflow.id) && !agent.workflows.includes(`${workflow.id}:${run.phase}`)) {
|
|
192
|
-
return {
|
|
193
|
-
ok: false,
|
|
194
|
-
reason: 'selected-agent-workflow-mismatch',
|
|
195
|
-
message: `Selected agent is not registered for workflow ${workflow.id} or phase ${workflow.id}:${run.phase}.`,
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
return { ok: true };
|
|
199
|
-
}
|
|
200
|
-
function recordWorkflowPendingApproval(service, runId, operation, executorMode, preflight) {
|
|
201
|
-
const approvalId = preflight.approval?.id ?? preflight.audit.approvalId;
|
|
202
|
-
return service.appendEvent({
|
|
203
|
-
runId,
|
|
204
|
-
kind: 'operation-execution',
|
|
205
|
-
title: `Workflow operation pending approval: ${operation.category} ${operation.operation}`,
|
|
206
|
-
payload: {
|
|
207
|
-
status: 'pending-approval',
|
|
208
|
-
executorName: `workflow-${executorMode}`,
|
|
209
|
-
requestedOperation: operationMetadataForWorkflowExecution(operation),
|
|
210
|
-
input: operation.input ?? null,
|
|
211
|
-
decisionEventId: preflight.permissionEvent.id,
|
|
212
|
-
approvalId: approvalId ?? null,
|
|
213
|
-
decision: preflight.decision.decision,
|
|
214
|
-
reason: preflight.decision.reason,
|
|
215
|
-
message: preflight.decision.message,
|
|
216
|
-
executorInvoked: false,
|
|
217
|
-
operationExecuted: false,
|
|
218
|
-
timestamp: new Date().toISOString(),
|
|
219
|
-
},
|
|
220
|
-
relatedType: 'approval',
|
|
221
|
-
...(approvalId === undefined ? {} : { relatedId: approvalId }),
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
export function runWorkflowPreviewCommand(workflow, parsed) {
|
|
225
|
-
const project = optionalStringFlag(parsed.flags, 'project') ?? 'vgxness';
|
|
226
|
-
const intent = optionalStringFlag(parsed.flags, 'intent') ?? parsed.positionals.slice(2).join(' ').trim();
|
|
227
|
-
const selected = getWorkflowDefinition(workflow);
|
|
228
|
-
return jsonResult({
|
|
229
|
-
ok: true,
|
|
230
|
-
value: {
|
|
231
|
-
workflow: selected,
|
|
232
|
-
registry: listWorkflows(),
|
|
233
|
-
...(intent.length > 0 ? { planner: createNaturalLanguagePlan({ project, intent }) } : {}),
|
|
234
|
-
safety: {
|
|
235
|
-
executed: false,
|
|
236
|
-
callsProvider: false,
|
|
237
|
-
editsFiles: false,
|
|
238
|
-
writesProviderConfig: false,
|
|
239
|
-
recordsRuns: false,
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
export function runWorkflowRunCommand(workflow, parsed, database) {
|
|
245
|
-
const project = optionalStringFlag(parsed.flags, 'project') ?? 'vgxness';
|
|
246
|
-
const intent = requiredFlag(parsed.flags, 'intent');
|
|
247
|
-
if (!intent.ok)
|
|
248
|
-
return resultFailure(intent);
|
|
249
|
-
const selected = getWorkflowDefinition(workflow);
|
|
250
|
-
const planner = createNaturalLanguagePlan({ project, intent: intent.value });
|
|
251
|
-
const recommended = getWorkflowDefinition(planner.workflow);
|
|
252
|
-
const phaseInput = optionalStringFlag(parsed.flags, 'phase') ?? selected.defaultPhase;
|
|
253
|
-
let phase = phaseInput;
|
|
254
|
-
if (selected.id === 'sdd') {
|
|
255
|
-
const canonicalPhase = normalizeSddPhaseInput(phaseInput);
|
|
256
|
-
if (canonicalPhase === undefined)
|
|
257
|
-
return resultFailure(validationFailure(`Unknown SDD phase: ${phaseInput}. Expected one of: ${sddPhases.join(', ')}`));
|
|
258
|
-
phase = canonicalPhase;
|
|
259
|
-
}
|
|
260
|
-
const providerAdapter = optionalStringFlag(parsed.flags, 'provider-adapter') ?? 'opencode';
|
|
261
|
-
const model = optionalStringFlag(parsed.flags, 'model') ?? canonicalOpenCodeDefaultModel;
|
|
262
|
-
const registry = new AgentRegistryService(database);
|
|
263
|
-
const explicitAgentId = optionalStringFlag(parsed.flags, 'agent-id');
|
|
264
|
-
const selectedAgent = resolveWorkflowRunAgent({
|
|
265
|
-
registry,
|
|
266
|
-
project,
|
|
267
|
-
intent: intent.value,
|
|
268
|
-
workflow: selected.id,
|
|
269
|
-
phase,
|
|
270
|
-
providerAdapter,
|
|
271
|
-
...(explicitAgentId !== undefined ? { explicitAgentId } : {}),
|
|
272
|
-
});
|
|
273
|
-
if (!selectedAgent.ok)
|
|
274
|
-
return jsonResult({ ok: true, value: selectedAgent.value });
|
|
275
|
-
const service = new RunService(database);
|
|
276
|
-
const created = service.createRun({
|
|
277
|
-
project,
|
|
278
|
-
userIntent: intent.value,
|
|
279
|
-
workflow: selected.id,
|
|
280
|
-
phase,
|
|
281
|
-
selectedAgentId: selectedAgent.value.agent.id,
|
|
282
|
-
providerAdapter,
|
|
283
|
-
model,
|
|
284
|
-
});
|
|
285
|
-
if (!created.ok)
|
|
286
|
-
return resultFailure(created);
|
|
287
|
-
const executionSafety = workflowRunSafety(selected);
|
|
288
|
-
const recommendation = workflowRunRecommendation(selected, recommended, planner);
|
|
289
|
-
const checkpointState = toJsonValue({
|
|
290
|
-
kind: 'workflow-run-plan',
|
|
291
|
-
version: 1,
|
|
292
|
-
workflow: selected,
|
|
293
|
-
planner,
|
|
294
|
-
safety: executionSafety,
|
|
295
|
-
recommendation,
|
|
296
|
-
selectedAgent: selectedAgent.value.summary,
|
|
297
|
-
nextAction: workflowRunNextAction(selected, recommended, planner),
|
|
298
|
-
});
|
|
299
|
-
const checkpoint = service.appendCheckpoint({
|
|
300
|
-
runId: created.value.id,
|
|
301
|
-
label: 'workflow-run-planned',
|
|
302
|
-
state: checkpointState,
|
|
303
|
-
});
|
|
304
|
-
if (!checkpoint.ok)
|
|
305
|
-
return resultFailure(checkpoint);
|
|
306
|
-
return jsonResult({
|
|
307
|
-
ok: true,
|
|
308
|
-
value: {
|
|
309
|
-
ok: true,
|
|
310
|
-
runId: created.value.id,
|
|
311
|
-
workflow: selected,
|
|
312
|
-
phase,
|
|
313
|
-
selectedAgent: selectedAgent.value.summary,
|
|
314
|
-
planner: {
|
|
315
|
-
workflow: planner.workflow,
|
|
316
|
-
flow: planner.flow,
|
|
317
|
-
confidence: planner.confidence,
|
|
318
|
-
reason: planner.reason,
|
|
319
|
-
signals: planner.signals,
|
|
320
|
-
needsClarification: planner.needsClarification,
|
|
321
|
-
},
|
|
322
|
-
safety: executionSafety,
|
|
323
|
-
checkpointId: checkpoint.value.id,
|
|
324
|
-
recommendation,
|
|
325
|
-
nextAction: workflowRunNextAction(selected, recommended, planner),
|
|
326
|
-
},
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
export function runWorkflowExecuteCommand(workflow, parsed, database, environment) {
|
|
330
|
-
const runId = requiredFlag(parsed.flags, 'run-id');
|
|
331
|
-
if (!runId.ok)
|
|
332
|
-
return resultFailure(runId);
|
|
333
|
-
const service = new RunService(database);
|
|
334
|
-
const details = service.getRun(runId.value);
|
|
335
|
-
if (!details.ok)
|
|
336
|
-
return resultFailure(details);
|
|
337
|
-
const selected = getWorkflowDefinition(workflow);
|
|
338
|
-
if (details.value.workflow !== selected.id) {
|
|
339
|
-
const checkpoint = appendWorkflowExecutionCheckpoint(service, details.value.id, 'workflow-execution-blocked', {
|
|
340
|
-
kind: 'workflow-execution-blocked',
|
|
341
|
-
version: 1,
|
|
342
|
-
runId: details.value.id,
|
|
343
|
-
requestedWorkflow: selected.id,
|
|
344
|
-
runWorkflow: details.value.workflow,
|
|
345
|
-
status: 'blocked',
|
|
346
|
-
dispatched: false,
|
|
347
|
-
reason: 'workflow-mismatch',
|
|
348
|
-
message: `Run ${details.value.id} belongs to workflow ${details.value.workflow}, not ${selected.id}.`,
|
|
349
|
-
safety: workflowExecutionSafety(false),
|
|
350
|
-
});
|
|
351
|
-
if (!checkpoint.ok)
|
|
352
|
-
return resultFailure(checkpoint);
|
|
353
|
-
return jsonResult({
|
|
354
|
-
ok: true,
|
|
355
|
-
value: workflowExecutionBlockedValue(details.value.id, selected.id, 'workflow-mismatch', 'Run workflow does not match the execute command.', checkpoint),
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
const agent = new AgentRegistryService(database).getAgent(details.value.selectedAgentId);
|
|
359
|
-
if (!agent.ok) {
|
|
360
|
-
const checkpoint = appendWorkflowExecutionCheckpoint(service, details.value.id, 'workflow-execution-blocked', {
|
|
361
|
-
kind: 'workflow-execution-blocked',
|
|
362
|
-
version: 1,
|
|
363
|
-
runId: details.value.id,
|
|
364
|
-
workflow: selected.id,
|
|
365
|
-
status: 'blocked',
|
|
366
|
-
dispatched: false,
|
|
367
|
-
reason: 'selected-agent-unresolved',
|
|
368
|
-
message: agent.error.message,
|
|
369
|
-
selectedAgentId: details.value.selectedAgentId,
|
|
370
|
-
safety: workflowExecutionSafety(false),
|
|
371
|
-
});
|
|
372
|
-
if (!checkpoint.ok)
|
|
373
|
-
return resultFailure(checkpoint);
|
|
374
|
-
return jsonResult({
|
|
375
|
-
ok: true,
|
|
376
|
-
value: workflowExecutionBlockedValue(details.value.id, selected.id, 'selected-agent-unresolved', agent.error.message, checkpoint),
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
const agentGate = validateWorkflowExecutionAgent(agent.value, details.value, selected);
|
|
380
|
-
if (!agentGate.ok) {
|
|
381
|
-
const checkpoint = appendWorkflowExecutionCheckpoint(service, details.value.id, 'workflow-execution-blocked', {
|
|
382
|
-
kind: 'workflow-execution-blocked',
|
|
383
|
-
version: 1,
|
|
384
|
-
runId: details.value.id,
|
|
385
|
-
workflow: selected.id,
|
|
386
|
-
status: 'blocked',
|
|
387
|
-
dispatched: false,
|
|
388
|
-
reason: agentGate.reason,
|
|
389
|
-
message: agentGate.message,
|
|
390
|
-
selectedAgent: workflowRunAgentSummary(agent.value, { policy: 'run-selected-agent', reasons: ['run.selectedAgentId resolved to a real registry agent'] }),
|
|
391
|
-
safety: workflowExecutionSafety(false),
|
|
392
|
-
});
|
|
393
|
-
if (!checkpoint.ok)
|
|
394
|
-
return resultFailure(checkpoint);
|
|
395
|
-
return jsonResult({ ok: true, value: workflowExecutionBlockedValue(details.value.id, selected.id, agentGate.reason, agentGate.message, checkpoint) });
|
|
396
|
-
}
|
|
397
|
-
if (parsed.flags.confirm !== true) {
|
|
398
|
-
const checkpoint = appendWorkflowExecutionCheckpoint(service, details.value.id, 'workflow-execution-blocked', {
|
|
399
|
-
kind: 'workflow-execution-blocked',
|
|
400
|
-
version: 1,
|
|
401
|
-
runId: details.value.id,
|
|
402
|
-
workflow: selected.id,
|
|
403
|
-
status: 'blocked',
|
|
404
|
-
dispatched: false,
|
|
405
|
-
reason: 'missing-confirmation',
|
|
406
|
-
message: 'Explicit --confirm is required before delegated workflow execution can be requested.',
|
|
407
|
-
selectedAgent: workflowRunAgentSummary(agent.value, { policy: 'run-selected-agent', reasons: ['run.selectedAgentId resolved to a real registry agent'] }),
|
|
408
|
-
safety: workflowExecutionSafety(false),
|
|
409
|
-
nextAction: `Re-run: vgxness ${selected.id} execute --run-id ${details.value.id} --confirm`,
|
|
410
|
-
});
|
|
411
|
-
if (!checkpoint.ok)
|
|
412
|
-
return resultFailure(checkpoint);
|
|
413
|
-
return jsonResult({
|
|
414
|
-
ok: true,
|
|
415
|
-
value: workflowExecutionBlockedValue(details.value.id, selected.id, 'missing-confirmation', 'Explicit --confirm is required.', checkpoint),
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
const planner = createNaturalLanguagePlan({ project: details.value.project, intent: details.value.userIntent });
|
|
419
|
-
const recommended = getWorkflowDefinition(planner.workflow);
|
|
420
|
-
const recommendation = workflowRunRecommendation(selected, recommended, planner);
|
|
421
|
-
if (recommended.id === 'sdd' && selected.id !== 'sdd' && parsed.flags['override-escalation'] !== true) {
|
|
422
|
-
const checkpoint = appendWorkflowExecutionCheckpoint(service, details.value.id, 'workflow-execution-blocked', {
|
|
423
|
-
kind: 'workflow-execution-blocked',
|
|
424
|
-
version: 1,
|
|
425
|
-
runId: details.value.id,
|
|
426
|
-
workflow: selected.id,
|
|
427
|
-
status: 'blocked',
|
|
428
|
-
dispatched: false,
|
|
429
|
-
reason: 'escalation-recommended',
|
|
430
|
-
message: 'Planner recommends formal SDD; delegated lightweight execution is blocked unless --override-escalation is supplied.',
|
|
431
|
-
recommendation,
|
|
432
|
-
planner,
|
|
433
|
-
selectedAgent: workflowRunAgentSummary(agent.value, { policy: 'run-selected-agent', reasons: ['run.selectedAgentId resolved to a real registry agent'] }),
|
|
434
|
-
safety: workflowExecutionSafety(false),
|
|
435
|
-
nextAction: workflowRunNextAction(selected, recommended, planner),
|
|
436
|
-
});
|
|
437
|
-
if (!checkpoint.ok)
|
|
438
|
-
return resultFailure(checkpoint);
|
|
439
|
-
return jsonResult({
|
|
440
|
-
ok: true,
|
|
441
|
-
value: workflowExecutionBlockedValue(details.value.id, selected.id, 'escalation-recommended', 'Planner recommends formal SDD; supply --override-escalation only after human review.', checkpoint, recommendation),
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
const workspaceRoot = optionalStringFlag(parsed.flags, 'workspace') ?? environment.cwd;
|
|
445
|
-
const executorMode = optionalStringFlag(parsed.flags, 'executor') ?? 'safe-non-dispatching';
|
|
446
|
-
if (executorMode !== 'safe-non-dispatching' && executorMode !== 'provider' && executorMode !== 'command')
|
|
447
|
-
return resultFailure(validationFailure(`Unknown workflow executor: ${executorMode}. Expected safe-non-dispatching, provider, or command.`));
|
|
448
|
-
const commandId = optionalStringFlag(parsed.flags, 'command');
|
|
449
|
-
if (executorMode === 'command' && commandId === undefined)
|
|
450
|
-
return resultFailure(validationFailure(`--executor command requires --command <name>. Allowlisted commands: ${commandAllowlistIds().join(', ')}`));
|
|
451
|
-
if (executorMode !== 'command' && commandId !== undefined)
|
|
452
|
-
return resultFailure(validationFailure('--command can only be used with --executor command'));
|
|
453
|
-
const commandTargets = optionalStringFlag(parsed.flags, 'command-targets')
|
|
454
|
-
?.split(',')
|
|
455
|
-
.map((item) => item.trim())
|
|
456
|
-
.filter((item) => item.length > 0) ?? [];
|
|
457
|
-
let commandAdapter;
|
|
458
|
-
if (executorMode === 'command') {
|
|
459
|
-
try {
|
|
460
|
-
const commandCwd = optionalStringFlag(parsed.flags, 'command-cwd');
|
|
461
|
-
commandAdapter = new CommandAllowlistAdapter({
|
|
462
|
-
commandId: commandId ?? '',
|
|
463
|
-
workspaceRoot,
|
|
464
|
-
targetPaths: commandTargets,
|
|
465
|
-
...(commandCwd === undefined ? {} : { cwd: commandCwd }),
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
catch (error) {
|
|
469
|
-
return resultFailure(validationFailure(error instanceof Error ? error.message : 'Command allowlist adapter rejected the request.'));
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
const operation = {
|
|
473
|
-
category: executorMode === 'command' ? 'shell' : 'provider-tool',
|
|
474
|
-
operation: executorMode === 'command' ? `command-allowlist:${commandId}` : 'workflow-delegated-dispatch',
|
|
475
|
-
...(executorMode === 'command' ? {} : { providerToolName: `${details.value.providerAdapter}:workflow-dispatch` }),
|
|
476
|
-
workspaceRoot,
|
|
477
|
-
agent: agent.value,
|
|
478
|
-
ambiguous: executorMode !== 'command',
|
|
479
|
-
input: toJsonValue({
|
|
480
|
-
runId: details.value.id,
|
|
481
|
-
project: details.value.project,
|
|
482
|
-
workflow: selected.id,
|
|
483
|
-
phase: details.value.phase,
|
|
484
|
-
userIntent: details.value.userIntent,
|
|
485
|
-
providerAdapter: details.value.providerAdapter,
|
|
486
|
-
model: details.value.model,
|
|
487
|
-
selectedAgentId: agent.value.id,
|
|
488
|
-
requestedBy: 'cli-workflow-execute',
|
|
489
|
-
...(executorMode === 'command' ? { command: commandId, allowlistedCommand: commandAdapter?.plan.request.argv ?? [] } : {}),
|
|
490
|
-
}),
|
|
491
|
-
};
|
|
492
|
-
const preflight = service.preflightOperation({ runId: details.value.id, ...operation });
|
|
493
|
-
if (!preflight.ok)
|
|
494
|
-
return resultFailure(preflight);
|
|
495
|
-
if (preflight.value.outcome === 'approval-needed') {
|
|
496
|
-
const pending = recordWorkflowPendingApproval(service, details.value.id, operation, executorMode, preflight.value);
|
|
497
|
-
if (!pending.ok)
|
|
498
|
-
return resultFailure(pending);
|
|
499
|
-
}
|
|
500
|
-
const selectedAgentSummary = workflowRunAgentSummary(agent.value, {
|
|
501
|
-
policy: 'run-selected-agent',
|
|
502
|
-
reasons: ['run.selectedAgentId resolved to a real registry agent'],
|
|
503
|
-
});
|
|
504
|
-
const executor = executorMode === 'provider' || executorMode === 'command'
|
|
505
|
-
? new GuardedProviderWorkflowExecutor({
|
|
506
|
-
...(commandAdapter === undefined ? {} : { adapter: commandAdapter }),
|
|
507
|
-
capabilities: {
|
|
508
|
-
sandboxEnforceable: commandAdapter !== undefined,
|
|
509
|
-
processExecutionEnforceable: commandAdapter !== undefined,
|
|
510
|
-
workspaceBoundaryEnforced: commandAdapter !== undefined,
|
|
511
|
-
providerConfigWritesBlocked: commandAdapter !== undefined,
|
|
512
|
-
},
|
|
513
|
-
})
|
|
514
|
-
: new SafeNonDispatchingWorkflowExecutor();
|
|
515
|
-
const executorResult = executor.execute({
|
|
516
|
-
run: details.value,
|
|
517
|
-
workflow: selected,
|
|
518
|
-
selectedAgent: agent.value,
|
|
519
|
-
selectedAgentSummary,
|
|
520
|
-
workspaceRoot,
|
|
521
|
-
requestedOperation: operation,
|
|
522
|
-
preflight: preflight.value,
|
|
523
|
-
...(commandAdapter === undefined ? {} : { sandboxExecutionEvidence: commandAdapter.plan.evidence }),
|
|
524
|
-
gates: {
|
|
525
|
-
validRunId: true,
|
|
526
|
-
workflowMatchesRun: true,
|
|
527
|
-
selectedAgentReal: true,
|
|
528
|
-
selectedAgentMatchesRun: true,
|
|
529
|
-
workspaceRoot,
|
|
530
|
-
confirmed: true,
|
|
531
|
-
escalationOverride: parsed.flags['override-escalation'] === true,
|
|
532
|
-
},
|
|
533
|
-
plannerRecommendation: { planner, recommendation },
|
|
534
|
-
});
|
|
535
|
-
const checkpoint = appendWorkflowExecutionCheckpoint(service, details.value.id, executorResult.checkpointLabel, executorResult.checkpointPayload);
|
|
536
|
-
if (!checkpoint.ok)
|
|
537
|
-
return resultFailure(checkpoint);
|
|
538
|
-
return jsonResult({
|
|
539
|
-
ok: true,
|
|
540
|
-
value: {
|
|
541
|
-
ok: true,
|
|
542
|
-
runId: details.value.id,
|
|
543
|
-
workflow: selected.id,
|
|
544
|
-
phase: details.value.phase,
|
|
545
|
-
status: executorResult.status,
|
|
546
|
-
dispatched: executorResult.dispatched,
|
|
547
|
-
dispatchMode: executorResult.dispatchMode,
|
|
548
|
-
executorId: executorResult.executorId,
|
|
549
|
-
executorKind: executorResult.executorKind,
|
|
550
|
-
reason: executorResult.reason,
|
|
551
|
-
message: executorResult.message,
|
|
552
|
-
selectedAgent: selectedAgentSummary,
|
|
553
|
-
preflight: {
|
|
554
|
-
outcome: preflight.value.outcome,
|
|
555
|
-
decision: preflight.value.decision,
|
|
556
|
-
audit: preflight.value.audit,
|
|
557
|
-
eligibleForFutureExecution: preflight.value.eligibleForFutureExecution,
|
|
558
|
-
safety: preflight.value.safety,
|
|
559
|
-
},
|
|
560
|
-
executorAudit: executorResult.audit,
|
|
561
|
-
checkpointId: checkpoint.value.id,
|
|
562
|
-
safety: workflowExecutionSafety(true),
|
|
563
|
-
nextAction: executorResult.nextAction,
|
|
564
|
-
},
|
|
565
|
-
});
|
|
566
|
-
}
|
|
1
|
+
export * from '../../interfaces/cli/commands/workflow-dispatcher.js';
|