gentle-pi 4.5.1 → 4.7.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/README.md +17 -15
- package/assets/agents/gentle-ai-explore.md +1 -0
- package/assets/agents/gentle-ai-verify.md +8 -1
- package/assets/agents/gentle-ai-worker.md +4 -0
- package/assets/agents/jd-fix-agent.md +1 -0
- package/assets/agents/jd-judge-a.md +1 -0
- package/assets/agents/jd-judge-b.md +1 -0
- package/assets/design-canvas/canvas.css +13 -1
- package/assets/design-canvas/canvas.js +11 -2
- package/assets/install-wizard/wizard.js +1 -0
- package/assets/migrations/agent-body-history.json +162 -0
- package/assets/orchestrator-delegation-reference.md +7 -7
- package/assets/orchestrator-delegation.md +3 -3
- package/assets/orchestrator-full-delegation-card.md +65 -0
- package/assets/orchestrator-full-delegation.md +34 -0
- package/assets/orchestrator-memory.md +3 -3
- package/assets/orchestrator-prompts.md +1 -1
- package/assets/orchestrator-skills.md +1 -1
- package/assets/orchestrator-verification.md +14 -8
- package/assets/orchestrator.md +11 -11
- package/bin/gentle-shell.mjs +225 -82
- package/docs/agent-status.md +61 -0
- package/docs/bundled-install.md +7 -5
- package/docs/ci-performance.md +11 -0
- package/docs/delegated-verification.md +35 -7
- package/docs/fast-mode.md +15 -0
- package/docs/gentle-agents-activity.md +22 -0
- package/docs/gentle-shell.md +113 -25
- package/docs/install-wizard.md +2 -2
- package/docs/mcp-status.md +52 -0
- package/docs/permission-modes.md +9 -4
- package/docs/prompt-budget.md +28 -0
- package/docs/readme-reference.md +154 -50
- package/docs/render-cache-performance.md +11 -1
- package/docs/review-coordinator.md +33 -0
- package/docs/review-request-context.md +19 -0
- package/docs/review-windows-acl.md +18 -0
- package/docs/session-profile-format.md +20 -5
- package/docs/sound-notifications.md +1 -1
- package/docs/star-prompt.md +32 -0
- package/docs/voice.md +6 -3
- package/docs/work-continuity.md +46 -0
- package/docs/yolo-mode.md +5 -5
- package/extensions/ask-user-choice.ts +1 -0
- package/extensions/ask-user-question.ts +2 -0
- package/extensions/child-safety.ts +3 -0
- package/extensions/codegraph-tools.ts +38 -4
- package/extensions/gentle-agent-status.ts +99 -0
- package/extensions/gentle-agents.ts +803 -84
- package/extensions/gentle-ai.ts +2491 -596
- package/extensions/gentle-fast.ts +61 -0
- package/extensions/gentle-guide.ts +174 -0
- package/extensions/gentle-herdr-activity.ts +21 -1
- package/extensions/gentle-herdr-agent.ts +144 -0
- package/extensions/gentle-program-identity.ts +61 -0
- package/extensions/gentle-shell.ts +895 -120
- package/extensions/gentle-star-prompt.ts +334 -0
- package/extensions/gentle-stats.ts +5 -5
- package/extensions/gentle-todo.ts +59 -23
- package/extensions/gentle-tps.ts +48 -0
- package/extensions/history/store.ts +18 -12
- package/extensions/quiet-tools.ts +38 -8
- package/extensions/skill-registry.ts +210 -21
- package/extensions/startup-banner.ts +69 -10
- package/lib/agent-assets.ts +74 -17
- package/lib/agent-profile-pin.ts +3 -3
- package/lib/agent-profiles.ts +161 -3
- package/lib/agent-status.ts +105 -0
- package/lib/agents-config.ts +58 -3
- package/lib/agents-history.ts +24 -5
- package/lib/agents-keys.ts +8 -16
- package/lib/agents-messaging.ts +47 -5
- package/lib/agents-protocol.ts +80 -4
- package/lib/agents-runner.ts +287 -15
- package/lib/agents-view.ts +6 -1
- package/lib/agents-widget.ts +132 -9
- package/lib/auto-permission-runtime.ts +1 -1
- package/lib/bounded-writer-admission.ts +13 -1
- package/lib/bridge-cost.ts +28 -0
- package/lib/card-content-policy.ts +8 -6
- package/lib/codemode-renderer.ts +16 -0
- package/lib/command-palette-catalog.ts +1 -0
- package/lib/command-palette.ts +154 -25
- package/lib/context-backstop.ts +14 -5
- package/lib/destructive-command-guard.ts +48 -4
- package/lib/execution-surface-guard.ts +20 -0
- package/lib/exploration-budget.ts +64 -0
- package/lib/gentle-ai-binary.ts +1 -1
- package/lib/gentle-design.ts +3 -0
- package/lib/gentle-guide.ts +201 -0
- package/lib/gentle-shell-bundled.ts +6 -19
- package/lib/gentle-shell-launcher.ts +47 -8
- package/lib/herdr-activity.ts +23 -5
- package/lib/herdr-busy.ts +45 -0
- package/lib/herdr-task-summary-policy.ts +85 -0
- package/lib/image-attachments.ts +33 -0
- package/lib/image-disk-cache.ts +137 -0
- package/lib/inprocess-reviewer.ts +282 -132
- package/lib/jobs-sidebar-state.ts +5 -6
- package/lib/jobs-view.ts +198 -11
- package/lib/jobs-widget.ts +16 -52
- package/lib/keymaps-customize.ts +81 -0
- package/lib/keymaps.ts +291 -0
- package/lib/model-fallback-notice.ts +61 -0
- package/lib/model-fallback-policy.ts +141 -0
- package/lib/model-fallback-store.ts +143 -0
- package/lib/model-routing-authority.ts +32 -6
- package/lib/nan-provider.ts +3 -2
- package/lib/native-choice-list.ts +20 -2
- package/lib/native-review-cli.ts +103 -21
- package/lib/notification-customize.ts +48 -51
- package/lib/openai-fast-tier.ts +22 -0
- package/lib/orchestrator-discovery.ts +5 -1
- package/lib/orchestrator-fallback.ts +75 -0
- package/lib/orchestrator-mode-policy.ts +105 -0
- package/lib/pasted-image-paths.ts +113 -0
- package/lib/questionnaire/questionnaire-view.ts +225 -18
- package/lib/rdd-mode-control.ts +32 -0
- package/lib/reply-language-anchor.ts +104 -0
- package/lib/review-blocker.ts +92 -0
- package/lib/review-candidate-symlink-scan.ts +136 -0
- package/lib/review-candidate-view-owner.ts +85 -44
- package/lib/review-candidate-view.ts +10 -7
- package/lib/review-continuation-registry.ts +99 -0
- package/lib/review-coordinator.ts +163 -0
- package/lib/review-failure-facts.ts +49 -0
- package/lib/review-host-relay.ts +51 -11
- package/lib/review-integration-v2.ts +29 -8
- package/lib/review-relay-phase-timing.ts +45 -0
- package/lib/review-repository.ts +5 -0
- package/lib/review-start-context.ts +17 -0
- package/lib/session-profile-append-controller.ts +21 -6
- package/lib/session-profile-authority.ts +119 -0
- package/lib/session-profile-binding.ts +54 -5
- package/lib/session-profile-freeze.ts +107 -9
- package/lib/session-profile-integration.ts +313 -0
- package/lib/session-profile-persistence.ts +63 -9
- package/lib/shell-bar.ts +269 -72
- package/lib/shell-card.ts +26 -6
- package/lib/shell-changes.ts +2 -0
- package/lib/shell-page.ts +120 -0
- package/lib/shell-panel.ts +163 -0
- package/lib/shell-prompt.ts +53 -1
- package/lib/shell-sidebar-layout.ts +198 -53
- package/lib/shell-sidebar.ts +61 -1
- package/lib/shell-stats.ts +123 -0
- package/lib/shell-todo.ts +79 -1
- package/lib/shell-usage.ts +12 -2
- package/lib/star-prompt.ts +197 -0
- package/lib/verifier-admission.ts +18 -8
- package/lib/verifier-settle-reminder.ts +64 -0
- package/lib/vim-editor-adapter.ts +6 -1
- package/lib/visual-customization-policy.ts +67 -12
- package/lib/visual-customize-view.ts +373 -40
- package/lib/visual-layout-preview.ts +47 -0
- package/lib/visual-profiles.ts +2 -2
- package/lib/windows-session-transport.ts +53 -2
- package/lib/yolo-session-policy.ts +68 -16
- package/package.json +2 -1
- package/runtime/gentle-ai-binary.mjs +1 -1
- package/runtime/gentle-shell-bundled.mjs +6 -19
- package/runtime/gentle-shell-launcher.mjs +46 -7
- package/runtime/native-review-cli.mjs +100 -18
- package/runtime/review-integration-v2.mjs +29 -8
- package/runtime/windows-session-transport.ps1 +60 -3
- package/scripts/bootstrap.sh +4 -1
- package/scripts/build-full-delegation-card.mjs +175 -0
- package/scripts/bundled-install.mjs +38 -8
- package/scripts/download-progress.mjs +68 -0
- package/scripts/gentle-ai-installer.mjs +41 -18
- package/scripts/gentle-ai-proxy.mjs +294 -0
- package/scripts/install-gentle-ai.mjs +14 -1
- package/scripts/installer-preflight.mjs +6 -6
- package/scripts/installer-runner.mjs +27 -12
- package/scripts/installer-server.mjs +8 -7
- package/scripts/pi-update.mjs +113 -3
- package/scripts/render-cache-host.mjs +72 -0
- package/scripts/render-cache-performance-worker.mjs +5 -4
- package/scripts/render-cache-performance.mjs +6 -1
- package/scripts/run-test-suite.mjs +41 -13
- package/scripts/shell-snapshot.mjs +340 -0
- package/scripts/test-packed-runner.mjs +1 -1
- package/scripts/update-agent-body-history.mjs +41 -0
- package/scripts/verify-installer-tap.mjs +45 -0
- package/scripts/verify-package-files.mjs +14 -2
- package/scripts/voice-worker.cjs +32 -6
- package/skills/design/SKILL.md +11 -8
- package/skills/gentle-ai/SKILL.md +4 -4
- package/skills/gentle-ui-design/SKILL.md +46 -0
- package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
- package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
- package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
- package/skills/gentle-ui-design/references/task-and-content.md +60 -0
- package/skills/skill-registry/SKILL.md +4 -2
- package/skills/tui-design/NOTICE.md +5 -0
- package/skills/tui-design/SKILL.md +56 -0
- package/skills/tui-design/references/commands.md +75 -0
- package/skills/tui-design/references/critique.md +48 -0
- package/skills/tui-design/references/design-doc.md +44 -0
- package/skills/tui-design/references/terminal-craft.md +64 -0
- package/skills/tui-design/references/visual-loop.md +32 -0
- package/skills/work-unit-commits/SKILL.md +6 -7
- package/tests/agent-home.test.ts +28 -9
- package/tests/agent-profiles-workflow.test.ts +163 -0
- package/tests/agent-risk-escalation.test.ts +1 -1
- package/tests/agent-status.test.ts +143 -0
- package/tests/agents-config.test.ts +96 -0
- package/tests/agents-history.test.ts +31 -0
- package/tests/agents-jobs-frames.test.ts +93 -0
- package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
- package/tests/agents-protocol.test.ts +53 -1
- package/tests/agents-runner-drain.test.ts +193 -0
- package/tests/agents-runner.test.ts +345 -4
- package/tests/agents-view.test.ts +27 -0
- package/tests/agents-widget.test.ts +312 -10
- package/tests/append-system-prompt-route.test.ts +4 -1
- package/tests/ask-user-choice.test.ts +4 -3
- package/tests/ask-user-question.test.ts +97 -0
- package/tests/auto-permission-runtime.test.ts +1 -1
- package/tests/autonomous-guard.test.ts +346 -10
- package/tests/bounded-scan-contract.test.ts +39 -0
- package/tests/bounded-stop-contract.test.ts +43 -3
- package/tests/bridge-cost.test.ts +47 -0
- package/tests/bundled-install.test.ts +36 -9
- package/tests/card-content-policy.test.ts +3 -3
- package/tests/chained-pr-skill.test.ts +8 -6
- package/tests/child-safety.test.ts +11 -0
- package/tests/ci-concurrency.test.ts +11 -0
- package/tests/ci-merge-base-identity.test.ts +114 -0
- package/tests/codegraph-tools.test.ts +80 -5
- package/tests/codemode-rendering.test.ts +22 -2
- package/tests/command-palette.test.ts +300 -3
- package/tests/commit-slice-signal.test.ts +11 -9
- package/tests/delegate-for-reason-contract.test.ts +8 -7
- package/tests/design-canvas-assets.test.ts +185 -2
- package/tests/destructive-command-guard.test.ts +52 -0
- package/tests/download-progress.test.ts +71 -0
- package/tests/execution-surface-guard.test.ts +55 -0
- package/tests/exploration-budget.test.ts +128 -0
- package/tests/fixtures/agent-assets/gentle-ai-worker.strict-tdd-era.md +122 -0
- package/tests/fixtures/measure-orchestrator-prompt.mjs +2 -1
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +26 -14
- package/tests/fixtures/proxy-tls/proxy.crt +19 -0
- package/tests/fixtures/proxy-tls/proxy.key +28 -0
- package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
- package/tests/fixtures/session-profile-v1/replay.ts +172 -0
- package/tests/fixtures/session-profile-v1/session-profile-authority.ts +113 -0
- package/tests/fixtures/session-profile-v1/session-profile-binding.ts +83 -0
- package/tests/fixtures/session-profile-v1/session-profile-disk-reader.ts +182 -0
- package/tests/fixtures/session-profile-v1/session-profile-freeze.ts +290 -0
- package/tests/fixtures/session-profile-v1/session-profile-persistence.ts +195 -0
- package/tests/fixtures/session-profile-v1/v1-inputs.ts +16 -0
- package/tests/fixtures/windows-pipe-availability.ps1 +26 -0
- package/tests/fixtures/windows-session-bootstrap.ps1 +6 -2
- package/tests/full-delegation-closure.test.ts +131 -0
- package/tests/full-delegation-notices.test.ts +76 -0
- package/tests/generic-agent-tools.test.ts +3 -3
- package/tests/gentle-agent-status.test.ts +74 -0
- package/tests/gentle-agents-child-jobs.test.ts +237 -0
- package/tests/gentle-agents.test.ts +1491 -38
- package/tests/gentle-ai-binary.test.ts +3 -1
- package/tests/gentle-ai-elapsed-store.test.ts +19 -0
- package/tests/gentle-ai-exploration-budget.test.ts +151 -0
- package/tests/gentle-ai-installer.test.ts +134 -51
- package/tests/gentle-ai-proxy.test.ts +434 -0
- package/tests/gentle-ai.test.ts +1101 -52
- package/tests/gentle-design.test.ts +21 -0
- package/tests/gentle-fast.test.ts +73 -0
- package/tests/gentle-guide.test.ts +208 -0
- package/tests/gentle-herdr-activity.test.ts +80 -3
- package/tests/gentle-herdr-agent.test.ts +111 -0
- package/tests/gentle-program-identity.test.ts +197 -0
- package/tests/gentle-shell-bin.test.ts +172 -26
- package/tests/gentle-shell-bundled.test.ts +207 -31
- package/tests/gentle-shell-launcher.test.ts +93 -10
- package/tests/gentle-shell.test.ts +1937 -66
- package/tests/gentle-stats.test.ts +15 -2
- package/tests/gentle-todo.test.ts +67 -4
- package/tests/gentle-tps.test.ts +123 -0
- package/tests/gentle-ui-design-skill.test.ts +59 -0
- package/tests/herdr-busy.test.ts +59 -0
- package/tests/herdr-task-summary-policy.test.ts +132 -0
- package/tests/history-store-private-mode.test.ts +40 -0
- package/tests/image-disk-cache.test.ts +163 -0
- package/tests/image-paste-chips.test.ts +42 -0
- package/tests/independent-recovery-delivery.test.ts +83 -0
- package/tests/inprocess-reviewer.test.ts +298 -4
- package/tests/installer-posix-bootstrap.test.ts +68 -6
- package/tests/installer-preflight.test.ts +5 -4
- package/tests/installer-runner.test.ts +79 -44
- package/tests/installer-server.test.ts +14 -11
- package/tests/installer-windows-diagnostics.test.ts +4 -5
- package/tests/isolated-config-home.ts +28 -0
- package/tests/jobs-view.test.ts +260 -6
- package/tests/jobs-widget.test.ts +25 -37
- package/tests/keymaps-customize.test.ts +114 -0
- package/tests/keymaps.test.ts +103 -0
- package/tests/maintainer/mcp-status.maintest.ts +88 -0
- package/tests/maintainer/pi-update-source.maintest.ts +116 -0
- package/tests/modal-mouse-boundaries.test.ts +136 -0
- package/tests/model-fallback-notice.test.ts +45 -0
- package/tests/model-fallback-policy.test.ts +83 -0
- package/tests/model-fallback-store.test.ts +111 -0
- package/tests/model-routing-authority.test.ts +178 -2
- package/tests/nan-provider.test.ts +4 -4
- package/tests/native-choice-list.test.ts +77 -2
- package/tests/native-review-capability-contract.test.ts +7 -1
- package/tests/native-review-cli.test.ts +269 -1
- package/tests/no-self-pause-contract.test.ts +22 -0
- package/tests/notification-customize.test.ts +58 -34
- package/tests/odd-routing-canonical-ratchet.test.ts +6 -6
- package/tests/odd-routing-contract.test.ts +1 -1
- package/tests/orchestrator-budget.test.ts +7 -2
- package/tests/orchestrator-delegation-mode.test.ts +153 -0
- package/tests/orchestrator-fallback.test.ts +82 -0
- package/tests/orchestrator-mode-policy.test.ts +175 -0
- package/tests/orchestrator-prompt-budget.test.ts +133 -0
- package/tests/orchestrator-rdd-ownership.test.ts +2 -2
- package/tests/package-manifest.test.ts +169 -14
- package/tests/pasted-image-paths.test.ts +118 -0
- package/tests/permission-allowlist.test.ts +202 -0
- package/tests/persona-reply-language.test.ts +20 -1
- package/tests/pi-update-launcher.test.ts +40 -8
- package/tests/pi-update-source.test.ts +162 -0
- package/tests/pnpm-workspace-config.test.ts +58 -0
- package/tests/primary-session-prompt.test.ts +13 -0
- package/tests/profile-fast-tier.test.ts +311 -0
- package/tests/profile-pin.test.ts +29 -2
- package/tests/profile-tier-footer.test.ts +84 -0
- package/tests/profiles-panel-delegation-mode.test.ts +422 -0
- package/tests/questionnaire-view.test.ts +265 -0
- package/tests/quiet-bash-runtime.test.ts +1 -1
- package/tests/quiet-tool-rendering.test.ts +48 -0
- package/tests/rdd-aware-verification-contract.test.ts +16 -11
- package/tests/rdd-customize.test.ts +287 -0
- package/tests/rdd-mode-cache.test.ts +450 -0
- package/tests/rdd-mode-control.test.ts +407 -0
- package/tests/rdd-mode-scope-regression.test.ts +137 -0
- package/tests/rdd-off-independent-regression.test.ts +69 -0
- package/tests/rdd-status-line.test.ts +18 -0
- package/tests/render-cache-performance.test.ts +171 -2
- package/tests/reply-language-anchor.test.ts +173 -0
- package/tests/review-agent-end-preflight.test.ts +1 -1
- package/tests/review-blocker.test.ts +193 -0
- package/tests/review-candidate-owner-retry.test.ts +1 -1
- package/tests/review-candidate-owner-sweep.test.ts +93 -0
- package/tests/review-candidate-symlink-scan.test.ts +157 -0
- package/tests/review-candidate-view.test.ts +52 -1
- package/tests/review-candidate-windows-boundary.test.ts +131 -0
- package/tests/review-candidate-windows-probe.test.ts +63 -0
- package/tests/review-committed-restart-ack.test.ts +129 -0
- package/tests/review-continuation-registry.test.ts +76 -0
- package/tests/review-controller-native-routing.test.ts +381 -11
- package/tests/review-controller-workspace-root.test.ts +230 -3
- package/tests/review-controller.test.ts +96 -11
- package/tests/review-coordinator-runtime.test.ts +117 -0
- package/tests/review-coordinator.test.ts +195 -0
- package/tests/review-failure-facts.test.ts +87 -0
- package/tests/review-gate.test.ts +24 -0
- package/tests/review-host-relay-routing.test.ts +258 -4
- package/tests/review-host-relay.test.ts +39 -0
- package/tests/review-inspect-preflight.test.ts +197 -0
- package/tests/review-integration-v2-forward.test.ts +59 -0
- package/tests/review-integration-v2.test.ts +46 -3
- package/tests/review-json-arguments.test.ts +65 -10
- package/tests/review-last-event-closure.test.ts +68 -0
- package/tests/review-loadout-rdd-off-sdk.test.ts +65 -31
- package/tests/review-owner-identity.test.ts +60 -24
- package/tests/review-relay-phase-timing.test.ts +128 -0
- package/tests/review-relay-transport-agent.test.ts +12 -2
- package/tests/review-repository.test.ts +52 -1
- package/tests/review-reviewer-evidence.test.ts +183 -0
- package/tests/review-risk-assessment.test.ts +74 -3
- package/tests/review-session-standing-permission-controller.test.ts +21 -1
- package/tests/review-sidebar-state.test.ts +5 -5
- package/tests/review-start-context.test.ts +19 -0
- package/tests/review-tool-prose-budget.test.ts +121 -0
- package/tests/run-test-suite.test.ts +183 -6
- package/tests/runtime-harness.mjs +4 -1
- package/tests/sensitive-path-tools.test.ts +250 -0
- package/tests/session-profile-append-controller-pi.test.ts +60 -31
- package/tests/session-profile-append-controller.test.ts +63 -0
- package/tests/session-profile-authority.test.ts +259 -0
- package/tests/session-profile-binding.test.ts +34 -1
- package/tests/session-profile-disk-reader-pi.test.ts +58 -16
- package/tests/session-profile-extension.test.ts +615 -0
- package/tests/session-profile-freeze.test.ts +110 -2
- package/tests/session-profile-integration.test.ts +857 -0
- package/tests/session-profile-persistence.test.ts +57 -0
- package/tests/session-profile-v1-compat.test.ts +255 -0
- package/tests/shell-bar.test.ts +274 -72
- package/tests/shell-card.test.ts +13 -1
- package/tests/shell-page.test.ts +108 -0
- package/tests/shell-panel.test.ts +360 -0
- package/tests/shell-prompt.test.ts +54 -0
- package/tests/shell-render-cache.test.ts +5 -0
- package/tests/shell-sidebar-fullscreen.test.ts +13 -1
- package/tests/shell-sidebar-layout.test.ts +447 -44
- package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
- package/tests/shell-stats.test.ts +90 -0
- package/tests/shell-surface-transparent.test.ts +89 -0
- package/tests/shell-todo.test.ts +12 -0
- package/tests/shell-usage.test.ts +14 -0
- package/tests/skill-registry.test.ts +902 -2
- package/tests/star-prompt.test.ts +470 -0
- package/tests/startup-banner.test.ts +209 -2
- package/tests/startup-home-repo.test.ts +2 -0
- package/tests/support/review-coordinator-runtime.ts +69 -0
- package/tests/task-size-routing-contract.test.ts +50 -4
- package/tests/verifier-admission.test.ts +49 -0
- package/tests/verifier-settle-reminder.test.ts +281 -0
- package/tests/verify-first-launch-contract.test.ts +134 -8
- package/tests/verify-installer-tap.test.ts +57 -0
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/visual-customization-policy.test.ts +95 -8
- package/tests/visual-customize-view.test.ts +818 -9
- package/tests/visual-layout-preview.test.ts +42 -0
- package/tests/visual-profiles.test.ts +11 -0
- package/tests/voice-worker.test.ts +73 -2
- package/tests/windows-session-bootstrap.test.ts +105 -2
- package/tests/windows-session-transport.test.ts +126 -0
- package/tests/work-continuity-contract.test.ts +114 -0
- package/tests/writer-feature-document-admission.test.ts +92 -0
- package/tests/writer-surfaces.test.ts +12 -10
- package/tests/yolo-customize.test.ts +57 -15
- package/tests/yolo-mode-runtime.test.ts +4 -2
- package/tests/yolo-mode.test.ts +39 -20
- package/tests/yolo-session-policy.test.ts +270 -1
|
@@ -621,6 +621,45 @@ test("a routing entry with no configured model is refused typed, naming the rout
|
|
|
621
621
|
assert.match(error.message, /review-risk/);
|
|
622
622
|
});
|
|
623
623
|
|
|
624
|
+
test("invalid or unavailable reviewer models refuse before materialization or completion", async (t) => {
|
|
625
|
+
const cases = [
|
|
626
|
+
{ name: "invalid selection", override: { selection: "not-a-provider-model" }, kind: REVIEW_HOST_RELAY_FAILURE.REVIEWER_CONFIG_INVALID, expectedEvidence: undefined },
|
|
627
|
+
{ name: "missing model", override: { reviewerRegistry: { find: () => undefined, getApiKeyAndHeaders: async () => { throw new Error("must not authenticate"); } } }, kind: REVIEW_HOST_RELAY_FAILURE.REVIEWER_MODEL_NOT_FOUND, expectedEvidence: undefined },
|
|
628
|
+
{ name: "missing provider", override: { reviewerRegistry: { find: () => ({ provider: "extension", id: "model", api: "custom" }) as never, getProvider: () => undefined, getApiKeyAndHeaders: async () => { throw new Error("must not authenticate"); } } }, kind: REVIEW_HOST_RELAY_FAILURE.REVIEWER_MODEL_NOT_FOUND, expectedEvidence: { provider: "extension", api: "custom", reviewerModel: "extension/model" } },
|
|
629
|
+
];
|
|
630
|
+
for (const item of cases) await t.test(item.name, async (t) => {
|
|
631
|
+
const fixture = harness(t), reviewer = textReviewer(REVIEWER_TEXT);
|
|
632
|
+
const error = await rejectsWithRelayError(runRelay(fixture, item.override, reviewer.runReviewer), item.kind, "pi");
|
|
633
|
+
assert.deepEqual(error.reviewerEvidence, item.expectedEvidence);
|
|
634
|
+
assert.equal(error.mutationOutcome, "none");
|
|
635
|
+
assert.equal(readLog(fixture.logPath).length, 0, "no native materialize or submit may run");
|
|
636
|
+
assert.equal(reviewer.calls.length, 0, "no completion may run");
|
|
637
|
+
assert.equal(existsSync(fixture.submitCapturePath), false);
|
|
638
|
+
});
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
test("a group checks every model before preparing any sibling reviewer", async (t) => {
|
|
642
|
+
for (const invalid of ["missing selection", "missing registry", "invalid selection", "missing model", "missing provider"]) await t.test(invalid, async (t) => {
|
|
643
|
+
const fixture = harness(t), requests = reviewerGroupRequests(fixture), reviewer = textReviewer(REVIEWER_TEXT);
|
|
644
|
+
requests[2] = { ...requests[2], ...(invalid === "missing selection" ? { selection: undefined }
|
|
645
|
+
: invalid === "missing registry" ? { reviewerRegistry: undefined }
|
|
646
|
+
: invalid === "invalid selection" ? { selection: "invalid" }
|
|
647
|
+
: invalid === "missing provider" ? { reviewerRegistry: { find: () => ({ provider: "extension", id: "model", api: "custom" }) as never, getProvider: () => undefined, getApiKeyAndHeaders: async () => { throw new Error("must not authenticate"); } } }
|
|
648
|
+
: { reviewerRegistry: { find: () => undefined, getApiKeyAndHeaders: async () => { throw new Error("must not authenticate"); } } }) };
|
|
649
|
+
let preparations = 0;
|
|
650
|
+
const kind = ["missing model", "missing provider"].includes(invalid) ? REVIEW_HOST_RELAY_FAILURE.REVIEWER_MODEL_NOT_FOUND : REVIEW_HOST_RELAY_FAILURE.REVIEWER_CONFIG_INVALID;
|
|
651
|
+
const error = await rejectsWithRelayError(runReviewHostRelayReviewerGroup(requests, async (request) => {
|
|
652
|
+
preparations++;
|
|
653
|
+
return prepareReviewHostRelaySlot(request, reviewer.runReviewer);
|
|
654
|
+
}), kind, "pi");
|
|
655
|
+
assert.deepEqual(error.reviewerEvidence, invalid === "missing provider" ? { provider: "extension", api: "custom", reviewerModel: "extension/model" } : undefined);
|
|
656
|
+
assert.equal(preparations, 0, "no sibling preparation may begin");
|
|
657
|
+
assert.equal(readLog(fixture.logPath).length, 0, "no native materialize or submit may run");
|
|
658
|
+
assert.equal(reviewer.calls.length, 0, "no completion may run");
|
|
659
|
+
assert.equal(existsSync(fixture.submitCapturePath), false);
|
|
660
|
+
});
|
|
661
|
+
});
|
|
662
|
+
|
|
624
663
|
test("a tool call's cancelled signal maps to REVIEWER_ABORTED and forwards the caller's own signal to the completion", async (t) => {
|
|
625
664
|
const fixture = harness(t);
|
|
626
665
|
const controller = new AbortController();
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { chmodSync, existsSync, mkdirSync, mkdtempSync, realpathSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { execFileSync } from "node:child_process";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import { __testing } from "../extensions/gentle-ai.ts";
|
|
8
|
+
import type { NativeReviewCli } from "../lib/native-review-cli.ts";
|
|
9
|
+
|
|
10
|
+
// gentle-ai#2196: inspect must not advertise a review.start whose candidate-view
|
|
11
|
+
// materialization is already known to fail. START verifies cheap non-mutating
|
|
12
|
+
// invariants (candidate owner parent privacy, symlink capability for trees that
|
|
13
|
+
// track symlinks); inspect runs the same non-persistent checks before a ready
|
|
14
|
+
// advertisement leaves the controller, with the typed codes START would emit.
|
|
15
|
+
|
|
16
|
+
function git(cwd: string, ...arguments_: string[]): string {
|
|
17
|
+
return execFileSync("git", [...arguments_], { cwd, encoding: "utf8" }).trim();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function fixtureRepository(tracksSymlink: boolean): { root: string; candidateTree: string } {
|
|
21
|
+
const root = realpathSync(mkdtempSync(join(tmpdir(), "inspect-preflight-")));
|
|
22
|
+
git(root, "init", "--quiet", "-b", "main");
|
|
23
|
+
writeFileSync(join(root, "tracked.txt"), "base\n");
|
|
24
|
+
if (tracksSymlink) symlinkSync("tracked.txt", join(root, "link"));
|
|
25
|
+
git(root, "add", "-A");
|
|
26
|
+
execFileSync("git", ["-c", "user.email=t@example.com", "-c", "user.name=T", "commit", "--quiet", "-m", "base"], { cwd: root, encoding: "utf8" });
|
|
27
|
+
return { root, candidateTree: git(root, "rev-parse", "HEAD^{tree}") };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const START_TRANSITION = { kind: "execute", execute: { operation: "review.start", arguments: [] } } as const;
|
|
31
|
+
|
|
32
|
+
function readyNative(candidateTree: string): NativeReviewCli {
|
|
33
|
+
return {
|
|
34
|
+
reviewMode: async () => ({ operation: "status", status: { effective: "on", source: "global", global: "on", cloneLocal: "" } }),
|
|
35
|
+
targetStatus: async () => ({
|
|
36
|
+
action: "start",
|
|
37
|
+
applicability: "unrelated",
|
|
38
|
+
targetIdentity: `sha256:${"a".repeat(64)}`,
|
|
39
|
+
projection: { projection: "workspace", baseTree: candidateTree, initialReviewTree: candidateTree, currentCandidateTree: candidateTree, paths: [] },
|
|
40
|
+
// raw is the full native STATUS body, which carries the executable transition.
|
|
41
|
+
raw: { schema: "gentle-ai.review-integration.status/v7", action: "start", reason_code: "fresh_target_ready", next_transition: START_TRANSITION },
|
|
42
|
+
nextTransition: { kind: "execute", execute: { operation: "review.start", arguments: [] } },
|
|
43
|
+
}),
|
|
44
|
+
} as unknown as NativeReviewCli;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const inspect = (root: string, native: NativeReviewCli) =>
|
|
48
|
+
__testing.executeReviewControllerOperation({ operation: "inspect" }, root, native, undefined, null) as Promise<Record<string, unknown>>;
|
|
49
|
+
|
|
50
|
+
const posix = process.platform !== "win32";
|
|
51
|
+
|
|
52
|
+
for (const quota of [{ name: "plain", untrackedScope: undefined }] as const) {
|
|
53
|
+
test(`inspect withholds a ready START advertisement when the candidate owner parent is not private (${quota.name}, gentle-ai#2196)`, { skip: posix ? false : "POSIX privacy modes are unavailable on Windows" }, async t => {
|
|
54
|
+
const { root } = fixtureRepository(false);
|
|
55
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
56
|
+
const views = join(root, ".git", "gentle-ai", "candidate-views");
|
|
57
|
+
mkdirSync(views, { recursive: true, mode: 0o700 });
|
|
58
|
+
chmodSync(views, 0o777);
|
|
59
|
+
const result = await inspect(root, readyNative(git(root, "rev-parse", "HEAD^{tree}")));
|
|
60
|
+
assert.equal(result.status, "blocked");
|
|
61
|
+
assert.equal(result.outcome, "candidate-view-preflight-blocked");
|
|
62
|
+
assert.equal((result.diagnostics as { code?: string }).code, "candidate-owner-parent-privacy");
|
|
63
|
+
assert.equal(result.mutation_performed, false);
|
|
64
|
+
assert.equal(result.lineage_created, false);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
test("inspect withholds a ready START advertisement for any other candidate owner failure START would repeat (gentle-ai#2196)", { skip: posix ? false : "POSIX symlinked owner parent fixture" }, async t => {
|
|
69
|
+
const { root, candidateTree } = fixtureRepository(false);
|
|
70
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
71
|
+
const elsewhere = join(root, ".git", "elsewhere");
|
|
72
|
+
mkdirSync(elsewhere, { mode: 0o700 });
|
|
73
|
+
mkdirSync(join(root, ".git", "gentle-ai"), { mode: 0o700 });
|
|
74
|
+
symlinkSync(elsewhere, join(root, ".git", "gentle-ai", "candidate-views"));
|
|
75
|
+
const result = await inspect(root, readyNative(candidateTree));
|
|
76
|
+
assert.equal(result.status, "blocked");
|
|
77
|
+
assert.equal(result.outcome, "candidate-view-preflight-blocked");
|
|
78
|
+
assert.equal((result.diagnostics as { code?: string }).code, "candidate-owner-preparation-failed");
|
|
79
|
+
assert.equal(result.mutation_performed, false);
|
|
80
|
+
assert.equal(result.lineage_created, false);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const unprivileged = posix && process.getuid?.() !== 0;
|
|
84
|
+
|
|
85
|
+
test("inspect withholds a ready START advertisement when the missing owner parent cannot be created under its nearest existing ancestor (gentle-ai#2196)", { skip: unprivileged ? false : "needs POSIX permission bits enforced for this process" }, async t => {
|
|
86
|
+
const { root, candidateTree } = fixtureRepository(false);
|
|
87
|
+
const commonDir = join(root, ".git");
|
|
88
|
+
t.after(() => {
|
|
89
|
+
chmodSync(commonDir, 0o755);
|
|
90
|
+
rmSync(root, { recursive: true, force: true });
|
|
91
|
+
});
|
|
92
|
+
// The owner parent is missing, so START would try to create it under .git;
|
|
93
|
+
// without write access there that creation fails, and START with it.
|
|
94
|
+
chmodSync(commonDir, 0o555);
|
|
95
|
+
const result = await inspect(root, readyNative(candidateTree));
|
|
96
|
+
assert.equal(result.status, "blocked");
|
|
97
|
+
assert.equal(result.outcome, "candidate-view-preflight-blocked");
|
|
98
|
+
assert.deepEqual(result.diagnostics, { code: "candidate-owner-preparation-failed", message: "candidate view owner preparation failed (EACCES)" });
|
|
99
|
+
assert.equal(result.mutation_performed, false);
|
|
100
|
+
assert.equal(result.lineage_created, false);
|
|
101
|
+
assert.equal(existsSync(join(commonDir, "gentle-ai")), false, "the preflight creates nothing");
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test("inspect withholds a ready START advertisement when the frozen tree tracks symlinks this process cannot create (gentle-ai#2196)", { skip: posix ? false : "fixture needs a tracked symlink" }, async t => {
|
|
105
|
+
const { root, candidateTree } = fixtureRepository(true);
|
|
106
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
107
|
+
__testing.setCandidateViewSymlinkProbeForTesting(() => { throw new Error("EPERM (probe)"); });
|
|
108
|
+
t.after(() => __testing.setCandidateViewSymlinkProbeForTesting(undefined));
|
|
109
|
+
const result = await inspect(root, readyNative(candidateTree));
|
|
110
|
+
assert.equal(result.status, "blocked");
|
|
111
|
+
assert.equal(result.outcome, "candidate-view-preflight-blocked");
|
|
112
|
+
assert.equal((result.diagnostics as { code?: string }).code, "symlink-materialization-failed");
|
|
113
|
+
assert.match(String((result.diagnostics as { message?: string }).message), /enable symlink capability out of band before retrying START/);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test("a blocked inspect result carries no executable START transition but keeps the native status data (gentle-ai#2196)", { skip: posix ? false : "fixture needs a tracked symlink" }, async t => {
|
|
117
|
+
const { root, candidateTree } = fixtureRepository(true);
|
|
118
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
119
|
+
__testing.setCandidateViewSymlinkProbeForTesting(() => { throw new Error("EPERM (probe)"); });
|
|
120
|
+
t.after(() => __testing.setCandidateViewSymlinkProbeForTesting(undefined));
|
|
121
|
+
const result = await inspect(root, readyNative(candidateTree));
|
|
122
|
+
assert.equal(result.status, "blocked");
|
|
123
|
+
assert.equal(result.next_transition, undefined);
|
|
124
|
+
assert.deepEqual(result.result, { schema: "gentle-ai.review-integration.status/v7", action: "start", reason_code: "fresh_target_ready" });
|
|
125
|
+
assert.equal(JSON.stringify(result).includes("review.start"), false, "no nested field may still advertise review.start");
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test("a frozen tree without symlinks never consults the symlink capability probe (gentle-ai#2196)", async t => {
|
|
129
|
+
const { root, candidateTree } = fixtureRepository(false);
|
|
130
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
131
|
+
let probed = 0;
|
|
132
|
+
__testing.setCandidateViewSymlinkProbeForTesting(() => { probed++; throw new Error("EPERM (probe)"); });
|
|
133
|
+
t.after(() => __testing.setCandidateViewSymlinkProbeForTesting(undefined));
|
|
134
|
+
const result = await inspect(root, readyNative(candidateTree));
|
|
135
|
+
assert.equal(probed, 0, "no symlink entries in the frozen tree means no capability probe");
|
|
136
|
+
assert.equal(result.status, "ready", "a healthy candidate keeps its advertisement");
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test("a healthy worktree keeps the ready START advertisement (gentle-ai#2196)", { skip: posix ? false : "real symlink probe depends on runner capability" }, async t => {
|
|
140
|
+
const { root, candidateTree } = fixtureRepository(true);
|
|
141
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
142
|
+
const result = await inspect(root, readyNative(candidateTree));
|
|
143
|
+
assert.equal(result.status, "ready");
|
|
144
|
+
assert.equal(result.outcome, undefined);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test("the symlink capability probe samples the filesystem that will hold the candidate view, never tmpdir (gentle-ai#2196)", { skip: posix ? false : "fixture needs a tracked symlink" }, async t => {
|
|
148
|
+
const { root, candidateTree } = fixtureRepository(true);
|
|
149
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
150
|
+
let probeRoot: string | undefined;
|
|
151
|
+
__testing.setCandidateViewSymlinkProbeForTesting((directory: string) => {
|
|
152
|
+
probeRoot = directory;
|
|
153
|
+
});
|
|
154
|
+
t.after(() => __testing.setCandidateViewSymlinkProbeForTesting(undefined));
|
|
155
|
+
const result = await inspect(root, readyNative(candidateTree));
|
|
156
|
+
assert.equal(result.status, "ready");
|
|
157
|
+
assert.ok(probeRoot !== undefined, "a symlink-tracking frozen tree consults the capability probe");
|
|
158
|
+
assert.ok(probeRoot!.startsWith(join(root, ".git")), `probe must run inside the candidate-view filesystem, saw: ${probeRoot}`);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test("inspect withholds the ready START advertisement when the symlink capability stays unconfirmed (gentle-ai#2196)", { skip: posix ? false : "fixture needs a tracked symlink" }, async t => {
|
|
162
|
+
const { root, candidateTree } = fixtureRepository(true);
|
|
163
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
164
|
+
__testing.setCandidateViewSymlinkProbeForTesting(() => {
|
|
165
|
+
throw new __testing.CandidateViewSymlinkProbeUnavailableError("no existing ancestor could host the probe");
|
|
166
|
+
});
|
|
167
|
+
t.after(() => __testing.setCandidateViewSymlinkProbeForTesting(undefined));
|
|
168
|
+
const result = await inspect(root, readyNative(candidateTree));
|
|
169
|
+
assert.equal(result.status, "blocked");
|
|
170
|
+
assert.equal(result.outcome, "candidate-view-preflight-blocked");
|
|
171
|
+
assert.equal((result.diagnostics as { code?: string }).code, "symlink-capability-unconfirmed");
|
|
172
|
+
assert.equal(result.mutation_performed, false);
|
|
173
|
+
assert.equal(result.lineage_created, false);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test("an incomplete symlink scan never claims a symlink-free tree and keeps the advertisement; START owns unreadable trees (gentle-ai#2196)", async t => {
|
|
177
|
+
const { root } = fixtureRepository(false);
|
|
178
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
179
|
+
let probed = 0;
|
|
180
|
+
__testing.setCandidateViewSymlinkProbeForTesting(() => {
|
|
181
|
+
probed++;
|
|
182
|
+
});
|
|
183
|
+
t.after(() => __testing.setCandidateViewSymlinkProbeForTesting(undefined));
|
|
184
|
+
const result = await inspect(root, readyNative("f".repeat(40)));
|
|
185
|
+
assert.equal(result.status, "ready", "an unconfirmed scan withholds no advertisement");
|
|
186
|
+
assert.equal(probed, 0, "an unconfirmed scan never consults the capability probe");
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
test("the scan classification itself is a tri-state: unreadable trees are unconfirmed, never symlink-free (gentle-ai#2196)", async t => {
|
|
190
|
+
const { root } = fixtureRepository(true);
|
|
191
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
192
|
+
assert.equal(__testing.scanCandidateTreeForSymlinks(root, git(root, "rev-parse", "HEAD^{tree}")), "tracks-symlinks");
|
|
193
|
+
const bare = fixtureRepository(false);
|
|
194
|
+
t.after(() => rmSync(bare.root, { recursive: true, force: true }));
|
|
195
|
+
assert.equal(__testing.scanCandidateTreeForSymlinks(bare.root, git(bare.root, "rev-parse", "HEAD^{tree}")), "no-symlinks");
|
|
196
|
+
assert.equal(__testing.scanCandidateTreeForSymlinks(bare.root, "f".repeat(40)), "unconfirmed", "an unreadable tree is never classified symlink-free");
|
|
197
|
+
});
|
|
@@ -1024,3 +1024,62 @@ test("START/v4 accepts every risk reason code and signal the published start sch
|
|
|
1024
1024
|
unknown.risk_reasons = [{ code: "code_from_a_newer_cli" }];
|
|
1025
1025
|
assert.throws(() => decodeReviewStartV4(unknown), /risk_reasons\[0\]\.code is unsupported/);
|
|
1026
1026
|
});
|
|
1027
|
+
|
|
1028
|
+
// A base-diff target keeps its selector in the intended-untracked submission
|
|
1029
|
+
// (provider-issued, exact forms only), so re-entering STATUS resolves the same
|
|
1030
|
+
// target instead of the workspace candidate.
|
|
1031
|
+
const PROVIDER_PREFIX = ["--contract=gentle-ai.review-integration/v2", "--next-transition=true", "--agent=pi"];
|
|
1032
|
+
const SELECTION_TOKEN = "--intended-untracked-selection={{value}}";
|
|
1033
|
+
const TREE = "a".repeat(40);
|
|
1034
|
+
|
|
1035
|
+
function intendedUntrackedSubmissionStatus(selector: readonly string[], location?: number): JsonObject {
|
|
1036
|
+
const body = initialIntendedUntrackedStatusV6();
|
|
1037
|
+
const input = ((body.next_transition as JsonObject).collect as JsonObject).inputs as JsonObject[];
|
|
1038
|
+
const submission = input[0]!.submission as JsonObject;
|
|
1039
|
+
const tokens = [...PROVIDER_PREFIX, ...selector, SELECTION_TOKEN];
|
|
1040
|
+
submission.argument_tokens = tokens;
|
|
1041
|
+
(submission.value as JsonObject).substitution_location = location ?? tokens.length - 1;
|
|
1042
|
+
return body;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
function decodedSubmissionTokens(body: JsonObject): readonly string[] {
|
|
1046
|
+
const decoded = decodeReviewStatusV3(body);
|
|
1047
|
+
const input = decoded.nextTransition?.kind === "collect" ? decoded.nextTransition.collect?.inputs[0] : undefined;
|
|
1048
|
+
return input?.submission?.argumentTokens ?? [];
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
test("status/v6 intended-untracked submission accepts the workspace and provider-issued base-diff selectors", () => {
|
|
1052
|
+
assert.deepEqual(decodedSubmissionTokens(intendedUntrackedSubmissionStatus(["--projection=workspace"])), [...PROVIDER_PREFIX, "--projection=workspace", SELECTION_TOKEN]);
|
|
1053
|
+
for (const scope of ["--committed-only=true", "--workspace-overlay=true"]) {
|
|
1054
|
+
const selector = [`--base-ref=${TREE}`, scope];
|
|
1055
|
+
assert.deepEqual(decodedSubmissionTokens(intendedUntrackedSubmissionStatus(selector)), [...PROVIDER_PREFIX, ...selector, SELECTION_TOKEN]);
|
|
1056
|
+
}
|
|
1057
|
+
assert.deepEqual(decodedSubmissionTokens(intendedUntrackedSubmissionStatus([`--base-ref=${"b".repeat(64)}`, "--committed-only=true"])).length, 6);
|
|
1058
|
+
});
|
|
1059
|
+
|
|
1060
|
+
test("status/v6 intended-untracked submission rejects any other selector or substitution location", () => {
|
|
1061
|
+
for (const selector of [
|
|
1062
|
+
["--projection=staged"],
|
|
1063
|
+
["--base-ref=HEAD", "--committed-only=true"],
|
|
1064
|
+
[`--base-ref=${TREE}`],
|
|
1065
|
+
["--committed-only=true"],
|
|
1066
|
+
[],
|
|
1067
|
+
[`--base-ref=${TREE}`, "--committed-only=true", "--projection=workspace"],
|
|
1068
|
+
]) {
|
|
1069
|
+
assert.throws(() => decodeReviewStatusV3(intendedUntrackedSubmissionStatus(selector)), /argument_tokens|substitution/, selector.join(" "));
|
|
1070
|
+
}
|
|
1071
|
+
assert.throws(() => decodeReviewStatusV3(intendedUntrackedSubmissionStatus([`--base-ref=${TREE}`, "--committed-only=true"], 4)), /substitution_location/);
|
|
1072
|
+
});
|
|
1073
|
+
|
|
1074
|
+
test("targetStatus runs a provider-issued base-diff submission as issued instead of re-forwarding the request base-ref", async () => {
|
|
1075
|
+
const queue = queuedTargetStatusAdapter();
|
|
1076
|
+
const tokens = [...PROVIDER_PREFIX, `--base-ref=${TREE}`, "--committed-only=true", SELECTION_TOKEN];
|
|
1077
|
+
await targetStatusClient(queue.adapter).targetStatus({
|
|
1078
|
+
cwd: "/repo", baseRef: "deadbeef", committedOnly: true,
|
|
1079
|
+
intendedUntrackedSelection: { argumentTokens: tokens, value: '{"selection":true}' },
|
|
1080
|
+
});
|
|
1081
|
+
assert.deepEqual(queue.calls[0], [
|
|
1082
|
+
"review", "status", "--cwd", "/repo",
|
|
1083
|
+
...PROVIDER_PREFIX, `--base-ref=${TREE}`, "--committed-only=true", '--intended-untracked-selection={"selection":true}',
|
|
1084
|
+
]);
|
|
1085
|
+
});
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
decodeReviewStartV3,
|
|
17
17
|
decodeReviewStartV4,
|
|
18
18
|
decodeReviewStatusV3,
|
|
19
|
+
decodeReviewTargetedValidationRequestV1,
|
|
19
20
|
} from "../lib/review-integration-v2.ts";
|
|
20
21
|
|
|
21
22
|
const fixtureRoot = join(process.cwd(), "contracts", "review-integration", "v2", "fixtures");
|
|
@@ -951,6 +952,37 @@ test("next_transition decodes the v9 host-mediated provider role submission form
|
|
|
951
952
|
);
|
|
952
953
|
});
|
|
953
954
|
|
|
955
|
+
test("targeted validation preserves an explicitly frozen empty policy without accepting absent or non-string policy", () => {
|
|
956
|
+
// Gentle AI v4.3.1 CompactState explicitly distinguishes a non-nil empty
|
|
957
|
+
// policy from missing historical policy; both the constructor and request
|
|
958
|
+
// serializer retain the empty string. It is evidence, not a required label.
|
|
959
|
+
const sha = `sha256:${"a".repeat(64)}`;
|
|
960
|
+
const request = {
|
|
961
|
+
schema: "gentle-ai.review-targeted-validation-request/v1", request_hash: sha,
|
|
962
|
+
lineage_id: "review-fixture", expected_revision: sha, target_identity: sha,
|
|
963
|
+
fix_finding_ids: ["R1-001"], policy_content: "",
|
|
964
|
+
fix_findings: [{ id: "R1-001", lens: "risk", location: "selected.txt:1", severity: "CRITICAL",
|
|
965
|
+
claim: "restore the requested behavior", proof_refs: ["selected.txt:1"], evidence_class: "deterministic", causal_disposition: "introduced" }],
|
|
966
|
+
fix_classifications: [{ finding_id: "R1-001", class: "deterministic", causal_disposition: "introduced", proof: "selected.txt:1" }],
|
|
967
|
+
projection: "workspace", correction_candidate_tree: "b".repeat(40), correction_target_identity: sha,
|
|
968
|
+
correction_paths: ["selected.txt"], correction_paths_digest: sha,
|
|
969
|
+
};
|
|
970
|
+
for (const policy_content of ["", "\n \t", "Frozen policy\n"]) {
|
|
971
|
+
const input = { ...request, policy_content };
|
|
972
|
+
const before = structuredClone(input);
|
|
973
|
+
assert.equal(decodeReviewTargetedValidationRequestV1(input).policyContent, policy_content);
|
|
974
|
+
assert.deepEqual(input, before, "frozen policy bytes and request bindings must remain unchanged");
|
|
975
|
+
}
|
|
976
|
+
for (const policy_content of [undefined, null, false, 0, [], {}]) {
|
|
977
|
+
assert.throws(() => decodeReviewTargetedValidationRequestV1({ ...request, policy_content }), /policy_content/);
|
|
978
|
+
}
|
|
979
|
+
const absent: Record<string, unknown> = { ...request };
|
|
980
|
+
delete absent.policy_content;
|
|
981
|
+
assert.throws(() => decodeReviewTargetedValidationRequestV1(absent), /policy_content is required/);
|
|
982
|
+
assert.throws(() => decodeReviewTargetedValidationRequestV1({ ...request, request_hash: "invalid" }), /request_hash/);
|
|
983
|
+
assert.throws(() => decodeReviewTargetedValidationRequestV1({ ...request, base_tree: "c".repeat(40) }), /base_tree is not allowed/);
|
|
984
|
+
});
|
|
985
|
+
|
|
954
986
|
test("v5 targeted-validator collect inputs carry the exact provider-owned validation request", () => {
|
|
955
987
|
const requestHash = `sha256:${"a".repeat(64)}`;
|
|
956
988
|
const expectedRevision = `sha256:${"b".repeat(64)}`;
|
|
@@ -1077,9 +1109,12 @@ test("v5 targeted-validator collect inputs carry the exact provider-owned valida
|
|
|
1077
1109
|
((malformedRequest.collect.inputs[0] as JsonObject).validation_request as JsonObject).unadvertised = true;
|
|
1078
1110
|
assert.throws(() => decodeReviewNextTransitionV3(malformedRequest, { v5: true }), /not allowed/);
|
|
1079
1111
|
|
|
1080
|
-
const
|
|
1081
|
-
((
|
|
1082
|
-
assert.
|
|
1112
|
+
const emptyPolicyRequest = clone(transition);
|
|
1113
|
+
((emptyPolicyRequest.collect.inputs[0] as JsonObject).validation_request as JsonObject).policy_content = "";
|
|
1114
|
+
assert.equal(decodeReviewNextTransitionV3(emptyPolicyRequest, { v5: true }).collect?.inputs[0]?.validationRequest?.policyContent, "");
|
|
1115
|
+
const malformedPolicyRequest = clone(transition);
|
|
1116
|
+
((malformedPolicyRequest.collect.inputs[0] as JsonObject).validation_request as JsonObject).policy_content = null;
|
|
1117
|
+
assert.throws(() => decodeReviewNextTransitionV3(malformedPolicyRequest, { v5: true }), /policy_content/);
|
|
1083
1118
|
});
|
|
1084
1119
|
|
|
1085
1120
|
test("status.frozen carries the optional frozen manifest digest", () => {
|
|
@@ -1155,3 +1190,11 @@ test("next_transition.execute.binding stays open, as its schema declares no prop
|
|
|
1155
1190
|
};
|
|
1156
1191
|
assert.doesNotThrow(() => decodeReviewNextTransitionV3(withContext));
|
|
1157
1192
|
});
|
|
1193
|
+
|
|
1194
|
+
test("capabilities retain request-context and START preflight features only when supported", () => {
|
|
1195
|
+
const source = fixture<any>("capabilities.fixture.json");
|
|
1196
|
+
source.features.optional.push({ name: "start_request_context", supported: true, requires: [] }, { name: "start_options_preflight", supported: false, requires: [] });
|
|
1197
|
+
const result = decodeReviewCapabilitiesV2(source, executableDigest);
|
|
1198
|
+
assert.equal(result.optionalFeatures.has("start_request_context"), true);
|
|
1199
|
+
assert.equal(result.optionalFeatures.has("start_options_preflight"), false);
|
|
1200
|
+
});
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
2
4
|
import test from "node:test";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
3
6
|
import { stream as streamAnthropic } from "@earendil-works/pi-ai/api/anthropic-messages";
|
|
4
7
|
import { normalizeContext, validateToolArguments, type Model, type ToolCall } from "@earendil-works/pi-ai";
|
|
5
8
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
6
9
|
import type { NativeReviewCli } from "../lib/native-review-cli.ts";
|
|
7
10
|
import { __testing, createGentleAiExtension } from "../extensions/gentle-ai.ts";
|
|
8
11
|
|
|
12
|
+
const metadata = join(dirname(fileURLToPath(import.meta.resolve("@earendil-works/pi-ai"))), "..", "package.json");
|
|
13
|
+
const version: string = JSON.parse(readFileSync(metadata, "utf8")).version;
|
|
14
|
+
assert.match(version, /^\d+\.\d+\.\d+$/);
|
|
15
|
+
const [major, minor] = version.split(".").map(Number);
|
|
16
|
+
assert.ok(major >= 1, `Pi AI >=1.0.0 required, installed ${version}`);
|
|
17
|
+
const coercesStringNull = major > 1 || (major === 1 && minor >= 5);
|
|
18
|
+
|
|
9
19
|
function registeredTools(): Map<string, any> {
|
|
10
20
|
const tools = new Map<string, any>();
|
|
11
21
|
createGentleAiExtension({ nativeReviewCli: null })({
|
|
@@ -53,7 +63,7 @@ test("public Anthropic non-strict adapter preserves the complete review tool dec
|
|
|
53
63
|
assert.deepEqual(controller.required, ["operation"]);
|
|
54
64
|
assert.deepEqual(Object.keys(controller.properties).sort(), ["operation", "lineageId", "selectionBinding", "intendedUntracked", "untrackedScope", "changeName", "idempotencyKey", "transition", "input", "outputPath", "inputPath", "operationId", "lineageIds", "workspaceRoot"].sort());
|
|
55
65
|
assert.ok(controller.properties.input.anyOf.some((schema: any) => schema.type === "object"));
|
|
56
|
-
assert.match(controller.properties.input.description, /START\/ASSESS\/answer-consent/);
|
|
66
|
+
assert.match(controller.properties.input.description, /START\/ASSESS\/answer-consent\/abandon/);
|
|
57
67
|
assert.deepEqual(controller.properties.operation.enum, tools.get("gentle_review").parameters.properties.operation.enum);
|
|
58
68
|
for (const name of ["gentle_review_capture", "gentle_review_capture_group"]) {
|
|
59
69
|
const schema = emitted.get(name);
|
|
@@ -77,6 +87,19 @@ test("public Anthropic non-strict adapter preserves the complete review tool dec
|
|
|
77
87
|
});
|
|
78
88
|
|
|
79
89
|
const binding = { name: "reviewer_result", arguments: [] };
|
|
90
|
+
|
|
91
|
+
test("STATUS accepts object selectors and rejects malformed input before native access", async () => {
|
|
92
|
+
const input = { baseRef: "HEAD", committedOnly: true };
|
|
93
|
+
assert.equal(__testing.parseReviewControllerParameters(validate("gentle_review", { operation: "status", input })).input, JSON.stringify(input));
|
|
94
|
+
let calls = 0;
|
|
95
|
+
const native = new Proxy({}, { get: () => async () => { calls++; throw new Error("invalid input reached native"); } }) as NativeReviewCli;
|
|
96
|
+
for (const malformed of [null, [], 42]) await assert.rejects(__testing.executeReviewControllerOperation({ operation: "status", input: malformed }, process.cwd(), native), /input|JSON|object/i);
|
|
97
|
+
for (const malformed of [{ baseRef: "HEAD" }, { baseRef: "HEAD", committedOnly: false }, { unexpected: true }]) {
|
|
98
|
+
const result = await __testing.executeReviewControllerOperation({ operation: "status", input: malformed }, process.cwd(), native);
|
|
99
|
+
assert.equal(result.outcome, "native-status-input-invalid");
|
|
100
|
+
}
|
|
101
|
+
assert.equal(calls, 0);
|
|
102
|
+
});
|
|
80
103
|
test("registered review schemas admit START/ASSESS objects and ordered capture objects", () => {
|
|
81
104
|
for (const operation of ["start", "assess"]) {
|
|
82
105
|
const input = operation === "start" ? { mode: "ordinary" } : { committedOnly: true, baseRef: "HEAD" };
|
|
@@ -106,6 +129,29 @@ test("answer-consent admits JSON object input and coerces it cleanly (#2375)", a
|
|
|
106
129
|
assert.match(String(outcome.outcome), /consent-binding-stale/);
|
|
107
130
|
});
|
|
108
131
|
|
|
132
|
+
test("abandon admits JSON object input and coerces it to a serialized string", () => {
|
|
133
|
+
const input = { actor: "loonbac", reason: "operator_disposition" };
|
|
134
|
+
const args = validate("gentle_review", { operation: "abandon", lineageId: "review-1", input });
|
|
135
|
+
assert.deepEqual(args.input, input);
|
|
136
|
+
assert.equal(__testing.parseReviewControllerParameters(args).input, JSON.stringify(input));
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test("validated abandon objects reach the mocked native facade and still fail closed", async () => {
|
|
140
|
+
let statusCalls = 0;
|
|
141
|
+
let abandonCalls = 0;
|
|
142
|
+
const native = {
|
|
143
|
+
reviewStatus: async () => { statusCalls++; return { entries: [] }; },
|
|
144
|
+
abandon: async () => { abandonCalls++; },
|
|
145
|
+
} as unknown as NativeReviewCli;
|
|
146
|
+
const bad = await __testing.executeReviewControllerOperation(validate("gentle_review", { operation: "abandon", lineageId: "review-1", input: { actor: "loonbac", reason: "not-a-reason" } }), process.cwd(), native);
|
|
147
|
+
assert.equal(bad.outcome, "native-input-invalid");
|
|
148
|
+
assert.equal(statusCalls, 0);
|
|
149
|
+
const ineligible = await __testing.executeReviewControllerOperation(validate("gentle_review", { operation: "abandon", lineageId: "review-1", input: { actor: "loonbac", reason: "operator_disposition" } }), process.cwd(), native);
|
|
150
|
+
assert.equal(ineligible.outcome, "native-abandon-ineligible");
|
|
151
|
+
assert.equal(statusCalls, 1);
|
|
152
|
+
assert.equal(abandonCalls, 0);
|
|
153
|
+
});
|
|
154
|
+
|
|
109
155
|
test("validated ASSESS objects reach the mocked native facade with parsed fields", async () => {
|
|
110
156
|
const requests: unknown[] = [];
|
|
111
157
|
const native = { assess: async (request: unknown) => { requests.push(request); throw new Error("mock assessment unavailable"); } } as unknown as NativeReviewCli;
|
|
@@ -126,9 +172,10 @@ test("serialized inputs remain byte-for-byte unchanged at validation and facade
|
|
|
126
172
|
assert.equal(__testing.parseReviewCaptureParameters(validate("gentle_review_capture", { lineageId: "l", collectBinding })).collectBinding, collectBinding);
|
|
127
173
|
});
|
|
128
174
|
|
|
129
|
-
test("
|
|
130
|
-
|
|
131
|
-
|
|
175
|
+
test("validation and facade keep arrays, primitives and null fail-closed", async () => {
|
|
176
|
+
const operations = ["start", "assess", "answer-consent", "inspect", "reset", "recover"];
|
|
177
|
+
for (const value of [[], 123, true, "123", "[]"]) {
|
|
178
|
+
for (const operation of operations) {
|
|
132
179
|
assert.throws(() => validate("gentle_review", { operation, input: value }), /Validation failed/);
|
|
133
180
|
}
|
|
134
181
|
assert.throws(() => validate("gentle_review_capture", { lineageId: "l", collectBinding: value }), /Validation failed/);
|
|
@@ -136,20 +183,28 @@ test("actual validation rejects arrays, null and coerced primitives rather than
|
|
|
136
183
|
}
|
|
137
184
|
let calls = 0;
|
|
138
185
|
const native = new Proxy({}, { get() { return async () => { calls++; throw new Error("unexpected native execution"); }; } }) as NativeReviewCli;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
186
|
+
// SDK coercion admits the nullable shell, not native operation input.
|
|
187
|
+
for (const value of [null, false, "null"]) {
|
|
188
|
+
for (const operation of operations) {
|
|
189
|
+
if (value === "null" && !coercesStringNull) {
|
|
190
|
+
assert.throws(() => validate("gentle_review", { operation, input: value }), /Validation failed/);
|
|
191
|
+
} else {
|
|
192
|
+
const validated = validate("gentle_review", { operation, input: value });
|
|
193
|
+
assert.equal(validated.input, null, "nullable shell preserves null instead of stripping it to omitted");
|
|
194
|
+
await assert.rejects(__testing.executeReviewControllerOperation(validated, process.cwd(), native));
|
|
195
|
+
}
|
|
144
196
|
}
|
|
145
197
|
assert.throws(() => validate("gentle_review_capture", { lineageId: "l", collectBinding: value }), /Validation failed/);
|
|
146
198
|
assert.throws(() => validate("gentle_review_capture_group", { lineageId: "l", collectBindings: [binding, value] }), /Validation failed/);
|
|
147
199
|
}
|
|
200
|
+
for (const operation of operations) {
|
|
201
|
+
await assert.rejects(__testing.executeReviewControllerOperation({ operation, input: "null" }, process.cwd(), native), /input must be a JSON object/);
|
|
202
|
+
}
|
|
148
203
|
assert.equal(calls, 0);
|
|
149
204
|
});
|
|
150
205
|
|
|
151
206
|
test("all other controller operations keep object input fail-closed at the facade boundary (#1698)", async () => {
|
|
152
|
-
const operations = (tools.get("gentle_review").parameters.properties.operation.enum as string[]).filter((operation) => operation !== "start" && operation !== "assess" && operation !== "answer-consent" && operation !== "select-intended-untracked");
|
|
207
|
+
const operations = (tools.get("gentle_review").parameters.properties.operation.enum as string[]).filter((operation) => operation !== "start" && operation !== "assess" && operation !== "answer-consent" && operation !== "abandon" && operation !== "status" && operation !== "select-intended-untracked");
|
|
153
208
|
let calls = 0;
|
|
154
209
|
const native = new Proxy({}, { get() { return async () => { calls++; throw new Error("unexpected native execution"); }; } }) as NativeReviewCli;
|
|
155
210
|
for (const operation of operations) {
|
|
@@ -6,6 +6,7 @@ import { __testing } from "../extensions/gentle-ai.ts";
|
|
|
6
6
|
import { reconcileUnknownReviewLastEventCapture } from "../lib/review-last-event-controller.ts";
|
|
7
7
|
import * as nativeReviewCliModule from "../lib/native-review-cli.ts";
|
|
8
8
|
import type { NativeReviewCli } from "../lib/native-review-cli.ts";
|
|
9
|
+
import { ReviewHostRelayError, REVIEW_HOST_RELAY_FAILURE } from "../lib/review-host-relay.ts";
|
|
9
10
|
import {
|
|
10
11
|
decodeReviewLastEventClosureV1,
|
|
11
12
|
decodeReviewStartV3,
|
|
@@ -17,6 +18,49 @@ const SHA = `sha256:${"a".repeat(64)}`;
|
|
|
17
18
|
const TREE = "b".repeat(40);
|
|
18
19
|
const CAPTURED_FIXTURES = join(process.cwd(), "tests", "fixtures", "devbinary");
|
|
19
20
|
|
|
21
|
+
test("host reviewer facts survive both ordinary capture and terminal closure without changing native output", async t => {
|
|
22
|
+
t.after(() => __testing.setReviewHostRelayRunnerForTesting());
|
|
23
|
+
for (const terminal of [false, true]) {
|
|
24
|
+
const lineageId = `facts-single-${terminal}`, input = materializeInput(lineageId);
|
|
25
|
+
const reviewer = { reviewerModel: "fixture/model", phase: "completion", usage: { input: 10 }, cost: { total: 0.01 } };
|
|
26
|
+
const native = { targetStatus: async () => status(lineageId, [input]) } as unknown as NativeReviewCli;
|
|
27
|
+
__testing.setReviewHostRelayRunnerForTesting(async () => ({ promptByteLength: 30, resultByteLength: 20, reviewerEvidence: reviewer,
|
|
28
|
+
submission: terminal ? JSON.stringify(closure("review/capture-result", lineageId)) : '{"admission_decision":"completed"}' }));
|
|
29
|
+
const result = await __testing.executeReviewCaptureOperation({ lineageId, collectBinding: JSON.stringify(input), reviewerRunAcknowledged: true }, process.cwd(), native);
|
|
30
|
+
assert.equal(result.outcome, terminal ? "native-last-event-closure" : "native-reviewer-result-captured");
|
|
31
|
+
assert.deepEqual((result.host_relay as any)?.reviewer, reviewer);
|
|
32
|
+
const before = structuredClone((result.host_relay as any).reviewer);
|
|
33
|
+
reviewer.usage.input = 999;
|
|
34
|
+
assert.deepEqual((result.host_relay as any).reviewer, before, "host facts are snapshots rather than a runner's mutable object");
|
|
35
|
+
if (terminal) assert.equal((result.closure as any).lineage_id, lineageId);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("group reviewer runs retain every prepared completion after early closure or later admission refusal", async t => {
|
|
40
|
+
t.after(() => __testing.setReviewHostRelayGroupRunnersForTesting());
|
|
41
|
+
for (const terminal of [true, false]) {
|
|
42
|
+
const lineageId = `facts-group-${terminal}`;
|
|
43
|
+
const inputs = Array.from({ length: 4 }, (_, index) => materializeInput(lineageId, String(index), `sha256:${String(index + 1).repeat(64)}`));
|
|
44
|
+
const facts = inputs.map((_, index) => ({ reviewerModel: `fixture/model-${index}`, phase: "completion", ...(index === 1 ? {} : { usage: { input: index + 1 }, cost: { total: 0.01 * (index + 1) } }) }));
|
|
45
|
+
let submitted = 0;
|
|
46
|
+
const native = { targetStatus: async () => ({ ...status(lineageId, inputs.slice(submitted)), repositoryContext: { capability: "review.opaque_repository_context", handle: `rctx1_${"c".repeat(64)}`, revision: SHA, targetIdentity: SHA } }) } as unknown as NativeReviewCli;
|
|
47
|
+
__testing.setReviewHostRelayGroupRunnersForTesting(async requests => requests.map((request, index) => ({ request, promptByteLength: 30, resultByteLength: 20, reviewerEvidence: facts[index] })), async () => {
|
|
48
|
+
if (submitted === 1) throw new ReviewHostRelayError(REVIEW_HOST_RELAY_FAILURE.SUBMISSION_REFUSED, "submit", "fixture refused", { mutationOutcome: "none", reviewerEvidence: facts[1] });
|
|
49
|
+
submitted++;
|
|
50
|
+
return { promptByteLength: 30, resultByteLength: 20, submission: terminal ? JSON.stringify(closure("review/capture-result", lineageId)) : '{"admission_decision":"completed"}' };
|
|
51
|
+
});
|
|
52
|
+
const result = await __testing.executeReviewCaptureGroupOperation({ lineageId, collectBindings: inputs, reviewerRunAcknowledged: true }, process.cwd(), native);
|
|
53
|
+
assert.equal(result.submitted_reviewers, 1, JSON.stringify(result)); assert.equal(result.prepared_reviewers, 4);
|
|
54
|
+
const diagnostics = result.host_relay as any;
|
|
55
|
+
assert.equal(diagnostics.reviewers.length, 1, "legacy reviewer diagnostics remain limited to confirmed submissions");
|
|
56
|
+
assert.equal(diagnostics.reviewer_runs.length, 4, "all prepared completions already spent their reported usage");
|
|
57
|
+
assert.deepEqual(diagnostics.reviewer_runs.map((run: any) => run.reviewer), facts);
|
|
58
|
+
assert.equal(Object.hasOwn(diagnostics.reviewer_runs[1].reviewer, "usage"), false, "missing usage remains unknown");
|
|
59
|
+
assert.equal(Object.hasOwn(diagnostics.reviewers[0], "reviewer"), false, "do not copy cost into both legacy and run diagnostics");
|
|
60
|
+
assert.equal(result.outcome, terminal ? "native-last-event-closure" : "pi-host-relay-transport-failure");
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
20
64
|
function captured(name: string): unknown {
|
|
21
65
|
return JSON.parse(readFileSync(join(CAPTURED_FIXTURES, name), "utf8"));
|
|
22
66
|
}
|
|
@@ -492,6 +536,30 @@ test("refuter and validation each execute one self-contained provider vector", a
|
|
|
492
536
|
}
|
|
493
537
|
});
|
|
494
538
|
|
|
539
|
+
test("public STATUS retains only the original opaque binding projection", async () => {
|
|
540
|
+
const lineageId = "validation-projection";
|
|
541
|
+
const input = roleInput(lineageId, "review.capture-validation");
|
|
542
|
+
const native = { targetStatus: async () => status(lineageId, [input]),
|
|
543
|
+
reviewMode: async () => ({ operation: "status", scope: "clone", status: { global: "on", cloneLocal: "", effective: "on", source: "global" } }),
|
|
544
|
+
} as unknown as NativeReviewCli;
|
|
545
|
+
const result = await __testing.executeReviewControllerOperation({ operation: "status", lineageId }, process.cwd(), native);
|
|
546
|
+
const entries = result.collectBindings as Array<{ collectBinding: string }>;
|
|
547
|
+
assert.equal(entries.length, 1);
|
|
548
|
+
assert.deepEqual(Object.keys(entries[0]), ["collectBinding"]);
|
|
549
|
+
assert.deepEqual(JSON.parse(entries[0].collectBinding), input);
|
|
550
|
+
assert.equal((entries[0] as Record<string, unknown>).forecast, undefined, "legacy execute vectors keep their existing route");
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
test("public correction STATUS adds no inferred input metadata", async () => {
|
|
554
|
+
const lineageId = "authored-plan-metadata";
|
|
555
|
+
const input = correctionPlanInput(lineageId);
|
|
556
|
+
const native = { targetStatus: async () => status(lineageId, [input]) } as unknown as NativeReviewCli;
|
|
557
|
+
const result = await __testing.executeReviewControllerOperation({ operation: "status", lineageId }, process.cwd(), native);
|
|
558
|
+
const entries = result.collectBindings as Array<{ collectBinding: string }>;
|
|
559
|
+
assert.deepEqual(Object.keys(entries[0]), ["collectBinding"]);
|
|
560
|
+
assert.deepEqual(JSON.parse(entries[0].collectBinding), input);
|
|
561
|
+
});
|
|
562
|
+
|
|
495
563
|
test("terminal capture closes directly, nonterminal capture does not auto-follow, and unknown mutation reconciles once", async (t) => {
|
|
496
564
|
t.after(() => __testing.setReviewHostRelayRunnerForTesting());
|
|
497
565
|
const lineageId = "closure-behavior";
|