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
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdirSync, mkdtempSync, realpathSync, 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 { AssistantMessage, JsonObject, ToolCall } from "@earendil-works/pi-ai";
|
|
7
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
8
|
+
|
|
9
|
+
// Rarely used and state-bound tools leave the primary request's declarations
|
|
10
|
+
// only while codemode, a route the prompt names, still reaches them; without
|
|
11
|
+
// codemode they stay direct declarations. Real Pi SDK sessions, offline
|
|
12
|
+
// provider: each request's declared tools and system prompt are recorded.
|
|
13
|
+
|
|
14
|
+
interface RecordedRequest { systemPrompt: string; tools: string[]; toolResults: Array<{ name: string; isError: boolean; text: string }> }
|
|
15
|
+
interface Step { prompt: string; call?: { name: string; arguments: JsonObject }; before?: () => void }
|
|
16
|
+
|
|
17
|
+
const DESIGN_TOOLS = ["gentle_design", "gentle_design_comments"];
|
|
18
|
+
|
|
19
|
+
async function runSession(root: string, label: string, options: { codemode: boolean; design?: boolean; env?: NodeJS.ProcessEnv; steps: Step[] }): Promise<{ requests: RecordedRequest[]; errors: string[]; cwd: string }> {
|
|
20
|
+
const sdk = await import("@earendil-works/pi-coding-agent");
|
|
21
|
+
const ai = await import("@earendil-works/pi-ai");
|
|
22
|
+
const { default: gentleDesign } = await import("../extensions/gentle-design.ts");
|
|
23
|
+
const { default: gentleGuide } = await import("../extensions/gentle-guide.ts");
|
|
24
|
+
const { registerCompactCodemode } = await import("../lib/codemode-renderer.ts");
|
|
25
|
+
const cwd = join(root, `repo-${label}`);
|
|
26
|
+
mkdirSync(cwd);
|
|
27
|
+
if (options.design) mkdirSync(join(cwd, "design"));
|
|
28
|
+
const requests: RecordedRequest[] = [];
|
|
29
|
+
const errors: string[] = [];
|
|
30
|
+
const queue: Array<{ name: string; arguments: JsonObject } | undefined> = [];
|
|
31
|
+
let calls = 0;
|
|
32
|
+
const model = { id: "driver", name: "Local driver", provider: "hidden-fixture", api: "hidden-fixture", baseUrl: "http://invalid.local", reasoning: false, input: ["text"], contextWindow: 1_000_000, maxTokens: 1024, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 } } as const;
|
|
33
|
+
const settings = sdk.SettingsManager.inMemory({ compaction: { enabled: false }, retry: { enabled: false }, cacheWarming: "off", packages: [] });
|
|
34
|
+
const runtime = await sdk.ModelRuntime.create({ credentials: new ai.InMemoryCredentialStore(), modelsPath: null, modelsStorePath: join(root, `models-${label}.json`), refreshOnCreate: false, allowModelNetwork: false });
|
|
35
|
+
const loader = new sdk.DefaultResourceLoader({
|
|
36
|
+
cwd, agentDir: join(root, "profile"), settingsManager: settings,
|
|
37
|
+
noExtensions: true, noSkills: true, noPromptTemplates: true, noThemes: true, noContextFiles: true,
|
|
38
|
+
extensionFactories: [(pi: ExtensionAPI) => {
|
|
39
|
+
gentleDesign(pi, { env: options.env ?? {} });
|
|
40
|
+
gentleGuide(pi, options.env ?? {});
|
|
41
|
+
registerCompactCodemode(pi);
|
|
42
|
+
pi.registerProvider("hidden-fixture", {
|
|
43
|
+
api: "hidden-fixture", apiKey: "fixture-only", baseUrl: "http://invalid.local",
|
|
44
|
+
models: [{ id: model.id, name: model.name, reasoning: false, input: ["text"], cost: model.cost, contextWindow: model.contextWindow, maxTokens: model.maxTokens }],
|
|
45
|
+
streamSimple(_model, context) {
|
|
46
|
+
requests.push({
|
|
47
|
+
systemPrompt: ai.getCurrentSystemPrompt(context.messages) ?? "",
|
|
48
|
+
tools: (ai.getCurrentTools(context.messages) ?? []).map((tool) => tool.name),
|
|
49
|
+
toolResults: context.messages.flatMap((message) => message.role === "toolResult"
|
|
50
|
+
? [{ name: message.toolName, isError: message.isError, text: message.content.map((part) => part.type === "text" ? part.text : "").join("") }] : []),
|
|
51
|
+
});
|
|
52
|
+
const request = queue.shift();
|
|
53
|
+
calls += 1;
|
|
54
|
+
const stream = ai.createAssistantMessageEventStream();
|
|
55
|
+
const message: AssistantMessage = { role: "assistant", api: model.api, provider: model.provider, model: model.id, content: [], stopReason: "pending" as never, timestamp: Date.now(), usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 0, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } } };
|
|
56
|
+
queueMicrotask(() => {
|
|
57
|
+
stream.push({ type: "start", partial: message });
|
|
58
|
+
if (request) {
|
|
59
|
+
const toolCall: ToolCall = { type: "toolCall", id: `call-${calls}`, ...request };
|
|
60
|
+
message.content.push(toolCall);
|
|
61
|
+
stream.push({ type: "toolcall_start", contentIndex: 0, partial: message });
|
|
62
|
+
stream.push({ type: "toolcall_end", contentIndex: 0, toolCall, partial: message });
|
|
63
|
+
}
|
|
64
|
+
message.stopReason = request ? "toolUse" : "stop";
|
|
65
|
+
stream.push({ type: "done", reason: message.stopReason, message });
|
|
66
|
+
stream.end();
|
|
67
|
+
});
|
|
68
|
+
return stream;
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}],
|
|
72
|
+
});
|
|
73
|
+
await loader.reload();
|
|
74
|
+
assert.deepEqual(loader.getExtensions().errors, []);
|
|
75
|
+
const { session } = await sdk.createAgentSession({
|
|
76
|
+
cwd, agentDir: join(root, "profile"), modelRuntime: runtime, model: model as never, thinkingLevel: "off", resourceLoader: loader,
|
|
77
|
+
tools: ["read", ...DESIGN_TOOLS, "gentle_guide", ...(options.codemode ? ["codemode"] : [])],
|
|
78
|
+
sessionManager: sdk.SessionManager.inMemory(cwd), settingsManager: settings,
|
|
79
|
+
});
|
|
80
|
+
try {
|
|
81
|
+
await session.bindExtensions({ mode: "json", onError: (error) => errors.push(error.error) });
|
|
82
|
+
for (const step of options.steps) {
|
|
83
|
+
step.before?.();
|
|
84
|
+
queue.push(step.call, undefined);
|
|
85
|
+
await session.prompt(step.prompt, { source: "interactive" });
|
|
86
|
+
}
|
|
87
|
+
} finally {
|
|
88
|
+
await session.abort();
|
|
89
|
+
session.dispose();
|
|
90
|
+
}
|
|
91
|
+
return { requests, errors, cwd };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function fixture(t: { after: (fn: () => void) => void }): string {
|
|
95
|
+
const root = realpathSync(mkdtempSync(join(tmpdir(), "gentle-hidden-tools-")));
|
|
96
|
+
mkdirSync(join(root, "profile"));
|
|
97
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
98
|
+
return root;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const codemodeCall = (code: string) => ({ name: "codemode", arguments: { code } });
|
|
102
|
+
const DESIGN_ROUTE = /gentle_design and gentle_design_comments are not declared in this run: call them from codemode, such as `tools\.gentle_design\(\{ action: "list" \}\)`\./;
|
|
103
|
+
const GUIDE_ROUTE = /gentle_guide is not declared: call it from codemode/;
|
|
104
|
+
|
|
105
|
+
test("with codemode and no design/ the design and guide tools leave the request, stay callable from codemode, and the list is stable", { timeout: 60_000 }, async (t) => {
|
|
106
|
+
const root = fixture(t);
|
|
107
|
+
const run = await runSession(root, "hidden", { codemode: true, steps: [
|
|
108
|
+
{ prompt: "Start the tour.", call: codemodeCall('return await tools.gentle_guide({ action: "start" });') },
|
|
109
|
+
{ prompt: "List the designs.", call: codemodeCall('return await tools.gentle_design({ action: "list" });') },
|
|
110
|
+
] });
|
|
111
|
+
assert.deepEqual(run.errors, []);
|
|
112
|
+
assert.equal(run.requests.length, 4, "a tool turn and a reply turn per prompt");
|
|
113
|
+
for (const request of run.requests) {
|
|
114
|
+
assert.deepEqual(request.tools, ["read", "codemode"], "only the reachable declarations are sent");
|
|
115
|
+
assert.match(request.systemPrompt, DESIGN_ROUTE);
|
|
116
|
+
assert.match(request.systemPrompt, GUIDE_ROUTE);
|
|
117
|
+
assert.doesNotMatch(request.systemPrompt, /- gentle_guide: /, "a hidden tool's snippet leaves the tool list too");
|
|
118
|
+
}
|
|
119
|
+
assert.equal(new Set(run.requests.map((request) => JSON.stringify(request.tools))).size, 1, "consecutive requests carry the same tool list");
|
|
120
|
+
assert.equal(new Set(run.requests.map((request) => request.systemPrompt)).size, 1, "and the same system prompt");
|
|
121
|
+
const [guide, design] = [run.requests[1].toolResults.at(-1)!, run.requests[3].toolResults.at(-1)!];
|
|
122
|
+
assert.equal(guide.name, "codemode");
|
|
123
|
+
assert.equal(guide.isError, false);
|
|
124
|
+
assert.match(guide.text, /Script completed[\s\S]*Tour steps: /, "the hidden guide tool ran from codemode");
|
|
125
|
+
assert.equal(design.isError, false);
|
|
126
|
+
assert.match(design.text, /Script completed[\s\S]*design/i, "the hidden design tool ran from codemode");
|
|
127
|
+
assert.doesNotMatch(design.text, /not a function|is not defined|unknown tool/i);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test("without codemode every tool stays a direct declaration and no route is named", { timeout: 60_000 }, async (t) => {
|
|
131
|
+
const root = fixture(t);
|
|
132
|
+
const run = await runSession(root, "direct", { codemode: false, steps: [{ prompt: "hello" }, { prompt: "again" }] });
|
|
133
|
+
assert.deepEqual(run.errors, []);
|
|
134
|
+
for (const request of run.requests) {
|
|
135
|
+
assert.deepEqual([...request.tools].sort(), ["gentle_design", "gentle_design_comments", "gentle_guide", "read"]);
|
|
136
|
+
assert.doesNotMatch(request.systemPrompt, DESIGN_ROUTE);
|
|
137
|
+
assert.doesNotMatch(request.systemPrompt, GUIDE_ROUTE);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("with a design/ directory the design tools are declared; one appearing mid-session declares them from the next run", { timeout: 60_000 }, async (t) => {
|
|
142
|
+
const root = fixture(t);
|
|
143
|
+
const present = await runSession(root, "present", { codemode: true, design: true, steps: [{ prompt: "hello" }] });
|
|
144
|
+
assert.deepEqual(present.errors, []);
|
|
145
|
+
assert.deepEqual([...present.requests[0].tools].sort(), ["codemode", "gentle_design", "gentle_design_comments", "read"]);
|
|
146
|
+
assert.doesNotMatch(present.requests[0].systemPrompt, DESIGN_ROUTE);
|
|
147
|
+
assert.match(present.requests[0].systemPrompt, GUIDE_ROUTE, "the guide stays behind codemode");
|
|
148
|
+
|
|
149
|
+
const appearing = await runSession(root, "appearing", { codemode: true, steps: [
|
|
150
|
+
{ prompt: "first" },
|
|
151
|
+
{ prompt: "second" },
|
|
152
|
+
{ prompt: "third", before: () => mkdirSync(join(root, "repo-appearing", "design")) },
|
|
153
|
+
] });
|
|
154
|
+
assert.deepEqual(appearing.errors, []);
|
|
155
|
+
const [first, second, third] = appearing.requests;
|
|
156
|
+
assert.deepEqual(first.tools, ["read", "codemode"]);
|
|
157
|
+
assert.deepEqual(second.tools, first.tools, "unchanged state keeps the list");
|
|
158
|
+
assert.deepEqual([...third.tools].sort(), ["codemode", "gentle_design", "gentle_design_comments", "read"], "the next run after design/ appears declares them");
|
|
159
|
+
assert.doesNotMatch(third.systemPrompt, DESIGN_ROUTE);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test("delegated children keep the design tools declared", { timeout: 60_000 }, async (t) => {
|
|
163
|
+
const root = fixture(t);
|
|
164
|
+
const run = await runSession(root, "child", { codemode: true, env: { GENTLE_PI_AGENTS_CHILD: "1" }, steps: [{ prompt: "hello" }] });
|
|
165
|
+
assert.deepEqual(run.errors, []);
|
|
166
|
+
assert.deepEqual([...run.requests[0].tools].sort(), ["codemode", "gentle_design", "gentle_design_comments", "read"]);
|
|
167
|
+
assert.doesNotMatch(run.requests[0].systemPrompt, DESIGN_ROUTE);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// Verifier probe (mwb9y35y-23-1w1c): a model that calls a hidden tool by its
|
|
171
|
+
// own name still reaches it, because the tool stays active.
|
|
172
|
+
test("a hidden tool called directly by name still runs", { timeout: 60_000 }, async (t) => {
|
|
173
|
+
const root = fixture(t);
|
|
174
|
+
const run = await runSession(root, "direct-call", { codemode: true, steps: [
|
|
175
|
+
{ prompt: "Start the tour.", call: { name: "gentle_guide", arguments: { action: "start" } } },
|
|
176
|
+
{ prompt: "List the designs.", call: { name: "gentle_design", arguments: { action: "list" } } },
|
|
177
|
+
] });
|
|
178
|
+
assert.deepEqual(run.errors, []);
|
|
179
|
+
assert.deepEqual(run.requests[0].tools, ["read", "codemode"], "both tools are hidden while the call is made");
|
|
180
|
+
assert.deepEqual(run.requests[2].tools, ["read", "codemode"]);
|
|
181
|
+
const [guide, design] = [run.requests[1].toolResults.at(-1)!, run.requests[3].toolResults.at(-1)!];
|
|
182
|
+
assert.equal(guide.name, "gentle_guide");
|
|
183
|
+
assert.equal(guide.isError, false);
|
|
184
|
+
assert.match(guide.text, /Tour steps: /);
|
|
185
|
+
assert.equal(design.name, "gentle_design");
|
|
186
|
+
assert.equal(design.isError, false);
|
|
187
|
+
assert.match(design.text, /No designs in design\/ yet/);
|
|
188
|
+
});
|
|
@@ -12,6 +12,15 @@ const paragraph = (p: string, prefix: string) => {
|
|
|
12
12
|
assert.ok(text, prefix);
|
|
13
13
|
return text;
|
|
14
14
|
};
|
|
15
|
+
// The body of the module's `## Verifier preparation failure` section.
|
|
16
|
+
const verifierPreparation = () => {
|
|
17
|
+
const module = read("assets/orchestrator-verification.md");
|
|
18
|
+
const start = module.indexOf("## Verifier preparation failure\n\n");
|
|
19
|
+
assert.ok(start >= 0, "verification module keeps its preparation-failure section");
|
|
20
|
+
const body = module.slice(start + "## Verifier preparation failure\n\n".length);
|
|
21
|
+
const end = body.indexOf("\n## ");
|
|
22
|
+
return end < 0 ? body : body.slice(0, end);
|
|
23
|
+
};
|
|
15
24
|
let cwd: string;
|
|
16
25
|
let prior: string | undefined;
|
|
17
26
|
before(() => {
|
|
@@ -33,15 +42,19 @@ for (const persona of ["gentleman", "neutral"] as const) {
|
|
|
33
42
|
test(`S2-S5 delivered recovery is bounded: ${persona}/${mode}`, () => {
|
|
34
43
|
const p = __testing.buildGentlePrompt(persona, join(cwd, "project"), ["read"], `Receipt-driven development: ${mode}`);
|
|
35
44
|
assert.equal(p.split("## Authorized work continuity").length, 2);
|
|
36
|
-
|
|
45
|
+
// cost-speed-painpoints S15 P4: the setup rules live in the verification module, loaded when Verification fires;
|
|
46
|
+
// the unavailable-verifier rule stays always-on in the mirrored Close step.
|
|
47
|
+
assert.ok(!p.includes("A failed verifier setup"), "the setup paragraph left the always-on prompt");
|
|
48
|
+
const setup = paragraph(verifierPreparation(), "A failed verifier setup");
|
|
37
49
|
assert.match(setup, /prerequisite is repaired, the human may explicitly request one new bounded verification attempt/);
|
|
38
50
|
assert.match(setup, /zero tests run; the checks remain unverified/);
|
|
39
|
-
assert.match(setup, /
|
|
51
|
+
assert.match(setup, /self-fix of its own setup error \(one correction in the same verification\) needs no decision/);
|
|
52
|
+
assert.match(p, /7\. \*\*Close\.\*\*[^\n]*an unavailable verifier or subagent is reported as unavailable, never retried or escalated/);
|
|
40
53
|
for (const guard of ["consent", "a denial", "one-run", "no-retry", "terminal native outcomes", "exhausted native budgets"]) assert.ok(setup.includes(guard), guard);
|
|
41
54
|
assert.match(setup, /no child is active or has an uncertain status/);
|
|
42
55
|
const worker = paragraph(p, "An exhausted worker-local");
|
|
43
56
|
assert.match(worker, /scope, executor, correction limit and checks/);
|
|
44
|
-
assert.match(worker, /later explicit
|
|
57
|
+
assert.match(worker, /later explicit requests stay subject to native authority/);
|
|
45
58
|
assert.match(worker, /new session does not reset any limit/);
|
|
46
59
|
assert.match(worker, /specifically authorized.*actual native authority.*in-scope compilation or implementation/);
|
|
47
60
|
assert.match(worker, /unavailable proof still blocks completion and delivery/);
|
|
@@ -67,9 +80,10 @@ test("S3-S5 parsed worker and verifier contracts retain confinement and proof li
|
|
|
67
80
|
assert.deepEqual(verify.tools, ["read", "grep", "find", "bash", "mcp__codegraph__codegraph_explore"]);
|
|
68
81
|
assert.match(verify.instructions, /Before isolated setup[^\n]*space and inodes/);
|
|
69
82
|
assert.match(verify.instructions, /smaller copy[^\n]*all source, test\/build files, baseline material, and dependencies/);
|
|
70
|
-
assert.match(verify.instructions, /
|
|
83
|
+
assert.match(verify.instructions, /deterministic error in a command or environment you constructed[^\n]*exactly one corrected attempt/);
|
|
84
|
+
assert.match(verify.instructions, /second failure, or at any missing or unavailable prerequisite[^\n]*stop setup/);
|
|
71
85
|
assert.match(verify.instructions, /setup fails before probes[^\n]*zero tests run/);
|
|
72
|
-
assert.match(verify.instructions, /
|
|
86
|
+
assert.match(verify.instructions, /No further setup retries and no repair-helper loops/);
|
|
73
87
|
for (const guard of ["system temp directory", "a symlink into the workspace", "No network, no installs, no writes outside", "NODE_COMPILE_CACHE", "NO_UPDATE_NOTIFIER=1"]) assert.ok(verify.instructions.includes(guard), guard);
|
|
74
88
|
});
|
|
75
89
|
|
|
@@ -5,8 +5,10 @@ import test from "node:test";
|
|
|
5
5
|
import type { Api, AssistantMessage, Context, Model, SimpleStreamOptions } from "@earendil-works/pi-ai";
|
|
6
6
|
import type { completeSimple } from "@earendil-works/pi-ai/compat";
|
|
7
7
|
import {
|
|
8
|
+
INPROCESS_REVIEWER_EMPTY_OUTPUT_CAUSE,
|
|
8
9
|
INPROCESS_REVIEWER_FAILURE,
|
|
9
10
|
INPROCESS_REVIEWER_OUTPUT_MAX_BYTES,
|
|
11
|
+
classifyEmptyOutput,
|
|
10
12
|
runInProcessReviewer,
|
|
11
13
|
openCodeSessionAttributionHeaders,
|
|
12
14
|
type InProcessReviewerOutcome,
|
|
@@ -239,6 +241,7 @@ test("refuses empty assistant text with safe completion evidence", async () => {
|
|
|
239
241
|
assert.deepEqual(withoutRunTiming(refused.evidence), {
|
|
240
242
|
phase: "completion", provider: "openai",
|
|
241
243
|
reviewerModel: "openai/gpt-5", stopReason: "stop",
|
|
244
|
+
cause: INPROCESS_REVIEWER_EMPTY_OUTPUT_CAUSE.EMPTY_COMPLETION,
|
|
242
245
|
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 0 },
|
|
243
246
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
|
244
247
|
content: { blocks: 0, textBlocks: 0, thinkingBlocks: 0, textChars: 0, thinkingChars: 0 },
|
|
@@ -261,6 +264,7 @@ test("empty-output diagnostics allowlist facts, not provider secrets, and comple
|
|
|
261
264
|
assert.deepEqual(withoutRunTiming(refused.evidence), {
|
|
262
265
|
phase: "completion", provider: "nan",
|
|
263
266
|
reviewerModel: "nan/deepseek-v4-flash", stopReason: "length",
|
|
267
|
+
cause: INPROCESS_REVIEWER_EMPTY_OUTPUT_CAUSE.REASONING_EXHAUSTED_OUTPUT_BUDGET,
|
|
264
268
|
usage: { input: 12, output: 64, reasoning: 64, cacheRead: 0, cacheWrite: 0, totalTokens: 76 },
|
|
265
269
|
content: { blocks: 2, textBlocks: 1, thinkingBlocks: 1, textChars: 0, thinkingChars: 16 },
|
|
266
270
|
});
|
|
@@ -295,6 +299,75 @@ test("empty-output evidence does not invent usage or missing thinking lengths",
|
|
|
295
299
|
assert.deepEqual(refused.evidence?.content, { blocks: 1, textBlocks: 0, thinkingBlocks: 1, textChars: 0 });
|
|
296
300
|
});
|
|
297
301
|
|
|
302
|
+
// gentle-ai#6095: an empty completion is attributed to whatever the completion
|
|
303
|
+
// itself proves — the model's spent output budget, or a provider response with
|
|
304
|
+
// no completion at all — instead of the generic "produced no text", which left
|
|
305
|
+
// the recorded facts uninterpreted. None of these refusals infers a candidate
|
|
306
|
+
// issue: a generation failure is a transport outcome, not a review finding.
|
|
307
|
+
|
|
308
|
+
test("attributes an empty verdict to a reviewer model that spent its output budget on reasoning", async () => {
|
|
309
|
+
const model = fakeModel({ provider: "nan", id: "glm5.3", maxTokens: 16_384 });
|
|
310
|
+
const assistant = assistantText("", {
|
|
311
|
+
content: [{ type: "thinking", thinking: "x".repeat(74_755), thinkingSignature: "PRIVATE SIGNATURE" }],
|
|
312
|
+
stopReason: "length", errorMessage: "PRIVATE ERROR",
|
|
313
|
+
usage: { input: 901, output: 16_384, reasoning: 16_384, cacheRead: 0, cacheWrite: 0, totalTokens: 17_285 } as never,
|
|
314
|
+
});
|
|
315
|
+
const refused = expectRefused(await runInProcessReviewer(baseRequest(), {
|
|
316
|
+
registry: { ...fakeRegistry([model]), find: () => model }, complete: async () => assistant,
|
|
317
|
+
}));
|
|
318
|
+
assert.equal(refused.code, INPROCESS_REVIEWER_FAILURE.EMPTY_OUTPUT);
|
|
319
|
+
assert.equal(refused.evidence?.cause, INPROCESS_REVIEWER_EMPTY_OUTPUT_CAUSE.REASONING_EXHAUSTED_OUTPUT_BUDGET);
|
|
320
|
+
assert.match(refused.message, /^Reviewer model nan\/glm5\.3 exhausted its 16384-token output budget on reasoning before emitting a verdict for review-risk \(stopReason: length; output: 16384; reasoning: 16384\)\./);
|
|
321
|
+
assert.match(refused.message, /Route this lens to a reviewer model with a sufficient output ceiling, raise the output budget, or reduce reasoning\./);
|
|
322
|
+
assert.match(refused.message, /No candidate issue is inferred from this generation failure\./);
|
|
323
|
+
// The facts that make the attribution checkable stay in the record.
|
|
324
|
+
assert.equal(refused.evidence?.reviewerModel, "nan/glm5.3");
|
|
325
|
+
assert.equal(refused.evidence?.stopReason, "length");
|
|
326
|
+
assert.deepEqual(refused.evidence?.usage, { input: 901, output: 16_384, reasoning: 16_384, cacheRead: 0, cacheWrite: 0, totalTokens: 17_285 });
|
|
327
|
+
assert.equal((refused.evidence?.content as Record<string, number>).textBlocks, 0);
|
|
328
|
+
assert.doesNotMatch(JSON.stringify(refused), /PRIVATE|Signature|errorMessage/);
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
test("attributes an empty completion with zero output tokens to the provider response", async () => {
|
|
332
|
+
const model = fakeModel({ provider: "nan", id: "glm5.3" });
|
|
333
|
+
const assistant = assistantText("", {
|
|
334
|
+
content: [], stopReason: "stop",
|
|
335
|
+
usage: { input: 901, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 901 } as never,
|
|
336
|
+
});
|
|
337
|
+
const refused = expectRefused(await runInProcessReviewer(baseRequest(), {
|
|
338
|
+
registry: { ...fakeRegistry([model]), find: () => model }, complete: async () => assistant,
|
|
339
|
+
}));
|
|
340
|
+
assert.equal(refused.code, INPROCESS_REVIEWER_FAILURE.EMPTY_OUTPUT);
|
|
341
|
+
assert.equal(refused.evidence?.cause, INPROCESS_REVIEWER_EMPTY_OUTPUT_CAUSE.EMPTY_COMPLETION);
|
|
342
|
+
assert.equal(
|
|
343
|
+
refused.message,
|
|
344
|
+
"The provider returned no completion for review-risk from reviewer model nan/glm5.3 (stopReason: stop; output: 0). Retry the slot. No candidate issue is inferred from this generation failure.",
|
|
345
|
+
);
|
|
346
|
+
assert.equal(refused.evidence?.reviewerModel, "nan/glm5.3");
|
|
347
|
+
assert.equal(refused.evidence?.stopReason, "stop");
|
|
348
|
+
assert.deepEqual(refused.evidence?.usage, { input: 901, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 901 });
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
test("keeps the generic empty-output refusal for shapes it cannot attribute", async () => {
|
|
352
|
+
const unattributed: Array<{ name: string; assistant: AssistantMessage }> = [
|
|
353
|
+
{ name: "length with no reasoning reported", assistant: assistantText("", { content: [], stopReason: "length", usage: { input: 5, output: 64, cacheRead: 0, cacheWrite: 0, totalTokens: 69 } as never }) },
|
|
354
|
+
{ name: "length with zero output tokens", assistant: assistantText("", { content: [], stopReason: "length", usage: { input: 5, output: 0, reasoning: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 5 } as never }) },
|
|
355
|
+
{ name: "stop with no usage reported", assistant: assistantText("", { content: [], stopReason: "stop", usage: undefined }) },
|
|
356
|
+
{ name: "partial reasoning below the budget", assistant: assistantText("", { content: [], stopReason: "length", usage: { input: 5, output: 64, reasoning: 63, cacheRead: 0, cacheWrite: 0, totalTokens: 69 } as never }) },
|
|
357
|
+
{ name: "unrecognized stop reason", assistant: assistantText("", { content: [], stopReason: "deferred" }) },
|
|
358
|
+
];
|
|
359
|
+
for (const { name, assistant } of unattributed) {
|
|
360
|
+
const refused = expectRefused(await runInProcessReviewer(baseRequest(), {
|
|
361
|
+
registry: fakeRegistry([fakeModel()]), complete: async () => assistant,
|
|
362
|
+
}));
|
|
363
|
+
assert.equal(refused.code, INPROCESS_REVIEWER_FAILURE.EMPTY_OUTPUT, name);
|
|
364
|
+
assert.ok(!Object.hasOwn(refused.evidence!, "cause"), name);
|
|
365
|
+
assert.match(refused.message, /^Reviewer produced no text for review-risk \(stopReason: /, name);
|
|
366
|
+
assert.doesNotMatch(refused.message, /No candidate issue is inferred/, name);
|
|
367
|
+
assert.equal(classifyEmptyOutput(assistant), undefined, name);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
|
|
298
371
|
test("refuses with PROVIDER_FAILED when the provider itself reports an aborted completion", async () => {
|
|
299
372
|
const assistant = assistantText("", { content: [], stopReason: "aborted", errorMessage: "provider aborted mid-turn" });
|
|
300
373
|
const outcome = await runInProcessReviewer(baseRequest(), {
|
|
@@ -366,6 +366,30 @@ test("planModel discloses the PATH change and runtime persistence before consent
|
|
|
366
366
|
[[false, true], [false, true]]);
|
|
367
367
|
});
|
|
368
368
|
|
|
369
|
+
test("the consent screen does not promise no replacements for a pnpm-managed Node", async () => {
|
|
370
|
+
for (const pi of [{ available: false }, { available: true, version: "0.99.0", usable: true, owner: "pnpm" }]) {
|
|
371
|
+
const view = await serverPlanView({ node: { available: true, version: "24.21.0", usable: true, persistent: false, npm: false,
|
|
372
|
+
found: "23.5.9", foundInGlobalBin: true }, pi });
|
|
373
|
+
const screen = wizard.renderPlan(new FakeDocument(), wizard.planModel(view), { install() {}, reload() {}, close() {} });
|
|
374
|
+
assert.match(screen.textContent, /Node\.js 23\.5\.9 is managed by pnpm under \$PNPM_HOME and will be replaced by the pinned Node\.js 24\.21\.0/);
|
|
375
|
+
assert.doesNotMatch(screen.textContent, /left unchanged|Existing installations are not replaced/);
|
|
376
|
+
}
|
|
377
|
+
const plain = wizard.renderPlan(new FakeDocument(), wizard.planModel(await serverPlanView()), { install() {}, reload() {}, close() {} });
|
|
378
|
+
assert.match(plain.textContent, /The installer runs only the steps listed above\. Existing installations are not replaced\./);
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
test("the consent screen distinguishes an unchanged PATH Node from the destination Node being replaced", async () => {
|
|
382
|
+
for (const pi of [{ available: false }, { available: true, version: "0.99.0", usable: true, owner: "pnpm" }]) {
|
|
383
|
+
const view = await serverPlanView({ node: { available: true, version: "24.21.0", usable: true, persistent: false, npm: false,
|
|
384
|
+
found: "23.5.9", globalBinNode: true }, pi });
|
|
385
|
+
const screen = wizard.renderPlan(new FakeDocument(), wizard.planModel(view), { install() {}, reload() {}, close() {} });
|
|
386
|
+
assert.doesNotMatch(screen.textContent, /Existing installations are not replaced/);
|
|
387
|
+
assert.match(screen.textContent, /Your Node\.js 23\.5\.9 found first on PATH is left unchanged\./);
|
|
388
|
+
assert.match(screen.textContent, /The Node\.js already in \$PNPM_HOME will be replaced by the pinned Node\.js 24\.21\.0\./);
|
|
389
|
+
assert.match(screen.textContent, /The installer runs only the steps listed above\./);
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
|
|
369
393
|
// A missing Git is noted on the review screen, never as a blocker: the plan stays installable.
|
|
370
394
|
test("the review screen notes a missing Git and stays installable", async () => {
|
|
371
395
|
const model = wizard.planModel(await serverPlanView({ git: { available: false } }));
|
|
@@ -422,7 +446,9 @@ test("planModel turns preflight blockers into guidance and offers no install", a
|
|
|
422
446
|
assert.equal(model.kind, "blocked");
|
|
423
447
|
assert.equal(model.blockers.length, 1);
|
|
424
448
|
assert.equal(model.blockers[0].toolLabel, "Node.js");
|
|
425
|
-
assert.equal(model.blockers[0].guidance, "Node.js 18.0.0 is installed, but this installer needs 22.19.0 or newer. Nothing was replaced. Update it, then select Check again.");
|
|
449
|
+
assert.equal(model.blockers[0].guidance, "Node.js 18.0.0 is installed, but this installer needs 22.19.0 or a later 22.x release, or 23.6.0 or newer. Nothing was replaced. Update it, then select Check again.");
|
|
450
|
+
const node23 = wizard.planModel(await serverPlanView({ node: { available: true, version: "23.3.0", usable: true, persistent: true, npm: true } }));
|
|
451
|
+
assert.equal(node23.blockers[0].guidance, "Node.js 23.3.0 is installed, but this installer needs 22.19.0 or a later 22.x release, or 23.6.0 or newer. Nothing was replaced. Update it, then select Check again.");
|
|
426
452
|
for (const code of Object.keys(guidance.blockers)) {
|
|
427
453
|
const rendered = wizard.planModel({ planId: "p", ready: false, actions: [], blockers: [{ code, tool: "pnpm", guidance: guidance.blockers[code] }],
|
|
428
454
|
profileChange: { changesProfile: false, binDir: null, description: "x" }, persistence: { tools: [], pnpmHome: null, description: "y" } });
|
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import test from "node:test";
|
|
3
|
-
import { artifactFor, uvPinVersion } from "../scripts/installer-downloads.mjs";
|
|
3
|
+
import { artifactFor, engramPinVersion, uvPinVersion } from "../scripts/installer-downloads.mjs";
|
|
4
|
+
|
|
5
|
+
// The Engram core the bundled install ships (S9), from its checksums.txt and
|
|
6
|
+
// the published asset digests; every archive was downloaded and re-hashed.
|
|
7
|
+
const engramPins = {
|
|
8
|
+
"darwin-arm64": ["darwin_arm64.tar.gz", "f96e08db8f47ca49ebc034eba30e468db81eb56df98f9bf21a73366b510695e4", 8001813],
|
|
9
|
+
"darwin-x64": ["darwin_amd64.tar.gz", "d35623443a5d85e8f78338cda5d0bb73b2f7ec6217a57e4abb71904a3e0d6287", 8488340],
|
|
10
|
+
"linux-x64": ["linux_amd64.tar.gz", "8db9d5db1c1574b8b830aac4ffbe86c024014aed6b9a3f0406ac3361a152cdf0", 8365851],
|
|
11
|
+
"linux-arm64": ["linux_arm64.tar.gz", "cdbbcb68d3e842d3e52e27edccef55e6fe98ce3cdbc90cd79894323b029efb50", 7712574],
|
|
12
|
+
"win32-x64": ["windows_amd64.zip", "515a716ce966202058d4b9f310626fde72583cfc64ccefbf0dcc81456260089c", 8582764],
|
|
13
|
+
"win32-arm64": ["windows_arm64.zip", "01e4f5dab2f941cf810d1373e7c6998c014499bee9c2d5783e34da94c70ac7f2", 7780232],
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
test("fixed Engram descriptors are the published 3.7.2 core archives and checksums, and nothing else", () => {
|
|
17
|
+
assert.equal(engramPinVersion, "3.7.2");
|
|
18
|
+
for (const [target, [suffix, sha256, size]] of Object.entries(engramPins)) {
|
|
19
|
+
const [platform, arch] = target.split("-");
|
|
20
|
+
const artifact = artifactFor("engram", platform, arch);
|
|
21
|
+
assert.equal(artifact.name, "engram");
|
|
22
|
+
assert.equal(artifact.version, "3.7.2");
|
|
23
|
+
assert.equal(artifact.url, `https://github.com/Gentleman-Programming/engram/releases/download/v3.7.2/engram_3.7.2_${suffix}`);
|
|
24
|
+
assert.equal(artifact.integrity, `sha256-${sha256}`);
|
|
25
|
+
assert.deepEqual([artifact.size, artifact.maxBytes], [size, size]);
|
|
26
|
+
assert.deepEqual(artifact.redirectHosts, ["objects.githubusercontent.com", "release-assets.githubusercontent.com"]);
|
|
27
|
+
assert.ok(Object.isFrozen(artifact));
|
|
28
|
+
}
|
|
29
|
+
for (const [platform, arch] of [["linux", "ia32"], ["freebsd", "x64"], ["win32", "ia32"], ["darwin", "ppc64"]]) {
|
|
30
|
+
assert.throws(() => artifactFor("engram", platform, arch), /Unsupported/);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
4
33
|
|
|
5
34
|
// The uv the /gentle:music offer installs inside a bundled prefix (S5): the
|
|
6
35
|
// astral-sh/uv release archives, each re-hashed after download before pinning.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, existsSync, symlinkSync, readdirSync, rmSync, lstatSync, unlinkSync, realpathSync } from "node:fs";
|
|
2
|
+
import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, existsSync, symlinkSync, readlinkSync, readdirSync, rmSync, lstatSync, unlinkSync, realpathSync } from "node:fs";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { dirname, join, resolve } from "node:path";
|
|
5
5
|
import { spawn, spawnSync } from "node:child_process";
|
|
@@ -9,7 +9,7 @@ import test, { type TestContext } from "node:test";
|
|
|
9
9
|
import fs from "node:fs";
|
|
10
10
|
import { syncBuiltinESMExports } from "node:module";
|
|
11
11
|
import { crc32, deflateRawSync, gzipSync } from "node:zlib";
|
|
12
|
-
import { artifactFor, verifiedDownload, compatibleEngine, ensurePnpm, launchWizard, bootstrap, removeOwnedTools, acquireGo, installedGo } from "../scripts/installer-downloads.mjs";
|
|
12
|
+
import { artifactFor, verifiedDownload, compatibleEngine, nodeRequirementSatisfied, ensurePnpm, launchWizard, bootstrap, removeOwnedTools, acquireGo, installedGo } from "../scripts/installer-downloads.mjs";
|
|
13
13
|
|
|
14
14
|
const script = resolve("scripts/bootstrap.sh");
|
|
15
15
|
const helper = resolve("scripts/installer-downloads.mjs");
|
|
@@ -17,8 +17,9 @@ const node = process.execPath;
|
|
|
17
17
|
// Shell and private-tools fixtures need POSIX sh, stock utilities and uids.
|
|
18
18
|
const posixHost = process.platform === "win32" ? "POSIX shell bootstrap fixtures need a POSIX host" : false;
|
|
19
19
|
const posixTest = (name: string, fn: (t: TestContext) => void | Promise<void>) => test(name, { skip: posixHost }, fn);
|
|
20
|
-
// macOS keeps several stock utilities only in /bin.
|
|
21
|
-
const systemUtility = (name: string) =>
|
|
20
|
+
// macOS keeps several stock utilities only in /bin. Allow an explicit awk for portability checks.
|
|
21
|
+
const systemUtility = (name: string) => name === "awk" && process.env.INSTALLER_TEST_AWK ? process.env.INSTALLER_TEST_AWK
|
|
22
|
+
: ["/usr/bin", "/bin"].map((dir) => join(dir, name)).find((path) => existsSync(path)) ?? `/usr/bin/${name}`;
|
|
22
23
|
function fixture() {
|
|
23
24
|
// The bootstrap refuses symlinked HOME ancestors, such as macOS /var -> /private/var.
|
|
24
25
|
const root = mkdtempSync(join(realpathSync(tmpdir()), "bootstrap space ü-"));
|
|
@@ -28,7 +29,7 @@ function fixture() {
|
|
|
28
29
|
for (const dir of [bin, home, join(bundle, "scripts"), join(bundle, "bin")]) mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
29
30
|
writeFileSync(join(bundle, "scripts/bootstrap.sh"), readFileSync(script));
|
|
30
31
|
writeFileSync(join(bundle, "scripts/installer-downloads.mjs"), readFileSync(helper));
|
|
31
|
-
writeFileSync(join(bundle, "package.json"), JSON.stringify({ engines: { node: "
|
|
32
|
+
writeFileSync(join(bundle, "package.json"), JSON.stringify({ engines: { node: "^22.19.0 || >=23.6.0" }, packageManager: "pnpm@11.1.1" }));
|
|
32
33
|
for (const name of ["dirname", "pwd", "awk", "mkdir", "mktemp", "chmod", "mv", "rm", "sleep", "wc", "cat", "id", "ls"])
|
|
33
34
|
symlinkSync(systemUtility(name), join(bin, name));
|
|
34
35
|
const executable = (name: string, body: string) => {
|
|
@@ -83,6 +84,13 @@ test("engine evidence supports stable lower bounds, not guessed ranges", () => {
|
|
|
83
84
|
assert.equal(compatibleEngine("*", "24.21.0"), false);
|
|
84
85
|
assert.equal(compatibleEngine(">=22.13.0", "24.0.0-rc.1"), false);
|
|
85
86
|
});
|
|
87
|
+
test("the repository Node requirement accepts 22.19 or a later 22.x, or 23.6 and newer", () => {
|
|
88
|
+
const range = "^22.19.0 || >=23.6.0";
|
|
89
|
+
for (const version of ["22.19.0", "22.99.99", "23.6.0", "24.22.2", "25.0.0", "v24.21.0"]) assert.equal(nodeRequirementSatisfied(range, version), true, version);
|
|
90
|
+
for (const version of ["21.99.99", "22.18.9", "23.0.0", "23.5.9", "24.0.0-rc.1", "banana"]) assert.equal(nodeRequirementSatisfied(range, version), false, version);
|
|
91
|
+
assert.equal(nodeRequirementSatisfied(">=22.19.0", "23.0.0"), true);
|
|
92
|
+
for (const bad of ["*", "", "^22.19", ">=22.19.0 <25.0.0", "^0.1.0", "^22.19.0 ||", "~22.19.0", undefined]) assert.equal(nodeRequirementSatisfied(bad, "24.22.2"), false, String(bad));
|
|
93
|
+
});
|
|
86
94
|
test("pnpm descriptor preserves the literal upstream Node engine", () => {
|
|
87
95
|
assert.equal(artifactFor("pnpm").engine, ">=22.13");
|
|
88
96
|
});
|
|
@@ -161,6 +169,83 @@ test("download helper validates bytes before returning them", async () => {
|
|
|
161
169
|
assert.notEqual(createHash("sha512").update(bytes).digest("base64"), artifactFor("pnpm").integrity.slice(7));
|
|
162
170
|
});
|
|
163
171
|
|
|
172
|
+
for (const version of ["23.5.9", "24.21.0"]) {
|
|
173
|
+
posixTest(`malformed repository Node ranges fail before acquisition with Node ${version}`, () => {
|
|
174
|
+
const invalid = ["^0.1.0 || >=23.6.0", ">=23.6.0 || ^0.1.0", "^00.1.0 || >=23.6.0",
|
|
175
|
+
"^22.019.0 || >=23.6.0", "^22.19.00 || >=23.6.0", "^22.19.0 || >=023.6.0",
|
|
176
|
+
"^22.19.0 || >=9007199254740992.0.0", ">=23.6.0 || >=1.9007199254740992.0",
|
|
177
|
+
">=23.6.0 || >=1.0.9007199254740992", "^22.19.0 ||", ">=23.6.0 || ~22.0.0"];
|
|
178
|
+
for (const range of invalid) {
|
|
179
|
+
assert.equal(nodeRequirementSatisfied(range, version), false, range);
|
|
180
|
+
const f = fixture();
|
|
181
|
+
try {
|
|
182
|
+
f.addPnpm(); f.wizard();
|
|
183
|
+
writeFileSync(join(f.bundle, "package.json"), JSON.stringify({ engines: { node: range }, packageManager: "pnpm@11.1.1" }));
|
|
184
|
+
const ownNode = `#!/bin/sh\nprintf x >> "$NODE_PROBE_COUNT"\nprintf '%s\\n' 'v${version}'\n`;
|
|
185
|
+
writeFileSync(join(f.bin, "node"), ownNode, { mode: 0o755 });
|
|
186
|
+
f.executable("curl", 'printf x >> "$DOWNLOAD_COUNT"; exit 1');
|
|
187
|
+
const before = readdirSync(f.root).sort();
|
|
188
|
+
const result = f.run({ NODE_PROBE_COUNT: join(f.root, "node-count"), DOWNLOAD_COUNT: join(f.root, "download-count") });
|
|
189
|
+
assert.equal(result.status, 1, range);
|
|
190
|
+
assert.equal(result.stdout, "", range);
|
|
191
|
+
assert.equal(result.stderr, "Bootstrap: Cannot establish repository Node requirement\n", range);
|
|
192
|
+
assert.deepEqual(readdirSync(f.root).sort(), before, `${range}: no probes, downloads, or files`);
|
|
193
|
+
assert.deepEqual(readdirSync(f.home), [], range);
|
|
194
|
+
assert.equal(readFileSync(join(f.bin, "node"), "utf8"), ownNode, range);
|
|
195
|
+
} finally { f.cleanup(); }
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
posixTest("noncanonical whitespace and JSON escapes remain rejected before probing or download", () => {
|
|
201
|
+
const cases = [
|
|
202
|
+
{ range: " ^22.19.0 || >=23.6.0 " },
|
|
203
|
+
{ range: "\t^22.19.0\n||\r>=23.6.0\u00a0" },
|
|
204
|
+
{ range: "^22.19.0 || >=23.6.0", json: '"\\u005e22.19.0 || >=23.6.0"' },
|
|
205
|
+
{ range: "^22.19.0\u00a0||\u00a0>=23.6.0" },
|
|
206
|
+
];
|
|
207
|
+
for (const { range, json = JSON.stringify(range) } of cases) {
|
|
208
|
+
assert.equal(nodeRequirementSatisfied(range, "24.21.0"), true, JSON.stringify(range));
|
|
209
|
+
const f = fixture();
|
|
210
|
+
try {
|
|
211
|
+
f.addPnpm(); f.wizard();
|
|
212
|
+
writeFileSync(join(f.bundle, "package.json"), `{"engines":{"node":${json}},"packageManager":"pnpm@11.1.1"}`);
|
|
213
|
+
f.executable("node", 'printf x >> "$NODE_PROBE_COUNT"; printf "v24.21.0\\n"');
|
|
214
|
+
f.executable("curl", 'printf x >> "$DOWNLOAD_COUNT"; exit 1');
|
|
215
|
+
const snapshot = () => readdirSync(f.root, { recursive: true }).sort().map((name) => {
|
|
216
|
+
const path = join(f.root, name);
|
|
217
|
+
const info = lstatSync(path);
|
|
218
|
+
return [name, info.isFile() ? readFileSync(path, "utf8") : info.isSymbolicLink() ? readlinkSync(path) : null];
|
|
219
|
+
});
|
|
220
|
+
const before = snapshot();
|
|
221
|
+
const result = f.run({ NODE_PROBE_COUNT: join(f.root, "node-count"), DOWNLOAD_COUNT: join(f.root, "download-count") });
|
|
222
|
+
assert.equal(result.status, 1, json);
|
|
223
|
+
assert.equal(result.stdout, "", json);
|
|
224
|
+
assert.equal(result.stderr, "Bootstrap: Cannot establish repository Node requirement\n", json);
|
|
225
|
+
assert.equal(existsSync(join(f.root, "node-count")), false, json);
|
|
226
|
+
assert.equal(existsSync(join(f.root, "download-count")), false, json);
|
|
227
|
+
assert.deepEqual(snapshot(), before, `${json}: no files written`);
|
|
228
|
+
} finally { f.cleanup(); }
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
posixTest("valid canonical ranges, including safe integer floors, still start the wizard", () => {
|
|
233
|
+
for (const range of [">=0.0.0", "^1.0.0 || >=23.6.0", ">=23.6.0 || ^9007199254740991.0.0",
|
|
234
|
+
"^22.19.0 || >=23.6.0"]) {
|
|
235
|
+
assert.equal(nodeRequirementSatisfied(range, "24.21.0"), true, range);
|
|
236
|
+
const f = fixture();
|
|
237
|
+
try {
|
|
238
|
+
f.addNode(); f.addPnpm(); f.wizard();
|
|
239
|
+
writeFileSync(join(f.bundle, "package.json"), JSON.stringify({ engines: { node: range }, packageManager: "pnpm@11.1.1" }));
|
|
240
|
+
const result = f.run();
|
|
241
|
+
assert.equal(result.status, 0, `${JSON.stringify(range)}: ${result.stderr}`);
|
|
242
|
+
assert.equal(result.stderr, "", range);
|
|
243
|
+
assert.match(result.stdout, /wizard-child:/, range);
|
|
244
|
+
assert.deepEqual(readdirSync(f.home), [], range);
|
|
245
|
+
} finally { f.cleanup(); }
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
164
249
|
posixTest("compatible existing tools are reused with whitespace and Unicode paths", () => {
|
|
165
250
|
const f = fixture();
|
|
166
251
|
try {
|
|
@@ -314,6 +399,22 @@ posixTest("an older stable Node is left unchanged and a verified Node runs the h
|
|
|
314
399
|
assert.deepEqual(readdirSync(f.home), [], "successful wizard exit removes the owned tools");
|
|
315
400
|
} finally { f.cleanup(); }
|
|
316
401
|
});
|
|
402
|
+
for (const [version, reused] of [["v22.19.0", true], ["v23.6.0", true], ["v23.0.0", false], ["v23.5.9", false]] as const) {
|
|
403
|
+
posixTest(`existing Node ${version} is ${reused ? "reused" : "left unchanged while a verified Node runs the wizard"}`, () => {
|
|
404
|
+
const f = fixture();
|
|
405
|
+
try {
|
|
406
|
+
f.addPnpm(); f.wizard();
|
|
407
|
+
const user = `#!/bin/sh\nif [ "$1" = --version ]; then echo ${version}; else ${reused ? `exec '${node}' "$@"` : "echo user-node-ran >&2; exit 9"}; fi\n`;
|
|
408
|
+
writeFileSync(join(f.bin, "node"), user, { mode: 0o755 });
|
|
409
|
+
const result = f.run();
|
|
410
|
+
assert.equal(result.status, 0, result.stderr);
|
|
411
|
+
if (reused) assert.doesNotMatch(result.stdout, /\.gentle-shell-bootstrap-tools\.[^:\n]*\/node\/bin/);
|
|
412
|
+
else assert.match(result.stdout, /wizard-child:[^:\n]*\.gentle-shell-bootstrap-tools\.[^:\n]*\/node\/bin:/);
|
|
413
|
+
assert.doesNotMatch(result.stderr, /user-node-ran/);
|
|
414
|
+
assert.equal(readFileSync(join(f.bin, "node"), "utf8"), user);
|
|
415
|
+
} finally { f.cleanup(); }
|
|
416
|
+
});
|
|
417
|
+
}
|
|
317
418
|
posixTest("existing pnpm with unknown engine blocks instead of acquisition", () => {
|
|
318
419
|
const f = fixture();
|
|
319
420
|
try {
|
|
@@ -994,19 +1095,19 @@ test("Go has no descriptor for other targets", () => {
|
|
|
994
1095
|
// The Engram release the bundled install ships (S9), from its checksums.txt and
|
|
995
1096
|
// the GitHub asset digests; every archive was downloaded and re-hashed.
|
|
996
1097
|
const engramPins = {
|
|
997
|
-
"darwin-arm64": ["darwin_arm64.tar.gz", "
|
|
998
|
-
"darwin-x64": ["darwin_amd64.tar.gz", "
|
|
999
|
-
"linux-x64": ["linux_amd64.tar.gz", "
|
|
1000
|
-
"linux-arm64": ["linux_arm64.tar.gz", "
|
|
1001
|
-
"win32-x64": ["windows_amd64.zip", "
|
|
1002
|
-
"win32-arm64": ["windows_arm64.zip", "
|
|
1098
|
+
"darwin-arm64": ["darwin_arm64.tar.gz", "f96e08db8f47ca49ebc034eba30e468db81eb56df98f9bf21a73366b510695e4", 8001813],
|
|
1099
|
+
"darwin-x64": ["darwin_amd64.tar.gz", "d35623443a5d85e8f78338cda5d0bb73b2f7ec6217a57e4abb71904a3e0d6287", 8488340],
|
|
1100
|
+
"linux-x64": ["linux_amd64.tar.gz", "8db9d5db1c1574b8b830aac4ffbe86c024014aed6b9a3f0406ac3361a152cdf0", 8365851],
|
|
1101
|
+
"linux-arm64": ["linux_arm64.tar.gz", "cdbbcb68d3e842d3e52e27edccef55e6fe98ce3cdbc90cd79894323b029efb50", 7712574],
|
|
1102
|
+
"win32-x64": ["windows_amd64.zip", "515a716ce966202058d4b9f310626fde72583cfc64ccefbf0dcc81456260089c", 8582764],
|
|
1103
|
+
"win32-arm64": ["windows_arm64.zip", "01e4f5dab2f941cf810d1373e7c6998c014499bee9c2d5783e34da94c70ac7f2", 7780232],
|
|
1003
1104
|
} as const;
|
|
1004
1105
|
test("fixed Engram descriptors are the GitHub release archives and checksums, and nothing else", () => {
|
|
1005
1106
|
for (const [target, [suffix, sha256, size]] of Object.entries(engramPins)) {
|
|
1006
1107
|
const [platform, arch] = target.split("-");
|
|
1007
1108
|
const artifact = artifactFor("engram", platform, arch);
|
|
1008
|
-
assert.equal(artifact.version, "3.
|
|
1009
|
-
assert.equal(artifact.url, `https://github.com/Gentleman-Programming/engram/releases/download/v3.
|
|
1109
|
+
assert.equal(artifact.version, "3.7.2");
|
|
1110
|
+
assert.equal(artifact.url, `https://github.com/Gentleman-Programming/engram/releases/download/v3.7.2/engram_3.7.2_${suffix}`);
|
|
1010
1111
|
assert.equal(artifact.integrity, `sha256-${sha256}`);
|
|
1011
1112
|
assert.deepEqual([artifact.size, artifact.maxBytes], [size, size]);
|
|
1012
1113
|
// GitHub serves release assets from its asset hosts.
|