@simon_he/vue-tui 1.0.0-rc.0 → 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 (118) hide show
  1. package/README.md +17 -8
  2. package/dist/{TSelect-BmSkar0D.js → TSelect-BwJJbuTt.js} +1275 -3883
  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/block-source-CKUOnkgT.js +1663 -0
  10. package/dist/cli/node-file-writers.d.ts +1 -0
  11. package/dist/cli.cjs +508 -111
  12. package/dist/cli.d.cts +1 -0
  13. package/dist/cli.d.ts +1 -0
  14. package/dist/cli.js +443 -89
  15. package/dist/core/terminal/create-terminal.d.ts +3 -2
  16. package/dist/core.cjs +120 -39
  17. package/dist/core.js +7 -5
  18. package/dist/{ansi-palette-Bv5Vqr4k.js → create-terminal-C2oiWFJU.js} +19 -84
  19. package/dist/create-terminal-app.d.ts +2 -0
  20. package/dist/{dom-renderer-CDVQIcIL.js → dom-renderer-BqGijQID.js} +3 -2
  21. package/dist/env-Cl8qmNFN.js +19 -0
  22. package/dist/experimental.cjs +2747 -509
  23. package/dist/experimental.d.cts +3 -0
  24. package/dist/experimental.d.ts +3 -0
  25. package/dist/experimental.js +9 -7519
  26. package/dist/frame-perf-C6Xfg85O.js +24 -0
  27. package/dist/{hyperlink-B5PD7a3Q.js → hyperlink-Bn02UXJb.js} +89 -1
  28. package/dist/index.cjs +4628 -618
  29. package/dist/index.d.cts +22 -0
  30. package/dist/index.d.ts +22 -0
  31. package/dist/index.js +16 -12
  32. package/dist/linkify-D_gzn9Xq.js +562 -0
  33. package/dist/markdown.cjs +447 -118
  34. package/dist/markdown.d.cts +2 -1
  35. package/dist/markdown.d.ts +2 -1
  36. package/dist/markdown.js +34 -1493
  37. package/dist/observability/frame-perf-store.d.ts +5 -0
  38. package/dist/observability/perf-sink.d.ts +56 -0
  39. package/dist/observability.cjs +125 -3
  40. package/dist/observability.d.cts +2 -0
  41. package/dist/observability.d.ts +2 -0
  42. package/dist/observability.js +3 -2
  43. package/dist/{path-DDiSCXrQ.js → path-mnSgEpCm.js} +1 -19
  44. package/dist/{path-suggest-0Q2BDsuj.js → path-suggest-BNqcuE3-.js} +1 -1
  45. package/dist/renderer-dom.cjs +0 -6
  46. package/dist/renderer-dom.js +5 -4
  47. package/dist/{runtime-DtrcQidD.js → runtime-rfcZCyJq.js} +1 -1
  48. package/dist/runtime.cjs +4 -3
  49. package/dist/runtime.js +2 -2
  50. package/dist/selection/terminal-selection.d.ts +2 -1
  51. package/dist/{terminal-selection-BCOh9jsL.js → terminal-selection-DBinO6p5.js} +3 -2
  52. package/dist/tlog-theme-qPBt5rge.js +9254 -0
  53. package/dist/trace-CjzYeIxN.js +182 -0
  54. package/dist/utils/grapheme.d.ts +5 -0
  55. package/dist/vue/agent/view-models.d.ts +98 -0
  56. package/dist/vue/components/TAnchor.d.ts +7 -7
  57. package/dist/vue/components/TCommandPalette.d.ts +587 -0
  58. package/dist/vue/components/TDataTable.d.ts +367 -0
  59. package/dist/vue/components/TDebugOverlay.d.ts +1 -1
  60. package/dist/vue/components/TDialog.d.ts +16 -17
  61. package/dist/vue/components/TFeedback.d.ts +635 -0
  62. package/dist/vue/components/TForm.d.ts +1230 -0
  63. package/dist/vue/components/TInput.d.ts +50 -59
  64. package/dist/vue/components/TInputBox.d.ts +6 -6
  65. package/dist/vue/components/TJsonEditor.d.ts +4 -4
  66. package/dist/vue/components/TLink.d.ts +239 -0
  67. package/dist/vue/components/TLinkifyText.d.ts +141 -0
  68. package/dist/vue/components/TList.d.ts +5 -5
  69. package/dist/vue/components/TLogLinksPanel.d.ts +4 -4
  70. package/dist/vue/components/TLogMinimap.d.ts +10 -10
  71. package/dist/vue/components/TLogScrollbar.d.ts +12 -12
  72. package/dist/vue/components/TLogSearchBar.d.ts +7 -7
  73. package/dist/vue/components/TLogSearchResults.d.ts +6 -6
  74. package/dist/vue/components/TLogView.d.ts +54 -20
  75. package/dist/vue/components/TLogVirtualLinksPanel.d.ts +4 -4
  76. package/dist/vue/components/TLogVirtualSearchResults.d.ts +4 -4
  77. package/dist/vue/components/TMarkdownText.d.ts +3 -3
  78. package/dist/vue/components/TNavigation.d.ts +324 -0
  79. package/dist/vue/components/TOverlay.d.ts +366 -0
  80. package/dist/vue/components/TPanels.d.ts +244 -0
  81. package/dist/vue/components/TPathPicker.d.ts +22 -22
  82. package/dist/vue/components/TSelect.d.ts +140 -20
  83. package/dist/vue/components/TTable.d.ts +317 -0
  84. package/dist/vue/components/TText.d.ts +1 -1
  85. package/dist/vue/components/TThinkingView.d.ts +233 -0
  86. package/dist/vue/components/TToolCallView.d.ts +384 -0
  87. package/dist/vue/components/TTranscriptView.d.ts +221 -0
  88. package/dist/vue/components/TTree.d.ts +200 -0
  89. package/dist/vue/components/TUserMessageView.d.ts +344 -0
  90. package/dist/vue/components/TView.d.ts +11 -11
  91. package/dist/vue/components/TVirtualList.d.ts +5 -5
  92. package/dist/vue/components/TVirtualMarkdown.d.ts +6 -6
  93. package/dist/vue/components/TVirtualRows.d.ts +247 -0
  94. package/dist/vue/components/TerminalProvider.d.ts +23 -0
  95. package/dist/vue/components/link/host.d.ts +15 -0
  96. package/dist/vue/components/simple-utils.d.ts +5 -0
  97. package/dist/vue/index.d.ts +31 -1
  98. package/dist/vue/linkify.d.ts +11 -0
  99. package/dist/vue/markdown/document.d.ts +2 -0
  100. package/dist/vue/markdown/layout.d.ts +6 -1
  101. package/dist/vue/markdown/types.d.ts +12 -0
  102. package/dist/vue/overlay.d.ts +27 -0
  103. package/dist/vue/theme.d.ts +48 -0
  104. package/dist/vue/transcript/hit-regions.d.ts +2 -0
  105. package/dist/vue/transcript/layout.d.ts +20 -0
  106. package/dist/vue/transcript/plain-text.d.ts +2 -0
  107. package/dist/vue/transcript/types.d.ts +122 -0
  108. package/dist/vue/utils/row-scroll.d.ts +25 -0
  109. package/dist/vue/utils/text.d.ts +1 -0
  110. package/dist/vue.cjs +17210 -12424
  111. package/dist/vue.d.cts +0 -2
  112. package/dist/vue.d.ts +0 -2
  113. package/dist/vue.js +918 -27
  114. package/dist/{wheel-scroll-B-WlFuNB.js → wheel-scroll-vBRaQ7p-.js} +48 -43
  115. package/package.json +24 -4
  116. package/dist/frame-perf-C-w8mjJL.js +0 -98
  117. package/dist/style-cache-i0ZABZRq.js +0 -178
  118. /package/dist/{sgr-DMK2AvuT.js → sgr-BmzxEjAO.js} +0 -0
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 };