vgxness 1.20.4 → 1.20.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/claude/agent-renderer.js +82 -0
- package/dist/{mcp → adapters/claude/install}/claude-code-agent-config.js +64 -9
- package/dist/{mcp → adapters/claude/install}/claude-code-config.js +28 -6
- package/dist/{mcp → adapters/claude/install}/claude-code-project-memory.js +35 -5
- package/dist/{mcp → adapters/claude/install}/claude-code-scope.js +12 -3
- package/dist/{mcp → adapters/claude/install}/claude-code-user-config.js +26 -5
- package/dist/{mcp → adapters/claude/install}/claude-code-user-memory.js +47 -7
- package/dist/{mcp → adapters/claude/install}/client-install-claude-code-contract.js +45 -8
- package/dist/{mcp → adapters/claude/install}/client-install-claude-code.js +98 -14
- package/dist/adapters/json/agent-renderer.js +104 -0
- package/dist/adapters/opencode/agent-renderer.js +113 -0
- package/dist/{mcp → adapters/opencode/install}/client-install-opencode-contract.js +2 -2
- package/dist/{mcp → adapters/opencode/install}/client-install-opencode.js +1 -1
- package/dist/{mcp → adapters/opencode/install}/opencode-default-agent-config.js +2 -2
- package/dist/{mcp → adapters/opencode/install}/opencode-handoff-preview.js +60 -7
- package/dist/{mcp → adapters/opencode/install}/opencode-visibility.js +1 -1
- package/dist/adapters/provider-renderer.js +6 -0
- package/dist/agents/agent-activation-service.js +1 -263
- package/dist/agents/agent-lookup-contexts.js +1 -28
- package/dist/agents/agent-registry-service.js +1 -81
- package/dist/agents/agent-resolver.js +1 -287
- package/dist/agents/agent-seed-service.js +1 -157
- package/dist/agents/agent-seed-upgrade-service.js +1 -231
- package/dist/agents/agent-selector-resolver.js +1 -28
- package/dist/agents/boot-upgrade.js +1 -59
- package/dist/agents/canonical-agent-manifest.js +1 -245
- package/dist/agents/canonical-agent-projection.js +1 -236
- package/dist/agents/manager-profile-overlay-service.js +1 -60
- package/dist/agents/profile-model-routing.js +1 -30
- package/dist/agents/renderers/claude-renderer.js +1 -82
- package/dist/agents/renderers/index.js +1 -14
- package/dist/agents/renderers/json-renderer.js +1 -104
- package/dist/agents/renderers/opencode-renderer.js +1 -113
- package/dist/agents/renderers/provider-adapter.js +1 -6
- package/dist/agents/repositories/agent-seed-history.js +1 -128
- package/dist/agents/repositories/agents.js +1 -200
- package/dist/agents/repositories/manager-profile-overlays.js +1 -90
- package/dist/agents/schema.js +1 -1
- package/dist/application/agents/agent-activation-service.js +261 -0
- package/dist/application/agents/agent-lookup-contexts.js +28 -0
- package/dist/application/agents/agent-registry-service.js +81 -0
- package/dist/application/agents/agent-resolver.js +287 -0
- package/dist/application/agents/agent-seed-service.js +157 -0
- package/dist/application/agents/agent-seed-upgrade-service.js +231 -0
- package/dist/application/agents/agent-selector-resolver.js +28 -0
- package/dist/application/agents/boot-upgrade.js +59 -0
- package/dist/application/agents/canonical-agent-projection.js +236 -0
- package/dist/application/agents/manager-profile-overlay-service.js +68 -0
- package/dist/application/agents/profile-model-routing.js +30 -0
- package/dist/application/agents/renderers/claude-renderer.js +1 -0
- package/dist/application/agents/renderers/index.js +14 -0
- package/dist/application/agents/renderers/json-renderer.js +1 -0
- package/dist/application/agents/renderers/opencode-renderer.js +1 -0
- package/dist/application/agents/renderers/provider-adapter.js +1 -0
- package/dist/application/memory/active-work-preview.js +75 -0
- package/dist/application/memory/agent-memory-capture-service.js +498 -0
- package/dist/application/memory/import/dry-run-planner.js +58 -0
- package/dist/application/memory/import/index.js +3 -0
- package/dist/application/memory/import/observation-writer.js +226 -0
- package/dist/application/memory/import/package.js +179 -0
- package/dist/application/memory/memory-service.js +202 -0
- package/dist/application/memory/search.js +11 -0
- package/dist/{mcp → application/provider-setup}/provider-change-plan.js +74 -13
- package/dist/{mcp → application/provider-setup}/provider-doctor.js +201 -31
- package/dist/{mcp → application/provider-setup}/provider-health-types.js +1 -1
- package/dist/{mcp → application/provider-setup}/provider-status.js +170 -33
- package/dist/application/runs/execution-planning.js +180 -0
- package/dist/application/runs/operation-execution.js +1 -0
- package/dist/application/runs/operation-retry.js +129 -0
- package/dist/application/runs/resume-after-approval-result.js +88 -0
- package/dist/application/runs/run-insights.js +270 -0
- package/dist/application/runs/run-service.js +1480 -0
- package/dist/application/runs/run-snapshot-export-service.js +31 -0
- package/dist/application/runs/sandbox-process-execution.js +244 -0
- package/dist/application/runs/sandbox-worktree-planning.js +59 -0
- package/dist/application/runs/task-scoped-command-grant-service.js +224 -0
- package/dist/application/sdd/artifact-portability-service.js +137 -0
- package/dist/application/sdd/cockpit-read-model.js +195 -0
- package/dist/application/sdd/sdd-continuation-plan.js +265 -0
- package/dist/application/sdd/sdd-workflow-service.js +892 -0
- package/dist/application/skills/boot-seed.js +42 -0
- package/dist/application/skills/personal-skills.js +41 -0
- package/dist/application/skills/skill-export-service.js +34 -0
- package/dist/application/skills/skill-index-service.js +126 -0
- package/dist/application/skills/skill-payload.js +186 -0
- package/dist/application/skills/skill-registry-service.js +648 -0
- package/dist/application/skills/skill-resolver.js +368 -0
- package/dist/application/skills/skill-seed-service.js +242 -0
- package/dist/application/skills/skill-status-service.js +147 -0
- package/dist/cli/bun-bin.js +0 -0
- package/dist/cli/cli-flags.js +1 -387
- package/dist/cli/cli-help.js +1 -173
- package/dist/cli/cli-helpers.js +1 -77
- package/dist/cli/cli-types.js +1 -1
- package/dist/cli/commands/agent-skill-dispatcher.js +1 -700
- package/dist/cli/commands/index.js +1 -9
- package/dist/cli/commands/interactive-entrypoint-dispatcher.js +1 -14
- package/dist/cli/commands/mcp-dispatcher.js +1 -232
- package/dist/cli/commands/memory-sdd-dispatcher.js +1 -367
- package/dist/cli/commands/run-permission-dispatcher.js +1 -455
- package/dist/cli/commands/setup-dispatcher.js +1 -496
- package/dist/cli/commands/status-dispatcher.js +1 -130
- package/dist/cli/commands/verification-dispatcher.js +1 -47
- package/dist/cli/commands/workflow-dispatcher.js +1 -566
- package/dist/cli/dispatcher.js +1 -247
- package/dist/cli/doctor-renderer.js +1 -26
- package/dist/cli/home-tui-app.js +1 -411
- package/dist/cli/home-tui-controller.js +1 -314
- package/dist/cli/mcp-start-path.js +1 -21
- package/dist/cli/product-resume-renderer.js +1 -32
- package/dist/cli/product-status-renderer.js +1 -81
- package/dist/cli/sdd-renderer.js +1 -247
- package/dist/cli/setup-plan-renderer.js +1 -79
- package/dist/cli/setup-status-renderer.js +1 -50
- package/dist/cli/setup-tui-app.js +1 -130
- package/dist/cli/setup-tui-controller.js +1 -89
- package/dist/cli/tui/focus-reducer.js +1 -0
- package/dist/cli/tui/focus-types.js +1 -0
- package/dist/cli/tui/ink/app-shell.js +1 -0
- package/dist/cli/tui/ink/components.js +1 -38
- package/dist/cli/tui/ink/help-overlay.js +1 -0
- package/dist/cli/tui/ink/state-components.js +1 -0
- package/dist/cli/tui/ink/theme.js +1 -36
- package/dist/cli/tui/key-intents.js +1 -0
- package/dist/cli/tui/keymap.js +1 -20
- package/dist/cli/tui/navigation.js +1 -10
- package/dist/cli/tui/screen-registry.js +1 -0
- package/dist/cli/tui/terminal-capabilities.js +1 -12
- package/dist/cli/tui/tui-types.js +1 -1
- package/dist/cli/tui/visual/badges.js +1 -19
- package/dist/cli/tui/visual/footer.js +1 -27
- package/dist/cli/tui/visual/index.js +1 -3
- package/dist/cli/tui/visual/viewport.js +1 -11
- package/dist/cli/tui-render-helpers.js +1 -200
- package/dist/cli/verification-plan-renderer.js +1 -25
- package/dist/cli/verification-report-renderer.js +1 -19
- package/dist/domain/agents/canonical-agent-manifest.js +355 -0
- package/dist/domain/agents/schema.js +1 -0
- package/dist/domain/memory/active-work-topics.js +64 -0
- package/dist/domain/memory/memory-capture-schema.js +1 -0
- package/dist/domain/memory/schema.js +1 -0
- package/dist/domain/runs/schema.js +5 -0
- package/dist/domain/sdd/cockpit-types.js +1 -0
- package/dist/domain/sdd/schema.js +111 -0
- package/dist/domain/skills/schema.js +1 -0
- package/dist/governance/risk-classifier.js +2 -0
- package/dist/interfaces/cli/bun-bin.js +46 -0
- package/dist/interfaces/cli/cli-flags.js +391 -0
- package/dist/interfaces/cli/cli-help.js +173 -0
- package/dist/interfaces/cli/cli-helpers.js +77 -0
- package/dist/interfaces/cli/cli-types.js +1 -0
- package/dist/interfaces/cli/commands/agent-skill-dispatcher.js +700 -0
- package/dist/interfaces/cli/commands/index.js +9 -0
- package/dist/interfaces/cli/commands/interactive-entrypoint-dispatcher.js +14 -0
- package/dist/interfaces/cli/commands/mcp-dispatcher.js +252 -0
- package/dist/interfaces/cli/commands/memory-sdd-dispatcher.js +367 -0
- package/dist/interfaces/cli/commands/run-permission-dispatcher.js +460 -0
- package/dist/interfaces/cli/commands/setup-dispatcher.js +496 -0
- package/dist/interfaces/cli/commands/status-dispatcher.js +130 -0
- package/dist/interfaces/cli/commands/verification-dispatcher.js +47 -0
- package/dist/interfaces/cli/commands/workflow-dispatcher.js +566 -0
- package/dist/interfaces/cli/dispatcher.js +247 -0
- package/dist/interfaces/cli/doctor-renderer.js +26 -0
- package/dist/interfaces/cli/home-tui-app.js +462 -0
- package/dist/interfaces/cli/home-tui-controller.js +341 -0
- package/dist/interfaces/cli/index.js +27 -0
- package/dist/interfaces/cli/mcp-start-path.js +21 -0
- package/dist/interfaces/cli/product-resume-renderer.js +32 -0
- package/dist/interfaces/cli/product-status-renderer.js +81 -0
- package/dist/interfaces/cli/sdd-renderer.js +247 -0
- package/dist/interfaces/cli/setup-plan-renderer.js +79 -0
- package/dist/interfaces/cli/setup-status-renderer.js +50 -0
- package/dist/interfaces/cli/setup-tui-app.js +135 -0
- package/dist/interfaces/cli/setup-tui-controller.js +89 -0
- package/dist/interfaces/cli/tui/focus-reducer.js +60 -0
- package/dist/interfaces/cli/tui/focus-types.js +10 -0
- package/dist/interfaces/cli/tui/ink/app-shell.js +16 -0
- package/dist/interfaces/cli/tui/ink/components.js +38 -0
- package/dist/interfaces/cli/tui/ink/help-overlay.js +6 -0
- package/dist/interfaces/cli/tui/ink/state-components.js +22 -0
- package/dist/interfaces/cli/tui/ink/theme.js +36 -0
- package/dist/interfaces/cli/tui/key-intents.js +33 -0
- package/dist/interfaces/cli/tui/keymap.js +20 -0
- package/dist/interfaces/cli/tui/navigation.js +10 -0
- package/dist/interfaces/cli/tui/screen-registry.js +43 -0
- package/dist/interfaces/cli/tui/terminal-capabilities.js +12 -0
- package/dist/interfaces/cli/tui/tui-types.js +1 -0
- package/dist/interfaces/cli/tui/visual/badges.js +19 -0
- package/dist/interfaces/cli/tui/visual/footer.js +27 -0
- package/dist/interfaces/cli/tui/visual/index.js +3 -0
- package/dist/interfaces/cli/tui/visual/viewport.js +11 -0
- package/dist/interfaces/cli/tui-render-helpers.js +200 -0
- package/dist/interfaces/cli/verification-plan-renderer.js +25 -0
- package/dist/interfaces/cli/verification-report-renderer.js +19 -0
- package/dist/interfaces/mcp/contracts/agents.js +1 -0
- package/dist/interfaces/mcp/contracts/context.js +1 -0
- package/dist/interfaces/mcp/contracts/governance.js +1 -0
- package/dist/interfaces/mcp/contracts/index.js +1 -0
- package/dist/interfaces/mcp/contracts/memory.js +1 -0
- package/dist/interfaces/mcp/contracts/providers.js +1 -0
- package/dist/interfaces/mcp/contracts/runs.js +1 -0
- package/dist/interfaces/mcp/contracts/sdd.js +1 -0
- package/dist/interfaces/mcp/contracts/sessions.js +1 -0
- package/dist/interfaces/mcp/contracts/skills.js +1 -0
- package/dist/interfaces/mcp/contracts/verification.js +1 -0
- package/dist/interfaces/mcp/control-plane/handlers/agents.js +38 -0
- package/dist/interfaces/mcp/control-plane/handlers/context.js +12 -0
- package/dist/interfaces/mcp/control-plane/handlers/memory.js +95 -0
- package/dist/interfaces/mcp/control-plane/handlers/providers.js +19 -0
- package/dist/interfaces/mcp/control-plane/handlers/runs.js +134 -0
- package/dist/interfaces/mcp/control-plane/handlers/sdd.js +225 -0
- package/dist/interfaces/mcp/control-plane/handlers/sessions.js +39 -0
- package/dist/interfaces/mcp/control-plane/handlers/skills.js +82 -0
- package/dist/interfaces/mcp/control-plane/handlers/verification.js +11 -0
- package/dist/interfaces/mcp/control-plane/types.js +1 -0
- package/dist/interfaces/mcp/control-plane.js +235 -0
- package/dist/interfaces/mcp/schema.js +174 -0
- package/dist/interfaces/mcp/schemas/common.js +121 -0
- package/dist/interfaces/mcp/schemas/inputs/agents.js +69 -0
- package/dist/interfaces/mcp/schemas/inputs/context.js +32 -0
- package/dist/interfaces/mcp/schemas/inputs/governance.js +23 -0
- package/dist/interfaces/mcp/schemas/inputs/index.js +10 -0
- package/dist/interfaces/mcp/schemas/inputs/memory.js +50 -0
- package/dist/interfaces/mcp/schemas/inputs/providers.js +35 -0
- package/dist/interfaces/mcp/schemas/inputs/runs.js +146 -0
- package/dist/interfaces/mcp/schemas/inputs/sdd.js +102 -0
- package/dist/interfaces/mcp/schemas/inputs/sessions.js +32 -0
- package/dist/interfaces/mcp/schemas/inputs/skills.js +231 -0
- package/dist/interfaces/mcp/schemas/inputs/verification.js +9 -0
- package/dist/interfaces/mcp/schemas/outputs/index.js +2 -0
- package/dist/interfaces/mcp/schemas/outputs/providers.js +28 -0
- package/dist/interfaces/mcp/schemas/outputs/sdd.js +166 -0
- package/dist/interfaces/mcp/stdio-server.js +116 -0
- package/dist/interfaces/mcp/validation/agents.js +189 -0
- package/dist/interfaces/mcp/validation/common.js +415 -0
- package/dist/interfaces/mcp/validation/governance.js +50 -0
- package/dist/interfaces/mcp/validation/memory.js +133 -0
- package/dist/interfaces/mcp/validation/providers.js +94 -0
- package/dist/interfaces/mcp/validation/runs.js +514 -0
- package/dist/interfaces/mcp/validation/sdd.js +247 -0
- package/dist/interfaces/mcp/validation/sessions.js +51 -0
- package/dist/interfaces/mcp/validation/skills.js +685 -0
- package/dist/interfaces/mcp/validation/verification.js +24 -0
- package/dist/interfaces/mcp/validation.js +149 -0
- package/dist/mcp/control-plane-snapshot-service.js +65 -2
- package/dist/mcp/control-plane.js +1 -646
- package/dist/mcp/doctor.js +1 -1
- package/dist/mcp/index.js +17 -17
- package/dist/mcp/schema.js +1 -1072
- package/dist/mcp/stdio-server.js +1 -116
- package/dist/mcp/validation.js +1 -2239
- package/dist/memory/active-work-preview.js +1 -75
- package/dist/memory/active-work-topics.js +1 -64
- package/dist/memory/agent-memory-capture-service.js +1 -497
- package/dist/memory/import/dry-run-planner.js +1 -58
- package/dist/memory/import/index.js +1 -3
- package/dist/memory/import/observation-writer.js +1 -226
- package/dist/memory/import/package.js +1 -179
- package/dist/memory/memory-capture-schema.js +1 -1
- package/dist/memory/memory-service.js +1 -201
- package/dist/memory/repositories/artifacts.js +1 -67
- package/dist/memory/repositories/observations.js +1 -217
- package/dist/memory/repositories/sessions.js +1 -125
- package/dist/memory/repositories/traces.js +1 -78
- package/dist/memory/schema.js +1 -1
- package/dist/memory/search.js +1 -11
- package/dist/memory/sqlite/database.js +1 -228
- package/dist/memory/storage-paths.js +1 -72
- package/dist/payload/context-budget-policy.js +10 -0
- package/dist/payload/context-budget-service.js +26 -0
- package/dist/payload/payload-diagnostics.js +50 -0
- package/dist/permissions/explicit-request-authorization.js +126 -0
- package/dist/permissions/policy-evaluator.js +54 -14
- package/dist/runs/execution-planning.js +1 -178
- package/dist/runs/operation-execution.js +1 -1
- package/dist/runs/operation-retry.js +1 -129
- package/dist/runs/repositories/runs.js +1 -676
- package/dist/runs/repositories/task-scoped-command-grants.js +1 -462
- package/dist/runs/resume-after-approval-result.js +1 -84
- package/dist/runs/run-insights.js +1 -270
- package/dist/runs/run-service.js +1 -1439
- package/dist/runs/run-snapshot-export-service.js +1 -31
- package/dist/runs/sandbox-process-execution.js +1 -240
- package/dist/runs/sandbox-worktree-planning.js +1 -59
- package/dist/runs/schema.js +1 -5
- package/dist/runs/task-scoped-command-grant-service.js +1 -216
- package/dist/sdd/artifact-portability-service.js +1 -137
- package/dist/sdd/cockpit-read-model.js +1 -195
- package/dist/sdd/cockpit-types.js +1 -1
- package/dist/sdd/schema.js +1 -111
- package/dist/sdd/sdd-continuation-plan.js +1 -265
- package/dist/sdd/sdd-workflow-service.js +1 -822
- package/dist/setup/providers/claude-setup-adapter.js +11 -4
- package/dist/setup/providers/opencode-setup-adapter.js +10 -7
- package/dist/setup/setup-plan.js +20 -7
- package/dist/skills/boot-seed.js +1 -42
- package/dist/skills/personal-skills.js +1 -41
- package/dist/skills/repositories/skill-evaluation-requests.js +1 -190
- package/dist/skills/repositories/skill-evaluation-scenarios.js +1 -305
- package/dist/skills/repositories/skill-improvement-proposals.js +1 -355
- package/dist/skills/repositories/skills.js +1 -1077
- package/dist/skills/schema.js +1 -1
- package/dist/skills/skill-export-service.js +1 -34
- package/dist/skills/skill-index-service.js +1 -126
- package/dist/skills/skill-payload.js +1 -186
- package/dist/skills/skill-registry-service.js +1 -644
- package/dist/skills/skill-resolver.js +1 -368
- package/dist/skills/skill-seed-service.js +1 -242
- package/dist/skills/skill-status-service.js +1 -147
- package/dist/storage/agents/repositories/agent-seed-history.js +128 -0
- package/dist/storage/agents/repositories/agents.js +200 -0
- package/dist/storage/agents/repositories/manager-profile-overlays.js +90 -0
- package/dist/storage/memory/repositories/artifacts.js +67 -0
- package/dist/storage/memory/repositories/observations.js +217 -0
- package/dist/storage/memory/repositories/sessions.js +125 -0
- package/dist/storage/memory/repositories/traces.js +78 -0
- package/dist/storage/memory/sqlite/database.js +228 -0
- package/dist/storage/memory/storage-paths.js +72 -0
- package/dist/storage/runs/repositories/runs.js +676 -0
- package/dist/storage/runs/repositories/task-scoped-command-grants.js +464 -0
- package/dist/storage/skills/repositories/skill-evaluation-requests.js +190 -0
- package/dist/storage/skills/repositories/skill-evaluation-scenarios.js +305 -0
- package/dist/storage/skills/repositories/skill-improvement-proposals.js +355 -0
- package/dist/storage/skills/repositories/skills.js +1084 -0
- package/docs/architecture.md +2 -2
- package/docs/glossary.md +1 -1
- package/docs/mcp.md +1 -1
- package/docs/module-boundaries.md +114 -0
- package/docs/prd.md +1 -1
- package/docs/project-health-audit-v1.10.x.md +1 -1
- package/docs/providers.md +2 -2
- package/docs/safety.md +3 -3
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/apply-progress.md +122 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/archive-report.md +61 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/design.md +66 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/proposal.md +79 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/spec.md +67 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/tasks.md +63 -0
- package/docs/sdd/archive/2026-06-26-ambitious-structure-reorganization/verify-report.md +71 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/apply-progress.md +68 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/archive-report.md +61 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/design.md +43 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/proposal.md +61 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/spec.md +31 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/tasks.md +27 -0
- package/docs/sdd/archive/2026-06-26-legacy-facade-cleanup/verify-report.md +58 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/apply-progress.md +65 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/archive-report.md +53 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/design.md +64 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/proposal.md +62 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/spec.md +51 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/tasks.md +50 -0
- package/docs/sdd/archive/2026-06-26-provider-install-adapter-boundary/verify-report.md +66 -0
- package/docs/storage.md +2 -2
- package/package.json +2 -2
- /package/dist/{mcp → adapters/claude/install}/claude-code-cli.js +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/001_initial.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/002_observation_revisions.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/003_agent_registry.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/004_run_runtime.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/005_run_approvals.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/006_run_operation_attempts.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/007_abandoned_operation_attempts.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/008_run_execution_plan_events.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/009_multiple_operation_attempts.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/010_skill_registry.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/011_skill_usage_resolution_outcomes.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/012_skill_improvement_proposals.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/013_skill_evaluation_scenarios.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/014_manager_profile_overlays.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/015_artifact_metadata.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/016_agent_seed_history.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/017_intent_signal_skill_targets.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/018_skill_system_v2.sql +0 -0
- /package/dist/{memory → storage/memory}/sqlite/migrations/019_task_scoped_command_grants.sql +0 -0
|
@@ -1,644 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { SkillEvaluationRequestRepository, } from './repositories/skill-evaluation-requests.js';
|
|
3
|
-
import { SkillEvaluationScenarioRepository, } from './repositories/skill-evaluation-scenarios.js';
|
|
4
|
-
import { SkillImprovementProposalRepository, } from './repositories/skill-improvement-proposals.js';
|
|
5
|
-
import { SkillRepository, } from './repositories/skills.js';
|
|
6
|
-
import { buildSkillInjectionPayload } from './skill-payload.js';
|
|
7
|
-
import { SkillResolver } from './skill-resolver.js';
|
|
8
|
-
export class SkillRegistryService {
|
|
9
|
-
database;
|
|
10
|
-
skills;
|
|
11
|
-
proposals;
|
|
12
|
-
evaluationScenarios;
|
|
13
|
-
evaluationRequests;
|
|
14
|
-
constructor(database) {
|
|
15
|
-
this.database = database;
|
|
16
|
-
this.skills = new SkillRepository(database);
|
|
17
|
-
this.proposals = new SkillImprovementProposalRepository(database);
|
|
18
|
-
this.evaluationScenarios = new SkillEvaluationScenarioRepository(database);
|
|
19
|
-
this.evaluationRequests = new SkillEvaluationRequestRepository(database);
|
|
20
|
-
}
|
|
21
|
-
registerSkill(input) {
|
|
22
|
-
return this.skills.register(input);
|
|
23
|
-
}
|
|
24
|
-
addSkillVersion(input) {
|
|
25
|
-
return this.skills.addVersion(input);
|
|
26
|
-
}
|
|
27
|
-
attachSkill(input) {
|
|
28
|
-
return this.skills.attach(input);
|
|
29
|
-
}
|
|
30
|
-
detachSkill(skillId, targetType, targetKey) {
|
|
31
|
-
return this.skills.detach(skillId, targetType, targetKey);
|
|
32
|
-
}
|
|
33
|
-
recordSkillUsage(input) {
|
|
34
|
-
return this.skills.recordUsage(input);
|
|
35
|
-
}
|
|
36
|
-
createSkillDraft(input) {
|
|
37
|
-
const created = this.skills.createDraft(input);
|
|
38
|
-
if (!created.ok)
|
|
39
|
-
return created;
|
|
40
|
-
return ok({
|
|
41
|
-
kind: 'skill-draft-created',
|
|
42
|
-
version: 1,
|
|
43
|
-
project: input.project,
|
|
44
|
-
scope: input.scope ?? 'project',
|
|
45
|
-
skill: created.value.skill,
|
|
46
|
-
draft: created.value.version,
|
|
47
|
-
event: created.value.event,
|
|
48
|
-
safety: lifecycleSafety(false),
|
|
49
|
-
warnings: ['Draft creation does not publish, activate, approve, or human-accept a skill version.'],
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
updateSkillDraft(input) {
|
|
53
|
-
const updated = this.skills.updateDraft(input);
|
|
54
|
-
if (!updated.ok)
|
|
55
|
-
return updated;
|
|
56
|
-
return ok({
|
|
57
|
-
kind: 'skill-draft-updated',
|
|
58
|
-
version: 1,
|
|
59
|
-
project: input.project,
|
|
60
|
-
scope: input.scope ?? 'project',
|
|
61
|
-
skill: updated.value.skill,
|
|
62
|
-
draft: updated.value.version,
|
|
63
|
-
event: updated.value.event,
|
|
64
|
-
safety: lifecycleSafety(false),
|
|
65
|
-
warnings: ['Draft updates are limited to draft versions and do not mutate active, deprecated, or archived versions.'],
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
publishSkillVersion(input) {
|
|
69
|
-
if (!input.reason.trim())
|
|
70
|
-
return validationFailure('Publish reason is required');
|
|
71
|
-
const published = this.skills.publishVersion(input);
|
|
72
|
-
if (!published.ok)
|
|
73
|
-
return published;
|
|
74
|
-
return ok({
|
|
75
|
-
kind: 'skill-version-published',
|
|
76
|
-
version: 1,
|
|
77
|
-
project: input.project,
|
|
78
|
-
scope: input.scope ?? 'project',
|
|
79
|
-
skill: published.value.skill,
|
|
80
|
-
published: published.value.version,
|
|
81
|
-
previousCurrentVersionId: published.value.previousCurrentVersionId,
|
|
82
|
-
event: published.value.event,
|
|
83
|
-
safety: lifecycleSafety(true),
|
|
84
|
-
warnings: ['Publication updates the current active version; it is not skill activation, SDD artifact acceptance, or correctness proof.'],
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
activateSkill(input) {
|
|
88
|
-
const scope = input.scope ?? 'project';
|
|
89
|
-
if ((input.skillId === undefined || input.skillId.trim().length === 0) && (input.name === undefined || input.name.trim().length === 0)) {
|
|
90
|
-
return validationFailure('Either skill id or name is required');
|
|
91
|
-
}
|
|
92
|
-
const skill = input.skillId !== undefined ? this.skills.getById(input.skillId) : this.skills.getByName(input.project, scope, input.name ?? '');
|
|
93
|
-
if (!skill.ok)
|
|
94
|
-
return skill;
|
|
95
|
-
if (skill.value.project !== input.project || skill.value.scope !== scope)
|
|
96
|
-
return validationFailure('Skill does not belong to the requested project/scope');
|
|
97
|
-
const version = this.activationVersion(skill.value.id, input);
|
|
98
|
-
if (!version.ok)
|
|
99
|
-
return version;
|
|
100
|
-
if (version.value.status !== 'active')
|
|
101
|
-
return validationFailure(`Skill ${skill.value.name} version ${version.value.version} is ${version.value.status}, not active`);
|
|
102
|
-
const summary = stringMetadata(version.value.source.inlineMetadata?.summary);
|
|
103
|
-
const content = stringMetadata(version.value.source.inlineMetadata?.content);
|
|
104
|
-
const resolvedSkill = {
|
|
105
|
-
skillId: skill.value.id,
|
|
106
|
-
name: skill.value.name,
|
|
107
|
-
description: skill.value.description,
|
|
108
|
-
versionId: version.value.id,
|
|
109
|
-
version: version.value.version,
|
|
110
|
-
source: version.value.source,
|
|
111
|
-
sourceMetadata: version.value.source.inlineMetadata ?? {},
|
|
112
|
-
attachmentSources: [{ kind: 'attachment', targetType: 'intent-signal', targetKey: 'manual-skill-activation', reason: input.reason ?? 'skill activation requested' }],
|
|
113
|
-
};
|
|
114
|
-
if (summary !== undefined)
|
|
115
|
-
resolvedSkill.summary = summary;
|
|
116
|
-
if (content !== undefined)
|
|
117
|
-
resolvedSkill.content = content;
|
|
118
|
-
const resolution = {
|
|
119
|
-
context: {
|
|
120
|
-
project: input.project,
|
|
121
|
-
scope,
|
|
122
|
-
...(input.agentId === undefined ? {} : { agentId: input.agentId }),
|
|
123
|
-
...(input.workflow === undefined ? {} : { workflow: input.workflow }),
|
|
124
|
-
...(input.phase === undefined ? {} : { phase: input.phase }),
|
|
125
|
-
...(input.providerAdapter === undefined ? {} : { providerAdapter: input.providerAdapter }),
|
|
126
|
-
...(input.runId === undefined ? {} : { runId: input.runId }),
|
|
127
|
-
...(input.intent?.signals !== undefined && Array.isArray(input.intent.signals) ? { intentSignals: input.intent.signals.filter((value) => typeof value === 'string') } : {}),
|
|
128
|
-
},
|
|
129
|
-
skills: [resolvedSkill],
|
|
130
|
-
skipped: [],
|
|
131
|
-
skillDiagnostics: {
|
|
132
|
-
provider: input.providerAdapter ?? 'unknown',
|
|
133
|
-
providerState: input.providerAdapter === 'opencode' ? 'preview-only' : 'unknown',
|
|
134
|
-
summary: { declared: 1, resolved: 1, skipped: 0, warnings: input.providerAdapter === 'opencode' ? 2 : 0, errors: 0 },
|
|
135
|
-
skills: [
|
|
136
|
-
{
|
|
137
|
-
name: skill.value.name,
|
|
138
|
-
registryState: 'active',
|
|
139
|
-
activeVersion: version.value.version,
|
|
140
|
-
payloadState: 'preview-only',
|
|
141
|
-
providerState: input.providerAdapter === 'opencode' ? 'preview-only' : 'unknown',
|
|
142
|
-
included: true,
|
|
143
|
-
reason: null,
|
|
144
|
-
attachments: { declared: 1, resolved: 1, missing: 0 },
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
diagnostics: input.providerAdapter === 'opencode'
|
|
148
|
-
? [
|
|
149
|
-
{
|
|
150
|
-
code: 'SKILL_PROVIDER_PREVIEW_ONLY',
|
|
151
|
-
severity: 'info',
|
|
152
|
-
message: 'Skill activation payload is preview/context-only for OpenCode and does not install or native-load skills.',
|
|
153
|
-
details: { provider: 'opencode', providerState: 'preview-only' },
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
code: 'SKILL_PROVIDER_NATIVE_UNSUPPORTED',
|
|
157
|
-
severity: 'info',
|
|
158
|
-
message: 'OpenCode native skill loading is not implemented by VGXNESS for this activation payload.',
|
|
159
|
-
details: { provider: 'opencode', providerState: 'preview-only', installsNativeSkills: false, mutatesProviderConfig: false },
|
|
160
|
-
},
|
|
161
|
-
]
|
|
162
|
-
: [],
|
|
163
|
-
},
|
|
164
|
-
warnings: ['Skill activation is an audit and payload preparation event only; it is not approval, publication, or proof of correctness.'],
|
|
165
|
-
usageRecorded: 0,
|
|
166
|
-
};
|
|
167
|
-
const payload = buildSkillInjectionPayload(resolution, {
|
|
168
|
-
...(input.workspaceRoot === undefined ? {} : { workspaceRoot: input.workspaceRoot }),
|
|
169
|
-
...(input.maxSourceBytes === undefined ? {} : { maxSourceBytes: input.maxSourceBytes }),
|
|
170
|
-
...(input.mode === undefined ? {} : { mode: input.mode }),
|
|
171
|
-
});
|
|
172
|
-
if (!payload.ok)
|
|
173
|
-
return payload;
|
|
174
|
-
const recordInput = {
|
|
175
|
-
project: input.project,
|
|
176
|
-
scope,
|
|
177
|
-
skillId: skill.value.id,
|
|
178
|
-
versionId: version.value.id,
|
|
179
|
-
...(input.runId === undefined ? {} : { runId: input.runId }),
|
|
180
|
-
...(input.agentId === undefined ? {} : { agentId: input.agentId }),
|
|
181
|
-
...(input.workflow === undefined ? {} : { workflow: input.workflow }),
|
|
182
|
-
...(input.phase === undefined ? {} : { phase: input.phase }),
|
|
183
|
-
...(input.providerAdapter === undefined ? {} : { providerAdapter: input.providerAdapter }),
|
|
184
|
-
...(input.intent === undefined ? {} : { intent: input.intent }),
|
|
185
|
-
...(input.reason === undefined ? {} : { reason: input.reason }),
|
|
186
|
-
payloadMetadata: { itemCount: payload.value.items.length, mode: input.mode ?? 'compact', providerAgnostic: true },
|
|
187
|
-
};
|
|
188
|
-
const activation = this.skills.recordActivation(recordInput);
|
|
189
|
-
if (!activation.ok)
|
|
190
|
-
return activation;
|
|
191
|
-
return ok({
|
|
192
|
-
kind: 'skill-activation',
|
|
193
|
-
version: 1,
|
|
194
|
-
project: input.project,
|
|
195
|
-
scope,
|
|
196
|
-
activation: activation.value,
|
|
197
|
-
skill: { id: skill.value.id, name: skill.value.name, description: skill.value.description, versionId: version.value.id, version: version.value.version },
|
|
198
|
-
payload: payload.value,
|
|
199
|
-
safety: {
|
|
200
|
-
providerConfigWrites: false,
|
|
201
|
-
opencodeWrites: false,
|
|
202
|
-
nativeSkillFileWrites: false,
|
|
203
|
-
providerExecution: false,
|
|
204
|
-
approval: false,
|
|
205
|
-
publication: false,
|
|
206
|
-
correctnessProof: false,
|
|
207
|
-
},
|
|
208
|
-
warnings: ['Skill activation is not approval, publication, or proof of correctness.', ...payload.value.warnings],
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
getSkill(input) {
|
|
212
|
-
if (typeof input === 'string')
|
|
213
|
-
return this.skills.getById(input);
|
|
214
|
-
const scope = input.scope ?? 'project';
|
|
215
|
-
if ((input.id === undefined || input.id.trim().length === 0) && (input.name === undefined || input.name.trim().length === 0)) {
|
|
216
|
-
return validationFailure('Either skill id or name is required');
|
|
217
|
-
}
|
|
218
|
-
const base = input.id !== undefined ? this.skills.getById(input.id) : this.skills.getByName(input.project, scope, input.name ?? '');
|
|
219
|
-
if (!base.ok)
|
|
220
|
-
return base;
|
|
221
|
-
if (base.value.project !== input.project || base.value.scope !== scope)
|
|
222
|
-
return validationFailure('Skill does not belong to the requested project/scope');
|
|
223
|
-
const details = this.skills.getDetails(base.value.id);
|
|
224
|
-
if (!details.ok)
|
|
225
|
-
return details;
|
|
226
|
-
return ok({
|
|
227
|
-
kind: 'skill-get',
|
|
228
|
-
version: 1,
|
|
229
|
-
project: input.project,
|
|
230
|
-
scope,
|
|
231
|
-
skill: {
|
|
232
|
-
id: details.value.id,
|
|
233
|
-
project: details.value.project,
|
|
234
|
-
scope: details.value.scope,
|
|
235
|
-
name: details.value.name,
|
|
236
|
-
description: details.value.description,
|
|
237
|
-
currentVersionId: details.value.currentVersionId ?? null,
|
|
238
|
-
createdAt: details.value.createdAt,
|
|
239
|
-
updatedAt: details.value.updatedAt,
|
|
240
|
-
currentVersion: details.value.currentVersion ?? null,
|
|
241
|
-
versions: details.value.versions,
|
|
242
|
-
attachments: details.value.attachments,
|
|
243
|
-
usage: input.includeUsage === true ? details.value.usage.slice(0, 25) : [],
|
|
244
|
-
},
|
|
245
|
-
diagnostics: [],
|
|
246
|
-
safety: readOnlySafety(),
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
getSkillByName(project, scope, name) {
|
|
250
|
-
return this.skills.getByName(project, scope, name);
|
|
251
|
-
}
|
|
252
|
-
getSkillDetails(id) {
|
|
253
|
-
return this.skills.getDetails(id);
|
|
254
|
-
}
|
|
255
|
-
listSkills(filters = {}) {
|
|
256
|
-
return this.skills.list(filters);
|
|
257
|
-
}
|
|
258
|
-
searchSkills(input) {
|
|
259
|
-
const scope = input.scope ?? 'project';
|
|
260
|
-
const limit = normalizeLimit(input.limit);
|
|
261
|
-
const searchInput = { project: input.project, scope, limit };
|
|
262
|
-
if (input.query !== undefined)
|
|
263
|
-
searchInput.query = input.query;
|
|
264
|
-
if (input.status !== undefined)
|
|
265
|
-
searchInput.status = input.status;
|
|
266
|
-
if (input.sourceKind !== undefined)
|
|
267
|
-
searchInput.sourceKind = input.sourceKind;
|
|
268
|
-
const skills = this.skills.search(searchInput);
|
|
269
|
-
if (!skills.ok)
|
|
270
|
-
return skills;
|
|
271
|
-
const matched = this.skills.countSearchMatches(searchInput);
|
|
272
|
-
if (!matched.ok)
|
|
273
|
-
return matched;
|
|
274
|
-
return ok({
|
|
275
|
-
kind: 'skills-search',
|
|
276
|
-
version: 1,
|
|
277
|
-
project: input.project,
|
|
278
|
-
scope,
|
|
279
|
-
filters: {
|
|
280
|
-
query: input.query?.trim() || null,
|
|
281
|
-
status: input.status ?? null,
|
|
282
|
-
sourceKind: input.sourceKind ?? null,
|
|
283
|
-
limit,
|
|
284
|
-
},
|
|
285
|
-
totals: { matched: matched.value, returned: skills.value.length },
|
|
286
|
-
skills: skills.value,
|
|
287
|
-
diagnostics: [],
|
|
288
|
-
safety: readOnlySafety(),
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
listSkillVersions(skillId) {
|
|
292
|
-
return this.skills.listVersions(skillId);
|
|
293
|
-
}
|
|
294
|
-
resolveSkills(input) {
|
|
295
|
-
return new SkillResolver(this.skills, new AgentRepository(this.database)).resolve(input);
|
|
296
|
-
}
|
|
297
|
-
createSkillImprovementProposal(input) {
|
|
298
|
-
return this.proposals.create(input);
|
|
299
|
-
}
|
|
300
|
-
proposeSkillImprovement(input) {
|
|
301
|
-
const scope = input.scope ?? 'project';
|
|
302
|
-
if ((input.skillId === undefined || input.skillId.trim().length === 0) && (input.name === undefined || input.name.trim().length === 0)) {
|
|
303
|
-
return validationFailure('Either skillId or name is required');
|
|
304
|
-
}
|
|
305
|
-
if (input.baseVersionId !== undefined && input.baseVersion !== undefined)
|
|
306
|
-
return validationFailure('Use either baseVersionId or baseVersion, not both');
|
|
307
|
-
if (!input.title.trim())
|
|
308
|
-
return validationFailure('Proposal title is required');
|
|
309
|
-
if (!input.problem.trim())
|
|
310
|
-
return validationFailure('Proposal problem statement is required');
|
|
311
|
-
if (!input.suggestedChange.trim())
|
|
312
|
-
return validationFailure('Proposal suggested change is required');
|
|
313
|
-
const skill = input.skillId !== undefined ? this.skills.getById(input.skillId) : this.skills.getByName(input.project, scope, input.name ?? '');
|
|
314
|
-
if (!skill.ok)
|
|
315
|
-
return skill;
|
|
316
|
-
if (skill.value.project !== input.project || skill.value.scope !== scope)
|
|
317
|
-
return validationFailure('Skill does not belong to the requested project/scope');
|
|
318
|
-
const baseVersion = resolveProposalBaseVersion(this.skills, skill.value.id, input.baseVersionId, input.baseVersion);
|
|
319
|
-
if (!baseVersion.ok)
|
|
320
|
-
return baseVersion;
|
|
321
|
-
const sourceSignal = {
|
|
322
|
-
...(input.sourceContext ?? {}),
|
|
323
|
-
...(input.workflow === undefined ? {} : { workflow: input.workflow }),
|
|
324
|
-
...(input.phase === undefined ? {} : { phase: input.phase }),
|
|
325
|
-
...(input.providerAdapter === undefined ? {} : { providerAdapter: input.providerAdapter }),
|
|
326
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
327
|
-
};
|
|
328
|
-
const evidence = input.evidenceRefs === undefined ? (input.evidence ?? {}) : { ...(input.evidence ?? {}), refs: input.evidenceRefs };
|
|
329
|
-
const proposal = this.proposals.create({
|
|
330
|
-
skillId: skill.value.id,
|
|
331
|
-
baseVersionId: baseVersion.value.id,
|
|
332
|
-
proposedVersion: input.proposedVersion,
|
|
333
|
-
proposedSource: input.proposedSource,
|
|
334
|
-
...(input.proposedCompatibility === undefined ? {} : { proposedCompatibility: input.proposedCompatibility }),
|
|
335
|
-
rationale: `${input.problem.trim()}\n\nSuggested change: ${input.suggestedChange.trim()}`,
|
|
336
|
-
sourceSignal,
|
|
337
|
-
title: input.title.trim(),
|
|
338
|
-
problem: input.problem.trim(),
|
|
339
|
-
suggestedChange: input.suggestedChange.trim(),
|
|
340
|
-
...(input.runId === undefined ? {} : { sourceRunId: input.runId }),
|
|
341
|
-
...(input.agentId === undefined ? {} : { sourceAgentId: input.agentId }),
|
|
342
|
-
evidence,
|
|
343
|
-
});
|
|
344
|
-
if (!proposal.ok)
|
|
345
|
-
return proposal;
|
|
346
|
-
return ok({
|
|
347
|
-
kind: 'skill-improvement-proposal',
|
|
348
|
-
version: 1,
|
|
349
|
-
project: input.project,
|
|
350
|
-
scope,
|
|
351
|
-
skill: { id: skill.value.id, name: skill.value.name, versionId: baseVersion.value.id, version: baseVersion.value.version },
|
|
352
|
-
proposal: proposal.value,
|
|
353
|
-
safety: proposalSafety(),
|
|
354
|
-
warnings: ['Improvement proposal creation is non-destructive and does not mutate active or published skill content.'],
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
listSkillImprovementProposals(input = {}) {
|
|
358
|
-
if (isSkillListImprovementProposalsInput(input)) {
|
|
359
|
-
const scope = input.scope ?? 'project';
|
|
360
|
-
const limit = normalizeLimit(input.limit);
|
|
361
|
-
let skillId = input.skillId;
|
|
362
|
-
if (skillId === undefined && input.name !== undefined) {
|
|
363
|
-
const skill = this.skills.getByName(input.project, scope, input.name);
|
|
364
|
-
if (!skill.ok)
|
|
365
|
-
return skill;
|
|
366
|
-
skillId = skill.value.id;
|
|
367
|
-
}
|
|
368
|
-
const proposals = this.proposals.list({
|
|
369
|
-
project: input.project,
|
|
370
|
-
scope,
|
|
371
|
-
...(skillId === undefined ? {} : { skillId }),
|
|
372
|
-
...(input.baseVersionId === undefined ? {} : { baseVersionId: input.baseVersionId }),
|
|
373
|
-
...(input.status === undefined ? {} : { status: input.status }),
|
|
374
|
-
...(input.runId === undefined ? {} : { runId: input.runId }),
|
|
375
|
-
...(input.agentId === undefined ? {} : { agentId: input.agentId }),
|
|
376
|
-
limit,
|
|
377
|
-
});
|
|
378
|
-
if (!proposals.ok)
|
|
379
|
-
return proposals;
|
|
380
|
-
return ok({
|
|
381
|
-
kind: 'skill-improvement-proposals-list',
|
|
382
|
-
version: 1,
|
|
383
|
-
project: input.project,
|
|
384
|
-
scope,
|
|
385
|
-
filters: {
|
|
386
|
-
skillId: skillId ?? null,
|
|
387
|
-
name: input.name ?? null,
|
|
388
|
-
baseVersionId: input.baseVersionId ?? null,
|
|
389
|
-
status: input.status ?? null,
|
|
390
|
-
runId: input.runId ?? null,
|
|
391
|
-
agentId: input.agentId ?? null,
|
|
392
|
-
limit,
|
|
393
|
-
},
|
|
394
|
-
totals: { returned: proposals.value.length, bounded: true },
|
|
395
|
-
proposals: proposals.value,
|
|
396
|
-
safety: { ...proposalSafety(), readOnly: true },
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
return this.proposals.list(input);
|
|
400
|
-
}
|
|
401
|
-
getSkillImprovementProposal(id) {
|
|
402
|
-
return this.proposals.getById(id);
|
|
403
|
-
}
|
|
404
|
-
submitSkillImprovementProposal(input) {
|
|
405
|
-
return this.proposals.submitForApproval(input);
|
|
406
|
-
}
|
|
407
|
-
approveSkillImprovementProposal(input) {
|
|
408
|
-
return this.proposals.approve(input);
|
|
409
|
-
}
|
|
410
|
-
rejectSkillImprovementProposal(input) {
|
|
411
|
-
return this.proposals.reject(input);
|
|
412
|
-
}
|
|
413
|
-
cancelSkillImprovementProposal(input) {
|
|
414
|
-
return this.proposals.cancel(input);
|
|
415
|
-
}
|
|
416
|
-
applySkillImprovementProposal(input) {
|
|
417
|
-
return this.proposals.apply(input);
|
|
418
|
-
}
|
|
419
|
-
createSkillEvaluationScenario(input) {
|
|
420
|
-
return this.evaluationScenarios.createScenario(input);
|
|
421
|
-
}
|
|
422
|
-
listSkillEvaluationScenarios(filters) {
|
|
423
|
-
return this.evaluationScenarios.listScenarios(filters);
|
|
424
|
-
}
|
|
425
|
-
recordSkillEvaluationResult(input) {
|
|
426
|
-
return this.evaluationScenarios.recordResult(input);
|
|
427
|
-
}
|
|
428
|
-
listSkillEvaluationResults(filters = {}) {
|
|
429
|
-
return this.evaluationScenarios.listResults(filters);
|
|
430
|
-
}
|
|
431
|
-
createSkillEvaluationRequest(input) {
|
|
432
|
-
return this.evaluationRequests.create(input);
|
|
433
|
-
}
|
|
434
|
-
requestSkillEvaluation(input) {
|
|
435
|
-
const scope = input.scope ?? 'project';
|
|
436
|
-
if ((input.skillId === undefined || input.skillId.trim().length === 0) && (input.name === undefined || input.name.trim().length === 0)) {
|
|
437
|
-
return validationFailure('Either skillId or name is required');
|
|
438
|
-
}
|
|
439
|
-
if (input.versionId !== undefined && input.version !== undefined)
|
|
440
|
-
return validationFailure('Use either versionId or version, not both');
|
|
441
|
-
const skill = input.skillId !== undefined ? this.skills.getById(input.skillId) : this.skills.getByName(input.project, scope, input.name ?? '');
|
|
442
|
-
if (!skill.ok)
|
|
443
|
-
return skill;
|
|
444
|
-
if (skill.value.project !== input.project || skill.value.scope !== scope)
|
|
445
|
-
return validationFailure('Skill does not belong to the requested project/scope');
|
|
446
|
-
let versionId = input.versionId;
|
|
447
|
-
if (versionId === undefined && input.version !== undefined) {
|
|
448
|
-
const version = this.skills.getVersionBySkillVersion(skill.value.id, input.version);
|
|
449
|
-
if (!version.ok)
|
|
450
|
-
return version;
|
|
451
|
-
versionId = version.value.id;
|
|
452
|
-
}
|
|
453
|
-
const request = this.evaluationRequests.create({
|
|
454
|
-
project: input.project,
|
|
455
|
-
scope,
|
|
456
|
-
skillId: skill.value.id,
|
|
457
|
-
requestedBy: input.requestedBy,
|
|
458
|
-
...(versionId === undefined ? {} : { versionId }),
|
|
459
|
-
...(input.scenarioId === undefined ? {} : { scenarioId: input.scenarioId }),
|
|
460
|
-
...(input.proposalId === undefined ? {} : { proposalId: input.proposalId }),
|
|
461
|
-
...(input.runId === undefined ? {} : { runId: input.runId }),
|
|
462
|
-
...(input.agentId === undefined ? {} : { agentId: input.agentId }),
|
|
463
|
-
...(input.workflow === undefined ? {} : { workflow: input.workflow }),
|
|
464
|
-
...(input.phase === undefined ? {} : { phase: input.phase }),
|
|
465
|
-
...(input.providerAdapter === undefined ? {} : { providerAdapter: input.providerAdapter }),
|
|
466
|
-
...(input.risk === undefined ? {} : { risk: input.risk }),
|
|
467
|
-
...(input.preflight === undefined ? {} : { preflight: input.preflight }),
|
|
468
|
-
});
|
|
469
|
-
if (!request.ok)
|
|
470
|
-
return request;
|
|
471
|
-
return ok({
|
|
472
|
-
kind: 'skill-evaluation-request',
|
|
473
|
-
version: 1,
|
|
474
|
-
project: input.project,
|
|
475
|
-
scope,
|
|
476
|
-
request: request.value,
|
|
477
|
-
safety: evaluationRequestSafety(),
|
|
478
|
-
warnings: ['Skill evaluation request creation only queues a request; it does not execute an evaluator or provider.'],
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
listSkillEvaluationRequests(filters) {
|
|
482
|
-
return this.evaluationRequests.list(filters);
|
|
483
|
-
}
|
|
484
|
-
listSkillEvaluations(input) {
|
|
485
|
-
const scope = input.scope ?? 'project';
|
|
486
|
-
const limit = normalizeLimit(input.limit);
|
|
487
|
-
let skillId = input.skillId;
|
|
488
|
-
if (skillId === undefined && input.name !== undefined) {
|
|
489
|
-
const skill = this.skills.getByName(input.project, scope, input.name);
|
|
490
|
-
if (!skill.ok)
|
|
491
|
-
return skill;
|
|
492
|
-
skillId = skill.value.id;
|
|
493
|
-
}
|
|
494
|
-
const requests = this.evaluationRequests.list({
|
|
495
|
-
project: input.project,
|
|
496
|
-
scope,
|
|
497
|
-
...(skillId === undefined ? {} : { skillId }),
|
|
498
|
-
...(input.versionId === undefined ? {} : { versionId: input.versionId }),
|
|
499
|
-
...(input.scenarioId === undefined ? {} : { scenarioId: input.scenarioId }),
|
|
500
|
-
...(input.proposalId === undefined ? {} : { proposalId: input.proposalId }),
|
|
501
|
-
...(input.status === undefined ? {} : { status: input.status }),
|
|
502
|
-
...(input.runId === undefined ? {} : { runId: input.runId }),
|
|
503
|
-
...(input.agentId === undefined ? {} : { agentId: input.agentId }),
|
|
504
|
-
limit,
|
|
505
|
-
});
|
|
506
|
-
if (!requests.ok)
|
|
507
|
-
return requests;
|
|
508
|
-
return ok({
|
|
509
|
-
kind: 'skill-evaluations-list',
|
|
510
|
-
version: 1,
|
|
511
|
-
project: input.project,
|
|
512
|
-
scope,
|
|
513
|
-
filters: {
|
|
514
|
-
skillId: skillId ?? null,
|
|
515
|
-
name: input.name ?? null,
|
|
516
|
-
versionId: input.versionId ?? null,
|
|
517
|
-
scenarioId: input.scenarioId ?? null,
|
|
518
|
-
proposalId: input.proposalId ?? null,
|
|
519
|
-
status: input.status ?? null,
|
|
520
|
-
runId: input.runId ?? null,
|
|
521
|
-
agentId: input.agentId ?? null,
|
|
522
|
-
limit,
|
|
523
|
-
},
|
|
524
|
-
totals: { returned: requests.value.length, bounded: true },
|
|
525
|
-
requests: requests.value,
|
|
526
|
-
safety: { ...evaluationRequestSafety(), readOnly: true },
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
getSkillEvaluationRequest(input) {
|
|
530
|
-
if (typeof input === 'string')
|
|
531
|
-
return this.evaluationRequests.getById(input);
|
|
532
|
-
const scope = input.scope ?? 'project';
|
|
533
|
-
const request = this.evaluationRequests.getById(input.id);
|
|
534
|
-
if (!request.ok)
|
|
535
|
-
return request;
|
|
536
|
-
if (request.value.project !== input.project || request.value.scope !== scope)
|
|
537
|
-
return validationFailure('Skill evaluation request does not belong to the requested project/scope');
|
|
538
|
-
return request;
|
|
539
|
-
}
|
|
540
|
-
buildSkillPayload(input, options = {}) {
|
|
541
|
-
const resolution = this.resolveSkills(input);
|
|
542
|
-
return resolution.ok ? buildSkillInjectionPayload(resolution.value, options) : resolution;
|
|
543
|
-
}
|
|
544
|
-
activationVersion(skillId, input) {
|
|
545
|
-
if (input.versionId !== undefined) {
|
|
546
|
-
const version = this.skills.getVersion(input.versionId);
|
|
547
|
-
if (!version.ok)
|
|
548
|
-
return version;
|
|
549
|
-
if (version.value.skillId !== skillId)
|
|
550
|
-
return validationFailure('Skill version must belong to the activated skill');
|
|
551
|
-
return version;
|
|
552
|
-
}
|
|
553
|
-
if (input.version !== undefined)
|
|
554
|
-
return this.skills.getVersionBySkillVersion(skillId, input.version);
|
|
555
|
-
const details = this.skills.getDetails(skillId);
|
|
556
|
-
if (!details.ok)
|
|
557
|
-
return details;
|
|
558
|
-
if (details.value.currentVersion === undefined)
|
|
559
|
-
return validationFailure(`Skill ${details.value.name} has no current version`);
|
|
560
|
-
return ok(details.value.currentVersion);
|
|
561
|
-
}
|
|
562
|
-
close() {
|
|
563
|
-
this.database.close();
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
function isSkillListImprovementProposalsInput(input) {
|
|
567
|
-
return typeof input.project === 'string';
|
|
568
|
-
}
|
|
569
|
-
function readOnlySafety() {
|
|
570
|
-
return {
|
|
571
|
-
readOnly: true,
|
|
572
|
-
providerConfigWrites: false,
|
|
573
|
-
opencodeWrites: false,
|
|
574
|
-
nativeSkillFileWrites: false,
|
|
575
|
-
urlFetches: false,
|
|
576
|
-
usageRecords: false,
|
|
577
|
-
providerExecution: false,
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
function proposalSafety() {
|
|
581
|
-
return {
|
|
582
|
-
providerConfigWrites: false,
|
|
583
|
-
opencodeWrites: false,
|
|
584
|
-
nativeSkillFileWrites: false,
|
|
585
|
-
activeSkillContentMutation: false,
|
|
586
|
-
providerExecution: false,
|
|
587
|
-
};
|
|
588
|
-
}
|
|
589
|
-
function evaluationRequestSafety() {
|
|
590
|
-
return {
|
|
591
|
-
providerConfigWrites: false,
|
|
592
|
-
opencodeWrites: false,
|
|
593
|
-
nativeSkillFileWrites: false,
|
|
594
|
-
providerExecution: false,
|
|
595
|
-
evaluatorExecution: false,
|
|
596
|
-
runStarted: false,
|
|
597
|
-
};
|
|
598
|
-
}
|
|
599
|
-
function lifecycleSafety(activeVersionUpdated) {
|
|
600
|
-
return {
|
|
601
|
-
providerConfigWrites: false,
|
|
602
|
-
opencodeWrites: false,
|
|
603
|
-
nativeSkillFileWrites: false,
|
|
604
|
-
providerExecution: false,
|
|
605
|
-
activation: false,
|
|
606
|
-
approval: false,
|
|
607
|
-
humanAcceptance: false,
|
|
608
|
-
activeVersionUpdated,
|
|
609
|
-
};
|
|
610
|
-
}
|
|
611
|
-
function resolveProposalBaseVersion(skills, skillId, baseVersionId, baseVersion) {
|
|
612
|
-
if (baseVersionId !== undefined) {
|
|
613
|
-
const version = skills.getVersion(baseVersionId);
|
|
614
|
-
if (!version.ok)
|
|
615
|
-
return version;
|
|
616
|
-
if (version.value.skillId !== skillId)
|
|
617
|
-
return validationFailure('Base version must belong to the proposed skill');
|
|
618
|
-
return version;
|
|
619
|
-
}
|
|
620
|
-
if (baseVersion !== undefined)
|
|
621
|
-
return skills.getVersionBySkillVersion(skillId, baseVersion);
|
|
622
|
-
const details = skills.getDetails(skillId);
|
|
623
|
-
if (!details.ok)
|
|
624
|
-
return details;
|
|
625
|
-
if (details.value.currentVersion === undefined)
|
|
626
|
-
return validationFailure(`Skill ${details.value.name} has no current version`);
|
|
627
|
-
return ok(details.value.currentVersion);
|
|
628
|
-
}
|
|
629
|
-
function normalizeLimit(limit) {
|
|
630
|
-
if (limit === undefined)
|
|
631
|
-
return 25;
|
|
632
|
-
if (!Number.isSafeInteger(limit) || limit < 1)
|
|
633
|
-
return 25;
|
|
634
|
-
return Math.min(limit, 100);
|
|
635
|
-
}
|
|
636
|
-
function stringMetadata(value) {
|
|
637
|
-
return typeof value === 'string' && value.trim().length > 0 ? value : undefined;
|
|
638
|
-
}
|
|
639
|
-
function ok(value) {
|
|
640
|
-
return { ok: true, value };
|
|
641
|
-
}
|
|
642
|
-
function validationFailure(message) {
|
|
643
|
-
return { ok: false, error: { code: 'validation_failed', message } };
|
|
644
|
-
}
|
|
1
|
+
export * from '../application/skills/skill-registry-service.js';
|