gentle-pi 4.6.0 → 4.8.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 +65 -55
- package/assets/agents/gentle-ai-explore.md +4 -3
- package/assets/agents/gentle-ai-verify.md +23 -6
- package/assets/agents/gentle-ai-worker.md +9 -6
- package/assets/agents/jd-fix-agent.md +1 -0
- package/assets/agents/jd-judge-a.md +2 -3
- package/assets/agents/jd-judge-b.md +2 -3
- package/assets/agents/review-readability.md +1 -5
- package/assets/agents/review-reliability.md +1 -5
- package/assets/agents/review-resilience.md +1 -5
- package/assets/agents/review-risk.md +1 -5
- package/assets/design-canvas/canvas-api.js +45 -0
- package/assets/design-canvas/canvas-boards.js +456 -0
- package/assets/design-canvas/canvas-boot.js +217 -0
- package/assets/design-canvas/canvas-checks.js +491 -0
- package/assets/design-canvas/canvas-comments.js +315 -0
- package/assets/design-canvas/canvas-compare.js +159 -0
- package/assets/design-canvas/canvas-events.js +75 -0
- package/assets/design-canvas/canvas-export.js +393 -0
- package/assets/design-canvas/canvas-focus.js +203 -0
- package/assets/design-canvas/canvas-handoffs.js +150 -0
- package/assets/design-canvas/canvas-i18n-es.js +392 -0
- package/assets/design-canvas/canvas-i18n.js +108 -0
- package/assets/design-canvas/canvas-layout.js +526 -0
- package/assets/design-canvas/canvas-menu.js +213 -0
- package/assets/design-canvas/canvas-messages.js +86 -0
- package/assets/design-canvas/canvas-minimap.js +163 -0
- package/assets/design-canvas/canvas-parts.js +401 -0
- package/assets/design-canvas/canvas-popover.js +234 -0
- package/assets/design-canvas/canvas-rail.js +348 -0
- package/assets/design-canvas/canvas-sizes.js +524 -0
- package/assets/design-canvas/canvas-store.js +164 -0
- package/assets/design-canvas/canvas-tokens.js +674 -0
- package/assets/design-canvas/canvas-ui.js +24 -0
- package/assets/design-canvas/canvas-view.js +184 -0
- package/assets/design-canvas/canvas.css +759 -16
- package/assets/design-canvas/canvas.js +2 -1497
- package/assets/design-canvas/index.html +117 -36
- package/assets/design-canvas/inspector.js +546 -16
- package/assets/install-wizard/wizard.js +6 -1
- package/assets/migrations/agent-body-history.json +40 -1
- package/assets/orchestrator-delegation-reference.md +10 -16
- package/assets/orchestrator-delegation.md +5 -5
- package/assets/orchestrator-full-delegation-card.md +64 -0
- package/assets/orchestrator-full-delegation.md +34 -0
- package/assets/orchestrator-memory.md +5 -5
- package/assets/orchestrator-prompts.md +2 -2
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +14 -13
- package/assets/orchestrator-tracking.md +10 -14
- package/assets/orchestrator-verification.md +12 -8
- package/assets/orchestrator-writer.md +4 -4
- package/assets/orchestrator.md +21 -25
- package/bin/gentle-shell.mjs +292 -65
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/orchestration/pi.md +1 -0
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/routing/pi.md +6 -6
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/agent-status.md +61 -0
- package/docs/assets/brand/sponsor-banner.svg +60 -0
- package/docs/bundled-install.md +20 -10
- package/docs/delegated-verification.md +46 -8
- package/docs/desktop-rpc.md +1253 -0
- package/docs/gentle-agents-activity.md +40 -0
- package/docs/gentle-shell.md +91 -30
- package/docs/install-wizard.md +30 -21
- package/docs/odd-preparation-continuity.md +24 -0
- package/docs/permission-modes.md +17 -4
- package/docs/prompt-budget.md +12 -0
- package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
- package/docs/readme-reference.md +142 -45
- package/docs/render-cache-performance.md +11 -1
- package/docs/review-coordinator.md +53 -0
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/review-request-context.md +19 -0
- package/docs/review-windows-acl.md +18 -0
- package/docs/voice.md +6 -3
- package/docs/work-continuity.md +11 -1
- package/docs/yolo-mode.md +5 -5
- package/extensions/ask-user-choice.ts +1 -0
- package/extensions/ask-user-question.ts +3 -2
- package/extensions/child-context.ts +21 -7
- package/extensions/child-safety.ts +3 -0
- package/extensions/gentle-agent-status.ts +99 -0
- package/extensions/gentle-agents.ts +559 -66
- package/extensions/gentle-ai.ts +2001 -518
- package/extensions/gentle-design.ts +69 -3
- package/extensions/gentle-desktop-rpc.ts +143 -0
- package/extensions/gentle-guide.ts +3 -0
- package/extensions/gentle-shell.ts +398 -115
- package/extensions/gentle-todo.ts +66 -27
- package/extensions/gentle-tps.ts +48 -0
- package/extensions/quiet-tools.ts +38 -8
- package/extensions/skill-registry.ts +349 -167
- package/extensions/startup-banner.ts +30 -3
- package/lib/agent-assets.ts +30 -6
- package/lib/agent-profile-pin.ts +3 -3
- package/lib/agent-profiles.ts +160 -2
- package/lib/agent-status.ts +105 -0
- package/lib/agent-tool-overlay.ts +117 -0
- package/lib/agents-config.ts +93 -6
- package/lib/agents-history.ts +24 -5
- package/lib/agents-message-delivery.ts +17 -0
- package/lib/agents-messaging.ts +55 -7
- package/lib/agents-protocol.ts +15 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-runner.ts +272 -16
- package/lib/agents-session-transport.ts +17 -1
- package/lib/auto-permission-runtime.ts +1 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/bounded-writer-admission.ts +197 -32
- package/lib/card-content-policy.ts +8 -6
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- package/lib/command-palette.ts +133 -17
- package/lib/context-backstop.ts +14 -5
- package/lib/delivery-conflict-markers.ts +349 -0
- package/lib/design-canvas-assets.ts +36 -0
- package/lib/design-canvas-server.ts +241 -23
- package/lib/design-comments.ts +94 -4
- package/lib/design-handoffs.ts +2 -1
- package/lib/design-layout.ts +125 -0
- package/lib/design-parts.ts +281 -0
- package/lib/design-system-tokens.ts +111 -0
- package/lib/desktop-agents-service.ts +294 -0
- package/lib/desktop-design-service.ts +233 -0
- package/lib/desktop-jobs-service.ts +263 -0
- package/lib/desktop-rpc-agents.ts +294 -0
- package/lib/desktop-rpc-config.ts +731 -0
- package/lib/desktop-rpc-design.ts +138 -0
- package/lib/desktop-rpc-jobs.ts +181 -0
- package/lib/desktop-rpc-permissions.ts +177 -0
- package/lib/desktop-rpc-profiles.ts +196 -0
- package/lib/desktop-rpc-usage.ts +229 -0
- package/lib/desktop-rpc.ts +225 -0
- package/lib/desktop-usage-service.ts +310 -0
- package/lib/destructive-command-guard.ts +236 -17
- package/lib/execution-surface-guard.ts +20 -0
- package/lib/exploration-budget.ts +4 -2
- package/lib/gentle-ai-binary.ts +1 -1
- package/lib/gentle-ai-renderer.ts +13 -1
- package/lib/gentle-design.ts +204 -14
- package/lib/gentle-shell-bundled.ts +106 -28
- package/lib/gentle-shell-launcher.ts +43 -8
- package/lib/herdr-activity.ts +14 -2
- package/lib/herdr-busy.ts +45 -0
- package/lib/hidden-tools.ts +35 -0
- package/lib/image-attachments.ts +33 -0
- package/lib/image-disk-cache.ts +137 -0
- package/lib/inprocess-reviewer.ts +358 -144
- package/lib/jobs-view.ts +198 -11
- package/lib/model-fallback-policy.ts +9 -0
- package/lib/model-routing-authority.ts +31 -4
- package/lib/nan-provider.ts +42 -28
- package/lib/native-choice-list.ts +20 -2
- package/lib/native-review-cli.ts +172 -20
- package/lib/orchestrator-discovery.ts +39 -2
- package/lib/orchestrator-mode-policy.ts +105 -0
- package/lib/questionnaire/questionnaire-view.ts +105 -12
- package/lib/rdd-mode-control.ts +32 -0
- package/lib/reply-language-anchor.ts +129 -0
- package/lib/request-context-placement.ts +53 -0
- package/lib/review-blocker.ts +92 -0
- package/lib/review-candidate-symlink-scan.ts +136 -0
- package/lib/review-candidate-view-owner.ts +81 -44
- package/lib/review-candidate-view.ts +11 -1
- package/lib/review-continuation-registry.ts +116 -0
- package/lib/review-coordinator.ts +407 -0
- package/lib/review-delivery-preflight.ts +85 -0
- package/lib/review-failure-facts.ts +49 -0
- package/lib/review-host-relay.ts +51 -11
- package/lib/review-integration-v2.ts +63 -4
- package/lib/review-relay-phase-timing.ts +45 -0
- package/lib/review-start-context.ts +17 -0
- package/lib/reviewer-stream.ts +87 -0
- package/lib/session-profile-freeze.ts +4 -2
- package/lib/shell-bar.ts +140 -58
- package/lib/shell-changes.ts +2 -0
- package/lib/shell-panel.ts +17 -3
- package/lib/shell-prompt.ts +16 -3
- package/lib/shell-sidebar-layout.ts +112 -40
- package/lib/shell-sidebar.ts +7 -0
- package/lib/shell-todo.ts +10 -3
- package/lib/shell-usage.ts +10 -0
- package/lib/verifier-admission.ts +1 -1
- package/lib/vim-editor-adapter.ts +9 -2
- package/lib/visual-customization-policy.ts +36 -16
- package/lib/visual-customize-view.ts +216 -21
- package/lib/visual-layout-preview.ts +9 -5
- package/lib/visual-profiles.ts +2 -2
- package/lib/windows-session-transport.ts +53 -2
- package/lib/writer-batch-admission.ts +55 -0
- package/lib/yolo-session-policy.ts +46 -16
- package/package.json +3 -2
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +37 -0
- package/runtime/gentle-ai-binary.mjs +1 -1
- package/runtime/gentle-shell-bundled.mjs +106 -28
- package/runtime/gentle-shell-launcher.mjs +42 -7
- package/runtime/native-review-cli.mjs +169 -17
- package/runtime/review-integration-v2.mjs +63 -4
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +179 -0
- package/scripts/build-runtime-modules.mjs +1 -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-downloads.mjs +34 -8
- package/scripts/installer-preflight.mjs +33 -22
- package/scripts/installer-probes.mjs +25 -5
- package/scripts/installer-runner.mjs +27 -12
- package/scripts/installer-server.mjs +46 -16
- package/scripts/installer-windows.mjs +2 -2
- package/scripts/pi-update.mjs +166 -27
- package/scripts/prepare-verifier.mjs +107 -0
- 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 +40 -28
- package/scripts/update-agent-body-history.mjs +55 -8
- package/scripts/verify-package-files.mjs +50 -19
- package/scripts/voice-worker.cjs +32 -6
- package/skills/branch-pr/SKILL.md +16 -16
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/design/SKILL.md +16 -13
- package/skills/gentle-ai/SKILL.md +7 -7
- 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/judgment-day/SKILL.md +2 -2
- package/skills/judgment-day/references/prompts-and-formats.md +1 -1
- package/skills/rdd-defect-workflow/SKILL.md +6 -6
- package/skills/skill-improver/SKILL.md +2 -2
- package/skills/skill-registry/SKILL.md +11 -11
- package/skills/tui-design/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +10 -11
- package/tests/agent-home.test.ts +28 -9
- package/tests/agent-profiles-workflow.test.ts +163 -0
- package/tests/agent-prompt-diet-contract.test.ts +101 -0
- package/tests/agent-risk-escalation.test.ts +1 -1
- package/tests/agent-status.test.ts +143 -0
- package/tests/agent-tool-overlay-acceptance.test.ts +158 -0
- package/tests/agent-tool-overlay.test.ts +89 -0
- package/tests/agents-config.test.ts +106 -1
- package/tests/agents-history.test.ts +31 -0
- package/tests/agents-jobs-frames.test.ts +93 -0
- package/tests/agents-message-delivery.test.ts +36 -0
- package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
- package/tests/agents-queries.test.ts +144 -4
- package/tests/agents-report-cap.test.ts +126 -0
- package/tests/agents-runner-drain.test.ts +193 -0
- package/tests/agents-runner.test.ts +215 -3
- package/tests/agents-session-transport.test.ts +34 -0
- package/tests/always-on-prompt-verdicts-contract.test.ts +188 -0
- package/tests/append-system-prompt-route.test.ts +12 -1
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-choice.test.ts +4 -3
- package/tests/ask-user-question.test.ts +99 -1
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/auto-permission-runtime.test.ts +1 -1
- package/tests/autonomous-guard.test.ts +346 -10
- package/tests/bounded-stop-contract.test.ts +51 -3
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bridge-cost.test.ts +19 -4
- package/tests/bundled-install.test.ts +31 -6
- package/tests/card-content-policy.test.ts +3 -3
- package/tests/chained-pr-skill.test.ts +8 -6
- package/tests/child-context-files.test.ts +64 -8
- package/tests/child-safety.test.ts +11 -0
- package/tests/child-skills-catalog.test.ts +56 -0
- package/tests/codegraph-tools.test.ts +11 -5
- package/tests/codemode-rendering.test.ts +4 -1
- package/tests/command-palette.test.ts +284 -1
- package/tests/delegate-for-reason-contract.test.ts +32 -10
- package/tests/delivery-conflict-markers.test.ts +348 -0
- package/tests/design-canvas-all-sizes.test.ts +631 -0
- package/tests/design-canvas-allowlist.test.ts +32 -0
- package/tests/design-canvas-assets.test.ts +11 -695
- package/tests/design-canvas-boards.test.ts +77 -0
- package/tests/design-canvas-checks.test.ts +655 -0
- package/tests/design-canvas-compare.test.ts +79 -0
- package/tests/design-canvas-events.test.ts +59 -0
- package/tests/design-canvas-export.test.ts +1168 -0
- package/tests/design-canvas-focus.test.ts +113 -0
- package/tests/design-canvas-handoffs.test.ts +59 -0
- package/tests/design-canvas-i18n-review.test.ts +513 -0
- package/tests/design-canvas-i18n-views.test.ts +259 -0
- package/tests/design-canvas-i18n.test.ts +526 -0
- package/tests/design-canvas-inspector.test.ts +937 -0
- package/tests/design-canvas-layout.test.ts +1222 -0
- package/tests/design-canvas-minimap.test.ts +413 -0
- package/tests/design-canvas-modules.test.ts +90 -0
- package/tests/design-canvas-parts.test.ts +721 -0
- package/tests/design-canvas-rail.test.ts +799 -0
- package/tests/design-canvas-server.test.ts +855 -17
- package/tests/design-canvas-sizes.test.ts +548 -0
- package/tests/design-canvas-store.test.ts +180 -0
- package/tests/design-canvas-tokens.test.ts +965 -0
- package/tests/design-canvas-view.test.ts +299 -0
- package/tests/design-comments.test.ts +201 -1
- package/tests/design-handoffs.test.ts +20 -0
- package/tests/design-layout.test.ts +100 -0
- package/tests/design-parts.test.ts +260 -0
- package/tests/design-system-tokens.test.ts +215 -0
- package/tests/desktop-rpc-agents.test.ts +893 -0
- package/tests/desktop-rpc-config.test.ts +1452 -0
- package/tests/desktop-rpc-design.test.ts +662 -0
- package/tests/desktop-rpc-jobs.test.ts +796 -0
- package/tests/desktop-rpc-permissions.test.ts +311 -0
- package/tests/desktop-rpc-profiles.test.ts +140 -0
- package/tests/desktop-rpc-safety.test.ts +119 -0
- package/tests/desktop-rpc-usage.test.ts +697 -0
- package/tests/desktop-rpc.test.ts +252 -0
- package/tests/destructive-command-guard.test.ts +52 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
- package/tests/devbinary/review-session-consent.devtest.ts +84 -0
- package/tests/download-progress.test.ts +71 -0
- package/tests/engram-safety.test.ts +111 -0
- package/tests/execution-surface-guard.test.ts +55 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.captured.json +92 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.provenance.md +3 -0
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +26 -31
- package/tests/fixtures/proxy-tls/proxy.crt +19 -0
- package/tests/fixtures/proxy-tls/proxy.key +28 -0
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
- package/tests/fixtures/session-profile-v1/replay.ts +53 -6
- package/tests/full-delegation-closure.test.ts +160 -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 +1403 -20
- package/tests/gentle-ai-binary.test.ts +3 -1
- package/tests/gentle-ai-child-guards.test.ts +1 -0
- package/tests/gentle-ai-elapsed-store.test.ts +19 -0
- package/tests/gentle-ai-exploration-budget.test.ts +18 -2
- package/tests/gentle-ai-installer.test.ts +135 -51
- package/tests/gentle-ai-proxy.test.ts +434 -0
- package/tests/gentle-ai-renderer.test.ts +36 -2
- package/tests/gentle-ai.test.ts +233 -43
- package/tests/gentle-design.test.ts +386 -1
- package/tests/gentle-herdr-activity.test.ts +9 -6
- package/tests/gentle-shell-bin.test.ts +123 -0
- package/tests/gentle-shell-bundled.test.ts +293 -31
- package/tests/gentle-shell-launcher.test.ts +78 -11
- package/tests/gentle-shell.test.ts +1017 -146
- package/tests/gentle-todo.test.ts +51 -11
- 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 +8 -4
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/image-disk-cache.test.ts +163 -0
- package/tests/independent-recovery-delivery.test.ts +97 -0
- package/tests/inprocess-reviewer.test.ts +249 -4
- package/tests/install-wizard.test.ts +27 -1
- package/tests/installer-downloads.test.ts +30 -1
- package/tests/installer-posix-bootstrap.test.ts +115 -14
- package/tests/installer-preflight.test.ts +54 -5
- package/tests/installer-probes.test.ts +146 -0
- package/tests/installer-runner.test.ts +79 -44
- package/tests/installer-server.test.ts +215 -13
- package/tests/installer-windows-bootstrap.test.ts +19 -1
- package/tests/jobs-view.test.ts +260 -6
- package/tests/judgment-day-severity-admission.test.ts +46 -0
- package/tests/lazy-module-contradictions-contract.test.ts +158 -0
- package/tests/maintainer/desktop-rpc.maintest.ts +632 -0
- package/tests/maintainer/pi-update-source.maintest.ts +48 -18
- package/tests/modal-mouse-boundaries.test.ts +136 -0
- package/tests/model-fallback-policy.test.ts +26 -7
- package/tests/model-routing-authority.test.ts +178 -2
- package/tests/nan-provider-runtime.test.ts +17 -3
- package/tests/nan-provider.test.ts +111 -56
- package/tests/native-choice-list.test.ts +77 -2
- package/tests/native-review-capability-contract.test.ts +17 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
- package/tests/native-review-cli.test.ts +269 -1
- package/tests/native-review-parity.test.ts +24 -5
- package/tests/native-review-refusal-identity.test.ts +25 -0
- package/tests/no-self-pause-contract.test.ts +13 -2
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
- package/tests/odd-routing-contract.test.ts +80 -28
- package/tests/orchestrator-budget.test.ts +35 -5
- package/tests/orchestrator-consultation-sdk.test.ts +32 -6
- package/tests/orchestrator-delegation-mode.test.ts +154 -0
- package/tests/orchestrator-discovery.test.ts +28 -0
- package/tests/orchestrator-mode-policy.test.ts +175 -0
- package/tests/orchestrator-prompt-budget.test.ts +13 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +221 -0
- package/tests/orchestrator-rdd-ownership.test.ts +4 -3
- package/tests/orchestrator-work-search.test.ts +4 -2
- package/tests/package-files.test.ts +25 -1
- package/tests/package-manifest.test.ts +16 -13
- package/tests/parallel-reason-contract.test.ts +6 -3
- package/tests/permission-allowlist.test.ts +372 -0
- package/tests/persona-neutral-voseo.test.ts +4 -4
- package/tests/persona-reply-language.test.ts +1 -1
- package/tests/persona-single-channel.test.ts +13 -5
- package/tests/pi-update-launcher.test.ts +25 -7
- package/tests/pi-update-source.test.ts +113 -6
- package/tests/pi-update.test.ts +294 -19
- package/tests/pnpm-workspace-config.test.ts +58 -0
- package/tests/pnpm-workspace-policy.test.ts +47 -0
- package/tests/primary-context-files.test.ts +233 -0
- package/tests/primary-context-three-files.test.ts +174 -0
- package/tests/primary-session-prompt.test.ts +13 -0
- package/tests/profile-pin.test.ts +29 -2
- package/tests/profile-tier-footer.test.ts +5 -0
- package/tests/profiles-panel-delegation-mode.test.ts +422 -0
- package/tests/provider-defect-handoff.test.ts +9 -2
- package/tests/questionnaire-view.test.ts +115 -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 +17 -12
- 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 +112 -1
- package/tests/render-cache-performance.test.ts +171 -2
- package/tests/reply-language-anchor-placement.test.ts +184 -0
- package/tests/reply-language-anchor.test.ts +189 -0
- package/tests/request-context-append-only.test.ts +218 -0
- package/tests/request-context-placement.test.ts +148 -0
- package/tests/review-agent-end-preflight.test.ts +80 -2
- package/tests/review-blocker.test.ts +193 -0
- package/tests/review-candidate-owner-retry.test.ts +1 -1
- package/tests/review-candidate-symlink-scan.test.ts +157 -0
- package/tests/review-candidate-view.test.ts +66 -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 +107 -0
- package/tests/review-contract-prompt.test.ts +1 -1
- package/tests/review-controller-native-routing.test.ts +261 -5
- package/tests/review-controller-workspace-root.test.ts +230 -3
- package/tests/review-controller.test.ts +98 -12
- package/tests/review-coordinator-correction-gate.test.ts +105 -0
- package/tests/review-coordinator-findings.test.ts +206 -0
- package/tests/review-coordinator-nonblocking-scope.test.ts +169 -0
- package/tests/review-coordinator-runtime.test.ts +117 -0
- package/tests/review-coordinator.test.ts +462 -0
- package/tests/review-delivery-preflight.test.ts +462 -0
- package/tests/review-due-compaction.test.ts +31 -0
- package/tests/review-due-public-boundary.test.ts +26 -0
- package/tests/review-failure-facts.test.ts +87 -0
- package/tests/review-host-relay-routing.test.ts +258 -4
- package/tests/review-host-relay.test.ts +39 -0
- package/tests/review-integration-nonblocking-findings.test.ts +108 -0
- package/tests/review-integration-v2.test.ts +46 -3
- package/tests/review-json-arguments.test.ts +105 -11
- package/tests/review-last-event-closure.test.ts +68 -0
- package/tests/review-ledger-contract.test.ts +19 -40
- package/tests/review-loadout-rdd-off-sdk.test.ts +95 -32
- package/tests/review-one-call-findings.test.ts +131 -0
- package/tests/review-one-call-followups.test.ts +308 -0
- package/tests/review-one-call-reviewer-requests.test.ts +207 -0
- package/tests/review-one-call.test.ts +452 -0
- 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 +39 -2
- package/tests/review-reviewer-evidence.test.ts +223 -0
- package/tests/review-risk-assessment.test.ts +126 -8
- package/tests/review-run-statement-guidance-independent.test.ts +54 -0
- package/tests/review-session-standing-permission-controller.test.ts +53 -3
- package/tests/review-start-context.test.ts +19 -0
- package/tests/review-tool-prose-budget.test.ts +122 -0
- package/tests/reviewer-stream.test.ts +149 -0
- package/tests/run-test-suite.test.ts +122 -1
- package/tests/runtime-harness.mjs +4 -1
- package/tests/sensitive-path-tools.test.ts +181 -5
- package/tests/session-profile-append-controller-pi.test.ts +60 -31
- package/tests/session-profile-binding.test.ts +19 -1
- package/tests/session-profile-disk-reader-pi.test.ts +58 -16
- package/tests/session-profile-extension.test.ts +2 -2
- package/tests/session-profile-v1-compat.test.ts +35 -1
- package/tests/shell-bar.test.ts +186 -42
- package/tests/shell-panel.test.ts +50 -22
- package/tests/shell-prompt.test.ts +17 -0
- package/tests/shell-sidebar-fullscreen.test.ts +5 -5
- package/tests/shell-sidebar-layout.test.ts +294 -23
- package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
- package/tests/shell-surface-transparent.test.ts +89 -0
- package/tests/shell-todo.test.ts +12 -0
- package/tests/shell-usage.test.ts +59 -10
- package/tests/skill-contradictions-contract.test.ts +122 -0
- package/tests/skill-registry-watcher.test.ts +216 -2
- package/tests/skill-registry.test.ts +1461 -5
- package/tests/startup-banner.test.ts +152 -1
- package/tests/startup-home-repo.test.ts +2 -0
- package/tests/support/design-canvas-dom.ts +369 -0
- package/tests/support/review-coordinator-runtime.ts +264 -0
- package/tests/task-size-routing-contract.test.ts +45 -12
- package/tests/test-strength-contract.test.ts +2 -1
- package/tests/todo-request-append-only.test.ts +214 -0
- package/tests/tool-batching-contract.test.ts +3 -1
- package/tests/update-agent-body-history.test.ts +138 -0
- package/tests/verification-tiers-contract.test.ts +229 -0
- package/tests/verifier-admission.test.ts +49 -0
- package/tests/verifier-preparation.test.ts +229 -0
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +162 -11
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/visual-customization-policy.test.ts +39 -6
- package/tests/visual-customize-view.test.ts +573 -9
- package/tests/visual-layout-preview.test.ts +15 -1
- package/tests/visual-profiles.test.ts +11 -0
- package/tests/voice-worker.test.ts +73 -2
- package/tests/windows-session-transport.test.ts +126 -0
- package/tests/work-continuity-contract.test.ts +77 -6
- package/tests/writer-admission-messages.test.ts +232 -0
- package/tests/writer-batch-admission.test.ts +66 -0
- package/tests/writer-edit-surface-scope.test.ts +52 -20
- package/tests/writer-feature-document-admission.test.ts +276 -0
- package/tests/yolo-customize.test.ts +27 -4
- package/tests/yolo-mode.test.ts +62 -18
- package/tests/yolo-session-policy.test.ts +270 -1
- package/skills/_shared/review-ledger-contract.md +0 -106
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
2
6
|
import test from "node:test";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
3
8
|
import { stream as streamAnthropic } from "@earendil-works/pi-ai/api/anthropic-messages";
|
|
4
9
|
import { normalizeContext, validateToolArguments, type Model, type ToolCall } from "@earendil-works/pi-ai";
|
|
5
10
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
6
11
|
import type { NativeReviewCli } from "../lib/native-review-cli.ts";
|
|
7
12
|
import { __testing, createGentleAiExtension } from "../extensions/gentle-ai.ts";
|
|
8
13
|
|
|
14
|
+
const metadata = join(dirname(fileURLToPath(import.meta.resolve("@earendil-works/pi-ai"))), "..", "package.json");
|
|
15
|
+
const version: string = JSON.parse(readFileSync(metadata, "utf8")).version;
|
|
16
|
+
assert.match(version, /^\d+\.\d+\.\d+$/);
|
|
17
|
+
const [major, minor] = version.split(".").map(Number);
|
|
18
|
+
assert.ok(major >= 1, `Pi AI >=1.0.0 required, installed ${version}`);
|
|
19
|
+
const coercesStringNull = major > 1 || (major === 1 && minor >= 5);
|
|
20
|
+
|
|
9
21
|
function registeredTools(): Map<string, any> {
|
|
10
22
|
const tools = new Map<string, any>();
|
|
11
23
|
createGentleAiExtension({ nativeReviewCli: null })({
|
|
@@ -53,7 +65,7 @@ test("public Anthropic non-strict adapter preserves the complete review tool dec
|
|
|
53
65
|
assert.deepEqual(controller.required, ["operation"]);
|
|
54
66
|
assert.deepEqual(Object.keys(controller.properties).sort(), ["operation", "lineageId", "selectionBinding", "intendedUntracked", "untrackedScope", "changeName", "idempotencyKey", "transition", "input", "outputPath", "inputPath", "operationId", "lineageIds", "workspaceRoot"].sort());
|
|
55
67
|
assert.ok(controller.properties.input.anyOf.some((schema: any) => schema.type === "object"));
|
|
56
|
-
assert.match(controller.properties.input.description, /START\/ASSESS\/answer-consent/);
|
|
68
|
+
assert.match(controller.properties.input.description, /START\/ASSESS\/answer-consent\/abandon/);
|
|
57
69
|
assert.deepEqual(controller.properties.operation.enum, tools.get("gentle_review").parameters.properties.operation.enum);
|
|
58
70
|
for (const name of ["gentle_review_capture", "gentle_review_capture_group"]) {
|
|
59
71
|
const schema = emitted.get(name);
|
|
@@ -77,6 +89,19 @@ test("public Anthropic non-strict adapter preserves the complete review tool dec
|
|
|
77
89
|
});
|
|
78
90
|
|
|
79
91
|
const binding = { name: "reviewer_result", arguments: [] };
|
|
92
|
+
|
|
93
|
+
test("STATUS accepts object selectors and rejects malformed input before native access", async () => {
|
|
94
|
+
const input = { baseRef: "HEAD", committedOnly: true };
|
|
95
|
+
assert.equal(__testing.parseReviewControllerParameters(validate("gentle_review", { operation: "status", input })).input, JSON.stringify(input));
|
|
96
|
+
let calls = 0;
|
|
97
|
+
const native = new Proxy({}, { get: () => async () => { calls++; throw new Error("invalid input reached native"); } }) as NativeReviewCli;
|
|
98
|
+
for (const malformed of [null, [], 42]) await assert.rejects(__testing.executeReviewControllerOperation({ operation: "status", input: malformed }, process.cwd(), native), /input|JSON|object/i);
|
|
99
|
+
for (const malformed of [{ baseRef: "HEAD" }, { baseRef: "HEAD", committedOnly: false }, { unexpected: true }]) {
|
|
100
|
+
const result = await __testing.executeReviewControllerOperation({ operation: "status", input: malformed }, process.cwd(), native);
|
|
101
|
+
assert.equal(result.outcome, "native-status-input-invalid");
|
|
102
|
+
}
|
|
103
|
+
assert.equal(calls, 0);
|
|
104
|
+
});
|
|
80
105
|
test("registered review schemas admit START/ASSESS objects and ordered capture objects", () => {
|
|
81
106
|
for (const operation of ["start", "assess"]) {
|
|
82
107
|
const input = operation === "start" ? { mode: "ordinary" } : { committedOnly: true, baseRef: "HEAD" };
|
|
@@ -106,17 +131,77 @@ test("answer-consent admits JSON object input and coerces it cleanly (#2375)", a
|
|
|
106
131
|
assert.match(String(outcome.outcome), /consent-binding-stale/);
|
|
107
132
|
});
|
|
108
133
|
|
|
134
|
+
test("abandon admits JSON object input and coerces it to a serialized string", () => {
|
|
135
|
+
const input = { actor: "loonbac", reason: "operator_disposition" };
|
|
136
|
+
const args = validate("gentle_review", { operation: "abandon", lineageId: "review-1", input });
|
|
137
|
+
assert.deepEqual(args.input, input);
|
|
138
|
+
assert.equal(__testing.parseReviewControllerParameters(args).input, JSON.stringify(input));
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("validated abandon objects reach the mocked native facade and still fail closed", async () => {
|
|
142
|
+
let statusCalls = 0;
|
|
143
|
+
let abandonCalls = 0;
|
|
144
|
+
const native = {
|
|
145
|
+
reviewStatus: async () => { statusCalls++; return { entries: [] }; },
|
|
146
|
+
abandon: async () => { abandonCalls++; },
|
|
147
|
+
} as unknown as NativeReviewCli;
|
|
148
|
+
const bad = await __testing.executeReviewControllerOperation(validate("gentle_review", { operation: "abandon", lineageId: "review-1", input: { actor: "loonbac", reason: "not-a-reason" } }), process.cwd(), native);
|
|
149
|
+
assert.equal(bad.outcome, "native-input-invalid");
|
|
150
|
+
assert.equal(statusCalls, 0);
|
|
151
|
+
const ineligible = await __testing.executeReviewControllerOperation(validate("gentle_review", { operation: "abandon", lineageId: "review-1", input: { actor: "loonbac", reason: "operator_disposition" } }), process.cwd(), native);
|
|
152
|
+
assert.equal(ineligible.outcome, "native-abandon-ineligible");
|
|
153
|
+
assert.equal(statusCalls, 1);
|
|
154
|
+
assert.equal(abandonCalls, 0);
|
|
155
|
+
});
|
|
156
|
+
|
|
109
157
|
test("validated ASSESS objects reach the mocked native facade with parsed fields", async () => {
|
|
110
158
|
const requests: unknown[] = [];
|
|
159
|
+
const baseRef = execFileSync("git", ["rev-parse", "HEAD"], { cwd: process.cwd(), encoding: "utf8" }).trim();
|
|
111
160
|
const native = { assess: async (request: unknown) => { requests.push(request); throw new Error("mock assessment unavailable"); } } as unknown as NativeReviewCli;
|
|
112
161
|
for (const input of [{ baseRef: "HEAD", committedOnly: true, nativeReviewOutcome: "unknown" }, ' { "baseRef": "HEAD", "committedOnly": true, "nativeReviewOutcome": "unknown" } ']) {
|
|
113
162
|
await __testing.executeReviewControllerOperation(validate("gentle_review", { operation: "assess", input }), process.cwd(), native);
|
|
114
163
|
}
|
|
115
164
|
assert.equal(requests.length, 2);
|
|
116
|
-
assert.deepEqual(requests[0], { cwd: process.cwd(), baseRef
|
|
165
|
+
assert.deepEqual(requests[0], { cwd: process.cwd(), baseRef, committedOnly: true });
|
|
117
166
|
assert.deepEqual(requests[1], requests[0]);
|
|
118
167
|
});
|
|
119
168
|
|
|
169
|
+
test("ASSESS ignores empty top-level selection defaults and targets the selected child repository (#2808)", async (t) => {
|
|
170
|
+
const parent = realpathSync(mkdtempSync(join(tmpdir(), "assess-parent-")));
|
|
171
|
+
t.after(() => rmSync(parent, { recursive: true, force: true }));
|
|
172
|
+
const selected = join(parent, "selected");
|
|
173
|
+
const other = join(parent, "other");
|
|
174
|
+
for (const cwd of [selected, other]) {
|
|
175
|
+
mkdirSync(cwd);
|
|
176
|
+
execFileSync("git", ["init", "--initial-branch=fixture"], { cwd, stdio: "ignore" });
|
|
177
|
+
}
|
|
178
|
+
const requests: unknown[] = [];
|
|
179
|
+
const native = { assess: async (request: unknown) => { requests.push(request); throw new Error("fixture assessment unavailable"); } } as unknown as NativeReviewCli;
|
|
180
|
+
for (const defaults of [{}, { intendedUntracked: [] }, { untrackedScope: "select" }, { untrackedScope: "exclude" }, { intendedUntracked: [], untrackedScope: "select" }, { intendedUntracked: [], untrackedScope: "exclude" }]) {
|
|
181
|
+
const args = validate("gentle_review", { operation: "assess", workspaceRoot: selected, input: "{}", ...defaults });
|
|
182
|
+
const original = structuredClone(args);
|
|
183
|
+
const parsed = __testing.parseReviewControllerParameters(args);
|
|
184
|
+
assert.equal("intendedUntracked" in parsed, false);
|
|
185
|
+
assert.equal("untrackedScope" in parsed, false);
|
|
186
|
+
const result = await __testing.executeReviewControllerOperation(args, parent, native);
|
|
187
|
+
assert.equal(result.operation, "assess");
|
|
188
|
+
assert.deepEqual(args, original, "normalization must not mutate the caller input");
|
|
189
|
+
}
|
|
190
|
+
assert.deepEqual(requests, Array.from({ length: 6 }, () => ({ cwd: selected })), "all equivalent calls reach the selected repository; the fixture deliberately reports native unavailability");
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test("ASSESS still rejects meaningful or malformed top-level untracked selection (#2808)", () => {
|
|
194
|
+
for (const defaults of [
|
|
195
|
+
{ intendedUntracked: ["new.ts"] },
|
|
196
|
+
{ intendedUntracked: ["new.ts"], untrackedScope: "select" },
|
|
197
|
+
{ intendedUntracked: null }, { intendedUntracked: "" }, { intendedUntracked: undefined },
|
|
198
|
+
{ intendedUntracked: [], untrackedScope: "unknown" }, { untrackedScope: null },
|
|
199
|
+
]) assert.throws(() => __testing.parseReviewControllerParameters({ operation: "assess", ...defaults }), /does not accept/);
|
|
200
|
+
for (const operation of ["status", "start", "answer-consent", "reset"]) {
|
|
201
|
+
assert.throws(() => __testing.parseReviewControllerParameters({ operation, intendedUntracked: [], untrackedScope: "select" }), /does not accept/);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
120
205
|
test("serialized inputs remain byte-for-byte unchanged at validation and facade parsing", () => {
|
|
121
206
|
const input = ' \n{ "mode" : "ordinary" }\t';
|
|
122
207
|
for (const operation of ["start", "assess", "answer-consent", "reset", "recover"]) {
|
|
@@ -126,9 +211,10 @@ test("serialized inputs remain byte-for-byte unchanged at validation and facade
|
|
|
126
211
|
assert.equal(__testing.parseReviewCaptureParameters(validate("gentle_review_capture", { lineageId: "l", collectBinding })).collectBinding, collectBinding);
|
|
127
212
|
});
|
|
128
213
|
|
|
129
|
-
test("
|
|
130
|
-
|
|
131
|
-
|
|
214
|
+
test("validation and facade keep arrays, primitives and null fail-closed", async () => {
|
|
215
|
+
const operations = ["start", "assess", "answer-consent", "inspect", "reset", "recover"];
|
|
216
|
+
for (const value of [[], 123, true, "123", "[]"]) {
|
|
217
|
+
for (const operation of operations) {
|
|
132
218
|
assert.throws(() => validate("gentle_review", { operation, input: value }), /Validation failed/);
|
|
133
219
|
}
|
|
134
220
|
assert.throws(() => validate("gentle_review_capture", { lineageId: "l", collectBinding: value }), /Validation failed/);
|
|
@@ -136,20 +222,28 @@ test("actual validation rejects arrays, null and coerced primitives rather than
|
|
|
136
222
|
}
|
|
137
223
|
let calls = 0;
|
|
138
224
|
const native = new Proxy({}, { get() { return async () => { calls++; throw new Error("unexpected native execution"); }; } }) as NativeReviewCli;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
225
|
+
// SDK coercion admits the nullable shell, not native operation input.
|
|
226
|
+
for (const value of [null, false, "null"]) {
|
|
227
|
+
for (const operation of operations) {
|
|
228
|
+
if (value === "null" && !coercesStringNull) {
|
|
229
|
+
assert.throws(() => validate("gentle_review", { operation, input: value }), /Validation failed/);
|
|
230
|
+
} else {
|
|
231
|
+
const validated = validate("gentle_review", { operation, input: value });
|
|
232
|
+
assert.equal(validated.input, null, "nullable shell preserves null instead of stripping it to omitted");
|
|
233
|
+
await assert.rejects(__testing.executeReviewControllerOperation(validated, process.cwd(), native));
|
|
234
|
+
}
|
|
144
235
|
}
|
|
145
236
|
assert.throws(() => validate("gentle_review_capture", { lineageId: "l", collectBinding: value }), /Validation failed/);
|
|
146
237
|
assert.throws(() => validate("gentle_review_capture_group", { lineageId: "l", collectBindings: [binding, value] }), /Validation failed/);
|
|
147
238
|
}
|
|
239
|
+
for (const operation of operations) {
|
|
240
|
+
await assert.rejects(__testing.executeReviewControllerOperation({ operation, input: "null" }, process.cwd(), native), /input must be a JSON object/);
|
|
241
|
+
}
|
|
148
242
|
assert.equal(calls, 0);
|
|
149
243
|
});
|
|
150
244
|
|
|
151
245
|
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");
|
|
246
|
+
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
247
|
let calls = 0;
|
|
154
248
|
const native = new Proxy({}, { get() { return async () => { calls++; throw new Error("unexpected native execution"); }; } }) as NativeReviewCli;
|
|
155
249
|
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";
|
|
@@ -4,9 +4,9 @@ import { dirname, join, relative, resolve, sep } from "node:path";
|
|
|
4
4
|
import test from "node:test";
|
|
5
5
|
import { REVIEW_LENS_PARITY_PATTERNS } from "./support/review-lens-parity.ts";
|
|
6
6
|
import { readDelegationDetail } from "./support/orchestrator-modules.ts";
|
|
7
|
+
import { FROZEN_SEVERITY } from "../lib/review-transaction.ts";
|
|
7
8
|
|
|
8
9
|
const ROOT = join(import.meta.dirname, "..");
|
|
9
|
-
const CANONICAL = "skills/_shared/review-ledger-contract.md";
|
|
10
10
|
const ORCHESTRATOR = ["assets/orchestrator.md", "assets/orchestrator-delegation.md", "assets/orchestrator-writer.md"];
|
|
11
11
|
const REVIEW_LENSES = [
|
|
12
12
|
"assets/agents/review-risk.md",
|
|
@@ -23,6 +23,7 @@ const README = "README.md";
|
|
|
23
23
|
const TECHNICAL_REFERENCE = "docs/readme-reference.md";
|
|
24
24
|
const CHAIN = "assets/chains/4r-review.chain.md";
|
|
25
25
|
const WORKER = "assets/agents/gentle-ai-worker.md";
|
|
26
|
+
const RDD_DEFECT_SKILL = "skills/rdd-defect-workflow/SKILL.md";
|
|
26
27
|
|
|
27
28
|
function read(path: string): string {
|
|
28
29
|
return readFileSync(join(ROOT, path), "utf8");
|
|
@@ -71,7 +72,6 @@ const OBSOLETE_JUDGMENT_DAY_REPLACEMENT =
|
|
|
71
72
|
/Judgment Day starts only when explicitly requested and replaces ordinary review for that lineage\./;
|
|
72
73
|
|
|
73
74
|
const JUDGMENT_DAY_SEMANTIC_SURFACES = [
|
|
74
|
-
CANONICAL,
|
|
75
75
|
JD_SKILL,
|
|
76
76
|
JD_PROMPTS,
|
|
77
77
|
...JUDGES,
|
|
@@ -91,39 +91,25 @@ const FIX_PATTERNS = [
|
|
|
91
91
|
/Do not add findings, alter frozen claims, authorize transitions, deliver, publish, or start another actor\./,
|
|
92
92
|
] as const;
|
|
93
93
|
|
|
94
|
-
test("
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
test("technical reference and README keep the review budget, compact states, trust boundary, and the delivery boundary", () => {
|
|
95
|
+
// The retired skills/_shared/review-ledger-contract.md carried these rules too; the
|
|
96
|
+
// technical reference is where they still live (cost-speed-painpoints P15).
|
|
97
|
+
const reference = read(TECHNICAL_REFERENCE);
|
|
98
|
+
assertMatches(TECHNICAL_REFERENCE, reference, [
|
|
99
|
+
/`low \| medium \| high` tier/,
|
|
99
100
|
/min\(200, ceil\(original_changed_lines \/ 2\)\)/,
|
|
100
101
|
/testdata\/golden\/\*\*/,
|
|
101
102
|
/`reviewing`, `correction_required`, `validating`, `approved`, and `escalated`/,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
/
|
|
105
|
-
/`pre-existing` and `base-only` findings become non-blocking follow-ups/,
|
|
106
|
-
/one correction transaction/i,
|
|
107
|
-
/original budget/i,
|
|
108
|
-
/frozen findings and genesis scope/i,
|
|
109
|
-
/content-derived revisions, compare-and-swap replacement, exact retry idempotency/i,
|
|
110
|
-
/graph-v1 ordinary lineages remain readable for compatibility but reject new mutation/i,
|
|
111
|
-
/Legacy graph bundle export\/import is retired/i,
|
|
103
|
+
/Ordinary permits one correction transaction within the original budget\./,
|
|
104
|
+
/frozen findings and genesis scope remain unchanged/,
|
|
105
|
+
/legacy graph bundle export\/import is retired/i,
|
|
112
106
|
/Judgment Day remains mutable on graph-v1/i,
|
|
113
|
-
/--agent=pi --materialize=true/,
|
|
114
|
-
/provider-owned submission form/i,
|
|
115
|
-
/self-contained authority-advancing vectors/i,
|
|
116
|
-
/Commit, push, pull-request creation, and release creation are not RDD gates/i,
|
|
117
|
-
/Review outcomes and receipt state are informational and never authorize, consume, rewrite, or block a Bash delivery command/i,
|
|
118
|
-
/Pi does not inspect RDD mode or native authority for those commands/i,
|
|
119
|
-
/Review transactions, validation, and SDD never perform delivery commands themselves/i,
|
|
120
107
|
/local orchestrator and same-user process are trusted/i,
|
|
121
|
-
/reviewer and validator outputs remain semantically untrusted/i,
|
|
122
|
-
/do not report.*trusted local orchestrator.*security finding/i,
|
|
123
|
-
/untrusted repository content.*malformed inputs.*stale authority.*path drift.*external callers/i,
|
|
124
108
|
...JUDGMENT_DAY_DISCOVERY_PATTERNS,
|
|
125
109
|
]);
|
|
126
|
-
assert.
|
|
110
|
+
assert.doesNotMatch(reference, /up to three failed targeted attempts|third failed attempt/i);
|
|
111
|
+
assert.match(read(RDD_DEFECT_SKILL), /Keep bounded review defects in one correction transaction/);
|
|
112
|
+
assert.match(reference, /Review outcomes never authorize delivery; commit, push, pull-request and release actions follow ordinary repository policy\./);
|
|
127
113
|
assert.match(read(README), /\]\(docs\/readme-reference\.md(?:#[^)]+)?\)/);
|
|
128
114
|
assert.doesNotMatch(read(README), /one one-shot authorization for the exact command/i);
|
|
129
115
|
assert.doesNotMatch(read(README), /review-publication-gate/i);
|
|
@@ -231,16 +217,6 @@ test("ordinary lens prompts contain the literal compact-v2 native result envelop
|
|
|
231
217
|
}
|
|
232
218
|
});
|
|
233
219
|
|
|
234
|
-
test("retained provider review contract preserves bounded correction without declaring approval", () => {
|
|
235
|
-
const content = read(CANONICAL);
|
|
236
|
-
assert.match(content, /one correction transaction/i);
|
|
237
|
-
assert.match(content, /original budget/i);
|
|
238
|
-
assert.match(content, /`correction_required`/);
|
|
239
|
-
assert.doesNotMatch(content, /up to three failed targeted attempts|third failed attempt/i);
|
|
240
|
-
assert.match(content, /`reviewing`, `correction_required`, `validating`, `approved`, and `escalated`/);
|
|
241
|
-
assert.match(content, /Only severe `introduced`, `behavior-activated`, or `worsened` findings with valid proof can enter `correction_ids`/);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
220
|
test("risk lens distinguishes trusted orchestration from concrete boundary bypasses", () => {
|
|
245
221
|
const content = read("assets/agents/review-risk.md");
|
|
246
222
|
assert.match(content, /local orchestrator and same-user process are trusted/i);
|
|
@@ -314,6 +290,9 @@ test("Judgment Day skill and prompts preserve bounded fix and re-judgment author
|
|
|
314
290
|
assertMatches(JD_PROMPTS, judgePrompt, JUDGMENT_DAY_DISCOVERY_PATTERNS);
|
|
315
291
|
assertMatches(JD_PROMPTS, fencedBlock(JD_PROMPTS, "## Fix Agent Prompt"), FIX_PATTERNS);
|
|
316
292
|
assertMatches(FIX_AGENT, read(FIX_AGENT), FIX_PATTERNS);
|
|
293
|
+
for (const content of [skill, judgePrompt, ...JUDGES.map(read)]) {
|
|
294
|
+
for (const severity of Object.values(FROZEN_SEVERITY)) assert.match(content, new RegExp(`\\b${severity}\\b`), "judge vocabulary must cover the canonical ledger enum");
|
|
295
|
+
}
|
|
317
296
|
});
|
|
318
297
|
|
|
319
298
|
test("Judgment Day fix routing has one canonical shape and never falls back to generic roles", () => {
|
|
@@ -330,7 +309,6 @@ test("Judgment Day fix routing has one canonical shape and never falls back to g
|
|
|
330
309
|
"## Allowed edit surfaces",
|
|
331
310
|
].join("\n");
|
|
332
311
|
for (const [path, content] of [
|
|
333
|
-
[CANONICAL, read(CANONICAL)],
|
|
334
312
|
[FIX_AGENT, read(FIX_AGENT)],
|
|
335
313
|
[JD_SKILL, read(JD_SKILL)],
|
|
336
314
|
[JD_PROMPTS, fencedBlock(JD_PROMPTS, "## Fix Agent Prompt")],
|
|
@@ -345,7 +323,8 @@ test("Judgment Day fix routing has one canonical shape and never falls back to g
|
|
|
345
323
|
});
|
|
346
324
|
|
|
347
325
|
test("orchestrator, injected skill, and technical reference defer RDD lifecycle ownership to Gentle AI", () => {
|
|
348
|
-
|
|
326
|
+
// cost-speed-painpoints S15 P5a (verdict X1): the contract is injected only while RDD is not off.
|
|
327
|
+
const boundary = "While RDD is not off, this package injects the mirrored provider-bundle review execution contract; Gentle AI writes nothing into this prompt. Absent that mirrored contract, this package invents no lifecycle instructions.";
|
|
349
328
|
const orchestrator = union(ORCHESTRATOR);
|
|
350
329
|
assert.ok(orchestrator.includes(boundary), "orchestrator must carry the sole static ownership boundary");
|
|
351
330
|
|
|
@@ -7,9 +7,8 @@ import test from "node:test";
|
|
|
7
7
|
import type { AssistantMessage, JsonObject, Tool, ToolCall } from "@earendil-works/pi-ai";
|
|
8
8
|
import type { NativeReviewCli } from "../lib/native-review-cli.ts";
|
|
9
9
|
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// guideline and leaves the capture, capture-group, and scope declarations out.
|
|
10
|
+
// With receipt-driven development off, the parent request does not require
|
|
11
|
+
// ASSESS and leaves the capture, capture-group, and scope declarations out.
|
|
13
12
|
// With RDD on, the request is exactly what the registered tools declare. Both
|
|
14
13
|
// paths run through a real Pi SDK session and inspect the provider request.
|
|
15
14
|
|
|
@@ -20,6 +19,7 @@ interface SessionRun {
|
|
|
20
19
|
requests: RecordedRequest[];
|
|
21
20
|
registered: Map<string, { description: string; promptGuidelines?: readonly string[] }>;
|
|
22
21
|
assessResults: Array<{ isError: boolean; details: unknown }>;
|
|
22
|
+
nativeCalls: { mode: number; assess: number; target: number };
|
|
23
23
|
errors: string[];
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -31,24 +31,29 @@ const NATIVE_CONTINUATION = {
|
|
|
31
31
|
arguments: [{ name: "--agent", value: "pi" }, { name: "--next-transition" }],
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
function nativeCli(mode: () => RddMode): NativeReviewCli {
|
|
34
|
+
function nativeCli(mode: () => RddMode, calls: SessionRun["nativeCalls"]): NativeReviewCli {
|
|
35
35
|
return {
|
|
36
36
|
reviewMode: async () => {
|
|
37
|
+
calls.mode++;
|
|
37
38
|
const effective = mode();
|
|
38
39
|
if (effective === "throws") throw new Error("native review mode is unavailable");
|
|
39
40
|
return { operation: "status", scope: "clone", status: { global: effective, cloneLocal: "", effective, source: "global" } };
|
|
40
41
|
},
|
|
41
|
-
assess: async () =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
assess: async () => {
|
|
43
|
+
calls.assess++;
|
|
44
|
+
return {
|
|
45
|
+
schema: "gentle-ai.review-assessment/v1",
|
|
46
|
+
risk: "high",
|
|
47
|
+
reviewDue: true,
|
|
48
|
+
reviewDueReason: "high_risk",
|
|
49
|
+
nextTransition: NATIVE_CONTINUATION,
|
|
50
|
+
reasons: [],
|
|
51
|
+
changedPaths: 1,
|
|
52
|
+
changedLines: 3,
|
|
53
|
+
candidate: { kind: "current-changes", baseRef: undefined },
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
targetStatus: async () => { calls.target++; return { applicability: "current_target", targetIdentity: "fixture" }; },
|
|
52
57
|
} as unknown as NativeReviewCli;
|
|
53
58
|
}
|
|
54
59
|
|
|
@@ -58,6 +63,7 @@ async function runSession(
|
|
|
58
63
|
bindings: Record<string, string>,
|
|
59
64
|
mode: () => RddMode,
|
|
60
65
|
beforeSecondPrompt: () => void = () => {},
|
|
66
|
+
extra?: { tools: string[]; install: (pi: import("@earendil-works/pi-coding-agent").ExtensionAPI) => void },
|
|
61
67
|
): Promise<SessionRun> {
|
|
62
68
|
const sdk = await import("@earendil-works/pi-coding-agent");
|
|
63
69
|
const ai = await import("@earendil-works/pi-ai");
|
|
@@ -66,9 +72,9 @@ async function runSession(
|
|
|
66
72
|
mkdirSync(cwd);
|
|
67
73
|
const gitEnv = { PATH: process.env.PATH, HOME: root, GIT_CONFIG_NOSYSTEM: "1", GIT_CONFIG_GLOBAL: join(root, "gitconfig") };
|
|
68
74
|
writeFileSync(gitEnv.GIT_CONFIG_GLOBAL, "");
|
|
75
|
+
// The stubbed review client needs a repository root, not a committed candidate.
|
|
69
76
|
execFileSync("git", ["init", "--initial-branch=fixture"], { cwd, env: gitEnv, stdio: "ignore" });
|
|
70
|
-
|
|
71
|
-
const run: SessionRun = { requests: [], registered: new Map(), assessResults: [], errors: [] };
|
|
77
|
+
const run: SessionRun = { requests: [], registered: new Map(), assessResults: [], nativeCalls: { mode: 0, assess: 0, target: 0 }, errors: [] };
|
|
72
78
|
let next: { name: string; arguments: JsonObject } | undefined;
|
|
73
79
|
let calls = 0;
|
|
74
80
|
const model = { id: "driver", name: "Local driver", provider: "loadout-fixture", api: "loadout-fixture", baseUrl: "http://invalid.local", reasoning: false, input: ["text"], contextWindow: 1_000_000, maxTokens: 1024, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 } } as const;
|
|
@@ -85,11 +91,12 @@ async function runSession(
|
|
|
85
91
|
return registerTool(definition as never);
|
|
86
92
|
}) as typeof pi.registerTool;
|
|
87
93
|
createGentleAiExtension({
|
|
88
|
-
nativeReviewCli: nativeCli(mode),
|
|
94
|
+
nativeReviewCli: nativeCli(mode, run.nativeCalls),
|
|
89
95
|
candidateViews: null,
|
|
90
96
|
processEnv: { ...bindings, GENTLE_AI_TELEMETRY: "0" },
|
|
91
97
|
resolveTelemetryTriggerBinary: () => { throw new Error("fixture"); },
|
|
92
98
|
})(pi);
|
|
99
|
+
extra?.install(pi);
|
|
93
100
|
pi.on("tool_result", (event) => {
|
|
94
101
|
if (event.toolName === "gentle_review") run.assessResults.push({ isError: event.isError, details: event.details });
|
|
95
102
|
});
|
|
@@ -125,7 +132,7 @@ async function runSession(
|
|
|
125
132
|
assert.deepEqual(loader.getExtensions().errors, []);
|
|
126
133
|
const { session } = await sdk.createAgentSession({
|
|
127
134
|
cwd, agentDir: bindings.PI_CODING_AGENT_DIR, modelRuntime: runtime, model: model as never, thinkingLevel: "off", resourceLoader: loader,
|
|
128
|
-
tools: ["read", "gentle_review", ...HIDDEN_WHEN_OFF], sessionManager: manager, settingsManager: settings,
|
|
135
|
+
tools: ["read", "gentle_review", ...HIDDEN_WHEN_OFF, ...(extra?.tools ?? [])], sessionManager: manager, settingsManager: settings,
|
|
129
136
|
});
|
|
130
137
|
try {
|
|
131
138
|
await session.bindExtensions({ mode: "json", onError: (error) => run.errors.push(error.error) });
|
|
@@ -140,7 +147,7 @@ async function runSession(
|
|
|
140
147
|
return run;
|
|
141
148
|
}
|
|
142
149
|
|
|
143
|
-
const LEAN_GUIDELINE = /
|
|
150
|
+
const LEAN_GUIDELINE = /RDD off does not require an assessment/;
|
|
144
151
|
|
|
145
152
|
function fixture(t: { after: (fn: () => void) => void }): { root: string; bindings: Record<string, string> } {
|
|
146
153
|
const root = realpathSync(mkdtempSync(join(tmpdir(), "gentle-review-loadout-")));
|
|
@@ -171,10 +178,8 @@ function registeredGuidelines(run: SessionRun): string[] {
|
|
|
171
178
|
function assertLeanRequest(request: RecordedRequest, run: SessionRun): void {
|
|
172
179
|
assert.match(request.systemPrompt, /Receipt-driven development: off /);
|
|
173
180
|
assert.match(request.systemPrompt, LEAN_GUIDELINE);
|
|
174
|
-
assert.
|
|
175
|
-
assert.match(request.systemPrompt, /
|
|
176
|
-
assert.doesNotMatch(request.systemPrompt, /relay it unchanged and follow it/);
|
|
177
|
-
assert.match(request.systemPrompt, /Continue the returned verification plan/);
|
|
181
|
+
assert.doesNotMatch(request.systemPrompt, /after an authorized implementation, delegated or inline, call it over the diff/);
|
|
182
|
+
assert.match(request.systemPrompt, /named Task Size high-risk item still requires one independent verifier/);
|
|
178
183
|
assert.match(request.systemPrompt, /tests, builds, and functional checks still run/);
|
|
179
184
|
for (const guideline of registeredGuidelines(run)) assert.equal(request.systemPrompt.includes(guideline), false, `RDD off must leave out: ${guideline.slice(0, 80)}`);
|
|
180
185
|
const names = request.tools.map((tool) => tool.name);
|
|
@@ -193,7 +198,7 @@ function assertRegisteredRequest(request: RecordedRequest, run: SessionRun): voi
|
|
|
193
198
|
}
|
|
194
199
|
}
|
|
195
200
|
|
|
196
|
-
test("RDD off: the parent request
|
|
201
|
+
test("RDD off: the parent request does not mandate ASSESS; RDD on keeps the registered review loadout", { timeout: 30_000 }, async (t) => {
|
|
197
202
|
const { root, bindings } = fixture(t);
|
|
198
203
|
const off = await runSession(root, "off", bindings, () => "off");
|
|
199
204
|
const on = await runSession(root, "on", bindings, () => "on");
|
|
@@ -211,9 +216,11 @@ test("RDD off: the parent request carries only the lean ASSESS loadout; RDD on:
|
|
|
211
216
|
assert.equal((off.assessResults[0].details as { schema?: string }).schema, "gentle-pi.review-assessment-plan/v1");
|
|
212
217
|
const plan = off.assessResults[0].details as Record<string, unknown>;
|
|
213
218
|
assert.equal(plan.rddLine, "off");
|
|
214
|
-
assert.equal(plan.
|
|
215
|
-
assert.equal(plan.
|
|
216
|
-
assert.
|
|
219
|
+
assert.equal(plan.nativeRisk, "unassessable");
|
|
220
|
+
assert.equal(plan.candidate, null);
|
|
221
|
+
for (const field of ["reviewDue", "reviewDueReason", "nextTransition"]) assert.equal(Object.hasOwn(plan, field), false);
|
|
222
|
+
assert.equal(off.nativeCalls.assess, 0);
|
|
223
|
+
assert.equal(off.nativeCalls.target, 0);
|
|
217
224
|
assert.equal((plan.plan as Record<string, unknown>).writerSelfVerification, true);
|
|
218
225
|
assert.equal((plan.plan as Record<string, unknown>).independentVerifier, true);
|
|
219
226
|
|
|
@@ -223,6 +230,9 @@ test("RDD off: the parent request carries only the lean ASSESS loadout; RDD on:
|
|
|
223
230
|
}
|
|
224
231
|
assert.equal(on.assessResults.length, 1);
|
|
225
232
|
assert.equal(on.assessResults[0].isError, false);
|
|
233
|
+
assert.equal(on.nativeCalls.assess, 1);
|
|
234
|
+
assert.equal(on.nativeCalls.target, 1);
|
|
235
|
+
assert.deepEqual((on.assessResults[0].details as Record<string, unknown>).nextTransition, NATIVE_CONTINUATION);
|
|
226
236
|
|
|
227
237
|
const bytes = (request: RecordedRequest) => ({
|
|
228
238
|
systemPrompt: Buffer.byteLength(request.systemPrompt),
|
|
@@ -244,15 +254,68 @@ test("an unknown RDD line keeps the registered loadout; turning RDD on mid-sessi
|
|
|
244
254
|
assert.match(request.systemPrompt, /Receipt-driven development: unknown/);
|
|
245
255
|
assertRegisteredRequest(request, unknown);
|
|
246
256
|
}
|
|
257
|
+
assert.equal(unknown.nativeCalls.assess, 1);
|
|
258
|
+
assert.equal(unknown.nativeCalls.target, 1);
|
|
247
259
|
|
|
248
260
|
let mode: RddMode = "off";
|
|
249
|
-
const flipped = await runSession(root, "flip", bindings, () => mode, () => {
|
|
250
|
-
mode = "on";
|
|
251
|
-
__testing.clearRddStatusMemoForTesting();
|
|
252
|
-
});
|
|
261
|
+
const flipped = await runSession(root, "flip", bindings, () => mode, () => { mode = "on"; });
|
|
253
262
|
assert.deepEqual(flipped.errors, []);
|
|
254
263
|
const last = flipped.requests.at(-1)!;
|
|
255
264
|
for (const request of flipped.requests.slice(0, -1)) assertLeanRequest(request, flipped);
|
|
256
265
|
assert.match(last.systemPrompt, /Receipt-driven development: on /);
|
|
257
266
|
assertRegisteredRequest(last, flipped);
|
|
267
|
+
|
|
268
|
+
mode = "off";
|
|
269
|
+
const failed = await runSession(root, "failed-after-off", bindings, () => mode, () => { mode = "throws"; });
|
|
270
|
+
assert.deepEqual(failed.errors, []);
|
|
271
|
+
assert.match(failed.requests.at(-1)!.systemPrompt, /Receipt-driven development: unknown/);
|
|
272
|
+
assertRegisteredRequest(failed.requests.at(-1)!, failed);
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
test("malformed fresh reads restore guidance while on and unknown preserve pinning", { timeout: 30_000 }, async (t) => {
|
|
276
|
+
const { root, bindings } = fixture(t);
|
|
277
|
+
for (const [initial, next, expected] of [["off", "malformed", "unknown"], ["on", "throws", "on"], ["throws", "on", "unknown"]] as const) {
|
|
278
|
+
let mode: RddMode = initial;
|
|
279
|
+
const run = await runSession(root, `independent-${initial}`, bindings, () => mode, () => { mode = next as RddMode; });
|
|
280
|
+
assert.deepEqual(run.errors, []);
|
|
281
|
+
assert.match(run.requests.at(-1)!.systemPrompt, new RegExp(`Receipt-driven development: ${expected}`));
|
|
282
|
+
assertRegisteredRequest(run.requests.at(-1)!, run);
|
|
283
|
+
if (initial === "off") {
|
|
284
|
+
assertLeanRequest(run.requests[0], run);
|
|
285
|
+
assert.equal(run.nativeCalls.assess, 0);
|
|
286
|
+
assert.equal(run.nativeCalls.target, 0);
|
|
287
|
+
} else {
|
|
288
|
+
assert.equal(run.nativeCalls.assess, 1);
|
|
289
|
+
assert.equal(run.nativeCalls.target, 1);
|
|
290
|
+
assert.equal(new Set(run.requests.map((request) => request.systemPrompt)).size, 1);
|
|
291
|
+
}
|
|
292
|
+
t.diagnostic(JSON.stringify({ initial, next, expected, requests: run.requests.length, calls: run.nativeCalls, errors: run.errors }));
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// P3 (tools by mode): another tool hidden behind codemode joins the RDD-off
|
|
297
|
+
// projection; it never replaces it, and the request stays stable across turns.
|
|
298
|
+
test("RDD off: the review capture tools stay hidden beside a tool hidden behind codemode", { timeout: 30_000 }, async (t) => {
|
|
299
|
+
const { root, bindings } = fixture(t);
|
|
300
|
+
const { default: gentleGuide } = await import("../extensions/gentle-guide.ts");
|
|
301
|
+
const { registerCompactCodemode } = await import("../lib/codemode-renderer.ts");
|
|
302
|
+
const extra = { tools: ["gentle_guide", "codemode"], install: (pi: import("@earendil-works/pi-coding-agent").ExtensionAPI) => { gentleGuide(pi, {}); registerCompactCodemode(pi); } };
|
|
303
|
+
const off = await runSession(root, "off-codemode", bindings, () => "off", () => {}, extra);
|
|
304
|
+
assert.deepEqual(off.errors, []);
|
|
305
|
+
for (const request of off.requests) {
|
|
306
|
+
assertLeanRequest(request, off);
|
|
307
|
+
assert.match(request.systemPrompt, /gentle_review\* tools are model-only: use direct tool calls, never tools\.gentle_review\(\.\.\.\) in codemode/);
|
|
308
|
+
assert.match(request.systemPrompt, /ALL_TOOLS lists only callable tools; absence there does not mean the direct tool is unavailable/);
|
|
309
|
+
assert.match(request.tools.find(tool => tool.name === "gentle_review")!.description, /Call directly, never through codemode/);
|
|
310
|
+
const names = request.tools.map((tool) => tool.name);
|
|
311
|
+
assert.deepEqual(names, ["read", "gentle_review", "codemode"], "review capture tools and the guide are all left out");
|
|
312
|
+
}
|
|
313
|
+
assert.equal(new Set(off.requests.map((request) => JSON.stringify(request.tools.map((tool) => tool.name)))).size, 1);
|
|
314
|
+
const on = await runSession(root, "on-codemode", bindings, () => "on", () => {}, extra);
|
|
315
|
+
assert.deepEqual(on.errors, []);
|
|
316
|
+
for (const request of on.requests) {
|
|
317
|
+
assert.deepEqual(request.tools.map((tool) => tool.name), ["read", "gentle_review", ...HIDDEN_WHEN_OFF, "codemode"], "RDD on declares the review family; the guide stays behind codemode");
|
|
318
|
+
assert.match(request.systemPrompt, /gentle_review\* tools are model-only: use direct tool calls/);
|
|
319
|
+
assert.match(request.tools.find(tool => tool.name === "gentle_review")!.description, /Call directly, never through codemode/);
|
|
320
|
+
}
|
|
258
321
|
});
|