gentle-pi 4.7.0 → 4.9.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 +115 -44
- package/assets/agents/gentle-ai-explore.md +3 -3
- package/assets/agents/gentle-ai-verify.md +20 -6
- package/assets/agents/gentle-ai-worker.md +14 -13
- package/assets/agents/jd-judge-a.md +1 -3
- package/assets/agents/jd-judge-b.md +1 -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 +476 -0
- package/assets/design-canvas/canvas-boot.js +219 -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 +397 -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 +219 -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 +351 -0
- package/assets/design-canvas/canvas-sizes.js +524 -0
- package/assets/design-canvas/canvas-store.js +167 -0
- package/assets/design-canvas/canvas-theme.js +69 -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 +773 -17
- package/assets/design-canvas/canvas.js +2 -1506
- package/assets/design-canvas/index.html +120 -36
- package/assets/design-canvas/inspector.js +574 -21
- package/assets/design-canvas/theme-early.js +10 -0
- package/assets/install-wizard/wizard.js +5 -1
- package/assets/migrations/agent-body-history.json +30 -0
- package/assets/orchestrator-delegation-reference.md +8 -14
- package/assets/orchestrator-delegation.md +5 -9
- package/assets/orchestrator-full-delegation-card.md +11 -16
- package/assets/orchestrator-full-delegation.md +9 -9
- package/assets/orchestrator-memory.md +4 -4
- package/assets/orchestrator-prompts.md +3 -31
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +13 -12
- package/assets/orchestrator-tracking.md +13 -17
- package/assets/orchestrator-verification.md +12 -10
- package/assets/orchestrator-writer.md +13 -13
- package/assets/orchestrator.md +20 -24
- package/bin/gentle-shell.mjs +205 -10
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/orchestration/pi.md +2 -1
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/routing/pi.md +16 -16
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/assets/brand/sponsor-banner.svg +60 -0
- package/docs/assets/features/gentle-tower.png +0 -0
- package/docs/auto-permission-answers.md +1 -1
- package/docs/bundled-install.md +14 -6
- package/docs/delegated-verification.md +23 -5
- package/docs/desktop-feed.md +303 -0
- package/docs/desktop-rpc.md +1931 -0
- package/docs/fast-mode.md +2 -2
- package/docs/gentle-agents-activity.md +26 -0
- package/docs/gentle-shell-desktop.md +465 -0
- package/docs/gentle-shell.md +102 -17
- package/docs/images/desktop/chat.png +0 -0
- package/docs/images/desktop/palette.png +0 -0
- package/docs/images/desktop/todo.png +0 -0
- package/docs/install-wizard.md +30 -21
- package/docs/odd-preparation-continuity.md +24 -0
- package/docs/permission-modes.md +9 -1
- package/docs/prompt-budget.md +12 -0
- package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
- package/docs/readme-reference.md +113 -32
- package/docs/review-coordinator.md +29 -9
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/work-continuity.md +19 -6
- package/extensions/ask-user-choice.ts +36 -18
- package/extensions/ask-user-question.ts +48 -9
- package/extensions/child-context.ts +21 -7
- package/extensions/gentle-agents.ts +436 -66
- package/extensions/gentle-ai.ts +809 -158
- package/extensions/gentle-design.ts +69 -3
- package/extensions/gentle-desktop-feed.ts +778 -0
- package/extensions/gentle-desktop-rpc.ts +276 -0
- package/extensions/gentle-guide.ts +3 -0
- package/extensions/gentle-herdr-desktop-status.ts +275 -0
- package/extensions/gentle-shell.ts +174 -59
- package/extensions/gentle-stats.ts +30 -1
- package/extensions/gentle-todo.ts +48 -25
- package/extensions/gentle-tower.ts +305 -0
- package/extensions/skill-registry.ts +260 -225
- package/herdr/RECIPE.md +157 -0
- package/herdr/keys.json +14 -0
- package/herdr/layouts/gentle-shell.json +202 -0
- package/herdr/mods/gentle-agents/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-agents/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-agents/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-agents/main.js +190 -0
- package/herdr/mods/gentle-agents/mod.json +1 -0
- package/herdr/mods/gentle-agents/snapshot.js +469 -0
- package/herdr/mods/gentle-agents/tokens.js +273 -0
- package/herdr/mods/gentle-chat/MINIMAL.md +69 -0
- package/herdr/mods/gentle-chat/actions.js +180 -0
- package/herdr/mods/gentle-chat/feed.js +321 -0
- package/herdr/mods/gentle-chat/icons/branch.svg +1 -0
- package/herdr/mods/gentle-chat/icons/chat.svg +1 -0
- package/herdr/mods/gentle-chat/icons/check.svg +1 -0
- package/herdr/mods/gentle-chat/icons/chev.svg +1 -0
- package/herdr/mods/gentle-chat/icons/clip.svg +1 -0
- package/herdr/mods/gentle-chat/icons/down.svg +1 -0
- package/herdr/mods/gentle-chat/icons/folder.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-chat/icons/mark.svg +1 -0
- package/herdr/mods/gentle-chat/icons/send.svg +1 -0
- package/herdr/mods/gentle-chat/icons/shield.svg +1 -0
- package/herdr/mods/gentle-chat/icons/stop.svg +1 -0
- package/herdr/mods/gentle-chat/icons/term.svg +1 -0
- package/herdr/mods/gentle-chat/icons/user.svg +1 -0
- package/herdr/mods/gentle-chat/icons/x.svg +1 -0
- package/herdr/mods/gentle-chat/main.js +968 -0
- package/herdr/mods/gentle-chat/mod.json +1 -0
- package/herdr/mods/gentle-chat/session.js +212 -0
- package/herdr/mods/gentle-chat/snapshot.js +469 -0
- package/herdr/mods/gentle-chat/tokens.js +137 -0
- package/herdr/mods/gentle-chat/ui.js +883 -0
- package/herdr/mods/gentle-confirm/main.js +60 -0
- package/herdr/mods/gentle-confirm/mod.json +1 -0
- package/herdr/mods/gentle-inspector/actions.js +180 -0
- package/herdr/mods/gentle-inspector/icons/bolt.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/bot.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/check.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/db.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/diff.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/jobs.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/plug.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/review.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/stats.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/stop.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/todo.svg +1 -0
- package/herdr/mods/gentle-inspector/main.js +500 -0
- package/herdr/mods/gentle-inspector/mod.json +1 -0
- package/herdr/mods/gentle-inspector/snapshot.js +469 -0
- package/herdr/mods/gentle-inspector/tokens.js +273 -0
- package/herdr/mods/gentle-palette/actions.js +180 -0
- package/herdr/mods/gentle-palette/icons/bolt.svg +1 -0
- package/herdr/mods/gentle-palette/icons/bot.svg +1 -0
- package/herdr/mods/gentle-palette/icons/chat.svg +1 -0
- package/herdr/mods/gentle-palette/icons/check.svg +1 -0
- package/herdr/mods/gentle-palette/icons/cmd.svg +1 -0
- package/herdr/mods/gentle-palette/icons/diff.svg +1 -0
- package/herdr/mods/gentle-palette/icons/jobs.svg +1 -0
- package/herdr/mods/gentle-palette/icons/plus.svg +1 -0
- package/herdr/mods/gentle-palette/icons/review.svg +1 -0
- package/herdr/mods/gentle-palette/icons/search.svg +1 -0
- package/herdr/mods/gentle-palette/icons/shield.svg +1 -0
- package/herdr/mods/gentle-palette/icons/stats.svg +1 -0
- package/herdr/mods/gentle-palette/icons/stop.svg +1 -0
- package/herdr/mods/gentle-palette/icons/term.svg +1 -0
- package/herdr/mods/gentle-palette/icons/todo.svg +1 -0
- package/herdr/mods/gentle-palette/main.js +333 -0
- package/herdr/mods/gentle-palette/mod.json +1 -0
- package/herdr/mods/gentle-palette/snapshot.js +469 -0
- package/herdr/mods/gentle-palette/tokens.js +273 -0
- package/herdr/mods/gentle-pane/icons/chat.svg +1 -0
- package/herdr/mods/gentle-pane/icons/close.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-pane/icons/split-down.svg +1 -0
- package/herdr/mods/gentle-pane/icons/split-right.svg +1 -0
- package/herdr/mods/gentle-pane/icons/term.svg +1 -0
- package/herdr/mods/gentle-pane/icons/unzoom.svg +1 -0
- package/herdr/mods/gentle-pane/icons/zoom.svg +1 -0
- package/herdr/mods/gentle-pane/main.js +91 -0
- package/herdr/mods/gentle-pane/mod.json +1 -0
- package/herdr/mods/gentle-pane/snapshot.js +469 -0
- package/herdr/mods/gentle-pane/tokens.js +273 -0
- package/herdr/mods/gentle-sidebar/actions.js +180 -0
- package/herdr/mods/gentle-sidebar/icons/gear.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/mark.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/refresh.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/server-plus.svg +1 -0
- package/herdr/mods/gentle-sidebar/main.js +171 -0
- package/herdr/mods/gentle-sidebar/mod.json +1 -0
- package/herdr/mods/gentle-sidebar/snapshot.js +469 -0
- package/herdr/mods/gentle-sidebar/tokens.js +273 -0
- package/herdr/mods/gentle-spaces/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/monitor.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/plus.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/server.svg +1 -0
- package/herdr/mods/gentle-spaces/machines.js +31 -0
- package/herdr/mods/gentle-spaces/main.js +299 -0
- package/herdr/mods/gentle-spaces/mod.json +1 -0
- package/herdr/mods/gentle-spaces/snapshot.js +469 -0
- package/herdr/mods/gentle-spaces/tokens.js +273 -0
- package/herdr/mods/gentle-status/actions.js +180 -0
- package/herdr/mods/gentle-status/main.js +192 -0
- package/herdr/mods/gentle-status/mod.json +1 -0
- package/herdr/mods/gentle-status/snapshot.js +469 -0
- package/herdr/mods/gentle-status/tokens.js +273 -0
- package/herdr/mods/gentle-tabs/icons/close.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/plus.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-close.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-max.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-min.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-restore.svg +1 -0
- package/herdr/mods/gentle-tabs/main.js +171 -0
- package/herdr/mods/gentle-tabs/mod.json +1 -0
- package/herdr/mods/gentle-tabs/snapshot.js +469 -0
- package/herdr/mods/gentle-tabs/tokens.js +273 -0
- package/herdr/mods/gentle-tokens/main.js +20 -0
- package/herdr/mods/gentle-tokens/mod.json +1 -0
- package/herdr/mods/gentle-tokens/snapshot.js +469 -0
- package/herdr/mods/gentle-tokens/tokens.js +273 -0
- package/herdr/preview.png +0 -0
- package/herdr/themes/gentle-shell-dark.json +33 -0
- package/herdr/themes/gentle-shell-light.json +34 -0
- package/lib/agent-assets.ts +30 -6
- package/lib/agent-tool-overlay.ts +117 -0
- package/lib/agents-config.ts +47 -6
- package/lib/agents-message-delivery.ts +17 -0
- package/lib/agents-messaging.ts +8 -2
- package/lib/agents-protocol.ts +17 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-rpc-publisher.ts +39 -12
- package/lib/agents-runner.ts +92 -6
- package/lib/agents-session-transport.ts +17 -1
- package/lib/auto-permission-answers.ts +2 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/background-jobs.ts +22 -2
- package/lib/bounded-writer-admission.ts +184 -31
- package/lib/change-diff.ts +104 -0
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- package/lib/commit-slice-signal.ts +1 -1
- package/lib/delivery-conflict-markers.ts +349 -0
- package/lib/design-canvas-assets.ts +38 -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 +315 -0
- package/lib/desktop-changes-service.ts +171 -0
- package/lib/desktop-design-service.ts +233 -0
- package/lib/desktop-feed-actions.ts +804 -0
- package/lib/desktop-feed-answers.ts +129 -0
- package/lib/desktop-feed-sources.ts +184 -0
- package/lib/desktop-feed-stats.ts +98 -0
- package/lib/desktop-feed-store.ts +124 -0
- package/lib/desktop-feed.ts +788 -0
- package/lib/desktop-jobs-service.ts +290 -0
- package/lib/desktop-review-service.ts +187 -0
- package/lib/desktop-rpc-agents.ts +403 -0
- package/lib/desktop-rpc-changes.ts +223 -0
- package/lib/desktop-rpc-config-watch.ts +285 -0
- package/lib/desktop-rpc-config.ts +885 -0
- package/lib/desktop-rpc-design.ts +138 -0
- package/lib/desktop-rpc-jobs.ts +290 -0
- package/lib/desktop-rpc-permissions.ts +328 -0
- package/lib/desktop-rpc-profiles.ts +196 -0
- package/lib/desktop-rpc-review.ts +180 -0
- package/lib/desktop-rpc-session.ts +203 -0
- package/lib/desktop-rpc-sessions.ts +250 -0
- package/lib/desktop-rpc-stats.ts +187 -0
- package/lib/desktop-rpc-updates.ts +143 -0
- package/lib/desktop-rpc-usage.ts +229 -0
- package/lib/desktop-rpc.ts +336 -0
- package/lib/desktop-session-service.ts +223 -0
- package/lib/desktop-sessions-service.ts +249 -0
- package/lib/desktop-stats-service.ts +142 -0
- package/lib/desktop-updates-service.ts +268 -0
- package/lib/desktop-usage-service.ts +310 -0
- package/lib/destructive-command-guard.ts +188 -13
- package/lib/gentle-ai-renderer.ts +13 -1
- package/lib/gentle-design.ts +201 -14
- package/lib/gentle-shell-bundled.ts +100 -9
- package/lib/gentle-shell-desktop.ts +1370 -0
- package/lib/gentle-shell-launcher.ts +45 -3
- package/lib/herdr-desktop-events.ts +40 -0
- package/lib/herdr-desktop-status.ts +229 -0
- package/lib/hidden-tools.ts +35 -0
- package/lib/inprocess-reviewer.ts +96 -12
- package/lib/jobs-sidebar-state.ts +5 -0
- package/lib/model-fallback-policy.ts +9 -0
- package/lib/model-routing-authority.ts +9 -0
- package/lib/nan-provider.ts +42 -28
- package/lib/native-review-cli.ts +86 -4
- package/lib/openai-fast-tier.ts +1 -0
- package/lib/orchestrator-discovery.ts +39 -2
- package/lib/reply-language-anchor.ts +27 -2
- package/lib/request-context-placement.ts +53 -0
- package/lib/review-candidate-view.ts +11 -1
- package/lib/review-continuation-registry.ts +17 -0
- package/lib/review-coordinator.ts +252 -8
- package/lib/review-delivery-preflight.ts +85 -0
- package/lib/review-host-relay.ts +5 -1
- package/lib/review-integration-v2.ts +56 -3
- package/lib/reviewer-stream.ts +87 -0
- package/lib/session-profile-freeze.ts +13 -5
- package/lib/shell-prompt.ts +16 -3
- package/lib/shell-usage.ts +10 -0
- package/lib/stats-collector.ts +56 -27
- package/lib/tower-actions.ts +100 -0
- package/lib/tower-hub.ts +73 -0
- package/lib/tower-launch.ts +111 -0
- package/lib/tower-open.ts +99 -0
- package/lib/tower-presence.ts +70 -0
- package/lib/tower-server.ts +234 -0
- package/lib/tower-snapshot.ts +298 -0
- package/lib/update-status.ts +238 -0
- package/lib/verifier-settle-reminder.ts +1 -1
- package/lib/vim-editor-adapter.ts +9 -2
- package/lib/writer-batch-admission.ts +55 -0
- package/lib/yolo-session-policy.ts +6 -1
- package/package.json +14 -5
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +39 -0
- package/runtime/gentle-shell-bundled.mjs +100 -9
- package/runtime/gentle-shell-desktop.mjs +1371 -0
- package/runtime/gentle-shell-launcher.mjs +44 -2
- package/runtime/native-review-cli.mjs +86 -4
- package/runtime/review-integration-v2.mjs +56 -3
- package/runtime/tower-actions.mjs +101 -0
- package/runtime/tower-hub.mjs +74 -0
- package/runtime/tower-launch.mjs +112 -0
- package/runtime/tower-open.mjs +100 -0
- package/runtime/tower-presence.mjs +71 -0
- package/runtime/tower-server.mjs +234 -0
- package/runtime/tower-snapshot.mjs +299 -0
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +5 -21
- package/scripts/build-runtime-modules.mjs +10 -0
- package/scripts/gentle-ai-installer.mjs +10 -10
- package/scripts/gentle-ai-proxy.mjs +1 -1
- package/scripts/installer-downloads.mjs +34 -8
- package/scripts/installer-preflight.mjs +28 -17
- package/scripts/installer-probes.mjs +25 -5
- package/scripts/installer-server.mjs +38 -9
- package/scripts/installer-windows.mjs +2 -2
- package/scripts/pi-update.mjs +166 -27
- package/scripts/prepare-verifier.mjs +107 -0
- package/scripts/update-agent-body-history.mjs +55 -8
- package/scripts/verify-package-files.mjs +61 -20
- package/skills/branch-pr/SKILL.md +16 -16
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/design/SKILL.md +6 -6
- package/skills/gentle-ai/SKILL.md +5 -5
- package/skills/judgment-day/SKILL.md +2 -2
- package/skills/judgment-day/references/prompts-and-formats.md +1 -1
- package/skills/provider-defect-report/SKILL.md +61 -0
- package/skills/rdd-defect-workflow/SKILL.md +6 -6
- package/skills/skill-improver/SKILL.md +2 -2
- package/skills/skill-registry/SKILL.md +11 -13
- package/skills/tui-design/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +5 -5
- package/tests/agent-prompt-diet-contract.test.ts +101 -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 +10 -1
- package/tests/agents-message-delivery.test.ts +36 -0
- package/tests/agents-queries.test.ts +144 -4
- package/tests/agents-report-cap.test.ts +126 -0
- package/tests/agents-runner.test.ts +37 -1
- 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 +26 -7
- 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 +78 -21
- package/tests/ask-user-question.test.ts +61 -6
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/auto-permission-answers.test.ts +12 -1
- package/tests/background-jobs.test.ts +12 -0
- package/tests/bounded-stop-contract.test.ts +148 -27
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bundled-install.test.ts +1 -1
- package/tests/change-diff.test.ts +75 -0
- package/tests/child-context-files.test.ts +64 -8
- package/tests/child-skills-catalog.test.ts +56 -0
- package/tests/codemode-rendering.test.ts +4 -1
- package/tests/commit-slice-signal.test.ts +3 -2
- package/tests/decision-routing-contract.test.ts +390 -0
- package/tests/delegate-for-reason-contract.test.ts +30 -8
- package/tests/delegated-key-learnings-contract.test.ts +21 -28
- package/tests/delivery-b-rendered-surfaces.test.ts +32 -0
- 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 -878
- 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 +528 -0
- package/tests/design-canvas-inspector.test.ts +1004 -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 +91 -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 +189 -0
- package/tests/design-canvas-theme.test.ts +198 -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-feed-actions-guards.test.ts +595 -0
- package/tests/desktop-feed-actions.test.ts +761 -0
- package/tests/desktop-feed-live-work.test.ts +209 -0
- package/tests/desktop-feed-performance.test.ts +369 -0
- package/tests/desktop-feed-plan-profiles.test.ts +509 -0
- package/tests/desktop-feed-send-prompt.test.ts +303 -0
- package/tests/desktop-feed-tool-summaries.test.ts +69 -0
- package/tests/desktop-feed.test.ts +615 -0
- package/tests/desktop-rpc-agents.test.ts +1319 -0
- package/tests/desktop-rpc-changes.test.ts +608 -0
- package/tests/desktop-rpc-config-watch.test.ts +1159 -0
- package/tests/desktop-rpc-config.test.ts +1462 -0
- package/tests/desktop-rpc-design.test.ts +672 -0
- package/tests/desktop-rpc-jobs.test.ts +1193 -0
- package/tests/desktop-rpc-permissions.test.ts +321 -0
- package/tests/desktop-rpc-profiles.test.ts +140 -0
- package/tests/desktop-rpc-review.test.ts +678 -0
- package/tests/desktop-rpc-safety.test.ts +119 -0
- package/tests/desktop-rpc-session.test.ts +642 -0
- package/tests/desktop-rpc-sessions.test.ts +647 -0
- package/tests/desktop-rpc-stats.test.ts +431 -0
- package/tests/desktop-rpc-updates.test.ts +525 -0
- package/tests/desktop-rpc-usage.test.ts +707 -0
- package/tests/desktop-rpc.test.ts +293 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
- package/tests/devbinary/review-session-consent.devtest.ts +84 -0
- package/tests/engram-safety.test.ts +111 -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 +30 -41
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/fixtures/session-profile-v1/replay.ts +4 -1
- package/tests/full-delegation-closure.test.ts +48 -0
- package/tests/gentle-agents.test.ts +848 -8
- package/tests/gentle-ai-binary.test.ts +1 -1
- package/tests/gentle-ai-child-guards.test.ts +1 -0
- package/tests/gentle-ai-installer.test.ts +52 -51
- package/tests/gentle-ai-renderer.test.ts +36 -2
- package/tests/gentle-ai.test.ts +195 -21
- package/tests/gentle-design.test.ts +365 -1
- package/tests/gentle-fast.test.ts +15 -0
- package/tests/gentle-herdr-desktop-status.test.ts +595 -0
- package/tests/gentle-shell-bundled.test.ts +91 -5
- package/tests/gentle-shell-desktop-bin.test.ts +125 -0
- package/tests/gentle-shell-desktop.test.ts +927 -0
- package/tests/gentle-shell-launcher-tower.test.ts +104 -0
- package/tests/gentle-shell-launcher.test.ts +1 -1
- package/tests/gentle-shell.test.ts +121 -87
- package/tests/gentle-todo.test.ts +32 -9
- package/tests/gentle-tower.test.ts +578 -0
- package/tests/herdr-desktop-status.test.ts +285 -0
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/independent-recovery-delivery.test.ts +35 -9
- package/tests/inprocess-reviewer.test.ts +73 -0
- package/tests/install-wizard.test.ts +27 -1
- package/tests/installer-downloads.test.ts +30 -1
- package/tests/installer-posix-bootstrap.test.ts +114 -13
- package/tests/installer-preflight.test.ts +49 -1
- package/tests/installer-probes.test.ts +146 -0
- package/tests/installer-server.test.ts +203 -4
- package/tests/installer-windows-bootstrap.test.ts +19 -1
- package/tests/judgment-day-severity-admission.test.ts +46 -0
- package/tests/lazy-module-contradictions-contract.test.ts +181 -0
- package/tests/maintainer/desktop-rpc.maintest.ts +907 -0
- package/tests/maintainer/pi-update-source.maintest.ts +48 -18
- package/tests/model-fallback-policy.test.ts +26 -7
- package/tests/nan-provider-runtime.test.ts +17 -3
- package/tests/nan-provider.test.ts +111 -56
- package/tests/native-review-capability-contract.test.ts +19 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
- 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 +33 -15
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-canonical-ratchet.test.ts +10 -0
- package/tests/odd-routing-contract.test.ts +99 -31
- package/tests/orchestrator-budget.test.ts +32 -5
- package/tests/orchestrator-consultation-sdk.test.ts +32 -6
- package/tests/orchestrator-delegation-mode.test.ts +2 -1
- package/tests/orchestrator-discovery.test.ts +28 -0
- package/tests/orchestrator-prompt-budget.test.ts +12 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +249 -0
- package/tests/orchestrator-rdd-ownership.test.ts +2 -1
- package/tests/orchestrator-work-search.test.ts +4 -2
- package/tests/package-files.test.ts +25 -1
- package/tests/package-manifest.test.ts +15 -14
- package/tests/parallel-reason-contract.test.ts +6 -3
- package/tests/permission-allowlist.test.ts +200 -30
- 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-routing-measured-values.test.ts +24 -0
- package/tests/pi-update-launcher.test.ts +17 -7
- package/tests/pi-update-source.test.ts +113 -6
- package/tests/pi-update.test.ts +294 -19
- 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 +25 -0
- package/tests/profile-fast-tier.test.ts +66 -1
- package/tests/provider-defect-handoff.test.ts +124 -99
- package/tests/rdd-aware-verification-contract.test.ts +1 -1
- package/tests/rdd-status-line.test.ts +94 -1
- package/tests/reply-language-anchor-placement.test.ts +184 -0
- package/tests/reply-language-anchor.test.ts +17 -1
- 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 +79 -1
- package/tests/review-candidate-view.test.ts +65 -0
- package/tests/review-continuation-registry.test.ts +31 -0
- package/tests/review-contract-prompt.test.ts +2 -1
- package/tests/review-controller.test.ts +2 -1
- 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.test.ts +271 -4
- 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 +27 -0
- package/tests/review-integration-nonblocking-findings.test.ts +108 -0
- package/tests/review-json-arguments.test.ts +41 -2
- package/tests/review-ledger-contract.test.ts +19 -40
- package/tests/review-loadout-rdd-off-sdk.test.ts +30 -1
- 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-relay-transport-agent.test.ts +28 -1
- package/tests/review-reviewer-evidence.test.ts +41 -1
- package/tests/review-risk-assessment.test.ts +52 -5
- package/tests/review-run-statement-guidance-independent.test.ts +54 -0
- package/tests/review-session-standing-permission-controller.test.ts +32 -2
- package/tests/review-tool-prose-budget.test.ts +1 -0
- package/tests/reviewer-stream.test.ts +149 -0
- package/tests/sensitive-path-tools.test.ts +138 -4
- package/tests/session-profile-extension.test.ts +312 -18
- package/tests/session-profile-freeze.test.ts +26 -0
- package/tests/session-profile-v1-compat.test.ts +20 -0
- package/tests/shell-prompt.test.ts +17 -0
- package/tests/shell-usage.test.ts +59 -10
- package/tests/skill-collision-prefixes.test.ts +1 -0
- package/tests/skill-contradictions-contract.test.ts +124 -0
- package/tests/skill-registry-watcher.test.ts +216 -2
- package/tests/skill-registry.test.ts +983 -306
- package/tests/stats-collector.test.ts +109 -2
- package/tests/support/design-canvas-dom.ts +386 -0
- package/tests/support/review-coordinator-runtime.ts +212 -17
- package/tests/task-size-routing-contract.test.ts +49 -14
- 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/tower-actions.test.ts +247 -0
- package/tests/tower-artifacts.test.ts +114 -0
- package/tests/tower-open.test.ts +97 -0
- package/tests/tower-presence.test.ts +175 -0
- package/tests/tower-server.test.ts +122 -0
- package/tests/tower-snapshot.test.ts +236 -0
- package/tests/tower-web-echo.test.ts +125 -0
- package/tests/tower-web-hover.test.ts +251 -0
- package/tests/update-agent-body-history.test.ts +138 -0
- package/tests/verification-scoped-stop-contract.test.ts +32 -0
- package/tests/verification-tiers-contract.test.ts +229 -0
- package/tests/verifier-preparation.test.ts +229 -0
- package/tests/verifier-settle-reminder.test.ts +2 -2
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +88 -12
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/work-continuity-contract.test.ts +136 -27
- 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 +184 -0
- package/tests/writer-rejection-next-step.test.ts +55 -0
- package/tests/writer-surface-authority-contract.test.ts +158 -0
- package/tests/yolo-mode.test.ts +39 -0
- package/skills/_shared/review-ledger-contract.md +0 -106
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import childProcess from "node:child_process";
|
|
4
|
+
import { syncBuiltinESMExports } from "node:module";
|
|
5
|
+
import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import test from "node:test";
|
|
9
|
+
import { createGentleAiExtension } from "../extensions/gentle-ai.ts";
|
|
10
|
+
import { checkReviewDeliveryPreflight } from "../lib/review-delivery-preflight.ts";
|
|
11
|
+
import { recognizeReviewDeliveryActions } from "../lib/destructive-command-guard.ts";
|
|
12
|
+
import { ReviewContinuationRegistry } from "../lib/review-continuation-registry.ts";
|
|
13
|
+
import { NativeReviewCliV216, type NativeReviewCli } from "../lib/native-review-cli.ts";
|
|
14
|
+
|
|
15
|
+
test("committed delivery requests pass the real native client validation without an untracked inventory", async t => {
|
|
16
|
+
const root = mkdtempSync(join(tmpdir(), "review-delivery-native-validation-"));
|
|
17
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
18
|
+
const git = (...args: string[]) => execFileSync("git", ["-c", "user.name=Fixture", "-c", "user.email=fixture@example.com", "-c", "commit.gpgsign=false", ...args], { cwd: root, encoding: "utf8" }).trim();
|
|
19
|
+
git("init", "-q"); writeFileSync(join(root, "app.ts"), "base\n"); git("add", "."); git("commit", "-qm", "base");
|
|
20
|
+
const baseRef = git("rev-parse", "HEAD");
|
|
21
|
+
const commands: string[][] = [];
|
|
22
|
+
const client = new NativeReviewCliV216(async request => {
|
|
23
|
+
commands.push([...request.arguments]);
|
|
24
|
+
if (request.arguments[1] === "status") throw new Error("process boundary reached after STATUS request validation");
|
|
25
|
+
return { stdout: JSON.stringify({ schema: "gentle-ai.review-assessment/v1", risk: "high", reasons: [], changed_paths: 1, changed_lines: 1,
|
|
26
|
+
candidate: { kind: "base-diff", base_ref: baseRef, consumed: false }, review_due: true, review_due_reason: "high_risk" }), stderr: "", exitCode: 0, signal: null, timedOut: false, outputLimitExceeded: false };
|
|
27
|
+
}, join(root, "native-fixture.exe"));
|
|
28
|
+
const cli = { reviewMode: async () => ({ status: { effective: "on" } }), assess: client.assess.bind(client), targetStatus: client.targetStatus.bind(client) } as unknown as NativeReviewCli;
|
|
29
|
+
await checkReviewDeliveryPreflight(root, "bash", "git push", cli, () => baseRef, () => false);
|
|
30
|
+
assert.deepEqual(commands.map(args => args[1]), ["status", "assess", "status"], "the untracked inventory read, then both real client validators accept the committed-only request and reach the process adapter");
|
|
31
|
+
for (const args of commands) {
|
|
32
|
+
assert.ok(args.includes("--committed-only"));
|
|
33
|
+
assert.ok(args.includes(baseRef));
|
|
34
|
+
assert.ok(!args.some(arg => /untracked/.test(arg)), "committed-only requires no untracked inventory flags");
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("#2997: a foreground or background delivery cannot precede an explicit committed-range assessment", async t => {
|
|
39
|
+
const root = mkdtempSync(join(tmpdir(), "review-delivery-"));
|
|
40
|
+
const configHome = join(root, "config");
|
|
41
|
+
mkdirSync(configHome);
|
|
42
|
+
const previousConfig = process.env.GENTLE_PI_CONFIG_HOME;
|
|
43
|
+
process.env.GENTLE_PI_CONFIG_HOME = configHome;
|
|
44
|
+
t.after(() => { if (previousConfig === undefined) delete process.env.GENTLE_PI_CONFIG_HOME; else process.env.GENTLE_PI_CONFIG_HOME = previousConfig; });
|
|
45
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
46
|
+
const git = (...args: string[]) => execFileSync("git", ["-c", "user.name=Fixture", "-c", "user.email=fixture@example.com", "-c", "commit.gpgsign=false", ...args], { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
47
|
+
git("init", "-q");
|
|
48
|
+
writeFileSync(join(root, "app.ts"), "export const value = 1;\n");
|
|
49
|
+
git("add", "."); git("commit", "-qm", "base");
|
|
50
|
+
const handlers = new Map<string, Function>();
|
|
51
|
+
const tools = new Map<string, { execute: Function }>();
|
|
52
|
+
let nativeDue = false;
|
|
53
|
+
let assessments = 0;
|
|
54
|
+
let assessmentBase: string | undefined;
|
|
55
|
+
let duringConfirmation = () => {};
|
|
56
|
+
const cli = {
|
|
57
|
+
reviewMode: async () => ({ status: { effective: "on", global: "on", cloneLocal: "", source: "global" } }),
|
|
58
|
+
assess: async (request: { baseRef?: string }) => { assessments++; assessmentBase = request.baseRef; return ({ schema: "gentle-ai.review-assessment/v1", risk: nativeDue ? "high" : "medium", reasons: [], changedPaths: 1, changedLines: 2,
|
|
59
|
+
candidate: { kind: "base-diff", baseRef: request.baseRef, consumed: false }, reviewDue: nativeDue, reviewDueReason: nativeDue ? "high_risk" : "under_budget" }); },
|
|
60
|
+
};
|
|
61
|
+
const pi = { on: (name: string, handler: Function) => handlers.set(name, handler), events: { emit() {} }, registerCommand() {}, registerTool(tool: { name: string; execute: Function }) { tools.set(tool.name, tool); } };
|
|
62
|
+
createGentleAiExtension({ nativeReviewCli: cli as never, processEnv: { GENTLE_AI_TELEMETRY: "0" } })(pi as never);
|
|
63
|
+
const ctx = { cwd: root, hasUI: true, sessionManager: { getSessionId: () => "delivery", getCwd: () => root, getBranch: () => [], getEntries: () => [] }, ui: { notify() {}, confirm: async () => { duringConfirmation(); return true; } } };
|
|
64
|
+
for (const [toolName, command] of [
|
|
65
|
+
["bash", "git push origin HEAD"],
|
|
66
|
+
["bash", "git commit -am fix && git push && gh pr create"],
|
|
67
|
+
["bash_background", "gh pr checks 42 --watch && gh pr merge 42"],
|
|
68
|
+
]) {
|
|
69
|
+
const result = await handlers.get("tool_call")!({ toolName, toolCallId: command, input: { command } }, ctx);
|
|
70
|
+
assert.equal(result?.block, true, command);
|
|
71
|
+
assert.match(result.reason, /delivery|committed.range/i);
|
|
72
|
+
}
|
|
73
|
+
const baseRef = git("rev-parse", "HEAD");
|
|
74
|
+
writeFileSync(join(root, "app.ts"), "export const value = 2;\n"); git("commit", "-qam", "change");
|
|
75
|
+
const gitReads = t.mock.method(childProcess, "execFile");
|
|
76
|
+
syncBuiltinESMExports();
|
|
77
|
+
try {
|
|
78
|
+
const assessed = await tools.get("gentle_review")!.execute("assess-committed", { operation: "assess", input: { baseRef, committedOnly: true } }, undefined, undefined, ctx);
|
|
79
|
+
assert.equal(assessed.details.reviewDue, false);
|
|
80
|
+
assert.equal(gitReads.mock.calls.filter(call => call.arguments[0] === "git").length, 0, "retaining the base adds no asynchronous Git snapshot reads");
|
|
81
|
+
} finally { gitReads.mock.restore(); syncBuiltinESMExports(); }
|
|
82
|
+
const admitted = await handlers.get("tool_call")!({ toolName: "bash", toolCallId: "push-after-assess", input: { command: "git push origin HEAD" } }, ctx);
|
|
83
|
+
assert.equal(admitted?.block, undefined, "the real controller remembers the explicit range for fresh delivery checks");
|
|
84
|
+
const beforeBatch = assessments;
|
|
85
|
+
const batch = await handlers.get("tool_call")!({ toolName: "bash", toolCallId: "batch-delivery", input: { command: "git push origin HEAD && gh pr create" } }, ctx);
|
|
86
|
+
assert.equal(batch?.block, undefined, "a non-due candidate can push and create its PR in one call");
|
|
87
|
+
assert.equal(assessments - beforeBatch, 1, "the batch gets one fresh assessment, not one per action");
|
|
88
|
+
const wrapped = await handlers.get("tool_call")!({ toolName: "bash", toolCallId: "wrapped-delivery", input: { command: "sh -c 'git push origin HEAD'" } }, ctx);
|
|
89
|
+
assert.equal(wrapped?.block, undefined, "a shell wrapper alone is not a review blocker");
|
|
90
|
+
for (const command of ["git commit -am fix && git push", "sh -c 'git commit -am fix && git push'", "git switch other && git push", "eval 'git revert HEAD && git push'"]) {
|
|
91
|
+
const result = await handlers.get("tool_call")!({ toolName: "bash", toolCallId: command, input: { command } }, ctx);
|
|
92
|
+
assert.equal(result?.block, true, "a candidate-changing command still needs its own boundary");
|
|
93
|
+
}
|
|
94
|
+
let confirmationObserved = false;
|
|
95
|
+
duringConfirmation = () => {
|
|
96
|
+
confirmationObserved = true;
|
|
97
|
+
duringConfirmation = () => {};
|
|
98
|
+
writeFileSync(join(root, "app.ts"), "export const value = 3;\n"); git("commit", "-qam", "changed during consent");
|
|
99
|
+
nativeDue = true;
|
|
100
|
+
};
|
|
101
|
+
const changed = await handlers.get("tool_call")!({ toolName: "bash", toolCallId: "changed-while-confirming", input: { command: "git push origin HEAD" } }, ctx);
|
|
102
|
+
assert.equal(confirmationObserved, true);
|
|
103
|
+
assert.equal(changed?.block, true, "command authorization cannot leave an earlier range check stale");
|
|
104
|
+
nativeDue = true;
|
|
105
|
+
await tools.get("gentle_review")!.execute("claimed-decline", { operation: "assess", input: { baseRef, committedOnly: true, nativeReviewOutcome: "declined" } }, undefined, undefined, ctx);
|
|
106
|
+
const refused = await handlers.get("tool_call")!({ toolName: "bash", toolCallId: "untrusted-decline", input: { command: "git push origin HEAD" } }, ctx);
|
|
107
|
+
assert.equal(refused?.block, true, "a model-declared decline cannot bypass a due native review");
|
|
108
|
+
nativeDue = false;
|
|
109
|
+
const selectedHead = git("rev-parse", "HEAD");
|
|
110
|
+
const selected = await tools.get("gentle_review")!.execute("select-head", { operation: "assess", input: { baseRef: "HEAD", committedOnly: true } }, undefined, undefined, ctx);
|
|
111
|
+
assert.equal(selected.details.candidate.baseRef, selectedHead, "selection assesses and retains the resolved commit, not mutable HEAD");
|
|
112
|
+
writeFileSync(join(root, "app.ts"), "export const value = 4;\n"); git("commit", "-qam", "after selection");
|
|
113
|
+
assert.equal((await handlers.get("tool_call")!({ toolName: "bash", toolCallId: "after-new-commit", input: { command: "git push" } }, ctx))?.block, undefined);
|
|
114
|
+
assert.equal(assessmentBase, selectedHead, "new commits remain in the selected delivery range");
|
|
115
|
+
git("branch", "delivery-base", selectedHead);
|
|
116
|
+
await tools.get("gentle_review")!.execute("select-branch", { operation: "assess", input: { baseRef: "delivery-base", committedOnly: true } }, undefined, undefined, ctx);
|
|
117
|
+
git("branch", "-f", "delivery-base", "HEAD");
|
|
118
|
+
await handlers.get("tool_call")!({ toolName: "bash", toolCallId: "after-base-branch-moved", input: { command: "git push" } }, ctx);
|
|
119
|
+
assert.equal(assessmentBase, selectedHead, "moving a selected branch does not shrink the delivery range");
|
|
120
|
+
for (const input of [{ baseRef, committedOnly: false }, { baseRef: "missing-delivery-base", committedOnly: true }]) {
|
|
121
|
+
try { await tools.get("gentle_review")!.execute("invalid-selection", { operation: "assess", input }, undefined, undefined, ctx); } catch { /* Rejected selectors must not replace the existing hint. */ }
|
|
122
|
+
await handlers.get("tool_call")!({ toolName: "bash", toolCallId: "after-invalid-selection", input: { command: "git push" } }, ctx);
|
|
123
|
+
assert.equal(assessmentBase, selectedHead, "invalid or unresolvable selection preserves the valid pinned range");
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test("delivery recognition distinguishes executable commands from text and covers grouped shell forms", () => {
|
|
128
|
+
for (const command of ["git push origin HEAD", "git -C './repo with space' push origin HEAD", "git commit -am fix && git push", "gh pr create", "gh pr merge 42 --auto", "gh -R owner/repo pr create", "until true; do gh pr merge 42; done", "sh -c 'git push'", "echo $(git push)", "eval 'git push'", "eval -- git push"]) {
|
|
129
|
+
assert.ok(recognizeReviewDeliveryActions(command).some(action => action.kind === "delivery"), command);
|
|
130
|
+
}
|
|
131
|
+
for (const command of ["git status", "git push --dry-run origin HEAD", "git push --delete origin old", "gh pr checks 42 --watch", "echo 'git push'", "echo '$(git push)'", "printf '%s' 'gh pr merge'", "cat <<'TEXT'\ngit push\nTEXT"]) {
|
|
132
|
+
assert.equal(recognizeReviewDeliveryActions(command).filter(action => action.kind === "delivery").length, 0, command);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test("repository redirects remain delivery commands but cannot borrow the session repository", async () => {
|
|
137
|
+
const commands = [
|
|
138
|
+
"git --git-dir /other/.git push", "git --git-dir=/other/.git push",
|
|
139
|
+
"git --work-tree /other push", "git --work-tree=/other push",
|
|
140
|
+
"git --namespace other push", "git --namespace=other push",
|
|
141
|
+
"GIT_DIR=/other/.git git push", "GIT_WORK_TREE=/other git push", "GIT_COMMON_DIR=/other/.git git push", "GIT_NAMESPACE=other git push",
|
|
142
|
+
"env GIT_DIR=/other/.git git push", "env -C /other git push", "env --chdir /other git push", "env --chdir=/other git push", "env -C/other git push",
|
|
143
|
+
"env -C /other sh -c 'git push'", "GIT_WORK_TREE=/other eval 'git push'",
|
|
144
|
+
"sudo --chdir /other git push", "sudo --chdir=/other git push", "sudo -D /other git push", "sudo -D/other git push",
|
|
145
|
+
];
|
|
146
|
+
let modeCalls = 0;
|
|
147
|
+
const cli = { reviewMode: async () => { modeCalls++; return { status: { effective: "off" } }; } } as unknown as NativeReviewCli;
|
|
148
|
+
for (const command of commands) {
|
|
149
|
+
const deliveries = recognizeReviewDeliveryActions(command).filter(action => action.kind === "delivery");
|
|
150
|
+
assert.equal(deliveries.length, 1, command);
|
|
151
|
+
assert.equal(deliveries[0].unresolvedDirectory, true, command);
|
|
152
|
+
const result = await checkReviewDeliveryPreflight(process.cwd(), "bash", command, cli, () => "HEAD", () => false);
|
|
153
|
+
assert.equal(result?.block, true, command);
|
|
154
|
+
assert.match(result!.reason, /literal cd or git -C/);
|
|
155
|
+
}
|
|
156
|
+
assert.equal(modeCalls, 0, "an unrelated off session repository cannot authorize a redirected target");
|
|
157
|
+
for (const command of ["env -u GIT_DIR git push", "sudo -C 3 git push", "CI=1 git push", "env CI=1 git push"]) {
|
|
158
|
+
assert.equal(recognizeReviewDeliveryActions(command).find(action => action.kind === "delivery")?.unresolvedDirectory, undefined, command);
|
|
159
|
+
}
|
|
160
|
+
assert.deepEqual(recognizeReviewDeliveryActions("git -C/other push"), [{ kind: "delivery", directories: ["/other"] }]);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test("#2997: escaped newlines preserve shell word comment boundaries", async () => {
|
|
164
|
+
const continued = String.fromCharCode(92, 10);
|
|
165
|
+
for (const command of [`${continued}git push`, `${continued} git push`, `g${continued}it push`, `git pu${continued}sh`, `git${continued} push`, `"g${continued}it" push`, `echo prefix${continued}#; git push`, `echo prefix${continued}${continued}#; git push`]) {
|
|
166
|
+
assert.equal(recognizeReviewDeliveryActions(command).filter(action => action.kind === "delivery").length, 1, command);
|
|
167
|
+
let assessments = 0;
|
|
168
|
+
const cli = { reviewMode: async () => ({ status: { effective: "on" } }), assess: async () => { assessments++; return { reviewDue: true }; } } as unknown as NativeReviewCli;
|
|
169
|
+
assert.equal((await checkReviewDeliveryPreflight(process.cwd(), "bash", command, cli, () => "HEAD", () => false))?.block, true);
|
|
170
|
+
assert.equal(assessments, 1);
|
|
171
|
+
}
|
|
172
|
+
for (const command of [`'g${continued}it' push`, `echo ${continued}#; git push`, `${continued}# git push &`, `echo ${continued}${continued}# git push &`]) {
|
|
173
|
+
assert.deepEqual(recognizeReviewDeliveryActions(command), [], command);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
test("#2997: comments inside backticks preserve subsequent parent deliveries", async () => {
|
|
178
|
+
for (const command of ["echo prefix`true # note`; git push", "echo `true # note`; git push", "echo `true # note`; git push &", "echo `true # note`; export GIT_DIR=/other; git push"]) {
|
|
179
|
+
const delivery = recognizeReviewDeliveryActions(command).filter(action => action.kind === "delivery");
|
|
180
|
+
assert.equal(delivery.length, 1, command);
|
|
181
|
+
}
|
|
182
|
+
let assessments = 0;
|
|
183
|
+
const cli = {
|
|
184
|
+
reviewMode: async () => ({ status: { effective: "on" } }),
|
|
185
|
+
assess: async () => { assessments++; return { reviewDue: true }; },
|
|
186
|
+
} as unknown as NativeReviewCli;
|
|
187
|
+
const result = await checkReviewDeliveryPreflight(process.cwd(), "bash", "echo `true # note`; git push", cli, () => "HEAD", () => false);
|
|
188
|
+
assert.equal(result?.block, true);
|
|
189
|
+
assert.equal(assessments, 1, "the trailing parent delivery must still be assessed");
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
test("#2997: shell background lists cannot use a foreground review check", async () => {
|
|
193
|
+
const commands = [
|
|
194
|
+
"sleep 30 && git push &", "git push && echo done &", "git push || echo failed &",
|
|
195
|
+
"sleep 30 && git push &&\n echo done &", "git push ||\n echo failed &", "git push |\n cat &",
|
|
196
|
+
"git push &&\n # continuation & comment\n echo done &",
|
|
197
|
+
"bash -c 'sleep 30 && git push &'", "bash -c 'git push' &",
|
|
198
|
+
"(git push; echo done) &", "{ git push; echo done; } &",
|
|
199
|
+
"if true; then git push; fi &", "until true; do gh pr merge 42; done &",
|
|
200
|
+
'echo "$(git push)" &', "echo `git push` &",
|
|
201
|
+
];
|
|
202
|
+
let assessments = 0;
|
|
203
|
+
const cli = {
|
|
204
|
+
reviewMode: async () => ({ status: { effective: "on" } }),
|
|
205
|
+
assess: async ({ baseRef }: { baseRef: string }) => { assessments++; return { candidate: { kind: "base-diff", baseRef }, reviewDue: false }; },
|
|
206
|
+
} as unknown as NativeReviewCli;
|
|
207
|
+
for (const command of commands) {
|
|
208
|
+
const result = await checkReviewDeliveryPreflight(process.cwd(), "bash", command, cli, () => "HEAD", () => false);
|
|
209
|
+
assert.equal(result?.block, true, command);
|
|
210
|
+
assert.match(result!.reason, /background|foreground/, command);
|
|
211
|
+
}
|
|
212
|
+
assert.equal(assessments, 0, "deferred execution must be separated before assessment");
|
|
213
|
+
const off = { reviewMode: async () => ({ status: { effective: "off" } }) } as unknown as NativeReviewCli;
|
|
214
|
+
for (const command of commands) assert.equal(await checkReviewDeliveryPreflight(process.cwd(), "bash", command, off, () => undefined, () => false), undefined, "known RDD off preserves ordinary command policy");
|
|
215
|
+
for (const command of ["git push # publish & notify", "git push # $(git push &)", "git push # `git push &`", "git push # comment with unmatched ' &",
|
|
216
|
+
"git push &&\n echo done", "git push # comment &\n echo done",
|
|
217
|
+
"sleep 1 & git push", "git push 2>&1 | tail -1", "git push &>/dev/null", "git push && echo done", "git push; echo `sleep 1 &`"]) {
|
|
218
|
+
assert.equal(await checkReviewDeliveryPreflight(process.cwd(), "bash", command, cli, () => "HEAD", () => false), undefined, command);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
test("#2997: exported Git routing cannot borrow an unrelated RDD-off directory", async () => {
|
|
223
|
+
let modeReads = 0;
|
|
224
|
+
const off = { reviewMode: async () => { modeReads++; return { status: { effective: "off" } }; } } as unknown as NativeReviewCli;
|
|
225
|
+
for (const variable of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_NAMESPACE"]) {
|
|
226
|
+
for (const command of [
|
|
227
|
+
`export ${variable}=/other; git push`, `export ${variable}=/other && gh pr merge 42`,
|
|
228
|
+
`export ${variable}=/other; bash -c 'git push'`, `export ${variable}=/other; echo "$(git push)"`,
|
|
229
|
+
`eval 'export ${variable}=/other'; git push`,
|
|
230
|
+
`export ${variable}=/other && git push &`, `echo \`export ${variable}=/other; git push\``,
|
|
231
|
+
]) {
|
|
232
|
+
const result = await checkReviewDeliveryPreflight(process.cwd(), "bash", command, off, () => undefined, () => false);
|
|
233
|
+
assert.equal(result?.block, true, command);
|
|
234
|
+
assert.match(result!.reason, /repository cannot be resolved/, command);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
assert.equal(modeReads, 0, "the session's off mode cannot authorize a redirected target");
|
|
238
|
+
for (const command of [
|
|
239
|
+
"export PATH=/bin; git push", 'echo "export GIT_DIR=/other; git push &"', "echo '$(git push)'",
|
|
240
|
+
'echo "$(git push)"; export GIT_DIR=/other', "(export GIT_DIR=/other); git push",
|
|
241
|
+
"bash -c 'export GIT_DIR=/other'; git push", "eval '(export GIT_DIR=/other)'; git push",
|
|
242
|
+
"export GIT_DIR=/other & git push", "echo `true; export GIT_DIR=/other; true`; git push",
|
|
243
|
+
"eval 'export GIT_DIR=/other &' ; git push",
|
|
244
|
+
]) {
|
|
245
|
+
assert.equal(await checkReviewDeliveryPreflight(process.cwd(), "bash", command, off, () => undefined, () => false), undefined, command);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
test("#3138: output redirections and trailing filters preserve a literal delivery directory", async () => {
|
|
250
|
+
const root = process.cwd();
|
|
251
|
+
const commands = [
|
|
252
|
+
`cd "${root}" && git push 2>&1`, `cd "${root}" && git push 2>&1 | tail -1`,
|
|
253
|
+
`cd "${root}" && git push 2>& 1 | tail -1`, `cd "${root}" && git push <& 0`,
|
|
254
|
+
`cd "${root}" && git push >out.log`, `cd "${root}" && git push>/dev/null`,
|
|
255
|
+
`cd "${root}" && git push &>/dev/null`, `cd "${root}" && git push >|out.log`,
|
|
256
|
+
`cd "${root}" && git push || echo failed`, `cd "${root}" && gh pr create --title x 2>&1 | tail -5`,
|
|
257
|
+
`cd "${root}" && gh pr create --body-file - <<'EOF'\nbody text\nEOF`,
|
|
258
|
+
];
|
|
259
|
+
for (const command of commands) {
|
|
260
|
+
assert.deepEqual(recognizeReviewDeliveryActions(command), [{ kind: "delivery", directories: [root] }], command);
|
|
261
|
+
const seen: string[] = [];
|
|
262
|
+
const cli = { reviewMode: async ({ cwd }: { cwd: string }) => { seen.push(cwd); return { status: { effective: "off" } }; } } as unknown as NativeReviewCli;
|
|
263
|
+
assert.equal(await checkReviewDeliveryPreflight(root, "bash", command, cli, () => undefined, () => false), undefined, command);
|
|
264
|
+
assert.deepEqual(seen, [root], "RDD off is read from the actual selected repository");
|
|
265
|
+
const on = { reviewMode: async () => ({ status: { effective: "on" } }) } as unknown as NativeReviewCli;
|
|
266
|
+
assert.match((await checkReviewDeliveryPreflight(root, "bash", command, on, () => undefined, () => false))!.reason, /committed range/, "output formatting never bypasses the RDD-on range gate");
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
test("#3138: output syntax never hides a repository redirect or an uncertain cd outcome", () => {
|
|
271
|
+
for (const command of [
|
|
272
|
+
"cd /other | git push", "false || cd /other && git push", "cd /other && false || git push",
|
|
273
|
+
"cd /other && git push || gh pr create", "cd /other && git push; gh pr create",
|
|
274
|
+
"> /dev/null | cd /other && git push", ">out || cd /other && git push",
|
|
275
|
+
"cd /other && GIT_DIR=/elsewhere git push 2>&1 | tail -1",
|
|
276
|
+
"cd /other && env -C /elsewhere git push 2>&1", "cd /other && git --work-tree=/elsewhere push >out",
|
|
277
|
+
]) assert.ok(recognizeReviewDeliveryActions(command).some(action => action.kind === "delivery" && action.unresolvedDirectory), command);
|
|
278
|
+
assert.deepEqual(recognizeReviewDeliveryActions('echo "2>&1 | git push"'), []);
|
|
279
|
+
for (const target of ["1--dry-run", "1-n", "1--delete", "1--work-tree=/elsewhere", "1push", "-n"]) {
|
|
280
|
+
assert.deepEqual(recognizeReviewDeliveryActions(`cd /selected && git push >&${target}`), [{ kind: "delivery", directories: ["/selected"] }], target);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
test("ambiguous directory control flow cannot borrow another repository's off mode", async t => {
|
|
285
|
+
const root = realpathSync(mkdtempSync(join(tmpdir(), "review-delivery-directory-flow-")));
|
|
286
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
287
|
+
const other = join(root, "other");
|
|
288
|
+
mkdirSync(other);
|
|
289
|
+
for (const cwd of [root, other]) execFileSync("git", ["init", "-q"], { cwd });
|
|
290
|
+
const seen: string[] = [];
|
|
291
|
+
const cli = { reviewMode: async ({ cwd }: { cwd: string }) => {
|
|
292
|
+
seen.push(cwd);
|
|
293
|
+
return { status: { effective: cwd === other ? "off" : "on" } };
|
|
294
|
+
} } as unknown as NativeReviewCli;
|
|
295
|
+
for (const command of [
|
|
296
|
+
`(cd "${other}" && pwd); git push`,
|
|
297
|
+
`bash -c '(cd "${other}" && pwd); git push'`,
|
|
298
|
+
`false && cd "${other}"; git push`,
|
|
299
|
+
`if false; then cd "${other}"; fi; git push`,
|
|
300
|
+
`cd "${other}" || true; git push`,
|
|
301
|
+
`cd "${other}" && pwd; git push`,
|
|
302
|
+
`cd "${other}" && git push; gh pr create`,
|
|
303
|
+
`pushd "${other}" && git push`,
|
|
304
|
+
'pushd "$OTHER" && git push',
|
|
305
|
+
"popd && git push",
|
|
306
|
+
]) {
|
|
307
|
+
seen.length = 0;
|
|
308
|
+
const result = await checkReviewDeliveryPreflight(root, "bash", command, cli, () => undefined, () => false);
|
|
309
|
+
assert.equal(result?.block, true, command);
|
|
310
|
+
assert.deepEqual(seen, [], "ambiguous directory state must be rejected before querying any repository's mode");
|
|
311
|
+
}
|
|
312
|
+
for (const command of [
|
|
313
|
+
`cd "${other}" && git push`, `git -C "${other}" push`, `sh -c 'cd "${other}" && git push'`,
|
|
314
|
+
`cd "${root}" && cd "${other}" && git push`,
|
|
315
|
+
`cd "${root}" && bash -c 'cd "${other}" && git push'`,
|
|
316
|
+
`cd "${other}" && echo '(quoted text)' && git push`,
|
|
317
|
+
]) {
|
|
318
|
+
seen.length = 0;
|
|
319
|
+
assert.equal(await checkReviewDeliveryPreflight(root, "bash", command, cli, () => undefined, () => false), undefined, command);
|
|
320
|
+
assert.deepEqual(seen, [other], "direct literal directory selection keeps the intended repository");
|
|
321
|
+
}
|
|
322
|
+
for (const command of ["git push && gh pr create", "bash -c 'git push'"]) {
|
|
323
|
+
seen.length = 0;
|
|
324
|
+
assert.equal((await checkReviewDeliveryPreflight(root, "bash", command, cli, () => undefined, () => false))?.block, true);
|
|
325
|
+
assert.deepEqual(seen, [root], "ordinary batching and wrappers continue to assess their session repository");
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
test("preflight rechecks the actual assessed range, preserves native non-due/decline and rejects drift", async t => {
|
|
330
|
+
const root = realpathSync(mkdtempSync(join(tmpdir(), "review-delivery-scope-")));
|
|
331
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
332
|
+
const git = (...args: string[]) => execFileSync("git", ["-c", "user.name=Fixture", "-c", "user.email=fixture@example.com", "-c", "commit.gpgsign=false", ...args], { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
333
|
+
git("init", "-q"); writeFileSync(join(root, "app.ts"), "base\n"); git("add", "."); git("commit", "-qm", "base");
|
|
334
|
+
const baseRef = git("rev-parse", "HEAD");
|
|
335
|
+
writeFileSync(join(root, "app.ts"), "changed\n"); git("commit", "-qam", "change");
|
|
336
|
+
const registry = new ReviewContinuationRegistry();
|
|
337
|
+
const scope = (path: string) => registry.readCommittedRange(path);
|
|
338
|
+
let active = true;
|
|
339
|
+
let mode = "on", due = false, consumed = false, seenBase: string | undefined;
|
|
340
|
+
let duringAssessment = () => {};
|
|
341
|
+
const native = {
|
|
342
|
+
reviewMode: async () => ({ status: { effective: mode } }),
|
|
343
|
+
assess: async (request: { baseRef?: string }) => { seenBase = request.baseRef; duringAssessment(); return { candidate: { kind: "base-diff", baseRef, consumed }, reviewDue: due }; },
|
|
344
|
+
targetStatus: async () => ({ applicability: "current_target", targetIdentity: "exact-target", projection: { kind: "base-diff" } }),
|
|
345
|
+
} as unknown as NativeReviewCli;
|
|
346
|
+
const check = (declined = false, selectedScope = scope) => checkReviewDeliveryPreflight(root, "bash", "git push origin HEAD", native, selectedScope, (_root, target) => declined && target === "exact-target", undefined, () => active);
|
|
347
|
+
assert.equal((await check())?.block, true, "an empty dirty tree is no substitute for a committed range");
|
|
348
|
+
registry.retainCommittedRange(root, baseRef);
|
|
349
|
+
assert.equal(await check(), undefined, "native under-budget/passive outcomes do not force review");
|
|
350
|
+
assert.equal(seenBase, baseRef);
|
|
351
|
+
due = true;
|
|
352
|
+
assert.equal((await check())?.block, true, "a due unacknowledged review pauses delivery");
|
|
353
|
+
assert.equal(await check(true), undefined, "the exact host-recorded human decline preserves ordinary policy");
|
|
354
|
+
const otherSession = new ReviewContinuationRegistry();
|
|
355
|
+
assert.equal((await check(false, path => otherSession.readCommittedRange(path)))?.block, true);
|
|
356
|
+
consumed = true; due = false;
|
|
357
|
+
assert.equal(await check(), undefined, "fresh native acknowledged evidence can proceed to ordinary delivery checks");
|
|
358
|
+
duringAssessment = () => { active = false; };
|
|
359
|
+
assert.equal((await check())?.block, true, "session invalidation during native await cannot allow delivery");
|
|
360
|
+
duringAssessment = () => {};
|
|
361
|
+
active = true;
|
|
362
|
+
writeFileSync(join(root, "app.ts"), "new change\n"); git("commit", "-qam", "new change");
|
|
363
|
+
assert.equal(await check(), undefined, "a new HEAD is assessed freshly without a manual re-registration cycle");
|
|
364
|
+
duringAssessment = () => { duringAssessment = () => {}; writeFileSync(join(root, "app.ts"), "raced change\n"); git("commit", "-qam", "changed during assessment"); };
|
|
365
|
+
assert.equal((await check())?.block, true, "HEAD drift during the fresh read still blocks delivery");
|
|
366
|
+
duringAssessment = () => { registry.retainCommittedRange(root, "HEAD"); };
|
|
367
|
+
assert.equal((await check())?.block, true, "replacement of the selected range during assessment blocks delivery");
|
|
368
|
+
duringAssessment = () => {};
|
|
369
|
+
registry.retainCommittedRange(root, baseRef);
|
|
370
|
+
mode = "off";
|
|
371
|
+
assert.equal(await check(), undefined, "RDD off preserves ordinary delivery policy");
|
|
372
|
+
for (const command of ["cd ~/other && git push", 'cd "$REPO" && git push', "cd && git push", 'git -C "$REPO" push', "sh -c 'cd ~/other && git push'"]) {
|
|
373
|
+
const modeCalls = t.mock.fn(native.reviewMode!);
|
|
374
|
+
assert.equal((await checkReviewDeliveryPreflight(root, "bash", command, { ...native, reviewMode: modeCalls }, scope, () => false))?.block, true, "unresolved directory must not inherit session repository mode");
|
|
375
|
+
assert.equal(modeCalls.mock.callCount(), 0, "do not query mode for an unresolved target");
|
|
376
|
+
}
|
|
377
|
+
mode = "on";
|
|
378
|
+
assert.equal((await checkReviewDeliveryPreflight(root, "bash", "git revert HEAD && git push", native, scope, () => false))?.block, true, "revert changes the candidate before delivery");
|
|
379
|
+
const other = join(root, "other"); mkdirSync(other); git("-C", other, "init", "-q");
|
|
380
|
+
const mixedModes = { ...native, reviewMode: async (request: { cwd: string }) => ({ status: { effective: request.cwd === root ? "off" : "on" } }) } as NativeReviewCli;
|
|
381
|
+
assert.equal((await checkReviewDeliveryPreflight(root, "bash", `cd "${other}" && git push origin HEAD`, mixedModes, scope, () => false))?.block, true, "cd selects its target's RDD mode rather than the session mode");
|
|
382
|
+
assert.equal((await checkReviewDeliveryPreflight(root, "bash", `git push origin HEAD; git -C "${other}" push origin HEAD`, mixedModes, scope, () => false))?.block, true, "a first off repository cannot bypass a second on repository");
|
|
383
|
+
const abort = new AbortController();
|
|
384
|
+
const uncooperative = { reviewMode: () => new Promise(() => {}), assess: () => assert.fail("No assessment after cancellation") } as unknown as NativeReviewCli;
|
|
385
|
+
const pending = checkReviewDeliveryPreflight(root, "bash", "git push origin HEAD", uncooperative, scope, () => false, abort.signal);
|
|
386
|
+
abort.abort();
|
|
387
|
+
assert.equal((await pending)?.block, true, "an uncooperative native reader cannot retain admission after abort");
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
test("#3169: an untracked file beside a committed range is excluded with the native inventory instead of failing the preflight", async t => {
|
|
391
|
+
const root = realpathSync(mkdtempSync(join(tmpdir(), "review-delivery-untracked-")));
|
|
392
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
393
|
+
const git = (...args: string[]) => execFileSync("git", ["-c", "user.name=Fixture", "-c", "user.email=fixture@example.com", "-c", "commit.gpgsign=false", ...args], { cwd: root, encoding: "utf8" }).trim();
|
|
394
|
+
git("init", "-q"); writeFileSync(join(root, "app.ts"), "base\n"); git("add", "."); git("commit", "-qm", "base");
|
|
395
|
+
const baseRef = git("rev-parse", "HEAD");
|
|
396
|
+
writeFileSync(join(root, "app.ts"), "changed\n"); git("commit", "-qam", "change");
|
|
397
|
+
writeFileSync(join(root, "body.md"), "PR body written for gh pr create --body-file\n");
|
|
398
|
+
let inventory: string | undefined = "sha256:inventory";
|
|
399
|
+
let statusFails = false;
|
|
400
|
+
const statusCalls: unknown[] = [], assessCalls: Array<Record<string, unknown>> = [];
|
|
401
|
+
const cli = {
|
|
402
|
+
reviewMode: async () => ({ status: { effective: "on" } }),
|
|
403
|
+
targetStatus: async (request: unknown) => {
|
|
404
|
+
statusCalls.push(request);
|
|
405
|
+
if (statusFails) throw new Error("status unavailable");
|
|
406
|
+
return { applicability: "unrelated", ...(inventory === undefined ? {} : { eligibleUntrackedInventory: inventory }) };
|
|
407
|
+
},
|
|
408
|
+
assess: async (request: Record<string, unknown>) => {
|
|
409
|
+
assessCalls.push(request);
|
|
410
|
+
// Mirrors native: an undeclared untracked inventory fails a committed-only assessment.
|
|
411
|
+
if (inventory !== undefined && request.expectedUntrackedInventory !== inventory) throw new Error("untracked files require an explicit declaration");
|
|
412
|
+
return { candidate: { kind: "base-diff", baseRef, consumed: false }, reviewDue: false };
|
|
413
|
+
},
|
|
414
|
+
} as unknown as NativeReviewCli;
|
|
415
|
+
const command = `cd "${root}" && gh pr create --base main --head feat/x --title "t" --body-file body.md`;
|
|
416
|
+
assert.equal(await checkReviewDeliveryPreflight(root, "bash", command, cli, () => baseRef, () => false), undefined, "gh pr create passes like the push of the same range");
|
|
417
|
+
assert.deepEqual(statusCalls.map(request => { const { signal: _signal, ...rest } = request as Record<string, unknown>; return rest; }), [{ cwd: root, baseRef, committedOnly: true, agent: "pi" }]);
|
|
418
|
+
assert.equal(assessCalls[0].untrackedScope, "exclude");
|
|
419
|
+
assert.equal(assessCalls[0].expectedUntrackedInventory, "sha256:inventory");
|
|
420
|
+
assert.equal(assessCalls[0].baseRef, baseRef);
|
|
421
|
+
assert.equal(assessCalls[0].committedOnly, true);
|
|
422
|
+
|
|
423
|
+
inventory = undefined; assessCalls.length = 0;
|
|
424
|
+
assert.equal(await checkReviewDeliveryPreflight(root, "bash", "git push", cli, () => baseRef, () => false), undefined);
|
|
425
|
+
assert.ok(!("untrackedScope" in assessCalls[0]) && !("expectedUntrackedInventory" in assessCalls[0]), "no inventory, no declaration");
|
|
426
|
+
|
|
427
|
+
statusFails = true; inventory = "sha256:inventory"; assessCalls.length = 0;
|
|
428
|
+
assert.equal((await checkReviewDeliveryPreflight(root, "bash", "git push", cli, () => baseRef, () => false))?.block, true, "without a native inventory the undeclared assessment still fails closed");
|
|
429
|
+
assert.ok(!("untrackedScope" in assessCalls[0]), "a failed status read never invents a declaration");
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
test("#3169: the real native client sends the exclusion flags with the status inventory, and a session change during the status read blocks", async t => {
|
|
433
|
+
const root = mkdtempSync(join(tmpdir(), "review-delivery-untracked-native-"));
|
|
434
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
435
|
+
const git = (...args: string[]) => execFileSync("git", ["-c", "user.name=Fixture", "-c", "user.email=fixture@example.com", "-c", "commit.gpgsign=false", ...args], { cwd: root, encoding: "utf8" }).trim();
|
|
436
|
+
git("init", "-q"); writeFileSync(join(root, "app.ts"), "base\n"); git("add", "."); git("commit", "-qm", "base");
|
|
437
|
+
const baseRef = git("rev-parse", "HEAD");
|
|
438
|
+
const digest = `sha256:${"a".repeat(64)}`;
|
|
439
|
+
const assessArgs: string[][] = [];
|
|
440
|
+
const client = new NativeReviewCliV216(async request => {
|
|
441
|
+
if (request.arguments[1] === "assess") {
|
|
442
|
+
assessArgs.push([...request.arguments]);
|
|
443
|
+
return { stdout: JSON.stringify({ schema: "gentle-ai.review-assessment/v1", risk: "medium", reasons: [], changed_paths: 1, changed_lines: 1,
|
|
444
|
+
candidate: { kind: "base-diff", base_ref: baseRef, consumed: false }, review_due: false, review_due_reason: "under_budget" }), stderr: "", exitCode: 0, signal: null, timedOut: false, outputLimitExceeded: false };
|
|
445
|
+
}
|
|
446
|
+
throw new Error("status is decoded by its own suite");
|
|
447
|
+
}, join(root, "native-fixture.exe"));
|
|
448
|
+
let active = true;
|
|
449
|
+
const cli = { reviewMode: async () => ({ status: { effective: "on" } }), assess: client.assess.bind(client),
|
|
450
|
+
targetStatus: async () => { if (!active) throw new Error("unreachable"); return { eligibleUntrackedInventory: digest }; } } as unknown as NativeReviewCli;
|
|
451
|
+
assert.equal(await checkReviewDeliveryPreflight(root, "bash", "git push", cli, () => baseRef, () => false, undefined, () => active), undefined);
|
|
452
|
+
assert.ok(assessArgs[0].includes("--untracked-scope=exclude"));
|
|
453
|
+
assert.ok(assessArgs[0].includes(`--expected-untracked-inventory=${digest}`));
|
|
454
|
+
assert.ok(!assessArgs[0].some(arg => arg.startsWith("--intended-untracked")), "exclude names no paths");
|
|
455
|
+
|
|
456
|
+
assessArgs.length = 0;
|
|
457
|
+
const changing = { ...cli, targetStatus: async () => { active = false; return { eligibleUntrackedInventory: digest }; } } as unknown as NativeReviewCli;
|
|
458
|
+
const result = await checkReviewDeliveryPreflight(root, "bash", "git push", changing, () => baseRef, () => false, undefined, () => active);
|
|
459
|
+
assert.equal(result?.block, true);
|
|
460
|
+
assert.match(result!.reason, /Session changed during preflight/);
|
|
461
|
+
assert.equal(assessArgs.length, 0, "no assessment runs after the session changed");
|
|
462
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import test from "node:test";
|
|
4
|
+
|
|
5
|
+
const text = readFileSync(new URL("../assets/orchestrator-tracking.md", import.meta.url), "utf8");
|
|
6
|
+
const policy = text.split("\n").find(line => line.startsWith("When RDD is enabled,"))!;
|
|
7
|
+
|
|
8
|
+
test("S1: compact tracking preserves candidate and boundary selectors", () => {
|
|
9
|
+
assert.match(policy, /each work-unit commit, assess it with `gentle_review` `\{"operation":"assess"\}` and `\{"baseRef":"<last reviewed boundary>","committedOnly":true\}`/);
|
|
10
|
+
assert.match(policy, /branch point.*reviewed boundary.*next base/);
|
|
11
|
+
assert.match(policy, /not-due `passive` commit needs no review and the boundary advances/);
|
|
12
|
+
assert.match(policy, /`under_budget` stays pending.*until a later commit reaches the budget/);
|
|
13
|
+
assert.match(policy, /(?:high-risk unit follows pending `under_budget` commits, assess the open slice first|Before a high-risk unit, assess any pending `under_budget` slice)/);
|
|
14
|
+
assert.match(policy, /only when `reviewDue` is true or the user explicitly asks; otherwise preserve the pending boundary/);
|
|
15
|
+
assert.match(policy, /A task boundary neither authorizes review nor advances a reviewed boundary/);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test("S1-S2: compact tracking preserves proof, risk floor and human control", () => {
|
|
19
|
+
assert.match(policy, /report (?:the )?missing assessment proof/);
|
|
20
|
+
assert.match(policy, /never infer `reviewDue`(?: or|,) construct a preflight transition/);
|
|
21
|
+
assert.match(policy, /(?:never lowers the tier:.*never infer low risk from a failed assessment|If assessment fails or is unavailable,.*lower the tier or infer low risk)/);
|
|
22
|
+
assert.match(policy, /assess `escalate` field.*never lower one/);
|
|
23
|
+
assert.match(policy, /injected Gentle AI.*contract governs.*consent/);
|
|
24
|
+
assert.match(policy, /When RDD is disabled, do not start or prompt for RDD; ordinary checks remain/);
|
|
25
|
+
assert.match(policy, /never enables RDD, replaces its refuter, or answers consent/);
|
|
26
|
+
assert.doesNotMatch(policy, /close the open slice first, assessing and reviewing|treat the commit as due/);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("S2: delivered tracking fits both existing ceilings", () => {
|
|
30
|
+
assert.ok(Buffer.byteLength(text) <= Math.min(10_324, 10_308));
|
|
31
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import test from "node:test";
|
|
4
|
+
import { __testing } from "../extensions/gentle-ai.ts";
|
|
5
|
+
|
|
6
|
+
const tracking = readFileSync(new URL("../assets/orchestrator-tracking.md", import.meta.url), "utf8");
|
|
7
|
+
const lockedSemver = (JSON.parse(readFileSync(new URL("../contracts/review-provider-contract-mirror/provider-contract.lock.json", import.meta.url), "utf8")) as { contract_semver: string }).contract_semver;
|
|
8
|
+
|
|
9
|
+
test("pending and failed assessment never manufacture review entry", () => {
|
|
10
|
+
assert.doesNotMatch(tracking, /close the open slice first, assessing and reviewing|treat the commit as due/);
|
|
11
|
+
assert.match(tracking, /only when `reviewDue` is true or the user explicitly asks/);
|
|
12
|
+
assert.match(tracking, /otherwise preserve the pending boundary/);
|
|
13
|
+
assert.match(tracking, /A task boundary neither authorizes review nor advances a reviewed boundary/);
|
|
14
|
+
assert.match(tracking, /report missing assessment proof/);
|
|
15
|
+
assert.match(tracking, /never infer `reviewDue`, construct a preflight transition/);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test("delivered contract preserves consent, authority and risk floor", () => {
|
|
19
|
+
const contract = __testing.readMirroredReviewContractFragment();
|
|
20
|
+
assert.ok(contract);
|
|
21
|
+
assert.ok(contract.includes(`mirrored provider bundle ${lockedSemver}`), "the fragment names the locked mirror version");
|
|
22
|
+
assert.match(contract, /only when its `reviewDue` is true.*or the user explicitly asks/);
|
|
23
|
+
assert.match(contract, /Global RDD enabled permits review; it never grants consent for this candidate/);
|
|
24
|
+
assert.match(contract, /prompt prose never creates authority or decides delivery/);
|
|
25
|
+
assert.match(tracking, /lower the tier or infer low risk/);
|
|
26
|
+
assert.match(tracking, /When RDD is disabled, do not start or prompt for RDD; ordinary checks remain/);
|
|
27
|
+
});
|