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,137 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { isSddPhase, sddTopicKey } from './schema.js';
|
|
3
|
-
export const artifactPackageKind = 'vgxness.sdd-artifact-package';
|
|
4
|
-
const defaultContext = { actor: 'artifact-portability-service' };
|
|
5
|
-
const validChangePattern = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
6
|
-
export class ArtifactPortabilityService {
|
|
7
|
-
memory;
|
|
8
|
-
workflow;
|
|
9
|
-
context;
|
|
10
|
-
constructor(memory, workflow, context = defaultContext) {
|
|
11
|
-
this.memory = memory;
|
|
12
|
-
this.workflow = workflow;
|
|
13
|
-
this.context = context;
|
|
14
|
-
}
|
|
15
|
-
exportPackage(input) {
|
|
16
|
-
const validIdentity = validateIdentity(input.project, input.change);
|
|
17
|
-
if (!validIdentity.ok)
|
|
18
|
-
return validIdentity;
|
|
19
|
-
const listed = this.memory.listArtifactsByTopicPrefix(input.project, `sdd/${input.change}/`, this.context);
|
|
20
|
-
if (!listed.ok)
|
|
21
|
-
return listed;
|
|
22
|
-
const artifacts = listed.value.filter(isCanonicalArtifact).map(toPortableArtifact);
|
|
23
|
-
if (artifacts.length === 0)
|
|
24
|
-
return failure(`No SDD artifacts found for ${input.project}/${input.change}`);
|
|
25
|
-
const artifactPackage = {
|
|
26
|
-
kind: artifactPackageKind,
|
|
27
|
-
version: 1,
|
|
28
|
-
project: input.project,
|
|
29
|
-
change: input.change,
|
|
30
|
-
exportedAt: new Date().toISOString(),
|
|
31
|
-
artifacts,
|
|
32
|
-
};
|
|
33
|
-
return { ok: true, value: redactJsonValue(artifactPackage) };
|
|
34
|
-
}
|
|
35
|
-
validatePackage(input) {
|
|
36
|
-
if (!isRecord(input))
|
|
37
|
-
return failure('Package must be a JSON object');
|
|
38
|
-
if (input.kind !== artifactPackageKind)
|
|
39
|
-
return failure('Package kind is invalid');
|
|
40
|
-
if (input.version !== 1)
|
|
41
|
-
return failure('Package version is invalid');
|
|
42
|
-
if (typeof input.project !== 'string' || input.project.trim().length === 0)
|
|
43
|
-
return failure('Package project is required');
|
|
44
|
-
if (typeof input.change !== 'string' || !validChangePattern.test(input.change))
|
|
45
|
-
return failure('Package change is invalid');
|
|
46
|
-
if (typeof input.exportedAt !== 'string' || input.exportedAt.trim().length === 0)
|
|
47
|
-
return failure('Package exportedAt is required');
|
|
48
|
-
if (!Array.isArray(input.artifacts) || input.artifacts.length === 0)
|
|
49
|
-
return failure('Package artifacts must not be empty');
|
|
50
|
-
const artifacts = [];
|
|
51
|
-
for (const item of input.artifacts) {
|
|
52
|
-
if (!isRecord(item))
|
|
53
|
-
return failure('Artifact entry must be an object');
|
|
54
|
-
if (typeof item.phase !== 'string' || !isSddPhase(item.phase))
|
|
55
|
-
return failure('Artifact phase is invalid');
|
|
56
|
-
if (item.topicKey !== sddTopicKey(input.change, item.phase))
|
|
57
|
-
return failure(`Artifact topicKey must be ${sddTopicKey(input.change, item.phase)}`);
|
|
58
|
-
if (typeof item.content !== 'string' || item.content.trim().length === 0)
|
|
59
|
-
return failure('Artifact content must not be empty');
|
|
60
|
-
artifacts.push({
|
|
61
|
-
phase: item.phase,
|
|
62
|
-
topicKey: item.topicKey,
|
|
63
|
-
content: item.content,
|
|
64
|
-
...(typeof item.updatedAt === 'string' ? { updatedAt: item.updatedAt } : {}),
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
ok: true,
|
|
69
|
-
value: { kind: artifactPackageKind, version: 1, project: input.project, change: input.change, exportedAt: input.exportedAt, artifacts },
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
planImport(input) {
|
|
73
|
-
const validated = this.validateImport(input);
|
|
74
|
-
if (!validated.ok)
|
|
75
|
-
return validated;
|
|
76
|
-
const plan = { toCreate: [], toOverwrite: [], skipped: [], errors: [] };
|
|
77
|
-
for (const artifact of validated.value.artifacts) {
|
|
78
|
-
const existing = this.memory.getArtifact(input.project, artifact.topicKey, this.context);
|
|
79
|
-
if (existing.ok && input.overwrite === true)
|
|
80
|
-
plan.toOverwrite.push(artifact.topicKey);
|
|
81
|
-
else if (existing.ok) {
|
|
82
|
-
plan.skipped.push(artifact.topicKey);
|
|
83
|
-
plan.errors.push(`Artifact already exists: ${artifact.topicKey}`);
|
|
84
|
-
}
|
|
85
|
-
else
|
|
86
|
-
plan.toCreate.push(artifact.topicKey);
|
|
87
|
-
}
|
|
88
|
-
return { ok: true, value: plan };
|
|
89
|
-
}
|
|
90
|
-
importPackage(input) {
|
|
91
|
-
const plan = this.planImport(input);
|
|
92
|
-
if (!plan.ok)
|
|
93
|
-
return plan;
|
|
94
|
-
if (plan.value.errors.length > 0)
|
|
95
|
-
return failure(plan.value.errors.join('; '));
|
|
96
|
-
const validated = this.validateImport(input);
|
|
97
|
-
if (!validated.ok)
|
|
98
|
-
return validated;
|
|
99
|
-
for (const artifact of validated.value.artifacts) {
|
|
100
|
-
const saved = this.workflow.saveArtifact({ project: input.project, change: input.change, phase: artifact.phase, content: artifact.content });
|
|
101
|
-
if (!saved.ok)
|
|
102
|
-
return saved;
|
|
103
|
-
}
|
|
104
|
-
return plan;
|
|
105
|
-
}
|
|
106
|
-
validateImport(input) {
|
|
107
|
-
const identity = validateIdentity(input.project, input.change);
|
|
108
|
-
if (!identity.ok)
|
|
109
|
-
return identity;
|
|
110
|
-
const parsed = this.validatePackage(input.package);
|
|
111
|
-
if (!parsed.ok)
|
|
112
|
-
return parsed;
|
|
113
|
-
if (parsed.value.project !== input.project || parsed.value.change !== input.change)
|
|
114
|
-
return failure('Package identity does not match import target');
|
|
115
|
-
return parsed;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
function isCanonicalArtifact(artifact) {
|
|
119
|
-
const phase = artifact.topicKey.split('/').at(-1);
|
|
120
|
-
return phase !== undefined && isSddPhase(phase) && artifact.topicKey === sddTopicKey(artifact.topicKey.split('/')[1] ?? '', phase);
|
|
121
|
-
}
|
|
122
|
-
function toPortableArtifact(artifact) {
|
|
123
|
-
return { phase: artifact.phase, topicKey: artifact.topicKey, content: artifact.content, updatedAt: artifact.updatedAt };
|
|
124
|
-
}
|
|
125
|
-
function validateIdentity(project, change) {
|
|
126
|
-
if (project.trim().length === 0)
|
|
127
|
-
return failure('Project must not be empty');
|
|
128
|
-
if (!validChangePattern.test(change))
|
|
129
|
-
return failure(`Invalid SDD change id: ${change}`);
|
|
130
|
-
return { ok: true, value: { project, change } };
|
|
131
|
-
}
|
|
132
|
-
function isRecord(value) {
|
|
133
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
134
|
-
}
|
|
135
|
-
function failure(message) {
|
|
136
|
-
return { ok: false, error: { code: 'validation_failed', message } };
|
|
137
|
-
}
|
|
1
|
+
export * from '../application/sdd/artifact-portability-service.js';
|
|
@@ -1,195 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export class SddCockpitReadModelService {
|
|
3
|
-
workflow;
|
|
4
|
-
constructor(workflow) {
|
|
5
|
-
this.workflow = workflow;
|
|
6
|
-
}
|
|
7
|
-
getReadModel(input) {
|
|
8
|
-
const cockpit = this.workflow.getCockpit(input);
|
|
9
|
-
if (!cockpit.ok)
|
|
10
|
-
return cockpit;
|
|
11
|
-
return { ok: true, value: buildSddCockpitReadModel(cockpit.value) };
|
|
12
|
-
}
|
|
13
|
-
getSurfaceResponse(input) {
|
|
14
|
-
const cockpit = this.workflow.getCockpit(input);
|
|
15
|
-
if (!cockpit.ok)
|
|
16
|
-
return cockpit;
|
|
17
|
-
return { ok: true, value: buildSddCockpitSurfaceResponse(cockpit.value) };
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export function buildSddCockpitSurfaceResponse(cockpit, options = {}) {
|
|
21
|
-
return { ...cockpit, readModel: buildSddCockpitReadModel(cockpit, options) };
|
|
22
|
-
}
|
|
23
|
-
export function buildSddCockpitReadModel(cockpit, options = {}) {
|
|
24
|
-
const phases = cockpit.phases.map((phase) => toPhaseReadModel(phase, options.operationalEvidenceByPhase?.[phase.phase]));
|
|
25
|
-
const blockers = toReadBlockers(cockpit);
|
|
26
|
-
const nextAction = chooseNextAction(cockpit, phases);
|
|
27
|
-
return {
|
|
28
|
-
project: cockpit.project,
|
|
29
|
-
change: cockpit.change,
|
|
30
|
-
phases,
|
|
31
|
-
nextAction,
|
|
32
|
-
blockers,
|
|
33
|
-
...(cockpit.gates === undefined ? {} : { gates: cockpit.gates }),
|
|
34
|
-
guidance: guidanceFor(cockpit, nextAction, blockers),
|
|
35
|
-
summary: summarize(phases),
|
|
36
|
-
contentIncluded: false,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function toPhaseReadModel(phase, operationalEvidence) {
|
|
40
|
-
const status = artifactReadStatus(phase);
|
|
41
|
-
const contentAvailable = phase.present && phase.artifact !== undefined;
|
|
42
|
-
const reasons = phase.blockers.map((blocker) => blocker.action ?? blocker.reason);
|
|
43
|
-
const canAccept = phase.present && !phase.accepted && status === 'draft';
|
|
44
|
-
const canReview = contentAvailable && status === 'draft';
|
|
45
|
-
return {
|
|
46
|
-
phase: phase.phase,
|
|
47
|
-
label: phaseLabel(phase.phase),
|
|
48
|
-
topicKey: phase.topicKey,
|
|
49
|
-
artifact: {
|
|
50
|
-
exists: phase.present,
|
|
51
|
-
status,
|
|
52
|
-
contentAvailable,
|
|
53
|
-
topicKey: phase.topicKey,
|
|
54
|
-
...(phase.artifact?.artifactId === undefined ? {} : { artifactId: phase.artifact.artifactId }),
|
|
55
|
-
...(phase.artifact?.createdAt === undefined ? {} : { createdAt: phase.artifact.createdAt }),
|
|
56
|
-
...(phase.artifact?.updatedAt === undefined ? {} : { updatedAt: phase.artifact.updatedAt }),
|
|
57
|
-
},
|
|
58
|
-
acceptance: {
|
|
59
|
-
accepted: phase.accepted,
|
|
60
|
-
acceptedByHuman: phase.artifact?.acceptance?.actor.type === 'human',
|
|
61
|
-
...(phase.artifact?.acceptance === undefined ? {} : { acceptance: phase.artifact.acceptance }),
|
|
62
|
-
requiredForNextPhase: isRequiredForLaterPhase(phase.phase),
|
|
63
|
-
},
|
|
64
|
-
actionability: {
|
|
65
|
-
canGenerate: !phase.present && phase.readiness.ready,
|
|
66
|
-
canReview,
|
|
67
|
-
canAccept,
|
|
68
|
-
canReopen: phase.present && status === 'rejected',
|
|
69
|
-
blocked: !phase.readiness.ready || phase.blockers.length > 0,
|
|
70
|
-
reasons,
|
|
71
|
-
},
|
|
72
|
-
...(phase.gates === undefined ? {} : { gates: phase.gates }),
|
|
73
|
-
...(operationalEvidence === undefined ? {} : { operationalEvidence }),
|
|
74
|
-
guidance: guidanceForPhase(phase, status, canAccept),
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
function artifactReadStatus(phase) {
|
|
78
|
-
if (!phase.present)
|
|
79
|
-
return 'missing';
|
|
80
|
-
if (phase.legacy)
|
|
81
|
-
return 'legacy';
|
|
82
|
-
const state = phase.state;
|
|
83
|
-
if (state === 'draft' || state === 'accepted' || state === 'rejected' || state === 'superseded' || state === 'missing')
|
|
84
|
-
return state;
|
|
85
|
-
return 'unknown';
|
|
86
|
-
}
|
|
87
|
-
function chooseNextAction(cockpit, phases) {
|
|
88
|
-
const reviewable = phases.find((phase) => phase.actionability.canReview);
|
|
89
|
-
if (reviewable !== undefined) {
|
|
90
|
-
return {
|
|
91
|
-
kind: 'review-artifact',
|
|
92
|
-
phase: reviewable.phase,
|
|
93
|
-
label: `Review ${reviewable.phase} artifact and accept it only after explicit human approval.`,
|
|
94
|
-
requiresConfirmation: false,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
const generatable = phases.find((phase) => phase.actionability.canGenerate);
|
|
98
|
-
if (generatable !== undefined) {
|
|
99
|
-
return {
|
|
100
|
-
kind: 'generate-artifact',
|
|
101
|
-
phase: generatable.phase,
|
|
102
|
-
label: `Generate or create the ${generatable.phase} SDD artifact.`,
|
|
103
|
-
requiresConfirmation: false,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
if (cockpit.next.status === 'complete') {
|
|
107
|
-
return { kind: 'none', label: 'All SDD phases are human-accepted.', requiresConfirmation: false };
|
|
108
|
-
}
|
|
109
|
-
if (cockpit.next.nextPhase !== undefined) {
|
|
110
|
-
const nextPhase = phases.find((phase) => phase.phase === cockpit.next.nextPhase);
|
|
111
|
-
return {
|
|
112
|
-
kind: 'continue-workflow',
|
|
113
|
-
phase: cockpit.next.nextPhase,
|
|
114
|
-
label: safeRecommendedAction(cockpit.recommendedAction, nextPhase),
|
|
115
|
-
requiresConfirmation: false,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
return { kind: 'none', label: cockpit.recommendedAction, requiresConfirmation: false };
|
|
119
|
-
}
|
|
120
|
-
function safeRecommendedAction(recommendedAction, phase) {
|
|
121
|
-
if (phase === undefined)
|
|
122
|
-
return recommendedAction;
|
|
123
|
-
if (!/accept/i.test(recommendedAction))
|
|
124
|
-
return recommendedAction;
|
|
125
|
-
if (phase.artifact.status === 'draft')
|
|
126
|
-
return recommendedAction;
|
|
127
|
-
if (phase.artifact.status === 'rejected')
|
|
128
|
-
return `Reopen the ${phase.phase} artifact before further review.`;
|
|
129
|
-
if (phase.artifact.status === 'superseded')
|
|
130
|
-
return `Generate or inspect the current canonical ${phase.phase} artifact; superseded metadata is not actionable.`;
|
|
131
|
-
if (phase.artifact.status === 'legacy')
|
|
132
|
-
return `Inspect legacy ${phase.phase} metadata before using it in the current SDD flow.`;
|
|
133
|
-
return recommendedAction;
|
|
134
|
-
}
|
|
135
|
-
function toReadBlockers(cockpit) {
|
|
136
|
-
return cockpit.aggregateBlockers.map((blocker) => ({
|
|
137
|
-
phase: blocker.phase,
|
|
138
|
-
topicKey: blocker.topicKey,
|
|
139
|
-
code: blocker.kind,
|
|
140
|
-
message: blocker.reason,
|
|
141
|
-
severity: blocker.kind === 'missing-topic-key' ? 'info' : 'blocking',
|
|
142
|
-
...(blocker.action === undefined ? {} : { action: blocker.action }),
|
|
143
|
-
...(blocker.artifactId === undefined ? {} : { artifactId: blocker.artifactId }),
|
|
144
|
-
}));
|
|
145
|
-
}
|
|
146
|
-
function summarize(phases) {
|
|
147
|
-
return {
|
|
148
|
-
totalPhases: phases.length,
|
|
149
|
-
presentArtifacts: phases.filter((phase) => phase.artifact.exists).length,
|
|
150
|
-
acceptedArtifacts: phases.filter((phase) => phase.acceptance.accepted).length,
|
|
151
|
-
missingArtifacts: phases.filter((phase) => phase.artifact.status === 'missing').length,
|
|
152
|
-
draftArtifacts: phases.filter((phase) => phase.artifact.status === 'draft').length,
|
|
153
|
-
rejectedArtifacts: phases.filter((phase) => phase.artifact.status === 'rejected').length,
|
|
154
|
-
supersededArtifacts: phases.filter((phase) => phase.artifact.status === 'superseded').length,
|
|
155
|
-
legacyArtifacts: phases.filter((phase) => phase.artifact.status === 'legacy').length,
|
|
156
|
-
isComplete: phases.length === sddPhases.length && phases.every((phase) => phase.acceptance.accepted),
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function guidanceFor(cockpit, nextAction, blockers) {
|
|
160
|
-
const phaseStatusByName = new Map(cockpit.phases.map((phase) => [phase.phase, artifactReadStatus(phase)]));
|
|
161
|
-
const guidance = [nextAction.label];
|
|
162
|
-
if (cockpit.phases.some((phase) => artifactReadStatus(phase) === 'draft' && !phase.accepted)) {
|
|
163
|
-
guidance.push('Artifact presence alone does not count as acceptance; explicit human acceptance is required for drafts.');
|
|
164
|
-
}
|
|
165
|
-
if (cockpit.next.blockerGuidance !== undefined) {
|
|
166
|
-
guidance.push(...cockpit.next.blockerGuidance
|
|
167
|
-
.filter((blocker) => phaseStatusByName.get(blocker.phase) === 'draft' || !/accept/i.test(blocker.action))
|
|
168
|
-
.map((blocker) => blocker.action));
|
|
169
|
-
}
|
|
170
|
-
return [...new Set(guidance)];
|
|
171
|
-
}
|
|
172
|
-
function guidanceForPhase(phase, status, canAccept) {
|
|
173
|
-
if (status === 'missing')
|
|
174
|
-
return [`Create the ${phase.phase} artifact when prerequisites are ready.`];
|
|
175
|
-
if (canAccept)
|
|
176
|
-
return [`Review ${phase.topicKey}; accept only after explicit human approval.`];
|
|
177
|
-
if (status === 'accepted')
|
|
178
|
-
return ['Accepted artifact metadata is available; full content is omitted from this read model.'];
|
|
179
|
-
if (status === 'rejected')
|
|
180
|
-
return ['Rejected artifact metadata is available; reopen it before further review.'];
|
|
181
|
-
if (status === 'superseded')
|
|
182
|
-
return ['Superseded artifact metadata is available; generate or inspect the current canonical artifact instead.'];
|
|
183
|
-
if (status === 'legacy')
|
|
184
|
-
return ['Legacy artifact metadata requires inspection before it can be used for current SDD flow.'];
|
|
185
|
-
return phase.blockers.map((blocker) => blocker.action ?? blocker.reason);
|
|
186
|
-
}
|
|
187
|
-
function phaseLabel(phase) {
|
|
188
|
-
return phase
|
|
189
|
-
.split('-')
|
|
190
|
-
.map((part) => `${part.slice(0, 1).toUpperCase()}${part.slice(1)}`)
|
|
191
|
-
.join(' ');
|
|
192
|
-
}
|
|
193
|
-
function isRequiredForLaterPhase(phase) {
|
|
194
|
-
return sddPhases.some((candidate) => sddPrerequisites[candidate].includes(phase));
|
|
195
|
-
}
|
|
1
|
+
export * from '../application/sdd/cockpit-read-model.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from '../domain/sdd/cockpit-types.js';
|
package/dist/sdd/schema.js
CHANGED
|
@@ -1,111 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const sddPhases = ['explore', 'proposal', 'spec', 'design', 'tasks', 'apply-progress', 'verify', 'archive'];
|
|
3
|
-
/**
|
|
4
|
-
* Governance status of an SDD artifact.
|
|
5
|
-
*
|
|
6
|
-
* - `draft` — present in the DB; satisfies downstream readiness when the
|
|
7
|
-
* `VGXNESS_SDD_AUTO_ADVANCE` feature flag is on (or
|
|
8
|
-
* `SddWorkflowService` is constructed with `autoAdvance: true`).
|
|
9
|
-
* Does NOT count toward the change being `complete`.
|
|
10
|
-
* - `accepted` — content has been frozen by an explicit human
|
|
11
|
-
* `vgxness_sdd_accept_artifact` call. Satisfies downstream
|
|
12
|
-
* readiness regardless of the auto-advance flag.
|
|
13
|
-
* - `rejected` — explicit human rejection. Hard-blocker for downstream
|
|
14
|
-
* readiness; can only be cleared by re-opening the artifact.
|
|
15
|
-
* - `superseded`— replaced by a newer artifact under a different topic key.
|
|
16
|
-
* Hard-blocker; cannot be re-saved or accepted.
|
|
17
|
-
*/
|
|
18
|
-
export const sddArtifactStatuses = ['draft', 'accepted', 'rejected', 'superseded'];
|
|
19
|
-
export const sddArtifactNormalizationWarnings = ['legacy-artifact-defaulted-to-draft', 'invalid-artifact-metadata-defaulted-to-draft'];
|
|
20
|
-
export const SddArtifactStatusSchema = z.enum(sddArtifactStatuses);
|
|
21
|
-
export const SddArtifactNormalizationWarningSchema = z.enum(sddArtifactNormalizationWarnings);
|
|
22
|
-
export const SddArtifactAcceptanceRecordSchema = z
|
|
23
|
-
.object({
|
|
24
|
-
actor: z.object({
|
|
25
|
-
type: z.literal('human'),
|
|
26
|
-
id: z.string().min(1),
|
|
27
|
-
displayName: z.string().min(1).optional(),
|
|
28
|
-
}),
|
|
29
|
-
acceptedAt: z.string().min(1),
|
|
30
|
-
note: z.string().optional(),
|
|
31
|
-
})
|
|
32
|
-
.strict();
|
|
33
|
-
export const SddArtifactReopenRecordSchema = z
|
|
34
|
-
.object({
|
|
35
|
-
actor: z.object({
|
|
36
|
-
type: z.literal('human'),
|
|
37
|
-
id: z.string().min(1),
|
|
38
|
-
displayName: z.string().min(1).optional(),
|
|
39
|
-
}),
|
|
40
|
-
reopenedAt: z.string().min(1),
|
|
41
|
-
note: z.string().optional(),
|
|
42
|
-
})
|
|
43
|
-
.strict();
|
|
44
|
-
export const SddArtifactMetadataSchema = z
|
|
45
|
-
.object({
|
|
46
|
-
status: SddArtifactStatusSchema,
|
|
47
|
-
acceptance: SddArtifactAcceptanceRecordSchema.optional(),
|
|
48
|
-
reopen: SddArtifactReopenRecordSchema.optional(),
|
|
49
|
-
supersededByTopicKey: z.string().min(1).optional(),
|
|
50
|
-
updatedAt: z.string().min(1).optional(),
|
|
51
|
-
})
|
|
52
|
-
.strict();
|
|
53
|
-
export const SddArtifactEnvelopeSchema = z
|
|
54
|
-
.object({
|
|
55
|
-
artifact: z
|
|
56
|
-
.object({
|
|
57
|
-
id: z.string(),
|
|
58
|
-
project: z.string(),
|
|
59
|
-
topicKey: z.string(),
|
|
60
|
-
phase: z.string(),
|
|
61
|
-
content: z.string(),
|
|
62
|
-
observationId: z.string(),
|
|
63
|
-
createdAt: z.string(),
|
|
64
|
-
updatedAt: z.string(),
|
|
65
|
-
})
|
|
66
|
-
.strict(),
|
|
67
|
-
metadata: SddArtifactMetadataSchema,
|
|
68
|
-
warnings: z.array(SddArtifactNormalizationWarningSchema),
|
|
69
|
-
})
|
|
70
|
-
.strict();
|
|
71
|
-
export function normalizeSddArtifact(artifact) {
|
|
72
|
-
if (Object.hasOwn(artifact, 'metadata')) {
|
|
73
|
-
const parsed = SddArtifactMetadataSchema.safeParse(artifact.metadata);
|
|
74
|
-
if (parsed.success)
|
|
75
|
-
return { artifact, metadata: parsed.data, warnings: [] };
|
|
76
|
-
return {
|
|
77
|
-
artifact,
|
|
78
|
-
metadata: { status: 'draft' },
|
|
79
|
-
warnings: ['invalid-artifact-metadata-defaulted-to-draft'],
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
artifact,
|
|
84
|
-
metadata: { status: 'draft' },
|
|
85
|
-
warnings: ['legacy-artifact-defaulted-to-draft'],
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
export const sddPrerequisites = {
|
|
89
|
-
explore: [],
|
|
90
|
-
proposal: ['explore'],
|
|
91
|
-
spec: ['proposal'],
|
|
92
|
-
design: ['proposal', 'spec'],
|
|
93
|
-
tasks: ['proposal', 'spec', 'design'],
|
|
94
|
-
'apply-progress': ['tasks'],
|
|
95
|
-
verify: ['apply-progress'],
|
|
96
|
-
archive: ['verify'],
|
|
97
|
-
};
|
|
98
|
-
export function isSddPhase(value) {
|
|
99
|
-
return sddPhases.includes(value);
|
|
100
|
-
}
|
|
101
|
-
export function normalizeSddPhaseInput(value) {
|
|
102
|
-
const normalized = value.trim();
|
|
103
|
-
if (normalized === 'apply')
|
|
104
|
-
return 'apply-progress';
|
|
105
|
-
if (isSddPhase(normalized))
|
|
106
|
-
return normalized;
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
109
|
-
export function sddTopicKey(change, phase) {
|
|
110
|
-
return `sdd/${change}/${phase}`;
|
|
111
|
-
}
|
|
1
|
+
export * from '../domain/sdd/schema.js';
|