gentle-pi 4.6.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -55
- package/assets/agents/gentle-ai-explore.md +4 -3
- package/assets/agents/gentle-ai-verify.md +23 -6
- package/assets/agents/gentle-ai-worker.md +9 -6
- package/assets/agents/jd-fix-agent.md +1 -0
- package/assets/agents/jd-judge-a.md +2 -3
- package/assets/agents/jd-judge-b.md +2 -3
- package/assets/agents/review-readability.md +1 -5
- package/assets/agents/review-reliability.md +1 -5
- package/assets/agents/review-resilience.md +1 -5
- package/assets/agents/review-risk.md +1 -5
- package/assets/design-canvas/canvas-api.js +45 -0
- package/assets/design-canvas/canvas-boards.js +456 -0
- package/assets/design-canvas/canvas-boot.js +217 -0
- package/assets/design-canvas/canvas-checks.js +491 -0
- package/assets/design-canvas/canvas-comments.js +315 -0
- package/assets/design-canvas/canvas-compare.js +159 -0
- package/assets/design-canvas/canvas-events.js +75 -0
- package/assets/design-canvas/canvas-export.js +393 -0
- package/assets/design-canvas/canvas-focus.js +203 -0
- package/assets/design-canvas/canvas-handoffs.js +150 -0
- package/assets/design-canvas/canvas-i18n-es.js +392 -0
- package/assets/design-canvas/canvas-i18n.js +108 -0
- package/assets/design-canvas/canvas-layout.js +526 -0
- package/assets/design-canvas/canvas-menu.js +213 -0
- package/assets/design-canvas/canvas-messages.js +86 -0
- package/assets/design-canvas/canvas-minimap.js +163 -0
- package/assets/design-canvas/canvas-parts.js +401 -0
- package/assets/design-canvas/canvas-popover.js +234 -0
- package/assets/design-canvas/canvas-rail.js +348 -0
- package/assets/design-canvas/canvas-sizes.js +524 -0
- package/assets/design-canvas/canvas-store.js +164 -0
- package/assets/design-canvas/canvas-tokens.js +674 -0
- package/assets/design-canvas/canvas-ui.js +24 -0
- package/assets/design-canvas/canvas-view.js +184 -0
- package/assets/design-canvas/canvas.css +759 -16
- package/assets/design-canvas/canvas.js +2 -1497
- package/assets/design-canvas/index.html +117 -36
- package/assets/design-canvas/inspector.js +546 -16
- package/assets/install-wizard/wizard.js +6 -1
- package/assets/migrations/agent-body-history.json +40 -1
- package/assets/orchestrator-delegation-reference.md +10 -16
- package/assets/orchestrator-delegation.md +5 -5
- package/assets/orchestrator-full-delegation-card.md +64 -0
- package/assets/orchestrator-full-delegation.md +34 -0
- package/assets/orchestrator-memory.md +5 -5
- package/assets/orchestrator-prompts.md +2 -2
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +14 -13
- package/assets/orchestrator-tracking.md +10 -14
- package/assets/orchestrator-verification.md +12 -8
- package/assets/orchestrator-writer.md +4 -4
- package/assets/orchestrator.md +21 -25
- package/bin/gentle-shell.mjs +292 -65
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/orchestration/pi.md +1 -0
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/routing/pi.md +6 -6
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/agent-status.md +61 -0
- package/docs/assets/brand/sponsor-banner.svg +60 -0
- package/docs/bundled-install.md +20 -10
- package/docs/delegated-verification.md +46 -8
- package/docs/desktop-rpc.md +1253 -0
- package/docs/gentle-agents-activity.md +40 -0
- package/docs/gentle-shell.md +91 -30
- package/docs/install-wizard.md +30 -21
- package/docs/odd-preparation-continuity.md +24 -0
- package/docs/permission-modes.md +17 -4
- package/docs/prompt-budget.md +12 -0
- package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
- package/docs/readme-reference.md +142 -45
- package/docs/render-cache-performance.md +11 -1
- package/docs/review-coordinator.md +53 -0
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/review-request-context.md +19 -0
- package/docs/review-windows-acl.md +18 -0
- package/docs/voice.md +6 -3
- package/docs/work-continuity.md +11 -1
- package/docs/yolo-mode.md +5 -5
- package/extensions/ask-user-choice.ts +1 -0
- package/extensions/ask-user-question.ts +3 -2
- package/extensions/child-context.ts +21 -7
- package/extensions/child-safety.ts +3 -0
- package/extensions/gentle-agent-status.ts +99 -0
- package/extensions/gentle-agents.ts +559 -66
- package/extensions/gentle-ai.ts +2001 -518
- package/extensions/gentle-design.ts +69 -3
- package/extensions/gentle-desktop-rpc.ts +143 -0
- package/extensions/gentle-guide.ts +3 -0
- package/extensions/gentle-shell.ts +398 -115
- package/extensions/gentle-todo.ts +66 -27
- package/extensions/gentle-tps.ts +48 -0
- package/extensions/quiet-tools.ts +38 -8
- package/extensions/skill-registry.ts +349 -167
- package/extensions/startup-banner.ts +30 -3
- package/lib/agent-assets.ts +30 -6
- package/lib/agent-profile-pin.ts +3 -3
- package/lib/agent-profiles.ts +160 -2
- package/lib/agent-status.ts +105 -0
- package/lib/agent-tool-overlay.ts +117 -0
- package/lib/agents-config.ts +93 -6
- package/lib/agents-history.ts +24 -5
- package/lib/agents-message-delivery.ts +17 -0
- package/lib/agents-messaging.ts +55 -7
- package/lib/agents-protocol.ts +15 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-runner.ts +272 -16
- package/lib/agents-session-transport.ts +17 -1
- package/lib/auto-permission-runtime.ts +1 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/bounded-writer-admission.ts +197 -32
- package/lib/card-content-policy.ts +8 -6
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- package/lib/command-palette.ts +133 -17
- package/lib/context-backstop.ts +14 -5
- package/lib/delivery-conflict-markers.ts +349 -0
- package/lib/design-canvas-assets.ts +36 -0
- package/lib/design-canvas-server.ts +241 -23
- package/lib/design-comments.ts +94 -4
- package/lib/design-handoffs.ts +2 -1
- package/lib/design-layout.ts +125 -0
- package/lib/design-parts.ts +281 -0
- package/lib/design-system-tokens.ts +111 -0
- package/lib/desktop-agents-service.ts +294 -0
- package/lib/desktop-design-service.ts +233 -0
- package/lib/desktop-jobs-service.ts +263 -0
- package/lib/desktop-rpc-agents.ts +294 -0
- package/lib/desktop-rpc-config.ts +731 -0
- package/lib/desktop-rpc-design.ts +138 -0
- package/lib/desktop-rpc-jobs.ts +181 -0
- package/lib/desktop-rpc-permissions.ts +177 -0
- package/lib/desktop-rpc-profiles.ts +196 -0
- package/lib/desktop-rpc-usage.ts +229 -0
- package/lib/desktop-rpc.ts +225 -0
- package/lib/desktop-usage-service.ts +310 -0
- package/lib/destructive-command-guard.ts +236 -17
- package/lib/execution-surface-guard.ts +20 -0
- package/lib/exploration-budget.ts +4 -2
- package/lib/gentle-ai-binary.ts +1 -1
- package/lib/gentle-ai-renderer.ts +13 -1
- package/lib/gentle-design.ts +204 -14
- package/lib/gentle-shell-bundled.ts +106 -28
- package/lib/gentle-shell-launcher.ts +43 -8
- package/lib/herdr-activity.ts +14 -2
- package/lib/herdr-busy.ts +45 -0
- package/lib/hidden-tools.ts +35 -0
- package/lib/image-attachments.ts +33 -0
- package/lib/image-disk-cache.ts +137 -0
- package/lib/inprocess-reviewer.ts +358 -144
- package/lib/jobs-view.ts +198 -11
- package/lib/model-fallback-policy.ts +9 -0
- package/lib/model-routing-authority.ts +31 -4
- package/lib/nan-provider.ts +42 -28
- package/lib/native-choice-list.ts +20 -2
- package/lib/native-review-cli.ts +172 -20
- package/lib/orchestrator-discovery.ts +39 -2
- package/lib/orchestrator-mode-policy.ts +105 -0
- package/lib/questionnaire/questionnaire-view.ts +105 -12
- package/lib/rdd-mode-control.ts +32 -0
- package/lib/reply-language-anchor.ts +129 -0
- package/lib/request-context-placement.ts +53 -0
- package/lib/review-blocker.ts +92 -0
- package/lib/review-candidate-symlink-scan.ts +136 -0
- package/lib/review-candidate-view-owner.ts +81 -44
- package/lib/review-candidate-view.ts +11 -1
- package/lib/review-continuation-registry.ts +116 -0
- package/lib/review-coordinator.ts +407 -0
- package/lib/review-delivery-preflight.ts +85 -0
- package/lib/review-failure-facts.ts +49 -0
- package/lib/review-host-relay.ts +51 -11
- package/lib/review-integration-v2.ts +63 -4
- package/lib/review-relay-phase-timing.ts +45 -0
- package/lib/review-start-context.ts +17 -0
- package/lib/reviewer-stream.ts +87 -0
- package/lib/session-profile-freeze.ts +4 -2
- package/lib/shell-bar.ts +140 -58
- package/lib/shell-changes.ts +2 -0
- package/lib/shell-panel.ts +17 -3
- package/lib/shell-prompt.ts +16 -3
- package/lib/shell-sidebar-layout.ts +112 -40
- package/lib/shell-sidebar.ts +7 -0
- package/lib/shell-todo.ts +10 -3
- package/lib/shell-usage.ts +10 -0
- package/lib/verifier-admission.ts +1 -1
- package/lib/vim-editor-adapter.ts +9 -2
- package/lib/visual-customization-policy.ts +36 -16
- package/lib/visual-customize-view.ts +216 -21
- package/lib/visual-layout-preview.ts +9 -5
- package/lib/visual-profiles.ts +2 -2
- package/lib/windows-session-transport.ts +53 -2
- package/lib/writer-batch-admission.ts +55 -0
- package/lib/yolo-session-policy.ts +46 -16
- package/package.json +3 -2
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +37 -0
- package/runtime/gentle-ai-binary.mjs +1 -1
- package/runtime/gentle-shell-bundled.mjs +106 -28
- package/runtime/gentle-shell-launcher.mjs +42 -7
- package/runtime/native-review-cli.mjs +169 -17
- package/runtime/review-integration-v2.mjs +63 -4
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +179 -0
- package/scripts/build-runtime-modules.mjs +1 -0
- package/scripts/bundled-install.mjs +38 -8
- package/scripts/download-progress.mjs +68 -0
- package/scripts/gentle-ai-installer.mjs +41 -18
- package/scripts/gentle-ai-proxy.mjs +294 -0
- package/scripts/install-gentle-ai.mjs +14 -1
- package/scripts/installer-downloads.mjs +34 -8
- package/scripts/installer-preflight.mjs +33 -22
- package/scripts/installer-probes.mjs +25 -5
- package/scripts/installer-runner.mjs +27 -12
- package/scripts/installer-server.mjs +46 -16
- package/scripts/installer-windows.mjs +2 -2
- package/scripts/pi-update.mjs +166 -27
- package/scripts/prepare-verifier.mjs +107 -0
- package/scripts/render-cache-host.mjs +72 -0
- package/scripts/render-cache-performance-worker.mjs +5 -4
- package/scripts/render-cache-performance.mjs +6 -1
- package/scripts/run-test-suite.mjs +40 -28
- package/scripts/update-agent-body-history.mjs +55 -8
- package/scripts/verify-package-files.mjs +50 -19
- package/scripts/voice-worker.cjs +32 -6
- package/skills/branch-pr/SKILL.md +16 -16
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/design/SKILL.md +16 -13
- package/skills/gentle-ai/SKILL.md +7 -7
- package/skills/gentle-ui-design/SKILL.md +46 -0
- package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
- package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
- package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
- package/skills/gentle-ui-design/references/task-and-content.md +60 -0
- package/skills/judgment-day/SKILL.md +2 -2
- package/skills/judgment-day/references/prompts-and-formats.md +1 -1
- package/skills/rdd-defect-workflow/SKILL.md +6 -6
- package/skills/skill-improver/SKILL.md +2 -2
- package/skills/skill-registry/SKILL.md +11 -11
- package/skills/tui-design/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +10 -11
- package/tests/agent-home.test.ts +28 -9
- package/tests/agent-profiles-workflow.test.ts +163 -0
- package/tests/agent-prompt-diet-contract.test.ts +101 -0
- package/tests/agent-risk-escalation.test.ts +1 -1
- package/tests/agent-status.test.ts +143 -0
- package/tests/agent-tool-overlay-acceptance.test.ts +158 -0
- package/tests/agent-tool-overlay.test.ts +89 -0
- package/tests/agents-config.test.ts +106 -1
- package/tests/agents-history.test.ts +31 -0
- package/tests/agents-jobs-frames.test.ts +93 -0
- package/tests/agents-message-delivery.test.ts +36 -0
- package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
- package/tests/agents-queries.test.ts +144 -4
- package/tests/agents-report-cap.test.ts +126 -0
- package/tests/agents-runner-drain.test.ts +193 -0
- package/tests/agents-runner.test.ts +215 -3
- package/tests/agents-session-transport.test.ts +34 -0
- package/tests/always-on-prompt-verdicts-contract.test.ts +188 -0
- package/tests/append-system-prompt-route.test.ts +12 -1
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-choice.test.ts +4 -3
- package/tests/ask-user-question.test.ts +99 -1
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/auto-permission-runtime.test.ts +1 -1
- package/tests/autonomous-guard.test.ts +346 -10
- package/tests/bounded-stop-contract.test.ts +51 -3
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bridge-cost.test.ts +19 -4
- package/tests/bundled-install.test.ts +31 -6
- package/tests/card-content-policy.test.ts +3 -3
- package/tests/chained-pr-skill.test.ts +8 -6
- package/tests/child-context-files.test.ts +64 -8
- package/tests/child-safety.test.ts +11 -0
- package/tests/child-skills-catalog.test.ts +56 -0
- package/tests/codegraph-tools.test.ts +11 -5
- package/tests/codemode-rendering.test.ts +4 -1
- package/tests/command-palette.test.ts +284 -1
- package/tests/delegate-for-reason-contract.test.ts +32 -10
- package/tests/delivery-conflict-markers.test.ts +348 -0
- package/tests/design-canvas-all-sizes.test.ts +631 -0
- package/tests/design-canvas-allowlist.test.ts +32 -0
- package/tests/design-canvas-assets.test.ts +11 -695
- package/tests/design-canvas-boards.test.ts +77 -0
- package/tests/design-canvas-checks.test.ts +655 -0
- package/tests/design-canvas-compare.test.ts +79 -0
- package/tests/design-canvas-events.test.ts +59 -0
- package/tests/design-canvas-export.test.ts +1168 -0
- package/tests/design-canvas-focus.test.ts +113 -0
- package/tests/design-canvas-handoffs.test.ts +59 -0
- package/tests/design-canvas-i18n-review.test.ts +513 -0
- package/tests/design-canvas-i18n-views.test.ts +259 -0
- package/tests/design-canvas-i18n.test.ts +526 -0
- package/tests/design-canvas-inspector.test.ts +937 -0
- package/tests/design-canvas-layout.test.ts +1222 -0
- package/tests/design-canvas-minimap.test.ts +413 -0
- package/tests/design-canvas-modules.test.ts +90 -0
- package/tests/design-canvas-parts.test.ts +721 -0
- package/tests/design-canvas-rail.test.ts +799 -0
- package/tests/design-canvas-server.test.ts +855 -17
- package/tests/design-canvas-sizes.test.ts +548 -0
- package/tests/design-canvas-store.test.ts +180 -0
- package/tests/design-canvas-tokens.test.ts +965 -0
- package/tests/design-canvas-view.test.ts +299 -0
- package/tests/design-comments.test.ts +201 -1
- package/tests/design-handoffs.test.ts +20 -0
- package/tests/design-layout.test.ts +100 -0
- package/tests/design-parts.test.ts +260 -0
- package/tests/design-system-tokens.test.ts +215 -0
- package/tests/desktop-rpc-agents.test.ts +893 -0
- package/tests/desktop-rpc-config.test.ts +1452 -0
- package/tests/desktop-rpc-design.test.ts +662 -0
- package/tests/desktop-rpc-jobs.test.ts +796 -0
- package/tests/desktop-rpc-permissions.test.ts +311 -0
- package/tests/desktop-rpc-profiles.test.ts +140 -0
- package/tests/desktop-rpc-safety.test.ts +119 -0
- package/tests/desktop-rpc-usage.test.ts +697 -0
- package/tests/desktop-rpc.test.ts +252 -0
- package/tests/destructive-command-guard.test.ts +52 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
- package/tests/devbinary/review-session-consent.devtest.ts +84 -0
- package/tests/download-progress.test.ts +71 -0
- package/tests/engram-safety.test.ts +111 -0
- package/tests/execution-surface-guard.test.ts +55 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.captured.json +92 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.provenance.md +3 -0
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +26 -31
- package/tests/fixtures/proxy-tls/proxy.crt +19 -0
- package/tests/fixtures/proxy-tls/proxy.key +28 -0
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
- package/tests/fixtures/session-profile-v1/replay.ts +53 -6
- package/tests/full-delegation-closure.test.ts +160 -0
- package/tests/full-delegation-notices.test.ts +76 -0
- package/tests/generic-agent-tools.test.ts +3 -3
- package/tests/gentle-agent-status.test.ts +74 -0
- package/tests/gentle-agents-child-jobs.test.ts +237 -0
- package/tests/gentle-agents.test.ts +1403 -20
- package/tests/gentle-ai-binary.test.ts +3 -1
- package/tests/gentle-ai-child-guards.test.ts +1 -0
- package/tests/gentle-ai-elapsed-store.test.ts +19 -0
- package/tests/gentle-ai-exploration-budget.test.ts +18 -2
- package/tests/gentle-ai-installer.test.ts +135 -51
- package/tests/gentle-ai-proxy.test.ts +434 -0
- package/tests/gentle-ai-renderer.test.ts +36 -2
- package/tests/gentle-ai.test.ts +233 -43
- package/tests/gentle-design.test.ts +386 -1
- package/tests/gentle-herdr-activity.test.ts +9 -6
- package/tests/gentle-shell-bin.test.ts +123 -0
- package/tests/gentle-shell-bundled.test.ts +293 -31
- package/tests/gentle-shell-launcher.test.ts +78 -11
- package/tests/gentle-shell.test.ts +1017 -146
- package/tests/gentle-todo.test.ts +51 -11
- package/tests/gentle-tps.test.ts +123 -0
- package/tests/gentle-ui-design-skill.test.ts +59 -0
- package/tests/herdr-busy.test.ts +59 -0
- package/tests/herdr-task-summary-policy.test.ts +8 -4
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/image-disk-cache.test.ts +163 -0
- package/tests/independent-recovery-delivery.test.ts +97 -0
- package/tests/inprocess-reviewer.test.ts +249 -4
- package/tests/install-wizard.test.ts +27 -1
- package/tests/installer-downloads.test.ts +30 -1
- package/tests/installer-posix-bootstrap.test.ts +115 -14
- package/tests/installer-preflight.test.ts +54 -5
- package/tests/installer-probes.test.ts +146 -0
- package/tests/installer-runner.test.ts +79 -44
- package/tests/installer-server.test.ts +215 -13
- package/tests/installer-windows-bootstrap.test.ts +19 -1
- package/tests/jobs-view.test.ts +260 -6
- package/tests/judgment-day-severity-admission.test.ts +46 -0
- package/tests/lazy-module-contradictions-contract.test.ts +158 -0
- package/tests/maintainer/desktop-rpc.maintest.ts +632 -0
- package/tests/maintainer/pi-update-source.maintest.ts +48 -18
- package/tests/modal-mouse-boundaries.test.ts +136 -0
- package/tests/model-fallback-policy.test.ts +26 -7
- package/tests/model-routing-authority.test.ts +178 -2
- package/tests/nan-provider-runtime.test.ts +17 -3
- package/tests/nan-provider.test.ts +111 -56
- package/tests/native-choice-list.test.ts +77 -2
- package/tests/native-review-capability-contract.test.ts +17 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
- package/tests/native-review-cli.test.ts +269 -1
- package/tests/native-review-parity.test.ts +24 -5
- package/tests/native-review-refusal-identity.test.ts +25 -0
- package/tests/no-self-pause-contract.test.ts +13 -2
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
- package/tests/odd-routing-contract.test.ts +80 -28
- package/tests/orchestrator-budget.test.ts +35 -5
- package/tests/orchestrator-consultation-sdk.test.ts +32 -6
- package/tests/orchestrator-delegation-mode.test.ts +154 -0
- package/tests/orchestrator-discovery.test.ts +28 -0
- package/tests/orchestrator-mode-policy.test.ts +175 -0
- package/tests/orchestrator-prompt-budget.test.ts +13 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +221 -0
- package/tests/orchestrator-rdd-ownership.test.ts +4 -3
- package/tests/orchestrator-work-search.test.ts +4 -2
- package/tests/package-files.test.ts +25 -1
- package/tests/package-manifest.test.ts +16 -13
- package/tests/parallel-reason-contract.test.ts +6 -3
- package/tests/permission-allowlist.test.ts +372 -0
- package/tests/persona-neutral-voseo.test.ts +4 -4
- package/tests/persona-reply-language.test.ts +1 -1
- package/tests/persona-single-channel.test.ts +13 -5
- package/tests/pi-update-launcher.test.ts +25 -7
- package/tests/pi-update-source.test.ts +113 -6
- package/tests/pi-update.test.ts +294 -19
- package/tests/pnpm-workspace-config.test.ts +58 -0
- package/tests/pnpm-workspace-policy.test.ts +47 -0
- package/tests/primary-context-files.test.ts +233 -0
- package/tests/primary-context-three-files.test.ts +174 -0
- package/tests/primary-session-prompt.test.ts +13 -0
- package/tests/profile-pin.test.ts +29 -2
- package/tests/profile-tier-footer.test.ts +5 -0
- package/tests/profiles-panel-delegation-mode.test.ts +422 -0
- package/tests/provider-defect-handoff.test.ts +9 -2
- package/tests/questionnaire-view.test.ts +115 -0
- package/tests/quiet-bash-runtime.test.ts +1 -1
- package/tests/quiet-tool-rendering.test.ts +48 -0
- package/tests/rdd-aware-verification-contract.test.ts +17 -12
- package/tests/rdd-customize.test.ts +287 -0
- package/tests/rdd-mode-cache.test.ts +450 -0
- package/tests/rdd-mode-control.test.ts +407 -0
- package/tests/rdd-mode-scope-regression.test.ts +137 -0
- package/tests/rdd-off-independent-regression.test.ts +69 -0
- package/tests/rdd-status-line.test.ts +112 -1
- package/tests/render-cache-performance.test.ts +171 -2
- package/tests/reply-language-anchor-placement.test.ts +184 -0
- package/tests/reply-language-anchor.test.ts +189 -0
- package/tests/request-context-append-only.test.ts +218 -0
- package/tests/request-context-placement.test.ts +148 -0
- package/tests/review-agent-end-preflight.test.ts +80 -2
- package/tests/review-blocker.test.ts +193 -0
- package/tests/review-candidate-owner-retry.test.ts +1 -1
- package/tests/review-candidate-symlink-scan.test.ts +157 -0
- package/tests/review-candidate-view.test.ts +66 -1
- package/tests/review-candidate-windows-boundary.test.ts +131 -0
- package/tests/review-candidate-windows-probe.test.ts +63 -0
- package/tests/review-committed-restart-ack.test.ts +129 -0
- package/tests/review-continuation-registry.test.ts +107 -0
- package/tests/review-contract-prompt.test.ts +1 -1
- package/tests/review-controller-native-routing.test.ts +261 -5
- package/tests/review-controller-workspace-root.test.ts +230 -3
- package/tests/review-controller.test.ts +98 -12
- package/tests/review-coordinator-correction-gate.test.ts +105 -0
- package/tests/review-coordinator-findings.test.ts +206 -0
- package/tests/review-coordinator-nonblocking-scope.test.ts +169 -0
- package/tests/review-coordinator-runtime.test.ts +117 -0
- package/tests/review-coordinator.test.ts +462 -0
- package/tests/review-delivery-preflight.test.ts +462 -0
- package/tests/review-due-compaction.test.ts +31 -0
- package/tests/review-due-public-boundary.test.ts +26 -0
- package/tests/review-failure-facts.test.ts +87 -0
- package/tests/review-host-relay-routing.test.ts +258 -4
- package/tests/review-host-relay.test.ts +39 -0
- package/tests/review-integration-nonblocking-findings.test.ts +108 -0
- package/tests/review-integration-v2.test.ts +46 -3
- package/tests/review-json-arguments.test.ts +105 -11
- package/tests/review-last-event-closure.test.ts +68 -0
- package/tests/review-ledger-contract.test.ts +19 -40
- package/tests/review-loadout-rdd-off-sdk.test.ts +95 -32
- package/tests/review-one-call-findings.test.ts +131 -0
- package/tests/review-one-call-followups.test.ts +308 -0
- package/tests/review-one-call-reviewer-requests.test.ts +207 -0
- package/tests/review-one-call.test.ts +452 -0
- package/tests/review-owner-identity.test.ts +60 -24
- package/tests/review-relay-phase-timing.test.ts +128 -0
- package/tests/review-relay-transport-agent.test.ts +39 -2
- package/tests/review-reviewer-evidence.test.ts +223 -0
- package/tests/review-risk-assessment.test.ts +126 -8
- package/tests/review-run-statement-guidance-independent.test.ts +54 -0
- package/tests/review-session-standing-permission-controller.test.ts +53 -3
- package/tests/review-start-context.test.ts +19 -0
- package/tests/review-tool-prose-budget.test.ts +122 -0
- package/tests/reviewer-stream.test.ts +149 -0
- package/tests/run-test-suite.test.ts +122 -1
- package/tests/runtime-harness.mjs +4 -1
- package/tests/sensitive-path-tools.test.ts +181 -5
- package/tests/session-profile-append-controller-pi.test.ts +60 -31
- package/tests/session-profile-binding.test.ts +19 -1
- package/tests/session-profile-disk-reader-pi.test.ts +58 -16
- package/tests/session-profile-extension.test.ts +2 -2
- package/tests/session-profile-v1-compat.test.ts +35 -1
- package/tests/shell-bar.test.ts +186 -42
- package/tests/shell-panel.test.ts +50 -22
- package/tests/shell-prompt.test.ts +17 -0
- package/tests/shell-sidebar-fullscreen.test.ts +5 -5
- package/tests/shell-sidebar-layout.test.ts +294 -23
- package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
- package/tests/shell-surface-transparent.test.ts +89 -0
- package/tests/shell-todo.test.ts +12 -0
- package/tests/shell-usage.test.ts +59 -10
- package/tests/skill-contradictions-contract.test.ts +122 -0
- package/tests/skill-registry-watcher.test.ts +216 -2
- package/tests/skill-registry.test.ts +1461 -5
- package/tests/startup-banner.test.ts +152 -1
- package/tests/startup-home-repo.test.ts +2 -0
- package/tests/support/design-canvas-dom.ts +369 -0
- package/tests/support/review-coordinator-runtime.ts +264 -0
- package/tests/task-size-routing-contract.test.ts +45 -12
- package/tests/test-strength-contract.test.ts +2 -1
- package/tests/todo-request-append-only.test.ts +214 -0
- package/tests/tool-batching-contract.test.ts +3 -1
- package/tests/update-agent-body-history.test.ts +138 -0
- package/tests/verification-tiers-contract.test.ts +229 -0
- package/tests/verifier-admission.test.ts +49 -0
- package/tests/verifier-preparation.test.ts +229 -0
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +162 -11
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/visual-customization-policy.test.ts +39 -6
- package/tests/visual-customize-view.test.ts +573 -9
- package/tests/visual-layout-preview.test.ts +15 -1
- package/tests/visual-profiles.test.ts +11 -0
- package/tests/voice-worker.test.ts +73 -2
- package/tests/windows-session-transport.test.ts +126 -0
- package/tests/work-continuity-contract.test.ts +77 -6
- package/tests/writer-admission-messages.test.ts +232 -0
- package/tests/writer-batch-admission.test.ts +66 -0
- package/tests/writer-edit-surface-scope.test.ts +52 -20
- package/tests/writer-feature-document-admission.test.ts +276 -0
- package/tests/yolo-customize.test.ts +27 -4
- package/tests/yolo-mode.test.ts +62 -18
- package/tests/yolo-session-policy.test.ts +270 -1
- package/skills/_shared/review-ledger-contract.md +0 -106
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -46,6 +46,7 @@ export const blockedReasons = Object.freeze([
|
|
|
46
46
|
/** Every `failedStep` a `failed` outcome can carry (for host guidance; no behavior). */
|
|
47
47
|
export const failedSteps = Object.freeze([
|
|
48
48
|
"prepare-pnpm-home",
|
|
49
|
+
"resolve-pi-version",
|
|
49
50
|
"persist-node",
|
|
50
51
|
"persist-package-managers",
|
|
51
52
|
"persist-npm",
|
|
@@ -101,7 +102,7 @@ const knownActions = Object.freeze({
|
|
|
101
102
|
"record-channel": { kind: "configure", target: "channel" },
|
|
102
103
|
"update-shell-release": { kind: "upgrade", target: "shell" },
|
|
103
104
|
"update-shell-main": { kind: "upgrade", target: "shell" },
|
|
104
|
-
"update-pi": { kind: "upgrade", target: "pi", version:
|
|
105
|
+
"update-pi": { kind: "upgrade", target: "pi", version: "latest" },
|
|
105
106
|
});
|
|
106
107
|
// The clean-stack path: both global packages are missing.
|
|
107
108
|
const requiredActions = ["install-pi", "install-shell", "setup-shell", "verify-readiness"];
|
|
@@ -601,7 +602,7 @@ function noExistingStack(stdout) {
|
|
|
601
602
|
* only Gentle Shell was added), and that runnable Pi (runnablePi) must exist;
|
|
602
603
|
* other projects (such as the persisted npm and pnpm) are ignored.
|
|
603
604
|
*/
|
|
604
|
-
async function verifiedPackageRoot(stdout, pnpmHome, platform, fs, shellVersion = requirements.shell, requirePi = true) {
|
|
605
|
+
async function verifiedPackageRoot(stdout, pnpmHome, platform, fs, shellVersion = requirements.shell, requirePi = true, expectedPi = PI_INSTALL_VERSION) {
|
|
605
606
|
const path = platform === "win32" ? win32 : posix;
|
|
606
607
|
const projects = JSON.parse(stdout);
|
|
607
608
|
if (!Array.isArray(projects)) return null;
|
|
@@ -610,7 +611,7 @@ async function verifiedPackageRoot(stdout, pnpmHome, platform, fs, shellVersion
|
|
|
610
611
|
if (!plainObject(dependencies)) return null;
|
|
611
612
|
const pi = dependencies[PI_PACKAGE];
|
|
612
613
|
const shell = dependencies[SHELL_PACKAGE];
|
|
613
|
-
if ((requirePi && pi?.version !==
|
|
614
|
+
if ((requirePi && (stable(expectedPi) === null || pi?.version !== expectedPi)) || shell?.version !== shellVersion) return null;
|
|
614
615
|
if (typeof shell.path !== "string" || !path.isAbsolute(shell.path)) return null;
|
|
615
616
|
const [root, home] = [await fs.realpath(shell.path), await fs.realpath(pnpmHome)];
|
|
616
617
|
if (!contains(home, root, platform)) return null;
|
|
@@ -906,6 +907,7 @@ export async function runStandardInstall(request, adapters) {
|
|
|
906
907
|
let runsPi = null;
|
|
907
908
|
let persistentNode = null;
|
|
908
909
|
let npmPrefix = null;
|
|
910
|
+
let piVersion = null;
|
|
909
911
|
// One add of only the missing managers (fixed versions only: never a blanket build approval).
|
|
910
912
|
const addOnly = ids.find((id) => ["persist-package-managers", "persist-npm", "persist-pnpm"].includes(id));
|
|
911
913
|
const addManagers = [addOnly, async () => succeeded(await runPnpm(["add", "-g", ...(addNpm ? [`npm@${persistencePins.npm}`] : []),
|
|
@@ -931,7 +933,7 @@ export async function runStandardInstall(request, adapters) {
|
|
|
931
933
|
// from the same owner at the target version, never a downgrade.
|
|
932
934
|
const piSteps = updatingPi ? [
|
|
933
935
|
["update-pi", async () => {
|
|
934
|
-
const spec = `${PI_PACKAGE}@${
|
|
936
|
+
const spec = `${PI_PACKAGE}@${piVersion}`;
|
|
935
937
|
const result = installedPi.owner === "npm"
|
|
936
938
|
? await adapters.run(npmCommand.command, [...npmCommand.prefix, "install", "-g", spec], { env, deadlineMs: deadlines.install })
|
|
937
939
|
: await runPnpm(["add", "-g", spec], deadlines.install);
|
|
@@ -940,7 +942,7 @@ export async function runStandardInstall(request, adapters) {
|
|
|
940
942
|
["verify-updated-pi", async () => {
|
|
941
943
|
const after = await adapters.locatePi();
|
|
942
944
|
if (!after || after.owner !== installedPi.owner || typeof after.root !== "string" || !path.isAbsolute(after.root)) return false;
|
|
943
|
-
if (
|
|
945
|
+
if (after.version !== piVersion) return false;
|
|
944
946
|
// npm replaces the package in place; pnpm 11 moves it to a new global directory.
|
|
945
947
|
return after.owner === "pnpm" || samePath(after.root, installedPi.root, platform);
|
|
946
948
|
}],
|
|
@@ -972,7 +974,7 @@ export async function runStandardInstall(request, adapters) {
|
|
|
972
974
|
] : [];
|
|
973
975
|
// Pi and gentle-pi stay separate pnpm groups, so `pi update` (which replaces Pi's
|
|
974
976
|
// own group) never removes gentle-pi; gentle-pi gets pnpm's peer Pi beside it.
|
|
975
|
-
const install = ["install-global", () => addGlobal([...(shellOnly ? [] : [`${PI_PACKAGE}@${
|
|
977
|
+
const install = ["install-global", () => addGlobal([...(shellOnly ? [] : [`${PI_PACKAGE}@${piVersion}`]),
|
|
976
978
|
`${SHELL_PACKAGE}@${requirements.shell}`, `--allow-build=${SHELL_PACKAGE}`], buildEnv())];
|
|
977
979
|
function mainSteps() {
|
|
978
980
|
const channel = adapters.mainChannel;
|
|
@@ -996,7 +998,7 @@ export async function runStandardInstall(request, adapters) {
|
|
|
996
998
|
const result = await list();
|
|
997
999
|
if (!succeeded(result)) return false;
|
|
998
1000
|
const verified = await verifiedPackageRoot(String(result.stdout ?? ""), globalBin.pnpmHome, platform, adapters.fs,
|
|
999
|
-
mainVersion(requirements.shell, shellCommit), !shellOnly);
|
|
1001
|
+
mainVersion(requirements.shell, shellCommit), !shellOnly, piVersion);
|
|
1000
1002
|
if (verified === null) return false;
|
|
1001
1003
|
({ root: packageRoot, pi: runsPi } = verified);
|
|
1002
1004
|
return true;
|
|
@@ -1016,7 +1018,8 @@ export async function runStandardInstall(request, adapters) {
|
|
|
1016
1018
|
["verify-global-list", async () => {
|
|
1017
1019
|
const result = await list();
|
|
1018
1020
|
if (!succeeded(result)) return false;
|
|
1019
|
-
const verified = await verifiedPackageRoot(String(result.stdout ?? ""), globalBin.pnpmHome, platform, adapters.fs, requirements.shell, !shellOnly
|
|
1021
|
+
const verified = await verifiedPackageRoot(String(result.stdout ?? ""), globalBin.pnpmHome, platform, adapters.fs, requirements.shell, !shellOnly,
|
|
1022
|
+
recovering ? PI_INSTALL_VERSION : piVersion);
|
|
1020
1023
|
if (verified === null) return false;
|
|
1021
1024
|
({ root: packageRoot, pi: runsPi } = verified);
|
|
1022
1025
|
return true;
|
|
@@ -1043,7 +1046,7 @@ export async function runStandardInstall(request, adapters) {
|
|
|
1043
1046
|
const setupStep = steps.find(([name]) => name === "shell-setup");
|
|
1044
1047
|
steps.splice(0, steps.length,
|
|
1045
1048
|
...goSteps,
|
|
1046
|
-
...(ids.includes("install-pi") ? [["install-pi", async () => succeeded(await runPnpm(["add", "-g", `${PI_PACKAGE}@${
|
|
1049
|
+
...(ids.includes("install-pi") ? [["install-pi", async () => succeeded(await runPnpm(["add", "-g", `${PI_PACKAGE}@${piVersion}`], deadlines.install))]] : []),
|
|
1047
1050
|
...piSteps,
|
|
1048
1051
|
["update-shell", withMainDetail(async () => (await adapters.upgradeShell({ channel, packageRoot: installed.root, currentVersion: installed.version,
|
|
1049
1052
|
...(pinnedGo ? { goPath: pinnedGo } : {}) })) === true)],
|
|
@@ -1069,14 +1072,26 @@ export async function runStandardInstall(request, adapters) {
|
|
|
1069
1072
|
if (piOnly) {
|
|
1070
1073
|
// The installer's Pi alone: the same `add -g` as install-pi, then found in pnpm's list.
|
|
1071
1074
|
steps.splice(0, steps.length, ...(updatingPi ? piSteps : [
|
|
1072
|
-
["install-pi", async () => succeeded(await runPnpm(["add", "-g", `${PI_PACKAGE}@${
|
|
1075
|
+
["install-pi", async () => succeeded(await runPnpm(["add", "-g", `${PI_PACKAGE}@${piVersion}`], deadlines.install))],
|
|
1073
1076
|
["verify-installed-pi", async () => {
|
|
1074
1077
|
const after = await adapters.locatePi();
|
|
1075
1078
|
return after?.owner === "pnpm" && typeof after.root === "string" && path.isAbsolute(after.root) &&
|
|
1076
|
-
|
|
1079
|
+
after.version === piVersion;
|
|
1077
1080
|
}],
|
|
1078
1081
|
]));
|
|
1079
1082
|
}
|
|
1083
|
+
if (ids.includes("install-pi") || updatingPi) {
|
|
1084
|
+
// Resolve before any package/runtime installation; never trust registry output
|
|
1085
|
+
// as an argument until it is an exact stable version meeting the minimum.
|
|
1086
|
+
steps.unshift(["resolve-pi-version", async () => {
|
|
1087
|
+
const result = await runPnpm(["view", `${PI_PACKAGE}@latest`, "version"], deadlines.probe);
|
|
1088
|
+
const version = String(result.stdout ?? "").trim();
|
|
1089
|
+
if (!succeeded(result) || result.truncated === true || !atLeast(version, requirements.pi) ||
|
|
1090
|
+
(installedPi && !atLeast(version, installedPi.version))) return false;
|
|
1091
|
+
piVersion = version;
|
|
1092
|
+
return true;
|
|
1093
|
+
}]);
|
|
1094
|
+
}
|
|
1080
1095
|
const persistPath = !globalBin.onPath && (privateHome || (!update && !piOnly));
|
|
1081
1096
|
if (persistPath) {
|
|
1082
1097
|
steps.push(["persist-path", async () => {
|
|
@@ -1096,7 +1111,7 @@ export async function runStandardInstall(request, adapters) {
|
|
|
1096
1111
|
log({ step, status: "done" });
|
|
1097
1112
|
}
|
|
1098
1113
|
// Reported only when Gentle Shell runs a Pi other than the installer's.
|
|
1099
|
-
const prefix = { ...(persistRuntime ? { npmPrefix } : {}), ...(runsPi !== null && runsPi !== PI_INSTALL_VERSION ? { piVersion: runsPi } : {}) };
|
|
1114
|
+
const prefix = { ...(persistRuntime ? { npmPrefix } : {}), ...(runsPi !== null && runsPi !== (piVersion ?? request.plan.tools.pi.version ?? PI_INSTALL_VERSION) ? { piVersion: runsPi } : {}) };
|
|
1100
1115
|
if (persistPath) return { outcome: "terminal-action-required", action: "open-new-terminal", completed, ...prefix };
|
|
1101
1116
|
return { outcome: "ready", completed, ...prefix };
|
|
1102
1117
|
}
|
|
@@ -2,7 +2,8 @@ import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import { createServer } from "node:http";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
|
-
import {
|
|
5
|
+
import { nodeRequirementClauses, nodeRequirementSatisfied } from "./installer-downloads.mjs";
|
|
6
|
+
import { goAcquisition, requirements } from "./installer-preflight.mjs";
|
|
6
7
|
|
|
7
8
|
// Local wizard host: a dependency-free loopback HTTP server with a fixed route
|
|
8
9
|
// allowlist. The browser never sends commands, paths, plans or environment:
|
|
@@ -71,8 +72,8 @@ export const actionDescriptions = Object.freeze({
|
|
|
71
72
|
"persist-pnpm": "Install pnpm under PNPM_HOME with `pnpm add -g`.",
|
|
72
73
|
"acquire-go": "Download the installer's pinned Go from go.dev and verify it, only to build Gentle AI.",
|
|
73
74
|
"verify-go": "Check that the downloaded Go runs and reports the pinned version.",
|
|
74
|
-
"install-pi": "
|
|
75
|
-
"install-shell": `Install Gentle Shell (gentle-pi) globally with pnpm. pnpm may put
|
|
75
|
+
"install-pi": "Resolve the latest stable Pi and install that exact version globally with pnpm.",
|
|
76
|
+
"install-shell": `Install Gentle Shell (gentle-pi) globally with pnpm. pnpm may put another Pi next to it ` +
|
|
76
77
|
`(at least Pi ${requirements.pi}), and Gentle Shell runs that Pi.`,
|
|
77
78
|
"provision-native": "Provision the package-native Gentle AI binary with the existing installer.",
|
|
78
79
|
"setup-shell": "Run the normal `gentle-shell setup`.",
|
|
@@ -135,6 +136,7 @@ export const guidance = Object.freeze({
|
|
|
135
136
|
"build-gentle-ai-main": `Gentle AI could not be built from its latest \`main\` commit. Check your network connection and that \`go\` runs in a terminal. ${tryAgain}`,
|
|
136
137
|
"install-shell-main": `Gentle Shell could not be installed from its latest \`main\` commit. Check your network connection. ${tryAgain}`,
|
|
137
138
|
"record-channel": "Gentle Shell is installed from `main`, but the channel could not be saved under `~/.pi/gentle-ai`. Check that folder's permissions, then run the installer again.",
|
|
139
|
+
"resolve-pi-version": `The latest stable Pi could not be resolved or did not meet the minimum. No packages were installed. Check your network connection. ${tryAgain}`,
|
|
138
140
|
"install-pi": `Installing Pi with pnpm failed. Your existing Gentle Shell was not changed. Check your network connection. ${tryAgain}`,
|
|
139
141
|
"update-shell": "Updating Gentle Shell failed. Run `gentle-shell upgrade` in a terminal to see the details.",
|
|
140
142
|
"verify-updated-shell": "Gentle Shell did not report the expected version after the update. Run `gentle-shell --version`, then `gentle-shell upgrade` in a terminal.",
|
|
@@ -247,6 +249,19 @@ const unmanaged = Object.freeze({
|
|
|
247
249
|
shell: "Gentle Shell is already installed, but neither pnpm nor npm manages it (a linked source checkout, for example), so this installer cannot update it. Nothing was replaced. Update it the way you installed it, then select Check again.",
|
|
248
250
|
});
|
|
249
251
|
const STABLE = /^v?(\d{1,6})\.(\d{1,6})\.(\d{1,6})$/;
|
|
252
|
+
/** Plain-language requirement: "1.2.0 or newer" for a minimum, and for a Node
|
|
253
|
+
* range such as ^22.19.0 || >=23.6.0 "22.19.0 or a later 22.x release, or 23.6.0 or newer". */
|
|
254
|
+
function describeRequirement(required) {
|
|
255
|
+
if (STABLE.test(required)) return `${required} or newer`;
|
|
256
|
+
const clauses = nodeRequirementClauses(required);
|
|
257
|
+
if (!clauses) return null;
|
|
258
|
+
return clauses.map(({ caret, floor }) => caret ? `${floor.join(".")} or a later ${floor[0]}.x release` : `${floor.join(".")} or newer`).join(", or ");
|
|
259
|
+
}
|
|
260
|
+
/** A found version that does not meet a minimum or Node range; false when unknown. */
|
|
261
|
+
function unmet(found, required) {
|
|
262
|
+
if (STABLE.test(required)) return older(found, required);
|
|
263
|
+
return STABLE.test(found) && nodeRequirementClauses(required) !== null && !nodeRequirementSatisfied(required, found);
|
|
264
|
+
}
|
|
250
265
|
function older(found, required) {
|
|
251
266
|
const [a, b] = [STABLE.exec(found), STABLE.exec(required)];
|
|
252
267
|
if (!a || !b) return false;
|
|
@@ -338,10 +353,10 @@ function blockerGuidance(blocker, inventory, plan) {
|
|
|
338
353
|
// An older Node left next to the bootstrap's copy is recorded in the plan.
|
|
339
354
|
const found = plan.tools?.[blocker.tool]?.found ?? inventory?.[blocker.tool]?.version;
|
|
340
355
|
const required = plan.tools?.[blocker.tool]?.required;
|
|
341
|
-
if (typeof found !== "string" || typeof required !== "string" || !
|
|
356
|
+
if (typeof found !== "string" || typeof required !== "string" || !unmet(found, required)) return fixed;
|
|
342
357
|
const version = found.replace(/^v/, "");
|
|
343
358
|
const remedy = tool.remedy ? tool.remedy(required) : "Update it";
|
|
344
|
-
return `${tool.label} ${version} is installed${tool.where}, but this installer needs ${required}
|
|
359
|
+
return `${tool.label} ${version} is installed${tool.where}, but this installer needs ${describeRequirement(required)}. Nothing was replaced. ${remedy}, then select Check again.`;
|
|
345
360
|
}
|
|
346
361
|
|
|
347
362
|
/** An older Pi's update names its found and target versions and the package
|
|
@@ -351,12 +366,12 @@ function actionDescription(action, plan) {
|
|
|
351
366
|
const pi = plan.tools?.pi;
|
|
352
367
|
const stable = (...versions) => versions.every((version) => typeof version === "string" && STABLE.test(version));
|
|
353
368
|
const bare = (version) => version.replace(/^v/, "");
|
|
354
|
-
if (action.id === "update-pi" && ["pnpm", "npm"].includes(pi?.owner) && stable(pi.version, pi.required
|
|
355
|
-
return `Update Pi ${bare(pi.version)} to
|
|
369
|
+
if (action.id === "update-pi" && action.version === "latest" && ["pnpm", "npm"].includes(pi?.owner) && stable(pi.version, pi.required)) {
|
|
370
|
+
return `Update Pi ${bare(pi.version)} to the latest stable version with ${pi.owner}, the package manager that installed it. ` +
|
|
356
371
|
`Gentle Shell needs Pi ${bare(pi.required)} or newer.`;
|
|
357
372
|
}
|
|
358
373
|
if (action.id === "install-pi" && pi?.status === "needs-install" && stable(pi.version)) {
|
|
359
|
-
return `Install Pi
|
|
374
|
+
return `Install the latest stable Pi globally with pnpm for Gentle Shell. The Pi ${bare(pi.version)} already on this computer ` +
|
|
360
375
|
"was not installed with pnpm or npm, so it is left unchanged. Gentle Shell uses the installer's Pi; the `pi` command in a terminal may still run the older one.";
|
|
361
376
|
}
|
|
362
377
|
// The pinned Go: its version, the Go found (older, unchecked or missing), and what stays unchanged.
|
|
@@ -370,23 +385,36 @@ function actionDescription(action, plan) {
|
|
|
370
385
|
return actionDescriptions[action.id] ?? "Prepare the installation.";
|
|
371
386
|
}
|
|
372
387
|
|
|
373
|
-
/** An
|
|
374
|
-
*
|
|
388
|
+
/** An unsupported Node or incompatible pnpm beside the installer's pinned copy:
|
|
389
|
+
* found and pinned versions, and whether persistence replaces the found Node.
|
|
375
390
|
* Nothing promises PATH precedence: a version manager may prepend its own again.
|
|
376
391
|
*/
|
|
377
392
|
function alongsideNotes(plan) {
|
|
378
393
|
const notes = [];
|
|
379
394
|
const node = plan.tools?.node;
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
395
|
+
const needs = typeof node?.required === "string" ? describeRequirement(node.required) : null;
|
|
396
|
+
if (STABLE.test(node?.found ?? "") && STABLE.test(node.version ?? "") && needs !== null) {
|
|
397
|
+
const persisting = plan.actions.some((action) => action.id === "persist-node");
|
|
398
|
+
const replacing = node.foundInGlobalBin === true && persisting;
|
|
399
|
+
const foundOnPath = persisting && node.globalBinNode === true ? " found first on PATH" : "";
|
|
400
|
+
notes.push(replacing
|
|
401
|
+
? `Node.js ${node.found} on this computer is not a version Gentle Shell supports (it needs ${needs}). ` +
|
|
402
|
+
`Your Node.js ${node.found} is managed by pnpm under $PNPM_HOME and will be replaced by the pinned Node.js ${node.version}.`
|
|
403
|
+
: `Node.js ${node.found} on this computer is not a version Gentle Shell supports (it needs ${needs}), so the installer uses its pinned Node.js ${node.version} ` +
|
|
404
|
+
`and installs it under $PNPM_HOME. Your Node.js ${node.found}${foundOnPath} is left unchanged.`);
|
|
383
405
|
}
|
|
384
406
|
const pnpm = plan.tools?.pnpm;
|
|
385
407
|
if (STABLE.test(pnpm?.found ?? "") && STABLE.test(pnpm.version ?? "")) {
|
|
386
408
|
notes.push(`pnpm ${pnpm.found} on this computer is not a pnpm ${pnpm.version.split(".")[0]} release this installer can use, ` +
|
|
387
409
|
`so the installer uses its pinned pnpm ${pnpm.version} and installs it under $PNPM_HOME. Your pnpm ${pnpm.found} is left unchanged.`);
|
|
388
410
|
}
|
|
389
|
-
|
|
411
|
+
const hasAlongside = notes.length > 0;
|
|
412
|
+
const persistNode = plan.actions.find((action) => action.id === "persist-node");
|
|
413
|
+
if (persistNode && node?.globalBinNode === true && node.foundInGlobalBin !== true) {
|
|
414
|
+
const pin = STABLE.test(persistNode.version ?? "") ? ` ${persistNode.version}` : "";
|
|
415
|
+
notes.push(`The Node.js already in $PNPM_HOME will be replaced by the pinned Node.js${pin}.`);
|
|
416
|
+
}
|
|
417
|
+
if (hasAlongside) notes.push("A version manager such as `mise activate` may still put your own versions first on PATH in new terminals.");
|
|
390
418
|
return notes;
|
|
391
419
|
}
|
|
392
420
|
|
|
@@ -493,6 +521,7 @@ function planView(planId, { inventory, plan }) {
|
|
|
493
521
|
const changesProfile = ids.includes("setup-global-bin") || (privateHome !== null && inventory?.globalBin?.onPath !== true);
|
|
494
522
|
let tools = [];
|
|
495
523
|
const alongside = alongsideNotes(plan);
|
|
524
|
+
const replacesNode = ids.includes("persist-node") && (plan.tools?.node?.foundInGlobalBin === true || plan.tools?.node?.globalBinNode === true);
|
|
496
525
|
// A persistent pnpm next to a bootstrap-only Node is kept (persist-npm), never replaced.
|
|
497
526
|
if (ids.includes("persist-node")) tools = ids.includes("persist-npm") ? ["node", "npm"] : ["node", "npm", "pnpm"];
|
|
498
527
|
else if (ids.includes("persist-package-managers")) tools = ["npm", "pnpm"];
|
|
@@ -527,8 +556,9 @@ function planView(planId, { inventory, plan }) {
|
|
|
527
556
|
persistence: {
|
|
528
557
|
tools,
|
|
529
558
|
pnpmHome,
|
|
559
|
+
...(replacesNode ? { replacesNode: true } : {}),
|
|
530
560
|
description: tools.length > 0
|
|
531
|
-
? [`${tools.join(", ")} will be installed under $PNPM_HOME (${pnpmHome ?? "pnpm's home directory"}) so new terminals keep working after the temporary installer tools are removed
|
|
561
|
+
? [`${tools.join(", ")} will be installed under $PNPM_HOME (${pnpmHome ?? "pnpm's home directory"}) so new terminals keep working after the temporary installer tools are removed.${replacesNode ? "" : " Existing installations are not replaced."}`, ...alongside, ...(unchecked ? [unchecked] : [])].join(" ")
|
|
532
562
|
: unchecked ? `No runtime needs to be installed under $PNPM_HOME. ${unchecked}`
|
|
533
563
|
: "No runtime needs to be installed under $PNPM_HOME; your existing Node.js, npm and pnpm are reused.",
|
|
534
564
|
},
|
|
@@ -558,7 +588,7 @@ function outcomeView(result) {
|
|
|
558
588
|
} else {
|
|
559
589
|
view.guidance = guidance.outcomes[result.outcome];
|
|
560
590
|
// The Pi Gentle Shell runs, when pnpm put one other than the installer's next to it.
|
|
561
|
-
if (typeof result.piVersion === "string" && STABLE.test(result.piVersion)
|
|
591
|
+
if (typeof result.piVersion === "string" && STABLE.test(result.piVersion)) {
|
|
562
592
|
view.guidance += ` Gentle Shell runs Pi ${result.piVersion.replace(/^v/, "")}, which pnpm installed next to it.`;
|
|
563
593
|
}
|
|
564
594
|
if (result.action === "open-new-terminal") view.action = "open-new-terminal";
|
|
@@ -2,7 +2,7 @@ import { lstatSync, readdirSync, readFileSync, realpathSync, mkdirSync, writeFil
|
|
|
2
2
|
import { dirname, extname, join, parse, resolve, win32 } from "node:path";
|
|
3
3
|
import { spawnSync } from "node:child_process";
|
|
4
4
|
import { gunzipSync } from "node:zlib";
|
|
5
|
-
import { artifactFor, verifiedDownload, compatibleEngine, launchWizard, pinnedPnpmCompatible } from "./installer-downloads.mjs";
|
|
5
|
+
import { artifactFor, verifiedDownload, compatibleEngine, launchWizard, nodeRequirementSatisfied, pinnedPnpmCompatible } from "./installer-downloads.mjs";
|
|
6
6
|
|
|
7
7
|
export const windowsNodeFloor = ">=24.3.0";
|
|
8
8
|
const maxExpandedBytes = 128 * 1024 * 1024;
|
|
@@ -765,7 +765,7 @@ export async function bootstrapWindows({ bundle, tools, env }) {
|
|
|
765
765
|
if (!regular(join(bundle, file))) throw new Error("Required wizard bundle file missing");
|
|
766
766
|
}
|
|
767
767
|
const metadata = JSON.parse(readFileSync(join(bundle, "package.json"), "utf8"));
|
|
768
|
-
if (!compatibleEngine(windowsNodeFloor, process.versions.node) || !
|
|
768
|
+
if (!compatibleEngine(windowsNodeFloor, process.versions.node) || !nodeRequirementSatisfied(metadata.engines?.node, process.versions.node) || metadata.packageManager !== `pnpm@${artifactFor("pnpm").version}`) throw new Error("Windows repository prerequisite rejected");
|
|
769
769
|
step = "tools-storage";
|
|
770
770
|
verifyWindowsStorage(tools, env);
|
|
771
771
|
const result = await ensureWindowsPnpm({ tools, env, onStep: (next) => { step = next; } });
|
package/scripts/pi-update.mjs
CHANGED
|
@@ -9,6 +9,7 @@ const object = value => value !== null && typeof value === 'object' && !Array.is
|
|
|
9
9
|
const succeeded = result => result?.code === 0 && !result.timedOut && result.signal == null;
|
|
10
10
|
const refusal = detail => new Error(`gentle-shell update: ownership ${detail}; update Pi with the package manager or source checkout that supplies the selected runtime. No installation changed.`);
|
|
11
11
|
const LINKED = /^(?:file|link|workspace):/i;
|
|
12
|
+
const STABLE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
12
13
|
// A main-channel Shell (`<version>-main.<sha12>`, scripts/main-channel.mjs
|
|
13
14
|
// mainVersion) is never published; it exists only as the packed tarball.
|
|
14
15
|
const MAIN_BUILD = /^[0-9A-Za-z.+-]+-main\.[0-9a-f]{12}$/;
|
|
@@ -130,7 +131,7 @@ async function listedEntries(groups, {adapters, path, key, canonical}) {
|
|
|
130
131
|
const set = members.get(key(groupRoot)) ?? new Set();
|
|
131
132
|
set.add(pkg);
|
|
132
133
|
members.set(key(groupRoot), set);
|
|
133
|
-
if (pkg === PI || pkg === SHELL) entries.push({pkg, dependency, groupRoot});
|
|
134
|
+
if (pkg === PI || pkg === SHELL) entries.push({pkg, dependency, groupRoot, listingRoot: path.isAbsolute(group.path) ? key(group.path) : null});
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
return {entries, members};
|
|
@@ -231,9 +232,9 @@ async function sourceOwner({root, linkPath, manifest, selected, adapters, path,
|
|
|
231
232
|
if (!succeeded(listing) || !Array.isArray(projects) || projects.length !== 1 || key(await canonical(projects[0]?.path)) !== key(root)) throw refusal('source workspace has other or unknown projects; update Pi from the workspace owner');
|
|
232
233
|
}
|
|
233
234
|
const flags = pin[1] === 'pnpm' ? ['--dir', root, '--lockfile-dir', root, '--recursive=false', '--ignore-pnpmfile', ...(sourceConfig === undefined ? [] : ['--workspace-root'])] : ['--prefix', root, '--workspaces=false', '--no-audit', '--no-fund'];
|
|
234
|
-
return {name:pin[1], ...invocation, package:SHELL, spec:PI, sourceRoot:root, sourceConfig, sourceEnv, linkPath,
|
|
235
|
+
return {name:pin[1], ...invocation, package:SHELL, spec:PI, sourceRoot:root, sourceConfig, sourceEnv, sourceOptions, linkPath,
|
|
235
236
|
manifest:await adapters.fs.readFile(path.join(root, 'package.json'), 'utf8'),
|
|
236
|
-
args:['update', PI, '--no-save', '--ignore-scripts', '--global=false', ...flags, ...sourceOptions]};
|
|
237
|
+
args:[pin[1] === 'pnpm' ? 'update' : 'install', PI, '--no-save', '--ignore-scripts', '--global=false', ...flags, ...sourceOptions]};
|
|
237
238
|
}
|
|
238
239
|
|
|
239
240
|
export async function resolveUpdateOwner({runtime, packageRoot, platform = process.platform, adapters, cwd, env, home}) {
|
|
@@ -248,7 +249,7 @@ export async function resolveUpdateOwner({runtime, packageRoot, platform = proce
|
|
|
248
249
|
if (!invocation) continue;
|
|
249
250
|
const groups = await globalListing(name, invocation, adapters, cwd);
|
|
250
251
|
const {entries, members} = await listedEntries(groups, {adapters, path, key, canonical});
|
|
251
|
-
for (const {pkg, dependency, groupRoot} of entries) {
|
|
252
|
+
for (const {pkg, dependency, groupRoot, listingRoot} of entries) {
|
|
252
253
|
if ((pkg === SHELL) !== adjacent) continue;
|
|
253
254
|
const linked = dependency.link === true || [dependency.resolved, dependency.version].some(value => typeof value === 'string' && LINKED.test(value));
|
|
254
255
|
const root = await canonical(dependency.path);
|
|
@@ -280,34 +281,169 @@ export async function resolveUpdateOwner({runtime, packageRoot, platform = proce
|
|
|
280
281
|
}
|
|
281
282
|
if (key(cli) !== key(selected)) continue;
|
|
282
283
|
if (name === 'pnpm' && members.get(key(groupRoot)).size !== 1) throw refusal('selected supplier shares its global install group');
|
|
283
|
-
|
|
284
|
+
// Keep the listing snapshot and selected identity: pnpm may replace both
|
|
285
|
+
// this group and the versioned store root during the same installation.
|
|
286
|
+
candidates.push({name, ...invocation, package:pkg, spec, artifact, groupRoot, listingRoot, members,
|
|
287
|
+
from:dependency.from, shellVersion:pkg === SHELL ? manifest.version : undefined});
|
|
284
288
|
}
|
|
285
289
|
}
|
|
286
290
|
if (candidates.length !== 1) throw refusal(candidates.length > 1 ? 'is ambiguous' : 'could not be verified from global listings');
|
|
287
291
|
return candidates[0];
|
|
288
292
|
}
|
|
289
293
|
|
|
294
|
+
// Registry queries run in the same manager/config context as the install.
|
|
295
|
+
function viewIn(owner, input, args) {
|
|
296
|
+
const scope = owner.sourceRoot
|
|
297
|
+
? owner.name === 'pnpm' ? ['--dir', owner.sourceRoot, ...owner.sourceOptions] : ['--prefix', owner.sourceRoot, '--workspaces=false']
|
|
298
|
+
: owner.name === 'pnpm' ? ['--config.global=true'] : [];
|
|
299
|
+
return input.adapters.run(owner.command, [...owner.prefix, 'view', ...args, ...scope],
|
|
300
|
+
{deadlineMs:60_000, cwd:owner.sourceRoot ?? input.cwd, ...(owner.sourceEnv ? {env:owner.sourceEnv} : {})});
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Only a stable registry tag may become an install argument; never trust arbitrary output.
|
|
304
|
+
async function latestPublishedPi(owner, input) {
|
|
305
|
+
const result = await viewIn(owner, input, [`${PI}@latest`, 'version']);
|
|
306
|
+
if (!succeeded(result) || result.truncated) throw new Error(`gentle-shell update: the latest published Pi could not be resolved (${owner.name} view failed). No installation changed.`);
|
|
307
|
+
const version = String(result.stdout ?? '').trim();
|
|
308
|
+
if (!STABLE.test(version)) throw new Error(`gentle-shell update: the latest published Pi version ${JSON.stringify(version)} was rejected. No installation changed.`);
|
|
309
|
+
return version;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const SIBLING = /^@earendil-works\/[a-z0-9][a-z0-9._-]*$/;
|
|
313
|
+
const MAX_SIBLINGS = 32;
|
|
314
|
+
// An exact version as pnpm accepts it in a minimumReleaseAgeExclude union.
|
|
315
|
+
const EXACT = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
316
|
+
|
|
317
|
+
// The published dependencies of one exact version, checked against its identity.
|
|
318
|
+
async function publishedDependencies(owner, input, name, version) {
|
|
319
|
+
const result = await viewIn(owner, input, [`${name}@${version}`, '--json']);
|
|
320
|
+
try {
|
|
321
|
+
const manifest = JSON.parse(String(result.stdout ?? ''));
|
|
322
|
+
const dependencies = manifest?.dependencies ?? {};
|
|
323
|
+
if (!succeeded(result) || result.truncated || !object(manifest) || manifest.name !== name || manifest.version !== version ||
|
|
324
|
+
!object(dependencies) || Object.values(dependencies).some(range => typeof range !== 'string')) throw new Error('invalid');
|
|
325
|
+
return Object.entries(dependencies).filter(([dependency, range]) => SIBLING.test(dependency) && dependency !== PI && STABLE.test(range));
|
|
326
|
+
} catch { throw new Error(`gentle-shell update: the published dependencies of ${name === PI ? 'Pi ' : `${name}@`}${version} could not be verified. No installation changed.`); }
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** Every Pi-scope package, as [name, version], that the selected Pi pins to an
|
|
330
|
+
* exact stable version directly or through such a pinned package (pi-ai pins
|
|
331
|
+
* pi-schema). They are published with Pi, so no older version can satisfy
|
|
332
|
+
* them, and pnpm's strict release-age mode cannot approve them under
|
|
333
|
+
* --no-save. Ranges, prereleases and other scopes stay age-filtered. The walk
|
|
334
|
+
* visits each package version once and is bounded.
|
|
335
|
+
*/
|
|
336
|
+
async function piSiblings(owner, input, version) {
|
|
337
|
+
const found = new Map();
|
|
338
|
+
let pending = await publishedDependencies(owner, input, PI, version);
|
|
339
|
+
while (pending.length) {
|
|
340
|
+
const level = [];
|
|
341
|
+
for (const [name, exact] of pending) {
|
|
342
|
+
if (found.has(`${name}@${exact}`)) continue;
|
|
343
|
+
if (found.size >= MAX_SIBLINGS) throw new Error(`gentle-shell update: Pi ${version} pins more than ${MAX_SIBLINGS} @earendil-works packages; their release age could not be verified. No installation changed.`);
|
|
344
|
+
found.set(`${name}@${exact}`, [name, exact]);
|
|
345
|
+
level.push([name, exact]);
|
|
346
|
+
}
|
|
347
|
+
pending = (await Promise.all(level.map(([name, exact]) => publishedDependencies(owner, input, name, exact)))).flat();
|
|
348
|
+
}
|
|
349
|
+
return [...found.values()];
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// pnpm's matcher (parseVersionPolicyRule) splits a rule at the `@` after a scope.
|
|
353
|
+
function exclusionName(entry) {
|
|
354
|
+
const at = entry.startsWith('@') ? entry.indexOf('@', 1) : entry.indexOf('@');
|
|
355
|
+
return at === -1 ? {name:entry, versions:null} : {name:entry.slice(0, at), versions:entry.slice(at + 1)};
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// CLI values replace pnpm's configured list, so read the effective list in the
|
|
359
|
+
// install context and pass it back intact with Pi and its exact siblings added.
|
|
360
|
+
// pnpm applies only the first rule naming a package, so a new version joins
|
|
361
|
+
// that name's existing rule as one `name@a || b` union (a bare name already
|
|
362
|
+
// covers every version); a rule it cannot merge safely is refused. pnpm
|
|
363
|
+
// represents a single CLI value as a string, not an array; repeat it when the
|
|
364
|
+
// list has one entry.
|
|
365
|
+
async function piAgeExclusion(owner, input, siblings) {
|
|
366
|
+
const scope = owner.sourceRoot ? ['--dir', owner.sourceRoot, ...owner.sourceOptions] : ['--global'];
|
|
367
|
+
const result = await input.adapters.run(owner.command, [...owner.prefix, 'config', 'get', 'minimumReleaseAgeExclude', '--json', ...scope],
|
|
368
|
+
{deadlineMs:30_000, cwd:owner.sourceRoot ?? input.cwd, ...(owner.sourceEnv ? {env:owner.sourceEnv} : {})});
|
|
369
|
+
const invalid = () => new Error('gentle-shell update: pnpm release-age exclusions could not be verified. No installation changed.');
|
|
370
|
+
let entries;
|
|
371
|
+
try {
|
|
372
|
+
const text = String(result.stdout ?? '').trim();
|
|
373
|
+
entries = text === '' || text === 'undefined' ? [] : JSON.parse(text);
|
|
374
|
+
if (typeof entries === 'string') entries = [entries];
|
|
375
|
+
if (!succeeded(result) || result.truncated || !Array.isArray(entries) || entries.some(entry => typeof entry !== 'string' || !entry)) throw new Error('invalid');
|
|
376
|
+
} catch { throw invalid(); }
|
|
377
|
+
// Wanted versions per name, in order; null means every version (Pi itself).
|
|
378
|
+
const wanted = new Map([[PI, null]]);
|
|
379
|
+
for (const [name, version] of siblings) if (wanted.get(name) !== null) wanted.set(name, [...(wanted.get(name) ?? []), version]);
|
|
380
|
+
const merged = new Map();
|
|
381
|
+
for (const entry of entries) {
|
|
382
|
+
const {name, versions} = exclusionName(entry);
|
|
383
|
+
if (!wanted.has(name)) continue;
|
|
384
|
+
const listed = versions === null ? null : versions.split('||').map(version => version.trim());
|
|
385
|
+
if (listed?.some(version => !EXACT.test(version))) throw invalid();
|
|
386
|
+
const before = merged.has(name) ? merged.get(name) : [];
|
|
387
|
+
merged.set(name, before === null || listed === null ? null : [...before, ...listed]);
|
|
388
|
+
}
|
|
389
|
+
const rule = name => {
|
|
390
|
+
const versions = merged.has(name) && merged.get(name) === null || wanted.get(name) === null ? null : [...new Set([...(merged.get(name) ?? []), ...wanted.get(name)])];
|
|
391
|
+
return versions === null ? name : `${name}@${versions.join(' || ')}`;
|
|
392
|
+
};
|
|
393
|
+
const placed = new Set();
|
|
394
|
+
const list = [];
|
|
395
|
+
for (const entry of entries) {
|
|
396
|
+
const {name} = exclusionName(entry);
|
|
397
|
+
if (!wanted.has(name)) list.push(entry);
|
|
398
|
+
else if (!placed.has(name)) { placed.add(name); list.push(rule(name)); }
|
|
399
|
+
}
|
|
400
|
+
for (const name of wanted.keys()) if (!placed.has(name)) list.push(rule(name));
|
|
401
|
+
if (list.length === 1) list.push(list[0]);
|
|
402
|
+
return list.map(entry => `--config.minimum-release-age-exclude=${entry}`);
|
|
403
|
+
}
|
|
404
|
+
|
|
290
405
|
/** The Pi version the owner's package now supplies, read back from a fresh
|
|
291
|
-
* listing after the install; null when
|
|
406
|
+
* listing after the install; null when continuity or identity is uncertain.
|
|
292
407
|
*/
|
|
293
408
|
async function suppliedPiVersion(owner, {platform, adapters, cwd}) {
|
|
294
409
|
const {path, key} = pathsFor(platform);
|
|
295
410
|
const canonical = canonicalWith(adapters, path);
|
|
296
411
|
try {
|
|
297
412
|
const groups = await globalListing(owner.name, owner, adapters, cwd);
|
|
298
|
-
const {entries} = await listedEntries(groups, {adapters, path, key, canonical});
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
413
|
+
const {entries, members} = await listedEntries(groups, {adapters, path, key, canonical});
|
|
414
|
+
const removed = [...owner.members.keys()].filter(group => !members.has(group));
|
|
415
|
+
const added = [...members.keys()].filter(group => !owner.members.has(group));
|
|
416
|
+
// An unchanged group must keep its complete membership. A replacement can
|
|
417
|
+
// be attributed only when the selected group alone disappeared and exactly
|
|
418
|
+
// one group appeared; never select a package just because it is first/latest.
|
|
419
|
+
for (const [group, before] of owner.members) {
|
|
420
|
+
const after = members.get(group);
|
|
421
|
+
if (after && (before.size !== after.size || [...before].some(pkg => !after.has(pkg)))) return null;
|
|
422
|
+
}
|
|
423
|
+
let target;
|
|
424
|
+
if (removed.length === 0 && added.length === 0) target = key(owner.groupRoot);
|
|
425
|
+
else if (owner.name === 'pnpm' && owner.listingRoot && removed.length === 1 && removed[0] === key(owner.groupRoot) && added.length === 1) target = added[0];
|
|
426
|
+
else return null;
|
|
427
|
+
const matches = entries.filter(entry => entry.pkg === owner.package && key(entry.groupRoot) === target);
|
|
428
|
+
if (matches.length !== 1 || (owner.name === 'pnpm' && members.get(target)?.size !== 1)) return null;
|
|
429
|
+
const {pkg, dependency, groupRoot, listingRoot} = matches[0];
|
|
430
|
+
if (listingRoot !== owner.listingRoot || (owner.from !== undefined && typeof owner.from !== 'string') || dependency.from !== owner.from ||
|
|
431
|
+
dependency.link === true || [dependency.resolved, dependency.version].some(value => typeof value === 'string' && LINKED.test(value))) return null;
|
|
432
|
+
const root = await canonical(dependency.path);
|
|
433
|
+
const manifest = await manifestOf(adapters, path, root);
|
|
434
|
+
if (manifest.name !== pkg || typeof manifest.version !== 'string' || !manifest.version ||
|
|
435
|
+
(dependency.version !== undefined && dependency.version !== manifest.version)) return null;
|
|
436
|
+
if (pkg === PI) {
|
|
437
|
+
if (manifest.bin?.pi !== 'dist/bundle/cli.js') return null;
|
|
438
|
+
const cli = await canonical(path.join(root, manifest.bin.pi));
|
|
439
|
+
return key(cli) === key(path.join(root, manifest.bin.pi)) ? manifest.version : null;
|
|
306
440
|
}
|
|
441
|
+
if (manifest.version !== owner.shellVersion) return null;
|
|
442
|
+
const peer = await adjacentPeer({shellRoot: root, groupRoot, adapters, path, key, canonical});
|
|
443
|
+
return typeof peer?.manifest.version === 'string' && peer.manifest.version ? peer.manifest.version : null;
|
|
307
444
|
} catch {
|
|
308
445
|
return null;
|
|
309
446
|
}
|
|
310
|
-
return null;
|
|
311
447
|
}
|
|
312
448
|
|
|
313
449
|
export async function updateSelectedPi(input) {
|
|
@@ -318,9 +454,15 @@ export async function updateSelectedPi(input) {
|
|
|
318
454
|
try { await input.adapters.fs.realpath(owner.spec); }
|
|
319
455
|
catch { throw new Error(`gentle-shell update: the main-channel build ${owner.spec} is missing, and this unpublished build cannot be reinstalled from the registry; run 'gentle-shell upgrade --channel release' and then 'gentle-shell upgrade --channel main' to rebuild it. No installation changed.`); }
|
|
320
456
|
}
|
|
457
|
+
const latest = await latestPublishedPi(owner, input);
|
|
458
|
+
const ageExclusion = owner.name === 'pnpm' ? await piAgeExclusion(owner, input, await piSiblings(owner, input, latest)) : [];
|
|
321
459
|
// Exactly one approved package per command; never create a comma group or
|
|
322
|
-
// reinstall arbitrary dependencies merely because they share a store.
|
|
323
|
-
|
|
460
|
+
// reinstall arbitrary dependencies merely because they share a store. The
|
|
461
|
+
// exact global Pi version is transient, not a source manifest pin.
|
|
462
|
+
const spec = owner.package === PI ? `${PI}@${latest}` : owner.spec;
|
|
463
|
+
const args = owner.args ? owner.args.map(arg => arg === PI ? `${PI}@${latest}` : arg)
|
|
464
|
+
: (owner.name === 'pnpm' ? ['add', '-g', spec, ...(owner.package === SHELL ? ['--allow-build=gentle-pi'] : [])] : ['install', '-g', spec, ...(owner.package === PI ? ['--ignore-scripts'] : [])]);
|
|
465
|
+
args.push(...ageExclusion);
|
|
324
466
|
const result = await input.adapters.run(owner.command, [...owner.prefix, ...args], {deadlineMs:20 * 60_000, cwd: owner.sourceRoot ?? input.cwd, stderrTail:4096, ...(owner.sourceEnv ? {env:owner.sourceEnv} : {})});
|
|
325
467
|
if (!succeeded(result)) {
|
|
326
468
|
// One sanitized line of the manager's own error: npm prints it on stderr,
|
|
@@ -328,7 +470,7 @@ export async function updateSelectedPi(input) {
|
|
|
328
470
|
// error line in either stream wins over a stderr warning, stderr's on a tie.
|
|
329
471
|
const output = [result?.stdout, result?.stderrTail].filter(text => typeof text === 'string').join('\n');
|
|
330
472
|
const detail = setupErrorDetail(output, input.home, input.platform);
|
|
331
|
-
throw new Error(`gentle-shell update: ${owner.name} (${[owner.command, ...owner.prefix].join(' ')}) could not install ${owner.spec}${detail ? `\n${detail}` : ''}`);
|
|
473
|
+
throw new Error(`gentle-shell update: ${owner.name} (${[owner.command, ...owner.prefix].join(' ')}) could not install ${owner.sourceRoot ? `${PI}@${latest}` : spec}${detail ? `\n${detail}` : ''}`);
|
|
332
474
|
}
|
|
333
475
|
if (owner.sourceRoot) {
|
|
334
476
|
const {path, key} = pathsFor(input.platform ?? process.platform);
|
|
@@ -345,19 +487,16 @@ export async function updateSelectedPi(input) {
|
|
|
345
487
|
if (peer && key(peer.cli) === key(nested)) after = peer.manifest.version ?? null;
|
|
346
488
|
} catch { /* Never invent readback after a successful manager invocation. */ }
|
|
347
489
|
const location = `${owner.name} updated ${PI} in ${owner.sourceRoot}`;
|
|
490
|
+
if (after !== null && after !== latest) throw new Error(`gentle-shell update: ${owner.name} supplied Pi ${after}, not the latest published Pi ${latest}; inspect the source checkout before retrying.`);
|
|
348
491
|
if (after === null) input.out?.(`${location}. The Pi version could not be read back; run 'gentle-shell --version' to check it.`);
|
|
349
|
-
else {
|
|
350
|
-
input.out?.(`${location}; the selected Pi is ${after === input.currentVersion ? 'still' : 'now'} ${after}${after !== input.currentVersion && input.currentVersion !== undefined ? ` (was ${input.currentVersion})` : ''}.`);
|
|
351
|
-
if (after === input.currentVersion && owner.name === 'pnpm') input.out?.('The declared version range and pnpm minimumReleaseAge setting still apply; neither was overridden.');
|
|
352
|
-
}
|
|
492
|
+
else input.out?.(`${location}; the selected Pi is ${after === input.currentVersion ? 'still' : 'now'} ${after}${after !== input.currentVersion && input.currentVersion !== undefined ? ` (was ${input.currentVersion})` : ''}.`);
|
|
353
493
|
return 0;
|
|
354
494
|
}
|
|
355
495
|
const after = await suppliedPiVersion(owner, input);
|
|
356
496
|
const before = input.currentVersion;
|
|
357
|
-
if (after
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
} else input.out?.(`${owner.name} installed ${owner.spec}; the selected Pi is now ${after}${before !== undefined ? ` (was ${before})` : ''}.`);
|
|
497
|
+
if (after !== null && after !== latest) throw new Error(`gentle-shell update: ${owner.name} supplied Pi ${after}, not the latest published Pi ${latest}; inspect the installation before retrying.`);
|
|
498
|
+
if (after === null) input.out?.(`${owner.name} installed ${spec}. The Pi version it now supplies could not be read back; run 'gentle-shell --version' to check it.`);
|
|
499
|
+
else if (before !== undefined && after === before) input.out?.(`${owner.name} installed ${spec}, and the selected Pi is still ${after}.`);
|
|
500
|
+
else input.out?.(`${owner.name} installed ${spec}; the selected Pi is now ${after}${before !== undefined ? ` (was ${before})` : ''}.`);
|
|
362
501
|
return 0;
|
|
363
502
|
}
|