gentle-pi 4.6.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -11
- package/assets/agents/gentle-ai-explore.md +1 -0
- package/assets/agents/gentle-ai-verify.md +5 -2
- package/assets/agents/gentle-ai-worker.md +3 -0
- package/assets/agents/jd-fix-agent.md +1 -0
- package/assets/agents/jd-judge-a.md +1 -0
- package/assets/agents/jd-judge-b.md +1 -0
- package/assets/design-canvas/canvas.css +13 -1
- package/assets/design-canvas/canvas.js +11 -2
- package/assets/install-wizard/wizard.js +1 -0
- package/assets/migrations/agent-body-history.json +16 -1
- package/assets/orchestrator-delegation-reference.md +4 -4
- package/assets/orchestrator-delegation.md +1 -1
- package/assets/orchestrator-full-delegation-card.md +65 -0
- package/assets/orchestrator-full-delegation.md +34 -0
- package/assets/orchestrator-memory.md +3 -3
- package/assets/orchestrator-prompts.md +1 -1
- package/assets/orchestrator-skills.md +1 -1
- package/assets/orchestrator-verification.md +7 -5
- package/assets/orchestrator.md +3 -3
- package/bin/gentle-shell.mjs +164 -56
- package/docs/agent-status.md +61 -0
- package/docs/bundled-install.md +7 -5
- package/docs/delegated-verification.md +29 -7
- package/docs/gentle-agents-activity.md +14 -0
- package/docs/gentle-shell.md +54 -16
- package/docs/install-wizard.md +1 -1
- package/docs/permission-modes.md +9 -4
- package/docs/readme-reference.md +75 -30
- package/docs/render-cache-performance.md +11 -1
- package/docs/review-coordinator.md +33 -0
- package/docs/review-request-context.md +19 -0
- package/docs/review-windows-acl.md +18 -0
- package/docs/voice.md +6 -3
- package/docs/yolo-mode.md +5 -5
- package/extensions/ask-user-choice.ts +1 -0
- package/extensions/ask-user-question.ts +1 -0
- package/extensions/child-safety.ts +3 -0
- package/extensions/gentle-agent-status.ts +99 -0
- package/extensions/gentle-agents.ts +326 -34
- package/extensions/gentle-ai.ts +1496 -454
- package/extensions/gentle-shell.ts +293 -63
- package/extensions/gentle-todo.ts +18 -2
- package/extensions/gentle-tps.ts +48 -0
- package/extensions/quiet-tools.ts +38 -8
- package/extensions/skill-registry.ts +175 -18
- package/extensions/startup-banner.ts +30 -3
- package/lib/agent-profile-pin.ts +3 -3
- package/lib/agent-profiles.ts +160 -2
- package/lib/agent-status.ts +105 -0
- package/lib/agents-config.ts +46 -0
- package/lib/agents-history.ts +24 -5
- package/lib/agents-messaging.ts +47 -5
- package/lib/agents-runner.ts +183 -12
- package/lib/auto-permission-runtime.ts +1 -1
- package/lib/bounded-writer-admission.ts +13 -1
- package/lib/card-content-policy.ts +8 -6
- package/lib/command-palette.ts +133 -17
- package/lib/context-backstop.ts +14 -5
- package/lib/destructive-command-guard.ts +48 -4
- package/lib/execution-surface-guard.ts +20 -0
- package/lib/exploration-budget.ts +4 -2
- package/lib/gentle-ai-binary.ts +1 -1
- package/lib/gentle-design.ts +3 -0
- package/lib/gentle-shell-bundled.ts +6 -19
- package/lib/gentle-shell-launcher.ts +43 -8
- package/lib/herdr-activity.ts +14 -2
- package/lib/herdr-busy.ts +45 -0
- package/lib/image-attachments.ts +33 -0
- package/lib/image-disk-cache.ts +137 -0
- package/lib/inprocess-reviewer.ts +270 -140
- package/lib/jobs-view.ts +198 -11
- package/lib/model-routing-authority.ts +22 -4
- package/lib/native-choice-list.ts +20 -2
- package/lib/native-review-cli.ts +96 -19
- 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 +104 -0
- package/lib/review-blocker.ts +92 -0
- package/lib/review-candidate-symlink-scan.ts +136 -0
- package/lib/review-candidate-view-owner.ts +81 -44
- package/lib/review-continuation-registry.ts +99 -0
- package/lib/review-coordinator.ts +163 -0
- package/lib/review-failure-facts.ts +49 -0
- package/lib/review-host-relay.ts +46 -10
- package/lib/review-integration-v2.ts +7 -1
- package/lib/review-relay-phase-timing.ts +45 -0
- package/lib/review-start-context.ts +17 -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-sidebar-layout.ts +112 -40
- package/lib/shell-sidebar.ts +7 -0
- package/lib/shell-todo.ts +10 -3
- package/lib/verifier-admission.ts +1 -1
- 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/yolo-session-policy.ts +40 -15
- package/package.json +2 -1
- package/runtime/gentle-ai-binary.mjs +1 -1
- package/runtime/gentle-shell-bundled.mjs +6 -19
- package/runtime/gentle-shell-launcher.mjs +42 -7
- package/runtime/native-review-cli.mjs +93 -16
- package/runtime/review-integration-v2.mjs +7 -1
- package/scripts/build-full-delegation-card.mjs +175 -0
- package/scripts/bundled-install.mjs +38 -8
- package/scripts/download-progress.mjs +68 -0
- package/scripts/gentle-ai-installer.mjs +41 -18
- package/scripts/gentle-ai-proxy.mjs +294 -0
- package/scripts/install-gentle-ai.mjs +14 -1
- package/scripts/installer-preflight.mjs +5 -5
- package/scripts/installer-runner.mjs +27 -12
- package/scripts/installer-server.mjs +8 -7
- 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/verify-package-files.mjs +12 -2
- package/scripts/voice-worker.cjs +32 -6
- package/skills/design/SKILL.md +11 -8
- package/skills/gentle-ai/SKILL.md +2 -2
- package/skills/gentle-ui-design/SKILL.md +46 -0
- package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
- package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
- package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
- package/skills/gentle-ui-design/references/task-and-content.md +60 -0
- package/skills/skill-registry/SKILL.md +4 -2
- package/skills/work-unit-commits/SKILL.md +6 -7
- package/tests/agent-home.test.ts +28 -9
- package/tests/agent-profiles-workflow.test.ts +163 -0
- package/tests/agent-risk-escalation.test.ts +1 -1
- package/tests/agent-status.test.ts +143 -0
- package/tests/agents-config.test.ts +96 -0
- package/tests/agents-history.test.ts +31 -0
- package/tests/agents-jobs-frames.test.ts +93 -0
- package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
- package/tests/agents-runner-drain.test.ts +193 -0
- package/tests/agents-runner.test.ts +178 -2
- package/tests/append-system-prompt-route.test.ts +4 -1
- package/tests/ask-user-choice.test.ts +4 -3
- package/tests/ask-user-question.test.ts +97 -0
- package/tests/auto-permission-runtime.test.ts +1 -1
- package/tests/autonomous-guard.test.ts +346 -10
- package/tests/bounded-stop-contract.test.ts +43 -3
- package/tests/bridge-cost.test.ts +19 -4
- package/tests/bundled-install.test.ts +30 -5
- package/tests/card-content-policy.test.ts +3 -3
- package/tests/chained-pr-skill.test.ts +8 -6
- package/tests/child-safety.test.ts +11 -0
- package/tests/codegraph-tools.test.ts +11 -5
- package/tests/command-palette.test.ts +284 -1
- package/tests/delegate-for-reason-contract.test.ts +3 -3
- package/tests/design-canvas-assets.test.ts +185 -2
- package/tests/destructive-command-guard.test.ts +52 -0
- package/tests/download-progress.test.ts +71 -0
- package/tests/execution-surface-guard.test.ts +55 -0
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +9 -5
- package/tests/fixtures/proxy-tls/proxy.crt +19 -0
- package/tests/fixtures/proxy-tls/proxy.key +28 -0
- package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
- package/tests/fixtures/session-profile-v1/replay.ts +53 -6
- package/tests/full-delegation-closure.test.ts +131 -0
- package/tests/full-delegation-notices.test.ts +76 -0
- package/tests/generic-agent-tools.test.ts +3 -3
- package/tests/gentle-agent-status.test.ts +74 -0
- package/tests/gentle-agents-child-jobs.test.ts +237 -0
- package/tests/gentle-agents.test.ts +1070 -12
- package/tests/gentle-ai-binary.test.ts +3 -1
- package/tests/gentle-ai-elapsed-store.test.ts +19 -0
- package/tests/gentle-ai-exploration-budget.test.ts +18 -2
- package/tests/gentle-ai-installer.test.ts +134 -51
- package/tests/gentle-ai-proxy.test.ts +434 -0
- package/tests/gentle-ai.test.ts +113 -38
- package/tests/gentle-design.test.ts +21 -0
- 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 +207 -31
- package/tests/gentle-shell-launcher.test.ts +77 -10
- package/tests/gentle-shell.test.ts +899 -59
- package/tests/gentle-todo.test.ts +19 -2
- 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/image-disk-cache.test.ts +163 -0
- package/tests/independent-recovery-delivery.test.ts +83 -0
- package/tests/inprocess-reviewer.test.ts +176 -4
- package/tests/installer-posix-bootstrap.test.ts +1 -1
- package/tests/installer-preflight.test.ts +5 -4
- package/tests/installer-runner.test.ts +79 -44
- package/tests/installer-server.test.ts +14 -11
- package/tests/jobs-view.test.ts +260 -6
- package/tests/modal-mouse-boundaries.test.ts +136 -0
- package/tests/model-routing-authority.test.ts +178 -2
- package/tests/native-choice-list.test.ts +77 -2
- package/tests/native-review-capability-contract.test.ts +7 -1
- package/tests/native-review-cli.test.ts +269 -1
- package/tests/no-self-pause-contract.test.ts +4 -1
- package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
- package/tests/orchestrator-budget.test.ts +7 -2
- package/tests/orchestrator-delegation-mode.test.ts +153 -0
- package/tests/orchestrator-mode-policy.test.ts +175 -0
- package/tests/orchestrator-prompt-budget.test.ts +3 -1
- package/tests/orchestrator-rdd-ownership.test.ts +2 -2
- package/tests/package-manifest.test.ts +11 -9
- package/tests/permission-allowlist.test.ts +202 -0
- package/tests/pi-update-launcher.test.ts +8 -0
- package/tests/pnpm-workspace-config.test.ts +58 -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/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 +16 -11
- package/tests/rdd-customize.test.ts +287 -0
- package/tests/rdd-mode-cache.test.ts +450 -0
- package/tests/rdd-mode-control.test.ts +407 -0
- package/tests/rdd-mode-scope-regression.test.ts +137 -0
- package/tests/rdd-off-independent-regression.test.ts +69 -0
- package/tests/rdd-status-line.test.ts +18 -0
- package/tests/render-cache-performance.test.ts +171 -2
- package/tests/reply-language-anchor.test.ts +173 -0
- package/tests/review-agent-end-preflight.test.ts +1 -1
- package/tests/review-blocker.test.ts +193 -0
- package/tests/review-candidate-owner-retry.test.ts +1 -1
- package/tests/review-candidate-symlink-scan.test.ts +157 -0
- package/tests/review-candidate-view.test.ts +1 -1
- package/tests/review-candidate-windows-boundary.test.ts +131 -0
- package/tests/review-candidate-windows-probe.test.ts +63 -0
- package/tests/review-committed-restart-ack.test.ts +129 -0
- package/tests/review-continuation-registry.test.ts +76 -0
- package/tests/review-controller-native-routing.test.ts +261 -5
- package/tests/review-controller-workspace-root.test.ts +230 -3
- package/tests/review-controller.test.ts +96 -11
- package/tests/review-coordinator-runtime.test.ts +117 -0
- package/tests/review-coordinator.test.ts +195 -0
- package/tests/review-failure-facts.test.ts +87 -0
- package/tests/review-host-relay-routing.test.ts +258 -4
- package/tests/review-host-relay.test.ts +39 -0
- package/tests/review-integration-v2.test.ts +46 -3
- package/tests/review-json-arguments.test.ts +65 -10
- package/tests/review-last-event-closure.test.ts +68 -0
- package/tests/review-loadout-rdd-off-sdk.test.ts +65 -31
- package/tests/review-owner-identity.test.ts +60 -24
- package/tests/review-relay-phase-timing.test.ts +128 -0
- package/tests/review-relay-transport-agent.test.ts +12 -2
- package/tests/review-reviewer-evidence.test.ts +183 -0
- package/tests/review-risk-assessment.test.ts +74 -3
- package/tests/review-session-standing-permission-controller.test.ts +21 -1
- package/tests/review-start-context.test.ts +19 -0
- package/tests/review-tool-prose-budget.test.ts +121 -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-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-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/skill-registry.test.ts +838 -5
- package/tests/startup-banner.test.ts +152 -1
- package/tests/startup-home-repo.test.ts +2 -0
- package/tests/support/review-coordinator-runtime.ts +69 -0
- package/tests/task-size-routing-contract.test.ts +5 -3
- package/tests/verifier-admission.test.ts +49 -0
- package/tests/verify-first-launch-contract.test.ts +78 -3
- 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 +28 -0
- package/tests/writer-feature-document-admission.test.ts +92 -0
- package/tests/yolo-customize.test.ts +27 -4
- package/tests/yolo-mode.test.ts +23 -18
- package/tests/yolo-session-policy.test.ts +270 -1
|
@@ -4,7 +4,8 @@ import { CURSOR_MARKER, Container, ScrollView, VStack, visibleWidth, type Compon
|
|
|
4
4
|
import { getScrollViewsAt, renderLayoutFrame, type LayoutBox } from "@earendil-works/pi-tui/dist/layout.js";
|
|
5
5
|
import { installSidebar, invalidateSidebar, narrowStatusOwner } from "../lib/shell-sidebar-layout.ts";
|
|
6
6
|
import { setSidebarHover, sidebarHeader, sidebarPart, sidebarState, sidebarStatusBar } from "../lib/shell-sidebar.ts";
|
|
7
|
-
import { renderShellSidebarBar } from "../lib/shell-bar.ts";
|
|
7
|
+
import { renderShellSidebarBar, renderShellStatusBar } from "../lib/shell-bar.ts";
|
|
8
|
+
import { chromeSurface, setChromeSurface } from "../lib/shell-panel.ts";
|
|
8
9
|
import { renderTodoCard, type TodoState } from "../lib/shell-todo.ts";
|
|
9
10
|
import { CARD_STYLE, cardStyle, setCardStyle } from "../lib/shell-card.ts";
|
|
10
11
|
|
|
@@ -304,14 +305,14 @@ test("hidden status reclaims the reserved footer row in narrow and wide fullscre
|
|
|
304
305
|
|
|
305
306
|
test("below-input header removes only the rail's top row", (t) => {
|
|
306
307
|
const f = fixture();
|
|
307
|
-
let header: "
|
|
308
|
+
let header: "split" | "below-input" = "split";
|
|
308
309
|
sidebarHeader(f.tui, { render: () => ["header"], invalidate() {} });
|
|
309
310
|
t.after(installSidebar(f.tui, theme, () => "auto", () => header));
|
|
310
311
|
assert.equal(f.root[NODE]().type, "vstack");
|
|
311
312
|
header = "below-input";
|
|
312
313
|
assert.equal(f.root[NODE]().type, "hstack");
|
|
313
314
|
assert.deepEqual(f.bottom.render(80), []);
|
|
314
|
-
header = "
|
|
315
|
+
header = "split";
|
|
315
316
|
assert.equal(f.root[NODE]().type, "vstack");
|
|
316
317
|
});
|
|
317
318
|
|
|
@@ -826,7 +827,7 @@ test("fullscreen native transcript renders once without changing bytes, geometry
|
|
|
826
827
|
test("native fullscreen header survives narrow and bottom transitions without replacing transcript scroll", (t) => {
|
|
827
828
|
const f = nativeSidebarFixture();
|
|
828
829
|
let placement: "right" | "bottom" | "hidden" = "right";
|
|
829
|
-
let headerPlacement: "
|
|
830
|
+
let headerPlacement: "split" | "below-input" = "split";
|
|
830
831
|
// Reinstall with live preferences so the transition uses the same native root.
|
|
831
832
|
f.dispose();
|
|
832
833
|
sidebarHeader(f.host as unknown as TUI, { render: (width: number) => [`HEADER ${width}`], invalidate() {} });
|
|
@@ -837,7 +838,7 @@ test("native fullscreen header survives narrow and bottom transitions without re
|
|
|
837
838
|
const { frame, transcriptRenders } = f.frame(width);
|
|
838
839
|
assert.equal(transcriptRenders, 1, "native transcript paints only once");
|
|
839
840
|
assert.equal(frame.primaryScrollView, f.primary);
|
|
840
|
-
assert.match(frame.lines[0] ?? "", new RegExp(`HEADER ${
|
|
841
|
+
assert.match(frame.lines[0] ?? "", new RegExp(`HEADER ${width}`));
|
|
841
842
|
assert.ok(frame.lines.some((line) => line.includes("Editor")), "native editor survives");
|
|
842
843
|
assert.equal(frame.root.children.some((box) => box.component instanceof ScrollView && box.component !== f.primary), false, "no extra root scroll view");
|
|
843
844
|
}
|
|
@@ -1008,29 +1009,23 @@ test("an active header wraps the hstack in a vstack and removes the banner from
|
|
|
1008
1009
|
{ basis: 0, grow: 1, shrink: 1, minSize: 1 },
|
|
1009
1010
|
]);
|
|
1010
1011
|
const header = node.entries[0].component as { render(width: number): string[] };
|
|
1011
|
-
|
|
1012
|
-
// the scrollbar column); the header stops there too so its right group
|
|
1013
|
-
// lines up with the card border instead of touching the edge.
|
|
1014
|
-
assert.deepEqual(header.render(0), ["HEADER 138"], "the header renders at the terminal width minus the rail's right inset, not the rail width");
|
|
1012
|
+
assert.deepEqual(header.render(0), ["HEADER 140"], "the header renders at the full terminal width, not the rail width");
|
|
1015
1013
|
|
|
1016
1014
|
const hstack = hstackOf(f);
|
|
1017
1015
|
assert.equal(hstack.type, "hstack");
|
|
1018
1016
|
const scroll = railWithHeader(f);
|
|
1019
1017
|
const rail = scroll.render(50);
|
|
1020
1018
|
assert.doesNotMatch(rail.join("\n"), /✿ Gentle Shell ✿/, "the header carries the brand now, not the banner");
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
// not sit flush against the header.
|
|
1024
|
-
assert.equal(rail[0]?.trim(), "", "the rail opens with a blank row under the header");
|
|
1025
|
-
assert.notEqual(rail[1]?.trim(), "", "the first card starts on the second row");
|
|
1019
|
+
assert.equal(rail[0]?.trim(), "", "the rail starts with a spacer below the full-width title");
|
|
1020
|
+
assert.match(rail[1]!, /Status/, "the first section follows the spacer");
|
|
1026
1021
|
});
|
|
1027
1022
|
|
|
1028
|
-
test("
|
|
1023
|
+
test("upper headers add one rail-local inset without moving the conversation or losing hits", (t) => {
|
|
1029
1024
|
const found = cardStyle();
|
|
1030
1025
|
t.after(() => setCardStyle(found));
|
|
1031
1026
|
setCardStyle(CARD_STYLE.FLOAT);
|
|
1032
1027
|
const painted = { ...theme, bg: (_color: string, text: string) => `\x1b[48;5;22m${text}\x1b[49m` };
|
|
1033
|
-
for (const placement of ["top", "below-input"] as const) {
|
|
1028
|
+
for (const placement of ["top", "split", "below-input"] as const) {
|
|
1034
1029
|
const f = fixture();
|
|
1035
1030
|
const received: TuiMouseEvent[] = [];
|
|
1036
1031
|
const status = renderShellSidebarBar({
|
|
@@ -1049,11 +1044,11 @@ test("the top header has a rail-local inset without moving the conversation or l
|
|
|
1049
1044
|
f.root[NODE] = () => ({ type: "vstack", entries: [{ component: transcript }] });
|
|
1050
1045
|
t.after(installSidebar(f.tui, painted, () => "auto", () => placement));
|
|
1051
1046
|
const frame = renderLayoutFrame(f.root, 140, 8, () => {});
|
|
1052
|
-
const bodyY = placement === "
|
|
1047
|
+
const bodyY = placement === "below-input" ? 0 : 2;
|
|
1053
1048
|
assert.match(frame.lines[bodyY], /CONVERSATION/);
|
|
1054
|
-
const inset = placement === "
|
|
1049
|
+
const inset = placement === "below-input" ? 0 : 1;
|
|
1055
1050
|
assert.doesNotMatch(frame.lines.slice(0, bodyY).join("\n"), /\x1b\[48;5;22m/);
|
|
1056
|
-
assert.match(frame.lines[bodyY], /\x1b\[48;5;22m/, "the panel surface reaches the header
|
|
1051
|
+
assert.match(frame.lines[bodyY], /\x1b\[48;5;22m/, "the panel surface reaches the header");
|
|
1057
1052
|
assert.match(frame.lines[bodyY + inset], /\x1b\[48;5;22m/);
|
|
1058
1053
|
for (const line of frame.lines.slice(bodyY)) assert.equal(visibleWidth(line), 140);
|
|
1059
1054
|
const scroll = railWithHeader(f);
|
|
@@ -1086,10 +1081,10 @@ test("float rail alignment preserves fallback banners and neon bytes across live
|
|
|
1086
1081
|
sidebarPart(f.tui, "todo", { render: () => ["TODO"], invalidate() {} });
|
|
1087
1082
|
t.after(installSidebar(f.tui, theme));
|
|
1088
1083
|
const baseline = railWithHeader(f).render(50);
|
|
1089
|
-
if (header) assert.deepEqual(baseline, ["", " TODO ", "", " Status "]);
|
|
1084
|
+
if (header) assert.deepEqual(baseline, [" ".repeat(50), " TODO ", "", " Status "], "the rail keeps its own spacer under the split title");
|
|
1090
1085
|
else assert.match(baseline.join("\n"), /✿ Gentle Shell ✿/);
|
|
1091
1086
|
setCardStyle(CARD_STYLE.FLOAT);
|
|
1092
|
-
assert.deepEqual(railWithHeader(f).render(50), baseline, "the active
|
|
1087
|
+
assert.deepEqual(railWithHeader(f).render(50), baseline, "the active split header keeps the same rail in both styles");
|
|
1093
1088
|
setCardStyle(CARD_STYLE.NEON);
|
|
1094
1089
|
assert.deepEqual(railWithHeader(f).render(50), baseline, "neon is byte-identical after switching back");
|
|
1095
1090
|
}
|
|
@@ -1106,7 +1101,7 @@ test("the header leaf carries the rule row: a two-line header renders both lines
|
|
|
1106
1101
|
const node = f.root[NODE]() as unknown as { type: string; entries: { component: Component }[] };
|
|
1107
1102
|
assert.equal(node.type, "vstack", "a two-line header still wraps the hstack in a vstack");
|
|
1108
1103
|
const header = node.entries[0]!.component as { render(width: number): string[] };
|
|
1109
|
-
assert.deepEqual(header.render(0), ["HEADER
|
|
1104
|
+
assert.deepEqual(header.render(0), ["HEADER 140", "RULE 140"], "both the status line and the rule row reach the layout, rendered at the terminal width minus the rail's right inset");
|
|
1110
1105
|
});
|
|
1111
1106
|
|
|
1112
1107
|
test("below the sidebar breakpoint a rule-like header paints above native layout without a rail", (t) => {
|
|
@@ -1259,7 +1254,7 @@ test("a status bar part paints one full-width row below the transcript and the r
|
|
|
1259
1254
|
assert.match(frame.lines.at(-1)!, /^STATUS BAR/, "the status bar is the last row, under the rail too");
|
|
1260
1255
|
assert.match(frame.lines[1]!, /CONVERSATION/, "the transcript starts immediately below the title");
|
|
1261
1256
|
assert.ok(frame.lines.slice(1, -1).some((line) => /Status/.test(line)), "the rail sits above the status bar");
|
|
1262
|
-
assert.equal(widthSeen, 160
|
|
1257
|
+
assert.equal(widthSeen, 160, "rendered at the full width, so the bar reaches the window edge");
|
|
1263
1258
|
});
|
|
1264
1259
|
|
|
1265
1260
|
test("below the rail breakpoint the status bar row stays only while its part paints one (mobile)", (t) => {
|
|
@@ -1290,3 +1285,279 @@ test("the rail panel surface reaches the bottom of the viewport, not just the la
|
|
|
1290
1285
|
rail(f).scrollBy(5);
|
|
1291
1286
|
assert.equal(rail(f).scrollTop, 0, "the fill adds no scroll range");
|
|
1292
1287
|
});
|
|
1288
|
+
|
|
1289
|
+
test("a top header spans both columns above the rail while the editor and its clicks stay in place", (t) => {
|
|
1290
|
+
for (const density of ["comfortable", "compact", "minimal"] as const) {
|
|
1291
|
+
const f = fixture("fullscreen", 160);
|
|
1292
|
+
const received: TuiMouseEvent[] = [];
|
|
1293
|
+
sidebarHeader(f.tui, {
|
|
1294
|
+
render: (width: number) => [`HEADER ${width}`],
|
|
1295
|
+
invalidate() {},
|
|
1296
|
+
handleMouse(event) { received.push(event); return { handled: true }; },
|
|
1297
|
+
});
|
|
1298
|
+
const transcript = { render: () => ["CONVERSATION".padEnd(107, "x")], invalidate() {} };
|
|
1299
|
+
const dock = { render: () => ["EDITOR".padEnd(110, "e")], invalidate() {} };
|
|
1300
|
+
f.root[NODE] = () => ({ type: "vstack", gap: 0, entries: [{ component: transcript, basis: 0, grow: 1, shrink: 1, minSize: 1 }, { component: dock, basis: "auto", grow: 0, shrink: 1, minSize: 1 }] });
|
|
1301
|
+
t.after(installSidebar(f.tui, theme, () => "auto", () => "top", () => density));
|
|
1302
|
+
const node = f.root[NODE]() as unknown as { type: string; entries: { component: Component }[] };
|
|
1303
|
+
assert.equal(node.type, "vstack", `${density}: the full-width header is above the hstack`);
|
|
1304
|
+
const lines = renderLayoutFrame(f.root, 160, 6, () => {}).lines.map((line) => line.replace(/\x1b\[[0-9;]*m|\x1b\]8;;\x07/g, ""));
|
|
1305
|
+
assert.match(lines[5]!, /^EDITORe{101}/, `${density}: the editor stays in the conversation column`);
|
|
1306
|
+
assert.equal(lines[5]!.slice(107, 110), " ", `${density}: the editor keeps the 3-column gap from the rail`);
|
|
1307
|
+
assert.match(lines[0]!, /^HEADER 160(?: |$)/, `${density}: the header spans both columns`);
|
|
1308
|
+
assert.doesNotMatch(lines[0]!, /Status/, `${density}: the rail starts below the header`);
|
|
1309
|
+
assert.equal(lines[1]!.slice(107, 110), " ", `${density}: the conversation keeps its 3-column gap from the rail`);
|
|
1310
|
+
assert.match(lines[1]!, /^CONVERSATION/, `${density}: the conversation follows the header`);
|
|
1311
|
+
assert.match(lines[2]!, /Status/, `${density}: one blank rail row precedes the first section`);
|
|
1312
|
+
const click: TuiMouseEvent = { type: "click", button: "left", x: 3, y: 0, screenX: 3, screenY: 0, width: 160, height: 1, shift: false, alt: false, ctrl: false };
|
|
1313
|
+
node.entries[0]!.component.handleMouse?.(click);
|
|
1314
|
+
assert.equal(received.at(-1)?.x, 3, `${density}: the header leaf still routes its clicks`);
|
|
1315
|
+
assert.deepEqual(railWithHeader(f).render(50), [" ".repeat(50), " Status "], `${density}: the rail has exactly one leading spacer`);
|
|
1316
|
+
assert.equal(sidebarState(f.tui).active, true);
|
|
1317
|
+
}
|
|
1318
|
+
});
|
|
1319
|
+
|
|
1320
|
+
test("every upper-header placement leaves one surface-aware rail spacer in every density and card style", (t) => {
|
|
1321
|
+
const [oldStyle, oldSurface] = [cardStyle(), chromeSurface()];
|
|
1322
|
+
t.after(() => { setCardStyle(oldStyle); setChromeSurface(oldSurface); });
|
|
1323
|
+
const painted = { ...theme, bg: (_color: string, text: string) => `\x1b[48;5;22m${text}\x1b[49m` };
|
|
1324
|
+
for (const placement of ["top", "split"] as const) for (const density of ["comfortable", "compact", "minimal"] as const) {
|
|
1325
|
+
for (const style of [CARD_STYLE.NEON, CARD_STYLE.FLOAT]) for (const surface of ["tinted", "transparent"] as const) {
|
|
1326
|
+
setCardStyle(style);
|
|
1327
|
+
setChromeSurface(surface);
|
|
1328
|
+
const label = `${placement}/${density}/${style}/${surface}`;
|
|
1329
|
+
const f = fixture("fullscreen", 160);
|
|
1330
|
+
let clicks = 0;
|
|
1331
|
+
sidebarPart(f.tui, "footer", {
|
|
1332
|
+
surface: "panel", render: () => ["Status"], invalidate() {},
|
|
1333
|
+
handleMouse(event) { assert.equal(event.y, 0); clicks++; return { handled: true }; },
|
|
1334
|
+
});
|
|
1335
|
+
sidebarHeader(f.tui, { render: (width) => ["PAD", `HEADER ${width}`, `RULE ${width}`, "PAD"], invalidate() {} });
|
|
1336
|
+
f.root[NODE] = () => ({ type: "vstack", entries: [{ component: { render: () => ["CONVERSATION"], invalidate() {} } }] });
|
|
1337
|
+
t.after(installSidebar(f.tui, painted, () => "auto", () => placement, () => density));
|
|
1338
|
+
const frame = renderLayoutFrame(f.root, 160, 12, () => {});
|
|
1339
|
+
assert.match(frame.lines[1]!, /HEADER 160/, label);
|
|
1340
|
+
assert.match(frame.lines[2]!, /RULE 160/, label);
|
|
1341
|
+
assert.doesNotMatch(frame.lines.slice(0, 4).join("\n"), /Status|\x1b\[48;5;22m/, `${label}: the rail starts after the entire header`);
|
|
1342
|
+
assert.match(frame.lines[4]!, /CONVERSATION/, label);
|
|
1343
|
+
const scroll = railWithHeader(f);
|
|
1344
|
+
const rows = scroll.render(50);
|
|
1345
|
+
assert.equal(rows[0]!.replace(/\x1b\[[0-9;]*m/g, "").trim(), "", `${label}: one leading spacer`);
|
|
1346
|
+
if (surface === "tinted") assert.match(rows[0]!, /\x1b\[48;5;22m/, `${label}: the spacer carries the panel`);
|
|
1347
|
+
else assert.doesNotMatch(rows[0]!, /\x1b\[48;5;/, `${label}: the spacer is unpainted`);
|
|
1348
|
+
const statusRow = rows.findIndex((row) => row.includes("Status"));
|
|
1349
|
+
assert.equal(statusRow, surface === "transparent" && style === CARD_STYLE.FLOAT ? 2 : 1, `${label}: only the float card's own padding follows the spacer`);
|
|
1350
|
+
const click = (y: number): TuiMouseEvent => ({ type: "click", button: "left", x: 2, y, screenX: 112, screenY: 4 + y, width: 50, height: 8, shift: false, alt: false, ctrl: false });
|
|
1351
|
+
assert.equal(scroll.handleMouse(click(0)), undefined, `${label}: the spacer has no hit target`);
|
|
1352
|
+
assert.equal(scroll.handleMouse(click(statusRow))?.handled, true, `${label}: the section title remains clickable`);
|
|
1353
|
+
assert.equal(clicks, 1, label);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
});
|
|
1357
|
+
|
|
1358
|
+
test("a split header keeps the full-width title row above the rail", (t) => {
|
|
1359
|
+
const f = fixture("fullscreen", 160);
|
|
1360
|
+
sidebarHeader(f.tui, { render: (width: number) => [`HEADER ${width}`], invalidate() {} });
|
|
1361
|
+
t.after(installSidebar(f.tui, theme, () => "auto", () => "split"));
|
|
1362
|
+
const node = f.root[NODE]() as unknown as { type: string; entries: { component: Component }[] };
|
|
1363
|
+
assert.equal(node.type, "vstack");
|
|
1364
|
+
assert.deepEqual(node.entries[0]!.component.render(160), ["HEADER 160"], "the title bar reaches the window edge");
|
|
1365
|
+
});
|
|
1366
|
+
|
|
1367
|
+
test("a top header falls back to the full width when the rail is not shown", (t) => {
|
|
1368
|
+
const f = fixture("fullscreen", 180);
|
|
1369
|
+
sidebarHeader(f.tui, { render: (width: number) => [`HEADER ${width}`], invalidate() {} });
|
|
1370
|
+
t.after(installSidebar(f.tui, theme, () => "bottom", () => "top"));
|
|
1371
|
+
const node = f.root[NODE]() as unknown as { type: string; entries: { component: Component }[] };
|
|
1372
|
+
assert.equal(node.type, "vstack");
|
|
1373
|
+
assert.deepEqual(node.entries[0]!.component.render(180), ["HEADER 180"]);
|
|
1374
|
+
});
|
|
1375
|
+
|
|
1376
|
+
test("a transparent chrome drops the rail, title row and status bar backgrounds and keeps the density's spacing", (t) => {
|
|
1377
|
+
const previousStyle = cardStyle();
|
|
1378
|
+
t.after(() => setCardStyle(previousStyle));
|
|
1379
|
+
setCardStyle(CARD_STYLE.NEON);
|
|
1380
|
+
const previous = chromeSurface();
|
|
1381
|
+
t.after(() => setChromeSurface(previous));
|
|
1382
|
+
const painted = { ...theme, bg: (_color: string, text: string) => `\x1b[48;5;22m${text}\x1b[49m` };
|
|
1383
|
+
const tinted = /\x1b\[48;5;22m/;
|
|
1384
|
+
for (const density of ["compact", "minimal"] as const) {
|
|
1385
|
+
setChromeSurface("transparent");
|
|
1386
|
+
const f = fixture("fullscreen", 160);
|
|
1387
|
+
sidebarPart(f.tui, "todo", { render: () => ["TODO"], invalidate() {} });
|
|
1388
|
+
sidebarPart(f.tui, "footer", { surface: "panel", render: () => ["Status"], invalidate() {} });
|
|
1389
|
+
sidebarHeader(f.tui, { render: () => ["HEADER"], invalidate() {} });
|
|
1390
|
+
t.after(installSidebar(f.tui, painted, () => "auto", () => "split", () => density));
|
|
1391
|
+
const rows = railWithHeader(f).render(50);
|
|
1392
|
+
assert.doesNotMatch(rows.join("\n"), tinted, `${density}: no panel background`);
|
|
1393
|
+
// A transparent rail draws each section as a card (neon here): a one-row
|
|
1394
|
+
// section is its title in the top rule, then the bottom edge.
|
|
1395
|
+
const text = rows.map((row) => row.replace(/\x1b\[[0-9;]*m/g, ""));
|
|
1396
|
+
const between = text.findIndex((row) => row.includes("Status")) - text.findIndex((row) => row.includes("TODO"));
|
|
1397
|
+
assert.equal(between, 2, `${density}: TODO's card closes and Status's card opens with no gap row: the surface never changes the density`);
|
|
1398
|
+
setChromeSurface("tinted");
|
|
1399
|
+
assert.match(railWithHeader(f).render(50).join("\n"), tinted, "switching back repaints the panel");
|
|
1400
|
+
}
|
|
1401
|
+
setChromeSurface("transparent");
|
|
1402
|
+
const model = { cwd: "/project", branch: "main", dirty: 0, sessionName: undefined, modelId: "model", effort: "high", contextPercent: 45, contextWindow: 1000, costTotal: 1, subscription: false, usage: undefined, statuses: [] };
|
|
1403
|
+
assert.doesNotMatch(renderShellStatusBar(model, painted, 120).rows.join("\n"), tinted, "the status bar floats");
|
|
1404
|
+
setChromeSurface("tinted");
|
|
1405
|
+
assert.match(renderShellStatusBar(model, painted, 120).rows.join("\n"), tinted);
|
|
1406
|
+
});
|
|
1407
|
+
|
|
1408
|
+
test("below a centered comfortable top bar the rail spacer follows the chosen surface", (t) => {
|
|
1409
|
+
const previousStyle = cardStyle();
|
|
1410
|
+
t.after(() => setCardStyle(previousStyle));
|
|
1411
|
+
setCardStyle(CARD_STYLE.NEON);
|
|
1412
|
+
const previous = chromeSurface();
|
|
1413
|
+
t.after(() => setChromeSurface(previous));
|
|
1414
|
+
const painted = { ...theme, bg: (_color: string, text: string) => `\x1b[48;5;22m${text}\x1b[49m` };
|
|
1415
|
+
for (const surface of ["tinted", "transparent"] as const) {
|
|
1416
|
+
setChromeSurface(surface);
|
|
1417
|
+
const f = fixture("fullscreen", 160);
|
|
1418
|
+
sidebarPart(f.tui, "footer", { surface: "panel", render: () => ["Status"], invalidate() {} });
|
|
1419
|
+
sidebarHeader(f.tui, { render: () => ["PAD", "HEADER", "PAD"], invalidate() {} });
|
|
1420
|
+
t.after(installSidebar(f.tui, painted, () => "auto", () => "top"));
|
|
1421
|
+
const rows = railWithHeader(f).render(50);
|
|
1422
|
+
const top = rows[0]!.replace(/\x1b\[[0-9;]*m/g, "").trim();
|
|
1423
|
+
assert.equal(top, "", `${surface}: the spacer is below all header rows`);
|
|
1424
|
+
assert.match(rows[1]!, /Status/, `${surface}: the first section follows the spacer`);
|
|
1425
|
+
if (surface === "tinted") assert.match(rows[0]!, /\x1b\[48;5;22m/, "the spacer continues the rail surface");
|
|
1426
|
+
else assert.doesNotMatch(rows.join("\n"), /\x1b\[48;5;22m/);
|
|
1427
|
+
}
|
|
1428
|
+
});
|
|
1429
|
+
|
|
1430
|
+
test("a split title row is followed by one rail spacer", (t) => {
|
|
1431
|
+
const painted = { ...theme, bg: (_color: string, text: string) => `\x1b[48;5;22m${text}\x1b[49m` };
|
|
1432
|
+
const f = fixture("fullscreen", 160);
|
|
1433
|
+
sidebarPart(f.tui, "footer", { surface: "panel", render: () => ["Status"], invalidate() {} });
|
|
1434
|
+
sidebarHeader(f.tui, { render: (width: number) => [`TITLE ${width}`, "PAD"], invalidate() {} });
|
|
1435
|
+
t.after(installSidebar(f.tui, painted, () => "auto", () => "split"));
|
|
1436
|
+
const rows = railWithHeader(f).render(50);
|
|
1437
|
+
assert.equal(rows[0]!.replace(/\x1b\[[0-9;]*m/g, "").trim(), "");
|
|
1438
|
+
assert.match(rows[0]!, /\x1b\[48;5;22m/, "the spacer is painted");
|
|
1439
|
+
assert.match(rows[1]!, /Status/, "the first section follows it");
|
|
1440
|
+
});
|
|
1441
|
+
|
|
1442
|
+
test("beside the rail a below-input layout keeps the transcript and the dock in the gapped column", (t) => {
|
|
1443
|
+
const f = fixture("fullscreen", 160);
|
|
1444
|
+
sidebarHeader(f.tui, { render: () => ["HEADER"], invalidate() {} });
|
|
1445
|
+
const transcript = { render: () => ["T".repeat(120)], invalidate() {} };
|
|
1446
|
+
const dock = { render: () => ["D".repeat(120)], invalidate() {} };
|
|
1447
|
+
f.root[NODE] = () => ({ type: "vstack", gap: 0, entries: [{ component: transcript, basis: 0, grow: 1, shrink: 1, minSize: 1 }, { component: dock, basis: "auto", grow: 0, shrink: 1, minSize: 1 }] });
|
|
1448
|
+
t.after(installSidebar(f.tui, theme, () => "auto", () => "below-input"));
|
|
1449
|
+
const lines = renderLayoutFrame(f.root, 160, 4, () => {}).lines.map((line) => line.replace(/\x1b\[[0-9;]*m|\x1b\]8;;\x07/g, ""));
|
|
1450
|
+
assert.match(lines[0]!, /^T{107} {3}/, "the transcript keeps its 3-column gap from the rail");
|
|
1451
|
+
assert.match(lines[3]!, /^D{107} {3}/, "so does the dock with the editor");
|
|
1452
|
+
});
|
|
1453
|
+
|
|
1454
|
+
test("a compact or minimal split title row has no margin row, so the rail keeps its own top gap", (t) => {
|
|
1455
|
+
const painted = { ...theme, bg: (_color: string, text: string) => `\x1b[48;5;22m${text}\x1b[49m` };
|
|
1456
|
+
for (const density of ["compact", "minimal"] as const) {
|
|
1457
|
+
const f = fixture("fullscreen", 160);
|
|
1458
|
+
sidebarPart(f.tui, "footer", { surface: "panel", render: () => ["Status"], invalidate() {} });
|
|
1459
|
+
sidebarHeader(f.tui, { render: (width: number) => [`TITLE ${width}`], invalidate() {} });
|
|
1460
|
+
t.after(installSidebar(f.tui, painted, () => "auto", () => "split", () => density));
|
|
1461
|
+
const rail = railWithHeader(f).render(50);
|
|
1462
|
+
assert.equal(rail[0]!.replace(/\x1b\[[0-9;]*m/g, "").trim(), "", `${density}: a blank rail row under the title`);
|
|
1463
|
+
assert.match(rail[1]!, /Status/, `${density}: the first section follows it`);
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
|
|
1467
|
+
test("a transparent rail draws every section as its own card in the transcript's card style, with the key hints outside the cards", (t) => {
|
|
1468
|
+
const [previousStyle, previousSurface] = [cardStyle(), chromeSurface()];
|
|
1469
|
+
t.after(() => { setCardStyle(previousStyle); setChromeSurface(previousSurface); });
|
|
1470
|
+
const painted = { ...theme, bg: (role: string, text: string) => `\x1b[48;5;${role === "customMessageBg" ? 171 : 120}m${text}\x1b[49m` };
|
|
1471
|
+
const strip = (row: string) => row.replace(/\x1b\[[0-9;]*m/g, "");
|
|
1472
|
+
for (const style of [CARD_STYLE.NEON, CARD_STYLE.FLOAT]) {
|
|
1473
|
+
setCardStyle(style);
|
|
1474
|
+
setChromeSurface("transparent");
|
|
1475
|
+
const f = fixture("fullscreen", 160);
|
|
1476
|
+
const received: TuiMouseEvent[] = [];
|
|
1477
|
+
const lines = (width: number) => [`\x1b[35m▾\x1b[39m CHANGES${" ".repeat(width - 14)}clean`, " no changes", "", `▾ INTEGRATIONS${" ".repeat(width - 15)}1`, " - gentle-pi · ready", "", " ctrl+shift+t todos"];
|
|
1478
|
+
// Like NativePointerRegion and the Status targets: the event must fall inside
|
|
1479
|
+
// the frame the part rendered (its width, all its rows), or it is ignored.
|
|
1480
|
+
const rendered = new Set<number>();
|
|
1481
|
+
sidebarPart(f.tui, "footer", { render: () => [], invalidate() {} }, {
|
|
1482
|
+
surface: "panel",
|
|
1483
|
+
render: (width: number) => { rendered.add(width); return lines(width); },
|
|
1484
|
+
cardGroups: () => ({ groups: [{ start: 0, end: 2 }, { start: 3, end: 5 }], loose: [6] }),
|
|
1485
|
+
invalidate() {},
|
|
1486
|
+
handleMouse(event) {
|
|
1487
|
+
if (!rendered.has(event.width) || event.height !== lines(event.width).length) return undefined;
|
|
1488
|
+
if (event.x < 0 || event.x >= event.width || event.y < 0 || event.y >= event.height) return undefined;
|
|
1489
|
+
received.push(event);
|
|
1490
|
+
return { handled: true };
|
|
1491
|
+
},
|
|
1492
|
+
});
|
|
1493
|
+
sidebarHeader(f.tui, { render: () => ["HEADER"], invalidate() {} });
|
|
1494
|
+
t.after(installSidebar(f.tui, painted, () => "auto", () => "split", () => "compact"));
|
|
1495
|
+
const scroll = railWithHeader(f);
|
|
1496
|
+
const rows = scroll.render(50);
|
|
1497
|
+
const text = rows.map(strip);
|
|
1498
|
+
const content = scroll.getContentWidth(50);
|
|
1499
|
+
for (const row of rows) assert.ok(visibleWidth(row) <= content, `${style}: no row overflows the rail`);
|
|
1500
|
+
const changes = text.findIndex((row) => row.includes("CHANGES"));
|
|
1501
|
+
const integrations = text.findIndex((row) => row.includes("INTEGRATIONS"));
|
|
1502
|
+
const hints = text.findIndex((row) => row.includes("ctrl+shift+t todos"));
|
|
1503
|
+
assert.ok(changes >= 0 && integrations > changes && hints > integrations, `${style}: Changes, Integrations, then the hints`);
|
|
1504
|
+
if (style === CARD_STYLE.NEON) {
|
|
1505
|
+
assert.match(text[changes]!, /^╭─ ▾ CHANGES ─+ clean ╮$/, "neon: the section title and count sit in the card's top rule, like a transcript card");
|
|
1506
|
+
assert.equal((text[changes]!.match(/▾/g) ?? []).length, 1, "neon: a styled header glyph is not repeated");
|
|
1507
|
+
assert.match(text[changes + 1]!, /^│ +no changes +│$/);
|
|
1508
|
+
assert.match(text[changes + 2]!, /^╰─+╯$/, "neon: every section closes its own card");
|
|
1509
|
+
assert.match(text[integrations]!, /^╭─ ▾ INTEGRATIONS ─+ 1 ╮$/, "neon: Integrations is its own card");
|
|
1510
|
+
} else {
|
|
1511
|
+
assert.match(rows[changes]!, /\x1b\[48;5;120m/, "float: the card tone background");
|
|
1512
|
+
assert.match(text[changes]!, /▎/, "float: the accent bar of a float card");
|
|
1513
|
+
assert.notEqual(rows.findIndex((row) => row.includes("\x1b[48;5;120m") && strip(row).includes("INTEGRATIONS")), -1, "float: Integrations is its own card");
|
|
1514
|
+
}
|
|
1515
|
+
assert.doesNotMatch(rows[hints]!, /\x1b\[48;5;/, `${style}: the hints sit outside the cards`);
|
|
1516
|
+
assert.doesNotMatch(text[hints]!, /[│╭╰▎]/, `${style}: no card chrome on the hints`);
|
|
1517
|
+
const click = (x: number, y: number): TuiMouseEvent => ({ type: "click", button: "left", x, y, screenX: 110 + x, screenY: y, width: 50, height: 30, shift: false, alt: false, ctrl: false });
|
|
1518
|
+
assert.equal(scroll.handleMouse(click(6, changes))?.handled, true, `${style}: the title row folds the section`);
|
|
1519
|
+
assert.equal(received.at(-1)?.y, 0, `${style}: the title row maps to the section header`);
|
|
1520
|
+
const body = text.findIndex((row) => row.includes("no changes"));
|
|
1521
|
+
assert.equal(scroll.handleMouse(click(6, body))?.handled, true);
|
|
1522
|
+
assert.equal(received.at(-1)?.y, 1, `${style}: a body row maps to its own row`);
|
|
1523
|
+
assert.equal(scroll.handleMouse(click(6, integrations))?.handled, true);
|
|
1524
|
+
assert.equal(received.at(-1)?.y, 3, `${style}: the second card's title maps to its header`);
|
|
1525
|
+
}
|
|
1526
|
+
});
|
|
1527
|
+
|
|
1528
|
+
test("float rail cards never fuse: an unpainted row separates them in every density, while neon cards may touch", (t) => {
|
|
1529
|
+
const [previousStyle, previousSurface] = [cardStyle(), chromeSurface()];
|
|
1530
|
+
t.after(() => { setCardStyle(previousStyle); setChromeSurface(previousSurface); });
|
|
1531
|
+
const painted = { ...theme, bg: (role: string, text: string) => `\x1b[48;5;${role === "customMessageBg" ? 171 : 120}m${text}\x1b[49m` };
|
|
1532
|
+
const tinted = /\x1b\[48;5;\d+m/;
|
|
1533
|
+
setChromeSurface("transparent");
|
|
1534
|
+
for (const style of [CARD_STYLE.FLOAT, CARD_STYLE.NEON]) {
|
|
1535
|
+
for (const density of ["comfortable", "compact", "minimal"] as const) {
|
|
1536
|
+
setCardStyle(style);
|
|
1537
|
+
const f = fixture("fullscreen", 160);
|
|
1538
|
+
sidebarPart(f.tui, "todo", { render: () => [], invalidate() {} }, { render: () => ["▾ TODOS 1/2", " task"], invalidate() {} });
|
|
1539
|
+
sidebarPart(f.tui, "footer", { render: () => [], invalidate() {} }, {
|
|
1540
|
+
surface: "panel",
|
|
1541
|
+
render: () => ["▾ CHANGES clean", " none", "▾ INTEGRATIONS 1", " ready"],
|
|
1542
|
+
cardGroups: () => ({ groups: [{ start: 0, end: 2 }, { start: 2, end: 4 }] }),
|
|
1543
|
+
invalidate() {},
|
|
1544
|
+
});
|
|
1545
|
+
sidebarHeader(f.tui, { render: () => ["HEADER"], invalidate() {} });
|
|
1546
|
+
t.after(installSidebar(f.tui, painted, () => "auto", () => "split", () => density));
|
|
1547
|
+
const rows = railWithHeader(f).render(50);
|
|
1548
|
+
const text = rows.map((row) => row.replace(/\x1b\[[0-9;]*m/g, ""));
|
|
1549
|
+
for (const title of ["CHANGES", "INTEGRATIONS"]) {
|
|
1550
|
+
const at = text.findIndex((row) => row.includes(title));
|
|
1551
|
+
if (style === CARD_STYLE.FLOAT) {
|
|
1552
|
+
// A float card opens with a padding row, so the row above that one separates two cards.
|
|
1553
|
+
assert.doesNotMatch(rows[at - 2] ?? "", tinted, `float/${density}: an unpainted row separates the card before ${title}`);
|
|
1554
|
+
assert.match(rows[at - 1]!, tinted, `float/${density}: ${title}'s card keeps its own top padding`);
|
|
1555
|
+
} else {
|
|
1556
|
+
const above = text.slice(0, at).filter((row) => row.trim() !== "").at(-1)!;
|
|
1557
|
+
assert.match(above, /^╰─+╯$/, `neon/${density}: the previous card's bottom rule closes it above ${title}`);
|
|
1558
|
+
assert.equal(text[at - 1]!.trim() === "", density === "comfortable", `neon/${density}: only comfortable adds a gap row`);
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
});
|
|
@@ -160,7 +160,7 @@ test("characterize settled native fullscreen scroll frames with and without the
|
|
|
160
160
|
assert.equal(visible[0], `ROW-${String(result.positions[frame % result.positions.length]).padStart(5, "0")} settled transcript`, "visible scroll anchor matches requested position");
|
|
161
161
|
if (fixture.sidebar && fixture.columns === 140) {
|
|
162
162
|
assert.ok(screen.some((line) => line.includes("Status card")), "desktop rail is painted");
|
|
163
|
-
assert.equal(screen[0], "HEADER
|
|
163
|
+
assert.equal(screen[0], "HEADER 140", "the header bar reaches the window edge");
|
|
164
164
|
} else {
|
|
165
165
|
if (fixture.columns === 100) assert.equal(screen[0], "HEADER 100", "narrow fallback retains the full-width header");
|
|
166
166
|
else assert.ok(!screen.some((line) => line.startsWith("HEADER ")), "desktop sidebar-off control has no header");
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { buildShellHeaderModel, renderShellChromeBar, renderShellHeaderChrome, renderShellStatusBar, shellHeaderUsageHit } from "../lib/shell-bar.ts";
|
|
7
|
+
import { chromeSurface, renderPanelSheet, setChromeSurface } from "../lib/shell-panel.ts";
|
|
8
|
+
import { CARD_STYLE, cardStyle, setCardStyle } from "../lib/shell-card.ts";
|
|
9
|
+
import { DEFAULT_VISUAL_SETTINGS, resolveVisualSettings, writeVisualSettings } from "../lib/visual-customization-policy.ts";
|
|
10
|
+
|
|
11
|
+
const painted = { fg: (_role: string, text: string) => text, bold: (text: string) => text, bg: (role: string, text: string) => `\x1b[48;5;${role === "customMessageBg" ? 171 : 120}m${text}\x1b[49m` };
|
|
12
|
+
const model = { cwd: "/repo", branch: "main", dirty: 0, sessionName: "s", modelId: "gpt-5.5", effort: "medium", contextPercent: 45, contextWindow: 1000, costTotal: 0, subscription: true, usage: undefined, statuses: [] };
|
|
13
|
+
|
|
14
|
+
const unstyled = (rows: string[]) => rows.map((row) => row.replace(/\x1b\[[0-9;]*m/g, ""));
|
|
15
|
+
|
|
16
|
+
test("a transparent surface keeps the float header's margins and drops only its background", (t) => {
|
|
17
|
+
const [style, surface] = [cardStyle(), chromeSurface()];
|
|
18
|
+
t.after(() => { setCardStyle(style); setChromeSurface(surface); });
|
|
19
|
+
setCardStyle(CARD_STYLE.FLOAT);
|
|
20
|
+
for (const headerPlacement of ["top", "below-input"] as const) {
|
|
21
|
+
const header = () => renderShellHeaderChrome(buildShellHeaderModel(model as never), painted as never, 107, "alt+u", { ...DEFAULT_VISUAL_SETTINGS, headerPlacement });
|
|
22
|
+
setChromeSurface("tinted");
|
|
23
|
+
const tinted = header();
|
|
24
|
+
assert.match(tinted.rows.join("\n"), /\x1b\[48;5;\d+m/, `${headerPlacement}: the tinted float header keeps its card`);
|
|
25
|
+
setChromeSurface("transparent");
|
|
26
|
+
const clear = header();
|
|
27
|
+
assert.doesNotMatch(clear.rows.join("\n"), /\x1b\[48;5;\d+m/, `${headerPlacement}: no background`);
|
|
28
|
+
assert.deepEqual(unstyled(clear.rows), unstyled(tinted.rows), `${headerPlacement}: same rows, margins and text`);
|
|
29
|
+
assert.equal(clear.headerRow, tinted.headerRow);
|
|
30
|
+
assert.deepEqual(clear.usageSpan, tinted.usageSpan, `${headerPlacement}: the usage click target does not move`);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("the chrome bar is the split status bar row, centered between two painted margin rows when comfortable", (t) => {
|
|
35
|
+
const [style, surface] = [cardStyle(), chromeSurface()];
|
|
36
|
+
t.after(() => { setCardStyle(style); setChromeSurface(surface); });
|
|
37
|
+
const barModel = { ...model, permission: { mode: "SUPER-YOLO" } };
|
|
38
|
+
const split = { ...DEFAULT_VISUAL_SETTINGS, headerPlacement: "split" as const };
|
|
39
|
+
for (const cards of [CARD_STYLE.FLOAT, CARD_STYLE.NEON]) {
|
|
40
|
+
setCardStyle(cards);
|
|
41
|
+
setChromeSurface("tinted");
|
|
42
|
+
const status = renderShellStatusBar(barModel as never, painted as never, 110, "alt+u", split);
|
|
43
|
+
const below = renderShellChromeBar(barModel as never, painted as never, 110, "alt+u", split, undefined);
|
|
44
|
+
assert.deepEqual(below.rows[1], status.rows[0], `${cards}: the same row as the split status bar`);
|
|
45
|
+
assert.equal(below.rows.length, 3, `${cards}: a margin row on each side centers the bar's text`);
|
|
46
|
+
assert.equal(below.headerRow, 1);
|
|
47
|
+
assert.deepEqual(below.rows[0], below.rows[2], `${cards}: both margin rows are the same blank chrome row`);
|
|
48
|
+
for (const row of below.rows) assert.match(row, /\x1b\[48;5;171m/, `${cards}: the margin row is painted like the bar`);
|
|
49
|
+
const text = unstyled(below.rows)[1]!;
|
|
50
|
+
assert.match(text, /💥 SUPER-YOLO/);
|
|
51
|
+
assert.ok(shellHeaderUsageHit(below, text.indexOf("usage"), 1), "usage stays clickable on the bar row");
|
|
52
|
+
assert.equal(shellHeaderUsageHit(below, text.indexOf("usage"), 0), false, "the margins are not targets");
|
|
53
|
+
assert.equal(shellHeaderUsageHit(below, text.indexOf("usage"), 2), false);
|
|
54
|
+
for (const density of ["compact", "minimal"] as const) {
|
|
55
|
+
assert.equal(renderShellChromeBar(barModel as never, painted as never, 110, "alt+u", { ...split, density }, undefined).rows.length, 1, `${cards}: ${density} has no margin row`);
|
|
56
|
+
}
|
|
57
|
+
setChromeSurface("transparent");
|
|
58
|
+
const clear = renderShellChromeBar(barModel as never, painted as never, 110, "alt+u", split, undefined);
|
|
59
|
+
assert.doesNotMatch(clear.rows.join("\n"), /\x1b\[48;5;\d+m/, `${cards}: transparent floats it`);
|
|
60
|
+
assert.deepEqual(unstyled(clear.rows), unstyled(below.rows));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("the panel sheet follows the chrome surface", (t) => {
|
|
65
|
+
const surface = chromeSurface();
|
|
66
|
+
t.after(() => setChromeSurface(surface));
|
|
67
|
+
const parts = new Map([["footer", { render: () => ["Status row"] }]]);
|
|
68
|
+
const sheet = () => renderPanelSheet(parts as never, painted as never, 60, { rows: 10, scrollTop: 0 } as never).lines.join("\n");
|
|
69
|
+
setChromeSurface("tinted");
|
|
70
|
+
assert.match(sheet(), /\x1b\[48;5;171m/);
|
|
71
|
+
setChromeSurface("transparent");
|
|
72
|
+
assert.doesNotMatch(sheet(), /\x1b\[48;5;171m/);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test("invalid surface or header writes keep the stored file byte-identical", () => {
|
|
76
|
+
const home = mkdtempSync(join(tmpdir(), "visual-invalid-"));
|
|
77
|
+
try {
|
|
78
|
+
writeVisualSettings({ ...DEFAULT_VISUAL_SETTINGS, headerPlacement: "split", surface: "transparent" }, { gentlePiConfigHome: home });
|
|
79
|
+
const file = join(home, "visual-customization.json");
|
|
80
|
+
const before = readFileSync(file, "utf8");
|
|
81
|
+
for (const bad of [{ surface: "glass" }, { surface: "Transparent" }, { headerPlacement: "above-input" }]) {
|
|
82
|
+
assert.throws(() => writeVisualSettings({ ...DEFAULT_VISUAL_SETTINGS, ...bad } as never, { gentlePiConfigHome: home }), /Invalid visual settings/);
|
|
83
|
+
assert.equal(readFileSync(file, "utf8"), before);
|
|
84
|
+
}
|
|
85
|
+
const { surface: _surface, ...legacy } = DEFAULT_VISUAL_SETTINGS;
|
|
86
|
+
assert.throws(() => writeVisualSettings(legacy as never, { gentlePiConfigHome: home }));
|
|
87
|
+
assert.equal(resolveVisualSettings({ gentlePiConfigHome: home }).settings.surface, "transparent");
|
|
88
|
+
} finally { rmSync(home, { recursive: true, force: true }); }
|
|
89
|
+
});
|
package/tests/shell-todo.test.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
todoStateMessage,
|
|
13
13
|
todoSummary,
|
|
14
14
|
type TodoState,
|
|
15
|
+
renderTodoSection,
|
|
15
16
|
} from "../lib/shell-todo.ts";
|
|
16
17
|
import { CARD_STYLE, cardStyle, setCardStyle, type CardStyle } from "../lib/shell-card.ts";
|
|
17
18
|
import { stripAnsi } from "../lib/terminal-theme.ts";
|
|
@@ -500,3 +501,14 @@ test("renderTodoCard folds dropped tasks next to done ones in a long list", () =
|
|
|
500
501
|
assert.match(plain[3], /^│ ○ Task 9 +│$/);
|
|
501
502
|
assert.match(plain[12], /^│ … 3 more +│$/);
|
|
502
503
|
});
|
|
504
|
+
|
|
505
|
+
test("the rail Todos header carries the collapse key as a small dim hint before the count", () => {
|
|
506
|
+
// Real SGR, so the width is measured as a terminal draws it.
|
|
507
|
+
const theme = { fg: (role: string, text: string) => role === "dim" ? `\x1b[2m${text}\x1b[22m` : text, bold: (text: string) => text };
|
|
508
|
+
const state = { tasks: [{ id: 1, title: "Ship it", status: "in_progress" as const }, { id: 2, title: "Done", status: "done" as const }], nextId: 3, updatedTurn: 0 };
|
|
509
|
+
const withKey = renderTodoSection(state, theme as never, 46, { collapsed: false, staleTurns: 0, collapseKey: "ctrl+shift+t" });
|
|
510
|
+
assert.match(withKey.header, /\x1b\[2mctrl\+shift\+t\x1b\[22m +1\/2$/, "the key sits dim before the count");
|
|
511
|
+
assert.equal(visibleWidth(withKey.header), 46, "the header keeps its width");
|
|
512
|
+
const without = renderTodoSection(state, theme as never, 46, { collapsed: false, staleTurns: 0 });
|
|
513
|
+
assert.doesNotMatch(without.header, /ctrl/, "no key, no hint");
|
|
514
|
+
});
|