@opengsd/gsd-core 1.10.0 → 1.12.0
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/agents/gsd-code-fixer.md +1 -1
- package/agents/gsd-debug-session-manager.md +12 -1
- package/agents/gsd-debugger.md +1 -1
- package/agents/gsd-doc-synthesizer.md +2 -4
- package/agents/gsd-dom-verifier.md +169 -0
- package/agents/gsd-eval-auditor.md +1 -1
- package/agents/gsd-executor.md +22 -14
- package/agents/gsd-framework-selector.md +1 -3
- package/agents/gsd-intel-updater.md +1 -1
- package/agents/gsd-mempalace-curator.md +5 -3
- package/agents/gsd-pattern-mapper.md +11 -0
- package/agents/gsd-phase-researcher.md +23 -2
- package/agents/gsd-plan-checker.md +50 -53
- package/agents/gsd-planner.md +50 -50
- package/agents/gsd-project-researcher.md +1 -1
- package/agents/gsd-research-synthesizer.md +2 -2
- package/agents/gsd-roadmapper.md +15 -11
- package/agents/gsd-ui-checker.md +63 -4
- package/agents/gsd-ui-researcher.md +41 -3
- package/agents/gsd-user-profiler.md +3 -0
- package/agents/gsd-verifier.md +13 -4
- package/bin/install.js +1448 -1103
- package/commands/gsd/code-review.md +1 -1
- package/commands/gsd/discuss-phase.md +1 -1
- package/commands/gsd/execute-phase.md +1 -1
- package/commands/gsd/import.md +1 -1
- package/commands/gsd/map-codebase.md +1 -1
- package/commands/gsd/mempalace-capture.md +1 -1
- package/commands/gsd/mempalace-recall.md +1 -1
- package/commands/gsd/new-milestone.md +1 -1
- package/commands/gsd/quick.md +9 -5
- package/commands/gsd/review-backlog.md +2 -1
- package/commands/gsd/verify-work.md +1 -1
- package/gsd-core/bin/gsd-tools.cjs +1035 -138
- package/gsd-core/bin/lib/active-workstream-store.cjs +146 -22
- package/gsd-core/bin/lib/adr-parser.cjs +13 -7
- package/gsd-core/bin/lib/agent-install-check.cjs +392 -32
- package/gsd-core/bin/lib/api-coverage.cjs +33 -14
- package/gsd-core/bin/lib/artifacts.cjs +5 -0
- package/gsd-core/bin/lib/assumption-delta.cjs +32 -15
- package/gsd-core/bin/lib/audit-command-router.cjs +9 -2
- package/gsd-core/bin/lib/audit.cjs +1026 -268
- package/gsd-core/bin/lib/broken-windows.cjs +306 -28
- package/gsd-core/bin/lib/capability-consent.cjs +149 -15
- package/gsd-core/bin/lib/capability-lifecycle.cjs +45 -0
- package/gsd-core/bin/lib/capability-lock.cjs +10 -4
- package/gsd-core/bin/lib/capability-registry.cjs +845 -130
- package/gsd-core/bin/lib/capability-source.cjs +92 -0
- package/gsd-core/bin/lib/capability-state.cjs +18 -3
- package/gsd-core/bin/lib/capability-trust.cjs +444 -25
- package/gsd-core/bin/lib/capability-validator.cjs +700 -40
- package/gsd-core/bin/lib/capability-writer.cjs +3 -2
- package/gsd-core/bin/lib/check-command-router.cjs +216 -42
- package/gsd-core/bin/lib/claude-orchestration.cjs +56 -3
- package/gsd-core/bin/lib/cli-exit.cjs +496 -10
- package/gsd-core/bin/lib/code-review-depth.cjs +288 -0
- package/gsd-core/bin/lib/codex-agent-toml.cjs +735 -0
- package/gsd-core/bin/lib/command-aliases.cjs +22 -0
- package/gsd-core/bin/lib/command-arg-projection.cjs +144 -14
- package/gsd-core/bin/lib/command-roster.cjs +44 -1
- package/gsd-core/bin/lib/command-routing-hub.cjs +31 -2
- package/gsd-core/bin/lib/commands.cjs +1172 -108
- package/gsd-core/bin/lib/commonjs-marker.cjs +12 -6
- package/gsd-core/bin/lib/complexity-trigger.cjs +1192 -0
- package/gsd-core/bin/lib/config-loader.cjs +187 -23
- package/gsd-core/bin/lib/config.cjs +102 -3
- package/gsd-core/bin/lib/configuration.cjs +129 -37
- package/gsd-core/bin/lib/core-utils.cjs +208 -33
- package/gsd-core/bin/lib/decisions.cjs +23 -0
- package/gsd-core/bin/lib/edge-probe.cjs +9 -1
- package/gsd-core/bin/lib/estimate-cli.cjs +55 -11
- package/gsd-core/bin/lib/exit-code-registry.cjs +98 -0
- package/gsd-core/bin/lib/fallow-runner.cjs +20 -44
- package/gsd-core/bin/lib/frontmatter.cjs +899 -229
- package/gsd-core/bin/lib/gap-checker.cjs +95 -10
- package/gsd-core/bin/lib/git-base-branch.cjs +276 -39
- package/gsd-core/bin/lib/gsd2-import.cjs +10 -1
- package/gsd-core/bin/lib/health-diagnostic-rules/agent-install.cjs +101 -0
- package/gsd-core/bin/lib/health-diagnostic-rules/config-validation.cjs +348 -0
- package/gsd-core/bin/lib/health-diagnostic-rules/consistency.cjs +149 -0
- package/gsd-core/bin/lib/health-diagnostic-rules/install-surface-shadowing.cjs +98 -0
- package/gsd-core/bin/lib/health-diagnostic-rules/milestone-archive-hygiene.cjs +100 -0
- package/gsd-core/bin/lib/health-diagnostic-rules/phase-structure.cjs +222 -0
- package/gsd-core/bin/lib/health-diagnostic-rules/roadmap-disk-consistency.cjs +268 -0
- package/gsd-core/bin/lib/health-diagnostic-rules/root-existence.cjs +161 -0
- package/gsd-core/bin/lib/health-diagnostic-rules/state-consistency.cjs +303 -0
- package/gsd-core/bin/lib/health-diagnostic-rules/worktree-health.cjs +187 -0
- package/gsd-core/bin/lib/health-diagnostic-types.cjs +68 -0
- package/gsd-core/bin/lib/health-diagnostic.cjs +451 -0
- package/gsd-core/bin/lib/host-integration.cjs +39 -6
- package/gsd-core/bin/lib/host-runtime-detection.cjs +134 -0
- package/gsd-core/bin/lib/init-command-router.cjs +118 -21
- package/gsd-core/bin/lib/init.cjs +439 -168
- package/gsd-core/bin/lib/install-effort-resolver.cjs +73 -30
- package/gsd-core/bin/lib/install-engine.cjs +811 -259
- package/gsd-core/bin/lib/install-fs-adapter.cjs +262 -0
- package/gsd-core/bin/lib/install-model-override-resolver.cjs +235 -0
- package/gsd-core/bin/lib/install-profiles.cjs +212 -61
- package/gsd-core/bin/lib/install-scope.cjs +270 -0
- package/gsd-core/bin/lib/install-shadow-report.cjs +385 -0
- package/gsd-core/bin/lib/installed-surface-resolver.cjs +381 -0
- package/gsd-core/bin/lib/installer-migration-report.cjs +3 -0
- package/gsd-core/bin/lib/installer-migrations/010-antigravity-retire-confighome-artifacts.cjs +169 -0
- package/gsd-core/bin/lib/installer-migrations.cjs +148 -38
- package/gsd-core/bin/lib/intel.cjs +101 -26
- package/gsd-core/bin/lib/io.cjs +170 -15
- package/gsd-core/bin/lib/learnings.cjs +85 -14
- package/gsd-core/bin/lib/legacy-cleanup.cjs +8 -2
- package/gsd-core/bin/lib/markdown-sectionizer.cjs +2 -1
- package/gsd-core/bin/lib/markdown-table.cjs +183 -22
- package/gsd-core/bin/lib/milestone-lock.cjs +248 -0
- package/gsd-core/bin/lib/milestone.cjs +842 -73
- package/gsd-core/bin/lib/model-catalog.cjs +232 -16
- package/gsd-core/bin/lib/model-resolver.cjs +193 -68
- package/gsd-core/bin/lib/normalize-test-command.cjs +1 -1
- package/gsd-core/bin/lib/onboard-projection.cjs +5 -1
- package/gsd-core/bin/lib/pattern.cjs +122 -0
- package/gsd-core/bin/lib/phase-estimation.cjs +18 -9
- package/gsd-core/bin/lib/phase-id.cjs +514 -40
- package/gsd-core/bin/lib/phase-lifecycle.cjs +52 -19
- package/gsd-core/bin/lib/phase-locator.cjs +262 -34
- package/gsd-core/bin/lib/phase.cjs +1038 -214
- package/gsd-core/bin/lib/plan-dependency-graph.cjs +72 -1
- package/gsd-core/bin/lib/plan-document.cjs +263 -0
- package/gsd-core/bin/lib/plan-drift-guard.cjs +120 -0
- package/gsd-core/bin/lib/plan-scan.cjs +98 -3
- package/gsd-core/bin/lib/planning-command-router.cjs +61 -0
- package/gsd-core/bin/lib/planning-inspect.cjs +1168 -0
- package/gsd-core/bin/lib/planning-scope.cjs +31 -0
- package/gsd-core/bin/lib/planning-snapshot.cjs +894 -0
- package/gsd-core/bin/lib/planning-workspace.cjs +112 -6
- package/gsd-core/bin/lib/probe-core.cjs +5 -2
- package/gsd-core/bin/lib/profile-output.cjs +1 -1
- package/gsd-core/bin/lib/profile-pipeline-command-router.cjs +50 -7
- package/gsd-core/bin/lib/profile-pipeline.cjs +6 -3
- package/gsd-core/bin/lib/real-home-guard.cjs +419 -0
- package/gsd-core/bin/lib/refactor-trigger-command-router.cjs +766 -0
- package/gsd-core/bin/lib/retired-artifact-cleanup.cjs +11 -6
- package/gsd-core/bin/lib/review-lane-descriptor.cjs +22 -13
- package/gsd-core/bin/lib/review-lane-invocation.cjs +30 -0
- package/gsd-core/bin/lib/review-lane-runner.cjs +421 -66
- package/gsd-core/bin/lib/review-reviewer-selection.cjs +13 -18
- package/gsd-core/bin/lib/roadmap-command-router.cjs +59 -11
- package/gsd-core/bin/lib/roadmap-parser.cjs +1006 -184
- package/gsd-core/bin/lib/roadmap-upgrade.cjs +37 -10
- package/gsd-core/bin/lib/roadmap.cjs +442 -96
- package/gsd-core/bin/lib/runtime-artifact-conversion.cjs +702 -52
- package/gsd-core/bin/lib/runtime-artifact-install-plan.cjs +14 -2
- package/gsd-core/bin/lib/runtime-artifact-layout.cjs +459 -55
- package/gsd-core/bin/lib/runtime-config-adapter-registry.cjs +3 -2
- package/gsd-core/bin/lib/runtime-homes.cjs +69 -3
- package/gsd-core/bin/lib/runtime-hooks-surface.cjs +402 -58
- package/gsd-core/bin/lib/runtime-identity.cjs +234 -0
- package/gsd-core/bin/lib/runtime-name-policy.cjs +3 -1
- package/gsd-core/bin/lib/runtime-slash.cjs +96 -8
- package/gsd-core/bin/lib/security.cjs +104 -5
- package/gsd-core/bin/lib/shell-command-projection.cjs +342 -7
- package/gsd-core/bin/lib/smart-entry.cjs +133 -23
- package/gsd-core/bin/lib/spec-section.cjs +12 -7
- package/gsd-core/bin/lib/state-command-router.cjs +52 -19
- package/gsd-core/bin/lib/state-contract.cjs +359 -0
- package/gsd-core/bin/lib/state-document.cjs +338 -8
- package/gsd-core/bin/lib/state-md-schema.cjs +221 -0
- package/gsd-core/bin/lib/state-transition.cjs +846 -176
- package/gsd-core/bin/lib/state.cjs +2589 -369
- package/gsd-core/bin/lib/surface.cjs +33 -11
- package/gsd-core/bin/lib/task-command-router.cjs +111 -1
- package/gsd-core/bin/lib/task-content-resolution.cjs +368 -0
- package/gsd-core/bin/lib/teams-status.cjs +4 -1
- package/gsd-core/bin/lib/text-lines.cjs +80 -0
- package/gsd-core/bin/lib/token-scanner.cjs +76 -0
- package/gsd-core/bin/lib/uat-predicate.cjs +67 -23
- package/gsd-core/bin/lib/uat.cjs +1761 -167
- package/gsd-core/bin/lib/ui-consideration-probe.cjs +9 -1
- package/gsd-core/bin/lib/ui-frontend-evidence.cjs +157 -0
- package/gsd-core/bin/lib/ui-safety-gate.cjs +51 -12
- package/gsd-core/bin/lib/unusable-input.cjs +37 -0
- package/gsd-core/bin/lib/update-context.cjs +8 -2
- package/gsd-core/bin/lib/user-artifact-staging.cjs +705 -0
- package/gsd-core/bin/lib/validate-command-router.cjs +2 -2
- package/gsd-core/bin/lib/validate.cjs +20 -6
- package/gsd-core/bin/lib/vendor/README.md +75 -0
- package/gsd-core/bin/lib/vendor/js-yaml.cjs +3014 -0
- package/gsd-core/bin/lib/vendor/re2js.cjs +6480 -0
- package/gsd-core/bin/lib/vendor/re2js.d.cts +938 -0
- package/gsd-core/bin/lib/verification-command-router.cjs +2 -1
- package/gsd-core/bin/lib/verification.cjs +272 -9
- package/gsd-core/bin/lib/verify-command-grounding.cjs +846 -0
- package/gsd-core/bin/lib/verify.cjs +453 -918
- package/gsd-core/bin/lib/workstream-inventory-builder.cjs +53 -32
- package/gsd-core/bin/lib/workstream-inventory.cjs +63 -10
- package/gsd-core/bin/lib/workstream-name-policy.cjs +25 -4
- package/gsd-core/bin/lib/workstream.cjs +2 -2
- package/gsd-core/bin/lib/worktree-base-ref.cjs +66 -12
- package/gsd-core/bin/lib/worktree-safety.cjs +341 -18
- package/gsd-core/bin/shared/config-defaults.manifest.json +8 -1
- package/gsd-core/bin/shared/config-schema.manifest.json +12 -1
- package/gsd-core/bin/shared/exit-codes.json +8 -0
- package/gsd-core/bin/shared/exit-codes.sh +20 -0
- package/gsd-core/bin/shared/model-catalog.json +8 -1
- package/gsd-core/references/agent-contracts.md +44 -26
- package/gsd-core/references/api-coverage.md +24 -2
- package/gsd-core/references/autonomous-smart-discuss.md +3 -3
- package/gsd-core/references/checkpoints.md +39 -21
- package/gsd-core/references/context-budget.md +1 -1
- package/gsd-core/references/decimal-phase-calculation.md +5 -5
- package/gsd-core/references/dispatch-isolation-gate.md +138 -0
- package/gsd-core/references/doc-conflict-engine.md +1 -1
- package/gsd-core/references/edge-probe.md +8 -0
- package/gsd-core/references/execute-mvp-tdd.md +4 -6
- package/gsd-core/references/execute-phase-between-wave-reset.md +15 -14
- package/gsd-core/references/execute-phase-context-guard.md +1 -1
- package/gsd-core/references/execute-phase-response-language.md +1 -1
- package/gsd-core/references/execute-phase-wave-guard.md +17 -11
- package/gsd-core/references/failing-direction.md +78 -0
- package/gsd-core/references/gate-prompts.md +1 -1
- package/gsd-core/references/git-integration.md +5 -5
- package/gsd-core/references/git-planning-commit.md +5 -4
- package/gsd-core/references/gsd-run-resolver.md +1 -1
- package/gsd-core/references/loop-hook-dispatch.md +61 -2
- package/gsd-core/references/model-profiles.md +12 -4
- package/gsd-core/references/mvp-concepts.md +9 -9
- package/gsd-core/references/nyquist-compliance.md +74 -0
- package/gsd-core/references/offer-next.md +3 -5
- package/gsd-core/references/phase-argument-parsing.md +3 -3
- package/gsd-core/references/planner-failing-direction.md +53 -0
- package/gsd-core/references/planner-guidance.md +3 -9
- package/gsd-core/references/planner-human-verify-mode.md +15 -1
- package/gsd-core/references/planner-preconditions.md +1 -1
- package/gsd-core/references/planner-reviews.md +1 -1
- package/gsd-core/references/planner-revision.md +1 -1
- package/gsd-core/references/planner-verify-command-grounding.md +17 -0
- package/gsd-core/references/planning-config.md +44 -13
- package/gsd-core/references/reviewer-instances.md +31 -0
- package/gsd-core/references/revision-loop.md +1 -1
- package/gsd-core/references/runtime-aware-dispatch.md +1 -1
- package/gsd-core/references/specless-probe-fallback.md +1 -1
- package/gsd-core/references/tdd.md +1 -3
- package/gsd-core/references/ui-brand.md +65 -21
- package/gsd-core/references/ui-consideration-probe.md +1 -1
- package/gsd-core/references/universal-anti-patterns.md +5 -5
- package/gsd-core/references/verifier-phase-gates.md +192 -0
- package/gsd-core/references/verify-command-path-resolvability.md +42 -0
- package/gsd-core/references/verify-mvp-mode.md +2 -2
- package/gsd-core/references/workstream-flag.md +33 -17
- package/gsd-core/templates/README.md +1 -1
- package/gsd-core/templates/SECURITY.md +3 -3
- package/gsd-core/templates/UI-SPEC.md +25 -3
- package/gsd-core/templates/VALIDATION.md +3 -3
- package/gsd-core/templates/discussion-log.md +1 -1
- package/gsd-core/templates/phase-prompt.md +5 -4
- package/gsd-core/templates/state.md +11 -4
- package/gsd-core/templates/verification-report.md +9 -1
- package/gsd-core/workflows/_runtime-launcher.snippet.sh +1 -1
- package/gsd-core/workflows/add-backlog.md +1 -1
- package/gsd-core/workflows/add-phase.md +3 -3
- package/gsd-core/workflows/add-tests.md +3 -8
- package/gsd-core/workflows/add-todo.md +1 -1
- package/gsd-core/workflows/ai-integration-phase.md +13 -20
- package/gsd-core/workflows/audit-fix.md +12 -3
- package/gsd-core/workflows/audit-milestone.md +9 -9
- package/gsd-core/workflows/audit-uat.md +17 -2
- package/gsd-core/workflows/autonomous/steps/converge-fail-fast.md +2 -2
- package/gsd-core/workflows/autonomous.md +11 -27
- package/gsd-core/workflows/check-todos.md +1 -1
- package/gsd-core/workflows/cleanup.md +64 -5
- package/gsd-core/workflows/code-review/steps/structural-pre-pass.md +14 -4
- package/gsd-core/workflows/code-review-fix.md +38 -11
- package/gsd-core/workflows/code-review.md +159 -52
- package/gsd-core/workflows/complete-milestone.md +151 -23
- package/gsd-core/workflows/debug.md +12 -8
- package/gsd-core/workflows/diagnose-issues.md +47 -15
- package/gsd-core/workflows/discuss-phase/modes/advisor.md +1 -1
- package/gsd-core/workflows/discuss-phase/modes/chain.md +5 -8
- package/gsd-core/workflows/discuss-phase/modes/default.md +1 -1
- package/gsd-core/workflows/discuss-phase/modes/text.md +1 -1
- package/gsd-core/workflows/discuss-phase-assumptions/steps/auto-advance-dispatch.md +1 -3
- package/gsd-core/workflows/discuss-phase-assumptions.md +4 -3
- package/gsd-core/workflows/discuss-phase.md +1 -1
- package/gsd-core/workflows/do.md +3 -6
- package/gsd-core/workflows/docs-update.md +5 -4
- package/gsd-core/workflows/edit-phase.md +27 -2
- package/gsd-core/workflows/eval-review.md +7 -14
- package/gsd-core/workflows/execute-phase/steps/codebase-drift-gate.md +1 -1
- package/gsd-core/workflows/execute-phase/steps/executor-isolation-dispatch.md +142 -15
- package/gsd-core/workflows/execute-phase/steps/gap-closure-artifacts.md +1 -1
- package/gsd-core/workflows/execute-phase/steps/partial-wave.md +1 -1
- package/gsd-core/workflows/execute-phase/steps/per-plan-executor-routing.md +77 -0
- package/gsd-core/workflows/execute-phase/steps/per-plan-worktree-gate.md +24 -4
- package/gsd-core/workflows/execute-phase/steps/post-merge-gate.md +2 -2
- package/gsd-core/workflows/execute-phase/steps/protected-branch.md +21 -0
- package/gsd-core/workflows/execute-phase/steps/regression-gate-run.md +2 -2
- package/gsd-core/workflows/execute-phase/steps/wave-post-gate-hooks.md +39 -0
- package/gsd-core/workflows/execute-phase.md +72 -100
- package/gsd-core/workflows/execute-plan.md +52 -15
- package/gsd-core/workflows/explore.md +131 -4
- package/gsd-core/workflows/extract-learnings.md +1 -1
- package/gsd-core/workflows/fast.md +10 -2
- package/gsd-core/workflows/forensics.md +1 -1
- package/gsd-core/workflows/graduation.md +5 -5
- package/gsd-core/workflows/health.md +76 -10
- package/gsd-core/workflows/import.md +18 -15
- package/gsd-core/workflows/inbox.md +4 -5
- package/gsd-core/workflows/ingest-docs.md +49 -16
- package/gsd-core/workflows/insert-phase.md +5 -5
- package/gsd-core/workflows/list-seeds.md +5 -3
- package/gsd-core/workflows/list-workspaces.md +1 -1
- package/gsd-core/workflows/manager.md +12 -23
- package/gsd-core/workflows/map-codebase.md +1 -1
- package/gsd-core/workflows/milestone-summary.md +1 -1
- package/gsd-core/workflows/mvp-phase.md +8 -5
- package/gsd-core/workflows/new-milestone.md +22 -29
- package/gsd-core/workflows/new-project/steps/auto-mode-config.md +1 -1
- package/gsd-core/workflows/new-project.md +26 -40
- package/gsd-core/workflows/new-workspace.md +1 -1
- package/gsd-core/workflows/next.md +14 -2
- package/gsd-core/workflows/pause-work.md +1 -1
- package/gsd-core/workflows/plan-phase/steps/adr-ingest-express-path.md +1 -1
- package/gsd-core/workflows/plan-phase/steps/chunked-planning-mode.md +1 -1
- package/gsd-core/workflows/plan-phase/steps/prd-express-path.md +2 -4
- package/gsd-core/workflows/plan-phase/steps/stall-detection-helpers.md +3 -3
- package/gsd-core/workflows/plan-phase.md +162 -59
- package/gsd-core/workflows/plan-review-convergence.md +96 -11
- package/gsd-core/workflows/plant-seed.md +2 -2
- package/gsd-core/workflows/pr-branch.md +187 -51
- package/gsd-core/workflows/profile-user.md +16 -14
- package/gsd-core/workflows/progress.md +61 -18
- package/gsd-core/workflows/quick/steps/discussion-phase.md +1 -3
- package/gsd-core/workflows/quick/steps/plan-checker-loop.md +5 -7
- package/gsd-core/workflows/quick/steps/quick-verification.md +28 -9
- package/gsd-core/workflows/quick/steps/research-phase.md +4 -6
- package/gsd-core/workflows/quick/steps/worktree-pre-dispatch-commit.md +3 -3
- package/gsd-core/workflows/quick.md +55 -44
- package/gsd-core/workflows/remove-phase.md +4 -4
- package/gsd-core/workflows/remove-workspace.md +2 -2
- package/gsd-core/workflows/resume-project.md +8 -12
- package/gsd-core/workflows/review.md +219 -20
- package/gsd-core/workflows/scan.md +1 -1
- package/gsd-core/workflows/secure-phase.md +3 -3
- package/gsd-core/workflows/session-report.md +2 -1
- package/gsd-core/workflows/settings-advanced.md +7 -9
- package/gsd-core/workflows/settings-integrations.md +64 -31
- package/gsd-core/workflows/settings.md +69 -7
- package/gsd-core/workflows/ship.md +116 -50
- package/gsd-core/workflows/sketch-wrap-up.md +11 -17
- package/gsd-core/workflows/sketch.md +12 -18
- package/gsd-core/workflows/smart-entry.md +3 -5
- package/gsd-core/workflows/spec-phase.md +53 -13
- package/gsd-core/workflows/spike-wrap-up.md +7 -11
- package/gsd-core/workflows/spike.md +20 -31
- package/gsd-core/workflows/stats.md +2 -2
- package/gsd-core/workflows/sync-skills.md +64 -9
- package/gsd-core/workflows/thread.md +11 -7
- package/gsd-core/workflows/transition.md +49 -14
- package/gsd-core/workflows/ui-phase.md +15 -21
- package/gsd-core/workflows/ui-review.md +8 -12
- package/gsd-core/workflows/ultraplan-phase.md +5 -13
- package/gsd-core/workflows/undo.md +8 -16
- package/gsd-core/workflows/update.md +7 -11
- package/gsd-core/workflows/validate-phase.md +3 -3
- package/gsd-core/workflows/verify-work/steps/automated-ui-verification.md +25 -1
- package/gsd-core/workflows/verify-work/steps/mvp-uat-framing.md +1 -1
- package/gsd-core/workflows/verify-work.md +66 -25
- package/hooks/dist/gsd-agent-isolation-guard.js +158 -30
- package/hooks/dist/gsd-check-update-worker.js +56 -13
- package/hooks/dist/gsd-check-update.js +19 -1
- package/hooks/dist/gsd-config-reload.js +18 -12
- package/hooks/dist/gsd-context-monitor.js +19 -10
- package/hooks/dist/gsd-cursor-post-tool.js +3 -1
- package/hooks/dist/gsd-cursor-pre-tool.js +2 -3
- package/hooks/dist/gsd-cursor-session-start.js +2 -1
- package/hooks/dist/gsd-cursor-stop.js +2 -1
- package/hooks/dist/gsd-cursor-subagent-start.js +83 -3
- package/hooks/dist/gsd-cursor-subagent-stop.js +6 -3
- package/hooks/dist/gsd-ensure-canonical-path.js +2 -1
- package/hooks/dist/gsd-graphify-update.sh +22 -18
- package/hooks/dist/gsd-node-runner.sh +76 -0
- package/hooks/dist/gsd-phase-boundary.sh +1 -0
- package/hooks/dist/gsd-prompt-guard.js +37 -27
- package/hooks/dist/gsd-read-guard.js +16 -7
- package/hooks/dist/gsd-read-injection-scanner.js +55 -32
- package/hooks/dist/gsd-session-state.sh +1 -0
- package/hooks/dist/gsd-statusline.js +231 -24
- package/hooks/dist/gsd-update-banner.js +22 -1
- package/hooks/dist/gsd-validate-commit.sh +80 -6
- package/hooks/dist/gsd-windsurf-pre-command.js +16 -11
- package/hooks/dist/gsd-windsurf-pre-write.js +22 -13
- package/hooks/dist/gsd-workflow-guard.js +162 -46
- package/hooks/dist/gsd-worktree-path-guard.js +36 -21
- package/hooks/dist/gsd-write-guard.js +35 -25
- package/hooks/dist/lib/cli-exit.js +560 -0
- package/hooks/dist/lib/exit-code-registry.js +98 -0
- package/hooks/dist/lib/git-cmd.js +92 -59
- package/hooks/dist/lib/git-probe.js +84 -0
- package/hooks/dist/lib/hook-exit.js +81 -0
- package/hooks/dist/lib/injection-patterns.js +45 -0
- package/hooks/dist/lib/isolation-deny-reason.js +39 -0
- package/hooks/dist/lib/isolation-sentinel.js +9 -0
- package/hooks/dist/managed-hooks-registry.cjs +3 -0
- package/hooks/gsd-agent-isolation-guard.js +158 -30
- package/hooks/gsd-check-update-worker.js +56 -13
- package/hooks/gsd-check-update.js +19 -1
- package/hooks/gsd-config-reload.js +18 -12
- package/hooks/gsd-context-monitor.js +19 -10
- package/hooks/gsd-cursor-post-tool.js +3 -1
- package/hooks/gsd-cursor-pre-tool.js +2 -3
- package/hooks/gsd-cursor-session-start.js +2 -1
- package/hooks/gsd-cursor-stop.js +2 -1
- package/hooks/gsd-cursor-subagent-start.js +83 -3
- package/hooks/gsd-cursor-subagent-stop.js +6 -3
- package/hooks/gsd-ensure-canonical-path.js +2 -1
- package/hooks/gsd-graphify-update.sh +22 -18
- package/hooks/gsd-node-runner.sh +76 -0
- package/hooks/gsd-phase-boundary.sh +1 -0
- package/hooks/gsd-prompt-guard.js +37 -27
- package/hooks/gsd-read-guard.js +16 -7
- package/hooks/gsd-read-injection-scanner.js +55 -32
- package/hooks/gsd-session-state.sh +1 -0
- package/hooks/gsd-statusline.js +231 -24
- package/hooks/gsd-update-banner.js +22 -1
- package/hooks/gsd-validate-commit.sh +80 -6
- package/hooks/gsd-windsurf-pre-command.js +16 -11
- package/hooks/gsd-windsurf-pre-write.js +22 -13
- package/hooks/gsd-workflow-guard.js +162 -46
- package/hooks/gsd-worktree-path-guard.js +36 -21
- package/hooks/gsd-write-guard.js +35 -25
- package/hooks/lib/cli-exit.js +560 -0
- package/hooks/lib/exit-code-registry.js +98 -0
- package/hooks/lib/git-cmd.js +92 -59
- package/hooks/lib/git-probe.js +84 -0
- package/hooks/lib/hook-exit.js +81 -0
- package/hooks/lib/injection-patterns.js +45 -0
- package/hooks/lib/isolation-deny-reason.js +39 -0
- package/hooks/lib/isolation-sentinel.js +9 -0
- package/hooks/managed-hooks-registry.cjs +3 -0
- package/package.json +28 -11
- package/pi/gsd.cjs +19 -5
- package/scripts/base64-scan.sh +74 -12
- package/scripts/baselines/planning-prompt-drift-baseline.json +4 -0
- package/scripts/baselines/planning-snapshot-bypass-baseline.json +12 -0
- package/scripts/baselines/unreachable-guard-drift-baseline.json +4 -0
- package/scripts/build-hooks.js +5 -0
- package/scripts/changeset/lint.cjs +60 -5
- package/scripts/check-alias-drift.cjs +7 -43
- package/scripts/check-contract-drift.cjs +297 -0
- package/scripts/check-glossary-refs.cjs +77 -15
- package/scripts/check-mutation-score-ratchet.cjs +156 -0
- package/scripts/ci-check-job-near-cap.cjs +49 -0
- package/scripts/ci-pr-mergeability.cjs +262 -0
- package/scripts/ci-test-scope.cjs +64 -14
- package/scripts/ci-timeout-report.cjs +230 -0
- package/scripts/command-contract-helpers.cjs +903 -1
- package/scripts/docs-guard-registry.cjs +396 -0
- package/scripts/gen-adr-index.cjs +728 -38
- package/scripts/gen-capability-registry.cjs +11 -21
- package/scripts/gen-context-index.cjs +2 -11
- package/scripts/gen-exit-code-docs.cjs +318 -0
- package/scripts/gen-exit-code-registry.cjs +891 -0
- package/scripts/gen-features.cjs +836 -0
- package/scripts/gen-health-docs.cjs +390 -0
- package/scripts/gen-hooks-cli-exit.cjs +239 -0
- package/scripts/gen-install-tree-fixtures.cjs +2 -2
- package/scripts/gen-inventory-manifest.cjs +50 -4
- package/scripts/gen-loop-host-contract.cjs +138 -25
- package/scripts/gen-registry.cjs +3 -14
- package/scripts/gen-scripts-cli-exit.cjs +185 -0
- package/scripts/gen-state-md-docs.cjs +727 -0
- package/scripts/{test-failure-reasons.cjs → gsd-test-gate-reasons.cjs} +6 -0
- package/scripts/lib/alias-drift-families.cjs +46 -0
- package/scripts/lib/ci-job-timing.cjs +72 -0
- package/scripts/lib/cli-exit.cjs +546 -44
- package/scripts/lib/drift-scan.cjs +308 -0
- package/scripts/lib/exit-code-registry.cjs +98 -0
- package/scripts/lib/ndjson-reporter.cjs +119 -0
- package/scripts/lint-allow-test-rule-refs.allowlist.json +1 -26
- package/scripts/lint-allow-test-rule-refs.effective-ceiling.json +4 -0
- package/scripts/lint-allow-test-rule-refs.unverified-ceiling.json +3 -0
- package/scripts/lint-canary-version-leak.cjs +73 -0
- package/scripts/lint-command-contract.cjs +96 -13
- package/scripts/lint-completion-predicate-drift.cjs +933 -0
- package/scripts/lint-completion-ratio-drift.cjs +214 -0
- package/scripts/lint-default-flip-documentation.cjs +193 -0
- package/scripts/lint-docs-guard-registration.cjs +495 -0
- package/scripts/lint-docs-guard-registration.exempt-baseline.cjs +193 -0
- package/scripts/lint-eslint-glob-coverage.allowlist.json +38 -0
- package/scripts/lint-eslint-glob-coverage.cjs +340 -0
- package/scripts/{lint-fix-has-regression-test.cjs → lint-fix-has-regression-tests.cjs} +12 -6
- package/scripts/lint-frontmatter-scalar-broad-grep.cjs +237 -0
- package/scripts/lint-health-diagnostic-rule-table.cjs +461 -0
- package/scripts/lint-hooks-runtime-build-seam.cjs +262 -0
- package/scripts/lint-milestone-window-drift.cjs +468 -0
- package/scripts/lint-mutation-test-derivation-drift.cjs +86 -0
- package/scripts/lint-phase-enumeration-drift.cjs +492 -0
- package/scripts/lint-plan-count-drift.cjs +318 -0
- package/scripts/lint-planning-artifact-writer-drift.cjs +398 -0
- package/scripts/lint-planning-prompt-drift.cjs +471 -0
- package/scripts/lint-planning-snapshot-bypass-drift.cjs +544 -0
- package/scripts/lint-regression-test-names.cjs +15 -13
- package/scripts/lint-removed-but-needed.cjs +488 -0
- package/scripts/lint-seam-enforcement.cjs +182 -0
- package/scripts/lint-slug-derivation-drift.cjs +921 -0
- package/scripts/lint-source-test-name-collision.cjs +241 -0
- package/scripts/lint-state-field-drift.cjs +805 -0
- package/scripts/lint-state-write-path-drift.cjs +950 -0
- package/scripts/lint-test-file-count.allowlist.json +137 -8
- package/scripts/lint-test-file-count.cjs +25 -3
- package/scripts/lint-unreachable-guard-drift.cjs +830 -0
- package/scripts/lint-vendored-deps.cjs +297 -0
- package/scripts/mutation-matrix.cjs +599 -50
- package/scripts/pr-changed-files.cjs +63 -0
- package/scripts/pr-template-policy.cjs +14 -4
- package/scripts/prompt-injection-scan.sh +100 -14
- package/scripts/require-issue-link-policy.cjs +192 -0
- package/scripts/secret-scan.sh +75 -13
- package/scripts/select-docs-guards.cjs +56 -0
- package/scripts/sync-runtime-launcher.cjs +24 -7
- package/skills/gsd-autonomous/SKILL.md +0 -1
- package/skills/gsd-code-review/SKILL.md +1 -1
- package/skills/gsd-discuss-phase/SKILL.md +1 -1
- package/skills/gsd-execute-phase/SKILL.md +1 -2
- package/skills/gsd-import/SKILL.md +1 -1
- package/skills/gsd-map-codebase/SKILL.md +1 -1
- package/skills/gsd-mempalace-capture/SKILL.md +1 -1
- package/skills/gsd-mempalace-recall/SKILL.md +1 -1
- package/skills/gsd-new-milestone/SKILL.md +1 -1
- package/skills/gsd-next/SKILL.md +0 -1
- package/skills/gsd-plan-phase/SKILL.md +0 -1
- package/skills/gsd-progress/SKILL.md +0 -1
- package/skills/gsd-quick/SKILL.md +9 -5
- package/skills/gsd-review-backlog/SKILL.md +2 -1
- package/skills/gsd-stats/SKILL.md +0 -1
- package/skills/gsd-verify-work/SKILL.md +1 -1
- package/vscode/package.json +1 -1
- package/bin/lib/ui-safety-gate.cjs +0 -107
- package/gsd-core/workflows/discovery-phase.md +0 -298
- package/gsd-core/workflows/plan-milestone-gaps.md +0 -281
- package/gsd-core/workflows/verify-phase.md +0 -574
- package/scripts/affected-tests-lib.cjs +0 -554
- package/scripts/lint-allow-test-rule-refs.cjs +0 -162
- package/scripts/lint-emitted-drift-ack.cjs +0 -344
- package/scripts/run-affected-tests.cjs +0 -7
- package/scripts/run-tests.cjs +0 -1051
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Capability trust gate — ADR-1244 Phase 4 (Decision D5 + the compatibility half of D6), extended
|
|
4
|
-
* by ADR-2782 Phase 3 (#2796) with a FOURTH executable-surface class
|
|
4
|
+
* by ADR-2782 Phase 3 (#2796) with a FOURTH executable-surface class (the reviewer lane), and by
|
|
5
|
+
* ADR-2363 Phase 1 (#3248) with a FIFTH, NON-executable class: the instruction surface.
|
|
5
6
|
*
|
|
6
7
|
* PURE module. It computes *what* a capability would do and *whether* policy allows it; it
|
|
7
8
|
* never mutates the filesystem and never performs I/O beyond reading staged files to confirm
|
|
@@ -21,16 +22,33 @@
|
|
|
21
22
|
* the signature — the loader has no config resolver and must compute the same signature as the
|
|
22
23
|
* lifecycle (constraint 2, `.gsd/phase/chore-2796-reviewer-trust-disclosure/40-design.md`).
|
|
23
24
|
*
|
|
25
|
+
* ADR-2363 D5 (#3248): a capability's declared `skills` are INSTRUCTION surfaces — their bodies are
|
|
26
|
+
* copied verbatim into the user's agent instruction context, so their reach is bounded only by what
|
|
27
|
+
* the agent will do when told. They are disclosed BY NAME and never content-scanned (D2 —
|
|
28
|
+
* Kerckhoffs: a shipped rule set is readable by the adversary who installs it). Unlike the four
|
|
29
|
+
* executable classes they never set `hasExecutable` (D3) and never enter `disclosureSignature` (D4):
|
|
30
|
+
* folding them in would perturb the stored signature of every already-consented skill-bearing
|
|
31
|
+
* capability and fire a spurious re-consent on its next upgrade — the harm ADR-2782 D4 rule 5
|
|
32
|
+
* already forbids. Any future signature binding arrives as a versioned v2, never an in-place
|
|
33
|
+
* re-encoding of v1. ADR-2363 D3's class table names "skills, agents", but third-party `agents[]`
|
|
34
|
+
* are deliberately EXCLUDED here: `stageAgentsForRuntimeWithConverter` (`src/install-profiles.cts`)
|
|
35
|
+
* takes only a source directory, with no registry-aware third-party staging path the way
|
|
36
|
+
* `readInstalledCapabilitySkill` gives skills — so a declared agent is never actually staged into
|
|
37
|
+
* the instruction context, and disclosing it would name a surface that does not exist. Agents stay
|
|
38
|
+
* unimplemented pending a maintainer decision.
|
|
39
|
+
*
|
|
24
40
|
* Exports:
|
|
25
41
|
* RESERVED_NAMESPACES — id prefixes third parties may not claim
|
|
26
|
-
* discloseExecutableSurfaces(...) — enumerate
|
|
42
|
+
* discloseExecutableSurfaces(...) — enumerate the four executable classes + instruction surfaces
|
|
27
43
|
* collectReviewerLaneSurfaces(...) — the reviewer-lane collector, independently testable
|
|
44
|
+
* collectInstructionSurfaces(...) — the instruction-surface collector, independently testable
|
|
28
45
|
* checkReservedNamespace(id) — is this id in a reserved namespace?
|
|
29
46
|
* evaluateSourceAllowed(parsed,...) — strictKnownRegistries enforcement
|
|
30
47
|
* checkEngines(manifest, host) — engines.gsd hard gate + compatVersions downgrade
|
|
31
48
|
* evaluateInstallTrust(args) — compose: source + namespace + engines + disclosure
|
|
32
49
|
* executableSetChanged(old, new) — did the executable surface set change between versions?
|
|
33
50
|
* summarizeDisclosure(disclosure) — human-readable consent-prompt lines
|
|
51
|
+
* summarizeInstructionSurfaces(d) — the instruction-surface section of the consent summary
|
|
34
52
|
* UNRESOLVED_HOST_MARKER — the non-blank marker for an unresolved openai-http host
|
|
35
53
|
* EGRESS_PAYLOAD_CLASSES — the named data classes every reviewer lane receives
|
|
36
54
|
*/
|
|
@@ -403,6 +421,48 @@ function collectReviewerLaneSurfaces(manifest, resolveHost) {
|
|
|
403
421
|
const args = rawArgsDeclared.filter((a) => typeof a === 'string');
|
|
404
422
|
const hostConfigKey = asString(invoke['hostConfigKey']);
|
|
405
423
|
const promptChannel = asString(invoke['promptChannel']);
|
|
424
|
+
// #2483: the declared env pairs. String-filtered for the human line exactly as `args` is, and
|
|
425
|
+
// prototype-safe (own enumerable keys only, dangerous keys never copied) exactly as `rawConfig`
|
|
426
|
+
// is. Disclosure runs BEFORE validation, so a non-object or non-string-valued `env` reaches here
|
|
427
|
+
// and must degrade to "declares none" rather than throw.
|
|
428
|
+
const env = {};
|
|
429
|
+
const envRaw = invoke['env'];
|
|
430
|
+
if (typeof envRaw === 'object' && envRaw !== null && !Array.isArray(envRaw)) {
|
|
431
|
+
for (const [k, v] of Object.entries(envRaw)) {
|
|
432
|
+
if (k === '__proto__' || k === 'constructor' || k === 'prototype')
|
|
433
|
+
continue;
|
|
434
|
+
if (typeof v === 'string')
|
|
435
|
+
env[k] = v;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
const defaultHost = asString(invoke['defaultHost']);
|
|
439
|
+
// The completeness backstop (mirrors rawConfig). Everything the invoke object declares that the
|
|
440
|
+
// explicit fields above do not already bind. Same prototype-safe copy.
|
|
441
|
+
const residualInvoke = {};
|
|
442
|
+
for (const [k, v] of Object.entries(invoke)) {
|
|
443
|
+
if (k === '__proto__' || k === 'constructor' || k === 'prototype')
|
|
444
|
+
continue;
|
|
445
|
+
if (k === 'binary' || k === 'args' || k === 'hostConfigKey' || k === 'promptChannel')
|
|
446
|
+
continue;
|
|
447
|
+
residualInvoke[k] = v;
|
|
448
|
+
}
|
|
449
|
+
// The outer half of the same backstop. `probe` is the one that matters most — its `binary` is
|
|
450
|
+
// spawned before dispatch — and the two exclusions below are ADR-2782's deliberate cosmetic
|
|
451
|
+
// carve-outs, not fields nobody got round to.
|
|
452
|
+
const residualLane = {};
|
|
453
|
+
for (const [k, v] of Object.entries(rec)) {
|
|
454
|
+
if (k === '__proto__' || k === 'constructor' || k === 'prototype')
|
|
455
|
+
continue;
|
|
456
|
+
if (k === 'slug' || k === 'transport' || k === 'handler' || k === 'invoke')
|
|
457
|
+
continue;
|
|
458
|
+
if (k === 'reviewsSection' || k === 'timeoutFloorMs')
|
|
459
|
+
continue;
|
|
460
|
+
residualLane[k] = v;
|
|
461
|
+
}
|
|
462
|
+
const probeRaw = rec['probe'];
|
|
463
|
+
const probeIsObj = typeof probeRaw === 'object' && probeRaw !== null && !Array.isArray(probeRaw);
|
|
464
|
+
const probeBinary = probeIsObj ? asString(probeRaw['binary']) : '';
|
|
465
|
+
const probeKind = probeIsObj ? asString(probeRaw['kind']) : '';
|
|
406
466
|
// An EMPTY (or wholly unrecognised) reviewer body declares no lane and must
|
|
407
467
|
// not be treated as one. Without this, `reviewer: {}` alone flips
|
|
408
468
|
// hasExecutable true and perturbs the disclosure signature — producing a
|
|
@@ -416,8 +476,12 @@ function collectReviewerLaneSurfaces(manifest, resolveHost) {
|
|
|
416
476
|
// enough. Requiring specifically a binary, or specifically a slug, would let
|
|
417
477
|
// a lane declaring only the other slip through unconsented, which is the far
|
|
418
478
|
// worse failure.
|
|
479
|
+
// `env`/`defaultHost` join the test for the reason the comment above gives for keeping it broad:
|
|
480
|
+
// a lane declaring ONLY an `env` pair would otherwise declare "nothing", disclose nothing, and
|
|
481
|
+
// still hand those pairs to a spawned child once #2927/#3062 made overlay lanes executable —
|
|
482
|
+
// the exact slip-through the broad test exists to refuse.
|
|
419
483
|
const declaresSomething = Boolean(slug || transport || handler || binary || hostConfigKey || promptChannel
|
|
420
|
-
|| rawArgsDeclared.length > 0);
|
|
484
|
+
|| rawArgsDeclared.length > 0 || Object.keys(env).length > 0 || defaultHost || probeBinary);
|
|
421
485
|
if (!declaresSomething)
|
|
422
486
|
return [];
|
|
423
487
|
// B2/B3/B4: resolvedHost/isLocalDestination are only meaningful for an openai-http lane — a
|
|
@@ -462,6 +526,12 @@ function collectReviewerLaneSurfaces(manifest, resolveHost) {
|
|
|
462
526
|
isLocalDestination,
|
|
463
527
|
promptChannel,
|
|
464
528
|
handler,
|
|
529
|
+
env,
|
|
530
|
+
defaultHost,
|
|
531
|
+
residualInvoke,
|
|
532
|
+
residualLane,
|
|
533
|
+
probeBinary,
|
|
534
|
+
probeKind,
|
|
465
535
|
// B5: every lane receives the same named egress payload classes — a fresh copy per surface so
|
|
466
536
|
// no caller can mutate the shared constant through a returned surface.
|
|
467
537
|
egressPayloadClasses: [...EGRESS_PAYLOAD_CLASSES],
|
|
@@ -469,6 +539,56 @@ function collectReviewerLaneSurfaces(manifest, resolveHost) {
|
|
|
469
539
|
return [surface];
|
|
470
540
|
}, []);
|
|
471
541
|
}
|
|
542
|
+
/**
|
|
543
|
+
* The manifest fields whose declared names become instruction surfaces. Ordered data rather than a
|
|
544
|
+
* hand-rolled loop per field, so a future second member of the class is one row, not a second copy
|
|
545
|
+
* of the same filter. Deliberately a ONE-row table today: third-party `agents[]` are never staged
|
|
546
|
+
* into the instruction context — `stageAgentsForRuntimeWithConverter` (`src/install-profiles.cts`)
|
|
547
|
+
* takes only a source directory, with no registry-aware staging path the way
|
|
548
|
+
* `readInstalledCapabilitySkill` gives skills — so disclosing them would name a surface that does
|
|
549
|
+
* not exist. ADR-2363 D3's class table says "skills, agents"; the agents half is therefore
|
|
550
|
+
* deliberately unimplemented pending a maintainer decision.
|
|
551
|
+
*/
|
|
552
|
+
const INSTRUCTION_SURFACE_FIELDS = [
|
|
553
|
+
{ field: 'skills', kind: 'skill' },
|
|
554
|
+
];
|
|
555
|
+
/**
|
|
556
|
+
* Collect the instruction surfaces a manifest declares (ADR-2363 D5, #3248) — peer to the four
|
|
557
|
+
* executable-surface collectors, and invoked through the same `safeCollect` wrapper so a hostile
|
|
558
|
+
* value here degrades ONLY this class to empty rather than losing the other four.
|
|
559
|
+
*
|
|
560
|
+
* Liberal in what it accepts, exactly like the existing collectors: a non-object manifest, an
|
|
561
|
+
* absent field, a non-array field, and a non-string/blank member each degrade quietly. A non-array
|
|
562
|
+
* `skills` is NOT a partial success — it yields nothing, because a scalar declares no set.
|
|
563
|
+
*
|
|
564
|
+
* Deliberately does NOT:
|
|
565
|
+
* - dedup (a manifest declaring a stem twice discloses it twice — disclosure reports what the
|
|
566
|
+
* manifest SAYS; collapsing would misreport it, and dedup is the registry's job);
|
|
567
|
+
* - normalize or truncate a name (it is disclosed verbatim so the user sees what was declared);
|
|
568
|
+
* - existence-check the stem against `stagedDir`. A stem is a REGISTRY name, not a bundle-relative
|
|
569
|
+
* artifact path — checking it would repeat the reviewer-lane `binary` mistake (matrix C6) and
|
|
570
|
+
* put registry names into `missingArtifacts`, which is for declared bundle FILES only.
|
|
571
|
+
*/
|
|
572
|
+
function collectInstructionSurfaces(manifest) {
|
|
573
|
+
const surfaces = [];
|
|
574
|
+
if (typeof manifest !== 'object' || manifest === null)
|
|
575
|
+
return surfaces;
|
|
576
|
+
for (const { field, kind } of INSTRUCTION_SURFACE_FIELDS) {
|
|
577
|
+
const declared = manifest[field];
|
|
578
|
+
if (!Array.isArray(declared))
|
|
579
|
+
continue;
|
|
580
|
+
for (const entry of declared) {
|
|
581
|
+
// A non-string or blank member is dropped INDIVIDUALLY — the valid siblings around it still
|
|
582
|
+
// disclose, mirroring how collectHookSurfaces skips a malformed entry rather than the array.
|
|
583
|
+
if (typeof entry !== 'string')
|
|
584
|
+
continue;
|
|
585
|
+
if (entry.trim() === '')
|
|
586
|
+
continue;
|
|
587
|
+
surfaces.push({ kind, name: entry });
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return surfaces;
|
|
591
|
+
}
|
|
472
592
|
/**
|
|
473
593
|
* Enumerate every executable surface a capability manifest declares.
|
|
474
594
|
*
|
|
@@ -478,6 +598,13 @@ function collectReviewerLaneSurfaces(manifest, resolveHost) {
|
|
|
478
598
|
* - `mcpServers`: { <name>: {...} } | [{ name }] — servers spawned by the host runtime
|
|
479
599
|
* - `reviewer`: { slug, transport, invoke, ... } — an external reviewer lane (ADR-2782 D5, #2796)
|
|
480
600
|
*
|
|
601
|
+
* plus ONE non-executable class (ADR-2363 D5, #3248):
|
|
602
|
+
* - `skills`: string[] of owned stems — INSTRUCTION surfaces, whose bodies land in the agent's
|
|
603
|
+
* instruction context. Disclosed by name; they never set `hasExecutable` (D3) and never enter
|
|
604
|
+
* `disclosureSignature` (D4). Stems are registry names, so they are never existence-checked
|
|
605
|
+
* against `stagedDir` and never appear in `missingArtifacts`. `agents` is excluded — see the
|
|
606
|
+
* module header.
|
|
607
|
+
*
|
|
481
608
|
* `mcpServers` is not a first-party capability.json field today, but a third-party manifest may
|
|
482
609
|
* declare it, so the trust gate discloses it whenever present (honest disclosure over the
|
|
483
610
|
* narrower first-party schema). Pure: when `stagedDir` is provided, declared hook/command-module
|
|
@@ -490,7 +617,7 @@ function collectReviewerLaneSurfaces(manifest, resolveHost) {
|
|
|
490
617
|
* throwing traps, or a property with a throwing getter (matrix C5, E2). Disclosure runs BEFORE
|
|
491
618
|
* Phase 2's validation, on a manifest validation would reject outright, so it must tolerate what
|
|
492
619
|
* validation does not. Each surface class is collected independently (`safeCollect`) so a hostile
|
|
493
|
-
* value in ONE class degrades only that class to empty rather than losing the
|
|
620
|
+
* value in ONE class degrades only that class to empty rather than losing the others.
|
|
494
621
|
*
|
|
495
622
|
* `resolveHost` (optional, #2796) is forwarded to `collectReviewerLaneSurfaces` so a caller with
|
|
496
623
|
* config access (the lifecycle, never the loader — see `signatureForManifest`) can disclose the REAL
|
|
@@ -502,8 +629,11 @@ function discloseExecutableSurfaces(manifest, stagedDir, resolveHost) {
|
|
|
502
629
|
const commandModules = safeCollect(() => collectCommandSurfaces(manifest, stagedDir, missingArtifacts), []);
|
|
503
630
|
const mcpServers = safeCollect(() => collectMcpSurfaces(manifest), []);
|
|
504
631
|
const reviewerLanes = safeCollect(() => collectReviewerLaneSurfaces(manifest, resolveHost), []);
|
|
632
|
+
const instructionSurfaces = safeCollect(() => collectInstructionSurfaces(manifest), []);
|
|
633
|
+
// ADR-2363 D3: instruction surfaces are deliberately ABSENT from this expression. Adding them
|
|
634
|
+
// would silently change `executableSetChanged` and the auto-update re-consent trigger.
|
|
505
635
|
const hasExecutable = hooks.length > 0 || commandModules.length > 0 || mcpServers.length > 0 || reviewerLanes.length > 0;
|
|
506
|
-
return { hooks, commandModules, mcpServers, reviewerLanes, hasExecutable, missingArtifacts };
|
|
636
|
+
return { hooks, commandModules, mcpServers, reviewerLanes, instructionSurfaces, hasExecutable, missingArtifacts };
|
|
507
637
|
}
|
|
508
638
|
/**
|
|
509
639
|
* Existence-check a manifest-declared artifact path under stagedDir, refusing to follow it
|
|
@@ -712,6 +842,15 @@ function evaluateInstallTrust(args) {
|
|
|
712
842
|
// openai-http reviewer lane to the human at install/upgrade time — it never affects the
|
|
713
843
|
// consent-binding signature (disclosureSignature never reads resolvedHost; design constraint 2).
|
|
714
844
|
const disclosure = discloseExecutableSurfaces(manifest, stagedDir, resolveHost);
|
|
845
|
+
// #3514 (F21c): prompt-only integrity status. Set AFTER discloseExecutableSurfaces so the
|
|
846
|
+
// surface builder (and every signature computed from it) is untouched — see the field's
|
|
847
|
+
// disclosure-interface comment for why this must never reach disclosureSignature.
|
|
848
|
+
if (args.integrityPin === 'sha512')
|
|
849
|
+
disclosure.integrityStatus = 'pinned';
|
|
850
|
+
else if (args.integrityPin === 'git-commit')
|
|
851
|
+
disclosure.integrityStatus = 'commit-pinned';
|
|
852
|
+
else if (args.integrityPin === 'none')
|
|
853
|
+
disclosure.integrityStatus = 'unverified';
|
|
715
854
|
// A manifest that declares a hook script or command module NOT present in the staged bundle
|
|
716
855
|
// (missing, or escaping the bundle via an absolute/`..` path) is rejected: such an artifact
|
|
717
856
|
// would run from outside the integrity-pinned, reversible install root. Only enforced when a
|
|
@@ -831,8 +970,41 @@ function disclosureSignature(d) {
|
|
|
831
970
|
// 2 — the loader has no config resolver and must compute the SAME signature as the lifecycle, or a
|
|
832
971
|
// resolver-bearing caller and a resolver-less caller would permanently disagree on one manifest's
|
|
833
972
|
// signature).
|
|
973
|
+
// #2483: the eight-field enumeration above was a CLOSED list over an OPEN vocabulary, and it had
|
|
974
|
+
// already fallen behind by EIGHT fields before `env` made the ninth — `defaultHost` (the manifest's
|
|
975
|
+
// OWN fallback egress host), `path` (appended to it to build the URL), `outputChannel`, `outputArg`,
|
|
976
|
+
// `modelArg`, `effortChannel`, `modelDiscovery` and `fallbackModel` all reach `resolveLanePlan` and
|
|
977
|
+
// none was signed. Counted, because the number is easy to state ambiguously: `resolveLanePlan`
|
|
978
|
+
// reads THIRTEEN distinct `inv.*` fields once `env` is included (twelve before this PR added it),
|
|
979
|
+
// of which the pre-#2483 tuple bound four — so eight were unbound before `env`, nine including it.
|
|
980
|
+
// So the fix is not a ninth name: it is a residual, the same completeness backstop `rawConfig` gives
|
|
981
|
+
// the MCP line one screen up (#1459 finding 5). `env`/`defaultHost` are ALSO named explicitly,
|
|
982
|
+
// mirroring that line's deliberate explicit-then-backstop overlap, because they are the two the
|
|
983
|
+
// human summary renders and a reader should be able to find them in the signature by name.
|
|
984
|
+
//
|
|
985
|
+
// APPENDED ONLY WHEN NON-EMPTY, which is D4.5 one level down: a lane declaring nothing beyond the
|
|
986
|
+
// eight already-bound fields keeps a BYTE-IDENTICAL signature, so this cannot re-prompt every
|
|
987
|
+
// consented capability for a field it does not use. A lane that DOES declare one re-consents — which
|
|
988
|
+
// is the correct outcome, not a cost: those fields were executable and undisclosed.
|
|
834
989
|
const lanes = d.reviewerLanes
|
|
835
|
-
.map((l) =>
|
|
990
|
+
.map((l) => {
|
|
991
|
+
const tuple = [
|
|
992
|
+
'lane', l.slug, l.transport, l.binary, l.rawArgs || [], l.hostConfigKey, l.promptChannel, l.handler,
|
|
993
|
+
];
|
|
994
|
+
const extra = {
|
|
995
|
+
env: l.env || {},
|
|
996
|
+
defaultHost: l.defaultHost || '',
|
|
997
|
+
residual: l.residualInvoke || {},
|
|
998
|
+
laneResidual: l.residualLane || {},
|
|
999
|
+
};
|
|
1000
|
+
const declaresExtra = Object.keys(extra.env).length > 0
|
|
1001
|
+
|| extra.defaultHost !== ''
|
|
1002
|
+
|| Object.keys(extra.residual).length > 0
|
|
1003
|
+
|| Object.keys(extra.laneResidual).length > 0;
|
|
1004
|
+
if (declaresExtra)
|
|
1005
|
+
tuple.push(extra);
|
|
1006
|
+
return stableJson(tuple);
|
|
1007
|
+
})
|
|
836
1008
|
.sort();
|
|
837
1009
|
// D4.5 (the highest-consequence line in this phase): the lane element is appended ONLY when at
|
|
838
1010
|
// least one lane is declared. A lane-free manifest's signature stays BYTE-IDENTICAL to before this
|
|
@@ -864,65 +1036,227 @@ function signatureForManifest(manifest, stagedDir) {
|
|
|
864
1036
|
// ---------------------------------------------------------------------------
|
|
865
1037
|
/** Max characters of an env VALUE shown in the human consent prompt before it is truncated. */
|
|
866
1038
|
const ENV_VALUE_MAX = 60;
|
|
1039
|
+
/**
|
|
1040
|
+
* Environment names that turn a declared pair into arbitrary code execution in a spawned child
|
|
1041
|
+
* (#2483). This list drives the consent prompt's WARNING line. The capability validator carries its
|
|
1042
|
+
* own denylist that REFUSES these names outright (`DENIED_LANE_ENV_KEYS`); the two are deliberately
|
|
1043
|
+
* separate layers rather than one, because they answer different questions: the validator refuses a
|
|
1044
|
+
* manifest it can reject, and this list makes sure anything that DOES reach a prompt is read loudly.
|
|
1045
|
+
* Neither is the boundary — install-time consent is, since no enumeration of execution-primitive
|
|
1046
|
+
* names can be complete against an arbitrary third-party child.
|
|
1047
|
+
*/
|
|
1048
|
+
const EXECUTION_PRIMITIVE_ENV = new Set([
|
|
1049
|
+
'NODE_OPTIONS', 'NODE_REPL_EXTERNAL_MODULE', 'LD_PRELOAD', 'LD_AUDIT', 'LD_LIBRARY_PATH',
|
|
1050
|
+
'DYLD_INSERT_LIBRARIES', 'DYLD_LIBRARY_PATH', 'PYTHONSTARTUP', 'PYTHONPATH', 'BASH_ENV', 'ENV',
|
|
1051
|
+
'PERL5OPT', 'RUBYOPT', 'JAVA_TOOL_OPTIONS', '_JAVA_OPTIONS', 'CLASSPATH', 'NODE_PATH',
|
|
1052
|
+
'GIT_SSH_COMMAND', 'GIT_EXTERNAL_DIFF', 'PATH',
|
|
1053
|
+
]);
|
|
867
1054
|
/** Truncate a long env value for the human prompt (the full value is still in the signature). */
|
|
868
1055
|
function truncateEnvValue(v) {
|
|
869
1056
|
if (typeof v !== 'string')
|
|
870
1057
|
return '';
|
|
871
1058
|
return v.length > ENV_VALUE_MAX ? `${v.slice(0, ENV_VALUE_MAX)}… (${v.length} chars)` : v;
|
|
872
1059
|
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Characters that must never reach the consent prompt unescaped. `summarizeDisclosure`'s lines are
|
|
1062
|
+
* joined with `\n` and written RAW to stderr on the needs-consent path, and every value in them is
|
|
1063
|
+
* attacker-controlled manifest data. A raw newline forges a line indistinguishable from genuine
|
|
1064
|
+
* disclosure text; a raw ESC lets a value rewrite or clear lines already printed; a bidi override
|
|
1065
|
+
* visually reorders one. C0, DEL, C1, the bidi/isolate controls, and the line/paragraph separators
|
|
1066
|
+
* are all escaped to a visible `\uXXXX`, so the value stays identifiable and cannot forge output.
|
|
1067
|
+
*/
|
|
1068
|
+
const UNSAFE_PROMPT_CHARS = /[\u0000-\u001f\u007f-\u009f\u200e\u200f\u2028\u2029\u202a-\u202e\u2066-\u2069]/g;
|
|
1069
|
+
/** Max characters of any single manifest-supplied value rendered into the consent prompt. */
|
|
1070
|
+
const PROMPT_VALUE_MAX = 200;
|
|
1071
|
+
/**
|
|
1072
|
+
* Render one manifest-supplied value safely into a consent-prompt line: escape every character that
|
|
1073
|
+
* could forge or rewrite output, then bound the length so one oversized value cannot flood the
|
|
1074
|
+
* prompt and push the rest off screen. Escaping is IDENTITY for ordinary names, so this changes no
|
|
1075
|
+
* existing rendered output for any well-formed manifest — only the disclosure OBJECT is verbatim;
|
|
1076
|
+
* the rendered LINE is always escaped.
|
|
1077
|
+
*/
|
|
1078
|
+
function renderValueForPrompt(v) {
|
|
1079
|
+
// `String(v)` on an arbitrary `unknown` risks Object's default `[object Object]` stringification
|
|
1080
|
+
// (@typescript-eslint/no-base-to-string) for a non-primitive; every call site here passes a string
|
|
1081
|
+
// in practice, but the parameter stays `unknown` for the same total-collector discipline as
|
|
1082
|
+
// `renderArgForHuman`, so a non-primitive is JSON-stringified instead of coerced.
|
|
1083
|
+
let s;
|
|
1084
|
+
if (typeof v === 'string') {
|
|
1085
|
+
s = v;
|
|
1086
|
+
}
|
|
1087
|
+
else if (v === null || v === undefined) {
|
|
1088
|
+
s = '';
|
|
1089
|
+
}
|
|
1090
|
+
else if (typeof v === 'number' || typeof v === 'boolean' || typeof v === 'bigint') {
|
|
1091
|
+
s = String(v);
|
|
1092
|
+
}
|
|
1093
|
+
else {
|
|
1094
|
+
try {
|
|
1095
|
+
s = JSON.stringify(v) ?? '';
|
|
1096
|
+
}
|
|
1097
|
+
catch {
|
|
1098
|
+
s = '';
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
const escaped = s.replace(UNSAFE_PROMPT_CHARS, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, '0')}`);
|
|
1102
|
+
return escaped.length > PROMPT_VALUE_MAX
|
|
1103
|
+
? `${escaped.slice(0, PROMPT_VALUE_MAX)}… (${escaped.length} chars)`
|
|
1104
|
+
: escaped;
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Render the instruction-surface section of a consent summary (ADR-2363 D3/D5, #3248).
|
|
1108
|
+
*
|
|
1109
|
+
* Extracted as its own exported function for two reasons. It is called from BOTH branches of
|
|
1110
|
+
* `summarizeDisclosure` — a skill-only capability has `hasExecutable === false` and takes the early
|
|
1111
|
+
* return, so a section appended only at the end would never render for exactly the capabilities
|
|
1112
|
+
* that need it. And it gives tests a typed surface to assert on, instead of regex-matching prose out
|
|
1113
|
+
* of `summarizeDisclosure` (CONTRIBUTING — "Prohibited: Raw Text Matching on Test Outputs").
|
|
1114
|
+
*
|
|
1115
|
+
* Returns `[]` when nothing is declared, so either caller can append unconditionally without
|
|
1116
|
+
* emitting an empty header.
|
|
1117
|
+
*
|
|
1118
|
+
* TOTAL for a partial disclosure object: the CLI edge calls `summarizeDisclosure(res.disclosure || {})`
|
|
1119
|
+
* (`capability-command-router.cjs`), so a bare `{}` — carrying no `instructionSurfaces` at all —
|
|
1120
|
+
* reaches this function whenever a lifecycle result has no disclosure.
|
|
1121
|
+
*
|
|
1122
|
+
* #3248: every manifest-supplied value rendered here (`kind`, `name`) goes through
|
|
1123
|
+
* `renderValueForPrompt` first — the CLI edge writes these lines RAW to stderr on the needs-consent
|
|
1124
|
+
* path, and an unescaped name could forge a line or rewrite output already printed (see that
|
|
1125
|
+
* function's comment).
|
|
1126
|
+
*/
|
|
1127
|
+
function summarizeInstructionSurfaces(disclosure) {
|
|
1128
|
+
const declared = disclosure?.instructionSurfaces;
|
|
1129
|
+
const surfaces = Array.isArray(declared) ? declared : [];
|
|
1130
|
+
if (surfaces.length === 0)
|
|
1131
|
+
return [];
|
|
1132
|
+
const lines = [
|
|
1133
|
+
` instruction surfaces (${surfaces.length}): installed into your agent's instruction context`,
|
|
1134
|
+
];
|
|
1135
|
+
for (const s of surfaces) {
|
|
1136
|
+
// #3248: kind/name are manifest-supplied — escape+bound before rendering (see `renderValueForPrompt`).
|
|
1137
|
+
const kind = s?.kind ? renderValueForPrompt(s.kind) : '(kind?)';
|
|
1138
|
+
const name = s?.name ? renderValueForPrompt(s.name) : '(name?)';
|
|
1139
|
+
lines.push(` - ${kind}: ${name}`);
|
|
1140
|
+
}
|
|
1141
|
+
// ADR-2363 D1/D2, and Kerckhoffs: say plainly that nothing inspected these bodies. A summary that
|
|
1142
|
+
// named the surface while implying review would be worse than silence — a "looks checked" line
|
|
1143
|
+
// displaces the judgement this prompt exists to provoke (Goodhart, D2).
|
|
1144
|
+
lines.push(' these bodies are installed verbatim and are NOT content-scanned');
|
|
1145
|
+
return lines;
|
|
1146
|
+
}
|
|
873
1147
|
/**
|
|
874
1148
|
* Render a disclosure as consent-prompt lines. Returned as an array so the CLI/runtime edge can
|
|
875
1149
|
* format it; the lib never writes to stdout.
|
|
1150
|
+
*
|
|
1151
|
+
* #3248: every manifest-supplied value interpolated into a line (hook event/script, command
|
|
1152
|
+
* family/module/router, MCP name/transport/url/command/argv/header-keys/env-keys+values/cwd,
|
|
1153
|
+
* reviewer-lane slug/hostConfigKey/resolvedHost/defaultHost/binary/rawArgs/handler/probe-binary/
|
|
1154
|
+
* env-keys+values, missingArtifacts entries)
|
|
1155
|
+
* goes through `renderValueForPrompt` first, which escapes forging/rewriting control characters and
|
|
1156
|
+
* bounds the length. These lines are joined with `\n` and written RAW to stderr on the
|
|
1157
|
+
* needs-consent path (`capability-command-router.cjs`), so an unescaped value could forge a line or
|
|
1158
|
+
* rewrite/clear output already printed — defeating the informed-consent guarantee this function
|
|
1159
|
+
* exists to provide. GSD-authored literals (fallback placeholders, headings, `<redacted>`) are never
|
|
1160
|
+
* escaped — only manifest-supplied data is.
|
|
1161
|
+
*/
|
|
1162
|
+
/**
|
|
1163
|
+
* #3515: one predicate for "this MCP server is remote (connects to a URL; nothing local is
|
|
1164
|
+
* spawned)" — shared by the section's confinement notice and the per-server rendering so the
|
|
1165
|
+
* consent-prompt claim cannot drift from what is actually disclosed per server. Branches on the
|
|
1166
|
+
* DECLARED SHAPE: an http/sse transport, or a server with no command but a url.
|
|
876
1167
|
*/
|
|
1168
|
+
function isRemoteMcpServer(s) {
|
|
1169
|
+
return (s.transport === 'http' || s.transport === 'sse') || (!s.command && !!s.url);
|
|
1170
|
+
}
|
|
877
1171
|
function summarizeDisclosure(disclosure) {
|
|
878
1172
|
const lines = [];
|
|
1173
|
+
const instructionLines = summarizeInstructionSurfaces(disclosure);
|
|
1174
|
+
// #3514 (F21c): computed once, appended before every return path so a future path cannot miss it.
|
|
1175
|
+
const integrity = integrityStatusLine(disclosure);
|
|
879
1176
|
if (!disclosure.hasExecutable) {
|
|
880
|
-
|
|
1177
|
+
// ADR-2363 D3: "declarative only" is true ONLY when there is no instruction surface either.
|
|
1178
|
+
// Claiming it unconditionally told a user their capability contributes nothing to weigh while
|
|
1179
|
+
// it was contributing agent instructions — the exact category error ADR-2363 was written to end.
|
|
1180
|
+
if (instructionLines.length === 0) {
|
|
1181
|
+
lines.push('This capability ships no executable surfaces (declarative only).');
|
|
1182
|
+
if (integrity)
|
|
1183
|
+
lines.push(integrity);
|
|
1184
|
+
return lines;
|
|
1185
|
+
}
|
|
1186
|
+
lines.push('This capability ships no executable surfaces, but contributes agent instructions:');
|
|
1187
|
+
for (const line of instructionLines)
|
|
1188
|
+
lines.push(line);
|
|
1189
|
+
if (integrity)
|
|
1190
|
+
lines.push(integrity);
|
|
881
1191
|
return lines;
|
|
882
1192
|
}
|
|
883
1193
|
lines.push('This capability ships executable surfaces that will run in your agent runtime:');
|
|
884
1194
|
if (disclosure.hooks.length > 0) {
|
|
885
1195
|
lines.push(` hooks (${disclosure.hooks.length}): run as runtime hook commands`);
|
|
886
1196
|
for (const h of disclosure.hooks) {
|
|
887
|
-
|
|
1197
|
+
const event = h.event ? renderValueForPrompt(h.event) : '(event?)';
|
|
1198
|
+
lines.push(` - ${event} -> ${renderValueForPrompt(h.script)}`);
|
|
888
1199
|
}
|
|
889
1200
|
}
|
|
890
1201
|
if (disclosure.commandModules.length > 0) {
|
|
891
1202
|
lines.push(` command modules (${disclosure.commandModules.length}): require()'d into the GSD CLI process`);
|
|
892
1203
|
for (const m of disclosure.commandModules) {
|
|
893
1204
|
// TRUST2-3 (#1459): show the router (which exported fn runs) so the user consents to the exact entry point.
|
|
894
|
-
const routerSuffix = m.router ? ` [router: ${m.router}]` : '';
|
|
895
|
-
|
|
1205
|
+
const routerSuffix = m.router ? ` [router: ${renderValueForPrompt(m.router)}]` : '';
|
|
1206
|
+
const family = m.family ? renderValueForPrompt(m.family) : '(family?)';
|
|
1207
|
+
lines.push(` - ${family} -> ${renderValueForPrompt(m.module)}${routerSuffix}`);
|
|
896
1208
|
}
|
|
897
1209
|
}
|
|
898
1210
|
if (disclosure.mcpServers.length > 0) {
|
|
899
1211
|
lines.push(` MCP servers (${disclosure.mcpServers.length}): spawned/connected by the host runtime`);
|
|
1212
|
+
// #3515 (epic #1900 F20): the confinement-posture notice. Hook commands are confined to the
|
|
1213
|
+
// capability bundle (D5 rule 5); an MCP server's command/args/env/cwd are written VERBATIM and
|
|
1214
|
+
// may point anywhere on the machine — an intentional asymmetry (confining them would break
|
|
1215
|
+
// global/npx servers), disclosed here so the consent is informed rather than assumed. env is
|
|
1216
|
+
// named explicitly (isolated review finding): an execution-primitive env value changes WHAT
|
|
1217
|
+
// runs without touching command or argv — the classic vector — and omitting it would invite
|
|
1218
|
+
// the inference that env IS confined. Only SPAWNED (stdio) servers earn the line: a remote
|
|
1219
|
+
// (http/sse) server runs nothing locally, and the claim must be exact in a consent prompt.
|
|
1220
|
+
// One shared predicate (below) decides spawn-vs-remote for the notice AND the per-server
|
|
1221
|
+
// rendering, so the two cannot drift into an inexact claim.
|
|
1222
|
+
if (disclosure.mcpServers.some((s) => !isRemoteMcpServer(s))) {
|
|
1223
|
+
lines.push(' intentionally NOT confined to the bundle: a server\'s command, args, env, and cwd are written ' +
|
|
1224
|
+
'verbatim and may point anywhere on this machine — unlike hooks, which are confined to the capability bundle root');
|
|
1225
|
+
}
|
|
900
1226
|
for (const s of disclosure.mcpServers) {
|
|
901
1227
|
// TRUST2-2 (#1459): a non-stdio (http/sse) server connects to a URL; disclose the endpoint, not
|
|
902
1228
|
// a (nonexistent) command. A stdio server discloses command + args as before.
|
|
903
|
-
const isRemote = (s
|
|
1229
|
+
const isRemote = isRemoteMcpServer(s);
|
|
1230
|
+
const name = renderValueForPrompt(s.name);
|
|
904
1231
|
if (isRemote) {
|
|
905
|
-
const t = s.transport
|
|
906
|
-
|
|
1232
|
+
const t = s.transport ? renderValueForPrompt(s.transport) : 'http';
|
|
1233
|
+
const url = s.url ? renderValueForPrompt(s.url) : '(no url declared)';
|
|
1234
|
+
lines.push(` - ${name} -> [${t}] ${url}`);
|
|
907
1235
|
// Header VALUES are redacted in the human summary (they may carry secrets); only the KEY set
|
|
908
1236
|
// is shown. The full values ARE in the signature, so a value change forces re-consent.
|
|
909
1237
|
const hdrKeys = s.headers ? Object.keys(s.headers) : [];
|
|
910
1238
|
if (hdrKeys.length > 0) {
|
|
911
|
-
lines.push(` headers: ${hdrKeys.map((k) => `${k}=<redacted>`).join(', ')}`);
|
|
1239
|
+
lines.push(` headers: ${hdrKeys.map((k) => `${renderValueForPrompt(k)}=<redacted>`).join(', ')}`);
|
|
912
1240
|
}
|
|
913
1241
|
}
|
|
914
1242
|
else {
|
|
915
|
-
|
|
916
|
-
|
|
1243
|
+
// Command + args are each escaped individually (not the joined string) so a value that
|
|
1244
|
+
// embeds a newline cannot forge a line even when it lands mid-argv.
|
|
1245
|
+
const cmd = [s.command, ...s.argv].filter(Boolean).map(renderValueForPrompt).join(' ');
|
|
1246
|
+
lines.push(` - ${name} -> ${cmd || '(no command declared)'}`);
|
|
917
1247
|
}
|
|
918
1248
|
// TRUST-2 (#1459): env can change WHAT runs without touching the command, so show each env key
|
|
919
|
-
// and its (truncated) value — the user is consenting to this exact environment.
|
|
1249
|
+
// and its (truncated) value — the user is consenting to this exact environment. Truncate first
|
|
1250
|
+
// (keeps the prompt readable at the existing 60-char bound), then escape the result (#3248) so
|
|
1251
|
+
// the truncated value can still not forge or rewrite output.
|
|
920
1252
|
const envKeys = s.env ? Object.keys(s.env) : [];
|
|
921
1253
|
if (envKeys.length > 0) {
|
|
922
|
-
lines.push(` env: ${envKeys
|
|
1254
|
+
lines.push(` env: ${envKeys
|
|
1255
|
+
.map((k) => `${renderValueForPrompt(k)}=${renderValueForPrompt(truncateEnvValue(s.env[k]))}`)
|
|
1256
|
+
.join(', ')}`);
|
|
923
1257
|
}
|
|
924
1258
|
if (s.cwd)
|
|
925
|
-
lines.push(` cwd: ${s.cwd}`);
|
|
1259
|
+
lines.push(` cwd: ${renderValueForPrompt(s.cwd)}`);
|
|
926
1260
|
}
|
|
927
1261
|
}
|
|
928
1262
|
if (disclosure.reviewerLanes.length > 0) {
|
|
@@ -937,44 +1271,129 @@ function summarizeDisclosure(disclosure) {
|
|
|
937
1271
|
// declared)" for a lane that in fact egresses to a live remote host —
|
|
938
1272
|
// understating the disclosure precisely when it matters. Disclosure runs
|
|
939
1273
|
// BEFORE validation, so a non-canonical transport does reach this code.
|
|
1274
|
+
const slug = l.slug ? renderValueForPrompt(l.slug) : '(slug?)';
|
|
940
1275
|
if (l.transport === 'openai-http' || (!l.binary && l.hostConfigKey)) {
|
|
941
1276
|
const localTag = l.isLocalDestination ? ' [local]' : '';
|
|
942
|
-
|
|
1277
|
+
const hostConfigKey = l.hostConfigKey ? renderValueForPrompt(l.hostConfigKey) : '(hostConfigKey?)';
|
|
1278
|
+
lines.push(` - ${slug} -> [openai-http] ${hostConfigKey} => ${renderValueForPrompt(l.resolvedHost)}${localTag}`);
|
|
1279
|
+
// #2483: the MANIFEST's own fallback host, which `resolveLanePlan` uses whenever the config
|
|
1280
|
+
// key resolves to nothing (`configured ?? declaredDefault`). Without this line a lane whose
|
|
1281
|
+
// key is unset renders as "(unresolved)" — which reads as "no destination" — while actually
|
|
1282
|
+
// shipping the egress payload classes below to an address the manifest chose. That is the
|
|
1283
|
+
// understating-the-disclosure failure the branch test one comment up already refuses.
|
|
1284
|
+
// Escaped like every other rendered value (#3248): it is manifest-supplied by the same route.
|
|
1285
|
+
if (l.defaultHost) {
|
|
1286
|
+
lines.push(` fallback destination declared by this capability: ${renderValueForPrompt(l.defaultHost)}`);
|
|
1287
|
+
}
|
|
943
1288
|
}
|
|
944
1289
|
else {
|
|
945
1290
|
// Render the RAW declared args, not the string-filtered view. The raw
|
|
946
1291
|
// array is what the host receives and what the consent signature binds,
|
|
947
1292
|
// so a non-string member that is invisible here is a surface the user
|
|
948
1293
|
// consented to without being shown — the opposite of the disclosure's
|
|
949
|
-
// whole purpose.
|
|
950
|
-
|
|
951
|
-
|
|
1294
|
+
// whole purpose. `renderArgForHuman` stringifies a non-string member; that
|
|
1295
|
+
// string is equally attacker-controlled, so it is escaped too (#3248).
|
|
1296
|
+
const cmd = [l.binary, ...l.rawArgs.map(renderArgForHuman)]
|
|
1297
|
+
.filter(Boolean)
|
|
1298
|
+
.map(renderValueForPrompt)
|
|
1299
|
+
.join(' ');
|
|
1300
|
+
lines.push(` - ${slug} -> ${cmd || '(no binary declared)'}`);
|
|
952
1301
|
}
|
|
953
1302
|
if (l.handler)
|
|
954
|
-
lines.push(` handler: ${l.handler}`);
|
|
1303
|
+
lines.push(` handler: ${renderValueForPrompt(l.handler)}`);
|
|
1304
|
+
// The probe binary belongs in the prompt beside the dispatch binary when it differs — but the
|
|
1305
|
+
// two probe kinds are NOT the same disclosure and must not be rendered as one.
|
|
1306
|
+
// `command-capability` SPAWNS `<binary> --help`; `command-exists` only asks `hasBinary`, which
|
|
1307
|
+
// scans PATH and spawns nothing. An earlier revision of this line asserted the spawn for both,
|
|
1308
|
+
// which is a FALSE statement in a consent prompt — the one place a claim must be exact.
|
|
1309
|
+
if (l.probeBinary && l.probeBinary !== l.binary) {
|
|
1310
|
+
const probeBinary = renderValueForPrompt(l.probeBinary);
|
|
1311
|
+
lines.push(l.probeKind === 'command-capability'
|
|
1312
|
+
? ` probes by running: ${probeBinary} --help`
|
|
1313
|
+
: ` probes for the presence of: ${probeBinary} (no process is started)`);
|
|
1314
|
+
}
|
|
1315
|
+
// #2483: identical treatment to the MCP `env` line above, for the identical reason stated
|
|
1316
|
+
// there — env changes WHAT runs without touching the command, so the user consents to this
|
|
1317
|
+
// exact environment or not at all. The parity is byte-level and deliberate: since #3248 the
|
|
1318
|
+
// MCP line escapes BOTH key and value through `renderValueForPrompt`, and a lane's env is
|
|
1319
|
+
// manifest-supplied by the same route — so rendering it raw here would reintroduce, on the
|
|
1320
|
+
// newer surface, precisely the prompt-forging vector #3248 closed on the older one.
|
|
1321
|
+
const laneEnvKeys = l.env ? Object.keys(l.env) : [];
|
|
1322
|
+
if (laneEnvKeys.length > 0) {
|
|
1323
|
+
lines.push(` env: ${laneEnvKeys
|
|
1324
|
+
.map((k) => `${renderValueForPrompt(k)}=${renderValueForPrompt(truncateEnvValue(l.env[k]))}`)
|
|
1325
|
+
.join(', ')}`);
|
|
1326
|
+
// Names that make an environment pair an EXECUTION primitive rather than configuration.
|
|
1327
|
+
// The validator REFUSES these on a reviewer lane (`DENIED_LANE_ENV_KEYS`), so in practice a
|
|
1328
|
+
// first-party or freshly-validated manifest never reaches this line. It still earns its
|
|
1329
|
+
// place, and the reason is the reason to keep both layers:
|
|
1330
|
+
// - Disclosure runs BEFORE validation, and on manifests validation would reject outright.
|
|
1331
|
+
// A user consenting to an already-installed or hand-placed capability sees this line
|
|
1332
|
+
// whether or not the validator ever ran on it.
|
|
1333
|
+
// - No enumeration of execution-primitive names is complete against an arbitrary
|
|
1334
|
+
// third-party child, so consent — not either list — is the boundary. A name missing from
|
|
1335
|
+
// both costs a quieter line on a value that is still SHOWN, which is the only
|
|
1336
|
+
// incompleteness budget an enumeration like this can honestly carry.
|
|
1337
|
+
const flagged = laneEnvKeys.filter((k) => EXECUTION_PRIMITIVE_ENV.has(k));
|
|
1338
|
+
if (flagged.length > 0) {
|
|
1339
|
+
lines.push(` WARNING — ${flagged.map(renderValueForPrompt).join(', ')} can make this lane run code of the capability's choosing`);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
955
1342
|
lines.push(` sends: ${l.egressPayloadClasses.join(', ')}`);
|
|
956
1343
|
}
|
|
957
1344
|
}
|
|
1345
|
+
for (const line of instructionLines)
|
|
1346
|
+
lines.push(line);
|
|
958
1347
|
if (disclosure.missingArtifacts.length > 0) {
|
|
959
1348
|
lines.push(' WARNING — declared artifacts not found in the staged bundle:');
|
|
960
1349
|
for (const a of disclosure.missingArtifacts) {
|
|
961
|
-
lines.push(` - ${a}`);
|
|
1350
|
+
lines.push(` - ${renderValueForPrompt(a)}`);
|
|
962
1351
|
}
|
|
963
1352
|
}
|
|
1353
|
+
if (integrity)
|
|
1354
|
+
lines.push(integrity);
|
|
964
1355
|
return lines;
|
|
965
1356
|
}
|
|
1357
|
+
/**
|
|
1358
|
+
* #3514 (F21c): the one-line integrity status for the consent prompt, or null when the caller
|
|
1359
|
+
* supplied no `integrityPin` (legacy — no line, byte-identical output). GSD-authored literals,
|
|
1360
|
+
* never manifest data — no escaping needed. A consent-prompt claim must be EXACT: a git
|
|
1361
|
+
* commit-pinned source renders its own line, never "sha512 pin" — no sha512 was supplied
|
|
1362
|
+
* (isolated review finding).
|
|
1363
|
+
*/
|
|
1364
|
+
function integrityStatusLine(disclosure) {
|
|
1365
|
+
if (disclosure.integrityStatus === 'pinned') {
|
|
1366
|
+
return ' content: sha512 pin supplied and verified before staging';
|
|
1367
|
+
}
|
|
1368
|
+
if (disclosure.integrityStatus === 'commit-pinned') {
|
|
1369
|
+
return ' content: pinned to a git commit, checked out before staging';
|
|
1370
|
+
}
|
|
1371
|
+
if (disclosure.integrityStatus === 'unverified') {
|
|
1372
|
+
return ' content: NO PINNED HASH — staged unverified (a computed sha512 is recorded in the ledger at install)';
|
|
1373
|
+
}
|
|
1374
|
+
return null;
|
|
1375
|
+
}
|
|
966
1376
|
module.exports = {
|
|
967
1377
|
RESERVED_NAMESPACES,
|
|
968
1378
|
discloseExecutableSurfaces,
|
|
969
1379
|
// #2796: the reviewer-lane collector, exported for independent testability (ADR-2782's own
|
|
970
1380
|
// argument for extracting per-class collectors rather than growing the switch inline).
|
|
971
1381
|
collectReviewerLaneSurfaces,
|
|
1382
|
+
// ADR-2363 D5 (#3248): the instruction-surface collector, exported for independent testability —
|
|
1383
|
+
// same rationale as `collectReviewerLaneSurfaces` above.
|
|
1384
|
+
collectInstructionSurfaces,
|
|
972
1385
|
checkReservedNamespace,
|
|
973
1386
|
evaluateSourceAllowed,
|
|
974
1387
|
checkEngines,
|
|
975
1388
|
evaluateInstallTrust,
|
|
976
1389
|
executableSetChanged,
|
|
977
1390
|
summarizeDisclosure,
|
|
1391
|
+
// ADR-2363 D3/D5 (#3248): the instruction-surface section of the consent summary, exported so
|
|
1392
|
+
// callers/tests can assert on it directly — see `summarizeInstructionSurfaces`'s own JSDoc.
|
|
1393
|
+
summarizeInstructionSurfaces,
|
|
1394
|
+
// #3248: the consent-prompt escaping/bounding helper, exported so tests can assert directly that
|
|
1395
|
+
// control characters (newline, ESC, bidi overrides, etc.) never reach a rendered prompt line.
|
|
1396
|
+
renderValueForPrompt,
|
|
978
1397
|
// #1459: the consent-binding signature (single source of truth for loader + lifecycle consent).
|
|
979
1398
|
disclosureSignature,
|
|
980
1399
|
signatureForManifest,
|