gentle-pi 4.7.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 +55 -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 +6 -6
- 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 +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 +746 -15
- package/assets/design-canvas/canvas.js +2 -1506
- package/assets/design-canvas/index.html +117 -36
- package/assets/design-canvas/inspector.js +546 -16
- package/assets/install-wizard/wizard.js +5 -1
- package/assets/migrations/agent-body-history.json +24 -0
- package/assets/orchestrator-delegation-reference.md +8 -14
- package/assets/orchestrator-delegation.md +4 -4
- package/assets/orchestrator-full-delegation-card.md +4 -5
- package/assets/orchestrator-full-delegation.md +8 -8
- package/assets/orchestrator-memory.md +2 -2
- package/assets/orchestrator-prompts.md +1 -1
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +13 -12
- package/assets/orchestrator-tracking.md +10 -14
- package/assets/orchestrator-verification.md +10 -8
- package/assets/orchestrator-writer.md +4 -4
- package/assets/orchestrator.md +18 -22
- package/bin/gentle-shell.mjs +128 -9
- 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/assets/brand/sponsor-banner.svg +60 -0
- package/docs/bundled-install.md +14 -6
- package/docs/delegated-verification.md +18 -2
- package/docs/desktop-rpc.md +1253 -0
- package/docs/gentle-agents-activity.md +26 -0
- package/docs/gentle-shell.md +39 -16
- 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 +76 -24
- package/docs/review-coordinator.md +29 -9
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/work-continuity.md +11 -1
- package/extensions/ask-user-question.ts +2 -2
- package/extensions/child-context.ts +21 -7
- package/extensions/gentle-agents.ts +234 -33
- package/extensions/gentle-ai.ts +576 -135
- 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 +105 -52
- package/extensions/gentle-todo.ts +48 -25
- package/extensions/skill-registry.ts +248 -223
- 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 +15 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-runner.ts +91 -6
- package/lib/agents-session-transport.ts +17 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/bounded-writer-admission.ts +184 -31
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- 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 +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/hidden-tools.ts +35 -0
- package/lib/inprocess-reviewer.ts +96 -12
- 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 +79 -4
- 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/shell-prompt.ts +16 -3
- package/lib/shell-usage.ts +10 -0
- 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 +2 -2
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +37 -0
- package/runtime/gentle-shell-bundled.mjs +100 -9
- package/runtime/native-review-cli.mjs +79 -4
- package/runtime/review-integration-v2.mjs +56 -3
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +4 -0
- package/scripts/build-runtime-modules.mjs +1 -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 +40 -19
- 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/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 +10 -2
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-question.test.ts +2 -1
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/bounded-stop-contract.test.ts +9 -1
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bundled-install.test.ts +1 -1
- 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/delegate-for-reason-contract.test.ts +30 -8
- 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 +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/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 +20 -29
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/full-delegation-closure.test.ts +29 -0
- package/tests/gentle-agents.test.ts +329 -4
- 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 +121 -6
- package/tests/gentle-design.test.ts +365 -1
- package/tests/gentle-shell-bundled.test.ts +91 -5
- package/tests/gentle-shell-launcher.test.ts +1 -1
- package/tests/gentle-shell.test.ts +118 -87
- package/tests/gentle-todo.test.ts +32 -9
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/independent-recovery-delivery.test.ts +19 -5
- 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 +158 -0
- package/tests/maintainer/desktop-rpc.maintest.ts +632 -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 +11 -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 +11 -3
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-contract.test.ts +80 -28
- package/tests/orchestrator-budget.test.ts +30 -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 +11 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +221 -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 +11 -10
- 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-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/provider-defect-handoff.test.ts +9 -2
- 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 +1 -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 +26 -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/session-profile-extension.test.ts +2 -2
- package/tests/shell-prompt.test.ts +17 -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 +929 -306
- package/tests/support/design-canvas-dom.ts +369 -0
- package/tests/support/review-coordinator-runtime.ts +212 -17
- package/tests/task-size-routing-contract.test.ts +42 -11
- 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-preparation.test.ts +229 -0
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +87 -11
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/work-continuity-contract.test.ts +54 -11
- 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/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.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
|
@@ -25,7 +25,7 @@ const ids = (inventory: object) => planPreflight(inventory).actions.map((action:
|
|
|
25
25
|
|
|
26
26
|
test("requirements follow repository metadata and native installer pin", () => {
|
|
27
27
|
const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
28
|
-
assert.equal(requirements.node, pkg.engines.node
|
|
28
|
+
assert.equal(requirements.node, pkg.engines.node);
|
|
29
29
|
assert.equal(requirements.pi, pkg.peerDependencies["@earendil-works/pi-coding-agent"].slice(2));
|
|
30
30
|
assert.equal(requirements.pnpm, pkg.packageManager.split("@")[1]);
|
|
31
31
|
assert.equal(requirements.shell, pkg.version);
|
|
@@ -515,6 +515,19 @@ test("a bootstrap-only Node next to a persistent pnpm persists Node and npm only
|
|
|
515
515
|
// An older Node or an incompatible pnpm on the user's PATH: the bootstrap's
|
|
516
516
|
// pinned copy runs the installer (the probe's version) and the probe reports
|
|
517
517
|
// the user's version as `found`. That copy is persisted; the user's stays.
|
|
518
|
+
test("Node follows the supported range: 22.19 or a later 22.x, or 23.6 and newer", () => {
|
|
519
|
+
for (const version of ["21.99.99", "22.18.9", "23.0.0", "23.3.0", "23.5.9"]) {
|
|
520
|
+
const plan = planPreflight({ ...installed(), node: tool(version) });
|
|
521
|
+
assert.equal(plan.tools.node.status, "incompatible", version);
|
|
522
|
+
assert.deepEqual(plan.blockers, [{ code: "incompatible-tool", tool: "node" }], version);
|
|
523
|
+
assert.deepEqual(plan.actions, [], version);
|
|
524
|
+
}
|
|
525
|
+
for (const version of ["22.19.0", "22.99.99", "23.6.0", "24.22.2", "25.0.0"]) {
|
|
526
|
+
const plan = planPreflight({ ...installed(), node: tool(version) });
|
|
527
|
+
assert.deepEqual(plan.tools.node, { status: "reusable", required: "^22.19.0 || >=23.6.0" }, version);
|
|
528
|
+
assert.deepEqual(plan.blockers, [], version);
|
|
529
|
+
}
|
|
530
|
+
});
|
|
518
531
|
const runtimeStack = (node: object, pnpm: object) => ({ ...clean(), node, pnpm,
|
|
519
532
|
globalBin: { available: true, path: "/disposable/bin", writable: true, onPath: true } });
|
|
520
533
|
const pinnedNode = (found?: string) => ({ ...tool("24.21.0"), persistent: false, npm: false, ...(found ? { found } : {}) });
|
|
@@ -529,6 +542,41 @@ test("an older Node is left as it is: the pinned Node is persisted alongside ins
|
|
|
529
542
|
assert.deepEqual(updateIds(plan), ["persist-node", "persist-npm", "configure-npm-prefix", ...rest]);
|
|
530
543
|
assert.deepEqual(updateIds(planPreflight(runtimeStack(pinnedNode("22.18.0"), pinnedPnpm()))), ["persist-node", "persist-package-managers", "configure-npm-prefix", ...rest]);
|
|
531
544
|
});
|
|
545
|
+
test("a Node 23 below 23.6 is left as it is, and a supported 22.x or 23.6 found Node is not replaced", () => {
|
|
546
|
+
for (const found of ["23.0.0", "23.5.9"]) {
|
|
547
|
+
assert.deepEqual(planPreflight(runtimeStack(pinnedNode(found), { ...pinnedPnpm(), persistent: true })).tools.node,
|
|
548
|
+
{ status: "reusable", required: requirements.node, found, version: "24.21.0" }, found);
|
|
549
|
+
}
|
|
550
|
+
for (const found of ["22.19.0", "23.6.0"]) {
|
|
551
|
+
assert.deepEqual(planPreflight(runtimeStack(pinnedNode(found), { ...pinnedPnpm(), persistent: true })).tools.node,
|
|
552
|
+
{ status: "reusable", required: requirements.node }, found);
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
test("preflight carries a different global-bin Node only when it persists Node", () => {
|
|
557
|
+
const pnpm = pinnedPnpm();
|
|
558
|
+
for (const found of ["23.5.9", undefined]) {
|
|
559
|
+
const node = { ...pinnedNode(found), globalBinNode: true };
|
|
560
|
+
const input = runtimeStack(node, pnpm);
|
|
561
|
+
const before = structuredClone(input);
|
|
562
|
+
const plan = planPreflight(input);
|
|
563
|
+
const original = planPreflight(runtimeStack(pinnedNode(found), pnpm));
|
|
564
|
+
assert.deepEqual(plan.tools.node, { ...original.tools.node, globalBinNode: true });
|
|
565
|
+
assert.deepEqual(plan.actions, original.actions);
|
|
566
|
+
assert.deepEqual(plan.blockers, original.blockers);
|
|
567
|
+
assert.deepEqual(input, before);
|
|
568
|
+
}
|
|
569
|
+
const supported = { ...tool("23.6.0"), persistent: true, npm: true, globalBinNode: true };
|
|
570
|
+
assert.deepEqual(planPreflight(runtimeStack(supported, pnpm)).tools.node, { status: "reusable", required: requirements.node });
|
|
571
|
+
// Recovery, updates and blockers do not persist Node and must not change their plans.
|
|
572
|
+
for (const inventory of [partial({ node: pinnedNode("23.5.9") }),
|
|
573
|
+
{ ...installed(), node: pinnedNode(), shell: owned("3.9.0"), gentleAi: unchecked, setup: unchecked },
|
|
574
|
+
{ ...installed(), node: pinnedNode("23.5.9"), shell: owned("3.9.0"), gentleAi: unchecked, setup: unchecked }]) {
|
|
575
|
+
const original = planPreflight(inventory);
|
|
576
|
+
assert.equal(original.actions.some((action: { id: string }) => action.id === "persist-node"), false);
|
|
577
|
+
assert.deepEqual(planPreflight({ ...inventory, node: { ...inventory.node, globalBinNode: true } }), original);
|
|
578
|
+
}
|
|
579
|
+
});
|
|
532
580
|
|
|
533
581
|
test("an incompatible pnpm is left as it is: the pinned pnpm is persisted alongside instead of blocking", () => {
|
|
534
582
|
for (const found of ["10.27.0", "12.0.0", "11.0.0"]) {
|
|
@@ -202,6 +202,7 @@ test("an older Node on the user's PATH is left as it is: the bootstrap's Node is
|
|
|
202
202
|
assert.equal(node.version, "24.21.0");
|
|
203
203
|
assert.equal(node.persistent, false);
|
|
204
204
|
assert.equal(node.found, "22.18.0");
|
|
205
|
+
assert.equal(node.foundInGlobalBin, undefined);
|
|
205
206
|
// A current user Node is reused as before, and an older one without a bootstrap copy is reported as it is.
|
|
206
207
|
const current = probes({ files: [...userNode.files, ...bootstrapNode.files], realpaths: userNode.realpaths, texts: userNode.texts,
|
|
207
208
|
results: { ...userNode.results, [`${TOOLS_NODE} --version`]: { code: 0, stdout: "v24.21.0\n" } } });
|
|
@@ -214,6 +215,151 @@ test("an older Node on the user's PATH is left as it is: the bootstrap's Node is
|
|
|
214
215
|
assert.equal((await stale.probes.node()).found, undefined);
|
|
215
216
|
});
|
|
216
217
|
|
|
218
|
+
test("a user Node 23 below 23.6 is swapped for the bootstrap's Node; 22.19 and 23.6 are reused", async () => {
|
|
219
|
+
const withUser = (version: string) => probes({ files: [...userNode.files, ...bootstrapNode.files], realpaths: { ...userNode.realpaths, ...bootstrapNode.realpaths },
|
|
220
|
+
texts: { ...userNode.texts, ...bootstrapNode.texts }, results: { ...userNode.results, [`${USER_NODE} --version`]: { code: 0, stdout: `v${version}\n` },
|
|
221
|
+
[`${TOOLS_NODE} --version`]: { code: 0, stdout: "v24.21.0\n" }, [`${TOOLS_NODE} ${USER_NPM_CLI} --version`]: { code: 0, stdout: "10.9.2\n" } } });
|
|
222
|
+
for (const version of ["23.0.0", "23.5.9"]) {
|
|
223
|
+
const node = await withUser(version).probes.node();
|
|
224
|
+
assert.equal(node.version, "24.21.0", version);
|
|
225
|
+
assert.equal(node.found, version);
|
|
226
|
+
}
|
|
227
|
+
for (const version of ["22.19.0", "23.6.0"]) {
|
|
228
|
+
const node = await withUser(version).probes.node();
|
|
229
|
+
assert.equal(node.version, version);
|
|
230
|
+
assert.equal(node.persistent, true, version);
|
|
231
|
+
assert.equal(node.found, undefined, version);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
test("the swapped Node records when the found executable is in pnpm's global bin on POSIX and Windows", async () => {
|
|
236
|
+
const cases = [
|
|
237
|
+
{ platform: "linux", env: { HOME, PNPM_HOME, PATH: `${TOOLS}/node/bin:${BIN}:/usr/bin` },
|
|
238
|
+
own: `${BIN}/node`, bootstrap: TOOLS_NODE },
|
|
239
|
+
{ platform: "win32", env: { LOCALAPPDATA: "C:\\Users\\u\\AppData\\Local", PNPM_HOME: "C:\\Users\\u\\pnpm",
|
|
240
|
+
Path: "C:\\Users\\u\\.gentle-shell-bootstrap-tools.1\\node;c:\\users\\U\\PNPM\\bin", PATHEXT: ".EXE" },
|
|
241
|
+
own: "c:\\users\\U\\PNPM\\bin\\node.exe", bootstrap: "C:\\Users\\u\\.gentle-shell-bootstrap-tools.1\\node\\node.exe" },
|
|
242
|
+
];
|
|
243
|
+
for (const { platform, env, own, bootstrap } of cases) {
|
|
244
|
+
for (const version of ["23.5.9", "22.18.0"]) {
|
|
245
|
+
const h = probes({ platform, env, files: [own, bootstrap], results: {
|
|
246
|
+
[`${own} --version`]: { code: 0, stdout: `v${version}\n` },
|
|
247
|
+
[`${bootstrap} --version`]: { code: 0, stdout: "v24.21.0\n" },
|
|
248
|
+
} });
|
|
249
|
+
const node = await h.probes.node();
|
|
250
|
+
assert.equal(node.found, version, platform);
|
|
251
|
+
assert.equal(node.foundInGlobalBin, true, platform);
|
|
252
|
+
}
|
|
253
|
+
const supported = probes({ platform, env, files: [own, bootstrap], results: {
|
|
254
|
+
[`${own} --version`]: { code: 0, stdout: "v23.6.0\n" },
|
|
255
|
+
[`${bootstrap} --version`]: { code: 0, stdout: "v24.21.0\n" },
|
|
256
|
+
} });
|
|
257
|
+
assert.deepEqual(await supported.probes.node(), { available: true, version: "23.6.0", usable: true, persistent: true, npm: false }, platform);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
for (const platform of ["linux", "win32"]) {
|
|
262
|
+
test(`${platform}: a swapped PATH Node records a different Node at the global-bin destination`, async () => {
|
|
263
|
+
const windows = platform === "win32";
|
|
264
|
+
const bin = windows ? "C:\\Users\\u\\pnpm\\bin" : BIN;
|
|
265
|
+
const bootstrap = windows ? "C:\\Users\\u\\.gentle-shell-bootstrap-tools.1\\node\\node.exe" : TOOLS_NODE;
|
|
266
|
+
const own = windows ? "C:\\System\\node.exe" : USER_NODE;
|
|
267
|
+
const destination = windows ? `${bin}\\node.exe` : `${bin}/node`;
|
|
268
|
+
const env = windows
|
|
269
|
+
? { PNPM_HOME: "C:\\Users\\u\\pnpm", Path: `C:\\Users\\u\\.gentle-shell-bootstrap-tools.1\\node;C:\\System;${bin}`, PATHEXT: ".CMD;.COM;.EXE;.BAT" }
|
|
270
|
+
: { HOME, PNPM_HOME, PATH: `${TOOLS}/node/bin:/usr/bin:${bin}` };
|
|
271
|
+
const h = probes({ platform, env, files: [own, bootstrap, destination, ...(windows ? [`${bin}\\node.cmd`] : [])], results: {
|
|
272
|
+
[`${own} --version`]: { code: 0, stdout: "v23.5.9\n" },
|
|
273
|
+
[`${bootstrap} --version`]: { code: 0, stdout: "v24.21.0\n" },
|
|
274
|
+
} });
|
|
275
|
+
assert.deepEqual(await h.probes.node(), { available: true, version: "24.21.0", usable: true, persistent: false, npm: false,
|
|
276
|
+
found: "23.5.9", globalBinNode: true });
|
|
277
|
+
assert.deepEqual(h.unexpected, []);
|
|
278
|
+
assert.equal(h.calls.some((call) => call.command === destination), false);
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
test("a destination Node is recorded without reading its version", async () => {
|
|
283
|
+
for (const result of [{ code: 1 }, { code: 0, timedOut: true, stdout: "v20.19.0" },
|
|
284
|
+
{ code: 0, truncated: true, stdout: "v20.19.0" }, { code: 0, stdout: "v20.19.0-rc.1" }, () => { throw new Error("unreadable"); }]) {
|
|
285
|
+
const destination = `${BIN}/node`;
|
|
286
|
+
const h = probes({ env: { HOME, PNPM_HOME, PATH: `${TOOLS}/node/bin:/usr/bin:${BIN}` }, files: [USER_NODE, TOOLS_NODE, destination], results: {
|
|
287
|
+
[`${USER_NODE} --version`]: { code: 0, stdout: "v23.5.9\n" },
|
|
288
|
+
[`${TOOLS_NODE} --version`]: { code: 0, stdout: "v24.21.0\n" }, [`${destination} --version`]: result,
|
|
289
|
+
} });
|
|
290
|
+
assert.deepEqual(await h.probes.node(), { available: true, version: "24.21.0", usable: true, persistent: false, npm: false,
|
|
291
|
+
found: "23.5.9", globalBinNode: true });
|
|
292
|
+
assert.equal(h.calls.some((call) => call.command === destination), false);
|
|
293
|
+
assert.deepEqual(h.unexpected, []);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
test("Windows neither runs nor walks a destination Node", async () => {
|
|
298
|
+
const bin = "C:\\Users\\u\\pnpm\\bin";
|
|
299
|
+
const own = "C:\\System\\node.exe";
|
|
300
|
+
const bootstrap = "C:\\Users\\u\\.gentle-shell-bootstrap-tools.1\\node\\node.exe";
|
|
301
|
+
const destination = `${bin}\\node.exe`;
|
|
302
|
+
const walked: string[] = [];
|
|
303
|
+
const h = probes({ platform: "win32", env: { PNPM_HOME: "C:\\Users\\u\\pnpm",
|
|
304
|
+
Path: `C:\\Users\\u\\.gentle-shell-bootstrap-tools.1\\node;C:\\System;${bin}`, PATHEXT: ".EXE" },
|
|
305
|
+
files: [own, bootstrap, destination], storage: (file) => { walked.push(file); throw new Error("untrusted"); }, results: {
|
|
306
|
+
[`${own} --version`]: { code: 0, stdout: "v23.5.9\n" },
|
|
307
|
+
[`${bootstrap} --version`]: { code: 0, stdout: "v24.21.0\n" },
|
|
308
|
+
} });
|
|
309
|
+
assert.deepEqual(await h.probes.node(), { available: true, version: "24.21.0", usable: true, persistent: false, npm: false,
|
|
310
|
+
found: "23.5.9", globalBinNode: true });
|
|
311
|
+
assert.deepEqual(walked, []);
|
|
312
|
+
assert.equal(h.calls.some((call) => call.command === destination), false);
|
|
313
|
+
assert.deepEqual(h.unexpected, []);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
test("a bootstrap-only Node records a global-bin destination even when that bin is not on PATH", async () => {
|
|
317
|
+
const destination = `${BIN}/node`;
|
|
318
|
+
const h = probes({ env: { HOME, PNPM_HOME, PATH: `${TOOLS}/node/bin:/usr/bin` }, files: [TOOLS_NODE, destination], results: {
|
|
319
|
+
[`${TOOLS_NODE} --version`]: { code: 0, stdout: "v24.21.0\n" },
|
|
320
|
+
} });
|
|
321
|
+
assert.deepEqual(await h.probes.node(), { available: true, version: "24.21.0", usable: true, persistent: false, npm: false,
|
|
322
|
+
globalBinNode: true });
|
|
323
|
+
assert.equal(h.calls.some((call) => call.command === destination), false);
|
|
324
|
+
assert.deepEqual(h.unexpected, []);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
test("a supported PATH Node is reused without probing another Node at the destination", async () => {
|
|
328
|
+
const destination = `${BIN}/node`;
|
|
329
|
+
const h = probes({ env: { HOME, PNPM_HOME, PATH: `${TOOLS}/node/bin:/usr/bin:${BIN}` }, files: [USER_NODE, TOOLS_NODE, destination],
|
|
330
|
+
results: { [`${USER_NODE} --version`]: { code: 0, stdout: "v23.6.0\n" } } });
|
|
331
|
+
assert.deepEqual(await h.probes.node(), { available: true, version: "23.6.0", usable: true, persistent: true, npm: false });
|
|
332
|
+
assert.equal(h.calls.some((call) => call.command === destination), false);
|
|
333
|
+
assert.deepEqual(h.unexpected, []);
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
test("a swapped Node reached through a directory alias keeps its pnpm global-bin provenance", async () => {
|
|
337
|
+
const windowsBin = "C:\\Users\\u\\pnpm\\bin";
|
|
338
|
+
const cases = [
|
|
339
|
+
{ platform: "linux", bin: BIN, alias: `${HOME}/pnpm-link/bin`, bootstrap: TOOLS_NODE,
|
|
340
|
+
env: { HOME, PNPM_HOME, PATH: `${TOOLS}/node/bin:${HOME}/pnpm-link/bin:/usr/bin` },
|
|
341
|
+
realBin: BIN, realAlias: BIN, separator: "/" },
|
|
342
|
+
{ platform: "win32", bin: windowsBin, alias: "C:\\Users\\u\\pnpm-link\\bin",
|
|
343
|
+
bootstrap: "C:\\Users\\u\\.gentle-shell-bootstrap-tools.1\\node\\node.exe",
|
|
344
|
+
env: { PNPM_HOME: "C:\\Users\\u\\pnpm", Path: "C:\\Users\\u\\.gentle-shell-bootstrap-tools.1\\node;C:\\Users\\u\\pnpm-link\\bin", PATHEXT: ".EXE" },
|
|
345
|
+
realBin: "C:\\Users\\u\\pnpm\\bin", realAlias: "c:\\users\\U\\PNPM\\BIN", separator: "\\" },
|
|
346
|
+
];
|
|
347
|
+
for (const { platform, bin, alias, bootstrap, env, realBin, realAlias, separator } of cases) {
|
|
348
|
+
const own = `${alias}${separator}node${platform === "win32" ? ".exe" : ""}`;
|
|
349
|
+
for (const version of ["23.5.9", "22.18.0"]) {
|
|
350
|
+
const destination = `${bin}${separator}node${platform === "win32" ? ".exe" : ""}`;
|
|
351
|
+
const h = probes({ platform, env, files: [own, bootstrap, destination], dirs: [alias, bin], realpaths: {
|
|
352
|
+
[alias]: realAlias, [bin]: realBin, [own]: `${bin}${separator}..${separator}runtime${separator}node`,
|
|
353
|
+
}, results: {
|
|
354
|
+
[`${own} --version`]: { code: 0, stdout: `v${version}\n` },
|
|
355
|
+
[`${bootstrap} --version`]: { code: 0, stdout: "v24.21.0\n" },
|
|
356
|
+
} });
|
|
357
|
+
assert.deepEqual(await h.probes.node(), { available: true, version: "24.21.0", usable: true, persistent: false,
|
|
358
|
+
npm: false, found: version, foundInGlobalBin: true }, `${platform} ${version}`);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
|
|
217
363
|
test("node absent, unparseable, failing, timed out or truncated", async () => {
|
|
218
364
|
assert.deepEqual(await probes({ env: { HOME, PATH: "/usr/bin" } }).probes.node(), { available: false });
|
|
219
365
|
for (const result of [{ code: 0, stdout: "v24\n" }, { code: 0, stdout: "v24.18.0-nightly\n" }, { code: 1, stdout: "v24.18.0" },
|
|
@@ -9,7 +9,8 @@ import { join } from "node:path";
|
|
|
9
9
|
import test from "node:test";
|
|
10
10
|
import { exitCodeFor, openBrowser, openerFor, redirectPage, runnerEnvironment, upgradeEnvironment, wizardHandlers, writeRedirect } from "../bin/gentle-shell-install.mjs";
|
|
11
11
|
import { planPreflight, requirements } from "../scripts/installer-preflight.mjs";
|
|
12
|
-
import { PI_INSTALL_VERSION, blockedReasons, failedSteps } from "../scripts/installer-runner.mjs";
|
|
12
|
+
import { PI_INSTALL_VERSION, blockedReasons, failedSteps, runStandardInstall } from "../scripts/installer-runner.mjs";
|
|
13
|
+
import { createProbes } from "../scripts/installer-probes.mjs";
|
|
13
14
|
import { createInstallerServer, guidance } from "../scripts/installer-server.mjs";
|
|
14
15
|
import { distributionAsset, prefixLayout } from "../scripts/bundled-install.mjs";
|
|
15
16
|
import { bundledBlockedReasons, bundledFailedSteps, bundledPlan } from "../scripts/bundled-wizard.mjs";
|
|
@@ -306,8 +307,8 @@ test("/api/plan names the found and required version of an older Gentle Shell an
|
|
|
306
307
|
const view = await plan(port, await login());
|
|
307
308
|
assert.deepEqual(view.blockers.map((blocker: { code: string; tool: string }) => [blocker.code, blocker.tool]), [["incompatible-tool", "shell"]]);
|
|
308
309
|
assert.equal(view.blockers[0].guidance,
|
|
309
|
-
"Gentle Shell 3.4.0 is installed globally with pnpm, but this installer needs 4.
|
|
310
|
-
"Update it with `pnpm add -g gentle-pi@4.
|
|
310
|
+
"Gentle Shell 3.4.0 is installed globally with pnpm, but this installer needs 4.8.0 or newer. Nothing was replaced. " +
|
|
311
|
+
"Update it with `pnpm add -g gentle-pi@4.8.0`, or remove it with `pnpm remove -g gentle-pi`, then select Check again.");
|
|
311
312
|
assert.deepEqual(view.actions, []);
|
|
312
313
|
} finally {
|
|
313
314
|
await host.close("test");
|
|
@@ -356,7 +357,7 @@ test("/api/plan says, before consent, that an older Node and an incompatible pnp
|
|
|
356
357
|
assert.deepEqual(view.blockers, []);
|
|
357
358
|
assert.deepEqual(view.persistence.tools, ["node", "npm", "pnpm"]);
|
|
358
359
|
const text = view.persistence.description;
|
|
359
|
-
assert.ok(text.includes(
|
|
360
|
+
assert.ok(text.includes("Node.js 22.18.0 on this computer is not a version Gentle Shell supports (it needs 22.19.0 or a later 22.x release, or 23.6.0 or newer), so the installer uses its pinned Node.js 24.21.0 " +
|
|
360
361
|
"and installs it under $PNPM_HOME. Your Node.js 22.18.0 is left unchanged."), text);
|
|
361
362
|
assert.ok(text.includes(`pnpm 10.27.0 on this computer is not a pnpm ${requirements.pnpm.split(".")[0]} release this installer can use, ` +
|
|
362
363
|
`so the installer uses its pinned pnpm ${requirements.pnpm} and installs it under $PNPM_HOME. Your pnpm 10.27.0 is left unchanged.`), text);
|
|
@@ -375,6 +376,169 @@ test("/api/plan says, before consent, that an older Node and an incompatible pnp
|
|
|
375
376
|
}
|
|
376
377
|
});
|
|
377
378
|
|
|
379
|
+
test("a pnpm-managed unsupported Node is disclosed as replaced from probe through plan, consent and runner", async () => {
|
|
380
|
+
const home = "/home/u/.local/share/pnpm";
|
|
381
|
+
const bootstrap = "/home/u/.gentle-shell-bootstrap-tools.fixture/node/bin/node";
|
|
382
|
+
const pnpmEntry = "/tools/pnpm/bin/pnpm.mjs";
|
|
383
|
+
const env = { HOME: "/home/u", PNPM_HOME: home, PATH: `${bootstrap.slice(0, -5)}:${BIN}:/usr/bin`,
|
|
384
|
+
GENTLE_INSTALL_PNPM_NODE: bootstrap, GENTLE_INSTALL_PNPM_ENTRY: pnpmEntry };
|
|
385
|
+
const nodeFor = async (version: string, own: string) => {
|
|
386
|
+
const probeEnv = { ...env, PATH: `${bootstrap.slice(0, -5)}:${own.slice(0, -5)}:/usr/bin` };
|
|
387
|
+
const fs = { isFile: async (file: string) => [bootstrap, own].includes(file),
|
|
388
|
+
isDirectory: async () => false, exists: async () => false, realpath: async (file: string) => file,
|
|
389
|
+
readText: async () => "", writable: async () => false };
|
|
390
|
+
return createProbes({ platform: "linux", env: probeEnv, fs,
|
|
391
|
+
run: async (command: string) => ({ code: 0, stdout: command === own ? `v${version}\n` : "v24.21.0\n" }) }).node();
|
|
392
|
+
};
|
|
393
|
+
for (const [version, own, managed] of [["23.5.9", `${BIN}/node`, true], ["22.18.0", `${BIN}/node`, true],
|
|
394
|
+
["23.5.9", "/usr/bin/node", false]] as const) {
|
|
395
|
+
const node = await nodeFor(version, own);
|
|
396
|
+
const data = collected({ node });
|
|
397
|
+
assert.deepEqual(data.plan.blockers, []);
|
|
398
|
+
assert.deepEqual(data.plan.actions.find((action: { id: string }) => action.id === "persist-node"),
|
|
399
|
+
{ id: "persist-node", kind: "persist-runtime", target: "node", version: "24.21.0" });
|
|
400
|
+
const { host, port, login } = await start({ collect: async () => data });
|
|
401
|
+
try {
|
|
402
|
+
const view = await plan(port, await login());
|
|
403
|
+
const text = view.persistence.description;
|
|
404
|
+
if (managed) {
|
|
405
|
+
assert.equal(view.persistence.replacesNode, true);
|
|
406
|
+
assert.equal(text, `node, npm, pnpm will be installed under $PNPM_HOME (${home}) so new terminals keep working after the temporary installer tools are removed. ` +
|
|
407
|
+
`Node.js ${version} on this computer is not a version Gentle Shell supports (it needs 22.19.0 or a later 22.x release, or 23.6.0 or newer). ` +
|
|
408
|
+
`Your Node.js ${version} is managed by pnpm under $PNPM_HOME and will be replaced by the pinned Node.js 24.21.0. ` +
|
|
409
|
+
"A version manager such as `mise activate` may still put your own versions first on PATH in new terminals.");
|
|
410
|
+
assert.doesNotMatch(text, /left unchanged|Existing installations are not replaced/);
|
|
411
|
+
} else {
|
|
412
|
+
assert.equal(text, `node, npm, pnpm will be installed under $PNPM_HOME (${home}) so new terminals keep working after the temporary installer tools are removed. Existing installations are not replaced. ` +
|
|
413
|
+
`Node.js ${version} on this computer is not a version Gentle Shell supports (it needs 22.19.0 or a later 22.x release, or 23.6.0 or newer), so the installer uses its pinned Node.js 24.21.0 ` +
|
|
414
|
+
`and installs it under $PNPM_HOME. Your Node.js ${version} is left unchanged. A version manager such as \`mise activate\` may still put your own versions first on PATH in new terminals.`);
|
|
415
|
+
}
|
|
416
|
+
} finally { await host.close("test"); }
|
|
417
|
+
if (!managed || version !== "23.5.9") continue;
|
|
418
|
+
const calls: string[][] = [];
|
|
419
|
+
const result = await runStandardInstall({ plan: data.plan, consent: true }, { platform: "linux", env, nodePath: bootstrap,
|
|
420
|
+
fs: { isFile: async () => false }, run: async (_command: string, args: string[]) => {
|
|
421
|
+
calls.push(args);
|
|
422
|
+
const operation = args.slice(1).join(" ");
|
|
423
|
+
if (operation === "bin -g") return { code: 0, stdout: `${BIN}\n` };
|
|
424
|
+
if (operation === "list -g --depth 0 --json") return { code: 0, stdout: "[]" };
|
|
425
|
+
if (operation.startsWith("view ")) return { code: 0, stdout: `${PI_INSTALL_VERSION}\n` };
|
|
426
|
+
return { code: 1, stdout: "" }; // Stop after observing the runtime command.
|
|
427
|
+
} });
|
|
428
|
+
assert.equal(result.failedStep, "persist-node");
|
|
429
|
+
assert.deepEqual(calls.at(-1), [pnpmEntry, "runtime", "set", "node", "24.21.0", "-g"]);
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
test("a separate global-bin Node is disclosed from probe through plan, consent and runner", async () => {
|
|
434
|
+
const home = "/home/u/.local/share/pnpm";
|
|
435
|
+
const bootstrap = "/home/u/.gentle-shell-bootstrap-tools.fixture/node/bin/node";
|
|
436
|
+
const own = "/usr/bin/node";
|
|
437
|
+
const destination = `${BIN}/node`;
|
|
438
|
+
const pnpmEntry = "/tools/pnpm/bin/pnpm.mjs";
|
|
439
|
+
const env = { HOME: "/home/u", PNPM_HOME: home, PATH: `${bootstrap.slice(0, -5)}:/usr/bin:${BIN}`,
|
|
440
|
+
GENTLE_INSTALL_PNPM_NODE: bootstrap, GENTLE_INSTALL_PNPM_ENTRY: pnpmEntry };
|
|
441
|
+
const fs = { isFile: async (file: string) => [bootstrap, own, destination].includes(file),
|
|
442
|
+
isDirectory: async () => false, exists: async () => false, realpath: async (file: string) => file,
|
|
443
|
+
readText: async () => "", writable: async () => false };
|
|
444
|
+
const node = await createProbes({ platform: "linux", env, fs, run: async (command: string) => ({ code: 0,
|
|
445
|
+
stdout: command === own ? "v23.5.9\n" : "v24.21.0\n" }) }).node();
|
|
446
|
+
const data = collected({ node });
|
|
447
|
+
assert.deepEqual(data.plan.blockers, []);
|
|
448
|
+
assert.deepEqual(data.plan.actions.find((action: { id: string }) => action.id === "persist-node"),
|
|
449
|
+
{ id: "persist-node", kind: "persist-runtime", target: "node", version: "24.21.0" });
|
|
450
|
+
const { host, port, login } = await start({ collect: async () => data });
|
|
451
|
+
try {
|
|
452
|
+
const view = await plan(port, await login());
|
|
453
|
+
const calls: string[][] = [];
|
|
454
|
+
const result = await runStandardInstall({ plan: data.plan, consent: true }, { platform: "linux", env, nodePath: bootstrap,
|
|
455
|
+
fs: { isFile: async () => false }, run: async (_command: string, args: string[]) => {
|
|
456
|
+
calls.push(args);
|
|
457
|
+
const operation = args.slice(1).join(" ");
|
|
458
|
+
if (operation === "bin -g") return { code: 0, stdout: `${BIN}\n` };
|
|
459
|
+
if (operation === "list -g --depth 0 --json") return { code: 0, stdout: "[]" };
|
|
460
|
+
if (operation.startsWith("view ")) return { code: 0, stdout: `${PI_INSTALL_VERSION}\n` };
|
|
461
|
+
return { code: 1, stdout: "" };
|
|
462
|
+
} });
|
|
463
|
+
assert.equal(result.failedStep, "persist-node");
|
|
464
|
+
assert.deepEqual(calls.at(-1), [pnpmEntry, "runtime", "set", "node", "24.21.0", "-g"]);
|
|
465
|
+
assert.equal(view.persistence.description, `node, npm, pnpm will be installed under $PNPM_HOME (${home}) so new terminals keep working after the temporary installer tools are removed. ` +
|
|
466
|
+
"Node.js 23.5.9 on this computer is not a version Gentle Shell supports (it needs 22.19.0 or a later 22.x release, or 23.6.0 or newer), so the installer uses its pinned Node.js 24.21.0 " +
|
|
467
|
+
"and installs it under $PNPM_HOME. Your Node.js 23.5.9 found first on PATH is left unchanged. " +
|
|
468
|
+
"The Node.js already in $PNPM_HOME will be replaced by the pinned Node.js 24.21.0. " +
|
|
469
|
+
"A version manager such as `mise activate` may still put your own versions first on PATH in new terminals.");
|
|
470
|
+
assert.doesNotMatch(view.persistence.description, /Existing installations are not replaced/);
|
|
471
|
+
assert.equal(view.persistence.replacesNode, true);
|
|
472
|
+
assert.equal(data.plan.tools.node.globalBinNode, true);
|
|
473
|
+
} finally { await host.close("test"); }
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
test("/api/plan discloses an unchecked destination Node even without a Node on PATH", async () => {
|
|
477
|
+
const node = { available: true, version: "24.21.0", usable: true, persistent: false, npm: false, globalBinNode: true };
|
|
478
|
+
const { host, port, login } = await start({ collect: async () => collected({ node }) });
|
|
479
|
+
try {
|
|
480
|
+
const view = await plan(port, await login());
|
|
481
|
+
assert.equal(view.persistence.description, `node, npm, pnpm will be installed under $PNPM_HOME (/home/u/.local/share/pnpm) so new terminals keep working after the temporary installer tools are removed. ` +
|
|
482
|
+
"The Node.js already in $PNPM_HOME will be replaced by the pinned Node.js 24.21.0.");
|
|
483
|
+
assert.doesNotMatch(view.persistence.description, /Existing installations are not replaced/);
|
|
484
|
+
assert.equal(view.persistence.replacesNode, true);
|
|
485
|
+
} finally { await host.close("test"); }
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
test("a setup recovery does not describe a destination Node as replaced without persist-node", async () => {
|
|
489
|
+
const node = { available: true, version: "24.21.0", usable: true, persistent: false, npm: false,
|
|
490
|
+
found: "23.5.9", globalBinNode: true };
|
|
491
|
+
const data = collected({ node, pi: { available: true, version: "1.2.0", usable: true },
|
|
492
|
+
shell: { available: true, version: requirements.shell, usable: true, global: true },
|
|
493
|
+
gentleAi: { available: true, version: requirements.gentleAi, usable: true, compatible: true },
|
|
494
|
+
setup: { available: true, recoverable: true } });
|
|
495
|
+
const { host, port, login } = await start({ collect: async () => data });
|
|
496
|
+
try {
|
|
497
|
+
const view = await plan(port, await login());
|
|
498
|
+
assert.deepEqual(view.blockers, []);
|
|
499
|
+
assert.equal(view.actions.some((action: { id: string }) => action.id === "persist-node"), false);
|
|
500
|
+
assert.equal(view.persistence.replacesNode, undefined);
|
|
501
|
+
assert.equal(view.persistence.description, "No runtime needs to be installed under $PNPM_HOME; your existing Node.js, npm and pnpm are reused.");
|
|
502
|
+
} finally { await host.close("test"); }
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
test("destination changes do not stale a plan without persist-node", async () => {
|
|
506
|
+
const node = { available: true, version: "24.21.0", usable: true, persistent: false, npm: false, found: "23.5.9" };
|
|
507
|
+
const recovery = { pi: { available: true, version: "1.2.0", usable: true },
|
|
508
|
+
shell: { available: true, version: requirements.shell, usable: true, global: true },
|
|
509
|
+
gentleAi: { available: true, version: requirements.gentleAi, usable: true, compatible: true },
|
|
510
|
+
setup: { available: true, recoverable: true } };
|
|
511
|
+
let current = collected({ ...recovery, node });
|
|
512
|
+
const consented = current.plan;
|
|
513
|
+
const { host, port, login, runs } = await start({ collect: async () => current });
|
|
514
|
+
try {
|
|
515
|
+
const cookie = await login();
|
|
516
|
+
const view = await plan(port, cookie);
|
|
517
|
+
assert.equal(view.actions.some((action: { id: string }) => action.id === "persist-node"), false);
|
|
518
|
+
current = collected({ ...recovery, node: { ...node, globalBinNode: true } });
|
|
519
|
+
const response = await post(port, "/api/install", cookie, { planId: view.planId, consent: true });
|
|
520
|
+
assert.equal(response.status, 202);
|
|
521
|
+
assert.deepEqual(JSON.parse(response.body), { started: true });
|
|
522
|
+
assert.equal(runs.length, 1);
|
|
523
|
+
assert.deepEqual(runs[0].request, { plan: consented, consent: true });
|
|
524
|
+
} finally { await host.close("test"); }
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
test("a changed destination Node invalidates the reviewed plan before the runner starts", async () => {
|
|
528
|
+
const node = { available: true, version: "24.21.0", usable: true, persistent: false, npm: false, found: "23.5.9" };
|
|
529
|
+
let current = collected({ node });
|
|
530
|
+
const { host, port, login, runs } = await start({ collect: async () => current });
|
|
531
|
+
try {
|
|
532
|
+
const cookie = await login();
|
|
533
|
+
const { planId } = await plan(port, cookie);
|
|
534
|
+
current = collected({ node: { ...node, globalBinNode: true } });
|
|
535
|
+
const response = await post(port, "/api/install", cookie, { planId, consent: true });
|
|
536
|
+
assert.equal(response.status, 409);
|
|
537
|
+
assert.equal(JSON.parse(response.body).error, "plan-changed");
|
|
538
|
+
assert.deepEqual(runs, []);
|
|
539
|
+
} finally { await host.close("test"); }
|
|
540
|
+
});
|
|
541
|
+
|
|
378
542
|
test("/api/plan says before consent which Go is downloaded, only to build, with the Go found and the system unchanged", async () => {
|
|
379
543
|
for (const [go, found] of [[{ available: true, version: "1.24.0", usable: true }, "Go 1.24.0 on this computer is older than 1.25.10"],
|
|
380
544
|
[{ available: false }, "Go is missing on this computer"]] as const) {
|
|
@@ -1509,6 +1673,41 @@ test("bundled outcomes: every bundled step has guidance, pnpm's error line is sh
|
|
|
1509
1673
|
}
|
|
1510
1674
|
});
|
|
1511
1675
|
|
|
1676
|
+
test("planning never executes a destination Node", { skip: process.platform === "win32" ? "simulated Linux paths need a POSIX filesystem" : false }, async () => {
|
|
1677
|
+
const home = mkdtempSync(join(tmpdir(), "gentle-destination-planning-"));
|
|
1678
|
+
try {
|
|
1679
|
+
const bootstrap = join(home, ".gentle-shell-bootstrap-tools.fixture/node/bin/node");
|
|
1680
|
+
const bin = join(home, "pnpm/bin");
|
|
1681
|
+
const destination = join(bin, "node");
|
|
1682
|
+
const own = "/usr/bin/node";
|
|
1683
|
+
const pnpmEntry = "/tools/pnpm/bin/pnpm.mjs";
|
|
1684
|
+
const env = { HOME: home, PNPM_HOME: join(home, "pnpm"), PATH: `${bootstrap.slice(0, -5)}:/usr/bin:${bin}`, SHELL: "/bin/bash",
|
|
1685
|
+
GENTLE_INSTALL_PNPM_NODE: bootstrap, GENTLE_INSTALL_PNPM_ENTRY: pnpmEntry };
|
|
1686
|
+
const fs = { isFile: async (file: string) => [bootstrap, own, destination].includes(file),
|
|
1687
|
+
isDirectory: async (file: string) => file === home, exists: async (file: string) => file === home,
|
|
1688
|
+
realpath: async (file: string) => file, readText: async () => "", writable: async () => true };
|
|
1689
|
+
const calls: Array<{ command: string; args: string[] }> = [];
|
|
1690
|
+
const run = async (command: string, args: string[]) => {
|
|
1691
|
+
calls.push({ command, args });
|
|
1692
|
+
if (command === own) return { code: 0, stdout: "v23.5.9\n" };
|
|
1693
|
+
if (command === destination) return { code: 0, stdout: "v20.19.0\n" };
|
|
1694
|
+
if (command === bootstrap && args[0] === "--version") return { code: 0, stdout: "v24.21.0\n" };
|
|
1695
|
+
if (command === bootstrap && args[0] === pnpmEntry && args[1] === "--version") return { code: 0, stdout: "11.1.1\n" };
|
|
1696
|
+
if (command === bootstrap && args[0] === pnpmEntry && args[1] === "list") return { code: 0, stdout: "[]" };
|
|
1697
|
+
return { code: 1, stdout: "" };
|
|
1698
|
+
};
|
|
1699
|
+
const standard = await createProbes({ platform: "linux", env, run, fs }).node();
|
|
1700
|
+
const asset = distributionAsset({ shell: requirements.shell, pi: "1.0.2" }, "lock");
|
|
1701
|
+
const handlers = wizardHandlers({ platform: "linux", arch: "x64", env, run, fs,
|
|
1702
|
+
download: async ({ url }: { url: string }) => Buffer.from(url.endsWith(".json") ? asset : "lock") });
|
|
1703
|
+
const bundled = await handlers.collectPlan("release");
|
|
1704
|
+
assert.equal(standard.globalBinNode, true);
|
|
1705
|
+
assert.equal(bundled.inventory.node.globalBinNode, true);
|
|
1706
|
+
assert.equal(bundled.plan.bundled.shell, requirements.shell);
|
|
1707
|
+
assert.deepEqual(calls.filter((call) => call.command === destination), []);
|
|
1708
|
+
} finally { rmSync(home, { recursive: true, force: true }); }
|
|
1709
|
+
});
|
|
1710
|
+
|
|
1512
1711
|
// Simulates Linux against the real filesystem (profile files), so it runs on the POSIX runners only.
|
|
1513
1712
|
test("wizardHandlers plans the bundled install only when the gate says so, and routes its plan to the bundled runner",
|
|
1514
1713
|
{ skip: process.platform === "win32" ? "simulated Linux paths need a POSIX filesystem" : false }, async () => {
|
|
@@ -101,6 +101,24 @@ test("only complete known Windows shims name what they run: npm cmd-shim, pnpm's
|
|
|
101
101
|
assert.equal(windowsShim(undefined), null);
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
+
// The exact PowerShell range check bootstrap.cmd applies to the repository's engines.node.
|
|
105
|
+
const windowsRangeCheck = "(@($metadata.engines.node -split '\\s*\\|\\|\\s*' | Where-Object { $floor = [Version]$_.TrimStart('^', '>', '='); $actual -ge $floor -and (-not $_.StartsWith('^') -or $actual.Major -eq $floor.Major) }).Count -gt 0)";
|
|
106
|
+
// A caret clause needs a major of 1 or more, as nodeRequirementClauses in installer-downloads.mjs.
|
|
107
|
+
const windowsRangeGrammar = "'^(\\^[1-9][0-9]*|>=[0-9]+)\\.[0-9]+\\.[0-9]+(\\s*\\|\\|\\s*(\\^[1-9][0-9]*|>=[0-9]+)\\.[0-9]+\\.[0-9]+)*$'";
|
|
108
|
+
const pwsh = ["pwsh", "powershell"].find((name) => spawnSync(name, ["-NoProfile", "-Command", "exit 0"], { encoding: "utf8" }).status === 0);
|
|
109
|
+
test("CMD entry accepts the repository's ^22.19.0 || >=23.6.0 Node range and checks versions against it", { skip: pwsh ? false : "PowerShell is not installed" }, () => {
|
|
110
|
+
const source = readFileSync(new URL("../scripts/bootstrap.cmd", import.meta.url), "utf8");
|
|
111
|
+
assert.ok(source.includes(`if ($metadata.engines.node -notmatch ${windowsRangeGrammar} -or`), "the bundle check reads the range grammar");
|
|
112
|
+
const run = (range: string, version: string) => spawnSync(pwsh!, ["-NoProfile", "-Command",
|
|
113
|
+
`$metadata = [pscustomobject]@{ engines = [pscustomobject]@{ node = '${range}' } }; $actual = [Version]'${version}'; ` +
|
|
114
|
+
`if ($metadata.engines.node -notmatch ${windowsRangeGrammar}) { 'unknown' } elseif (${windowsRangeCheck}) { 'in' } else { 'out' }`], { encoding: "utf8" }).stdout.trim();
|
|
115
|
+
const range = "^22.19.0 || >=23.6.0";
|
|
116
|
+
for (const version of ["22.19.0", "22.99.99", "23.6.0", "24.22.2", "25.0.0"]) assert.equal(run(range, version), "in", version);
|
|
117
|
+
for (const version of ["22.18.9", "23.0.0", "23.5.9", "21.99.99"]) assert.equal(run(range, version), "out", version);
|
|
118
|
+
assert.equal(run(">=22.19.0", "23.0.0"), "in");
|
|
119
|
+
for (const bad of ["*", "^22.19", ">=22.19.0 <25.0.0", "~22.19.0", "^0.1.0", "^0.1.0 || >=23.6.0"]) assert.equal(run(bad, "24.22.2"), "unknown", bad);
|
|
120
|
+
});
|
|
121
|
+
|
|
104
122
|
test("CMD entry contains fixed commands, data-only paths, early bundle checks and no policy bypass", () => {
|
|
105
123
|
const source = readFileSync(new URL("../scripts/bootstrap.cmd", import.meta.url), "utf8");
|
|
106
124
|
assert.match(source, /DisableDelayedExpansion/i);
|
|
@@ -837,7 +855,7 @@ test("an older or untrusted user Node re-enters the pinned acquisition once; the
|
|
|
837
855
|
assert.match(probe, /"& \{ \$child = \$null; \$started = \$false; \$acquired = \$true; \$step = 'policy'; try \{/, "refusal is the default before any check");
|
|
838
856
|
assert.match(probe, /throw 'missing-target' \}; \$acquired = Test-Path -LiteralPath \(Join-Path \$tools '\.node-stem'\);/);
|
|
839
857
|
assert.match(probe, /if \(\$acquired -and \$version -ne 'v24\.21\.0'\) \{ throw 'acquired-version' \};/);
|
|
840
|
-
assert.
|
|
858
|
+
assert.ok(probe.includes(`if ($actual -lt [Version]'24.3.0' -or -not ${windowsRangeCheck}) { if ($acquired) { throw 'engine' }; [IO.File]::Delete((Join-Path $tools '.node-target')) };`));
|
|
841
859
|
const untrusted = probe.match(/if \(-not \$acquired -and \$reason -cmatch '\^\(([a-z|()-]+)\)\$'\) \{ \[IO\.File\]::Delete\(\(Join-Path \$env:GENTLE_BOOTSTRAP_TOOLS '\.node-target'\)\) \}\" \^\n {2}\"else \{ \[Console\]::Error\.WriteLine\(/);
|
|
842
860
|
assert.ok(untrusted, "only fixed storage codes leave the user's Node; everything else still refuses");
|
|
843
861
|
const leaves = new RegExp(`^(?:${untrusted[1]})$`);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import test from "node:test";
|
|
6
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { createGentleAiExtension } from "../extensions/gentle-ai.ts";
|
|
8
|
+
import { canonicalHash } from "../lib/review-transaction.ts";
|
|
9
|
+
|
|
10
|
+
function dispatch(severity: string) {
|
|
11
|
+
const rows = [{ id: "JD-A-001", lens: "judgment-day", location: "src/target.ts:1", severity, status_at_freeze: "open",
|
|
12
|
+
evidence_class: "deterministic", evidence_claim: "Controlled concrete impact at the frozen location." }];
|
|
13
|
+
return { agent: "jd-fix-agent", task: ["## Judgment Day activation", "User explicitly requested Judgment Day.",
|
|
14
|
+
"## Exact authorized severe IDs", "- `JD-A-001`", "## Judgment Day correction batch", "Round: 1 of 2.",
|
|
15
|
+
`Frozen ledger SHA-256: \`${canonicalHash(rows)}\``, "## Exact frozen finding rows", JSON.stringify(rows[0]),
|
|
16
|
+
"## Allowed edit surfaces", "src/target.ts"].join("\n") };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
test("#3051: the registered admission hook pinpoints unsupported severity without promoting it", async t => {
|
|
20
|
+
const cwd = mkdtempSync(join(tmpdir(), "judgment-severity-"));
|
|
21
|
+
t.after(() => rmSync(cwd, { recursive: true, force: true }));
|
|
22
|
+
type Handler = (event: { toolName: string; input: unknown }, ctx: ExtensionContext) => Promise<{ block?: boolean; reason?: string } | undefined>;
|
|
23
|
+
const handlers = new Map<string, Handler>();
|
|
24
|
+
createGentleAiExtension({ nativeReviewCli: null, processEnv: { GENTLE_AI_TELEMETRY: "0" } })({
|
|
25
|
+
on: (name: string, handler: Handler) => handlers.set(name, handler), events: { emit() {} }, registerCommand() {}, registerTool() {},
|
|
26
|
+
} as unknown as ExtensionAPI);
|
|
27
|
+
const check = (input: unknown) => handlers.get("tool_call")!({ toolName: "subagent_run", input }, {
|
|
28
|
+
cwd, hasUI: false, getContextUsage: () => ({ tokens: 1000, contextWindow: 272000, percent: 1 }),
|
|
29
|
+
} as unknown as ExtensionContext);
|
|
30
|
+
for (const severity of ["BLOCKER", "CRITICAL"]) assert.equal(await check(dispatch(severity)), undefined, severity);
|
|
31
|
+
for (const severity of ["HIGH", "MAJOR"]) {
|
|
32
|
+
const input = dispatch(severity), before = JSON.stringify(input);
|
|
33
|
+
const rejected = await check(input);
|
|
34
|
+
assert.equal(rejected?.block, true);
|
|
35
|
+
assert.match(rejected!.reason!, new RegExp(`Unsupported Judgment Day severity "${severity}"`));
|
|
36
|
+
assert.match(rejected!.reason!, /BLOCKER, CRITICAL, WARNING, SUGGESTION/);
|
|
37
|
+
assert.equal(JSON.stringify(input), before, "admission never rewrites the frozen rows or hash");
|
|
38
|
+
}
|
|
39
|
+
for (const severity of ["WARNING", "SUGGESTION"]) {
|
|
40
|
+
const rejected = await check(dispatch(severity));
|
|
41
|
+
assert.equal(rejected?.block, true); assert.match(rejected!.reason!, /informational.*not eligible/i);
|
|
42
|
+
}
|
|
43
|
+
const wrongHash = dispatch("CRITICAL"); wrongHash.task = wrongHash.task.replace(/Frozen ledger SHA-256: `[^`]+`/, `Frozen ledger SHA-256: \`${"0".repeat(64)}\``);
|
|
44
|
+
assert.equal((await check(wrongHash))?.block, true, "valid severity never bypasses the frozen hash");
|
|
45
|
+
assert.equal((await check({ ...dispatch("CRITICAL"), agents: [] }))?.block, true, "batch envelopes remain forbidden");
|
|
46
|
+
});
|