gentle-pi 4.5.0 → 4.6.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 +9 -6
- package/assets/agents/gentle-ai-verify.md +4 -0
- package/assets/agents/gentle-ai-worker.md +1 -0
- package/assets/migrations/agent-body-history.json +147 -0
- package/assets/orchestrator-delegation-reference.md +3 -3
- package/assets/orchestrator-delegation.md +2 -2
- package/assets/orchestrator-verification.md +10 -6
- package/assets/orchestrator.md +8 -8
- package/bin/gentle-shell.mjs +61 -26
- package/docs/ci-performance.md +11 -0
- package/docs/delegated-verification.md +6 -0
- package/docs/fast-mode.md +15 -0
- package/docs/gentle-agents-activity.md +8 -0
- package/docs/gentle-music.md +6 -3
- package/docs/gentle-shell.md +70 -20
- package/docs/install-wizard.md +1 -1
- package/docs/mcp-status.md +52 -0
- package/docs/prompt-budget.md +28 -0
- package/docs/readme-reference.md +82 -21
- package/docs/session-profile-format.md +20 -5
- package/docs/sound-notifications.md +1 -1
- package/docs/star-prompt.md +32 -0
- package/docs/work-continuity.md +46 -0
- package/extensions/ask-user-question.ts +1 -0
- package/extensions/codegraph-tools.ts +38 -4
- package/extensions/gentle-agents.ts +477 -50
- package/extensions/gentle-ai.ts +1046 -191
- package/extensions/gentle-fast.ts +61 -0
- package/extensions/gentle-guide.ts +174 -0
- package/extensions/gentle-herdr-activity.ts +21 -1
- package/extensions/gentle-herdr-agent.ts +144 -0
- package/extensions/gentle-music.ts +10 -0
- package/extensions/gentle-program-identity.ts +61 -0
- package/extensions/gentle-shell.ts +642 -97
- package/extensions/gentle-star-prompt.ts +334 -0
- package/extensions/gentle-stats.ts +5 -5
- package/extensions/gentle-todo.ts +42 -22
- package/extensions/history/store.ts +18 -12
- package/extensions/skill-registry.ts +35 -3
- package/extensions/startup-banner.ts +39 -7
- package/lib/agent-assets.ts +74 -17
- package/lib/agent-profiles.ts +1 -1
- package/lib/agents-config.ts +12 -3
- package/lib/agents-keys.ts +8 -16
- package/lib/agents-protocol.ts +80 -4
- package/lib/agents-runner.ts +105 -4
- package/lib/agents-view.ts +6 -1
- package/lib/agents-widget.ts +132 -9
- package/lib/bridge-cost.ts +28 -0
- package/lib/codemode-renderer.ts +16 -0
- package/lib/command-palette-catalog.ts +1 -0
- package/lib/command-palette.ts +21 -8
- package/lib/exploration-budget.ts +62 -0
- package/lib/gentle-guide.ts +201 -0
- package/lib/gentle-shell-launcher.ts +4 -0
- package/lib/herdr-activity.ts +9 -3
- package/lib/herdr-task-summary-policy.ts +85 -0
- package/lib/inprocess-reviewer.ts +33 -13
- package/lib/jobs-sidebar-state.ts +5 -6
- package/lib/jobs-widget.ts +16 -52
- package/lib/keymaps-customize.ts +81 -0
- package/lib/keymaps.ts +291 -0
- package/lib/model-fallback-notice.ts +61 -0
- package/lib/model-fallback-policy.ts +141 -0
- package/lib/model-fallback-store.ts +143 -0
- package/lib/model-routing-authority.ts +10 -2
- package/lib/nan-provider.ts +3 -2
- package/lib/native-review-cli.ts +7 -2
- package/lib/notification-customize.ts +48 -51
- package/lib/openai-fast-tier.ts +22 -0
- package/lib/orchestrator-discovery.ts +5 -1
- package/lib/orchestrator-fallback.ts +75 -0
- package/lib/pasted-image-paths.ts +113 -0
- package/lib/questionnaire/questionnaire-view.ts +121 -7
- package/lib/review-candidate-view-owner.ts +4 -0
- package/lib/review-candidate-view.ts +10 -7
- package/lib/review-host-relay.ts +5 -1
- package/lib/review-integration-v2.ts +22 -7
- package/lib/review-repository.ts +5 -0
- package/lib/session-profile-append-controller.ts +21 -6
- package/lib/session-profile-authority.ts +119 -0
- package/lib/session-profile-binding.ts +54 -5
- package/lib/session-profile-freeze.ts +105 -9
- package/lib/session-profile-integration.ts +313 -0
- package/lib/session-profile-persistence.ts +63 -9
- package/lib/shell-bar.ts +171 -56
- package/lib/shell-card.ts +26 -6
- package/lib/shell-page.ts +120 -0
- package/lib/shell-panel.ts +149 -0
- package/lib/shell-prompt.ts +53 -1
- package/lib/shell-sidebar-layout.ts +98 -25
- package/lib/shell-sidebar.ts +54 -1
- package/lib/shell-stats.ts +123 -0
- package/lib/shell-todo.ts +71 -0
- package/lib/shell-usage.ts +12 -2
- package/lib/star-prompt.ts +197 -0
- package/lib/verifier-admission.ts +18 -8
- package/lib/verifier-settle-reminder.ts +64 -0
- package/lib/vim-editor-adapter.ts +6 -1
- package/lib/visual-customization-policy.ts +41 -6
- package/lib/visual-customize-view.ts +164 -26
- package/lib/visual-layout-preview.ts +43 -0
- package/lib/yolo-session-policy.ts +28 -1
- package/package.json +1 -1
- package/runtime/gentle-shell-launcher.mjs +4 -0
- package/runtime/native-review-cli.mjs +7 -2
- package/runtime/review-integration-v2.mjs +22 -7
- package/runtime/windows-session-transport.ps1 +60 -3
- package/scripts/bootstrap.sh +4 -1
- package/scripts/installer-preflight.mjs +1 -1
- package/scripts/pi-update.mjs +113 -3
- package/scripts/run-test-suite.mjs +17 -1
- package/scripts/shell-snapshot.mjs +340 -0
- package/scripts/test-packed-runner.mjs +1 -1
- package/scripts/update-agent-body-history.mjs +41 -0
- package/scripts/verify-installer-tap.mjs +45 -0
- package/scripts/verify-package-files.mjs +2 -0
- package/skills/gentle-ai/SKILL.md +2 -2
- package/skills/tui-design/NOTICE.md +5 -0
- package/skills/tui-design/SKILL.md +56 -0
- package/skills/tui-design/references/commands.md +75 -0
- package/skills/tui-design/references/critique.md +48 -0
- package/skills/tui-design/references/design-doc.md +44 -0
- package/skills/tui-design/references/terminal-craft.md +64 -0
- package/skills/tui-design/references/visual-loop.md +32 -0
- package/tests/agents-protocol.test.ts +53 -1
- package/tests/agents-runner.test.ts +168 -3
- package/tests/agents-view.test.ts +27 -0
- package/tests/agents-widget.test.ts +312 -10
- package/tests/bounded-scan-contract.test.ts +39 -0
- package/tests/bridge-cost.test.ts +32 -0
- package/tests/bundled-install.test.ts +6 -4
- package/tests/ci-concurrency.test.ts +11 -0
- package/tests/ci-merge-base-identity.test.ts +114 -0
- package/tests/codegraph-tools.test.ts +69 -0
- package/tests/codemode-rendering.test.ts +22 -2
- package/tests/command-palette.test.ts +16 -2
- package/tests/commit-slice-signal.test.ts +11 -9
- package/tests/delegate-for-reason-contract.test.ts +5 -4
- package/tests/design-canvas-server.test.ts +6 -2
- package/tests/exploration-budget.test.ts +128 -0
- package/tests/fixtures/agent-assets/gentle-ai-worker.strict-tdd-era.md +122 -0
- package/tests/fixtures/measure-orchestrator-prompt.mjs +2 -1
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +18 -10
- package/tests/fixtures/session-profile-v1/replay.ts +125 -0
- package/tests/fixtures/session-profile-v1/session-profile-authority.ts +113 -0
- package/tests/fixtures/session-profile-v1/session-profile-binding.ts +83 -0
- package/tests/fixtures/session-profile-v1/session-profile-disk-reader.ts +182 -0
- package/tests/fixtures/session-profile-v1/session-profile-freeze.ts +290 -0
- package/tests/fixtures/session-profile-v1/session-profile-persistence.ts +195 -0
- package/tests/fixtures/session-profile-v1/v1-inputs.ts +16 -0
- package/tests/fixtures/windows-pipe-availability.ps1 +26 -0
- package/tests/fixtures/windows-session-bootstrap.ps1 +6 -2
- package/tests/gentle-agents.test.ts +416 -21
- package/tests/gentle-ai-exploration-budget.test.ts +135 -0
- package/tests/gentle-ai.test.ts +1011 -37
- package/tests/gentle-fast.test.ts +73 -0
- package/tests/gentle-guide.test.ts +208 -0
- package/tests/gentle-herdr-activity.test.ts +76 -2
- package/tests/gentle-herdr-agent.test.ts +111 -0
- package/tests/gentle-music.test.ts +36 -1
- package/tests/gentle-program-identity.test.ts +197 -0
- package/tests/gentle-shell-bin.test.ts +49 -26
- package/tests/gentle-shell-launcher.test.ts +18 -2
- package/tests/gentle-shell.test.ts +1068 -37
- package/tests/gentle-stats.test.ts +15 -2
- package/tests/gentle-todo.test.ts +50 -4
- package/tests/herdr-task-summary-policy.test.ts +128 -0
- package/tests/history-store-private-mode.test.ts +40 -0
- package/tests/image-paste-chips.test.ts +42 -0
- package/tests/inprocess-reviewer.test.ts +122 -0
- package/tests/installer-posix-bootstrap.test.ts +67 -5
- package/tests/installer-server.test.ts +2 -2
- package/tests/installer-windows-diagnostics.test.ts +4 -5
- package/tests/isolated-config-home.ts +28 -0
- package/tests/jobs-widget.test.ts +25 -37
- package/tests/keymaps-customize.test.ts +114 -0
- package/tests/keymaps.test.ts +103 -0
- package/tests/maintainer/mcp-status.maintest.ts +88 -0
- package/tests/maintainer/pi-update-source.maintest.ts +116 -0
- package/tests/model-fallback-notice.test.ts +45 -0
- package/tests/model-fallback-policy.test.ts +83 -0
- package/tests/model-fallback-store.test.ts +111 -0
- package/tests/nan-provider.test.ts +4 -4
- package/tests/no-self-pause-contract.test.ts +19 -0
- package/tests/notification-customize.test.ts +58 -34
- package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
- package/tests/odd-routing-contract.test.ts +1 -1
- package/tests/orchestrator-fallback.test.ts +82 -0
- package/tests/orchestrator-prompt-budget.test.ts +131 -0
- package/tests/package-manifest.test.ts +160 -7
- package/tests/pasted-image-paths.test.ts +118 -0
- package/tests/persona-reply-language.test.ts +61 -0
- package/tests/pi-update-launcher.test.ts +32 -8
- package/tests/pi-update-source.test.ts +162 -0
- package/tests/profile-fast-tier.test.ts +311 -0
- package/tests/profile-tier-footer.test.ts +79 -0
- package/tests/questionnaire-view.test.ts +150 -0
- package/tests/review-candidate-owner-sweep.test.ts +93 -0
- package/tests/review-candidate-view.test.ts +51 -0
- package/tests/review-controller-native-routing.test.ts +120 -6
- package/tests/review-gate.test.ts +24 -0
- package/tests/review-inspect-preflight.test.ts +197 -0
- package/tests/review-integration-v2-forward.test.ts +59 -0
- package/tests/review-repository.test.ts +52 -1
- package/tests/review-sidebar-state.test.ts +5 -5
- package/tests/run-test-suite.test.ts +61 -5
- package/tests/sensitive-path-tools.test.ts +74 -0
- package/tests/session-profile-append-controller.test.ts +63 -0
- package/tests/session-profile-authority.test.ts +259 -0
- package/tests/session-profile-binding.test.ts +15 -0
- package/tests/session-profile-extension.test.ts +615 -0
- package/tests/session-profile-freeze.test.ts +110 -2
- package/tests/session-profile-integration.test.ts +857 -0
- package/tests/session-profile-persistence.test.ts +57 -0
- package/tests/session-profile-v1-compat.test.ts +221 -0
- package/tests/shell-bar.test.ts +113 -55
- package/tests/shell-card.test.ts +13 -1
- package/tests/shell-page.test.ts +108 -0
- package/tests/shell-panel.test.ts +332 -0
- package/tests/shell-prompt.test.ts +54 -0
- package/tests/shell-render-cache.test.ts +5 -0
- package/tests/shell-sidebar-fullscreen.test.ts +12 -0
- package/tests/shell-sidebar-layout.test.ts +159 -27
- package/tests/shell-stats.test.ts +90 -0
- package/tests/shell-usage.test.ts +14 -0
- package/tests/skill-registry.test.ts +68 -1
- package/tests/star-prompt.test.ts +470 -0
- package/tests/startup-banner.test.ts +57 -1
- package/tests/task-size-routing-contract.test.ts +45 -1
- package/tests/verifier-settle-reminder.test.ts +281 -0
- package/tests/verify-first-launch-contract.test.ts +56 -5
- package/tests/verify-installer-tap.test.ts +57 -0
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/visual-customization-policy.test.ts +61 -7
- package/tests/visual-customize-view.test.ts +253 -8
- package/tests/visual-layout-preview.test.ts +28 -0
- package/tests/windows-session-bootstrap.test.ts +105 -2
- package/tests/work-continuity-contract.test.ts +86 -0
- package/tests/writer-surfaces.test.ts +12 -10
- package/tests/yolo-customize.test.ts +30 -11
- package/tests/yolo-mode-runtime.test.ts +4 -2
- package/tests/yolo-mode.test.ts +16 -2
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
SESSION_PROFILE_CUSTOM_TYPE,
|
|
5
5
|
createSessionProfileBind,
|
|
6
6
|
createSessionProfileClear,
|
|
7
|
+
createSessionProfileStartupBind,
|
|
7
8
|
readSessionProfileEntry,
|
|
8
9
|
replaySessionProfileBranch,
|
|
9
10
|
} from "../lib/session-profile-persistence.ts";
|
|
@@ -332,3 +333,59 @@ test("replay sees only caller-supplied active branch, not siblings or later path
|
|
|
332
333
|
binding: bind(),
|
|
333
334
|
});
|
|
334
335
|
});
|
|
336
|
+
|
|
337
|
+
// A2 record shapes (gentle-shell#2742, section 3).
|
|
338
|
+
const TEAM = { worker: { model: "provider/team" }, orchestrator: { model: "provider/main" } };
|
|
339
|
+
const teamStartup = <O extends string>(origin: O) => ({ origin, name: "team", modelProfiles: TEAM });
|
|
340
|
+
|
|
341
|
+
test("writer emits a startup bind per origin with the full definition, orchestrator included", () => {
|
|
342
|
+
for (const origin of ["local", "repo", "global"] as const) {
|
|
343
|
+
const payload = createSessionProfileStartupBind(origin, "team", TEAM);
|
|
344
|
+
assert.deepEqual(payload, { kind: "bind", ...teamStartup(origin) });
|
|
345
|
+
assert.deepEqual(readSessionProfileEntry(custom(payload)), { status: "bound", binding: payload });
|
|
346
|
+
}
|
|
347
|
+
assert.throws(() => createSessionProfileStartupBind("user" as "local", "team", TEAM));
|
|
348
|
+
assert.throws(() => createSessionProfileStartupBind("global", "../team", TEAM));
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
test("writer records the startup state on an explicit choice and on a clear", () => {
|
|
352
|
+
for (const startup of [teamStartup("repo"), "none"] as const) {
|
|
353
|
+
const payload = createSessionProfileBind("work", {}, startup);
|
|
354
|
+
assert.deepEqual(payload, { ...bind(), startup });
|
|
355
|
+
assert.deepEqual(readSessionProfileEntry(custom(payload)), { status: "bound", binding: payload });
|
|
356
|
+
}
|
|
357
|
+
assert.deepEqual(createSessionProfileClear("none"), { kind: "clear", startup: "none" });
|
|
358
|
+
assert.deepEqual(readSessionProfileEntry(custom({ kind: "clear", startup: "none" })), {
|
|
359
|
+
status: "cleared",
|
|
360
|
+
startup: "none",
|
|
361
|
+
});
|
|
362
|
+
assert.throws(() => createSessionProfileBind("work", {}, teamStartup("user") as never));
|
|
363
|
+
assert.throws(() => createSessionProfileBind("work", {}, { ...teamStartup("local"), modelProfiles: { worker: "bad model" } } as never));
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
test("a malformed startup state is ignored, never invalidating the record", () => {
|
|
367
|
+
const malformed: unknown[] = [
|
|
368
|
+
null,
|
|
369
|
+
"other",
|
|
370
|
+
{},
|
|
371
|
+
teamStartup("user"),
|
|
372
|
+
{ ...teamStartup("global"), name: "../team" },
|
|
373
|
+
{ ...teamStartup("global"), modelProfiles: { worker: "bad model" } },
|
|
374
|
+
{ origin: "global", name: "team" },
|
|
375
|
+
];
|
|
376
|
+
for (const startup of malformed) {
|
|
377
|
+
assert.deepEqual(readSessionProfileEntry(custom({ ...bind(), startup })), { status: "bound", binding: bind() });
|
|
378
|
+
assert.deepEqual(readSessionProfileEntry(custom({ kind: "clear", startup })), { status: "cleared" });
|
|
379
|
+
}
|
|
380
|
+
// A startup record is its own startup state; a nested one carries no meaning.
|
|
381
|
+
const startupBind = { kind: "bind", ...teamStartup("global") };
|
|
382
|
+
assert.deepEqual(readSessionProfileEntry(custom({ ...startupBind, startup: "none" })), {
|
|
383
|
+
status: "bound",
|
|
384
|
+
binding: startupBind,
|
|
385
|
+
});
|
|
386
|
+
assert.deepEqual(replaySessionProfileBranch([custom(bind()), custom({ kind: "clear", startup: "none" })]), {
|
|
387
|
+
status: "cleared",
|
|
388
|
+
startup: "none",
|
|
389
|
+
entryIndex: 1,
|
|
390
|
+
});
|
|
391
|
+
});
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { profileRoleEntries } from "../lib/agent-profiles.ts";
|
|
4
|
+
import type { AgentModelConfig } from "../lib/model-routing-authority.ts";
|
|
5
|
+
import {
|
|
6
|
+
createSessionProfileBind,
|
|
7
|
+
createSessionProfileClear,
|
|
8
|
+
createSessionProfileStartupBind,
|
|
9
|
+
} from "../lib/session-profile-persistence.ts";
|
|
10
|
+
import { replay, type Transcript } from "./fixtures/session-profile-v1/replay.ts";
|
|
11
|
+
|
|
12
|
+
// v1 compatibility (gentle-shell#2742, section 10): a session resumed by the
|
|
13
|
+
// vendored v1 chain routes like the current modules. This file pins today's
|
|
14
|
+
// record shapes; the A2 shapes join the same table as they land.
|
|
15
|
+
|
|
16
|
+
const FRONTIER: AgentModelConfig = { worker: { model: "anthropic/claude-opus", thinking: "high" } };
|
|
17
|
+
const LOCAL: AgentModelConfig = { worker: { model: "ollama/qwen", thinking: "low" } };
|
|
18
|
+
const TEAM: AgentModelConfig = { worker: { model: "openai/gpt-5" }, orchestrator: { model: "openai/gpt-5" } };
|
|
19
|
+
const profiles = { frontier: FRONTIER, local: LOCAL, team: TEAM };
|
|
20
|
+
|
|
21
|
+
const userBind = (name: string, modelProfiles: AgentModelConfig) => ({ kind: "bind", origin: "user", name, modelProfiles });
|
|
22
|
+
|
|
23
|
+
const transcripts: Record<string, Transcript> = {
|
|
24
|
+
"no record, no defaults": { records: [], defaults: { profiles } },
|
|
25
|
+
"no record, active profile": { records: [], defaults: { profiles, active: "frontier" } },
|
|
26
|
+
"no record, local pin over active": { records: [], defaults: { profiles, active: "frontier", localPin: "local" } },
|
|
27
|
+
"no record, repo declaration, foreign pin": {
|
|
28
|
+
records: [],
|
|
29
|
+
defaults: { profiles, repoDeclaration: "team", foreignPin: "local" },
|
|
30
|
+
},
|
|
31
|
+
"explicit bind": { records: [userBind("local", LOCAL)], defaults: { profiles, active: "frontier" } },
|
|
32
|
+
"explicit bind, definition edited since": {
|
|
33
|
+
records: [userBind("local", { worker: { model: "ollama/llama" } })],
|
|
34
|
+
defaults: { profiles, active: "frontier" },
|
|
35
|
+
},
|
|
36
|
+
"legacy clear after a bind": {
|
|
37
|
+
records: [userBind("local", LOCAL), { kind: "clear" }],
|
|
38
|
+
defaults: { profiles, active: "frontier" },
|
|
39
|
+
},
|
|
40
|
+
"legacy clear, no defaults, foreign pin": {
|
|
41
|
+
records: [{ kind: "clear" }],
|
|
42
|
+
defaults: { profiles, foreignPin: "team" },
|
|
43
|
+
},
|
|
44
|
+
"invalid newest record": {
|
|
45
|
+
records: [userBind("local", LOCAL), { kind: "bind", origin: "user", name: "" }],
|
|
46
|
+
defaults: { profiles, active: "frontier" },
|
|
47
|
+
},
|
|
48
|
+
"unsupported newest record": {
|
|
49
|
+
records: [userBind("local", LOCAL), { kind: "rename", name: "x" }],
|
|
50
|
+
defaults: { profiles, active: "frontier" },
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
for (const [name, transcript] of Object.entries(transcripts)) {
|
|
55
|
+
test(`v1 and current resume route the same: ${name}`, () => {
|
|
56
|
+
assert.deepEqual(replay("current", transcript), replay("v1", transcript));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
test("v1 replay observes the recorded binding, its label and its routing", () => {
|
|
61
|
+
const observed = replay("v1", transcripts["explicit bind"]!);
|
|
62
|
+
assert.deepEqual(observed, {
|
|
63
|
+
authority: true,
|
|
64
|
+
kind: "explicit",
|
|
65
|
+
label: "local (session)",
|
|
66
|
+
routing: LOCAL,
|
|
67
|
+
foreignRouting: LOCAL,
|
|
68
|
+
notice: undefined,
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test("v1 replay of a legacy clear freezes the resume-time default", () => {
|
|
73
|
+
const observed = replay("v1", transcripts["legacy clear after a bind"]!);
|
|
74
|
+
assert.equal(observed.kind, "inherited");
|
|
75
|
+
assert.equal(observed.label, "frontier");
|
|
76
|
+
assert.deepEqual(observed.routing, FRONTIER);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// A2 shapes, written by the current codec (section 5): the v1 observation is
|
|
80
|
+
// asserted directly, since how the current version reads them is T3's job.
|
|
81
|
+
const startupDefaults = {
|
|
82
|
+
local: { profiles, localPin: "local" },
|
|
83
|
+
repo: { profiles, repoDeclaration: "frontier" },
|
|
84
|
+
global: { profiles, active: "team" },
|
|
85
|
+
} as const;
|
|
86
|
+
|
|
87
|
+
for (const [origin, defaults] of Object.entries(startupDefaults) as Array<[keyof typeof startupDefaults, (typeof startupDefaults)["local"]]>) {
|
|
88
|
+
test(`v1 reads a ${origin} startup bind as bound, with the startup launch routing and no drift notice`, () => {
|
|
89
|
+
const name = { local: "local", repo: "frontier", global: "team" }[origin];
|
|
90
|
+
const definition = profiles[name];
|
|
91
|
+
const started = replay("v1", { records: [], defaults });
|
|
92
|
+
const observed = replay("v1", { records: [createSessionProfileStartupBind(origin, name, definition)], defaults });
|
|
93
|
+
assert.deepEqual(observed, {
|
|
94
|
+
authority: true,
|
|
95
|
+
kind: "explicit",
|
|
96
|
+
label: `${name} (session)`,
|
|
97
|
+
routing: definition,
|
|
98
|
+
foreignRouting: definition,
|
|
99
|
+
notice: undefined,
|
|
100
|
+
});
|
|
101
|
+
// Launch routing ignores the orchestrator key the record carries; the
|
|
102
|
+
// inherited path may hold an absent route field as `undefined`.
|
|
103
|
+
const { orchestrator: _, ...roles } = observed.routing!;
|
|
104
|
+
assert.deepEqual(roles, JSON.parse(JSON.stringify(started.routing)));
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
test("v1 reads a startup-none clear as a legacy clear", () => {
|
|
109
|
+
const defaults = { profiles, foreignPin: "team" };
|
|
110
|
+
const observed = replay("v1", { records: [userBind("local", LOCAL), createSessionProfileClear("none")], defaults });
|
|
111
|
+
assert.equal(observed.kind, "inherited");
|
|
112
|
+
assert.deepEqual(observed, replay("v1", { records: [userBind("local", LOCAL), { kind: "clear" }], defaults }));
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test("v1 reads an explicit bind with a startup state as bound and ignores the startup state", () => {
|
|
116
|
+
const defaults = { profiles, active: "frontier" };
|
|
117
|
+
for (const startup of [{ origin: "global" as const, name: "team", modelProfiles: TEAM }, "none" as const]) {
|
|
118
|
+
const observed = replay("v1", { records: [createSessionProfileBind("local", LOCAL, startup)], defaults });
|
|
119
|
+
assert.equal(observed.kind, "explicit");
|
|
120
|
+
assert.deepEqual(observed, replay("v1", transcripts["explicit bind"]!));
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// How the current version reads the A2 shapes (section 4) against v1 (section
|
|
125
|
+
// 5). Launch routing ignores the orchestrator key, so routing compares role
|
|
126
|
+
// entries; kind, label and notices are asserted per version.
|
|
127
|
+
const roles = (config: AgentModelConfig | undefined) =>
|
|
128
|
+
config === undefined ? undefined : JSON.parse(JSON.stringify(Object.fromEntries(profileRoleEntries(config))));
|
|
129
|
+
const launchRouting = (version: "v1" | "current", transcript: Transcript) => {
|
|
130
|
+
const observed = replay(version, transcript);
|
|
131
|
+
return { authority: observed.authority, routing: roles(observed.routing), foreignRouting: roles(observed.foreignRouting) };
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
for (const [origin, defaults] of Object.entries(startupDefaults) as Array<[keyof typeof startupDefaults, (typeof startupDefaults)["local"]]>) {
|
|
135
|
+
const name = { local: "local", repo: "frontier", global: "team" }[origin];
|
|
136
|
+
const label = origin === "global" ? name : `${name} (${origin})`;
|
|
137
|
+
const record = createSessionProfileStartupBind(origin, name, profiles[name]);
|
|
138
|
+
test(`current reads a ${origin} startup bind as the inherited ${label}, with v1 launch routing`, () => {
|
|
139
|
+
const transcript = { records: [record], defaults: { ...defaults, foreignPin: "local" } };
|
|
140
|
+
const observed = replay("current", transcript);
|
|
141
|
+
assert.deepEqual([observed.kind, observed.label, observed.notice], ["inherited", label, undefined]);
|
|
142
|
+
assert.deepEqual(launchRouting("current", transcript), launchRouting("v1", transcript));
|
|
143
|
+
});
|
|
144
|
+
test(`resume of a ${origin} startup bind keeps it after the defaults changed, in both versions`, () => {
|
|
145
|
+
const transcript = { records: [record], defaults: { profiles, active: "local", localPin: name === "local" ? "frontier" : undefined } };
|
|
146
|
+
assert.deepEqual(launchRouting("current", transcript), launchRouting("v1", transcript));
|
|
147
|
+
assert.deepEqual(launchRouting("current", transcript).routing, roles(profiles[name]));
|
|
148
|
+
const notice = replay("current", transcript).notice;
|
|
149
|
+
assert.ok(notice?.includes(`this session keeps "${name}" (${origin})`), "the inherited drift notice");
|
|
150
|
+
assert.equal(replay("v1", transcript).notice, undefined, "v1 finds no definition drift");
|
|
151
|
+
});
|
|
152
|
+
test(`follow mode routes a ${origin} startup bind as v1 does`, () => {
|
|
153
|
+
const transcript = { records: [record], defaults: { profiles, active: "local", foreignPin: "frontier" }, env: { GENTLE_PI_PROFILE_FOLLOW: "1" } };
|
|
154
|
+
assert.deepEqual(launchRouting("current", transcript), launchRouting("v1", transcript));
|
|
155
|
+
assert.deepEqual(launchRouting("current", transcript).foreignRouting, roles(profiles[name]));
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
test("current reads a startup-none clear as no session profile, routing as v1 while the defaults did not change", () => {
|
|
160
|
+
const transcript = { records: [userBind("local", LOCAL), createSessionProfileClear("none")], defaults: { profiles, foreignPin: "team" } };
|
|
161
|
+
const observed = replay("current", transcript);
|
|
162
|
+
assert.deepEqual([observed.kind, observed.label, observed.routing, observed.notice], ["inherited", undefined, undefined, undefined]);
|
|
163
|
+
assert.deepEqual(roles(observed.foreignRouting), roles(TEAM), "a foreign repository uses its own pin");
|
|
164
|
+
assert.deepEqual(observed, replay("v1", transcript));
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
test("gap (section 10): a startup-none clear resumed after an active profile appeared diverges from v1", () => {
|
|
168
|
+
const transcript = { records: [createSessionProfileClear("none")], defaults: { profiles, active: "frontier" } };
|
|
169
|
+
const current = replay("current", transcript);
|
|
170
|
+
assert.deepEqual([current.kind, current.label, current.routing], ["inherited", undefined, undefined], "current keeps no session profile");
|
|
171
|
+
const v1 = replay("v1", transcript);
|
|
172
|
+
assert.deepEqual([v1.kind, v1.label, v1.routing], ["inherited", "frontier", FRONTIER], "v1 routes to the new active profile");
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test("follow mode resolves the current defaults after a startup-none or legacy clear, as v1 does", () => {
|
|
176
|
+
for (const clear of [createSessionProfileClear("none"), createSessionProfileClear()]) {
|
|
177
|
+
const transcript = { records: [clear], defaults: { profiles, active: "frontier" }, env: { GENTLE_PI_PROFILE_FOLLOW: "1" } };
|
|
178
|
+
assert.deepEqual(replay("current", transcript), replay("v1", transcript));
|
|
179
|
+
assert.deepEqual(replay("current", transcript).routing, FRONTIER);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
test("current reads an explicit bind with or without a startup state exactly as v1", () => {
|
|
184
|
+
for (const startup of [{ origin: "global" as const, name: "team", modelProfiles: TEAM }, "none" as const, undefined]) {
|
|
185
|
+
const transcript = { records: [createSessionProfileBind("local", LOCAL, startup)], defaults: { profiles, active: "frontier", foreignPin: "team" } };
|
|
186
|
+
assert.deepEqual(replay("current", transcript), replay("v1", transcript));
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// Clear (section 10): the record sequences the A2 clear writes, by newest entry.
|
|
191
|
+
const teamStartup = { origin: "global" as const, name: "team", modelProfiles: TEAM };
|
|
192
|
+
const invalid = { kind: "bind", origin: "user", name: "" };
|
|
193
|
+
const clearTranscripts: Record<string, Transcript> = {
|
|
194
|
+
"known startup profile": { records: [createSessionProfileBind("local", LOCAL, teamStartup), createSessionProfileStartupBind("global", "team", TEAM)], defaults: { profiles, active: "team", foreignPin: "frontier" } },
|
|
195
|
+
"known no profile": { records: [createSessionProfileBind("local", LOCAL, "none"), createSessionProfileClear("none")], defaults: { profiles, foreignPin: "team" } },
|
|
196
|
+
"unknown startup state": { records: [userBind("local", LOCAL), createSessionProfileClear()], defaults: { profiles, active: "frontier" } },
|
|
197
|
+
"invalid newest entry, startup known": { records: [userBind("local", LOCAL), invalid, createSessionProfileStartupBind("global", "team", TEAM)], defaults: { profiles, active: "team" } },
|
|
198
|
+
"invalid newest entry, startup unknown": { records: [userBind("local", LOCAL), invalid, createSessionProfileClear()], defaults: { profiles, active: "frontier" } },
|
|
199
|
+
"follow mode": { records: [createSessionProfileBind("local", LOCAL, teamStartup), createSessionProfileClear()], defaults: { profiles, active: "frontier" }, env: { GENTLE_PI_PROFILE_FOLLOW: "1" } },
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
for (const [name, transcript] of Object.entries(clearTranscripts)) {
|
|
203
|
+
test(`a clear routes the same in v1 and current: ${name}`, () => {
|
|
204
|
+
assert.deepEqual(launchRouting("current", transcript), launchRouting("v1", transcript));
|
|
205
|
+
assert.equal(replay("current", transcript).authority, true, "the clear restores authority");
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
test("a clear back to a startup profile with an orchestrator raises no v1 definition drift notice", () => {
|
|
210
|
+
const transcript = clearTranscripts["known startup profile"]!;
|
|
211
|
+
const v1 = replay("v1", transcript);
|
|
212
|
+
assert.deepEqual([v1.notice, roles(v1.routing)], [undefined, roles(TEAM)]);
|
|
213
|
+
assert.deepEqual([replay("current", transcript).label, replay("current", transcript).notice], ["team", undefined]);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
test("a legacy clear after an explicit choice that carried its startup state freezes the defaults at resume, as v1", () => {
|
|
217
|
+
const startup = { origin: "global" as const, name: "team", modelProfiles: TEAM };
|
|
218
|
+
const transcript = { records: [createSessionProfileBind("local", LOCAL, startup), createSessionProfileClear()], defaults: { profiles, active: "frontier" } };
|
|
219
|
+
assert.deepEqual(replay("current", transcript), replay("v1", transcript));
|
|
220
|
+
assert.equal(replay("current", transcript).label, "frontier");
|
|
221
|
+
});
|
package/tests/shell-bar.test.ts
CHANGED
|
@@ -103,11 +103,11 @@ test("visual visibility hides only selected optional status segments", () => {
|
|
|
103
103
|
const settings = { ...DEFAULT_VISUAL_SETTINGS, visibility: { ...DEFAULT_VISUAL_SETTINGS.visibility, changes: false, modelDetails: false, usageCost: false } };
|
|
104
104
|
const data = model({ changes: { files: 2, added: 1, deleted: 1 } });
|
|
105
105
|
assert.doesNotMatch(renderShellBar(data, plainTheme, 160, settings).join(""), /gpt-5\.5|ctx|\$9\.49/);
|
|
106
|
-
assert.doesNotMatch(renderShellSidebarBar(data, plainTheme, 50, settings).join(""), /
|
|
106
|
+
assert.doesNotMatch(renderShellSidebarBar(data, plainTheme, 50, settings).join(""), /CHANGES|2 files/);
|
|
107
107
|
assert.doesNotMatch(renderShellHeaderBar(buildShellHeaderModel(data), plainTheme, 160, undefined, settings).text, /gpt-5\.5|ctx|\$9\.49|usage/);
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
-
test("Status keeps
|
|
110
|
+
test("Status keeps the Review section beside Changes while running jobs live in their own section", () => {
|
|
111
111
|
const data = model({ jobs: [
|
|
112
112
|
{ id: "job-2", label: "CI for PR 1860", startedAt: 2 },
|
|
113
113
|
{ id: "job-1", label: "Build runtime", startedAt: 1 },
|
|
@@ -115,10 +115,10 @@ test("Status keeps RDD beside structured groups while running jobs moved to thei
|
|
|
115
115
|
for (const width of [30, 60]) {
|
|
116
116
|
const lines = renderShellSidebarBar(data, plainTheme, width);
|
|
117
117
|
const text = lines.join("\n");
|
|
118
|
-
// Running jobs live in their own
|
|
119
|
-
//
|
|
120
|
-
assert.doesNotMatch(text, /
|
|
121
|
-
assert.match(text,
|
|
118
|
+
// Running jobs live in their own rail section; Status never prints
|
|
119
|
+
// them, so the two surfaces cannot duplicate one job.
|
|
120
|
+
assert.doesNotMatch(text, /JOBS|CI for PR 1860|Build runtime/);
|
|
121
|
+
assert.match(text, /▾ REVIEW/);
|
|
122
122
|
assert.ok(lines.every((line) => visibleWidth(line) <= width));
|
|
123
123
|
}
|
|
124
124
|
});
|
|
@@ -147,33 +147,33 @@ test("bottom-only and hidden below-input chrome retain a compact jobs count", (t
|
|
|
147
147
|
assert.ok(rows.every((line) => visibleWidth(line) <= 80));
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
test("Status
|
|
150
|
+
test("Status opens with Changes and shows no Review section without an active review", () => {
|
|
151
151
|
const lines = renderShellSidebarBar(model(), plainTheme, 60);
|
|
152
|
-
assert.match(lines[0],
|
|
153
|
-
assert.doesNotMatch(lines.slice(1).join("\n"),
|
|
152
|
+
assert.match(lines[0], /^▾ CHANGES/);
|
|
153
|
+
assert.doesNotMatch(lines.slice(1).join("\n"), /REVIEW/);
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
-
test("
|
|
156
|
+
test("the Review section lists the lifecycle state and the candidate scope", () => {
|
|
157
157
|
const lines = renderShellSidebarBar(model({ review: { state: "reviewing", scope: "first.ts +2 files" } }), plainTheme, 60);
|
|
158
|
-
assert.match(lines[0],
|
|
159
|
-
assert.match(lines.slice(1).join("\n"),
|
|
158
|
+
assert.match(lines[0], /^▾ CHANGES/);
|
|
159
|
+
assert.match(lines.slice(1).join("\n"), /▾ REVIEW[\s\S]*Reviewers running…[\s\S]*first\.ts \+2 files/);
|
|
160
160
|
});
|
|
161
161
|
|
|
162
162
|
test("review lifecycle block omits the scope line when the candidate scope is unknown", () => {
|
|
163
163
|
const known = renderShellSidebarBar(model({ review: { state: "checking", scope: "first.ts" } }), plainTheme, 60);
|
|
164
164
|
const unknown = renderShellSidebarBar(model({ review: { state: "checking", scope: REVIEW_SCOPE_UNAVAILABLE } }), plainTheme, 60);
|
|
165
165
|
const text = unknown.join("\n");
|
|
166
|
-
assert.match(text,
|
|
166
|
+
assert.match(text, /▾ REVIEW[\s\S]*Updating…/);
|
|
167
167
|
assert.doesNotMatch(text, /Candidate scope unavailable/);
|
|
168
168
|
assert.equal(unknown.length, known.length - 1);
|
|
169
169
|
});
|
|
170
170
|
|
|
171
171
|
test("rdd visibility hides only the review lifecycle block", () => {
|
|
172
172
|
const data = model({ review: { state: "reviewing", scope: "first.ts +2" }, changes: { files: 2, added: 1, deleted: 1 } });
|
|
173
|
-
assert.match(renderShellSidebarBar(data, plainTheme, 60, DEFAULT_VISUAL_SETTINGS).join("\n"),
|
|
173
|
+
assert.match(renderShellSidebarBar(data, plainTheme, 60, DEFAULT_VISUAL_SETTINGS).join("\n"), /▾ REVIEW[\s\S]*Reviewers running…/);
|
|
174
174
|
const hidden = renderShellSidebarBar(data, plainTheme, 60, { ...DEFAULT_VISUAL_SETTINGS, visibility: { ...DEFAULT_VISUAL_SETTINGS.visibility, rdd: false } }).join("\n");
|
|
175
|
-
assert.doesNotMatch(hidden,
|
|
176
|
-
assert.match(hidden, /
|
|
175
|
+
assert.doesNotMatch(hidden, /REVIEW|Reviewers running|first\.ts \+2 files/);
|
|
176
|
+
assert.match(hidden, /CHANGES[\s\S]*2 files/);
|
|
177
177
|
});
|
|
178
178
|
|
|
179
179
|
test("Status and review lifecycle block respect terminal width", () => {
|
|
@@ -181,7 +181,7 @@ test("Status and review lifecycle block respect terminal width", () => {
|
|
|
181
181
|
for (const review of [undefined, { state: "reviewing" as const, scope: "first.ts +2 files" }, { state: "approved" as const, scope: REVIEW_SCOPE_UNAVAILABLE }]) {
|
|
182
182
|
const lines = renderShellSidebarBar(model({ review }), plainTheme, width);
|
|
183
183
|
for (const line of lines) assert.ok(visibleWidth(line) <= width, `${width}: ${line}`);
|
|
184
|
-
if (width >= 20) assert.match(lines[0],
|
|
184
|
+
if (width >= 20) assert.match(lines[0], /^▾ CHANGES/);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
});
|
|
@@ -347,47 +347,91 @@ test("shellEnabled honors GENTLE_PI_SHELL=0", () => {
|
|
|
347
347
|
assert.equal(shellEnabled({ GENTLE_PI_SHELL: "false" }), false);
|
|
348
348
|
});
|
|
349
349
|
|
|
350
|
-
test("renderShellSidebarBar
|
|
351
|
-
const lines = renderShellSidebarBar(model(), taggedTheme,
|
|
352
|
-
assert.match(lines[0], /^<
|
|
353
|
-
assert.
|
|
354
|
-
assert.match(lines[lines.length - 1], /^<border>╰<\/border>/);
|
|
350
|
+
test("renderShellSidebarBar draws panel section headers, never a card frame", () => {
|
|
351
|
+
const lines = renderShellSidebarBar(model(), taggedTheme, 160);
|
|
352
|
+
assert.match(lines[0], /^<muted>▾<\/muted> <text>.*CHANGES.*<\/text>/);
|
|
353
|
+
assert.doesNotMatch(lines.join("\n"), /[╭╮╰╯│]/u);
|
|
355
354
|
});
|
|
356
355
|
|
|
357
|
-
test("
|
|
356
|
+
test("the rail Status orders Changes before Integrations and keeps the location out", () => {
|
|
358
357
|
const data = model({ changes: { files: 2, added: 7, deleted: 3 }, statuses: ["MCP connected"] });
|
|
359
358
|
const lines = renderShellSidebarBar(data, plainTheme, 46);
|
|
360
359
|
const text = lines.join("\n");
|
|
361
|
-
assert.equal(lines.filter((line) => line.startsWith("╭")).length, 1);
|
|
362
360
|
let previous = -1;
|
|
363
|
-
for (const heading of ["
|
|
361
|
+
for (const heading of ["CHANGES", "INTEGRATIONS"]) {
|
|
364
362
|
const index = text.indexOf(heading);
|
|
365
363
|
assert.ok(index > previous, heading);
|
|
366
364
|
previous = index;
|
|
367
365
|
}
|
|
368
|
-
assert.match(text, /2 files
|
|
366
|
+
assert.match(text, /2 files/);
|
|
367
|
+
assert.match(text, /\+7 −3/);
|
|
369
368
|
assert.match(text, /\/gentle:changes/);
|
|
370
|
-
assert.match(text, /
|
|
369
|
+
assert.match(text, /MCP connected/);
|
|
370
|
+
assert.doesNotMatch(text, /main|Branch|Project/, "location lives in the header row, once");
|
|
371
371
|
for (const width of [1, 8, 24, 46]) assert.ok(renderShellSidebarBar(data, plainTheme, width).every((line) => visibleWidth(line) <= width));
|
|
372
372
|
const empty = renderShellSidebarBar(model(), plainTheme, 46).join("\n");
|
|
373
|
-
assert.match(empty, /
|
|
374
|
-
assert.match(empty, /
|
|
373
|
+
assert.match(empty, /no captured changes/);
|
|
374
|
+
assert.match(empty, /INTEGRATIONS/);
|
|
375
375
|
});
|
|
376
376
|
|
|
377
|
-
test("
|
|
378
|
-
const
|
|
377
|
+
test("Integrations shows the effective agent profile without changing its count or status order", () => {
|
|
378
|
+
const data = model({
|
|
379
|
+
profile: "alpha (session)",
|
|
380
|
+
permission: { mode: "AUTO", detail: "confirm before action" },
|
|
381
|
+
statuses: ["compact status"],
|
|
382
|
+
integrations: ["MCP connected", "Engram ready"],
|
|
383
|
+
});
|
|
384
|
+
const rows = () => renderShellSidebarBar(data, plainTheme, 60).map((line) => line.trimEnd());
|
|
385
|
+
const initial = rows();
|
|
386
|
+
const at = initial.findIndex((line) => line.startsWith("▾ INTEGRATIONS"));
|
|
387
|
+
assert.match(initial[at]!, /INTEGRATIONS\s+3$/);
|
|
388
|
+
assert.deepEqual(initial.slice(at + 1), [
|
|
389
|
+
" Agent profile: alpha (session)",
|
|
390
|
+
" - permissions confirm before action",
|
|
391
|
+
" - MCP connected",
|
|
392
|
+
" - Engram ready",
|
|
393
|
+
]);
|
|
394
|
+
data.profile = "beta (repo)";
|
|
395
|
+
const updated = rows().join("\n");
|
|
396
|
+
assert.match(updated, /INTEGRATIONS[\s\S]*Agent profile: beta \(repo\)/);
|
|
397
|
+
assert.doesNotMatch(updated, /alpha \(session\)/);
|
|
398
|
+
|
|
399
|
+
data.profile = undefined;
|
|
400
|
+
const absent = rows();
|
|
401
|
+
const absentAt = absent.findIndex((line) => line.startsWith("▾ INTEGRATIONS"));
|
|
402
|
+
assert.match(absent[absentAt]!, /INTEGRATIONS\s+3$/);
|
|
403
|
+
assert.deepEqual(absent.slice(absentAt + 1), [" - permissions confirm before action", " - MCP connected", " - Engram ready"]);
|
|
404
|
+
for (const profile of ["", " \t\n", "\x1b[31m\x1b[0m"]) {
|
|
405
|
+
data.profile = profile;
|
|
406
|
+
assert.deepEqual(rows(), absent, "an empty sanitized profile leaves prior output unchanged");
|
|
407
|
+
}
|
|
408
|
+
const onlyProfile = renderShellSidebarBar(model({ profile: "solo (local)" }), plainTheme, 60).map((line) => line.trimEnd());
|
|
409
|
+
const onlyAt = onlyProfile.findIndex((line) => line.startsWith("▾ INTEGRATIONS"));
|
|
410
|
+
assert.match(onlyProfile[onlyAt]!, /INTEGRATIONS\s+none$/);
|
|
411
|
+
assert.deepEqual(onlyProfile.slice(onlyAt + 1), [" Agent profile: solo (local)", " no status reported"]);
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
test("the rail wraps and sanitizes long agent profiles, leaving the compact bar unchanged", () => {
|
|
415
|
+
const profile = `team-${"x".repeat(59)}\x1b[31m\nops\t界unit\x07\x1b[0m (repo)`;
|
|
379
416
|
const base = model();
|
|
380
417
|
const active = model({ profile });
|
|
381
|
-
|
|
382
|
-
|
|
418
|
+
const settings = { ...DEFAULT_VISUAL_SETTINGS, visibility: { ...DEFAULT_VISUAL_SETTINGS.visibility, changes: false } };
|
|
419
|
+
for (const width of [16, 24, 46]) {
|
|
420
|
+
const lines = renderShellSidebarBar(active, plainTheme, width, settings);
|
|
383
421
|
assert.ok(lines.every((line) => visibleWidth(line) <= width));
|
|
384
|
-
assert.
|
|
385
|
-
|
|
422
|
+
assert.ok(lines.every((line) => !/[\x00-\x1f\x7f-\x9f]/.test(line)), "profile controls must not reach the terminal");
|
|
423
|
+
const text = lines.slice(1).join("").replace(/\s/g, "");
|
|
424
|
+
assert.ok(text.includes(`Agentprofile:team-${"x".repeat(59)}ops界unit(repo)`), "the complete sanitized profile survives wrapping");
|
|
386
425
|
}
|
|
426
|
+
const ansiTheme = { ...plainTheme, fg: (role: string, value: string) => `\x1b[${role === "muted" ? 90 : 37}m${value}\x1b[0m` };
|
|
427
|
+
const colored = renderShellSidebarBar(active, ansiTheme, 24, settings);
|
|
428
|
+
assert.ok(colored.every((line) => visibleWidth(line) <= 24));
|
|
429
|
+
assert.match(colored.join(""), /\x1b\[90mAgent profile:\x1b\[0m/);
|
|
430
|
+
assert.ok(colored.slice(1).map(stripAnsi).join("").replace(/\s/g, "").includes(`Agentprofile:team-${"x".repeat(59)}ops界unit(repo)`));
|
|
387
431
|
assert.deepEqual(renderShellBar(active, plainTheme, 120), renderShellBar(base, plainTheme, 120));
|
|
388
432
|
});
|
|
389
433
|
|
|
390
|
-
test("
|
|
434
|
+
test("the rail Status drops model, usage and session identity, keeping Changes and Integrations", () => {
|
|
391
435
|
const usage = {
|
|
392
436
|
provider: "openai-codex",
|
|
393
437
|
plan: "pro",
|
|
@@ -396,17 +440,8 @@ test("sidebar Status card drops Model, Effort, Context, Cost and Usage, keeping
|
|
|
396
440
|
};
|
|
397
441
|
const data = model({ profile: "team", sessionName: "session", usage, changes: { files: 1, added: 2, deleted: 1 }, statuses: ["MCP connected"] });
|
|
398
442
|
const text = renderShellSidebarBar(data, plainTheme, 60).join("\n");
|
|
399
|
-
assert.doesNotMatch(text,
|
|
400
|
-
assert.
|
|
401
|
-
assert.doesNotMatch(text, /Effort/);
|
|
402
|
-
assert.doesNotMatch(text, /Context/);
|
|
403
|
-
assert.doesNotMatch(text, /Cost/);
|
|
404
|
-
assert.doesNotMatch(text, /\$9\.49/);
|
|
405
|
-
assert.doesNotMatch(text, /codex 5h/);
|
|
406
|
-
for (const heading of ["Status", "Project", "Changes", "Integrations"]) assert.match(text, new RegExp(heading));
|
|
407
|
-
assert.match(text, /Branch.*main/);
|
|
408
|
-
assert.match(text, /Session.*session/);
|
|
409
|
-
assert.match(text, /Profile.*team/);
|
|
443
|
+
for (const absent of [/Usage/, /Model/, /Effort/, /Context/, /Cost/, /\$9\.49/, /codex 5h/, /Branch/, /Session/]) assert.doesNotMatch(text, absent);
|
|
444
|
+
for (const heading of ["CHANGES", "INTEGRATIONS"]) assert.match(text, new RegExp(heading));
|
|
410
445
|
});
|
|
411
446
|
|
|
412
447
|
// The live header row above the fullscreen rail: identity on the left (brand,
|
|
@@ -521,6 +556,31 @@ test("renderShellHeaderBar shows every usage window with its gauge and the short
|
|
|
521
556
|
assert.equal(text.slice(usageSpan.start, usageSpan.end), "usage 5h ▰▰▱▱▱▱▱▱ 26% · week ▰▱▱▱▱▱▱▱ 12% · alt+u");
|
|
522
557
|
});
|
|
523
558
|
|
|
559
|
+
test("header retains effort without location when it fits beside full usage windows", () => {
|
|
560
|
+
const header = buildShellHeaderModel(model({ cwd: "~/work/" + "x".repeat(80), profile: "current", usage: USAGE_TWO_WINDOWS }));
|
|
561
|
+
for (const density of ["minimal", "compact", "comfortable"] as const) {
|
|
562
|
+
const settings = { ...DEFAULT_VISUAL_SETTINGS, density };
|
|
563
|
+
const right = "ctx ▰▰▰▰▱▱▱▱ 45% ⟡ $9.49 sub ⟡ usage 5h ▰▰▱▱▱▱▱▱ 26% · week ▰▱▱▱▱▱▱▱ 12% · alt+u";
|
|
564
|
+
const left = density === "minimal" ? "gpt-5.5 · medium" : "✿ Gentle Shell ⟡ gpt-5.5 · medium";
|
|
565
|
+
const width = visibleWidth(left) + 2 + visibleWidth(right);
|
|
566
|
+
const result = renderShellHeaderBar(header, plainTheme, width, "alt+u", settings);
|
|
567
|
+
assert.equal(result.text, left + " " + right, density);
|
|
568
|
+
assert.ok(result.usageSpan);
|
|
569
|
+
assert.equal(result.text.slice(result.usageSpan.start, result.usageSpan.end), right.slice(right.indexOf("usage")));
|
|
570
|
+
|
|
571
|
+
const narrower = renderShellHeaderBar(header, plainTheme, width - 1, "alt+u", settings).text;
|
|
572
|
+
assert.match(narrower, /gpt-5\.5/);
|
|
573
|
+
assert.doesNotMatch(narrower, /medium|current|~\/work/);
|
|
574
|
+
assert.ok(narrower.endsWith(right), "model-only fallback preserves full usage");
|
|
575
|
+
assert.equal(visibleWidth(narrower), width - 1);
|
|
576
|
+
|
|
577
|
+
const withoutEffort = renderShellHeaderBar({ ...header, effort: undefined }, plainTheme, width, "alt+u", settings).text;
|
|
578
|
+
assert.doesNotMatch(withoutEffort, /medium|current|~\/work/);
|
|
579
|
+
assert.ok(withoutEffort.endsWith(right));
|
|
580
|
+
assert.equal(visibleWidth(withoutEffort), width);
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
|
|
524
584
|
test("renderShellHeaderBar shows 'usage · <shortcut>' with no data, and drops the hint when the shortcut is disabled", () => {
|
|
525
585
|
const withHint = renderShellHeaderBar(buildShellHeaderModel(model({ usage: undefined })), plainTheme, 140, "alt+u");
|
|
526
586
|
assert.match(withHint.text, /usage · alt\+u$/);
|
|
@@ -573,16 +633,14 @@ test("renderShellHeaderRule paints one full-width line in the editor frame color
|
|
|
573
633
|
assert.equal(renderShellHeaderRule(plainTheme, -3), "", "negative widths clamp to an empty rule");
|
|
574
634
|
});
|
|
575
635
|
|
|
576
|
-
test("the
|
|
636
|
+
test("the rail Status is the same panel in the neon and float card styles", (t) => {
|
|
637
|
+
// Card styles dress transcript cards; the rail panel has its own surface.
|
|
577
638
|
const theme = withBackground(plainTheme);
|
|
578
|
-
const
|
|
639
|
+
const data = model({ review: { state: "reviewing", scope: "first.ts +2 files" } });
|
|
640
|
+
const neon = renderShellSidebarBar(data, theme, 60);
|
|
579
641
|
useCardStyle(t, CARD_STYLE.FLOAT);
|
|
580
|
-
|
|
581
|
-
assert.
|
|
582
|
-
assert.equal(stripAnsi(float[1]!), ` ▎ ✿ Status${" ".repeat(49)}`);
|
|
583
|
-
assert.equal(stripAnsi(float[2]!), ` ▎${" ".repeat(57)} `, "a blank separator row follows the header");
|
|
584
|
-
assertFloatRows(float, 60);
|
|
585
|
-
assert.deepEqual(float.slice(3, -1).map(bodyText), neon.slice(1, -1).map(bodyText));
|
|
642
|
+
assert.deepEqual(renderShellSidebarBar(data, theme, 60), neon);
|
|
643
|
+
assert.match(stripAnsi(neon[0]!), /^▾ CHANGES/);
|
|
586
644
|
});
|
|
587
645
|
|
|
588
646
|
// The float top bar has full-width painted padding above and below its
|
package/tests/shell-card.test.ts
CHANGED
|
@@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
|
|
2
2
|
import test from "node:test";
|
|
3
3
|
import { visibleWidth } from "@earendil-works/pi-tui";
|
|
4
4
|
import {
|
|
5
|
-
CARD_STYLE, CARD_TONE, cardAwaitingResult, cardRunningLine, cardStyle, cardTopRows, markCardResult, panelExtraRows, panelHeaderRow, renderCard, setCardStyle,
|
|
5
|
+
CARD_STYLE, CARD_TONE, cardAwaitingResult, cardRunningLine, cardStyle, cardTopRows, headingFits, markCardResult, panelExtraRows, panelHeaderRow, renderCard, setCardStyle,
|
|
6
6
|
type Card, type CardStyle, type CardTone,
|
|
7
7
|
} from "../lib/shell-card.ts";
|
|
8
8
|
import { stripAnsi } from "../lib/terminal-theme.ts";
|
|
@@ -493,3 +493,15 @@ test("a call card awaits its result until pi finishes the row or a result render
|
|
|
493
493
|
assert.equal(cardRunningLine(CARD_TONE.WARNING, plainTheme, 20), `│ running…${" ".repeat(8)} │`);
|
|
494
494
|
for (const width of [0, 1, 2, 3, 4, 5, 6, 7, 8]) assert.ok(visibleWidth(cardRunningLine(CARD_TONE.WARNING, plainTheme, width)) <= width);
|
|
495
495
|
});
|
|
496
|
+
|
|
497
|
+
test("headingFits says whether a composed subtitle still leaves room for the key hint", () => {
|
|
498
|
+
const card: Card = { title: "Agent status", subtitle: "explore", body: [], tone: CARD_TONE.INFO, glyph: "◎" };
|
|
499
|
+
const hint = "expand";
|
|
500
|
+
// cardTop needs title + glyph, the separator and subtitle, the frame columns and the hinted tail.
|
|
501
|
+
const needed = visibleWidth("◎ Agent status") + 3 + visibleWidth("explore") + 5 + visibleWidth(hint) + 2;
|
|
502
|
+
assert.equal(headingFits(card, hint, needed), true, "exactly enough columns still shows the hint");
|
|
503
|
+
assert.equal(headingFits(card, hint, needed - 1), false, "one column short is a no");
|
|
504
|
+
assert.equal(headingFits(card, undefined, needed - (visibleWidth(hint) + 2)), true, "without a hint exactly the head columns are enough");
|
|
505
|
+
assert.equal(headingFits(card, undefined, needed - (visibleWidth(hint) + 3)), false, "and one column less is still a no");
|
|
506
|
+
assert.equal(headingFits({ ...card, subtitle: undefined }, hint, needed - 9), true, "no subtitle frees its separator and columns");
|
|
507
|
+
});
|