fix(status-line): carry effective sessionAccent into SegmentContext and honor it for session_name
Address review feedback: the segment previously read the setting from ctx.session.settings, a second source of truth that could disagree with the component's effectiveSettings.sessionAccent and crashed lightweight test fixtures lacking a settings manager. Resolve the value once in #buildSegmentContext from the effective settings and pass it through SegmentContext.sessionAccent so the name segment and the gap-fill divider consume the same value. Add regression assertions for the enabled and disabled branches and a changelog entry.
This commit is contained in:
@@ -305,6 +305,9 @@
|
||||
- Fixed remote or LAN local-engine endpoints being ignored during model discovery: the llama.cpp and Ollama probes used timeouts tuned for loopback, so a host reached over the network could exceed them and return no models, while changing `OLLAMA_BASE_URL`/`OLLAMA_HOST` could keep reusing a fresh cache from the previous endpoint. Non-loopback hosts now get a generous discovery timeout, and Ollama cache rows are scoped to the normalized endpoint ([#7087](https://github.com/can1357/oh-my-pi/issues/7087)).
|
||||
- Fixed `omp install` failing extension validation for pi extensions that import `createEditTool` or `createWriteTool` (e.g. gentle-pi) — the legacy `@oh-my-pi/pi-coding-agent` shim exported the read/bash/grep/find/ls tool factories but omitted the edit and write ones, so a named import threw Bun's static "Export named X not found" error. Added `createEditTool`/`createEditToolDefinition` and `createWriteTool`/`createWriteToolDefinition` to match the upstream pi surface ([#7094](https://github.com/can1357/oh-my-pi/issues/7094)).
|
||||
- Fixed Python eval's loopback tool bridge being routed through macOS system HTTP proxies, which caused `parallel()` tool reads to fail with `ConnectionRefusedError` after a local proxy stopped.
|
||||
### Fixed
|
||||
|
||||
- The status-line `session_name` segment now honors the `statusLine.sessionAccent` setting: when disabled, the rendered session name falls back to the theme `accent` color instead of emitting the hash-derived session accent, matching the gap-fill divider behavior ([#7867](https://github.com/can1357/oh-my-pi/pull/7867)).
|
||||
|
||||
## [17.2.0] - 2026-07-30
|
||||
|
||||
|
||||
@@ -1556,6 +1556,7 @@ export class StatusLineComponent implements Component {
|
||||
return {
|
||||
session: this.session,
|
||||
focusedAgentId: this.#focusedAgentId,
|
||||
sessionAccent: this.#resolveSettings().sessionAccent !== false,
|
||||
activeRepo: activeRepoCache.activeRepo,
|
||||
width,
|
||||
options: segmentOptions ?? {},
|
||||
|
||||
@@ -592,7 +592,7 @@ const sessionNameSegment: StatusLineSegment = {
|
||||
const name = sessionManager?.getSessionName();
|
||||
if (!name) return { content: "", visible: false };
|
||||
|
||||
const accentEnabled = ctx.session.settings.get("statusLine.sessionAccent") !== false;
|
||||
const accentEnabled = ctx.sessionAccent !== false;
|
||||
const ansi = accentEnabled
|
||||
? (getSessionAccentAnsi(
|
||||
getSessionAccentHex(name, theme.getMajorThemeColorHexes(), theme.accentSurfaceLuminance),
|
||||
|
||||
@@ -52,6 +52,8 @@ export interface SegmentContext {
|
||||
session: AgentSession;
|
||||
/** Focused subagent id while the view is proxied at its session, undefined otherwise. */
|
||||
focusedAgentId?: string | undefined;
|
||||
/** Resolved `statusLine.sessionAccent` from the component's effective settings; undefined/false disables hash-derived accent colors. */
|
||||
sessionAccent?: boolean;
|
||||
activeRepo: ActiveRepoContext | null;
|
||||
width: number;
|
||||
options: StatusLineSegmentOptions;
|
||||
|
||||
@@ -26,14 +26,16 @@ afterAll(() => {
|
||||
});
|
||||
|
||||
/** Minimal SegmentContext factory — only path/git fields matter for these tests. */
|
||||
function createCtx(overrides?: { pathMaxLength?: number; branch?: string | null }): SegmentContext {
|
||||
function createCtx(overrides?: { pathMaxLength?: number; branch?: string | null; sessionName?: string; sessionAccent?: boolean }): SegmentContext {
|
||||
const hasName = overrides?.sessionName !== undefined;
|
||||
return {
|
||||
session: {
|
||||
state: {},
|
||||
isFastModeEnabled: () => false,
|
||||
modelRegistry: { isUsingOAuth: () => false },
|
||||
sessionManager: undefined,
|
||||
sessionManager: hasName ? { getSessionName: () => overrides.sessionName } : undefined,
|
||||
} as unknown as SegmentContext["session"],
|
||||
sessionAccent: overrides?.sessionAccent,
|
||||
width: 120,
|
||||
compactThinkingLevel: false,
|
||||
options: {
|
||||
@@ -160,6 +162,25 @@ describe("status line session accent", () => {
|
||||
// for its own text — we only care that the gap is not accent-painted.
|
||||
expect(border).not.toContain(`${ansi}${theme.boxRound.horizontal}`);
|
||||
});
|
||||
|
||||
it("renders the session name with the theme accent color when the accent is disabled", () => {
|
||||
const ansi = accentAnsi();
|
||||
expect(ansi).toBeDefined();
|
||||
const disabled = renderSegment("session_name", createCtx({ sessionName: "Named session", sessionAccent: false }));
|
||||
expect(disabled.visible).toBe(true);
|
||||
// Positive: the name uses the theme accent color, not the hash-derived session ANSI.
|
||||
expect(disabled.content).toContain(theme.getFgAnsi("accent"));
|
||||
// Negative: the hash-derived session ANSI must not appear for the name text.
|
||||
expect(disabled.content).not.toContain(ansi);
|
||||
});
|
||||
|
||||
it("still renders the session name with the hash-derived accent when enabled", () => {
|
||||
const ansi = accentAnsi();
|
||||
expect(ansi).toBeDefined();
|
||||
const enabled = renderSegment("session_name", createCtx({ sessionName: "Named session", sessionAccent: true }));
|
||||
expect(enabled.visible).toBe(true);
|
||||
expect(enabled.content).toContain(ansi);
|
||||
});
|
||||
});
|
||||
|
||||
describe("status line focused-agent dimming", () => {
|
||||
|
||||
Reference in New Issue
Block a user