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
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import test from "node:test";
|
|
5
|
+
|
|
6
|
+
// gentle-shell#2926: pnpm 11 runs an implicit `pnpm install` before
|
|
7
|
+
// `pnpm run`/`pnpm exec` unless verifyDepsBeforeRun is off. In a worktree whose
|
|
8
|
+
// node_modules links to another checkout that install tries to purge the shared
|
|
9
|
+
// node_modules and aborts without a TTY. These pins keep the setting, keep it
|
|
10
|
+
// out of published packages, and keep every workflow installing explicitly.
|
|
11
|
+
|
|
12
|
+
const root = join(import.meta.dirname, "..");
|
|
13
|
+
const read = (relative: string): string => readFileSync(join(root, relative), "utf8");
|
|
14
|
+
|
|
15
|
+
test("#2926: pnpm-workspace.yaml disables the implicit install before run", () => {
|
|
16
|
+
const workspace = read("pnpm-workspace.yaml");
|
|
17
|
+
const values = [...workspace.matchAll(/^verifyDepsBeforeRun:\s*(\S+)\s*$/gm)].map((match) => match[1]);
|
|
18
|
+
assert.deepEqual(values, ["false"], "verifyDepsBeforeRun must be set once to false; install and prompt break non-TTY shells");
|
|
19
|
+
assert.match(workspace, /^nodeLinker: hoisted$/m);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("#2926: the repository pnpm-workspace.yaml is not published", () => {
|
|
23
|
+
const files = (JSON.parse(read("package.json")) as { files?: string[] }).files ?? [];
|
|
24
|
+
assert.ok(files.length > 0, "package.json must keep an explicit files allowlist");
|
|
25
|
+
assert.ok(!files.some((entry) => entry.replace(/^\.\//, "").startsWith("pnpm-workspace")), "pnpm-workspace.yaml must stay out of the package");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
function workflowJobs(text: string): Array<{ name: string; body: string }> {
|
|
29
|
+
const jobsAt = text.search(/^jobs:\s*$/m);
|
|
30
|
+
if (jobsAt < 0) return [];
|
|
31
|
+
const jobs: Array<{ name: string; body: string }> = [];
|
|
32
|
+
let current: { name: string; lines: string[] } | undefined;
|
|
33
|
+
for (const line of text.slice(jobsAt).split("\n").slice(1)) {
|
|
34
|
+
const header = /^ {2}([A-Za-z0-9_-]+):\s*$/.exec(line);
|
|
35
|
+
if (header) {
|
|
36
|
+
if (current) jobs.push({ name: current.name, body: current.lines.join("\n") });
|
|
37
|
+
current = { name: header[1], lines: [] };
|
|
38
|
+
} else if (/^\S/.test(line)) break;
|
|
39
|
+
else current?.lines.push(line);
|
|
40
|
+
}
|
|
41
|
+
if (current) jobs.push({ name: current.name, body: current.lines.join("\n") });
|
|
42
|
+
return jobs;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
test("#2926: every workflow job installs dependencies before pnpm test, run or exec", () => {
|
|
46
|
+
const dir = ".github/workflows";
|
|
47
|
+
let checked = 0;
|
|
48
|
+
for (const file of readdirSync(join(root, dir)).filter((name) => /\.ya?ml$/.test(name))) {
|
|
49
|
+
for (const job of workflowJobs(read(join(dir, file)))) {
|
|
50
|
+
const usesPnpm = job.body.search(/\bpnpm (test|run|exec)\b/);
|
|
51
|
+
if (usesPnpm < 0) continue;
|
|
52
|
+
checked++;
|
|
53
|
+
const install = job.body.search(/\bpnpm install --frozen-lockfile\b/);
|
|
54
|
+
assert.ok(install >= 0 && install < usesPnpm, `${file} job ${job.name} runs pnpm test/run/exec before pnpm install --frozen-lockfile`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
assert.ok(checked > 0, "expected at least one workflow job that runs pnpm test/run/exec");
|
|
58
|
+
});
|
|
@@ -99,3 +99,16 @@ test("a routing block whose ODD protocol section changed shape fails closed", ()
|
|
|
99
99
|
const withoutSection = mirroredRoutingText().replace("### ODD protocol (MANDATORY, in this order, on every request)", "### ODD protocol");
|
|
100
100
|
assert.throws(() => __testing.readMirroredOddProtocolSteps(tempRoutingMirror(withoutSection)), unexpectedShape);
|
|
101
101
|
});
|
|
102
|
+
|
|
103
|
+
// Issue #2935: the confinement clause must deliver the resolved-skill-read
|
|
104
|
+
// exception in every mode without loosening the rest of the boundary.
|
|
105
|
+
test("Safety clause allows the task's exact resolved skill reads in every mode without new write rights", () => {
|
|
106
|
+
const line = renderPrimaryPrompt().split("\n").find(candidate => candidate.startsWith("- Keep session work inside the project root"));
|
|
107
|
+
assert.ok(line, "confinement clause is delivered");
|
|
108
|
+
for (const clause of [
|
|
109
|
+
"reading the task's exact resolved skill files needs no per-file question in any mode",
|
|
110
|
+
"Grants are per-target, per-session, never blanket: in-project scripts naming outside paths are not standing consent",
|
|
111
|
+
"ask before any read or write outside it, naming the absolute path",
|
|
112
|
+
"registered same-clone worktrees",
|
|
113
|
+
]) assert.ok(line.includes(clause), `missing delivered clause: ${clause}`);
|
|
114
|
+
});
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { SessionManager } from "@earendil-works/pi-coding-agent";
|
|
4
|
+
import { createSessionProfileIntegration } from "../lib/session-profile-integration.ts";
|
|
5
|
+
import { normalizeProfilesFile, PROFILES_KIND, PROFILES_VERSION, createProfile, duplicateProfile, emptyProfilesFile, parseProfileExportText, parseProfilesFileText, serializeProfileExport, serializeProfilesFile } from "../lib/agent-profiles.ts";
|
|
6
|
+
import { createSessionProfileBind, readSessionProfileEntry, replaySessionProfileBranch, SESSION_PROFILE_CUSTOM_TYPE } from "../lib/session-profile-persistence.ts";
|
|
7
|
+
import { normalizeRoutingEntry } from "../lib/model-routing-authority.ts";
|
|
8
|
+
import { parseAgentsConfig, resolveAgentProfile, withPinnedModelProfiles } from "../lib/agents-config.ts";
|
|
9
|
+
import { __testing } from "../extensions/gentle-ai.ts";
|
|
10
|
+
import fast from "../extensions/gentle-fast.ts";
|
|
11
|
+
import { CHILD_TIER_ENV, PROFILE_TIER_EVENT } from "../lib/openai-fast-tier.ts";
|
|
12
|
+
import { runInProcessReviewer } from "../lib/inprocess-reviewer.ts";
|
|
13
|
+
import { bindSessionProfile, clearSessionProfileBinding } from "../lib/session-profile-binding.ts";
|
|
14
|
+
import { freezeSessionProfileAtStartup, readFrozenDefaultOrchestrator, readFrozenInheritedProfile, setFrozenDefaultOrchestrator } from "../lib/session-profile-freeze.ts";
|
|
15
|
+
|
|
16
|
+
test("All Fast sets compatible routes without toggling existing Fast or changing other fields", () => {
|
|
17
|
+
const model = "openai/gpt-6.1-sol";
|
|
18
|
+
const codex = "openai-codex/gpt-6.1-terra";
|
|
19
|
+
const draft = { orchestrator: { model, thinking: "high" as const, tier: "standard" as const }, worker: { model: codex, thinking: "medium" as const }, verify: { model, tier: "fast" as const }, other: { model: "other/model", tier: "standard" as const }, inherited: { thinking: "high" as const } };
|
|
20
|
+
const original = structuredClone(draft);
|
|
21
|
+
for (const width of [72, 120]) {
|
|
22
|
+
const results: any[] = [];
|
|
23
|
+
__testing.routingTablePanel(draft, [model, codex], ["worker", "verify", "other", "inherited"], width, undefined, undefined, ["a", "a", "s"], [], results, { fastModels: [model, codex] });
|
|
24
|
+
assert.equal(results.length, 1);
|
|
25
|
+
assert.equal(results[0].type, "save");
|
|
26
|
+
assert.equal(results[0].name, "current");
|
|
27
|
+
assert.deepEqual(results[0].config, { ...original, orchestrator: { ...original.orchestrator, tier: "fast" }, worker: { ...original.worker, tier: "fast" } });
|
|
28
|
+
assert.deepEqual(draft, original, "editing does not mutate the original profile");
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test("All Fast is clickable at narrow and wide widths and does not save or apply by itself", () => {
|
|
33
|
+
const model = "openai/gpt-6.1-sol";
|
|
34
|
+
const draft = { orchestrator: { model }, worker: { model } };
|
|
35
|
+
for (const width of [72, 120]) {
|
|
36
|
+
const args: [typeof draft, string[], string[], number, undefined, undefined] = [draft, [model], ["worker"], width, undefined, undefined];
|
|
37
|
+
const options = { fastModels: [model] };
|
|
38
|
+
const before = __testing.routingTablePanel(...args, [], [], [], options);
|
|
39
|
+
const y = before.findIndex(line => line.includes("All Fast"));
|
|
40
|
+
assert.notEqual(y, -1, `All Fast is visible at ${width} columns`);
|
|
41
|
+
const results: any[] = [];
|
|
42
|
+
const after = __testing.routingTablePanel(...args, [], [{ type: "click", x: before[y].indexOf("All Fast") + 2, y }], results, options);
|
|
43
|
+
assert.equal(after.filter(line => line.includes("Fast ▾")).length, 2);
|
|
44
|
+
assert.match(after.join("\n"), /2 unsaved/);
|
|
45
|
+
assert.deepEqual(results, [], "bulk edit does not silently save or change session/defaults");
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("individual tier selection still overrides All Fast", () => {
|
|
50
|
+
const model = "openai/gpt-6.1-sol";
|
|
51
|
+
const results: any[] = [];
|
|
52
|
+
__testing.routingTablePanel({ orchestrator: { model }, worker: { model } }, [model], ["worker"], 120, undefined, undefined, ["a", "t", "s"], [], results, { fastModels: [model] });
|
|
53
|
+
assert.equal(results[0].config.orchestrator.tier, "standard");
|
|
54
|
+
assert.equal(results[0].config.worker.tier, "fast");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("profile UI saves Fast for both providers and independent roles", () => {
|
|
58
|
+
for (const provider of ["openai", "openai-codex"]) {
|
|
59
|
+
const model = `${provider}/gpt-5.6-luna`;
|
|
60
|
+
const results: any[] = [];
|
|
61
|
+
const lines = __testing.routingTablePanel({ orchestrator: { model }, worker: { model } }, [model], ["worker"], 120, undefined, undefined, ["t", "j", "j", "t", "s"], [], results, { fastModels: [model] });
|
|
62
|
+
assert.match(lines.join("\n"), /Fast/);
|
|
63
|
+
assert.equal(results[0].type, "save");
|
|
64
|
+
assert.equal(results[0].config.orchestrator.tier, "fast");
|
|
65
|
+
assert.equal(results[0].config.worker.tier, "fast");
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("tier and fallback controls coexist at narrow and wide widths", () => {
|
|
70
|
+
const model = "openai/gpt-5.6-luna";
|
|
71
|
+
const draft = { orchestrator: { model } };
|
|
72
|
+
const fallbacks = { chain: () => [{ model: "fallback/model" }], save: () => undefined };
|
|
73
|
+
for (const width of [72, 120]) {
|
|
74
|
+
const options = { fastModels: [model], fallbacks };
|
|
75
|
+
const screen = __testing.routingTablePanel(draft, [model], [], width, undefined, undefined, [], [], [], options);
|
|
76
|
+
const row = screen.findIndex((line) => line.includes("Standard ▾"));
|
|
77
|
+
assert.notEqual(row, -1, `tier is fully visible at ${width} columns`);
|
|
78
|
+
const tierX = screen[row].indexOf("Standard") + 1;
|
|
79
|
+
const clicked = __testing.routingTablePanel(draft, [model], [], width, undefined, undefined, [], [{ type: "click", x: tierX, y: row }], [], options);
|
|
80
|
+
assert.match(clicked.join("\n"), /Fast ▾/);
|
|
81
|
+
assert.match(clicked.join("\n"), /↑↓ agent/);
|
|
82
|
+
if (width === 72) assert.doesNotMatch(clicked.join("\n"), /t tier/);
|
|
83
|
+
else assert.match(clicked.join("\n"), /t tier/);
|
|
84
|
+
}
|
|
85
|
+
const wide = __testing.routingTablePanel(draft, [model], [], 120, undefined, undefined, ["t"], [], [], { fastModels: [model], fallbacks });
|
|
86
|
+
assert.match(wide.join("\n"), /Fast ▾\s+↪ fallback\/model/);
|
|
87
|
+
const fallbackCard = __testing.routingTablePanel(draft, [model], [], 120, undefined, undefined, ["f"], [], [], { fastModels: [model], fallbacks });
|
|
88
|
+
assert.match(fallbackCard.join("\n"), /Fallbacks for the orchestrator/);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test("profile UI does not offer tier for an unsupported route", () => {
|
|
92
|
+
const results: any[] = [];
|
|
93
|
+
__testing.routingTablePanel({ orchestrator: { model: "openai/other" } }, [], [], 100, undefined, undefined, ["t", "s"], [], results, { fastModels: [] });
|
|
94
|
+
assert.deepEqual(results, []);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
for (const provider of ["openai", "openai-codex"]) {
|
|
98
|
+
test(`${provider} profile retains Fast through normalization and session replay`, () => {
|
|
99
|
+
const model = `${provider}/gpt-5.6-luna`;
|
|
100
|
+
const result = normalizeProfilesFile({ kind: PROFILES_KIND, version: PROFILES_VERSION, profiles: { work: { orchestrator: { model, thinking: "high", tier: "fast" } } } });
|
|
101
|
+
assert.ok(result);
|
|
102
|
+
assert.deepEqual(result.file.profiles.work.orchestrator, { model, thinking: "high", tier: "fast" });
|
|
103
|
+
const binding = createSessionProfileBind("work", result.file.profiles.work);
|
|
104
|
+
assert.deepEqual(replaySessionProfileBranch([{ type: "custom", customType: SESSION_PROFILE_CUSTOM_TYPE, data: binding }]), { status: "bound", binding, entryIndex: 0 });
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
test("profile clone, file and export roundtrips preserve independent tier routes", () => {
|
|
109
|
+
const route = { orchestrator: { model: "openai/gpt-5.6-luna", thinking: "high" as const, tier: "fast" as const }, worker: { model: "openai-codex/gpt-5.6-sol", tier: "standard" as const } };
|
|
110
|
+
const file = duplicateProfile(createProfile(emptyProfilesFile(), "work", route), "work", "copy");
|
|
111
|
+
route.orchestrator.tier = "standard" as any;
|
|
112
|
+
assert.equal(file.profiles.copy.orchestrator.tier, "fast");
|
|
113
|
+
const parsed = parseProfilesFileText(serializeProfilesFile(file));
|
|
114
|
+
assert.equal(parsed.status, "valid");
|
|
115
|
+
if (parsed.status === "valid") assert.equal(parsed.file.profiles.copy.worker.tier, "standard");
|
|
116
|
+
assert.deepEqual(JSON.parse(JSON.stringify(parseProfileExportText(serializeProfileExport("work", file.profiles.work))?.config)), file.profiles.work);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test("child profile resolver carries the tier from the selected route", () => {
|
|
120
|
+
const config = withPinnedModelProfiles(parseAgentsConfig(undefined, undefined), { worker: { model: "openai/gpt-5.6-luna", thinking: "high", tier: "fast" } });
|
|
121
|
+
const agent = { name: "worker", description: "", filePath: "", scope: "global" as const, instructions: "", model: undefined, thinking: undefined, mode: undefined, tools: [] };
|
|
122
|
+
assert.equal(resolveAgentProfile(agent, config).tier, "fast");
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test("old and invalid-tier routes preserve model and effort normalization", () => {
|
|
126
|
+
assert.deepEqual(normalizeRoutingEntry({ model: "openai/gpt-5.6-luna", effort: "high" }), { model: "openai/gpt-5.6-luna", thinking: "high" });
|
|
127
|
+
assert.deepEqual(normalizeRoutingEntry({ model: "openai/gpt-5.6-luna", thinking: "low", tier: "invalid" }), { model: "openai/gpt-5.6-luna", thinking: "low" });
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test("profile application switches tiers without affecting unsupported models", async () => {
|
|
131
|
+
const handlers = new Map<string, Function>();
|
|
132
|
+
const bus = new Map<string, Function>();
|
|
133
|
+
const model = { provider: "openai-codex", api: "openai-codex-responses", id: "gpt-5.6-luna" };
|
|
134
|
+
const ctx: any = { model, hasUI: false, sessionManager: { getSessionId: () => "profile-test" }, ui: { notify() {} } };
|
|
135
|
+
fast({ on: (name: string, fn: Function) => handlers.set(name, fn), events: { on: (name: string, fn: Function) => bus.set(name, fn) } } as any);
|
|
136
|
+
handlers.get("session_start")!({}, ctx);
|
|
137
|
+
const request = () => handlers.get("before_provider_request")!({ payload: {} }, ctx);
|
|
138
|
+
bus.get(PROFILE_TIER_EVENT)!({ sessionId: "profile-test", tier: "fast", model: "openai-codex/gpt-5.6-luna" });
|
|
139
|
+
assert.equal(request().service_tier, "priority");
|
|
140
|
+
bus.get(PROFILE_TIER_EVENT)!({ sessionId: "profile-test", tier: "standard", model: "openai-codex/gpt-5.6-luna" });
|
|
141
|
+
assert.equal(request().service_tier, "default");
|
|
142
|
+
bus.get(PROFILE_TIER_EVENT)!({ sessionId: "profile-test", tier: undefined });
|
|
143
|
+
assert.equal(request(), undefined);
|
|
144
|
+
bus.get(PROFILE_TIER_EVENT)!({ sessionId: "other", tier: "fast" });
|
|
145
|
+
assert.equal(request(), undefined);
|
|
146
|
+
bus.get(PROFILE_TIER_EVENT)!({ sessionId: "profile-test", tier: "fast", model: "openai-codex/gpt-5.6-luna" });
|
|
147
|
+
ctx.model = { ...model, id: "gpt-5.6-sol" };
|
|
148
|
+
handlers.get("model_select")!({ model: ctx.model }, ctx);
|
|
149
|
+
assert.equal(request(), undefined);
|
|
150
|
+
ctx.model = { ...model, api: "openai-completions" };
|
|
151
|
+
assert.equal(request(), undefined);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test("session tree restores its frozen profile binding", async () => {
|
|
155
|
+
const handlers = new Map<string, Function>();
|
|
156
|
+
const bus = new Map<string, Function>();
|
|
157
|
+
const model = { provider: "openai", api: "openai-responses", id: "gpt-5.6-luna" };
|
|
158
|
+
const ctx: any = { model, hasUI: false, sessionManager: { getSessionId: () => "tier-restore-test" }, ui: { notify() {} } };
|
|
159
|
+
fast({ on: (name: string, fn: Function) => handlers.set(name, fn), events: { on: (name: string, fn: Function) => bus.set(name, fn) } } as any);
|
|
160
|
+
const previousChild = process.env.GENTLE_PI_AGENTS_CHILD;
|
|
161
|
+
process.env.GENTLE_PI_AGENTS_CHILD = "0";
|
|
162
|
+
bindSessionProfile("tier-restore-test", "work", { orchestrator: { model: "openai/gpt-5.6-luna", tier: "fast" } });
|
|
163
|
+
try {
|
|
164
|
+
handlers.get("session_start")!({}, ctx);
|
|
165
|
+
const request = () => handlers.get("before_provider_request")!({ payload: {} }, ctx);
|
|
166
|
+
assert.equal(request().service_tier, "priority");
|
|
167
|
+
bus.get(PROFILE_TIER_EVENT)!({ sessionId: "tier-restore-test", tier: "standard", model: "openai/gpt-5.6-luna" });
|
|
168
|
+
assert.equal(request().service_tier, "default");
|
|
169
|
+
handlers.get("session_tree")!({}, ctx);
|
|
170
|
+
assert.equal(request().service_tier, "priority");
|
|
171
|
+
} finally {
|
|
172
|
+
clearSessionProfileBinding("tier-restore-test");
|
|
173
|
+
if (previousChild === undefined) delete process.env.GENTLE_PI_AGENTS_CHILD;
|
|
174
|
+
else process.env.GENTLE_PI_AGENTS_CHILD = previousChild;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test("child runtime uses only its launch route and rejects model mismatches", () => {
|
|
179
|
+
const oldChild = process.env.GENTLE_PI_AGENTS_CHILD;
|
|
180
|
+
const oldTier = process.env[CHILD_TIER_ENV];
|
|
181
|
+
const handlers = new Map<string, Function>();
|
|
182
|
+
const ctx: any = { model: { provider: "openai-codex", api: "openai-codex-responses", id: "gpt-5.6-luna" }, hasUI: false, sessionManager: { getSessionId: () => "child" }, ui: { notify() {} } };
|
|
183
|
+
fast({ on: (name: string, fn: Function) => handlers.set(name, fn) } as any);
|
|
184
|
+
try {
|
|
185
|
+
process.env.GENTLE_PI_AGENTS_CHILD = "1";
|
|
186
|
+
process.env[CHILD_TIER_ENV] = JSON.stringify({ model: "openai-codex/gpt-5.6-luna", tier: "fast" });
|
|
187
|
+
handlers.get("session_start")!({}, ctx);
|
|
188
|
+
assert.equal(handlers.get("before_provider_request")!({ payload: {} }, ctx).service_tier, "priority");
|
|
189
|
+
process.env[CHILD_TIER_ENV] = JSON.stringify({ model: "openai/gpt-5.6-luna", tier: "fast" });
|
|
190
|
+
handlers.get("session_start")!({}, ctx);
|
|
191
|
+
assert.equal(handlers.get("before_provider_request")!({ payload: {} }, ctx), undefined);
|
|
192
|
+
} finally {
|
|
193
|
+
if (oldChild === undefined) delete process.env.GENTLE_PI_AGENTS_CHILD; else process.env.GENTLE_PI_AGENTS_CHILD = oldChild;
|
|
194
|
+
if (oldTier === undefined) delete process.env[CHILD_TIER_ENV]; else process.env[CHILD_TIER_ENV] = oldTier;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
test("fresh default tier is frozen per session and used only for its model", () => {
|
|
199
|
+
let current: any = { model: "openai/gpt-5.6-luna", tier: "fast" };
|
|
200
|
+
const options: any = { sessionId: "tier-default-test", cwd: "/nonexistent", configHome: "/nonexistent", env: {}, resolveWorktree: () => undefined, readDefaultOrchestrator: () => current };
|
|
201
|
+
freezeSessionProfileAtStartup(options);
|
|
202
|
+
current = { model: "openai/gpt-5.6-luna", tier: "standard" };
|
|
203
|
+
freezeSessionProfileAtStartup(options);
|
|
204
|
+
assert.equal(readFrozenInheritedProfile("tier-default-test")?.defaultOrchestrator?.tier, "fast");
|
|
205
|
+
freezeSessionProfileAtStartup({ ...options, sessionId: "tier-default-new" });
|
|
206
|
+
assert.equal(readFrozenInheritedProfile("tier-default-new")?.defaultOrchestrator?.tier, "standard");
|
|
207
|
+
freezeSessionProfileAtStartup({ ...options, sessionId: "tier-default-follow", env: { GENTLE_PI_PROFILE_FOLLOW: "1" } });
|
|
208
|
+
current = { model: "openai/gpt-5.6-luna", tier: "fast" };
|
|
209
|
+
freezeSessionProfileAtStartup({ ...options, sessionId: "tier-default-follow", env: { GENTLE_PI_PROFILE_FOLLOW: "1" } });
|
|
210
|
+
assert.equal(readFrozenDefaultOrchestrator("tier-default-follow")?.tier, "standard");
|
|
211
|
+
current = { model: "openai/gpt-5.6-luna", tier: "standard" };
|
|
212
|
+
const handlers = new Map<string, Function>();
|
|
213
|
+
const ctx: any = { model: { provider: "openai", api: "openai-responses", id: "gpt-5.6-luna" }, cwd: "/nonexistent", hasUI: false, sessionManager: { getSessionId: () => "tier-default-test" }, ui: { notify() {} } };
|
|
214
|
+
fast({ on: (name: string, fn: Function) => handlers.set(name, fn) } as any);
|
|
215
|
+
const old = process.env.GENTLE_PI_AGENTS_CHILD;
|
|
216
|
+
try {
|
|
217
|
+
process.env.GENTLE_PI_AGENTS_CHILD = "0";
|
|
218
|
+
handlers.get("session_start")!({}, ctx);
|
|
219
|
+
assert.equal(handlers.get("before_provider_request")!({ payload: {} }, ctx)?.service_tier, "priority");
|
|
220
|
+
bindSessionProfile("tier-default-test", "explicit", { orchestrator: { model: "openai/gpt-5.6-luna", tier: "standard" } });
|
|
221
|
+
handlers.get("session_start")!({}, ctx);
|
|
222
|
+
assert.equal(handlers.get("before_provider_request")!({ payload: {} }, ctx)?.service_tier, "default");
|
|
223
|
+
bindSessionProfile("tier-default-test", "old", { worker: { model: "openai/gpt-5.6-luna" } });
|
|
224
|
+
handlers.get("session_start")!({}, ctx);
|
|
225
|
+
assert.equal(handlers.get("before_provider_request")!({ payload: {} }, ctx), undefined);
|
|
226
|
+
clearSessionProfileBinding("tier-default-test");
|
|
227
|
+
setFrozenDefaultOrchestrator("tier-default-test", current);
|
|
228
|
+
handlers.get("session_start")!({}, ctx);
|
|
229
|
+
assert.equal(handlers.get("before_provider_request")!({ payload: {} }, ctx)?.service_tier, "default");
|
|
230
|
+
ctx.model = { ...ctx.model, id: "gpt-5.6-sol" };
|
|
231
|
+
handlers.get("session_start")!({}, ctx);
|
|
232
|
+
assert.equal(handlers.get("before_provider_request")!({ payload: {} }, ctx), undefined);
|
|
233
|
+
} finally { if (old === undefined) delete process.env.GENTLE_PI_AGENTS_CHILD; else process.env.GENTLE_PI_AGENTS_CHILD = old; }
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
for (const provider of ["openai", "openai-codex"]) for (const order of ["fast-first", "profiles-first"]) {
|
|
237
|
+
test(`${provider}/${order} selecting a thinking-only profile clears Fast without switching models`, async () => {
|
|
238
|
+
const model = { provider, api: provider === "openai" ? "openai-responses" : "openai-codex-responses", id: "gpt-5.6-luna" };
|
|
239
|
+
const ref = `${provider}/${model.id}`;
|
|
240
|
+
const manager = SessionManager.inMemory("/nonexistent");
|
|
241
|
+
const integration = createSessionProfileIntegration();
|
|
242
|
+
integration.start(manager, (type, data) => { manager.appendCustomEntry(type, data); }, { reason: "startup" });
|
|
243
|
+
const handlers = new Map<string, Function>();
|
|
244
|
+
const listeners = new Map<string, Function[]>();
|
|
245
|
+
const bus: any = { on: (name: string, fn: Function) => listeners.set(name, [...(listeners.get(name) ?? []), fn]), emit: (name: string, data: unknown) => { for (const fn of listeners.get(name) ?? []) fn(data); } };
|
|
246
|
+
const fastCtx: any = { model, hasUI: false, sessionManager: { getSessionId: () => manager.getSessionId() }, ui: { notify() {} } };
|
|
247
|
+
const ctx: any = { model, sessionManager: manager, modelRegistry: { find: () => model }, hasUI: false, ui: { notify() {} } };
|
|
248
|
+
let switched = 0;
|
|
249
|
+
let succeeds = true;
|
|
250
|
+
const live: any = { events: bus, setModel: async () => { switched++; return succeeds; }, setThinkingLevel() { throw new Error("thinking-only must not change thinking"); }, getThinkingLevel: () => "high" };
|
|
251
|
+
const file = createProfile(createProfile(createProfile(emptyProfilesFile(), "fast", { orchestrator: { model: ref, tier: "fast" } }), "old", { orchestrator: { thinking: "high" } }), "standard", { orchestrator: { model: ref, tier: "standard" } });
|
|
252
|
+
const installFast = () => fast({ on: (name: string, fn: Function) => handlers.set(name, fn), events: bus } as any);
|
|
253
|
+
let select!: (name: string) => Promise<void>;
|
|
254
|
+
const installProfiles = () => { select = async (name) => {
|
|
255
|
+
const result: any[] = [];
|
|
256
|
+
__testing.routingTablePanel(file.profiles[name], [ref], [], 100, undefined, undefined, ["u"], [], result, { file, profileName: name, fastModels: [ref] });
|
|
257
|
+
assert.equal(result[0]?.type, "use-session");
|
|
258
|
+
await __testing.runProfilesPanelAction(ctx, live, "/nonexistent/profiles.json", file, result[0]);
|
|
259
|
+
}; };
|
|
260
|
+
if (order === "fast-first") { installFast(); installProfiles(); } else { installProfiles(); installFast(); }
|
|
261
|
+
handlers.get("session_start")!({}, fastCtx);
|
|
262
|
+
const request = () => handlers.get("before_provider_request")!({ payload: {} }, fastCtx);
|
|
263
|
+
await select("fast");
|
|
264
|
+
assert.equal(request()?.service_tier, "priority", `${provider}/${order}: fast selection`);
|
|
265
|
+
const previousSwitches = switched;
|
|
266
|
+
await select("old");
|
|
267
|
+
assert.equal(request(), undefined, `${provider}/${order}: thinking-only must clear Fast`);
|
|
268
|
+
assert.equal(switched, previousSwitches, `${provider}/${order}: no model switch`);
|
|
269
|
+
await select("fast");
|
|
270
|
+
assert.equal(request()?.service_tier, "priority");
|
|
271
|
+
succeeds = false;
|
|
272
|
+
await select("standard");
|
|
273
|
+
assert.equal(request()?.service_tier, "priority", `${provider}/${order}: failed Standard switch preserves profile Fast`);
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
test("live switching emits tier only for successful and current model switches", async () => {
|
|
278
|
+
const model: any = { provider: "openai", api: "openai-responses", id: "gpt-5.6-luna" };
|
|
279
|
+
const ctx: any = { sessionManager: { getSessionId: () => "test" }, modelRegistry: { find: () => model }, hasUI: false };
|
|
280
|
+
const emitted: any[] = [];
|
|
281
|
+
let success = false;
|
|
282
|
+
let current = true;
|
|
283
|
+
const live: any = { setModel: async () => success, getThinkingLevel: () => "high", setThinkingLevel() {}, events: { emit: (...args: any[]) => emitted.push(args) } };
|
|
284
|
+
const route: any = { model: "openai/gpt-5.6-luna", tier: "fast" };
|
|
285
|
+
await __testing.switchLiveOrchestrator(ctx, live, route, () => current);
|
|
286
|
+
assert.equal(emitted.length, 0);
|
|
287
|
+
success = true;
|
|
288
|
+
current = false;
|
|
289
|
+
await __testing.switchLiveOrchestrator(ctx, live, route, () => current);
|
|
290
|
+
assert.equal(emitted.length, 0);
|
|
291
|
+
current = true;
|
|
292
|
+
await __testing.switchLiveOrchestrator(ctx, live, route, () => current);
|
|
293
|
+
assert.deepEqual(emitted, [[PROFILE_TIER_EVENT, { sessionId: "test", tier: "fast", model: "openai/gpt-5.6-luna" }]]);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
test("direct provider route applies tier through the provider payload hook", async () => {
|
|
297
|
+
for (const [provider, api] of [["openai", "openai-responses"], ["openai-codex", "openai-codex-responses"]]) {
|
|
298
|
+
const model: any = { provider, api, id: "gpt-5.6-luna", reasoning: false };
|
|
299
|
+
let options: any;
|
|
300
|
+
const registry: any = { find: () => model, getApiKeyAndHeaders: async () => ({ ok: true }) };
|
|
301
|
+
const complete: any = async (_model: any, _context: any, value: any) => { options = value; return { content: [{ type: "text", text: "ok" }], stopReason: "stop" }; };
|
|
302
|
+
const result = await runInProcessReviewer({ selection: `${provider}/${model.id}`, tier: "fast", prompt: Buffer.from("test"), timeoutMs: 1000, routingKey: "review-risk" }, { registry, complete });
|
|
303
|
+
assert.equal(result.kind, "text");
|
|
304
|
+
assert.deepEqual(await options.onPayload({ input: "x" }, model), { input: "x", service_tier: "priority" });
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
test("session snapshots reject invalid tier instead of silently changing binding", () => {
|
|
309
|
+
const entry = { type: "custom", customType: SESSION_PROFILE_CUSTOM_TYPE, data: { kind: "bind", origin: "user", name: "work", modelProfiles: { worker: { model: "openai/gpt-5.6-luna", tier: "invalid" } } } };
|
|
310
|
+
assert.deepEqual(readSessionProfileEntry(entry), { status: "invalid" });
|
|
311
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import { execFileSync } from "node:child_process";
|
|
2
|
+
import childProcess, { execFileSync } from "node:child_process";
|
|
3
3
|
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { syncBuiltinESMExports } from "node:module";
|
|
4
5
|
import { tmpdir } from "node:os";
|
|
5
6
|
import { join } from "node:path";
|
|
6
7
|
import test, { after } from "node:test";
|
|
@@ -24,7 +25,7 @@ import {
|
|
|
24
25
|
writeProfilePinSync,
|
|
25
26
|
} from "../lib/agent-profile-pin.ts";
|
|
26
27
|
import type { AgentModelConfig } from "../lib/model-routing-authority.ts";
|
|
27
|
-
import type
|
|
28
|
+
import { clearSessionWorktreeMemo, type WorktreeIdentity } from "../lib/session-worktree-registry.ts";
|
|
28
29
|
|
|
29
30
|
// Per-repository agent-model profile pins: two layers holding only a profile name,
|
|
30
31
|
// resolved at launch against the global profiles store. These tests never touch
|
|
@@ -368,3 +369,29 @@ test("normalizeProfilePin accepts only a value-level pin this version writes", (
|
|
|
368
369
|
assert.equal(normalizeProfilePin({ kind: PROFILE_PIN_KIND, version: PROFILE_PIN_VERSION, profile: "bad name" }), undefined);
|
|
369
370
|
assert.equal(normalizeProfilePin("deep-work"), undefined);
|
|
370
371
|
});
|
|
372
|
+
|
|
373
|
+
test("repeated profile pin status reads share a single Git resolution through the memoized resolver (#2922)", (t) => {
|
|
374
|
+
const repo = join(root, "memoized-status-reads");
|
|
375
|
+
mkdirSync(repo, { recursive: true });
|
|
376
|
+
execFileSync("git", ["init", "--quiet", repo]);
|
|
377
|
+
clearSessionWorktreeMemo();
|
|
378
|
+
|
|
379
|
+
let spawns = 0;
|
|
380
|
+
const original = childProcess.execFileSync;
|
|
381
|
+
childProcess.execFileSync = ((...args: Parameters<typeof original>) => {
|
|
382
|
+
if (args[0] === "git") spawns++;
|
|
383
|
+
return original(...args);
|
|
384
|
+
}) as typeof original;
|
|
385
|
+
syncBuiltinESMExports();
|
|
386
|
+
t.after(() => {
|
|
387
|
+
childProcess.execFileSync = original;
|
|
388
|
+
syncBuiltinESMExports();
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
const first = readProfilePinStatus(repo);
|
|
392
|
+
assert.ok(first);
|
|
393
|
+
for (let i = 0; i < 5; i++) {
|
|
394
|
+
assert.deepEqual(readProfilePinStatus(repo), first);
|
|
395
|
+
}
|
|
396
|
+
assert.equal(spawns, 2, "repeated status reads must not spawn additional git rev-parse children");
|
|
397
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { mkdtempSync, writeFileSync, rmSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { visibleWidth } from "@earendil-works/pi-tui";
|
|
7
|
+
import { buildShellBarModel, createActiveProfileReader } from "../extensions/gentle-shell.ts";
|
|
8
|
+
import { bindSessionProfile, resetSessionProfileBindingsForTesting } from "../lib/session-profile-binding.ts";
|
|
9
|
+
import { renderShellStatusBar, renderShellTitleRow, renderShellBar, type ShellBarModel } from "../lib/shell-bar.ts";
|
|
10
|
+
|
|
11
|
+
const theme = { fg: (_role: string, text: string) => text, bold: (text: string) => text };
|
|
12
|
+
const base: ShellBarModel = {
|
|
13
|
+
cwd: "/fixture", branch: "main", dirty: 0, sessionName: "fixture",
|
|
14
|
+
modelId: "gpt-6.1-sol", effort: "xhigh", contextPercent: 95, contextWindow: 200000,
|
|
15
|
+
costTotal: 13.21, subscription: false, usage: undefined, statuses: [],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
test("bottom tier reads the named profile configuration, not its older session snapshot", (t) => {
|
|
19
|
+
const home = mkdtempSync(join(tmpdir(), "profile-tier-footer-"));
|
|
20
|
+
t.after(() => { resetSessionProfileBindingsForTesting(); rmSync(home, { recursive: true, force: true }); });
|
|
21
|
+
const profiles = { team: { orchestrator: { model: "openai/gpt-6.1-sol", tier: "fast" } }, other: { orchestrator: { model: "openai/gpt-6.1-sol", tier: "standard" } } };
|
|
22
|
+
const save = (active: string) => writeFileSync(join(home, "profiles.json"), JSON.stringify({ kind: "gentle-pi.agent_model_profiles", version: 1, active, profiles }));
|
|
23
|
+
save("team");
|
|
24
|
+
bindSessionProfile("footer-tier", "team", { orchestrator: { model: "openai/gpt-6.1-sol" } });
|
|
25
|
+
const reader = createActiveProfileReader({ GENTLE_PI_CONFIG_HOME: home });
|
|
26
|
+
reader.bind(home, () => undefined, "footer-tier");
|
|
27
|
+
assert.equal(reader(), "team (session)");
|
|
28
|
+
assert.equal(reader.tier(), "fast", "the configured tier shows even when the binding has no tier");
|
|
29
|
+
save("other"); reader.refresh();
|
|
30
|
+
assert.equal(reader.tier(), "fast", "a different global default does not replace the session's named profile");
|
|
31
|
+
profiles.team.orchestrator.tier = "standard"; save("other");
|
|
32
|
+
assert.equal(reader.refresh(), true, "tier changes invalidate footer presentation");
|
|
33
|
+
assert.equal(reader.tier(), "standard");
|
|
34
|
+
assert.equal(reader(), "team (session)", "existing profile labeling is unchanged");
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("bottom bar places configured Fast or Standard beside effort without changing other bars", () => {
|
|
38
|
+
for (const profileTier of ["fast", "standard"] as const) {
|
|
39
|
+
const configured = { ...base, profileTier };
|
|
40
|
+
for (const width of [40, 60, 72, 80, 120, 140, 180]) {
|
|
41
|
+
const row = renderShellStatusBar(configured, theme, width).rows[0]!;
|
|
42
|
+
assert.equal(visibleWidth(row), width);
|
|
43
|
+
if (width >= 72) assert.match(row, new RegExp("gpt-6.1-sol · xhigh · " + (profileTier === "fast" ? "Fast" : "Standard")));
|
|
44
|
+
assert.match(row, /ctx.*95%/);
|
|
45
|
+
assert.match(row, /\$13\.21/);
|
|
46
|
+
}
|
|
47
|
+
const narrow = renderShellStatusBar({ ...configured, permission: { mode: "SUPER YOLO" } }, theme, 72).rows[0]!;
|
|
48
|
+
assert.ok(narrow.includes("gpt-6.1-sol · xhigh"), "the new tier yields before displacing the existing model and effort");
|
|
49
|
+
assert.equal(renderShellTitleRow(configured, theme, 120), renderShellTitleRow(base, theme, 120));
|
|
50
|
+
assert.deepEqual(renderShellBar(configured, theme, 120), renderShellBar(base, theme, 120));
|
|
51
|
+
}
|
|
52
|
+
assert.doesNotMatch(renderShellStatusBar(base, theme, 120).rows[0]!, /No tier|Fast|Standard|server/);
|
|
53
|
+
const both = { ...base, profileTier: "fast" as const, profile: "team (session)" };
|
|
54
|
+
assert.match(renderShellStatusBar(both, theme, 140).rows[0]!, /gpt-6\.1-sol · xhigh · Fast · team \(session\) │/, "the profile follows the tier");
|
|
55
|
+
const tight = renderShellStatusBar(both, theme, 72).rows[0]!;
|
|
56
|
+
assert.match(tight, /gpt-6\.1-sol · xhigh · Fast/, "the profile gives way before the tier");
|
|
57
|
+
assert.doesNotMatch(tight, /team \(session\)/);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test("legacy tier integration is excluded while permission warnings and other statuses survive", () => {
|
|
61
|
+
const pi = { getThinkingLevel: () => "xhigh" } as any;
|
|
62
|
+
const ctx = {
|
|
63
|
+
model: { provider: "openai", api: "openai-responses", id: "gpt-6.1-sol", reasoning: true },
|
|
64
|
+
getContextUsage: () => ({ percent: 95, contextWindow: 200000 }),
|
|
65
|
+
modelRegistry: { isUsingOAuth: () => false },
|
|
66
|
+
sessionManager: { getCwd: () => "/fixture", getSessionName: () => "fixture", getEntries: () => [] },
|
|
67
|
+
} as any;
|
|
68
|
+
const footer = {
|
|
69
|
+
getGitBranch: () => "main",
|
|
70
|
+
getExtensionStatuses: () => new Map([
|
|
71
|
+
["gentle-fast", "No tier selected; last response from server: Standard (default)"],
|
|
72
|
+
["gentle:mode", "Permissions: SUPER YOLO"],
|
|
73
|
+
["gentle:yolo", "SUPER YOLO — no permission prompts; private paths stay blocked"],
|
|
74
|
+
["other", "ready"],
|
|
75
|
+
]),
|
|
76
|
+
} as any;
|
|
77
|
+
const model = buildShellBarModel(pi, ctx, footer, { profileTier: "fast" });
|
|
78
|
+
assert.equal(model.profileTier, "fast");
|
|
79
|
+
assert.deepEqual(model.integrations, ["ready"]);
|
|
80
|
+
assert.equal(model.permission?.detail, "no permission prompts; private paths stay blocked");
|
|
81
|
+
assert.ok(model.statuses.includes("ready"));
|
|
82
|
+
assert.ok(model.statuses.some(text => text.includes("private paths stay blocked")));
|
|
83
|
+
assert.ok(!model.statuses.some(text => /No tier|last response/.test(text)));
|
|
84
|
+
});
|