@simon_he/vue-tui 0.0.8 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/README.md +142 -30
  2. package/dist/TSelect-BwJJbuTt.js +6089 -0
  3. package/dist/TTree-DK_DQBYm.js +6480 -0
  4. package/dist/agent.cjs +39416 -0
  5. package/dist/agent.d.cts +44 -0
  6. package/dist/agent.d.ts +44 -0
  7. package/dist/agent.js +828 -0
  8. package/dist/ansi-palette-CNXqFciC.js +57 -0
  9. package/dist/ansi-styles.d.ts +200 -0
  10. package/dist/block-source-CKUOnkgT.js +1663 -0
  11. package/dist/cli/headless-renderer.d.ts +29 -0
  12. package/dist/cli/input.d.ts +49 -0
  13. package/dist/cli/node-file-writers.d.ts +13 -0
  14. package/dist/cli/node-module.d.ts +2 -0
  15. package/dist/cli/parse-kitty.d.ts +2 -0
  16. package/dist/cli/parse-mouse.d.ts +2 -0
  17. package/dist/cli/parse-utils.d.ts +14 -0
  18. package/dist/cli/parse-xterm.d.ts +2 -0
  19. package/dist/cli/path-provider-types.d.ts +1 -0
  20. package/dist/cli/path-provider.d.ts +4 -0
  21. package/dist/cli/path-suggest-core.d.ts +1 -0
  22. package/dist/cli/path-suggest.d.ts +15 -0
  23. package/dist/cli/recording.d.ts +4 -0
  24. package/dist/cli/stdin-buffer.d.ts +33 -0
  25. package/dist/cli.cjs +11061 -0
  26. package/dist/cli.d.cts +23 -0
  27. package/dist/cli.d.ts +23 -0
  28. package/dist/cli.js +9875 -0
  29. package/dist/core/ansi/capability.d.ts +20 -0
  30. package/dist/core/ansi/colors.d.ts +41 -0
  31. package/dist/core/ansi/sgr.d.ts +7 -0
  32. package/dist/core/ansi/theme.d.ts +6 -0
  33. package/dist/core/ansi-palette.d.ts +14 -0
  34. package/dist/core/buffer/buffer.d.ts +54 -0
  35. package/dist/core/buffer/width.d.ts +4 -0
  36. package/dist/core/debug-logger.d.ts +18 -0
  37. package/dist/core/hyperlink.d.ts +9 -0
  38. package/dist/core/index.d.ts +4 -0
  39. package/dist/core/path-provider-types.d.ts +24 -0
  40. package/dist/core/path-suggest.d.ts +35 -0
  41. package/dist/core/render-plane.d.ts +3 -0
  42. package/dist/core/terminal/create-terminal.d.ts +8 -0
  43. package/dist/core/terminal/emitter.d.ts +7 -0
  44. package/dist/core/types.d.ts +107 -0
  45. package/dist/core.cjs +3153 -0
  46. package/dist/core.d.cts +14 -0
  47. package/dist/core.d.ts +14 -0
  48. package/dist/core.js +424 -0
  49. package/dist/create-terminal-C2oiWFJU.js +1434 -0
  50. package/dist/create-terminal-app.d.ts +36 -0
  51. package/dist/dom-renderer-BqGijQID.js +1173 -0
  52. package/dist/env-Cl8qmNFN.js +19 -0
  53. package/dist/events/index.d.ts +6 -0
  54. package/dist/events/manager/cli-event-manager.d.ts +22 -0
  55. package/dist/events/manager/event-manager.d.ts +30 -0
  56. package/dist/events/manager/selection-suppression.d.ts +3 -0
  57. package/dist/events/manager/types.d.ts +108 -0
  58. package/dist/events/recording.d.ts +44 -0
  59. package/dist/experimental.cjs +4412 -1641
  60. package/dist/experimental.d.cts +42 -0
  61. package/dist/experimental.d.ts +42 -825
  62. package/dist/experimental.js +31 -7392
  63. package/dist/frame-perf-C6Xfg85O.js +24 -0
  64. package/dist/hyperlink-Bn02UXJb.js +419 -0
  65. package/dist/index.cjs +14765 -17582
  66. package/dist/index.d.cts +35 -0
  67. package/dist/index.d.ts +35 -1528
  68. package/dist/index.js +17 -20026
  69. package/dist/linkify-D_gzn9Xq.js +562 -0
  70. package/dist/markdown.cjs +9321 -7623
  71. package/dist/markdown.d.cts +11 -0
  72. package/dist/markdown.d.ts +11 -112
  73. package/dist/markdown.js +36 -1427
  74. package/dist/observability/cli-latency-node.d.ts +3 -0
  75. package/dist/observability/cli-latency-types.d.ts +41 -0
  76. package/dist/observability/cli-latency.d.ts +3 -0
  77. package/dist/observability/frame-perf-store.d.ts +18 -0
  78. package/dist/observability/frame-perf.d.ts +40 -0
  79. package/dist/observability/perf-sink.d.ts +56 -0
  80. package/dist/observability/trace.d.ts +40 -0
  81. package/dist/observability/tui-profiler.d.ts +33 -0
  82. package/dist/observability.cjs +221 -0
  83. package/dist/observability.d.cts +8 -0
  84. package/dist/observability.d.ts +8 -0
  85. package/dist/observability.js +4 -0
  86. package/dist/path-mnSgEpCm.js +81 -0
  87. package/dist/path-suggest-BNqcuE3-.js +274 -0
  88. package/dist/path-suggest-Dk9TRLh5.js +3 -0
  89. package/dist/{path-suggest-DmrmeueH.js → path-suggest-bvR9SY6Q.js} +86 -18
  90. package/dist/renderer/capabilities.d.ts +13 -0
  91. package/dist/renderer/cli/index.d.ts +2 -0
  92. package/dist/renderer/cli/stdout-metrics.d.ts +18 -0
  93. package/dist/renderer/cli/stdout-renderer.d.ts +48 -0
  94. package/dist/renderer/dom/dom-renderer.d.ts +157 -0
  95. package/dist/renderer/dom/index.d.ts +2 -0
  96. package/dist/renderer/index.d.ts +2 -0
  97. package/dist/renderer-dom.cjs +1505 -0
  98. package/dist/renderer-dom.d.cts +4 -0
  99. package/dist/renderer-dom.d.ts +4 -0
  100. package/dist/renderer-dom.js +7 -0
  101. package/dist/runtime/index.d.ts +36 -0
  102. package/dist/runtime/osc52.d.ts +9 -0
  103. package/dist/runtime-rfcZCyJq.js +1197 -0
  104. package/dist/runtime.cjs +1698 -0
  105. package/dist/runtime.d.cts +9 -0
  106. package/dist/runtime.d.ts +9 -0
  107. package/dist/runtime.js +4 -0
  108. package/dist/selection/terminal-selection.d.ts +123 -0
  109. package/dist/sgr-BmzxEjAO.js +304 -0
  110. package/dist/terminal-selection-DBinO6p5.js +330 -0
  111. package/dist/tlog-theme-qPBt5rge.js +9254 -0
  112. package/dist/trace-CjzYeIxN.js +182 -0
  113. package/dist/utils/env.d.ts +3 -0
  114. package/dist/utils/grapheme.d.ts +5 -0
  115. package/dist/utils/newlines.d.ts +1 -0
  116. package/dist/utils/path.d.ts +7 -0
  117. package/dist/utils/url-safety.d.ts +2 -0
  118. package/dist/vue/agent/view-models.d.ts +98 -0
  119. package/dist/vue/components/TAnchor.d.ts +108 -0
  120. package/dist/vue/components/TBox.d.ts +144 -0
  121. package/dist/vue/components/TCommandPalette.d.ts +587 -0
  122. package/dist/vue/components/TDataTable.d.ts +367 -0
  123. package/dist/vue/components/TDebugOverlay.d.ts +43 -0
  124. package/dist/vue/components/TDialog.d.ts +255 -0
  125. package/dist/vue/components/TFeedback.d.ts +635 -0
  126. package/dist/vue/components/TFlow.d.ts +85 -0
  127. package/dist/vue/components/TForm.d.ts +1230 -0
  128. package/dist/vue/components/TInput.d.ts +545 -0
  129. package/dist/vue/components/TInputBox.d.ts +158 -0
  130. package/dist/vue/components/TJsonEditor.d.ts +165 -0
  131. package/dist/vue/components/TLink.d.ts +239 -0
  132. package/dist/vue/components/TLinkifyText.d.ts +141 -0
  133. package/dist/vue/components/TList.d.ts +119 -0
  134. package/dist/vue/components/TLogLinksPanel.d.ts +238 -0
  135. package/dist/vue/components/TLogMinimap.d.ts +263 -0
  136. package/dist/vue/components/TLogScrollbar.d.ts +236 -0
  137. package/dist/vue/components/TLogSearchBar.d.ts +267 -0
  138. package/dist/vue/components/TLogSearchPager.d.ts +162 -0
  139. package/dist/vue/components/TLogSearchResults.d.ts +200 -0
  140. package/dist/vue/components/TLogView.d.ts +536 -0
  141. package/dist/vue/components/TLogVirtualLinksPanel.d.ts +141 -0
  142. package/dist/vue/components/TLogVirtualSearchResults.d.ts +146 -0
  143. package/dist/vue/components/TMarkdownText.d.ts +134 -0
  144. package/dist/vue/components/TMultilineModal.d.ts +62 -0
  145. package/dist/vue/components/TNavigation.d.ts +324 -0
  146. package/dist/vue/components/TOverlay.d.ts +366 -0
  147. package/dist/vue/components/TPanels.d.ts +244 -0
  148. package/dist/vue/components/TPathPicker.d.ts +213 -0
  149. package/dist/vue/components/TRenderLayer.d.ts +16 -0
  150. package/dist/vue/components/TRenderPlane.d.ts +17 -0
  151. package/dist/vue/components/TSelect.d.ts +335 -0
  152. package/dist/vue/components/TTable.d.ts +317 -0
  153. package/dist/vue/components/TText.d.ts +116 -0
  154. package/dist/vue/components/TThinkingView.d.ts +233 -0
  155. package/dist/vue/components/TToolCallView.d.ts +384 -0
  156. package/dist/vue/components/TTranscriptView.d.ts +221 -0
  157. package/dist/vue/components/TTransition.d.ts +83 -0
  158. package/dist/vue/components/TTree.d.ts +200 -0
  159. package/dist/vue/components/TUserMessageView.d.ts +344 -0
  160. package/dist/vue/components/TView.d.ts +127 -0
  161. package/dist/vue/components/TVirtualList.d.ts +182 -0
  162. package/dist/vue/components/TVirtualMarkdown.d.ts +168 -0
  163. package/dist/vue/components/TVirtualRows.d.ts +247 -0
  164. package/dist/vue/components/TerminalProvider.d.ts +218 -0
  165. package/dist/vue/components/input/host.d.ts +17 -0
  166. package/dist/vue/components/input/plugins/hostPlugin.d.ts +7 -0
  167. package/dist/vue/components/input/plugins/hostPlugin.node.d.ts +15 -0
  168. package/dist/vue/components/input/plugins/mentionUtils.d.ts +17 -0
  169. package/dist/vue/components/input/plugins/nodeMentionPathProvider.d.ts +2 -0
  170. package/dist/vue/components/input/plugins/promptMentionPlugin.d.ts +8 -0
  171. package/dist/vue/components/input/plugins/promptMentionState.d.ts +98 -0
  172. package/dist/vue/components/input/plugins/restrictText.d.ts +27 -0
  173. package/dist/vue/components/input/plugins/types.d.ts +90 -0
  174. package/dist/vue/components/input/utils/inlineText.d.ts +57 -0
  175. package/dist/vue/components/input/utils/inlineTextTokens.d.ts +34 -0
  176. package/dist/vue/components/input/utils/primitives.d.ts +3 -0
  177. package/dist/vue/components/input/utils/wordNavigation.d.ts +6 -0
  178. package/dist/vue/components/link/host.d.ts +15 -0
  179. package/dist/vue/components/list/list-geometry.d.ts +16 -0
  180. package/dist/vue/components/list/list-paint.d.ts +1 -0
  181. package/dist/vue/components/list/scroll-state.d.ts +25 -0
  182. package/dist/vue/components/list/selection-state.d.ts +6 -0
  183. package/dist/vue/components/simple-utils.d.ts +5 -0
  184. package/dist/vue/components/terminal-provider/copy-toast.d.ts +6 -0
  185. package/dist/vue/components/terminal-provider/portals.d.ts +17 -0
  186. package/dist/vue/components/terminal-provider/scheduler.d.ts +29 -0
  187. package/dist/vue/components/terminal-provider/selection-config.d.ts +15 -0
  188. package/dist/vue/components/terminal-provider/utils.d.ts +5 -0
  189. package/dist/vue/composables/use-layout.d.ts +2 -0
  190. package/dist/vue/composables/use-render-node.d.ts +19 -0
  191. package/dist/vue/composables/use-render-stack.d.ts +3 -0
  192. package/dist/vue/composables/use-runtime.d.ts +5 -0
  193. package/dist/vue/composables/use-terminal-node.d.ts +14 -0
  194. package/dist/vue/composables/use-terminal.d.ts +2 -0
  195. package/dist/vue/composables/use-visibility.d.ts +12 -0
  196. package/dist/vue/context.d.ts +153 -0
  197. package/dist/vue/index.d.ts +69 -0
  198. package/dist/vue/injection-key.d.ts +2 -0
  199. package/dist/vue/linkify.d.ts +11 -0
  200. package/dist/vue/log/append-only-log-store.d.ts +2 -0
  201. package/dist/vue/log/tlog-keymap.d.ts +28 -0
  202. package/dist/vue/log/tlog-plugins.d.ts +144 -0
  203. package/dist/vue/log/tlog-session.d.ts +81 -0
  204. package/dist/vue/log/tlog-theme.d.ts +68 -0
  205. package/dist/vue/log/types.d.ts +43 -0
  206. package/dist/vue/log/use-tlog-link-controller.d.ts +31 -0
  207. package/dist/vue/log/use-tlog-retained-index.d.ts +26 -0
  208. package/dist/vue/log/use-tlog-search-controller.d.ts +51 -0
  209. package/dist/vue/log/use-tlog-search-results-page.d.ts +31 -0
  210. package/dist/vue/log/use-tlog-virtual-search-results.d.ts +22 -0
  211. package/dist/vue/markdown/ast.d.ts +3 -0
  212. package/dist/vue/markdown/block-source.d.ts +22 -0
  213. package/dist/vue/markdown/document.d.ts +20 -0
  214. package/dist/vue/markdown/layout.d.ts +21 -0
  215. package/dist/vue/markdown/parser.d.ts +11 -0
  216. package/dist/vue/markdown/render.d.ts +10 -0
  217. package/dist/vue/markdown/theme.d.ts +186 -0
  218. package/dist/vue/markdown/types.d.ts +59 -0
  219. package/dist/vue/overlay.d.ts +27 -0
  220. package/dist/vue/render/context.d.ts +3 -0
  221. package/dist/vue/render/render-manager.d.ts +94 -0
  222. package/dist/vue/router/RouterView.d.ts +25 -0
  223. package/dist/vue/router/composables.d.ts +4 -0
  224. package/dist/vue/router/context.d.ts +4 -0
  225. package/dist/vue/router/router.d.ts +7 -0
  226. package/dist/vue/router/types.d.ts +29 -0
  227. package/dist/vue/scheduler/frame-mailbox.d.ts +55 -0
  228. package/dist/vue/scheduler/frame-scheduler.d.ts +51 -0
  229. package/dist/vue/theme.d.ts +48 -0
  230. package/dist/vue/transcript/hit-regions.d.ts +2 -0
  231. package/dist/vue/transcript/layout.d.ts +20 -0
  232. package/dist/vue/transcript/plain-text.d.ts +2 -0
  233. package/dist/vue/transcript/types.d.ts +122 -0
  234. package/dist/vue/utils/frame-task.d.ts +6 -0
  235. package/dist/vue/utils/rect.d.ts +4 -0
  236. package/dist/vue/utils/row-scroll.d.ts +25 -0
  237. package/dist/vue/utils/style-cache.d.ts +3 -0
  238. package/dist/vue/utils/text.d.ts +27 -0
  239. package/dist/vue/utils/wheel-scroll.d.ts +18 -0
  240. package/dist/vue.cjs +23668 -0
  241. package/dist/vue.d.cts +1 -0
  242. package/dist/vue.d.ts +1 -0
  243. package/dist/vue.js +3957 -0
  244. package/dist/{wheel-scroll-CiNsasLf.js → wheel-scroll-vBRaQ7p-.js} +404 -405
  245. package/package.json +185 -35
  246. package/dist/path-suggest-BeV6n7m-.js +0 -3
  247. package/dist/sgr-Tko2EQ0U.js +0 -484
  248. package/dist/theme-Bsm65g8k.d.ts +0 -32
  249. package/dist/types-ClIV2h1o.d.ts +0 -103
package/dist/agent.js ADDED
@@ -0,0 +1,828 @@
1
+ import "./create-terminal-C2oiWFJU.js";
2
+ import "./hyperlink-Bn02UXJb.js";
3
+ import "./sgr-BmzxEjAO.js";
4
+ import { forEachTextCellSegment, sanitizeInlineText, sanitizeTextBlock, sliceByCells, spaces, textCellWidth$1 as textCellWidth, useTerminal, withTextWidthProvider } from "./wheel-scroll-vBRaQ7p-.js";
5
+ import { TView } from "./linkify-D_gzn9Xq.js";
6
+ import "./terminal-selection-DBinO6p5.js";
7
+ import { TBox, TCommandPalette, TDialog, TInput, TRenderPlane, TSelect, TText, computeCommandPaletteMatchRanges } from "./TSelect-BwJJbuTt.js";
8
+ import "./frame-perf-C6Xfg85O.js";
9
+ import "./path-mnSgEpCm.js";
10
+ import { TVirtualMarkdown, createMarkdownBlockSource } from "./block-source-CKUOnkgT.js";
11
+ import { TLogLinksPanel, TLogMinimap, TLogScrollbar, TLogSearchBar, TLogSearchPager, TLogSearchResults, TLogView, TLogVirtualLinksPanel, TLogVirtualSearchResults, TTranscriptView, TVirtualList, createAppendOnlyLogStore, createTLogDensityBucketsFromMarkers, createTLogLevelPlugin, createTLogLineMatcherPlugin, createTLogLinkActionPlugin, createTLogOsc8LinkPlugin, createTLogUrlPlugin, detectTLogUrls, dispatchTLogPluginLinkAction, getTLogPluginMetadata, parseTLogAnnotatedText, resolveTLogLinksPanelTheme, resolveTLogMinimapTheme, resolveTLogScrollbarTheme, resolveTLogSearchBarTheme, resolveTLogSearchPagerTheme, resolveTLogSearchResultsTheme, resolveTLogViewTheme, stripTLogAnsiText, tlogDarkPreset, tlogDarkTheme, tlogDefaultPreset, tlogDefaultTheme, tlogHighContrastPreset, tlogHighContrastTheme, toTLogExternalLinkFromVisibleLink, useTLogLinkController, useTLogRetainedIndex, useTLogSearchController, useTLogSearchResultsPage, useTLogVirtualSearchResults } from "./tlog-theme-qPBt5rge.js";
12
+ import { computed, defineComponent, h } from "vue";
13
+
14
+ //#region src/vue/agent/view-models.ts
15
+ function resolveTUserMessageViewModel(opts) {
16
+ const indent = Math.max(0, Math.floor(opts.indent ?? 0));
17
+ const prefix = sanitizeInlineText(opts.prefix ?? "> ");
18
+ const label = sanitizeInlineText(opts.label);
19
+ const meta = sanitizeInlineText(opts.meta ?? "");
20
+ const headerText = `${prefix}${label}${meta ? ` ${meta}` : ""}`;
21
+ const base = opts.style ?? {};
22
+ const header = {
23
+ ...base,
24
+ ...opts.headerStyle
25
+ };
26
+ const rows = buildUserRows(sanitizeTextBlock(opts.content), Math.max(1, Math.floor(opts.w) - indent), opts.segments ?? []);
27
+ return {
28
+ indent,
29
+ headerText,
30
+ header,
31
+ content: {
32
+ ...base,
33
+ ...opts.contentStyle
34
+ },
35
+ segment: {
36
+ ...base,
37
+ ...opts.segmentStyle
38
+ },
39
+ headerSegments: [{
40
+ start: 0,
41
+ end: prefix.length,
42
+ text: prefix,
43
+ style: {
44
+ ...header,
45
+ ...opts.prefixStyle
46
+ }
47
+ }, {
48
+ start: prefix.length,
49
+ end: prefix.length + label.length,
50
+ text: label,
51
+ style: {
52
+ ...header,
53
+ ...opts.labelStyle
54
+ }
55
+ }],
56
+ rows
57
+ };
58
+ }
59
+ function buildUserRows(content, width, segments) {
60
+ const rows = [];
61
+ let lineStart = 0;
62
+ for (const rawLine of content.split("\n")) {
63
+ if (!rawLine) {
64
+ rows.push({
65
+ text: "",
66
+ start: lineStart,
67
+ end: lineStart,
68
+ segments: []
69
+ });
70
+ lineStart += 1;
71
+ continue;
72
+ }
73
+ let rowStart = lineStart;
74
+ let rowText = "";
75
+ let rowCells = 0;
76
+ forEachTextCellSegment(rawLine, (segment) => {
77
+ if (rowText && rowCells + segment.cells > width) {
78
+ const rowEnd$1 = lineStart + segment.start;
79
+ rows.push({
80
+ text: rowText,
81
+ start: rowStart,
82
+ end: rowEnd$1,
83
+ segments: clipUserSegments(segments, rowStart, rowEnd$1)
84
+ });
85
+ rowStart = rowEnd$1;
86
+ rowText = "";
87
+ rowCells = 0;
88
+ }
89
+ rowText += segment.text;
90
+ rowCells += segment.cells;
91
+ });
92
+ const rowEnd = rowStart + rowText.length;
93
+ rows.push({
94
+ text: rowText,
95
+ start: rowStart,
96
+ end: rowEnd,
97
+ segments: clipUserSegments(segments, rowStart, rowEnd)
98
+ });
99
+ lineStart += rawLine.length + 1;
100
+ }
101
+ return rows;
102
+ }
103
+ function clipUserSegments(segments, start, end) {
104
+ return segments.filter((segment) => segment.end > start && segment.start < end).map((segment) => ({
105
+ ...segment,
106
+ start: Math.max(segment.start, start),
107
+ end: Math.min(segment.end, end)
108
+ }));
109
+ }
110
+ function resolveTThinkingViewModel(opts) {
111
+ const marker = opts.collapsed ? "▸" : "▾";
112
+ const title = pulseTitle(sanitizeInlineText(opts.title), opts.pulseFrame ?? null);
113
+ const headerText = sliceByCells(`${marker} ${title}`, Math.max(1, Math.floor(opts.w)));
114
+ return {
115
+ headerText,
116
+ bodyRows: opts.collapsed ? [] : sanitizeTextBlock(opts.content).split("\n"),
117
+ styles: {
118
+ header: {
119
+ ...opts.style,
120
+ ...opts.headerStyle,
121
+ ...opts.markerStyle,
122
+ ...opts.titleStyle
123
+ },
124
+ body: {
125
+ ...opts.style,
126
+ ...opts.bodyStyle
127
+ }
128
+ }
129
+ };
130
+ }
131
+ function pulseTitle(title, frame) {
132
+ if (frame == null || title.length === 0) return title;
133
+ const index = Math.abs(Math.floor(frame)) % title.length;
134
+ return `${title.slice(0, index)}${title[index].toUpperCase()}${title.slice(index + 1)}`;
135
+ }
136
+ function resolveTToolCallViewModel(opts) {
137
+ const width = Math.max(0, Math.floor(opts.w));
138
+ const base = opts.style ?? {
139
+ fg: "yellowBright",
140
+ bg: "black"
141
+ };
142
+ const muted = opts.mutedStyle ?? {
143
+ fg: "white",
144
+ bg: base.bg,
145
+ dim: true
146
+ };
147
+ const status = opts.status ?? "pending";
148
+ const collapsed = Boolean(opts.collapsed);
149
+ const header = collapsed ? mergeStyle(base, { dim: true }, opts.collapsedStyle, opts.headerStyle) : mergeStyle(base, opts.selected ? { bold: true } : void 0, opts.expandedStyle, opts.headerStyle);
150
+ const markerStyle = opts.markerStyle ? mergeStyle(header, opts.markerStyle) : header;
151
+ const statusStyle = mergeStyle(resolveStatusStyle(status, base, muted), opts.statusStyle);
152
+ const titleStyle = mergeStyle(base, { dim: false }, opts.selected ? { bold: true } : void 0, opts.titleStyle);
153
+ const suffixStyle = mergeStyle(base, muted, opts.suffixStyle);
154
+ const previewStyle = mergeStyle(base, { dim: true }, opts.previewStyle);
155
+ const styles = {
156
+ base,
157
+ header,
158
+ marker: markerStyle,
159
+ status: statusStyle,
160
+ title: titleStyle,
161
+ suffix: suffixStyle,
162
+ preview: previewStyle
163
+ };
164
+ const segments = [];
165
+ let x = 0;
166
+ const nestedLead = opts.nested ? " " : "";
167
+ const marker = collapsed ? opts.markerCollapsed ?? "▸" : opts.markerExpanded ?? "▾";
168
+ x = pushToolSegment(segments, "marker", x, `${nestedLead}${marker} `, markerStyle);
169
+ const statusDot = opts.statusDot ?? "●";
170
+ if (statusDot) {
171
+ x = pushToolSegment(segments, "status", x, statusDot, statusStyle);
172
+ x = pushToolSegment(segments, "separator", x, " ", header);
173
+ }
174
+ x = pushToolSegment(segments, "title", x, fitText(opts.title, Math.max(0, width - x)), titleStyle);
175
+ if (collapsed) pushToolSegment(segments, "suffix", x, fitSuffix(opts.suffix ?? "", Math.max(0, width - x)), suffixStyle);
176
+ const previewPrefix = `${nestedLead}${opts.previewPrefix ?? " ⎿ "}`;
177
+ const previewText = collapsed && opts.preview ? fitText(opts.preview, Math.max(0, width - textCellWidth(previewPrefix))) : "";
178
+ const previewSegments = [];
179
+ if (previewText) {
180
+ let previewX = 0;
181
+ previewX = pushToolSegment(previewSegments, "preview-prefix", previewX, previewPrefix, previewStyle);
182
+ pushToolSegment(previewSegments, "preview", previewX, previewText, previewStyle);
183
+ }
184
+ return {
185
+ styles,
186
+ marker,
187
+ suffix: segments.find((segment) => segment.role === "suffix")?.text ?? "",
188
+ preview: previewText,
189
+ previewPrefix,
190
+ headerSegments: segments,
191
+ previewSegments
192
+ };
193
+ }
194
+ function mergeStyle(base, ...overrides) {
195
+ let out = base;
196
+ for (const next of overrides) if (next) out = {
197
+ ...out,
198
+ ...next
199
+ };
200
+ return out;
201
+ }
202
+ function fitText(text, width) {
203
+ const safe = sanitizeInlineText(text);
204
+ if (width <= 0) return "";
205
+ if (textCellWidth(safe) <= width) return safe;
206
+ const marker = "…";
207
+ const markerCells = textCellWidth(marker);
208
+ if (width <= markerCells) return sliceByCells(safe, width);
209
+ return `${sliceByCells(safe, width - markerCells)}${marker}`;
210
+ }
211
+ function fitSuffix(text, width) {
212
+ const safe = sanitizeInlineText(text);
213
+ if (!safe || width <= 0) return "";
214
+ const suffix = safe.startsWith(" ") ? safe : ` ${safe}`;
215
+ if (textCellWidth(suffix) <= width) return suffix;
216
+ const prefix = " ";
217
+ const marker = "…";
218
+ const bodyWidth = width - textCellWidth(prefix) - textCellWidth(marker);
219
+ if (bodyWidth <= 0) return "";
220
+ return `${prefix}${sliceByCells(suffix.trimStart(), bodyWidth)}${marker}`;
221
+ }
222
+ function resolveStatusStyle(status, base, muted) {
223
+ if (status === "success") return mergeStyle(base, {
224
+ fg: "greenBright",
225
+ bold: true
226
+ });
227
+ if (status === "error") return mergeStyle(base, {
228
+ fg: "redBright",
229
+ bold: true
230
+ });
231
+ if (status === "warning") return mergeStyle(base, {
232
+ fg: "yellowBright",
233
+ bold: true
234
+ });
235
+ return mergeStyle(base, muted);
236
+ }
237
+ function pushToolSegment(out, role, x, text, style) {
238
+ if (!text) return x;
239
+ const cells = textCellWidth(text);
240
+ out.push({
241
+ role,
242
+ x,
243
+ text,
244
+ cells,
245
+ style
246
+ });
247
+ return x + cells;
248
+ }
249
+
250
+ //#endregion
251
+ //#region src/vue/components/TThinkingView.ts
252
+ const DEFAULT_HEADER_STYLE$1 = {
253
+ fg: "magentaBright",
254
+ bg: "black",
255
+ bold: true
256
+ };
257
+ const DEFAULT_BODY_STYLE = {
258
+ fg: "white",
259
+ bg: "black",
260
+ dim: true
261
+ };
262
+ const TThinkingView = defineComponent({
263
+ name: "TThinkingView",
264
+ props: {
265
+ x: {
266
+ type: Number,
267
+ required: true
268
+ },
269
+ y: {
270
+ type: Number,
271
+ required: true
272
+ },
273
+ w: {
274
+ type: Number,
275
+ required: true
276
+ },
277
+ h: {
278
+ type: Number,
279
+ default: void 0
280
+ },
281
+ zIndex: {
282
+ type: Number,
283
+ default: 0
284
+ },
285
+ title: {
286
+ type: String,
287
+ default: "Thinking"
288
+ },
289
+ content: {
290
+ type: String,
291
+ default: ""
292
+ },
293
+ collapsed: {
294
+ type: Boolean,
295
+ default: false
296
+ },
297
+ pulseFrame: {
298
+ type: Number,
299
+ default: null
300
+ },
301
+ style: {
302
+ type: Object,
303
+ default: void 0
304
+ },
305
+ headerStyle: {
306
+ type: Object,
307
+ default: () => DEFAULT_HEADER_STYLE$1
308
+ },
309
+ markerStyle: {
310
+ type: Object,
311
+ default: void 0
312
+ },
313
+ titleStyle: {
314
+ type: Object,
315
+ default: void 0
316
+ },
317
+ bodyStyle: {
318
+ type: Object,
319
+ default: () => DEFAULT_BODY_STYLE
320
+ },
321
+ focusable: {
322
+ type: Boolean,
323
+ default: false
324
+ },
325
+ selectable: {
326
+ type: Boolean,
327
+ default: void 0
328
+ }
329
+ },
330
+ emits: ["click", "toggle"],
331
+ setup(props, { emit }) {
332
+ const { widthProvider } = useTerminal();
333
+ const withWidthProvider = (fn) => withTextWidthProvider(widthProvider, fn);
334
+ const model = computed(() => withWidthProvider(() => resolveTThinkingViewModel({
335
+ w: props.w,
336
+ title: props.title,
337
+ content: props.content,
338
+ collapsed: props.collapsed,
339
+ pulseFrame: props.pulseFrame,
340
+ style: props.style,
341
+ headerStyle: props.headerStyle,
342
+ markerStyle: props.markerStyle,
343
+ titleStyle: props.titleStyle,
344
+ bodyStyle: props.bodyStyle
345
+ })));
346
+ return () => {
347
+ const state = model.value;
348
+ const height = Math.max(1, Math.floor(props.h ?? 1 + state.bodyRows.length));
349
+ const children = [h(TText, {
350
+ key: "header",
351
+ x: 0,
352
+ y: 0,
353
+ w: props.w,
354
+ value: state.headerText,
355
+ style: state.styles.header
356
+ })];
357
+ for (let index = 0; index < state.bodyRows.length; index++) {
358
+ const y = index + 1;
359
+ if (y >= height) break;
360
+ children.push(h(TText, {
361
+ key: `body:${index}`,
362
+ x: 0,
363
+ y,
364
+ w: props.w,
365
+ value: state.bodyRows[index],
366
+ style: state.styles.body
367
+ }));
368
+ }
369
+ return h(TView, {
370
+ x: props.x,
371
+ y: props.y,
372
+ w: props.w,
373
+ h: height,
374
+ zIndex: props.zIndex,
375
+ focusable: props.focusable,
376
+ selectable: props.selectable,
377
+ onClick: (event) => {
378
+ emit("click", event);
379
+ emit("toggle", { collapsed: !props.collapsed });
380
+ }
381
+ }, () => children);
382
+ };
383
+ }
384
+ });
385
+
386
+ //#endregion
387
+ //#region src/vue/components/TToolCallView.ts
388
+ function renderSegments(segments, y, width) {
389
+ return segments.map((segment, index) => {
390
+ const available = Math.max(0, width - segment.x);
391
+ const w = Math.min(segment.cells, available);
392
+ if (w <= 0) return null;
393
+ return h(TText, {
394
+ key: `${segment.role}:${index}`,
395
+ x: segment.x,
396
+ y,
397
+ w,
398
+ value: sliceByCells(segment.text, w),
399
+ style: segment.style,
400
+ clear: false
401
+ });
402
+ });
403
+ }
404
+ const TToolCallView = defineComponent({
405
+ name: "TToolCallView",
406
+ props: {
407
+ x: {
408
+ type: Number,
409
+ required: true
410
+ },
411
+ y: {
412
+ type: Number,
413
+ required: true
414
+ },
415
+ w: {
416
+ type: Number,
417
+ required: true
418
+ },
419
+ h: {
420
+ type: Number,
421
+ default: void 0
422
+ },
423
+ zIndex: {
424
+ type: Number,
425
+ default: 0
426
+ },
427
+ title: {
428
+ type: String,
429
+ required: true
430
+ },
431
+ collapsed: {
432
+ type: Boolean,
433
+ default: false
434
+ },
435
+ status: {
436
+ type: String,
437
+ default: "pending"
438
+ },
439
+ suffix: {
440
+ type: String,
441
+ default: ""
442
+ },
443
+ preview: {
444
+ type: String,
445
+ default: ""
446
+ },
447
+ nested: {
448
+ type: Boolean,
449
+ default: false
450
+ },
451
+ selected: {
452
+ type: Boolean,
453
+ default: false
454
+ },
455
+ markerCollapsed: {
456
+ type: String,
457
+ default: "▸"
458
+ },
459
+ markerExpanded: {
460
+ type: String,
461
+ default: "▾"
462
+ },
463
+ statusDot: {
464
+ type: String,
465
+ default: "●"
466
+ },
467
+ previewPrefix: {
468
+ type: String,
469
+ default: " ⎿ "
470
+ },
471
+ style: {
472
+ type: Object,
473
+ default: void 0
474
+ },
475
+ mutedStyle: {
476
+ type: Object,
477
+ default: void 0
478
+ },
479
+ headerStyle: {
480
+ type: Object,
481
+ default: void 0
482
+ },
483
+ collapsedStyle: {
484
+ type: Object,
485
+ default: void 0
486
+ },
487
+ expandedStyle: {
488
+ type: Object,
489
+ default: void 0
490
+ },
491
+ markerStyle: {
492
+ type: Object,
493
+ default: void 0
494
+ },
495
+ statusStyle: {
496
+ type: Object,
497
+ default: void 0
498
+ },
499
+ titleStyle: {
500
+ type: Object,
501
+ default: void 0
502
+ },
503
+ suffixStyle: {
504
+ type: Object,
505
+ default: void 0
506
+ },
507
+ previewStyle: {
508
+ type: Object,
509
+ default: void 0
510
+ },
511
+ focusable: {
512
+ type: Boolean,
513
+ default: false
514
+ },
515
+ selectable: {
516
+ type: Boolean,
517
+ default: void 0
518
+ }
519
+ },
520
+ emits: ["click", "toggle"],
521
+ setup(props, { emit, slots }) {
522
+ const { widthProvider } = useTerminal();
523
+ const withWidthProvider = (fn) => withTextWidthProvider(widthProvider, fn);
524
+ const model = computed(() => withWidthProvider(() => resolveTToolCallViewModel({
525
+ w: props.w,
526
+ title: props.title,
527
+ collapsed: props.collapsed,
528
+ selected: props.selected,
529
+ nested: props.nested,
530
+ status: props.status,
531
+ suffix: props.suffix,
532
+ preview: props.preview,
533
+ markerCollapsed: props.markerCollapsed,
534
+ markerExpanded: props.markerExpanded,
535
+ statusDot: props.statusDot,
536
+ previewPrefix: props.previewPrefix,
537
+ style: props.style,
538
+ mutedStyle: props.mutedStyle,
539
+ headerStyle: props.headerStyle,
540
+ collapsedStyle: props.collapsedStyle,
541
+ expandedStyle: props.expandedStyle,
542
+ markerStyle: props.markerStyle,
543
+ statusStyle: props.statusStyle,
544
+ titleStyle: props.titleStyle,
545
+ suffixStyle: props.suffixStyle,
546
+ previewStyle: props.previewStyle
547
+ })));
548
+ return () => {
549
+ const state = model.value;
550
+ const height = Math.max(1, Math.floor(props.h ?? (state.preview ? 2 : 1)));
551
+ const headerSlotProps = {
552
+ x: 0,
553
+ y: 0,
554
+ w: props.w,
555
+ collapsed: props.collapsed,
556
+ nested: props.nested,
557
+ selected: props.selected,
558
+ status: props.status,
559
+ marker: state.marker,
560
+ statusDot: props.statusDot,
561
+ title: props.title,
562
+ suffix: state.suffix,
563
+ preview: state.preview,
564
+ previewPrefix: state.previewPrefix,
565
+ segments: state.headerSegments,
566
+ styles: state.styles
567
+ };
568
+ const previewSlotProps = {
569
+ ...headerSlotProps,
570
+ y: 1,
571
+ segments: state.previewSegments
572
+ };
573
+ const children = [h(TText, {
574
+ key: "header-bg",
575
+ x: 0,
576
+ y: 0,
577
+ w: props.w,
578
+ h: 1,
579
+ value: "",
580
+ style: state.styles.header
581
+ }), ...slots.header ? slots.header(headerSlotProps) : withWidthProvider(() => renderSegments(state.headerSegments, 0, props.w))];
582
+ if (state.preview && height > 1) children.push(h(TText, {
583
+ key: "preview-bg",
584
+ x: 0,
585
+ y: 1,
586
+ w: props.w,
587
+ h: 1,
588
+ value: "",
589
+ style: state.styles.preview
590
+ }), ...slots.preview ? slots.preview(previewSlotProps) : withWidthProvider(() => renderSegments(state.previewSegments, 1, props.w)));
591
+ return h(TView, {
592
+ x: props.x,
593
+ y: props.y,
594
+ w: props.w,
595
+ h: height,
596
+ zIndex: props.zIndex,
597
+ focusable: props.focusable,
598
+ selectable: props.selectable,
599
+ onClick: (event) => {
600
+ emit("click", event);
601
+ emit("toggle", { collapsed: !props.collapsed });
602
+ }
603
+ }, () => children);
604
+ };
605
+ }
606
+ });
607
+
608
+ //#endregion
609
+ //#region src/vue/components/TUserMessageView.ts
610
+ const DEFAULT_BLOCK_STYLE = {
611
+ fg: "whiteBright",
612
+ bg: "blackBright"
613
+ };
614
+ const DEFAULT_HEADER_STYLE = {
615
+ fg: "white",
616
+ bg: "blackBright",
617
+ dim: true
618
+ };
619
+ const DEFAULT_LABEL_STYLE = {
620
+ fg: "greenBright",
621
+ bg: "blackBright",
622
+ bold: true
623
+ };
624
+ const DEFAULT_SEGMENT_STYLE = {
625
+ fg: "cyanBright",
626
+ bg: "blackBright",
627
+ underline: true
628
+ };
629
+ function styledText(key, x, y, w, value, style) {
630
+ if (w <= 0) return null;
631
+ return h(TText, {
632
+ key,
633
+ x,
634
+ y,
635
+ w,
636
+ value,
637
+ style,
638
+ clear: false
639
+ });
640
+ }
641
+ const TUserMessageView = defineComponent({
642
+ name: "TUserMessageView",
643
+ props: {
644
+ x: {
645
+ type: Number,
646
+ required: true
647
+ },
648
+ y: {
649
+ type: Number,
650
+ required: true
651
+ },
652
+ w: {
653
+ type: Number,
654
+ required: true
655
+ },
656
+ h: {
657
+ type: Number,
658
+ default: void 0
659
+ },
660
+ zIndex: {
661
+ type: Number,
662
+ default: 0
663
+ },
664
+ label: {
665
+ type: String,
666
+ default: "user"
667
+ },
668
+ prefix: {
669
+ type: String,
670
+ default: "> "
671
+ },
672
+ meta: {
673
+ type: String,
674
+ default: ""
675
+ },
676
+ content: {
677
+ type: String,
678
+ required: true
679
+ },
680
+ indent: {
681
+ type: Number,
682
+ default: 2
683
+ },
684
+ topBlank: {
685
+ type: Boolean,
686
+ default: true
687
+ },
688
+ bottomBlank: {
689
+ type: Boolean,
690
+ default: true
691
+ },
692
+ segments: {
693
+ type: Array,
694
+ default: () => []
695
+ },
696
+ style: {
697
+ type: Object,
698
+ default: () => DEFAULT_BLOCK_STYLE
699
+ },
700
+ headerStyle: {
701
+ type: Object,
702
+ default: () => DEFAULT_HEADER_STYLE
703
+ },
704
+ prefixStyle: {
705
+ type: Object,
706
+ default: () => DEFAULT_LABEL_STYLE
707
+ },
708
+ labelStyle: {
709
+ type: Object,
710
+ default: () => DEFAULT_LABEL_STYLE
711
+ },
712
+ contentStyle: {
713
+ type: Object,
714
+ default: void 0
715
+ },
716
+ segmentStyle: {
717
+ type: Object,
718
+ default: () => DEFAULT_SEGMENT_STYLE
719
+ },
720
+ focusable: {
721
+ type: Boolean,
722
+ default: false
723
+ },
724
+ selectable: {
725
+ type: Boolean,
726
+ default: void 0
727
+ }
728
+ },
729
+ setup(props) {
730
+ const { widthProvider } = useTerminal();
731
+ const withWidthProvider = (fn) => withTextWidthProvider(widthProvider, fn);
732
+ const model = computed(() => withWidthProvider(() => resolveTUserMessageViewModel({
733
+ w: props.w,
734
+ label: props.label,
735
+ prefix: props.prefix,
736
+ meta: props.meta,
737
+ content: props.content,
738
+ indent: props.indent,
739
+ topBlank: props.topBlank,
740
+ bottomBlank: props.bottomBlank,
741
+ segments: props.segments,
742
+ style: props.style,
743
+ headerStyle: props.headerStyle,
744
+ prefixStyle: props.prefixStyle,
745
+ labelStyle: props.labelStyle,
746
+ contentStyle: props.contentStyle,
747
+ segmentStyle: props.segmentStyle
748
+ })));
749
+ return () => {
750
+ const state = model.value;
751
+ const topRows = props.topBlank ? 1 : 0;
752
+ const naturalHeight = topRows + 1 + state.rows.length + (props.bottomBlank ? 1 : 0);
753
+ const height = Math.max(1, Math.floor(props.h ?? naturalHeight));
754
+ const children = [];
755
+ for (let y = 0; y < height; y++) children.push(h(TText, {
756
+ key: `bg:${y}`,
757
+ x: 0,
758
+ y,
759
+ w: props.w,
760
+ value: "",
761
+ style: state.content
762
+ }));
763
+ withWidthProvider(() => {
764
+ const indent = Math.min(state.indent, props.w);
765
+ const headerY = topRows;
766
+ if (headerY < height) {
767
+ const headerText = `${spaces(indent)}${state.headerText}`;
768
+ children.push(h(TText, {
769
+ key: "header",
770
+ x: 0,
771
+ y: headerY,
772
+ w: props.w,
773
+ value: headerText,
774
+ style: state.header,
775
+ clear: false
776
+ }));
777
+ for (let index = 0; index < state.headerSegments.length; index++) {
778
+ const segment = state.headerSegments[index];
779
+ const x = indent + textCellWidth(state.headerText.slice(0, segment.start));
780
+ const width = Math.min(textCellWidth(segment.text), Math.max(0, props.w - x));
781
+ children.push(styledText(`header:${index}`, x, headerY, width, segment.text, segment.style));
782
+ }
783
+ }
784
+ const contentStartY = headerY + 1;
785
+ for (let rowIndex = 0; rowIndex < state.rows.length; rowIndex++) {
786
+ const y = contentStartY + rowIndex;
787
+ if (y >= height) break;
788
+ const row = state.rows[rowIndex];
789
+ children.push(h(TText, {
790
+ key: `row:${rowIndex}`,
791
+ x: 0,
792
+ y,
793
+ w: props.w,
794
+ value: `${spaces(indent)}${row.text}`,
795
+ style: state.content,
796
+ clear: false
797
+ }));
798
+ for (let segmentIndex = 0; segmentIndex < row.segments.length; segmentIndex++) {
799
+ const segment = row.segments[segmentIndex];
800
+ const localStart = Math.max(0, segment.start - row.start);
801
+ const localEnd = Math.max(localStart, segment.end - row.start);
802
+ const text = row.text.slice(localStart, localEnd);
803
+ if (!text) continue;
804
+ const x = indent + textCellWidth(row.text.slice(0, localStart));
805
+ const width = Math.min(textCellWidth(text), Math.max(0, props.w - x));
806
+ children.push(styledText(`row:${rowIndex}:segment:${segmentIndex}`, x, y, width, text, {
807
+ ...state.segment,
808
+ ...segment.style,
809
+ href: segment.href ?? segment.style?.href
810
+ }));
811
+ }
812
+ }
813
+ });
814
+ return h(TView, {
815
+ x: props.x,
816
+ y: props.y,
817
+ w: props.w,
818
+ h: height,
819
+ zIndex: props.zIndex,
820
+ focusable: props.focusable,
821
+ selectable: props.selectable
822
+ }, () => children);
823
+ };
824
+ }
825
+ });
826
+
827
+ //#endregion
828
+ export { TTranscriptView as TAgentTranscript, TBox, TCommandPalette, TDialog, TInput, TLogLinksPanel, TLogMinimap, TLogScrollbar, TLogSearchBar, TLogSearchPager, TLogSearchResults, TLogView, TLogVirtualLinksPanel, TLogVirtualSearchResults, TRenderPlane, TSelect, TText, TThinkingView, TToolCallView, TLogView as TToolLogView, TTranscriptView, TUserMessageView, TView, TVirtualList, TVirtualMarkdown, computeCommandPaletteMatchRanges, createAppendOnlyLogStore, createMarkdownBlockSource, createTLogDensityBucketsFromMarkers, createTLogLevelPlugin, createTLogLineMatcherPlugin, createTLogLinkActionPlugin, createTLogOsc8LinkPlugin, createTLogUrlPlugin, detectTLogUrls, dispatchTLogPluginLinkAction, getTLogPluginMetadata, parseTLogAnnotatedText, resolveTLogLinksPanelTheme, resolveTLogMinimapTheme, resolveTLogScrollbarTheme, resolveTLogSearchBarTheme, resolveTLogSearchPagerTheme, resolveTLogSearchResultsTheme, resolveTLogViewTheme, resolveTThinkingViewModel, resolveTToolCallViewModel, resolveTUserMessageViewModel, stripTLogAnsiText, tlogDarkPreset, tlogDarkTheme, tlogDefaultPreset, tlogDefaultTheme, tlogHighContrastPreset, tlogHighContrastTheme, toTLogExternalLinkFromVisibleLink, useTLogLinkController, useTLogRetainedIndex, useTLogSearchController, useTLogSearchResultsPage, useTLogVirtualSearchResults };