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
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import test from "node:test";
|
|
6
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { createGentleAiExtension } from "../extensions/gentle-ai.ts";
|
|
8
|
+
import { VERIFIER_RISK_REJECTION, declaredHighRiskItem, rejectUnriskedVerifierLaunch } from "../lib/verifier-admission.ts";
|
|
9
|
+
import {
|
|
10
|
+
VERIFIER_SETTLE_REMINDER_TYPE,
|
|
11
|
+
createVerifierSettleReminders,
|
|
12
|
+
finalAssistantText,
|
|
13
|
+
verifierSettleReminderText,
|
|
14
|
+
} from "../lib/verifier-settle-reminder.ts";
|
|
15
|
+
|
|
16
|
+
// odd/tasks/verifier-settle-reminder.md (#2652): a run that declares `Risk: item N` in its final message and never
|
|
17
|
+
// attempted a `gentle-ai-verify` launch gets one visible reminder and one continuation at settle.
|
|
18
|
+
|
|
19
|
+
const assistant = (text: string) => ({ role: "assistant", content: [{ type: "text", text }] });
|
|
20
|
+
const user = (text: string) => ({ role: "user", content: [{ type: "text", text }] });
|
|
21
|
+
|
|
22
|
+
test("S1: the settle check reuses the admission grammar and names the declared item", () => {
|
|
23
|
+
assert.equal(declaredHighRiskItem("Done.\nRisk: item 3 (shared parser)"), 3);
|
|
24
|
+
assert.equal(declaredHighRiskItem("Done. Risk: item 2, item 3 (auth)"), 2);
|
|
25
|
+
for (const text of ["Done.\nRisk: none", "Do not write Risk: item 3 here.", "Risk: item 7", "Done."]) {
|
|
26
|
+
assert.equal(declaredHighRiskItem(text), undefined, text);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test("S1: the final assistant text is the last assistant message's text", () => {
|
|
31
|
+
const messages = [user("Fix it."), assistant("Risk: item 1"), user("And?"), { role: "assistant", content: [{ type: "thinking", thinking: "Risk: item 4" }, { type: "text", text: "Done.\nRisk: item 2" }] }, { role: "toolResult", content: [] }];
|
|
32
|
+
assert.equal(finalAssistantText(messages), "Done.\nRisk: item 2");
|
|
33
|
+
assert.equal(finalAssistantText([user("Risk: item 3")]), undefined);
|
|
34
|
+
assert.equal(finalAssistantText([{ role: "assistant", content: "Risk: item 5" }]), "Risk: item 5");
|
|
35
|
+
// Adjacent text blocks are one rendered text: a split near-miss never becomes a line-start declaration.
|
|
36
|
+
const split = finalAssistantText([{ role: "assistant", content: [{ type: "text", text: "Do not write " }, { type: "text", text: "Risk: item 3 here." }] }]);
|
|
37
|
+
assert.equal(split, "Do not write Risk: item 3 here.");
|
|
38
|
+
assert.equal(declaredHighRiskItem(split!), undefined);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("S2: the reminder names the item, the launch, the approval rule, and the Needs your decision close", () => {
|
|
42
|
+
const text = verifierSettleReminderText(4);
|
|
43
|
+
assert.match(text, /`Risk: item 4`/);
|
|
44
|
+
assert.match(text, /launch `gentle-ai-verify` with the `Risk: item 4` line in its `task`/);
|
|
45
|
+
assert.match(text, /a user's visual or manual approval does not replace technical verification/i);
|
|
46
|
+
assert.match(text, /close with \*\*Needs your decision\*\* naming the missing proof/);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("S1/S3: one reminder per user prompt, none for Risk: none or after a verifier attempt", () => {
|
|
50
|
+
const reminders = createVerifierSettleReminders<string>();
|
|
51
|
+
reminders.userPrompt("s");
|
|
52
|
+
assert.equal(reminders.beforeSettle("s", "Done.\nRisk: none"), undefined, "Risk: none earns no reminder");
|
|
53
|
+
assert.equal(reminders.beforeSettle("s", "Done."), undefined, "no declaration earns no reminder");
|
|
54
|
+
assert.equal(reminders.beforeSettle("s", undefined), undefined, "no final text earns no reminder");
|
|
55
|
+
assert.equal(reminders.beforeSettle("s", "Done.\nRisk: item 3"), verifierSettleReminderText(3), "the first declared settle reminds");
|
|
56
|
+
assert.equal(reminders.beforeSettle("s", "Still done.\nRisk: item 3"), undefined, "the continuation of the same prompt is not reminded again");
|
|
57
|
+
reminders.userPrompt("s");
|
|
58
|
+
assert.equal(reminders.beforeSettle("s", "Risk: item 1"), verifierSettleReminderText(1), "a new user prompt resets the reminder");
|
|
59
|
+
reminders.userPrompt("s");
|
|
60
|
+
reminders.toolCall("s", "subagent_run", { agent: "gentle-ai-verify", task: "Verify it." });
|
|
61
|
+
assert.equal(reminders.beforeSettle("s", "Risk: item 1"), undefined, "an attempted verifier launch, even one rejected, earns no reminder");
|
|
62
|
+
reminders.userPrompt("s");
|
|
63
|
+
reminders.toolCall("s", "subagent_run", { agent: "gentle-ai-worker", task: "Risk: item 1" });
|
|
64
|
+
reminders.toolCall("s", "subagent_continue", { agent: "gentle-ai-verify", task_id: "t-1" });
|
|
65
|
+
assert.equal(reminders.beforeSettle("s", "Risk: item 1"), verifierSettleReminderText(1), "other agents and continuations are not verifier attempts");
|
|
66
|
+
assert.equal(reminders.beforeSettle("other", "Risk: item 2"), verifierSettleReminderText(2), "sessions are independent");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("S4: the admission rejection says no supported declaration was recognized", (t) => {
|
|
70
|
+
assert.doesNotMatch(VERIFIER_RISK_REJECTION, /This change declares none/);
|
|
71
|
+
assert.match(VERIFIER_RISK_REJECTION, /No supported `Risk: item N` declaration was recognized in the launch `task` or `context`/);
|
|
72
|
+
assert.match(VERIFIER_RISK_REJECTION, /run its focused test and suite inline yourself now/);
|
|
73
|
+
assert.match(VERIFIER_RISK_REJECTION, /never add a Risk line or create a feature document only to get a verifier admitted/);
|
|
74
|
+
const root = mkdtempSync(join(tmpdir(), "verifier-settle-"));
|
|
75
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
76
|
+
const denied = rejectUnriskedVerifierLaunch({ agent: "gentle-ai-verify", task: "Verify it." }, { root, contextUsage: { tokens: 0, contextWindow: 400_000 } });
|
|
77
|
+
assert.equal(denied?.reason, VERIFIER_RISK_REJECTION);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
type Handler = (event: unknown, ctx: ExtensionContext) => unknown;
|
|
81
|
+
interface SettleResult { entries?: Array<{ type: string; customType?: string; content?: unknown; display?: boolean }>; continue?: boolean }
|
|
82
|
+
|
|
83
|
+
function hookedExtension(processEnv: NodeJS.ProcessEnv = {}) {
|
|
84
|
+
const handlers = new Map<string, Handler[]>();
|
|
85
|
+
const sent: unknown[] = [];
|
|
86
|
+
const pi = {
|
|
87
|
+
on(name: string, handler: Handler) { handlers.set(name, [...(handlers.get(name) ?? []), handler]); },
|
|
88
|
+
events: { emit() {}, on() { return () => {}; } },
|
|
89
|
+
registerCommand() {}, registerTool() {}, registerShortcut() {}, registerFlag() {}, registerMessageRenderer() {},
|
|
90
|
+
sendMessage(message: unknown) { sent.push(message); },
|
|
91
|
+
appendEntry() {},
|
|
92
|
+
} as unknown as ExtensionAPI;
|
|
93
|
+
createGentleAiExtension({ nativeReviewCli: null, processEnv })(pi);
|
|
94
|
+
const ctx = {
|
|
95
|
+
cwd: tmpdir(), hasUI: false, ui: { confirm: async () => true, notify() {}, setStatus() {} },
|
|
96
|
+
getContextUsage: () => ({ tokens: 0, contextWindow: 272_000, percent: 0 }),
|
|
97
|
+
sessionManager: { getSessionId: () => "session-1", getCwd: () => tmpdir(), getEntries: () => [], getBranch: () => [] },
|
|
98
|
+
} as unknown as ExtensionContext;
|
|
99
|
+
const emit = async (name: string, event: unknown) => {
|
|
100
|
+
let last: unknown;
|
|
101
|
+
for (const handler of handlers.get(name) ?? []) last = await handler(event, ctx);
|
|
102
|
+
return last;
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
input: (text = "Do it.") => emit("input", { type: "input", text, source: "interactive" }),
|
|
106
|
+
toolCall: (toolName: string, input: Record<string, unknown>) => emit("tool_call", { type: "tool_call", toolName, toolCallId: "c-1", input }),
|
|
107
|
+
settle: async (finalText: string, entries: unknown[] = []) => (await emit("agent_before_settle", {
|
|
108
|
+
type: "agent_before_settle", entries, continue: false, outcome: "completed",
|
|
109
|
+
context: { contextEntries: [], contextMessages: [user("Do it."), assistant(finalText)], llmMessages: [], pendingMessages: [], canContinue: false },
|
|
110
|
+
})) as SettleResult | undefined,
|
|
111
|
+
agentStart: (event: Record<string, unknown> = {}) => emit("before_agent_start", { type: "before_agent_start", prompt: "Do it.", systemPrompt: "", ...event }),
|
|
112
|
+
agentEnd: () => emit("agent_end", { type: "agent_end", messages: [] }),
|
|
113
|
+
settled: () => emit("agent_settled", { type: "agent_settled" }),
|
|
114
|
+
sent,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
test("S1/S2: the settle hook appends one visible reminder and requests one continuation", async () => {
|
|
119
|
+
const session = hookedExtension();
|
|
120
|
+
await session.input();
|
|
121
|
+
const prior = { type: "custom", customType: "other.extension" };
|
|
122
|
+
const result = await session.settle("Implemented.\nRisk: item 3 (shared parser)", [prior]);
|
|
123
|
+
assert.equal(result?.continue, true);
|
|
124
|
+
assert.equal(result?.entries?.length, 2, "earlier proposed entries are kept");
|
|
125
|
+
assert.deepEqual(result?.entries?.[0], prior);
|
|
126
|
+
const reminder = result?.entries?.[1];
|
|
127
|
+
assert.equal(reminder?.type, "custom_message");
|
|
128
|
+
assert.equal(reminder?.customType, VERIFIER_SETTLE_REMINDER_TYPE);
|
|
129
|
+
assert.equal(reminder?.display, true, "the reminder is visible");
|
|
130
|
+
assert.equal(reminder?.content, verifierSettleReminderText(3));
|
|
131
|
+
assert.equal(await session.settle("Ran the verifier? No.\nRisk: item 3"), undefined, "the continuation of the same prompt is not reminded again");
|
|
132
|
+
await session.input("Next task.");
|
|
133
|
+
assert.equal((await session.settle("Risk: item 2"))?.continue, true, "a new user prompt resets the reminder");
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test("S3: no settle reminder for Risk: none, no item, or a rejected verifier attempt", async () => {
|
|
137
|
+
const session = hookedExtension();
|
|
138
|
+
await session.input();
|
|
139
|
+
assert.equal(await session.settle("Done.\nRisk: none"), undefined);
|
|
140
|
+
assert.equal(await session.settle("Done."), undefined);
|
|
141
|
+
const rejected = await session.toolCall("subagent_run", { agent: "gentle-ai-verify", mode: "task", task: "Verify the change." }) as { block?: boolean } | undefined;
|
|
142
|
+
assert.equal(rejected?.block, true, "the admission still rejects the unrisked launch");
|
|
143
|
+
assert.equal(await session.settle("Done.\nRisk: item 3"), undefined, "a rejected verifier attempt counts as attempted");
|
|
144
|
+
await session.input("Again.");
|
|
145
|
+
const admitted = await session.toolCall("subagent_run", { agent: "gentle-ai-verify", mode: "task", task: "Verify it.\nRisk: item 3" }) as { block?: boolean } | undefined;
|
|
146
|
+
assert.equal(admitted?.block, undefined);
|
|
147
|
+
assert.equal(await session.settle("Done.\nRisk: item 3"), undefined, "an admitted verifier attempt counts as attempted");
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
test("S1: a child session never gets the settle reminder", async () => {
|
|
151
|
+
const child = hookedExtension({ GENTLE_PI_AGENTS_CHILD: "1" });
|
|
152
|
+
await child.input();
|
|
153
|
+
assert.equal(await child.settle("Done.\nRisk: item 3"), undefined);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test("S1: the existing agent_end review preflight stays inert without a native review CLI", async () => {
|
|
157
|
+
const session = hookedExtension();
|
|
158
|
+
await session.input();
|
|
159
|
+
await session.agentEnd();
|
|
160
|
+
assert.deepEqual(session.sent, [], "agent_end sends no preflight nudge and the settle reminder never uses sendMessage");
|
|
161
|
+
await session.settle("Risk: item 1");
|
|
162
|
+
assert.deepEqual(session.sent, []);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
test("S5: the gentle_review input description documents the ASSESS escalate shape", () => {
|
|
166
|
+
const source = readFileSync(join(import.meta.dirname, "..", "extensions", "gentle-ai.ts"), "utf8");
|
|
167
|
+
const description = source.split("\n").find(line => line.includes("ASSESS accepts an optional object with baseRef"));
|
|
168
|
+
assert.ok(description, "the gentle_review input description exists");
|
|
169
|
+
assert.match(description, /writerEffort, nativeReviewOutcome, and escalate/);
|
|
170
|
+
assert.match(description, /escalate is \{\\"item\\":N,\\"reason\\":\\"\.\.\.\\"\} with item an integer from 1 to 6 and a non-empty reason of at most 500 characters; any other shape is rejected, and omitting it means no escalation/);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
test("S6: the reference docs describe the settle reminder", () => {
|
|
174
|
+
const docs = readFileSync(join(import.meta.dirname, "..", "docs", "readme-reference.md"), "utf8");
|
|
175
|
+
const start = docs.indexOf("A third admission check keeps the independent verifier for high-risk changes");
|
|
176
|
+
assert.ok(start >= 0);
|
|
177
|
+
const paragraph = docs.slice(start, docs.indexOf("\n\n", docs.indexOf("\n\n", start) + 2));
|
|
178
|
+
assert.match(paragraph, /no supported `Risk: item N` declaration was recognized/);
|
|
179
|
+
assert.match(paragraph, /`agent_before_settle`[^]*one visible reminder[^]*one continuation/);
|
|
180
|
+
assert.match(paragraph, /once per user prompt/);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// #2652 regression: a real Pi session hands `agent_before_settle` a completed run with `canContinue: false` (the last
|
|
184
|
+
// message is the assistant's). The reminder must still be appended and continue exactly once.
|
|
185
|
+
test("a real Pi session appends one settle reminder and continues once after a declared high risk", async () => {
|
|
186
|
+
const sdk = await import("@earendil-works/pi-coding-agent");
|
|
187
|
+
const ai = await import("@earendil-works/pi-ai");
|
|
188
|
+
const root = mkdtempSync(join(tmpdir(), "vsr-"));
|
|
189
|
+
const profile = join(root, "profile");
|
|
190
|
+
const bindings: Record<string, string> = { PI_CODING_AGENT_DIR: profile, PI_CODING_AGENT_SESSION_DIR: join(root, "sessions"), GENTLE_PI_AGENT_HOME: profile, GENTLE_PI_CONFIG_HOME: join(root, "config") };
|
|
191
|
+
const previous = Object.fromEntries(Object.keys(bindings).map(key => [key, process.env[key]]));
|
|
192
|
+
Object.assign(process.env, bindings);
|
|
193
|
+
const replies = ["Implemented.\nRisk: item 6 (no regression test)"];
|
|
194
|
+
let calls = 0;
|
|
195
|
+
const usage = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 0, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } };
|
|
196
|
+
const cost = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
197
|
+
const model = { id: "driver", name: "driver", provider: "fx", api: "fx", baseUrl: "http://invalid.local", reasoning: false, input: ["text"], contextWindow: 1_000_000, maxTokens: 1024, cost } as any;
|
|
198
|
+
try {
|
|
199
|
+
const { mkdirSync } = await import("node:fs");
|
|
200
|
+
mkdirSync(profile);
|
|
201
|
+
const manager = sdk.SessionManager.inMemory(root);
|
|
202
|
+
const settings = sdk.SettingsManager.inMemory({ compaction: { enabled: false }, retry: { enabled: false }, cacheWarming: "off", packages: [] } as any);
|
|
203
|
+
const runtime = await sdk.ModelRuntime.create({ credentials: new ai.InMemoryCredentialStore(), modelsPath: null, modelsStorePath: join(root, "models.json"), refreshOnCreate: false, allowModelNetwork: false } as any);
|
|
204
|
+
const loader = new sdk.DefaultResourceLoader({
|
|
205
|
+
cwd: root, agentDir: profile, settingsManager: settings, noExtensions: true, noSkills: true, noPromptTemplates: true, noThemes: true, noContextFiles: true, systemPrompt: "fixture",
|
|
206
|
+
extensionFactories: [(pi: ExtensionAPI) => {
|
|
207
|
+
createGentleAiExtension({ nativeReviewCli: null, candidateViews: null, processEnv: bindings, resolveTelemetryTriggerBinary: () => { throw new Error("fixture"); } } as any)(pi);
|
|
208
|
+
pi.registerProvider("fx", {
|
|
209
|
+
api: "fx", apiKey: "x", baseUrl: "http://invalid.local",
|
|
210
|
+
models: [{ id: model.id, name: model.name, reasoning: false, input: ["text"], cost, contextWindow: model.contextWindow, maxTokens: model.maxTokens }],
|
|
211
|
+
streamSimple() {
|
|
212
|
+
const stream = ai.createAssistantMessageEventStream();
|
|
213
|
+
calls++;
|
|
214
|
+
const message = { role: "assistant", api: "fx", provider: "fx", model: "driver", content: [{ type: "text", text: replies.shift() ?? "Needs your decision: independent verification is pending." }], stopReason: "stop", timestamp: Date.now(), usage } as any;
|
|
215
|
+
queueMicrotask(() => { stream.push({ type: "start", partial: message }); stream.push({ type: "done", reason: "stop", message }); stream.end(); });
|
|
216
|
+
return stream;
|
|
217
|
+
},
|
|
218
|
+
} as any);
|
|
219
|
+
}],
|
|
220
|
+
} as any);
|
|
221
|
+
await loader.reload();
|
|
222
|
+
const { session } = await sdk.createAgentSession({ cwd: root, agentDir: profile, modelRuntime: runtime, model, thinkingLevel: "off", resourceLoader: loader, tools: [], sessionManager: manager, settingsManager: settings } as any);
|
|
223
|
+
const errors: unknown[] = [];
|
|
224
|
+
await session.bindExtensions({ mode: "json", onError: (error: any) => errors.push(error.error) } as any);
|
|
225
|
+
await session.prompt("Do the change.", { source: "interactive" } as any);
|
|
226
|
+
const reminders = manager.getEntries().filter((entry: any) => entry.type === "custom_message" && entry.customType === "gentle-pi.verifier-settle-reminder");
|
|
227
|
+
await session.abort();
|
|
228
|
+
session.dispose();
|
|
229
|
+
assert.deepEqual(errors, []);
|
|
230
|
+
assert.equal(reminders.length, 1);
|
|
231
|
+
assert.equal(calls, 2);
|
|
232
|
+
} finally {
|
|
233
|
+
for (const [key, value] of Object.entries(previous)) { if (value === undefined) delete process.env[key]; else process.env[key] = value; }
|
|
234
|
+
rmSync(root, { recursive: true, force: true });
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
// #2653 follow-up: an in-process named-agent run never records verifier attempts (its tool calls are not primary), so its
|
|
239
|
+
// settle must never remind, whatever its final text declares. The next primary run still is reminded.
|
|
240
|
+
test("S1: a named-agent run is never reminded at settle, and the next primary run still is", async () => {
|
|
241
|
+
const session = hookedExtension();
|
|
242
|
+
await session.input();
|
|
243
|
+
await session.agentStart({ agentName: "gentle-ai-worker" });
|
|
244
|
+
await session.agentEnd();
|
|
245
|
+
assert.equal(await session.settle("Worker done.\nRisk: item 3 (shared parser)"), undefined);
|
|
246
|
+
await session.settled();
|
|
247
|
+
await session.agentStart();
|
|
248
|
+
const result = await session.settle("Implemented.\nRisk: item 3 (shared parser)");
|
|
249
|
+
assert.equal(result?.continue, true);
|
|
250
|
+
assert.equal(result?.entries?.[0]?.content, verifierSettleReminderText(3));
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
// A named agent nested inside a primary run settles before it. Its settle is paired off without touching the primary
|
|
254
|
+
// run's classification, and without relying on `agent_end` (which, without native review, never pairs the depth off).
|
|
255
|
+
test("S1: a named-agent run nested in a primary run does not suppress the primary run's reminder", async () => {
|
|
256
|
+
const session = hookedExtension();
|
|
257
|
+
await session.input();
|
|
258
|
+
await session.agentStart();
|
|
259
|
+
await session.agentStart({ agentName: "review-readability" });
|
|
260
|
+
await session.agentEnd();
|
|
261
|
+
assert.equal(await session.settle("Review done.\nRisk: item 2 (auth)"), undefined, "the nested named run is not reminded");
|
|
262
|
+
await session.settled();
|
|
263
|
+
await session.agentEnd();
|
|
264
|
+
const result = await session.settle("Implemented.\nRisk: item 3 (shared parser)");
|
|
265
|
+
assert.equal(result?.continue, true, "the primary run is still reminded");
|
|
266
|
+
assert.equal(result?.entries?.[0]?.content, verifierSettleReminderText(3));
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
// Pi can check settlement again after a continuation without a new `before_agent_start`, so a named run stays named until
|
|
270
|
+
// `agent_settled`, and only then does the next settle count as the primary run's.
|
|
271
|
+
test("S1: a named-agent run stays unreminded across continuation settles until it has settled", async () => {
|
|
272
|
+
const session = hookedExtension();
|
|
273
|
+
await session.input();
|
|
274
|
+
await session.agentStart();
|
|
275
|
+
await session.agentStart({ agentName: "review-readability" });
|
|
276
|
+
assert.equal(await session.settle("Review done.\nRisk: item 2 (auth)"), undefined);
|
|
277
|
+
assert.equal(await session.settle("Review still done.\nRisk: item 2 (auth)"), undefined, "a continuation settle of the named run is not reminded");
|
|
278
|
+
await session.settled();
|
|
279
|
+
const result = await session.settle("Implemented.\nRisk: item 3 (shared parser)");
|
|
280
|
+
assert.equal(result?.continue, true, "the primary run is reminded once the named run settled");
|
|
281
|
+
});
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import {
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readlinkSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
3
5
|
import { join } from "node:path";
|
|
4
|
-
import test from "node:test";
|
|
6
|
+
import test, { after, before } from "node:test";
|
|
7
|
+
import { blockChildDestructiveCommand } from "../extensions/child-safety.ts";
|
|
5
8
|
import { __testing } from "../extensions/gentle-ai.ts";
|
|
9
|
+
import { recognizeDestructiveCommands } from "../lib/destructive-command-guard.ts";
|
|
6
10
|
|
|
7
11
|
// gentle-shell#1731 T16 (S5; L33-L34): in the after3 bench (B x4/x5) the first
|
|
8
12
|
// verify launch ran no probes because the handoff said only "read-only" and
|
|
@@ -18,11 +22,92 @@ import { __testing } from "../extensions/gentle-ai.ts";
|
|
|
18
22
|
const read = (relative: string): string => readFileSync(join(import.meta.dirname, "..", relative), "utf8");
|
|
19
23
|
const verify = read("assets/agents/gentle-ai-verify.md");
|
|
20
24
|
const verification = read("assets/orchestrator-verification.md");
|
|
25
|
+
let scratch: string;
|
|
26
|
+
let previousConfigHome: string | undefined;
|
|
27
|
+
before(() => {
|
|
28
|
+
scratch = mkdtempSync(join(tmpdir(), "gentle-verify-first-"));
|
|
29
|
+
previousConfigHome = process.env.GENTLE_PI_CONFIG_HOME;
|
|
30
|
+
process.env.GENTLE_PI_CONFIG_HOME = join(scratch, "config");
|
|
31
|
+
});
|
|
32
|
+
after(() => {
|
|
33
|
+
if (previousConfigHome === undefined) delete process.env.GENTLE_PI_CONFIG_HOME;
|
|
34
|
+
else process.env.GENTLE_PI_CONFIG_HOME = previousConfigHome;
|
|
35
|
+
if (scratch) rmSync(scratch, { recursive: true, force: true });
|
|
36
|
+
});
|
|
21
37
|
|
|
22
38
|
function containsAll(text: string, clauses: readonly string[], label: string): void {
|
|
23
39
|
for (const clause of clauses) assert.ok(text.includes(clause), `${label} is missing: ${clause}`);
|
|
24
40
|
}
|
|
25
41
|
|
|
42
|
+
// Issue #1494: these pin prompt policy, not a runtime-enforced limit or model compliance.
|
|
43
|
+
test("S1: verifier makes one isolated preparation attempt before checks", () => {
|
|
44
|
+
containsAll(verify, [
|
|
45
|
+
"Make one isolated preparation attempt",
|
|
46
|
+
"If preparation succeeds, run the authorized checks and independent spec-derived probes",
|
|
47
|
+
], "preparation bound");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("S2: preparation failure reports a concrete blocker and exact unrun checks", () => {
|
|
51
|
+
containsAll(verify, [
|
|
52
|
+
"At the first inability to prepare a required copy, environment, dependency, or helper, stop setup",
|
|
53
|
+
"report one concrete setup blocker and the exact checks left unrun as unverified, not passed",
|
|
54
|
+
"list every scratch directory you created by exact path",
|
|
55
|
+
], "setup failure");
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("S3: setup failures do not trigger repair loops or automatic relaunch", () => {
|
|
59
|
+
containsAll(verify, ["Do not retry setup or enter repair-helper loops"], "verifier setup");
|
|
60
|
+
containsAll(verification, [
|
|
61
|
+
"Do not automatically relaunch the verifier for the same missing prerequisite",
|
|
62
|
+
"Distinguish setup or infrastructure failure from genuine code findings",
|
|
63
|
+
"stop with one **Needs your decision** result identifying the missing prerequisite and exact unrun checks",
|
|
64
|
+
"Do not keep repairing helpers",
|
|
65
|
+
"Auxiliary tooling defects remain subject to the existing correction bound",
|
|
66
|
+
], "parent setup");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("S2-S3: setup recovery references the always-on bounded policy", () => {
|
|
70
|
+
containsAll(verification, [
|
|
71
|
+
"Follow **Authorized work continuity** for setup and worker recovery; scratch: `gentle-ai-verify`.",
|
|
72
|
+
"Do not automatically relaunch the verifier for the same missing prerequisite",
|
|
73
|
+
], "parent setup recovery");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("S3: scratch preparation establishes capacity and a complete payload before copying", () => {
|
|
77
|
+
containsAll(verify, [
|
|
78
|
+
"Before isolated setup, establish the required payload, available dependencies, and scratch capacity, including space and inodes when relevant.",
|
|
79
|
+
"A smaller copy is permitted only when it includes all source, test/build files, baseline material, and dependencies needed for every authorized probe.",
|
|
80
|
+
"If a prerequisite cannot be established, report it as missing instead of blindly copying or omitting required inputs",
|
|
81
|
+
"If setup fails before probes, preserve the failed attempt and report zero tests run",
|
|
82
|
+
"never `git worktree`, `git stash`, or a symlink into the workspace",
|
|
83
|
+
"No network, no installs, no writes outside the scratch directory",
|
|
84
|
+
"under the system temp directory, never inside the workspace",
|
|
85
|
+
], "scratch isolation remains required");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test("S5: documentation identifies the instruction as policy rather than runtime enforcement", () => {
|
|
89
|
+
const docs = read("docs/delegated-verification.md");
|
|
90
|
+
containsAll(docs, [
|
|
91
|
+
"one isolated preparation attempt",
|
|
92
|
+
"prompt policy, not a runtime-enforced limit",
|
|
93
|
+
"unverified, not passed",
|
|
94
|
+
], "delegated verification documentation");
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test("S4: successful setup retains independent probes, isolation, consent and finding correction", () => {
|
|
98
|
+
containsAll(verify, [
|
|
99
|
+
"independent probes required by the risk tier",
|
|
100
|
+
"never `git worktree`, `git stash`, or a symlink into the workspace",
|
|
101
|
+
"No network, no installs, no writes outside the scratch directory",
|
|
102
|
+
"one correction batch and one recheck limited to the reported blockers",
|
|
103
|
+
], "verification safeguards");
|
|
104
|
+
containsAll(verification, [
|
|
105
|
+
"one separate `gentle-ai-verify` run",
|
|
106
|
+
"one correction batch that fixes every reported blocker",
|
|
107
|
+
], "parent safeguards");
|
|
108
|
+
assert.ok(read("docs/delegated-verification.md").includes("human consent for native review"));
|
|
109
|
+
});
|
|
110
|
+
|
|
26
111
|
test("T16: read-only means no repository or git-state edits", () => {
|
|
27
112
|
containsAll(verify, [
|
|
28
113
|
"read-only technical verifier for generic ODD work",
|
|
@@ -52,6 +137,46 @@ test("T16/W1: the scratch copy method cannot write outside the scratch directory
|
|
|
52
137
|
], "scratch copy method");
|
|
53
138
|
});
|
|
54
139
|
|
|
140
|
+
// gentle-shell#2818: the prompt asked for a copy without `.git` but named only
|
|
141
|
+
// `cp -a --reflink=auto`, which cannot exclude anything. Verifiers then ran
|
|
142
|
+
// `rm -rf "$s/work/.git"` (blocked by child safety) or `cp --exclude` (no such
|
|
143
|
+
// option), so no probe ran. The prompt names one exact guard-compatible form.
|
|
144
|
+
const SCRATCH_COPY = /`(mkdir -p "\$s\/work" && tar --exclude=\.\/\.git [^`]+)`/;
|
|
145
|
+
|
|
146
|
+
test("#2818: the scratch copy names one exact command the child guard allows", () => {
|
|
147
|
+
const command = verify.match(SCRATCH_COPY)?.[1];
|
|
148
|
+
assert.ok(command, "verify must name the exact tar scratch copy command");
|
|
149
|
+
assert.deepEqual(recognizeDestructiveCommands(command), []);
|
|
150
|
+
assert.equal(blockChildDestructiveCommand(command), undefined);
|
|
151
|
+
assert.ok(!verify.includes("for example `cp -a --reflink=auto`"), "the cp example cannot exclude `.git`");
|
|
152
|
+
containsAll(verify, [
|
|
153
|
+
"never copy `.git` and delete it afterwards",
|
|
154
|
+
"`cp` has no `--exclude` option",
|
|
155
|
+
], "scratch copy method");
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("#2818: the named scratch copy omits top-level .git and keeps dotfiles, dependencies and symlinks", () => {
|
|
159
|
+
const command = verify.match(SCRATCH_COPY)?.[1];
|
|
160
|
+
assert.ok(command);
|
|
161
|
+
const workspace = join(scratch, "workspace");
|
|
162
|
+
mkdirSync(join(workspace, ".git", "objects"), { recursive: true });
|
|
163
|
+
writeFileSync(join(workspace, ".git", "HEAD"), "ref: refs/heads/main\n");
|
|
164
|
+
writeFileSync(join(workspace, ".env.example"), "KEY=\n");
|
|
165
|
+
mkdirSync(join(workspace, "node_modules", "dep"), { recursive: true });
|
|
166
|
+
writeFileSync(join(workspace, "node_modules", "dep", "index.js"), "module.exports = 1;\n");
|
|
167
|
+
mkdirSync(join(workspace, "node_modules", ".bin"));
|
|
168
|
+
symlinkSync("../dep/index.js", join(workspace, "node_modules", ".bin", "dep"));
|
|
169
|
+
const s = mkdtempSync(join(scratch, "probe-"));
|
|
170
|
+
const result = spawnSync("bash", ["-c", command], { cwd: workspace, env: { ...process.env, s }, encoding: "utf8" });
|
|
171
|
+
assert.equal(result.status, 0, result.stderr);
|
|
172
|
+
const work = join(s, "work");
|
|
173
|
+
assert.equal(existsSync(join(work, ".git")), false);
|
|
174
|
+
assert.equal(readFileSync(join(work, ".env.example"), "utf8"), "KEY=\n");
|
|
175
|
+
assert.equal(readFileSync(join(work, "node_modules", "dep", "index.js"), "utf8"), "module.exports = 1;\n");
|
|
176
|
+
assert.equal(readlinkSync(join(work, "node_modules", ".bin", "dep")), "../dep/index.js");
|
|
177
|
+
assert.equal(existsSync(join(workspace, ".git", "HEAD")), true);
|
|
178
|
+
});
|
|
179
|
+
|
|
55
180
|
// T21 (L44): in after4, verify reported a behavior already present at the
|
|
56
181
|
// baseline (B x5, unchecked import amounts the request kept "as they do today")
|
|
57
182
|
// and a value far outside the realistic domain (B x4, sums near 9e15) as
|
|
@@ -116,19 +241,20 @@ test("T16: the verify handoff names probe command forms and the scratch location
|
|
|
116
241
|
], "verify handoff");
|
|
117
242
|
});
|
|
118
243
|
|
|
119
|
-
// T17b (L42):
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
test("T17b: the core Evidence-budget rule never fires to prepare an inline write", () => {
|
|
244
|
+
// T17b (L42): preparation for an understood inline write stays inline, but
|
|
245
|
+
// discovery cannot evade the evidence budget merely because a write is planned.
|
|
246
|
+
test("T17b: inline-write preparation is distinct from discovery", () => {
|
|
123
247
|
const core = read("assets/orchestrator.md");
|
|
124
248
|
const rule = core.split("\n").find((line) => line.includes("**Evidence-budget rule**"));
|
|
125
249
|
assert.ok(rule, "Evidence-budget rule is missing");
|
|
126
|
-
assert.
|
|
250
|
+
assert.match(rule, /Exempt only preparation for an understood inline write, not discovery/);
|
|
251
|
+
assert.match(rule, /cumulative discovery each batch, never reset/);
|
|
252
|
+
assert.match(core, /No explore, worker, or verifier unless a trigger fires/);
|
|
127
253
|
});
|
|
128
254
|
|
|
129
255
|
test("T17: the always-on Explore step delegates exploration only for a map the parent needs", () => {
|
|
130
256
|
for (const persona of ["gentleman", "neutral"] as const) {
|
|
131
|
-
const prompt = __testing.buildGentlePrompt(persona);
|
|
257
|
+
const prompt = __testing.buildGentlePrompt(persona, scratch, ["read"]);
|
|
132
258
|
const step = prompt.split("\n").find((line) => line.startsWith("2. **Explore.**"));
|
|
133
259
|
assert.ok(step, "ODD step 2 Explore is missing");
|
|
134
260
|
containsAll(step, [
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import test from "node:test";
|
|
5
|
+
|
|
6
|
+
const source = readFileSync(new URL("./installer-windows-bootstrap.test.ts", import.meta.url), "utf8");
|
|
7
|
+
const names = [...source.matchAll(/^test\(("native Windows(?:[^"\\]|\\.)*")\s*,/gm)].map((match) => JSON.parse(match[1]) as string);
|
|
8
|
+
const modes = JSON.parse(`[${/^const probeModes = \[([^\]]*)\] as const;$/m.exec(source)![1]}]`) as string[];
|
|
9
|
+
names.push(...modes.map((mode) => `native Windows: pre-Node production process primitive ${mode}`));
|
|
10
|
+
assert.equal(names.length, 38);
|
|
11
|
+
|
|
12
|
+
// Node's TAP reporter escapes backslashes in test names.
|
|
13
|
+
const tapNames = names.map((name) => name.replaceAll("\\", "\\\\"));
|
|
14
|
+
function tap(results = tapNames.map((name, i) => `ok ${i + 1} - ${name}`)) {
|
|
15
|
+
return [`TAP version 13`, ...results, `ok ${results.length + 1} - other platform # SKIP unavailable`,
|
|
16
|
+
`1..${results.length + 1}`, `# tests ${results.length + 1}`, `# suites 0`, `# pass ${results.length}`,
|
|
17
|
+
`# fail 0`, `# cancelled 0`, `# skipped 1`, `# todo 0`, `# duration_ms 1.2`, ""].join("\n");
|
|
18
|
+
}
|
|
19
|
+
function verify(input: string) {
|
|
20
|
+
return spawnSync(process.execPath, ["scripts/verify-installer-tap.mjs"], { input, encoding: "utf8" });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
test("accepts every native pass even with an unrelated platform skip", () => {
|
|
24
|
+
const input = tap().replace("ok 1 - ", "# Subtest: native fixture\n ---\n duration_ms: 1\n ...\nok 1 - ");
|
|
25
|
+
const result = verify(input.replaceAll("\n", "\r\n"));
|
|
26
|
+
assert.equal(result.status, 0, result.stderr);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const cases: [string, (input: string) => string][] = [
|
|
30
|
+
["missing native result", (s) => s.replace(` - ${names[0]}\n`, " - unrelated replacement\n")],
|
|
31
|
+
["duplicate native result", (s) => s.replace(` - ${names[1]}\n`, ` - ${names[0]}\n`)],
|
|
32
|
+
["native skip", (s) => s.replace(` - ${names[0]}\n`, ` - ${names[0]} # SKIP unavailable\n`)],
|
|
33
|
+
["native TODO", (s) => s.replace(` - ${names[0]}\n`, ` - ${names[0]} # TODO later\n`)],
|
|
34
|
+
["native failure", (s) => s.replace(`ok 1 - ${names[0]}`, `not ok 1 - ${names[0]}`)],
|
|
35
|
+
["missing final summary", (s) => s.slice(0, s.indexOf("# tests"))],
|
|
36
|
+
["missing plan", (s) => s.replace(/^1\.\.\d+\n/m, "")],
|
|
37
|
+
["duplicate plan", (s) => s.replace(/^(1\.\.\d+)\n/m, "$1\n$1\n")],
|
|
38
|
+
["duplicate summary", (s) => s + s.slice(s.indexOf("# tests"))],
|
|
39
|
+
["truncated final line", (s) => s.slice(0, -1)],
|
|
40
|
+
["inconsistent plan", (s) => s.replace("1..39", "1..40")],
|
|
41
|
+
["inconsistent summary", (s) => s.replace("# tests 39", "# tests 40")],
|
|
42
|
+
["unaccounted skip", (s) => s.replace("# pass 38", "# pass 39").replace("# skipped 1", "# skipped 0")],
|
|
43
|
+
["duplicate partial summary", (s) => s.replace("1..39\n", "# tests 39\n1..39\n")],
|
|
44
|
+
["duplicate header", (s) => s.replace("1..39\n", "TAP version 13\n1..39\n")],
|
|
45
|
+
["duplicate result number", (s) => s.replace("ok 2 - ", "ok 1 - ")],
|
|
46
|
+
["unexpected failure", (s) => s.replace("# fail 0", "# fail 1")],
|
|
47
|
+
["unexpected TODO", (s) => s.replace("# todo 0", "# todo 1")],
|
|
48
|
+
["unexpected cancellation", (s) => s.replace("# cancelled 0", "# cancelled 1")],
|
|
49
|
+
["malformed result", (s) => s.replace("ok 2 - ", "okay 2 - ")],
|
|
50
|
+
];
|
|
51
|
+
for (const [label, mutate] of cases) {
|
|
52
|
+
test(`rejects ${label}`, () => {
|
|
53
|
+
const result = verify(mutate(tap()));
|
|
54
|
+
assert.notEqual(result.status, 0);
|
|
55
|
+
assert.match(result.stderr, /installer TAP:/);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
@@ -277,12 +277,12 @@ test("resolveVimRuntime resolves local bundle cli entrypoint when provided", ()
|
|
|
277
277
|
});
|
|
278
278
|
|
|
279
279
|
test("audited Pi editor releases are one frozen exact allowlist that includes the installed TUI", () => {
|
|
280
|
-
assert.deepEqual([...AUDITED_PI_EDITOR_VERSIONS], ["0.99.1", "0.99.2", "1.0.0", "1.1.0", "1.2.0", "1.3.0", "1.4.0"]);
|
|
280
|
+
assert.deepEqual([...AUDITED_PI_EDITOR_VERSIONS], ["0.99.1", "0.99.2", "1.0.0", "1.1.0", "1.2.0", "1.3.0", "1.4.0", "1.5.0"]);
|
|
281
281
|
assert.equal(bundledAgent.VERSION, INSTALLED_PI, "bundled and local metadata must describe the same actual installed release");
|
|
282
282
|
assert.ok(Object.isFrozen(AUDITED_PI_EDITOR_VERSIONS));
|
|
283
283
|
assert.throws(() => (AUDITED_PI_EDITOR_VERSIONS as unknown as string[]).push("0.99.3"), TypeError);
|
|
284
284
|
assert.ok(isAuditedPiEditorVersion(INSTALLED_PI), `installed pi-tui ${INSTALLED_PI} must be audited`);
|
|
285
|
-
for (const unknown of ["0.99.3", "0.99.10", "0.99", "v0.99.2", " 0.99.2", "0.99.2-rc.1", ">=0.99.2", "1.0.1", ">=1.0.0", "v1.0.0", " 1.0.0", "1.0.0-rc.1", "1.2.1", "1.2.0-rc.1", "v1.2.0", ">=1.2.0", "1.4.1", "1.5.
|
|
285
|
+
for (const unknown of ["0.99.3", "0.99.10", "0.99", "v0.99.2", " 0.99.2", "0.99.2-rc.1", ">=0.99.2", "1.0.1", ">=1.0.0", "v1.0.0", " 1.0.0", "1.0.0-rc.1", "1.2.1", "1.2.0-rc.1", "v1.2.0", ">=1.2.0", "1.4.1", "1.5.1", "1.4.0-rc.1", undefined, 99.2]) {
|
|
286
286
|
assert.equal(isAuditedPiEditorVersion(unknown), false, String(unknown));
|
|
287
287
|
}
|
|
288
288
|
});
|