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
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { Container, ScrollView, VStack, visibleWidth, type Component, type TUI, type TuiMouseEvent } from "@earendil-works/pi-tui";
|
|
1
|
+
import { Container, ScrollView, VStack, truncateToWidth, visibleWidth, type Component, type TUI, type TuiMouseEvent } from "@earendil-works/pi-tui";
|
|
2
2
|
import { setSidebarHover, sidebarState, type SidebarRail } from "./shell-sidebar.ts";
|
|
3
3
|
import type { ShellBarTheme } from "./shell-bar.ts";
|
|
4
|
-
import { CARD_STYLE, cardStyle, paintSurfaceRow,
|
|
5
|
-
import {
|
|
4
|
+
import { CARD_STYLE, CARD_TONE, cardBottom, cardLine, cardStyle, cardTop, floatRows, paintSurfaceRow, panelInnerWidth, type CardStyle } from "./shell-card.ts";
|
|
5
|
+
import { chromeSurface, PANEL_ROW_INDENT, panelSurfaceOpener, sectionGap } from "./shell-panel.ts";
|
|
6
6
|
import { renderSidebarBanner } from "./shell-sidebar-banner.ts";
|
|
7
7
|
import type { Density, HeaderPlacement, StatusPlacement } from "./visual-customization-policy.ts";
|
|
8
8
|
|
|
9
9
|
export const SIDEBAR_BREAKPOINT = 140;
|
|
10
10
|
const RAIL_WIDTH = 50;
|
|
11
11
|
const RAIL_PADDING = 1;
|
|
12
|
-
// The
|
|
13
|
-
// padding that puts the card's right border two columns in from the edge.
|
|
14
|
-
// The header row stops at the same column so its right group lines up with
|
|
15
|
-
// the card instead of touching the terminal edge.
|
|
16
|
-
const HEADER_RIGHT_INSET = RAIL_PADDING + 1;
|
|
12
|
+
// The conversation and rail keep a gap below the full-width header.
|
|
17
13
|
const GAP = 3;
|
|
18
14
|
/** Right-edge columns the painting rail takes from the editor column; published as `railColumns`. */
|
|
19
15
|
export const SIDEBAR_RAIL_COLUMNS = RAIL_WIDTH + GAP;
|
|
@@ -25,14 +21,59 @@ type StackLayoutEntry = ConstructorParameters<typeof VStack>[0] extends Array<in
|
|
|
25
21
|
type LayoutRoot = Component & { [NODE]?: () => LayoutNode };
|
|
26
22
|
type Host = TUI & { mode?: string; layoutRoot?: LayoutRoot };
|
|
27
23
|
type SidebarCache = { revision: number };
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
// `x`/`row` map a rail cell to the part's own cells; `frameWidth`/`frameHeight` are
|
|
25
|
+
// the frame the part rendered, which its mouse handler checks events against.
|
|
26
|
+
// A card title row (`wholeRow`) answers across the whole rail row, its x clamped into the frame.
|
|
27
|
+
type RailHit = { key: string; component: Component; startY: number; height: number; width: number; x: number; row: number; frameWidth: number; frameHeight: number; wholeRow?: boolean };
|
|
28
|
+
type SectionCacheEntry = { component: Component; digest: string | undefined; revision: number; contentWidth: number; renderWidth: number; cardStyle: CardStyle; theme: ShellBarTheme; themeSignature: string; lines: string[] };
|
|
29
|
+
// A transparent rail draws every section as its own card in the transcript's
|
|
30
|
+
// card style (neon outline with the title in the top rule, float tint with its
|
|
31
|
+
// accent bar), through the same renderCard the conversation cards use.
|
|
32
|
+
type CardGeometry = { headerRow: number; headerX: number; bodyRow: number; bodyX: number };
|
|
33
|
+
// One section card: the title (with its count as the top rule's hint) and the
|
|
34
|
+
// body rows together, so a float card spends no separator row between them.
|
|
35
|
+
function sectionCardRows(header: { glyph?: string; title: string; count?: string }, body: readonly string[], theme: ShellBarTheme, width: number): string[] {
|
|
36
|
+
const tone = CARD_TONE.INFO;
|
|
37
|
+
return floatRows(tone, theme, width, (inner) => ({
|
|
38
|
+
head: [cardTop({ title: header.title, ...(header.glyph ? { glyph: header.glyph } : {}), body: [], tone }, theme, inner, header.count), ...body.map((row) => cardLine(row, tone, theme, inner))],
|
|
39
|
+
bottom: cardBottom(tone, theme, inner),
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
const CARD_PROBE = "\u2063probe";
|
|
43
|
+
const geometryCache = new Map<string, CardGeometry>();
|
|
44
|
+
function cardGeometry(theme: ShellBarTheme, width: number, style: CardStyle): CardGeometry {
|
|
45
|
+
const key = `${style}:${width}:${themeSignature(theme)}`;
|
|
46
|
+
const cached = geometryCache.get(key);
|
|
47
|
+
if (cached) return cached;
|
|
48
|
+
const rows = sectionCardRows({ glyph: "▾", title: "HEADER" }, [CARD_PROBE], theme, width).map((row) => row.replace(/\x1b\[[0-9;]*m/g, ""));
|
|
49
|
+
const bodyRow = Math.max(0, rows.findIndex((row) => row.includes(CARD_PROBE)));
|
|
50
|
+
const headerRow = Math.max(0, rows.findIndex((row) => row.includes("HEADER")));
|
|
51
|
+
const geometry = { headerRow, headerX: Math.max(0, visibleWidth(rows[headerRow]!.slice(0, rows[headerRow]!.indexOf("▾")))), bodyRow, bodyX: Math.max(0, visibleWidth(rows[bodyRow]!.slice(0, rows[bodyRow]!.indexOf(CARD_PROBE)))) };
|
|
52
|
+
if (geometryCache.size > 64) geometryCache.clear();
|
|
53
|
+
geometryCache.set(key, geometry);
|
|
54
|
+
return geometry;
|
|
55
|
+
}
|
|
56
|
+
// The header row a part renders (`▾ NAME … count`, styled, hover included),
|
|
57
|
+
// split at the gap before its right-aligned count into the card's glyph,
|
|
58
|
+
// title and count, keeping their styling.
|
|
59
|
+
function headerParts(line: string): { glyph?: string; title: string; count?: string } {
|
|
60
|
+
const trimmed = line.replace(/ +((?:\x1b\[[0-9;]*m)*)$/, "$1");
|
|
61
|
+
const split = /^(.*?\S)( {2,})(?=\S|\x1b)(.*)$/s.exec(trimmed);
|
|
62
|
+
const left = split ? split[1]! : trimmed;
|
|
63
|
+
const count = split?.[3]?.trim() ? split[3] : undefined;
|
|
64
|
+
// The glyph keeps its own escape codes on both sides (the hover role paints it),
|
|
65
|
+
// so no opening code leaks onto the title.
|
|
66
|
+
const glyph = /^((?:\x1b\[[0-9;]*m)*[▾▸](?:\x1b\[[0-9;]*m)*)\s/.exec(left);
|
|
67
|
+
return { ...(glyph ? { glyph: glyph[1] } : {}), title: glyph ? left.slice(glyph[0].length) : left, ...(count ? { count } : {}) };
|
|
68
|
+
}
|
|
30
69
|
type SidebarPresentation = { scrollTop: number; output: LayoutNode };
|
|
31
70
|
type PreparedRail = {
|
|
32
71
|
revision: number;
|
|
33
72
|
width: number;
|
|
34
73
|
mode: string | undefined;
|
|
35
74
|
headerPlacement: HeaderPlacement;
|
|
75
|
+
density: Density;
|
|
76
|
+
surface: string;
|
|
36
77
|
cardStyle: CardStyle;
|
|
37
78
|
root: LayoutRoot;
|
|
38
79
|
theme: ShellBarTheme;
|
|
@@ -110,11 +151,11 @@ export interface StatusOwnerInput {
|
|
|
110
151
|
*/
|
|
111
152
|
export function narrowStatusOwner(input: StatusOwnerInput): StatusOwner | undefined {
|
|
112
153
|
if (input.mode !== "fullscreen" || input.columns >= SIDEBAR_BREAKPOINT) return undefined;
|
|
113
|
-
return input.headerPlacement
|
|
154
|
+
return input.headerPlacement !== "below-input" || input.statusPlacement === "hidden" ? STATUS_OWNER.HEADER : STATUS_OWNER.BOTTOM;
|
|
114
155
|
}
|
|
115
156
|
|
|
116
157
|
/** Installs the fullscreen rail: wraps the host layout root with the [rail, transcript] hstack and returns a disposer restoring the original layout. */
|
|
117
|
-
export function installSidebar(tui: TUI, theme: ShellBarTheme, placement: () => StatusPlacement = () => "auto", headerPlacement: () => HeaderPlacement = () => "
|
|
158
|
+
export function installSidebar(tui: TUI, theme: ShellBarTheme, placement: () => StatusPlacement = () => "auto", headerPlacement: () => HeaderPlacement = () => "split", density: () => Density = () => "comfortable"): () => void {
|
|
118
159
|
if (!tui.terminal) return () => {};
|
|
119
160
|
const host = tui as Host;
|
|
120
161
|
const state = sidebarState(tui);
|
|
@@ -142,7 +183,7 @@ export function installSidebar(tui: TUI, theme: ShellBarTheme, placement: () =>
|
|
|
142
183
|
// A narrow top header is the only status row there. Whether it paints comes
|
|
143
184
|
// from the last layout pass (a blank or failed header never swallows the
|
|
144
185
|
// bottom bar); the geometry is read live so a resize applies before the next pass.
|
|
145
|
-
const headerOwnsStatus = () => !stopped && !failed && headerLines.length > 0 && headerPlacement()
|
|
186
|
+
const headerOwnsStatus = () => !stopped && !failed && headerLines.length > 0 && headerPlacement() !== "below-input" &&
|
|
146
187
|
narrowStatusOwner({ mode: host.mode, columns: tui.terminal.columns, statusPlacement: placement(), headerPlacement: headerPlacement() }) === STATUS_OWNER.HEADER;
|
|
147
188
|
state.headerOwnsStatus = headerOwnsStatus;
|
|
148
189
|
state.railColumns = SIDEBAR_RAIL_COLUMNS;
|
|
@@ -205,17 +246,19 @@ export function installSidebar(tui: TUI, theme: ShellBarTheme, placement: () =>
|
|
|
205
246
|
const current = prepared;
|
|
206
247
|
if (!current || stopped || failed || !current.active || current.revision !== cache.revision ||
|
|
207
248
|
host.mode !== "fullscreen" || tui.terminal.columns !== current.width || host.layoutRoot !== current.root ||
|
|
208
|
-
scroll.getContentWidth(event.width) !== current.contentWidth || event.x <
|
|
249
|
+
scroll.getContentWidth(event.width) !== current.contentWidth || event.x < 0 ||
|
|
209
250
|
event.x >= current.contentWidth || event.y < 0 || event.y >= event.height) return undefined;
|
|
210
251
|
const contentY = scroll.scrollTop + event.y;
|
|
211
252
|
const hit = current.hits.find((candidate) => contentY >= candidate.startY && contentY < candidate.startY + candidate.height);
|
|
212
|
-
if (!hit || state.parts.get(hit.key) !== hit.component
|
|
253
|
+
if (!hit || state.parts.get(hit.key) !== hit.component) return undefined;
|
|
254
|
+
if (!hit.wholeRow && (event.x < hit.x || event.x >= hit.x + hit.width)) return undefined;
|
|
255
|
+
// The part sees the event in the frame it rendered: its own width and all its rows.
|
|
213
256
|
return hit.component.handleMouse?.({
|
|
214
257
|
...event,
|
|
215
|
-
x: event.x -
|
|
216
|
-
y: contentY - hit.startY,
|
|
217
|
-
width: hit.
|
|
218
|
-
height: hit.
|
|
258
|
+
x: Math.max(0, Math.min(hit.frameWidth - 1, event.x - hit.x)),
|
|
259
|
+
y: hit.row + contentY - hit.startY,
|
|
260
|
+
width: hit.frameWidth,
|
|
261
|
+
height: hit.frameHeight,
|
|
219
262
|
});
|
|
220
263
|
};
|
|
221
264
|
scroll.handleMouse = (event) => {
|
|
@@ -251,7 +294,7 @@ export function installSidebar(tui: TUI, theme: ShellBarTheme, placement: () =>
|
|
|
251
294
|
statusLines = [];
|
|
252
295
|
try {
|
|
253
296
|
const headerPart = state.parts.get("header");
|
|
254
|
-
headerLines = headerPlacement()
|
|
297
|
+
headerLines = headerPlacement() !== "below-input" && headerPart
|
|
255
298
|
? [...(headerPart.render(Math.max(0, width)) ?? [])] : [];
|
|
256
299
|
if (!headerLines.some((line) => line.trim() !== "")) headerLines = [];
|
|
257
300
|
// A narrow terminal keeps the status bar row (mobile chrome) when its part paints one.
|
|
@@ -272,7 +315,7 @@ export function installSidebar(tui: TUI, theme: ShellBarTheme, placement: () =>
|
|
|
272
315
|
const digests = parts.map(([, rail]) => railDigest(rail));
|
|
273
316
|
const signature = themeSignature(theme);
|
|
274
317
|
const unchanged = prepared?.revision === cache.revision &&
|
|
275
|
-
prepared.width === width && prepared.mode === host.mode && prepared.headerPlacement === headerPlacement() && prepared.cardStyle === style && prepared.root === root && prepared.theme === theme && prepared.themeSignature === signature &&
|
|
318
|
+
prepared.width === width && prepared.mode === host.mode && prepared.headerPlacement === headerPlacement() && prepared.density === density() && prepared.surface === chromeSurface() && prepared.cardStyle === style && prepared.root === root && prepared.theme === theme && prepared.themeSignature === signature &&
|
|
276
319
|
prepared.parts.length === parts.length && prepared.parts.every(([key, part], index) => parts[index]?.[0] === key && parts[index]?.[1] === part) &&
|
|
277
320
|
prepared.digests.length === digests.length && prepared.digests.every((digest, index) => digest === digests[index]);
|
|
278
321
|
if (unchanged) {
|
|
@@ -284,13 +327,19 @@ export function installSidebar(tui: TUI, theme: ShellBarTheme, placement: () =>
|
|
|
284
327
|
}
|
|
285
328
|
try {
|
|
286
329
|
const digestByPart = new Map(parts.map(([key], index) => [key, digests[index]]));
|
|
287
|
-
//
|
|
288
|
-
// the
|
|
289
|
-
// 50-column rail's content width.
|
|
330
|
+
// Top and split headers are full-width siblings above the conversation
|
|
331
|
+
// and rail; the registered part still chooses which content to render.
|
|
290
332
|
const headerPart = state.parts.get("header");
|
|
291
|
-
const preparedHeaderLines = [...(headerPart?.render(Math.max(0, width
|
|
333
|
+
const preparedHeaderLines = [...(headerPart?.render(Math.max(0, width)) ?? [])];
|
|
292
334
|
const headerActive = headerPart !== undefined && preparedHeaderLines.some((line) => line.trim() !== "");
|
|
293
335
|
const contentWidth = scroll.getContentWidth(RAIL_WIDTH);
|
|
336
|
+
const carded = chromeSurface() === "transparent";
|
|
337
|
+
// Float cards are tinted from edge to edge, so two of them would fuse into one
|
|
338
|
+
// slab: like the conversation cards, they always keep a blank row between them.
|
|
339
|
+
// Neon cards close with their own rule, so the density decides their gap.
|
|
340
|
+
const cardGap = () => (carded && style === CARD_STYLE.FLOAT) || sectionGap(density());
|
|
341
|
+
// A carded section renders one indent wider; its body rows drop that indent inside the card.
|
|
342
|
+
const renderWidth = carded ? panelInnerWidth(theme, contentWidth) + PANEL_ROW_INDENT : contentWidth - RAIL_PADDING * 2;
|
|
294
343
|
// Live work first, then the session Status sections (design/shell-rework/02-proposal.html).
|
|
295
344
|
const sections = ["todo", "jobs", "agents", "footer"].filter((key) => key !== "todo" || state.visibility?.todo !== false).map((key) => {
|
|
296
345
|
const component = state.parts.get(key);
|
|
@@ -302,14 +351,14 @@ export function installSidebar(tui: TUI, theme: ShellBarTheme, placement: () =>
|
|
|
302
351
|
const existing = sectionCache.get(key);
|
|
303
352
|
// Sections paint their card chrome in the active style, which their
|
|
304
353
|
// own digests do not track, so a style switch must re-render them.
|
|
305
|
-
const reusable = existing?.component === component && existing.contentWidth === contentWidth && existing.cardStyle === style && existing.theme === theme && existing.themeSignature === signature &&
|
|
354
|
+
const reusable = existing?.component === component && existing.contentWidth === contentWidth && existing.renderWidth === renderWidth && existing.cardStyle === style && existing.theme === theme && existing.themeSignature === signature &&
|
|
306
355
|
(digest !== undefined ? existing.digest === digest : existing.digest === undefined && existing.revision === cache.revision);
|
|
307
356
|
const lines = reusable ? existing.lines : (() => {
|
|
308
|
-
const rendered = [...(component.render(
|
|
357
|
+
const rendered = [...(component.render(renderWidth) ?? [])];
|
|
309
358
|
while (rendered.length && rendered[rendered.length - 1]?.trim() === "") rendered.pop();
|
|
310
359
|
return rendered;
|
|
311
360
|
})();
|
|
312
|
-
sectionCache.set(key, { component, digest, revision: cache.revision, contentWidth, cardStyle: style, theme, themeSignature: signature, lines });
|
|
361
|
+
sectionCache.set(key, { component, digest, revision: cache.revision, contentWidth, renderWidth, cardStyle: style, theme, themeSignature: signature, lines });
|
|
313
362
|
return { key, component, lines };
|
|
314
363
|
}).filter((section) => section.component !== undefined && section.lines.length > 0) as Array<{ key: string; component: Component; lines: string[] }>;
|
|
315
364
|
// The header carries the brand once it is active; the banner is the
|
|
@@ -318,11 +367,15 @@ export function installSidebar(tui: TUI, theme: ShellBarTheme, placement: () =>
|
|
|
318
367
|
const hits: RailHit[] = [];
|
|
319
368
|
railLines = [];
|
|
320
369
|
fillRow = "";
|
|
321
|
-
const surface =
|
|
370
|
+
const surface = panelSurfaceOpener(theme);
|
|
371
|
+
if (sections.length && headerActive && headerPlacement() !== "below-input") {
|
|
372
|
+
// Tinted spacing continues the rail background; transparent spacing
|
|
373
|
+
// leaves a clear row above the first card. Count it before recording hits.
|
|
374
|
+
railLines.push(paintSurfaceRow(" ".repeat(contentWidth), surface));
|
|
375
|
+
}
|
|
322
376
|
if (sections.length && branding.length) {
|
|
323
377
|
railLines.push(...branding.map((line) => " ".repeat(RAIL_PADDING) + line + " ".repeat(RAIL_PADDING)));
|
|
324
|
-
} else if (sections.length && headerActive &&
|
|
325
|
-
// Pad the first section beneath the header without breaking its surface.
|
|
378
|
+
} else if (!carded && sections.length && headerActive && headerPlacement() === "below-input" && density() === "comfortable" && style === CARD_STYLE.NEON) {
|
|
326
379
|
// Keep neon's existing comfortable gap for below-input headers too.
|
|
327
380
|
railLines.push((sections[0].component as SidebarRail).surface === "panel" ? paintSurfaceRow(" ".repeat(contentWidth), surface) : "");
|
|
328
381
|
}
|
|
@@ -334,20 +387,40 @@ export function installSidebar(tui: TUI, theme: ShellBarTheme, placement: () =>
|
|
|
334
387
|
const paint = (row: string) => (panel ? paintSurfaceRow(row, surface) : row);
|
|
335
388
|
// One blank row separates a section from the banner or the
|
|
336
389
|
// previous section; neon's header gap above is not a section.
|
|
337
|
-
if ((hits.length > 0 || branding.length > 0) &&
|
|
390
|
+
if ((hits.length > 0 || branding.length > 0) && (carded ? cardGap() : sectionGap(density()))) railLines.push(!carded && panel && previousPanel ? paint(" ".repeat(contentWidth)) : "");
|
|
391
|
+
if (carded) {
|
|
392
|
+
const layout = (section.component as SidebarRail).cardGroups?.(renderWidth) ?? { groups: [{ start: 0, end: section.lines.length }] };
|
|
393
|
+
const geometry = cardGeometry(theme, contentWidth, style);
|
|
394
|
+
const indent = " ".repeat(PANEL_ROW_INDENT);
|
|
395
|
+
layout.groups.forEach((group, index) => {
|
|
396
|
+
if (index > 0 && cardGap()) railLines.push("");
|
|
397
|
+
const body = section.lines.slice(group.start + 1, group.end).map((row) => row.startsWith(indent) ? row.slice(PANEL_ROW_INDENT) : row);
|
|
398
|
+
while (body.length && body[body.length - 1]?.trim() === "") body.pop();
|
|
399
|
+
const top = railLines.length;
|
|
400
|
+
railLines.push(...sectionCardRows(headerParts(section.lines[group.start] ?? ""), body, theme, contentWidth));
|
|
401
|
+
// The title row folds the section like its header; body rows keep their own rows.
|
|
402
|
+
const frame = { frameWidth: renderWidth, frameHeight: section.lines.length };
|
|
403
|
+
hits.push({ key: section.key, component: section.component, startY: top + geometry.headerRow, height: 1, width: renderWidth, x: geometry.headerX, row: group.start, wholeRow: true, ...frame });
|
|
404
|
+
if (body.length) hits.push({ key: section.key, component: section.component, startY: top + geometry.bodyRow, height: body.length, width: renderWidth - PANEL_ROW_INDENT, x: geometry.bodyX - PANEL_ROW_INDENT, row: group.start + 1, ...frame });
|
|
405
|
+
});
|
|
406
|
+
const loose = (layout.loose ?? []).map((row) => section.lines[row] ?? "").filter((row) => row.trim() !== "");
|
|
407
|
+
if (loose.length && sectionGap(density())) railLines.push("");
|
|
408
|
+
railLines.push(...loose.map((row) => truncateToWidth(row.trimEnd(), contentWidth, "…")));
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
338
411
|
const startY = railLines.length;
|
|
339
412
|
railLines.push(...section.lines.map((line) => paint(" ".repeat(RAIL_PADDING) + line + " ".repeat(RAIL_PADDING))));
|
|
340
413
|
previousPanel = panel;
|
|
341
414
|
fillRow = panel ? paint(" ".repeat(contentWidth)) : "";
|
|
342
|
-
hits.push({ key: section.key, component: section.component, startY, height: section.lines.length, width:
|
|
415
|
+
hits.push({ key: section.key, component: section.component, startY, height: section.lines.length, width: renderWidth, x: RAIL_PADDING, row: 0, frameWidth: renderWidth, frameHeight: section.lines.length });
|
|
343
416
|
}
|
|
344
417
|
// Height is owned by the native ScrollView, never by the transcript.
|
|
345
418
|
const active = railLines.length > 0 && railLines.every((line) => visibleWidth(line) <= contentWidth);
|
|
346
|
-
headerLines = headerActive && headerPlacement()
|
|
419
|
+
headerLines = headerActive && headerPlacement() !== "below-input" ? preparedHeaderLines : [];
|
|
347
420
|
const statusPart = state.parts.get("statusbar");
|
|
348
|
-
const preparedStatusLines = active && statusPart ? [...(statusPart.render(Math.max(0, width
|
|
421
|
+
const preparedStatusLines = active && statusPart ? [...(statusPart.render(Math.max(0, width)) ?? [])] : [];
|
|
349
422
|
statusLines = preparedStatusLines.some((line) => line.trim() !== "") ? preparedStatusLines : [];
|
|
350
|
-
prepared = { revision: cache.revision, width, mode: host.mode, headerPlacement: headerPlacement(), cardStyle: style, root, theme, themeSignature: signature, parts, digests, contentWidth, active, lines: railLines, hits, headerLines, statusLines, fillRow, headerActive: headerLines.length > 0 };
|
|
423
|
+
prepared = { revision: cache.revision, width, mode: host.mode, headerPlacement: headerPlacement(), density: density(), surface: chromeSurface(), cardStyle: style, root, theme, themeSignature: signature, parts, digests, contentWidth, active, lines: railLines, hits, headerLines, statusLines, fillRow, headerActive: headerLines.length > 0 };
|
|
351
424
|
state.active = active;
|
|
352
425
|
return active;
|
|
353
426
|
} catch {
|
|
@@ -408,10 +481,9 @@ export function installSidebar(tui: TUI, theme: ShellBarTheme, placement: () =>
|
|
|
408
481
|
const nativeLayout = () => placement() === "hidden" || headerOwnsStatus() || state.compactWork?.() ? reclaimFooterRow(original.call(root)) : original.call(root);
|
|
409
482
|
const nativeHost = { render: () => [], invalidate() {}, [NODE]: nativeLayout };
|
|
410
483
|
const left = { render: () => [], invalidate() {}, [NODE]: () => reclaimFooterRow(original.call(root)) };
|
|
411
|
-
//
|
|
412
|
-
//
|
|
413
|
-
//
|
|
414
|
-
// recurses into a nested layout via [NODE].
|
|
484
|
+
// The full-width header is a sibling above this stable conversation/rail
|
|
485
|
+
// hstack. Pi keeps native transcript scrolling and dispatches header and
|
|
486
|
+
// rail mouse events in their respective boxes.
|
|
415
487
|
const hstackHost: Component & { [NODE](): LayoutNode } = {
|
|
416
488
|
render: () => [],
|
|
417
489
|
invalidate() {},
|
package/lib/shell-sidebar.ts
CHANGED
|
@@ -34,6 +34,13 @@ export interface SidebarState {
|
|
|
34
34
|
|
|
35
35
|
/** A rail slot in the fullscreen sidebar. */
|
|
36
36
|
export interface SidebarRail extends Component {
|
|
37
|
+
/**
|
|
38
|
+
* Row ranges of the sections this part renders, for a transparent rail that
|
|
39
|
+
* draws every section as its own card: each group starts at its header row
|
|
40
|
+
* and ends before `end`; `loose` rows (key hints) sit outside the cards.
|
|
41
|
+
* Without it the whole part is one section headed by its first row.
|
|
42
|
+
*/
|
|
43
|
+
cardGroups?(width: number): { groups: Array<{ start: number; end: number }>; loose?: number[] } | undefined;
|
|
37
44
|
/**
|
|
38
45
|
* Cheap digest of the live state this rail paints. The fullscreen layout memo
|
|
39
46
|
* re-renders a part only when its digest changes, so a rail that reads session
|
package/lib/shell-todo.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { truncateToWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
2
|
+
import type { OrchestratorMode } from "./agent-profiles.ts";
|
|
2
3
|
import { CARD_TONE, panelHeaderRow, panelInnerWidth, renderCard, type CardTheme, type CardTone } from "./shell-card.ts";
|
|
3
4
|
import { sanitizeTerminalText } from "./terminal-theme.ts";
|
|
4
5
|
import { paintHoverable } from "./shell-hover.ts";
|
|
@@ -285,6 +286,8 @@ export function replayTodo(entries: readonly unknown[]): TodoState {
|
|
|
285
286
|
// hidden transcript message appended when it changes (todoStateMessage,
|
|
286
287
|
// gentle-shell#2195), so requests stay append-only and a change costs only
|
|
287
288
|
// the tail of the conversation, never the prefix.
|
|
289
|
+
const TODO_SMALL_TASK_ORGANIC = "A small task (Task Size) uses no todo list: do it and report.";
|
|
290
|
+
const TODO_SMALL_TASK_FULL_DELEGATION = "A small task (Task Size) uses no todo list: delegate it and report.";
|
|
288
291
|
const TODO_PROMPT_BLOCK = [
|
|
289
292
|
"## Todo list",
|
|
290
293
|
"A small task (Task Size) uses no todo list: do it and report. For tracked or multi-step work, keep it current with the `todo` tool: mark a task in_progress before starting it, done right after finishing it, and rewrite the whole list with `write` whenever the plan changes. Update it before you end the turn.",
|
|
@@ -293,7 +296,9 @@ const TODO_PROMPT_BLOCK = [
|
|
|
293
296
|
].join("\n");
|
|
294
297
|
|
|
295
298
|
/** The byte-stable rules block appended to every system prompt. */
|
|
296
|
-
export function todoPromptBlock(): string {
|
|
299
|
+
export function todoPromptBlock(mode: OrchestratorMode = "organic"): string {
|
|
300
|
+
// Full delegation mode: a small task still skips the list, but it goes to a writer.
|
|
301
|
+
if (mode === "full-delegation") return TODO_PROMPT_BLOCK.replace(TODO_SMALL_TASK_ORGANIC, TODO_SMALL_TASK_FULL_DELEGATION);
|
|
297
302
|
return TODO_PROMPT_BLOCK;
|
|
298
303
|
}
|
|
299
304
|
|
|
@@ -416,14 +421,16 @@ function sectionTaskRows(task: TodoTask, theme: TodoTheme, width: number): strin
|
|
|
416
421
|
return [...rows, ...wrapTextWithAnsi(task.note, noteWidth).map((line, index) => renderPanelRow(width, `${index === 0 ? theme.fg("dim", "└") : " "} ${theme.fg(NOTE_ROLE, line)}`, "", PANEL_ROW_INDENT + 2))];
|
|
417
422
|
}
|
|
418
423
|
|
|
419
|
-
export function renderTodoSection(state: TodoState, theme: TodoTheme, width: number, options: Pick<TodoRenderOptions, "collapsed" | "staleTurns" | "hovered">): TodoSection {
|
|
424
|
+
export function renderTodoSection(state: TodoState, theme: TodoTheme, width: number, options: Pick<TodoRenderOptions, "collapsed" | "staleTurns" | "hovered" | "collapseKey">): TodoSection {
|
|
420
425
|
if (state.tasks.length === 0) return { header: "", body: [] };
|
|
421
426
|
const { done, total } = todoSummary(state);
|
|
422
427
|
const planned = total - countStatus(state, TODO_STATUS.DROPPED);
|
|
423
428
|
const stale = options.staleTurns >= STALE_AFTER_TURNS;
|
|
429
|
+
// The collapse key rides the header, small and dim, as the only rail key hint.
|
|
430
|
+
const keyHint = options.collapseKey ? `${theme.fg("dim", options.collapseKey)} ` : "";
|
|
424
431
|
const header = renderPanelHeader(theme, width, {
|
|
425
432
|
title: "Todos",
|
|
426
|
-
count: `${stale ? `stale · ${options.staleTurns} turns · ` : ""}${done}/${planned}`,
|
|
433
|
+
count: `${keyHint}${stale ? `stale · ${options.staleTurns} turns · ` : ""}${done}/${planned}`,
|
|
427
434
|
countRole: stale ? "warning" : "muted",
|
|
428
435
|
open: !options.collapsed,
|
|
429
436
|
hovered: options.hovered,
|
package/lib/shell-usage.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
2
2
|
import { parseModelRef } from "./agents-config.ts";
|
|
3
|
+
import { NAN_CHAT_MODEL_IDS } from "./nan-provider.ts";
|
|
3
4
|
import { paintGauge, type GaugePaint } from "./shell-gauge.ts";
|
|
4
5
|
|
|
5
6
|
// Gentle Shell subscription usage: the rate-limit windows each connected
|
|
@@ -132,6 +133,9 @@ const ACTIVE_MARK = "✿";
|
|
|
132
133
|
// and answered nothing. Generic on purpose: it names no endpoint, key, or
|
|
133
134
|
// account detail, exactly like the other notes here.
|
|
134
135
|
export const USAGE_FETCH_FAILED_NOTE = "fetch failed · r to retry";
|
|
136
|
+
// NaN bills from a shared credit pool its API keys cannot read; the quota
|
|
137
|
+
// endpoint only reports legacy per-model token caps, so the panel says so.
|
|
138
|
+
export const NAN_QUOTA_NOTE = "per-model token quota · not your credit balance";
|
|
135
139
|
|
|
136
140
|
export interface ActiveProvider {
|
|
137
141
|
provider: string;
|
|
@@ -388,6 +392,8 @@ export function parseNanQuota(payload: unknown, now: number): ProviderUsage {
|
|
|
388
392
|
if (!entry || typeof entry !== "object") continue;
|
|
389
393
|
const model = entry as RawNanModel;
|
|
390
394
|
if (typeof model.model !== "string" || model.model.length === 0) continue;
|
|
395
|
+
// The payload still lists retired models; only the maintained catalog is shown.
|
|
396
|
+
if (!NAN_CHAT_MODEL_IDS.has(model.model)) continue;
|
|
391
397
|
const allowance = nanEffectiveAllowance(model);
|
|
392
398
|
// A model that reports no allowance is not drift — the dashboard draws
|
|
393
399
|
// nothing for it either, and the live payload carries such entries. A metered
|
|
@@ -484,6 +490,8 @@ export function groupUsageLimits(limits: readonly UsageLimit[]): UsageLimit[] {
|
|
|
484
490
|
// The bar follows the model the session is using: exact allowance, then its
|
|
485
491
|
// family, then the account total, then the first limit (which is what every
|
|
486
492
|
// provider without raw numbers keeps using, and what a missing model keeps).
|
|
493
|
+
// NaN stops after the family: its caps are per-model token quota, and a sum of
|
|
494
|
+
// them would read as an account balance it is not.
|
|
487
495
|
export function selectUsageLimit(usage: ProviderUsage, activeModelId?: string): UsageLimit | undefined {
|
|
488
496
|
if (!activeModelId) return usage.limits[0];
|
|
489
497
|
const exact = usage.limits.find((limit) => limit.name === activeModelId);
|
|
@@ -498,6 +506,7 @@ export function selectUsageLimit(usage: ProviderUsage, activeModelId?: string):
|
|
|
498
506
|
const total = allowanceTotal(`${family}${GROUP_SUFFIX}`, members);
|
|
499
507
|
if (total) return total;
|
|
500
508
|
}
|
|
509
|
+
if (usage.provider === NAN_PROVIDER) return undefined;
|
|
501
510
|
const account = allowanceTotal(`${usage.provider}${GROUP_SUFFIX}`, usage.limits);
|
|
502
511
|
if (account) return account;
|
|
503
512
|
}
|
|
@@ -611,6 +620,7 @@ export function renderUsagePanel(usages: ProviderUsage[], theme: UsageTheme, wid
|
|
|
611
620
|
const tail = reset.length > 0 ? ` ${theme.fg(ROLE.SEPARATOR, "·")} ${theme.fg(ROLE.RESET, reset)}` : "";
|
|
612
621
|
lines.push(` ${theme.fg(ROLE.LABEL, row.name.padEnd(nameWidth))} ${paintMeter(row.window.usedPercent, PANEL_METER_CELLS, theme, paint)} ${theme.fg(ROLE.PERCENT, percent)}${tail}`);
|
|
613
622
|
}
|
|
623
|
+
if (usage.provider === NAN_PROVIDER) lines.push(` ${theme.fg(ROLE.RESET, NAN_QUOTA_NOTE)}`);
|
|
614
624
|
// A failure after a good snapshot never hides either fact: the last good
|
|
615
625
|
// snapshot stays on its rows and the failed refresh says so beside it.
|
|
616
626
|
if (scope?.failed.has(row.provider)) lines.push(` ${theme.fg(ROLE.RESET, USAGE_FETCH_FAILED_NOTE)}`);
|
|
@@ -13,7 +13,7 @@ export const VERIFIER_NAMES = ["gentle-ai-verify"];
|
|
|
13
13
|
// sentence ("Do not write Risk: item 3") do not start one. The capture is the first named item.
|
|
14
14
|
const HIGH_RISK_ITEM_LINE = /(?:^[ \t]*(?:[-*+][ \t]+)?|[.!?][ \t]+)Risk:[ \t]*item[ \t]+([1-6])(?!\d)/m;
|
|
15
15
|
export const VERIFIER_RISK_REJECTION =
|
|
16
|
-
"An independent verifier runs only for a change that declares a named high-risk item (`Risk: item N` from the Task Size list in the task). No supported `Risk: item N` declaration was recognized in the launch `task` or `context`: run its focused test and suite inline yourself now; do not retry the launch, and never add a Risk line or create a feature document only to get a verifier admitted.";
|
|
16
|
+
"An independent verifier runs only for a change that declares a named high-risk item (`Risk: item N` from the Task Size list in the task). A supported `Risk: item N` declaration starts a line (optionally after a list marker like `- `) or a sentence (after `.`, `!` or `?` and a space), for example `Risk: item 2 (authorization tokens)`; a declaration after another separator such as `; ` or `,` is not recognized. No supported `Risk: item N` declaration was recognized in the launch `task` or `context`: run its focused test and suite inline yourself now; do not retry the launch, and never add a Risk line or create a feature document only to get a verifier admitted.";
|
|
17
17
|
|
|
18
18
|
// The first high-risk item a text declares with the admission grammar, or undefined when it declares none.
|
|
19
19
|
export function declaredHighRiskItem(text: string): number | undefined {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CURSOR_MARKER, Editor, visibleWidth } from "@earendil-works/pi-tui";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
|
|
4
|
-
// Private shape audited against @earendil-works/pi-tui 0.99.1, 0.99.2, 1.0.0, 1.1.0, 1.2.0, 1.3.0 and 1.
|
|
4
|
+
// Private shape audited against @earendil-works/pi-tui 0.99.1, 0.99.2, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.5.1 and 1.5.2:
|
|
5
5
|
// editor.js state/pastes/history, sticky cursor reset, layoutText/render geometry,
|
|
6
6
|
// autocomplete cancellation and { state, pastes, pasteCounter } undo restoration;
|
|
7
7
|
// undo-stack.js clone-on-push/pop snapshots. The two 0.99 releases ship identical
|
|
@@ -23,6 +23,13 @@ import { createRequire } from "node:module";
|
|
|
23
23
|
// matches tui.select.pageUp/pageDown in the autocomplete menu, and keys.js adds Kitty
|
|
24
24
|
// F1-F12 functional-key mappings plus the Kitty functional PUA range filter. State,
|
|
25
25
|
// undo, paste, layout and autocomplete contracts remain unchanged.
|
|
26
|
+
// 1.5.1 keeps undo-stack.js, keys.js, editor-component.js and coding-agent's
|
|
27
|
+
// custom-editor.js byte-identical to 1.5.0; editor.js changes one line (a removed
|
|
28
|
+
// paste marker's renumbered neighbors no longer gain an "undefined" suffix when they
|
|
29
|
+
// have no size suffix); tui.js strips every cursor marker from terminal output, not
|
|
30
|
+
// only the first; utils.js stops carrying APC cursor markers into a column slice.
|
|
31
|
+
// 1.5.2 ships the same dist as 1.5.1 (only package.json differs). State, undo,
|
|
32
|
+
// paste registry, layout, render and autocomplete contracts remain unchanged.
|
|
26
33
|
// Never silently adapt another build: undo also owns the paste registry.
|
|
27
34
|
interface Position { line: number; col: number }
|
|
28
35
|
interface State { lines: string[]; cursorLine: number; cursorCol: number }
|
|
@@ -63,7 +70,7 @@ interface PrivateEditor {
|
|
|
63
70
|
|
|
64
71
|
// The single audited-release source for the adapter and Gentle Shell's runtime
|
|
65
72
|
// identity gates. Add a release only after re-auditing the files named above.
|
|
66
|
-
export const AUDITED_PI_EDITOR_VERSIONS = Object.freeze(["0.99.1", "0.99.2", "1.0.0", "1.1.0", "1.2.0", "1.3.0", "1.4.0", "1.5.0"] as const);
|
|
73
|
+
export const AUDITED_PI_EDITOR_VERSIONS = Object.freeze(["0.99.1", "0.99.2", "1.0.0", "1.1.0", "1.2.0", "1.3.0", "1.4.0", "1.5.0", "1.5.1", "1.5.2"] as const);
|
|
67
74
|
export type AuditedPiEditorVersion = (typeof AUDITED_PI_EDITOR_VERSIONS)[number];
|
|
68
75
|
|
|
69
76
|
export function isAuditedPiEditorVersion(version: unknown): version is AuditedPiEditorVersion {
|
|
@@ -5,11 +5,19 @@ import { gentlePiConfigHome } from "./agent-home.ts";
|
|
|
5
5
|
|
|
6
6
|
export const VISUAL_SCHEMA = "gentle-pi.visual-customization/v1";
|
|
7
7
|
export const STATUS_PLACEMENT = { AUTO: "auto", RIGHT: "right", BOTTOM: "bottom", HIDDEN: "hidden" } as const;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Where the header row goes: `top` spans both conversation and rail above them;
|
|
10
|
+
* `below-input` under the editor; `split` the IDE chrome, a full-width title
|
|
11
|
+
* row on top and the per-frame counters in a status bar at the bottom.
|
|
12
|
+
*/
|
|
13
|
+
export const HEADER_PLACEMENT = { TOP: "top", BELOW_INPUT: "below-input", SPLIT: "split" } as const;
|
|
9
14
|
export const DENSITY = { COMFORTABLE: "comfortable", COMPACT: "compact", MINIMAL: "minimal" } as const;
|
|
15
|
+
/** The chrome background: `tinted` paints the rail, title row, status bar and panel sheet; `transparent` lets the terminal show through. */
|
|
16
|
+
export const CHROME_SURFACE = { TINTED: "tinted", TRANSPARENT: "transparent" } as const;
|
|
10
17
|
export type StatusPlacement = (typeof STATUS_PLACEMENT)[keyof typeof STATUS_PLACEMENT];
|
|
11
18
|
export type HeaderPlacement = (typeof HEADER_PLACEMENT)[keyof typeof HEADER_PLACEMENT];
|
|
12
19
|
export type Density = (typeof DENSITY)[keyof typeof DENSITY];
|
|
20
|
+
export type ChromeSurface = (typeof CHROME_SURFACE)[keyof typeof CHROME_SURFACE];
|
|
13
21
|
|
|
14
22
|
export interface VisualVisibility {
|
|
15
23
|
changes: boolean;
|
|
@@ -27,28 +35,32 @@ export interface VisualSettings {
|
|
|
27
35
|
statusPlacement: StatusPlacement;
|
|
28
36
|
headerPlacement: HeaderPlacement;
|
|
29
37
|
density: Density;
|
|
38
|
+
/** Stored only when tinted, so files that keep the transparent default stay readable by older versions. */
|
|
39
|
+
surface: ChromeSurface;
|
|
30
40
|
visibility: VisualVisibility;
|
|
31
41
|
}
|
|
32
42
|
export const DEFAULT_VISUAL_SETTINGS: VisualSettings = {
|
|
33
43
|
statusPlacement: STATUS_PLACEMENT.AUTO,
|
|
34
44
|
headerPlacement: HEADER_PLACEMENT.TOP,
|
|
35
45
|
density: DENSITY.COMFORTABLE,
|
|
46
|
+
surface: CHROME_SURFACE.TRANSPARENT,
|
|
36
47
|
visibility: { changes: true, rdd: true, agents: true, todo: true, usageCost: true, modelDetails: true, contextWarning: true, stats: false },
|
|
37
48
|
};
|
|
38
49
|
/**
|
|
39
|
-
* Presets bundle the
|
|
50
|
+
* Presets bundle the visibility switches (design/shell-rework/inventory.md):
|
|
40
51
|
* Light is the minimal edition: Status at the bottom (no rail) and priority 1
|
|
41
52
|
* only (model, context, agent questions, review); Neutral is the default;
|
|
42
|
-
* Power user adds session Stats
|
|
43
|
-
* placement
|
|
53
|
+
* Power user adds session Stats. Density is its own axis, like the header
|
|
54
|
+
* placement and the surface: a preset neither sets nor compares it. The active
|
|
55
|
+
* preset is whichever bundle the current settings match.
|
|
44
56
|
*/
|
|
45
57
|
export const VISUAL_PRESET = { LIGHT: "light", NEUTRAL: "neutral", POWER_USER: "power-user" } as const;
|
|
46
58
|
export type VisualPreset = (typeof VISUAL_PRESET)[keyof typeof VISUAL_PRESET];
|
|
47
|
-
const PRESET_BUNDLES: Record<VisualPreset, Pick<VisualSettings, "
|
|
48
|
-
[VISUAL_PRESET.LIGHT]: {
|
|
49
|
-
[VISUAL_PRESET.NEUTRAL]: {
|
|
50
|
-
//
|
|
51
|
-
[VISUAL_PRESET.POWER_USER]: {
|
|
59
|
+
const PRESET_BUNDLES: Record<VisualPreset, Pick<VisualSettings, "visibility">> = {
|
|
60
|
+
[VISUAL_PRESET.LIGHT]: { visibility: { changes: false, rdd: true, agents: true, todo: false, usageCost: true, modelDetails: true, contextWarning: true, stats: false } },
|
|
61
|
+
[VISUAL_PRESET.NEUTRAL]: { visibility: { ...DEFAULT_VISUAL_SETTINGS.visibility } },
|
|
62
|
+
// What Power user adds is content (Stats).
|
|
63
|
+
[VISUAL_PRESET.POWER_USER]: { visibility: { changes: true, rdd: true, agents: true, todo: true, usageCost: true, modelDetails: true, contextWarning: true, stats: true } },
|
|
52
64
|
};
|
|
53
65
|
export function applyVisualPreset(settings: VisualSettings, preset: VisualPreset): VisualSettings {
|
|
54
66
|
const bundle = PRESET_BUNDLES[preset];
|
|
@@ -57,14 +69,14 @@ export function applyVisualPreset(settings: VisualSettings, preset: VisualPreset
|
|
|
57
69
|
const leavingLight = visualPresetOf(settings) === VISUAL_PRESET.LIGHT;
|
|
58
70
|
const statusPlacement = preset === VISUAL_PRESET.LIGHT ? STATUS_PLACEMENT.BOTTOM
|
|
59
71
|
: leavingLight ? STATUS_PLACEMENT.AUTO : settings.statusPlacement;
|
|
60
|
-
return { ...settings, statusPlacement,
|
|
72
|
+
return { ...settings, statusPlacement, visibility: { ...bundle.visibility } };
|
|
61
73
|
}
|
|
62
74
|
/** The preset the settings match, or undefined for a hand-tuned mix. */
|
|
63
75
|
export function visualPresetOf(settings: VisualSettings): VisualPreset | undefined {
|
|
64
76
|
return (Object.values(VISUAL_PRESET) as VisualPreset[]).find((preset) => {
|
|
65
77
|
const bundle = PRESET_BUNDLES[preset];
|
|
66
78
|
if ((settings.statusPlacement === STATUS_PLACEMENT.BOTTOM) !== (preset === VISUAL_PRESET.LIGHT)) return false;
|
|
67
|
-
return
|
|
79
|
+
return (Object.keys(bundle.visibility) as (keyof VisualVisibility)[]).every((key) => bundle.visibility[key] === settings.visibility[key]);
|
|
68
80
|
});
|
|
69
81
|
}
|
|
70
82
|
/** Sections row order; `rdd` follows `changes` as the RDD group follows Changes in the Status card. */
|
|
@@ -92,11 +104,12 @@ function member<T extends string>(value: unknown, choices: Record<string, T>): v
|
|
|
92
104
|
return typeof value === "string" && Object.values(choices).includes(value as T);
|
|
93
105
|
}
|
|
94
106
|
export function isVisualSettings(value: unknown): value is VisualSettings {
|
|
95
|
-
if (!record(value) || !keysMatch(value, ["statusPlacement", "headerPlacement", "density", "visibility"])) return false;
|
|
107
|
+
if (!record(value) || !keysMatch(value, ["statusPlacement", "headerPlacement", "density", "surface", "visibility"])) return false;
|
|
96
108
|
const visibility = value.visibility;
|
|
97
109
|
return member(value.statusPlacement, STATUS_PLACEMENT)
|
|
98
110
|
&& member(value.headerPlacement, HEADER_PLACEMENT)
|
|
99
111
|
&& member(value.density, DENSITY)
|
|
112
|
+
&& member(value.surface, CHROME_SURFACE)
|
|
100
113
|
&& record(visibility)
|
|
101
114
|
&& keysMatch(visibility, VISUAL_SECTION_KEYS)
|
|
102
115
|
&& Object.values(visibility).every((item) => typeof item === "boolean");
|
|
@@ -107,9 +120,11 @@ export function isVisualSettings(value: unknown): value is VisualSettings {
|
|
|
107
120
|
* boolean; missing added keys then take their default (`rdd`, `contextWarning` shown, `stats` hidden),
|
|
108
121
|
* while present values (including `rdd: false`) are preserved. Writers stay strict.
|
|
109
122
|
*/
|
|
110
|
-
export function normalizeVisualSettings(
|
|
111
|
-
if (!record(
|
|
112
|
-
|
|
123
|
+
export function normalizeVisualSettings(raw: unknown): VisualSettings | undefined {
|
|
124
|
+
if (!record(raw) || !record(raw.visibility)) return undefined;
|
|
125
|
+
// A file without `surface` (older versions, or the transparent default) reads as the default.
|
|
126
|
+
const value = Object.hasOwn(raw, "surface") ? raw : { ...raw, surface: DEFAULT_VISUAL_SETTINGS.surface };
|
|
127
|
+
const visibility = raw.visibility;
|
|
113
128
|
if (!Object.keys(visibility).every((key) => (VISUAL_SECTION_KEYS as readonly string[]).includes(key))) return undefined;
|
|
114
129
|
if (!BASE_SECTION_KEYS.every((key) => Object.hasOwn(visibility, key))) return undefined;
|
|
115
130
|
// A key that is present is authoritative: only a missing added key may default to shown.
|
|
@@ -137,6 +152,11 @@ export function resolveVisualSettings(options: VisualOptions = {}): VisualResolu
|
|
|
137
152
|
return { settings: structuredClone(DEFAULT_VISUAL_SETTINGS), source: missing ? "default" : "global_file", malformed: false, readError: !missing, globalFile };
|
|
138
153
|
}
|
|
139
154
|
}
|
|
155
|
+
/** The stored shape: the default surface stays out of the file, so older versions keep reading it. */
|
|
156
|
+
export function storedVisualSettings(settings: VisualSettings): Omit<VisualSettings, "surface"> & { surface?: ChromeSurface } {
|
|
157
|
+
const { surface, ...stored } = settings;
|
|
158
|
+
return surface === DEFAULT_VISUAL_SETTINGS.surface ? stored : { ...stored, surface };
|
|
159
|
+
}
|
|
140
160
|
/** Same-directory rename keeps partial JSON invisible to readers. */
|
|
141
161
|
export function writeVisualSettings(settings: VisualSettings, options: VisualOptions = {}): string {
|
|
142
162
|
if (!isVisualSettings(settings)) throw new TypeError("Invalid visual settings");
|
|
@@ -145,7 +165,7 @@ export function writeVisualSettings(settings: VisualSettings, options: VisualOpt
|
|
|
145
165
|
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
146
166
|
mkdirSync(home, { recursive: true });
|
|
147
167
|
try {
|
|
148
|
-
writeFileSync(temporary, `${JSON.stringify({ schema: VISUAL_SCHEMA, ...settings })}\n`, { flag: "wx", mode: 0o600 });
|
|
168
|
+
writeFileSync(temporary, `${JSON.stringify({ schema: VISUAL_SCHEMA, ...storedVisualSettings(settings) })}\n`, { flag: "wx", mode: 0o600 });
|
|
149
169
|
renameSync(temporary, path);
|
|
150
170
|
} finally {
|
|
151
171
|
try { unlinkSync(temporary); } catch { /* Rename consumed the temporary file. */ }
|