@linxiraos/pi-tui 1.4.6 → 1.4.7

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 (278) hide show
  1. package/CHANGELOG.md +194 -195
  2. package/README.md +34 -34
  3. package/dist/types/app-keybindings.d.ts +15 -0
  4. package/dist/types/apps/session-picker.d.ts +5 -0
  5. package/dist/types/charts/chart-plan.d.ts +9 -7
  6. package/dist/types/chat/assistant-message.d.ts +15 -3
  7. package/dist/types/chat/bash-execution.d.ts +2 -0
  8. package/dist/types/chat/display-preferences.d.ts +2 -0
  9. package/dist/types/chat/extension-types.d.ts +31 -0
  10. package/dist/types/chat/reply-write.d.ts +48 -0
  11. package/dist/types/chat/table-chart.d.ts +4 -3
  12. package/dist/types/chat/tool-execution.d.ts +1 -2
  13. package/dist/types/chat/transcript-outline.d.ts +7 -0
  14. package/dist/types/chat/transcript-render-helpers.d.ts +2 -0
  15. package/dist/types/chrome/index.d.ts +1 -0
  16. package/dist/types/chrome/transcript-notice.d.ts +35 -0
  17. package/dist/types/chrome/transcript-status.d.ts +20 -8
  18. package/dist/types/components/editor.d.ts +8 -0
  19. package/dist/types/components/markdown.d.ts +7 -0
  20. package/dist/types/native/blobs.d.ts +2 -1
  21. package/dist/types/native/picker.d.ts +4 -4
  22. package/dist/types/overlays/annotation-overlay.d.ts +7 -1
  23. package/dist/types/overlays/annotation-types.d.ts +28 -0
  24. package/dist/types/overlays/login-dialog.d.ts +5 -1
  25. package/dist/types/overlays/model-browser.d.ts +10 -1
  26. package/dist/types/overlays/oauth-selector.d.ts +23 -0
  27. package/dist/types/overlays/plan-review-overlay.d.ts +2 -0
  28. package/dist/types/overlays/rewind-selector.d.ts +1 -1
  29. package/dist/types/overlays/session-selector.d.ts +22 -2
  30. package/dist/types/prompt/composer.d.ts +43 -0
  31. package/dist/types/prompt/interactive-context-helpers.d.ts +10 -3
  32. package/dist/types/render/extension-links.d.ts +65 -0
  33. package/dist/types/render/hyperlink.d.ts +25 -7
  34. package/dist/types/render/index.d.ts +1 -0
  35. package/dist/types/setup/scenes/glyph.d.ts +1 -1
  36. package/dist/types/setup/scenes/model.d.ts +1 -1
  37. package/dist/types/setup/scenes/outro.d.ts +5 -4
  38. package/dist/types/setup/scenes/sign-in.d.ts +13 -8
  39. package/dist/types/setup/scenes/types.d.ts +16 -1
  40. package/dist/types/setup/startup-splash.d.ts +1 -1
  41. package/dist/types/setup/wizard-overlay.d.ts +11 -7
  42. package/dist/types/setup/wizard.d.ts +5 -1
  43. package/dist/types/status-line/component.d.ts +1 -1
  44. package/dist/types/status-line/context-usage.d.ts +28 -6
  45. package/dist/types/status-line/host.d.ts +6 -2
  46. package/dist/types/theme/theme.d.ts +0 -23
  47. package/dist/types/tools/bash-interactive.d.ts +6 -0
  48. package/dist/types/tools/bash.d.ts +2 -0
  49. package/dist/types/tools/default-renderer.d.ts +6 -4
  50. package/dist/types/tools/irc.d.ts +6 -0
  51. package/dist/types/tools/json-tree.d.ts +23 -4
  52. package/dist/types/tools/lsp.d.ts +2 -0
  53. package/dist/types/tools/mcp.d.ts +6 -5
  54. package/dist/types/tools/native-view.d.ts +1 -1
  55. package/dist/types/tools/renderer.d.ts +2 -0
  56. package/dist/types/tools/streaming-output.d.ts +11 -0
  57. package/dist/types/tools/task.d.ts +9 -1
  58. package/dist/types/tools/url-scheme-host.d.ts +17 -0
  59. package/dist/types/tools/yield.d.ts +1 -1
  60. package/dist/types/tui.d.ts +7 -2
  61. package/package.json +10 -14
  62. package/src/app-keybindings.d.ts +15 -0
  63. package/src/app-keybindings.ts +15 -0
  64. package/src/apps/session-picker.ts +7 -0
  65. package/src/charts/chart-plan.d.ts +9 -7
  66. package/src/charts/chart-plan.ts +20 -50
  67. package/src/chat/advisor-message.ts +2 -0
  68. package/src/chat/assistant-message.d.ts +15 -3
  69. package/src/chat/assistant-message.ts +137 -19
  70. package/src/chat/background-tan-message.ts +4 -0
  71. package/src/chat/bash-execution.d.ts +2 -0
  72. package/src/chat/bash-execution.ts +6 -0
  73. package/src/chat/chat-transcript-builder.ts +58 -28
  74. package/src/chat/compaction-summary-message.ts +2 -1
  75. package/src/chat/display-preferences.d.ts +2 -0
  76. package/src/chat/display-preferences.ts +3 -0
  77. package/src/chat/extension-types.d.ts +31 -0
  78. package/src/chat/extension-types.ts +34 -0
  79. package/src/chat/reply-write.d.ts +48 -0
  80. package/src/chat/reply-write.ts +127 -0
  81. package/src/chat/table-chart.d.ts +4 -3
  82. package/src/chat/table-chart.ts +10 -4
  83. package/src/chat/tool-execution.d.ts +1 -2
  84. package/src/chat/tool-execution.ts +20 -13
  85. package/src/chat/transcript-outline.d.ts +7 -0
  86. package/src/chat/transcript-outline.ts +27 -0
  87. package/src/chat/transcript-render-helpers.d.ts +2 -0
  88. package/src/chat/transcript-render-helpers.ts +66 -24
  89. package/src/chrome/index.ts +1 -0
  90. package/src/chrome/transcript-notice.d.ts +35 -0
  91. package/src/chrome/transcript-notice.ts +83 -0
  92. package/src/chrome/transcript-status.d.ts +20 -8
  93. package/src/chrome/transcript-status.ts +29 -29
  94. package/src/components/editor.d.ts +8 -0
  95. package/src/components/editor.ts +10 -1
  96. package/src/components/markdown.d.ts +7 -0
  97. package/src/components/markdown.ts +116 -6
  98. package/src/hotkeys-markdown.ts +1 -0
  99. package/src/native/backend.ts +5 -66
  100. package/src/native/blobs.d.ts +2 -1
  101. package/src/native/blobs.ts +3 -2
  102. package/src/native/picker.d.ts +4 -4
  103. package/src/native/picker.ts +4 -4
  104. package/src/overlays/advisor-config.ts +1 -10
  105. package/src/overlays/annotation-overlay.ts +125 -37
  106. package/src/overlays/annotation-types.ts +24 -0
  107. package/src/overlays/hook-selector.ts +2 -2
  108. package/src/overlays/login-dialog.ts +31 -5
  109. package/src/overlays/mcp-add-wizard.ts +1 -1
  110. package/src/overlays/model-browser.ts +37 -0
  111. package/src/overlays/model-hub.ts +1 -7
  112. package/src/overlays/model-picker.ts +1 -10
  113. package/src/overlays/oauth-selector.ts +44 -6
  114. package/src/overlays/plan-review-overlay.ts +13 -2
  115. package/src/overlays/rewind-selector.ts +29 -12
  116. package/src/overlays/session-selector.ts +313 -42
  117. package/src/overlays/usage-dashboard.ts +5 -12
  118. package/src/prompt/composer.ts +216 -1
  119. package/src/prompt/custom-editor.ts +6 -1
  120. package/src/prompt/emoji-autocomplete.ts +0 -2
  121. package/src/prompt/interactive-context-helpers.ts +29 -4
  122. package/src/render/extension-links.d.ts +65 -0
  123. package/src/render/extension-links.ts +214 -0
  124. package/src/render/hyperlink.d.ts +25 -7
  125. package/src/render/hyperlink.ts +65 -9
  126. package/src/render/index.d.ts +1 -0
  127. package/src/render/index.ts +1 -0
  128. package/src/setup/scenes/composer.ts +2 -0
  129. package/src/setup/scenes/glyph.ts +3 -1
  130. package/src/setup/scenes/model.ts +192 -29
  131. package/src/setup/scenes/outro.ts +33 -15
  132. package/src/setup/scenes/sign-in.ts +196 -400
  133. package/src/setup/scenes/theme.ts +2 -0
  134. package/src/setup/scenes/types.ts +18 -1
  135. package/src/setup/startup-splash.ts +8 -7
  136. package/src/setup/wizard-overlay.ts +164 -35
  137. package/src/setup/wizard.ts +11 -2
  138. package/src/status-line/component.ts +4 -10
  139. package/src/status-line/context-usage.ts +72 -21
  140. package/src/status-line/host.ts +6 -2
  141. package/src/terminal.ts +24 -2
  142. package/src/theme/defaults.json +1 -0
  143. package/src/theme/loader.ts +1 -1
  144. package/src/theme/theme.d.ts +0 -23
  145. package/src/theme/theme.ts +2 -75
  146. package/src/tools/bash-interactive.d.ts +49 -0
  147. package/src/tools/bash-interactive.ts +6 -1
  148. package/src/tools/bash.d.ts +2 -0
  149. package/src/tools/bash.ts +2 -0
  150. package/src/tools/default-renderer.d.ts +6 -4
  151. package/src/tools/default-renderer.ts +9 -6
  152. package/src/tools/eval.ts +14 -4
  153. package/src/tools/irc.d.ts +6 -0
  154. package/src/tools/irc.ts +6 -0
  155. package/src/tools/job-widget.ts +13 -1
  156. package/src/tools/json-tree.d.ts +23 -4
  157. package/src/tools/json-tree.ts +132 -42
  158. package/src/tools/lsp.d.ts +2 -0
  159. package/src/tools/lsp.ts +36 -15
  160. package/src/tools/mcp.d.ts +6 -5
  161. package/src/tools/mcp.ts +20 -12
  162. package/src/tools/native-view.d.ts +1 -1
  163. package/src/tools/native-view.ts +1 -1
  164. package/src/tools/renderer.d.ts +2 -0
  165. package/src/tools/renderer.ts +2 -0
  166. package/src/tools/streaming-output.d.ts +11 -0
  167. package/src/tools/streaming-output.ts +41 -0
  168. package/src/tools/task.d.ts +9 -1
  169. package/src/tools/task.ts +59 -16
  170. package/src/tools/url-scheme-host.d.ts +17 -0
  171. package/src/tools/url-scheme-host.ts +21 -0
  172. package/src/tools/yield.d.ts +1 -1
  173. package/src/tools/yield.ts +18 -9
  174. package/src/tui.d.ts +7 -2
  175. package/src/tui.ts +43 -15
  176. package/dist/types/theme/defaults/index.d.ts +0 -10289
  177. package/src/theme/defaults/alabaster.json +0 -103
  178. package/src/theme/defaults/amethyst.json +0 -106
  179. package/src/theme/defaults/anthracite.json +0 -103
  180. package/src/theme/defaults/basalt.json +0 -101
  181. package/src/theme/defaults/birch.json +0 -105
  182. package/src/theme/defaults/dark-abyss.json +0 -101
  183. package/src/theme/defaults/dark-arctic.json +0 -114
  184. package/src/theme/defaults/dark-aurora.json +0 -105
  185. package/src/theme/defaults/dark-catppuccin.json +0 -117
  186. package/src/theme/defaults/dark-cavern.json +0 -101
  187. package/src/theme/defaults/dark-celestial.json +0 -116
  188. package/src/theme/defaults/dark-copper.json +0 -105
  189. package/src/theme/defaults/dark-cosmos.json +0 -100
  190. package/src/theme/defaults/dark-cyberpunk.json +0 -112
  191. package/src/theme/defaults/dark-dracula.json +0 -108
  192. package/src/theme/defaults/dark-eclipse.json +0 -101
  193. package/src/theme/defaults/dark-ember.json +0 -105
  194. package/src/theme/defaults/dark-equinox.json +0 -100
  195. package/src/theme/defaults/dark-forest.json +0 -106
  196. package/src/theme/defaults/dark-github.json +0 -115
  197. package/src/theme/defaults/dark-gruvbox.json +0 -122
  198. package/src/theme/defaults/dark-lavender.json +0 -105
  199. package/src/theme/defaults/dark-lunar.json +0 -99
  200. package/src/theme/defaults/dark-midnight.json +0 -105
  201. package/src/theme/defaults/dark-monochrome.json +0 -104
  202. package/src/theme/defaults/dark-monokai.json +0 -108
  203. package/src/theme/defaults/dark-nebula.json +0 -100
  204. package/src/theme/defaults/dark-neon-noir.json +0 -110
  205. package/src/theme/defaults/dark-nord.json +0 -108
  206. package/src/theme/defaults/dark-ocean.json +0 -111
  207. package/src/theme/defaults/dark-one.json +0 -110
  208. package/src/theme/defaults/dark-poimandres.json +0 -125
  209. package/src/theme/defaults/dark-rainforest.json +0 -101
  210. package/src/theme/defaults/dark-reef.json +0 -101
  211. package/src/theme/defaults/dark-retro.json +0 -102
  212. package/src/theme/defaults/dark-rose-pine.json +0 -106
  213. package/src/theme/defaults/dark-sakura.json +0 -105
  214. package/src/theme/defaults/dark-slate.json +0 -105
  215. package/src/theme/defaults/dark-solarized.json +0 -107
  216. package/src/theme/defaults/dark-solstice.json +0 -100
  217. package/src/theme/defaults/dark-starfall.json +0 -101
  218. package/src/theme/defaults/dark-sunset.json +0 -109
  219. package/src/theme/defaults/dark-swamp.json +0 -100
  220. package/src/theme/defaults/dark-synthwave.json +0 -113
  221. package/src/theme/defaults/dark-taiga.json +0 -101
  222. package/src/theme/defaults/dark-terminal.json +0 -105
  223. package/src/theme/defaults/dark-tokyo-night.json +0 -111
  224. package/src/theme/defaults/dark-tundra.json +0 -101
  225. package/src/theme/defaults/dark-twilight.json +0 -101
  226. package/src/theme/defaults/dark-volcanic.json +0 -101
  227. package/src/theme/defaults/graphite.json +0 -102
  228. package/src/theme/defaults/index.d.ts +0 -10289
  229. package/src/theme/defaults/index.ts +0 -203
  230. package/src/theme/defaults/light-arctic.json +0 -117
  231. package/src/theme/defaults/light-aurora-day.json +0 -101
  232. package/src/theme/defaults/light-canyon.json +0 -101
  233. package/src/theme/defaults/light-catppuccin.json +0 -116
  234. package/src/theme/defaults/light-cirrus.json +0 -100
  235. package/src/theme/defaults/light-coral.json +0 -105
  236. package/src/theme/defaults/light-cyberpunk.json +0 -106
  237. package/src/theme/defaults/light-dawn.json +0 -100
  238. package/src/theme/defaults/light-dunes.json +0 -101
  239. package/src/theme/defaults/light-eucalyptus.json +0 -105
  240. package/src/theme/defaults/light-forest.json +0 -110
  241. package/src/theme/defaults/light-frost.json +0 -105
  242. package/src/theme/defaults/light-github.json +0 -125
  243. package/src/theme/defaults/light-glacier.json +0 -101
  244. package/src/theme/defaults/light-gruvbox.json +0 -118
  245. package/src/theme/defaults/light-haze.json +0 -100
  246. package/src/theme/defaults/light-honeycomb.json +0 -105
  247. package/src/theme/defaults/light-lagoon.json +0 -101
  248. package/src/theme/defaults/light-lavender.json +0 -105
  249. package/src/theme/defaults/light-meadow.json +0 -101
  250. package/src/theme/defaults/light-mint.json +0 -105
  251. package/src/theme/defaults/light-monochrome.json +0 -111
  252. package/src/theme/defaults/light-ocean.json +0 -109
  253. package/src/theme/defaults/light-one.json +0 -109
  254. package/src/theme/defaults/light-opal.json +0 -101
  255. package/src/theme/defaults/light-orchard.json +0 -101
  256. package/src/theme/defaults/light-paper.json +0 -105
  257. package/src/theme/defaults/light-poimandres.json +0 -125
  258. package/src/theme/defaults/light-prism.json +0 -100
  259. package/src/theme/defaults/light-retro.json +0 -108
  260. package/src/theme/defaults/light-sand.json +0 -105
  261. package/src/theme/defaults/light-savanna.json +0 -101
  262. package/src/theme/defaults/light-solarized.json +0 -112
  263. package/src/theme/defaults/light-soleil.json +0 -100
  264. package/src/theme/defaults/light-sunset.json +0 -109
  265. package/src/theme/defaults/light-synthwave.json +0 -108
  266. package/src/theme/defaults/light-tokyo-night.json +0 -121
  267. package/src/theme/defaults/light-wetland.json +0 -101
  268. package/src/theme/defaults/light-zenith.json +0 -99
  269. package/src/theme/defaults/limestone.json +0 -104
  270. package/src/theme/defaults/mahogany.json +0 -107
  271. package/src/theme/defaults/marble.json +0 -103
  272. package/src/theme/defaults/obsidian.json +0 -101
  273. package/src/theme/defaults/onyx.json +0 -101
  274. package/src/theme/defaults/pearl.json +0 -103
  275. package/src/theme/defaults/porcelain.json +0 -101
  276. package/src/theme/defaults/quartz.json +0 -106
  277. package/src/theme/defaults/sandstone.json +0 -105
  278. package/src/theme/defaults/titanium.json +0 -100
@@ -5,7 +5,7 @@ import { getCustomThemesDir } from "@linxiraos/pi-utils/dirs";
5
5
  import { isEnoent } from "@linxiraos/pi-utils/fs-error";
6
6
  import { detectColorMode, resolveThemeColors } from "./color";
7
7
  import darkThemeJson from "./dark.json" with { type: "json" };
8
- import { defaultThemes } from "./defaults";
8
+ import defaultThemes from "./defaults.json" with { type: "json" };
9
9
  import lightThemeJson from "./light.json" with { type: "json" };
10
10
  import type { ColorMode, ThemeBg, ThemeColor, ThemeJson } from "./schema";
11
11
  import { normalizeSpinnerFramesOverride, type SymbolPreset } from "./symbols";
@@ -114,29 +114,6 @@ export declare function stopThemeWatcher(): void;
114
114
  * Used by HTML export to generate CSS custom properties.
115
115
  */
116
116
  export declare function getResolvedThemeColors(themeName?: string): Promise<Record<string, string>>;
117
- /** One appearance variant of {@link NativeThemePalette}: token name → `#rrggbb`. */
118
- export type NativeThemeVariant = Record<string, string>;
119
- /** omp's resolved theme for a Tern Surface Protocol terminal (the `t` verb body minus `sf`). */
120
- export interface NativeThemePalette {
121
- dark?: NativeThemeVariant;
122
- light?: NativeThemeVariant;
123
- name: {
124
- dark?: string;
125
- light?: string;
126
- };
127
- }
128
- /**
129
- * Cheap identity of everything {@link getNativeThemePalette} depends on;
130
- * recompute the palette only when it changes.
131
- */
132
- export declare function getNativeThemePaletteKey(): string;
133
- /**
134
- * omp's theme for a native surface: with auto theme, the configured dark and
135
- * light themes; otherwise (or while the theme selector previews one) the
136
- * active theme under its own appearance only. Themes without a loadable
137
- * definition (in-memory instances) contribute nothing.
138
- */
139
- export declare function getNativeThemePalette(): NativeThemePalette;
140
117
  /**
141
118
  * Check if a theme is a "light" theme by analyzing its status-line background
142
119
  * luminance. Loads theme JSON synchronously (built-in or custom file on disk)
@@ -8,16 +8,8 @@ import * as logger from "@linxiraos/pi-utils/logger";
8
8
  import { isTerminalBackgroundQueryTrusted } from "../terminal-multiplexer";
9
9
  import { setActiveSymbolTheme } from "./active-symbols";
10
10
  import { ansi256ToHex, resolveThemeColors, resolveVarRefs } from "./color";
11
- import {
12
- type CreateThemeOptions,
13
- createTheme,
14
- getBuiltinThemes,
15
- loadTheme,
16
- loadThemeJson,
17
- loadThemeJsonSync,
18
- loadThemeSync,
19
- } from "./loader";
20
- import { isValidThemeBg, isValidThemeColor, type ThemeColor, type ThemeJson } from "./schema";
11
+ import { type CreateThemeOptions, getBuiltinThemes, loadTheme, loadThemeJson, loadThemeSync } from "./loader";
12
+ import { type ThemeColor, type ThemeJson } from "./schema";
21
13
  import type { SymbolPreset } from "./symbols";
22
14
  import type { Theme } from "./theme-class";
23
15
 
@@ -843,71 +835,6 @@ export async function getResolvedThemeColors(themeName?: string): Promise<Record
843
835
  return cssColors;
844
836
  }
845
837
 
846
- /** One appearance variant of {@link NativeThemePalette}: token name → `#rrggbb`. */
847
- export type NativeThemeVariant = Record<string, string>;
848
-
849
- /** omp's resolved theme for a Tern Surface Protocol terminal (the `t` verb body minus `sf`). */
850
- export interface NativeThemePalette {
851
- dark?: NativeThemeVariant;
852
- light?: NativeThemeVariant;
853
- name: { dark?: string; light?: string };
854
- }
855
-
856
- /**
857
- * Cheap identity of everything {@link getNativeThemePalette} depends on;
858
- * recompute the palette only when it changes.
859
- */
860
- export function getNativeThemePaletteKey(): string {
861
- return `${themeEpoch}|${autoDetectedTheme}|${autoDarkTheme}|${autoLightTheme}|${currentThemeName}|${previewThemeName}|${currentColorBlindMode}`;
862
- }
863
-
864
- /** Every token of theme `name` as hex (terminal-default tokens omitted), plus its export colours. */
865
- function nativeThemeVariant(name: string): { light: boolean; colors: NativeThemeVariant } {
866
- const themeJson = loadThemeJsonSync(name);
867
- const built = createTheme(themeJson, getCurrentThemeOptions());
868
- const raw = resolveThemeColors(themeJson.colors, themeJson.vars);
869
- const colors: NativeThemeVariant = {};
870
- for (const key in raw) {
871
- // Terminal-default tokens stay unset; keys outside the schema are ignored like the theme does.
872
- if (raw[key as keyof typeof raw] === "") continue;
873
- if (isValidThemeColor(key)) colors[key] = built.getColorHex(key);
874
- else if (isValidThemeBg(key)) colors[key] = built.getBgHex(key);
875
- }
876
- const exported = resolveThemeExportColors(themeJson);
877
- for (const key of ["pageBg", "cardBg", "infoBg"] as const) {
878
- const value = exported[key];
879
- if (value) colors[key] = value;
880
- }
881
- return { light: isLightThemeJson(themeJson), colors };
882
- }
883
-
884
- /**
885
- * omp's theme for a native surface: with auto theme, the configured dark and
886
- * light themes; otherwise (or while the theme selector previews one) the
887
- * active theme under its own appearance only. Themes without a loadable
888
- * definition (in-memory instances) contribute nothing.
889
- */
890
- export function getNativeThemePalette(): NativeThemePalette {
891
- const palette: NativeThemePalette = { name: {} };
892
- const add = (name: string, as?: "dark" | "light"): void => {
893
- try {
894
- const variant = nativeThemeVariant(name);
895
- const slot = as ?? (variant.light ? "light" : "dark");
896
- palette[slot] = variant.colors;
897
- palette.name[slot] = name;
898
- } catch (error) {
899
- logger.debug("Native theme palette: theme not loadable", { name, error: String(error) });
900
- }
901
- };
902
- const single = previewThemeName ?? (autoDetectedTheme ? undefined : currentThemeName);
903
- if (single !== undefined) add(single);
904
- else {
905
- add(autoDarkTheme, "dark");
906
- add(autoLightTheme, "light");
907
- }
908
- return palette;
909
- }
910
-
911
838
  /**
912
839
  * Check if a theme is a "light" theme by analyzing its status-line background
913
840
  * luminance. Loads theme JSON synchronously (built-in or custom file on disk)
@@ -0,0 +1,49 @@
1
+ import type * as XtermModule from "@linxiraos/pi-utils/vterm";
2
+ import type { Component } from "../tui";
3
+ import type { DescribeContext, NativeNode, NativeUiEvent } from "../native/node";
4
+ import type { Theme } from "../theme/theme";
5
+ /** Resize-only backend exposed by an interactive PTY controller. */
6
+ export interface BashInteractiveTerminalBackend {
7
+ resize(columns: number, rows: number): void;
8
+ }
9
+ /**
10
+ * Translates a TUI key event into the bytes a terminal would send to a PTY
11
+ * child; key releases encode to "". Shared by the agent `pty` console and
12
+ * `!` commands (`BashExecutionComponent.encodePtyInput`).
13
+ */
14
+ export declare function normalizeInputForPty(data: string, applicationCursorKeysMode: boolean): string;
15
+ /** Interactive terminal overlay driven by an external PTY controller. */
16
+ export declare class BashInteractiveOverlayComponent implements Component {
17
+ #private;
18
+ /** Native sheet: a full-pane glass overlay titled Console. */
19
+ readonly nativeOverlay: {
20
+ readonly role: "zeta.overlay.console";
21
+ readonly size: "full";
22
+ readonly head: "Console";
23
+ };
24
+ constructor(command: string, uiTheme: Theme, getTerminalRows: () => number, terminalCtor: typeof XtermModule.Terminal, backend: BashInteractiveTerminalBackend);
25
+ /** Connects normalized keyboard input and overlay lifecycle events to the controller. */
26
+ setHandlers(onInput: (data: string) => void, onDismiss: () => void, onDispose: () => void): void;
27
+ /** Queues a raw terminal output chunk for virtual-terminal rendering. */
28
+ appendOutput(chunk: string): void;
29
+ /** Resolves when the virtual terminal has processed all queued output. */
30
+ flushOutput(): Promise<void>;
31
+ /** Records process completion and stops forwarding keyboard input. */
32
+ setComplete(result: {
33
+ exitCode: number | undefined;
34
+ cancelled: boolean;
35
+ timedOut: boolean;
36
+ }): void;
37
+ handleInput(data: string): void;
38
+ /** The Force kill button runs the Esc path. */
39
+ handleNativeEvent(event: NativeUiEvent): void;
40
+ /**
41
+ * Native view: the command with its state badge, the PTY screen as an
42
+ * `ansi` node (SGR kept, fixed to the PTY grid), and a footer with the
43
+ * Force kill action while running.
44
+ */
45
+ describe(cx: DescribeContext): NativeNode;
46
+ render(width: number): readonly string[];
47
+ invalidate(): void;
48
+ dispose(): void;
49
+ }
@@ -25,7 +25,12 @@ const NATIVE_SHEET_INSET_COLS = 8;
25
25
  // Action id of the native Force kill button (mirrors Esc).
26
26
  const KILL_ACTION = "kill";
27
27
 
28
- function normalizeInputForPty(data: string, applicationCursorKeysMode: boolean): string {
28
+ /**
29
+ * Translates a TUI key event into the bytes a terminal would send to a PTY
30
+ * child; key releases encode to "". Shared by the agent `pty` console and
31
+ * `!` commands (`BashExecutionComponent.encodePtyInput`).
32
+ */
33
+ export function normalizeInputForPty(data: string, applicationCursorKeysMode: boolean): string {
29
34
  const kitty = parseKittySequence(data);
30
35
  if (kitty?.eventType === 3) {
31
36
  return "";
@@ -24,6 +24,8 @@ export interface BashToolDetails {
24
24
  exitCode?: number;
25
25
  /** True when the command was killed by its timeout deadline (not a failure). */
26
26
  timedOut?: boolean;
27
+ /** Text the command wrote to `out://`, oldest first; transcripts draw each as a reply after the call. */
28
+ replies?: string[];
27
29
  /** Live ACP update only; completed results refer to released terminals. */
28
30
  terminalId?: string;
29
31
  service?: {
package/src/tools/bash.ts CHANGED
@@ -69,6 +69,8 @@ export interface BashToolDetails {
69
69
  exitCode?: number;
70
70
  /** True when the command was killed by its timeout deadline (not a failure). */
71
71
  timedOut?: boolean;
72
+ /** Text the command wrote to `out://`, oldest first; transcripts draw each as a reply after the call. */
73
+ replies?: string[];
72
74
  /** Live ACP update only; completed results refer to released terminals. */
73
75
  terminalId?: string;
74
76
  service?: {
@@ -22,10 +22,12 @@ export interface DefaultToolRenderInput {
22
22
  export declare function formatDefaultToolExecution(input: DefaultToolRenderInput, contentWidth: number, uiTheme: Theme): string;
23
23
  /**
24
24
  * TSP view of the generic fallback card: the tool label with a one-line args
25
- * summary as the head target; the result as a JSON tree or raw `ansi` output.
26
- * The complete output goes over the wire — the card-level disclosure clamp the
27
- * terminal applies is the only bound, so an expanded card keeps every row. JSON
28
- * the tree's depth, node or scalar caps would cut keeps the raw path instead.
25
+ * summary as the head target; the result as JSON (the host's `json` viewer,
26
+ * else a JSON tree) or raw `ansi` output. The complete output goes over the
27
+ * wire — the card-level disclosure clamp the terminal applies is the only
28
+ * bound, so an expanded card keeps every row. The `json` viewer never cuts;
29
+ * JSON the fallback tree's depth, node or scalar caps would cut keeps the raw
30
+ * path instead.
29
31
  */
30
32
  export declare function describeDefaultToolExecution(input: DefaultToolRenderInput): NativeToolView;
31
33
  /** Render the generic fallback as the state-tinted card used by direct custom tools. */
@@ -9,7 +9,7 @@ import { renderStatusLine, type StatusLineOptions } from "../render/status-line"
9
9
  import { plainToolCard, type ToolCardPhase } from "../render/tool-card";
10
10
  import { clipCollapsed } from "../render/render-utils";
11
11
  import {
12
- describeJsonTree,
12
+ describeJsonValue,
13
13
  formatArgsInline,
14
14
  JSON_TREE_MAX_DEPTH_COLLAPSED,
15
15
  JSON_TREE_MAX_DEPTH_EXPANDED,
@@ -186,10 +186,12 @@ const NATIVE_ARGS_SUMMARY_CHARS = 160;
186
186
 
187
187
  /**
188
188
  * TSP view of the generic fallback card: the tool label with a one-line args
189
- * summary as the head target; the result as a JSON tree or raw `ansi` output.
190
- * The complete output goes over the wire — the card-level disclosure clamp the
191
- * terminal applies is the only bound, so an expanded card keeps every row. JSON
192
- * the tree's depth, node or scalar caps would cut keeps the raw path instead.
189
+ * summary as the head target; the result as JSON (the host's `json` viewer,
190
+ * else a JSON tree) or raw `ansi` output. The complete output goes over the
191
+ * wire — the card-level disclosure clamp the terminal applies is the only
192
+ * bound, so an expanded card keeps every row. The `json` viewer never cuts;
193
+ * JSON the fallback tree's depth, node or scalar caps would cut keeps the raw
194
+ * path instead.
193
195
  */
194
196
  export function describeDefaultToolExecution(input: DefaultToolRenderInput): NativeToolView {
195
197
  const { result } = input;
@@ -212,7 +214,8 @@ export function describeDefaultToolExecution(input: DefaultToolRenderInput): Nat
212
214
  }
213
215
  if (parsed !== undefined) {
214
216
  let truncated = false;
215
- const tree = describeJsonTree(parsed, {
217
+ const tree = describeJsonValue(parsed, {
218
+ native: input.options.json,
216
219
  // A result's own `i` or `__partialJson` keys are data, not call metadata.
217
220
  hiddenRootKeys: [],
218
221
  onTruncated: () => {
package/src/tools/eval.ts CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  JSON_TREE_MAX_LINES_EXPANDED,
32
32
  JSON_TREE_SCALAR_LEN_COLLAPSED,
33
33
  JSON_TREE_SCALAR_LEN_EXPANDED,
34
- describeJsonTree,
34
+ describeJsonValue,
35
35
  renderJsonTreeLines,
36
36
  } from "./json-tree";
37
37
  import { formatStyledTruncationWarning, stripOutputNotice } from "./output-meta";
@@ -820,11 +820,14 @@ function evalTableNode(view: Extract<EvalView, { kind: "table" }>, key: string):
820
820
  /**
821
821
  * One cell's outputs in order: printed text (following its tail, clamped to
822
822
  * the last `previewLines` while folded) with each view in place of its text.
823
+ * A json view is the host's own JSON viewer (`json`), top-level entries
824
+ * listed and containers folded, when it draws the kind; else a JSON tree.
823
825
  */
824
826
  function evalOutputNodes(
825
827
  output: string,
826
828
  views: readonly EvalViewEntry[] | undefined,
827
829
  previewLines: number,
830
+ json: boolean,
828
831
  ): NativeNode[] {
829
832
  if (output.trim().length === 0) return [];
830
833
  return splitEvalOutput(output, views).map((part, i) => {
@@ -837,7 +840,9 @@ function evalOutputNodes(
837
840
  }
838
841
  const view = part.view;
839
842
  if (view.kind === "table") return evalTableNode(view, `table-${i}`);
840
- if (view.kind === "json") return keyed(describeJsonTree(view.value, { hiddenRootKeys: [] }), `json-${i}`);
843
+ if (view.kind === "json") {
844
+ return keyed(describeJsonValue(view.value, { native: json, hiddenRootKeys: [] }), `json-${i}`);
845
+ }
841
846
  return keyed(md(view.text), `markdown-${i}`);
842
847
  });
843
848
  }
@@ -1307,7 +1312,7 @@ export const evalToolRenderer = {
1307
1312
  language,
1308
1313
  code: formatEvalCodeForDisplay(cell.code, language),
1309
1314
  title: cell.title,
1310
- outputs: [...evalOutputNodes(cell.output, cell.views, previewLines)],
1315
+ outputs: [...evalOutputNodes(cell.output, cell.views, previewLines, options.json === true)],
1311
1316
  status: evalStatusSection(cell, expanded),
1312
1317
  foot: state && {
1313
1318
  state,
@@ -1332,7 +1337,12 @@ export const evalToolRenderer = {
1332
1337
  const rawOutput = options.renderContext?.output ?? resultText(result).trimEnd();
1333
1338
  const state: RunState = cancelled ? "cancelled" : isPartial ? "running" : result.isError ? "failed" : "done";
1334
1339
  const last: Omit<EvalCellRun, "language" | "code" | "title"> = {
1335
- outputs: evalOutputNodes(stripOutputNotice(rawOutput, details?.meta).trimEnd(), undefined, previewLines),
1340
+ outputs: evalOutputNodes(
1341
+ stripOutputNotice(rawOutput, details?.meta).trimEnd(),
1342
+ undefined,
1343
+ previewLines,
1344
+ options.json === true,
1345
+ ),
1336
1346
  status: evalStatusSection(details ?? {}, expanded),
1337
1347
  foot: { state, elapsedMs: options.elapsedMs, ...callFacts },
1338
1348
  };
@@ -25,6 +25,12 @@ export interface IrcMessage {
25
25
  * the broadcaster, mostly to say the message was not for it.
26
26
  */
27
27
  broadcast?: boolean;
28
+ /**
29
+ * Interim acknowledgement or progress on something the recipient asked
30
+ * (`agent://<id>?progress`): it neither answers that request nor asks one,
31
+ * so the recipient's `wait` keeps waiting for the actual reply.
32
+ */
33
+ progress?: boolean;
28
34
  }
29
35
  /** Delivery outcome for one peer recipient. */
30
36
  export interface IrcDeliveryReceipt {
package/src/tools/irc.ts CHANGED
@@ -27,6 +27,12 @@ export interface IrcMessage {
27
27
  * the broadcaster, mostly to say the message was not for it.
28
28
  */
29
29
  broadcast?: boolean;
30
+ /**
31
+ * Interim acknowledgement or progress on something the recipient asked
32
+ * (`agent://<id>?progress`): it neither answers that request nor asks one,
33
+ * so the recipient's `wait` keeps waiting for the actual reply.
34
+ */
35
+ progress?: boolean;
30
36
  }
31
37
 
32
38
  /** Delivery outcome for one peer recipient. */
@@ -190,10 +190,22 @@ function headlineGlance(view: JobWidgetView): JobWidgetGlance | undefined {
190
190
  };
191
191
  }
192
192
 
193
+ /** The meter's `140/190` when the headline only restates its numerator (`140`). */
194
+ function meterWhole(headline: JobWidgetGlance, view: JobWidgetView): string | undefined {
195
+ const meter = view.blocks.find((block): block is JobWidgetMeterBlock => block.kind === "meter");
196
+ const whole = meter ? plainLine(meter.text) : "";
197
+ return /^\s*\/\s*\S/.test(whole.slice(headline.text.trim().length)) && whole.startsWith(headline.text.trim())
198
+ ? whole
199
+ : undefined;
200
+ }
201
+
193
202
  /** What one glance at the widget reads: the headline, else the latest figure of its first spark or meter. */
194
203
  export function jobWidgetGlance(view: JobWidgetView): JobWidgetGlance | undefined {
195
204
  const headline = headlineGlance(view);
196
- if (headline) return headline;
205
+ if (headline) {
206
+ const whole = meterWhole(headline, view);
207
+ return whole ? { ...headline, text: whole } : headline;
208
+ }
197
209
  for (const block of view.blocks) {
198
210
  if (block.kind === "spark" && block.values.length > 0 && plainLine(block.last)) {
199
211
  return { text: plainLine(block.last), label: plainLine(block.label) };
@@ -12,6 +12,8 @@ export declare const JSON_TREE_MAX_LINES_EXPANDED = 200;
12
12
  export declare const JSON_TREE_SCALAR_LEN_COLLAPSED = 60;
13
13
  /** Maximum expanded JSON scalar width. */
14
14
  export declare const JSON_TREE_SCALAR_LEN_EXPANDED = 2000;
15
+ /** Characters a container's one-line form may take before a JSON tree lists its entries instead. */
16
+ export declare const JSON_TREE_INLINE_LEN = 60;
15
17
  /** Sanitization, string summary, and budgeting policy for inline JSON. */
16
18
  export interface InlineFormatOptions {
17
19
  sanitizeText?: (text: string) => string;
@@ -46,7 +48,8 @@ export interface JsonTreeRenderOptions {
46
48
  rootConnectors?: "hooked" | "siblings";
47
49
  }
48
50
  /**
49
- * Render a JSON value as bounded tree lines. The positional form remains the
51
+ * Render a JSON value as bounded tree lines, containers that fit
52
+ * {@link JSON_TREE_INLINE_LEN} on one row. The positional form remains the
50
53
  * public tool-renderer contract; the options form exposes sanitization and root
51
54
  * connector policy for specialized adapters such as nested task output.
52
55
  */
@@ -74,8 +77,24 @@ export interface JsonTreeDescribeOptions {
74
77
  onTruncated?: () => void;
75
78
  }
76
79
  /**
77
- * TSP `tree` of a JSON value: containers become expandable nodes labelled with
78
- * their key and size, scalars become `key: value` leaves styled by type.
79
- * Bounded by depth, node count and scalar length; no width math.
80
+ * TSP `tree` of a JSON value: containers that fit {@link JSON_TREE_INLINE_LEN}
81
+ * become `key: [1, "a"]` leaves, larger ones expandable nodes labelled with
82
+ * their key and size, scalars `key: value` leaves styled by type. Bounded by
83
+ * depth, node count and scalar length; no width math.
80
84
  */
81
85
  export declare function describeJsonTree(value: unknown, options?: JsonTreeDescribeOptions): NativeNode;
86
+ /** Options of {@link describeJsonValue}: the `json` node's own, plus the fallback tree's. */
87
+ export interface JsonValueDescribeOptions extends JsonTreeDescribeOptions {
88
+ /** The host draws the `json` kind (`cx.supports("json")`). */
89
+ native?: boolean;
90
+ /** `json` node: container levels expanded below the top-level entries (default 0). */
91
+ open?: number;
92
+ }
93
+ /**
94
+ * A JSON value for a TSP host: the terminal's own `json` viewer when it draws
95
+ * the kind, which folds and previews containers itself and never cuts (so
96
+ * `onTruncated` never fires), else {@link describeJsonTree} with the same
97
+ * options. Root keys the tree would hide are left out of the sent value too;
98
+ * strings are sanitized like the tree's labels.
99
+ */
100
+ export declare function describeJsonValue(value: unknown, options?: JsonValueDescribeOptions): NativeNode;