ceulen 0.9.0 → 0.10.1

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/extensions/lib/registry.ts +8 -2
  3. package/extensions/lib/skill-path.test.ts +35 -0
  4. package/extensions/lib/skill-path.ts +22 -0
  5. package/extensions/modules/a2a/index.ts +2 -2
  6. package/extensions/modules/a2a/lib/config.ts +1 -1
  7. package/extensions/modules/a2a/lib/registry.ts +1 -1
  8. package/extensions/modules/composer/index.ts +19 -1
  9. package/extensions/modules/composer/lib/footer.ts +7 -7
  10. package/extensions/modules/composer/lib/shapes.ts +237 -112
  11. package/extensions/modules/composer/test/editor.test.ts +3 -3
  12. package/extensions/modules/composer/test/footer.test.ts +1 -1
  13. package/extensions/modules/composer/test/module.test.ts +8 -7
  14. package/extensions/modules/composer/test/screen.test.ts +10 -9
  15. package/extensions/modules/composer/test/shapes.test.ts +83 -61
  16. package/extensions/modules/config/index.ts +1 -0
  17. package/extensions/modules/config/test/renderTools.test.ts +1 -1
  18. package/extensions/modules/gh/configPanel.ts +82 -0
  19. package/extensions/modules/gh/index.ts +86 -0
  20. package/extensions/modules/gh/lib/gh-cli.ts +337 -0
  21. package/extensions/modules/gh/lib/ops.ts +771 -0
  22. package/extensions/modules/gh/test/gh.test.ts +280 -0
  23. package/extensions/modules/munin/index.ts +2 -2
  24. package/extensions/modules/plan/lib/plan-tools.ts +8 -0
  25. package/extensions/modules/ponytail/index.ts +2 -2
  26. package/extensions/modules/repair/index.ts +138 -0
  27. package/extensions/modules/repair/lib/guards.ts +1 -1
  28. package/extensions/modules/repair/lib/read-selector.ts +242 -0
  29. package/extensions/modules/repair/lib/settings.ts +1 -1
  30. package/extensions/modules/repair/test/read-selector.test.ts +198 -0
  31. package/extensions/modules/router/lib/provider.ts +13 -9
  32. package/extensions/modules/steering/configPanel.ts +8 -0
  33. package/extensions/modules/steering/index.ts +6 -0
  34. package/extensions/modules/steering/lib/settings.ts +6 -2
  35. package/extensions/modules/steering/lib/think.ts +66 -0
  36. package/extensions/modules/steering/test/harness.ts +5 -0
  37. package/extensions/modules/steering/test/settings.test.ts +2 -0
  38. package/extensions/modules/steering/test/think.test.ts +77 -0
  39. package/extensions/modules/subagent/lib/runner.ts +4 -2
  40. package/extensions/modules/ux/index.ts +2 -2
  41. package/extensions/modules/web/index.ts +39 -3
  42. package/extensions/modules/web/lib/a11y.ts +252 -0
  43. package/extensions/modules/web/lib/chrome.ts +1 -1
  44. package/extensions/modules/web/test/a11y.test.ts +218 -0
  45. package/extensions/modules/web/test/extension.test.ts +2 -2
  46. package/extensions/modules/web/test/hook.test.ts +2 -2
  47. package/extensions/modules/web/vendor/axe/LICENSE +362 -0
  48. package/extensions/modules/web/vendor/axe/LICENSE-3RD-PARTY.txt +66 -0
  49. package/extensions/modules/web/vendor/axe/README.md +19 -0
  50. package/extensions/modules/web/vendor/axe/axe.min.js +12 -0
  51. package/package.json +2 -2
  52. package/skills/web/SKILL.md +1 -0
@@ -9,12 +9,16 @@
9
9
  * FINAL line — so chrome can wrap each composed row (rails, caps, gutter,
10
10
  * fill) without touching text, wrapping, or cursor placement.
11
11
  *
12
- * Status: shapes that embed a status line in their chrome (band · box ·
13
- * claude · rule) render OMP's stock info split — left group (model · dir
14
- * (branch) · Generation Rate) flush-left, right group (`0.0%/1.0M` context
15
- * window) justified right on the band, docked on the rule chip. OMP's
16
- * standalone BOTTOM status bar has no twin here — pi's own footer already
17
- * sits under the editor for every shape.
12
+ * Status architecture = OMP's, per shape: band/box embed a POWERLINE status
13
+ * row (bg-filled left group `π > ⬢ model > 📁 dir > ⑂ git`, OMP's context
14
+ * gauge with embedded `N%`/window labels, session-title chip on box) — the
15
+ * band relocates the title away, exactly like OMP's band layout. claude and
16
+ * rule dock the session-title chip on the top rule and render the left group
17
+ * + context segment on a standalone BOTTOM bar (left of the closing rule for
18
+ * claude, after a spacer row for rule); pi/borderless/field/rail render the
19
+ * full standalone bottom bar (session title right-justified). pi's replaced
20
+ * footer keeps only the other extensions' statuses; line 1 (rateLine) stays
21
+ * ceulen's numeric block on every shape.
18
22
  */
19
23
 
20
24
  import { CustomEditor } from "@earendil-works/pi-coding-agent";
@@ -39,8 +43,11 @@ export interface BandData {
39
43
  pct?: number | null;
40
44
  /** Context window size in tokens, when known. */
41
45
  window?: number;
42
- /** Auto-compaction armed (pi's footer `(auto)` marker). */
46
+ /** Auto-compaction armed (drives the gauge's `┃` threshold marker and the
47
+ * context segment's `⟲` icon — OMP's auto marker). */
43
48
  autoCompact?: boolean;
49
+ /** Session title (OMP's session_name segment — the right group / rule chip). */
50
+ sessionName?: string;
44
51
  /** Generation Rate: last response's tok/s. */
45
52
  rate?: number;
46
53
  /** Provider quota windows from the usage module (e.g. `(router) R:59%/2H3M`). */
@@ -67,6 +74,8 @@ export interface ShapeTheme {
67
74
  dim: (s: string) => string;
68
75
  warn: (s: string) => string;
69
76
  error: (s: string) => string;
77
+ /** Clean-tree git branch / staged indicator (OMP's statusLineStaged). */
78
+ success: (s: string) => string;
70
79
  /** Filled surface (background + on-surface foreground), robust to nested
71
80
  * SGR resets — the cursor glyph emits one, which would otherwise drop the
72
81
  * fill from that point on (OMP's bgFill). */
@@ -81,6 +90,7 @@ export const IDENTITY_THEME: ShapeTheme = {
81
90
  dim: (s) => s,
82
91
  warn: (s) => s,
83
92
  error: (s) => s,
93
+ success: (s) => s,
84
94
  fill: (s) => s,
85
95
  inverse: (s) => s,
86
96
  };
@@ -104,6 +114,7 @@ export function shapeTheme(t: ThemeLike): ShapeTheme {
104
114
  dim: (s) => t.fg("dim" as never, s),
105
115
  warn: (s) => t.fg("warning" as never, s),
106
116
  error: (s) => t.fg("error" as never, s),
117
+ success: (s) => t.fg("success" as never, s),
107
118
  fill: surfacePainter(bg + onBg),
108
119
  inverse: (s) => t.inverse?.(s) ?? s,
109
120
  };
@@ -138,10 +149,17 @@ export interface ComposerShapeDef {
138
149
  sideWidth: number;
139
150
  /** Minimum editor paddingX this shape needs (host padding can raise it). */
140
151
  padX: number;
141
- /** True when the shape's top row embeds the status line (OMP's
142
- * statusAttachment). Non-embedding shapes surface the working spinner
143
- * through pi's native spinner-bearing rule instead. */
152
+ /** True when the shape's top chrome carries status (band/box powerline
153
+ * row, claude/rule chip); the rest surface the spinner through pi's
154
+ * native spinner-bearing rule and status on the standalone bottom bar. */
144
155
  embedsStatus?: boolean;
156
+ /** OMP's bottomBar: standalone status bar under the editor — `left` group
157
+ * only (claude/rule: the title rides the top rule), `full` (pi/borderless/
158
+ * field/rail: title right-justified), `none` (band/box: embedded top). */
159
+ bottomBar?: "left" | "full" | "none";
160
+ /** Blank spacer row between the editor and the standalone bottom bar
161
+ * (OMP's bottomBarGap — styles without bottom chrome need it). */
162
+ barGap?: boolean;
145
163
  /** First-row prompt gutter (OMP's defaultPromptGutter); continuation rows
146
164
  * get spaces so the text column stays aligned. */
147
165
  gutter?: string;
@@ -164,105 +182,139 @@ export function surfacePainter(prefix: string): (s: string) => string {
164
182
  return (s) => (prefix === "" ? s : prefix + s.replace(/\x1b\[0m/g, `\x1b[0m${prefix}`) + "\x1b[39m\x1b[49m");
165
183
  }
166
184
 
167
- /** Compact token counts for the context window — pi-footer/OMP parity
168
- * (`200k`, `1.0M`). */
169
- export function formatCompact(n: number): string {
185
+ /** Token/window figure in OMP's formatNumber shape (`9.5k`, `200K`, `1.0M`). */
186
+ export function formatNumberTokens(n: number): string {
170
187
  if (!Number.isFinite(n) || n < 0) return "0";
171
188
  if (n < 1000) return `${Math.round(n)}`;
172
- if (n < 1_000_000) return `${(n / 1000).toFixed(n < 10_000 ? 1 : 0)}k`;
173
- return `${(n / 1_000_000).toFixed(n < 10_000_000 ? 1 : 0)}M`;
189
+ if (n < 10_000) return `${trim1(n / 1000)}K`;
190
+ if (n < 1_000_000) return `${Math.round(n / 1000)}K`;
191
+ if (n < 10_000_000) return `${trim1(n / 1_000_000)}M`;
192
+ return `${Math.round(n / 1_000_000)}M`;
174
193
  }
175
194
 
195
+ const trim1 = (n: number): string => {
196
+ const s = n.toFixed(1);
197
+ return s.endsWith(".0") ? s.slice(0, -2) : s;
198
+ };
199
+
176
200
  /** Composer status icons — OMP's unicode glyph set, so every shape speaks the
177
201
  * same visual language: brand mark before the model, folder on the working
178
202
  * dir, branch glyph on the git segment, throughput on the Generation Rate. */
179
203
  export const ICONS = {
180
204
  brand: "π",
205
+ model: "⬢",
181
206
  folder: "📁",
182
207
  branch: "⑂",
208
+ context: "◫",
209
+ auto: "⟲",
210
+ threshold: "┃",
183
211
  throughput: "⚡",
184
212
  } as const;
185
213
 
186
- /** Context-window segment: `0.0%/1.0M` (one-decimal pct + compact window),
187
- * color-stepped like pi's footer (>70 warning, >90 error). */
214
+ /** Context-window segment: `◫ 2.1%/1M ⟲` (OMP's context_pct — icon, one-
215
+ * decimal pct + OMP-format window, auto-compact `⟲` when armed). Color
216
+ * steps at OMP's thresholds (>50 warning, >90 error). */
188
217
  function contextSegment(data: BandData, theme: ShapeTheme): string {
189
218
  const pct = typeof data.pct === "number" && Number.isFinite(data.pct) ? data.pct : undefined;
190
- const win = typeof data.window === "number" && data.window > 0 ? formatCompact(data.window) : undefined;
219
+ const win = typeof data.window === "number" && data.window > 0 ? formatNumberTokens(data.window) : undefined;
191
220
  if (pct === undefined && win === undefined) return "";
192
- const text = (pct !== undefined ? `${pct.toFixed(1)}%${win ? `/${win}` : ""}` : `${win}/?`) + (data.autoCompact ? " (auto)" : "");
193
- if (pct !== undefined && pct > 90) return theme.error(text);
194
- if (pct !== undefined && pct > 70) return theme.warn(text);
195
- return theme.dim(text);
221
+ const text = pct !== undefined ? `${pct.toFixed(1)}%${win ? `/${win}` : ""}` : `${win}/?`;
222
+ const color = pct !== undefined && pct > 90 ? theme.error : pct !== undefined && pct > 50 ? theme.warn : theme.dim;
223
+ const auto = data.autoCompact ? ` ${theme.dim(ICONS.auto)}` : "";
224
+ return `${theme.dim(ICONS.context)} ${color(text)}${auto}`;
196
225
  }
197
226
 
198
- /** Git segment: `⑂ main *3 +1 ?2` — branch + OMP's working-tree indicators
199
- * (`*` unstaged, `+` staged, `?` untracked). A dirty tree renders `warning`. */
227
+ /** Git segment: `⑂ main *3 +1 ?2` — branch + OMP's working-tree indicators,
228
+ * each in OMP's per-indicator color (`*` unstaged warn, `+` staged success,
229
+ * `?` untracked dim); the branch goes warning when the tree is dirty. */
200
230
  function gitSegment(data: BandData, theme: ShapeTheme): string {
201
231
  const branch = typeof data.branch === "string" && data.branch.trim() ? data.branch.trim() : "";
202
232
  const g = data.git;
203
233
  const dirty = !!g && g.staged + g.unstaged + g.untracked > 0;
204
- const parts: string[] = [];
205
- if (branch) parts.push(`${ICONS.branch} ${branch}`);
234
+ const ind: string[] = [];
206
235
  if (dirty && g) {
207
- if (g.unstaged > 0) parts.push(`*${g.unstaged}`);
208
- if (g.staged > 0) parts.push(`+${g.staged}`);
209
- if (g.untracked > 0) parts.push(`?${g.untracked}`);
236
+ if (g.unstaged > 0) ind.push(theme.warn(`*${g.unstaged}`));
237
+ if (g.staged > 0) ind.push(theme.success(`+${g.staged}`));
238
+ if (g.untracked > 0) ind.push(theme.dim(`?${g.untracked}`));
210
239
  }
211
- if (parts.length === 0) return "";
212
- return dirty ? theme.warn(parts.join(" ")) : theme.dim(parts.join(" "));
240
+ const branchText = branch ? `${ICONS.branch} ${branch}` : ind.length > 0 ? ICONS.branch : "";
241
+ if (!branchText) return "";
242
+ // OMP colors the BRANCH itself only when dirty; a clean branch rides the
243
+ // plain group color, and only the indicators carry their own colors.
244
+ return [dirty ? theme.warn(branchText) : branchText, ...ind].join(" ");
213
245
  }
214
246
 
215
- /** The status line's stock groups (OMP's segment split): left = identity
216
- * (model · dir · git · Generation Rate), right = context window.
217
- * Segments drop out when the session hasn't provided them — never wrong,
218
- * just shorter. Every segment carries its icon. */
247
+ /** The status line's stock groups. OMP's powerline layouts fill the LEFT
248
+ * group (brand · model · dir · git) with the context segment appended —
249
+ * the gauge absorbs the context figure at render time; the RIGHT group is
250
+ * the session title. `plain` bars join with ` · ` instead of powerline `>`. */
219
251
  export function statusSegments(
220
252
  data: BandData | undefined,
221
253
  theme: ShapeTheme,
222
254
  spinner?: string,
223
255
  ): { left: string; right: string } {
224
- return { left: identitySegments(data, theme, spinner).join(theme.dim(" · ")), right: data ? contextSegment(data, theme) : "" };
256
+ return {
257
+ left: identitySegments(data, theme, spinner).join(theme.dim(` ${POWERLINE_SEP} `)),
258
+ right: data?.sessionName?.trim() ? theme.accent(data.sessionName.trim()) : "",
259
+ };
225
260
  }
226
261
 
227
- /** The identity group as separate styled segments, brand first — callers that
228
- * must fit a fixed width shed WHOLE trailing segments (stats → rate → usage
229
- * → git → dir) rather than cutting one in half (OMP's overflow behavior). */
230
- export function identitySegments(data: BandData | undefined, theme: ShapeTheme, spinner?: string): string[] {
262
+ /** The identity segments WITHOUT the leading brand (model · dir · git) —
263
+ * the bottom bar appends the context segment before the brand joins. */
264
+ function identityList(data: BandData | undefined, theme: ShapeTheme): string[] {
231
265
  const identity: string[] = [];
232
- // Model cluster — model info only for now: usage windows + token stats are
233
- // dropped from the band at the user's request (restore = push usageSegment
234
- // + stats back into this cluster, see git history).
235
- const cluster: string[] = [];
236
- // Model segment: `(provider) model (level)` — provider prefix from the model
237
- // id (a router model's upstream slug), thinking level in parens, OMP's
238
- // model-segment shape (its `showThinkingLevel` option).
239
266
  const model = data?.model?.trim();
240
267
  if (model) {
241
- const provider = data?.provider?.trim();
242
268
  const level = data?.thinkingLevel?.trim();
243
- // Skip the prefix when the display name already carries it (direct
244
- // providers register names like `zai/glm-5.3-flash` under provider `zai`).
245
- const prefix = provider && !model.toLowerCase().startsWith(provider.toLowerCase() + "/") ? `(${provider}) ` : "";
246
- let label = prefix + model;
247
- if (level && level !== "off") label += ` (${level})`;
248
- cluster.push(theme.accent(label));
269
+ let label = `${ICONS.model} ${theme.accent(model)}`;
270
+ if (level && level !== "off") label += theme.dim(` · ${level}`);
271
+ identity.push(label);
249
272
  }
250
- if (cluster.length > 0) identity.push(cluster.join(theme.dim(" | ")));
251
273
  const cwd = data?.cwd?.trim();
252
274
  if (cwd) identity.push(theme.dim(`${ICONS.folder} ${cwd}`));
253
275
  const git = data ? gitSegment(data, theme) : "";
254
276
  if (git) identity.push(git);
277
+ return identity;
278
+ }
279
+
280
+ /** The identity group as separate styled segments, brand first — callers that
281
+ * must fit a fixed width shed WHOLE trailing segments (git → dir) rather
282
+ * than cutting one in half (OMP's overflow behavior). Model segment:
283
+ * `⬢ model · level` (OMP's model segment: icon, thinking level after OMP's
284
+ * dot separator). */
285
+ export function identitySegments(data: BandData | undefined, theme: ShapeTheme, spinner?: string): string[] {
286
+ const identity = identityList(data, theme);
255
287
  // Generation rate renders as its own right-justified line ABOVE the band
256
288
  // (OMP's throughline placement) — not a band segment.
257
289
  // The brand leads ONLY a group that exists (OMP's pi segment): with nothing
258
290
  // to identify, the band stays blank so the layout never shifts on startup.
259
291
  // While a turn runs the working spinner takes the brand slot.
260
- const lead = identity.length > 0 || spinner ? spinner ?? theme.accent(ICONS.brand) : undefined;
292
+ const lead = identity.length > 0 || spinner ? spinner ?? theme.dim(ICONS.brand) : undefined;
261
293
  return lead ? [lead, ...identity] : identity;
262
294
  }
263
295
 
296
+ /** Powerline separator + soft cap glyphs (OMP's `powerline-thin` / band cap;
297
+ * the unicode fallbacks — the nerd-font private-use glyphs are terminal-
298
+ * specific, and the ascii twins render everywhere). */
299
+ const POWERLINE_SEP = ">";
300
+ /** OMP's band soft cap (`sep.powerlineCapLeft`) — empty in the unicode/ascii
301
+ * symbol sets (only the nerd set has \ue0b6), so the band starts flush. */
302
+ const BAND_CAP = "";
303
+ /** Cells reserved ahead of the left group so the gauge keeps room for its
304
+ * embedded `─N% ┃ ─window` labels (OMP's embeddedContextGaugeMinWidth). */
305
+ const GAUGE_RESERVE = 14;
306
+
307
+ /** Fill a styled group for the powerline row: OMP's bg-filled group text —
308
+ * ` seg > seg > seg ` — padded one cell each side, background preserved
309
+ * across the nested SGR resets the styled segments carry. */
310
+ function powerlineGroup(segs: readonly string[], theme: ShapeTheme): string {
311
+ if (segs.length === 0) return "";
312
+ const joined = segs.join(theme.dim(` ${POWERLINE_SEP} `));
313
+ return theme.fill(` ${joined} `);
314
+ }
315
+
264
316
  /** One composed status line: left flush-left, right justified right. Over-
265
- * budget, the LEFT group yields first (OMP's priority — the context window
317
+ * budget, the LEFT group yields first (OMP's priority — the session title
266
318
  * stays); the right group is truncated only when it alone overflows. */
267
319
  export function composeStatus(left: string, right: string, w: number): string {
268
320
  const rw = visibleWidth(right);
@@ -280,7 +332,7 @@ function rule(w: number, th: ShapeTheme): string {
280
332
  return th.border("─".repeat(Math.max(0, w)));
281
333
  }
282
334
 
283
- /** Rule carrying pi's native scroll indicator (` ↑ N more `), centered. */
335
+ /** Rule carrying pi's scroll indicator (` ↑ N more `), centered. */
284
336
  function ruleWithScroll(w: number, hidden: number, th: ShapeTheme): string {
285
337
  if (hidden > 0) {
286
338
  const label = ` ↑ ${hidden} more `;
@@ -293,47 +345,108 @@ function ruleWithScroll(w: number, hidden: number, th: ShapeTheme): string {
293
345
  return rule(w, th);
294
346
  }
295
347
 
296
- /** Right-docked status chip on a rule (OMP's renderTopRule: left fill, status
297
- * at the right edge, one rule cell after it). */
348
+ /** Context-reactive gauge (OMP's #buildContextGaugeFill): accent used-portion,
349
+ * border remainder; the rounded `N%` label rides just past the used cells,
350
+ * the `┃` marks pi's auto-compaction threshold position (window − 16384
351
+ * reserve) when armed, and the window figure sits at the far right edge. */
352
+ function gaugeFill(w: number, data: BandData | undefined, theme: ShapeTheme): string {
353
+ const pct = typeof data?.pct === "number" && Number.isFinite(data.pct) ? Math.min(100, Math.max(0, data.pct)) : null;
354
+ const win = typeof data?.window === "number" && data.window > 0 ? formatNumberTokens(data.window) : undefined;
355
+ const windowLabel = win ?? "";
356
+ const percentLabel = pct === null ? "" : `${Math.round(pct)}%`;
357
+ const windowStart = windowLabel ? Math.max(1, w - windowLabel.length - 1) : -1;
358
+ const scale = windowStart >= 0 ? windowStart : w;
359
+ const usedCount = Math.min(scale, Math.max(1, Math.round(((pct ?? 0) / 100) * scale)));
360
+ const percentStart = percentLabel ? Math.min(Math.max(1, scale - percentLabel.length - 1), Math.max(1, usedCount)) : -1;
361
+ // pi's compaction fires at contextWindow − reserveTokens (16384 default).
362
+ const thresholdIdx =
363
+ data?.autoCompact && w >= 8 && data.window ? Math.min(scale - 1, Math.max(0, Math.round(((data.window - 16384) / data.window) * scale))) : -1;
364
+ let out = "";
365
+ for (let i = 0; i < w; i++) {
366
+ if (percentStart >= 0 && i >= percentStart && i < percentStart + percentLabel.length) out += theme.accent(percentLabel[i - percentStart]!);
367
+ else if (i === thresholdIdx && (percentStart < 0 || i < percentStart || i >= percentStart + percentLabel.length)) out += theme.dim(ICONS.threshold);
368
+ else if (windowStart >= 0 && i >= windowStart) out += i < windowStart + windowLabel.length ? theme.dim(windowLabel[i - windowStart]!) : theme.dim("─");
369
+ else out += i < usedCount ? theme.accent("─") : theme.border("─");
370
+ }
371
+ return out;
372
+ }
373
+
374
+ /** Left group the gauge layouts shed whole trailing segments from
375
+ * (stats → git → dir), never a half segment. */
376
+ function shedSegments(segs: readonly string[], theme: ShapeTheme, budget: number): string[] {
377
+ const sep = visibleWidth(theme.dim(` ${POWERLINE_SEP} `));
378
+ const width = (n: number) => segs.slice(0, n).reduce((a, s) => a + visibleWidth(s), 0) + sep * Math.max(0, n - 1);
379
+ let keep = segs.length;
380
+ while (keep > 1 && width(keep) > budget) keep--;
381
+ return width(keep) > budget ? [] : segs.slice(0, keep);
382
+ }
383
+
384
+ /** Right-docked session-title chip on a rule (OMP's renderTopRule: left
385
+ * fill, chip near the right edge, one rule cell after it). */
298
386
  function topRuleChip(c: ShapeCtx): string {
299
- const { w, theme } = c;
300
- const { left, right } = statusSegments(c.data, theme, c.spinner);
301
- // The chip is the compact `left · right` join — full-width justification is
302
- // the band's job, not a right-docked chip's.
303
- const status = [left, right].filter(Boolean).join(theme.dim(" · "));
304
- if (visibleWidth(status) > 0 && w > 2) {
305
- const content = visibleWidth(status) > w - 2 ? truncateToWidth(status, w - 2, "…") : status;
387
+ const { w, theme, data } = c;
388
+ const title = data?.sessionName?.trim() ? theme.accent(data.sessionName.trim()) : "";
389
+ if (visibleWidth(title) > 0 && w > 2) {
390
+ const content = visibleWidth(title) > w - 2 ? truncateToWidth(title, w - 2, "…") : title;
306
391
  return theme.border("─".repeat(Math.max(0, w - visibleWidth(content) - 1))) + content + theme.border("─");
307
392
  }
308
393
  return ruleWithScroll(w, c.hidden, theme);
309
394
  }
310
395
 
311
- /** Flush soft-capped status band (no frame). Reserved row: blank when the
312
- * status has nothing to show yet, so the layout never shifts. */
396
+ /** Flush soft-capped powerline band (OMP's band layout, minus the session
397
+ * title it relocates): filled left group, context-reactive gauge to the
398
+ * right edge. Reserved blank row until the status has anything to show. */
313
399
  function bandTop(c: ShapeCtx): string {
314
- const { w, theme } = c;
315
- const segs = identitySegments(c.data, theme, c.spinner);
316
- const right = c.data ? contextSegment(c.data, theme) : "";
317
- const cap = theme.accent("╭─");
318
- const scroll = c.hidden > 0 ? theme.border(` ↑${c.hidden} `) : "";
319
- const budget = Math.max(1, w - visibleWidth(cap) - visibleWidth(scroll));
320
- if (segmentsWidth(segs, theme) === 0 && right === "") return ""; // reserved blank row until data arrives
321
- // The fill covers the STATUS CHIP only (OMP's band: the chip ends where the
322
- // identity does; the context figure floats right on the bare prompt
323
- // surface). A full-width fill reads as a title bar, not a status band.
324
- const rw = visibleWidth(right);
325
- const maxLeft = Math.max(0, budget - rw);
326
- // Fit by shedding WHOLE trailing segments (stats → rate → usage → git →
327
- // dir) — never half a segment. The context figure is reserved in full: it is
328
- // the one
329
- // figure worth keeping whole, and clipping it defeats the window display.
400
+ const { w, theme, data } = c;
401
+ const segs = identitySegments(data, theme, c.spinner);
402
+ const context = data ? contextSegment(data, theme) : "";
403
+ if (segs.length === 0 && context === "") return ""; // reserved blank row until data arrives
404
+ const budget = Math.max(0, w - visibleWidth(BAND_CAP) - GAUGE_RESERVE);
405
+ const left = powerlineGroup(shedSegments(segs, theme, budget), theme);
406
+ const body = Math.max(0, w - visibleWidth(BAND_CAP) - visibleWidth(left));
407
+ return left + gaugeFill(body, data, theme);
408
+ }
409
+
410
+ /** Rounded box top: `╭─ left …gauge… title ─╮` — the powerline row embedded
411
+ * in the border (OMP's box + getTopBorder, session-title chip on the right). */
412
+ function boxTop(c: ShapeCtx): string {
413
+ const { w, theme, data } = c;
414
+ const inner = Math.max(0, w - 2);
415
+ const segs = identitySegments(data, theme, c.spinner);
416
+ const title = data?.sessionName?.trim() ? theme.accent(data.sessionName.trim()) : "";
417
+ if (segs.length === 0 && !title) return theme.border("╭" + "─".repeat(inner) + "╮");
418
+ const titleBlock = title ? ` ${title} ` : "";
419
+ // `╭─` + content + `─╮` = w ⇒ the content budget is inner - 2; the closing
420
+ // dash before `╮` is unconditional (OMP's ` omp ─┐`).
421
+ const body = Math.max(0, inner - 2);
422
+ const gauge = Math.min(Math.max(8, Math.floor(inner / 5)), Math.max(8, body - visibleWidth(titleBlock) - 24));
423
+ const budget = Math.max(0, body - gauge - visibleWidth(titleBlock));
424
+ let left = powerlineGroup(shedSegments(segs, theme, budget), theme);
425
+ if (visibleWidth(left) > budget) left = truncateToWidth(left, budget, "…");
426
+ const gap = Math.max(0, body - visibleWidth(left) - visibleWidth(titleBlock));
427
+ return theme.border("╭─") + left + gaugeFill(gap, data, theme) + titleBlock + theme.border("─╮");
428
+ }
429
+
430
+ /** Standalone bottom status bar (OMP's renderBottomBar): plain ` · `-joined
431
+ * groups — left group + context segment flush-left, session title right-
432
+ * justified. `groups: "left"` drops the title (claude/rule: it's on the chip). */
433
+ export function bottomBar(c: ShapeCtx, groups: "left" | "full"): string {
434
+ const { w, theme, data } = c;
435
+ const identity = identityList(data, theme);
436
+ const context = data ? contextSegment(data, theme) : "";
437
+ const rest = context ? [...identity, context] : identity;
438
+ const title = groups === "full" && data?.sessionName?.trim() ? theme.accent(data.sessionName.trim()) : "";
439
+ if (rest.length === 0 && !title) return "";
440
+ const lead = rest.length > 0 || c.spinner ? c.spinner ?? theme.dim(ICONS.brand) : undefined;
441
+ const segs = lead ? [lead, ...rest] : rest;
442
+ const sep = theme.dim(" · ");
443
+ const right = title;
444
+ const rw = visibleWidth(right) + (right ? 1 : 0);
330
445
  let keep = segs.length;
331
- while (keep > 1 && segmentsWidth(segs.slice(0, keep), theme) + 2 > maxLeft) keep--;
332
- const left = segmentsWidth(segs.slice(0, keep), theme) + 2 > maxLeft ? "" : segs.slice(0, keep).join(theme.dim(" · "));
333
- if (left === "" && right === "") return "";
334
- // ` text ` — the padding IS the separation from the context figure.
335
- const chip = left === "" ? "" : theme.fill(` ${left} `);
336
- return cap + chip + spaces(Math.max(0, maxLeft - visibleWidth(chip))) + right + scroll;
446
+ const width = (n: number) => segs.slice(0, n).reduce((a, s) => a + visibleWidth(s), 0) + visibleWidth(sep) * Math.max(0, n - 1);
447
+ while (keep > 1 && width(keep) + rw > w) keep--;
448
+ const left = width(keep) + rw > w ? "" : segs.slice(0, keep).join(sep);
449
+ return composeStatus(left, right, w);
337
450
  }
338
451
 
339
452
  /** Line 1 (OMP's Generation Rate placement): the numeric block split by the
@@ -360,26 +473,6 @@ export function rateLine(data: BandData | undefined, theme: ShapeTheme, w: numbe
360
473
  return composeStatus(leftText, right, w);
361
474
  }
362
475
 
363
- /** Width of a joined segment group (separators included). */
364
- function segmentsWidth(segs: readonly string[], theme: ShapeTheme): number {
365
- if (segs.length === 0) return 0;
366
- const sep = visibleWidth(theme.dim(" · "));
367
- return segs.reduce((n, s) => n + visibleWidth(s), 0) + sep * (segs.length - 1);
368
- }
369
-
370
- /** Rounded box top: `╭─ left …fill… right ─╮` (status embedded, OMP's box). */
371
- function boxTop(c: ShapeCtx): string {
372
- const { w, theme } = c;
373
- const inner = Math.max(0, w - 2);
374
- const { left, right } = statusSegments(c.data, theme, c.spinner);
375
- const status = composeStatus(left, right, Math.max(0, inner - 4));
376
- if (!status || visibleWidth(status) === 0) return theme.border("╭" + "─".repeat(inner) + "╮");
377
- const content = truncateToWidth(status, Math.max(1, inner - 4), "…");
378
- // `╭─ ` (3) + content + ` ` (1) + fill + `─` (1) + `╮` (1) = w ⇒ fill = inner - content - 4.
379
- const fill = "─".repeat(Math.max(0, inner - visibleWidth(content) - 4));
380
- return theme.border("╭─ ") + content + theme.border(" " + fill + "─" + "╮");
381
- }
382
-
383
476
  /** Current git branch for a cwd — reads `.git/HEAD` (walk-up; a `.git` FILE
384
477
  * is a linked worktree pointing at `gitdir:`), `"detached"` on a raw SHA,
385
478
  * null outside a repo. Sync by design: callers cache; never watches. */
@@ -445,6 +538,7 @@ export const SHAPES: ComposerShapeDef[] = [
445
538
  sideWidth: 0,
446
539
  padX: 0,
447
540
  embedsStatus: true,
541
+ bottomBar: "none",
448
542
  gutter: "╰─ ",
449
543
  top: bandTop,
450
544
  row: (c, text, o) =>
@@ -457,6 +551,7 @@ export const SHAPES: ComposerShapeDef[] = [
457
551
  sideWidth: 1,
458
552
  padX: 2,
459
553
  embedsStatus: true,
554
+ bottomBar: "none",
460
555
  top: boxTop,
461
556
  row: (c, text, o) => {
462
557
  if (!o.isLast) return c.theme.border("│") + text + c.theme.border("│");
@@ -474,6 +569,7 @@ export const SHAPES: ComposerShapeDef[] = [
474
569
  sideWidth: 0,
475
570
  padX: 0,
476
571
  embedsStatus: true,
572
+ bottomBar: "left",
477
573
  gutter: "❯ ",
478
574
  top: topRuleChip,
479
575
  bottom: (c) => ruleWithScroll(c.w, c.hidden, c.theme),
@@ -485,6 +581,7 @@ export const SHAPES: ComposerShapeDef[] = [
485
581
  description: "Framed horizontal rules with status line at bottom",
486
582
  sideWidth: 0,
487
583
  padX: 1,
584
+ bottomBar: "full",
488
585
  top: (c) => ruleWithScroll(c.w, c.hidden, c.theme),
489
586
  bottom: (c) => ruleWithScroll(c.w, c.hidden, c.theme),
490
587
  row: (_c, text) => text,
@@ -495,6 +592,10 @@ export const SHAPES: ComposerShapeDef[] = [
495
592
  description: "Clean prompt glyph with status line at bottom, no box borders",
496
593
  sideWidth: 0,
497
594
  padX: 0,
595
+ bottomBar: "full",
596
+ // OMP's borderless is bottomBarGap:false — the bar sits flush under the
597
+ // single prompt row.
598
+ barGap: false,
498
599
  gutter: "❯ ",
499
600
  row: (c, text, o) => (o.first ? c.theme.accent(c.gutter ?? "") : spaces(visibleWidth(c.gutter ?? ""))) + text,
500
601
  },
@@ -505,6 +606,8 @@ export const SHAPES: ComposerShapeDef[] = [
505
606
  sideWidth: 0,
506
607
  padX: 0,
507
608
  embedsStatus: true,
609
+ bottomBar: "left",
610
+ barGap: true,
508
611
  gutter: "❯ ",
509
612
  top: topRuleChip,
510
613
  row: (c, text, o) => (o.first ? c.theme.accent(c.gutter ?? "") : spaces(visibleWidth(c.gutter ?? ""))) + text,
@@ -515,6 +618,8 @@ export const SHAPES: ComposerShapeDef[] = [
515
618
  description: "Filled one-row field with accent end caps",
516
619
  sideWidth: 1,
517
620
  padX: 1,
621
+ bottomBar: "full",
622
+ barGap: true,
518
623
  row: (c, text) => c.theme.accent("▐") + c.theme.fill(text) + c.theme.accent("▌"),
519
624
  },
520
625
  {
@@ -523,6 +628,8 @@ export const SHAPES: ComposerShapeDef[] = [
523
628
  description: "Filled one-row field anchored by a single accent rail",
524
629
  sideWidth: 1,
525
630
  padX: 1,
631
+ bottomBar: "full",
632
+ barGap: true,
526
633
  row: (c, text) => c.theme.accent("▎") + c.theme.fill(text),
527
634
  },
528
635
  ];
@@ -562,10 +669,17 @@ export function previewShape(id: string, w: number, theme: ShapeTheme, data?: Ba
562
669
  const text = padRow(inner, spaces(shape.padX) + prompt + theme.inverse(" "));
563
670
  const lines: string[] = [];
564
671
  const top = shape.top?.(c);
565
- if (top !== undefined) lines.push(top);
672
+ if (top !== undefined && top !== "") lines.push(top);
566
673
  lines.push(shape.row(c, text, { first: true, isLast: true }));
567
674
  const bottom = shape.bottom?.(c);
568
675
  if (bottom !== undefined) lines.push(bottom);
676
+ if (shape.bottomBar && shape.bottomBar !== "none") {
677
+ const bar = bottomBar(c, shape.bottomBar);
678
+ if (bar) {
679
+ if (shape.barGap) lines.push("");
680
+ lines.push(bar);
681
+ }
682
+ }
569
683
  return lines.map((l) => truncateToWidth(l, w, "", true));
570
684
  }
571
685
 
@@ -628,6 +742,17 @@ export class ShapeEditor extends CustomEditor {
628
742
  content.forEach((r, i) => out.push(shape.row(c, padRow(inner, r), { first: i === 0, isLast: i === content.length - 1 })));
629
743
  const bottom = shape.bottom?.(c);
630
744
  if (bottom !== undefined) out.push(bottom);
745
+ // OMP's standalone bottom status bar (claude/rule: left group only;
746
+ // pi/borderless/field/rail: full), after its spacer row when the shape
747
+ // has no bottom chrome. Hidden while the autocomplete menu is up — the
748
+ // menu yields rows instead (OMP's autocomplete probe).
749
+ if (shape.bottomBar && shape.bottomBar !== "none" && acH === 0) {
750
+ const bar = bottomBar(c, shape.bottomBar);
751
+ if (bar) {
752
+ if (shape.barGap) out.push("");
753
+ out.push(bar);
754
+ }
755
+ }
631
756
  for (const r of acRows) out.push(shape.row(c, padRow(inner, r), { first: false, isLast: false }));
632
757
  return out.map((l) => truncateToWidth(l, width, "", true));
633
758
  } catch {
@@ -81,11 +81,11 @@ describe("ShapeEditor rendering", () => {
81
81
  assert.equal(borderless.length, 1, "borderless is a single row");
82
82
  });
83
83
 
84
- it("status-bearing shapes show the live status; band shows a blank reserved row without data", () => {
84
+ it("status-bearing shapes show the live status; band is absent without data", () => {
85
85
  const withData = rendered(editor("box", "hi", { model: "GLM-5.3", cwd: "ceulen", pct: 42 }), 50).map(plain);
86
- assert.ok(withData[0]!.includes("GLM-5.3") && withData[0]!.includes("42.0%"), withData[0]);
86
+ assert.ok(withData[0]!.includes("GLM-5.3") && withData[0]!.includes("42%"), withData[0]);
87
87
  const empty = rendered(editor("band"), 50).map(plain);
88
- assert.equal(empty[0]!.trim(), "", "band reserves its row (blank, full width)");
88
+ assert.ok(empty.every((l) => !l.includes("π")), "no status rows without data (the layout never shifts)");
89
89
  });
90
90
 
91
91
  it("keeps the working spinner visible while a turn runs", () => {
@@ -46,7 +46,7 @@ describe("session totals (band stats source)", () => {
46
46
  it("statsLine formats the band's token figures and is empty before any usage", () => {
47
47
  assert.equal(statsLine(EMPTY_TOTALS), "");
48
48
  const line = statsLine({ input: 12_000, output: 4_000, cacheRead: 100_000, cacheWrite: 2_000, cacheHitRate: 97.1 });
49
- assert.equal(line, "↑12k ↓4.0k R100k W2.0k CH97.1%");
49
+ assert.equal(line, "↑12K ↓4K R100K W2K CH97.1%");
50
50
  // Cost is NOT a line-1 figure (/usage only); cache-hit only when computed.
51
51
  const noCost: SessionTotals = { input: 1, output: 1, cacheRead: 0, cacheWrite: 0 };
52
52
  assert.equal(statsLine(noCost), "↑1 ↓1");
@@ -163,9 +163,10 @@ describe("applyShape dispatch", () => {
163
163
  const band = lines[1]!;
164
164
  assert.ok(band.includes("GLM"), band);
165
165
  assert.ok(band.includes("/tmp/somerepo"), `cwd shown: ${band}`);
166
- assert.ok(band.includes("10.0%/1.0k"), `context window shown: ${band}`);
166
+ // The gauge carries the context figure rounded (OMP's embedded percent) + window.
167
+ assert.ok(band.includes("10%") && band.includes("1K"), `context window shown: ${band}`);
167
168
  assert.ok(!band.includes("↑100 ↓50") && !band.includes("R:59%"), `stats/quota stay off the band: ${band}`);
168
- assert.ok(band.includes("10.0%/1.0k (auto)"), `auto-compact marker from pi settings: ${band}`);
169
+ assert.ok(band.includes("┃"), `auto-compact threshold marker from pi settings: ${band}`);
169
170
  resetGenRate();
170
171
  resetUsageItem();
171
172
  });
@@ -270,13 +271,13 @@ describe("module registration (core)", () => {
270
271
  (ctx as unknown as { __calls: { factory: (t: unknown, th: unknown, kb: unknown) => { render(w: number): string[] } }[] }).__calls.at(-1)!.factory;
271
272
  const render = (ed: { render(w: number): string[] }) => {
272
273
  const lines = ed.render(120).map((l) => l.replace(/\x1b\[[0-9;]*m/g, ""));
273
- return lines.find((l) => l.includes("π ·")) ?? lines[0]!;
274
+ return lines.find((l) => l.includes("π >")) ?? lines[0]!;
274
275
  };
275
276
  const ed1 = factoryOf()({ terminal: { rows: 30 }, requestRender() {} }, { borderColor: (s: string) => s }, {});
276
- assert.ok(render(ed1).includes("(high)"), "session_start ctx level");
277
+ assert.ok(render(ed1).includes("· high"), "session_start ctx level");
277
278
  await events.get("thinking_level_select")!({ type: "thinking_level_select", level: "max", previousLevel: "high" }, ctx);
278
279
  const ed2 = factoryOf()({ terminal: { rows: 30 }, requestRender() {} }, { borderColor: (s: string) => s }, {});
279
- assert.ok(render(ed2).includes("(max)"), "event updates the level live");
280
+ assert.ok(render(ed2).includes("· max"), "event updates the level live");
280
281
  });
281
282
  });
282
283
 
@@ -305,8 +306,8 @@ describe("core module contract", () => {
305
306
  it("nextDisabled excludes core modules; withEnableRow adds no row for them", async () => {
306
307
  const { nextDisabled, withEnableRow } = await import("../../config/index.js");
307
308
  // working = enabled set; nextDisabled lists the NOT-enabled non-core modules.
308
- assert.deepEqual(nextDisabled(new Set(["munin"])), ["zai", "ponytail", "subagent", "plan", "a2a", "todo", "repair", "serena", "fff", "web", "rules", "steering", "rtk"]);
309
- assert.deepEqual(nextDisabled(new Set(["router", "classifier", "ux", "munin", "usage", "ponytail", "subagent", "plan", "a2a", "todo", "repair", "serena", "fff", "web", "rules", "steering", "zai", "rtk", "config"])), [], "all-on → nothing disabled");
309
+ assert.deepEqual(nextDisabled(new Set(["munin"])), ["zai", "ponytail", "subagent", "plan", "a2a", "todo", "repair", "serena", "fff", "web", "rules", "gh", "steering", "rtk"]);
310
+ assert.deepEqual(nextDisabled(new Set(["router", "classifier", "ux", "munin", "usage", "ponytail", "subagent", "plan", "a2a", "todo", "repair", "serena", "fff", "web", "gh", "rules", "steering", "zai", "rtk", "config"])), [], "all-on → nothing disabled");
310
311
  for (const core of ["composer", "advisor", "router", "classifier", "usage", "ux", "config"]) {
311
312
  assert.ok(!nextDisabled(new Set()).includes(core), `core (${core}) is never disableable`);
312
313
  }