omp-fabric 1.27.2 → 1.28.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +1 -1
  3. package/dist/chunks/{chunk-KIH3KLZU.js → chunk-C2YMZNT5.js} +5 -5
  4. package/dist/chunks/chunk-C2YMZNT5.js.map +7 -0
  5. package/dist/chunks/{chunk-OJZNMROB.js → chunk-DKXNUCM2.js} +36 -50
  6. package/dist/chunks/chunk-DKXNUCM2.js.map +7 -0
  7. package/dist/chunks/chunk-K3OSK6AX.js +132 -0
  8. package/dist/chunks/chunk-K3OSK6AX.js.map +7 -0
  9. package/dist/chunks/{chunk-2BOZMRT5.js → chunk-LK66YHVL.js} +32 -49
  10. package/dist/chunks/chunk-LK66YHVL.js.map +7 -0
  11. package/dist/chunks/chunk-MIGBZN2K.js +81 -0
  12. package/dist/chunks/chunk-MIGBZN2K.js.map +7 -0
  13. package/dist/chunks/chunk-O337ZL5J.js +277 -0
  14. package/dist/chunks/chunk-O337ZL5J.js.map +7 -0
  15. package/dist/chunks/chunk-T76MXSP4.js +32 -0
  16. package/dist/chunks/chunk-T76MXSP4.js.map +7 -0
  17. package/dist/chunks/{chunk-NOZBB266.js → chunk-XZIQGFF7.js} +9 -13
  18. package/dist/chunks/chunk-XZIQGFF7.js.map +7 -0
  19. package/dist/chunks/{chunk-4XLJPEI4.js → chunk-ZJ7HHWW4.js} +20 -41
  20. package/dist/chunks/chunk-ZJ7HHWW4.js.map +7 -0
  21. package/dist/core/approval-controller.d.ts.map +1 -1
  22. package/dist/fabric-exec-tool.d.ts.map +1 -1
  23. package/dist/fabric-runtime-state.js +3 -1
  24. package/dist/fabric-runtime-state.js.map +1 -1
  25. package/dist/host-compatibility.d.ts +1 -1
  26. package/dist/index.js +169 -164
  27. package/dist/index.js.map +3 -3
  28. package/dist/ui/arc-group.d.ts +1 -1
  29. package/dist/ui/arc-group.d.ts.map +1 -1
  30. package/dist/ui/code-preview-shell.d.ts +2 -2
  31. package/dist/ui/code-preview-shell.d.ts.map +1 -1
  32. package/dist/ui/controller.d.ts.map +1 -1
  33. package/dist/ui/conversation-chrome.d.ts +1 -5
  34. package/dist/ui/conversation-chrome.d.ts.map +1 -1
  35. package/dist/ui/conversation-chrome.js +2 -2
  36. package/dist/ui/conversation-queue.d.ts +3 -2
  37. package/dist/ui/conversation-queue.d.ts.map +1 -1
  38. package/dist/ui/conversation-render.d.ts +19 -23
  39. package/dist/ui/conversation-render.d.ts.map +1 -1
  40. package/dist/ui/conversation.d.ts +7 -17
  41. package/dist/ui/conversation.d.ts.map +1 -1
  42. package/dist/ui/conversation.js +317 -318
  43. package/dist/ui/conversation.js.map +3 -3
  44. package/dist/ui/core-tool-render.d.ts +1 -1
  45. package/dist/ui/core-tool-render.d.ts.map +1 -1
  46. package/dist/ui/dashboard-detail.d.ts +4 -4
  47. package/dist/ui/dashboard-detail.d.ts.map +1 -1
  48. package/dist/ui/dashboard-fabric-graph.d.ts +1 -1
  49. package/dist/ui/dashboard-fabric-graph.d.ts.map +1 -1
  50. package/dist/ui/dashboard-presentation.d.ts +1 -1
  51. package/dist/ui/dashboard-presentation.d.ts.map +1 -1
  52. package/dist/ui/dashboard.d.ts +8 -8
  53. package/dist/ui/dashboard.d.ts.map +1 -1
  54. package/dist/ui/dashboard.js +207 -343
  55. package/dist/ui/dashboard.js.map +3 -3
  56. package/dist/ui/diff-background.d.ts +1 -1
  57. package/dist/ui/diff-background.d.ts.map +1 -1
  58. package/dist/ui/fabric-actor-delivery-selector.d.ts +4 -4
  59. package/dist/ui/fabric-actor-delivery-selector.d.ts.map +1 -1
  60. package/dist/ui/fabric-actor-tool-selector.d.ts +5 -6
  61. package/dist/ui/fabric-actor-tool-selector.d.ts.map +1 -1
  62. package/dist/ui/fabric-host-event-selector.d.ts +4 -4
  63. package/dist/ui/fabric-host-event-selector.d.ts.map +1 -1
  64. package/dist/ui/fabric-model-selector.d.ts +4 -6
  65. package/dist/ui/fabric-model-selector.d.ts.map +1 -1
  66. package/dist/ui/fabric-render.d.ts +6 -6
  67. package/dist/ui/fabric-render.d.ts.map +1 -1
  68. package/dist/ui/fabric-thinking-selector.d.ts +4 -7
  69. package/dist/ui/fabric-thinking-selector.d.ts.map +1 -1
  70. package/dist/ui/highlight.d.ts +2 -13
  71. package/dist/ui/highlight.d.ts.map +1 -1
  72. package/dist/ui/row-balance.d.ts +6 -6
  73. package/dist/ui/row-balance.d.ts.map +1 -1
  74. package/dist/ui/settings.d.ts +6 -3
  75. package/dist/ui/settings.d.ts.map +1 -1
  76. package/dist/ui/settings.js +234 -112
  77. package/dist/ui/settings.js.map +3 -3
  78. package/dist/ui/state-file-preview.d.ts +1 -1
  79. package/dist/ui/state-file-preview.d.ts.map +1 -1
  80. package/dist/ui/tui/input.d.ts +16 -0
  81. package/dist/ui/tui/input.d.ts.map +1 -0
  82. package/dist/ui/tui/rows.d.ts +24 -0
  83. package/dist/ui/tui/rows.d.ts.map +1 -0
  84. package/dist/ui/tui/select-list.d.ts +28 -0
  85. package/dist/ui/tui/select-list.d.ts.map +1 -0
  86. package/dist/ui/tui/settings-list.d.ts +38 -0
  87. package/dist/ui/tui/settings-list.d.ts.map +1 -0
  88. package/dist/ui/tui/text-field.d.ts +40 -0
  89. package/dist/ui/tui/text-field.d.ts.map +1 -0
  90. package/dist/ui/tui/view.d.ts +26 -0
  91. package/dist/ui/tui/view.d.ts.map +1 -0
  92. package/dist/ui/widget.d.ts +3 -3
  93. package/dist/ui/widget.d.ts.map +1 -1
  94. package/docs/interface.md +3 -3
  95. package/package.json +11 -11
  96. package/dist/chunks/chunk-2BOZMRT5.js.map +0 -7
  97. package/dist/chunks/chunk-4XLJPEI4.js.map +0 -7
  98. package/dist/chunks/chunk-G2IBGGBM.js +0 -42
  99. package/dist/chunks/chunk-G2IBGGBM.js.map +0 -7
  100. package/dist/chunks/chunk-KIH3KLZU.js.map +0 -7
  101. package/dist/chunks/chunk-NOZBB266.js.map +0 -7
  102. package/dist/chunks/chunk-OJZNMROB.js.map +0 -7
  103. package/dist/ui/symbol-theme.d.ts +0 -3
  104. package/dist/ui/symbol-theme.d.ts.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  FabricModelSelector
3
- } from "../chunks/chunk-OJZNMROB.js";
3
+ } from "../chunks/chunk-DKXNUCM2.js";
4
4
  import {
5
- ompSymbolTheme
6
- } from "../chunks/chunk-G2IBGGBM.js";
5
+ TextField
6
+ } from "../chunks/chunk-O337ZL5J.js";
7
7
  import {
8
8
  INHERIT_VALUE
9
9
  } from "../chunks/chunk-7BOAOKWH.js";
@@ -17,7 +17,7 @@ import {
17
17
  renderBoundedLines,
18
18
  renderCoreToolBody,
19
19
  spinnerFrame
20
- } from "../chunks/chunk-4XLJPEI4.js";
20
+ } from "../chunks/chunk-ZJ7HHWW4.js";
21
21
  import {
22
22
  isActiveStatus,
23
23
  orderAgentsByCreation
@@ -30,9 +30,21 @@ import {
30
30
  padToWidth,
31
31
  safeText,
32
32
  wrapPlainText
33
- } from "../chunks/chunk-KIH3KLZU.js";
33
+ } from "../chunks/chunk-C2YMZNT5.js";
34
34
  import "../chunks/chunk-IPI4UOTC.js";
35
35
  import "../chunks/chunk-DLXPTBPL.js";
36
+ import {
37
+ BlankRows,
38
+ SelectList,
39
+ Stack,
40
+ TextBlock
41
+ } from "../chunks/chunk-K3OSK6AX.js";
42
+ import {
43
+ decodeTerminalInput,
44
+ isAction,
45
+ isKey,
46
+ keyOf
47
+ } from "../chunks/chunk-T76MXSP4.js";
36
48
  import {
37
49
  FABRIC_ACTOR_HOST_EVENTS
38
50
  } from "../chunks/chunk-3LI7YO4M.js";
@@ -46,15 +58,7 @@ import {
46
58
  } from "../chunks/chunk-LMAVZN7J.js";
47
59
 
48
60
  // src/ui/dashboard.ts
49
- import "@oh-my-pi/pi-tui";
50
- import {
51
- Editor,
52
- getKeybindings as getKeybindings3,
53
- Key,
54
- matchesKey,
55
- truncateToWidth as truncateToWidth4,
56
- visibleWidth as visibleWidth4
57
- } from "@oh-my-pi/pi-tui";
61
+ import { truncate as truncate4, visibleWidth as visibleWidth4 } from "@oh-my-pi/pi-tui/text/width";
58
62
 
59
63
  // src/ui/topology.ts
60
64
  import { createHash } from "node:crypto";
@@ -988,12 +992,13 @@ var entityTail = (entity, now) => {
988
992
  };
989
993
 
990
994
  // src/ui/dashboard-detail.ts
991
- import { Markdown, truncateToWidth as truncateToWidth2, wrapTextWithAnsi, visibleWidth as visibleWidth2 } from "@oh-my-pi/pi-tui";
995
+ import { renderMarkdown } from "@oh-my-pi/pi-tui/text/markdown/render";
996
+ import { truncate as truncate2, visibleWidth as visibleWidth2, wrap } from "@oh-my-pi/pi-tui/text/width";
992
997
 
993
998
  // src/ui/state-file-preview.ts
994
999
  import fs from "node:fs";
995
1000
  import path from "node:path";
996
- import { truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui";
1001
+ import { truncate, visibleWidth } from "@oh-my-pi/pi-tui/text/width";
997
1002
  var MAX_FILE_BYTES = 64 * 1024;
998
1003
  var MAX_FILE_LINES = 240;
999
1004
  var CACHE_LIMIT = 64;
@@ -1069,51 +1074,23 @@ var renderStateFilePreview = (preview, theme, width, maxLines, invalidate) => {
1069
1074
  const digits = String(Math.max(1, shown.length)).length;
1070
1075
  const output = highlighted.map((line, index) => {
1071
1076
  const gutter = theme.fg("dim", `${String(index + 1).padStart(digits)} \u2502 `);
1072
- return truncateToWidth(gutter + line, width, "");
1077
+ return truncate(gutter + line, width, "");
1073
1078
  });
1074
1079
  if ((preview.truncated || preview.lines.length > shown.length) && output.length < maxLines) {
1075
1080
  const omitted = Math.max(0, preview.lines.length - shown.length);
1076
1081
  const label = omitted > 0 ? `\u2026 ${omitted}+ lines omitted` : "\u2026 file truncated";
1077
- output.push(truncateToWidth(theme.fg("dim", label), width, ""));
1082
+ output.push(truncate(theme.fg("dim", label), width, ""));
1078
1083
  }
1079
1084
  return output.filter((line) => visibleWidth(line) <= width);
1080
1085
  };
1081
1086
 
1082
1087
  // src/ui/dashboard-detail.ts
1083
- var isSymbolTheme = (value) => value !== null && typeof value === "object";
1084
- var transcriptMarkdownTheme = (theme, invalidate) => {
1085
- const rawSymbols = Reflect.get(theme, "symbols");
1086
- const symbols = isSymbolTheme(rawSymbols) ? rawSymbols : ompSymbolTheme;
1087
- const format = (color, text) => theme.fg(color, text);
1088
- const style = (name, text) => {
1089
- const fn = Reflect.get(theme, name);
1090
- return typeof fn === "function" ? fn.call(theme, text) : text;
1091
- };
1092
- return {
1093
- symbols,
1094
- heading: (text) => format("mdHeading", text),
1095
- link: (text) => format("mdLink", text),
1096
- linkUrl: (text) => format("mdLinkUrl", text),
1097
- code: (text) => format("mdCode", text),
1098
- codeBlock: (text) => format("mdCodeBlock", text),
1099
- codeBlockBorder: (text) => format("mdCodeBlockBorder", text),
1100
- quote: (text) => format("mdQuote", text),
1101
- quoteBorder: (text) => format("mdQuoteBorder", text),
1102
- hr: (text) => format("mdHr", text),
1103
- listBullet: (text) => format("mdListBullet", text),
1104
- bold: (text) => style("bold", text),
1105
- italic: (text) => style("italic", text),
1106
- underline: (text) => style("underline", text),
1107
- strikethrough: (text) => style("strikethrough", text),
1108
- highlightCode: (code, lang) => highlightCode(code, lang ?? "", invalidate) ?? code.split("\n").map((line) => format("mdCodeBlock", line))
1109
- };
1110
- };
1111
1088
  var TRANSCRIPT_EXPANDED_TOOL_LINES = 40;
1112
1089
  var TRANSCRIPT_STRUCTURED_LINES = 40;
1113
1090
  var safeMarkdownText = (value) => value.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "").replace(/\r\n?/g, "\n").replace(/[\u0000-\u0008\u000b-\u000c\u000e-\u001f\u007f-\u009f]/g, " ");
1114
1091
  var DashboardDetailRenderer = class {
1115
- constructor(tui, theme, snapshot, options) {
1116
- this.tui = tui;
1092
+ constructor(host, theme, snapshot, options) {
1093
+ this.host = host;
1117
1094
  this.theme = theme;
1118
1095
  this.snapshot = snapshot;
1119
1096
  this.agentTranscript = options.agentTranscript;
@@ -1130,7 +1107,7 @@ var DashboardDetailRenderer = class {
1130
1107
  actionHint = "";
1131
1108
  toolToggleHint = "";
1132
1109
  transcriptMarkdown = /* @__PURE__ */ new Map();
1133
- highlightInvalidate = () => this.tui.requestRender();
1110
+ highlightInvalidate = () => this.host.requestRender();
1134
1111
  agentTranscript;
1135
1112
  actorTranscript;
1136
1113
  codePreviewSettings;
@@ -1185,7 +1162,7 @@ var DashboardDetailRenderer = class {
1185
1162
  const kindLabel = entity.kind === "main" ? "main agent" : entity.kind === "peer" ? "peer session" : entity.kind === "meshParticipant" ? "project participant" : entity.kind === "meshTopic" ? "topic" : entity.kind === "meshRoute" ? "route" : entity.kind;
1186
1163
  const lines = [this.topBorder(width, `${kindLabel} \xB7 ${entity.label}${viewLabel}`)];
1187
1164
  const content = transcriptView ? this.transcriptLines(entity, innerWidth) : this.detailLines(entity, innerWidth, snapshot.now, snapshot.main.cwd ?? process.cwd());
1188
- const terminalRows = this.tui.terminal?.rows ?? process.stdout.rows ?? 28;
1165
+ const terminalRows = this.host.size().rows;
1189
1166
  const maxBody = Math.max(1, Math.min(24, terminalRows - 8 - actionLines.length));
1190
1167
  const maxScroll = Math.max(0, content.length - maxBody);
1191
1168
  this.detailMaxScroll = maxScroll;
@@ -1208,7 +1185,7 @@ var DashboardDetailRenderer = class {
1208
1185
  lines.push(this.row(width, this.theme.fg("muted", ` ${actionLine}`)));
1209
1186
  }
1210
1187
  lines.push(this.bottomBorder(width));
1211
- return lines.map((line) => truncateToWidth2(line, width, ""));
1188
+ return lines.map((line) => truncate2(line, width, ""));
1212
1189
  }
1213
1190
  transcriptLines(entity, width) {
1214
1191
  const transcript = this.transcriptFor(entity);
@@ -1239,14 +1216,10 @@ var DashboardDetailRenderer = class {
1239
1216
  statusGlyph(entry.status ?? "completed")
1240
1217
  );
1241
1218
  lines.push(
1242
- truncateToWidth2(
1243
- `${glyph} ${this.theme.fg(
1244
- entry.kind === "assistant" ? "accent" : "muted",
1245
- safeText(entry.label)
1246
- )}`,
1247
- width,
1248
- ""
1249
- )
1219
+ truncate2(`${glyph} ${this.theme.fg(
1220
+ entry.kind === "assistant" ? "accent" : "muted",
1221
+ safeText(entry.label)
1222
+ )}`, width, "")
1250
1223
  );
1251
1224
  if (!entry.text) continue;
1252
1225
  if (entry.kind === "assistant" || entry.kind === "user") {
@@ -1262,7 +1235,7 @@ var DashboardDetailRenderer = class {
1262
1235
  }
1263
1236
  for (const paragraph of entry.text.split("\n")) {
1264
1237
  const wrapped = wrapPlainText(paragraph, Math.max(1, width - 2), 1e4);
1265
- for (const line of wrapped) lines.push(truncateToWidth2(` ${line}`, width, ""));
1238
+ for (const line of wrapped) lines.push(truncate2(` ${line}`, width, ""));
1266
1239
  }
1267
1240
  }
1268
1241
  if (transcript.hasNewer) {
@@ -1287,14 +1260,10 @@ var DashboardDetailRenderer = class {
1287
1260
  invalidate: this.highlightInvalidate
1288
1261
  } : void 0;
1289
1262
  const title = context ? coreToolTitle(audit, this.theme, context) : null;
1290
- const headline = title ?? this.theme.fg("toolTitle", this.theme.bold(entry.toolName ?? entry.label));
1263
+ const headline = title ?? this.theme.fg("toolTitle", this.theme.style("strong", entry.toolName ?? entry.label));
1291
1264
  const collapsedSummary = !this.transcriptToolsExpanded && entry.text ? ` \xB7 ${safeText(entry.text).replace(/\s+/g, " ").trim()}` : "";
1292
1265
  const lines = [
1293
- truncateToWidth2(
1294
- `${padding}${glyph} ${headline}${this.theme.fg("dim", `${status}${collapsedSummary}`)}`,
1295
- width,
1296
- ""
1297
- )
1266
+ truncate2(`${padding}${glyph} ${headline}${this.theme.fg("dim", `${status}${collapsedSummary}`)}`, width, "")
1298
1267
  ];
1299
1268
  if (!this.transcriptToolsExpanded) return lines;
1300
1269
  const rendered = context ? renderCoreToolBody(audit, this.theme, {
@@ -1308,7 +1277,7 @@ var DashboardDetailRenderer = class {
1308
1277
  this.theme,
1309
1278
  this.codePreviewSettings?.diffIntensity ?? "off"
1310
1279
  ).render(Math.max(1, width - visibleWidth2(bodyPadding)))) {
1311
- lines.push(truncateToWidth2(`${bodyPadding}${row}`, width, ""));
1280
+ lines.push(truncate2(`${bodyPadding}${row}`, width, ""));
1312
1281
  }
1313
1282
  if (rendered.hidden > 0) {
1314
1283
  lines.push(this.theme.fg("dim", `${bodyPadding}\u2026 ${rendered.hidden} more lines`));
@@ -1323,7 +1292,7 @@ var DashboardDetailRenderer = class {
1323
1292
  Math.max(1, width - visibleWidth2(bodyPadding)),
1324
1293
  1e4
1325
1294
  )) {
1326
- lines.push(truncateToWidth2(`${bodyPadding}${row}`, width, ""));
1295
+ lines.push(truncate2(`${bodyPadding}${row}`, width, ""));
1327
1296
  }
1328
1297
  }
1329
1298
  if (entry.result !== void 0) {
@@ -1360,11 +1329,11 @@ var DashboardDetailRenderer = class {
1360
1329
  const yamlLines = yaml.split("\n");
1361
1330
  const shownYamlLines = yamlLines.slice(0, TRANSCRIPT_STRUCTURED_LINES);
1362
1331
  const highlighted = highlightCode(shownYamlLines.join("\n"), "yaml", this.highlightInvalidate) ?? shownYamlLines.map((line) => this.theme.fg("mdCodeBlock", line || " "));
1363
- const lines = [truncateToWidth2(`${padding}${this.theme.fg("dim", `${label}:`)}`, width, "")];
1332
+ const lines = [truncate2(`${padding}${this.theme.fg("dim", `${label}:`)}`, width, "")];
1364
1333
  const nestedPadding = `${padding} `;
1365
1334
  for (const row of highlighted) {
1366
- for (const wrapped of wrapTextWithAnsi(row, Math.max(1, width - visibleWidth2(nestedPadding)))) {
1367
- lines.push(truncateToWidth2(`${nestedPadding}${wrapped}`, width, ""));
1335
+ for (const wrapped of wrap(row, Math.max(1, width - visibleWidth2(nestedPadding)))) {
1336
+ lines.push(truncate2(`${nestedPadding}${wrapped}`, width, ""));
1368
1337
  if (lines.length > TRANSCRIPT_STRUCTURED_LINES) break;
1369
1338
  }
1370
1339
  if (lines.length > TRANSCRIPT_STRUCTURED_LINES) break;
@@ -1381,19 +1350,14 @@ var DashboardDetailRenderer = class {
1381
1350
  markdownLines(key, text, width, indent = 2) {
1382
1351
  const markdown = safeMarkdownText(text);
1383
1352
  if (!markdown.trim()) return [];
1353
+ const padding = " ".repeat(Math.max(0, indent));
1354
+ const contentWidth = Math.max(1, width - visibleWidth2(padding));
1384
1355
  let cached = this.transcriptMarkdown.get(key);
1385
- if (!cached || cached.text !== markdown) {
1356
+ if (!cached || cached.text !== markdown || cached.width !== contentWidth) {
1386
1357
  cached = {
1387
1358
  text: markdown,
1388
- component: new Markdown(
1389
- markdown,
1390
- 0,
1391
- 0,
1392
- transcriptMarkdownTheme(this.theme, () => {
1393
- this.transcriptMarkdown.delete(key);
1394
- this.tui.requestRender();
1395
- })
1396
- )
1359
+ width: contentWidth,
1360
+ rows: renderMarkdown(markdown, contentWidth, { theme: this.theme })
1397
1361
  };
1398
1362
  this.transcriptMarkdown.delete(key);
1399
1363
  this.transcriptMarkdown.set(key, cached);
@@ -1403,8 +1367,7 @@ var DashboardDetailRenderer = class {
1403
1367
  this.transcriptMarkdown.delete(oldest);
1404
1368
  }
1405
1369
  }
1406
- const padding = " ".repeat(Math.max(0, indent));
1407
- return cached.component.render(Math.max(1, width - visibleWidth2(padding))).map((line) => truncateToWidth2(`${padding}${line}`, width, ""));
1370
+ return cached.rows.map((line) => truncate2(`${padding}${line}`, width, ""));
1408
1371
  }
1409
1372
  detailLines(entity, width, now, cwd) {
1410
1373
  const lines = [];
@@ -1413,9 +1376,9 @@ var DashboardDetailRenderer = class {
1413
1376
  if (!text) return;
1414
1377
  const prefix = `${this.theme.fg("dim", `${label}:`)} `;
1415
1378
  const wrapped = wrapPlainText(text, Math.max(1, width - visibleWidth2(prefix)), 12);
1416
- if (wrapped[0]) lines.push(truncateToWidth2(prefix + wrapped[0], width));
1379
+ if (wrapped[0]) lines.push(truncate2(prefix + wrapped[0], width));
1417
1380
  for (const continuation of wrapped.slice(1)) {
1418
- lines.push(truncateToWidth2(" ".repeat(visibleWidth2(prefix)) + continuation, width));
1381
+ lines.push(truncate2(" ".repeat(visibleWidth2(prefix)) + continuation, width));
1419
1382
  }
1420
1383
  };
1421
1384
  const markdownField = (label, value, key) => {
@@ -1433,8 +1396,8 @@ var DashboardDetailRenderer = class {
1433
1396
  lines.push(this.theme.fg("dim", `${label}:`));
1434
1397
  const highlighted = highlightCode(yaml, "yaml", this.highlightInvalidate) ?? yaml.split("\n").map((line) => this.theme.fg("mdCodeBlock", line || " "));
1435
1398
  for (const highlightedLine of highlighted) {
1436
- for (const wrapped of wrapTextWithAnsi(highlightedLine, Math.max(1, width - 2))) {
1437
- lines.push(truncateToWidth2(` ${wrapped}`, width, ""));
1399
+ for (const wrapped of wrap(highlightedLine, Math.max(1, width - 2))) {
1400
+ lines.push(truncate2(` ${wrapped}`, width, ""));
1438
1401
  }
1439
1402
  }
1440
1403
  };
@@ -1497,7 +1460,7 @@ var DashboardDetailRenderer = class {
1497
1460
  this.theme,
1498
1461
  settings.diffIntensity
1499
1462
  ).render(Math.max(1, width - 2));
1500
- for (const row of body) lines.push(truncateToWidth2(` ${row}`, width, ""));
1463
+ for (const row of body) lines.push(truncate2(` ${row}`, width, ""));
1501
1464
  if (rendered.hidden > 0) {
1502
1465
  lines.push(this.theme.fg("muted", ` \u2026 ${rendered.hidden} more lines`));
1503
1466
  }
@@ -1528,7 +1491,7 @@ ${command}
1528
1491
  this.highlightInvalidate
1529
1492
  );
1530
1493
  if (diff) {
1531
- for (const line of diff) lines.push(truncateToWidth2(` ${line}`, width, ""));
1494
+ for (const line of diff) lines.push(truncate2(` ${line}`, width, ""));
1532
1495
  } else {
1533
1496
  structuredField("Edits", edits);
1534
1497
  }
@@ -1763,7 +1726,7 @@ ${command}
1763
1726
  renderNarrowDetail(width, snapshot, entity) {
1764
1727
  const transcriptView = (entity.kind === "agent" || entity.kind === "actor") && this.detailView === "transcript";
1765
1728
  const content = transcriptView ? this.transcriptLines(entity, width) : this.detailLines(entity, width, snapshot.now, snapshot.main.cwd ?? process.cwd());
1766
- const terminalRows = this.tui.terminal?.rows ?? process.stdout.rows ?? 28;
1729
+ const terminalRows = this.host.size().rows;
1767
1730
  const maxBody = Math.max(1, terminalRows - 2);
1768
1731
  this.detailMaxScroll = Math.max(0, content.length - maxBody);
1769
1732
  if (transcriptView && this.transcriptFollowing) {
@@ -1776,11 +1739,11 @@ ${command}
1776
1739
  }
1777
1740
  const title = `${entity.label}${transcriptView ? " \xB7 transcript" : ""}`;
1778
1741
  const hint = transcriptView ? `${this.transcriptToolToggleHint()} \xB7 g page top \xB7 G follow:${this.transcriptFollowing ? "on" : "off"}/tail \xB7 t summary \xB7 esc` : `${this.hasTranscript(entity) ? "t transcript \xB7 " : ""}esc`;
1779
- return [title, ...content.slice(this.detailScroll, this.detailScroll + maxBody), hint].map((line) => truncateToWidth2(line, width, "")).filter((line) => visibleWidth2(line) > 0);
1742
+ return [title, ...content.slice(this.detailScroll, this.detailScroll + maxBody), hint].map((line) => truncate2(line, width, "")).filter((line) => visibleWidth2(line) > 0);
1780
1743
  }
1781
1744
  topBorder(width, title) {
1782
1745
  const border = (value) => this.theme.fg("borderMuted", value);
1783
- const safeTitle = truncateToWidth2(safeText(title), Math.max(0, width - 6));
1746
+ const safeTitle = truncate2(safeText(title), Math.max(0, width - 6));
1784
1747
  const styledTitle = ` ${this.theme.fg("accent", safeTitle)} `;
1785
1748
  const remaining = Math.max(0, width - 2 - visibleWidth2(styledTitle));
1786
1749
  const left = Math.floor(remaining / 2);
@@ -1803,8 +1766,7 @@ ${command}
1803
1766
  };
1804
1767
 
1805
1768
  // src/ui/dashboard-fabric-graph.ts
1806
- import { Ellipsis as Ellipsis2 } from "@oh-my-pi/pi-tui";
1807
- import { truncateToWidth as truncateToWidth3, visibleWidth as visibleWidth3 } from "@oh-my-pi/pi-tui";
1769
+ import { truncate as truncate3, visibleWidth as visibleWidth3 } from "@oh-my-pi/pi-tui/text/width";
1808
1770
  var kindRank = {
1809
1771
  agent: 0,
1810
1772
  actor: 1,
@@ -2396,7 +2358,7 @@ var renderCanvas = (theme, layout, selectedEntityId, width, height, camera, anim
2396
2358
  if (style === "edge") return theme.fg("borderMuted", value);
2397
2359
  if (style === "dim") return theme.fg("dim", value);
2398
2360
  if (style === "muted") return theme.fg("muted", value);
2399
- if (style === "accent") return theme.fg("accent", theme.bold(value));
2361
+ if (style === "accent") return theme.fg("accent", theme.style("strong", value));
2400
2362
  if (style === "success") return theme.fg("success", value);
2401
2363
  if (style === "warning") return theme.fg("warning", value);
2402
2364
  if (style === "error") return theme.fg("error", value);
@@ -2415,12 +2377,12 @@ var renderCanvas = (theme, layout, selectedEntityId, width, height, camera, anim
2415
2377
  run += cell.char;
2416
2378
  }
2417
2379
  rendered += apply(style, run);
2418
- return truncateToWidth3(rendered, width, "");
2380
+ return truncate3(rendered, width, "");
2419
2381
  });
2420
2382
  };
2421
2383
  var wrapInspector = (theme, label, value, width) => {
2422
2384
  const clean = safeText(value);
2423
- const first = truncateToWidth3(clean, Math.max(1, width - label.length - 1), Ellipsis2.Unicode);
2385
+ const first = truncate3(clean, Math.max(1, width - label.length - 1));
2424
2386
  return [theme.fg("muted", `${label} ${first}`)];
2425
2387
  };
2426
2388
  var inspectorLines = (theme, entity, snapshot, run, width, height, invalidate) => {
@@ -2428,10 +2390,10 @@ var inspectorLines = (theme, entity, snapshot, run, width, height, invalidate) =
2428
2390
  const border = (value) => theme.fg("borderMuted", value);
2429
2391
  const content = [];
2430
2392
  if (entity) {
2431
- content.push(theme.fg("accent", theme.bold(truncateToWidth3(safeText(entity.label), inner - 2, Ellipsis2.Unicode))));
2393
+ content.push(theme.fg("accent", theme.style("strong", truncate3(safeText(entity.label), inner - 2))));
2432
2394
  content.push(colorStatus(theme, entity.status, `${statusGlyph(entity.status)} ${entity.kind} \xB7 ${entity.status}`));
2433
2395
  content.push("");
2434
- content.push(theme.fg("dim", truncateToWidth3(safeText(entityTail(entity, snapshot.now)), inner - 2, Ellipsis2.Unicode)));
2396
+ content.push(theme.fg("dim", truncate3(safeText(entityTail(entity, snapshot.now)), inner - 2)));
2435
2397
  if (entity.kind === "agent") {
2436
2398
  const agentRun = snapshot.runs.find((candidate) => candidate.id === entity.value.runId) ?? run;
2437
2399
  const phase = agentRun?.phases.find((candidate) => candidate.id === entity.value.phaseId);
@@ -2583,12 +2545,8 @@ var renderFabricTopologyPanel = ({
2583
2545
  animation.reducedMotion ? "reduced motion" : void 0,
2584
2546
  filter !== "all" ? `${entities.length}/${allEntities.length} ${filter}` : void 0
2585
2547
  ].filter((value) => Boolean(value)).join(" \xB7 ");
2586
- const graphLegend = padToWidth(theme.fg("dim", truncateToWidth3(legend, graphWidth, "")), graphWidth);
2587
- lines[0] = truncateToWidth3(
2588
- graphLegend + (inspectorWidth > 0 ? inspector[0] ?? "" : ""),
2589
- width,
2590
- ""
2591
- );
2548
+ const graphLegend = padToWidth(theme.fg("dim", truncate3(legend, graphWidth, "")), graphWidth);
2549
+ lines[0] = truncate3(graphLegend + (inspectorWidth > 0 ? inspector[0] ?? "" : ""), width, "");
2592
2550
  }
2593
2551
  const selectedPosition = selected ? layout.positions.get(selected.id) : void 0;
2594
2552
  return {
@@ -2617,7 +2575,7 @@ var directionalGraphTarget = (positions, currentId, direction) => {
2617
2575
  };
2618
2576
 
2619
2577
  // src/ui/fabric-host-event-selector.ts
2620
- import { Container, getKeybindings, Spacer, Text } from "@oh-my-pi/pi-tui";
2578
+ import { widgetKeyMatches } from "@oh-my-pi/pi-tui/term/keymap";
2621
2579
  var COMMON_HOST_EVENTS = [
2622
2580
  "input",
2623
2581
  "turn_end",
@@ -2666,53 +2624,51 @@ var EVENT_LABELS = {
2666
2624
  tool_execution_end: "tool execution completed",
2667
2625
  user_bash: "a user ! or !! shell command was submitted"
2668
2626
  };
2669
- var FabricHostEventSelector = class extends Container {
2627
+ var FabricHostEventSelector = class extends Stack {
2670
2628
  theme;
2671
2629
  onSelectCallback;
2672
2630
  onCancelCallback;
2673
- listContainer = new Container();
2631
+ listContainer = new Stack();
2674
2632
  enabled;
2675
2633
  selectedIndex = 0;
2676
- focused = false;
2677
2634
  constructor(options) {
2678
2635
  super();
2679
2636
  this.theme = options.theme;
2680
2637
  this.onSelectCallback = options.onSelect;
2681
2638
  this.onCancelCallback = options.onCancel;
2682
2639
  this.enabled = new Set(options.currentValue);
2683
- this.addChild(
2684
- new Text(
2640
+ this.add(
2641
+ new TextBlock(
2685
2642
  this.theme.fg(
2686
2643
  "muted",
2687
2644
  options.headerText ?? "Toggle the host events this actor subscribes to."
2688
- ),
2689
- 0,
2690
- 0
2645
+ )
2691
2646
  )
2692
2647
  );
2693
- this.addChild(new Spacer(1));
2694
- this.addChild(this.listContainer);
2695
- this.addChild(new Spacer(1));
2648
+ this.add(new BlankRows(1));
2649
+ this.add(this.listContainer);
2650
+ this.add(new BlankRows(1));
2696
2651
  this.updateList();
2697
2652
  }
2698
2653
  handleInput(keyData) {
2699
- const kb = getKeybindings();
2700
- if (kb.matches(keyData, "tui.select.up")) {
2654
+ const key = keyOf(keyData);
2655
+ if (!key) return;
2656
+ if (widgetKeyMatches(key, "select.up")) {
2701
2657
  this.selectedIndex = this.selectedIndex === 0 ? HOST_EVENT_ORDER.length - 1 : this.selectedIndex - 1;
2702
2658
  this.updateList();
2703
- } else if (kb.matches(keyData, "tui.select.down")) {
2659
+ } else if (widgetKeyMatches(key, "select.down")) {
2704
2660
  this.selectedIndex = this.selectedIndex === HOST_EVENT_ORDER.length - 1 ? 0 : this.selectedIndex + 1;
2705
2661
  this.updateList();
2706
- } else if (keyData === " ") {
2662
+ } else if (key.id === "space") {
2707
2663
  const event = HOST_EVENT_ORDER[this.selectedIndex];
2708
2664
  if (event) {
2709
2665
  if (this.enabled.has(event)) this.enabled.delete(event);
2710
2666
  else this.enabled.add(event);
2711
2667
  this.updateList();
2712
2668
  }
2713
- } else if (kb.matches(keyData, "tui.select.confirm")) {
2669
+ } else if (widgetKeyMatches(key, "select.confirm")) {
2714
2670
  this.onSelectCallback(HOST_EVENT_ORDER.filter((event) => this.enabled.has(event)));
2715
- } else if (kb.matches(keyData, "tui.select.cancel")) {
2671
+ } else if (widgetKeyMatches(key, "select.cancel")) {
2716
2672
  this.onCancelCallback();
2717
2673
  }
2718
2674
  }
@@ -2728,8 +2684,8 @@ var FabricHostEventSelector = class extends Container {
2728
2684
  );
2729
2685
  const endIndex = Math.min(startIndex + MAX_VISIBLE_HOST_EVENTS, total);
2730
2686
  if (startIndex > 0) {
2731
- this.listContainer.addChild(
2732
- new Text(this.theme.fg("dim", ` \u2191 ${startIndex} earlier events`), 0, 0)
2687
+ this.listContainer.add(
2688
+ new TextBlock(this.theme.fg("dim", ` \u2191 ${startIndex} earlier events`))
2733
2689
  );
2734
2690
  }
2735
2691
  for (let index = startIndex; index < endIndex; index++) {
@@ -2739,28 +2695,21 @@ var FabricHostEventSelector = class extends Container {
2739
2695
  const box = checked ? this.theme.fg("success", "[x]") : this.theme.fg("dim", "[ ]");
2740
2696
  const label = `${box} ${event} \xB7 ${this.theme.fg("muted", EVENT_LABELS[event] ?? event)}`;
2741
2697
  const line = selected ? `${this.theme.fg("accent", "\u2192 ")}${this.theme.fg("accent", label)}` : ` ${label}`;
2742
- this.listContainer.addChild(new Text(line, 0, 0));
2698
+ this.listContainer.add(new TextBlock(line));
2743
2699
  }
2744
2700
  if (endIndex < total) {
2745
- this.listContainer.addChild(
2746
- new Text(this.theme.fg("dim", ` \u2193 ${total - endIndex} later events`), 0, 0)
2701
+ this.listContainer.add(
2702
+ new TextBlock(this.theme.fg("dim", ` \u2193 ${total - endIndex} later events`))
2747
2703
  );
2748
2704
  }
2749
- this.listContainer.addChild(new Spacer(1));
2750
- this.listContainer.addChild(
2751
- new Text(this.theme.fg("muted", " space toggle \xB7 enter apply \xB7 esc cancel"), 0, 0)
2705
+ this.listContainer.add(new BlankRows(1));
2706
+ this.listContainer.add(
2707
+ new TextBlock(this.theme.fg("muted", " space toggle \xB7 enter apply \xB7 esc cancel"))
2752
2708
  );
2753
2709
  }
2754
2710
  };
2755
2711
 
2756
2712
  // src/ui/fabric-actor-delivery-selector.ts
2757
- import "@oh-my-pi/pi-tui";
2758
- import {
2759
- Container as Container2,
2760
- SelectList,
2761
- Spacer as Spacer2,
2762
- Text as Text2
2763
- } from "@oh-my-pi/pi-tui";
2764
2713
  var LAYOUT = {
2765
2714
  minPrimaryColumnWidth: 18,
2766
2715
  maxPrimaryColumnWidth: 34
@@ -2773,17 +2722,8 @@ var POLICIES = [
2773
2722
  { value: "followUp-active", label: "Follow-up \xB7 resume Main", description: "deliver after the run and start Main when idle", delivery: "followUp", triggerTurn: true },
2774
2723
  { value: "next-turn", label: "Next user turn", description: "defer until the next user prompt", delivery: "nextTurn", triggerTurn: false }
2775
2724
  ];
2776
- var selectListTheme = (theme) => ({
2777
- symbols: theme.symbols,
2778
- selectedPrefix: (text) => theme.fg("accent", text),
2779
- selectedText: (text) => theme.fg("accent", text),
2780
- description: (text) => theme.fg("muted", text),
2781
- scrollInfo: (text) => theme.fg("muted", text),
2782
- noMatch: (text) => theme.fg("muted", text)
2783
- });
2784
- var FabricActorDeliverySelector = class extends Container2 {
2725
+ var FabricActorDeliverySelector = class extends Stack {
2785
2726
  selectList;
2786
- focused = false;
2787
2727
  constructor(options) {
2788
2728
  super();
2789
2729
  const current = POLICIES.find(
@@ -2794,18 +2734,16 @@ var FabricActorDeliverySelector = class extends Container2 {
2794
2734
  label: `${policy.label}${policy.value === current ? " \u2713" : ""}`,
2795
2735
  description: policy.description
2796
2736
  }));
2797
- this.addChild(
2798
- new Text2(
2737
+ this.add(
2738
+ new TextBlock(
2799
2739
  options.theme.fg(
2800
2740
  "muted",
2801
2741
  options.headerText ?? "Choose how actor output enters Main and whether it starts a turn."
2802
- ),
2803
- 0,
2804
- 0
2742
+ )
2805
2743
  )
2806
2744
  );
2807
- this.addChild(new Spacer2(1));
2808
- this.selectList = new SelectList(items, items.length, selectListTheme(options.theme), LAYOUT);
2745
+ this.add(new BlankRows(1));
2746
+ this.selectList = new SelectList(items, items.length, options.theme, LAYOUT);
2809
2747
  const startIndex = items.findIndex((item) => item.value === current);
2810
2748
  if (startIndex >= 0) this.selectList.setSelectedIndex(startIndex);
2811
2749
  this.selectList.onSelect = (item) => {
@@ -2813,8 +2751,8 @@ var FabricActorDeliverySelector = class extends Container2 {
2813
2751
  if (policy) options.onSelect({ delivery: policy.delivery, triggerTurn: policy.triggerTurn });
2814
2752
  };
2815
2753
  this.selectList.onCancel = options.onCancel;
2816
- this.addChild(this.selectList);
2817
- this.addChild(new Spacer2(1));
2754
+ this.add(this.selectList);
2755
+ this.add(new BlankRows(1));
2818
2756
  }
2819
2757
  handleInput(data) {
2820
2758
  this.selectList.handleInput(data);
@@ -2822,7 +2760,7 @@ var FabricActorDeliverySelector = class extends Container2 {
2822
2760
  };
2823
2761
 
2824
2762
  // src/ui/fabric-actor-tool-selector.ts
2825
- import { Container as Container3, getKeybindings as getKeybindings2, Spacer as Spacer3, Text as Text3 } from "@oh-my-pi/pi-tui";
2763
+ import { widgetKeyMatches as widgetKeyMatches2 } from "@oh-my-pi/pi-tui/term/keymap";
2826
2764
  var ACTOR_TOOL_ORDER = ["read", "grep", "find", "ls", "bash", "edit", "write"];
2827
2765
  var TOOL_LABELS = {
2828
2766
  read: "read files",
@@ -2833,102 +2771,67 @@ var TOOL_LABELS = {
2833
2771
  edit: "edit existing files",
2834
2772
  write: "write files"
2835
2773
  };
2836
- var FabricActorToolSelector = class extends Container3 {
2774
+ var FabricActorToolSelector = class {
2837
2775
  theme;
2838
2776
  onSelectCallback;
2839
2777
  onCancelCallback;
2840
- listContainer = new Container3();
2778
+ header;
2841
2779
  enabled;
2842
2780
  selectedIndex = 0;
2843
- focused = false;
2844
2781
  constructor(options) {
2845
- super();
2846
2782
  this.theme = options.theme;
2847
2783
  this.onSelectCallback = options.onSelect;
2848
2784
  this.onCancelCallback = options.onCancel;
2849
2785
  this.enabled = new Set(options.currentValue);
2850
- this.addChild(
2851
- new Text3(
2852
- this.theme.fg("muted", options.headerText ?? "Select the optional tools available to this actor."),
2853
- 0,
2854
- 0
2855
- )
2786
+ this.header = new TextBlock(
2787
+ this.theme.fg("muted", options.headerText ?? "Select the optional tools available to this actor.")
2856
2788
  );
2857
- this.addChild(new Spacer3(1));
2858
- this.addChild(this.listContainer);
2859
- this.addChild(new Spacer3(1));
2860
- this.updateList();
2861
2789
  }
2862
2790
  handleInput(keyData) {
2863
- const kb = getKeybindings2();
2864
- if (kb.matches(keyData, "tui.select.up")) {
2865
- this.selectedIndex = this.selectedIndex === 0 ? ACTOR_TOOL_ORDER.length - 1 : this.selectedIndex - 1;
2866
- this.updateList();
2867
- } else if (kb.matches(keyData, "tui.select.down")) {
2868
- this.selectedIndex = this.selectedIndex === ACTOR_TOOL_ORDER.length - 1 ? 0 : this.selectedIndex + 1;
2869
- this.updateList();
2870
- } else if (keyData === " ") {
2871
- const tool = ACTOR_TOOL_ORDER[this.selectedIndex];
2872
- if (tool) {
2873
- if (this.enabled.has(tool)) this.enabled.delete(tool);
2874
- else this.enabled.add(tool);
2875
- this.updateList();
2791
+ for (const event of decodeTerminalInput(keyData)) {
2792
+ if (event.type !== "key") continue;
2793
+ const key = event.key;
2794
+ if (widgetKeyMatches2(key, "select.up")) {
2795
+ this.selectedIndex = this.selectedIndex === 0 ? ACTOR_TOOL_ORDER.length - 1 : this.selectedIndex - 1;
2796
+ } else if (widgetKeyMatches2(key, "select.down")) {
2797
+ this.selectedIndex = this.selectedIndex === ACTOR_TOOL_ORDER.length - 1 ? 0 : this.selectedIndex + 1;
2798
+ } else if (key.id === "space") {
2799
+ const tool = ACTOR_TOOL_ORDER[this.selectedIndex];
2800
+ if (tool) {
2801
+ if (this.enabled.has(tool)) this.enabled.delete(tool);
2802
+ else this.enabled.add(tool);
2803
+ }
2804
+ } else if (widgetKeyMatches2(key, "select.confirm")) {
2805
+ const selected = ACTOR_TOOL_ORDER.filter((tool) => this.enabled.has(tool));
2806
+ const custom = [...this.enabled].filter(
2807
+ (tool) => !ACTOR_TOOL_ORDER.includes(tool)
2808
+ );
2809
+ this.onSelectCallback([...selected, ...custom]);
2810
+ } else if (widgetKeyMatches2(key, "select.cancel")) {
2811
+ this.onCancelCallback();
2876
2812
  }
2877
- } else if (kb.matches(keyData, "tui.select.confirm")) {
2878
- const selected = ACTOR_TOOL_ORDER.filter((tool) => this.enabled.has(tool));
2879
- const custom = [...this.enabled].filter(
2880
- (tool) => !ACTOR_TOOL_ORDER.includes(tool)
2881
- );
2882
- this.onSelectCallback([...selected, ...custom]);
2883
- } else if (kb.matches(keyData, "tui.select.cancel")) {
2884
- this.onCancelCallback();
2885
2813
  }
2886
2814
  }
2887
- updateList() {
2888
- this.listContainer.clear();
2815
+ render(width) {
2816
+ const rows = [...this.header.render(width), ""];
2889
2817
  for (let index = 0; index < ACTOR_TOOL_ORDER.length; index++) {
2890
2818
  const tool = ACTOR_TOOL_ORDER[index];
2891
2819
  const selected = index === this.selectedIndex;
2892
2820
  const checked = this.enabled.has(tool);
2893
2821
  const box = checked ? this.theme.fg("success", "[x]") : this.theme.fg("dim", "[ ]");
2894
2822
  const label = `${box} ${tool} \xB7 ${this.theme.fg("muted", TOOL_LABELS[tool])}`;
2895
- const line = selected ? `${this.theme.fg("accent", "\u2192 ")}${this.theme.fg("accent", label)}` : ` ${label}`;
2896
- this.listContainer.addChild(new Text3(line, 0, 0));
2823
+ rows.push(...new TextBlock(selected ? `${this.theme.fg("accent", "\u2192 ")}${this.theme.fg("accent", label)}` : ` ${label}`).render(width));
2897
2824
  }
2898
- this.listContainer.addChild(new Spacer3(1));
2899
- this.listContainer.addChild(
2900
- new Text3(this.theme.fg("muted", " space toggle \xB7 enter apply \xB7 esc cancel"), 0, 0)
2901
- );
2825
+ rows.push("", ...new TextBlock(this.theme.fg("muted", " space toggle \xB7 enter apply \xB7 esc cancel")).render(width), "");
2826
+ return rows;
2902
2827
  }
2903
2828
  };
2904
2829
 
2905
2830
  // src/ui/fabric-thinking-selector.ts
2906
- import "@oh-my-pi/pi-tui";
2907
- import {
2908
- Container as Container4,
2909
- SelectList as SelectList2,
2910
- Spacer as Spacer4,
2911
- Text as Text4
2912
- } from "@oh-my-pi/pi-tui";
2913
- var LAYOUT2 = {
2914
- minPrimaryColumnWidth: 8,
2915
- maxPrimaryColumnWidth: 24
2916
- };
2917
- var selectListTheme2 = (theme) => ({
2918
- symbols: theme.symbols,
2919
- selectedPrefix: (text) => theme.fg("accent", text),
2920
- selectedText: (text) => theme.fg("accent", text),
2921
- description: (text) => theme.fg("muted", text),
2922
- scrollInfo: (text) => theme.fg("muted", text),
2923
- noMatch: (text) => theme.fg("muted", text)
2924
- });
2925
- var FabricThinkingSelector = class extends Container4 {
2831
+ var FabricThinkingSelector = class extends Stack {
2926
2832
  selectList;
2927
- onSelectCallback;
2928
- focused = false;
2929
2833
  constructor(options) {
2930
2834
  super();
2931
- this.onSelectCallback = options.onSelect;
2932
2835
  const headerText = options.headerText ?? "Thinking level for this actor. Pick Inherit to use the Fabric default.";
2933
2836
  const inheritName = options.inheritName ?? "Use the Fabric default thinking level";
2934
2837
  const items = [
@@ -2943,14 +2846,17 @@ var FabricThinkingSelector = class extends Container4 {
2943
2846
  }))
2944
2847
  ];
2945
2848
  const startIndex = items.findIndex((item) => item.value === options.currentValue);
2946
- this.addChild(new Text4(options.theme.fg("muted", headerText), 0, 0));
2947
- this.addChild(new Spacer4(1));
2948
- this.selectList = new SelectList2(items, items.length, selectListTheme2(options.theme), LAYOUT2);
2849
+ this.add(new TextBlock(options.theme.fg("muted", headerText)));
2850
+ this.add(new BlankRows(1));
2851
+ this.selectList = new SelectList(items, items.length, options.theme, {
2852
+ minPrimaryColumnWidth: 8,
2853
+ maxPrimaryColumnWidth: 24
2854
+ });
2949
2855
  if (startIndex >= 0) this.selectList.setSelectedIndex(startIndex);
2950
- this.selectList.onSelect = (item) => this.onSelectCallback(item.value);
2856
+ this.selectList.onSelect = (item) => options.onSelect(item.value);
2951
2857
  this.selectList.onCancel = options.onCancel;
2952
- this.addChild(this.selectList);
2953
- this.addChild(new Spacer4(1));
2858
+ this.add(this.selectList);
2859
+ this.add(new BlankRows(1));
2954
2860
  }
2955
2861
  handleInput(data) {
2956
2862
  this.selectList.handleInput(data);
@@ -2958,34 +2864,12 @@ var FabricThinkingSelector = class extends Container4 {
2958
2864
  };
2959
2865
 
2960
2866
  // src/ui/dashboard.ts
2961
- var editorTheme = (theme) => ({
2962
- symbols: ompSymbolTheme,
2963
- borderColor: (value) => theme.fg("borderMuted", value),
2964
- selectList: {
2965
- symbols: ompSymbolTheme,
2966
- selectedPrefix: (text) => theme.fg("accent", text),
2967
- selectedText: (text) => theme.fg("accent", text),
2968
- description: (text) => theme.fg("muted", text),
2969
- scrollInfo: (text) => theme.fg("muted", text),
2970
- noMatch: (text) => theme.fg("muted", text)
2971
- }
2972
- });
2973
- var DASHBOARD_OVERLAY_HEIGHT_PERCENT = 90;
2974
- var DASHBOARD_OVERLAY_VERTICAL_MARGIN = 1;
2975
- var dashboardOverlayRows = (terminalRows) => Math.max(
2976
- 1,
2977
- Math.min(
2978
- Math.floor(terminalRows * DASHBOARD_OVERLAY_HEIGHT_PERCENT / 100),
2979
- terminalRows - DASHBOARD_OVERLAY_VERTICAL_MARGIN * 2
2980
- )
2981
- );
2982
2867
  var FabricDashboard = class {
2983
- constructor(tui, theme, snapshot, done, options = {}) {
2984
- this.tui = tui;
2868
+ constructor(host, theme, snapshot, done, options = {}) {
2869
+ this.host = host;
2985
2870
  this.theme = theme;
2986
2871
  this.snapshot = snapshot;
2987
2872
  this.done = done;
2988
- this.focused = true;
2989
2873
  this.modelSource = options.modelSource;
2990
2874
  this.codePreviewSettings = options.codePreviewSettings;
2991
2875
  this.keybindings = options.keybindings;
@@ -3013,14 +2897,13 @@ var FabricDashboard = class {
3013
2897
  this.onImportActor = options.onImportActor;
3014
2898
  this.onExportActor = options.onExportActor;
3015
2899
  this.onRemoveGlobalActor = options.onRemoveGlobalActor;
3016
- this.detailRenderer = new DashboardDetailRenderer(tui, theme, snapshot, {
2900
+ this.detailRenderer = new DashboardDetailRenderer(host, theme, snapshot, {
3017
2901
  agentTranscript: this.agentTranscript,
3018
2902
  actorTranscript: this.actorTranscript,
3019
2903
  codePreviewSettings: this.codePreviewSettings,
3020
2904
  actorDefaultTools: this.actorDefaultTools
3021
2905
  });
3022
2906
  }
3023
- focused = false;
3024
2907
  pane = "phases";
3025
2908
  overviewView = "activity";
3026
2909
  graphPositions = /* @__PURE__ */ new Map();
@@ -3057,7 +2940,7 @@ var FabricDashboard = class {
3057
2940
  detailView = "summary";
3058
2941
  transcriptFollowing = true;
3059
2942
  detailRenderer;
3060
- highlightInvalidate = () => this.tui.requestRender();
2943
+ highlightInvalidate = () => this.host.requestRender();
3061
2944
  mode = "overview";
3062
2945
  picker;
3063
2946
  editor;
@@ -3094,33 +2977,33 @@ var FabricDashboard = class {
3094
2977
  pickerActorName;
3095
2978
  handleInput(data) {
3096
2979
  if (this.mode === "help") {
3097
- if (data === "?" || matchesKey(data, Key.escape) || matchesKey(data, Key.ctrl("c"))) {
2980
+ if (data === "?" || isKey(data, "escape") || isKey(data, "ctrl+c")) {
3098
2981
  this.mode = this.detailId ? "detail" : "overview";
3099
2982
  }
3100
- this.tui.requestRender();
2983
+ this.host.requestRender();
3101
2984
  return;
3102
2985
  }
3103
2986
  if (this.mode === "agentMessageEditor" && this.editor) {
3104
- if (getKeybindings3().matches(data, "tui.select.cancel")) {
2987
+ if (isAction(data, "select.cancel")) {
3105
2988
  this.closeAgentMessageEditor();
3106
2989
  } else {
3107
2990
  this.editor.handleInput(data);
3108
2991
  }
3109
- this.tui.requestRender();
2992
+ this.host.requestRender();
3110
2993
  return;
3111
2994
  }
3112
2995
  if (this.mode === "instructionsEditor" && this.editor) {
3113
- if (getKeybindings3().matches(data, "tui.select.cancel")) {
2996
+ if (isAction(data, "select.cancel")) {
3114
2997
  this.closeInstructionsEditor();
3115
2998
  } else {
3116
2999
  this.editor.handleInput(data);
3117
3000
  }
3118
- this.tui.requestRender();
3001
+ this.host.requestRender();
3119
3002
  return;
3120
3003
  }
3121
3004
  if ((this.mode === "modelPicker" || this.mode === "thinkingPicker" || this.mode === "deliveryPicker" || this.mode === "eventsPicker" || this.mode === "toolsPicker") && this.picker) {
3122
3005
  this.picker.handleInput(data);
3123
- this.tui.requestRender();
3006
+ this.host.requestRender();
3124
3007
  return;
3125
3008
  }
3126
3009
  const snapshot = this.snapshot();
@@ -3148,11 +3031,11 @@ var FabricDashboard = class {
3148
3031
  }
3149
3032
  if (data === "?") {
3150
3033
  this.mode = "help";
3151
- this.tui.requestRender();
3034
+ this.host.requestRender();
3152
3035
  return;
3153
3036
  }
3154
3037
  if (this.detailId) {
3155
- if (matchesKey(data, Key.escape) || matchesKey(data, Key.ctrl("c")) || matchesKey(data, Key.left) || data === "h") {
3038
+ if (isKey(data, "escape") || isKey(data, "ctrl+c") || isKey(data, "left") || data === "h") {
3156
3039
  this.closeDetail();
3157
3040
  } else if (data === "t") {
3158
3041
  const detail = allEntities.find((entity) => entity.id === this.detailId);
@@ -3164,7 +3047,7 @@ var FabricDashboard = class {
3164
3047
  }
3165
3048
  } else if (this.detailView === "transcript" && this.matchesTranscriptToolToggle(data)) {
3166
3049
  this.transcriptToolsExpanded = !this.transcriptToolsExpanded;
3167
- } else if (matchesKey(data, Key.up) || data === "k") {
3050
+ } else if (isKey(data, "up") || data === "k") {
3168
3051
  if (this.detailScroll > 0) {
3169
3052
  if (this.detailView === "transcript") this.transcriptFollowing = false;
3170
3053
  this.detailScroll--;
@@ -3176,7 +3059,7 @@ var FabricDashboard = class {
3176
3059
  this.transcriptFollowing = false;
3177
3060
  }
3178
3061
  }
3179
- } else if (matchesKey(data, Key.down) || data === "j") {
3062
+ } else if (isKey(data, "down") || data === "j") {
3180
3063
  if (this.detailScroll < this.detailMaxScroll) {
3181
3064
  if (this.detailView === "transcript") this.transcriptFollowing = false;
3182
3065
  this.detailScroll++;
@@ -3195,7 +3078,7 @@ var FabricDashboard = class {
3195
3078
  this.transcriptPageAnchor = void 0;
3196
3079
  this.transcriptFollowing = true;
3197
3080
  this.detailScroll = this.detailMaxScroll;
3198
- } else if (matchesKey(data, Key.home) || data === "g") {
3081
+ } else if (isKey(data, "home") || data === "g") {
3199
3082
  if (this.detailView === "transcript") {
3200
3083
  this.transcriptPageAnchor = void 0;
3201
3084
  this.transcriptFollowing = false;
@@ -3260,7 +3143,7 @@ var FabricDashboard = class {
3260
3143
  this.onRemoveGlobalActor(detail.value.id);
3261
3144
  }
3262
3145
  }
3263
- this.tui.requestRender();
3146
+ this.host.requestRender();
3264
3147
  return;
3265
3148
  }
3266
3149
  if (data === "1" || data === "2") {
@@ -3276,10 +3159,10 @@ var FabricDashboard = class {
3276
3159
  this.selectedEntityId = void 0;
3277
3160
  this.pendingStop = void 0;
3278
3161
  }
3279
- this.tui.requestRender();
3162
+ this.host.requestRender();
3280
3163
  return;
3281
3164
  }
3282
- if (matchesKey(data, Key.escape) || matchesKey(data, Key.ctrl("c"))) {
3165
+ if (isKey(data, "escape") || isKey(data, "ctrl+c")) {
3283
3166
  if (this.overviewView === "activity" && this.pane === "entities") {
3284
3167
  this.pane = "phases";
3285
3168
  } else {
@@ -3289,17 +3172,17 @@ var FabricDashboard = class {
3289
3172
  } else if (this.overviewView === "topology" && data === "r") {
3290
3173
  this.toggleGraphReplay(snapshot, projectMesh);
3291
3174
  this.startGraphEffectsAnimation();
3292
- this.tui.requestRender();
3175
+ this.host.requestRender();
3293
3176
  return;
3294
3177
  } else if (this.overviewView === "topology" && this.graphReplayIndex !== void 0 && data === " ") {
3295
3178
  this.graphReplayPlaying = !this.graphReplayPlaying;
3296
3179
  this.graphReplayAdvancedAt = Date.now();
3297
3180
  this.startGraphEffectsAnimation();
3298
- this.tui.requestRender();
3181
+ this.host.requestRender();
3299
3182
  return;
3300
- } else if (this.overviewView === "topology" && this.graphReplayIndex !== void 0 && (matchesKey(data, Key.left) || matchesKey(data, Key.right))) {
3301
- this.stepGraphReplay(matchesKey(data, Key.left) ? -1 : 1);
3302
- this.tui.requestRender();
3183
+ } else if (this.overviewView === "topology" && this.graphReplayIndex !== void 0 && (isKey(data, "left") || isKey(data, "right"))) {
3184
+ this.stepGraphReplay(isKey(data, "left") ? -1 : 1);
3185
+ this.host.requestRender();
3303
3186
  return;
3304
3187
  } else if (this.overviewView === "topology" && (data === "+" || data === "=" || data === "-")) {
3305
3188
  const speeds = [0.5, 1, 2, 4];
@@ -3307,11 +3190,11 @@ var FabricDashboard = class {
3307
3190
  const direction = data === "-" ? -1 : 1;
3308
3191
  this.graphReplaySpeed = speeds[Math.max(0, Math.min(speeds.length - 1, current + direction))] ?? 1;
3309
3192
  this.graphReplayAdvancedAt = Date.now();
3310
- this.tui.requestRender();
3193
+ this.host.requestRender();
3311
3194
  return;
3312
3195
  } else if (this.overviewView === "topology" && data === "H") {
3313
3196
  this.graphShowHistory = !this.graphShowHistory;
3314
- this.tui.requestRender();
3197
+ this.host.requestRender();
3315
3198
  return;
3316
3199
  } else if (this.overviewView === "topology" && data === "M") {
3317
3200
  const selected = this.pane === "entities" ? entities[this.entityIndex] : void 0;
@@ -3321,10 +3204,10 @@ var FabricDashboard = class {
3321
3204
  } else {
3322
3205
  this.graphReducedMotion = !this.graphReducedMotion;
3323
3206
  }
3324
- this.tui.requestRender();
3207
+ this.host.requestRender();
3325
3208
  return;
3326
- } else if (this.overviewView === "topology" && (matchesKey(data, Key.left) || matchesKey(data, Key.right) || matchesKey(data, Key.up) || matchesKey(data, Key.down) || data === "h" || data === "l")) {
3327
- const direction = matchesKey(data, Key.left) || data === "h" ? "left" : matchesKey(data, Key.right) || data === "l" ? "right" : matchesKey(data, Key.up) ? "up" : "down";
3209
+ } else if (this.overviewView === "topology" && (isKey(data, "left") || isKey(data, "right") || isKey(data, "up") || isKey(data, "down") || data === "h" || data === "l")) {
3210
+ const direction = isKey(data, "left") || data === "h" ? "left" : isKey(data, "right") || data === "l" ? "right" : isKey(data, "up") ? "up" : "down";
3328
3211
  const target = directionalGraphTarget(this.graphPositions, this.selectedEntityId, direction);
3329
3212
  const targetIndex = target ? entities.findIndex((entity) => entity.id === target) : -1;
3330
3213
  if (targetIndex >= 0) {
@@ -3332,21 +3215,21 @@ var FabricDashboard = class {
3332
3215
  this.selectedEntityId = target;
3333
3216
  this.pendingStop = void 0;
3334
3217
  }
3335
- this.tui.requestRender();
3218
+ this.host.requestRender();
3336
3219
  return;
3337
- } else if (matchesKey(data, Key.tab) && this.overviewView === "topology") {
3220
+ } else if (isKey(data, "tab") && this.overviewView === "topology") {
3338
3221
  this.entityIndex = entities.length > 0 ? (this.entityIndex + 1) % entities.length : 0;
3339
3222
  this.selectedEntityId = entities[this.entityIndex]?.id;
3340
3223
  this.pendingStop = void 0;
3341
- this.tui.requestRender();
3224
+ this.host.requestRender();
3342
3225
  return;
3343
- } else if (matchesKey(data, Key.tab) && this.overviewView === "activity") {
3226
+ } else if (isKey(data, "tab") && this.overviewView === "activity") {
3344
3227
  this.pane = this.pane === "phases" ? "entities" : "phases";
3345
- } else if (this.overviewView === "activity" && (matchesKey(data, Key.left) || data === "h")) {
3228
+ } else if (this.overviewView === "activity" && (isKey(data, "left") || data === "h")) {
3346
3229
  this.pane = "phases";
3347
- } else if (this.overviewView === "activity" && (matchesKey(data, Key.right) || data === "l")) {
3230
+ } else if (this.overviewView === "activity" && (isKey(data, "right") || data === "l")) {
3348
3231
  this.pane = "entities";
3349
- } else if (matchesKey(data, Key.up) || data === "k") {
3232
+ } else if (isKey(data, "up") || data === "k") {
3350
3233
  if (this.overviewView === "activity" && this.pane === "phases") {
3351
3234
  this.phaseIndex = Math.max(0, this.phaseIndex - 1);
3352
3235
  this.phaseSelectionTouched = true;
@@ -3355,7 +3238,7 @@ var FabricDashboard = class {
3355
3238
  } else {
3356
3239
  this.entityIndex = Math.max(0, this.entityIndex - 1);
3357
3240
  }
3358
- } else if (matchesKey(data, Key.down) || data === "j") {
3241
+ } else if (isKey(data, "down") || data === "j") {
3359
3242
  if (this.overviewView === "activity" && this.pane === "phases") {
3360
3243
  this.phaseIndex = Math.min(Math.max(0, panels.length - 1), this.phaseIndex + 1);
3361
3244
  this.phaseSelectionTouched = true;
@@ -3409,7 +3292,7 @@ var FabricDashboard = class {
3409
3292
  this.transcriptPageAnchor = void 0;
3410
3293
  this.transcriptFollowing = true;
3411
3294
  }
3412
- } else if (matchesKey(data, Key.enter)) {
3295
+ } else if (isKey(data, "enter")) {
3413
3296
  if (this.overviewView === "activity" && this.pane === "phases") {
3414
3297
  this.pane = "entities";
3415
3298
  } else {
@@ -3426,21 +3309,21 @@ var FabricDashboard = class {
3426
3309
  this.filter = filters[next] ?? "all";
3427
3310
  this.entityIndex = 0;
3428
3311
  this.selectedEntityId = void 0;
3429
- this.tui.requestRender();
3312
+ this.host.requestRender();
3430
3313
  return;
3431
3314
  } else if (data === "[") {
3432
3315
  this.runIndex = Math.min(Math.max(0, snapshot.runs.length - 1), this.runIndex + 1);
3433
3316
  this.selectedRunId = snapshot.runs[this.runIndex]?.id;
3434
3317
  this.runSelectionTouched = true;
3435
3318
  this.resetSelection();
3436
- this.tui.requestRender();
3319
+ this.host.requestRender();
3437
3320
  return;
3438
3321
  } else if (data === "]") {
3439
3322
  this.runIndex = Math.max(0, this.runIndex - 1);
3440
3323
  this.selectedRunId = snapshot.runs[this.runIndex]?.id;
3441
3324
  this.runSelectionTouched = true;
3442
3325
  this.resetSelection();
3443
- this.tui.requestRender();
3326
+ this.host.requestRender();
3444
3327
  return;
3445
3328
  } else if (data === "G") {
3446
3329
  if (this.overviewView === "activity" && this.pane === "phases") {
@@ -3468,7 +3351,7 @@ var FabricDashboard = class {
3468
3351
  if (this.pane === "entities") {
3469
3352
  this.selectedEntityId = entities[this.entityIndex]?.id;
3470
3353
  }
3471
- this.tui.requestRender();
3354
+ this.host.requestRender();
3472
3355
  }
3473
3356
  render(width) {
3474
3357
  if (width <= 0) return [];
@@ -3534,14 +3417,13 @@ var FabricDashboard = class {
3534
3417
  return entity.kind === "agent" && this.agentTranscript !== void 0 || entity.kind === "actor" && this.actorTranscript !== void 0;
3535
3418
  }
3536
3419
  matchesTranscriptToolToggle(data) {
3537
- if (this.keybindings) return this.keybindings.matches(data, "app.tools.expand");
3538
- const keybindings = getKeybindings3();
3539
- const keys = keybindings.getKeys("app.tools.expand");
3540
- return keys.length > 0 ? keybindings.matches(data, "app.tools.expand") : matchesKey(data, Key.ctrl("o"));
3420
+ const key = keyOf(data);
3421
+ if (!key) return false;
3422
+ return this.keybindings ? this.keybindings.matches(key, "app.tools.expand") : key.id === "ctrl+o";
3541
3423
  }
3542
3424
  transcriptToolToggleHint() {
3543
- const keys = (this.keybindings ?? getKeybindings3()).getKeys("app.tools.expand");
3544
- const key = keys.length > 0 ? keys.join("/") : this.keybindings ? "unbound" : "ctrl+o";
3425
+ const keys = this.keybindings?.keysFor("app.tools.expand") ?? ["ctrl+o"];
3426
+ const key = keys.length > 0 ? keys.join("/") : "unbound";
3545
3427
  return `${key} ${this.transcriptToolsExpanded ? "collapse" : "expand"} tools`;
3546
3428
  }
3547
3429
  messageTarget(entity) {
@@ -3585,8 +3467,7 @@ var FabricDashboard = class {
3585
3467
  openAgentMessageEditor(entity, delivery) {
3586
3468
  const target = this.messageTarget(entity);
3587
3469
  if (!target || !this.canMessage(entity, delivery)) return;
3588
- const editor = new Editor(editorTheme(this.theme));
3589
- editor.focused = true;
3470
+ const editor = new TextField({ multiline: true });
3590
3471
  editor.onSubmit = (text) => {
3591
3472
  const message = text.trim();
3592
3473
  if (!message) return;
@@ -3646,7 +3527,7 @@ var FabricDashboard = class {
3646
3527
  )
3647
3528
  );
3648
3529
  lines.push(this.bottomBorder(width));
3649
- return lines.map((line) => truncateToWidth4(line, width, ""));
3530
+ return lines.map((line) => truncate4(line, width, ""));
3650
3531
  }
3651
3532
  renderHelp(width) {
3652
3533
  if (width < 24) return this.renderNarrowFallback(width, "dashboard help", "? or esc close");
@@ -3708,7 +3589,7 @@ var FabricDashboard = class {
3708
3589
  lines.push(this.middleBorder(width));
3709
3590
  lines.push(this.row(width, this.theme.fg("dim", " ? or esc close")));
3710
3591
  lines.push(this.bottomBorder(width));
3711
- return lines.map((line) => truncateToWidth4(line, width, ""));
3592
+ return lines.map((line) => truncate4(line, width, ""));
3712
3593
  }
3713
3594
  modelSourceForActor(actor) {
3714
3595
  return actor.runner === "claude" ? this.claudeModelSource : this.modelSource;
@@ -3736,7 +3617,6 @@ var FabricDashboard = class {
3736
3617
  },
3737
3618
  onCancel: () => this.closeModelPicker()
3738
3619
  });
3739
- this.picker.focused = true;
3740
3620
  this.mode = "modelPicker";
3741
3621
  }
3742
3622
  openThinkingPicker(entity, scope = "session") {
@@ -3762,7 +3642,6 @@ var FabricDashboard = class {
3762
3642
  },
3763
3643
  onCancel: () => this.closeModelPicker()
3764
3644
  });
3765
- this.picker.focused = true;
3766
3645
  this.mode = "thinkingPicker";
3767
3646
  }
3768
3647
  openDeliveryPicker(entity) {
@@ -3781,7 +3660,6 @@ var FabricDashboard = class {
3781
3660
  },
3782
3661
  onCancel: () => this.closeModelPicker()
3783
3662
  });
3784
- this.picker.focused = true;
3785
3663
  this.mode = "deliveryPicker";
3786
3664
  }
3787
3665
  openEventsPicker(entity) {
@@ -3798,7 +3676,6 @@ var FabricDashboard = class {
3798
3676
  },
3799
3677
  onCancel: () => this.closeModelPicker()
3800
3678
  });
3801
- this.picker.focused = true;
3802
3679
  this.mode = "eventsPicker";
3803
3680
  }
3804
3681
  openToolsPicker(entity) {
@@ -3815,7 +3692,6 @@ var FabricDashboard = class {
3815
3692
  },
3816
3693
  onCancel: () => this.closeModelPicker()
3817
3694
  });
3818
- this.picker.focused = true;
3819
3695
  this.mode = "toolsPicker";
3820
3696
  }
3821
3697
  closeModelPicker() {
@@ -3850,8 +3726,7 @@ var FabricDashboard = class {
3850
3726
  } else {
3851
3727
  return;
3852
3728
  }
3853
- const editor = new Editor(editorTheme(this.theme));
3854
- editor.focused = true;
3729
+ const editor = new TextField({ multiline: true });
3855
3730
  editor.setText(instructions);
3856
3731
  editor.onSubmit = (text) => {
3857
3732
  if (kind === "actor") this.onActorInstructions?.(id, text);
@@ -3885,7 +3760,7 @@ var FabricDashboard = class {
3885
3760
  )
3886
3761
  );
3887
3762
  lines.push(this.bottomBorder(width));
3888
- return lines.map((line) => truncateToWidth4(line, width, ""));
3763
+ return lines.map((line) => truncate4(line, width, ""));
3889
3764
  }
3890
3765
  renderInstructionsEditor(width) {
3891
3766
  if (!this.editor) return [];
@@ -3903,7 +3778,7 @@ var FabricDashboard = class {
3903
3778
  )
3904
3779
  );
3905
3780
  lines.push(this.bottomBorder(width));
3906
- return lines.map((line) => truncateToWidth4(line, width, ""));
3781
+ return lines.map((line) => truncate4(line, width, ""));
3907
3782
  }
3908
3783
  projectMesh(snapshot) {
3909
3784
  if (this.overviewView !== "topology") return void 0;
@@ -3938,7 +3813,7 @@ var FabricDashboard = class {
3938
3813
  this.graphReplayPlaying = false;
3939
3814
  }
3940
3815
  }
3941
- this.tui.requestRender();
3816
+ this.host.requestRender();
3942
3817
  }, 80);
3943
3818
  this.graphEffectsAnimation.unref?.();
3944
3819
  }
@@ -4024,18 +3899,14 @@ var FabricDashboard = class {
4024
3899
  if (this.graphAnimation) clearInterval(this.graphAnimation);
4025
3900
  this.graphAnimation = void 0;
4026
3901
  }
4027
- this.tui.requestRender();
3902
+ this.host.requestRender();
4028
3903
  }
4029
3904
  renderOverview(width, snapshot, run, panels, entities, allEntities, meshModel) {
4030
3905
  if (width < 24) {
4031
- return [truncateToWidth4("too narrow \xB7 need 24 cols", width)];
3906
+ return [truncate4("too narrow \xB7 need 24 cols", width)];
4032
3907
  }
4033
3908
  const innerWidth = width - 2;
4034
- const terminalRows = Math.max(
4035
- 1,
4036
- this.tui.terminal?.rows ?? process.stdout.rows ?? 28
4037
- );
4038
- const overlayRows = dashboardOverlayRows(terminalRows);
3909
+ const overlayRows = Math.max(1, this.host.size().rows);
4039
3910
  const lines = [];
4040
3911
  const title = this.overviewView === "activity" ? `Fabric \xB7 ${run?.name ?? "session"} \xB7 Activity` : "Fabric \xB7 Topology";
4041
3912
  lines.push(this.topBorder(width, title));
@@ -4081,7 +3952,7 @@ var FabricDashboard = class {
4081
3952
  title,
4082
3953
  this.theme.fg("dim", summaryText || "No Fabric activity yet"),
4083
3954
  this.theme.fg("dim", "1 activity \xB7 2 topology \xB7 arrows move \xB7 esc close")
4084
- ].slice(0, overlayRows).map((line) => truncateToWidth4(line, width, ""));
3955
+ ].slice(0, overlayRows).map((line) => truncate4(line, width, ""));
4085
3956
  }
4086
3957
  lines.push(this.row(width, headerLine || this.theme.fg("muted", "No Fabric activity yet")));
4087
3958
  lines.push(this.middleBorder(width));
@@ -4218,7 +4089,7 @@ var FabricDashboard = class {
4218
4089
  const actionHint = this.pane === "entities" && selectedEntity ? this.theme.fg("muted", ` ${this.overviewActionHint(selectedEntity)}`) : "";
4219
4090
  lines.push(this.row(width, actionHint));
4220
4091
  lines.push(this.bottomBorder(width));
4221
- return lines.map((line) => truncateToWidth4(line, width, ""));
4092
+ return lines.map((line) => truncate4(line, width, ""));
4222
4093
  }
4223
4094
  overviewActionHint(entity) {
4224
4095
  if (entity.kind === "main") {
@@ -4288,13 +4159,10 @@ var FabricDashboard = class {
4288
4159
  }
4289
4160
  renderPhasePanel(panels, width, height) {
4290
4161
  const lines = [
4291
- truncateToWidth4(
4292
- `${this.pane === "phases" ? this.theme.fg("accent", "\u25B8 ") : " "}${this.theme.fg(
4293
- "accent",
4294
- "Activity"
4295
- )}`,
4296
- width
4297
- )
4162
+ truncate4(`${this.pane === "phases" ? this.theme.fg("accent", "\u25B8 ") : " "}${this.theme.fg(
4163
+ "accent",
4164
+ "Activity"
4165
+ )}`, width)
4298
4166
  ];
4299
4167
  const available = Math.max(0, height - 1);
4300
4168
  const start = Math.max(
@@ -4316,7 +4184,7 @@ var FabricDashboard = class {
4316
4184
  if (selected && this.pane === "phases") {
4317
4185
  line = this.theme.bg("selectedBg", padToWidth(line, width));
4318
4186
  }
4319
- lines.push(truncateToWidth4(line, width, ""));
4187
+ lines.push(truncate4(line, width, ""));
4320
4188
  }
4321
4189
  while (lines.length < height) lines.push("");
4322
4190
  return lines.slice(0, height);
@@ -4356,14 +4224,10 @@ var FabricDashboard = class {
4356
4224
  }
4357
4225
  if (row.type === "group") {
4358
4226
  lines.push(
4359
- truncateToWidth4(
4360
- this.theme.fg(
4361
- "muted",
4362
- ` ${this.theme.bold(row.group.label)} (${row.group.entries.length})`
4363
- ),
4364
- width,
4365
- ""
4366
- )
4227
+ truncate4(this.theme.fg(
4228
+ "muted",
4229
+ ` ${this.theme.style("strong", row.group.label)} (${row.group.entries.length})`
4230
+ ), width, "")
4367
4231
  );
4368
4232
  continue;
4369
4233
  }
@@ -4378,7 +4242,7 @@ var FabricDashboard = class {
4378
4242
  if (selected && this.pane === "entities") {
4379
4243
  line = this.theme.bg("selectedBg", padToWidth(line, width));
4380
4244
  }
4381
- lines.push(truncateToWidth4(line, width, ""));
4245
+ lines.push(truncate4(line, width, ""));
4382
4246
  }
4383
4247
  if (entities.length === 0 && available > 0) {
4384
4248
  const label = this.filter === "all" ? "activity" : `${this.filter} activity`;
@@ -4572,11 +4436,11 @@ var FabricDashboard = class {
4572
4436
  this.transcriptFollowing = true;
4573
4437
  }
4574
4438
  renderNarrowFallback(width, label, hint) {
4575
- return [safeText(label), hint].map((line) => truncateToWidth4(line, width, "")).filter((line) => visibleWidth4(line) > 0);
4439
+ return [safeText(label), hint].map((line) => truncate4(line, width, "")).filter((line) => visibleWidth4(line) > 0);
4576
4440
  }
4577
4441
  topBorder(width, title) {
4578
4442
  const border = (value) => this.theme.fg("borderMuted", value);
4579
- const safeTitle = truncateToWidth4(safeText(title), Math.max(0, width - 6));
4443
+ const safeTitle = truncate4(safeText(title), Math.max(0, width - 6));
4580
4444
  const styledTitle = ` ${this.theme.fg("accent", safeTitle)} `;
4581
4445
  const remaining = Math.max(0, width - 2 - visibleWidth4(styledTitle));
4582
4446
  const left = Math.floor(remaining / 2);