vgxness 1.20.4 → 1.20.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/claude/agent-renderer.js +82 -0
- package/dist/{mcp → adapters/claude/install}/claude-code-agent-config.js +64 -9
- package/dist/{mcp → adapters/claude/install}/claude-code-config.js +28 -6
- package/dist/{mcp → adapters/claude/install}/claude-code-project-memory.js +35 -5
- package/dist/{mcp → adapters/claude/install}/claude-code-scope.js +12 -3
- package/dist/{mcp → adapters/claude/install}/claude-code-user-config.js +26 -5
- package/dist/{mcp → adapters/claude/install}/claude-code-user-memory.js +47 -7
- package/dist/{mcp → adapters/claude/install}/client-install-claude-code-contract.js +45 -8
- package/dist/{mcp → adapters/claude/install}/client-install-claude-code.js +98 -14
- package/dist/adapters/json/agent-renderer.js +104 -0
- package/dist/adapters/opencode/agent-renderer.js +113 -0
- package/dist/{mcp → adapters/opencode/install}/client-install-opencode-contract.js +2 -2
- package/dist/{mcp → adapters/opencode/install}/client-install-opencode.js +1 -1
- package/dist/{mcp → adapters/opencode/install}/opencode-default-agent-config.js +2 -2
- package/dist/{mcp → adapters/opencode/install}/opencode-handoff-preview.js +60 -7
- package/dist/{mcp → adapters/opencode/install}/opencode-visibility.js +1 -1
- package/dist/adapters/provider-renderer.js +6 -0
- package/dist/agents/agent-activation-service.js +1 -263
- package/dist/agents/agent-lookup-contexts.js +1 -28
- package/dist/agents/agent-registry-service.js +1 -81
- package/dist/agents/agent-resolver.js +1 -287
- package/dist/agents/agent-seed-service.js +1 -157
- package/dist/agents/agent-seed-upgrade-service.js +1 -231
- package/dist/agents/agent-selector-resolver.js +1 -28
- package/dist/agents/boot-upgrade.js +1 -59
- package/dist/agents/canonical-agent-manifest.js +1 -245
- package/dist/agents/canonical-agent-projection.js +1 -236
- package/dist/agents/manager-profile-overlay-service.js +1 -60
- package/dist/agents/profile-model-routing.js +1 -30
- package/dist/agents/renderers/claude-renderer.js +1 -82
- package/dist/agents/renderers/index.js +1 -14
- package/dist/agents/renderers/json-renderer.js +1 -104
- package/dist/agents/renderers/opencode-renderer.js +1 -113
- package/dist/agents/renderers/provider-adapter.js +1 -6
- package/dist/agents/repositories/agent-seed-history.js +1 -128
- package/dist/agents/repositories/agents.js +1 -200
- package/dist/agents/repositories/manager-profile-overlays.js +1 -90
- package/dist/agents/schema.js +1 -1
- package/dist/application/agents/agent-activation-service.js +261 -0
- package/dist/application/agents/agent-lookup-contexts.js +28 -0
- package/dist/application/agents/agent-registry-service.js +81 -0
- package/dist/application/agents/agent-resolver.js +287 -0
- package/dist/application/agents/agent-seed-service.js +157 -0
- package/dist/application/agents/agent-seed-upgrade-service.js +231 -0
- package/dist/application/agents/agent-selector-resolver.js +28 -0
- package/dist/application/agents/boot-upgrade.js +59 -0
- package/dist/application/agents/canonical-agent-projection.js +236 -0
- package/dist/application/agents/manager-profile-overlay-service.js +68 -0
- package/dist/application/agents/profile-model-routing.js +30 -0
- package/dist/application/agents/renderers/claude-renderer.js +1 -0
- package/dist/application/agents/renderers/index.js +14 -0
- package/dist/application/agents/renderers/json-renderer.js +1 -0
- package/dist/application/agents/renderers/opencode-renderer.js +1 -0
- package/dist/application/agents/renderers/provider-adapter.js +1 -0
- package/dist/application/memory/active-work-preview.js +75 -0
- package/dist/application/memory/agent-memory-capture-service.js +498 -0
- package/dist/application/memory/import/dry-run-planner.js +58 -0
- package/dist/application/memory/import/index.js +3 -0
- package/dist/application/memory/import/observation-writer.js +226 -0
- package/dist/application/memory/import/package.js +179 -0
- package/dist/application/memory/memory-service.js +202 -0
- package/dist/application/memory/search.js +11 -0
- package/dist/{mcp → application/provider-setup}/provider-change-plan.js +74 -13
- package/dist/{mcp → application/provider-setup}/provider-doctor.js +201 -31
- package/dist/{mcp → application/provider-setup}/provider-health-types.js +1 -1
- package/dist/{mcp → application/provider-setup}/provider-status.js +170 -33
- package/dist/application/runs/execution-planning.js +180 -0
- package/dist/application/runs/operation-execution.js +1 -0
- package/dist/application/runs/operation-retry.js +129 -0
- package/dist/application/runs/resume-after-approval-result.js +88 -0
- package/dist/application/runs/run-insights.js +270 -0
- package/dist/application/runs/run-service.js +1480 -0
- package/dist/application/runs/run-snapshot-export-service.js +31 -0
- package/dist/application/runs/sandbox-process-execution.js +244 -0
- package/dist/application/runs/sandbox-worktree-planning.js +59 -0
- package/dist/application/runs/task-scoped-command-grant-service.js +224 -0
- package/dist/application/sdd/artifact-portability-service.js +137 -0
- package/dist/application/sdd/cockpit-read-model.js +195 -0
- package/dist/application/sdd/sdd-continuation-plan.js +265 -0
- package/dist/application/sdd/sdd-workflow-service.js +892 -0
- package/dist/application/skills/boot-seed.js +42 -0
- package/dist/application/skills/personal-skills.js +41 -0
- package/dist/application/skills/skill-export-service.js +34 -0
- package/dist/application/skills/skill-index-service.js +126 -0
- package/dist/application/skills/skill-payload.js +186 -0
- package/dist/application/skills/skill-registry-service.js +648 -0
- package/dist/application/skills/skill-resolver.js +368 -0
- package/dist/application/skills/skill-seed-service.js +242 -0
- package/dist/application/skills/skill-status-service.js +147 -0
- package/dist/cli/bun-bin.js +0 -0
- package/dist/cli/cli-flags.js +1 -387
- package/dist/cli/cli-help.js +1 -173
- package/dist/cli/cli-helpers.js +1 -77
- package/dist/cli/cli-types.js +1 -1
- package/dist/cli/commands/agent-skill-dispatcher.js +1 -700
- package/dist/cli/commands/index.js +1 -9
- package/dist/cli/commands/interactive-entrypoint-dispatcher.js +1 -14
- package/dist/cli/commands/mcp-dispatcher.js +1 -232
- package/dist/cli/commands/memory-sdd-dispatcher.js +1 -367
- package/dist/cli/commands/run-permission-dispatcher.js +1 -455
- package/dist/cli/commands/setup-dispatcher.js +1 -496
- package/dist/cli/commands/status-dispatcher.js +1 -130
- package/dist/cli/commands/verification-dispatcher.js +1 -47
- package/dist/cli/commands/workflow-dispatcher.js +1 -566
- package/dist/cli/dispatcher.js +1 -247
- package/dist/cli/doctor-renderer.js +1 -26
- package/dist/cli/home-tui-app.js +1 -411
- package/dist/cli/home-tui-controller.js +1 -314
- package/dist/cli/mcp-start-path.js +1 -21
- package/dist/cli/product-resume-renderer.js +1 -32
- package/dist/cli/product-status-renderer.js +1 -81
- package/dist/cli/sdd-renderer.js +1 -247
- package/dist/cli/setup-plan-renderer.js +1 -79
- package/dist/cli/setup-status-renderer.js +1 -50
- package/dist/cli/setup-tui-app.js +1 -130
- package/dist/cli/setup-tui-controller.js +1 -89
- package/dist/cli/tui/focus-reducer.js +1 -0
- package/dist/cli/tui/focus-types.js +1 -0
- package/dist/cli/tui/ink/app-shell.js +1 -0
- package/dist/cli/tui/ink/components.js +1 -38
- package/dist/cli/tui/ink/help-overlay.js +1 -0
- package/dist/cli/tui/ink/state-components.js +1 -0
- package/dist/cli/tui/ink/theme.js +1 -36
- package/dist/cli/tui/key-intents.js +1 -0
- package/dist/cli/tui/keymap.js +1 -20
- package/dist/cli/tui/navigation.js +1 -10
- package/dist/cli/tui/screen-registry.js +1 -0
- package/dist/cli/tui/terminal-capabilities.js +1 -12
- package/dist/cli/tui/tui-types.js +1 -1
- package/dist/cli/tui/visual/badges.js +1 -19
- package/dist/cli/tui/visual/footer.js +1 -27
- package/dist/cli/tui/visual/index.js +1 -3
- package/dist/cli/tui/visual/viewport.js +1 -11
- package/dist/cli/tui-render-helpers.js +1 -200
- package/dist/cli/verification-plan-renderer.js +1 -25
- package/dist/cli/verification-report-renderer.js +1 -19
- package/dist/domain/agents/canonical-agent-manifest.js +355 -0
- package/dist/domain/agents/schema.js +1 -0
- package/dist/domain/memory/active-work-topics.js +64 -0
- package/dist/domain/memory/memory-capture-schema.js +1 -0
- package/dist/domain/memory/schema.js +1 -0
- package/dist/domain/runs/schema.js +5 -0
- package/dist/domain/sdd/cockpit-types.js +1 -0
- package/dist/domain/sdd/schema.js +111 -0
- package/dist/domain/skills/schema.js +1 -0
- package/dist/governance/risk-classifier.js +2 -0
- package/dist/interfaces/cli/bun-bin.js +46 -0
- package/dist/interfaces/cli/cli-flags.js +391 -0
- package/dist/interfaces/cli/cli-help.js +173 -0
- package/dist/interfaces/cli/cli-helpers.js +77 -0
- package/dist/interfaces/cli/cli-types.js +1 -0
- package/dist/interfaces/cli/commands/agent-skill-dispatcher.js +700 -0
- package/dist/interfaces/cli/commands/index.js +9 -0
- package/dist/interfaces/cli/commands/interactive-entrypoint-dispatcher.js +14 -0
- package/dist/interfaces/cli/commands/mcp-dispatcher.js +252 -0
- package/dist/interfaces/cli/commands/memory-sdd-dispatcher.js +367 -0
- package/dist/interfaces/cli/commands/run-permission-dispatcher.js +460 -0
- package/dist/interfaces/cli/commands/setup-dispatcher.js +496 -0
- package/dist/interfaces/cli/commands/status-dispatcher.js +130 -0
- package/dist/interfaces/cli/commands/verification-dispatcher.js +47 -0
- package/dist/interfaces/cli/commands/workflow-dispatcher.js +566 -0
- package/dist/interfaces/cli/dispatcher.js +247 -0
- package/dist/interfaces/cli/doctor-renderer.js +26 -0
- package/dist/interfaces/cli/home-tui-app.js +462 -0
- package/dist/interfaces/cli/home-tui-controller.js +341 -0
- package/dist/interfaces/cli/index.js +27 -0
- package/dist/interfaces/cli/mcp-start-path.js +21 -0
- package/dist/interfaces/cli/product-resume-renderer.js +32 -0
- package/dist/interfaces/cli/product-status-renderer.js +81 -0
- package/dist/interfaces/cli/sdd-renderer.js +247 -0
- package/dist/interfaces/cli/setup-plan-renderer.js +79 -0
- package/dist/interfaces/cli/setup-status-renderer.js +50 -0
- package/dist/interfaces/cli/setup-tui-app.js +135 -0
- package/dist/interfaces/cli/setup-tui-controller.js +89 -0
- package/dist/interfaces/cli/tui/focus-reducer.js +60 -0
- package/dist/interfaces/cli/tui/focus-types.js +10 -0
- package/dist/interfaces/cli/tui/ink/app-shell.js +16 -0
- package/dist/interfaces/cli/tui/ink/components.js +38 -0
- package/dist/interfaces/cli/tui/ink/help-overlay.js +6 -0
- package/dist/interfaces/cli/tui/ink/state-components.js +22 -0
- package/dist/interfaces/cli/tui/ink/theme.js +36 -0
- package/dist/interfaces/cli/tui/key-intents.js +33 -0
- package/dist/interfaces/cli/tui/keymap.js +20 -0
- package/dist/interfaces/cli/tui/navigation.js +10 -0
- package/dist/interfaces/cli/tui/screen-registry.js +43 -0
- package/dist/interfaces/cli/tui/terminal-capabilities.js +12 -0
- package/dist/interfaces/cli/tui/tui-types.js +1 -0
- package/dist/interfaces/cli/tui/visual/badges.js +19 -0
- package/dist/interfaces/cli/tui/visual/footer.js +27 -0
- package/dist/interfaces/cli/tui/visual/index.js +3 -0
- package/dist/interfaces/cli/tui/visual/viewport.js +11 -0
- package/dist/interfaces/cli/tui-render-helpers.js +200 -0
- package/dist/interfaces/cli/verification-plan-renderer.js +25 -0
- package/dist/interfaces/cli/verification-report-renderer.js +19 -0
- package/dist/interfaces/mcp/contracts/agents.js +1 -0
- package/dist/interfaces/mcp/contracts/context.js +1 -0
- package/dist/interfaces/mcp/contracts/governance.js +1 -0
- package/dist/interfaces/mcp/contracts/index.js +1 -0
- package/dist/interfaces/mcp/contracts/memory.js +1 -0
- package/dist/interfaces/mcp/contracts/providers.js +1 -0
- package/dist/interfaces/mcp/contracts/runs.js +1 -0
- package/dist/interfaces/mcp/contracts/sdd.js +1 -0
- package/dist/interfaces/mcp/contracts/sessions.js +1 -0
- package/dist/interfaces/mcp/contracts/skills.js +1 -0
- package/dist/interfaces/mcp/contracts/verification.js +1 -0
- package/dist/interfaces/mcp/control-plane/handlers/agents.js +38 -0
- package/dist/interfaces/mcp/control-plane/handlers/context.js +12 -0
- package/dist/interfaces/mcp/control-plane/handlers/memory.js +95 -0
- package/dist/interfaces/mcp/control-plane/handlers/providers.js +19 -0
- package/dist/interfaces/mcp/control-plane/handlers/runs.js +134 -0
- package/dist/interfaces/mcp/control-plane/handlers/sdd.js +225 -0
- package/dist/interfaces/mcp/control-plane/handlers/sessions.js +39 -0
- package/dist/interfaces/mcp/control-plane/handlers/skills.js +82 -0
- package/dist/interfaces/mcp/control-plane/handlers/verification.js +11 -0
- package/dist/interfaces/mcp/control-plane/types.js +1 -0
- package/dist/interfaces/mcp/control-plane.js +235 -0
- package/dist/interfaces/mcp/schema.js +174 -0
- package/dist/interfaces/mcp/schemas/common.js +121 -0
- package/dist/interfaces/mcp/schemas/inputs/agents.js +69 -0
- package/dist/interfaces/mcp/schemas/inputs/context.js +32 -0
- package/dist/interfaces/mcp/schemas/inputs/governance.js +23 -0
- package/dist/interfaces/mcp/schemas/inputs/index.js +10 -0
- package/dist/interfaces/mcp/schemas/inputs/memory.js +50 -0
- package/dist/interfaces/mcp/schemas/inputs/providers.js +35 -0
- package/dist/interfaces/mcp/schemas/inputs/runs.js +146 -0
- package/dist/interfaces/mcp/schemas/inputs/sdd.js +102 -0
- package/dist/interfaces/mcp/schemas/inputs/sessions.js +32 -0
- package/dist/interfaces/mcp/schemas/inputs/skills.js +231 -0
- package/dist/interfaces/mcp/schemas/inputs/verification.js +9 -0
- package/dist/interfaces/mcp/schemas/outputs/index.js +2 -0
- package/dist/interfaces/mcp/schemas/outputs/providers.js +28 -0
- package/dist/interfaces/mcp/schemas/outputs/sdd.js +166 -0
- package/dist/interfaces/mcp/stdio-server.js +116 -0
- package/dist/interfaces/mcp/validation/agents.js +189 -0
- package/dist/interfaces/mcp/validation/common.js +415 -0
- package/dist/interfaces/mcp/validation/governance.js +50 -0
- package/dist/interfaces/mcp/validation/memory.js +133 -0
- package/dist/interfaces/mcp/validation/providers.js +94 -0
- package/dist/interfaces/mcp/validation/runs.js +514 -0
- package/dist/interfaces/mcp/validation/sdd.js +247 -0
- package/dist/interfaces/mcp/validation/sessions.js +51 -0
- package/dist/interfaces/mcp/validation/skills.js +685 -0
- package/dist/interfaces/mcp/validation/verification.js +24 -0
- package/dist/interfaces/mcp/validation.js +149 -0
- package/dist/mcp/control-plane-snapshot-service.js +65 -2
- package/dist/mcp/control-plane.js +1 -646
- package/dist/mcp/doctor.js +1 -1
- package/dist/mcp/index.js +17 -17
- package/dist/mcp/schema.js +1 -1072
- package/dist/mcp/stdio-server.js +1 -116
- package/dist/mcp/validation.js +1 -2239
- package/dist/memory/active-work-preview.js +1 -75
- package/dist/memory/active-work-topics.js +1 -64
- package/dist/memory/agent-memory-capture-service.js +1 -497
- package/dist/memory/import/dry-run-planner.js +1 -58
- package/dist/memory/import/index.js +1 -3
- package/dist/memory/import/observation-writer.js +1 -226
- package/dist/memory/import/package.js +1 -179
- package/dist/memory/memory-capture-schema.js +1 -1
- package/dist/memory/memory-service.js +1 -201
- package/dist/memory/repositories/artifacts.js +1 -67
- package/dist/memory/repositories/observations.js +1 -217
- package/dist/memory/repositories/sessions.js +1 -125
- package/dist/memory/repositories/traces.js +1 -78
- package/dist/memory/schema.js +1 -1
- package/dist/memory/search.js +1 -11
- package/dist/memory/sqlite/database.js +1 -228
- package/dist/memory/storage-paths.js +1 -72
- package/dist/payload/context-budget-policy.js +10 -0
- package/dist/payload/context-budget-service.js +26 -0
- package/dist/payload/payload-diagnostics.js +50 -0
- package/dist/permissions/explicit-request-authorization.js +126 -0
- package/dist/permissions/policy-evaluator.js +54 -14
- package/dist/runs/execution-planning.js +1 -178
- package/dist/runs/operation-execution.js +1 -1
- package/dist/runs/operation-retry.js +1 -129
- package/dist/runs/repositories/runs.js +1 -676
- package/dist/runs/repositories/task-scoped-command-grants.js +1 -462
- package/dist/runs/resume-after-approval-result.js +1 -84
- package/dist/runs/run-insights.js +1 -270
- package/dist/runs/run-service.js +1 -1439
- package/dist/runs/run-snapshot-export-service.js +1 -31
- package/dist/runs/sandbox-process-execution.js +1 -240
- package/dist/runs/sandbox-worktree-planning.js +1 -59
- package/dist/runs/schema.js +1 -5
- package/dist/runs/task-scoped-command-grant-service.js +1 -216
- package/dist/sdd/artifact-portability-service.js +1 -137
- package/dist/sdd/cockpit-read-model.js +1 -195
- package/dist/sdd/cockpit-types.js +1 -1
- package/dist/sdd/schema.js +1 -111
- package/dist/sdd/sdd-continuation-plan.js +1 -265
- package/dist/sdd/sdd-workflow-service.js +1 -822
- package/dist/setup/providers/claude-setup-adapter.js +11 -4
- package/dist/setup/providers/opencode-setup-adapter.js +10 -7
- package/dist/setup/setup-plan.js +20 -7
- package/dist/skills/boot-seed.js +1 -42
- package/dist/skills/personal-skills.js +1 -41
- package/dist/skills/repositories/skill-evaluation-requests.js +1 -190
- package/dist/skills/repositories/skill-evaluation-scenarios.js +1 -305
- package/dist/skills/repositories/skill-improvement-proposals.js +1 -355
- package/dist/skills/repositories/skills.js +1 -1077
- package/dist/skills/schema.js +1 -1
- package/dist/skills/skill-export-service.js +1 -34
- package/dist/skills/skill-index-service.js +1 -126
- package/dist/skills/skill-payload.js +1 -186
- package/dist/skills/skill-registry-service.js +1 -644
- package/dist/skills/skill-resolver.js +1 -368
- package/dist/skills/skill-seed-service.js +1 -242
- package/dist/skills/skill-status-service.js +1 -147
- package/dist/storage/agents/repositories/agent-seed-history.js +128 -0
- package/dist/storage/agents/repositories/agents.js +200 -0
- package/dist/storage/agents/repositories/manager-profile-overlays.js +90 -0
- package/dist/storage/memory/repositories/artifacts.js +67 -0
- package/dist/storage/memory/repositories/observations.js +217 -0
- package/dist/storage/memory/repositories/sessions.js +125 -0
- package/dist/storage/memory/repositories/traces.js +78 -0
- package/dist/storage/memory/sqlite/database.js +228 -0
- package/dist/storage/memory/storage-paths.js +72 -0
- package/dist/storage/runs/repositories/runs.js +676 -0
- package/dist/storage/runs/repositories/task-scoped-command-grants.js +464 -0
- package/dist/storage/skills/repositories/skill-evaluation-requests.js +190 -0
- package/dist/storage/skills/repositories/skill-evaluation-scenarios.js +305 -0
- package/dist/storage/skills/repositories/skill-improvement-proposals.js +355 -0
- package/dist/storage/skills/repositories/skills.js +1084 -0
- package/docs/architecture.md +2 -2
- package/docs/glossary.md +1 -1
- package/docs/mcp.md +1 -1
- package/docs/module-boundaries.md +114 -0
- package/docs/prd.md +1 -1
- package/docs/project-health-audit-v1.10.x.md +1 -1
- package/docs/providers.md +2 -2
- package/docs/safety.md +3 -3
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/apply-progress.md +122 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/archive-report.md +61 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/design.md +66 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/proposal.md +79 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/spec.md +67 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/tasks.md +63 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/verify-report.md +71 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/apply-progress.md +68 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/archive-report.md +61 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/design.md +43 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/proposal.md +61 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/spec.md +31 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/tasks.md +27 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/verify-report.md +58 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/apply-progress.md +65 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/archive-report.md +53 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/design.md +64 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/proposal.md +62 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/spec.md +51 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/tasks.md +50 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/verify-report.md +66 -0
- package/docs/storage.md +2 -2
- package/package.json +2 -2
- /package/dist/{mcp → adapters/claude/install}/claude-code-cli.js +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/001_initial.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/002_observation_revisions.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/003_agent_registry.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/004_run_runtime.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/005_run_approvals.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/006_run_operation_attempts.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/007_abandoned_operation_attempts.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/008_run_execution_plan_events.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/009_multiple_operation_attempts.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/010_skill_registry.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/011_skill_usage_resolution_outcomes.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/012_skill_improvement_proposals.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/013_skill_evaluation_scenarios.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/014_manager_profile_overlays.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/015_artifact_metadata.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/016_agent_seed_history.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/017_intent_signal_skill_targets.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/018_skill_system_v2.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/019_task_scoped_command_grants.sql +0 -0
|
@@ -0,0 +1,685 @@
|
|
|
1
|
+
import { agentModes, copyOptionalStrings, copyRequiredStrings, inputRecord, payloadModes, readNonEmptyString, readOptionalBoundedLimit, readOptionalJsonObject, readOptionalNonEmptyString, readOptionalOneOf, readOptionalStringArray, readRequiredOneOf, readSkillLifecycleActor, readSkillSource, scopes, skillAttachmentTargetTypes, skillEvaluationRequestStatuses, skillImprovementProposalStatuses, skillSourceKinds, skillUsageOutcomes, skillVersionStatuses, validationFailure, } from './common.js';
|
|
2
|
+
export function validateSkillIndexInput(input, tool) {
|
|
3
|
+
const record = inputRecord(input, tool, ['project', 'scope']);
|
|
4
|
+
if (!record.ok)
|
|
5
|
+
return record;
|
|
6
|
+
const project = readNonEmptyString(record.value, 'project', tool);
|
|
7
|
+
if (!project.ok)
|
|
8
|
+
return project;
|
|
9
|
+
const scope = readRequiredOneOf(record.value, 'scope', scopes, tool);
|
|
10
|
+
if (!scope.ok)
|
|
11
|
+
return scope;
|
|
12
|
+
return { ok: true, value: { project: project.value, scope: scope.value } };
|
|
13
|
+
}
|
|
14
|
+
export function validateSkillSearchInput(input, tool) {
|
|
15
|
+
const record = inputRecord(input, tool, ['project', 'scope', 'query', 'status', 'sourceKind', 'limit']);
|
|
16
|
+
if (!record.ok)
|
|
17
|
+
return record;
|
|
18
|
+
const project = readNonEmptyString(record.value, 'project', tool);
|
|
19
|
+
if (!project.ok)
|
|
20
|
+
return project;
|
|
21
|
+
const result = { project: project.value };
|
|
22
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
23
|
+
if (!scope.ok)
|
|
24
|
+
return scope;
|
|
25
|
+
if (scope.value !== undefined)
|
|
26
|
+
result.scope = scope.value;
|
|
27
|
+
const query = readOptionalNonEmptyString(record.value, 'query', tool);
|
|
28
|
+
if (!query.ok)
|
|
29
|
+
return query;
|
|
30
|
+
if (query.value !== undefined)
|
|
31
|
+
result.query = query.value;
|
|
32
|
+
const status = readOptionalOneOf(record.value, 'status', skillVersionStatuses, tool);
|
|
33
|
+
if (!status.ok)
|
|
34
|
+
return status;
|
|
35
|
+
if (status.value !== undefined)
|
|
36
|
+
result.status = status.value;
|
|
37
|
+
const sourceKind = readOptionalOneOf(record.value, 'sourceKind', skillSourceKinds, tool);
|
|
38
|
+
if (!sourceKind.ok)
|
|
39
|
+
return sourceKind;
|
|
40
|
+
if (sourceKind.value !== undefined)
|
|
41
|
+
result.sourceKind = sourceKind.value;
|
|
42
|
+
if (record.value.limit !== undefined) {
|
|
43
|
+
const limit = record.value.limit;
|
|
44
|
+
if (typeof limit !== 'number' || !Number.isSafeInteger(limit) || limit < 1 || limit > 100)
|
|
45
|
+
return validationFailure('limit must be an integer between 1 and 100', tool);
|
|
46
|
+
result.limit = limit;
|
|
47
|
+
}
|
|
48
|
+
return { ok: true, value: result };
|
|
49
|
+
}
|
|
50
|
+
export function validateSkillGetInput(input, tool) {
|
|
51
|
+
const record = inputRecord(input, tool, ['project', 'scope', 'id', 'name', 'includeUsage']);
|
|
52
|
+
if (!record.ok)
|
|
53
|
+
return record;
|
|
54
|
+
const project = readNonEmptyString(record.value, 'project', tool);
|
|
55
|
+
if (!project.ok)
|
|
56
|
+
return project;
|
|
57
|
+
const result = { project: project.value };
|
|
58
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
59
|
+
if (!scope.ok)
|
|
60
|
+
return scope;
|
|
61
|
+
if (scope.value !== undefined)
|
|
62
|
+
result.scope = scope.value;
|
|
63
|
+
const id = readOptionalNonEmptyString(record.value, 'id', tool);
|
|
64
|
+
if (!id.ok)
|
|
65
|
+
return id;
|
|
66
|
+
if (id.value !== undefined)
|
|
67
|
+
result.id = id.value;
|
|
68
|
+
const name = readOptionalNonEmptyString(record.value, 'name', tool);
|
|
69
|
+
if (!name.ok)
|
|
70
|
+
return name;
|
|
71
|
+
if (name.value !== undefined)
|
|
72
|
+
result.name = name.value;
|
|
73
|
+
if (result.id === undefined && result.name === undefined)
|
|
74
|
+
return validationFailure('Either id or name is required', tool);
|
|
75
|
+
if (record.value.includeUsage !== undefined) {
|
|
76
|
+
if (typeof record.value.includeUsage !== 'boolean')
|
|
77
|
+
return validationFailure('includeUsage must be boolean', tool);
|
|
78
|
+
result.includeUsage = record.value.includeUsage;
|
|
79
|
+
}
|
|
80
|
+
return { ok: true, value: result };
|
|
81
|
+
}
|
|
82
|
+
export function validateSkillStatusInput(input, tool) {
|
|
83
|
+
const record = inputRecord(input, tool, ['project', 'scope', 'provider', 'mode', 'agent']);
|
|
84
|
+
if (!record.ok)
|
|
85
|
+
return record;
|
|
86
|
+
const project = readNonEmptyString(record.value, 'project', tool);
|
|
87
|
+
if (!project.ok)
|
|
88
|
+
return project;
|
|
89
|
+
const result = { project: project.value };
|
|
90
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
91
|
+
if (!scope.ok)
|
|
92
|
+
return scope;
|
|
93
|
+
if (scope.value !== undefined)
|
|
94
|
+
result.scope = scope.value;
|
|
95
|
+
const mode = readOptionalOneOf(record.value, 'mode', agentModes, tool);
|
|
96
|
+
if (!mode.ok)
|
|
97
|
+
return mode;
|
|
98
|
+
if (mode.value !== undefined)
|
|
99
|
+
result.mode = mode.value;
|
|
100
|
+
const copied = copyOptionalStrings(result, record.value, tool, ['provider', 'agent']);
|
|
101
|
+
if (!copied.ok)
|
|
102
|
+
return copied;
|
|
103
|
+
return { ok: true, value: result };
|
|
104
|
+
}
|
|
105
|
+
export function validateSkillPayloadInput(input, tool) {
|
|
106
|
+
const record = inputRecord(input, tool, [
|
|
107
|
+
'workspaceRoot',
|
|
108
|
+
'maxSourceBytes',
|
|
109
|
+
'project',
|
|
110
|
+
'scope',
|
|
111
|
+
'agentId',
|
|
112
|
+
'agentName',
|
|
113
|
+
'workflow',
|
|
114
|
+
'phase',
|
|
115
|
+
'intentSignals',
|
|
116
|
+
'providerAdapter',
|
|
117
|
+
'runId',
|
|
118
|
+
'mode',
|
|
119
|
+
]);
|
|
120
|
+
if (!record.ok)
|
|
121
|
+
return record;
|
|
122
|
+
const workspaceRoot = readNonEmptyString(record.value, 'workspaceRoot', tool);
|
|
123
|
+
if (!workspaceRoot.ok)
|
|
124
|
+
return workspaceRoot;
|
|
125
|
+
const result = { workspaceRoot: workspaceRoot.value };
|
|
126
|
+
const copied = copyOptionalStrings(result, record.value, tool, ['project', 'agentId', 'agentName', 'workflow', 'phase', 'providerAdapter', 'runId']);
|
|
127
|
+
if (!copied.ok)
|
|
128
|
+
return copied;
|
|
129
|
+
const intentSignals = readOptionalStringArray(record.value, 'intentSignals', tool);
|
|
130
|
+
if (!intentSignals.ok)
|
|
131
|
+
return intentSignals;
|
|
132
|
+
if (intentSignals.value !== undefined)
|
|
133
|
+
result.intentSignals = intentSignals.value;
|
|
134
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
135
|
+
if (!scope.ok)
|
|
136
|
+
return scope;
|
|
137
|
+
if (scope.value !== undefined)
|
|
138
|
+
result.scope = scope.value;
|
|
139
|
+
const mode = readOptionalOneOf(record.value, 'mode', payloadModes, tool);
|
|
140
|
+
if (!mode.ok)
|
|
141
|
+
return mode;
|
|
142
|
+
if (mode.value !== undefined)
|
|
143
|
+
result.mode = mode.value;
|
|
144
|
+
if (record.value.maxSourceBytes !== undefined) {
|
|
145
|
+
const maxSourceBytes = record.value.maxSourceBytes;
|
|
146
|
+
if (typeof maxSourceBytes !== 'number' || !Number.isSafeInteger(maxSourceBytes) || maxSourceBytes <= 0)
|
|
147
|
+
return validationFailure('maxSourceBytes must be a positive safe integer', tool);
|
|
148
|
+
result.maxSourceBytes = maxSourceBytes;
|
|
149
|
+
}
|
|
150
|
+
return { ok: true, value: result };
|
|
151
|
+
}
|
|
152
|
+
export function validateSkillActivateInput(input, tool) {
|
|
153
|
+
const record = inputRecord(input, tool, [
|
|
154
|
+
'project',
|
|
155
|
+
'scope',
|
|
156
|
+
'skillId',
|
|
157
|
+
'name',
|
|
158
|
+
'versionId',
|
|
159
|
+
'version',
|
|
160
|
+
'runId',
|
|
161
|
+
'agentId',
|
|
162
|
+
'workflow',
|
|
163
|
+
'phase',
|
|
164
|
+
'providerAdapter',
|
|
165
|
+
'intent',
|
|
166
|
+
'reason',
|
|
167
|
+
'workspaceRoot',
|
|
168
|
+
'maxSourceBytes',
|
|
169
|
+
'mode',
|
|
170
|
+
]);
|
|
171
|
+
if (!record.ok)
|
|
172
|
+
return record;
|
|
173
|
+
const project = readNonEmptyString(record.value, 'project', tool);
|
|
174
|
+
if (!project.ok)
|
|
175
|
+
return project;
|
|
176
|
+
const result = { project: project.value };
|
|
177
|
+
const copied = copyOptionalStrings(result, record.value, tool, [
|
|
178
|
+
'skillId',
|
|
179
|
+
'name',
|
|
180
|
+
'versionId',
|
|
181
|
+
'version',
|
|
182
|
+
'runId',
|
|
183
|
+
'agentId',
|
|
184
|
+
'workflow',
|
|
185
|
+
'phase',
|
|
186
|
+
'providerAdapter',
|
|
187
|
+
'reason',
|
|
188
|
+
'workspaceRoot',
|
|
189
|
+
]);
|
|
190
|
+
if (!copied.ok)
|
|
191
|
+
return copied;
|
|
192
|
+
if (result.skillId === undefined && result.name === undefined)
|
|
193
|
+
return validationFailure('Either skillId or name is required', tool);
|
|
194
|
+
if (result.versionId !== undefined && result.version !== undefined)
|
|
195
|
+
return validationFailure('Use either versionId or version, not both', tool);
|
|
196
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
197
|
+
if (!scope.ok)
|
|
198
|
+
return scope;
|
|
199
|
+
if (scope.value !== undefined)
|
|
200
|
+
result.scope = scope.value;
|
|
201
|
+
const mode = readOptionalOneOf(record.value, 'mode', payloadModes, tool);
|
|
202
|
+
if (!mode.ok)
|
|
203
|
+
return mode;
|
|
204
|
+
if (mode.value !== undefined)
|
|
205
|
+
result.mode = mode.value;
|
|
206
|
+
const intent = readOptionalJsonObject(record.value, 'intent', tool);
|
|
207
|
+
if (!intent.ok)
|
|
208
|
+
return intent;
|
|
209
|
+
if (intent.value !== undefined)
|
|
210
|
+
result.intent = intent.value;
|
|
211
|
+
if (record.value.maxSourceBytes !== undefined) {
|
|
212
|
+
const maxSourceBytes = record.value.maxSourceBytes;
|
|
213
|
+
if (typeof maxSourceBytes !== 'number' || !Number.isSafeInteger(maxSourceBytes) || maxSourceBytes <= 0)
|
|
214
|
+
return validationFailure('maxSourceBytes must be a positive safe integer', tool);
|
|
215
|
+
result.maxSourceBytes = maxSourceBytes;
|
|
216
|
+
}
|
|
217
|
+
return { ok: true, value: result };
|
|
218
|
+
}
|
|
219
|
+
export function validateSkillRecordUsageInput(input, tool) {
|
|
220
|
+
const record = inputRecord(input, tool, [
|
|
221
|
+
'skillId',
|
|
222
|
+
'versionId',
|
|
223
|
+
'runId',
|
|
224
|
+
'targetType',
|
|
225
|
+
'targetKey',
|
|
226
|
+
'outcome',
|
|
227
|
+
'notes',
|
|
228
|
+
'workflow',
|
|
229
|
+
'phase',
|
|
230
|
+
'providerAdapter',
|
|
231
|
+
'agentId',
|
|
232
|
+
'intent',
|
|
233
|
+
'evidence',
|
|
234
|
+
]);
|
|
235
|
+
if (!record.ok)
|
|
236
|
+
return record;
|
|
237
|
+
const skillId = readNonEmptyString(record.value, 'skillId', tool);
|
|
238
|
+
if (!skillId.ok)
|
|
239
|
+
return skillId;
|
|
240
|
+
const outcome = readRequiredOneOf(record.value, 'outcome', skillUsageOutcomes, tool);
|
|
241
|
+
if (!outcome.ok)
|
|
242
|
+
return outcome;
|
|
243
|
+
const result = { skillId: skillId.value, outcome: outcome.value };
|
|
244
|
+
const copied = copyOptionalStrings(result, record.value, tool, [
|
|
245
|
+
'versionId',
|
|
246
|
+
'runId',
|
|
247
|
+
'targetKey',
|
|
248
|
+
'notes',
|
|
249
|
+
'workflow',
|
|
250
|
+
'phase',
|
|
251
|
+
'providerAdapter',
|
|
252
|
+
'agentId',
|
|
253
|
+
]);
|
|
254
|
+
if (!copied.ok)
|
|
255
|
+
return copied;
|
|
256
|
+
const targetType = readOptionalOneOf(record.value, 'targetType', skillAttachmentTargetTypes, tool);
|
|
257
|
+
if (!targetType.ok)
|
|
258
|
+
return targetType;
|
|
259
|
+
if (targetType.value !== undefined)
|
|
260
|
+
result.targetType = targetType.value;
|
|
261
|
+
if (result.targetType !== undefined && result.targetKey === undefined)
|
|
262
|
+
return validationFailure('targetKey is required when targetType is set', tool);
|
|
263
|
+
if (result.targetType === undefined && result.targetKey !== undefined)
|
|
264
|
+
return validationFailure('targetType is required when targetKey is set', tool);
|
|
265
|
+
const intent = readOptionalJsonObject(record.value, 'intent', tool);
|
|
266
|
+
if (!intent.ok)
|
|
267
|
+
return intent;
|
|
268
|
+
if (intent.value !== undefined)
|
|
269
|
+
result.intent = intent.value;
|
|
270
|
+
const evidence = readOptionalJsonObject(record.value, 'evidence', tool);
|
|
271
|
+
if (!evidence.ok)
|
|
272
|
+
return evidence;
|
|
273
|
+
if (evidence.value !== undefined)
|
|
274
|
+
result.evidence = evidence.value;
|
|
275
|
+
return { ok: true, value: result };
|
|
276
|
+
}
|
|
277
|
+
export function validateSkillProposeImprovementInput(input, tool) {
|
|
278
|
+
const record = inputRecord(input, tool, [
|
|
279
|
+
'project',
|
|
280
|
+
'scope',
|
|
281
|
+
'skillId',
|
|
282
|
+
'name',
|
|
283
|
+
'baseVersionId',
|
|
284
|
+
'baseVersion',
|
|
285
|
+
'proposedVersion',
|
|
286
|
+
'proposedSource',
|
|
287
|
+
'proposedCompatibility',
|
|
288
|
+
'title',
|
|
289
|
+
'problem',
|
|
290
|
+
'suggestedChange',
|
|
291
|
+
'sourceContext',
|
|
292
|
+
'runId',
|
|
293
|
+
'agentId',
|
|
294
|
+
'workflow',
|
|
295
|
+
'phase',
|
|
296
|
+
'providerAdapter',
|
|
297
|
+
'evidenceRefs',
|
|
298
|
+
'evidence',
|
|
299
|
+
'actor',
|
|
300
|
+
]);
|
|
301
|
+
if (!record.ok)
|
|
302
|
+
return record;
|
|
303
|
+
const result = {};
|
|
304
|
+
const copied = copyRequiredStrings(result, record.value, tool, ['project', 'proposedVersion', 'title', 'problem', 'suggestedChange']);
|
|
305
|
+
if (!copied.ok)
|
|
306
|
+
return copied;
|
|
307
|
+
const optional = copyOptionalStrings(result, record.value, tool, [
|
|
308
|
+
'skillId',
|
|
309
|
+
'name',
|
|
310
|
+
'baseVersionId',
|
|
311
|
+
'baseVersion',
|
|
312
|
+
'runId',
|
|
313
|
+
'agentId',
|
|
314
|
+
'workflow',
|
|
315
|
+
'phase',
|
|
316
|
+
'providerAdapter',
|
|
317
|
+
'actor',
|
|
318
|
+
]);
|
|
319
|
+
if (!optional.ok)
|
|
320
|
+
return optional;
|
|
321
|
+
if (result.skillId === undefined && result.name === undefined)
|
|
322
|
+
return validationFailure('Either skillId or name is required', tool);
|
|
323
|
+
if (result.baseVersionId !== undefined && result.baseVersion !== undefined)
|
|
324
|
+
return validationFailure('Use either baseVersionId or baseVersion, not both', tool);
|
|
325
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
326
|
+
if (!scope.ok)
|
|
327
|
+
return scope;
|
|
328
|
+
if (scope.value !== undefined)
|
|
329
|
+
result.scope = scope.value;
|
|
330
|
+
const source = readSkillSource(record.value, 'proposedSource', tool);
|
|
331
|
+
if (!source.ok)
|
|
332
|
+
return source;
|
|
333
|
+
result.proposedSource = source.value;
|
|
334
|
+
const compatibility = readOptionalJsonObject(record.value, 'proposedCompatibility', tool);
|
|
335
|
+
if (!compatibility.ok)
|
|
336
|
+
return compatibility;
|
|
337
|
+
if (compatibility.value !== undefined) {
|
|
338
|
+
const proposedCompatibility = compatibility.value;
|
|
339
|
+
if (proposedCompatibility !== undefined)
|
|
340
|
+
result.proposedCompatibility = proposedCompatibility;
|
|
341
|
+
}
|
|
342
|
+
const sourceContext = readOptionalJsonObject(record.value, 'sourceContext', tool);
|
|
343
|
+
if (!sourceContext.ok)
|
|
344
|
+
return sourceContext;
|
|
345
|
+
if (sourceContext.value !== undefined)
|
|
346
|
+
result.sourceContext = sourceContext.value;
|
|
347
|
+
const evidence = readOptionalJsonObject(record.value, 'evidence', tool);
|
|
348
|
+
if (!evidence.ok)
|
|
349
|
+
return evidence;
|
|
350
|
+
if (evidence.value !== undefined)
|
|
351
|
+
result.evidence = evidence.value;
|
|
352
|
+
const evidenceRefs = readOptionalStringArray(record.value, 'evidenceRefs', tool);
|
|
353
|
+
if (!evidenceRefs.ok)
|
|
354
|
+
return evidenceRefs;
|
|
355
|
+
if (evidenceRefs.value !== undefined)
|
|
356
|
+
result.evidenceRefs = evidenceRefs.value;
|
|
357
|
+
return { ok: true, value: result };
|
|
358
|
+
}
|
|
359
|
+
export function validateSkillListImprovementProposalsInput(input, tool) {
|
|
360
|
+
const record = inputRecord(input, tool, ['project', 'scope', 'skillId', 'name', 'baseVersionId', 'status', 'runId', 'agentId', 'limit']);
|
|
361
|
+
if (!record.ok)
|
|
362
|
+
return record;
|
|
363
|
+
const project = readNonEmptyString(record.value, 'project', tool);
|
|
364
|
+
if (!project.ok)
|
|
365
|
+
return project;
|
|
366
|
+
const result = { project: project.value };
|
|
367
|
+
const copied = copyOptionalStrings(result, record.value, tool, ['skillId', 'name', 'baseVersionId', 'runId', 'agentId']);
|
|
368
|
+
if (!copied.ok)
|
|
369
|
+
return copied;
|
|
370
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
371
|
+
if (!scope.ok)
|
|
372
|
+
return scope;
|
|
373
|
+
if (scope.value !== undefined)
|
|
374
|
+
result.scope = scope.value;
|
|
375
|
+
const status = readOptionalOneOf(record.value, 'status', skillImprovementProposalStatuses, tool);
|
|
376
|
+
if (!status.ok)
|
|
377
|
+
return status;
|
|
378
|
+
if (status.value !== undefined)
|
|
379
|
+
result.status = status.value;
|
|
380
|
+
const limit = readOptionalBoundedLimit(record.value, tool);
|
|
381
|
+
if (!limit.ok)
|
|
382
|
+
return limit;
|
|
383
|
+
if (limit.value !== undefined)
|
|
384
|
+
result.limit = limit.value;
|
|
385
|
+
return { ok: true, value: result };
|
|
386
|
+
}
|
|
387
|
+
export function validateSkillRequestEvaluationInput(input, tool) {
|
|
388
|
+
const record = inputRecord(input, tool, [
|
|
389
|
+
'project',
|
|
390
|
+
'scope',
|
|
391
|
+
'skillId',
|
|
392
|
+
'name',
|
|
393
|
+
'versionId',
|
|
394
|
+
'version',
|
|
395
|
+
'scenarioId',
|
|
396
|
+
'proposalId',
|
|
397
|
+
'requestedBy',
|
|
398
|
+
'runId',
|
|
399
|
+
'agentId',
|
|
400
|
+
'workflow',
|
|
401
|
+
'phase',
|
|
402
|
+
'providerAdapter',
|
|
403
|
+
'risk',
|
|
404
|
+
'preflight',
|
|
405
|
+
]);
|
|
406
|
+
if (!record.ok)
|
|
407
|
+
return record;
|
|
408
|
+
const result = {};
|
|
409
|
+
const copied = copyRequiredStrings(result, record.value, tool, ['project', 'requestedBy']);
|
|
410
|
+
if (!copied.ok)
|
|
411
|
+
return copied;
|
|
412
|
+
const optional = copyOptionalStrings(result, record.value, tool, [
|
|
413
|
+
'skillId',
|
|
414
|
+
'name',
|
|
415
|
+
'versionId',
|
|
416
|
+
'version',
|
|
417
|
+
'scenarioId',
|
|
418
|
+
'proposalId',
|
|
419
|
+
'runId',
|
|
420
|
+
'agentId',
|
|
421
|
+
'workflow',
|
|
422
|
+
'phase',
|
|
423
|
+
'providerAdapter',
|
|
424
|
+
]);
|
|
425
|
+
if (!optional.ok)
|
|
426
|
+
return optional;
|
|
427
|
+
if (result.skillId === undefined && result.name === undefined)
|
|
428
|
+
return validationFailure('Either skillId or name is required', tool);
|
|
429
|
+
if (result.versionId !== undefined && result.version !== undefined)
|
|
430
|
+
return validationFailure('Use either versionId or version, not both', tool);
|
|
431
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
432
|
+
if (!scope.ok)
|
|
433
|
+
return scope;
|
|
434
|
+
if (scope.value !== undefined)
|
|
435
|
+
result.scope = scope.value;
|
|
436
|
+
const risk = readOptionalJsonObject(record.value, 'risk', tool);
|
|
437
|
+
if (!risk.ok)
|
|
438
|
+
return risk;
|
|
439
|
+
if (risk.value !== undefined)
|
|
440
|
+
result.risk = risk.value;
|
|
441
|
+
const preflight = readOptionalJsonObject(record.value, 'preflight', tool);
|
|
442
|
+
if (!preflight.ok)
|
|
443
|
+
return preflight;
|
|
444
|
+
if (preflight.value !== undefined)
|
|
445
|
+
result.preflight = preflight.value;
|
|
446
|
+
return { ok: true, value: result };
|
|
447
|
+
}
|
|
448
|
+
export function validateSkillListEvaluationsInput(input, tool) {
|
|
449
|
+
const record = inputRecord(input, tool, [
|
|
450
|
+
'project',
|
|
451
|
+
'scope',
|
|
452
|
+
'skillId',
|
|
453
|
+
'name',
|
|
454
|
+
'versionId',
|
|
455
|
+
'scenarioId',
|
|
456
|
+
'proposalId',
|
|
457
|
+
'status',
|
|
458
|
+
'runId',
|
|
459
|
+
'agentId',
|
|
460
|
+
'limit',
|
|
461
|
+
]);
|
|
462
|
+
if (!record.ok)
|
|
463
|
+
return record;
|
|
464
|
+
const project = readNonEmptyString(record.value, 'project', tool);
|
|
465
|
+
if (!project.ok)
|
|
466
|
+
return project;
|
|
467
|
+
const result = { project: project.value };
|
|
468
|
+
const copied = copyOptionalStrings(result, record.value, tool, ['skillId', 'name', 'versionId', 'scenarioId', 'proposalId', 'runId', 'agentId']);
|
|
469
|
+
if (!copied.ok)
|
|
470
|
+
return copied;
|
|
471
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
472
|
+
if (!scope.ok)
|
|
473
|
+
return scope;
|
|
474
|
+
if (scope.value !== undefined)
|
|
475
|
+
result.scope = scope.value;
|
|
476
|
+
const status = readOptionalOneOf(record.value, 'status', skillEvaluationRequestStatuses, tool);
|
|
477
|
+
if (!status.ok)
|
|
478
|
+
return status;
|
|
479
|
+
if (status.value !== undefined)
|
|
480
|
+
result.status = status.value;
|
|
481
|
+
const limit = readOptionalBoundedLimit(record.value, tool);
|
|
482
|
+
if (!limit.ok)
|
|
483
|
+
return limit;
|
|
484
|
+
if (limit.value !== undefined)
|
|
485
|
+
result.limit = limit.value;
|
|
486
|
+
return { ok: true, value: result };
|
|
487
|
+
}
|
|
488
|
+
export function validateSkillGetEvaluationInput(input, tool) {
|
|
489
|
+
const record = inputRecord(input, tool, ['project', 'scope', 'id']);
|
|
490
|
+
if (!record.ok)
|
|
491
|
+
return record;
|
|
492
|
+
const project = readNonEmptyString(record.value, 'project', tool);
|
|
493
|
+
if (!project.ok)
|
|
494
|
+
return project;
|
|
495
|
+
const id = readNonEmptyString(record.value, 'id', tool);
|
|
496
|
+
if (!id.ok)
|
|
497
|
+
return id;
|
|
498
|
+
const result = { project: project.value, id: id.value };
|
|
499
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
500
|
+
if (!scope.ok)
|
|
501
|
+
return scope;
|
|
502
|
+
if (scope.value !== undefined)
|
|
503
|
+
result.scope = scope.value;
|
|
504
|
+
return { ok: true, value: result };
|
|
505
|
+
}
|
|
506
|
+
export function validateSkillCreateDraftInput(input, tool) {
|
|
507
|
+
const record = inputRecord(input, tool, [
|
|
508
|
+
'project',
|
|
509
|
+
'scope',
|
|
510
|
+
'name',
|
|
511
|
+
'description',
|
|
512
|
+
'version',
|
|
513
|
+
'source',
|
|
514
|
+
'compatibility',
|
|
515
|
+
'draftParentVersionId',
|
|
516
|
+
'actor',
|
|
517
|
+
'reason',
|
|
518
|
+
'runId',
|
|
519
|
+
'agentId',
|
|
520
|
+
'evidence',
|
|
521
|
+
'governance',
|
|
522
|
+
]);
|
|
523
|
+
if (!record.ok)
|
|
524
|
+
return record;
|
|
525
|
+
const result = {};
|
|
526
|
+
const required = copyRequiredStrings(result, record.value, tool, ['project', 'name', 'description', 'version']);
|
|
527
|
+
if (!required.ok)
|
|
528
|
+
return required;
|
|
529
|
+
const optional = copyOptionalStrings(result, record.value, tool, ['draftParentVersionId', 'reason', 'runId', 'agentId']);
|
|
530
|
+
if (!optional.ok)
|
|
531
|
+
return optional;
|
|
532
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
533
|
+
if (!scope.ok)
|
|
534
|
+
return scope;
|
|
535
|
+
if (scope.value !== undefined)
|
|
536
|
+
result.scope = scope.value;
|
|
537
|
+
const source = readSkillSource(record.value, 'source', tool);
|
|
538
|
+
if (!source.ok)
|
|
539
|
+
return source;
|
|
540
|
+
result.source = source.value;
|
|
541
|
+
const actor = readSkillLifecycleActor(record.value, tool);
|
|
542
|
+
if (!actor.ok)
|
|
543
|
+
return actor;
|
|
544
|
+
result.actor = actor.value;
|
|
545
|
+
const compatibility = readOptionalJsonObject(record.value, 'compatibility', tool);
|
|
546
|
+
if (!compatibility.ok)
|
|
547
|
+
return compatibility;
|
|
548
|
+
if (compatibility.value !== undefined)
|
|
549
|
+
result.compatibility = compatibility.value;
|
|
550
|
+
const evidence = readOptionalJsonObject(record.value, 'evidence', tool);
|
|
551
|
+
if (!evidence.ok)
|
|
552
|
+
return evidence;
|
|
553
|
+
if (evidence.value !== undefined)
|
|
554
|
+
result.evidence = evidence.value;
|
|
555
|
+
const governance = readOptionalJsonObject(record.value, 'governance', tool);
|
|
556
|
+
if (!governance.ok)
|
|
557
|
+
return governance;
|
|
558
|
+
if (governance.value !== undefined)
|
|
559
|
+
result.governance = governance.value;
|
|
560
|
+
return { ok: true, value: result };
|
|
561
|
+
}
|
|
562
|
+
export function validateSkillUpdateDraftInput(input, tool) {
|
|
563
|
+
const record = inputRecord(input, tool, [
|
|
564
|
+
'project',
|
|
565
|
+
'scope',
|
|
566
|
+
'skillId',
|
|
567
|
+
'name',
|
|
568
|
+
'versionId',
|
|
569
|
+
'version',
|
|
570
|
+
'source',
|
|
571
|
+
'compatibility',
|
|
572
|
+
'expectedDraftRevision',
|
|
573
|
+
'actor',
|
|
574
|
+
'reason',
|
|
575
|
+
'runId',
|
|
576
|
+
'agentId',
|
|
577
|
+
'evidence',
|
|
578
|
+
'governance',
|
|
579
|
+
]);
|
|
580
|
+
if (!record.ok)
|
|
581
|
+
return record;
|
|
582
|
+
const result = {};
|
|
583
|
+
const required = copyRequiredStrings(result, record.value, tool, ['project']);
|
|
584
|
+
if (!required.ok)
|
|
585
|
+
return required;
|
|
586
|
+
const optional = copyOptionalStrings(result, record.value, tool, ['skillId', 'name', 'versionId', 'version', 'reason', 'runId', 'agentId']);
|
|
587
|
+
if (!optional.ok)
|
|
588
|
+
return optional;
|
|
589
|
+
if (result.skillId === undefined && result.name === undefined)
|
|
590
|
+
return validationFailure('Either skillId or name is required', tool);
|
|
591
|
+
if (result.versionId === undefined && result.version === undefined)
|
|
592
|
+
return validationFailure('Either versionId or version is required', tool);
|
|
593
|
+
if (result.versionId !== undefined && result.version !== undefined)
|
|
594
|
+
return validationFailure('Use either versionId or version, not both', tool);
|
|
595
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
596
|
+
if (!scope.ok)
|
|
597
|
+
return scope;
|
|
598
|
+
if (scope.value !== undefined)
|
|
599
|
+
result.scope = scope.value;
|
|
600
|
+
const actor = readSkillLifecycleActor(record.value, tool);
|
|
601
|
+
if (!actor.ok)
|
|
602
|
+
return actor;
|
|
603
|
+
result.actor = actor.value;
|
|
604
|
+
if (record.value.source !== undefined) {
|
|
605
|
+
const source = readSkillSource(record.value, 'source', tool);
|
|
606
|
+
if (!source.ok)
|
|
607
|
+
return source;
|
|
608
|
+
result.source = source.value;
|
|
609
|
+
}
|
|
610
|
+
const compatibility = readOptionalJsonObject(record.value, 'compatibility', tool);
|
|
611
|
+
if (!compatibility.ok)
|
|
612
|
+
return compatibility;
|
|
613
|
+
if (compatibility.value !== undefined)
|
|
614
|
+
result.compatibility = compatibility.value;
|
|
615
|
+
if (record.value.expectedDraftRevision !== undefined) {
|
|
616
|
+
const revision = record.value.expectedDraftRevision;
|
|
617
|
+
if (typeof revision !== 'number' || !Number.isSafeInteger(revision) || revision < 1)
|
|
618
|
+
return validationFailure('expectedDraftRevision must be a positive safe integer', tool);
|
|
619
|
+
result.expectedDraftRevision = revision;
|
|
620
|
+
}
|
|
621
|
+
const evidence = readOptionalJsonObject(record.value, 'evidence', tool);
|
|
622
|
+
if (!evidence.ok)
|
|
623
|
+
return evidence;
|
|
624
|
+
if (evidence.value !== undefined)
|
|
625
|
+
result.evidence = evidence.value;
|
|
626
|
+
const governance = readOptionalJsonObject(record.value, 'governance', tool);
|
|
627
|
+
if (!governance.ok)
|
|
628
|
+
return governance;
|
|
629
|
+
if (governance.value !== undefined)
|
|
630
|
+
result.governance = governance.value;
|
|
631
|
+
if (result.source === undefined && result.compatibility === undefined && result.governance === undefined)
|
|
632
|
+
return validationFailure('At least one draft update field is required', tool);
|
|
633
|
+
return { ok: true, value: result };
|
|
634
|
+
}
|
|
635
|
+
export function validateSkillPublishVersionInput(input, tool) {
|
|
636
|
+
const record = inputRecord(input, tool, [
|
|
637
|
+
'project',
|
|
638
|
+
'scope',
|
|
639
|
+
'skillId',
|
|
640
|
+
'name',
|
|
641
|
+
'versionId',
|
|
642
|
+
'version',
|
|
643
|
+
'actor',
|
|
644
|
+
'reason',
|
|
645
|
+
'runId',
|
|
646
|
+
'agentId',
|
|
647
|
+
'evidence',
|
|
648
|
+
'governance',
|
|
649
|
+
]);
|
|
650
|
+
if (!record.ok)
|
|
651
|
+
return record;
|
|
652
|
+
const result = {};
|
|
653
|
+
const required = copyRequiredStrings(result, record.value, tool, ['project', 'reason']);
|
|
654
|
+
if (!required.ok)
|
|
655
|
+
return required;
|
|
656
|
+
const optional = copyOptionalStrings(result, record.value, tool, ['skillId', 'name', 'versionId', 'version', 'runId', 'agentId']);
|
|
657
|
+
if (!optional.ok)
|
|
658
|
+
return optional;
|
|
659
|
+
if (result.skillId === undefined && result.name === undefined)
|
|
660
|
+
return validationFailure('Either skillId or name is required', tool);
|
|
661
|
+
if (result.versionId === undefined && result.version === undefined)
|
|
662
|
+
return validationFailure('Either versionId or version is required', tool);
|
|
663
|
+
if (result.versionId !== undefined && result.version !== undefined)
|
|
664
|
+
return validationFailure('Use either versionId or version, not both', tool);
|
|
665
|
+
const scope = readOptionalOneOf(record.value, 'scope', scopes, tool);
|
|
666
|
+
if (!scope.ok)
|
|
667
|
+
return scope;
|
|
668
|
+
if (scope.value !== undefined)
|
|
669
|
+
result.scope = scope.value;
|
|
670
|
+
const actor = readSkillLifecycleActor(record.value, tool);
|
|
671
|
+
if (!actor.ok)
|
|
672
|
+
return actor;
|
|
673
|
+
result.actor = actor.value;
|
|
674
|
+
const evidence = readOptionalJsonObject(record.value, 'evidence', tool);
|
|
675
|
+
if (!evidence.ok)
|
|
676
|
+
return evidence;
|
|
677
|
+
if (evidence.value !== undefined)
|
|
678
|
+
result.evidence = evidence.value;
|
|
679
|
+
const governance = readOptionalJsonObject(record.value, 'governance', tool);
|
|
680
|
+
if (!governance.ok)
|
|
681
|
+
return governance;
|
|
682
|
+
if (governance.value !== undefined)
|
|
683
|
+
result.governance = governance.value;
|
|
684
|
+
return { ok: true, value: result };
|
|
685
|
+
}
|