gentle-pi 4.5.1 → 4.7.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 +17 -15
- package/assets/agents/gentle-ai-explore.md +1 -0
- package/assets/agents/gentle-ai-verify.md +8 -1
- package/assets/agents/gentle-ai-worker.md +4 -0
- package/assets/agents/jd-fix-agent.md +1 -0
- package/assets/agents/jd-judge-a.md +1 -0
- package/assets/agents/jd-judge-b.md +1 -0
- package/assets/design-canvas/canvas.css +13 -1
- package/assets/design-canvas/canvas.js +11 -2
- package/assets/install-wizard/wizard.js +1 -0
- package/assets/migrations/agent-body-history.json +162 -0
- package/assets/orchestrator-delegation-reference.md +7 -7
- package/assets/orchestrator-delegation.md +3 -3
- package/assets/orchestrator-full-delegation-card.md +65 -0
- package/assets/orchestrator-full-delegation.md +34 -0
- package/assets/orchestrator-memory.md +3 -3
- package/assets/orchestrator-prompts.md +1 -1
- package/assets/orchestrator-skills.md +1 -1
- package/assets/orchestrator-verification.md +14 -8
- package/assets/orchestrator.md +11 -11
- package/bin/gentle-shell.mjs +225 -82
- package/docs/agent-status.md +61 -0
- package/docs/bundled-install.md +7 -5
- package/docs/ci-performance.md +11 -0
- package/docs/delegated-verification.md +35 -7
- package/docs/fast-mode.md +15 -0
- package/docs/gentle-agents-activity.md +22 -0
- package/docs/gentle-shell.md +113 -25
- package/docs/install-wizard.md +2 -2
- package/docs/mcp-status.md +52 -0
- package/docs/permission-modes.md +9 -4
- package/docs/prompt-budget.md +28 -0
- package/docs/readme-reference.md +154 -50
- package/docs/render-cache-performance.md +11 -1
- package/docs/review-coordinator.md +33 -0
- package/docs/review-request-context.md +19 -0
- package/docs/review-windows-acl.md +18 -0
- package/docs/session-profile-format.md +20 -5
- package/docs/sound-notifications.md +1 -1
- package/docs/star-prompt.md +32 -0
- package/docs/voice.md +6 -3
- package/docs/work-continuity.md +46 -0
- package/docs/yolo-mode.md +5 -5
- package/extensions/ask-user-choice.ts +1 -0
- package/extensions/ask-user-question.ts +2 -0
- package/extensions/child-safety.ts +3 -0
- package/extensions/codegraph-tools.ts +38 -4
- package/extensions/gentle-agent-status.ts +99 -0
- package/extensions/gentle-agents.ts +803 -84
- package/extensions/gentle-ai.ts +2491 -596
- package/extensions/gentle-fast.ts +61 -0
- package/extensions/gentle-guide.ts +174 -0
- package/extensions/gentle-herdr-activity.ts +21 -1
- package/extensions/gentle-herdr-agent.ts +144 -0
- package/extensions/gentle-program-identity.ts +61 -0
- package/extensions/gentle-shell.ts +895 -120
- package/extensions/gentle-star-prompt.ts +334 -0
- package/extensions/gentle-stats.ts +5 -5
- package/extensions/gentle-todo.ts +59 -23
- package/extensions/gentle-tps.ts +48 -0
- package/extensions/history/store.ts +18 -12
- package/extensions/quiet-tools.ts +38 -8
- package/extensions/skill-registry.ts +210 -21
- package/extensions/startup-banner.ts +69 -10
- package/lib/agent-assets.ts +74 -17
- package/lib/agent-profile-pin.ts +3 -3
- package/lib/agent-profiles.ts +161 -3
- package/lib/agent-status.ts +105 -0
- package/lib/agents-config.ts +58 -3
- package/lib/agents-history.ts +24 -5
- package/lib/agents-keys.ts +8 -16
- package/lib/agents-messaging.ts +47 -5
- package/lib/agents-protocol.ts +80 -4
- package/lib/agents-runner.ts +287 -15
- package/lib/agents-view.ts +6 -1
- package/lib/agents-widget.ts +132 -9
- package/lib/auto-permission-runtime.ts +1 -1
- package/lib/bounded-writer-admission.ts +13 -1
- package/lib/bridge-cost.ts +28 -0
- package/lib/card-content-policy.ts +8 -6
- package/lib/codemode-renderer.ts +16 -0
- package/lib/command-palette-catalog.ts +1 -0
- package/lib/command-palette.ts +154 -25
- package/lib/context-backstop.ts +14 -5
- package/lib/destructive-command-guard.ts +48 -4
- package/lib/execution-surface-guard.ts +20 -0
- package/lib/exploration-budget.ts +64 -0
- package/lib/gentle-ai-binary.ts +1 -1
- package/lib/gentle-design.ts +3 -0
- package/lib/gentle-guide.ts +201 -0
- package/lib/gentle-shell-bundled.ts +6 -19
- package/lib/gentle-shell-launcher.ts +47 -8
- package/lib/herdr-activity.ts +23 -5
- package/lib/herdr-busy.ts +45 -0
- package/lib/herdr-task-summary-policy.ts +85 -0
- package/lib/image-attachments.ts +33 -0
- package/lib/image-disk-cache.ts +137 -0
- package/lib/inprocess-reviewer.ts +282 -132
- package/lib/jobs-sidebar-state.ts +5 -6
- package/lib/jobs-view.ts +198 -11
- package/lib/jobs-widget.ts +16 -52
- package/lib/keymaps-customize.ts +81 -0
- package/lib/keymaps.ts +291 -0
- package/lib/model-fallback-notice.ts +61 -0
- package/lib/model-fallback-policy.ts +141 -0
- package/lib/model-fallback-store.ts +143 -0
- package/lib/model-routing-authority.ts +32 -6
- package/lib/nan-provider.ts +3 -2
- package/lib/native-choice-list.ts +20 -2
- package/lib/native-review-cli.ts +103 -21
- package/lib/notification-customize.ts +48 -51
- package/lib/openai-fast-tier.ts +22 -0
- package/lib/orchestrator-discovery.ts +5 -1
- package/lib/orchestrator-fallback.ts +75 -0
- package/lib/orchestrator-mode-policy.ts +105 -0
- package/lib/pasted-image-paths.ts +113 -0
- package/lib/questionnaire/questionnaire-view.ts +225 -18
- package/lib/rdd-mode-control.ts +32 -0
- package/lib/reply-language-anchor.ts +104 -0
- package/lib/review-blocker.ts +92 -0
- package/lib/review-candidate-symlink-scan.ts +136 -0
- package/lib/review-candidate-view-owner.ts +85 -44
- package/lib/review-candidate-view.ts +10 -7
- package/lib/review-continuation-registry.ts +99 -0
- package/lib/review-coordinator.ts +163 -0
- package/lib/review-failure-facts.ts +49 -0
- package/lib/review-host-relay.ts +51 -11
- package/lib/review-integration-v2.ts +29 -8
- package/lib/review-relay-phase-timing.ts +45 -0
- package/lib/review-repository.ts +5 -0
- package/lib/review-start-context.ts +17 -0
- package/lib/session-profile-append-controller.ts +21 -6
- package/lib/session-profile-authority.ts +119 -0
- package/lib/session-profile-binding.ts +54 -5
- package/lib/session-profile-freeze.ts +107 -9
- package/lib/session-profile-integration.ts +313 -0
- package/lib/session-profile-persistence.ts +63 -9
- package/lib/shell-bar.ts +269 -72
- package/lib/shell-card.ts +26 -6
- package/lib/shell-changes.ts +2 -0
- package/lib/shell-page.ts +120 -0
- package/lib/shell-panel.ts +163 -0
- package/lib/shell-prompt.ts +53 -1
- package/lib/shell-sidebar-layout.ts +198 -53
- package/lib/shell-sidebar.ts +61 -1
- package/lib/shell-stats.ts +123 -0
- package/lib/shell-todo.ts +79 -1
- package/lib/shell-usage.ts +12 -2
- package/lib/star-prompt.ts +197 -0
- package/lib/verifier-admission.ts +18 -8
- package/lib/verifier-settle-reminder.ts +64 -0
- package/lib/vim-editor-adapter.ts +6 -1
- package/lib/visual-customization-policy.ts +67 -12
- package/lib/visual-customize-view.ts +373 -40
- package/lib/visual-layout-preview.ts +47 -0
- package/lib/visual-profiles.ts +2 -2
- package/lib/windows-session-transport.ts +53 -2
- package/lib/yolo-session-policy.ts +68 -16
- package/package.json +2 -1
- package/runtime/gentle-ai-binary.mjs +1 -1
- package/runtime/gentle-shell-bundled.mjs +6 -19
- package/runtime/gentle-shell-launcher.mjs +46 -7
- package/runtime/native-review-cli.mjs +100 -18
- package/runtime/review-integration-v2.mjs +29 -8
- package/runtime/windows-session-transport.ps1 +60 -3
- package/scripts/bootstrap.sh +4 -1
- package/scripts/build-full-delegation-card.mjs +175 -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-preflight.mjs +6 -6
- package/scripts/installer-runner.mjs +27 -12
- package/scripts/installer-server.mjs +8 -7
- package/scripts/pi-update.mjs +113 -3
- 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 +41 -13
- package/scripts/shell-snapshot.mjs +340 -0
- package/scripts/test-packed-runner.mjs +1 -1
- package/scripts/update-agent-body-history.mjs +41 -0
- package/scripts/verify-installer-tap.mjs +45 -0
- package/scripts/verify-package-files.mjs +14 -2
- package/scripts/voice-worker.cjs +32 -6
- package/skills/design/SKILL.md +11 -8
- package/skills/gentle-ai/SKILL.md +4 -4
- 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/skill-registry/SKILL.md +4 -2
- package/skills/tui-design/NOTICE.md +5 -0
- package/skills/tui-design/SKILL.md +56 -0
- package/skills/tui-design/references/commands.md +75 -0
- package/skills/tui-design/references/critique.md +48 -0
- package/skills/tui-design/references/design-doc.md +44 -0
- package/skills/tui-design/references/terminal-craft.md +64 -0
- package/skills/tui-design/references/visual-loop.md +32 -0
- package/skills/work-unit-commits/SKILL.md +6 -7
- package/tests/agent-home.test.ts +28 -9
- package/tests/agent-profiles-workflow.test.ts +163 -0
- package/tests/agent-risk-escalation.test.ts +1 -1
- package/tests/agent-status.test.ts +143 -0
- package/tests/agents-config.test.ts +96 -0
- package/tests/agents-history.test.ts +31 -0
- package/tests/agents-jobs-frames.test.ts +93 -0
- package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
- package/tests/agents-protocol.test.ts +53 -1
- package/tests/agents-runner-drain.test.ts +193 -0
- package/tests/agents-runner.test.ts +345 -4
- package/tests/agents-view.test.ts +27 -0
- package/tests/agents-widget.test.ts +312 -10
- package/tests/append-system-prompt-route.test.ts +4 -1
- package/tests/ask-user-choice.test.ts +4 -3
- package/tests/ask-user-question.test.ts +97 -0
- package/tests/auto-permission-runtime.test.ts +1 -1
- package/tests/autonomous-guard.test.ts +346 -10
- package/tests/bounded-scan-contract.test.ts +39 -0
- package/tests/bounded-stop-contract.test.ts +43 -3
- package/tests/bridge-cost.test.ts +47 -0
- package/tests/bundled-install.test.ts +36 -9
- package/tests/card-content-policy.test.ts +3 -3
- package/tests/chained-pr-skill.test.ts +8 -6
- package/tests/child-safety.test.ts +11 -0
- package/tests/ci-concurrency.test.ts +11 -0
- package/tests/ci-merge-base-identity.test.ts +114 -0
- package/tests/codegraph-tools.test.ts +80 -5
- package/tests/codemode-rendering.test.ts +22 -2
- package/tests/command-palette.test.ts +300 -3
- package/tests/commit-slice-signal.test.ts +11 -9
- package/tests/delegate-for-reason-contract.test.ts +8 -7
- package/tests/design-canvas-assets.test.ts +185 -2
- package/tests/destructive-command-guard.test.ts +52 -0
- package/tests/download-progress.test.ts +71 -0
- package/tests/execution-surface-guard.test.ts +55 -0
- package/tests/exploration-budget.test.ts +128 -0
- package/tests/fixtures/agent-assets/gentle-ai-worker.strict-tdd-era.md +122 -0
- package/tests/fixtures/measure-orchestrator-prompt.mjs +2 -1
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +26 -14
- package/tests/fixtures/proxy-tls/proxy.crt +19 -0
- package/tests/fixtures/proxy-tls/proxy.key +28 -0
- package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
- package/tests/fixtures/session-profile-v1/replay.ts +172 -0
- package/tests/fixtures/session-profile-v1/session-profile-authority.ts +113 -0
- package/tests/fixtures/session-profile-v1/session-profile-binding.ts +83 -0
- package/tests/fixtures/session-profile-v1/session-profile-disk-reader.ts +182 -0
- package/tests/fixtures/session-profile-v1/session-profile-freeze.ts +290 -0
- package/tests/fixtures/session-profile-v1/session-profile-persistence.ts +195 -0
- package/tests/fixtures/session-profile-v1/v1-inputs.ts +16 -0
- package/tests/fixtures/windows-pipe-availability.ps1 +26 -0
- package/tests/fixtures/windows-session-bootstrap.ps1 +6 -2
- package/tests/full-delegation-closure.test.ts +131 -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 +1491 -38
- package/tests/gentle-ai-binary.test.ts +3 -1
- package/tests/gentle-ai-elapsed-store.test.ts +19 -0
- package/tests/gentle-ai-exploration-budget.test.ts +151 -0
- package/tests/gentle-ai-installer.test.ts +134 -51
- package/tests/gentle-ai-proxy.test.ts +434 -0
- package/tests/gentle-ai.test.ts +1101 -52
- package/tests/gentle-design.test.ts +21 -0
- package/tests/gentle-fast.test.ts +73 -0
- package/tests/gentle-guide.test.ts +208 -0
- package/tests/gentle-herdr-activity.test.ts +80 -3
- package/tests/gentle-herdr-agent.test.ts +111 -0
- package/tests/gentle-program-identity.test.ts +197 -0
- package/tests/gentle-shell-bin.test.ts +172 -26
- package/tests/gentle-shell-bundled.test.ts +207 -31
- package/tests/gentle-shell-launcher.test.ts +93 -10
- package/tests/gentle-shell.test.ts +1937 -66
- package/tests/gentle-stats.test.ts +15 -2
- package/tests/gentle-todo.test.ts +67 -4
- 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 +132 -0
- package/tests/history-store-private-mode.test.ts +40 -0
- package/tests/image-disk-cache.test.ts +163 -0
- package/tests/image-paste-chips.test.ts +42 -0
- package/tests/independent-recovery-delivery.test.ts +83 -0
- package/tests/inprocess-reviewer.test.ts +298 -4
- package/tests/installer-posix-bootstrap.test.ts +68 -6
- package/tests/installer-preflight.test.ts +5 -4
- package/tests/installer-runner.test.ts +79 -44
- package/tests/installer-server.test.ts +14 -11
- package/tests/installer-windows-diagnostics.test.ts +4 -5
- package/tests/isolated-config-home.ts +28 -0
- package/tests/jobs-view.test.ts +260 -6
- package/tests/jobs-widget.test.ts +25 -37
- package/tests/keymaps-customize.test.ts +114 -0
- package/tests/keymaps.test.ts +103 -0
- package/tests/maintainer/mcp-status.maintest.ts +88 -0
- package/tests/maintainer/pi-update-source.maintest.ts +116 -0
- package/tests/modal-mouse-boundaries.test.ts +136 -0
- package/tests/model-fallback-notice.test.ts +45 -0
- package/tests/model-fallback-policy.test.ts +83 -0
- package/tests/model-fallback-store.test.ts +111 -0
- package/tests/model-routing-authority.test.ts +178 -2
- package/tests/nan-provider.test.ts +4 -4
- package/tests/native-choice-list.test.ts +77 -2
- package/tests/native-review-capability-contract.test.ts +7 -1
- package/tests/native-review-cli.test.ts +269 -1
- package/tests/no-self-pause-contract.test.ts +22 -0
- package/tests/notification-customize.test.ts +58 -34
- package/tests/odd-routing-canonical-ratchet.test.ts +6 -6
- package/tests/odd-routing-contract.test.ts +1 -1
- package/tests/orchestrator-budget.test.ts +7 -2
- package/tests/orchestrator-delegation-mode.test.ts +153 -0
- package/tests/orchestrator-fallback.test.ts +82 -0
- package/tests/orchestrator-mode-policy.test.ts +175 -0
- package/tests/orchestrator-prompt-budget.test.ts +133 -0
- package/tests/orchestrator-rdd-ownership.test.ts +2 -2
- package/tests/package-manifest.test.ts +169 -14
- package/tests/pasted-image-paths.test.ts +118 -0
- package/tests/permission-allowlist.test.ts +202 -0
- package/tests/persona-reply-language.test.ts +20 -1
- package/tests/pi-update-launcher.test.ts +40 -8
- package/tests/pi-update-source.test.ts +162 -0
- package/tests/pnpm-workspace-config.test.ts +58 -0
- package/tests/primary-session-prompt.test.ts +13 -0
- package/tests/profile-fast-tier.test.ts +311 -0
- package/tests/profile-pin.test.ts +29 -2
- package/tests/profile-tier-footer.test.ts +84 -0
- package/tests/profiles-panel-delegation-mode.test.ts +422 -0
- package/tests/questionnaire-view.test.ts +265 -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 +16 -11
- 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 +18 -0
- package/tests/render-cache-performance.test.ts +171 -2
- package/tests/reply-language-anchor.test.ts +173 -0
- package/tests/review-agent-end-preflight.test.ts +1 -1
- package/tests/review-blocker.test.ts +193 -0
- package/tests/review-candidate-owner-retry.test.ts +1 -1
- package/tests/review-candidate-owner-sweep.test.ts +93 -0
- package/tests/review-candidate-symlink-scan.test.ts +157 -0
- package/tests/review-candidate-view.test.ts +52 -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 +76 -0
- package/tests/review-controller-native-routing.test.ts +381 -11
- package/tests/review-controller-workspace-root.test.ts +230 -3
- package/tests/review-controller.test.ts +96 -11
- package/tests/review-coordinator-runtime.test.ts +117 -0
- package/tests/review-coordinator.test.ts +195 -0
- package/tests/review-failure-facts.test.ts +87 -0
- package/tests/review-gate.test.ts +24 -0
- package/tests/review-host-relay-routing.test.ts +258 -4
- package/tests/review-host-relay.test.ts +39 -0
- package/tests/review-inspect-preflight.test.ts +197 -0
- package/tests/review-integration-v2-forward.test.ts +59 -0
- package/tests/review-integration-v2.test.ts +46 -3
- package/tests/review-json-arguments.test.ts +65 -10
- package/tests/review-last-event-closure.test.ts +68 -0
- package/tests/review-loadout-rdd-off-sdk.test.ts +65 -31
- 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 +12 -2
- package/tests/review-repository.test.ts +52 -1
- package/tests/review-reviewer-evidence.test.ts +183 -0
- package/tests/review-risk-assessment.test.ts +74 -3
- package/tests/review-session-standing-permission-controller.test.ts +21 -1
- package/tests/review-sidebar-state.test.ts +5 -5
- package/tests/review-start-context.test.ts +19 -0
- package/tests/review-tool-prose-budget.test.ts +121 -0
- package/tests/run-test-suite.test.ts +183 -6
- package/tests/runtime-harness.mjs +4 -1
- package/tests/sensitive-path-tools.test.ts +250 -0
- package/tests/session-profile-append-controller-pi.test.ts +60 -31
- package/tests/session-profile-append-controller.test.ts +63 -0
- package/tests/session-profile-authority.test.ts +259 -0
- package/tests/session-profile-binding.test.ts +34 -1
- package/tests/session-profile-disk-reader-pi.test.ts +58 -16
- package/tests/session-profile-extension.test.ts +615 -0
- package/tests/session-profile-freeze.test.ts +110 -2
- package/tests/session-profile-integration.test.ts +857 -0
- package/tests/session-profile-persistence.test.ts +57 -0
- package/tests/session-profile-v1-compat.test.ts +255 -0
- package/tests/shell-bar.test.ts +274 -72
- package/tests/shell-card.test.ts +13 -1
- package/tests/shell-page.test.ts +108 -0
- package/tests/shell-panel.test.ts +360 -0
- package/tests/shell-prompt.test.ts +54 -0
- package/tests/shell-render-cache.test.ts +5 -0
- package/tests/shell-sidebar-fullscreen.test.ts +13 -1
- package/tests/shell-sidebar-layout.test.ts +447 -44
- package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
- package/tests/shell-stats.test.ts +90 -0
- package/tests/shell-surface-transparent.test.ts +89 -0
- package/tests/shell-todo.test.ts +12 -0
- package/tests/shell-usage.test.ts +14 -0
- package/tests/skill-registry.test.ts +902 -2
- package/tests/star-prompt.test.ts +470 -0
- package/tests/startup-banner.test.ts +209 -2
- package/tests/startup-home-repo.test.ts +2 -0
- package/tests/support/review-coordinator-runtime.ts +69 -0
- package/tests/task-size-routing-contract.test.ts +50 -4
- package/tests/verifier-admission.test.ts +49 -0
- package/tests/verifier-settle-reminder.test.ts +281 -0
- package/tests/verify-first-launch-contract.test.ts +134 -8
- package/tests/verify-installer-tap.test.ts +57 -0
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/visual-customization-policy.test.ts +95 -8
- package/tests/visual-customize-view.test.ts +818 -9
- package/tests/visual-layout-preview.test.ts +42 -0
- package/tests/visual-profiles.test.ts +11 -0
- package/tests/voice-worker.test.ts +73 -2
- package/tests/windows-session-bootstrap.test.ts +105 -2
- package/tests/windows-session-transport.test.ts +126 -0
- package/tests/work-continuity-contract.test.ts +114 -0
- package/tests/writer-feature-document-admission.test.ts +92 -0
- package/tests/writer-surfaces.test.ts +12 -10
- package/tests/yolo-customize.test.ts +57 -15
- package/tests/yolo-mode-runtime.test.ts +4 -2
- package/tests/yolo-mode.test.ts +39 -20
- package/tests/yolo-session-policy.test.ts +270 -1
|
@@ -5,6 +5,7 @@ import { chmodSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readdirSyn
|
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
6
6
|
import { dirname, join, posix, win32 } from "node:path";
|
|
7
7
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
|
+
import { stripVTControlCharacters } from "node:util";
|
|
8
9
|
import test, { type TestContext } from "node:test";
|
|
9
10
|
import {
|
|
10
11
|
BUNDLED_VERIFY_ENV,
|
|
@@ -12,7 +13,6 @@ import {
|
|
|
12
13
|
bundledPi,
|
|
13
14
|
bundledSetupEnv,
|
|
14
15
|
bundledUpdateNext,
|
|
15
|
-
bundledUpdateNotice,
|
|
16
16
|
bundledUpdatePlan,
|
|
17
17
|
parseBundledUpgradeArgs,
|
|
18
18
|
withBundledNpmCommand,
|
|
@@ -294,24 +294,12 @@ test("bundledUpdateNext still updates extensions when the upgrade did not comple
|
|
|
294
294
|
assert.deepEqual(bundledUpdateNext({ self: true, piArgs: ["update", "--extensions"] }, 0), { piArgs: ["update", "--extensions"] });
|
|
295
295
|
const failed = bundledUpdateNext({ self: true, piArgs: ["update", "--extensions"] }, 1);
|
|
296
296
|
assert.deepEqual("piArgs" in failed ? failed.piArgs : [], ["update", "--extensions"]);
|
|
297
|
-
assert.match("note" in failed ? String(failed.note) : "", /
|
|
297
|
+
assert.match("note" in failed ? String(failed.note) : "", /latest Pi update did not complete.*extensions/);
|
|
298
298
|
const latest = bundledUpdateNext({ self: true, latest: true, piArgs: ["update", "--extensions"] }, 1);
|
|
299
299
|
assert.match("note" in latest ? String(latest.note) : "", /latest Pi update did not complete.*extensions/);
|
|
300
300
|
assert.deepEqual(bundledUpdateNext({ self: true, latest: true }, 1), { exitCode: 1 });
|
|
301
301
|
});
|
|
302
302
|
|
|
303
|
-
test("bundledUpdateNotice explains the pinned Pi and runs or names gentle-shell upgrade", () => {
|
|
304
|
-
const interactive = bundledUpdateNotice({ piVersion: "1.2.0", interactive: true }).join("\n");
|
|
305
|
-
assert.match(interactive, /Pi ships pinned with Gentle Shell \(Pi 1\.2\.0\)/);
|
|
306
|
-
assert.match(interactive, /Running 'gentle-shell upgrade'/);
|
|
307
|
-
assert.match(bundledUpdateNotice({ piVersion: "1.2.0", interactive: false }).join("\n"), /Run 'gentle-shell upgrade'/);
|
|
308
|
-
for (const interactive of [true, false]) {
|
|
309
|
-
const lines = bundledUpdateNotice({ piVersion: "1.2.0", interactive });
|
|
310
|
-
assert.equal(lines[0], "Pi ships pinned with Gentle Shell (Pi 1.2.0): a newer Pi arrives with a Gentle Shell release.");
|
|
311
|
-
assert.equal(lines.at(-1), "Run 'gentle-shell update --latest' to install the newest published Pi now, without the release's verified lockfile.");
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
|
|
315
303
|
test("parseBundledUpgradeArgs accepts the release channel and --rollback and refuses the main channel", () => {
|
|
316
304
|
assert.deepEqual(parseBundledUpgradeArgs([]), { action: "upgrade" });
|
|
317
305
|
assert.deepEqual(parseBundledUpgradeArgs(["--channel", "release"]), { action: "upgrade" });
|
|
@@ -338,7 +326,7 @@ const FIXTURE_ID = `${SHELL}-1.2.0`;
|
|
|
338
326
|
const FAKE_PI = [
|
|
339
327
|
"import {mkdirSync, readFileSync, writeFileSync} from 'node:fs'; import {join, dirname} from 'node:path';",
|
|
340
328
|
"const args = process.argv.slice(2);",
|
|
341
|
-
"if (args[0] === 'install' && args[1] === 'npm:gentle-engram
|
|
329
|
+
"if (args[0] === 'install' && args[1] === 'npm:gentle-engram' && process.env.FIXTURE_INSTALL_CAPABILITY !== '0') {",
|
|
342
330
|
" const home = process.env.PI_CODING_AGENT_DIR; const metadata = join(home, 'npm/node_modules/gentle-engram/package.json'); mkdirSync(dirname(metadata), {recursive:true});",
|
|
343
331
|
" writeFileSync(metadata, JSON.stringify({name:'gentle-engram',version:'0.4.2',engram:{startupPolicy:1}}));",
|
|
344
332
|
" const path = join(home,'settings.json'); let settings={}; try {settings=JSON.parse(readFileSync(path,'utf8'));} catch {}",
|
|
@@ -427,6 +415,12 @@ function bundledPrefix(t: TestContext, { pi = "1.2.0", core = true } = {}) {
|
|
|
427
415
|
writeFileSync(publisher, `export * from ${JSON.stringify(pathToFileURL(join(repository, "scripts", "bundled-install.mjs")).href)};
|
|
428
416
|
import { artifactFor } from ${JSON.stringify(pathToFileURL(join(repository, "scripts", "installer-downloads.mjs")).href)};
|
|
429
417
|
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
418
|
+
export async function publishedPi() { return '1.3.0'; }
|
|
419
|
+
export async function upgradePiLatest({ adapters, out }) {
|
|
420
|
+
const latest = await adapters.latestPi();
|
|
421
|
+
if (process.env.FIXTURE_PI_UPDATE_FAIL === '1') throw new Error('fixture Pi installation failed');
|
|
422
|
+
out('fixture latest Pi ' + latest);
|
|
423
|
+
}
|
|
430
424
|
export async function ensureEngram({ layout, platform, arch }) {
|
|
431
425
|
if (existsSync(layout.engram)) return false;
|
|
432
426
|
mkdirSync(layout.engramDir, { recursive: true });
|
|
@@ -914,18 +908,18 @@ test("a gentle-pi version change reruns setup once and keeps memory on the share
|
|
|
914
908
|
assert.equal(installer.runs(), 2);
|
|
915
909
|
});
|
|
916
910
|
|
|
917
|
-
test("
|
|
911
|
+
test("a missing companion is registered through Pi configuration; a failed readback warns and the guard still protects memory", { skip: posixHost }, (t) => {
|
|
918
912
|
const prefix = bundledPrefix(t);
|
|
919
913
|
writeFileSync(prefix.metadata, '{"name":"gentle-engram","version":"0.4.1"}');
|
|
920
914
|
mkdirSync(join(prefix.home, ".engram"));
|
|
921
915
|
const result = prefix.run([], { FIXTURE_INSTALL_CAPABILITY: "0" });
|
|
922
916
|
assert.equal(result.status, 0, result.stderr);
|
|
923
|
-
assert.match(result.stderr, /
|
|
917
|
+
assert.match(result.stderr, /installing policy-capable companion npm:gentle-engram through Pi\n/);
|
|
924
918
|
assert.match(result.stderr, /startupPolicy/);
|
|
925
919
|
assert.equal(lastLaunch(result).env.ENGRAM_BIN, prefix.guard);
|
|
926
920
|
});
|
|
927
921
|
|
|
928
|
-
test("capability readback also requires Pi to declare the selected
|
|
922
|
+
test("capability readback also requires Pi to declare the selected companion", { skip: posixHost }, (t) => {
|
|
929
923
|
const prefix = bundledPrefix(t);
|
|
930
924
|
const result = prefix.run([], { FIXTURE_INSTALL_CAPABILITY: "metadata-only" });
|
|
931
925
|
assert.equal(result.status, 0, result.stderr);
|
|
@@ -933,7 +927,7 @@ test("capability readback also requires Pi to declare the selected pinned compan
|
|
|
933
927
|
assert.equal(lastLaunch(result).env.ENGRAM_BIN, prefix.guard);
|
|
934
928
|
});
|
|
935
929
|
|
|
936
|
-
test("
|
|
930
|
+
test("a user-selected companion pin preserves filters and unrelated settings and is not reinstalled", { skip: posixHost }, (t) => {
|
|
937
931
|
const prefix = bundledPrefix(t);
|
|
938
932
|
const settings = join(prefix.home, ".gentle-shell", "agent", "settings.json");
|
|
939
933
|
const other = { source: "npm:unrelated", extensions: ["keep.ts"] };
|
|
@@ -942,7 +936,8 @@ test("pinning preserves resource filters and unrelated settings and does not rei
|
|
|
942
936
|
assert.equal(first.status, 0, first.stderr);
|
|
943
937
|
const updated = JSON.parse(readFileSync(settings, "utf8"));
|
|
944
938
|
assert.equal(updated.theme, "chosen");
|
|
945
|
-
assert.deepEqual(updated.packages, [other, { source: "npm:gentle-engram@0.4.
|
|
939
|
+
assert.deepEqual(updated.packages, [other, { source: "npm:gentle-engram@0.4.1", autoload: false, extensions: [] }]);
|
|
940
|
+
assert.match(first.stderr, /selected gentle-engram does not match its installed version/);
|
|
946
941
|
assert.doesNotMatch(prefix.run([]).stderr, /installing policy-capable companion/);
|
|
947
942
|
});
|
|
948
943
|
|
|
@@ -1180,22 +1175,203 @@ test("the bundled launcher refuses a Pi that is not the pinned one", { skip: pos
|
|
|
1180
1175
|
assert.doesNotMatch(result.stdout, /9\.9\.9/);
|
|
1181
1176
|
});
|
|
1182
1177
|
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1178
|
+
// Exercise Pi's actual package manager, update command and interactive notice
|
|
1179
|
+
// with an isolated fake npm registry/installer; no network or user home is used.
|
|
1180
|
+
function nativeCompanionFixture(t: TestContext) {
|
|
1181
|
+
const prefix = bundledPrefix(t);
|
|
1182
|
+
const piDist = join(repository, "node_modules", "@earendil-works", "pi-coding-agent", "dist");
|
|
1183
|
+
const sdk = pathToFileURL(join(piDist, "index.js")).href;
|
|
1184
|
+
const interactive = pathToFileURL(join(piDist, "modes", "interactive", "interactive-mode.js")).href;
|
|
1185
|
+
const theme = pathToFileURL(join(piDist, "modes", "interactive", "theme", "theme.js")).href;
|
|
1186
|
+
const commands = pathToFileURL(join(piDist, "package-manager-cli.js")).href;
|
|
1187
|
+
const agent = join(prefix.home, ".gentle-shell", "agent");
|
|
1188
|
+
const settings = join(agent, "settings.json");
|
|
1189
|
+
const calls = join(prefix.home, "npm-calls.jsonl");
|
|
1190
|
+
const node = join(prefix.root, "runtime", "node-24.21.0", "bin", "node");
|
|
1191
|
+
mkdirSync(dirname(node), { recursive: true });
|
|
1192
|
+
symlinkSync(process.execPath, node);
|
|
1193
|
+
const packagePath = join(prefix.piDir, "package.json");
|
|
1194
|
+
writeFileSync(packagePath, JSON.stringify({ ...JSON.parse(readFileSync(packagePath, "utf8")), main: "./dist/index.js" }));
|
|
1195
|
+
writeFileSync(join(prefix.piDir, "dist", "index.js"), `export * from ${JSON.stringify(sdk)};\n`);
|
|
1196
|
+
writeFileSync(join(prefix.piDir, "dist", "bundle", "cli.js"), `
|
|
1197
|
+
import { SettingsManager } from ${JSON.stringify(sdk)};
|
|
1198
|
+
import { InteractiveMode } from ${JSON.stringify(interactive)};
|
|
1199
|
+
import { initTheme } from ${JSON.stringify(theme)};
|
|
1200
|
+
import { handlePackageCommand } from ${JSON.stringify(commands)};
|
|
1201
|
+
const args = process.argv.slice(2);
|
|
1202
|
+
if (args.includes('--version')) { console.log('1.2.0'); process.exit(0); }
|
|
1203
|
+
if (args[0] === 'update') { await handlePackageCommand(args); }
|
|
1204
|
+
else {
|
|
1205
|
+
const settingsManager = SettingsManager.create(process.cwd(), process.env.PI_CODING_AGENT_DIR, { projectTrusted: false });
|
|
1206
|
+
const names = await InteractiveMode.prototype.checkForPackageUpdates.call({ settingsManager, sessionManager: { getCwd: () => process.cwd() } });
|
|
1207
|
+
const lines = [];
|
|
1208
|
+
if (names.length) {
|
|
1209
|
+
initTheme('dark');
|
|
1210
|
+
InteractiveMode.prototype.showPackageUpdateNotification.call({ chatContainer: { addChild: (component) => lines.push(...component.render(100)) }, ui: { requestRender() {} } }, names);
|
|
1211
|
+
}
|
|
1212
|
+
console.log(JSON.stringify({ names, notice: lines.join('\\n') }));
|
|
1213
|
+
}`);
|
|
1214
|
+
writeFileSync(prefix.npmCli, `
|
|
1215
|
+
const { appendFileSync, readFileSync, writeFileSync } = require('node:fs');
|
|
1216
|
+
const args = process.argv.slice(2); appendFileSync(${JSON.stringify(calls)}, JSON.stringify(args) + '\\n');
|
|
1217
|
+
if (args.includes('view')) { console.log(JSON.stringify(process.env.FIXTURE_PACKAGE_LATEST)); }
|
|
1218
|
+
else if (args.includes('install')) {
|
|
1219
|
+
if (process.env.FIXTURE_PACKAGE_FAIL === '1') { console.error('fixture package install failed'); process.exit(7); }
|
|
1220
|
+
if (!args.includes('gentle-engram@latest')) { console.error('unexpected package spec'); process.exit(8); }
|
|
1221
|
+
const metadata = ${JSON.stringify(prefix.metadata)}; const pkg = JSON.parse(readFileSync(metadata, 'utf8'));
|
|
1222
|
+
pkg.version = process.env.FIXTURE_PACKAGE_LATEST; writeFileSync(metadata, JSON.stringify(pkg));
|
|
1223
|
+
} else { console.error('unexpected npm call'); process.exit(9); }
|
|
1224
|
+
`);
|
|
1225
|
+
const run = (args: string[], extra: Record<string, string> = {}) => spawnSync(process.execPath, [prefix.entry, ...args], {
|
|
1226
|
+
cwd: prefix.home, env: { ...prefix.env, FORCE_COLOR: "0", FIXTURE_PACKAGE_LATEST: "0.5.0", ...extra }, encoding: "utf8", input: "", timeout: 15000,
|
|
1227
|
+
});
|
|
1228
|
+
const npmCalls = (): string[][] => existsSync(calls) ? readFileSync(calls, "utf8").trim().split("\n").map((line) => JSON.parse(line)) : [];
|
|
1229
|
+
return { ...prefix, agent, settings, run, npmCalls };
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
test("native startup notice discovers a newer Shell-managed companion without installing it", { skip: posixHost }, (t) => {
|
|
1233
|
+
const fixture = nativeCompanionFixture(t);
|
|
1234
|
+
const other = { source: "npm:other-extension@2.0.0", extensions: ["chosen.ts"] };
|
|
1235
|
+
const companion = { source: "npm:gentle-engram@0.4.2", autoload: false, extensions: ["index.ts"] };
|
|
1236
|
+
writeFileSync(fixture.settings, JSON.stringify({ theme: "chosen", packages: [other, companion] }));
|
|
1237
|
+
const before = readFileSync(fixture.metadata, "utf8");
|
|
1238
|
+
const newer = fixture.run([]);
|
|
1239
|
+
assert.equal(newer.status, 0, newer.stderr);
|
|
1240
|
+
const shown = JSON.parse(newer.stdout.trim().split("\n").at(-1)!);
|
|
1241
|
+
assert.deepEqual(shown.names, ["gentle-engram"]);
|
|
1242
|
+
const notice = stripVTControlCharacters(shown.notice);
|
|
1243
|
+
assert.match(notice, /Package Updates Available/);
|
|
1244
|
+
assert.match(notice, /Package updates are available\. Run pi update --extensions/);
|
|
1245
|
+
assert.match(notice, /- gentle-engram/);
|
|
1246
|
+
assert.equal(readFileSync(fixture.metadata, "utf8"), before);
|
|
1247
|
+
assert.deepEqual(JSON.parse(readFileSync(fixture.settings, "utf8")).packages, [other, { ...companion, source: "npm:gentle-engram" }]);
|
|
1248
|
+
assert.equal(fixture.npmCalls().some((args) => args.includes("install")), false);
|
|
1249
|
+
for (const latest of ["0.4.2", "0.3.9"]) {
|
|
1250
|
+
const current = fixture.run([], { FIXTURE_PACKAGE_LATEST: latest });
|
|
1251
|
+
assert.equal(current.status, 0, current.stderr);
|
|
1252
|
+
assert.deepEqual(JSON.parse(current.stdout.trim().split("\n").at(-1)!), { names: [], notice: "" });
|
|
1253
|
+
assert.equal(readFileSync(fixture.metadata, "utf8"), before);
|
|
1254
|
+
}
|
|
1255
|
+
assert.equal(fixture.npmCalls().some((args) => args.includes("install")), false);
|
|
1256
|
+
});
|
|
1257
|
+
|
|
1258
|
+
test("extension update migrates the old managed companion and propagates failure before succeeding", { skip: posixHost }, (t) => {
|
|
1259
|
+
const fixture = nativeCompanionFixture(t);
|
|
1260
|
+
const other = "npm:other-extension@2.0.0";
|
|
1261
|
+
writeFileSync(fixture.settings, JSON.stringify({ packages: ["npm:gentle-engram@0.4.2", other] }));
|
|
1262
|
+
const before = readFileSync(fixture.metadata, "utf8");
|
|
1263
|
+
const invalid = fixture.run(["update", "--extensions", "--nope"]);
|
|
1264
|
+
assert.equal(invalid.status, 1);
|
|
1265
|
+
assert.equal(invalid.stdout, "");
|
|
1266
|
+
assert.match(invalid.stderr, /Unknown option --nope/);
|
|
1267
|
+
assert.equal(readFileSync(fixture.metadata, "utf8"), before);
|
|
1268
|
+
assert.deepEqual(JSON.parse(readFileSync(fixture.settings, "utf8")).packages, ["npm:gentle-engram@0.4.2", other]);
|
|
1269
|
+
assert.deepEqual(fixture.npmCalls(), []);
|
|
1270
|
+
const failed = fixture.run(["update", "--extensions"], { FIXTURE_PACKAGE_FAIL: "1" });
|
|
1271
|
+
assert.equal(failed.status, 1);
|
|
1272
|
+
assert.match(failed.stderr, /fixture package install failed|exited with code 7/);
|
|
1273
|
+
assert.doesNotMatch(failed.stdout, /Updated packages/);
|
|
1274
|
+
assert.equal(readFileSync(fixture.metadata, "utf8"), before);
|
|
1275
|
+
assert.deepEqual(JSON.parse(readFileSync(fixture.settings, "utf8")).packages, ["npm:gentle-engram", other]);
|
|
1276
|
+
const updated = fixture.run(["update", "--extensions"]);
|
|
1277
|
+
assert.equal(updated.status, 0, updated.stderr);
|
|
1278
|
+
assert.match(updated.stdout, /Updated packages/);
|
|
1279
|
+
assert.equal(updated.stderr, "");
|
|
1280
|
+
assert.equal(JSON.parse(readFileSync(fixture.metadata, "utf8")).version, "0.5.0");
|
|
1281
|
+
assert.deepEqual(JSON.parse(readFileSync(fixture.settings, "utf8")).packages, ["npm:gentle-engram", other]);
|
|
1282
|
+
assert.equal(fixture.npmCalls().filter((args) => args.includes("install") && args.includes("gentle-engram@latest")).length, 2);
|
|
1283
|
+
assert.equal(fixture.npmCalls().some((args) => args.includes("other-extension@latest")), false);
|
|
1284
|
+
const current = fixture.run([]);
|
|
1285
|
+
assert.equal(current.status, 0, current.stderr);
|
|
1286
|
+
assert.deepEqual(JSON.parse(current.stdout.trim().split("\n").at(-1)!), { names: [], notice: "" });
|
|
1287
|
+
});
|
|
1288
|
+
|
|
1289
|
+
test("extension update refuses success if the selected Pi cannot migrate the legacy companion", { skip: posixHost }, (t) => {
|
|
1290
|
+
const fixture = nativeCompanionFixture(t);
|
|
1291
|
+
const packages = ["npm:gentle-engram@0.4.2", "npm:other-extension@2.0.0"];
|
|
1292
|
+
writeFileSync(fixture.settings, JSON.stringify({ packages }));
|
|
1293
|
+
const before = readFileSync(fixture.metadata, "utf8");
|
|
1294
|
+
writeFileSync(join(fixture.piDir, "dist", "index.js"), "throw new Error('fixture SDK unavailable');\n");
|
|
1295
|
+
const result = fixture.run(["update", "--extensions"]);
|
|
1296
|
+
assert.equal(result.status, 1);
|
|
1297
|
+
assert.equal(result.stdout, "");
|
|
1298
|
+
assert.match(result.stderr, /could not prepare the managed gentle-engram package for updates \(fixture SDK unavailable\)/);
|
|
1299
|
+
assert.equal(readFileSync(fixture.metadata, "utf8"), before);
|
|
1300
|
+
assert.deepEqual(JSON.parse(readFileSync(fixture.settings, "utf8")).packages, packages);
|
|
1301
|
+
assert.deepEqual(fixture.npmCalls(), []);
|
|
1302
|
+
});
|
|
1303
|
+
|
|
1304
|
+
test("an unverified legacy companion cannot be reported as an extension-update success", { skip: posixHost }, (t) => {
|
|
1305
|
+
const fixture = nativeCompanionFixture(t);
|
|
1306
|
+
const packages = ["npm:gentle-engram@0.4.2", "npm:other-extension@2.0.0"];
|
|
1307
|
+
writeFileSync(fixture.settings, JSON.stringify({ packages }));
|
|
1308
|
+
writeFileSync(fixture.metadata, JSON.stringify({ name: "gentle-engram", version: "0.4.1" }));
|
|
1309
|
+
const before = readFileSync(fixture.metadata, "utf8");
|
|
1310
|
+
const result = fixture.run(["update", "--extensions"]);
|
|
1311
|
+
assert.equal(result.status, 1);
|
|
1312
|
+
assert.equal(result.stdout, "");
|
|
1313
|
+
assert.match(result.stderr, /legacy companion installation could not be verified/);
|
|
1314
|
+
assert.equal(readFileSync(fixture.metadata, "utf8"), before);
|
|
1315
|
+
assert.deepEqual(JSON.parse(readFileSync(fixture.settings, "utf8")).packages, packages);
|
|
1316
|
+
assert.deepEqual(fixture.npmCalls(), []);
|
|
1189
1317
|
});
|
|
1190
1318
|
|
|
1191
|
-
test("
|
|
1319
|
+
test("companion selections in linked and foreign homes remain untouched", { skip: posixHost }, (t) => {
|
|
1320
|
+
const fixture = nativeCompanionFixture(t);
|
|
1321
|
+
for (const [args, home] of [
|
|
1322
|
+
[["--link"], join(fixture.home, ".pi", "agent")],
|
|
1323
|
+
[["--home", join(fixture.home, "foreign")], join(fixture.home, "foreign")],
|
|
1324
|
+
] as Array<[string[], string]>) {
|
|
1325
|
+
const metadata = join(home, "npm", "node_modules", "gentle-engram", "package.json");
|
|
1326
|
+
mkdirSync(dirname(metadata), { recursive: true });
|
|
1327
|
+
writeFileSync(metadata, JSON.stringify({ name: "gentle-engram", version: "0.4.2", engram: { startupPolicy: 1 } }));
|
|
1328
|
+
const settings = join(home, "settings.json");
|
|
1329
|
+
const text = JSON.stringify({ packages: ["npm:gentle-engram@0.4.2", "npm:other-extension@2.0.0"] });
|
|
1330
|
+
writeFileSync(settings, text);
|
|
1331
|
+
const result = fixture.run(args, { FIXTURE_NO_PROBE: "1", ENGRAM_STARTUP_POLICY: "disabled" });
|
|
1332
|
+
assert.equal(result.status, 0, result.stderr);
|
|
1333
|
+
assert.deepEqual(JSON.parse(result.stdout.trim().split("\n").at(-1)!), { names: [], notice: "" });
|
|
1334
|
+
assert.equal(readFileSync(settings, "utf8"), text);
|
|
1335
|
+
}
|
|
1336
|
+
assert.deepEqual(fixture.npmCalls(), []);
|
|
1337
|
+
});
|
|
1338
|
+
|
|
1339
|
+
test("bundled update defaults to latest and --latest remains an alias", { skip: posixHost }, (t) => {
|
|
1192
1340
|
const prefix = bundledPrefix(t);
|
|
1193
|
-
const
|
|
1194
|
-
|
|
1195
|
-
|
|
1341
|
+
for (const args of [["update"], ["update", "--latest"]]) {
|
|
1342
|
+
const result = prefix.run(args);
|
|
1343
|
+
assert.deepEqual([result.status, result.stdout, result.stderr], [0, "fixture latest Pi 1.3.0\n", ""]);
|
|
1344
|
+
assert.equal(readlinkSync(join(prefix.root, "current")), `versions/${FIXTURE_ID}`);
|
|
1345
|
+
}
|
|
1346
|
+
});
|
|
1347
|
+
|
|
1348
|
+
test("bundled all forwards extensions and reports a failed Pi update", { skip: posixHost }, (t) => {
|
|
1349
|
+
const prefix = bundledPrefix(t);
|
|
1350
|
+
const result = prefix.run(["update", "pi", "--extensions"], { FIXTURE_PI_UPDATE_FAIL: "1" });
|
|
1351
|
+
assert.equal(result.status, 1);
|
|
1352
|
+
assert.equal(result.stderr.split("\n")[0], "gentle-shell update: fixture Pi installation failed");
|
|
1353
|
+
assert.match(result.stderr, /latest Pi update did not complete; updating the extensions anyway/);
|
|
1196
1354
|
const seen = JSON.parse(result.stdout.trim().split("\n").at(-1) ?? "{}");
|
|
1197
1355
|
assert.deepEqual(seen.args, ["update", "--extensions"]);
|
|
1198
|
-
assert.
|
|
1356
|
+
assert.equal(readlinkSync(join(prefix.root, "current")), `versions/${FIXTURE_ID}`);
|
|
1357
|
+
});
|
|
1358
|
+
|
|
1359
|
+
test("bundled update rejects unsupported force without changing the active version", { skip: posixHost }, (t) => {
|
|
1360
|
+
const prefix = bundledPrefix(t);
|
|
1361
|
+
const result = prefix.run(["update", "--force"]);
|
|
1362
|
+
assert.deepEqual([result.status, result.stdout, result.stderr], [2, "", "gentle-shell update: --force is not supported for managed Pi updates.\n"]);
|
|
1363
|
+
assert.equal(readlinkSync(join(prefix.root, "current")), `versions/${FIXTURE_ID}`);
|
|
1364
|
+
});
|
|
1365
|
+
|
|
1366
|
+
test("bundled extension and model updates still reach Pi without a self update", { skip: posixHost }, (t) => {
|
|
1367
|
+
const prefix = bundledPrefix(t);
|
|
1368
|
+
for (const args of [["update", "--extensions"], ["update", "--models"]]) {
|
|
1369
|
+
const result = prefix.run(args);
|
|
1370
|
+
assert.equal(result.status, 0, result.stderr);
|
|
1371
|
+
assert.deepEqual(JSON.parse(result.stdout.trim()).args, args);
|
|
1372
|
+
assert.doesNotMatch(result.stdout, /fixture latest Pi/);
|
|
1373
|
+
assert.equal(readlinkSync(join(prefix.root, "current")), `versions/${FIXTURE_ID}`);
|
|
1374
|
+
}
|
|
1199
1375
|
});
|
|
1200
1376
|
|
|
1201
1377
|
test("a kept version that current does not name keeps the ordinary Pi override and refuses an unowned update", { skip: posixHost }, (t) => {
|
|
@@ -4,6 +4,7 @@ import { join, resolve } from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import test from "node:test";
|
|
6
6
|
import { CHILD_PACKAGE_INJECTION_ENV, encodeChildPackageInjection, parseChildPackageInjection } from "../lib/child-package-injection.ts";
|
|
7
|
+
import { bundledChildEnv } from "../lib/gentle-shell-bundled.ts";
|
|
7
8
|
import {
|
|
8
9
|
GENTLE_AI_PI_EXCLUDE_PACKAGES_ENV,
|
|
9
10
|
MIN_PI_VERSION,
|
|
@@ -25,6 +26,8 @@ import {
|
|
|
25
26
|
type LooseExtensionFsEntry,
|
|
26
27
|
missingPiMessage,
|
|
27
28
|
needsProvisioning,
|
|
29
|
+
NON_INTERACTIVE_GIT_ENV,
|
|
30
|
+
nonInteractiveGitEnv,
|
|
28
31
|
otherPackageInjections,
|
|
29
32
|
parseLauncherArgs,
|
|
30
33
|
parseLauncherConfig,
|
|
@@ -213,8 +216,9 @@ test("help text documents the bundled upgrade, its rollback and the pinned Pi up
|
|
|
213
216
|
const text = helpText();
|
|
214
217
|
assert.ok(text.includes(" gentle-shell upgrade --rollback"));
|
|
215
218
|
assert.match(text, /bundled install.*release channel only.*--rollback switches back to the previous kept version/s);
|
|
216
|
-
assert.match(text, /In a bundled install
|
|
217
|
-
assert.match(text,
|
|
219
|
+
assert.match(text, /In a bundled install 'update' installs the newest stable Pi\n\s+without the release's verified lockfile; --latest is an alias\./);
|
|
220
|
+
assert.match(text, /--all also updates extensions; explicit package pins remain pinned\./);
|
|
221
|
+
assert.match(text, /--force is not supported for managed Pi self updates\./);
|
|
218
222
|
});
|
|
219
223
|
|
|
220
224
|
test("parseLauncherArgs treats home as a plain passthrough token when it is not argv[0]", () => {
|
|
@@ -636,21 +640,21 @@ test("recordProvisioned overwrites an existing marker for the same home", () =>
|
|
|
636
640
|
test("resolvePiRuntime prefers GENTLE_SHELL_PI over every other source", () => {
|
|
637
641
|
const runtime = resolvePiRuntime({
|
|
638
642
|
env: { GENTLE_SHELL_PI: "/opt/pi/pi" },
|
|
639
|
-
resolveBundledCli: () => "/bundled/cli.js",
|
|
643
|
+
resolveBundledCli: () => ({ path: "/bundled/cli.js", version: "1.2.3" }),
|
|
640
644
|
findOnPath: () => "/usr/bin/pi",
|
|
641
645
|
nodeExecPath: "/usr/bin/node",
|
|
642
646
|
});
|
|
643
647
|
assert.deepEqual(runtime, { kind: "env", command: "/opt/pi/pi", args: [] });
|
|
644
648
|
});
|
|
645
649
|
|
|
646
|
-
test("resolvePiRuntime falls back to the bundled CLI run with the current node", () => {
|
|
650
|
+
test("resolvePiRuntime falls back to the bundled CLI run with the current node, carrying its version so main() never has to spawn just to read it", () => {
|
|
647
651
|
const runtime = resolvePiRuntime({
|
|
648
652
|
env: {},
|
|
649
|
-
resolveBundledCli: () => "/bundled/cli.js",
|
|
653
|
+
resolveBundledCli: () => ({ path: "/bundled/cli.js", version: "1.2.3" }),
|
|
650
654
|
findOnPath: () => "/usr/bin/pi",
|
|
651
655
|
nodeExecPath: "/usr/bin/node",
|
|
652
656
|
});
|
|
653
|
-
assert.deepEqual(runtime, { kind: "bundled", command: "/usr/bin/node", args: ["/bundled/cli.js"] });
|
|
657
|
+
assert.deepEqual(runtime, { kind: "bundled", command: "/usr/bin/node", args: ["/bundled/cli.js"], version: "1.2.3" });
|
|
654
658
|
});
|
|
655
659
|
|
|
656
660
|
test("resolvePiRuntime falls back to pi on PATH when nothing else resolves", () => {
|
|
@@ -676,11 +680,11 @@ test("resolvePiRuntime returns undefined when no source resolves", () => {
|
|
|
676
680
|
test("resolvePiRuntime treats an empty GENTLE_SHELL_PI as unset", () => {
|
|
677
681
|
const runtime = resolvePiRuntime({
|
|
678
682
|
env: { GENTLE_SHELL_PI: "" },
|
|
679
|
-
resolveBundledCli: () => "/bundled/cli.js",
|
|
683
|
+
resolveBundledCli: () => ({ path: "/bundled/cli.js", version: "1.2.3" }),
|
|
680
684
|
findOnPath: () => undefined,
|
|
681
685
|
nodeExecPath: "/usr/bin/node",
|
|
682
686
|
});
|
|
683
|
-
assert.deepEqual(runtime, { kind: "bundled", command: "/usr/bin/node", args: ["/bundled/cli.js"] });
|
|
687
|
+
assert.deepEqual(runtime, { kind: "bundled", command: "/usr/bin/node", args: ["/bundled/cli.js"], version: "1.2.3" });
|
|
684
688
|
});
|
|
685
689
|
|
|
686
690
|
test("missingPiMessage names the three resolution options", () => {
|
|
@@ -1274,6 +1278,21 @@ test("package injection relies on Pi's -e resource discovery in isolated and tak
|
|
|
1274
1278
|
const linkHome: ResolvedHome = { mode: "link", dir: "/pi/agent", source: "flag" };
|
|
1275
1279
|
const isolatedHomeResolved: ResolvedHome = { mode: "isolated", dir: "/gentle-shell/agent", source: "default" };
|
|
1276
1280
|
|
|
1281
|
+
test("buildPiInvocation activates program identity only in its child environment", () => {
|
|
1282
|
+
for (const home of [linkHome, isolatedHomeResolved]) {
|
|
1283
|
+
const baseEnv = Object.freeze({ PATH: "/usr/bin", PI_PROGRAM_STATUS_APP: "pi", PI_PROGRAM_STATUS: "0" });
|
|
1284
|
+
const built = buildPiInvocation({
|
|
1285
|
+
runtime: { kind: "path", command: "/usr/bin/pi", args: [] }, home,
|
|
1286
|
+
packageRoot: "/pkg", declaration: { kind: "npm" }, takeOver: false,
|
|
1287
|
+
otherPackagePaths: [], passthrough: [], baseEnv, homedir: "/home/u", cwd: "/work",
|
|
1288
|
+
});
|
|
1289
|
+
assert.equal(built.env.PI_PROGRAM_STATUS_APP, "gentle-shell");
|
|
1290
|
+
assert.equal(built.env.PI_PROGRAM_STATUS, "0");
|
|
1291
|
+
assert.equal(built.env.PI_CODING_AGENT_DIR, home.dir);
|
|
1292
|
+
assert.deepEqual(baseEnv, { PATH: "/usr/bin", PI_PROGRAM_STATUS_APP: "pi", PI_PROGRAM_STATUS: "0" });
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
|
|
1277
1296
|
test("buildPiInvocation injects the launcher env into baseEnv", () => {
|
|
1278
1297
|
const built = buildPiInvocation({
|
|
1279
1298
|
runtime: { kind: "path", command: "/usr/bin/pi", args: [] },
|
|
@@ -1287,7 +1306,69 @@ test("buildPiInvocation injects the launcher env into baseEnv", () => {
|
|
|
1287
1306
|
homedir: "/home/u",
|
|
1288
1307
|
cwd: "/work",
|
|
1289
1308
|
});
|
|
1290
|
-
assert.deepEqual(built.env, { PATH: "/usr/bin", PI_CODING_AGENT_DIR: "/pi/agent", GENTLE_PI_AGENT_HOME: "/pi/agent", GENTLE_SHELL_USER_PI_HOME: join("/home/u", ".pi", "agent") });
|
|
1309
|
+
assert.deepEqual(built.env, { ...NON_INTERACTIVE_GIT_ENV, PATH: "/usr/bin", PI_CODING_AGENT_DIR: "/pi/agent", PI_PROGRAM_STATUS_APP: "gentle-shell", GENTLE_PI_AGENT_HOME: "/pi/agent", GENTLE_SHELL_USER_PI_HOME: join("/home/u", ".pi", "agent") });
|
|
1310
|
+
});
|
|
1311
|
+
|
|
1312
|
+
// An editor git opens from Pi's bash tool has no terminal anyone can reach, so
|
|
1313
|
+
// `git rebase --continue` or a bare `git commit` hung the tool call forever.
|
|
1314
|
+
test("buildPiInvocation keeps git from opening an editor unless the user chose one for git", () => {
|
|
1315
|
+
const build = (baseEnv: Record<string, string | undefined>) => buildPiInvocation({
|
|
1316
|
+
runtime: { kind: "path", command: "/usr/bin/pi", args: [] },
|
|
1317
|
+
home: linkHome,
|
|
1318
|
+
packageRoot: "/pkg",
|
|
1319
|
+
declaration: undefined,
|
|
1320
|
+
takeOver: false,
|
|
1321
|
+
otherPackagePaths: [],
|
|
1322
|
+
passthrough: [],
|
|
1323
|
+
baseEnv,
|
|
1324
|
+
homedir: "/home/u",
|
|
1325
|
+
cwd: "/work",
|
|
1326
|
+
}).env;
|
|
1327
|
+
const defaults = build({ EDITOR: "nvim", VISUAL: "nvim" });
|
|
1328
|
+
assert.equal(defaults.GIT_EDITOR, "true");
|
|
1329
|
+
assert.equal(defaults.GIT_SEQUENCE_EDITOR, "true");
|
|
1330
|
+
assert.equal(defaults.EDITOR, "nvim");
|
|
1331
|
+
assert.equal(defaults.VISUAL, "nvim");
|
|
1332
|
+
const explicit = build({ GIT_EDITOR: "code --wait", GIT_SEQUENCE_EDITOR: "" });
|
|
1333
|
+
assert.equal(explicit.GIT_EDITOR, "code --wait");
|
|
1334
|
+
assert.equal(explicit.GIT_SEQUENCE_EDITOR, "");
|
|
1335
|
+
assert.deepEqual(nonInteractiveGitEnv({ GIT_EDITOR: "vim" }, "linux"), { GIT_SEQUENCE_EDITOR: "true" });
|
|
1336
|
+
// A key that is present but undefined is omitted from the spawn, so it still gets the default.
|
|
1337
|
+
assert.equal(build({ GIT_EDITOR: undefined }).GIT_EDITOR, "true");
|
|
1338
|
+
});
|
|
1339
|
+
|
|
1340
|
+
// The bundled launcher copies process.env into a plain object, which loses
|
|
1341
|
+
// Windows' case-insensitive lookup; a user's `git_editor` must still win.
|
|
1342
|
+
test("nonInteractiveGitEnv matches editor names case-insensitively on Windows only", () => {
|
|
1343
|
+
const bundled = bundledChildEnv({ git_editor: "code --wait", Git_Sequence_Editor: "vim" }, { node: "/n/node", cli: "/n/cli.js", prefix: "/p" });
|
|
1344
|
+
assert.deepEqual(nonInteractiveGitEnv(bundled, "win32"), {});
|
|
1345
|
+
assert.deepEqual(nonInteractiveGitEnv(bundled, "linux"), NON_INTERACTIVE_GIT_ENV);
|
|
1346
|
+
assert.deepEqual(nonInteractiveGitEnv({ git_editor: undefined }, "win32"), NON_INTERACTIVE_GIT_ENV);
|
|
1347
|
+
});
|
|
1348
|
+
|
|
1349
|
+
// Node on Windows keeps the first case variant in sorted order (GIT_EDITOR)
|
|
1350
|
+
// and then skips it as undefined, so the user's git_editor would be lost too.
|
|
1351
|
+
test("buildPiInvocation on Windows drops an undefined case variant so the user's git editor reaches the child", () => {
|
|
1352
|
+
const build = (platform: string) => buildPiInvocation({
|
|
1353
|
+
runtime: { kind: "path", command: "/usr/bin/pi", args: [] },
|
|
1354
|
+
home: linkHome,
|
|
1355
|
+
packageRoot: "/pkg",
|
|
1356
|
+
declaration: undefined,
|
|
1357
|
+
takeOver: false,
|
|
1358
|
+
otherPackagePaths: [],
|
|
1359
|
+
passthrough: [],
|
|
1360
|
+
baseEnv: { GIT_EDITOR: undefined, git_editor: "vim" },
|
|
1361
|
+
homedir: "/home/u",
|
|
1362
|
+
cwd: "/work",
|
|
1363
|
+
platform,
|
|
1364
|
+
}).env;
|
|
1365
|
+
const win = build("win32");
|
|
1366
|
+
assert.equal("GIT_EDITOR" in win, false);
|
|
1367
|
+
assert.equal(win.git_editor, "vim");
|
|
1368
|
+
assert.equal(win.GIT_SEQUENCE_EDITOR, "true");
|
|
1369
|
+
const linux = build("linux");
|
|
1370
|
+
assert.equal(linux.GIT_EDITOR, "true");
|
|
1371
|
+
assert.equal(linux.git_editor, "vim");
|
|
1291
1372
|
});
|
|
1292
1373
|
|
|
1293
1374
|
test("buildPiInvocation skips injection when there is a declaration and no takeover (npm matches the launcher's own install)", () => {
|
|
@@ -1361,8 +1442,10 @@ test("buildPiInvocation still injects the launcher env for a pi subcommand", ()
|
|
|
1361
1442
|
cwd: "/work",
|
|
1362
1443
|
});
|
|
1363
1444
|
assert.deepEqual(built.env, {
|
|
1445
|
+
...NON_INTERACTIVE_GIT_ENV,
|
|
1364
1446
|
PATH: "/usr/bin",
|
|
1365
1447
|
PI_CODING_AGENT_DIR: "/gentle-shell/agent",
|
|
1448
|
+
PI_PROGRAM_STATUS_APP: "gentle-shell",
|
|
1366
1449
|
GENTLE_PI_AGENT_HOME: "/gentle-shell/agent",
|
|
1367
1450
|
GENTLE_SHELL_USER_PI_HOME: join("/home/u", ".pi", "agent"),
|
|
1368
1451
|
});
|
|
@@ -1384,7 +1467,7 @@ test("buildPiInvocation in link mode with a pi subcommand is exactly pi <subcomm
|
|
|
1384
1467
|
});
|
|
1385
1468
|
assert.equal(built.command, "/usr/bin/pi");
|
|
1386
1469
|
assert.deepEqual(built.args, ["auth", "status"]);
|
|
1387
|
-
assert.deepEqual(built.env, { PI_CODING_AGENT_DIR: "/pi/agent", GENTLE_PI_AGENT_HOME: "/pi/agent", GENTLE_SHELL_USER_PI_HOME: "/pi/agent" });
|
|
1470
|
+
assert.deepEqual(built.env, { ...NON_INTERACTIVE_GIT_ENV, PI_CODING_AGENT_DIR: "/pi/agent", PI_PROGRAM_STATUS_APP: "gentle-shell", GENTLE_PI_AGENT_HOME: "/pi/agent", GENTLE_SHELL_USER_PI_HOME: "/pi/agent" });
|
|
1388
1471
|
});
|
|
1389
1472
|
|
|
1390
1473
|
// The isolated home overrides PI_CODING_AGENT_DIR for the session, so the
|