omp-fabric 1.27.2 → 1.28.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 (121) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +1 -1
  3. package/dist/capture/interceptor.d.ts.map +1 -1
  4. package/dist/chunks/{chunk-OJZNMROB.js → chunk-4PPAWZM6.js} +36 -50
  5. package/dist/chunks/chunk-4PPAWZM6.js.map +7 -0
  6. package/dist/chunks/{chunk-KIH3KLZU.js → chunk-C2YMZNT5.js} +5 -5
  7. package/dist/chunks/chunk-C2YMZNT5.js.map +7 -0
  8. package/dist/chunks/chunk-CHXPTZUF.js +277 -0
  9. package/dist/chunks/chunk-CHXPTZUF.js.map +7 -0
  10. package/dist/chunks/chunk-CYNNPPN4.js +93 -0
  11. package/dist/chunks/chunk-CYNNPPN4.js.map +7 -0
  12. package/dist/chunks/{chunk-ANHZ3SWB.js → chunk-DGKGPZET.js} +9 -4
  13. package/dist/chunks/{chunk-ANHZ3SWB.js.map → chunk-DGKGPZET.js.map} +2 -2
  14. package/dist/chunks/{chunk-2BOZMRT5.js → chunk-FVNEGH4J.js} +32 -49
  15. package/dist/chunks/chunk-FVNEGH4J.js.map +7 -0
  16. package/dist/chunks/{chunk-CNCRWY4Q.js → chunk-GS6IWGXQ.js} +9 -1
  17. package/dist/chunks/chunk-GS6IWGXQ.js.map +7 -0
  18. package/dist/chunks/{chunk-7QKSPNXQ.js → chunk-V5FB7D4C.js} +3 -3
  19. package/dist/chunks/chunk-VDYGBL4Z.js +132 -0
  20. package/dist/chunks/chunk-VDYGBL4Z.js.map +7 -0
  21. package/dist/chunks/chunk-XVA63H6I.js +151 -0
  22. package/dist/chunks/chunk-XVA63H6I.js.map +7 -0
  23. package/dist/chunks/{chunk-NOZBB266.js → chunk-XZIQGFF7.js} +9 -13
  24. package/dist/chunks/chunk-XZIQGFF7.js.map +7 -0
  25. package/dist/chunks/{chunk-4XLJPEI4.js → chunk-ZJ7HHWW4.js} +20 -41
  26. package/dist/chunks/chunk-ZJ7HHWW4.js.map +7 -0
  27. package/dist/config.d.ts +2 -0
  28. package/dist/config.d.ts.map +1 -1
  29. package/dist/core/approval-controller.d.ts.map +1 -1
  30. package/dist/fabric-exec-tool.d.ts.map +1 -1
  31. package/dist/fabric-runtime-state.js +5 -3
  32. package/dist/fabric-runtime-state.js.map +1 -1
  33. package/dist/host-compatibility.d.ts +1 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +180 -170
  36. package/dist/index.js.map +3 -3
  37. package/dist/residency/host.js +3 -3
  38. package/dist/residency/omp-entry.js +3 -3
  39. package/dist/topology/participant-directory.d.ts.map +1 -1
  40. package/dist/ui/arc-group.d.ts +1 -1
  41. package/dist/ui/arc-group.d.ts.map +1 -1
  42. package/dist/ui/code-preview-shell.d.ts +2 -2
  43. package/dist/ui/code-preview-shell.d.ts.map +1 -1
  44. package/dist/ui/controller.d.ts.map +1 -1
  45. package/dist/ui/conversation-chrome.d.ts +1 -5
  46. package/dist/ui/conversation-chrome.d.ts.map +1 -1
  47. package/dist/ui/conversation-chrome.js +2 -2
  48. package/dist/ui/conversation-queue.d.ts +3 -2
  49. package/dist/ui/conversation-queue.d.ts.map +1 -1
  50. package/dist/ui/conversation-render.d.ts +19 -23
  51. package/dist/ui/conversation-render.d.ts.map +1 -1
  52. package/dist/ui/conversation.d.ts +7 -17
  53. package/dist/ui/conversation.d.ts.map +1 -1
  54. package/dist/ui/conversation.js +317 -318
  55. package/dist/ui/conversation.js.map +3 -3
  56. package/dist/ui/core-tool-render.d.ts +1 -1
  57. package/dist/ui/core-tool-render.d.ts.map +1 -1
  58. package/dist/ui/dashboard-detail.d.ts +4 -4
  59. package/dist/ui/dashboard-detail.d.ts.map +1 -1
  60. package/dist/ui/dashboard-fabric-graph.d.ts +1 -1
  61. package/dist/ui/dashboard-fabric-graph.d.ts.map +1 -1
  62. package/dist/ui/dashboard-presentation.d.ts +1 -1
  63. package/dist/ui/dashboard-presentation.d.ts.map +1 -1
  64. package/dist/ui/dashboard.d.ts +8 -8
  65. package/dist/ui/dashboard.d.ts.map +1 -1
  66. package/dist/ui/dashboard.js +206 -343
  67. package/dist/ui/dashboard.js.map +3 -3
  68. package/dist/ui/diff-background.d.ts +1 -1
  69. package/dist/ui/diff-background.d.ts.map +1 -1
  70. package/dist/ui/fabric-actor-delivery-selector.d.ts +4 -4
  71. package/dist/ui/fabric-actor-delivery-selector.d.ts.map +1 -1
  72. package/dist/ui/fabric-actor-tool-selector.d.ts +5 -6
  73. package/dist/ui/fabric-actor-tool-selector.d.ts.map +1 -1
  74. package/dist/ui/fabric-host-event-selector.d.ts +4 -4
  75. package/dist/ui/fabric-host-event-selector.d.ts.map +1 -1
  76. package/dist/ui/fabric-model-selector.d.ts +4 -6
  77. package/dist/ui/fabric-model-selector.d.ts.map +1 -1
  78. package/dist/ui/fabric-render.d.ts +6 -6
  79. package/dist/ui/fabric-render.d.ts.map +1 -1
  80. package/dist/ui/fabric-thinking-selector.d.ts +4 -7
  81. package/dist/ui/fabric-thinking-selector.d.ts.map +1 -1
  82. package/dist/ui/highlight.d.ts +2 -13
  83. package/dist/ui/highlight.d.ts.map +1 -1
  84. package/dist/ui/row-balance.d.ts +6 -6
  85. package/dist/ui/row-balance.d.ts.map +1 -1
  86. package/dist/ui/settings.d.ts +6 -3
  87. package/dist/ui/settings.d.ts.map +1 -1
  88. package/dist/ui/settings.js +239 -113
  89. package/dist/ui/settings.js.map +3 -3
  90. package/dist/ui/state-file-preview.d.ts +1 -1
  91. package/dist/ui/state-file-preview.d.ts.map +1 -1
  92. package/dist/ui/tui/host-term.d.ts +16 -0
  93. package/dist/ui/tui/host-term.d.ts.map +1 -0
  94. package/dist/ui/tui/input.d.ts +19 -0
  95. package/dist/ui/tui/input.d.ts.map +1 -0
  96. package/dist/ui/tui/rows.d.ts +24 -0
  97. package/dist/ui/tui/rows.d.ts.map +1 -0
  98. package/dist/ui/tui/select-list.d.ts +28 -0
  99. package/dist/ui/tui/select-list.d.ts.map +1 -0
  100. package/dist/ui/tui/settings-list.d.ts +38 -0
  101. package/dist/ui/tui/settings-list.d.ts.map +1 -0
  102. package/dist/ui/tui/text-field.d.ts +40 -0
  103. package/dist/ui/tui/text-field.d.ts.map +1 -0
  104. package/dist/ui/tui/view.d.ts +26 -0
  105. package/dist/ui/tui/view.d.ts.map +1 -0
  106. package/dist/ui/widget.d.ts +3 -3
  107. package/dist/ui/widget.d.ts.map +1 -1
  108. package/docs/configuration.md +2 -0
  109. package/docs/interface.md +16 -3
  110. package/package.json +13 -12
  111. package/dist/chunks/chunk-2BOZMRT5.js.map +0 -7
  112. package/dist/chunks/chunk-4XLJPEI4.js.map +0 -7
  113. package/dist/chunks/chunk-CNCRWY4Q.js.map +0 -7
  114. package/dist/chunks/chunk-G2IBGGBM.js +0 -42
  115. package/dist/chunks/chunk-G2IBGGBM.js.map +0 -7
  116. package/dist/chunks/chunk-KIH3KLZU.js.map +0 -7
  117. package/dist/chunks/chunk-NOZBB266.js.map +0 -7
  118. package/dist/chunks/chunk-OJZNMROB.js.map +0 -7
  119. package/dist/ui/symbol-theme.d.ts +0 -3
  120. package/dist/ui/symbol-theme.d.ts.map +0 -1
  121. /package/dist/chunks/{chunk-7QKSPNXQ.js.map → chunk-V5FB7D4C.js.map} +0 -0
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  FabricModelSelector
3
- } from "../chunks/chunk-OJZNMROB.js";
3
+ } from "../chunks/chunk-4PPAWZM6.js";
4
4
  import {
5
- ompSymbolTheme
6
- } from "../chunks/chunk-G2IBGGBM.js";
5
+ TextField
6
+ } from "../chunks/chunk-CHXPTZUF.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,22 @@ 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-VDYGBL4Z.js";
42
+ import {
43
+ decodeTerminalInput,
44
+ isAction,
45
+ isKey,
46
+ keyMatches,
47
+ keyOf
48
+ } from "../chunks/chunk-XVA63H6I.js";
36
49
  import {
37
50
  FABRIC_ACTOR_HOST_EVENTS
38
51
  } from "../chunks/chunk-3LI7YO4M.js";
@@ -46,15 +59,7 @@ import {
46
59
  } from "../chunks/chunk-LMAVZN7J.js";
47
60
 
48
61
  // 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";
62
+ import { truncate as truncate4, visibleWidth as visibleWidth4 } from "@oh-my-pi/pi-tui/text/width";
58
63
 
59
64
  // src/ui/topology.ts
60
65
  import { createHash } from "node:crypto";
@@ -988,12 +993,13 @@ var entityTail = (entity, now) => {
988
993
  };
989
994
 
990
995
  // src/ui/dashboard-detail.ts
991
- import { Markdown, truncateToWidth as truncateToWidth2, wrapTextWithAnsi, visibleWidth as visibleWidth2 } from "@oh-my-pi/pi-tui";
996
+ import { renderMarkdown } from "@oh-my-pi/pi-tui/text/markdown/render";
997
+ import { truncate as truncate2, visibleWidth as visibleWidth2, wrap } from "@oh-my-pi/pi-tui/text/width";
992
998
 
993
999
  // src/ui/state-file-preview.ts
994
1000
  import fs from "node:fs";
995
1001
  import path from "node:path";
996
- import { truncateToWidth, visibleWidth } from "@oh-my-pi/pi-tui";
1002
+ import { truncate, visibleWidth } from "@oh-my-pi/pi-tui/text/width";
997
1003
  var MAX_FILE_BYTES = 64 * 1024;
998
1004
  var MAX_FILE_LINES = 240;
999
1005
  var CACHE_LIMIT = 64;
@@ -1069,51 +1075,23 @@ var renderStateFilePreview = (preview, theme, width, maxLines, invalidate) => {
1069
1075
  const digits = String(Math.max(1, shown.length)).length;
1070
1076
  const output = highlighted.map((line, index) => {
1071
1077
  const gutter = theme.fg("dim", `${String(index + 1).padStart(digits)} \u2502 `);
1072
- return truncateToWidth(gutter + line, width, "");
1078
+ return truncate(gutter + line, width, "");
1073
1079
  });
1074
1080
  if ((preview.truncated || preview.lines.length > shown.length) && output.length < maxLines) {
1075
1081
  const omitted = Math.max(0, preview.lines.length - shown.length);
1076
1082
  const label = omitted > 0 ? `\u2026 ${omitted}+ lines omitted` : "\u2026 file truncated";
1077
- output.push(truncateToWidth(theme.fg("dim", label), width, ""));
1083
+ output.push(truncate(theme.fg("dim", label), width, ""));
1078
1084
  }
1079
1085
  return output.filter((line) => visibleWidth(line) <= width);
1080
1086
  };
1081
1087
 
1082
1088
  // 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
1089
  var TRANSCRIPT_EXPANDED_TOOL_LINES = 40;
1112
1090
  var TRANSCRIPT_STRUCTURED_LINES = 40;
1113
1091
  var safeMarkdownText = (value) => value.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "").replace(/\r\n?/g, "\n").replace(/[\u0000-\u0008\u000b-\u000c\u000e-\u001f\u007f-\u009f]/g, " ");
1114
1092
  var DashboardDetailRenderer = class {
1115
- constructor(tui, theme, snapshot, options) {
1116
- this.tui = tui;
1093
+ constructor(host, theme, snapshot, options) {
1094
+ this.host = host;
1117
1095
  this.theme = theme;
1118
1096
  this.snapshot = snapshot;
1119
1097
  this.agentTranscript = options.agentTranscript;
@@ -1130,7 +1108,7 @@ var DashboardDetailRenderer = class {
1130
1108
  actionHint = "";
1131
1109
  toolToggleHint = "";
1132
1110
  transcriptMarkdown = /* @__PURE__ */ new Map();
1133
- highlightInvalidate = () => this.tui.requestRender();
1111
+ highlightInvalidate = () => this.host.requestRender();
1134
1112
  agentTranscript;
1135
1113
  actorTranscript;
1136
1114
  codePreviewSettings;
@@ -1185,7 +1163,7 @@ var DashboardDetailRenderer = class {
1185
1163
  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
1164
  const lines = [this.topBorder(width, `${kindLabel} \xB7 ${entity.label}${viewLabel}`)];
1187
1165
  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;
1166
+ const terminalRows = this.host.size().rows;
1189
1167
  const maxBody = Math.max(1, Math.min(24, terminalRows - 8 - actionLines.length));
1190
1168
  const maxScroll = Math.max(0, content.length - maxBody);
1191
1169
  this.detailMaxScroll = maxScroll;
@@ -1208,7 +1186,7 @@ var DashboardDetailRenderer = class {
1208
1186
  lines.push(this.row(width, this.theme.fg("muted", ` ${actionLine}`)));
1209
1187
  }
1210
1188
  lines.push(this.bottomBorder(width));
1211
- return lines.map((line) => truncateToWidth2(line, width, ""));
1189
+ return lines.map((line) => truncate2(line, width, ""));
1212
1190
  }
1213
1191
  transcriptLines(entity, width) {
1214
1192
  const transcript = this.transcriptFor(entity);
@@ -1239,14 +1217,10 @@ var DashboardDetailRenderer = class {
1239
1217
  statusGlyph(entry.status ?? "completed")
1240
1218
  );
1241
1219
  lines.push(
1242
- truncateToWidth2(
1243
- `${glyph} ${this.theme.fg(
1244
- entry.kind === "assistant" ? "accent" : "muted",
1245
- safeText(entry.label)
1246
- )}`,
1247
- width,
1248
- ""
1249
- )
1220
+ truncate2(`${glyph} ${this.theme.fg(
1221
+ entry.kind === "assistant" ? "accent" : "muted",
1222
+ safeText(entry.label)
1223
+ )}`, width, "")
1250
1224
  );
1251
1225
  if (!entry.text) continue;
1252
1226
  if (entry.kind === "assistant" || entry.kind === "user") {
@@ -1262,7 +1236,7 @@ var DashboardDetailRenderer = class {
1262
1236
  }
1263
1237
  for (const paragraph of entry.text.split("\n")) {
1264
1238
  const wrapped = wrapPlainText(paragraph, Math.max(1, width - 2), 1e4);
1265
- for (const line of wrapped) lines.push(truncateToWidth2(` ${line}`, width, ""));
1239
+ for (const line of wrapped) lines.push(truncate2(` ${line}`, width, ""));
1266
1240
  }
1267
1241
  }
1268
1242
  if (transcript.hasNewer) {
@@ -1287,14 +1261,10 @@ var DashboardDetailRenderer = class {
1287
1261
  invalidate: this.highlightInvalidate
1288
1262
  } : void 0;
1289
1263
  const title = context ? coreToolTitle(audit, this.theme, context) : null;
1290
- const headline = title ?? this.theme.fg("toolTitle", this.theme.bold(entry.toolName ?? entry.label));
1264
+ const headline = title ?? this.theme.fg("toolTitle", this.theme.style("strong", entry.toolName ?? entry.label));
1291
1265
  const collapsedSummary = !this.transcriptToolsExpanded && entry.text ? ` \xB7 ${safeText(entry.text).replace(/\s+/g, " ").trim()}` : "";
1292
1266
  const lines = [
1293
- truncateToWidth2(
1294
- `${padding}${glyph} ${headline}${this.theme.fg("dim", `${status}${collapsedSummary}`)}`,
1295
- width,
1296
- ""
1297
- )
1267
+ truncate2(`${padding}${glyph} ${headline}${this.theme.fg("dim", `${status}${collapsedSummary}`)}`, width, "")
1298
1268
  ];
1299
1269
  if (!this.transcriptToolsExpanded) return lines;
1300
1270
  const rendered = context ? renderCoreToolBody(audit, this.theme, {
@@ -1308,7 +1278,7 @@ var DashboardDetailRenderer = class {
1308
1278
  this.theme,
1309
1279
  this.codePreviewSettings?.diffIntensity ?? "off"
1310
1280
  ).render(Math.max(1, width - visibleWidth2(bodyPadding)))) {
1311
- lines.push(truncateToWidth2(`${bodyPadding}${row}`, width, ""));
1281
+ lines.push(truncate2(`${bodyPadding}${row}`, width, ""));
1312
1282
  }
1313
1283
  if (rendered.hidden > 0) {
1314
1284
  lines.push(this.theme.fg("dim", `${bodyPadding}\u2026 ${rendered.hidden} more lines`));
@@ -1323,7 +1293,7 @@ var DashboardDetailRenderer = class {
1323
1293
  Math.max(1, width - visibleWidth2(bodyPadding)),
1324
1294
  1e4
1325
1295
  )) {
1326
- lines.push(truncateToWidth2(`${bodyPadding}${row}`, width, ""));
1296
+ lines.push(truncate2(`${bodyPadding}${row}`, width, ""));
1327
1297
  }
1328
1298
  }
1329
1299
  if (entry.result !== void 0) {
@@ -1360,11 +1330,11 @@ var DashboardDetailRenderer = class {
1360
1330
  const yamlLines = yaml.split("\n");
1361
1331
  const shownYamlLines = yamlLines.slice(0, TRANSCRIPT_STRUCTURED_LINES);
1362
1332
  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, "")];
1333
+ const lines = [truncate2(`${padding}${this.theme.fg("dim", `${label}:`)}`, width, "")];
1364
1334
  const nestedPadding = `${padding} `;
1365
1335
  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, ""));
1336
+ for (const wrapped of wrap(row, Math.max(1, width - visibleWidth2(nestedPadding)))) {
1337
+ lines.push(truncate2(`${nestedPadding}${wrapped}`, width, ""));
1368
1338
  if (lines.length > TRANSCRIPT_STRUCTURED_LINES) break;
1369
1339
  }
1370
1340
  if (lines.length > TRANSCRIPT_STRUCTURED_LINES) break;
@@ -1381,19 +1351,14 @@ var DashboardDetailRenderer = class {
1381
1351
  markdownLines(key, text, width, indent = 2) {
1382
1352
  const markdown = safeMarkdownText(text);
1383
1353
  if (!markdown.trim()) return [];
1354
+ const padding = " ".repeat(Math.max(0, indent));
1355
+ const contentWidth = Math.max(1, width - visibleWidth2(padding));
1384
1356
  let cached = this.transcriptMarkdown.get(key);
1385
- if (!cached || cached.text !== markdown) {
1357
+ if (!cached || cached.text !== markdown || cached.width !== contentWidth) {
1386
1358
  cached = {
1387
1359
  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
- )
1360
+ width: contentWidth,
1361
+ rows: renderMarkdown(markdown, contentWidth, { theme: this.theme })
1397
1362
  };
1398
1363
  this.transcriptMarkdown.delete(key);
1399
1364
  this.transcriptMarkdown.set(key, cached);
@@ -1403,8 +1368,7 @@ var DashboardDetailRenderer = class {
1403
1368
  this.transcriptMarkdown.delete(oldest);
1404
1369
  }
1405
1370
  }
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, ""));
1371
+ return cached.rows.map((line) => truncate2(`${padding}${line}`, width, ""));
1408
1372
  }
1409
1373
  detailLines(entity, width, now, cwd) {
1410
1374
  const lines = [];
@@ -1413,9 +1377,9 @@ var DashboardDetailRenderer = class {
1413
1377
  if (!text) return;
1414
1378
  const prefix = `${this.theme.fg("dim", `${label}:`)} `;
1415
1379
  const wrapped = wrapPlainText(text, Math.max(1, width - visibleWidth2(prefix)), 12);
1416
- if (wrapped[0]) lines.push(truncateToWidth2(prefix + wrapped[0], width));
1380
+ if (wrapped[0]) lines.push(truncate2(prefix + wrapped[0], width));
1417
1381
  for (const continuation of wrapped.slice(1)) {
1418
- lines.push(truncateToWidth2(" ".repeat(visibleWidth2(prefix)) + continuation, width));
1382
+ lines.push(truncate2(" ".repeat(visibleWidth2(prefix)) + continuation, width));
1419
1383
  }
1420
1384
  };
1421
1385
  const markdownField = (label, value, key) => {
@@ -1433,8 +1397,8 @@ var DashboardDetailRenderer = class {
1433
1397
  lines.push(this.theme.fg("dim", `${label}:`));
1434
1398
  const highlighted = highlightCode(yaml, "yaml", this.highlightInvalidate) ?? yaml.split("\n").map((line) => this.theme.fg("mdCodeBlock", line || " "));
1435
1399
  for (const highlightedLine of highlighted) {
1436
- for (const wrapped of wrapTextWithAnsi(highlightedLine, Math.max(1, width - 2))) {
1437
- lines.push(truncateToWidth2(` ${wrapped}`, width, ""));
1400
+ for (const wrapped of wrap(highlightedLine, Math.max(1, width - 2))) {
1401
+ lines.push(truncate2(` ${wrapped}`, width, ""));
1438
1402
  }
1439
1403
  }
1440
1404
  };
@@ -1497,7 +1461,7 @@ var DashboardDetailRenderer = class {
1497
1461
  this.theme,
1498
1462
  settings.diffIntensity
1499
1463
  ).render(Math.max(1, width - 2));
1500
- for (const row of body) lines.push(truncateToWidth2(` ${row}`, width, ""));
1464
+ for (const row of body) lines.push(truncate2(` ${row}`, width, ""));
1501
1465
  if (rendered.hidden > 0) {
1502
1466
  lines.push(this.theme.fg("muted", ` \u2026 ${rendered.hidden} more lines`));
1503
1467
  }
@@ -1528,7 +1492,7 @@ ${command}
1528
1492
  this.highlightInvalidate
1529
1493
  );
1530
1494
  if (diff) {
1531
- for (const line of diff) lines.push(truncateToWidth2(` ${line}`, width, ""));
1495
+ for (const line of diff) lines.push(truncate2(` ${line}`, width, ""));
1532
1496
  } else {
1533
1497
  structuredField("Edits", edits);
1534
1498
  }
@@ -1763,7 +1727,7 @@ ${command}
1763
1727
  renderNarrowDetail(width, snapshot, entity) {
1764
1728
  const transcriptView = (entity.kind === "agent" || entity.kind === "actor") && this.detailView === "transcript";
1765
1729
  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;
1730
+ const terminalRows = this.host.size().rows;
1767
1731
  const maxBody = Math.max(1, terminalRows - 2);
1768
1732
  this.detailMaxScroll = Math.max(0, content.length - maxBody);
1769
1733
  if (transcriptView && this.transcriptFollowing) {
@@ -1776,11 +1740,11 @@ ${command}
1776
1740
  }
1777
1741
  const title = `${entity.label}${transcriptView ? " \xB7 transcript" : ""}`;
1778
1742
  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);
1743
+ return [title, ...content.slice(this.detailScroll, this.detailScroll + maxBody), hint].map((line) => truncate2(line, width, "")).filter((line) => visibleWidth2(line) > 0);
1780
1744
  }
1781
1745
  topBorder(width, title) {
1782
1746
  const border = (value) => this.theme.fg("borderMuted", value);
1783
- const safeTitle = truncateToWidth2(safeText(title), Math.max(0, width - 6));
1747
+ const safeTitle = truncate2(safeText(title), Math.max(0, width - 6));
1784
1748
  const styledTitle = ` ${this.theme.fg("accent", safeTitle)} `;
1785
1749
  const remaining = Math.max(0, width - 2 - visibleWidth2(styledTitle));
1786
1750
  const left = Math.floor(remaining / 2);
@@ -1803,8 +1767,7 @@ ${command}
1803
1767
  };
1804
1768
 
1805
1769
  // 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";
1770
+ import { truncate as truncate3, visibleWidth as visibleWidth3 } from "@oh-my-pi/pi-tui/text/width";
1808
1771
  var kindRank = {
1809
1772
  agent: 0,
1810
1773
  actor: 1,
@@ -2396,7 +2359,7 @@ var renderCanvas = (theme, layout, selectedEntityId, width, height, camera, anim
2396
2359
  if (style === "edge") return theme.fg("borderMuted", value);
2397
2360
  if (style === "dim") return theme.fg("dim", value);
2398
2361
  if (style === "muted") return theme.fg("muted", value);
2399
- if (style === "accent") return theme.fg("accent", theme.bold(value));
2362
+ if (style === "accent") return theme.fg("accent", theme.style("strong", value));
2400
2363
  if (style === "success") return theme.fg("success", value);
2401
2364
  if (style === "warning") return theme.fg("warning", value);
2402
2365
  if (style === "error") return theme.fg("error", value);
@@ -2415,12 +2378,12 @@ var renderCanvas = (theme, layout, selectedEntityId, width, height, camera, anim
2415
2378
  run += cell.char;
2416
2379
  }
2417
2380
  rendered += apply(style, run);
2418
- return truncateToWidth3(rendered, width, "");
2381
+ return truncate3(rendered, width, "");
2419
2382
  });
2420
2383
  };
2421
2384
  var wrapInspector = (theme, label, value, width) => {
2422
2385
  const clean = safeText(value);
2423
- const first = truncateToWidth3(clean, Math.max(1, width - label.length - 1), Ellipsis2.Unicode);
2386
+ const first = truncate3(clean, Math.max(1, width - label.length - 1));
2424
2387
  return [theme.fg("muted", `${label} ${first}`)];
2425
2388
  };
2426
2389
  var inspectorLines = (theme, entity, snapshot, run, width, height, invalidate) => {
@@ -2428,10 +2391,10 @@ var inspectorLines = (theme, entity, snapshot, run, width, height, invalidate) =
2428
2391
  const border = (value) => theme.fg("borderMuted", value);
2429
2392
  const content = [];
2430
2393
  if (entity) {
2431
- content.push(theme.fg("accent", theme.bold(truncateToWidth3(safeText(entity.label), inner - 2, Ellipsis2.Unicode))));
2394
+ content.push(theme.fg("accent", theme.style("strong", truncate3(safeText(entity.label), inner - 2))));
2432
2395
  content.push(colorStatus(theme, entity.status, `${statusGlyph(entity.status)} ${entity.kind} \xB7 ${entity.status}`));
2433
2396
  content.push("");
2434
- content.push(theme.fg("dim", truncateToWidth3(safeText(entityTail(entity, snapshot.now)), inner - 2, Ellipsis2.Unicode)));
2397
+ content.push(theme.fg("dim", truncate3(safeText(entityTail(entity, snapshot.now)), inner - 2)));
2435
2398
  if (entity.kind === "agent") {
2436
2399
  const agentRun = snapshot.runs.find((candidate) => candidate.id === entity.value.runId) ?? run;
2437
2400
  const phase = agentRun?.phases.find((candidate) => candidate.id === entity.value.phaseId);
@@ -2583,12 +2546,8 @@ var renderFabricTopologyPanel = ({
2583
2546
  animation.reducedMotion ? "reduced motion" : void 0,
2584
2547
  filter !== "all" ? `${entities.length}/${allEntities.length} ${filter}` : void 0
2585
2548
  ].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
- );
2549
+ const graphLegend = padToWidth(theme.fg("dim", truncate3(legend, graphWidth, "")), graphWidth);
2550
+ lines[0] = truncate3(graphLegend + (inspectorWidth > 0 ? inspector[0] ?? "" : ""), width, "");
2592
2551
  }
2593
2552
  const selectedPosition = selected ? layout.positions.get(selected.id) : void 0;
2594
2553
  return {
@@ -2617,7 +2576,6 @@ var directionalGraphTarget = (positions, currentId, direction) => {
2617
2576
  };
2618
2577
 
2619
2578
  // src/ui/fabric-host-event-selector.ts
2620
- import { Container, getKeybindings, Spacer, Text } from "@oh-my-pi/pi-tui";
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 (keyMatches(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 (keyMatches(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 (keyMatches(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 (keyMatches(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,6 @@ 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";
2826
2763
  var ACTOR_TOOL_ORDER = ["read", "grep", "find", "ls", "bash", "edit", "write"];
2827
2764
  var TOOL_LABELS = {
2828
2765
  read: "read files",
@@ -2833,102 +2770,67 @@ var TOOL_LABELS = {
2833
2770
  edit: "edit existing files",
2834
2771
  write: "write files"
2835
2772
  };
2836
- var FabricActorToolSelector = class extends Container3 {
2773
+ var FabricActorToolSelector = class {
2837
2774
  theme;
2838
2775
  onSelectCallback;
2839
2776
  onCancelCallback;
2840
- listContainer = new Container3();
2777
+ header;
2841
2778
  enabled;
2842
2779
  selectedIndex = 0;
2843
- focused = false;
2844
2780
  constructor(options) {
2845
- super();
2846
2781
  this.theme = options.theme;
2847
2782
  this.onSelectCallback = options.onSelect;
2848
2783
  this.onCancelCallback = options.onCancel;
2849
2784
  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
- )
2785
+ this.header = new TextBlock(
2786
+ this.theme.fg("muted", options.headerText ?? "Select the optional tools available to this actor.")
2856
2787
  );
2857
- this.addChild(new Spacer3(1));
2858
- this.addChild(this.listContainer);
2859
- this.addChild(new Spacer3(1));
2860
- this.updateList();
2861
2788
  }
2862
2789
  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();
2790
+ for (const event of decodeTerminalInput(keyData)) {
2791
+ if (event.type !== "key") continue;
2792
+ const key = event.key;
2793
+ if (keyMatches(key, "select.up")) {
2794
+ this.selectedIndex = this.selectedIndex === 0 ? ACTOR_TOOL_ORDER.length - 1 : this.selectedIndex - 1;
2795
+ } else if (keyMatches(key, "select.down")) {
2796
+ this.selectedIndex = this.selectedIndex === ACTOR_TOOL_ORDER.length - 1 ? 0 : this.selectedIndex + 1;
2797
+ } else if (key.id === "space") {
2798
+ const tool = ACTOR_TOOL_ORDER[this.selectedIndex];
2799
+ if (tool) {
2800
+ if (this.enabled.has(tool)) this.enabled.delete(tool);
2801
+ else this.enabled.add(tool);
2802
+ }
2803
+ } else if (keyMatches(key, "select.confirm")) {
2804
+ const selected = ACTOR_TOOL_ORDER.filter((tool) => this.enabled.has(tool));
2805
+ const custom = [...this.enabled].filter(
2806
+ (tool) => !ACTOR_TOOL_ORDER.includes(tool)
2807
+ );
2808
+ this.onSelectCallback([...selected, ...custom]);
2809
+ } else if (keyMatches(key, "select.cancel")) {
2810
+ this.onCancelCallback();
2876
2811
  }
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
2812
  }
2886
2813
  }
2887
- updateList() {
2888
- this.listContainer.clear();
2814
+ render(width) {
2815
+ const rows = [...this.header.render(width), ""];
2889
2816
  for (let index = 0; index < ACTOR_TOOL_ORDER.length; index++) {
2890
2817
  const tool = ACTOR_TOOL_ORDER[index];
2891
2818
  const selected = index === this.selectedIndex;
2892
2819
  const checked = this.enabled.has(tool);
2893
2820
  const box = checked ? this.theme.fg("success", "[x]") : this.theme.fg("dim", "[ ]");
2894
2821
  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));
2822
+ rows.push(...new TextBlock(selected ? `${this.theme.fg("accent", "\u2192 ")}${this.theme.fg("accent", label)}` : ` ${label}`).render(width));
2897
2823
  }
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
- );
2824
+ rows.push("", ...new TextBlock(this.theme.fg("muted", " space toggle \xB7 enter apply \xB7 esc cancel")).render(width), "");
2825
+ return rows;
2902
2826
  }
2903
2827
  };
2904
2828
 
2905
2829
  // 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 {
2830
+ var FabricThinkingSelector = class extends Stack {
2926
2831
  selectList;
2927
- onSelectCallback;
2928
- focused = false;
2929
2832
  constructor(options) {
2930
2833
  super();
2931
- this.onSelectCallback = options.onSelect;
2932
2834
  const headerText = options.headerText ?? "Thinking level for this actor. Pick Inherit to use the Fabric default.";
2933
2835
  const inheritName = options.inheritName ?? "Use the Fabric default thinking level";
2934
2836
  const items = [
@@ -2943,14 +2845,17 @@ var FabricThinkingSelector = class extends Container4 {
2943
2845
  }))
2944
2846
  ];
2945
2847
  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);
2848
+ this.add(new TextBlock(options.theme.fg("muted", headerText)));
2849
+ this.add(new BlankRows(1));
2850
+ this.selectList = new SelectList(items, items.length, options.theme, {
2851
+ minPrimaryColumnWidth: 8,
2852
+ maxPrimaryColumnWidth: 24
2853
+ });
2949
2854
  if (startIndex >= 0) this.selectList.setSelectedIndex(startIndex);
2950
- this.selectList.onSelect = (item) => this.onSelectCallback(item.value);
2855
+ this.selectList.onSelect = (item) => options.onSelect(item.value);
2951
2856
  this.selectList.onCancel = options.onCancel;
2952
- this.addChild(this.selectList);
2953
- this.addChild(new Spacer4(1));
2857
+ this.add(this.selectList);
2858
+ this.add(new BlankRows(1));
2954
2859
  }
2955
2860
  handleInput(data) {
2956
2861
  this.selectList.handleInput(data);
@@ -2958,34 +2863,12 @@ var FabricThinkingSelector = class extends Container4 {
2958
2863
  };
2959
2864
 
2960
2865
  // 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
2866
  var FabricDashboard = class {
2983
- constructor(tui, theme, snapshot, done, options = {}) {
2984
- this.tui = tui;
2867
+ constructor(host, theme, snapshot, done, options = {}) {
2868
+ this.host = host;
2985
2869
  this.theme = theme;
2986
2870
  this.snapshot = snapshot;
2987
2871
  this.done = done;
2988
- this.focused = true;
2989
2872
  this.modelSource = options.modelSource;
2990
2873
  this.codePreviewSettings = options.codePreviewSettings;
2991
2874
  this.keybindings = options.keybindings;
@@ -3013,14 +2896,13 @@ var FabricDashboard = class {
3013
2896
  this.onImportActor = options.onImportActor;
3014
2897
  this.onExportActor = options.onExportActor;
3015
2898
  this.onRemoveGlobalActor = options.onRemoveGlobalActor;
3016
- this.detailRenderer = new DashboardDetailRenderer(tui, theme, snapshot, {
2899
+ this.detailRenderer = new DashboardDetailRenderer(host, theme, snapshot, {
3017
2900
  agentTranscript: this.agentTranscript,
3018
2901
  actorTranscript: this.actorTranscript,
3019
2902
  codePreviewSettings: this.codePreviewSettings,
3020
2903
  actorDefaultTools: this.actorDefaultTools
3021
2904
  });
3022
2905
  }
3023
- focused = false;
3024
2906
  pane = "phases";
3025
2907
  overviewView = "activity";
3026
2908
  graphPositions = /* @__PURE__ */ new Map();
@@ -3057,7 +2939,7 @@ var FabricDashboard = class {
3057
2939
  detailView = "summary";
3058
2940
  transcriptFollowing = true;
3059
2941
  detailRenderer;
3060
- highlightInvalidate = () => this.tui.requestRender();
2942
+ highlightInvalidate = () => this.host.requestRender();
3061
2943
  mode = "overview";
3062
2944
  picker;
3063
2945
  editor;
@@ -3094,33 +2976,33 @@ var FabricDashboard = class {
3094
2976
  pickerActorName;
3095
2977
  handleInput(data) {
3096
2978
  if (this.mode === "help") {
3097
- if (data === "?" || matchesKey(data, Key.escape) || matchesKey(data, Key.ctrl("c"))) {
2979
+ if (data === "?" || isKey(data, "escape") || isKey(data, "ctrl+c")) {
3098
2980
  this.mode = this.detailId ? "detail" : "overview";
3099
2981
  }
3100
- this.tui.requestRender();
2982
+ this.host.requestRender();
3101
2983
  return;
3102
2984
  }
3103
2985
  if (this.mode === "agentMessageEditor" && this.editor) {
3104
- if (getKeybindings3().matches(data, "tui.select.cancel")) {
2986
+ if (isAction(data, "select.cancel")) {
3105
2987
  this.closeAgentMessageEditor();
3106
2988
  } else {
3107
2989
  this.editor.handleInput(data);
3108
2990
  }
3109
- this.tui.requestRender();
2991
+ this.host.requestRender();
3110
2992
  return;
3111
2993
  }
3112
2994
  if (this.mode === "instructionsEditor" && this.editor) {
3113
- if (getKeybindings3().matches(data, "tui.select.cancel")) {
2995
+ if (isAction(data, "select.cancel")) {
3114
2996
  this.closeInstructionsEditor();
3115
2997
  } else {
3116
2998
  this.editor.handleInput(data);
3117
2999
  }
3118
- this.tui.requestRender();
3000
+ this.host.requestRender();
3119
3001
  return;
3120
3002
  }
3121
3003
  if ((this.mode === "modelPicker" || this.mode === "thinkingPicker" || this.mode === "deliveryPicker" || this.mode === "eventsPicker" || this.mode === "toolsPicker") && this.picker) {
3122
3004
  this.picker.handleInput(data);
3123
- this.tui.requestRender();
3005
+ this.host.requestRender();
3124
3006
  return;
3125
3007
  }
3126
3008
  const snapshot = this.snapshot();
@@ -3148,11 +3030,11 @@ var FabricDashboard = class {
3148
3030
  }
3149
3031
  if (data === "?") {
3150
3032
  this.mode = "help";
3151
- this.tui.requestRender();
3033
+ this.host.requestRender();
3152
3034
  return;
3153
3035
  }
3154
3036
  if (this.detailId) {
3155
- if (matchesKey(data, Key.escape) || matchesKey(data, Key.ctrl("c")) || matchesKey(data, Key.left) || data === "h") {
3037
+ if (isKey(data, "escape") || isKey(data, "ctrl+c") || isKey(data, "left") || data === "h") {
3156
3038
  this.closeDetail();
3157
3039
  } else if (data === "t") {
3158
3040
  const detail = allEntities.find((entity) => entity.id === this.detailId);
@@ -3164,7 +3046,7 @@ var FabricDashboard = class {
3164
3046
  }
3165
3047
  } else if (this.detailView === "transcript" && this.matchesTranscriptToolToggle(data)) {
3166
3048
  this.transcriptToolsExpanded = !this.transcriptToolsExpanded;
3167
- } else if (matchesKey(data, Key.up) || data === "k") {
3049
+ } else if (isKey(data, "up") || data === "k") {
3168
3050
  if (this.detailScroll > 0) {
3169
3051
  if (this.detailView === "transcript") this.transcriptFollowing = false;
3170
3052
  this.detailScroll--;
@@ -3176,7 +3058,7 @@ var FabricDashboard = class {
3176
3058
  this.transcriptFollowing = false;
3177
3059
  }
3178
3060
  }
3179
- } else if (matchesKey(data, Key.down) || data === "j") {
3061
+ } else if (isKey(data, "down") || data === "j") {
3180
3062
  if (this.detailScroll < this.detailMaxScroll) {
3181
3063
  if (this.detailView === "transcript") this.transcriptFollowing = false;
3182
3064
  this.detailScroll++;
@@ -3195,7 +3077,7 @@ var FabricDashboard = class {
3195
3077
  this.transcriptPageAnchor = void 0;
3196
3078
  this.transcriptFollowing = true;
3197
3079
  this.detailScroll = this.detailMaxScroll;
3198
- } else if (matchesKey(data, Key.home) || data === "g") {
3080
+ } else if (isKey(data, "home") || data === "g") {
3199
3081
  if (this.detailView === "transcript") {
3200
3082
  this.transcriptPageAnchor = void 0;
3201
3083
  this.transcriptFollowing = false;
@@ -3260,7 +3142,7 @@ var FabricDashboard = class {
3260
3142
  this.onRemoveGlobalActor(detail.value.id);
3261
3143
  }
3262
3144
  }
3263
- this.tui.requestRender();
3145
+ this.host.requestRender();
3264
3146
  return;
3265
3147
  }
3266
3148
  if (data === "1" || data === "2") {
@@ -3276,10 +3158,10 @@ var FabricDashboard = class {
3276
3158
  this.selectedEntityId = void 0;
3277
3159
  this.pendingStop = void 0;
3278
3160
  }
3279
- this.tui.requestRender();
3161
+ this.host.requestRender();
3280
3162
  return;
3281
3163
  }
3282
- if (matchesKey(data, Key.escape) || matchesKey(data, Key.ctrl("c"))) {
3164
+ if (isKey(data, "escape") || isKey(data, "ctrl+c")) {
3283
3165
  if (this.overviewView === "activity" && this.pane === "entities") {
3284
3166
  this.pane = "phases";
3285
3167
  } else {
@@ -3289,17 +3171,17 @@ var FabricDashboard = class {
3289
3171
  } else if (this.overviewView === "topology" && data === "r") {
3290
3172
  this.toggleGraphReplay(snapshot, projectMesh);
3291
3173
  this.startGraphEffectsAnimation();
3292
- this.tui.requestRender();
3174
+ this.host.requestRender();
3293
3175
  return;
3294
3176
  } else if (this.overviewView === "topology" && this.graphReplayIndex !== void 0 && data === " ") {
3295
3177
  this.graphReplayPlaying = !this.graphReplayPlaying;
3296
3178
  this.graphReplayAdvancedAt = Date.now();
3297
3179
  this.startGraphEffectsAnimation();
3298
- this.tui.requestRender();
3180
+ this.host.requestRender();
3299
3181
  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();
3182
+ } else if (this.overviewView === "topology" && this.graphReplayIndex !== void 0 && (isKey(data, "left") || isKey(data, "right"))) {
3183
+ this.stepGraphReplay(isKey(data, "left") ? -1 : 1);
3184
+ this.host.requestRender();
3303
3185
  return;
3304
3186
  } else if (this.overviewView === "topology" && (data === "+" || data === "=" || data === "-")) {
3305
3187
  const speeds = [0.5, 1, 2, 4];
@@ -3307,11 +3189,11 @@ var FabricDashboard = class {
3307
3189
  const direction = data === "-" ? -1 : 1;
3308
3190
  this.graphReplaySpeed = speeds[Math.max(0, Math.min(speeds.length - 1, current + direction))] ?? 1;
3309
3191
  this.graphReplayAdvancedAt = Date.now();
3310
- this.tui.requestRender();
3192
+ this.host.requestRender();
3311
3193
  return;
3312
3194
  } else if (this.overviewView === "topology" && data === "H") {
3313
3195
  this.graphShowHistory = !this.graphShowHistory;
3314
- this.tui.requestRender();
3196
+ this.host.requestRender();
3315
3197
  return;
3316
3198
  } else if (this.overviewView === "topology" && data === "M") {
3317
3199
  const selected = this.pane === "entities" ? entities[this.entityIndex] : void 0;
@@ -3321,10 +3203,10 @@ var FabricDashboard = class {
3321
3203
  } else {
3322
3204
  this.graphReducedMotion = !this.graphReducedMotion;
3323
3205
  }
3324
- this.tui.requestRender();
3206
+ this.host.requestRender();
3325
3207
  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";
3208
+ } else if (this.overviewView === "topology" && (isKey(data, "left") || isKey(data, "right") || isKey(data, "up") || isKey(data, "down") || data === "h" || data === "l")) {
3209
+ const direction = isKey(data, "left") || data === "h" ? "left" : isKey(data, "right") || data === "l" ? "right" : isKey(data, "up") ? "up" : "down";
3328
3210
  const target = directionalGraphTarget(this.graphPositions, this.selectedEntityId, direction);
3329
3211
  const targetIndex = target ? entities.findIndex((entity) => entity.id === target) : -1;
3330
3212
  if (targetIndex >= 0) {
@@ -3332,21 +3214,21 @@ var FabricDashboard = class {
3332
3214
  this.selectedEntityId = target;
3333
3215
  this.pendingStop = void 0;
3334
3216
  }
3335
- this.tui.requestRender();
3217
+ this.host.requestRender();
3336
3218
  return;
3337
- } else if (matchesKey(data, Key.tab) && this.overviewView === "topology") {
3219
+ } else if (isKey(data, "tab") && this.overviewView === "topology") {
3338
3220
  this.entityIndex = entities.length > 0 ? (this.entityIndex + 1) % entities.length : 0;
3339
3221
  this.selectedEntityId = entities[this.entityIndex]?.id;
3340
3222
  this.pendingStop = void 0;
3341
- this.tui.requestRender();
3223
+ this.host.requestRender();
3342
3224
  return;
3343
- } else if (matchesKey(data, Key.tab) && this.overviewView === "activity") {
3225
+ } else if (isKey(data, "tab") && this.overviewView === "activity") {
3344
3226
  this.pane = this.pane === "phases" ? "entities" : "phases";
3345
- } else if (this.overviewView === "activity" && (matchesKey(data, Key.left) || data === "h")) {
3227
+ } else if (this.overviewView === "activity" && (isKey(data, "left") || data === "h")) {
3346
3228
  this.pane = "phases";
3347
- } else if (this.overviewView === "activity" && (matchesKey(data, Key.right) || data === "l")) {
3229
+ } else if (this.overviewView === "activity" && (isKey(data, "right") || data === "l")) {
3348
3230
  this.pane = "entities";
3349
- } else if (matchesKey(data, Key.up) || data === "k") {
3231
+ } else if (isKey(data, "up") || data === "k") {
3350
3232
  if (this.overviewView === "activity" && this.pane === "phases") {
3351
3233
  this.phaseIndex = Math.max(0, this.phaseIndex - 1);
3352
3234
  this.phaseSelectionTouched = true;
@@ -3355,7 +3237,7 @@ var FabricDashboard = class {
3355
3237
  } else {
3356
3238
  this.entityIndex = Math.max(0, this.entityIndex - 1);
3357
3239
  }
3358
- } else if (matchesKey(data, Key.down) || data === "j") {
3240
+ } else if (isKey(data, "down") || data === "j") {
3359
3241
  if (this.overviewView === "activity" && this.pane === "phases") {
3360
3242
  this.phaseIndex = Math.min(Math.max(0, panels.length - 1), this.phaseIndex + 1);
3361
3243
  this.phaseSelectionTouched = true;
@@ -3409,7 +3291,7 @@ var FabricDashboard = class {
3409
3291
  this.transcriptPageAnchor = void 0;
3410
3292
  this.transcriptFollowing = true;
3411
3293
  }
3412
- } else if (matchesKey(data, Key.enter)) {
3294
+ } else if (isKey(data, "enter")) {
3413
3295
  if (this.overviewView === "activity" && this.pane === "phases") {
3414
3296
  this.pane = "entities";
3415
3297
  } else {
@@ -3426,21 +3308,21 @@ var FabricDashboard = class {
3426
3308
  this.filter = filters[next] ?? "all";
3427
3309
  this.entityIndex = 0;
3428
3310
  this.selectedEntityId = void 0;
3429
- this.tui.requestRender();
3311
+ this.host.requestRender();
3430
3312
  return;
3431
3313
  } else if (data === "[") {
3432
3314
  this.runIndex = Math.min(Math.max(0, snapshot.runs.length - 1), this.runIndex + 1);
3433
3315
  this.selectedRunId = snapshot.runs[this.runIndex]?.id;
3434
3316
  this.runSelectionTouched = true;
3435
3317
  this.resetSelection();
3436
- this.tui.requestRender();
3318
+ this.host.requestRender();
3437
3319
  return;
3438
3320
  } else if (data === "]") {
3439
3321
  this.runIndex = Math.max(0, this.runIndex - 1);
3440
3322
  this.selectedRunId = snapshot.runs[this.runIndex]?.id;
3441
3323
  this.runSelectionTouched = true;
3442
3324
  this.resetSelection();
3443
- this.tui.requestRender();
3325
+ this.host.requestRender();
3444
3326
  return;
3445
3327
  } else if (data === "G") {
3446
3328
  if (this.overviewView === "activity" && this.pane === "phases") {
@@ -3468,7 +3350,7 @@ var FabricDashboard = class {
3468
3350
  if (this.pane === "entities") {
3469
3351
  this.selectedEntityId = entities[this.entityIndex]?.id;
3470
3352
  }
3471
- this.tui.requestRender();
3353
+ this.host.requestRender();
3472
3354
  }
3473
3355
  render(width) {
3474
3356
  if (width <= 0) return [];
@@ -3534,14 +3416,13 @@ var FabricDashboard = class {
3534
3416
  return entity.kind === "agent" && this.agentTranscript !== void 0 || entity.kind === "actor" && this.actorTranscript !== void 0;
3535
3417
  }
3536
3418
  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"));
3419
+ const key = keyOf(data);
3420
+ if (!key) return false;
3421
+ return this.keybindings ? this.keybindings.matches(key, "app.tools.expand") : key.id === "ctrl+o";
3541
3422
  }
3542
3423
  transcriptToolToggleHint() {
3543
- const keys = (this.keybindings ?? getKeybindings3()).getKeys("app.tools.expand");
3544
- const key = keys.length > 0 ? keys.join("/") : this.keybindings ? "unbound" : "ctrl+o";
3424
+ const keys = this.keybindings?.keysFor("app.tools.expand") ?? ["ctrl+o"];
3425
+ const key = keys.length > 0 ? keys.join("/") : "unbound";
3545
3426
  return `${key} ${this.transcriptToolsExpanded ? "collapse" : "expand"} tools`;
3546
3427
  }
3547
3428
  messageTarget(entity) {
@@ -3585,8 +3466,7 @@ var FabricDashboard = class {
3585
3466
  openAgentMessageEditor(entity, delivery) {
3586
3467
  const target = this.messageTarget(entity);
3587
3468
  if (!target || !this.canMessage(entity, delivery)) return;
3588
- const editor = new Editor(editorTheme(this.theme));
3589
- editor.focused = true;
3469
+ const editor = new TextField({ multiline: true });
3590
3470
  editor.onSubmit = (text) => {
3591
3471
  const message = text.trim();
3592
3472
  if (!message) return;
@@ -3646,7 +3526,7 @@ var FabricDashboard = class {
3646
3526
  )
3647
3527
  );
3648
3528
  lines.push(this.bottomBorder(width));
3649
- return lines.map((line) => truncateToWidth4(line, width, ""));
3529
+ return lines.map((line) => truncate4(line, width, ""));
3650
3530
  }
3651
3531
  renderHelp(width) {
3652
3532
  if (width < 24) return this.renderNarrowFallback(width, "dashboard help", "? or esc close");
@@ -3708,7 +3588,7 @@ var FabricDashboard = class {
3708
3588
  lines.push(this.middleBorder(width));
3709
3589
  lines.push(this.row(width, this.theme.fg("dim", " ? or esc close")));
3710
3590
  lines.push(this.bottomBorder(width));
3711
- return lines.map((line) => truncateToWidth4(line, width, ""));
3591
+ return lines.map((line) => truncate4(line, width, ""));
3712
3592
  }
3713
3593
  modelSourceForActor(actor) {
3714
3594
  return actor.runner === "claude" ? this.claudeModelSource : this.modelSource;
@@ -3736,7 +3616,6 @@ var FabricDashboard = class {
3736
3616
  },
3737
3617
  onCancel: () => this.closeModelPicker()
3738
3618
  });
3739
- this.picker.focused = true;
3740
3619
  this.mode = "modelPicker";
3741
3620
  }
3742
3621
  openThinkingPicker(entity, scope = "session") {
@@ -3762,7 +3641,6 @@ var FabricDashboard = class {
3762
3641
  },
3763
3642
  onCancel: () => this.closeModelPicker()
3764
3643
  });
3765
- this.picker.focused = true;
3766
3644
  this.mode = "thinkingPicker";
3767
3645
  }
3768
3646
  openDeliveryPicker(entity) {
@@ -3781,7 +3659,6 @@ var FabricDashboard = class {
3781
3659
  },
3782
3660
  onCancel: () => this.closeModelPicker()
3783
3661
  });
3784
- this.picker.focused = true;
3785
3662
  this.mode = "deliveryPicker";
3786
3663
  }
3787
3664
  openEventsPicker(entity) {
@@ -3798,7 +3675,6 @@ var FabricDashboard = class {
3798
3675
  },
3799
3676
  onCancel: () => this.closeModelPicker()
3800
3677
  });
3801
- this.picker.focused = true;
3802
3678
  this.mode = "eventsPicker";
3803
3679
  }
3804
3680
  openToolsPicker(entity) {
@@ -3815,7 +3691,6 @@ var FabricDashboard = class {
3815
3691
  },
3816
3692
  onCancel: () => this.closeModelPicker()
3817
3693
  });
3818
- this.picker.focused = true;
3819
3694
  this.mode = "toolsPicker";
3820
3695
  }
3821
3696
  closeModelPicker() {
@@ -3850,8 +3725,7 @@ var FabricDashboard = class {
3850
3725
  } else {
3851
3726
  return;
3852
3727
  }
3853
- const editor = new Editor(editorTheme(this.theme));
3854
- editor.focused = true;
3728
+ const editor = new TextField({ multiline: true });
3855
3729
  editor.setText(instructions);
3856
3730
  editor.onSubmit = (text) => {
3857
3731
  if (kind === "actor") this.onActorInstructions?.(id, text);
@@ -3885,7 +3759,7 @@ var FabricDashboard = class {
3885
3759
  )
3886
3760
  );
3887
3761
  lines.push(this.bottomBorder(width));
3888
- return lines.map((line) => truncateToWidth4(line, width, ""));
3762
+ return lines.map((line) => truncate4(line, width, ""));
3889
3763
  }
3890
3764
  renderInstructionsEditor(width) {
3891
3765
  if (!this.editor) return [];
@@ -3903,7 +3777,7 @@ var FabricDashboard = class {
3903
3777
  )
3904
3778
  );
3905
3779
  lines.push(this.bottomBorder(width));
3906
- return lines.map((line) => truncateToWidth4(line, width, ""));
3780
+ return lines.map((line) => truncate4(line, width, ""));
3907
3781
  }
3908
3782
  projectMesh(snapshot) {
3909
3783
  if (this.overviewView !== "topology") return void 0;
@@ -3938,7 +3812,7 @@ var FabricDashboard = class {
3938
3812
  this.graphReplayPlaying = false;
3939
3813
  }
3940
3814
  }
3941
- this.tui.requestRender();
3815
+ this.host.requestRender();
3942
3816
  }, 80);
3943
3817
  this.graphEffectsAnimation.unref?.();
3944
3818
  }
@@ -4024,18 +3898,14 @@ var FabricDashboard = class {
4024
3898
  if (this.graphAnimation) clearInterval(this.graphAnimation);
4025
3899
  this.graphAnimation = void 0;
4026
3900
  }
4027
- this.tui.requestRender();
3901
+ this.host.requestRender();
4028
3902
  }
4029
3903
  renderOverview(width, snapshot, run, panels, entities, allEntities, meshModel) {
4030
3904
  if (width < 24) {
4031
- return [truncateToWidth4("too narrow \xB7 need 24 cols", width)];
3905
+ return [truncate4("too narrow \xB7 need 24 cols", width)];
4032
3906
  }
4033
3907
  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);
3908
+ const overlayRows = Math.max(1, this.host.size().rows);
4039
3909
  const lines = [];
4040
3910
  const title = this.overviewView === "activity" ? `Fabric \xB7 ${run?.name ?? "session"} \xB7 Activity` : "Fabric \xB7 Topology";
4041
3911
  lines.push(this.topBorder(width, title));
@@ -4081,7 +3951,7 @@ var FabricDashboard = class {
4081
3951
  title,
4082
3952
  this.theme.fg("dim", summaryText || "No Fabric activity yet"),
4083
3953
  this.theme.fg("dim", "1 activity \xB7 2 topology \xB7 arrows move \xB7 esc close")
4084
- ].slice(0, overlayRows).map((line) => truncateToWidth4(line, width, ""));
3954
+ ].slice(0, overlayRows).map((line) => truncate4(line, width, ""));
4085
3955
  }
4086
3956
  lines.push(this.row(width, headerLine || this.theme.fg("muted", "No Fabric activity yet")));
4087
3957
  lines.push(this.middleBorder(width));
@@ -4218,7 +4088,7 @@ var FabricDashboard = class {
4218
4088
  const actionHint = this.pane === "entities" && selectedEntity ? this.theme.fg("muted", ` ${this.overviewActionHint(selectedEntity)}`) : "";
4219
4089
  lines.push(this.row(width, actionHint));
4220
4090
  lines.push(this.bottomBorder(width));
4221
- return lines.map((line) => truncateToWidth4(line, width, ""));
4091
+ return lines.map((line) => truncate4(line, width, ""));
4222
4092
  }
4223
4093
  overviewActionHint(entity) {
4224
4094
  if (entity.kind === "main") {
@@ -4288,13 +4158,10 @@ var FabricDashboard = class {
4288
4158
  }
4289
4159
  renderPhasePanel(panels, width, height) {
4290
4160
  const lines = [
4291
- truncateToWidth4(
4292
- `${this.pane === "phases" ? this.theme.fg("accent", "\u25B8 ") : " "}${this.theme.fg(
4293
- "accent",
4294
- "Activity"
4295
- )}`,
4296
- width
4297
- )
4161
+ truncate4(`${this.pane === "phases" ? this.theme.fg("accent", "\u25B8 ") : " "}${this.theme.fg(
4162
+ "accent",
4163
+ "Activity"
4164
+ )}`, width)
4298
4165
  ];
4299
4166
  const available = Math.max(0, height - 1);
4300
4167
  const start = Math.max(
@@ -4316,7 +4183,7 @@ var FabricDashboard = class {
4316
4183
  if (selected && this.pane === "phases") {
4317
4184
  line = this.theme.bg("selectedBg", padToWidth(line, width));
4318
4185
  }
4319
- lines.push(truncateToWidth4(line, width, ""));
4186
+ lines.push(truncate4(line, width, ""));
4320
4187
  }
4321
4188
  while (lines.length < height) lines.push("");
4322
4189
  return lines.slice(0, height);
@@ -4356,14 +4223,10 @@ var FabricDashboard = class {
4356
4223
  }
4357
4224
  if (row.type === "group") {
4358
4225
  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
- )
4226
+ truncate4(this.theme.fg(
4227
+ "muted",
4228
+ ` ${this.theme.style("strong", row.group.label)} (${row.group.entries.length})`
4229
+ ), width, "")
4367
4230
  );
4368
4231
  continue;
4369
4232
  }
@@ -4378,7 +4241,7 @@ var FabricDashboard = class {
4378
4241
  if (selected && this.pane === "entities") {
4379
4242
  line = this.theme.bg("selectedBg", padToWidth(line, width));
4380
4243
  }
4381
- lines.push(truncateToWidth4(line, width, ""));
4244
+ lines.push(truncate4(line, width, ""));
4382
4245
  }
4383
4246
  if (entities.length === 0 && available > 0) {
4384
4247
  const label = this.filter === "all" ? "activity" : `${this.filter} activity`;
@@ -4572,11 +4435,11 @@ var FabricDashboard = class {
4572
4435
  this.transcriptFollowing = true;
4573
4436
  }
4574
4437
  renderNarrowFallback(width, label, hint) {
4575
- return [safeText(label), hint].map((line) => truncateToWidth4(line, width, "")).filter((line) => visibleWidth4(line) > 0);
4438
+ return [safeText(label), hint].map((line) => truncate4(line, width, "")).filter((line) => visibleWidth4(line) > 0);
4576
4439
  }
4577
4440
  topBorder(width, title) {
4578
4441
  const border = (value) => this.theme.fg("borderMuted", value);
4579
- const safeTitle = truncateToWidth4(safeText(title), Math.max(0, width - 6));
4442
+ const safeTitle = truncate4(safeText(title), Math.max(0, width - 6));
4580
4443
  const styledTitle = ` ${this.theme.fg("accent", safeTitle)} `;
4581
4444
  const remaining = Math.max(0, width - 2 - visibleWidth4(styledTitle));
4582
4445
  const left = Math.floor(remaining / 2);