vgxness 1.20.5 → 1.20.7
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 -246
- 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 +364 -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/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 -1132
- package/dist/mcp/stdio-server.js +1 -116
- package/dist/mcp/validation.js +1 -2383
- 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/policy-evaluator.js +12 -5
- 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 -1470
- 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 -217
- 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/sdd/manager-prompt-autonomy/apply-progress.md +28 -0
- package/docs/sdd/manager-prompt-autonomy/design.md +63 -0
- package/docs/sdd/manager-prompt-autonomy/proposal.md +57 -0
- package/docs/sdd/manager-prompt-autonomy/tasks.md +19 -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,94 @@
|
|
|
1
|
+
import { inputRecord, payloadModes, providerChangePlanProviders, providerChangePlanTypes, providerInstallTargets, providerUserGlobalOnlyMigrationMessage, readNonEmptyString, readOptionalNonEmptyString, readOptionalOneOf, readRequiredOneOf, scopes, validationFailure, } from './common.js';
|
|
2
|
+
export function validateProviderChangePlanInput(input, tool) {
|
|
3
|
+
const record = inputRecord(input, tool, ['project', 'scope', 'installTarget', 'provider', 'changeType', 'workspaceRoot', 'payloadMode']);
|
|
4
|
+
if (!record.ok)
|
|
5
|
+
return record;
|
|
6
|
+
const provider = readRequiredOneOf(record.value, 'provider', providerChangePlanProviders, tool);
|
|
7
|
+
if (!provider.ok)
|
|
8
|
+
return provider;
|
|
9
|
+
const changeType = readRequiredOneOf(record.value, 'changeType', providerChangePlanTypes, tool);
|
|
10
|
+
if (!changeType.ok)
|
|
11
|
+
return changeType;
|
|
12
|
+
const workspaceRoot = readNonEmptyString(record.value, 'workspaceRoot', tool);
|
|
13
|
+
if (!workspaceRoot.ok)
|
|
14
|
+
return workspaceRoot;
|
|
15
|
+
const payloadMode = readRequiredOneOf(record.value, 'payloadMode', payloadModes, tool);
|
|
16
|
+
if (!payloadMode.ok)
|
|
17
|
+
return payloadMode;
|
|
18
|
+
const result = {
|
|
19
|
+
provider: provider.value,
|
|
20
|
+
changeType: changeType.value,
|
|
21
|
+
workspaceRoot: workspaceRoot.value,
|
|
22
|
+
payloadMode: payloadMode.value,
|
|
23
|
+
};
|
|
24
|
+
const project = readOptionalNonEmptyString(record.value, 'project', tool);
|
|
25
|
+
if (!project.ok)
|
|
26
|
+
return project;
|
|
27
|
+
if (project.value !== undefined)
|
|
28
|
+
result.project = project.value;
|
|
29
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
30
|
+
if (!scope.ok)
|
|
31
|
+
return scope;
|
|
32
|
+
if (scope.value !== undefined)
|
|
33
|
+
result.scope = scope.value;
|
|
34
|
+
if (typeof record.value.installTarget === 'string' && record.value.installTarget.trim() !== 'user-global') {
|
|
35
|
+
return validationFailure(providerUserGlobalOnlyMigrationMessage, tool);
|
|
36
|
+
}
|
|
37
|
+
const installTarget = readOptionalOneOf(record.value, 'installTarget', providerInstallTargets, tool);
|
|
38
|
+
if (!installTarget.ok)
|
|
39
|
+
return installTarget;
|
|
40
|
+
if (installTarget.value !== undefined)
|
|
41
|
+
result.installTarget = installTarget.value;
|
|
42
|
+
return { ok: true, value: result };
|
|
43
|
+
}
|
|
44
|
+
export function validateProviderHealthInput(input, tool) {
|
|
45
|
+
const record = inputRecord(input ?? {}, tool, [
|
|
46
|
+
'project',
|
|
47
|
+
'scope',
|
|
48
|
+
'providerAdapter',
|
|
49
|
+
'workspaceRoot',
|
|
50
|
+
'change',
|
|
51
|
+
'expectedPromptContractVersion',
|
|
52
|
+
'payloadMode',
|
|
53
|
+
]);
|
|
54
|
+
if (!record.ok)
|
|
55
|
+
return record;
|
|
56
|
+
const result = {};
|
|
57
|
+
const project = readOptionalNonEmptyString(record.value, 'project', tool);
|
|
58
|
+
if (!project.ok)
|
|
59
|
+
return project;
|
|
60
|
+
if (project.value !== undefined)
|
|
61
|
+
result.project = project.value;
|
|
62
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
63
|
+
if (!scope.ok)
|
|
64
|
+
return scope;
|
|
65
|
+
if (scope.value !== undefined)
|
|
66
|
+
result.scope = scope.value;
|
|
67
|
+
const providerAdapter = readOptionalOneOf(record.value, 'providerAdapter', ['opencode', 'claude'], tool);
|
|
68
|
+
if (!providerAdapter.ok)
|
|
69
|
+
return providerAdapter;
|
|
70
|
+
if (providerAdapter.value !== undefined)
|
|
71
|
+
result.providerAdapter = providerAdapter.value;
|
|
72
|
+
const workspaceRoot = readOptionalNonEmptyString(record.value, 'workspaceRoot', tool);
|
|
73
|
+
if (!workspaceRoot.ok)
|
|
74
|
+
return workspaceRoot;
|
|
75
|
+
if (workspaceRoot.value !== undefined)
|
|
76
|
+
result.workspaceRoot = workspaceRoot.value;
|
|
77
|
+
const change = readOptionalNonEmptyString(record.value, 'change', tool);
|
|
78
|
+
if (!change.ok)
|
|
79
|
+
return change;
|
|
80
|
+
if (change.value !== undefined)
|
|
81
|
+
result.change = change.value;
|
|
82
|
+
const expectedPromptContractVersion = record.value.expectedPromptContractVersion;
|
|
83
|
+
if (expectedPromptContractVersion !== undefined) {
|
|
84
|
+
if (typeof expectedPromptContractVersion !== 'number' || !Number.isSafeInteger(expectedPromptContractVersion) || expectedPromptContractVersion <= 0)
|
|
85
|
+
return validationFailure('expectedPromptContractVersion must be a positive safe integer', tool);
|
|
86
|
+
result.expectedPromptContractVersion = expectedPromptContractVersion;
|
|
87
|
+
}
|
|
88
|
+
const payloadMode = readOptionalOneOf(record.value, 'payloadMode', payloadModes, tool);
|
|
89
|
+
if (!payloadMode.ok)
|
|
90
|
+
return payloadMode;
|
|
91
|
+
if (payloadMode.value !== undefined)
|
|
92
|
+
result.payloadMode = payloadMode.value;
|
|
93
|
+
return { ok: true, value: result };
|
|
94
|
+
}
|
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import { isRiskyPermissionCategory, permissionCategories } from '../../../permissions/schema.js';
|
|
2
|
+
import { parseOperationRetryPolicy } from '../../../runs/operation-retry.js';
|
|
3
|
+
import { workflowIds } from '../../../workflows/schema.js';
|
|
4
|
+
import { asRecord, copyOptionalBooleans, copyOptionalStrings, copyRequiredStrings, finalRunStatuses, inputRecord, readBoundedLimit, readJsonValue, readNonEmptyString, readOptionalBoundedLimit, readOptionalOneOf, readOptionalStringArray, readPreflightAgent, readRequiredOneOf, readRequiredOneOfArray, readRequiredStringArray, readTaskGrantActor, readTaskGrantCommandPolicy, runOutcomes, runStatuses, taskGrantCategories, taskGrantStatuses, validationFailure, } from './common.js';
|
|
5
|
+
export function validateRunListInput(input, tool) {
|
|
6
|
+
const record = inputRecord(input, tool, ['project', 'status', 'limit']);
|
|
7
|
+
if (!record.ok)
|
|
8
|
+
return record;
|
|
9
|
+
const result = {};
|
|
10
|
+
const project = copyOptionalStrings(result, record.value, tool, ['project']);
|
|
11
|
+
if (!project.ok)
|
|
12
|
+
return project;
|
|
13
|
+
const status = readOptionalOneOf(record.value, 'status', runStatuses, tool);
|
|
14
|
+
if (!status.ok)
|
|
15
|
+
return status;
|
|
16
|
+
if (status.value !== undefined)
|
|
17
|
+
result.status = status.value;
|
|
18
|
+
const limit = readBoundedLimit(record.value, tool);
|
|
19
|
+
if (!limit.ok)
|
|
20
|
+
return limit;
|
|
21
|
+
result.limit = limit.value;
|
|
22
|
+
return { ok: true, value: result };
|
|
23
|
+
}
|
|
24
|
+
export function validateRunGetInput(input, tool) {
|
|
25
|
+
const record = inputRecord(input, tool, ['id']);
|
|
26
|
+
if (!record.ok)
|
|
27
|
+
return record;
|
|
28
|
+
const id = readNonEmptyString(record.value, 'id', tool);
|
|
29
|
+
if (!id.ok)
|
|
30
|
+
return id;
|
|
31
|
+
return { ok: true, value: { id: id.value } };
|
|
32
|
+
}
|
|
33
|
+
export function validateRunPreflightInput(input, tool) {
|
|
34
|
+
const record = inputRecord(input, tool, [
|
|
35
|
+
'runId',
|
|
36
|
+
'category',
|
|
37
|
+
'operation',
|
|
38
|
+
'workflow',
|
|
39
|
+
'phase',
|
|
40
|
+
'agentId',
|
|
41
|
+
'workspaceRoot',
|
|
42
|
+
'targetPath',
|
|
43
|
+
'taskFingerprint',
|
|
44
|
+
'commandId',
|
|
45
|
+
'cwd',
|
|
46
|
+
'targetPaths',
|
|
47
|
+
'providerToolName',
|
|
48
|
+
'agent',
|
|
49
|
+
'sandboxStrategy',
|
|
50
|
+
'destructive',
|
|
51
|
+
'external',
|
|
52
|
+
'privileged',
|
|
53
|
+
'ambiguous',
|
|
54
|
+
'providerConfigMutation',
|
|
55
|
+
'globalConfigMutation',
|
|
56
|
+
'explicitRequest',
|
|
57
|
+
]);
|
|
58
|
+
if (!record.ok)
|
|
59
|
+
return record;
|
|
60
|
+
const runId = readNonEmptyString(record.value, 'runId', tool);
|
|
61
|
+
if (!runId.ok)
|
|
62
|
+
return runId;
|
|
63
|
+
const category = readRequiredOneOf(record.value, 'category', permissionCategories, tool);
|
|
64
|
+
if (!category.ok)
|
|
65
|
+
return category;
|
|
66
|
+
const operation = readNonEmptyString(record.value, 'operation', tool);
|
|
67
|
+
if (!operation.ok)
|
|
68
|
+
return operation;
|
|
69
|
+
const result = { runId: runId.value, category: category.value, operation: operation.value };
|
|
70
|
+
const workflow = readOptionalOneOf(record.value, 'workflow', workflowIds, tool);
|
|
71
|
+
if (!workflow.ok)
|
|
72
|
+
return workflow;
|
|
73
|
+
if (workflow.value !== undefined)
|
|
74
|
+
result.workflow = workflow.value;
|
|
75
|
+
const copied = copyOptionalStrings(result, record.value, tool, [
|
|
76
|
+
'phase',
|
|
77
|
+
'agentId',
|
|
78
|
+
'workspaceRoot',
|
|
79
|
+
'targetPath',
|
|
80
|
+
'taskFingerprint',
|
|
81
|
+
'commandId',
|
|
82
|
+
'cwd',
|
|
83
|
+
'providerToolName',
|
|
84
|
+
]);
|
|
85
|
+
if (!copied.ok)
|
|
86
|
+
return copied;
|
|
87
|
+
const targetPaths = readOptionalStringArray(record.value, 'targetPaths', tool);
|
|
88
|
+
if (!targetPaths.ok)
|
|
89
|
+
return targetPaths;
|
|
90
|
+
if (targetPaths.value !== undefined)
|
|
91
|
+
result.targetPaths = targetPaths.value;
|
|
92
|
+
const sandboxStrategy = readOptionalOneOf(record.value, 'sandboxStrategy', ['worktree'], tool);
|
|
93
|
+
if (!sandboxStrategy.ok)
|
|
94
|
+
return sandboxStrategy;
|
|
95
|
+
if (sandboxStrategy.value !== undefined)
|
|
96
|
+
result.sandboxStrategy = sandboxStrategy.value;
|
|
97
|
+
const booleans = copyOptionalBooleans(result, record.value, tool, [
|
|
98
|
+
'destructive',
|
|
99
|
+
'external',
|
|
100
|
+
'privileged',
|
|
101
|
+
'ambiguous',
|
|
102
|
+
'providerConfigMutation',
|
|
103
|
+
'globalConfigMutation',
|
|
104
|
+
]);
|
|
105
|
+
if (!booleans.ok)
|
|
106
|
+
return booleans;
|
|
107
|
+
if (record.value.agent !== undefined) {
|
|
108
|
+
const agent = readPreflightAgent(record.value.agent, tool);
|
|
109
|
+
if (!agent.ok)
|
|
110
|
+
return agent;
|
|
111
|
+
result.agent = agent.value;
|
|
112
|
+
}
|
|
113
|
+
if (record.value.explicitRequest !== undefined) {
|
|
114
|
+
const explicitRequest = readExplicitRequest(record.value.explicitRequest, tool);
|
|
115
|
+
if (!explicitRequest.ok)
|
|
116
|
+
return explicitRequest;
|
|
117
|
+
result.explicitRequest = explicitRequest.value;
|
|
118
|
+
}
|
|
119
|
+
if (isRiskyPermissionCategory(result.category)) {
|
|
120
|
+
if (result.phase !== undefined && result.agentId === undefined && result.agent === undefined) {
|
|
121
|
+
return validationFailure(`VGX-managed preflight for risky category ${result.category} requires agentId when phase metadata is provided`, tool);
|
|
122
|
+
}
|
|
123
|
+
if (result.agentId !== undefined && result.phase === undefined) {
|
|
124
|
+
return validationFailure(`VGX-managed preflight for risky category ${result.category} requires phase when agentId metadata is provided`, tool);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return { ok: true, value: result };
|
|
128
|
+
}
|
|
129
|
+
export function readExplicitRequest(value, tool) {
|
|
130
|
+
const record = asRecord(value, tool, 'explicitRequest must be an object');
|
|
131
|
+
if (!record.ok)
|
|
132
|
+
return record;
|
|
133
|
+
const unexpected = Object.keys(record.value).find((key) => !['version', 'actor', 'request', 'requestedOperation', 'riskAttributes', 'parser'].includes(key));
|
|
134
|
+
if (unexpected !== undefined)
|
|
135
|
+
return validationFailure(`Unexpected explicitRequest field: ${unexpected}`, tool);
|
|
136
|
+
if (record.value.version !== 1)
|
|
137
|
+
return validationFailure('explicitRequest.version must be 1', tool);
|
|
138
|
+
const actor = readExplicitRequestActor(record.value.actor, tool);
|
|
139
|
+
if (!actor.ok)
|
|
140
|
+
return actor;
|
|
141
|
+
const request = readExplicitRequestRequest(record.value.request, tool);
|
|
142
|
+
if (!request.ok)
|
|
143
|
+
return request;
|
|
144
|
+
const requestedOperation = readExplicitRequestedOperation(record.value.requestedOperation, tool);
|
|
145
|
+
if (!requestedOperation.ok)
|
|
146
|
+
return requestedOperation;
|
|
147
|
+
const riskAttributes = readExplicitRiskAttributes(record.value.riskAttributes, tool);
|
|
148
|
+
if (!riskAttributes.ok)
|
|
149
|
+
return riskAttributes;
|
|
150
|
+
const parser = readExplicitParser(record.value.parser, tool);
|
|
151
|
+
if (!parser.ok)
|
|
152
|
+
return parser;
|
|
153
|
+
return {
|
|
154
|
+
ok: true,
|
|
155
|
+
value: {
|
|
156
|
+
version: 1,
|
|
157
|
+
actor: actor.value,
|
|
158
|
+
request: request.value,
|
|
159
|
+
requestedOperation: requestedOperation.value,
|
|
160
|
+
riskAttributes: riskAttributes.value,
|
|
161
|
+
parser: parser.value,
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
export function readExplicitRequestActor(value, tool) {
|
|
166
|
+
const record = asRecord(value, tool, 'explicitRequest.actor must be an object');
|
|
167
|
+
if (!record.ok)
|
|
168
|
+
return record;
|
|
169
|
+
const unexpected = Object.keys(record.value).find((key) => !['type', 'id', 'displayName'].includes(key));
|
|
170
|
+
if (unexpected !== undefined)
|
|
171
|
+
return validationFailure(`Unexpected explicitRequest.actor field: ${unexpected}`, tool);
|
|
172
|
+
const type = readRequiredOneOf(record.value, 'type', ['human'], tool);
|
|
173
|
+
if (!type.ok)
|
|
174
|
+
return type;
|
|
175
|
+
const actor = { type: type.value };
|
|
176
|
+
const copied = copyOptionalStrings(actor, record.value, tool, ['id', 'displayName']);
|
|
177
|
+
if (!copied.ok)
|
|
178
|
+
return copied;
|
|
179
|
+
return { ok: true, value: actor };
|
|
180
|
+
}
|
|
181
|
+
export function readExplicitRequestRequest(value, tool) {
|
|
182
|
+
const record = asRecord(value, tool, 'explicitRequest.request must be an object');
|
|
183
|
+
if (!record.ok)
|
|
184
|
+
return record;
|
|
185
|
+
const unexpected = Object.keys(record.value).find((key) => !['id', 'source', 'utteranceRef', 'excerpt', 'requestedAt', 'sessionId', 'runId'].includes(key));
|
|
186
|
+
if (unexpected !== undefined)
|
|
187
|
+
return validationFailure(`Unexpected explicitRequest.request field: ${unexpected}`, tool);
|
|
188
|
+
const source = readRequiredOneOf(record.value, 'source', ['chat', 'mcp', 'cli', 'provider', 'unknown'], tool);
|
|
189
|
+
if (!source.ok)
|
|
190
|
+
return source;
|
|
191
|
+
const requestedAt = readNonEmptyString(record.value, 'requestedAt', tool);
|
|
192
|
+
if (!requestedAt.ok)
|
|
193
|
+
return requestedAt;
|
|
194
|
+
if (!validIsoTimestamp(requestedAt.value))
|
|
195
|
+
return validationFailure('explicitRequest.request.requestedAt must be a valid ISO timestamp', tool);
|
|
196
|
+
const request = { source: source.value, requestedAt: requestedAt.value };
|
|
197
|
+
const copied = copyOptionalStrings(request, record.value, tool, ['id', 'utteranceRef', 'excerpt', 'sessionId', 'runId']);
|
|
198
|
+
if (!copied.ok)
|
|
199
|
+
return copied;
|
|
200
|
+
return { ok: true, value: request };
|
|
201
|
+
}
|
|
202
|
+
export function readExplicitRequestedOperation(value, tool) {
|
|
203
|
+
const record = asRecord(value, tool, 'explicitRequest.requestedOperation must be an object');
|
|
204
|
+
if (!record.ok)
|
|
205
|
+
return record;
|
|
206
|
+
const unexpected = Object.keys(record.value).find((key) => !['category', 'operation', 'commandId', 'providerToolName', 'targetPath', 'targetPaths', 'cwd', 'workspaceRoot', 'scopeSummary'].includes(key));
|
|
207
|
+
if (unexpected !== undefined)
|
|
208
|
+
return validationFailure(`Unexpected explicitRequest.requestedOperation field: ${unexpected}`, tool);
|
|
209
|
+
const category = readRequiredOneOf(record.value, 'category', permissionCategories, tool);
|
|
210
|
+
if (!category.ok)
|
|
211
|
+
return category;
|
|
212
|
+
const operation = readNonEmptyString(record.value, 'operation', tool);
|
|
213
|
+
if (!operation.ok)
|
|
214
|
+
return operation;
|
|
215
|
+
const scopeSummary = readNonEmptyString(record.value, 'scopeSummary', tool);
|
|
216
|
+
if (!scopeSummary.ok)
|
|
217
|
+
return scopeSummary;
|
|
218
|
+
const requestedOperation = {
|
|
219
|
+
category: category.value,
|
|
220
|
+
operation: operation.value,
|
|
221
|
+
scopeSummary: scopeSummary.value,
|
|
222
|
+
};
|
|
223
|
+
const copied = copyOptionalStrings(requestedOperation, record.value, tool, ['commandId', 'providerToolName', 'targetPath', 'cwd', 'workspaceRoot']);
|
|
224
|
+
if (!copied.ok)
|
|
225
|
+
return copied;
|
|
226
|
+
const targetPaths = readOptionalStringArray(record.value, 'targetPaths', tool);
|
|
227
|
+
if (!targetPaths.ok)
|
|
228
|
+
return targetPaths;
|
|
229
|
+
if (targetPaths.value !== undefined)
|
|
230
|
+
requestedOperation.targetPaths = targetPaths.value;
|
|
231
|
+
return { ok: true, value: requestedOperation };
|
|
232
|
+
}
|
|
233
|
+
export function readExplicitRiskAttributes(value, tool) {
|
|
234
|
+
const record = asRecord(value, tool, 'explicitRequest.riskAttributes must be an object');
|
|
235
|
+
if (!record.ok)
|
|
236
|
+
return record;
|
|
237
|
+
const fields = [
|
|
238
|
+
'destructive',
|
|
239
|
+
'privileged',
|
|
240
|
+
'external',
|
|
241
|
+
'ambiguous',
|
|
242
|
+
'secrets',
|
|
243
|
+
'providerConfigMutation',
|
|
244
|
+
'globalConfigMutation',
|
|
245
|
+
'network',
|
|
246
|
+
'install',
|
|
247
|
+
];
|
|
248
|
+
const unexpected = Object.keys(record.value).find((key) => !fields.includes(key));
|
|
249
|
+
if (unexpected !== undefined)
|
|
250
|
+
return validationFailure(`Unexpected explicitRequest.riskAttributes field: ${unexpected}`, tool);
|
|
251
|
+
const riskAttributes = {};
|
|
252
|
+
const copied = copyOptionalBooleans(riskAttributes, record.value, tool, fields);
|
|
253
|
+
if (!copied.ok)
|
|
254
|
+
return copied;
|
|
255
|
+
return { ok: true, value: riskAttributes };
|
|
256
|
+
}
|
|
257
|
+
export function readExplicitParser(value, tool) {
|
|
258
|
+
const record = asRecord(value, tool, 'explicitRequest.parser must be an object');
|
|
259
|
+
if (!record.ok)
|
|
260
|
+
return record;
|
|
261
|
+
const unexpected = Object.keys(record.value).find((key) => !['exact', 'confidence', 'ambiguityReasons', 'expansionReasons'].includes(key));
|
|
262
|
+
if (unexpected !== undefined)
|
|
263
|
+
return validationFailure(`Unexpected explicitRequest.parser field: ${unexpected}`, tool);
|
|
264
|
+
if (typeof record.value.exact !== 'boolean')
|
|
265
|
+
return validationFailure('explicitRequest.parser.exact must be a boolean', tool);
|
|
266
|
+
const parser = { exact: record.value.exact };
|
|
267
|
+
const confidence = readOptionalOneOf(record.value, 'confidence', ['high', 'medium', 'low'], tool);
|
|
268
|
+
if (!confidence.ok)
|
|
269
|
+
return confidence;
|
|
270
|
+
if (confidence.value !== undefined)
|
|
271
|
+
parser.confidence = confidence.value;
|
|
272
|
+
const ambiguityReasons = readOptionalStringArray(record.value, 'ambiguityReasons', tool);
|
|
273
|
+
if (!ambiguityReasons.ok)
|
|
274
|
+
return ambiguityReasons;
|
|
275
|
+
if (ambiguityReasons.value !== undefined)
|
|
276
|
+
parser.ambiguityReasons = ambiguityReasons.value;
|
|
277
|
+
const expansionReasons = readOptionalStringArray(record.value, 'expansionReasons', tool);
|
|
278
|
+
if (!expansionReasons.ok)
|
|
279
|
+
return expansionReasons;
|
|
280
|
+
if (expansionReasons.value !== undefined)
|
|
281
|
+
parser.expansionReasons = expansionReasons.value;
|
|
282
|
+
return { ok: true, value: parser };
|
|
283
|
+
}
|
|
284
|
+
export function validIsoTimestamp(value) {
|
|
285
|
+
const timestamp = Date.parse(value);
|
|
286
|
+
return Number.isFinite(timestamp) && new Date(timestamp).toISOString() === value;
|
|
287
|
+
}
|
|
288
|
+
export function validateRunTaskGrantCreateInput(input, tool) {
|
|
289
|
+
const record = inputRecord(input, tool, [
|
|
290
|
+
'runId',
|
|
291
|
+
'agentId',
|
|
292
|
+
'taskFingerprint',
|
|
293
|
+
'categories',
|
|
294
|
+
'externalRoots',
|
|
295
|
+
'cwdPatterns',
|
|
296
|
+
'commandPolicy',
|
|
297
|
+
'expiresAt',
|
|
298
|
+
'maxUses',
|
|
299
|
+
'createdBy',
|
|
300
|
+
'creationReason',
|
|
301
|
+
'approvedScopeSummary',
|
|
302
|
+
]);
|
|
303
|
+
if (!record.ok)
|
|
304
|
+
return record;
|
|
305
|
+
const result = {};
|
|
306
|
+
const copied = copyRequiredStrings(result, record.value, tool, [
|
|
307
|
+
'runId',
|
|
308
|
+
'agentId',
|
|
309
|
+
'taskFingerprint',
|
|
310
|
+
'expiresAt',
|
|
311
|
+
'creationReason',
|
|
312
|
+
'approvedScopeSummary',
|
|
313
|
+
]);
|
|
314
|
+
if (!copied.ok)
|
|
315
|
+
return copied;
|
|
316
|
+
const categories = readRequiredOneOfArray(record.value, 'categories', taskGrantCategories, tool);
|
|
317
|
+
if (!categories.ok)
|
|
318
|
+
return categories;
|
|
319
|
+
result.categories = categories.value;
|
|
320
|
+
const externalRoots = readRequiredStringArray(record.value, 'externalRoots', tool);
|
|
321
|
+
if (!externalRoots.ok)
|
|
322
|
+
return externalRoots;
|
|
323
|
+
result.externalRoots = externalRoots.value;
|
|
324
|
+
const cwdPatterns = readOptionalStringArray(record.value, 'cwdPatterns', tool);
|
|
325
|
+
if (!cwdPatterns.ok)
|
|
326
|
+
return cwdPatterns;
|
|
327
|
+
if (cwdPatterns.value !== undefined)
|
|
328
|
+
result.cwdPatterns = cwdPatterns.value;
|
|
329
|
+
const commandPolicy = readTaskGrantCommandPolicy(record.value.commandPolicy, tool);
|
|
330
|
+
if (!commandPolicy.ok)
|
|
331
|
+
return commandPolicy;
|
|
332
|
+
result.commandPolicy = commandPolicy.value;
|
|
333
|
+
const createdBy = readTaskGrantActor(record.value.createdBy, tool, ['human']);
|
|
334
|
+
if (!createdBy.ok)
|
|
335
|
+
return createdBy;
|
|
336
|
+
result.createdBy = createdBy.value;
|
|
337
|
+
if (typeof record.value.maxUses !== 'number' || !Number.isSafeInteger(record.value.maxUses) || record.value.maxUses < 1)
|
|
338
|
+
return validationFailure('maxUses must be a positive safe integer', tool);
|
|
339
|
+
result.maxUses = record.value.maxUses;
|
|
340
|
+
const expiresAt = Date.parse(result.expiresAt ?? '');
|
|
341
|
+
if (!Number.isFinite(expiresAt) || new Date(expiresAt).toISOString() !== result.expiresAt)
|
|
342
|
+
return validationFailure('expiresAt must be a valid ISO date', tool);
|
|
343
|
+
const expiryDelta = expiresAt - Date.now();
|
|
344
|
+
if (expiryDelta <= 0)
|
|
345
|
+
return validationFailure('expiresAt must be in the future', tool);
|
|
346
|
+
if (expiryDelta > 24 * 60 * 60 * 1000)
|
|
347
|
+
return validationFailure('expiresAt must be within 24 hours', tool);
|
|
348
|
+
return { ok: true, value: result };
|
|
349
|
+
}
|
|
350
|
+
export function validateRunTaskGrantListInput(input, tool) {
|
|
351
|
+
const record = inputRecord(input, tool, ['runId', 'agentId', 'status', 'limit']);
|
|
352
|
+
if (!record.ok)
|
|
353
|
+
return record;
|
|
354
|
+
const result = {};
|
|
355
|
+
const copied = copyOptionalStrings(result, record.value, tool, ['runId', 'agentId']);
|
|
356
|
+
if (!copied.ok)
|
|
357
|
+
return copied;
|
|
358
|
+
const status = readOptionalOneOf(record.value, 'status', taskGrantStatuses, tool);
|
|
359
|
+
if (!status.ok)
|
|
360
|
+
return status;
|
|
361
|
+
if (status.value !== undefined)
|
|
362
|
+
result.status = status.value;
|
|
363
|
+
const limit = readOptionalBoundedLimit(record.value, tool);
|
|
364
|
+
if (!limit.ok)
|
|
365
|
+
return limit;
|
|
366
|
+
if (limit.value !== undefined)
|
|
367
|
+
result.limit = limit.value;
|
|
368
|
+
return { ok: true, value: result };
|
|
369
|
+
}
|
|
370
|
+
export function validateRunTaskGrantGetInput(input, tool) {
|
|
371
|
+
const record = inputRecord(input, tool, ['grantId']);
|
|
372
|
+
if (!record.ok)
|
|
373
|
+
return record;
|
|
374
|
+
const grantId = readNonEmptyString(record.value, 'grantId', tool);
|
|
375
|
+
if (!grantId.ok)
|
|
376
|
+
return grantId;
|
|
377
|
+
return { ok: true, value: { grantId: grantId.value } };
|
|
378
|
+
}
|
|
379
|
+
export function validateRunTaskGrantRevokeInput(input, tool) {
|
|
380
|
+
const record = inputRecord(input, tool, ['grantId', 'actor', 'reason']);
|
|
381
|
+
if (!record.ok)
|
|
382
|
+
return record;
|
|
383
|
+
const grantId = readNonEmptyString(record.value, 'grantId', tool);
|
|
384
|
+
if (!grantId.ok)
|
|
385
|
+
return grantId;
|
|
386
|
+
const reason = readNonEmptyString(record.value, 'reason', tool);
|
|
387
|
+
if (!reason.ok)
|
|
388
|
+
return reason;
|
|
389
|
+
const actor = readTaskGrantActor(record.value.actor, tool, ['human', 'system']);
|
|
390
|
+
if (!actor.ok)
|
|
391
|
+
return actor;
|
|
392
|
+
return { ok: true, value: { grantId: grantId.value, actor: actor.value, reason: reason.value } };
|
|
393
|
+
}
|
|
394
|
+
export function validateRunTaskGrantPreviewMatchInput(input, tool) {
|
|
395
|
+
const record = inputRecord(input, tool, ['runId', 'agentId', 'taskFingerprint', 'category', 'operation', 'workspaceRoot', 'cwd', 'targetPaths']);
|
|
396
|
+
if (!record.ok)
|
|
397
|
+
return record;
|
|
398
|
+
const runId = readNonEmptyString(record.value, 'runId', tool);
|
|
399
|
+
if (!runId.ok)
|
|
400
|
+
return runId;
|
|
401
|
+
const taskFingerprint = readNonEmptyString(record.value, 'taskFingerprint', tool);
|
|
402
|
+
if (!taskFingerprint.ok)
|
|
403
|
+
return taskFingerprint;
|
|
404
|
+
const category = readRequiredOneOf(record.value, 'category', permissionCategories, tool);
|
|
405
|
+
if (!category.ok)
|
|
406
|
+
return category;
|
|
407
|
+
const operation = readNonEmptyString(record.value, 'operation', tool);
|
|
408
|
+
if (!operation.ok)
|
|
409
|
+
return operation;
|
|
410
|
+
const cwd = readNonEmptyString(record.value, 'cwd', tool);
|
|
411
|
+
if (!cwd.ok)
|
|
412
|
+
return cwd;
|
|
413
|
+
const result = {
|
|
414
|
+
runId: runId.value,
|
|
415
|
+
taskFingerprint: taskFingerprint.value,
|
|
416
|
+
category: category.value,
|
|
417
|
+
operation: operation.value,
|
|
418
|
+
cwd: cwd.value,
|
|
419
|
+
};
|
|
420
|
+
const copied = copyOptionalStrings(result, record.value, tool, ['agentId', 'workspaceRoot']);
|
|
421
|
+
if (!copied.ok)
|
|
422
|
+
return copied;
|
|
423
|
+
const targetPaths = readOptionalStringArray(record.value, 'targetPaths', tool);
|
|
424
|
+
if (!targetPaths.ok)
|
|
425
|
+
return targetPaths;
|
|
426
|
+
if (targetPaths.value !== undefined)
|
|
427
|
+
result.targetPaths = targetPaths.value;
|
|
428
|
+
return { ok: true, value: result };
|
|
429
|
+
}
|
|
430
|
+
export function validateRunStartInput(input, tool) {
|
|
431
|
+
const record = inputRecord(input, tool, ['project', 'userIntent', 'workflow', 'phase', 'selectedAgentId', 'providerAdapter', 'model']);
|
|
432
|
+
if (!record.ok)
|
|
433
|
+
return record;
|
|
434
|
+
const result = {};
|
|
435
|
+
const copied = copyRequiredStrings(result, record.value, tool, ['project', 'userIntent', 'workflow', 'phase', 'selectedAgentId', 'providerAdapter', 'model']);
|
|
436
|
+
if (!copied.ok)
|
|
437
|
+
return copied;
|
|
438
|
+
return { ok: true, value: result };
|
|
439
|
+
}
|
|
440
|
+
export function validateRunCheckpointInput(input, tool) {
|
|
441
|
+
const record = inputRecord(input, tool, ['runId', 'label', 'state']);
|
|
442
|
+
if (!record.ok)
|
|
443
|
+
return record;
|
|
444
|
+
const runId = readNonEmptyString(record.value, 'runId', tool);
|
|
445
|
+
if (!runId.ok)
|
|
446
|
+
return runId;
|
|
447
|
+
const label = readNonEmptyString(record.value, 'label', tool);
|
|
448
|
+
if (!label.ok)
|
|
449
|
+
return label;
|
|
450
|
+
const state = readJsonValue(record.value, 'state', tool);
|
|
451
|
+
if (!state.ok)
|
|
452
|
+
return state;
|
|
453
|
+
return { ok: true, value: { runId: runId.value, label: label.value, state: state.value } };
|
|
454
|
+
}
|
|
455
|
+
export function validateRunFinalizeInput(input, tool) {
|
|
456
|
+
const record = inputRecord(input, tool, ['runId', 'status', 'outcome', 'outcomeReason']);
|
|
457
|
+
if (!record.ok)
|
|
458
|
+
return record;
|
|
459
|
+
const runId = readNonEmptyString(record.value, 'runId', tool);
|
|
460
|
+
if (!runId.ok)
|
|
461
|
+
return runId;
|
|
462
|
+
const status = readRequiredOneOf(record.value, 'status', finalRunStatuses, tool);
|
|
463
|
+
if (!status.ok)
|
|
464
|
+
return status;
|
|
465
|
+
const outcome = readRequiredOneOf(record.value, 'outcome', runOutcomes, tool);
|
|
466
|
+
if (!outcome.ok)
|
|
467
|
+
return outcome;
|
|
468
|
+
const result = { runId: runId.value, status: status.value, outcome: outcome.value };
|
|
469
|
+
const copied = copyOptionalStrings(result, record.value, tool, ['outcomeReason']);
|
|
470
|
+
if (!copied.ok)
|
|
471
|
+
return copied;
|
|
472
|
+
return { ok: true, value: result };
|
|
473
|
+
}
|
|
474
|
+
export function validateRunResumeCandidatesInput(input, tool) {
|
|
475
|
+
const record = inputRecord(input, tool, ['project', 'limit']);
|
|
476
|
+
if (!record.ok)
|
|
477
|
+
return record;
|
|
478
|
+
const project = readNonEmptyString(record.value, 'project', tool);
|
|
479
|
+
if (!project.ok)
|
|
480
|
+
return project;
|
|
481
|
+
const result = { project: project.value };
|
|
482
|
+
if (record.value.limit !== undefined) {
|
|
483
|
+
const limit = readBoundedLimit(record.value, tool);
|
|
484
|
+
if (!limit.ok)
|
|
485
|
+
return limit;
|
|
486
|
+
result.limit = limit.value;
|
|
487
|
+
}
|
|
488
|
+
return { ok: true, value: result };
|
|
489
|
+
}
|
|
490
|
+
export function validateRunResumeInspectInput(input, tool) {
|
|
491
|
+
const record = inputRecord(input, tool, ['runId']);
|
|
492
|
+
if (!record.ok)
|
|
493
|
+
return record;
|
|
494
|
+
const runId = readNonEmptyString(record.value, 'runId', tool);
|
|
495
|
+
if (!runId.ok)
|
|
496
|
+
return runId;
|
|
497
|
+
return { ok: true, value: { runId: runId.value } };
|
|
498
|
+
}
|
|
499
|
+
export function validateRunResumeGateInput(input, tool) {
|
|
500
|
+
const record = inputRecord(input, tool, ['approvalId', 'policy']);
|
|
501
|
+
if (!record.ok)
|
|
502
|
+
return record;
|
|
503
|
+
const approvalId = readNonEmptyString(record.value, 'approvalId', tool);
|
|
504
|
+
if (!approvalId.ok)
|
|
505
|
+
return approvalId;
|
|
506
|
+
const result = { approvalId: approvalId.value };
|
|
507
|
+
if (record.value.policy !== undefined) {
|
|
508
|
+
const policy = parseOperationRetryPolicy(record.value.policy);
|
|
509
|
+
if (!policy.ok)
|
|
510
|
+
return validationFailure(policy.errors.join('; '), tool);
|
|
511
|
+
result.policy = policy.policy;
|
|
512
|
+
}
|
|
513
|
+
return { ok: true, value: result };
|
|
514
|
+
}
|