gentle-pi 4.6.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -55
- package/assets/agents/gentle-ai-explore.md +4 -3
- package/assets/agents/gentle-ai-verify.md +23 -6
- package/assets/agents/gentle-ai-worker.md +9 -6
- package/assets/agents/jd-fix-agent.md +1 -0
- package/assets/agents/jd-judge-a.md +2 -3
- package/assets/agents/jd-judge-b.md +2 -3
- package/assets/agents/review-readability.md +1 -5
- package/assets/agents/review-reliability.md +1 -5
- package/assets/agents/review-resilience.md +1 -5
- package/assets/agents/review-risk.md +1 -5
- package/assets/design-canvas/canvas-api.js +45 -0
- package/assets/design-canvas/canvas-boards.js +456 -0
- package/assets/design-canvas/canvas-boot.js +217 -0
- package/assets/design-canvas/canvas-checks.js +491 -0
- package/assets/design-canvas/canvas-comments.js +315 -0
- package/assets/design-canvas/canvas-compare.js +159 -0
- package/assets/design-canvas/canvas-events.js +75 -0
- package/assets/design-canvas/canvas-export.js +393 -0
- package/assets/design-canvas/canvas-focus.js +203 -0
- package/assets/design-canvas/canvas-handoffs.js +150 -0
- package/assets/design-canvas/canvas-i18n-es.js +392 -0
- package/assets/design-canvas/canvas-i18n.js +108 -0
- package/assets/design-canvas/canvas-layout.js +526 -0
- package/assets/design-canvas/canvas-menu.js +213 -0
- package/assets/design-canvas/canvas-messages.js +86 -0
- package/assets/design-canvas/canvas-minimap.js +163 -0
- package/assets/design-canvas/canvas-parts.js +401 -0
- package/assets/design-canvas/canvas-popover.js +234 -0
- package/assets/design-canvas/canvas-rail.js +348 -0
- package/assets/design-canvas/canvas-sizes.js +524 -0
- package/assets/design-canvas/canvas-store.js +164 -0
- package/assets/design-canvas/canvas-tokens.js +674 -0
- package/assets/design-canvas/canvas-ui.js +24 -0
- package/assets/design-canvas/canvas-view.js +184 -0
- package/assets/design-canvas/canvas.css +759 -16
- package/assets/design-canvas/canvas.js +2 -1497
- package/assets/design-canvas/index.html +117 -36
- package/assets/design-canvas/inspector.js +546 -16
- package/assets/install-wizard/wizard.js +6 -1
- package/assets/migrations/agent-body-history.json +40 -1
- package/assets/orchestrator-delegation-reference.md +10 -16
- package/assets/orchestrator-delegation.md +5 -5
- package/assets/orchestrator-full-delegation-card.md +64 -0
- package/assets/orchestrator-full-delegation.md +34 -0
- package/assets/orchestrator-memory.md +5 -5
- package/assets/orchestrator-prompts.md +2 -2
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +14 -13
- package/assets/orchestrator-tracking.md +10 -14
- package/assets/orchestrator-verification.md +12 -8
- package/assets/orchestrator-writer.md +4 -4
- package/assets/orchestrator.md +21 -25
- package/bin/gentle-shell.mjs +292 -65
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/orchestration/pi.md +1 -0
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/routing/pi.md +6 -6
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/agent-status.md +61 -0
- package/docs/assets/brand/sponsor-banner.svg +60 -0
- package/docs/bundled-install.md +20 -10
- package/docs/delegated-verification.md +46 -8
- package/docs/desktop-rpc.md +1253 -0
- package/docs/gentle-agents-activity.md +40 -0
- package/docs/gentle-shell.md +91 -30
- package/docs/install-wizard.md +30 -21
- package/docs/odd-preparation-continuity.md +24 -0
- package/docs/permission-modes.md +17 -4
- package/docs/prompt-budget.md +12 -0
- package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
- package/docs/readme-reference.md +142 -45
- package/docs/render-cache-performance.md +11 -1
- package/docs/review-coordinator.md +53 -0
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/review-request-context.md +19 -0
- package/docs/review-windows-acl.md +18 -0
- package/docs/voice.md +6 -3
- package/docs/work-continuity.md +11 -1
- package/docs/yolo-mode.md +5 -5
- package/extensions/ask-user-choice.ts +1 -0
- package/extensions/ask-user-question.ts +3 -2
- package/extensions/child-context.ts +21 -7
- package/extensions/child-safety.ts +3 -0
- package/extensions/gentle-agent-status.ts +99 -0
- package/extensions/gentle-agents.ts +559 -66
- package/extensions/gentle-ai.ts +2001 -518
- package/extensions/gentle-design.ts +69 -3
- package/extensions/gentle-desktop-rpc.ts +143 -0
- package/extensions/gentle-guide.ts +3 -0
- package/extensions/gentle-shell.ts +398 -115
- package/extensions/gentle-todo.ts +66 -27
- package/extensions/gentle-tps.ts +48 -0
- package/extensions/quiet-tools.ts +38 -8
- package/extensions/skill-registry.ts +349 -167
- package/extensions/startup-banner.ts +30 -3
- package/lib/agent-assets.ts +30 -6
- package/lib/agent-profile-pin.ts +3 -3
- package/lib/agent-profiles.ts +160 -2
- package/lib/agent-status.ts +105 -0
- package/lib/agent-tool-overlay.ts +117 -0
- package/lib/agents-config.ts +93 -6
- package/lib/agents-history.ts +24 -5
- package/lib/agents-message-delivery.ts +17 -0
- package/lib/agents-messaging.ts +55 -7
- package/lib/agents-protocol.ts +15 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-runner.ts +272 -16
- package/lib/agents-session-transport.ts +17 -1
- package/lib/auto-permission-runtime.ts +1 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/bounded-writer-admission.ts +197 -32
- package/lib/card-content-policy.ts +8 -6
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- package/lib/command-palette.ts +133 -17
- package/lib/context-backstop.ts +14 -5
- package/lib/delivery-conflict-markers.ts +349 -0
- package/lib/design-canvas-assets.ts +36 -0
- package/lib/design-canvas-server.ts +241 -23
- package/lib/design-comments.ts +94 -4
- package/lib/design-handoffs.ts +2 -1
- package/lib/design-layout.ts +125 -0
- package/lib/design-parts.ts +281 -0
- package/lib/design-system-tokens.ts +111 -0
- package/lib/desktop-agents-service.ts +294 -0
- package/lib/desktop-design-service.ts +233 -0
- package/lib/desktop-jobs-service.ts +263 -0
- package/lib/desktop-rpc-agents.ts +294 -0
- package/lib/desktop-rpc-config.ts +731 -0
- package/lib/desktop-rpc-design.ts +138 -0
- package/lib/desktop-rpc-jobs.ts +181 -0
- package/lib/desktop-rpc-permissions.ts +177 -0
- package/lib/desktop-rpc-profiles.ts +196 -0
- package/lib/desktop-rpc-usage.ts +229 -0
- package/lib/desktop-rpc.ts +225 -0
- package/lib/desktop-usage-service.ts +310 -0
- package/lib/destructive-command-guard.ts +236 -17
- package/lib/execution-surface-guard.ts +20 -0
- package/lib/exploration-budget.ts +4 -2
- package/lib/gentle-ai-binary.ts +1 -1
- package/lib/gentle-ai-renderer.ts +13 -1
- package/lib/gentle-design.ts +204 -14
- package/lib/gentle-shell-bundled.ts +106 -28
- package/lib/gentle-shell-launcher.ts +43 -8
- package/lib/herdr-activity.ts +14 -2
- package/lib/herdr-busy.ts +45 -0
- package/lib/hidden-tools.ts +35 -0
- package/lib/image-attachments.ts +33 -0
- package/lib/image-disk-cache.ts +137 -0
- package/lib/inprocess-reviewer.ts +358 -144
- package/lib/jobs-view.ts +198 -11
- package/lib/model-fallback-policy.ts +9 -0
- package/lib/model-routing-authority.ts +31 -4
- package/lib/nan-provider.ts +42 -28
- package/lib/native-choice-list.ts +20 -2
- package/lib/native-review-cli.ts +172 -20
- package/lib/orchestrator-discovery.ts +39 -2
- package/lib/orchestrator-mode-policy.ts +105 -0
- package/lib/questionnaire/questionnaire-view.ts +105 -12
- package/lib/rdd-mode-control.ts +32 -0
- package/lib/reply-language-anchor.ts +129 -0
- package/lib/request-context-placement.ts +53 -0
- package/lib/review-blocker.ts +92 -0
- package/lib/review-candidate-symlink-scan.ts +136 -0
- package/lib/review-candidate-view-owner.ts +81 -44
- package/lib/review-candidate-view.ts +11 -1
- package/lib/review-continuation-registry.ts +116 -0
- package/lib/review-coordinator.ts +407 -0
- package/lib/review-delivery-preflight.ts +85 -0
- package/lib/review-failure-facts.ts +49 -0
- package/lib/review-host-relay.ts +51 -11
- package/lib/review-integration-v2.ts +63 -4
- package/lib/review-relay-phase-timing.ts +45 -0
- package/lib/review-start-context.ts +17 -0
- package/lib/reviewer-stream.ts +87 -0
- package/lib/session-profile-freeze.ts +4 -2
- package/lib/shell-bar.ts +140 -58
- package/lib/shell-changes.ts +2 -0
- package/lib/shell-panel.ts +17 -3
- package/lib/shell-prompt.ts +16 -3
- package/lib/shell-sidebar-layout.ts +112 -40
- package/lib/shell-sidebar.ts +7 -0
- package/lib/shell-todo.ts +10 -3
- package/lib/shell-usage.ts +10 -0
- package/lib/verifier-admission.ts +1 -1
- package/lib/vim-editor-adapter.ts +9 -2
- package/lib/visual-customization-policy.ts +36 -16
- package/lib/visual-customize-view.ts +216 -21
- package/lib/visual-layout-preview.ts +9 -5
- package/lib/visual-profiles.ts +2 -2
- package/lib/windows-session-transport.ts +53 -2
- package/lib/writer-batch-admission.ts +55 -0
- package/lib/yolo-session-policy.ts +46 -16
- package/package.json +3 -2
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +37 -0
- package/runtime/gentle-ai-binary.mjs +1 -1
- package/runtime/gentle-shell-bundled.mjs +106 -28
- package/runtime/gentle-shell-launcher.mjs +42 -7
- package/runtime/native-review-cli.mjs +169 -17
- package/runtime/review-integration-v2.mjs +63 -4
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +179 -0
- package/scripts/build-runtime-modules.mjs +1 -0
- package/scripts/bundled-install.mjs +38 -8
- package/scripts/download-progress.mjs +68 -0
- package/scripts/gentle-ai-installer.mjs +41 -18
- package/scripts/gentle-ai-proxy.mjs +294 -0
- package/scripts/install-gentle-ai.mjs +14 -1
- package/scripts/installer-downloads.mjs +34 -8
- package/scripts/installer-preflight.mjs +33 -22
- package/scripts/installer-probes.mjs +25 -5
- package/scripts/installer-runner.mjs +27 -12
- package/scripts/installer-server.mjs +46 -16
- package/scripts/installer-windows.mjs +2 -2
- package/scripts/pi-update.mjs +166 -27
- package/scripts/prepare-verifier.mjs +107 -0
- package/scripts/render-cache-host.mjs +72 -0
- package/scripts/render-cache-performance-worker.mjs +5 -4
- package/scripts/render-cache-performance.mjs +6 -1
- package/scripts/run-test-suite.mjs +40 -28
- package/scripts/update-agent-body-history.mjs +55 -8
- package/scripts/verify-package-files.mjs +50 -19
- package/scripts/voice-worker.cjs +32 -6
- package/skills/branch-pr/SKILL.md +16 -16
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/design/SKILL.md +16 -13
- package/skills/gentle-ai/SKILL.md +7 -7
- package/skills/gentle-ui-design/SKILL.md +46 -0
- package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
- package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
- package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
- package/skills/gentle-ui-design/references/task-and-content.md +60 -0
- package/skills/judgment-day/SKILL.md +2 -2
- package/skills/judgment-day/references/prompts-and-formats.md +1 -1
- package/skills/rdd-defect-workflow/SKILL.md +6 -6
- package/skills/skill-improver/SKILL.md +2 -2
- package/skills/skill-registry/SKILL.md +11 -11
- package/skills/tui-design/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +10 -11
- package/tests/agent-home.test.ts +28 -9
- package/tests/agent-profiles-workflow.test.ts +163 -0
- package/tests/agent-prompt-diet-contract.test.ts +101 -0
- package/tests/agent-risk-escalation.test.ts +1 -1
- package/tests/agent-status.test.ts +143 -0
- package/tests/agent-tool-overlay-acceptance.test.ts +158 -0
- package/tests/agent-tool-overlay.test.ts +89 -0
- package/tests/agents-config.test.ts +106 -1
- package/tests/agents-history.test.ts +31 -0
- package/tests/agents-jobs-frames.test.ts +93 -0
- package/tests/agents-message-delivery.test.ts +36 -0
- package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
- package/tests/agents-queries.test.ts +144 -4
- package/tests/agents-report-cap.test.ts +126 -0
- package/tests/agents-runner-drain.test.ts +193 -0
- package/tests/agents-runner.test.ts +215 -3
- package/tests/agents-session-transport.test.ts +34 -0
- package/tests/always-on-prompt-verdicts-contract.test.ts +188 -0
- package/tests/append-system-prompt-route.test.ts +12 -1
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-choice.test.ts +4 -3
- package/tests/ask-user-question.test.ts +99 -1
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/auto-permission-runtime.test.ts +1 -1
- package/tests/autonomous-guard.test.ts +346 -10
- package/tests/bounded-stop-contract.test.ts +51 -3
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bridge-cost.test.ts +19 -4
- package/tests/bundled-install.test.ts +31 -6
- package/tests/card-content-policy.test.ts +3 -3
- package/tests/chained-pr-skill.test.ts +8 -6
- package/tests/child-context-files.test.ts +64 -8
- package/tests/child-safety.test.ts +11 -0
- package/tests/child-skills-catalog.test.ts +56 -0
- package/tests/codegraph-tools.test.ts +11 -5
- package/tests/codemode-rendering.test.ts +4 -1
- package/tests/command-palette.test.ts +284 -1
- package/tests/delegate-for-reason-contract.test.ts +32 -10
- package/tests/delivery-conflict-markers.test.ts +348 -0
- package/tests/design-canvas-all-sizes.test.ts +631 -0
- package/tests/design-canvas-allowlist.test.ts +32 -0
- package/tests/design-canvas-assets.test.ts +11 -695
- package/tests/design-canvas-boards.test.ts +77 -0
- package/tests/design-canvas-checks.test.ts +655 -0
- package/tests/design-canvas-compare.test.ts +79 -0
- package/tests/design-canvas-events.test.ts +59 -0
- package/tests/design-canvas-export.test.ts +1168 -0
- package/tests/design-canvas-focus.test.ts +113 -0
- package/tests/design-canvas-handoffs.test.ts +59 -0
- package/tests/design-canvas-i18n-review.test.ts +513 -0
- package/tests/design-canvas-i18n-views.test.ts +259 -0
- package/tests/design-canvas-i18n.test.ts +526 -0
- package/tests/design-canvas-inspector.test.ts +937 -0
- package/tests/design-canvas-layout.test.ts +1222 -0
- package/tests/design-canvas-minimap.test.ts +413 -0
- package/tests/design-canvas-modules.test.ts +90 -0
- package/tests/design-canvas-parts.test.ts +721 -0
- package/tests/design-canvas-rail.test.ts +799 -0
- package/tests/design-canvas-server.test.ts +855 -17
- package/tests/design-canvas-sizes.test.ts +548 -0
- package/tests/design-canvas-store.test.ts +180 -0
- package/tests/design-canvas-tokens.test.ts +965 -0
- package/tests/design-canvas-view.test.ts +299 -0
- package/tests/design-comments.test.ts +201 -1
- package/tests/design-handoffs.test.ts +20 -0
- package/tests/design-layout.test.ts +100 -0
- package/tests/design-parts.test.ts +260 -0
- package/tests/design-system-tokens.test.ts +215 -0
- package/tests/desktop-rpc-agents.test.ts +893 -0
- package/tests/desktop-rpc-config.test.ts +1452 -0
- package/tests/desktop-rpc-design.test.ts +662 -0
- package/tests/desktop-rpc-jobs.test.ts +796 -0
- package/tests/desktop-rpc-permissions.test.ts +311 -0
- package/tests/desktop-rpc-profiles.test.ts +140 -0
- package/tests/desktop-rpc-safety.test.ts +119 -0
- package/tests/desktop-rpc-usage.test.ts +697 -0
- package/tests/desktop-rpc.test.ts +252 -0
- package/tests/destructive-command-guard.test.ts +52 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
- package/tests/devbinary/review-session-consent.devtest.ts +84 -0
- package/tests/download-progress.test.ts +71 -0
- package/tests/engram-safety.test.ts +111 -0
- package/tests/execution-surface-guard.test.ts +55 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.captured.json +92 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.provenance.md +3 -0
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +26 -31
- package/tests/fixtures/proxy-tls/proxy.crt +19 -0
- package/tests/fixtures/proxy-tls/proxy.key +28 -0
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
- package/tests/fixtures/session-profile-v1/replay.ts +53 -6
- package/tests/full-delegation-closure.test.ts +160 -0
- package/tests/full-delegation-notices.test.ts +76 -0
- package/tests/generic-agent-tools.test.ts +3 -3
- package/tests/gentle-agent-status.test.ts +74 -0
- package/tests/gentle-agents-child-jobs.test.ts +237 -0
- package/tests/gentle-agents.test.ts +1403 -20
- package/tests/gentle-ai-binary.test.ts +3 -1
- package/tests/gentle-ai-child-guards.test.ts +1 -0
- package/tests/gentle-ai-elapsed-store.test.ts +19 -0
- package/tests/gentle-ai-exploration-budget.test.ts +18 -2
- package/tests/gentle-ai-installer.test.ts +135 -51
- package/tests/gentle-ai-proxy.test.ts +434 -0
- package/tests/gentle-ai-renderer.test.ts +36 -2
- package/tests/gentle-ai.test.ts +233 -43
- package/tests/gentle-design.test.ts +386 -1
- package/tests/gentle-herdr-activity.test.ts +9 -6
- package/tests/gentle-shell-bin.test.ts +123 -0
- package/tests/gentle-shell-bundled.test.ts +293 -31
- package/tests/gentle-shell-launcher.test.ts +78 -11
- package/tests/gentle-shell.test.ts +1017 -146
- package/tests/gentle-todo.test.ts +51 -11
- package/tests/gentle-tps.test.ts +123 -0
- package/tests/gentle-ui-design-skill.test.ts +59 -0
- package/tests/herdr-busy.test.ts +59 -0
- package/tests/herdr-task-summary-policy.test.ts +8 -4
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/image-disk-cache.test.ts +163 -0
- package/tests/independent-recovery-delivery.test.ts +97 -0
- package/tests/inprocess-reviewer.test.ts +249 -4
- package/tests/install-wizard.test.ts +27 -1
- package/tests/installer-downloads.test.ts +30 -1
- package/tests/installer-posix-bootstrap.test.ts +115 -14
- package/tests/installer-preflight.test.ts +54 -5
- package/tests/installer-probes.test.ts +146 -0
- package/tests/installer-runner.test.ts +79 -44
- package/tests/installer-server.test.ts +215 -13
- package/tests/installer-windows-bootstrap.test.ts +19 -1
- package/tests/jobs-view.test.ts +260 -6
- package/tests/judgment-day-severity-admission.test.ts +46 -0
- package/tests/lazy-module-contradictions-contract.test.ts +158 -0
- package/tests/maintainer/desktop-rpc.maintest.ts +632 -0
- package/tests/maintainer/pi-update-source.maintest.ts +48 -18
- package/tests/modal-mouse-boundaries.test.ts +136 -0
- package/tests/model-fallback-policy.test.ts +26 -7
- package/tests/model-routing-authority.test.ts +178 -2
- package/tests/nan-provider-runtime.test.ts +17 -3
- package/tests/nan-provider.test.ts +111 -56
- package/tests/native-choice-list.test.ts +77 -2
- package/tests/native-review-capability-contract.test.ts +17 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
- package/tests/native-review-cli.test.ts +269 -1
- package/tests/native-review-parity.test.ts +24 -5
- package/tests/native-review-refusal-identity.test.ts +25 -0
- package/tests/no-self-pause-contract.test.ts +13 -2
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
- package/tests/odd-routing-contract.test.ts +80 -28
- package/tests/orchestrator-budget.test.ts +35 -5
- package/tests/orchestrator-consultation-sdk.test.ts +32 -6
- package/tests/orchestrator-delegation-mode.test.ts +154 -0
- package/tests/orchestrator-discovery.test.ts +28 -0
- package/tests/orchestrator-mode-policy.test.ts +175 -0
- package/tests/orchestrator-prompt-budget.test.ts +13 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +221 -0
- package/tests/orchestrator-rdd-ownership.test.ts +4 -3
- package/tests/orchestrator-work-search.test.ts +4 -2
- package/tests/package-files.test.ts +25 -1
- package/tests/package-manifest.test.ts +16 -13
- package/tests/parallel-reason-contract.test.ts +6 -3
- package/tests/permission-allowlist.test.ts +372 -0
- package/tests/persona-neutral-voseo.test.ts +4 -4
- package/tests/persona-reply-language.test.ts +1 -1
- package/tests/persona-single-channel.test.ts +13 -5
- package/tests/pi-update-launcher.test.ts +25 -7
- package/tests/pi-update-source.test.ts +113 -6
- package/tests/pi-update.test.ts +294 -19
- package/tests/pnpm-workspace-config.test.ts +58 -0
- package/tests/pnpm-workspace-policy.test.ts +47 -0
- package/tests/primary-context-files.test.ts +233 -0
- package/tests/primary-context-three-files.test.ts +174 -0
- package/tests/primary-session-prompt.test.ts +13 -0
- package/tests/profile-pin.test.ts +29 -2
- package/tests/profile-tier-footer.test.ts +5 -0
- package/tests/profiles-panel-delegation-mode.test.ts +422 -0
- package/tests/provider-defect-handoff.test.ts +9 -2
- package/tests/questionnaire-view.test.ts +115 -0
- package/tests/quiet-bash-runtime.test.ts +1 -1
- package/tests/quiet-tool-rendering.test.ts +48 -0
- package/tests/rdd-aware-verification-contract.test.ts +17 -12
- package/tests/rdd-customize.test.ts +287 -0
- package/tests/rdd-mode-cache.test.ts +450 -0
- package/tests/rdd-mode-control.test.ts +407 -0
- package/tests/rdd-mode-scope-regression.test.ts +137 -0
- package/tests/rdd-off-independent-regression.test.ts +69 -0
- package/tests/rdd-status-line.test.ts +112 -1
- package/tests/render-cache-performance.test.ts +171 -2
- package/tests/reply-language-anchor-placement.test.ts +184 -0
- package/tests/reply-language-anchor.test.ts +189 -0
- package/tests/request-context-append-only.test.ts +218 -0
- package/tests/request-context-placement.test.ts +148 -0
- package/tests/review-agent-end-preflight.test.ts +80 -2
- package/tests/review-blocker.test.ts +193 -0
- package/tests/review-candidate-owner-retry.test.ts +1 -1
- package/tests/review-candidate-symlink-scan.test.ts +157 -0
- package/tests/review-candidate-view.test.ts +66 -1
- package/tests/review-candidate-windows-boundary.test.ts +131 -0
- package/tests/review-candidate-windows-probe.test.ts +63 -0
- package/tests/review-committed-restart-ack.test.ts +129 -0
- package/tests/review-continuation-registry.test.ts +107 -0
- package/tests/review-contract-prompt.test.ts +1 -1
- package/tests/review-controller-native-routing.test.ts +261 -5
- package/tests/review-controller-workspace-root.test.ts +230 -3
- package/tests/review-controller.test.ts +98 -12
- package/tests/review-coordinator-correction-gate.test.ts +105 -0
- package/tests/review-coordinator-findings.test.ts +206 -0
- package/tests/review-coordinator-nonblocking-scope.test.ts +169 -0
- package/tests/review-coordinator-runtime.test.ts +117 -0
- package/tests/review-coordinator.test.ts +462 -0
- package/tests/review-delivery-preflight.test.ts +462 -0
- package/tests/review-due-compaction.test.ts +31 -0
- package/tests/review-due-public-boundary.test.ts +26 -0
- package/tests/review-failure-facts.test.ts +87 -0
- package/tests/review-host-relay-routing.test.ts +258 -4
- package/tests/review-host-relay.test.ts +39 -0
- package/tests/review-integration-nonblocking-findings.test.ts +108 -0
- package/tests/review-integration-v2.test.ts +46 -3
- package/tests/review-json-arguments.test.ts +105 -11
- package/tests/review-last-event-closure.test.ts +68 -0
- package/tests/review-ledger-contract.test.ts +19 -40
- package/tests/review-loadout-rdd-off-sdk.test.ts +95 -32
- package/tests/review-one-call-findings.test.ts +131 -0
- package/tests/review-one-call-followups.test.ts +308 -0
- package/tests/review-one-call-reviewer-requests.test.ts +207 -0
- package/tests/review-one-call.test.ts +452 -0
- package/tests/review-owner-identity.test.ts +60 -24
- package/tests/review-relay-phase-timing.test.ts +128 -0
- package/tests/review-relay-transport-agent.test.ts +39 -2
- package/tests/review-reviewer-evidence.test.ts +223 -0
- package/tests/review-risk-assessment.test.ts +126 -8
- package/tests/review-run-statement-guidance-independent.test.ts +54 -0
- package/tests/review-session-standing-permission-controller.test.ts +53 -3
- package/tests/review-start-context.test.ts +19 -0
- package/tests/review-tool-prose-budget.test.ts +122 -0
- package/tests/reviewer-stream.test.ts +149 -0
- package/tests/run-test-suite.test.ts +122 -1
- package/tests/runtime-harness.mjs +4 -1
- package/tests/sensitive-path-tools.test.ts +181 -5
- package/tests/session-profile-append-controller-pi.test.ts +60 -31
- package/tests/session-profile-binding.test.ts +19 -1
- package/tests/session-profile-disk-reader-pi.test.ts +58 -16
- package/tests/session-profile-extension.test.ts +2 -2
- package/tests/session-profile-v1-compat.test.ts +35 -1
- package/tests/shell-bar.test.ts +186 -42
- package/tests/shell-panel.test.ts +50 -22
- package/tests/shell-prompt.test.ts +17 -0
- package/tests/shell-sidebar-fullscreen.test.ts +5 -5
- package/tests/shell-sidebar-layout.test.ts +294 -23
- package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
- package/tests/shell-surface-transparent.test.ts +89 -0
- package/tests/shell-todo.test.ts +12 -0
- package/tests/shell-usage.test.ts +59 -10
- package/tests/skill-contradictions-contract.test.ts +122 -0
- package/tests/skill-registry-watcher.test.ts +216 -2
- package/tests/skill-registry.test.ts +1461 -5
- package/tests/startup-banner.test.ts +152 -1
- package/tests/startup-home-repo.test.ts +2 -0
- package/tests/support/design-canvas-dom.ts +369 -0
- package/tests/support/review-coordinator-runtime.ts +264 -0
- package/tests/task-size-routing-contract.test.ts +45 -12
- package/tests/test-strength-contract.test.ts +2 -1
- package/tests/todo-request-append-only.test.ts +214 -0
- package/tests/tool-batching-contract.test.ts +3 -1
- package/tests/update-agent-body-history.test.ts +138 -0
- package/tests/verification-tiers-contract.test.ts +229 -0
- package/tests/verifier-admission.test.ts +49 -0
- package/tests/verifier-preparation.test.ts +229 -0
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +162 -11
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/visual-customization-policy.test.ts +39 -6
- package/tests/visual-customize-view.test.ts +573 -9
- package/tests/visual-layout-preview.test.ts +15 -1
- package/tests/visual-profiles.test.ts +11 -0
- package/tests/voice-worker.test.ts +73 -2
- package/tests/windows-session-transport.test.ts +126 -0
- package/tests/work-continuity-contract.test.ts +77 -6
- package/tests/writer-admission-messages.test.ts +232 -0
- package/tests/writer-batch-admission.test.ts +66 -0
- package/tests/writer-edit-surface-scope.test.ts +52 -20
- package/tests/writer-feature-document-admission.test.ts +276 -0
- package/tests/yolo-customize.test.ts +27 -4
- package/tests/yolo-mode.test.ts +62 -18
- package/tests/yolo-session-policy.test.ts +270 -1
- package/skills/_shared/review-ledger-contract.md +0 -106
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -5,7 +5,7 @@ import { clampThinkingLevel, createModels, getSupportedThinkingLevels, InMemoryC
|
|
|
5
5
|
import type { Provider } from "@earendil-works/pi-ai";
|
|
6
6
|
import { completeSimple } from "@earendil-works/pi-ai/compat";
|
|
7
7
|
import nanProviderExtension from "../extensions/nan-provider.ts";
|
|
8
|
-
import { createNanProviderConfig as createNativeProvider, isNanAdaptiveReasoningModel, NAN_PROVIDER_BASE_URL, NAN_PROVIDER_ID } from "../lib/nan-provider.ts";
|
|
8
|
+
import { createNanProviderConfig as createNativeProvider, isNanAdaptiveReasoningModel, NAN_ADAPTIVE_REASONING_MODEL_IDS, NAN_PROVIDER_BASE_URL, NAN_PROVIDER_ID } from "../lib/nan-provider.ts";
|
|
9
9
|
|
|
10
10
|
// Keep catalog assertions independent of the native refresh's void return contract.
|
|
11
11
|
function createNanProviderConfig(options: Parameters<typeof createNativeProvider>[0] = {}) {
|
|
@@ -23,8 +23,17 @@ function createNanProviderConfig(options: Parameters<typeof createNativeProvider
|
|
|
23
23
|
const DOCUMENTED_CHAT_IDS = [
|
|
24
24
|
"glm5.3", "deepseek-v4-flash", "glm5.3-flash", "qwen3.8-flash",
|
|
25
25
|
"mimo-v2.6-flash", "gemma4", "qwen3.6",
|
|
26
|
+
"kimi-k3.1-pro", "qwen3.8-max", "deepseek-v4-pro", "hy4",
|
|
26
27
|
];
|
|
27
28
|
|
|
29
|
+
// Pi 1.5 derives the compat and thinking-map types through pi-schema's Static, which
|
|
30
|
+
// collapses all-optional objects to `unknown` under this repository's `strict: false`.
|
|
31
|
+
// Both Pi 1.4 and 1.5 still read `compat.maxTokensField` at run time; these views name
|
|
32
|
+
// the fields the tests read and write.
|
|
33
|
+
type CatalogModel = ReturnType<ReturnType<typeof createNativeProvider>["getModels"]>[number];
|
|
34
|
+
const capCompat = (model: CatalogModel) => model.compat as { maxTokensField?: "max_tokens" | "max_completion_tokens" } | undefined;
|
|
35
|
+
const levelMap = (model: CatalogModel) => model.thinkingLevelMap as Record<string, string | null> | undefined;
|
|
36
|
+
|
|
28
37
|
function jsonResponse(body: unknown, status = 200): Response {
|
|
29
38
|
return new Response(JSON.stringify(body), {
|
|
30
39
|
status,
|
|
@@ -182,7 +191,7 @@ test("offline and already-aborted refreshes invalidate keys without publication"
|
|
|
182
191
|
}
|
|
183
192
|
});
|
|
184
193
|
|
|
185
|
-
test("initial catalog contains all
|
|
194
|
+
test("initial catalog contains all eleven documented chat models with configured output caps", () => {
|
|
186
195
|
const models = createNanProviderConfig().models;
|
|
187
196
|
assert.deepEqual(models.map((model) => model.id), DOCUMENTED_CHAT_IDS);
|
|
188
197
|
const model = models.find((model) => model.id === "deepseek-v4-flash");
|
|
@@ -191,12 +200,12 @@ test("initial catalog contains all seven documented chat models with configured
|
|
|
191
200
|
assert.equal(model?.reasoning, true);
|
|
192
201
|
assert.deepEqual(model?.input, ["text", "image"]);
|
|
193
202
|
assert.equal(model?.contextWindow, 1_000_000);
|
|
194
|
-
assert.equal(models.length,
|
|
195
|
-
assert.equal(model?.maxTokens,
|
|
203
|
+
assert.equal(models.length, 11);
|
|
204
|
+
assert.equal(model?.maxTokens, 393_216);
|
|
196
205
|
assert.deepEqual(model?.cost, { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 });
|
|
197
206
|
});
|
|
198
207
|
|
|
199
|
-
test("
|
|
208
|
+
test("DeepSeek Flash keeps max_tokens as its configured output field", async () => {
|
|
200
209
|
const models = createNativeProvider().getModels();
|
|
201
210
|
const model = models.find((model) => model.id === "deepseek-v4-flash")!;
|
|
202
211
|
let body: Record<string, unknown> | undefined;
|
|
@@ -211,11 +220,11 @@ test("only NaN DeepSeek serializes its unchanged output cap as max_tokens", asyn
|
|
|
211
220
|
},
|
|
212
221
|
});
|
|
213
222
|
assert.equal(result.stopReason, "stop");
|
|
214
|
-
assert.equal(body?.max_tokens,
|
|
223
|
+
assert.equal(body?.max_tokens, 393_216);
|
|
215
224
|
assert.ok(!Object.hasOwn(body!, "max_completion_tokens"));
|
|
216
225
|
assert.equal(body?.reasoning_effort, "minimal");
|
|
217
|
-
assert.equal(model.maxTokens,
|
|
218
|
-
assert.equal(model
|
|
226
|
+
assert.equal(model.maxTokens, 393_216);
|
|
227
|
+
assert.equal(capCompat(model)?.maxTokensField, "max_tokens");
|
|
219
228
|
assert.ok(models.filter((candidate) => candidate.id !== model.id).every((candidate) => candidate.compat === undefined));
|
|
220
229
|
});
|
|
221
230
|
|
|
@@ -224,52 +233,75 @@ test("DeepSeek compat is isolated across snapshots, providers, and live refreshe
|
|
|
224
233
|
for (const live of [false, true]) {
|
|
225
234
|
if (live) await provider.refreshModels!(refreshContext({ type: "api_key", key: "synthetic-key" }));
|
|
226
235
|
const model = provider.getModels().find((model) => model.id === "deepseek-v4-flash")!;
|
|
227
|
-
assert.equal(model
|
|
228
|
-
model
|
|
229
|
-
assert.equal(provider.getModels().find((candidate) => candidate.id === model.id)
|
|
230
|
-
assert.equal(createNativeProvider().getModels().find((model) => model.id === "deepseek-v4-flash")
|
|
236
|
+
assert.equal(capCompat(model)?.maxTokensField, "max_tokens");
|
|
237
|
+
capCompat(model)!.maxTokensField = "max_completion_tokens";
|
|
238
|
+
assert.equal(capCompat(provider.getModels().find((candidate) => candidate.id === model.id)!)?.maxTokensField, "max_tokens");
|
|
239
|
+
assert.equal(capCompat(createNativeProvider().getModels().find((model) => model.id === "deepseek-v4-flash")!)?.maxTokensField, "max_tokens");
|
|
231
240
|
}
|
|
232
241
|
});
|
|
233
242
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
for (const id of ["glm5.3", "glm5.3-flash"]) {
|
|
237
|
-
const model = models.find((model) => model.id === id);
|
|
238
|
-
assert.ok(model);
|
|
239
|
-
assert.deepEqual(model.thinkingLevelMap, { off: null, minimal: null, xhigh: null, max: "max" });
|
|
240
|
-
assert.deepEqual(getSupportedThinkingLevels(model), ["low", "medium", "high", "max"]);
|
|
241
|
-
// Pi levels NaN does not declare clamp onto the nearest declared effort.
|
|
242
|
-
assert.equal(clampThinkingLevel(model, "off"), "low");
|
|
243
|
-
assert.equal(clampThinkingLevel(model, "minimal"), "low");
|
|
244
|
-
assert.equal(clampThinkingLevel(model, "xhigh"), "max");
|
|
245
|
-
}
|
|
246
|
-
});
|
|
243
|
+
const ALL_EFFORTS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"] as const;
|
|
244
|
+
type Effort = (typeof ALL_EFFORTS)[number];
|
|
247
245
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
246
|
+
async function chatPayload(model: ReturnType<ReturnType<typeof createNativeProvider>["getModels"]>[number], reasoning?: Effort) {
|
|
247
|
+
let body: Record<string, unknown> | undefined;
|
|
248
|
+
const result = await completeSimple(model, { messages: [{ role: "user", content: "offline probe", timestamp: 0 }] }, {
|
|
249
|
+
// Pi's simple stream represents the model's off level by omitting reasoning.
|
|
250
|
+
apiKey: "synthetic-key", reasoning: reasoning === "off" ? undefined : reasoning,
|
|
251
|
+
fetch: async (input, init) => {
|
|
252
|
+
assert.equal(String(input), `${NAN_PROVIDER_BASE_URL}/chat/completions`);
|
|
253
|
+
body = JSON.parse(String(init?.body));
|
|
254
|
+
return new Response('data: {"id":"offline","choices":[{"index":0,"delta":{"role":"assistant","content":"ok"},"finish_reason":"stop"}]}\n\ndata: [DONE]\n\n', {
|
|
255
|
+
headers: { "content-type": "text/event-stream" },
|
|
256
|
+
});
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
assert.equal(result.stopReason, "stop");
|
|
260
|
+
assert.ok(body);
|
|
261
|
+
return body;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Assert the public Pi level list and actual OpenAI-compatible wire payload, not
|
|
265
|
+
// just the map: ordinary levels pass through, while off and MiMo use aliases.
|
|
266
|
+
for (const id of DOCUMENTED_CHAT_IDS) {
|
|
267
|
+
test(`${id} exposes and serializes NaN's accepted reasoning efforts`, async () => {
|
|
268
|
+
const model = createNativeProvider().getModels().find((candidate) => candidate.id === id);
|
|
254
269
|
assert.ok(model);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
270
|
+
const glm = id === "glm5.3" || id === "glm5.3-flash";
|
|
271
|
+
const mimo = id === "mimo-v2.6-flash";
|
|
272
|
+
const supported = glm ? ALL_EFFORTS.slice(1) : [...ALL_EFFORTS];
|
|
273
|
+
assert.deepEqual(getSupportedThinkingLevels(model), supported);
|
|
274
|
+
if (glm) assert.equal(clampThinkingLevel(model, "off"), "minimal");
|
|
275
|
+
for (const effort of supported) {
|
|
276
|
+
const body = await chatPayload(model, effort);
|
|
277
|
+
const expected = effort === "off" ? "none" : mimo && effort === "minimal" ? "low" : mimo && effort === "xhigh" ? "max" : effort;
|
|
278
|
+
assert.equal(body.model, id);
|
|
279
|
+
assert.equal(body.reasoning_effort, expected, `${id} ${effort}`);
|
|
280
|
+
assert.equal(Object.hasOwn(body, "thinking"), false, `${id} ${effort} must use reasoning_effort`);
|
|
281
|
+
const capField = id === "deepseek-v4-flash" ? "max_tokens" : "max_completion_tokens";
|
|
282
|
+
const otherField = capField === "max_tokens" ? "max_completion_tokens" : "max_tokens";
|
|
283
|
+
// Pi clamps the configured cap to the context window minus its 4,096-token
|
|
284
|
+
// safety reserve and this probe's 4 estimated tokens. Only Kimi K3.1 Pro
|
|
285
|
+
// (Max answer 1M == context window) hits that clamp: 1,000,000 - 4,100.
|
|
286
|
+
const expectedCap = model.maxTokens >= model.contextWindow ? 995_900 : model.maxTokens;
|
|
287
|
+
assert.equal(body[capField], expectedCap, `${id} ${effort} output cap`);
|
|
288
|
+
assert.equal(Object.hasOwn(body, otherField), false, `${id} ${effort} alternate cap`);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
test("Hy4 forwards explicit effort; Pi's off mapping does not invent its server default", async () => {
|
|
294
|
+
const model = createNativeProvider().getModels().find((candidate) => candidate.id === "hy4");
|
|
295
|
+
assert.ok(model);
|
|
296
|
+
assert.equal((await chatPayload(model, "high")).reasoning_effort, "high");
|
|
297
|
+
assert.equal((await chatPayload(model, "off")).reasoning_effort, "none");
|
|
298
|
+
// Pi's simple stream also uses the off map when no option was supplied.
|
|
299
|
+
assert.equal((await chatPayload(model)).reasoning_effort, "none");
|
|
259
300
|
});
|
|
260
301
|
|
|
261
|
-
test("
|
|
262
|
-
|
|
263
|
-
assert.
|
|
264
|
-
models.filter((model) => isNanAdaptiveReasoningModel(model)).map((model) => model.id),
|
|
265
|
-
["deepseek-v4-flash", "qwen3.8-flash", "mimo-v2.6-flash"],
|
|
266
|
-
);
|
|
267
|
-
// Qwen 3.6 and Gemma 4 share the same map but honor the level as a depth budget.
|
|
268
|
-
for (const id of ["qwen3.6", "gemma4", "glm5.3", "glm5.3-flash"]) {
|
|
269
|
-
const model = models.find((model) => model.id === id);
|
|
270
|
-
assert.ok(model);
|
|
271
|
-
assert.equal(isNanAdaptiveReasoningModel(model), false);
|
|
272
|
-
}
|
|
302
|
+
test("the legacy adaptive marker is retained but no longer classifies NaN models", () => {
|
|
303
|
+
assert.deepEqual([...NAN_ADAPTIVE_REASONING_MODEL_IDS], []);
|
|
304
|
+
for (const model of createNativeProvider().getModels()) assert.equal(isNanAdaptiveReasoningModel(model), false);
|
|
273
305
|
assert.equal(isNanAdaptiveReasoningModel(undefined), false);
|
|
274
306
|
assert.equal(isNanAdaptiveReasoningModel({ provider: "openai", id: "deepseek-v4-flash" }), false);
|
|
275
307
|
});
|
|
@@ -280,17 +312,19 @@ test("thinking maps are isolated across snapshots, providers, and live catalog r
|
|
|
280
312
|
});
|
|
281
313
|
const baseline = provider.getModels();
|
|
282
314
|
for (const model of provider.getModels()) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
315
|
+
const map = levelMap(model);
|
|
316
|
+
assert.ok(map);
|
|
317
|
+
map.off = "mutated";
|
|
318
|
+
map.medium = null;
|
|
286
319
|
}
|
|
287
320
|
assert.deepEqual(provider.getModels(), baseline);
|
|
288
321
|
assert.deepEqual(createNativeProvider().getModels(), baseline);
|
|
289
322
|
await provider.refreshModels!(refreshContext({ type: "api_key", key: "map-key" }));
|
|
290
323
|
assert.deepEqual(provider.getModels(), baseline);
|
|
291
324
|
for (const model of provider.getModels()) {
|
|
292
|
-
|
|
293
|
-
|
|
325
|
+
const map = levelMap(model);
|
|
326
|
+
assert.ok(map);
|
|
327
|
+
map.xhigh = "mutated";
|
|
294
328
|
}
|
|
295
329
|
assert.deepEqual(provider.getModels(), baseline);
|
|
296
330
|
await provider.refreshModels!(refreshContext({ type: "api_key", key: "map-key" }));
|
|
@@ -320,7 +354,7 @@ test("live discovery uses the key-scoped endpoint and replaces the fallback with
|
|
|
320
354
|
const config = createNanProviderConfig({
|
|
321
355
|
fetchImpl: async (input, init) => {
|
|
322
356
|
request = { url: String(input), init };
|
|
323
|
-
return jsonResponse({ data: [{ id: " glm5.3 " }, { id: "glm5.3" }, { id: "unknown-chat" }, { id: "embedding" }, { id: "image" }, { id: "speech" }, { id: "rerank" }] });
|
|
357
|
+
return jsonResponse({ data: [{ id: " glm5.3 " }, { id: "glm5.3" }, { id: "hy4" }, { id: "qwen3.8-max" }, { id: "deepseek-v4-pro" }, { id: "kimi-k3.1-pro" }, { id: "unknown-chat" }, { id: "embedding" }, { id: "image" }, { id: "speech" }, { id: "rerank" }] });
|
|
324
358
|
},
|
|
325
359
|
});
|
|
326
360
|
const fallbackId = "deepseek-v4-flash";
|
|
@@ -332,7 +366,7 @@ test("live discovery uses the key-scoped endpoint and replaces the fallback with
|
|
|
332
366
|
assert.equal(request?.init?.method, "GET");
|
|
333
367
|
assert.equal(new Headers(request?.init?.headers).get("authorization"), "Bearer test-secret");
|
|
334
368
|
assert.equal(request?.init?.redirect, "error");
|
|
335
|
-
assert.deepEqual(models?.map((model) => model.id), ["glm5.3"]);
|
|
369
|
+
assert.deepEqual(models?.map((model) => model.id), ["glm5.3", "hy4", "qwen3.8-max", "deepseek-v4-pro", "kimi-k3.1-pro"]);
|
|
336
370
|
assert.ok(!models?.some((model) => model.id === fallbackId));
|
|
337
371
|
|
|
338
372
|
const known = models?.[0];
|
|
@@ -347,12 +381,16 @@ test("live discovery uses the key-scoped endpoint and replaces the fallback with
|
|
|
347
381
|
test("known chat models retain documented capabilities without advertising audio", async () => {
|
|
348
382
|
const expected = [
|
|
349
383
|
["glm5.3", 1_000_000, ["text", "image"], 32_768],
|
|
350
|
-
["deepseek-v4-flash", 1_000_000, ["text", "image"],
|
|
351
|
-
["glm5.3-flash", 1_000_000, ["text", "image"],
|
|
384
|
+
["deepseek-v4-flash", 1_000_000, ["text", "image"], 393_216],
|
|
385
|
+
["glm5.3-flash", 1_000_000, ["text", "image"], 131_072],
|
|
352
386
|
["qwen3.8-flash", 1_048_576, ["text", "image"], 131_000],
|
|
353
387
|
["mimo-v2.6-flash", 1_000_000, ["text", "image"], 32_768],
|
|
354
388
|
["gemma4", 262_000, ["text", "image"], 65_536],
|
|
355
389
|
["qwen3.6", 262_000, ["text", "image"], 65_536],
|
|
390
|
+
["kimi-k3.1-pro", 1_000_000, ["text", "image"], 1_000_000],
|
|
391
|
+
["qwen3.8-max", 1_000_000, ["text", "image"], 131_000],
|
|
392
|
+
["deepseek-v4-pro", 1_000_000, ["text"], 393_000],
|
|
393
|
+
["hy4", 1_000_000, ["text", "image"], 64_000],
|
|
356
394
|
] as const;
|
|
357
395
|
const config = createNanProviderConfig({
|
|
358
396
|
fetchImpl: async () => jsonResponse({ data: expected.map(([id]) => ({ id })) }),
|
|
@@ -363,9 +401,12 @@ test("known chat models retain documented capabilities without advertising audio
|
|
|
363
401
|
const model = models?.[index];
|
|
364
402
|
assert.equal(model?.id, id);
|
|
365
403
|
assert.equal(model?.reasoning, true);
|
|
404
|
+
assert.equal(model?.api, "openai-completions");
|
|
366
405
|
assert.equal(model?.contextWindow, contextWindow);
|
|
367
406
|
assert.deepEqual(model?.input, input);
|
|
368
407
|
assert.equal(model?.maxTokens, maxTokens);
|
|
408
|
+
assert.deepEqual(model?.cost, { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 });
|
|
409
|
+
assert.deepEqual(model?.compat, id === "deepseek-v4-flash" ? { maxTokensField: "max_tokens" } : undefined);
|
|
369
410
|
}
|
|
370
411
|
});
|
|
371
412
|
|
|
@@ -515,3 +556,17 @@ test("an old in-flight discovery cannot overwrite a changed credential's catalog
|
|
|
515
556
|
...refreshContext({ type: "api_key", key: "second-key" }), allowNetwork: false,
|
|
516
557
|
}), []);
|
|
517
558
|
});
|
|
559
|
+
|
|
560
|
+
test("NaN effort levels per model follow the reasoning contract", () => {
|
|
561
|
+
const models = createNativeProvider().getModels();
|
|
562
|
+
const levels = Object.fromEntries(models.map((model) => [model.id, getSupportedThinkingLevels(model).join(",")]));
|
|
563
|
+
const full = "off,minimal,low,medium,high,xhigh,max";
|
|
564
|
+
const glm = "minimal,low,medium,high,xhigh,max";
|
|
565
|
+
assert.deepEqual(levels, {
|
|
566
|
+
"glm5.3": glm, "glm5.3-flash": glm,
|
|
567
|
+
"deepseek-v4-flash": full, "qwen3.8-flash": full, "mimo-v2.6-flash": full, gemma4: full, "qwen3.6": full,
|
|
568
|
+
"kimi-k3.1-pro": full, "qwen3.8-max": full, "deepseek-v4-pro": full, hy4: full,
|
|
569
|
+
});
|
|
570
|
+
const mimo = models.find((model) => model.id === "mimo-v2.6-flash");
|
|
571
|
+
assert.deepEqual(mimo?.thinkingLevelMap, { off: "none", minimal: "low", xhigh: "max", max: "max" });
|
|
572
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import test, { mock } from "node:test";
|
|
3
3
|
import {
|
|
4
|
-
KeybindingsManager, stripTerminalSequences, Text, TUI_KEYBINDINGS,
|
|
5
|
-
type Component, type TuiMouseEvent, visibleWidth,
|
|
4
|
+
KeybindingsManager, stripTerminalSequences, Text, TUI_KEYBINDINGS, TuiAltScreen,
|
|
5
|
+
type Component, type Terminal, type TuiMouseEvent, visibleWidth,
|
|
6
6
|
} from "@earendil-works/pi-tui";
|
|
7
7
|
import { NativeChoiceList } from "../lib/native-choice-list.ts";
|
|
8
8
|
import {
|
|
@@ -85,6 +85,81 @@ test("native choice list presents one hovered wrapped option without changing se
|
|
|
85
85
|
assert.doesNotMatch(list.render(56).join("\n"), new RegExp(hoverBackground.replace(/[\[\]]/g, "\\$&")));
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
+
const warningForeground = "\u001b[33m";
|
|
89
|
+
const warningTheme = {
|
|
90
|
+
...theme,
|
|
91
|
+
fg: (role: string, text: string) => role === "warning" ? `${warningForeground}${text}\u001b[39m` : text,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
test("native choice hover uses the shared warning foreground without selecting or activating", () => {
|
|
95
|
+
const items = [
|
|
96
|
+
{ id: "opaque-first", label: "First", description: "First detail." },
|
|
97
|
+
{ id: "opaque-second", label: "Second", description: "Second detail." },
|
|
98
|
+
];
|
|
99
|
+
const list = new NativeChoiceList(items, warningTheme);
|
|
100
|
+
const selected: string[] = [];
|
|
101
|
+
list.onSelect = (item) => selected.push(item.id);
|
|
102
|
+
let { lines, row } = layout(list, 40, "Second");
|
|
103
|
+
assert.equal(list.handleMouse(event("move", "none", row, 40, lines.length))?.render, true);
|
|
104
|
+
lines = list.render(40);
|
|
105
|
+
assert.match(lines[row]!, /\x1b\[33mSecond\x1b\[39m/);
|
|
106
|
+
assert.ok(!lines[row]!.includes(hoverBackground), "hover does not use toolPendingBg");
|
|
107
|
+
assert.equal(list.getSelectedItem(), items[0]);
|
|
108
|
+
assert.deepEqual(selected, []);
|
|
109
|
+
assert.equal(list.handleMouse(event("move", "none", row, 40, lines.length))?.render, false);
|
|
110
|
+
list.handleInput("\r");
|
|
111
|
+
assert.deepEqual(selected, ["opaque-first"], "Enter still selects the keyboard item");
|
|
112
|
+
list.invalidate();
|
|
113
|
+
assert.doesNotMatch(list.render(40).join("\n"), /\x1b\[33m/);
|
|
114
|
+
({ lines, row } = layout(list, 40, "Second"));
|
|
115
|
+
list.handleMouse(event("move", "none", row, 40, lines.length));
|
|
116
|
+
list.dispose();
|
|
117
|
+
assert.equal(list.handleMouse(event("click", "left", row, 40, lines.length)), undefined);
|
|
118
|
+
list.handleInput("\r");
|
|
119
|
+
assert.deepEqual(selected, ["opaque-first"]);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test("choice overlay uses real SGR coordinates and documents the outside-overlay leave boundary", () => {
|
|
123
|
+
let input: ((data: string) => void) | undefined;
|
|
124
|
+
const terminal: Terminal = {
|
|
125
|
+
start(onInput) { input = onInput; }, stop() {}, async drainInput() {}, write() {},
|
|
126
|
+
get columns() { return 120; }, get rows() { return 30; }, get kittyProtocolActive() { return false; },
|
|
127
|
+
moveBy() {}, hideCursor() {}, showCursor() {}, clearLine() {}, clearFromCursor() {}, clearScreen() {},
|
|
128
|
+
setTitle() {}, setProgress() {}, setProgramStatus() {},
|
|
129
|
+
};
|
|
130
|
+
const list = new NativeChoiceList([{ id: "first", label: "First" }, { id: "second", label: "Second" }], warningTheme);
|
|
131
|
+
const selected: string[] = [];
|
|
132
|
+
list.onSelect = (item) => selected.push(item.id);
|
|
133
|
+
const root = createNativeFullscreenInteraction({
|
|
134
|
+
keyboardTarget: list, requestRender() {}, mouseObserver: list.createMouseObserver(() => {}),
|
|
135
|
+
});
|
|
136
|
+
root.addChild(new Text("Heading", 0, 0));
|
|
137
|
+
root.addChild(list);
|
|
138
|
+
root.addChild(new Text("Footer", 0, 0));
|
|
139
|
+
const tui = new TuiAltScreen(terminal, false, undefined, { mouse: true });
|
|
140
|
+
const overlay = tui.showOverlay(root, { anchor: "center", width: 60, maxHeight: 15 });
|
|
141
|
+
tui.start(); tui.renderNow(true);
|
|
142
|
+
try {
|
|
143
|
+
let lines = root.render(60);
|
|
144
|
+
const bounds = overlay.getBounds();
|
|
145
|
+
assert.ok(bounds && bounds.col > 0 && bounds.row > 0);
|
|
146
|
+
const second = lines.findIndex((line) => stripTerminalSequences(line).includes("Second"));
|
|
147
|
+
assert.ok(second >= 0);
|
|
148
|
+
const x = bounds.col + 3, y = bounds.row + second + 1;
|
|
149
|
+
input?.(`\x1b[<35;${x};${y}M`);
|
|
150
|
+
lines = root.render(60);
|
|
151
|
+
assert.match(lines[second]!, /\x1b\[33mSecond\x1b\[39m/);
|
|
152
|
+
assert.deepEqual(selected, []);
|
|
153
|
+
input?.("\x1b[<35;1;1M");
|
|
154
|
+
assert.match(root.render(60)[second]!, /\x1b\[33mSecond\x1b\[39m/, "outside-overlay motion is not delivered to the root observer");
|
|
155
|
+
input?.(`\x1b[<35;${bounds.col + 1};${bounds.row + 1}M`);
|
|
156
|
+
assert.doesNotMatch(root.render(60).join("\n"), /\x1b\[33m/, "inside-root heading motion clears hover");
|
|
157
|
+
input?.(`\x1b[<0;${x};${y}M`);
|
|
158
|
+
input?.(`\x1b[<0;${x};${y}m`);
|
|
159
|
+
assert.deepEqual(selected, ["second"]);
|
|
160
|
+
} finally { tui.stop(); }
|
|
161
|
+
});
|
|
162
|
+
|
|
88
163
|
test("native choice list refreshes existing item content without changing selection", () => {
|
|
89
164
|
const items = [
|
|
90
165
|
{ id: "first", label: "First", description: "Initial detail." },
|
|
@@ -392,11 +392,27 @@ test("4.3.1 explicitly repeats 4.2.0 because capabilities/v2.6 and provider cont
|
|
|
392
392
|
assert.deepEqual(contract, NATIVE_CLI_CONTRACTS["4.2.0"] as Record<string, boolean>);
|
|
393
393
|
});
|
|
394
394
|
|
|
395
|
+
test("4.4.0 explicitly repeats 4.3.1 because capabilities/v2.6 and provider contract 1.4.0 are unchanged", () => {
|
|
396
|
+
const contract = NATIVE_CLI_CONTRACTS["4.4.0"] as Record<string, boolean>;
|
|
397
|
+
assert.ok(contract);
|
|
398
|
+
assert.deepEqual(contract, NATIVE_CLI_CONTRACTS["4.3.1"] as Record<string, boolean>);
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
test("4.5.0 explicitly repeats 4.4.0 because capabilities/v2.6 still carries the negotiated surface", () => {
|
|
402
|
+
// Ground truth from the published v4.5.0 darwin/arm64 binary:
|
|
403
|
+
// `review capabilities --contract gentle-ai.review-integration/v2` reports
|
|
404
|
+
// schema/feature identity capabilities/v2.6 (protocol minor 6), and the
|
|
405
|
+
// additive provider contract 1.5.0 changes no negotiated START/STATUS field.
|
|
406
|
+
const contract = NATIVE_CLI_CONTRACTS["4.5.0"] as Record<string, boolean>;
|
|
407
|
+
assert.ok(contract);
|
|
408
|
+
assert.deepEqual(contract, NATIVE_CLI_CONTRACTS["4.4.0"] as Record<string, boolean>);
|
|
409
|
+
});
|
|
410
|
+
|
|
395
411
|
test("no shipped version key was added beyond the pin bump", () => {
|
|
396
412
|
// Rows are promises to consumers, so a new key only ever appears in a
|
|
397
413
|
// dedicated commit alongside a pin bump, never as a side effect. v2.2.4 and
|
|
398
414
|
// v2.3.0 shipped upstream while Pi stayed on 2.2.3 and were never pinned,
|
|
399
415
|
// so they get no row: a row asserts ground truth measured against a binary
|
|
400
416
|
// Pi actually ran, and the table only has to be ascending, not gapless.
|
|
401
|
-
assert.deepEqual(Object.keys(NATIVE_CLI_CONTRACTS), [...DARK_VERSIONS, "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.4.0", "2.5.0-rc.3", "2.5.0", "2.6.0", "2.7.0", "2.8.0", "2.8.1", "2.8.2", "2.9.0", "2.9.1", "3.0.0", "3.0.1", "3.1.0", "3.2.1", "3.4.0", "3.5.0", "3.6.0", "3.6.1", "3.7.0", "4.0.0", "4.1.1", "4.2.0", "4.3.1"]);
|
|
417
|
+
assert.deepEqual(Object.keys(NATIVE_CLI_CONTRACTS), [...DARK_VERSIONS, "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.4.0", "2.5.0-rc.3", "2.5.0", "2.6.0", "2.7.0", "2.8.0", "2.8.1", "2.8.2", "2.9.0", "2.9.1", "3.0.0", "3.0.1", "3.1.0", "3.2.1", "3.4.0", "3.5.0", "3.6.0", "3.6.1", "3.7.0", "4.0.0", "4.1.1", "4.2.0", "4.3.1", "4.4.0", "4.5.0"]);
|
|
402
418
|
});
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import test, { after } from "node:test";
|
|
6
|
+
import { NativeReviewCliV216, NativeReviewIntegrationError, type ExecFileAdapter } from "../lib/native-review-cli.ts";
|
|
7
|
+
|
|
8
|
+
// odd/tasks/review-one-call.md T11 (S5), L18: contracted STATUS asks for the
|
|
9
|
+
// non-blocking findings (gentle-ai#6088) only when the caller requests them; a
|
|
10
|
+
// provider that refuses the unknown flag is asked once more without it and is
|
|
11
|
+
// not sent the flag again while it stays the same binary.
|
|
12
|
+
|
|
13
|
+
const scratch = realpathSync(mkdtempSync(join(realpathSync(tmpdir()), "native-nbf-")));
|
|
14
|
+
after(() => rmSync(scratch, { recursive: true, force: true }));
|
|
15
|
+
let binaries = 0;
|
|
16
|
+
/** A package-local executable stand-in; only its path and bytes identify it. */
|
|
17
|
+
function binary(content = `fixture-${binaries}`): string {
|
|
18
|
+
const path = join(scratch, `gentle-ai-${binaries++}`);
|
|
19
|
+
writeFileSync(path, content);
|
|
20
|
+
return path;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const statusBody = JSON.parse(readFileSync(join(process.cwd(), "tests", "fixtures", "devbinary", "status-v5.captured.json"), "utf8"));
|
|
24
|
+
const refusal = (cause: string) => ({
|
|
25
|
+
schema: "gentle-ai.review-integration.failure/v2", contract: "gentle-ai.review-integration/v2", operation: "review.status", phase: "preflight",
|
|
26
|
+
code: "invalid_request", message: "The negotiated review request is invalid.", mutation_outcome: "not_started", authority_applicability: "not_evaluated",
|
|
27
|
+
retry_safe: true, replayability: "not_replayable", required_inputs: [], next_action: "correct_request", cause,
|
|
28
|
+
});
|
|
29
|
+
const UNKNOWN_FLAG = refusal("flag provided but not defined: -non-blocking-findings");
|
|
30
|
+
type Reply = { body: unknown; exitCode?: number };
|
|
31
|
+
function adapter(replies: Reply[]): { adapter: ExecFileAdapter; calls: { file: string; arguments: readonly string[] }[] } {
|
|
32
|
+
const calls: { file: string; arguments: readonly string[] }[] = [];
|
|
33
|
+
return { calls, adapter: async (request) => {
|
|
34
|
+
calls.push({ file: request.file, arguments: request.arguments });
|
|
35
|
+
const reply = replies.shift();
|
|
36
|
+
if (reply === undefined) throw new Error("unexpected native invocation");
|
|
37
|
+
const exitCode = reply.exitCode ?? 0;
|
|
38
|
+
return { stdout: JSON.stringify(reply.body), stderr: exitCode === 0 ? "" : "Error: The negotiated review request is invalid. [invalid_request]\n", exitCode, signal: null, timedOut: false, outputLimitExceeded: false };
|
|
39
|
+
} };
|
|
40
|
+
}
|
|
41
|
+
const base = ["review", "status", "--contract", "gentle-ai.review-integration/v2", "--cwd", "/repo", "--projection", "workspace", "--lineage", "review-status-fixture", "--agent", "pi"];
|
|
42
|
+
const request = { cwd: "/repo", lineageId: "review-status-fixture", agent: "pi" as const };
|
|
43
|
+
|
|
44
|
+
test("a contracted STATUS sends --non-blocking-findings only when the caller asks for it", async () => {
|
|
45
|
+
const queue = adapter([{ body: statusBody }, { body: statusBody }]);
|
|
46
|
+
const cli = new NativeReviewCliV216(queue.adapter, binary(), 30_000, 1024 * 1024);
|
|
47
|
+
await cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
48
|
+
await cli.targetStatus(request);
|
|
49
|
+
assert.deepEqual(queue.calls.map((call) => call.arguments), [[...base, "--non-blocking-findings", "--next-transition"], [...base, "--next-transition"]]);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("a provider that refuses the unknown flag is asked once more without it and is not sent it again while it is the same binary", async () => {
|
|
53
|
+
const executable = binary();
|
|
54
|
+
const queue = adapter([{ body: UNKNOWN_FLAG, exitCode: 1 }, { body: statusBody }, { body: statusBody }]);
|
|
55
|
+
const cli = new NativeReviewCliV216(queue.adapter, () => executable, 30_000, 1024 * 1024);
|
|
56
|
+
const first = await cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
57
|
+
assert.equal(first.nextTransition?.kind, "collect", "the run ends as today");
|
|
58
|
+
assert.equal(Object.hasOwn(first, "nonBlockingFindings"), false);
|
|
59
|
+
await cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
60
|
+
assert.deepEqual(queue.calls.map((call) => call.arguments), [
|
|
61
|
+
[...base, "--non-blocking-findings", "--next-transition"],
|
|
62
|
+
[...base, "--next-transition"],
|
|
63
|
+
[...base, "--next-transition"],
|
|
64
|
+
]);
|
|
65
|
+
// A replaced binary at the same path is a different provider: asked again.
|
|
66
|
+
writeFileSync(executable, "a newer provider");
|
|
67
|
+
const renewed = adapter([{ body: statusBody }]);
|
|
68
|
+
const replaced = new NativeReviewCliV216(renewed.adapter, () => executable, 30_000, 1024 * 1024);
|
|
69
|
+
await replaced.targetStatus({ ...request, nonBlockingFindings: true });
|
|
70
|
+
assert.deepEqual(renewed.calls[0]!.arguments, [...base, "--non-blocking-findings", "--next-transition"]);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test("the refusal is remembered per binary: another binary is still sent the flag", async () => {
|
|
74
|
+
const old = binary("old provider");
|
|
75
|
+
const current = binary("current provider");
|
|
76
|
+
let path = old;
|
|
77
|
+
const queue = adapter([{ body: UNKNOWN_FLAG, exitCode: 1 }, { body: statusBody }, { body: statusBody }]);
|
|
78
|
+
const cli = new NativeReviewCliV216(queue.adapter, () => path, 30_000, 1024 * 1024);
|
|
79
|
+
await cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
80
|
+
path = current;
|
|
81
|
+
await cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
82
|
+
assert.deepEqual(queue.calls.map((call) => [call.file, call.arguments.includes("--non-blocking-findings")]), [[old, true], [old, false], [current, true]]);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("any other STATUS failure is not retried and keeps its error", async () => {
|
|
86
|
+
for (const body of [refusal("flag provided but not defined: -lenses"), refusal("--non-blocking-findings requires --contract gentle-ai.review-integration/v2"), { ...UNKNOWN_FLAG, code: "authority_unavailable" }]) {
|
|
87
|
+
const queue = adapter([{ body, exitCode: 1 }]);
|
|
88
|
+
const cli = new NativeReviewCliV216(queue.adapter, binary(), 30_000, 1024 * 1024);
|
|
89
|
+
await assert.rejects(cli.targetStatus({ ...request, nonBlockingFindings: true }), (error: unknown) => error instanceof NativeReviewIntegrationError && error.failureEnvelope.cause === body.cause);
|
|
90
|
+
assert.equal(queue.calls.length, 1, String(body.cause));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("the flag rides only Gentle Shell's own contracted STATUS, never a provider-issued selection submission", async () => {
|
|
95
|
+
const queue = adapter([{ body: statusBody }]);
|
|
96
|
+
const cli = new NativeReviewCliV216(queue.adapter, binary(), 30_000, 1024 * 1024);
|
|
97
|
+
await cli.targetStatus({ cwd: "/repo", nonBlockingFindings: true, intendedUntrackedSelection: {
|
|
98
|
+
argumentTokens: ["--contract=gentle-ai.review-integration/v2", "--next-transition=true", "--agent=pi", "--projection=workspace", "--intended-untracked-selection={{value}}"], value: "{}" } } as never);
|
|
99
|
+
assert.equal(queue.calls[0]!.arguments.includes("--non-blocking-findings"), false);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Verifier regressions (odd/tasks/review-one-call.md L19).
|
|
103
|
+
test("two concurrent first STATUS calls each pay the refusal once; later calls never resend the flag", async () => {
|
|
104
|
+
const executable = binary("concurrent provider");
|
|
105
|
+
const calls: boolean[] = [];
|
|
106
|
+
const adapterFn: ExecFileAdapter = async (request) => {
|
|
107
|
+
const flagged = request.arguments.includes("--non-blocking-findings");
|
|
108
|
+
calls.push(flagged);
|
|
109
|
+
await new Promise((resolve) => setTimeout(resolve, 5));
|
|
110
|
+
const refused = flagged;
|
|
111
|
+
return { stdout: JSON.stringify(refused ? UNKNOWN_FLAG : statusBody), stderr: refused ? "Error: The negotiated review request is invalid. [invalid_request]\n" : "", exitCode: refused ? 1 : 0, signal: null, timedOut: false, outputLimitExceeded: false };
|
|
112
|
+
};
|
|
113
|
+
const cli = new NativeReviewCliV216(adapterFn, () => executable, 30_000, 1024 * 1024);
|
|
114
|
+
await Promise.all([cli.targetStatus({ ...request, nonBlockingFindings: true }), cli.targetStatus({ ...request, nonBlockingFindings: true })]);
|
|
115
|
+
await cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
116
|
+
assert.deepEqual(calls, [true, true, false, false, false]);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test("look-alike refusals are not retried", async () => {
|
|
120
|
+
for (const body of [
|
|
121
|
+
refusal("x flag provided but not defined: -non-blocking-findings"),
|
|
122
|
+
refusal("flag provided but not defined: -non-blocking-findings-v2"),
|
|
123
|
+
{ ...UNKNOWN_FLAG, mutation_outcome: "unknown" },
|
|
124
|
+
]) {
|
|
125
|
+
const queue = adapter([{ body, exitCode: 1 }]);
|
|
126
|
+
const cli = new NativeReviewCliV216(queue.adapter, binary(), 30_000, 1024 * 1024);
|
|
127
|
+
await assert.rejects(cli.targetStatus({ ...request, nonBlockingFindings: true }));
|
|
128
|
+
assert.equal(queue.calls.length, 1, JSON.stringify(body).slice(0, 200));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test("an in-flight old refusal does not suppress the flag for a replacement executable", async () => {
|
|
133
|
+
const executable = binary("old in-flight provider");
|
|
134
|
+
let enter!: () => void;
|
|
135
|
+
let release!: () => void;
|
|
136
|
+
const entered = new Promise<void>((resolve) => { enter = resolve; });
|
|
137
|
+
const held = new Promise<void>((resolve) => { release = resolve; });
|
|
138
|
+
const queue = adapter([{ body: UNKNOWN_FLAG, exitCode: 1 }, { body: statusBody }, { body: statusBody }]);
|
|
139
|
+
let first = true;
|
|
140
|
+
const cli = new NativeReviewCliV216(async (call) => {
|
|
141
|
+
if (first) { first = false; enter(); await held; }
|
|
142
|
+
return queue.adapter(call);
|
|
143
|
+
}, executable, 30_000, 1024 * 1024);
|
|
144
|
+
const pending = cli.targetStatus({ ...request, nonBlockingFindings: true });
|
|
145
|
+
await entered;
|
|
146
|
+
writeFileSync(executable, "replacement supporting provider");
|
|
147
|
+
release();
|
|
148
|
+
assert.equal((await pending).nextTransition?.kind, "collect");
|
|
149
|
+
assert.equal((await cli.targetStatus({ ...request, nonBlockingFindings: true })).nextTransition?.kind, "collect");
|
|
150
|
+
assert.deepEqual(queue.calls.map((call) => call.arguments), [
|
|
151
|
+
[...base, "--non-blocking-findings", "--next-transition"],
|
|
152
|
+
[...base, "--next-transition"],
|
|
153
|
+
[...base, "--non-blocking-findings", "--next-transition"],
|
|
154
|
+
]);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test("unreadable executable identity preserves STATUS refusal fallback without caching", async () => {
|
|
158
|
+
const executable = join(scratch, "absent-executable");
|
|
159
|
+
const queue = adapter([{ body: UNKNOWN_FLAG, exitCode: 1 }, { body: statusBody }, { body: UNKNOWN_FLAG, exitCode: 1 }, { body: statusBody }]);
|
|
160
|
+
const cli = new NativeReviewCliV216(queue.adapter, executable, 30_000, 1024 * 1024);
|
|
161
|
+
for (let call = 0; call < 2; call++) {
|
|
162
|
+
assert.equal((await cli.targetStatus({ ...request, nonBlockingFindings: true })).nextTransition?.kind, "collect");
|
|
163
|
+
}
|
|
164
|
+
assert.deepEqual(queue.calls.map((call) => call.arguments.includes("--non-blocking-findings")), [true, false, true, false]);
|
|
165
|
+
});
|