gentle-pi 4.6.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -55
- package/assets/agents/gentle-ai-explore.md +4 -3
- package/assets/agents/gentle-ai-verify.md +23 -6
- package/assets/agents/gentle-ai-worker.md +9 -6
- package/assets/agents/jd-fix-agent.md +1 -0
- package/assets/agents/jd-judge-a.md +2 -3
- package/assets/agents/jd-judge-b.md +2 -3
- package/assets/agents/review-readability.md +1 -5
- package/assets/agents/review-reliability.md +1 -5
- package/assets/agents/review-resilience.md +1 -5
- package/assets/agents/review-risk.md +1 -5
- package/assets/design-canvas/canvas-api.js +45 -0
- package/assets/design-canvas/canvas-boards.js +456 -0
- package/assets/design-canvas/canvas-boot.js +217 -0
- package/assets/design-canvas/canvas-checks.js +491 -0
- package/assets/design-canvas/canvas-comments.js +315 -0
- package/assets/design-canvas/canvas-compare.js +159 -0
- package/assets/design-canvas/canvas-events.js +75 -0
- package/assets/design-canvas/canvas-export.js +393 -0
- package/assets/design-canvas/canvas-focus.js +203 -0
- package/assets/design-canvas/canvas-handoffs.js +150 -0
- package/assets/design-canvas/canvas-i18n-es.js +392 -0
- package/assets/design-canvas/canvas-i18n.js +108 -0
- package/assets/design-canvas/canvas-layout.js +526 -0
- package/assets/design-canvas/canvas-menu.js +213 -0
- package/assets/design-canvas/canvas-messages.js +86 -0
- package/assets/design-canvas/canvas-minimap.js +163 -0
- package/assets/design-canvas/canvas-parts.js +401 -0
- package/assets/design-canvas/canvas-popover.js +234 -0
- package/assets/design-canvas/canvas-rail.js +348 -0
- package/assets/design-canvas/canvas-sizes.js +524 -0
- package/assets/design-canvas/canvas-store.js +164 -0
- package/assets/design-canvas/canvas-tokens.js +674 -0
- package/assets/design-canvas/canvas-ui.js +24 -0
- package/assets/design-canvas/canvas-view.js +184 -0
- package/assets/design-canvas/canvas.css +759 -16
- package/assets/design-canvas/canvas.js +2 -1497
- package/assets/design-canvas/index.html +117 -36
- package/assets/design-canvas/inspector.js +546 -16
- package/assets/install-wizard/wizard.js +6 -1
- package/assets/migrations/agent-body-history.json +40 -1
- package/assets/orchestrator-delegation-reference.md +10 -16
- package/assets/orchestrator-delegation.md +5 -5
- package/assets/orchestrator-full-delegation-card.md +64 -0
- package/assets/orchestrator-full-delegation.md +34 -0
- package/assets/orchestrator-memory.md +5 -5
- package/assets/orchestrator-prompts.md +2 -2
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +14 -13
- package/assets/orchestrator-tracking.md +10 -14
- package/assets/orchestrator-verification.md +12 -8
- package/assets/orchestrator-writer.md +4 -4
- package/assets/orchestrator.md +21 -25
- package/bin/gentle-shell.mjs +292 -65
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/orchestration/pi.md +1 -0
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/routing/pi.md +6 -6
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/agent-status.md +61 -0
- package/docs/assets/brand/sponsor-banner.svg +60 -0
- package/docs/bundled-install.md +20 -10
- package/docs/delegated-verification.md +46 -8
- package/docs/desktop-rpc.md +1253 -0
- package/docs/gentle-agents-activity.md +40 -0
- package/docs/gentle-shell.md +91 -30
- package/docs/install-wizard.md +30 -21
- package/docs/odd-preparation-continuity.md +24 -0
- package/docs/permission-modes.md +17 -4
- package/docs/prompt-budget.md +12 -0
- package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
- package/docs/readme-reference.md +142 -45
- package/docs/render-cache-performance.md +11 -1
- package/docs/review-coordinator.md +53 -0
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/review-request-context.md +19 -0
- package/docs/review-windows-acl.md +18 -0
- package/docs/voice.md +6 -3
- package/docs/work-continuity.md +11 -1
- package/docs/yolo-mode.md +5 -5
- package/extensions/ask-user-choice.ts +1 -0
- package/extensions/ask-user-question.ts +3 -2
- package/extensions/child-context.ts +21 -7
- package/extensions/child-safety.ts +3 -0
- package/extensions/gentle-agent-status.ts +99 -0
- package/extensions/gentle-agents.ts +559 -66
- package/extensions/gentle-ai.ts +2001 -518
- package/extensions/gentle-design.ts +69 -3
- package/extensions/gentle-desktop-rpc.ts +143 -0
- package/extensions/gentle-guide.ts +3 -0
- package/extensions/gentle-shell.ts +398 -115
- package/extensions/gentle-todo.ts +66 -27
- package/extensions/gentle-tps.ts +48 -0
- package/extensions/quiet-tools.ts +38 -8
- package/extensions/skill-registry.ts +349 -167
- package/extensions/startup-banner.ts +30 -3
- package/lib/agent-assets.ts +30 -6
- package/lib/agent-profile-pin.ts +3 -3
- package/lib/agent-profiles.ts +160 -2
- package/lib/agent-status.ts +105 -0
- package/lib/agent-tool-overlay.ts +117 -0
- package/lib/agents-config.ts +93 -6
- package/lib/agents-history.ts +24 -5
- package/lib/agents-message-delivery.ts +17 -0
- package/lib/agents-messaging.ts +55 -7
- package/lib/agents-protocol.ts +15 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-runner.ts +272 -16
- package/lib/agents-session-transport.ts +17 -1
- package/lib/auto-permission-runtime.ts +1 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/bounded-writer-admission.ts +197 -32
- package/lib/card-content-policy.ts +8 -6
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- package/lib/command-palette.ts +133 -17
- package/lib/context-backstop.ts +14 -5
- package/lib/delivery-conflict-markers.ts +349 -0
- package/lib/design-canvas-assets.ts +36 -0
- package/lib/design-canvas-server.ts +241 -23
- package/lib/design-comments.ts +94 -4
- package/lib/design-handoffs.ts +2 -1
- package/lib/design-layout.ts +125 -0
- package/lib/design-parts.ts +281 -0
- package/lib/design-system-tokens.ts +111 -0
- package/lib/desktop-agents-service.ts +294 -0
- package/lib/desktop-design-service.ts +233 -0
- package/lib/desktop-jobs-service.ts +263 -0
- package/lib/desktop-rpc-agents.ts +294 -0
- package/lib/desktop-rpc-config.ts +731 -0
- package/lib/desktop-rpc-design.ts +138 -0
- package/lib/desktop-rpc-jobs.ts +181 -0
- package/lib/desktop-rpc-permissions.ts +177 -0
- package/lib/desktop-rpc-profiles.ts +196 -0
- package/lib/desktop-rpc-usage.ts +229 -0
- package/lib/desktop-rpc.ts +225 -0
- package/lib/desktop-usage-service.ts +310 -0
- package/lib/destructive-command-guard.ts +236 -17
- package/lib/execution-surface-guard.ts +20 -0
- package/lib/exploration-budget.ts +4 -2
- package/lib/gentle-ai-binary.ts +1 -1
- package/lib/gentle-ai-renderer.ts +13 -1
- package/lib/gentle-design.ts +204 -14
- package/lib/gentle-shell-bundled.ts +106 -28
- package/lib/gentle-shell-launcher.ts +43 -8
- package/lib/herdr-activity.ts +14 -2
- package/lib/herdr-busy.ts +45 -0
- package/lib/hidden-tools.ts +35 -0
- package/lib/image-attachments.ts +33 -0
- package/lib/image-disk-cache.ts +137 -0
- package/lib/inprocess-reviewer.ts +358 -144
- package/lib/jobs-view.ts +198 -11
- package/lib/model-fallback-policy.ts +9 -0
- package/lib/model-routing-authority.ts +31 -4
- package/lib/nan-provider.ts +42 -28
- package/lib/native-choice-list.ts +20 -2
- package/lib/native-review-cli.ts +172 -20
- package/lib/orchestrator-discovery.ts +39 -2
- package/lib/orchestrator-mode-policy.ts +105 -0
- package/lib/questionnaire/questionnaire-view.ts +105 -12
- package/lib/rdd-mode-control.ts +32 -0
- package/lib/reply-language-anchor.ts +129 -0
- package/lib/request-context-placement.ts +53 -0
- package/lib/review-blocker.ts +92 -0
- package/lib/review-candidate-symlink-scan.ts +136 -0
- package/lib/review-candidate-view-owner.ts +81 -44
- package/lib/review-candidate-view.ts +11 -1
- package/lib/review-continuation-registry.ts +116 -0
- package/lib/review-coordinator.ts +407 -0
- package/lib/review-delivery-preflight.ts +85 -0
- package/lib/review-failure-facts.ts +49 -0
- package/lib/review-host-relay.ts +51 -11
- package/lib/review-integration-v2.ts +63 -4
- package/lib/review-relay-phase-timing.ts +45 -0
- package/lib/review-start-context.ts +17 -0
- package/lib/reviewer-stream.ts +87 -0
- package/lib/session-profile-freeze.ts +4 -2
- package/lib/shell-bar.ts +140 -58
- package/lib/shell-changes.ts +2 -0
- package/lib/shell-panel.ts +17 -3
- package/lib/shell-prompt.ts +16 -3
- package/lib/shell-sidebar-layout.ts +112 -40
- package/lib/shell-sidebar.ts +7 -0
- package/lib/shell-todo.ts +10 -3
- package/lib/shell-usage.ts +10 -0
- package/lib/verifier-admission.ts +1 -1
- package/lib/vim-editor-adapter.ts +9 -2
- package/lib/visual-customization-policy.ts +36 -16
- package/lib/visual-customize-view.ts +216 -21
- package/lib/visual-layout-preview.ts +9 -5
- package/lib/visual-profiles.ts +2 -2
- package/lib/windows-session-transport.ts +53 -2
- package/lib/writer-batch-admission.ts +55 -0
- package/lib/yolo-session-policy.ts +46 -16
- package/package.json +3 -2
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +37 -0
- package/runtime/gentle-ai-binary.mjs +1 -1
- package/runtime/gentle-shell-bundled.mjs +106 -28
- package/runtime/gentle-shell-launcher.mjs +42 -7
- package/runtime/native-review-cli.mjs +169 -17
- package/runtime/review-integration-v2.mjs +63 -4
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +179 -0
- package/scripts/build-runtime-modules.mjs +1 -0
- package/scripts/bundled-install.mjs +38 -8
- package/scripts/download-progress.mjs +68 -0
- package/scripts/gentle-ai-installer.mjs +41 -18
- package/scripts/gentle-ai-proxy.mjs +294 -0
- package/scripts/install-gentle-ai.mjs +14 -1
- package/scripts/installer-downloads.mjs +34 -8
- package/scripts/installer-preflight.mjs +33 -22
- package/scripts/installer-probes.mjs +25 -5
- package/scripts/installer-runner.mjs +27 -12
- package/scripts/installer-server.mjs +46 -16
- package/scripts/installer-windows.mjs +2 -2
- package/scripts/pi-update.mjs +166 -27
- package/scripts/prepare-verifier.mjs +107 -0
- package/scripts/render-cache-host.mjs +72 -0
- package/scripts/render-cache-performance-worker.mjs +5 -4
- package/scripts/render-cache-performance.mjs +6 -1
- package/scripts/run-test-suite.mjs +40 -28
- package/scripts/update-agent-body-history.mjs +55 -8
- package/scripts/verify-package-files.mjs +50 -19
- package/scripts/voice-worker.cjs +32 -6
- package/skills/branch-pr/SKILL.md +16 -16
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/design/SKILL.md +16 -13
- package/skills/gentle-ai/SKILL.md +7 -7
- package/skills/gentle-ui-design/SKILL.md +46 -0
- package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
- package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
- package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
- package/skills/gentle-ui-design/references/task-and-content.md +60 -0
- package/skills/judgment-day/SKILL.md +2 -2
- package/skills/judgment-day/references/prompts-and-formats.md +1 -1
- package/skills/rdd-defect-workflow/SKILL.md +6 -6
- package/skills/skill-improver/SKILL.md +2 -2
- package/skills/skill-registry/SKILL.md +11 -11
- package/skills/tui-design/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +10 -11
- package/tests/agent-home.test.ts +28 -9
- package/tests/agent-profiles-workflow.test.ts +163 -0
- package/tests/agent-prompt-diet-contract.test.ts +101 -0
- package/tests/agent-risk-escalation.test.ts +1 -1
- package/tests/agent-status.test.ts +143 -0
- package/tests/agent-tool-overlay-acceptance.test.ts +158 -0
- package/tests/agent-tool-overlay.test.ts +89 -0
- package/tests/agents-config.test.ts +106 -1
- package/tests/agents-history.test.ts +31 -0
- package/tests/agents-jobs-frames.test.ts +93 -0
- package/tests/agents-message-delivery.test.ts +36 -0
- package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
- package/tests/agents-queries.test.ts +144 -4
- package/tests/agents-report-cap.test.ts +126 -0
- package/tests/agents-runner-drain.test.ts +193 -0
- package/tests/agents-runner.test.ts +215 -3
- package/tests/agents-session-transport.test.ts +34 -0
- package/tests/always-on-prompt-verdicts-contract.test.ts +188 -0
- package/tests/append-system-prompt-route.test.ts +12 -1
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-choice.test.ts +4 -3
- package/tests/ask-user-question.test.ts +99 -1
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/auto-permission-runtime.test.ts +1 -1
- package/tests/autonomous-guard.test.ts +346 -10
- package/tests/bounded-stop-contract.test.ts +51 -3
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bridge-cost.test.ts +19 -4
- package/tests/bundled-install.test.ts +31 -6
- package/tests/card-content-policy.test.ts +3 -3
- package/tests/chained-pr-skill.test.ts +8 -6
- package/tests/child-context-files.test.ts +64 -8
- package/tests/child-safety.test.ts +11 -0
- package/tests/child-skills-catalog.test.ts +56 -0
- package/tests/codegraph-tools.test.ts +11 -5
- package/tests/codemode-rendering.test.ts +4 -1
- package/tests/command-palette.test.ts +284 -1
- package/tests/delegate-for-reason-contract.test.ts +32 -10
- package/tests/delivery-conflict-markers.test.ts +348 -0
- package/tests/design-canvas-all-sizes.test.ts +631 -0
- package/tests/design-canvas-allowlist.test.ts +32 -0
- package/tests/design-canvas-assets.test.ts +11 -695
- package/tests/design-canvas-boards.test.ts +77 -0
- package/tests/design-canvas-checks.test.ts +655 -0
- package/tests/design-canvas-compare.test.ts +79 -0
- package/tests/design-canvas-events.test.ts +59 -0
- package/tests/design-canvas-export.test.ts +1168 -0
- package/tests/design-canvas-focus.test.ts +113 -0
- package/tests/design-canvas-handoffs.test.ts +59 -0
- package/tests/design-canvas-i18n-review.test.ts +513 -0
- package/tests/design-canvas-i18n-views.test.ts +259 -0
- package/tests/design-canvas-i18n.test.ts +526 -0
- package/tests/design-canvas-inspector.test.ts +937 -0
- package/tests/design-canvas-layout.test.ts +1222 -0
- package/tests/design-canvas-minimap.test.ts +413 -0
- package/tests/design-canvas-modules.test.ts +90 -0
- package/tests/design-canvas-parts.test.ts +721 -0
- package/tests/design-canvas-rail.test.ts +799 -0
- package/tests/design-canvas-server.test.ts +855 -17
- package/tests/design-canvas-sizes.test.ts +548 -0
- package/tests/design-canvas-store.test.ts +180 -0
- package/tests/design-canvas-tokens.test.ts +965 -0
- package/tests/design-canvas-view.test.ts +299 -0
- package/tests/design-comments.test.ts +201 -1
- package/tests/design-handoffs.test.ts +20 -0
- package/tests/design-layout.test.ts +100 -0
- package/tests/design-parts.test.ts +260 -0
- package/tests/design-system-tokens.test.ts +215 -0
- package/tests/desktop-rpc-agents.test.ts +893 -0
- package/tests/desktop-rpc-config.test.ts +1452 -0
- package/tests/desktop-rpc-design.test.ts +662 -0
- package/tests/desktop-rpc-jobs.test.ts +796 -0
- package/tests/desktop-rpc-permissions.test.ts +311 -0
- package/tests/desktop-rpc-profiles.test.ts +140 -0
- package/tests/desktop-rpc-safety.test.ts +119 -0
- package/tests/desktop-rpc-usage.test.ts +697 -0
- package/tests/desktop-rpc.test.ts +252 -0
- package/tests/destructive-command-guard.test.ts +52 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
- package/tests/devbinary/review-session-consent.devtest.ts +84 -0
- package/tests/download-progress.test.ts +71 -0
- package/tests/engram-safety.test.ts +111 -0
- package/tests/execution-surface-guard.test.ts +55 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.captured.json +92 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.provenance.md +3 -0
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +26 -31
- package/tests/fixtures/proxy-tls/proxy.crt +19 -0
- package/tests/fixtures/proxy-tls/proxy.key +28 -0
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
- package/tests/fixtures/session-profile-v1/replay.ts +53 -6
- package/tests/full-delegation-closure.test.ts +160 -0
- package/tests/full-delegation-notices.test.ts +76 -0
- package/tests/generic-agent-tools.test.ts +3 -3
- package/tests/gentle-agent-status.test.ts +74 -0
- package/tests/gentle-agents-child-jobs.test.ts +237 -0
- package/tests/gentle-agents.test.ts +1403 -20
- package/tests/gentle-ai-binary.test.ts +3 -1
- package/tests/gentle-ai-child-guards.test.ts +1 -0
- package/tests/gentle-ai-elapsed-store.test.ts +19 -0
- package/tests/gentle-ai-exploration-budget.test.ts +18 -2
- package/tests/gentle-ai-installer.test.ts +135 -51
- package/tests/gentle-ai-proxy.test.ts +434 -0
- package/tests/gentle-ai-renderer.test.ts +36 -2
- package/tests/gentle-ai.test.ts +233 -43
- package/tests/gentle-design.test.ts +386 -1
- package/tests/gentle-herdr-activity.test.ts +9 -6
- package/tests/gentle-shell-bin.test.ts +123 -0
- package/tests/gentle-shell-bundled.test.ts +293 -31
- package/tests/gentle-shell-launcher.test.ts +78 -11
- package/tests/gentle-shell.test.ts +1017 -146
- package/tests/gentle-todo.test.ts +51 -11
- package/tests/gentle-tps.test.ts +123 -0
- package/tests/gentle-ui-design-skill.test.ts +59 -0
- package/tests/herdr-busy.test.ts +59 -0
- package/tests/herdr-task-summary-policy.test.ts +8 -4
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/image-disk-cache.test.ts +163 -0
- package/tests/independent-recovery-delivery.test.ts +97 -0
- package/tests/inprocess-reviewer.test.ts +249 -4
- package/tests/install-wizard.test.ts +27 -1
- package/tests/installer-downloads.test.ts +30 -1
- package/tests/installer-posix-bootstrap.test.ts +115 -14
- package/tests/installer-preflight.test.ts +54 -5
- package/tests/installer-probes.test.ts +146 -0
- package/tests/installer-runner.test.ts +79 -44
- package/tests/installer-server.test.ts +215 -13
- package/tests/installer-windows-bootstrap.test.ts +19 -1
- package/tests/jobs-view.test.ts +260 -6
- package/tests/judgment-day-severity-admission.test.ts +46 -0
- package/tests/lazy-module-contradictions-contract.test.ts +158 -0
- package/tests/maintainer/desktop-rpc.maintest.ts +632 -0
- package/tests/maintainer/pi-update-source.maintest.ts +48 -18
- package/tests/modal-mouse-boundaries.test.ts +136 -0
- package/tests/model-fallback-policy.test.ts +26 -7
- package/tests/model-routing-authority.test.ts +178 -2
- package/tests/nan-provider-runtime.test.ts +17 -3
- package/tests/nan-provider.test.ts +111 -56
- package/tests/native-choice-list.test.ts +77 -2
- package/tests/native-review-capability-contract.test.ts +17 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
- package/tests/native-review-cli.test.ts +269 -1
- package/tests/native-review-parity.test.ts +24 -5
- package/tests/native-review-refusal-identity.test.ts +25 -0
- package/tests/no-self-pause-contract.test.ts +13 -2
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
- package/tests/odd-routing-contract.test.ts +80 -28
- package/tests/orchestrator-budget.test.ts +35 -5
- package/tests/orchestrator-consultation-sdk.test.ts +32 -6
- package/tests/orchestrator-delegation-mode.test.ts +154 -0
- package/tests/orchestrator-discovery.test.ts +28 -0
- package/tests/orchestrator-mode-policy.test.ts +175 -0
- package/tests/orchestrator-prompt-budget.test.ts +13 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +221 -0
- package/tests/orchestrator-rdd-ownership.test.ts +4 -3
- package/tests/orchestrator-work-search.test.ts +4 -2
- package/tests/package-files.test.ts +25 -1
- package/tests/package-manifest.test.ts +16 -13
- package/tests/parallel-reason-contract.test.ts +6 -3
- package/tests/permission-allowlist.test.ts +372 -0
- package/tests/persona-neutral-voseo.test.ts +4 -4
- package/tests/persona-reply-language.test.ts +1 -1
- package/tests/persona-single-channel.test.ts +13 -5
- package/tests/pi-update-launcher.test.ts +25 -7
- package/tests/pi-update-source.test.ts +113 -6
- package/tests/pi-update.test.ts +294 -19
- package/tests/pnpm-workspace-config.test.ts +58 -0
- package/tests/pnpm-workspace-policy.test.ts +47 -0
- package/tests/primary-context-files.test.ts +233 -0
- package/tests/primary-context-three-files.test.ts +174 -0
- package/tests/primary-session-prompt.test.ts +13 -0
- package/tests/profile-pin.test.ts +29 -2
- package/tests/profile-tier-footer.test.ts +5 -0
- package/tests/profiles-panel-delegation-mode.test.ts +422 -0
- package/tests/provider-defect-handoff.test.ts +9 -2
- package/tests/questionnaire-view.test.ts +115 -0
- package/tests/quiet-bash-runtime.test.ts +1 -1
- package/tests/quiet-tool-rendering.test.ts +48 -0
- package/tests/rdd-aware-verification-contract.test.ts +17 -12
- package/tests/rdd-customize.test.ts +287 -0
- package/tests/rdd-mode-cache.test.ts +450 -0
- package/tests/rdd-mode-control.test.ts +407 -0
- package/tests/rdd-mode-scope-regression.test.ts +137 -0
- package/tests/rdd-off-independent-regression.test.ts +69 -0
- package/tests/rdd-status-line.test.ts +112 -1
- package/tests/render-cache-performance.test.ts +171 -2
- package/tests/reply-language-anchor-placement.test.ts +184 -0
- package/tests/reply-language-anchor.test.ts +189 -0
- package/tests/request-context-append-only.test.ts +218 -0
- package/tests/request-context-placement.test.ts +148 -0
- package/tests/review-agent-end-preflight.test.ts +80 -2
- package/tests/review-blocker.test.ts +193 -0
- package/tests/review-candidate-owner-retry.test.ts +1 -1
- package/tests/review-candidate-symlink-scan.test.ts +157 -0
- package/tests/review-candidate-view.test.ts +66 -1
- package/tests/review-candidate-windows-boundary.test.ts +131 -0
- package/tests/review-candidate-windows-probe.test.ts +63 -0
- package/tests/review-committed-restart-ack.test.ts +129 -0
- package/tests/review-continuation-registry.test.ts +107 -0
- package/tests/review-contract-prompt.test.ts +1 -1
- package/tests/review-controller-native-routing.test.ts +261 -5
- package/tests/review-controller-workspace-root.test.ts +230 -3
- package/tests/review-controller.test.ts +98 -12
- package/tests/review-coordinator-correction-gate.test.ts +105 -0
- package/tests/review-coordinator-findings.test.ts +206 -0
- package/tests/review-coordinator-nonblocking-scope.test.ts +169 -0
- package/tests/review-coordinator-runtime.test.ts +117 -0
- package/tests/review-coordinator.test.ts +462 -0
- package/tests/review-delivery-preflight.test.ts +462 -0
- package/tests/review-due-compaction.test.ts +31 -0
- package/tests/review-due-public-boundary.test.ts +26 -0
- package/tests/review-failure-facts.test.ts +87 -0
- package/tests/review-host-relay-routing.test.ts +258 -4
- package/tests/review-host-relay.test.ts +39 -0
- package/tests/review-integration-nonblocking-findings.test.ts +108 -0
- package/tests/review-integration-v2.test.ts +46 -3
- package/tests/review-json-arguments.test.ts +105 -11
- package/tests/review-last-event-closure.test.ts +68 -0
- package/tests/review-ledger-contract.test.ts +19 -40
- package/tests/review-loadout-rdd-off-sdk.test.ts +95 -32
- package/tests/review-one-call-findings.test.ts +131 -0
- package/tests/review-one-call-followups.test.ts +308 -0
- package/tests/review-one-call-reviewer-requests.test.ts +207 -0
- package/tests/review-one-call.test.ts +452 -0
- package/tests/review-owner-identity.test.ts +60 -24
- package/tests/review-relay-phase-timing.test.ts +128 -0
- package/tests/review-relay-transport-agent.test.ts +39 -2
- package/tests/review-reviewer-evidence.test.ts +223 -0
- package/tests/review-risk-assessment.test.ts +126 -8
- package/tests/review-run-statement-guidance-independent.test.ts +54 -0
- package/tests/review-session-standing-permission-controller.test.ts +53 -3
- package/tests/review-start-context.test.ts +19 -0
- package/tests/review-tool-prose-budget.test.ts +122 -0
- package/tests/reviewer-stream.test.ts +149 -0
- package/tests/run-test-suite.test.ts +122 -1
- package/tests/runtime-harness.mjs +4 -1
- package/tests/sensitive-path-tools.test.ts +181 -5
- package/tests/session-profile-append-controller-pi.test.ts +60 -31
- package/tests/session-profile-binding.test.ts +19 -1
- package/tests/session-profile-disk-reader-pi.test.ts +58 -16
- package/tests/session-profile-extension.test.ts +2 -2
- package/tests/session-profile-v1-compat.test.ts +35 -1
- package/tests/shell-bar.test.ts +186 -42
- package/tests/shell-panel.test.ts +50 -22
- package/tests/shell-prompt.test.ts +17 -0
- package/tests/shell-sidebar-fullscreen.test.ts +5 -5
- package/tests/shell-sidebar-layout.test.ts +294 -23
- package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
- package/tests/shell-surface-transparent.test.ts +89 -0
- package/tests/shell-todo.test.ts +12 -0
- package/tests/shell-usage.test.ts +59 -10
- package/tests/skill-contradictions-contract.test.ts +122 -0
- package/tests/skill-registry-watcher.test.ts +216 -2
- package/tests/skill-registry.test.ts +1461 -5
- package/tests/startup-banner.test.ts +152 -1
- package/tests/startup-home-repo.test.ts +2 -0
- package/tests/support/design-canvas-dom.ts +369 -0
- package/tests/support/review-coordinator-runtime.ts +264 -0
- package/tests/task-size-routing-contract.test.ts +45 -12
- package/tests/test-strength-contract.test.ts +2 -1
- package/tests/todo-request-append-only.test.ts +214 -0
- package/tests/tool-batching-contract.test.ts +3 -1
- package/tests/update-agent-body-history.test.ts +138 -0
- package/tests/verification-tiers-contract.test.ts +229 -0
- package/tests/verifier-admission.test.ts +49 -0
- package/tests/verifier-preparation.test.ts +229 -0
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +162 -11
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/visual-customization-policy.test.ts +39 -6
- package/tests/visual-customize-view.test.ts +573 -9
- package/tests/visual-layout-preview.test.ts +15 -1
- package/tests/visual-profiles.test.ts +11 -0
- package/tests/voice-worker.test.ts +73 -2
- package/tests/windows-session-transport.test.ts +126 -0
- package/tests/work-continuity-contract.test.ts +77 -6
- package/tests/writer-admission-messages.test.ts +232 -0
- package/tests/writer-batch-admission.test.ts +66 -0
- package/tests/writer-edit-surface-scope.test.ts +52 -20
- package/tests/writer-feature-document-admission.test.ts +276 -0
- package/tests/yolo-customize.test.ts +27 -4
- package/tests/yolo-mode.test.ts +62 -18
- package/tests/yolo-session-policy.test.ts +270 -1
- package/skills/_shared/review-ledger-contract.md +0 -106
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -5,6 +5,7 @@ import { Editor, Image, Key, decodeKittyPrintable, getCapabilities, isKeyRelease
|
|
|
5
5
|
import { readClipboardImage, type ClipboardImage } from "../lib/clipboard-image.ts";
|
|
6
6
|
import { readPastedImagePaths } from "../lib/pasted-image-paths.ts";
|
|
7
7
|
import { describeAttachment, ImageAttachments } from "../lib/image-attachments.ts";
|
|
8
|
+
import { defaultCacheRoot, ImageDiskCache } from "../lib/image-disk-cache.ts";
|
|
8
9
|
import { execFile, spawnSync } from "node:child_process";
|
|
9
10
|
import { openInExternalEditor, type ExternalEditorHost } from "../lib/external-editor.ts";
|
|
10
11
|
import { existsSync, realpathSync, statSync } from "node:fs";
|
|
@@ -14,10 +15,11 @@ import { profilesFilePath, profileRoleEntries, readProfilesFileResult } from "..
|
|
|
14
15
|
import { resolveSessionProfile, sessionProfileLabel, sessionProfileModelProfiles } from "../lib/session-profile-freeze.ts";
|
|
15
16
|
import * as os from "node:os";
|
|
16
17
|
import { dirname, join, resolve } from "node:path";
|
|
17
|
-
import { buildShellHeaderModel, renderShellBar, renderShellBelowInputFloat, renderShellBottomOnlyBar, renderShellHeaderChrome, renderShellSidebarBar, renderShellStatusBar, renderShellStatusSections, renderShellTitleRow, type StatusSection, type StatusTarget, keepNativeWorkingRow, shellEnabled, shellHeaderUsageHit, shellJobsCount, type ShellBarModel, type ShellBarTheme } from "../lib/shell-bar.ts";
|
|
18
|
+
import { buildShellHeaderModel, renderShellBar, renderShellBelowInputFloat, renderShellBottomOnlyBar, renderShellHeaderChrome, renderShellSidebarBar, renderShellStatusBar, renderShellStatusSections, renderShellChromeBar, renderShellChromePad, renderShellTitleRow, type StatusSection, type StatusTarget, keepNativeWorkingRow, shellEnabled, shellHeaderUsageHit, shellJobsCount, type ShellBarModel, type ShellBarTheme } from "../lib/shell-bar.ts";
|
|
18
19
|
import { CHANGE_STATUS, DIFF_MAX_BYTES, DIFF_MAX_LINES, DIFF_TOO_LARGE, WorktreeChangesTracker, changesDigest, renderChangesWidget, type ChangedFile, type ChangesModel, type FileRevision, type GitRunner, type LineCounter, type WorktreeChanges } from "../lib/shell-changes.ts";
|
|
19
20
|
import { WorktreeChangesView } from "../lib/shell-changes-view.ts";
|
|
20
21
|
import { createNativeFullscreenInteraction } from "../lib/native-fullscreen-interaction.ts";
|
|
22
|
+
import { windowsProcessTreeKiller, type ProcessTreeKiller } from "../lib/native-review-cli.ts";
|
|
21
23
|
import { SessionWorktreeRegistry, resolveSessionWorktree, worktreeGitEnvironment, type WorktreeResolver, type WorktreeIdentity } from "../lib/session-worktree-registry.ts";
|
|
22
24
|
import { CARD_STYLE, CARD_TONE, cardStyle, panelHeaderRow, renderCard, setCardStyle, type Card, type CardTheme } from "../lib/shell-card.ts";
|
|
23
25
|
import { resolveCardStyle, writeCardStyle } from "../lib/card-style-policy.ts";
|
|
@@ -26,26 +28,28 @@ import { CommandPalette, commandsKey, type CommandPaletteResult } from "../lib/c
|
|
|
26
28
|
import { buildCommandPaletteGroups } from "../lib/command-palette-catalog.ts";
|
|
27
29
|
import { buildKeymapRows } from "../lib/keymaps-customize.ts";
|
|
28
30
|
import { discoverYoloUiAdapter, MODE_STATUS_KEY, YOLO_DISPLAY, YOLO_STATUS_KEY, type YoloDisplay, type YoloUiAdapter } from "../lib/yolo-session-policy.ts";
|
|
31
|
+
import { discoverRddModeControl, type RddModeControl } from "../lib/rdd-mode-control.ts";
|
|
32
|
+
import { NATIVE_REVIEW_MODE_SOURCE } from "../lib/native-review-cli.ts";
|
|
29
33
|
import { VisualCustomizeView, type CustomizeCategory, type CustomizeRow, type ProfileActions } from "../lib/visual-customize-view.ts";
|
|
30
34
|
import { deleteVisualProfile, getVisualProfile, listVisualProfiles, resetVisualProfiles, saveVisualProfile } from "../lib/visual-profiles.ts";
|
|
31
35
|
import { gaugePaintFor } from "../lib/gauge-theme.ts";
|
|
32
36
|
import type { GaugePaint } from "../lib/shell-gauge.ts";
|
|
33
37
|
import { sourcePalettePreview } from "../lib/theme-customization.ts";
|
|
34
|
-
import { applyVisualPreset, DEFAULT_VISUAL_SETTINGS, DENSITY, HEADER_PLACEMENT, STATUS_PLACEMENT, VISUAL_PRESET, VISUAL_SECTION_KEYS, resolveVisualSettings, visualPresetOf, writeVisualSettings, type VisualPreset } from "../lib/visual-customization-policy.ts";
|
|
38
|
+
import { applyVisualPreset, CHROME_SURFACE, DEFAULT_VISUAL_SETTINGS, DENSITY, HEADER_PLACEMENT, STATUS_PLACEMENT, VISUAL_PRESET, VISUAL_SECTION_KEYS, resolveVisualSettings, visualPresetOf, writeVisualSettings, type VisualPreset } from "../lib/visual-customization-policy.ts";
|
|
35
39
|
import { BANNER_COLORS, DEFAULT_BANNER_CONFIG, readBannerConfig, readBannerConfigForEdit, writeBannerConfig } from "./startup-banner.ts";
|
|
36
40
|
import { commandKeymapId, commandKeymapIds, effectiveKey, keymapCommand, keymapLabel, keymapSavedNotice, loadKeymaps, prepareKeymapChange, writeKeymaps, type KeymapBindings, type PiKeybindings } from "../lib/keymaps.ts";
|
|
37
41
|
import { GentleAiDevBinaryOverrideError, resolveGentleAiDevBinaryOverride } from "../lib/gentle-ai-binary.ts";
|
|
38
|
-
import { DOUBLE_ESC_CANCEL_HINT, floatPromptRow, framePromptLines, panelPromptRow, resolvePromptLayout, IDLE_ESC_CLEAR_HINT, PANEL_BUTTON, PROMPT_HINT, PROMPT_STATE, SHELL_PULSE_WATCHDOG_MS, withPromptHint, type PromptState } from "../lib/shell-prompt.ts";
|
|
42
|
+
import { DOUBLE_ESC_CANCEL_HINT, floatPromptRow, framePromptLines, panelPromptRow, resolvePromptLayout, IDLE_ESC_CLEAR_HINT, PANEL_BUTTON, PROMPT_HINT, PROMPT_STATE, SHELL_PULSE_MS, SHELL_PULSE_WATCHDOG_MS, withPromptHint, workingTick, type PromptState } from "../lib/shell-prompt.ts";
|
|
39
43
|
import { stripAnsi } from "../lib/terminal-theme.ts";
|
|
40
44
|
import { oddPhaseRegistry } from "../lib/odd-phase.ts";
|
|
41
45
|
import { CLAUDE_BRIDGE_PROVIDER, priceBridgeMessage } from "../lib/bridge-cost.ts";
|
|
42
46
|
import { inferOddPhase } from "../lib/odd-phase-inference.ts";
|
|
43
47
|
import { isInteractiveMode } from "../lib/rpc-host.ts";
|
|
44
48
|
import { gentlePiConfigHome } from "../lib/agent-home.ts";
|
|
45
|
-
import { isNanAdaptiveReasoningModel } from "../lib/nan-provider.ts";
|
|
46
49
|
import { resolveAnimationPolicy, writeAnimationPolicy, type AnimationPolicy } from "../lib/animation-policy.ts";
|
|
47
50
|
import { resolveVimPolicy, writeVimPolicy, type VimPolicy } from "../lib/vim-policy.ts";
|
|
48
51
|
import { resolveHistoryCapture, writeHistoryCapturePolicy } from "../lib/history-capture-policy.ts";
|
|
52
|
+
import { HERDR_TASK_SUMMARY_CHANGED, resolveHerdrTaskSummarySettings, writeHerdrTaskSummarySettings } from "../lib/herdr-task-summary-policy.ts";
|
|
49
53
|
import { createRequire } from "node:module";
|
|
50
54
|
import { createVimEditorAdapter, isAuditedPiEditorVersion } from "../lib/vim-editor-adapter.ts";
|
|
51
55
|
import { VimNormalEngine } from "../lib/vim-normal-engine.ts";
|
|
@@ -125,10 +129,19 @@ import {
|
|
|
125
129
|
type DoubleEscCancelResolution,
|
|
126
130
|
} from "../lib/double-esc-cancel-policy.ts";
|
|
127
131
|
import { accountIdFromToken, CODEX_PROVIDER, CODEX_USAGE_URL, NAN_PROVIDER, NAN_QUOTA_URL, parseCodexUsage, parseNanQuota, parseProviderUsage, parseUsageHeaders, parseUsageSource, usageScopeProviders, UsageSourceRegistry, UsageStore, USAGE_SOURCE_EVENT, type ProviderUsage, type UsageSource } from "../lib/shell-usage.ts";
|
|
132
|
+
import {
|
|
133
|
+
DESKTOP_USAGE_SERVICE_CHANNEL,
|
|
134
|
+
DESKTOP_USAGE_SERVICE_SCHEMA,
|
|
135
|
+
isRefreshableUsageProvider,
|
|
136
|
+
isSupportedUsageProvider,
|
|
137
|
+
type DesktopUsageOwnerRead,
|
|
138
|
+
type DesktopUsageRecordedSnapshot,
|
|
139
|
+
type DesktopUsageService,
|
|
140
|
+
} from "../lib/desktop-rpc-usage.ts";
|
|
128
141
|
import { UsageView } from "../lib/shell-usage-view.ts";
|
|
129
142
|
import { releaseSidebarHover, setSidebarHover, sidebarHeader, sidebarPart, sidebarState, sidebarStatusBar, VISUAL_SETTINGS_CHANGED, type SidebarRail } from "../lib/shell-sidebar.ts";
|
|
130
143
|
import { installSidebar, invalidateSidebar, narrowStatusOwner, SIDEBAR_BREAKPOINT, STATUS_OWNER } from "../lib/shell-sidebar-layout.ts";
|
|
131
|
-
import { panelSheetBackHit, renderPanelSheet, renderWorkRow, workRowLead } from "../lib/shell-panel.ts";
|
|
144
|
+
import { panelSheetBackHit, renderPanelSheet, renderWorkRow, setChromeSurface, workRowLead } from "../lib/shell-panel.ts";
|
|
132
145
|
import { installPagePaint, type PageTheme } from "../lib/shell-page.ts";
|
|
133
146
|
import { layoutSchematic } from "../lib/visual-layout-preview.ts";
|
|
134
147
|
import { collectSessionStats, type SessionStats } from "../lib/shell-stats.ts";
|
|
@@ -350,7 +363,6 @@ export function buildShellBarModel(
|
|
|
350
363
|
const home = options.home ?? os.homedir();
|
|
351
364
|
const { usage, costTotal } = sessionStats(ctx);
|
|
352
365
|
const model = ctx.model;
|
|
353
|
-
const adaptiveReasoning = isNanAdaptiveReasoningModel(model);
|
|
354
366
|
const entries = Array.from(footerData.getExtensionStatuses().entries())
|
|
355
367
|
.filter(([key]) => key !== "gentle-fast" && (options.jobs === undefined || key !== JOBS_STATUS_KEY))
|
|
356
368
|
.sort(([a], [b]) => a.localeCompare(b));
|
|
@@ -369,7 +381,7 @@ export function buildShellBarModel(
|
|
|
369
381
|
dirty: options.dirty,
|
|
370
382
|
sessionName: ctx.sessionManager.getSessionName(),
|
|
371
383
|
modelId: model?.id ?? "no-model",
|
|
372
|
-
effort: model?.reasoning ?
|
|
384
|
+
effort: model?.reasoning ? pi.getThinkingLevel() : undefined,
|
|
373
385
|
contextPercent: usage?.percent ?? null,
|
|
374
386
|
contextWindow: usage?.contextWindow ?? model?.contextWindow ?? 0,
|
|
375
387
|
costTotal,
|
|
@@ -420,7 +432,7 @@ export function createFooterStatusMemo(deps: FooterStatusMemoDeps): { key(): str
|
|
|
420
432
|
statsKey ? [statsKey[0], statsKey[1], statsKey[2]] : sessionStats(ctx),
|
|
421
433
|
model?.id ?? null,
|
|
422
434
|
model?.contextWindow ?? null,
|
|
423
|
-
model?.reasoning ?
|
|
435
|
+
model?.reasoning ? pi.getThinkingLevel() : undefined,
|
|
424
436
|
model ? ctx.modelRegistry.isUsingOAuth(model) : false,
|
|
425
437
|
footerData.getGitBranch(),
|
|
426
438
|
deps.profile(),
|
|
@@ -513,7 +525,7 @@ interface PromptEditorDeps {
|
|
|
513
525
|
/** Pasted images become atomic `[Image#N]` chips; absent, Pi's paste handler runs unchanged. */
|
|
514
526
|
attachments?: ImageAttachments;
|
|
515
527
|
readClipboardImage?: () => Promise<ClipboardImage | null>;
|
|
516
|
-
/** Injectable
|
|
528
|
+
/** Injectable coarse-animation window; production and tests default to SHELL_PULSE_WATCHDOG_MS. */
|
|
517
529
|
watchdogMs?: number;
|
|
518
530
|
/** Read on every render: true while the wide IDE chrome shows, so the editor draws its panel frame. */
|
|
519
531
|
panelChrome?: () => boolean;
|
|
@@ -563,7 +575,6 @@ export function extractQueuedText(combined: string, draft: string): string | und
|
|
|
563
575
|
|
|
564
576
|
export class GentlePromptEditor extends CustomEditor {
|
|
565
577
|
private promptState: PromptState = PROMPT_STATE.IDLE;
|
|
566
|
-
private tick = 0;
|
|
567
578
|
private animationPolicy: AnimationPolicy = "quality";
|
|
568
579
|
private vimPolicy: VimPolicy = "off";
|
|
569
580
|
private vimRejected = false;
|
|
@@ -580,9 +591,6 @@ export class GentlePromptEditor extends CustomEditor {
|
|
|
580
591
|
private visualObjectPending: "i" | "a" | undefined;
|
|
581
592
|
private visualAnchor: { line: number; col: number } | undefined;
|
|
582
593
|
private watchdog: NodeJS.Timeout | undefined;
|
|
583
|
-
// Last time a frame painted (or the watchdog forced one) while working; the
|
|
584
|
-
// quality watchdog repaints only when now() drifts past its window.
|
|
585
|
-
private lastRenderAt = 0;
|
|
586
594
|
private readonly deps: PromptEditorDeps;
|
|
587
595
|
private readonly pointerTui: TUI;
|
|
588
596
|
private floatMouseLayout?: ReturnType<typeof resolvePromptLayout>;
|
|
@@ -810,20 +818,22 @@ export class GentlePromptEditor extends CustomEditor {
|
|
|
810
818
|
this.deps.requestRender();
|
|
811
819
|
}
|
|
812
820
|
|
|
821
|
+
/** Current animation phase: elapsed working time at the policy cadence. */
|
|
822
|
+
private workingPhase(): number {
|
|
823
|
+
// potato never animates (no timer, static petal); quality steps per
|
|
824
|
+
// SHELL_PULSE_MS window; performance keeps the coarse watchdog cadence.
|
|
825
|
+
if (this.animationPolicy === "potato") return 0;
|
|
826
|
+
return workingTick(this.deps.now(), this.animationPolicy === "quality" ? SHELL_PULSE_MS : (this.deps.watchdogMs ?? SHELL_PULSE_WATCHDOG_MS));
|
|
827
|
+
}
|
|
828
|
+
|
|
813
829
|
private startWatchdog(): void {
|
|
830
|
+
// Time-based animation: the phase comes from workingPhase(), so this
|
|
831
|
+
// timer only keeps repaints flowing while working — quality pulses at
|
|
832
|
+
// SHELL_PULSE_MS so silent tool runs stay on cadence; potato gets no
|
|
833
|
+
// timer at all (its coarse frames paint only when a repaint happens).
|
|
814
834
|
if (this.animationPolicy === "potato") return;
|
|
815
|
-
const windowMs = this.deps.watchdogMs ?? SHELL_PULSE_WATCHDOG_MS;
|
|
816
|
-
this.
|
|
817
|
-
this.watchdog = setInterval(() => {
|
|
818
|
-
// Render-driven petal (gentle-shell#994): streaming frames already
|
|
819
|
-
// advance the animation in render(), so under quality the watchdog
|
|
820
|
-
// stays silent unless no frame painted within its window. performance
|
|
821
|
-
// keeps its coarse cadence regardless of render traffic.
|
|
822
|
-
if (this.animationPolicy === "quality" && this.deps.now() - this.lastRenderAt < windowMs) return;
|
|
823
|
-
this.tick += 1;
|
|
824
|
-
this.lastRenderAt = this.deps.now();
|
|
825
|
-
this.deps.requestRender();
|
|
826
|
-
}, windowMs);
|
|
835
|
+
const windowMs = this.animationPolicy === "quality" ? SHELL_PULSE_MS : (this.deps.watchdogMs ?? SHELL_PULSE_WATCHDOG_MS);
|
|
836
|
+
this.watchdog = setInterval(() => this.deps.requestRender(), windowMs);
|
|
827
837
|
this.watchdog.unref();
|
|
828
838
|
}
|
|
829
839
|
|
|
@@ -1379,13 +1389,9 @@ export class GentlePromptEditor extends CustomEditor {
|
|
|
1379
1389
|
}
|
|
1380
1390
|
|
|
1381
1391
|
render(width: number): string[] {
|
|
1382
|
-
//
|
|
1383
|
-
//
|
|
1384
|
-
//
|
|
1385
|
-
if (this.promptState === PROMPT_STATE.WORKING && this.animationPolicy === "quality") {
|
|
1386
|
-
this.tick += 1;
|
|
1387
|
-
this.lastRenderAt = this.deps.now();
|
|
1388
|
-
}
|
|
1392
|
+
// Time-based animation: the phase is read from the clock per frame, so a
|
|
1393
|
+
// streaming render burst cannot strobe the wave and silent tool runs
|
|
1394
|
+
// advance it via the working pulse timer.
|
|
1389
1395
|
const layout = resolvePromptLayout(width, cardStyle(), this.deps.bg, this.deps.panelChrome?.() ?? false);
|
|
1390
1396
|
this.floatMouseLayout = layout.background || layout.panel ? layout : undefined;
|
|
1391
1397
|
const inner = layout.nativeWidth;
|
|
@@ -1412,7 +1418,7 @@ export class GentlePromptEditor extends CustomEditor {
|
|
|
1412
1418
|
? visibleCount! + 2 : editorLines.length;
|
|
1413
1419
|
const framed = framePromptLines(editorLines.slice(0, borderEnd), width, {
|
|
1414
1420
|
state,
|
|
1415
|
-
tick: this.
|
|
1421
|
+
tick: this.workingPhase(),
|
|
1416
1422
|
borderColor: (text) => layout.background || layout.panel ? this.borderColor(text) : this.deps.fg(PROMPT_FRAME_ROLE, text),
|
|
1417
1423
|
fg: this.deps.fg,
|
|
1418
1424
|
bold: this.deps.bold,
|
|
@@ -1492,7 +1498,6 @@ export class GentlePromptEditor extends CustomEditor {
|
|
|
1492
1498
|
private stopWatchdog(): void {
|
|
1493
1499
|
if (this.watchdog) clearInterval(this.watchdog);
|
|
1494
1500
|
this.watchdog = undefined;
|
|
1495
|
-
this.tick = 0;
|
|
1496
1501
|
}
|
|
1497
1502
|
}
|
|
1498
1503
|
|
|
@@ -1633,29 +1638,81 @@ function renderDoubleEscCancelReport(
|
|
|
1633
1638
|
const CHANGES_WIDGET_KEY = "gentle-shell-changes";
|
|
1634
1639
|
const HEADER_WIDGET_KEY = "gentle-shell-below-input-header";
|
|
1635
1640
|
const CHANGES_COMMAND_NAME = "gentle:changes";
|
|
1641
|
+
const IMAGES_COMMAND_NAME = "gentle:images";
|
|
1636
1642
|
const CHANGES_POLL_DEFAULT_MS = 2000;
|
|
1637
1643
|
const GIT_TIMEOUT_MS = 5000;
|
|
1638
1644
|
const COMMANDS_COMMAND_NAME = "gentle:commands";
|
|
1639
1645
|
|
|
1640
|
-
|
|
1646
|
+
// If taskkill cannot run (AppLocker, a broken PATH) the direct child can exit
|
|
1647
|
+
// while a descendant still holds the inherited pipes, which keeps execFile from
|
|
1648
|
+
// calling back; cut them after this grace so the scan still settles.
|
|
1649
|
+
const GIT_TREE_KILL_GRACE_MS = 1_000;
|
|
1650
|
+
|
|
1651
|
+
export function shellGitRunner(cwd: string, env: NodeJS.ProcessEnv = process.env, run: typeof execFile = execFile, maxBuffer = Infinity, killProcessTree: ProcessTreeKiller | undefined = process.platform === "win32" ? windowsProcessTreeKiller : undefined): GitRunner {
|
|
1641
1652
|
// Pi exec cannot replace the inherited environment. Use argv directly and
|
|
1642
1653
|
// a complete sanitized environment for discovery, status, and lazy diffs.
|
|
1643
1654
|
const childEnv = worktreeGitEnvironment(env);
|
|
1655
|
+
// A timed-out Git scan on Windows is more than one process: `git` hands the
|
|
1656
|
+
// status work to a descendant, and that descendant survives the direct child
|
|
1657
|
+
// Node itself kills, so a large repository whose scan passes the timeout
|
|
1658
|
+
// leaks another orphaned git.exe on every poll until physical memory is
|
|
1659
|
+
// exhausted (#927). Windows therefore owns the deadline below, so the tree
|
|
1660
|
+
// kill lands while the parent is still alive for taskkill to walk; everywhere
|
|
1661
|
+
// else execFile's own timeout stays exactly as it was.
|
|
1662
|
+
const treeKiller = killProcessTree;
|
|
1644
1663
|
return (args) => new Promise((resolve) => {
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1664
|
+
let deadline: ReturnType<typeof setTimeout> | undefined;
|
|
1665
|
+
let grace: ReturnType<typeof setTimeout> | undefined;
|
|
1666
|
+
let settled = false;
|
|
1667
|
+
// A scan that passed its deadline is a failed scan, never a partial
|
|
1668
|
+
// success, even if the direct child exited 0 before its pipes closed.
|
|
1669
|
+
let timedOut = false;
|
|
1670
|
+
const settle = (error: { code?: unknown; killed?: boolean } | null, stdout: string): void => {
|
|
1671
|
+
settled = true;
|
|
1672
|
+
if (deadline !== undefined) clearTimeout(deadline);
|
|
1673
|
+
if (grace !== undefined) clearTimeout(grace);
|
|
1674
|
+
if (error?.code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER") { resolve({ stdout, code: 1, truncated: true }); return; }
|
|
1675
|
+
const code = timedOut ? 1 : error ? typeof error.code === "number" ? error.code : 1 : 0;
|
|
1676
|
+
// Without a tree killer execFile owns the timeout and reports its kill on the error.
|
|
1677
|
+
resolve({ stdout, code, ...(timedOut || (treeKiller === undefined && error?.killed) ? { timedOut: true } : {}) });
|
|
1678
|
+
};
|
|
1679
|
+
let child: ReturnType<typeof execFile>;
|
|
1680
|
+
try {
|
|
1681
|
+
child = run("git", ["-C", cwd, ...args], {
|
|
1682
|
+
env: childEnv,
|
|
1683
|
+
encoding: "utf8",
|
|
1684
|
+
shell: false,
|
|
1685
|
+
windowsHide: true,
|
|
1686
|
+
...(treeKiller === undefined ? { timeout: GIT_TIMEOUT_MS } : {}),
|
|
1687
|
+
// Pi exec accumulates output without a maxBuffer cap. In particular,
|
|
1688
|
+
// large porcelain inventories must not become partial successful scans.
|
|
1689
|
+
// Only a single diff passes a bound, and is told when it hit it.
|
|
1690
|
+
maxBuffer,
|
|
1691
|
+
}, (error, stdout) => settle(error, stdout));
|
|
1692
|
+
} catch (error) {
|
|
1693
|
+
// A spawn that throws (invalid options, an injected runner) is a failed scan.
|
|
1694
|
+
settle(error as { code?: unknown }, "");
|
|
1695
|
+
return;
|
|
1696
|
+
}
|
|
1697
|
+
// The callback may already have settled a synchronous run (a fake in
|
|
1698
|
+
// tests, a spawn error), so only arm the deadline while it is pending.
|
|
1699
|
+
if (settled || treeKiller === undefined || child?.pid === undefined) return;
|
|
1700
|
+
const pid = child.pid;
|
|
1701
|
+
deadline = setTimeout(() => {
|
|
1702
|
+
timedOut = true;
|
|
1703
|
+
// taskkill walks the tree from a live parent. If the direct child
|
|
1704
|
+
// already exited, only a descendant can be holding the inherited
|
|
1705
|
+
// pipes, and a PID-based kill would just report "process not found";
|
|
1706
|
+
// the grace below still cuts those pipes so the scan can settle.
|
|
1707
|
+
if (child.exitCode === null && child.signalCode === null) treeKiller(pid);
|
|
1708
|
+
grace = setTimeout(() => {
|
|
1709
|
+
if (child.exitCode === null && child.signalCode === null) child.kill();
|
|
1710
|
+
child.stdout?.destroy();
|
|
1711
|
+
child.stderr?.destroy();
|
|
1712
|
+
}, GIT_TREE_KILL_GRACE_MS);
|
|
1713
|
+
grace.unref?.();
|
|
1714
|
+
}, GIT_TIMEOUT_MS);
|
|
1715
|
+
deadline.unref?.();
|
|
1659
1716
|
});
|
|
1660
1717
|
}
|
|
1661
1718
|
|
|
@@ -1663,7 +1720,7 @@ export async function loadFileDiff(git: GitRunner, file: ChangedFile): Promise<s
|
|
|
1663
1720
|
const args = file.status === CHANGE_STATUS.UNTRACKED ? ["diff", "--no-index", "--", "/dev/null", file.path] : ["diff", "HEAD", "--", file.path];
|
|
1664
1721
|
const result = await git(args);
|
|
1665
1722
|
if (result.truncated || result.stdout.length > DIFF_MAX_BYTES || result.stdout.split("\n", DIFF_MAX_LINES + 2).length > DIFF_MAX_LINES + 1) return DIFF_TOO_LARGE;
|
|
1666
|
-
return result.code === 0 || result.code === 1 ? result.stdout : "";
|
|
1723
|
+
return !result.timedOut && (result.code === 0 || result.code === 1) ? result.stdout : "";
|
|
1667
1724
|
}
|
|
1668
1725
|
|
|
1669
1726
|
// Untracked files have no numstat; count their lines without reading past the diff bound.
|
|
@@ -2000,6 +2057,7 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2000
2057
|
const profileReader = createActiveProfileReader(env);
|
|
2001
2058
|
const deps: ShellDeps = { ...defaultShellDeps, activeProfile: profileReader, ...overrides };
|
|
2002
2059
|
let closeCustomize: (() => void) | undefined;
|
|
2060
|
+
let customizeGeneration = 0;
|
|
2003
2061
|
let profilePoll: ReturnType<typeof setInterval> | undefined;
|
|
2004
2062
|
const stopProfilePoll = () => {
|
|
2005
2063
|
if (profilePoll) clearInterval(profilePoll);
|
|
@@ -2025,17 +2083,6 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2025
2083
|
// overlapping refreshes of the SAME source (or of builtins) can otherwise
|
|
2026
2084
|
// let an older failure settle after a newer success and poison it.
|
|
2027
2085
|
const usageGenerations = new Map<string, number>();
|
|
2028
|
-
// NaN accepts a thinking level for DeepSeek V4 Flash, Qwen 3.8 Flash, and MiMo
|
|
2029
|
-
// but manages their depth itself, so the header reports `auto` and the shell says
|
|
2030
|
-
// why once per model instead of repeating it on every level change.
|
|
2031
|
-
const adaptiveReasoningNotices = new Set<string>();
|
|
2032
|
-
const announceAdaptiveReasoning = (ctx: ExtensionContext, model: { provider: string; id: string; name?: string } | undefined) => {
|
|
2033
|
-
if (!ctx.hasUI || !isNanAdaptiveReasoningModel(model)) return;
|
|
2034
|
-
const key = `${model.provider}/${model.id}`;
|
|
2035
|
-
if (adaptiveReasoningNotices.has(key)) return;
|
|
2036
|
-
adaptiveReasoningNotices.add(key);
|
|
2037
|
-
ctx.ui.notify(`${model.name || model.id} chooses its reasoning depth automatically; the selected thinking level is accepted but does not change it.`, "info");
|
|
2038
|
-
};
|
|
2039
2086
|
// One spelling of the config home, so the pin resolver, the global profiles
|
|
2040
2087
|
// store and the profile reader cannot drift onto two different stores.
|
|
2041
2088
|
const usageConfigHome = gentlePiConfigHome(env);
|
|
@@ -2162,6 +2209,75 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2162
2209
|
.map((provider) => refreshProvider(ctx, provider, usageSources.get(provider), force, now)),
|
|
2163
2210
|
);
|
|
2164
2211
|
};
|
|
2212
|
+
// Desktop's usage slice reaches the owner only through this versioned,
|
|
2213
|
+
// adapter-shaped seam — the usage analogue of the YOLO host-ui adapter. It
|
|
2214
|
+
// wraps the existing UsageStore / UsageSourceRegistry / refreshUsage /
|
|
2215
|
+
// after_provider_response closures; there is no second store, fetcher, or
|
|
2216
|
+
// auth resolver. Header-driven snapshots are broadcast to every subscribed
|
|
2217
|
+
// Desktop consumer through the shared observer set below, already parsed.
|
|
2218
|
+
const desktopUsageObservers = new Set<(recorded: DesktopUsageRecordedSnapshot) => void>();
|
|
2219
|
+
pi.events.on(DESKTOP_USAGE_SERVICE_CHANNEL, (payload: unknown) => {
|
|
2220
|
+
if (!payload || typeof payload !== "object") return;
|
|
2221
|
+
const request = payload as Partial<{ context: ExtensionContext; respond(service: DesktopUsageService): void }>;
|
|
2222
|
+
if (typeof request.respond !== "function" || !request.context) return;
|
|
2223
|
+
const ctx = request.context;
|
|
2224
|
+
try {
|
|
2225
|
+
let disposed = false;
|
|
2226
|
+
const subscriptions = new Set<(recorded: DesktopUsageRecordedSnapshot) => void>();
|
|
2227
|
+
const read = (provider?: string, outOfScope = false): DesktopUsageOwnerRead => {
|
|
2228
|
+
if (disposed) return { providers: [] };
|
|
2229
|
+
const scope = provider === undefined ? resolveUsageScope(ctx) : [provider];
|
|
2230
|
+
return {
|
|
2231
|
+
providers: scope.map((name) => ({
|
|
2232
|
+
provider: name,
|
|
2233
|
+
supported: isSupportedUsageProvider(name, usageSources.has(name)),
|
|
2234
|
+
refreshable: isRefreshableUsageProvider(name, usageSources.has(name)),
|
|
2235
|
+
failed: usageFailures.has(name),
|
|
2236
|
+
...(outOfScope ? { outOfScope: true } : {}),
|
|
2237
|
+
snapshot: usage.get(name),
|
|
2238
|
+
})),
|
|
2239
|
+
};
|
|
2240
|
+
};
|
|
2241
|
+
const refresh = async (provider?: string): Promise<DesktopUsageOwnerRead> => {
|
|
2242
|
+
if (disposed) return { providers: [] };
|
|
2243
|
+
// Resolve the scope BEFORE delegation: a filtered refresh for a provider
|
|
2244
|
+
// outside the current session scope would never fetch anything (refreshUsage
|
|
2245
|
+
// filters by scope), so it answers a truthful out_of_scope no-op instead of
|
|
2246
|
+
// an ambiguous pending, and never attempts the fetch.
|
|
2247
|
+
const scope = resolveUsageScope(ctx);
|
|
2248
|
+
if (provider !== undefined && !scope.includes(provider)) {
|
|
2249
|
+
return read(provider, true);
|
|
2250
|
+
}
|
|
2251
|
+
// The same API-key/auth logic the panel uses: refreshUsage resolves
|
|
2252
|
+
// the scope, the credentials, and the fetch window itself. Anthropic
|
|
2253
|
+
// is skipped there because it has no usage endpoint, so a refresh
|
|
2254
|
+
// for it is a truthful no-op rather than a fabricated snapshot.
|
|
2255
|
+
await refreshUsage(ctx, true, provider);
|
|
2256
|
+
return read(provider);
|
|
2257
|
+
};
|
|
2258
|
+
request.respond({
|
|
2259
|
+
schema: DESKTOP_USAGE_SERVICE_SCHEMA,
|
|
2260
|
+
read,
|
|
2261
|
+
refresh,
|
|
2262
|
+
observe: (onSnapshot) => {
|
|
2263
|
+
if (disposed) return () => {};
|
|
2264
|
+
subscriptions.add(onSnapshot);
|
|
2265
|
+
desktopUsageObservers.add(onSnapshot);
|
|
2266
|
+
return () => {
|
|
2267
|
+
subscriptions.delete(onSnapshot);
|
|
2268
|
+
desktopUsageObservers.delete(onSnapshot);
|
|
2269
|
+
};
|
|
2270
|
+
},
|
|
2271
|
+
dispose: () => {
|
|
2272
|
+
disposed = true;
|
|
2273
|
+
for (const onSnapshot of subscriptions) desktopUsageObservers.delete(onSnapshot);
|
|
2274
|
+
subscriptions.clear();
|
|
2275
|
+
},
|
|
2276
|
+
});
|
|
2277
|
+
} catch {
|
|
2278
|
+
/* obsolete trusted context: discovery expires closed */
|
|
2279
|
+
}
|
|
2280
|
+
});
|
|
2165
2281
|
// Subscribed once, for the life of the extension: a registration can
|
|
2166
2282
|
// arrive before the first session_start (the owning extension's factory
|
|
2167
2283
|
// runs first) or after it (its own session_start fires later, or it
|
|
@@ -2190,6 +2306,11 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2190
2306
|
// A snapshot that arrived with a response is evidence the provider is
|
|
2191
2307
|
// answering: a failure some earlier refresh recorded no longer stands.
|
|
2192
2308
|
usageFailures.delete(parsed.provider);
|
|
2309
|
+
// Desktop consumers subscribed through the owner service get the already-
|
|
2310
|
+
// parsed snapshot (Claude's 5h/7d windows included), never header text.
|
|
2311
|
+
for (const onSnapshot of [...desktopUsageObservers]) {
|
|
2312
|
+
try { onSnapshot({ provider: parsed.provider, usage: parsed }); } catch { /* a listener never breaks usage */ }
|
|
2313
|
+
}
|
|
2193
2314
|
renderHost?.invalidateSidebar?.();
|
|
2194
2315
|
renderHost?.requestRender();
|
|
2195
2316
|
});
|
|
@@ -2199,21 +2320,29 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2199
2320
|
const hint = keyHint("app.tools.expand", options.expanded ? "collapse" : "expand");
|
|
2200
2321
|
return cardComponent({ title: "Gentle AI", subtitle: "review preflight", body, tone: CARD_TONE.INFO }, theme, { expanded: options.expanded, previewRows: 3, hint });
|
|
2201
2322
|
});
|
|
2202
|
-
//
|
|
2203
|
-
//
|
|
2204
|
-
//
|
|
2205
|
-
// hidden Status, and regular mode.
|
|
2323
|
+
// The attached narrow fullscreen layout owns the mobile editor and work row
|
|
2324
|
+
// for every header placement. Wide split uses the IDE chrome beside the rail;
|
|
2325
|
+
// wide top and below-input keep their existing chrome-bar paths.
|
|
2206
2326
|
const chromeMode = (tui: TUI): "wide" | "narrow" | undefined => {
|
|
2207
|
-
if (
|
|
2327
|
+
if ((tui as TUI & { mode?: string }).mode !== "fullscreen" || !tui.terminal) return undefined;
|
|
2208
2328
|
const state = sidebarState(tui);
|
|
2209
|
-
if (state.active && state.ownsHost?.()) return "wide";
|
|
2210
|
-
//
|
|
2211
|
-
// layout that draws its title row and status bar is installed.
|
|
2329
|
+
if (state.active && state.ownsHost?.()) return visualSettings.headerPlacement === "split" ? "wide" : undefined;
|
|
2330
|
+
// Do not suppress native widgets unless the host can actually draw the bar.
|
|
2212
2331
|
if (!state.layoutAttached?.()) return undefined;
|
|
2332
|
+
return tui.terminal.columns < SIDEBAR_BREAKPOINT ? "narrow" : undefined;
|
|
2333
|
+
};
|
|
2334
|
+
// Where the chrome bars draw (beside the rail, or with Status hidden or at the
|
|
2335
|
+
// bottom, outside the mobile chrome): every placement there shares the bar
|
|
2336
|
+
// design and the titled-rule editor.
|
|
2337
|
+
// `drawn` asks whether the rail actually painted in the last layout pass: the
|
|
2338
|
+
// editor and footer render after it, while the header renders during it.
|
|
2339
|
+
const chromeBarsShown = (tui: TUI, drawn = false): boolean => {
|
|
2340
|
+
if ((tui as TUI & { mode?: string }).mode !== "fullscreen" || !tui.terminal || chromeMode(tui) === "narrow") return false;
|
|
2213
2341
|
const placement = visualSettings.statusPlacement;
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2342
|
+
if (placement === "hidden" || placement === "bottom") return true;
|
|
2343
|
+
// The rail owns the host (layout installed) only at 140 columns or wider, with Status auto or right.
|
|
2344
|
+
const state = sidebarState(tui);
|
|
2345
|
+
return Boolean(state.ownsHost?.() && (!drawn || state.active));
|
|
2217
2346
|
};
|
|
2218
2347
|
// The live-work digests the mobile work row folds, honoring the Todos switch.
|
|
2219
2348
|
const workParts = (tui: TUI) => {
|
|
@@ -2247,7 +2376,16 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2247
2376
|
return [...(row ? [row] : []), ...(cardHidden ? (state.parts.get("agents")?.alert?.(width) ?? []) : [])];
|
|
2248
2377
|
};
|
|
2249
2378
|
// The rail's sections as a full-width sheet: /gentle:panel, or a tap on the mobile work row.
|
|
2250
|
-
|
|
2379
|
+
// The sheet leaves the editor's [ Panel ] clickable, so an open sheet is reused
|
|
2380
|
+
// instead of stacking another overlay per click.
|
|
2381
|
+
let openSheet: Promise<null | undefined> | undefined;
|
|
2382
|
+
const openPanelSheet = (ctx: ExtensionContext) => {
|
|
2383
|
+
if (openSheet) return openSheet;
|
|
2384
|
+
const opened = showPanelSheet(ctx).finally(() => { if (openSheet === opened) openSheet = undefined; });
|
|
2385
|
+
openSheet = opened;
|
|
2386
|
+
return opened;
|
|
2387
|
+
};
|
|
2388
|
+
const showPanelSheet = (ctx: ExtensionContext) =>
|
|
2251
2389
|
ctx.ui.custom<null>(
|
|
2252
2390
|
(tui, theme, _keybindings, done) => {
|
|
2253
2391
|
const close = withOverlayRepaint(tui, done);
|
|
@@ -2335,6 +2473,10 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2335
2473
|
let prompt: GentlePromptEditor | undefined;
|
|
2336
2474
|
// Images pasted into the current draft; emptied on every submit.
|
|
2337
2475
|
const imageAttachments = new ImageAttachments();
|
|
2476
|
+
// Opt-in disk cache for tools that need a real file path. Off unless the user
|
|
2477
|
+
// asks for it: `GENTLE_PI_IMAGES_DISK_CACHE=session`. The path is never put in
|
|
2478
|
+
// the prompt; it is readable through /gentle:images only.
|
|
2479
|
+
const imagesDiskCachePolicy = (env.GENTLE_PI_IMAGES_DISK_CACHE ?? "off").trim().toLowerCase() === "session" ? "session" : "off";
|
|
2338
2480
|
// Set by abortAndDispatchQueued via dispatchQueuedText when an Esc aborts
|
|
2339
2481
|
// a turn with a non-empty queue; sent exactly once, from agent_settled,
|
|
2340
2482
|
// once the aborted run has fully settled (issue #1218). Several aborts
|
|
@@ -2369,10 +2511,12 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2369
2511
|
ctx.ui.notify(`vim: ${result.policy} (decided by ${source})${result.malformed ? "; malformed or unreadable file, falling back to off" : ""}. ${state}.`, result.malformed || (effective !== undefined && effective !== result.policy) ? "warning" : "info");
|
|
2370
2512
|
};
|
|
2371
2513
|
let visualSettings = resolveVisualSettings(animationOptions).settings;
|
|
2514
|
+
setChromeSurface(visualSettings.surface);
|
|
2372
2515
|
let sidebarTui: TUI | undefined;
|
|
2373
2516
|
let groupedChangesOwner: (width: number) => boolean = () => false;
|
|
2374
2517
|
const refreshVisual = () => {
|
|
2375
2518
|
visualSettings = resolveVisualSettings(animationOptions).settings;
|
|
2519
|
+
setChromeSurface(visualSettings.surface);
|
|
2376
2520
|
if (currentContext && changes) showChanges(currentContext, changes.model, visualSettings.visibility.changes, (width) => groupedChangesOwner(width));
|
|
2377
2521
|
if (sidebarTui?.terminal) sidebarState(sidebarTui).visibility = { todo: visualSettings.visibility.todo };
|
|
2378
2522
|
renderHost?.invalidateSidebar?.();
|
|
@@ -2449,12 +2593,18 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2449
2593
|
},
|
|
2450
2594
|
});
|
|
2451
2595
|
pi.on("session_start", async (_event, ctx) => {
|
|
2596
|
+
customizeGeneration++;
|
|
2597
|
+
if (imagesDiskCachePolicy === "session") {
|
|
2598
|
+
const cacheRoot = defaultCacheRoot(env);
|
|
2599
|
+
try {
|
|
2600
|
+
ImageDiskCache.sweepStale(cacheRoot, 7 * 24 * 60 * 60 * 1000);
|
|
2601
|
+
} catch {
|
|
2602
|
+
// A sweep that cannot run must never block the session.
|
|
2603
|
+
}
|
|
2604
|
+
imageAttachments.setCache(new ImageDiskCache({ root: cacheRoot, sessionId: ctx.sessionManager.getSessionId() }));
|
|
2605
|
+
}
|
|
2452
2606
|
closeCustomize?.();
|
|
2453
2607
|
runningJobs = undefined;
|
|
2454
|
-
adaptiveReasoningNotices.clear();
|
|
2455
|
-
// A restored or default session never emits model_select, so the startup model
|
|
2456
|
-
// announces itself here when it manages its own depth.
|
|
2457
|
-
announceAdaptiveReasoning(ctx, ctx.model);
|
|
2458
2608
|
if (review) {
|
|
2459
2609
|
review = undefined;
|
|
2460
2610
|
redrawReview();
|
|
@@ -2469,6 +2619,7 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2469
2619
|
applyCardContent();
|
|
2470
2620
|
if (!ctx.hasUI) return;
|
|
2471
2621
|
visualSettings = resolveVisualSettings(animationOptions).settings;
|
|
2622
|
+
setChromeSurface(visualSettings.surface);
|
|
2472
2623
|
if (!overrides.activeProfile) {
|
|
2473
2624
|
profileReader.bind(ctx.cwd, deps.resolveWorktree, ctx.sessionManager.getSessionId());
|
|
2474
2625
|
const sessionId = ctx.sessionManager.getSessionId();
|
|
@@ -2522,10 +2673,11 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2522
2673
|
const state = sidebarState(tui);
|
|
2523
2674
|
return Boolean(state.statusHidden?.() || state.headerOwnsStatus?.() || (state.active && state.ownsHost?.()));
|
|
2524
2675
|
};
|
|
2525
|
-
|
|
2676
|
+
// Chrome bars never group Changes: they keep their own row (or the rail).
|
|
2677
|
+
groupedChangesOwner = (width) => !narrowChrome() && !belowChrome() && belowFloat(width, !footerSuppressed()) !== undefined;
|
|
2526
2678
|
const bottomBar = {
|
|
2527
2679
|
...bottom,
|
|
2528
|
-
render: (width: number) => belowFloat(width, true)?.rows ?? (statusOwner() === STATUS_OWNER.BOTTOM ? renderShellBottomOnlyBar(footerModel(), theme, width, usageShortcutKey, visualSettings, undefined, gaugePaint(ctx)) : bottom.render(width)),
|
|
2680
|
+
render: (width: number) => bottomStatus() ? [] : belowFloat(width, true)?.rows ?? (statusOwner() === STATUS_OWNER.BOTTOM ? renderShellBottomOnlyBar(footerModel(), theme, width, usageShortcutKey, visualSettings, undefined, gaugePaint(ctx)) : bottom.render(width)),
|
|
2529
2681
|
handleMouse(event: Parameters<NonNullable<SidebarRail["handleMouse"]>>[0]) {
|
|
2530
2682
|
if (footerSuppressed() || event.type !== "click" || event.button !== "left") return undefined;
|
|
2531
2683
|
const chrome = belowFloat(event.width, true);
|
|
@@ -2536,21 +2688,26 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2536
2688
|
};
|
|
2537
2689
|
// The rail's Status is a panel: Changes, Review and Integrations, then
|
|
2538
2690
|
// the key hints that close the rail (the section headers carry none).
|
|
2539
|
-
|
|
2691
|
+
// The rail carries no key hints row: the Todos header shows its own collapse
|
|
2692
|
+
// key, and the bars carry the usage key.
|
|
2693
|
+
const railHints = undefined;
|
|
2540
2694
|
// Status sections are clickable like the other rail sections: a header
|
|
2541
2695
|
// folds its section, the Changes row opens /gentle:changes.
|
|
2542
2696
|
const statusCollapsed = new Set<StatusSection>();
|
|
2543
2697
|
let statusHover: StatusSection | "open-changes" | undefined;
|
|
2544
2698
|
// Keyed by width: the rail and the full-width panel sheet render the same part.
|
|
2545
2699
|
const statusTargets = new Map<number, StatusTarget[]>();
|
|
2700
|
+
const statusGroups = new Map<number, { groups: Array<{ start: number; end: number }>; loose: number[] }>();
|
|
2546
2701
|
const statusCard: Component = {
|
|
2547
2702
|
render(width: number) {
|
|
2548
|
-
//
|
|
2549
|
-
//
|
|
2550
|
-
|
|
2703
|
+
// Beside the rail every header placement draws a chrome bar that shows
|
|
2704
|
+
// the permission mode with its icon, so the rail never repeats the raw
|
|
2705
|
+
// mode statuses; the session-and-statuses view stays for other hosts.
|
|
2706
|
+
const view = statusCardVisible()
|
|
2551
2707
|
? renderShellStatusSections(withStats(footerModel()), theme, width, visualSettings, railHints, { collapsed: statusCollapsed, hovered: statusHover })
|
|
2552
2708
|
: renderShellStatusSections(withStats({ ...footerModel(), integrations: undefined, permission: undefined }), theme, width, visualSettings, railHints, { session: true, collapsed: statusCollapsed, hovered: statusHover });
|
|
2553
2709
|
statusTargets.set(width, view.targets);
|
|
2710
|
+
statusGroups.set(width, { groups: view.groups, loose: view.loose });
|
|
2554
2711
|
return view.lines;
|
|
2555
2712
|
},
|
|
2556
2713
|
invalidate() {
|
|
@@ -2605,6 +2762,7 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2605
2762
|
return JSON.stringify([footerStatus.key(), [...statusCollapsed], statusHover ?? "", stats ? [stats.turns, stats.toolCalls, stats.cost, stats.spanMs, spend?.runs, spend?.tokens, spend?.cost] : ""]);
|
|
2606
2763
|
},
|
|
2607
2764
|
render: (width) => statusRegion.render(width),
|
|
2765
|
+
cardGroups: (width) => statusGroups.get(width),
|
|
2608
2766
|
handleMouse: (event) => statusRegion.handleMouse(event),
|
|
2609
2767
|
invalidate: () => statusRegion.invalidate(),
|
|
2610
2768
|
});
|
|
@@ -2679,40 +2837,70 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2679
2837
|
// effort, context, cost, usage) plus session identity and the jobs count
|
|
2680
2838
|
// when Status is absent. Opaque statuses and working state stay excluded.
|
|
2681
2839
|
const headerBar = (width: number) => renderShellHeaderChrome(buildShellHeaderModel(footerModel(), !statusCardVisible() && (statusOwner() === STATUS_OWNER.HEADER || visualSettings.statusPlacement === "hidden")), theme, width, usageShortcutKey, visualSettings, gaugePaint(ctx));
|
|
2682
|
-
// With the rail shown and
|
|
2840
|
+
// With the rail shown and a split header, the chrome splits like an
|
|
2683
2841
|
// IDE: a title row with the project identity above, and a status bar
|
|
2684
2842
|
// with the per-frame counters below (design/shell-rework/02-proposal.html).
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
//
|
|
2688
|
-
|
|
2843
|
+
// A top header instead keeps the whole header row above the conversation.
|
|
2844
|
+
const ideChrome = () => statusCardVisible() && visualSettings.headerPlacement === "split";
|
|
2845
|
+
// The split title row and status bar also stay with Status hidden.
|
|
2846
|
+
const splitChrome = () => ideChrome() || (barChrome() && visualSettings.headerPlacement === "split");
|
|
2847
|
+
// Beside the rail the below-input bar is the full-width bottom row, like
|
|
2848
|
+
// split's status bar; the widget under the input steps aside while the
|
|
2849
|
+
// rail is actually drawn.
|
|
2850
|
+
const belowRail = () => fullscreen() && visualSettings.headerPlacement === "below-input" && statusCardVisible();
|
|
2851
|
+
// Beside the rail, the top and below-input headers draw the split status
|
|
2852
|
+
// bar's design (a chrome bar) with a margin row toward the content.
|
|
2853
|
+
// They apply beside the rail and with Status hidden (no rail at all); the
|
|
2854
|
+
// mobile chrome keeps phones and the minimal edition.
|
|
2855
|
+
const fullscreen = () => (tui as TUI & { mode?: string }).mode === "fullscreen";
|
|
2856
|
+
const barChrome = () => chromeBarsShown(tui);
|
|
2857
|
+
// Status at the bottom of a wide terminal: the chrome bars close the screen, and the
|
|
2858
|
+
// previous compact bottom bar steps aside ([ Panel ] opens the Status sections).
|
|
2859
|
+
const bottomStatus = () => barChrome() && visualSettings.statusPlacement === "bottom";
|
|
2860
|
+
const topChrome = () => barChrome() && visualSettings.headerPlacement === "top";
|
|
2861
|
+
// The below-input widget renders after the layout pass, so it can also
|
|
2862
|
+
// require the rail to be actually drawn (a rail that does not fit groups
|
|
2863
|
+
// Changes into the float footer as before).
|
|
2864
|
+
const belowChrome = () => barChrome() && visualSettings.headerPlacement === "below-input" && (visualSettings.statusPlacement === "hidden" || visualSettings.statusPlacement === "bottom" || sidebarState(tui).active === true);
|
|
2865
|
+
// Without the rail the bar also counts the running jobs, as the mobile status bar does.
|
|
2866
|
+
const chromeBar = (width: number) => renderShellChromeBar(footerModel(), theme, width, usageShortcutKey, visualSettings, gaugePaint(ctx), { jobs: !statusCardVisible() });
|
|
2867
|
+
const topHeader = (width: number) => chromeBar(width);
|
|
2868
|
+
// Comfortable centers the split title row between two margin rows.
|
|
2869
|
+
const titleRows = (width: number) => visualSettings.density === "comfortable"
|
|
2870
|
+
? [renderShellChromePad(theme, width), renderShellTitleRow(footerModel(), theme, width), renderShellChromePad(theme, width)]
|
|
2871
|
+
: [renderShellTitleRow(footerModel(), theme, width)];
|
|
2872
|
+
// Mobile keeps the same work row and editor for all placements. Only split
|
|
2873
|
+
// moves model identity to the title; top and below-input use one shared bar.
|
|
2689
2874
|
const narrowChrome = () => chromeMode(tui) === "narrow";
|
|
2875
|
+
const narrowSplit = () => narrowChrome() && visualSettings.headerPlacement === "split";
|
|
2876
|
+
const narrowTop = () => narrowChrome() && visualSettings.headerPlacement === "top";
|
|
2877
|
+
const narrowBelow = () => narrowChrome() && visualSettings.headerPlacement === "below-input";
|
|
2690
2878
|
if (tui.terminal) {
|
|
2691
2879
|
sidebarState(tui).compactWork = narrowChrome;
|
|
2692
|
-
//
|
|
2693
|
-
sidebarState(tui).statusBarShowsMode = () => chromeMode(tui) !== undefined;
|
|
2880
|
+
// The IDE chromes and the chrome bars show the permission mode with its icon.
|
|
2881
|
+
sidebarState(tui).statusBarShowsMode = () => chromeMode(tui) !== undefined || topChrome() || belowChrome() || splitChrome();
|
|
2694
2882
|
}
|
|
2695
|
-
const statusBarChrome = (width: number) =>
|
|
2883
|
+
const statusBarChrome = (width: number) => narrowSplit()
|
|
2696
2884
|
? renderShellStatusBar(footerModel(), theme, width, usageShortcutKey, { ...visualSettings, visibility: { ...visualSettings.visibility, modelDetails: false } }, gaugePaint(ctx), { jobs: true })
|
|
2697
|
-
:
|
|
2885
|
+
: chromeBar(width);
|
|
2698
2886
|
const disposeHeader = sidebarHeader(tui, {
|
|
2699
2887
|
digest: () => footerStatus.key(),
|
|
2700
|
-
render: (width) =>
|
|
2888
|
+
render: (width) => splitChrome() ? titleRows(width) : narrowSplit() ? [renderShellTitleRow(footerModel(), theme, width, { model: true })] : (narrowTop() || topChrome()) ? topHeader(width).rows : headerBar(width).rows,
|
|
2701
2889
|
invalidate() {},
|
|
2702
2890
|
handleMouse(event) {
|
|
2703
|
-
if (
|
|
2704
|
-
if (!shellHeaderUsageHit(headerBar(event.width), event.x, event.y)) return undefined;
|
|
2891
|
+
if (splitChrome() || narrowSplit() || narrowBelow() || event.type !== "click" || event.button !== "left") return undefined;
|
|
2892
|
+
if (!shellHeaderUsageHit(narrowTop() || topChrome() ? topHeader(event.width) : headerBar(event.width), event.x, event.y)) return undefined;
|
|
2705
2893
|
void openUsage(ctx);
|
|
2706
2894
|
return { handled: true, render: true };
|
|
2707
2895
|
},
|
|
2708
2896
|
});
|
|
2709
2897
|
const disposeStatusBar = sidebarStatusBar(tui, {
|
|
2710
2898
|
digest: () => footerStatus.key(),
|
|
2711
|
-
render: (width) =>
|
|
2899
|
+
render: (width) => splitChrome() || narrowSplit() || narrowBelow() ? statusBarChrome(width).rows : belowRail() ? chromeBar(width).rows : [],
|
|
2712
2900
|
invalidate() {},
|
|
2713
2901
|
handleMouse(event) {
|
|
2714
|
-
if (!(
|
|
2715
|
-
if (!shellHeaderUsageHit(statusBarChrome(event.width), event.x, event.y)) return undefined;
|
|
2902
|
+
if (!(splitChrome() || narrowSplit() || narrowBelow() || belowRail()) || event.type !== "click" || event.button !== "left") return undefined;
|
|
2903
|
+
if (!shellHeaderUsageHit(belowRail() ? chromeBar(event.width) : statusBarChrome(event.width), event.x, event.y)) return undefined;
|
|
2716
2904
|
void openUsage(ctx);
|
|
2717
2905
|
return { handled: true, render: true };
|
|
2718
2906
|
},
|
|
@@ -2727,13 +2915,21 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2727
2915
|
let disposed = false;
|
|
2728
2916
|
ctx.ui.setWidget(HEADER_WIDGET_KEY, () => ({
|
|
2729
2917
|
render(width: number) {
|
|
2730
|
-
if (disposed) return [];
|
|
2918
|
+
if (disposed || narrowChrome()) return [];
|
|
2919
|
+
if (belowRail() && sidebarState(tui).active) return [];
|
|
2920
|
+
if (belowChrome()) return chromeBar(width).rows;
|
|
2731
2921
|
if (belowFloat(width, false)) return footerSuppressed() ? widgetChrome(width).rows : [];
|
|
2732
2922
|
return belowHeader() ? headerBar(width).rows : [];
|
|
2733
2923
|
},
|
|
2734
2924
|
invalidate() {},
|
|
2735
2925
|
handleMouse(event) {
|
|
2736
|
-
if (disposed) return undefined;
|
|
2926
|
+
if (disposed || narrowChrome()) return undefined;
|
|
2927
|
+
if (belowRail() && sidebarState(tui).active) return undefined;
|
|
2928
|
+
if (belowChrome()) {
|
|
2929
|
+
if (event.type !== "click" || event.button !== "left" || !shellHeaderUsageHit(chromeBar(event.width), event.x, event.y)) return undefined;
|
|
2930
|
+
void openUsage(ctx);
|
|
2931
|
+
return { handled: true, render: true };
|
|
2932
|
+
}
|
|
2737
2933
|
const grouped = belowFloat(event.width, false);
|
|
2738
2934
|
if ((grouped ? !footerSuppressed() : !belowHeader()) || event.type !== "click" || event.button !== "left") return undefined;
|
|
2739
2935
|
if (!shellHeaderUsageHit(widgetChrome(event.width), event.x, event.y)) return undefined;
|
|
@@ -2768,8 +2964,12 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2768
2964
|
return [truncateToWidth(theme.fg("muted", shellJobsCount(compactRunningJobs.length)), width, "…")];
|
|
2769
2965
|
}
|
|
2770
2966
|
const rows = part.render(width);
|
|
2771
|
-
// Preserve a shrinkable exterior dock row, outside prompt/completion geometry
|
|
2772
|
-
|
|
2967
|
+
// Preserve a shrinkable exterior dock row, outside prompt/completion geometry,
|
|
2968
|
+
// only while the float prompt ends the dock. A titled-rule editor (top, split,
|
|
2969
|
+
// mobile) keeps its own bottom row as the margin, and a below-input header follows it.
|
|
2970
|
+
// A split status bar follows the prompt too, so it never needs the exterior row.
|
|
2971
|
+
const promptEndsDock = !(chromeMode(tui) !== undefined || chromeBarsShown(tui, true) || belowHeader());
|
|
2972
|
+
return rows.length === 0 && (tui as TUI & { mode?: string }).mode === "fullscreen" && promptEndsDock
|
|
2773
2973
|
&& resolvePromptLayout(width, cardStyle(), theme.bg?.bind(theme)).background ? [""] : rows;
|
|
2774
2974
|
},
|
|
2775
2975
|
handleMouse(event: Parameters<NonNullable<SidebarRail["handleMouse"]>>[0]) {
|
|
@@ -2788,8 +2988,10 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2788
2988
|
},
|
|
2789
2989
|
{ now: () => deps.now(), doubleEscCancelEnabled: () => doubleEscCancelPolicy === "on", dispatchQueuedText: (text) => { pendingQueuedText = pendingQueuedText === undefined ? text : `${pendingQueuedText}\n\n${text}`; }, vimRuntimeVersion: deps.vimRuntimeVersion, attachments: imageAttachments, readClipboardImage: () => (deps.readClipboardImage ?? readClipboardImage)(),
|
|
2790
2990
|
// The editor joins the wide IDE chrome while the rail owns the host with the header on top.
|
|
2791
|
-
panelChrome: (tui) => chromeMode(tui) !== undefined,
|
|
2792
|
-
|
|
2991
|
+
panelChrome: (tui) => chromeMode(tui) !== undefined || chromeBarsShown(tui, true),
|
|
2992
|
+
// Without the rail, [ Panel ] opens the Status sections: the mobile chrome,
|
|
2993
|
+
// and a wide terminal with Status at the bottom.
|
|
2994
|
+
panelButton: (tui) => chromeMode(tui) === "narrow" || (visualSettings.statusPlacement === "bottom" && chromeBarsShown(tui, true)),
|
|
2793
2995
|
topRows: (tui, width, hovered) => panelTopRows(tui, width, ctx.ui.theme, hovered),
|
|
2794
2996
|
// The mobile work row is the first top row; a tap on it opens the leading section's view.
|
|
2795
2997
|
onTopRowClick: (tui, index) => { if (chromeMode(tui) === "narrow" && index === 0) openWorkRow(tui, ctx); },
|
|
@@ -2832,7 +3034,10 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2832
3034
|
return { action: "transform", text: submitted.text, images: [...(event.images ?? []), ...submitted.images] };
|
|
2833
3035
|
});
|
|
2834
3036
|
pi.on("session_shutdown", (_event, ctx) => {
|
|
3037
|
+
customizeGeneration++;
|
|
2835
3038
|
disposeFooter?.();
|
|
3039
|
+
imageAttachments.dispose();
|
|
3040
|
+
imageAttachments.setCache(undefined);
|
|
2836
3041
|
closeCustomize?.();
|
|
2837
3042
|
if (review) {
|
|
2838
3043
|
review = undefined;
|
|
@@ -2882,6 +3087,21 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2882
3087
|
if (failed > 0) ctx.ui.notify(`Git status failed for ${failed} ${failed === 1 ? "root" : "roots"}; ${failed === 1 ? "its" : "their"} changes are not listed.`, "warning");
|
|
2883
3088
|
await showChangesOverlay(ctx, { loadDiff: (root, file) => loadFileDiff(deps.gitRunner(root, DIFF_MAX_BYTES), file), worktrees: () => tracker.worktrees, refresh: () => tracker.refresh(), apply: applyChanges, pollMs: changesPollMs(env) });
|
|
2884
3089
|
};
|
|
3090
|
+
pi.registerCommand(IMAGES_COMMAND_NAME, {
|
|
3091
|
+
description: "List the on-disk paths of images pasted in this draft (needs GENTLE_PI_IMAGES_DISK_CACHE=session).",
|
|
3092
|
+
handler: async (_args, ctx) => {
|
|
3093
|
+
if (imagesDiskCachePolicy !== "session") {
|
|
3094
|
+
ctx.ui.notify("Image disk cache is off. Set GENTLE_PI_IMAGES_DISK_CACHE=session to enable it.", "info");
|
|
3095
|
+
return;
|
|
3096
|
+
}
|
|
3097
|
+
const cached = imageAttachments.cachedPaths(prompt?.getText() ?? "");
|
|
3098
|
+
if (cached.length === 0) {
|
|
3099
|
+
ctx.ui.notify("No pasted images are cached in this draft.", "info");
|
|
3100
|
+
return;
|
|
3101
|
+
}
|
|
3102
|
+
for (const entry of cached) ctx.ui.notify(`${entry.token} ${entry.path}`, "info");
|
|
3103
|
+
},
|
|
3104
|
+
});
|
|
2885
3105
|
pi.registerCommand(CHANGES_COMMAND_NAME, {
|
|
2886
3106
|
description: "Browse uncommitted Git changes (working tree vs HEAD, untracked included) in this session's repository and its subagents' worktrees. Press o to open $EDITOR.",
|
|
2887
3107
|
handler: async (_args, ctx) => openChanges(ctx),
|
|
@@ -2950,13 +3170,26 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
2950
3170
|
});
|
|
2951
3171
|
}
|
|
2952
3172
|
pi.registerCommand("gentle:customize", {
|
|
2953
|
-
description: "Configure appearance, audio notifications, Vim editing, session permissions and global Auto/YOLO defaults, and prompt history capture.",
|
|
3173
|
+
description: "Configure appearance, task summary publishing, audio notifications, Vim editing, RDD, session permissions and global Auto/YOLO defaults, and prompt history capture.",
|
|
2954
3174
|
handler: async (_args, ctx) => {
|
|
2955
3175
|
if (ctx.mode !== "tui" || !ctx.hasUI) {
|
|
2956
3176
|
if (ctx.hasUI) ctx.ui.notify("Customization requires an interactive terminal.", "warning");
|
|
2957
3177
|
return;
|
|
2958
3178
|
}
|
|
2959
3179
|
closeCustomize?.();
|
|
3180
|
+
const generation = ++customizeGeneration;
|
|
3181
|
+
// The owner also checks its lifecycle; this binds this particular card
|
|
3182
|
+
// to its caller before discovery and again before handing off the UI.
|
|
3183
|
+
const currentRddSession = (() => {
|
|
3184
|
+
try {
|
|
3185
|
+
const manager = ctx.sessionManager, id = manager.getSessionId(), cwd = ctx.cwd, ui = ctx.ui;
|
|
3186
|
+
if (env.GENTLE_PI_AGENTS_CHILD === "1" || !id || !cwd || (manager.getCwd?.() ?? cwd) !== cwd) return () => false;
|
|
3187
|
+
return () => {
|
|
3188
|
+
try { return customizeGeneration === generation && ctx.mode === "tui" && ctx.hasUI && ctx.ui === ui && ctx.cwd === cwd && ctx.sessionManager === manager && manager.getSessionId() === id && (manager.getCwd?.() ?? cwd) === cwd; }
|
|
3189
|
+
catch { return false; }
|
|
3190
|
+
};
|
|
3191
|
+
} catch { return () => false; }
|
|
3192
|
+
})();
|
|
2960
3193
|
let closed = false;
|
|
2961
3194
|
let adapter: YoloUiAdapter | undefined;
|
|
2962
3195
|
let unobserve: (() => void) | undefined;
|
|
@@ -3082,6 +3315,40 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
3082
3315
|
reportVim(ctx, result);
|
|
3083
3316
|
},
|
|
3084
3317
|
});
|
|
3318
|
+
let rddControl: RddModeControl | undefined;
|
|
3319
|
+
let rddSnapshot: Awaited<ReturnType<RddModeControl["read"]>>;
|
|
3320
|
+
let rddLoading = true;
|
|
3321
|
+
let rddHandoff: RddModeControl | undefined;
|
|
3322
|
+
// Never block the rest of Customize on an unavailable or slow provider.
|
|
3323
|
+
// Rendering only consumes the snapshot, which is refreshed on each open.
|
|
3324
|
+
const refreshRdd = async () => {
|
|
3325
|
+
let control: RddModeControl | undefined;
|
|
3326
|
+
let snapshot: Awaited<ReturnType<RddModeControl["read"]>>;
|
|
3327
|
+
try {
|
|
3328
|
+
control = currentRddSession() ? await discoverRddModeControl(pi) : undefined;
|
|
3329
|
+
snapshot = !closed && currentRddSession() ? await control?.read() : undefined;
|
|
3330
|
+
} catch { /* An incompatible or failing bridge is unavailable. */ }
|
|
3331
|
+
if (closed) return;
|
|
3332
|
+
rddSnapshot = currentRddSession() && snapshot && (snapshot.effective === "on" || snapshot.effective === "off") && Object.values(NATIVE_REVIEW_MODE_SOURCE).includes(snapshot.source) ? snapshot : undefined;
|
|
3333
|
+
rddControl = rddSnapshot ? control : undefined;
|
|
3334
|
+
rddLoading = false;
|
|
3335
|
+
requestCustomizeRender?.();
|
|
3336
|
+
};
|
|
3337
|
+
rows.push({
|
|
3338
|
+
category,
|
|
3339
|
+
label: () => rddSnapshot ? `RDD: ${rddSnapshot.effective} (decided by ${rddSnapshot.source}) · checked on open` : `RDD: ${rddLoading ? "checking" : "unavailable"}`,
|
|
3340
|
+
preview: () => ({ title: "RDD selector", sample: "Enter for fresh status and repository or explicitly machine-wide choices; review consent unchanged." }),
|
|
3341
|
+
action: () => {
|
|
3342
|
+
if (closed || !currentRddSession()) return;
|
|
3343
|
+
if (!rddControl || !rddSnapshot) {
|
|
3344
|
+
ctx.ui.notify(rddLoading ? "RDD status is still being checked." : "RDD is unavailable in this live primary session.", "warning");
|
|
3345
|
+
return;
|
|
3346
|
+
}
|
|
3347
|
+
// The owner's native selector must not sit underneath our overlay.
|
|
3348
|
+
rddHandoff = rddControl;
|
|
3349
|
+
close();
|
|
3350
|
+
},
|
|
3351
|
+
});
|
|
3085
3352
|
let yoloDisplay: YoloDisplay = YOLO_DISPLAY.unavailable;
|
|
3086
3353
|
let permissionDisplay = "normal", permissionDefault = "normal";
|
|
3087
3354
|
let requestYoloRender = () => {};
|
|
@@ -3179,15 +3446,34 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
3179
3446
|
});
|
|
3180
3447
|
rows.push(...buildNotificationRows(ctx));
|
|
3181
3448
|
category = "Layout";
|
|
3182
|
-
|
|
3449
|
+
const taskSummary = () => resolveHerdrTaskSummarySettings(home);
|
|
3450
|
+
const taskSummaryCurrent = (enabled: boolean) => {
|
|
3451
|
+
const current = taskSummary();
|
|
3452
|
+
return !current.malformed && !current.readError && current.settings.enabled === enabled;
|
|
3453
|
+
};
|
|
3454
|
+
for (const enabled of [true, false]) add(
|
|
3455
|
+
() => `Task summary: ${enabled ? "on" : "off"}${taskSummaryCurrent(enabled) ? " (current)" : ""}`,
|
|
3456
|
+
`Task summary: ${enabled ? "on" : "off"}. Applies now to the active-task summary published to terminal tools (for example Herdr's sidebar).`,
|
|
3457
|
+
() => {
|
|
3458
|
+
const current = taskSummary();
|
|
3459
|
+
if (current.malformed || current.readError) throw new Error(`Cannot update malformed or unreadable task summary preference: ${current.globalFile}`);
|
|
3460
|
+
writeHerdrTaskSummarySettings({ ...current.settings, enabled }, home);
|
|
3461
|
+
pi.events.emit(HERDR_TASK_SUMMARY_CHANGED, { configHome: doubleEscCancelConfigHome });
|
|
3462
|
+
},
|
|
3463
|
+
undefined,
|
|
3464
|
+
{ ...explicitChoice("Task summary", enabled ? "on" : "off", () => taskSummaryCurrent(enabled)), hint: "Controls the task summary published to terminal tools" },
|
|
3465
|
+
);
|
|
3466
|
+
// Presets set the visibility switches and keep the placements, the density and the surface; any switch below still overrides them.
|
|
3183
3467
|
for (const preset of Object.values(VISUAL_PRESET)) add(() => `Preset: ${PRESET_LABEL[preset]}${visualPresetOf(visual()) === preset ? " (current)" : ""}`, pending, () => updateVisual((settings) => applyVisualPreset(settings, preset)), () => layoutPreview(applyVisualPreset(visual(), preset)),
|
|
3184
3468
|
layoutChoice("Preset", PRESET_LABEL[preset], () => visualPresetOf(visual()) === preset, "Light hides the rail, Power user adds Stats; alt+l cycles them"));
|
|
3185
3469
|
for (const value of Object.values(STATUS_PLACEMENT)) add(() => `Status placement: ${value}${visual().statusPlacement === value ? " (current)" : ""}`, pending, () => updateVisual((settings) => ({ ...settings, statusPlacement: value })), () => layoutPreview({ ...visual(), statusPlacement: value }),
|
|
3186
3470
|
layoutChoice("Status", value, () => visual().statusPlacement === value, "Where Status lives; auto uses the rail from 140 columns"));
|
|
3187
3471
|
for (const value of Object.values(HEADER_PLACEMENT)) add(() => `Header placement: ${value}${visual().headerPlacement === value ? " (current)" : ""}`, pending, () => updateVisual((settings) => ({ ...settings, headerPlacement: value })), () => layoutPreview({ ...visual(), headerPlacement: value }),
|
|
3188
|
-
layoutChoice("Header", value, () => visual().headerPlacement === value, "The model, context and cost row: above the conversation
|
|
3472
|
+
layoutChoice("Header", value, () => visual().headerPlacement === value, "The model, context and cost row: top above the conversation, below-input under the input, split into a title row and a bottom status bar"));
|
|
3189
3473
|
for (const value of Object.values(DENSITY)) add(() => `Density: ${value}${visual().density === value ? " (current)" : ""}`, pending, () => updateVisual((settings) => ({ ...settings, density: value })), () => layoutPreview({ ...visual(), density: value }),
|
|
3190
|
-
layoutChoice("Density", value, () => visual().density === value, "
|
|
3474
|
+
layoutChoice("Density", value, () => visual().density === value, "Spacing: comfortable adds gaps between rail sections and a padding row under a top header; compact removes them; minimal also drops the brand and the key hints"));
|
|
3475
|
+
for (const value of Object.values(CHROME_SURFACE)) add(() => `Surface: ${value}${visual().surface === value ? " (current)" : ""}`, pending, () => updateVisual((settings) => ({ ...settings, surface: value })), () => layoutPreview({ ...visual(), surface: value }),
|
|
3476
|
+
layoutChoice("Surface", value, () => visual().surface === value, "Chrome background: transparent (default) lets the terminal background show through; tinted paints the rail, header rows and panel"));
|
|
3191
3477
|
category = "Cards";
|
|
3192
3478
|
// One live style for conversation cards, panels, header/footer and prompt.
|
|
3193
3479
|
const cardStylePreview = { [CARD_STYLE.NEON]: "╭─ ✿ read ─╮ outlined chrome + prompt", [CARD_STYLE.FLOAT]: "▎ ✿ read painted chrome + prompt" };
|
|
@@ -3254,7 +3540,7 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
3254
3540
|
category = "Profiles";
|
|
3255
3541
|
rows.push({ category, label: "Visual profiles (preview, save, apply, delete)", preview: () => {
|
|
3256
3542
|
const saved = catalog()[0];
|
|
3257
|
-
return saved ? { title: `${saved.name} · saved profile`, sample: `${saved.visual.headerPlacement === "top" ? "[Header] → [Input]" : "[Input] → [Header]"} [${saved.visual.statusPlacement} status]` } : { title: "No saved profiles", sample: "Enter to save the current appearance" };
|
|
3543
|
+
return saved ? { title: `${saved.name} · saved profile`, sample: `${saved.visual.headerPlacement === "top" ? "[Header] → [Input]" : saved.visual.headerPlacement === "split" ? "[Title] → [Input] → [Status bar]" : "[Input] → [Header]"} [${saved.visual.statusPlacement} status]` } : { title: "No saved profiles", sample: "Enter to save the current appearance" };
|
|
3258
3544
|
}, action: () => {
|
|
3259
3545
|
catalog();
|
|
3260
3546
|
customizeView?.openProfiles();
|
|
@@ -3339,16 +3625,19 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
3339
3625
|
requestCustomizeRender = requestYoloRender;
|
|
3340
3626
|
customizeView = new VisualCustomizeView({ rows, profiles, theme, requestRender: requestYoloRender, rowsAvailable: () => Math.max(0, Math.floor(tui.terminal.rows * 0.85) - 2), onError: (error) => { if (!closed) ctx.ui.notify(`${customizeView?.title() ?? "Customization"}: ${error.message}`, "error"); }, onClose: close });
|
|
3341
3627
|
const view = customizeView;
|
|
3628
|
+
void refreshRdd();
|
|
3342
3629
|
// Own interaction lifetime here, leaving the shared view unchanged.
|
|
3343
3630
|
return {
|
|
3344
3631
|
render: (width) => closed ? [] : view.render(width),
|
|
3345
3632
|
handleInput: (data) => { if (!closed) view.handleInput(data); },
|
|
3633
|
+
handleMouse: (event) => closed ? undefined : view.handleMouse(event),
|
|
3346
3634
|
focus: (label: string) => !closed && view.focus(label),
|
|
3347
3635
|
invalidate: () => { if (!closed) view.invalidate(); },
|
|
3348
3636
|
dispose: close,
|
|
3349
3637
|
};
|
|
3350
3638
|
}, { overlay: true, overlayOptions: { anchor: "center", width: "70%", minWidth: 60, maxHeight: "85%" } });
|
|
3351
3639
|
} finally { close(); }
|
|
3640
|
+
if (rddHandoff && currentRddSession()) await rddHandoff.open();
|
|
3352
3641
|
if (reloadRequested) await ctx.reload();
|
|
3353
3642
|
},
|
|
3354
3643
|
});
|
|
@@ -3503,10 +3792,4 @@ export default function gentleShell(pi: ExtensionAPI, env: NodeJS.ProcessEnv = p
|
|
|
3503
3792
|
trackChangeRefresh(refreshChanges(ctx));
|
|
3504
3793
|
void refreshUsage(ctx, false);
|
|
3505
3794
|
});
|
|
3506
|
-
pi.on("model_select", (event, ctx) => {
|
|
3507
|
-
announceAdaptiveReasoning(ctx, event.model);
|
|
3508
|
-
});
|
|
3509
|
-
pi.on("thinking_level_select", (_event, ctx) => {
|
|
3510
|
-
announceAdaptiveReasoning(ctx, ctx.model);
|
|
3511
|
-
});
|
|
3512
3795
|
}
|