@h-rig/cli 0.0.6-alpha.87 → 0.0.6-alpha.89

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 (78) hide show
  1. package/dist/bin/rig.js +1380 -865
  2. package/dist/src/app/board.js +462 -48
  3. package/dist/src/app-opentui/adapters/common.d.ts +3 -0
  4. package/dist/src/app-opentui/adapters/common.js +4 -0
  5. package/dist/src/app-opentui/adapters/doctor.js +458 -46
  6. package/dist/src/app-opentui/adapters/family.js +701 -151
  7. package/dist/src/app-opentui/adapters/fleet.js +477 -46
  8. package/dist/src/app-opentui/adapters/inbox.js +477 -46
  9. package/dist/src/app-opentui/adapters/init.js +497 -74
  10. package/dist/src/app-opentui/adapters/inspect.js +477 -46
  11. package/dist/src/app-opentui/adapters/pi-attach.d.ts +7 -0
  12. package/dist/src/app-opentui/adapters/pi-attach.js +1004 -519
  13. package/dist/src/app-opentui/adapters/run-detail.js +477 -46
  14. package/dist/src/app-opentui/adapters/server.d.ts +26 -0
  15. package/dist/src/app-opentui/adapters/server.js +676 -59
  16. package/dist/src/app-opentui/adapters/tasks.js +621 -549
  17. package/dist/src/app-opentui/autocomplete.js +4 -2
  18. package/dist/src/app-opentui/bootstrap.js +1376 -861
  19. package/dist/src/app-opentui/command-palette.js +37 -10
  20. package/dist/src/app-opentui/index.js +632 -528
  21. package/dist/src/app-opentui/intent.js +33 -8
  22. package/dist/src/app-opentui/keymap.js +43 -414
  23. package/dist/src/app-opentui/pi-host-child.js +496 -57
  24. package/dist/src/app-opentui/pi-pty-host.d.ts +14 -64
  25. package/dist/src/app-opentui/pi-pty-host.js +3 -397
  26. package/dist/src/app-opentui/react/App.js +144 -469
  27. package/dist/src/app-opentui/react/ChromeHost.js +44 -415
  28. package/dist/src/app-opentui/react/launch.js +659 -552
  29. package/dist/src/app-opentui/react/nav.js +1 -1
  30. package/dist/src/app-opentui/registry.js +1181 -742
  31. package/dist/src/app-opentui/remote-link.d.ts +10 -0
  32. package/dist/src/app-opentui/remote-link.js +47 -0
  33. package/dist/src/app-opentui/render/terminal-handoff.d.ts +16 -0
  34. package/dist/src/app-opentui/render/terminal-handoff.js +14 -0
  35. package/dist/src/app-opentui/runtime.js +632 -528
  36. package/dist/src/app-opentui/scenes/doctor.js +1 -1
  37. package/dist/src/app-opentui/scenes/error.js +50 -4
  38. package/dist/src/app-opentui/scenes/family.js +60 -6
  39. package/dist/src/app-opentui/scenes/fleet.js +65 -13
  40. package/dist/src/app-opentui/scenes/help.js +4 -2
  41. package/dist/src/app-opentui/scenes/init.js +12 -12
  42. package/dist/src/app-opentui/scenes/main.js +7 -7
  43. package/dist/src/app-opentui/scenes/server.js +83 -11
  44. package/dist/src/app-opentui/scenes/tasks.js +79 -16
  45. package/dist/src/app-opentui/state.js +25 -5
  46. package/dist/src/app-opentui/surface-catalog.js +4 -2
  47. package/dist/src/app-opentui/types.d.ts +1 -1
  48. package/dist/src/commands/_cli-format.d.ts +10 -1
  49. package/dist/src/commands/_cli-format.js +5 -2
  50. package/dist/src/commands/_connection-state.d.ts +11 -1
  51. package/dist/src/commands/_connection-state.js +50 -5
  52. package/dist/src/commands/_doctor-checks.js +458 -46
  53. package/dist/src/commands/_help-catalog.js +4 -2
  54. package/dist/src/commands/_json-output.js +4 -0
  55. package/dist/src/commands/_operator-view.js +496 -57
  56. package/dist/src/commands/_pi-frontend.d.ts +25 -0
  57. package/dist/src/commands/_pi-frontend.js +497 -57
  58. package/dist/src/commands/_preflight.js +509 -72
  59. package/dist/src/commands/_server-client.d.ts +33 -0
  60. package/dist/src/commands/_server-client.js +477 -46
  61. package/dist/src/commands/_server-events.js +446 -41
  62. package/dist/src/commands/_snapshot-upload.js +460 -48
  63. package/dist/src/commands/connect.js +620 -15
  64. package/dist/src/commands/doctor.js +458 -46
  65. package/dist/src/commands/github.js +462 -50
  66. package/dist/src/commands/inbox.js +458 -46
  67. package/dist/src/commands/init.js +497 -74
  68. package/dist/src/commands/inspect.js +458 -46
  69. package/dist/src/commands/run.js +496 -57
  70. package/dist/src/commands/server.js +647 -163
  71. package/dist/src/commands/setup.js +463 -51
  72. package/dist/src/commands/stats.js +462 -48
  73. package/dist/src/commands/task-run-driver.js +464 -52
  74. package/dist/src/commands/task.js +551 -85
  75. package/dist/src/commands.js +701 -151
  76. package/dist/src/index.js +705 -151
  77. package/dist/src/launcher.js +4 -0
  78. package/package.json +8 -8
@@ -305,7 +305,7 @@ function sparklineString(values, width) {
305
305
 
306
306
  // packages/cli/src/app-opentui/scenes/main.ts
307
307
  var CONFIGURED_MENU = [
308
- ["init", "setup, reconfigure, repair project state", { id: "init", label: "init", intent: { scene: "command", argv: ["init"], action: { kind: "command-run", label: "Run init" } }, message: "run setup/reconfigure flow" }],
308
+ ["init", "guided setup, reconfigure, repair project state", { id: "init", label: "init", intent: { scene: "init", argv: ["init"], action: { kind: "refresh", label: "Open init" } }, message: "open native init flow" }],
309
309
  ["server", "local/remote target, auth, linkage", { id: "server", label: "server", intent: { scene: "server", argv: ["server", "status"], action: { kind: "refresh", label: "Checking server" } }, message: "check selected server" }],
310
310
  ["github", "auth, selected repo, stored token", { id: "github", label: "github", intent: { scene: "server", argv: ["github", "auth", "status"], action: { kind: "refresh", label: "Checking GitHub auth" } }, message: "check GitHub auth" }],
311
311
  ["tasks", "browse, filter, dispatch, attach active work", { id: "tasks", label: "tasks", intent: { scene: "tasks", argv: ["tasks"], action: { kind: "refresh", label: "Opening tasks" } }, message: "selected tasks" }],
@@ -324,10 +324,10 @@ var CONFIGURED_MENU = [
324
324
  ["help", "all actions, shortcuts, mouse controls", { id: "help", label: "help", intent: { scene: "help", argv: ["help"], action: { kind: "none", label: "Opening help" } }, message: "selected help" }]
325
325
  ];
326
326
  var ONBOARD_PRIMARY = {
327
- id: "onboard-setup",
328
- label: "Start guided setup",
329
- intent: { scene: "init", argv: ["init"], action: { kind: "refresh", label: "Setup" } },
330
- message: "open the guided setup checklist"
327
+ id: "onboard-init",
328
+ label: "Start guided init",
329
+ intent: { scene: "init", argv: ["init"], action: { kind: "refresh", label: "Init" } },
330
+ message: "open the native init checklist"
331
331
  };
332
332
  var ONBOARD_SECONDARY = [
333
333
  ["server", "select a local or remote target", { id: "server", label: "server", intent: { scene: "server", argv: ["server", "status"], action: { kind: "refresh", label: "Checking server" } }, message: "check selected server" }],
@@ -390,7 +390,7 @@ function configuredMenuRows(selectedIndex) {
390
390
  }));
391
391
  }
392
392
  function onboardingRows(selectedIndex) {
393
- const primary = selectableDeckRow({ label: "setup", detail: "Start guided setup \u2014 recommended", active: selectedIndex === 0 }, ONBOARD_PRIMARY);
393
+ const primary = selectableDeckRow({ label: "init", detail: "Start guided init \u2014 recommended", active: selectedIndex === 0 }, ONBOARD_PRIMARY);
394
394
  const secondary = ONBOARD_SECONDARY.map(([label, detail, item], index) => ({
395
395
  ...deckRow({ label, detail, index: index + 1, active: selectedIndex === index + 1, activateOnClick: true }),
396
396
  selectable: item
@@ -454,7 +454,7 @@ function renderMainScene(state, layout) {
454
454
  statusLine(state)
455
455
  ] : [
456
456
  line("WELCOME", { fg: RIG_UI.ink, bold: true }),
457
- line("This project isn't set up yet. One guided flow gets you running.", { fg: RIG_UI.ink2 }),
457
+ line("This project isn't initialized yet. One native init flow gets you running.", { fg: RIG_UI.ink2 }),
458
458
  blank(),
459
459
  line("GET STARTED", { fg: RIG_UI.ink, bold: true }),
460
460
  ...onboardingRows(actionSelected),
@@ -557,12 +557,13 @@ var PRIMARY_GROUPS = [
557
557
  {
558
558
  name: "server",
559
559
  summary: "Choose, inspect, and start the Rig server that owns tasks and runs.",
560
- usage: ["rig server <status|list|add|use|start> [options]"],
560
+ usage: ["rig server <status|list|add|use|repair-link|start> [options]"],
561
561
  commands: [
562
- { command: "status", description: "Show the selected server for this repo.", primary: true },
562
+ { command: "status", description: "Show the selected server and remote project-root link for this repo.", primary: true },
563
563
  { command: "use local", description: "Switch this repo to the local Rig server.", primary: true },
564
564
  { command: "add <alias> <url>", description: "Save a remote Rig server URL.", primary: true },
565
565
  { command: "use <alias>", description: "Select a saved remote server alias.", primary: true },
566
+ { command: "repair-link [--prepare|--backfill-only] [--repo owner/repo]", description: "Backfill or prepare the selected remote's server-host checkout link.", primary: true },
566
567
  { command: "list", description: "List saved local/remote server aliases.", primary: true },
567
568
  { command: "start [--host <host>] [--port <n>]", description: "Start a local rig-server process." }
568
569
  ],
@@ -570,6 +571,7 @@ var PRIMARY_GROUPS = [
570
571
  "rig server status",
571
572
  "rig server add prod https://where.rig-does.work",
572
573
  "rig server use prod",
574
+ "rig server repair-link --repo owner/repo",
573
575
  "rig server use local",
574
576
  "rig server start --port 3773"
575
577
  ],
@@ -1133,17 +1135,63 @@ function renderHelpScene(state, layout) {
1133
1135
  });
1134
1136
  }
1135
1137
 
1138
+ // packages/cli/src/app-opentui/remote-link.ts
1139
+ var REPAIRABLE_REMOTE_LINK_STATUSES = new Set([
1140
+ "auth_required",
1141
+ "project_not_registered",
1142
+ "no_server_checkout",
1143
+ "invalid_root",
1144
+ "needs_prepare",
1145
+ "error"
1146
+ ]);
1147
+ function remoteProjectLinkError(message) {
1148
+ return /no server-host project root link|remote project(?:-root)? link|x-rig-project-root|serverProjectRoot/i.test(message ?? "");
1149
+ }
1150
+ function serverRecordForRemoteLink(state) {
1151
+ const server = state.data.server;
1152
+ return server && typeof server === "object" && !Array.isArray(server) ? server : null;
1153
+ }
1154
+ function remoteProjectLinkState(state) {
1155
+ const serverRecord = serverRecordForRemoteLink(state);
1156
+ if (!serverRecord || serverRecord.kind !== "remote")
1157
+ return null;
1158
+ const link = serverRecord.remoteProjectLink;
1159
+ if (link && typeof link === "object" && !Array.isArray(link))
1160
+ return link;
1161
+ const direct = state.data.remoteProjectLink;
1162
+ if (direct && typeof direct === "object" && !Array.isArray(direct))
1163
+ return direct;
1164
+ return null;
1165
+ }
1166
+ function shouldOfferRemoteLinkRepair(state, message) {
1167
+ const link = remoteProjectLinkState(state);
1168
+ if (link) {
1169
+ if (link.ok === true)
1170
+ return false;
1171
+ const status = link.status ?? "";
1172
+ return REPAIRABLE_REMOTE_LINK_STATUSES.has(status);
1173
+ }
1174
+ const serverRecord = serverRecordForRemoteLink(state);
1175
+ if (serverRecord && serverRecord.kind !== "remote")
1176
+ return false;
1177
+ return remoteProjectLinkError(message ?? state.error?.message);
1178
+ }
1179
+
1136
1180
  // packages/cli/src/app-opentui/scenes/error.ts
1137
1181
  var ERROR_ACTIONS = [
1138
1182
  { detail: "return to dashboard", item: { id: "main", label: "main", intent: { scene: "main", argv: [], action: { kind: "refresh", label: "Back to dashboard" } }, message: "back to dashboard" } },
1139
1183
  { detail: "run diagnostics", item: { id: "doctor", label: "doctor", intent: { scene: "doctor", argv: ["doctor"], action: { kind: "doctor-run", label: "Run doctor" } }, message: "run diagnostics" } },
1140
- { detail: "open server controls", item: { id: "server", label: "server", intent: { scene: "server", argv: ["server", "status"], action: { kind: "refresh", label: "Open server controls" } }, message: "open server controls" } },
1141
- { detail: "repair project/server/auth link", item: { id: "repair", label: "repair", intent: { scene: "command", argv: ["init", "--repair"], action: { kind: "command-run", label: "Repair project link" } }, message: "repair project link" } }
1184
+ { detail: "open server controls", item: { id: "server", label: "server", intent: { scene: "server", argv: ["server", "status"], action: { kind: "refresh", label: "Open server controls" } }, message: "open server controls" } }
1142
1185
  ];
1186
+ var ERROR_REPAIR_LINK_ACTION = { detail: "backfill or prepare selected remote project-root link", item: { id: "repair-link", label: "repair link", intent: { scene: "server", argv: ["server", "repair-link"], action: { kind: "remote-link-repair", label: "Repair remote link", payload: { returnScene: "server" } } }, message: "repair remote project link" } };
1187
+ function errorActions(state) {
1188
+ return shouldOfferRemoteLinkRepair(state, state.error?.message) ? [...ERROR_ACTIONS, ERROR_REPAIR_LINK_ACTION] : ERROR_ACTIONS;
1189
+ }
1143
1190
  function renderErrorScene(state) {
1144
1191
  const message = state.error?.message ?? "Unknown app error";
1145
1192
  const hint = state.error?.hint ?? "Use the actions below to recover.";
1146
- const selected = Math.max(0, Math.min(3, state.selection.index));
1193
+ const actions = errorActions(state);
1194
+ const selected = Math.max(0, Math.min(actions.length - 1, state.selection.index));
1147
1195
  return makeSceneFrame({
1148
1196
  scene: "error",
1149
1197
  title: "Error",
@@ -1161,7 +1209,7 @@ function renderErrorScene(state) {
1161
1209
  ...hint ? [line(hint, { fg: RIG_UI.yellow })] : [],
1162
1210
  line("", { fg: RIG_UI.ink3 }),
1163
1211
  line("ACTIONS", { fg: RIG_UI.ink3, bold: true }),
1164
- ...ERROR_ACTIONS.map(({ detail, item }, index) => selectableDeckRow({ label: item.label, detail, index, active: selected === index }, item))
1212
+ ...actions.map(({ detail, item }, index) => selectableDeckRow({ label: item.label, detail, index, active: selected === index }, item))
1165
1213
  ],
1166
1214
  backgroundColor: RIG_UI.panel,
1167
1215
  backgroundAlpha: 184,
@@ -1635,16 +1683,31 @@ function taskViewIntent(argv, command = "", rest = [], raw) {
1635
1683
  const { payload, label } = taskViewPayload(command, rest);
1636
1684
  return intent("tasks", argv, "refresh", payload, label, raw);
1637
1685
  }
1638
- function routeServer(argv, command, raw, checkingLabel) {
1639
- if (!command || command === "status") {
1686
+ function routeServer(argv, command, rest, raw, checkingLabel) {
1687
+ if (!command || command === "status" || command === "list") {
1640
1688
  return intent("server", argv, "refresh", undefined, command ? checkingLabel : "Loading server", raw);
1641
1689
  }
1690
+ if (command === "use") {
1691
+ const alias = firstNonOption(rest);
1692
+ if (alias === "local")
1693
+ return intent("server", argv, "server-use-local", undefined, "Use local server", raw);
1694
+ if (alias)
1695
+ return intent("server", argv, "server-use-remote", { alias }, `Use ${alias}`, raw);
1696
+ return intent("server", argv, "refresh", undefined, "Select a remote alias in Server", raw);
1697
+ }
1698
+ if (command === "add")
1699
+ return intent("server", argv, "server-add-remote", { argv: [...argv] }, "Add remote server", raw);
1700
+ if (command === "repair-link")
1701
+ return intent("server", argv, "remote-link-repair", undefined, "Repair remote link", raw);
1642
1702
  return commandRunIntent(argv, raw);
1643
1703
  }
1644
1704
  function routeGithub(argv, command, rest, raw) {
1645
1705
  if (command === "auth" && (rest[0]?.toLowerCase() ?? "status") === "status" && rest.length <= 1) {
1646
1706
  return intent("server", argv, "refresh", undefined, "Checking GitHub auth", raw);
1647
1707
  }
1708
+ if (command === "auth" && rest[0]?.toLowerCase() === "import-gh" && rest.length <= 1) {
1709
+ return intent("server", argv, "github-auth-import", undefined, "Import GitHub auth", raw);
1710
+ }
1648
1711
  return commandRunIntent(argv, raw);
1649
1712
  }
1650
1713
  function routeDoctor(argv, command, raw) {
@@ -1693,11 +1756,16 @@ function intentFromArgv(argv) {
1693
1756
  return commandRunIntent(argv);
1694
1757
  }
1695
1758
  if (normalizedGroup === "server")
1696
- return routeServer(argv, normalizedCommand, undefined, "Checking server");
1759
+ return routeServer(argv, normalizedCommand, rest, undefined, "Checking server");
1697
1760
  if (normalizedGroup === "github")
1698
1761
  return routeGithub(argv, normalizedCommand, rest);
1699
- if (normalizedGroup === "init")
1700
- return commandRunIntent(argv);
1762
+ if (normalizedGroup === "init") {
1763
+ if (!normalizedCommand)
1764
+ return intent("init", argv, "refresh", undefined, "Open init");
1765
+ if (rest.includes("--yes") || normalizedCommand === "--yes")
1766
+ return intent("init", argv, "init-start", undefined, "Run init");
1767
+ return intent("init", argv, "refresh", undefined, "Open init");
1768
+ }
1701
1769
  if (normalizedGroup === "doctor")
1702
1770
  return routeDoctor(argv, normalizedCommand);
1703
1771
  if (normalizedGroup === "inbox")
@@ -1760,12 +1828,17 @@ function intentFromTypeBar(value) {
1760
1828
  return commandRunIntent(parts, value);
1761
1829
  return intent("tasks", parts, "refresh", undefined, "Select a task, then press Enter; or use run next", value);
1762
1830
  }
1763
- if (first === "init")
1764
- return commandRunIntent(parts, value);
1831
+ if (first === "init") {
1832
+ if (!second)
1833
+ return intent("init", parts, "refresh", undefined, "Open init", value);
1834
+ if (parts.includes("--yes"))
1835
+ return intent("init", parts, "init-start", undefined, "Run init", value);
1836
+ return intent("init", parts, "refresh", undefined, "Open init", value);
1837
+ }
1765
1838
  if (first === "doctor")
1766
1839
  return routeDoctor(parts, second, value);
1767
1840
  if (first === "server")
1768
- return routeServer(parts, second, value, "Loading server");
1841
+ return routeServer(parts, second, rest, value, "Loading server");
1769
1842
  if (first === "github")
1770
1843
  return routeGithub(parts, second, rest, value);
1771
1844
  if (first === "inbox")
@@ -1783,397 +1856,6 @@ function intentFromTypeBar(value) {
1783
1856
  return intentFromArgv(parts);
1784
1857
  }
1785
1858
 
1786
- // packages/cli/src/app-opentui/pi-pty-host.ts
1787
- import { fileURLToPath as fileURLToPath2 } from "url";
1788
- import { basename as basename2 } from "path";
1789
- import { RGBA as RGBA2, StyledText as StyledText2, TextAttributes as TextAttributes3 } from "@opentui/core";
1790
- import { Terminal as XtermTerminal2 } from "@xterm/headless";
1791
- var MIN_COLS2 = 40;
1792
- var MIN_ROWS2 = 12;
1793
- var MAX_ROWS2 = 300;
1794
- var MAX_SNAPSHOT_LINES2 = 360;
1795
- var STYLED_SNAPSHOT_MARGIN = 6;
1796
- var SNAPSHOT_DELAY_MS2 = 120;
1797
- var fallbackChildScriptPath = fileURLToPath2(new URL("./pi-host-child.ts", import.meta.url));
1798
- var activeHost2 = null;
1799
- function clampCols2(cols) {
1800
- return Math.max(MIN_COLS2, Math.trunc(cols || 100));
1801
- }
1802
- function clampRows2(rows) {
1803
- return Math.max(MIN_ROWS2, Math.min(MAX_ROWS2, Math.trunc(rows || 35)));
1804
- }
1805
- var XTERM_COLOR_MODE_INDEXED_16 = 16777216;
1806
- var XTERM_COLOR_MODE_INDEXED_256 = 33554432;
1807
- var XTERM_COLOR_MODE_RGB = 50331648;
1808
- function rgbaFromXtermColor(mode, value) {
1809
- if (mode === 1 || mode === 2 || mode === XTERM_COLOR_MODE_INDEXED_16 || mode === XTERM_COLOR_MODE_INDEXED_256) {
1810
- return RGBA2.fromIndex(value);
1811
- }
1812
- if (mode === 3 || mode === XTERM_COLOR_MODE_RGB) {
1813
- return RGBA2.fromInts(value >> 16 & 255, value >> 8 & 255, value & 255);
1814
- }
1815
- return;
1816
- }
1817
- function textAttributesFromCell(cell) {
1818
- let attributes = TextAttributes3.NONE;
1819
- if (cell.isBold())
1820
- attributes |= TextAttributes3.BOLD;
1821
- if (cell.isDim())
1822
- attributes |= TextAttributes3.DIM;
1823
- if (cell.isItalic())
1824
- attributes |= TextAttributes3.ITALIC;
1825
- if (cell.isUnderline())
1826
- attributes |= TextAttributes3.UNDERLINE;
1827
- if (cell.isBlink())
1828
- attributes |= TextAttributes3.BLINK;
1829
- if (cell.isInverse())
1830
- attributes |= TextAttributes3.INVERSE;
1831
- if (cell.isInvisible())
1832
- attributes |= TextAttributes3.HIDDEN;
1833
- if (cell.isStrikethrough())
1834
- attributes |= TextAttributes3.STRIKETHROUGH;
1835
- return attributes;
1836
- }
1837
- function sameRgba(a, b) {
1838
- if (!a && !b)
1839
- return true;
1840
- return Boolean(a && b && a.equals(b));
1841
- }
1842
- function sameStyle(a, b) {
1843
- return sameRgba(a.fg, b.fg) && sameRgba(a.bg, b.bg) && (a.attributes ?? 0) === (b.attributes ?? 0);
1844
- }
1845
- function styleFromCell(cell) {
1846
- return {
1847
- fg: rgbaFromXtermColor(cell.getFgColorMode(), cell.getFgColor()),
1848
- bg: rgbaFromXtermColor(cell.getBgColorMode(), cell.getBgColor()),
1849
- attributes: textAttributesFromCell(cell)
1850
- };
1851
- }
1852
- function lineToStyledText(line2, cols) {
1853
- if (!line2)
1854
- return new StyledText2([{ __isChunk: true, text: "" }]);
1855
- const chunks = [];
1856
- let run = "";
1857
- let runStyle = null;
1858
- const flush = () => {
1859
- if (!run)
1860
- return;
1861
- chunks.push({
1862
- __isChunk: true,
1863
- text: run,
1864
- ...runStyle?.fg ? { fg: runStyle.fg } : {},
1865
- ...runStyle?.bg ? { bg: runStyle.bg } : {},
1866
- ...(runStyle?.attributes ?? 0) !== 0 ? { attributes: runStyle.attributes } : {}
1867
- });
1868
- run = "";
1869
- };
1870
- for (let index = 0;index < cols; index += 1) {
1871
- const cell = line2.getCell(index);
1872
- if (!cell) {
1873
- if (runStyle !== null)
1874
- flush();
1875
- runStyle = null;
1876
- run += " ";
1877
- continue;
1878
- }
1879
- if (cell.getWidth() === 0)
1880
- continue;
1881
- const style = styleFromCell(cell);
1882
- if (!runStyle || !sameStyle(runStyle, style)) {
1883
- flush();
1884
- runStyle = style;
1885
- }
1886
- run += cell.getChars() || " ";
1887
- }
1888
- flush();
1889
- return new StyledText2(chunks.length > 0 ? chunks : [{ __isChunk: true, text: "" }]);
1890
- }
1891
- function childCommandPrefix2() {
1892
- const execName = basename2(process.execPath).toLowerCase();
1893
- const currentEntry = process.argv[1];
1894
- if (execName === "bun" || execName === "bun.exe") {
1895
- return currentEntry ? [process.execPath, currentEntry, "__opentui-pi-host"] : [process.execPath, fallbackChildScriptPath];
1896
- }
1897
- return [process.execPath, "__opentui-pi-host"];
1898
- }
1899
- function withEnv2(base) {
1900
- const env = {};
1901
- for (const [key, value] of Object.entries(base ?? process.env)) {
1902
- if (key === "RIG_PLAIN" || key === "RIG_CLI_PLAIN_HELP" || key === "NO_COLOR")
1903
- continue;
1904
- if (typeof value === "string")
1905
- env[key] = value;
1906
- }
1907
- return {
1908
- ...env,
1909
- TERM: "xterm-256color",
1910
- COLORTERM: "truecolor",
1911
- FORCE_COLOR: env.FORCE_COLOR ?? "1",
1912
- RIG_OPENTUI_PI_HOST: "1"
1913
- };
1914
- }
1915
- function getActivePiHost() {
1916
- return activeHost2 && !activeHost2.disposed ? activeHost2 : null;
1917
- }
1918
- function stopActivePiHost(reason = "detach") {
1919
- activeHost2?.dispose(reason);
1920
- activeHost2 = null;
1921
- }
1922
-
1923
- class PiPtyHost {
1924
- runId;
1925
- projectRoot;
1926
- onSnapshot;
1927
- onExit;
1928
- onError;
1929
- terminal;
1930
- disposables = [];
1931
- decoder = new TextDecoder("utf-8");
1932
- proc = null;
1933
- pty = null;
1934
- status = "starting";
1935
- cols;
1936
- rows;
1937
- message = "starting bundled Pi";
1938
- lastResizeError = null;
1939
- exitCode;
1940
- signal;
1941
- notifyTimer = null;
1942
- lastStreamKey = "";
1943
- _disposed = false;
1944
- constructor(options) {
1945
- this.runId = options.runId;
1946
- this.projectRoot = options.projectRoot;
1947
- this.cols = clampCols2(options.cols);
1948
- this.rows = clampRows2(options.rows);
1949
- this.onSnapshot = options.onSnapshot;
1950
- this.onExit = options.onExit;
1951
- this.onError = options.onError;
1952
- this.terminal = new XtermTerminal2({
1953
- allowProposedApi: true,
1954
- cols: this.cols,
1955
- rows: this.rows,
1956
- scrollback: 1000
1957
- });
1958
- this.registerTerminalResponders();
1959
- this.disposables.push(this.terminal.onWriteParsed(() => {
1960
- if (this._disposed)
1961
- return;
1962
- const snapshot = this.createSnapshot();
1963
- const key = snapshot.lines.join(`
1964
- `);
1965
- if (key === this.lastStreamKey)
1966
- return;
1967
- this.lastStreamKey = key;
1968
- this.onSnapshot?.(snapshot);
1969
- }));
1970
- }
1971
- get disposed() {
1972
- return this._disposed;
1973
- }
1974
- get snapshot() {
1975
- return this.createSnapshot();
1976
- }
1977
- async start() {
1978
- if (this._disposed)
1979
- throw new Error("Pi PTY host is disposed.");
1980
- if (typeof Bun.Terminal !== "function") {
1981
- throw new Error("Bun native PTY is unavailable in this runtime. Pi host requires Bun.Terminal.");
1982
- }
1983
- const spawnOptions = {
1984
- cwd: this.projectRoot,
1985
- env: withEnv2(process.env),
1986
- terminal: {
1987
- cols: this.cols,
1988
- rows: this.rows,
1989
- name: "xterm-256color",
1990
- data: (_terminal, data) => this.handlePtyData(data)
1991
- }
1992
- };
1993
- const proc = Bun.spawn([
1994
- ...childCommandPrefix2(),
1995
- "--run-id",
1996
- this.runId,
1997
- "--project-root",
1998
- this.projectRoot
1999
- ], spawnOptions);
2000
- if (!proc.terminal)
2001
- throw new Error("Bun did not attach a terminal to the bundled Pi child process.");
2002
- this.proc = proc;
2003
- this.pty = proc.terminal;
2004
- this.status = "running";
2005
- this.message = "bundled Pi running inside this app";
2006
- this.emitSnapshotSoon(0);
2007
- proc.exited.then((exitCode) => {
2008
- if (this._disposed)
2009
- return;
2010
- this.status = exitCode === 0 ? "exited" : "failed";
2011
- this.exitCode = exitCode;
2012
- this.signal = null;
2013
- this.message = exitCode === 0 ? "bundled Pi exited" : `bundled Pi exited with code ${exitCode}`;
2014
- const snapshot = this.createSnapshot();
2015
- this.onSnapshot?.(snapshot);
2016
- this.onExit?.(snapshot);
2017
- if (activeHost2 === this)
2018
- activeHost2 = null;
2019
- this.dispose("exit", { kill: false, notify: false });
2020
- }).catch((error) => {
2021
- if (this._disposed)
2022
- return;
2023
- this.status = "failed";
2024
- this.message = error instanceof Error ? error.message : String(error);
2025
- const snapshot = this.createSnapshot();
2026
- this.onSnapshot?.(snapshot);
2027
- this.onError?.(error, snapshot);
2028
- if (activeHost2 === this)
2029
- activeHost2 = null;
2030
- this.dispose("error", { kill: false, notify: false });
2031
- });
2032
- }
2033
- write(data) {
2034
- if (this._disposed || !this.pty)
2035
- return;
2036
- try {
2037
- this.pty.write(data);
2038
- } catch (error) {
2039
- this.status = "failed";
2040
- this.message = error instanceof Error ? error.message : String(error);
2041
- const snapshot = this.createSnapshot();
2042
- this.onSnapshot?.(snapshot);
2043
- this.onError?.(error, snapshot);
2044
- }
2045
- }
2046
- resize(cols, rows) {
2047
- const nextCols = clampCols2(cols);
2048
- const nextRows = clampRows2(rows);
2049
- if (nextCols === this.cols && nextRows === this.rows)
2050
- return;
2051
- this.cols = nextCols;
2052
- this.rows = nextRows;
2053
- this.terminal.resize(nextCols, nextRows);
2054
- try {
2055
- this.pty?.resize(nextCols, nextRows);
2056
- this.lastResizeError = null;
2057
- } catch (error) {
2058
- this.lastResizeError = error instanceof Error ? error.message : String(error);
2059
- }
2060
- this.emitSnapshotSoon(0);
2061
- }
2062
- detach() {
2063
- this.dispose("detach");
2064
- return this.createSnapshot("detached from bundled Pi");
2065
- }
2066
- dispose(reason = "dispose", options = {}) {
2067
- if (this._disposed)
2068
- return;
2069
- this._disposed = true;
2070
- if (this.notifyTimer)
2071
- clearTimeout(this.notifyTimer);
2072
- this.notifyTimer = null;
2073
- for (const disposable of this.disposables.splice(0)) {
2074
- try {
2075
- disposable.dispose();
2076
- } catch {}
2077
- }
2078
- if (options.kill !== false) {
2079
- try {
2080
- this.proc?.kill("SIGTERM");
2081
- } catch {}
2082
- }
2083
- try {
2084
- this.pty?.close();
2085
- } catch {}
2086
- try {
2087
- this.terminal.dispose();
2088
- } catch {}
2089
- if (activeHost2 === this)
2090
- activeHost2 = null;
2091
- if (options.notify) {
2092
- this.message = reason;
2093
- this.onSnapshot?.(this.createSnapshot(reason));
2094
- }
2095
- }
2096
- handlePtyData(data) {
2097
- if (this._disposed)
2098
- return;
2099
- const text = this.decoder.decode(data, { stream: true });
2100
- this.respondToRawTerminalQueries(text);
2101
- this.terminal.write(data);
2102
- }
2103
- emitSnapshotSoon(delayMs = SNAPSHOT_DELAY_MS2) {
2104
- if (this._disposed || this.notifyTimer)
2105
- return;
2106
- this.notifyTimer = setTimeout(() => {
2107
- this.notifyTimer = null;
2108
- if (this._disposed)
2109
- return;
2110
- this.onSnapshot?.(this.createSnapshot());
2111
- }, delayMs);
2112
- }
2113
- createSnapshot(message = this.message) {
2114
- const buffer = this.terminal.buffer.active;
2115
- const end = buffer.length;
2116
- const start = Math.max(0, end - MAX_SNAPSHOT_LINES2);
2117
- const styledStart = Math.max(start, end - this.rows - STYLED_SNAPSHOT_MARGIN);
2118
- const lines = [];
2119
- const styledLines = [];
2120
- for (let row = start;row < end; row += 1) {
2121
- const line2 = buffer.getLine(row);
2122
- lines.push((line2?.translateToString(false) ?? "").slice(0, this.cols));
2123
- if (row >= styledStart)
2124
- styledLines[lines.length - 1] = lineToStyledText(line2, this.cols);
2125
- }
2126
- while (lines.length < this.rows) {
2127
- lines.push("");
2128
- styledLines[lines.length - 1] = new StyledText2([{ __isChunk: true, text: "" }]);
2129
- }
2130
- const resolvedMessage = this.lastResizeError ? `resize degraded: ${this.lastResizeError}` : message;
2131
- return {
2132
- runId: this.runId,
2133
- status: this.status,
2134
- cols: this.cols,
2135
- rows: this.rows,
2136
- lines,
2137
- styledLines,
2138
- message: resolvedMessage,
2139
- ...this.lastResizeError ? { resizeError: this.lastResizeError } : {},
2140
- ...this.exitCode !== undefined ? { exitCode: this.exitCode } : {},
2141
- ...this.signal !== undefined ? { signal: this.signal } : {}
2142
- };
2143
- }
2144
- registerTerminalResponders() {
2145
- this.disposables.push(this.terminal.parser.registerCsiHandler({ final: "c" }, (params) => {
2146
- if (params.length === 0 || params[0] === 0)
2147
- this.write("\x1B[?62;22c");
2148
- return false;
2149
- }));
2150
- this.disposables.push(this.terminal.parser.registerCsiHandler({ prefix: ">", final: "c" }, (params) => {
2151
- if (params.length === 0 || params[0] === 0)
2152
- this.write("\x1B[>0;0;0c");
2153
- return false;
2154
- }));
2155
- this.disposables.push(this.terminal.parser.registerCsiHandler({ final: "n" }, (params) => {
2156
- if (params[0] === 5) {
2157
- this.write("\x1B[0n");
2158
- } else if (params[0] === 6) {
2159
- const row = this.terminal.buffer.active.cursorY + 1;
2160
- const col = this.terminal.buffer.active.cursorX + 1;
2161
- this.write(`\x1B[${row};${col}R`);
2162
- }
2163
- return false;
2164
- }));
2165
- }
2166
- respondToRawTerminalQueries(text) {
2167
- if (!text)
2168
- return;
2169
- const decrqm = /\x1b\[\?(\d+)\$p/g;
2170
- let match;
2171
- while ((match = decrqm.exec(text)) !== null) {
2172
- this.write(`\x1B[?${match[1]};2$y`);
2173
- }
2174
- }
2175
- }
2176
-
2177
1859
  // packages/cli/src/app-opentui/keymap.ts
2178
1860
  var autocompleteState;
2179
1861
  function clearTypeBar(context, message) {
@@ -2183,22 +1865,15 @@ function clearTypeBar(context, message) {
2183
1865
  context.emitTypeBarPatch({ value: "", mode: "nav", prompt: undefined, message });
2184
1866
  }
2185
1867
  function handleEmbeddedTerminalKey(context, key) {
2186
- const state = context.getState();
2187
- const piHost = getActivePiHost();
2188
- const commandHost = getActiveCommandHost();
2189
- const host = state.scene === "handoff" ? piHost : state.scene === "command" ? commandHost : null;
1868
+ if (context.getState().scene !== "command")
1869
+ return false;
1870
+ const host = getActiveCommandHost();
2190
1871
  if (!host)
2191
1872
  return false;
2192
1873
  if (key.ctrl && key.name === "]") {
2193
- if (state.scene === "handoff") {
2194
- stopActivePiHost("operator detach");
2195
- clearTypeBar(context, "detached from Pi");
2196
- context.runAppAction("Opening runs", () => context.runtime.runIntent({ scene: "fleet", argv: ["runs"], action: { kind: "refresh", label: "Opening runs" } }));
2197
- } else {
2198
- stopActiveCommandHost("operator detach");
2199
- clearTypeBar(context, "closed command");
2200
- context.runAppAction("Project menu", () => context.runtime.runIntent({ scene: "main", argv: ["main"], action: { kind: "none", label: "Project menu" } }));
2201
- }
1874
+ stopActiveCommandHost("operator detach");
1875
+ clearTypeBar(context, "closed command");
1876
+ context.runAppAction("Project menu", () => context.runtime.runIntent({ scene: "main", argv: ["main"], action: { kind: "none", label: "Project menu" } }));
2202
1877
  return true;
2203
1878
  }
2204
1879
  const sequence = key.raw || key.sequence;
@@ -2404,7 +2079,7 @@ function handleAppKeyPress(context, key) {
2404
2079
  }
2405
2080
 
2406
2081
  // packages/cli/src/app-opentui/runtime.ts
2407
- import { BoxRenderable as BoxRenderable3, RGBA as RGBA8, StyledText as StyledText4, TextRenderable as TextRenderable4, createCliRenderer } from "@opentui/core";
2082
+ import { BoxRenderable as BoxRenderable3, RGBA as RGBA7, StyledText as StyledText3, TextRenderable as TextRenderable4, createCliRenderer } from "@opentui/core";
2408
2083
 
2409
2084
  // packages/cli/src/commands/_server-events.ts
2410
2085
  import { WsTransport } from "@rig/client";
@@ -2433,7 +2108,7 @@ var RESUMABLE_RUN_STATUSES = new Set([
2433
2108
  ]);
2434
2109
 
2435
2110
  // packages/cli/src/app-opentui/render/graphics.ts
2436
- import { FrameBufferRenderable, RGBA as RGBA3 } from "@opentui/core";
2111
+ import { FrameBufferRenderable, RGBA as RGBA2 } from "@opentui/core";
2437
2112
 
2438
2113
  // packages/cli/src/app-opentui/render/ascii-fleet.ts
2439
2114
  var LEAD_DRONE = [
@@ -2577,13 +2252,13 @@ var GLOW_FALLOFF_EXP_ASCII = 2.2;
2577
2252
  // packages/cli/src/app-opentui/render/graphics.ts
2578
2253
  var BRAILLE_SAMPLES_X = 2;
2579
2254
  var BRAILLE_SAMPLES_Y = 4;
2580
- var TRANSPARENT = RGBA3.fromValues(0, 0, 0, 0);
2581
- var BACKDROP = RGBA3.fromHex(RIG_UI.bg);
2582
- var PANEL_BG = RGBA3.fromInts(16, 17, 21, 184);
2583
- var PANEL_HEADER_BG = RGBA3.fromInts(16, 17, 21, 188);
2584
- var PANEL_LINE = RGBA3.fromInts(255, 255, 255, 20);
2585
- var PANEL_LINE_DIM = RGBA3.fromInts(255, 255, 255, 8);
2586
- var PANEL_TEXT_DIM = RGBA3.fromInts(108, 110, 121, 255);
2255
+ var TRANSPARENT = RGBA2.fromValues(0, 0, 0, 0);
2256
+ var BACKDROP = RGBA2.fromHex(RIG_UI.bg);
2257
+ var PANEL_BG = RGBA2.fromInts(16, 17, 21, 184);
2258
+ var PANEL_HEADER_BG = RGBA2.fromInts(16, 17, 21, 188);
2259
+ var PANEL_LINE = RGBA2.fromInts(255, 255, 255, 20);
2260
+ var PANEL_LINE_DIM = RGBA2.fromInts(255, 255, 255, 8);
2261
+ var PANEL_TEXT_DIM = RGBA2.fromInts(108, 110, 121, 255);
2587
2262
  var AC_RGB = [204, 255, 77];
2588
2263
  var C2_RGB = [86, 216, 255];
2589
2264
  var MG_RGB = [255, 121, 176];
@@ -2688,7 +2363,7 @@ function paletteColor(ac, c2, mg, ink) {
2688
2363
  const b = (AC_RGB[2] * ac + C2_RGB[2] * c2 + MG_RGB[2] * mg + INK_RGB[2] * ink) / total;
2689
2364
  const intensity = Math.min(1, total / 4);
2690
2365
  const lift = 0.34 + intensity * 0.66;
2691
- return RGBA3.fromInts(Math.round(r * lift), Math.round(g * lift), Math.round(b * lift), 255);
2366
+ return RGBA2.fromInts(Math.round(r * lift), Math.round(g * lift), Math.round(b * lift), 255);
2692
2367
  }
2693
2368
  function clearCanvas(canvas) {
2694
2369
  canvas.ac.fill(0);
@@ -3043,8 +2718,8 @@ function staticFleetTick(scene) {
3043
2718
  }
3044
2719
  function withAlpha(hex, alpha) {
3045
2720
  const a = Math.max(0, Math.min(255, Math.round(alpha * 255)));
3046
- const [r, g, b] = RGBA3.fromHex(hex).toInts();
3047
- return RGBA3.fromInts(r, g, b, a);
2721
+ const [r, g, b] = RGBA2.fromHex(hex).toInts();
2722
+ return RGBA2.fromInts(r, g, b, a);
3048
2723
  }
3049
2724
  function asciiFleetColor(char, row, alpha) {
3050
2725
  if (char === "@" || char === "$" || char === "o")
@@ -3052,7 +2727,7 @@ function asciiFleetColor(char, row, alpha) {
3052
2727
  if (char === "%" || char === "!" || char === "/" || char === "\\" || char === "|")
3053
2728
  return withAlpha(RIG_UI.cyan, alpha);
3054
2729
  if (char === "." || char === "'" || char === "_" || row < 3 || row > FLEET_GRID_HEIGHT - 4) {
3055
- return RGBA3.fromInts(108, 110, 121, Math.min(170, Math.max(0, Math.min(255, Math.round(alpha * 255)))));
2730
+ return RGBA2.fromInts(108, 110, 121, Math.min(170, Math.max(0, Math.min(255, Math.round(alpha * 255)))));
3056
2731
  }
3057
2732
  return withAlpha(RIG_UI.limeDim, alpha);
3058
2733
  }
@@ -3104,7 +2779,7 @@ function drawAmbientField(layer, layout, _tick, scene = "fleet", load = 0, activ
3104
2779
  }
3105
2780
 
3106
2781
  // packages/cli/src/app-opentui/render/text.ts
3107
- import { RGBA as RGBA4, TextAttributes as TextAttributes4, TextRenderable } from "@opentui/core";
2782
+ import { RGBA as RGBA3, TextAttributes as TextAttributes3, TextRenderable } from "@opentui/core";
3108
2783
 
3109
2784
  // packages/cli/src/app-opentui/render/hover.ts
3110
2785
  var hoveredId;
@@ -3134,8 +2809,8 @@ function subscribeHover(listener) {
3134
2809
  }
3135
2810
 
3136
2811
  // packages/cli/src/app-opentui/render/text.ts
3137
- var TRANSPARENT2 = RGBA4.fromInts(0, 0, 0, 0);
3138
- var HOVER_BG = RGBA4.fromHex(RIG_UI.hover);
2812
+ var TRANSPARENT2 = RGBA3.fromInts(0, 0, 0, 0);
2813
+ var HOVER_BG = RGBA3.fromHex(RIG_UI.hover);
3139
2814
  function lineIsClickable(line2) {
3140
2815
  return line2?.selectable !== undefined || line2?.selectableIndex !== undefined;
3141
2816
  }
@@ -3144,7 +2819,7 @@ function lineSelectableId(line2) {
3144
2819
  }
3145
2820
  function lineBackground(line2) {
3146
2821
  if (line2?.bg)
3147
- return RGBA4.fromHex(line2.bg);
2822
+ return RGBA3.fromHex(line2.bg);
3148
2823
  const id = lineSelectableId(line2);
3149
2824
  if (id !== undefined && isHovered(id))
3150
2825
  return HOVER_BG;
@@ -3194,12 +2869,12 @@ function applyFlowTextLine(renderable, line2, width) {
3194
2869
  renderable.content = line2?.styledText ?? line2?.text ?? "";
3195
2870
  renderable.fg = line2?.fg ?? RIG_UI.ink2;
3196
2871
  renderable.bg = lineBackground(line2);
3197
- renderable.attributes = line2?.bold ? TextAttributes4.BOLD : line2?.dim ? TextAttributes4.DIM : 0;
2872
+ renderable.attributes = line2?.bold ? TextAttributes3.BOLD : line2?.dim ? TextAttributes3.DIM : 0;
3198
2873
  }
3199
2874
 
3200
2875
  // packages/cli/src/app-opentui/render/panels.ts
3201
- import { RGBA as RGBA5, ScrollBoxRenderable } from "@opentui/core";
3202
- var TRANSPARENT3 = RGBA5.fromInts(0, 0, 0, 0);
2876
+ import { RGBA as RGBA4, ScrollBoxRenderable } from "@opentui/core";
2877
+ var TRANSPARENT3 = RGBA4.fromInts(0, 0, 0, 0);
3203
2878
  var MAX_PANEL_LINES = 420;
3204
2879
  var PANEL_OPAQUE_ALPHA = 255;
3205
2880
  var PANEL_BORDER = hexToRgba(RIG_UI.border, 255);
@@ -3208,8 +2883,8 @@ function hexToRgba(hex, alpha) {
3208
2883
  const full = clean.length === 3 ? clean.split("").map((part) => `${part}${part}`).join("") : clean;
3209
2884
  const value = Number.parseInt(full, 16);
3210
2885
  if (!Number.isFinite(value))
3211
- return RGBA5.fromInts(14, 15, 17, alpha);
3212
- return RGBA5.fromInts(value >> 16 & 255, value >> 8 & 255, value & 255, alpha);
2886
+ return RGBA4.fromInts(14, 15, 17, alpha);
2887
+ return RGBA4.fromInts(value >> 16 & 255, value >> 8 & 255, value & 255, alpha);
3213
2888
  }
3214
2889
  function panelBackground(panel) {
3215
2890
  return hexToRgba(panel.backgroundColor ?? RIG_UI.panel, PANEL_OPAQUE_ALPHA);
@@ -3324,9 +2999,9 @@ function applyScrollPanels(panels, layout, scenePanels) {
3324
2999
  }
3325
3000
 
3326
3001
  // packages/cli/src/app-opentui/render/type-bar.ts
3327
- import { BoxRenderable, InputRenderable, InputRenderableEvents, RGBA as RGBA6, StyledText as StyledText3, TextRenderable as TextRenderable2 } from "@opentui/core";
3328
- var TYPEBAR_BG = RGBA6.fromInts(20, 25, 14, 224);
3329
- var TYPEBAR_BORDER = RGBA6.fromInts(204, 255, 77, 92);
3002
+ import { BoxRenderable, InputRenderable, InputRenderableEvents, RGBA as RGBA5, StyledText as StyledText2, TextRenderable as TextRenderable2 } from "@opentui/core";
3003
+ var TYPEBAR_BG = RGBA5.fromInts(20, 25, 14, 224);
3004
+ var TYPEBAR_BORDER = RGBA5.fromInts(204, 255, 77, 92);
3330
3005
  function createTypeBar(renderer) {
3331
3006
  const background = new BoxRenderable(renderer, {
3332
3007
  id: "typebar-card",
@@ -3474,7 +3149,7 @@ function formatFooter(footer, width) {
3474
3149
  chunks.push(cell.style(text));
3475
3150
  used += visibleWidth(text);
3476
3151
  });
3477
- return new StyledText3(chunks);
3152
+ return new StyledText2(chunks);
3478
3153
  }
3479
3154
 
3480
3155
  // packages/cli/src/app-opentui/render/native-host.ts
@@ -3482,7 +3157,7 @@ import {
3482
3157
  BoxRenderable as BoxRenderable2,
3483
3158
  CodeRenderable,
3484
3159
  DiffRenderable,
3485
- RGBA as RGBA7,
3160
+ RGBA as RGBA6,
3486
3161
  ScrollBoxRenderable as ScrollBoxRenderable2,
3487
3162
  SyntaxStyle,
3488
3163
  TextRenderable as TextRenderable3,
@@ -3493,19 +3168,19 @@ function rigSyntaxStyle() {
3493
3168
  if (syntaxStyle)
3494
3169
  return syntaxStyle;
3495
3170
  syntaxStyle = SyntaxStyle.fromStyles({
3496
- keyword: { fg: RGBA7.fromHex(RIG_UI.magenta), bold: true },
3497
- string: { fg: RGBA7.fromHex(RIG_UI.lime) },
3498
- number: { fg: RGBA7.fromHex(RIG_UI.cyan) },
3499
- comment: { fg: RGBA7.fromHex(RIG_UI.ink4), italic: true },
3500
- function: { fg: RGBA7.fromHex(RIG_UI.cyan) },
3501
- type: { fg: RGBA7.fromHex(RIG_UI.limeDim) },
3502
- constant: { fg: RGBA7.fromHex(RIG_UI.yellow) },
3503
- default: { fg: RGBA7.fromHex(RIG_UI.ink2) }
3171
+ keyword: { fg: RGBA6.fromHex(RIG_UI.magenta), bold: true },
3172
+ string: { fg: RGBA6.fromHex(RIG_UI.lime) },
3173
+ number: { fg: RGBA6.fromHex(RIG_UI.cyan) },
3174
+ comment: { fg: RGBA6.fromHex(RIG_UI.ink4), italic: true },
3175
+ function: { fg: RGBA6.fromHex(RIG_UI.cyan) },
3176
+ type: { fg: RGBA6.fromHex(RIG_UI.limeDim) },
3177
+ constant: { fg: RGBA6.fromHex(RIG_UI.yellow) },
3178
+ default: { fg: RGBA6.fromHex(RIG_UI.ink2) }
3504
3179
  });
3505
3180
  return syntaxStyle;
3506
3181
  }
3507
3182
  function tableContent(rows) {
3508
- return rows.map((row, rowIndex) => row.map((cell) => [{ __isChunk: true, text: cell, fg: RGBA7.fromHex(rowIndex === 0 ? RIG_UI.ink3 : RIG_UI.ink2) }]));
3183
+ return rows.map((row, rowIndex) => row.map((cell) => [{ __isChunk: true, text: cell, fg: RGBA6.fromHex(rowIndex === 0 ? RIG_UI.ink3 : RIG_UI.ink2) }]));
3509
3184
  }
3510
3185
  function createNativeHost(renderer) {
3511
3186
  try {
@@ -3604,7 +3279,7 @@ function destroyNativeHost(host) {
3604
3279
  }
3605
3280
 
3606
3281
  // packages/cli/src/app-opentui/runtime.ts
3607
- var PRELOADER_BACKDROP = RGBA8.fromHex(RIG_UI.bg);
3282
+ var PRELOADER_BACKDROP = RGBA7.fromHex(RIG_UI.bg);
3608
3283
  function inboxPendingCount(state) {
3609
3284
  const inbox = state.data.inbox;
3610
3285
  if (!inbox || typeof inbox !== "object" || Array.isArray(inbox))
@@ -3620,7 +3295,7 @@ var PRIMARY_NAV = [
3620
3295
  { id: "tasks", label: "Tasks", scene: "tasks", argv: ["tasks"], enterLabel: "Tasks", member: ["tasks"] },
3621
3296
  { id: "inbox", label: "Inbox", scene: "inbox", argv: ["inbox"], enterLabel: "Inbox", member: ["inbox"], badge: inboxPendingCount },
3622
3297
  { id: "stats", label: "Stats", scene: "family", argv: ["stats"], enterLabel: "Stats", member: ["family"] },
3623
- { id: "setup", label: "Setup", scene: "init", argv: ["init"], enterLabel: "Setup", member: ["init", "doctor", "server", "pi", "plugin", "repo", "workspace"] },
3298
+ { id: "init", label: "Init", scene: "init", argv: ["init"], enterLabel: "Init", member: ["init", "doctor", "server", "pi", "plugin", "repo", "workspace"] },
3624
3299
  { id: "help", label: "Help", scene: "help", argv: ["help"], enterLabel: "Help", member: ["help"] }
3625
3300
  ];
3626
3301
  function activeNavSection(scene) {
@@ -3641,7 +3316,7 @@ function entryIntentForScene(scene) {
3641
3316
  case "doctor":
3642
3317
  return { scene, argv: ["doctor"], action: { kind: "doctor-run", label: "Doctor" } };
3643
3318
  case "init":
3644
- return { scene, argv: ["init"], action: { kind: "refresh", label: "Setup" } };
3319
+ return { scene, argv: ["init"], action: { kind: "refresh", label: "Init" } };
3645
3320
  case "run-detail":
3646
3321
  return { scene, argv: ["run", "status"], action: { kind: "refresh", label: "Run" } };
3647
3322
  case "pi":
@@ -3675,7 +3350,7 @@ function sceneSectionLabel(scene) {
3675
3350
  handoff: "pi console",
3676
3351
  server: "server",
3677
3352
  doctor: "doctor",
3678
- init: "setup",
3353
+ init: "init",
3679
3354
  pi: "pi",
3680
3355
  plugin: "plugins",
3681
3356
  repo: "repo",
@@ -3701,7 +3376,7 @@ function buildNavStrip(state) {
3701
3376
  chunks.push(otuiBold(styles.yellow(String(badgeCount))));
3702
3377
  }
3703
3378
  });
3704
- return new StyledText4(chunks);
3379
+ return new StyledText3(chunks);
3705
3380
  }
3706
3381
  function renderedItemsOrStateItems(_state, renderedItems) {
3707
3382
  return renderedItems ? [...renderedItems] : [];
@@ -3837,7 +3512,7 @@ function Backdrop(props) {
3837
3512
  // packages/cli/src/app-opentui/react/SceneFrameView.tsx
3838
3513
  import { useEffect as useEffect2, useRef as useRef2 } from "react";
3839
3514
  import { useRenderer as useRenderer2 } from "@opentui/react";
3840
- import { TextAttributes as TextAttributes5 } from "@opentui/core";
3515
+ import { TextAttributes as TextAttributes4 } from "@opentui/core";
3841
3516
 
3842
3517
  // packages/cli/src/app-opentui/react/scroll.ts
3843
3518
  var registries = new Set;
@@ -3859,7 +3534,7 @@ function scrollActiveBody(delta) {
3859
3534
  // packages/cli/src/app-opentui/react/SceneFrameView.tsx
3860
3535
  import { jsxDEV, Fragment } from "@opentui/react/jsx-dev-runtime";
3861
3536
  function lineAttributes(line2) {
3862
- return line2?.bold ? TextAttributes5.BOLD : line2?.dim ? TextAttributes5.DIM : 0;
3537
+ return line2?.bold ? TextAttributes4.BOLD : line2?.dim ? TextAttributes4.DIM : 0;
3863
3538
  }
3864
3539
  function lineContent(line2) {
3865
3540
  return line2.styledText ?? line2.text ?? "";
@@ -4063,7 +3738,7 @@ var PRIMARY_NAV2 = [
4063
3738
  { id: "tasks", label: "Tasks", scene: "tasks", argv: ["tasks"], enterLabel: "Tasks", member: ["tasks"] },
4064
3739
  { id: "inbox", label: "Inbox", scene: "inbox", argv: ["inbox"], enterLabel: "Inbox", member: ["inbox"], badge: inboxPendingCount2 },
4065
3740
  { id: "stats", label: "Stats", scene: "family", argv: ["stats"], enterLabel: "Stats", member: ["family"] },
4066
- { id: "setup", label: "Setup", scene: "init", argv: ["init"], enterLabel: "Setup", member: ["init", "doctor", "server", "pi", "plugin", "repo", "workspace"] },
3741
+ { id: "init", label: "Init", scene: "init", argv: ["init"], enterLabel: "Init", member: ["init", "doctor", "server", "pi", "plugin", "repo", "workspace"] },
4067
3742
  { id: "help", label: "Help", scene: "help", argv: ["help"], enterLabel: "Help", member: ["help"] }
4068
3743
  ];
4069
3744
  function navSectionIntent(section) {