@marinoscar/platform-cli 0.1.0-next.23 → 0.1.0-next.25

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 (227) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +4 -3
  3. package/dist/engine/commands/node.d.ts.map +1 -1
  4. package/dist/engine/commands/node.js +73 -6
  5. package/dist/engine/commands/node.js.map +1 -1
  6. package/dist/engine/conformance.d.ts +3 -0
  7. package/dist/engine/conformance.d.ts.map +1 -1
  8. package/dist/engine/conformance.js +7 -0
  9. package/dist/engine/conformance.js.map +1 -1
  10. package/dist/engine/create-cli.d.ts +21 -0
  11. package/dist/engine/create-cli.d.ts.map +1 -1
  12. package/dist/engine/create-cli.js +11 -0
  13. package/dist/engine/create-cli.js.map +1 -1
  14. package/dist/engine/index.d.ts +26 -3
  15. package/dist/engine/index.d.ts.map +1 -1
  16. package/dist/engine/index.js +13 -1
  17. package/dist/engine/index.js.map +1 -1
  18. package/dist/engine/node/capabilities.d.ts +199 -4
  19. package/dist/engine/node/capabilities.d.ts.map +1 -1
  20. package/dist/engine/node/capabilities.js +292 -11
  21. package/dist/engine/node/capabilities.js.map +1 -1
  22. package/dist/engine/node/daemon-channels.d.ts +66 -0
  23. package/dist/engine/node/daemon-channels.d.ts.map +1 -0
  24. package/dist/engine/node/daemon-channels.js +65 -0
  25. package/dist/engine/node/daemon-channels.js.map +1 -0
  26. package/dist/engine/node/daemon.d.ts.map +1 -1
  27. package/dist/engine/node/daemon.js +52 -0
  28. package/dist/engine/node/daemon.js.map +1 -1
  29. package/dist/engine/node/doctor.d.ts +2 -0
  30. package/dist/engine/node/doctor.d.ts.map +1 -1
  31. package/dist/engine/node/doctor.js +56 -3
  32. package/dist/engine/node/doctor.js.map +1 -1
  33. package/dist/engine/node/executors/credential-hygiene.d.ts +1 -1
  34. package/dist/engine/node/executors/credential-hygiene.d.ts.map +1 -1
  35. package/dist/engine/node/executors/credential-hygiene.js +23 -2
  36. package/dist/engine/node/executors/credential-hygiene.js.map +1 -1
  37. package/dist/engine/node/executors/index.d.ts +52 -7
  38. package/dist/engine/node/executors/index.d.ts.map +1 -1
  39. package/dist/engine/node/executors/index.js +14 -0
  40. package/dist/engine/node/executors/index.js.map +1 -1
  41. package/dist/engine/node/executors/registry.d.ts.map +1 -1
  42. package/dist/engine/node/executors/registry.js +13 -2
  43. package/dist/engine/node/executors/registry.js.map +1 -1
  44. package/dist/engine/node/install-deps.d.ts +164 -6
  45. package/dist/engine/node/install-deps.d.ts.map +1 -1
  46. package/dist/engine/node/install-deps.js +251 -9
  47. package/dist/engine/node/install-deps.js.map +1 -1
  48. package/dist/engine/node/ipc-protocol.d.ts +49 -2
  49. package/dist/engine/node/ipc-protocol.d.ts.map +1 -1
  50. package/dist/engine/node/ipc-protocol.js +39 -0
  51. package/dist/engine/node/ipc-protocol.js.map +1 -1
  52. package/dist/engine/node/lifecycle.js +2 -1
  53. package/dist/engine/node/lifecycle.js.map +1 -1
  54. package/dist/engine/node/logger.d.ts +13 -0
  55. package/dist/engine/node/logger.d.ts.map +1 -1
  56. package/dist/engine/node/logger.js.map +1 -1
  57. package/dist/engine/node/memory-watchdog.d.ts +11 -0
  58. package/dist/engine/node/memory-watchdog.d.ts.map +1 -1
  59. package/dist/engine/node/memory-watchdog.js +28 -4
  60. package/dist/engine/node/memory-watchdog.js.map +1 -1
  61. package/dist/engine/node/models.d.ts +195 -0
  62. package/dist/engine/node/models.d.ts.map +1 -0
  63. package/dist/engine/node/models.js +379 -0
  64. package/dist/engine/node/models.js.map +1 -0
  65. package/dist/engine/node/node-dashboard-source.d.ts +46 -19
  66. package/dist/engine/node/node-dashboard-source.d.ts.map +1 -1
  67. package/dist/engine/node/node-dashboard-source.js +70 -102
  68. package/dist/engine/node/node-dashboard-source.js.map +1 -1
  69. package/dist/engine/node/node-engine.d.ts +20 -2
  70. package/dist/engine/node/node-engine.d.ts.map +1 -1
  71. package/dist/engine/node/node-engine.js +99 -11
  72. package/dist/engine/node/node-engine.js.map +1 -1
  73. package/dist/engine/node/runtime-state.d.ts +24 -0
  74. package/dist/engine/node/runtime-state.d.ts.map +1 -0
  75. package/dist/engine/node/runtime-state.js +19 -0
  76. package/dist/engine/node/runtime-state.js.map +1 -0
  77. package/dist/engine/node/runtime-tuning.d.ts +111 -2
  78. package/dist/engine/node/runtime-tuning.d.ts.map +1 -1
  79. package/dist/engine/node/runtime-tuning.js +133 -4
  80. package/dist/engine/node/runtime-tuning.js.map +1 -1
  81. package/dist/engine/node/service.d.ts.map +1 -1
  82. package/dist/engine/node/service.js +4 -0
  83. package/dist/engine/node/service.js.map +1 -1
  84. package/dist/engine/node/start.d.ts +7 -0
  85. package/dist/engine/node/start.d.ts.map +1 -1
  86. package/dist/engine/node/start.js +71 -3
  87. package/dist/engine/node/start.js.map +1 -1
  88. package/dist/engine/node/worker-env-aliases.d.ts +39 -0
  89. package/dist/engine/node/worker-env-aliases.d.ts.map +1 -0
  90. package/dist/engine/node/worker-env-aliases.js +126 -0
  91. package/dist/engine/node/worker-env-aliases.js.map +1 -0
  92. package/dist/engine/node/worker-env-table.d.ts.map +1 -1
  93. package/dist/engine/node/worker-env-table.js +4 -1
  94. package/dist/engine/node/worker-env-table.js.map +1 -1
  95. package/dist/engine/node/worker-env.d.ts +18 -1
  96. package/dist/engine/node/worker-env.d.ts.map +1 -1
  97. package/dist/engine/node/worker-env.js +13 -0
  98. package/dist/engine/node/worker-env.js.map +1 -1
  99. package/dist/engine/registries.d.ts.map +1 -1
  100. package/dist/engine/registries.js +7 -0
  101. package/dist/engine/registries.js.map +1 -1
  102. package/dist/engine/tui/app.d.ts.map +1 -1
  103. package/dist/engine/tui/app.js +15 -2
  104. package/dist/engine/tui/app.js.map +1 -1
  105. package/dist/engine/tui/builtin-screens.d.ts.map +1 -1
  106. package/dist/engine/tui/builtin-screens.js +6 -0
  107. package/dist/engine/tui/builtin-screens.js.map +1 -1
  108. package/dist/engine/tui/conformance.d.ts +143 -0
  109. package/dist/engine/tui/conformance.d.ts.map +1 -0
  110. package/dist/engine/tui/conformance.js +423 -0
  111. package/dist/engine/tui/conformance.js.map +1 -0
  112. package/dist/engine/tui/dashboard/index.d.ts +8 -0
  113. package/dist/engine/tui/dashboard/index.d.ts.map +1 -0
  114. package/dist/engine/tui/dashboard/index.js +5 -0
  115. package/dist/engine/tui/dashboard/index.js.map +1 -0
  116. package/dist/engine/tui/dashboard/jobs-insights.d.ts +145 -0
  117. package/dist/engine/tui/dashboard/jobs-insights.d.ts.map +1 -0
  118. package/dist/engine/tui/dashboard/jobs-insights.js +63 -0
  119. package/dist/engine/tui/dashboard/jobs-insights.js.map +1 -0
  120. package/dist/engine/tui/dashboard/node-embedded.d.ts +33 -0
  121. package/dist/engine/tui/dashboard/node-embedded.d.ts.map +1 -0
  122. package/dist/engine/tui/dashboard/node-embedded.js +81 -0
  123. package/dist/engine/tui/dashboard/node-embedded.js.map +1 -0
  124. package/dist/engine/tui/dashboard/source.d.ts +274 -0
  125. package/dist/engine/tui/dashboard/source.d.ts.map +1 -0
  126. package/dist/engine/tui/dashboard/source.js +351 -0
  127. package/dist/engine/tui/dashboard/source.js.map +1 -0
  128. package/dist/engine/tui/dashboard/use-dashboard.d.ts +23 -0
  129. package/dist/engine/tui/dashboard/use-dashboard.d.ts.map +1 -0
  130. package/dist/engine/tui/dashboard/use-dashboard.js +32 -0
  131. package/dist/engine/tui/dashboard/use-dashboard.js.map +1 -0
  132. package/dist/engine/tui/layout.d.ts +20 -0
  133. package/dist/engine/tui/layout.d.ts.map +1 -1
  134. package/dist/engine/tui/layout.js +7 -0
  135. package/dist/engine/tui/layout.js.map +1 -1
  136. package/dist/engine/tui/menu-registry.d.ts +124 -0
  137. package/dist/engine/tui/menu-registry.d.ts.map +1 -0
  138. package/dist/engine/tui/menu-registry.js +151 -0
  139. package/dist/engine/tui/menu-registry.js.map +1 -0
  140. package/dist/engine/tui/menu-tree.d.ts +179 -0
  141. package/dist/engine/tui/menu-tree.d.ts.map +1 -0
  142. package/dist/engine/tui/menu-tree.js +250 -0
  143. package/dist/engine/tui/menu-tree.js.map +1 -0
  144. package/dist/engine/tui/screen-registry.d.ts +1 -1
  145. package/dist/engine/tui/screen-registry.d.ts.map +1 -1
  146. package/dist/engine/tui/screen-registry.js +2 -1
  147. package/dist/engine/tui/screen-registry.js.map +1 -1
  148. package/dist/engine/tui/screens/jobs.d.ts +12 -0
  149. package/dist/engine/tui/screens/jobs.d.ts.map +1 -0
  150. package/dist/engine/tui/screens/jobs.js +72 -0
  151. package/dist/engine/tui/screens/jobs.js.map +1 -0
  152. package/dist/engine/tui/screens/menu.d.ts +4 -1
  153. package/dist/engine/tui/screens/menu.d.ts.map +1 -1
  154. package/dist/engine/tui/screens/menu.js +85 -22
  155. package/dist/engine/tui/screens/menu.js.map +1 -1
  156. package/dist/engine/tui/screens/node.d.ts.map +1 -1
  157. package/dist/engine/tui/screens/node.js +82 -37
  158. package/dist/engine/tui/screens/node.js.map +1 -1
  159. package/dist/engine/tui/screens/not-logged-in.d.ts +12 -0
  160. package/dist/engine/tui/screens/not-logged-in.d.ts.map +1 -0
  161. package/dist/engine/tui/screens/not-logged-in.js +14 -0
  162. package/dist/engine/tui/screens/not-logged-in.js.map +1 -0
  163. package/dist/engine/tui/scroll-box.d.ts +15 -0
  164. package/dist/engine/tui/scroll-box.d.ts.map +1 -1
  165. package/dist/engine/tui/scroll-box.js +10 -0
  166. package/dist/engine/tui/scroll-box.js.map +1 -1
  167. package/dist/engine/tui/testing/feeds.d.ts +58 -0
  168. package/dist/engine/tui/testing/feeds.d.ts.map +1 -0
  169. package/dist/engine/tui/testing/feeds.js +67 -0
  170. package/dist/engine/tui/testing/feeds.js.map +1 -0
  171. package/dist/engine/tui/testing/harness.d.ts +241 -0
  172. package/dist/engine/tui/testing/harness.d.ts.map +1 -0
  173. package/dist/engine/tui/testing/harness.js +332 -0
  174. package/dist/engine/tui/testing/harness.js.map +1 -0
  175. package/dist/engine/tui/ui/active-items.d.ts +40 -0
  176. package/dist/engine/tui/ui/active-items.d.ts.map +1 -0
  177. package/dist/engine/tui/ui/active-items.js +38 -0
  178. package/dist/engine/tui/ui/active-items.js.map +1 -0
  179. package/dist/engine/tui/ui/event-log.d.ts +58 -0
  180. package/dist/engine/tui/ui/event-log.d.ts.map +1 -0
  181. package/dist/engine/tui/ui/event-log.js +32 -0
  182. package/dist/engine/tui/ui/event-log.js.map +1 -0
  183. package/dist/engine/tui/ui/index.d.ts +20 -0
  184. package/dist/engine/tui/ui/index.d.ts.map +1 -0
  185. package/dist/engine/tui/ui/index.js +14 -0
  186. package/dist/engine/tui/ui/index.js.map +1 -0
  187. package/dist/engine/tui/ui/meter-legend.d.ts +26 -0
  188. package/dist/engine/tui/ui/meter-legend.d.ts.map +1 -0
  189. package/dist/engine/tui/ui/meter-legend.js +25 -0
  190. package/dist/engine/tui/ui/meter-legend.js.map +1 -0
  191. package/dist/engine/tui/ui/run-summary.d.ts +58 -0
  192. package/dist/engine/tui/ui/run-summary.d.ts.map +1 -0
  193. package/dist/engine/tui/ui/run-summary.js +29 -0
  194. package/dist/engine/tui/ui/run-summary.js.map +1 -0
  195. package/dist/engine/tui/ui/segment-meter.d.ts +72 -0
  196. package/dist/engine/tui/ui/segment-meter.d.ts.map +1 -0
  197. package/dist/engine/tui/ui/segment-meter.js +128 -0
  198. package/dist/engine/tui/ui/segment-meter.js.map +1 -0
  199. package/dist/engine/tui/ui/status-line.d.ts +42 -0
  200. package/dist/engine/tui/ui/status-line.d.ts.map +1 -0
  201. package/dist/engine/tui/ui/status-line.js +35 -0
  202. package/dist/engine/tui/ui/status-line.js.map +1 -0
  203. package/dist/engine/tui/ui/tone.d.ts +46 -0
  204. package/dist/engine/tui/ui/tone.d.ts.map +1 -0
  205. package/dist/engine/tui/ui/tone.js +48 -0
  206. package/dist/engine/tui/ui/tone.js.map +1 -0
  207. package/dist/node/index.d.ts +2 -2
  208. package/dist/node/index.d.ts.map +1 -1
  209. package/dist/node/index.js +1 -1
  210. package/dist/node/index.js.map +1 -1
  211. package/dist/testing/index.d.ts +2 -2
  212. package/dist/testing/index.d.ts.map +1 -1
  213. package/dist/testing/index.js +1 -1
  214. package/dist/testing/index.js.map +1 -1
  215. package/dist/tui/index.d.ts +2 -2
  216. package/dist/tui/index.d.ts.map +1 -1
  217. package/dist/tui/index.js +1 -1
  218. package/dist/tui/index.js.map +1 -1
  219. package/dist/tui/testing/index.d.ts +5 -0
  220. package/dist/tui/testing/index.d.ts.map +1 -0
  221. package/dist/tui/testing/index.js +12 -0
  222. package/dist/tui/testing/index.js.map +1 -0
  223. package/dist/tui/ui/index.d.ts +2 -0
  224. package/dist/tui/ui/index.d.ts.map +1 -0
  225. package/dist/tui/ui/index.js +10 -0
  226. package/dist/tui/ui/index.js.map +1 -0
  227. package/package.json +16 -3
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ import { useTuiTheme } from '../context.js';
4
+ import { useTerminalSize } from '../layout.js';
5
+ import { textColor } from '../theme.js';
6
+ import { middleTruncate } from './tone.js';
7
+ const DEFAULT_MAX_VISIBLE = 5;
8
+ function clampFraction(fraction) {
9
+ return Number.isFinite(fraction) ? Math.min(1, Math.max(0, fraction)) : 0;
10
+ }
11
+ /**
12
+ * Mini progress bars for the items currently in flight.
13
+ *
14
+ * Each row is a bar, a percentage and the label. The bar shrinks with the
15
+ * terminal and the label takes what is left, cut in the middle, so a row never
16
+ * wraps. Draws nothing when there are no items.
17
+ *
18
+ * @param props - The items and how many to show.
19
+ * @returns The rows, or nothing when empty.
20
+ * @stability experimental
21
+ */
22
+ export function ActiveItems({ items, maxVisible, title }) {
23
+ const theme = useTuiTheme();
24
+ const { columns, narrow, tiny } = useTerminalSize();
25
+ if (items.length === 0)
26
+ return null;
27
+ const limit = Math.max(1, Math.floor(maxVisible ?? DEFAULT_MAX_VISIBLE));
28
+ const visible = items.slice(0, limit);
29
+ const barWidth = tiny ? 6 : narrow ? 10 : 20;
30
+ // bar + space + "100%" + space.
31
+ const labelBudget = Math.max(6, columns - barWidth - 7);
32
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, dimColor: true, children: `${title ?? 'Active'} (${items.length})` }), visible.map((item) => {
33
+ const fraction = clampFraction(item.fraction);
34
+ const filled = Math.round(fraction * barWidth);
35
+ return (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { ...textColor(theme.primary), children: theme.glyphs.meter.full.repeat(filled) }), _jsx(Text, { dimColor: true, children: theme.glyphs.meter.light.repeat(barWidth - filled) }), _jsx(Text, { dimColor: true, children: ` ${String(Math.round(fraction * 100)).padStart(3)}% ` }), _jsx(Text, { children: middleTruncate(item.label, labelBudget, theme.glyphs.ellipsis) })] }, item.id));
36
+ }), items.length > limit ? _jsx(Text, { dimColor: true, children: ` ${theme.glyphs.ellipsis} and ${items.length - limit} more` }) : null] }));
37
+ }
38
+ //# sourceMappingURL=active-items.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"active-items.js","sourceRoot":"","sources":["../../../../src/engine/tui/ui/active-items.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAGhC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AA8B3C,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,SAAS,aAAa,CAAC,QAAgB;IACrC,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAA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AAC,OAAO,CAAC,YAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAQ,EACnF,KAAC,IAAI,IAAC,QAAQ,kBAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,GAAQ,EAC1E,KAAC,IAAI,IAAC,QAAQ,kBAAE,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAQ,EAC9E,KAAC,IAAI,cAAE,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAQ,KAJpE,IAAI,CAAC,EAAE,CAKX,CACR,CAAC;YACJ,CAAC,CAAC,EACD,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,QAAQ,kBAAE,KAAK,KAAK,CAAC,MAAM,CAAC,QAAQ,QAAQ,KAAK,CAAC,MAAM,GAAG,KAAK,OAAO,GAAQ,CAAC,CAAC,CAAC,IAAI,IAChH,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,58 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type TuiTone } from './tone.js';
3
+ /**
4
+ * One line of an {@link EventLog}.
5
+ *
6
+ * @stability experimental
7
+ */
8
+ export interface TuiLogEvent<K extends string = string> {
9
+ /** A stable key; a new event must never reuse one. */
10
+ id: string | number;
11
+ /** Selects the glyph and tone from the log's `kinds`. */
12
+ kind: K;
13
+ /** The main text, e.g. a path; shortened in the middle when the line is full. */
14
+ text: string;
15
+ /** A trailing explanation, e.g. a reason or an error; dim, cut at the end. */
16
+ detail?: string | undefined;
17
+ /** True when the item will be tried again. */
18
+ retrying?: boolean | undefined;
19
+ }
20
+ /**
21
+ * How one event kind is drawn.
22
+ *
23
+ * @stability experimental
24
+ */
25
+ export interface TuiLogKind {
26
+ /** A short mark, normally one cell. It carries the meaning when colour is off. */
27
+ glyph: string;
28
+ /** The colour role. */
29
+ tone: TuiTone;
30
+ }
31
+ /**
32
+ * Props of {@link EventLog}.
33
+ *
34
+ * @stability experimental
35
+ */
36
+ export interface EventLogProps<K extends string> {
37
+ /** Oldest first; the newest `maxVisible` are drawn. */
38
+ events: readonly TuiLogEvent<K>[];
39
+ /** The glyph and tone of each kind. An unknown kind is drawn as a dim bullet. */
40
+ kinds: Readonly<Record<K, TuiLogKind>>;
41
+ /** How many lines to show; default 8. */
42
+ maxVisible?: number | undefined;
43
+ /** An optional heading above the lines. */
44
+ title?: string | undefined;
45
+ }
46
+ /**
47
+ * A rolling log: the newest lines, newest last.
48
+ *
49
+ * Draws nothing when there are no events. Each line is one terminal row; text is
50
+ * shortened in the middle and the detail at the end, so a long path never wraps.
51
+ *
52
+ * @typeParam K - The event kinds the app uses.
53
+ * @param props - The events and how each kind looks.
54
+ * @returns The log, or nothing when empty.
55
+ * @stability experimental
56
+ */
57
+ export declare function EventLog<K extends string>({ events, kinds, maxVisible, title, }: EventLogProps<K>): ReactNode;
58
+ //# sourceMappingURL=event-log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-log.d.ts","sourceRoot":"","sources":["../../../../src/engine/tui/ui/event-log.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,EAA6B,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpE;;;;GAIG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACpD,sDAAsD;IACtD,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,yDAAyD;IACzD,IAAI,EAAE,CAAC,CAAC;IACR,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM;IAC7C,uDAAuD;IACvD,MAAM,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAClC,iFAAiF;IACjF,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;IACvC,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,EACzC,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,GACN,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAgC9B"}
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ import { useTuiTheme } from '../context.js';
4
+ import { useTerminalSize } from '../layout.js';
5
+ import { middleTruncate, toneProps } from './tone.js';
6
+ const DEFAULT_MAX_VISIBLE = 8;
7
+ /**
8
+ * A rolling log: the newest lines, newest last.
9
+ *
10
+ * Draws nothing when there are no events. Each line is one terminal row; text is
11
+ * shortened in the middle and the detail at the end, so a long path never wraps.
12
+ *
13
+ * @typeParam K - The event kinds the app uses.
14
+ * @param props - The events and how each kind looks.
15
+ * @returns The log, or nothing when empty.
16
+ * @stability experimental
17
+ */
18
+ export function EventLog({ events, kinds, maxVisible, title, }) {
19
+ const theme = useTuiTheme();
20
+ const { columns, tiny } = useTerminalSize();
21
+ if (events.length === 0)
22
+ return null;
23
+ const limit = Math.max(1, Math.floor(maxVisible ?? DEFAULT_MAX_VISIBLE));
24
+ const visible = events.slice(-limit);
25
+ // Roughly two thirds of the row for the text, the rest for the detail.
26
+ const textBudget = Math.max(8, Math.floor(columns * (tiny ? 0.8 : 0.55)));
27
+ return (_jsxs(Box, { flexDirection: "column", children: [title === undefined ? null : (_jsx(Text, { bold: true, dimColor: true, children: title })), visible.map((event) => {
28
+ const style = kinds[event.kind] ?? { glyph: theme.glyphs.bullet, tone: 'dim' };
29
+ return (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { ...toneProps(theme, style.tone), children: style.glyph }), _jsx(Text, { children: " " }), _jsx(Text, { ...(style.tone === 'dim' ? { dimColor: true } : {}), children: middleTruncate(event.text, textBudget, theme.glyphs.ellipsis) }), event.detail === undefined || event.detail === '' ? null : _jsx(Text, { dimColor: true, children: ` ${event.detail}` }), event.retrying === true ? _jsx(Text, { dimColor: true, children: ' (retrying)' }) : null] }, event.id));
30
+ })] }));
31
+ }
32
+ //# sourceMappingURL=event-log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-log.js","sourceRoot":"","sources":["../../../../src/engine/tui/ui/event-log.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAGhC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAgB,MAAM,WAAW,CAAC;AAgDpE,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,QAAQ,CAAmB,EACzC,MAAM,EACN,KAAK,EACL,UAAU,EACV,KAAK,GACY;IACjB,MAAM,KAAK,GAAG,WAAW,EAAE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CAAC,EAAE,CAAC,YAAG,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAQ,EACjI,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,QAAQ,kBAAE,IAAI,KAAK,CAAC,MAAM,EAAE,GAAQ,EACrG,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,QAAQ,kBAAE,aAAa,GAAQ,CAAC,CAAC,CAAC,IAAI,KAL9D,KAAK,CAAC,EAAE,CAMZ,CACR,CAAC;YACJ,CAAC,CAAC,IACE,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ export { EventLog } from './event-log.js';
2
+ export type { EventLogProps, TuiLogEvent, TuiLogKind } from './event-log.js';
3
+ export { SegmentMeter, allocateMeterCells } from './segment-meter.js';
4
+ export type { SegmentMeterProps, TuiMeterSegment } from './segment-meter.js';
5
+ export { MeterLegend } from './meter-legend.js';
6
+ export type { MeterLegendProps } from './meter-legend.js';
7
+ export { StatusLine } from './status-line.js';
8
+ export type { StatusLineProps, TuiStatusItem } from './status-line.js';
9
+ export { ActiveItems } from './active-items.js';
10
+ export type { ActiveItemsProps, TuiActiveItem } from './active-items.js';
11
+ export { RunSummary } from './run-summary.js';
12
+ export type { RunSummaryProps, TuiSummaryFailure, TuiSummaryStat } from './run-summary.js';
13
+ export { middleTruncate, toneProps } from './tone.js';
14
+ export type { TuiTone, TuiToneProps } from './tone.js';
15
+ export { ErrorNotice, Field, Frame, KeyHints, NARROW_COLUMNS, TINY_COLUMNS, useTerminalSize } from '../layout.js';
16
+ export type { FrameProps, TerminalSize } from '../layout.js';
17
+ export { ScrollBox } from '../scroll-box.js';
18
+ export type { ScrollBoxProps } from '../scroll-box.js';
19
+ export { formatDuration } from '../../node/node-dashboard-source.js';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/engine/tui/ui/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtD,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClH,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,14 @@
1
+ // The component kit behind `@marinoscar/platform-cli/tui/ui` (RETRO-G1.4, #1068).
2
+ // Importing it loads ink; `@marinoscar/platform-cli/tui` never does.
3
+ export { EventLog } from './event-log.js';
4
+ export { SegmentMeter, allocateMeterCells } from './segment-meter.js';
5
+ export { MeterLegend } from './meter-legend.js';
6
+ export { StatusLine } from './status-line.js';
7
+ export { ActiveItems } from './active-items.js';
8
+ export { RunSummary } from './run-summary.js';
9
+ export { middleTruncate, toneProps } from './tone.js';
10
+ // The platform's own building blocks, promoted to public.
11
+ export { ErrorNotice, Field, Frame, KeyHints, NARROW_COLUMNS, TINY_COLUMNS, useTerminalSize } from '../layout.js';
12
+ export { ScrollBox } from '../scroll-box.js';
13
+ export { formatDuration } from '../../node/node-dashboard-source.js';
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/engine/tui/ui/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,qEAAqE;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtD,0DAA0D;AAC1D,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAElH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type TuiMeterSegment } from './segment-meter.js';
3
+ /**
4
+ * Props of {@link MeterLegend}.
5
+ *
6
+ * @stability experimental
7
+ */
8
+ export interface MeterLegendProps<C extends string> {
9
+ /** The same list the {@link SegmentMeter} draws, so glyphs and tones match. */
10
+ segments: readonly TuiMeterSegment<C>[];
11
+ /** The number of items the full bar stands for; drives the percentages. */
12
+ total: number;
13
+ }
14
+ /**
15
+ * Swatches with a label, count and share for each meter category.
16
+ *
17
+ * Wide terminals wrap the entries in a row; below the narrow threshold they
18
+ * stack one per line so nothing is cut.
19
+ *
20
+ * @typeParam C - The category ids the app uses.
21
+ * @param props - The categories and the total.
22
+ * @returns The legend.
23
+ * @stability experimental
24
+ */
25
+ export declare function MeterLegend<C extends string>({ segments, total }: MeterLegendProps<C>): ReactNode;
26
+ //# sourceMappingURL=meter-legend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meter-legend.d.ts","sourceRoot":"","sources":["../../../../src/engine/tui/ui/meter-legend.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGxE;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,MAAM;IAChD,+EAA+E;IAC/E,QAAQ,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,SAAS,CAoBjG"}
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ import { useTuiTheme } from '../context.js';
4
+ import { useTerminalSize } from '../layout.js';
5
+ import { segmentGlyph } from './segment-meter.js';
6
+ import { toneProps } from './tone.js';
7
+ /**
8
+ * Swatches with a label, count and share for each meter category.
9
+ *
10
+ * Wide terminals wrap the entries in a row; below the narrow threshold they
11
+ * stack one per line so nothing is cut.
12
+ *
13
+ * @typeParam C - The category ids the app uses.
14
+ * @param props - The categories and the total.
15
+ * @returns The legend.
16
+ * @stability experimental
17
+ */
18
+ export function MeterLegend({ segments, total }) {
19
+ const theme = useTuiTheme();
20
+ const { narrow } = useTerminalSize();
21
+ const sum = segments.reduce((acc, segment) => acc + Math.max(0, segment.count), 0);
22
+ const share = (count) => (total > 0 ? `${Math.round((Math.max(0, count) / total) * 100)}%` : '0%');
23
+ return (_jsxs(Box, { ...(narrow ? { flexDirection: 'column' } : { flexDirection: 'row', flexWrap: 'wrap', columnGap: 2 }), children: [segments.map((segment, index) => (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { ...toneProps(theme, segment.tone), children: segmentGlyph(theme, segment, index) }), _jsx(Text, { dimColor: true, children: ` ${segment.label ?? segment.id} ` }), _jsx(Text, { children: segment.count }), _jsx(Text, { dimColor: true, children: ` (${share(segment.count)})` })] }, segment.id))), _jsx(Text, { dimColor: true, children: `${sum} / ${total}` })] }));
24
+ }
25
+ //# sourceMappingURL=meter-legend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meter-legend.js","sourceRoot":"","sources":["../../../../src/engine/tui/ui/meter-legend.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAGhC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EA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IAAC,QAAQ,kBAAE,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,EAAE,GAAG,GAAQ,EAC1D,KAAC,IAAI,cAAE,OAAO,CAAC,KAAK,GAAQ,EAC5B,KAAC,IAAI,IAAC,QAAQ,kBAAE,KAAK,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,GAAQ,KAJ3C,OAAO,CAAC,EAAE,CAKd,CACR,CAAC,EACF,KAAC,IAAI,IAAC,QAAQ,kBAAE,GAAG,GAAG,MAAM,KAAK,EAAE,GAAQ,IACvC,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,58 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type TuiTone } from './tone.js';
3
+ /**
4
+ * One headline number of a {@link RunSummary}.
5
+ *
6
+ * @stability experimental
7
+ */
8
+ export interface TuiSummaryStat {
9
+ /** What it counts. Dim. */
10
+ label: string;
11
+ /** The value, already formatted. */
12
+ value: string;
13
+ /** The value's colour role. */
14
+ tone?: TuiTone | undefined;
15
+ }
16
+ /**
17
+ * One failed item listed by a {@link RunSummary}.
18
+ *
19
+ * @stability experimental
20
+ */
21
+ export interface TuiSummaryFailure {
22
+ /** A stable key. */
23
+ id: string | number;
24
+ /** What failed, e.g. a path. */
25
+ label: string;
26
+ /** Why. */
27
+ error: string;
28
+ }
29
+ /**
30
+ * Props of {@link RunSummary}.
31
+ *
32
+ * @stability experimental
33
+ */
34
+ export interface RunSummaryProps {
35
+ /** The heading, e.g. `Run complete`. */
36
+ title: string;
37
+ /** The headline numbers, left to right. */
38
+ stats: readonly TuiSummaryStat[];
39
+ /** How long the run took; shown as a final stat. */
40
+ durationMs: number;
41
+ /** Items to list as failed; the first ten are drawn. */
42
+ failures?: readonly TuiSummaryFailure[] | undefined;
43
+ /** Anything below, e.g. key hints or an export path. */
44
+ footer?: ReactNode;
45
+ }
46
+ /**
47
+ * The end-of-run panel: headline stats, duration, a failures list and a footer.
48
+ *
49
+ * Bordered when there is room; below the narrow threshold the border and
50
+ * padding go, so the content keeps every column. Draws no keys of its own, the
51
+ * screen decides what Enter or `r` mean.
52
+ *
53
+ * @param props - The title, stats, duration, failures and footer.
54
+ * @returns The panel.
55
+ * @stability experimental
56
+ */
57
+ export declare function RunSummary({ title, stats, durationMs, failures, footer }: RunSummaryProps): ReactNode;
58
+ //# sourceMappingURL=run-summary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-summary.d.ts","sourceRoot":"","sources":["../../../../src/engine/tui/ui/run-summary.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,OAAO,EAA6B,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpE;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IACjC,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,SAAS,iBAAiB,EAAE,GAAG,SAAS,CAAC;IACpD,wDAAwD;IACxD,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,eAAe,GAAG,SAAS,CA+DrG"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ import { formatDuration } from '../../node/node-dashboard-source.js';
4
+ import { useTuiTheme } from '../context.js';
5
+ import { useTerminalSize } from '../layout.js';
6
+ import { textColor } from '../theme.js';
7
+ import { middleTruncate, toneProps } from './tone.js';
8
+ const MAX_FAILURES = 10;
9
+ /**
10
+ * The end-of-run panel: headline stats, duration, a failures list and a footer.
11
+ *
12
+ * Bordered when there is room; below the narrow threshold the border and
13
+ * padding go, so the content keeps every column. Draws no keys of its own, the
14
+ * screen decides what Enter or `r` mean.
15
+ *
16
+ * @param props - The title, stats, duration, failures and footer.
17
+ * @returns The panel.
18
+ * @stability experimental
19
+ */
20
+ export function RunSummary({ title, stats, durationMs, failures, footer }) {
21
+ const theme = useTuiTheme();
22
+ const { columns, narrow } = useTerminalSize();
23
+ const failed = failures ?? [];
24
+ const shown = failed.slice(0, MAX_FAILURES);
25
+ const labelBudget = Math.max(8, Math.floor(columns * 0.35));
26
+ const panel = (_jsxs(Box, { flexDirection: "column", gap: narrow ? 0 : 1, children: [_jsx(Text, { bold: true, ...textColor(theme.primary), children: title }), _jsxs(Box, { flexWrap: "wrap", columnGap: narrow ? 2 : 4, children: [stats.map((stat) => (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: stat.label }), _jsx(Text, { bold: true, ...toneProps(theme, stat.tone), children: stat.value })] }, stat.label))), _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: "Duration" }), _jsx(Text, { bold: true, children: formatDuration(durationMs) })] })] })] }));
27
+ return (_jsxs(Box, { flexDirection: "column", gap: narrow ? 0 : 1, children: [narrow ? (panel) : (_jsx(Box, { borderStyle: "round", ...(theme.primary === undefined ? {} : { borderColor: theme.primary }), flexDirection: "column", paddingX: 2, paddingY: 1, children: panel })), shown.length === 0 ? null : (_jsxs(Box, { flexDirection: "column", ...(narrow ? {} : { borderStyle: 'round', paddingX: 2, paddingY: 1 }), ...(narrow || theme.error === undefined ? {} : { borderColor: theme.error }), children: [_jsx(Text, { bold: true, ...textColor(theme.error), children: `Failed (${failed.length})` }), shown.map((failure) => (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { ...textColor(theme.error), children: theme.glyphs.cross }), _jsx(Text, { children: ` ${middleTruncate(failure.label, labelBudget, theme.glyphs.ellipsis)}` }), _jsx(Text, { dimColor: true, children: `: ${failure.error}` })] }, failure.id))), failed.length > shown.length ? (_jsx(Text, { dimColor: true, children: `${theme.glyphs.ellipsis} and ${failed.length - shown.length} more` })) : null] })), footer === undefined || footer === null ? null : _jsx(Box, { flexDirection: "column", children: footer })] }));
28
+ }
29
+ //# sourceMappingURL=run-summary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-summary.js","sourceRoot":"","sources":["../../../../src/engine/tui/ui/run-summary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAGhC,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAgB,MAAM,WAAW,CAAC;AAgDpE,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAmB;IACxF,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,eAAe,EAAE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,QAAQ,kBAAE,KAAK,OAAO,CAAC,KAAK,EAAE,GAAQ,KAHnC,OAAO,CAAC,EAAE,CAId,CACR,CAAC,EACD,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAC9B,KAAC,IAAI,IAAC,QAAQ,kBAAE,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,QAAQ,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,OAAO,GAAQ,CAC5F,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,EAEA,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,YAAE,MAAM,GAAO,IACxF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,72 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { TuiTheme } from '../theme.js';
3
+ import { type TuiTone } from './tone.js';
4
+ /**
5
+ * One category of a {@link SegmentMeter}.
6
+ *
7
+ * @stability experimental
8
+ */
9
+ export interface TuiMeterSegment<C extends string = string> {
10
+ /** A stable id, also the legend label unless `label` is set. */
11
+ id: C;
12
+ /** How many items fall in this category. */
13
+ count: number;
14
+ /** The colour role. */
15
+ tone: TuiTone;
16
+ /**
17
+ * The block drawn for this category. Defaults to a theme meter glyph chosen by
18
+ * position, so categories stay distinguishable under `NO_COLOR`.
19
+ */
20
+ glyph?: string | undefined;
21
+ /** The legend text; defaults to `id`. */
22
+ label?: string | undefined;
23
+ /** True when the category counts as finished work (drives the percentage). */
24
+ done?: boolean | undefined;
25
+ }
26
+ /**
27
+ * Props of {@link SegmentMeter}.
28
+ *
29
+ * @stability experimental
30
+ */
31
+ export interface SegmentMeterProps<C extends string> {
32
+ /** The categories, in drawing order. */
33
+ segments: readonly TuiMeterSegment<C>[];
34
+ /** The number of items the full bar stands for. */
35
+ total: number;
36
+ /** Cells to draw; default 56, always cut to fit the terminal. */
37
+ width?: number | undefined;
38
+ }
39
+ /**
40
+ * Split `width` cells across categories, by largest remainder.
41
+ *
42
+ * Returns one entry per count plus a final entry for the unfilled share
43
+ * (`total` minus the counts, never negative), so the result always sums to
44
+ * exactly `width`. A category with a non-zero count always gets at least one
45
+ * cell, so a single failure among thousands of successes stays visible; the
46
+ * cells come out of the largest categories. When more categories are non-zero
47
+ * than there are cells, the smallest ones are dropped.
48
+ *
49
+ * @param counts - Items per category (negative and non-finite values count as 0).
50
+ * @param total - Items the whole bar stands for; raised to the sum of the counts when smaller.
51
+ * @param width - Cells available; below 1 yields all zeros.
52
+ * @returns `counts.length + 1` whole numbers summing to `width`.
53
+ * @stability experimental
54
+ */
55
+ export declare function allocateMeterCells(counts: readonly number[], total: number, width: number): number[];
56
+ /** The block for a segment: its own, else a theme meter glyph by position. */
57
+ export declare function segmentGlyph(theme: TuiTheme, segment: TuiMeterSegment, index: number): string;
58
+ /**
59
+ * A one-row segmented progress bar.
60
+ *
61
+ * Each category is a run of cells in its own tone and glyph; the share not yet
62
+ * accounted for is drawn with the theme's light block, dimmed. The width is cut
63
+ * to the terminal, and a percentage of the `done` categories follows the bar
64
+ * when at least one is flagged and there is room.
65
+ *
66
+ * @typeParam C - The category ids the app uses.
67
+ * @param props - The categories and the total.
68
+ * @returns The bar.
69
+ * @stability experimental
70
+ */
71
+ export declare function SegmentMeter<C extends string>({ segments, total, width }: SegmentMeterProps<C>): ReactNode;
72
+ //# sourceMappingURL=segment-meter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segment-meter.d.ts","sourceRoot":"","sources":["../../../../src/engine/tui/ui/segment-meter.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACxD,gEAAgE;IAChE,EAAE,EAAE,CAAC,CAAC;IACN,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,IAAI,EAAE,OAAO,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,8EAA8E;IAC9E,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM;IACjD,wCAAwC;IACxC,QAAQ,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAqEpG;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK7F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,SAAS,CAoC1G"}
@@ -0,0 +1,128 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ import { useTuiTheme } from '../context.js';
4
+ import { useTerminalSize } from '../layout.js';
5
+ import { toneProps } from './tone.js';
6
+ const DEFAULT_METER_WIDTH = 56;
7
+ const MIN_METER_WIDTH = 8;
8
+ const PERCENT_COLUMNS = 5;
9
+ /**
10
+ * Split `width` cells across categories, by largest remainder.
11
+ *
12
+ * Returns one entry per count plus a final entry for the unfilled share
13
+ * (`total` minus the counts, never negative), so the result always sums to
14
+ * exactly `width`. A category with a non-zero count always gets at least one
15
+ * cell, so a single failure among thousands of successes stays visible; the
16
+ * cells come out of the largest categories. When more categories are non-zero
17
+ * than there are cells, the smallest ones are dropped.
18
+ *
19
+ * @param counts - Items per category (negative and non-finite values count as 0).
20
+ * @param total - Items the whole bar stands for; raised to the sum of the counts when smaller.
21
+ * @param width - Cells available; below 1 yields all zeros.
22
+ * @returns `counts.length + 1` whole numbers summing to `width`.
23
+ * @stability experimental
24
+ */
25
+ export function allocateMeterCells(counts, total, width) {
26
+ const cells = Math.max(0, Math.floor(Number.isFinite(width) ? width : 0));
27
+ const shares = counts.map((count) => (Number.isFinite(count) && count > 0 ? count : 0));
28
+ const filled = shares.reduce((sum, share) => sum + share, 0);
29
+ const safeTotal = Number.isFinite(total) && total > 0 ? total : 0;
30
+ const denominator = Math.max(safeTotal, filled);
31
+ shares.push(Math.max(0, denominator - filled));
32
+ const result = shares.map(() => 0);
33
+ if (cells === 0)
34
+ return result;
35
+ if (denominator === 0) {
36
+ result[result.length - 1] = cells;
37
+ return result;
38
+ }
39
+ const exact = shares.map((share) => (share / denominator) * cells);
40
+ for (let i = 0; i < shares.length; i += 1)
41
+ result[i] = Math.floor(exact[i] ?? 0);
42
+ // Never lose a non-zero category: lift each empty one to a single cell, largest first.
43
+ const empties = shares
44
+ .map((share, index) => ({ share, index }))
45
+ .filter(({ share, index }) => share > 0 && result[index] === 0)
46
+ .sort((a, b) => b.share - a.share || a.index - b.index);
47
+ for (const { index } of empties)
48
+ result[index] = 1;
49
+ let allocated = result.reduce((sum, cell) => sum + cell, 0);
50
+ // Over budget (lifts, or more non-zero categories than cells): take from the
51
+ // most over-served cell above one; when none is above one, drop the smallest category.
52
+ while (allocated > cells) {
53
+ let pick = -1;
54
+ let overshoot = -Infinity;
55
+ for (let i = 0; i < result.length; i += 1) {
56
+ const cell = result[i] ?? 0;
57
+ if (cell > 1 && cell - (exact[i] ?? 0) > overshoot) {
58
+ overshoot = cell - (exact[i] ?? 0);
59
+ pick = i;
60
+ }
61
+ }
62
+ if (pick === -1) {
63
+ let smallest = Infinity;
64
+ for (let i = 0; i < result.length; i += 1) {
65
+ if ((result[i] ?? 0) > 0 && (shares[i] ?? 0) < smallest) {
66
+ smallest = shares[i] ?? 0;
67
+ pick = i;
68
+ }
69
+ }
70
+ }
71
+ result[pick] = (result[pick] ?? 0) - 1;
72
+ allocated -= 1;
73
+ }
74
+ // Under budget: hand the leftovers to the largest remainders.
75
+ while (allocated < cells) {
76
+ let pick = 0;
77
+ let deficit = -Infinity;
78
+ for (let i = 0; i < result.length; i += 1) {
79
+ if ((shares[i] ?? 0) <= 0)
80
+ continue;
81
+ const gap = (exact[i] ?? 0) - (result[i] ?? 0);
82
+ if (gap > deficit) {
83
+ deficit = gap;
84
+ pick = i;
85
+ }
86
+ }
87
+ result[pick] = (result[pick] ?? 0) + 1;
88
+ allocated += 1;
89
+ }
90
+ return result;
91
+ }
92
+ /** The block for a segment: its own, else a theme meter glyph by position. */
93
+ export function segmentGlyph(theme, segment, index) {
94
+ if (segment.glyph !== undefined)
95
+ return segment.glyph;
96
+ const { full, dense, medium, light } = theme.glyphs.meter;
97
+ const cycle = [full, dense, medium, light];
98
+ return cycle[index % cycle.length] ?? full;
99
+ }
100
+ /**
101
+ * A one-row segmented progress bar.
102
+ *
103
+ * Each category is a run of cells in its own tone and glyph; the share not yet
104
+ * accounted for is drawn with the theme's light block, dimmed. The width is cut
105
+ * to the terminal, and a percentage of the `done` categories follows the bar
106
+ * when at least one is flagged and there is room.
107
+ *
108
+ * @typeParam C - The category ids the app uses.
109
+ * @param props - The categories and the total.
110
+ * @returns The bar.
111
+ * @stability experimental
112
+ */
113
+ export function SegmentMeter({ segments, total, width }) {
114
+ const theme = useTuiTheme();
115
+ const { columns } = useTerminalSize();
116
+ const hasDone = segments.some((segment) => segment.done === true);
117
+ const showPercent = hasDone && columns >= 30;
118
+ const available = Math.max(MIN_METER_WIDTH, columns - 2 - (showPercent ? PERCENT_COLUMNS : 0));
119
+ const cells = Math.min(Math.max(1, Math.floor(width ?? DEFAULT_METER_WIDTH)), available);
120
+ const allocation = allocateMeterCells(segments.map((segment) => segment.count), total, cells);
121
+ const finished = segments.reduce((sum, segment) => sum + (segment.done === true ? Math.max(0, segment.count) : 0), 0);
122
+ const percent = total > 0 ? Math.min(100, Math.round((finished / total) * 100)) : 0;
123
+ return (_jsxs(Box, { children: [_jsxs(Text, { children: [segments.map((segment, index) => {
124
+ const run = allocation[index] ?? 0;
125
+ return run === 0 ? null : (_jsx(Text, { ...toneProps(theme, segment.tone), children: segmentGlyph(theme, segment, index).repeat(run) }, segment.id));
126
+ }), (allocation[segments.length] ?? 0) === 0 ? null : (_jsx(Text, { dimColor: true, children: theme.glyphs.meter.light.repeat(allocation[segments.length] ?? 0) }))] }), showPercent ? _jsx(Text, { dimColor: true, children: ` ${String(percent).padStart(3)}%` }) : null] }));
127
+ }
128
+ //# sourceMappingURL=segment-meter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segment-meter.js","sourceRoot":"","sources":["../../../../src/engine/tui/ui/segment-meter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAGhC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAgB,MAAM,WAAW,CAAC;AAuCpD,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,eAAe,GAAG,CAAC,CA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GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;wBACnC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACxB,KAAC,IAAI,OAAsB,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,YACtD,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IADvC,OAAO,CAAC,EAAE,CAEd,CACR,CAAC;oBACJ,CAAC,CAAC,EACD,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACjD,KAAC,IAAI,IAAC,QAAQ,kBAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAQ,CAC1F,IACI,EACN,WAAW,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,QAAQ,kBAAE,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,GAAQ,CAAC,CAAC,CAAC,IAAI,IAC5E,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type TuiTone } from './tone.js';
3
+ /**
4
+ * One labelled value of a {@link StatusLine}.
5
+ *
6
+ * @stability experimental
7
+ */
8
+ export interface TuiStatusItem {
9
+ /** What the value is, e.g. `server`. Dim. */
10
+ label: string;
11
+ /** The value. */
12
+ value: string;
13
+ /** The value's colour role. */
14
+ tone?: TuiTone | undefined;
15
+ }
16
+ /**
17
+ * Props of {@link StatusLine}.
18
+ *
19
+ * @stability experimental
20
+ */
21
+ export interface StatusLineProps {
22
+ /** The run's name, bold at the start. */
23
+ title: string;
24
+ /** Labelled values shown after the title. */
25
+ items: readonly TuiStatusItem[];
26
+ /** True once the run has finished; stops the clock and the spinner. */
27
+ done?: boolean | undefined;
28
+ /** The final duration shown when `done`; without it the live clock's last value stays. */
29
+ durationMs?: number | undefined;
30
+ }
31
+ /**
32
+ * A header line: title, labelled values, elapsed time and a running or done mark.
33
+ *
34
+ * Runs its own one-second clock while not `done`, and clears it on unmount.
35
+ * Wraps below the narrow threshold, where the separators are dropped.
36
+ *
37
+ * @param props - The title, items and run state.
38
+ * @returns The line.
39
+ * @stability experimental
40
+ */
41
+ export declare function StatusLine({ title, items, done, durationMs }: StatusLineProps): ReactNode;
42
+ //# sourceMappingURL=status-line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-line.d.ts","sourceRoot":"","sources":["../../../../src/engine/tui/ui/status-line.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAM5D,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,uEAAuE;IACvE,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,0FAA0F;IAC1F,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,eAAe,GAAG,SAAS,CA+CzF"}