@linxiraos/pi-tui 1.4.3 → 1.4.6

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 (117) hide show
  1. package/CHANGELOG.md +29 -23
  2. package/THIRD-PARTY-NOTICES.txt +14 -0
  3. package/dist/types/app-keybindings.d.ts +5 -0
  4. package/dist/types/chrome/context-map.d.ts +15 -0
  5. package/dist/types/chrome/context-presentation.d.ts +48 -0
  6. package/dist/types/chrome/context-view-model.d.ts +77 -0
  7. package/dist/types/components/image.d.ts +20 -0
  8. package/dist/types/components/loader.d.ts +1 -1
  9. package/dist/types/native/blobs.d.ts +9 -0
  10. package/dist/types/overlays/advisor-config.d.ts +6 -0
  11. package/dist/types/overlays/agent-hub-projection.d.ts +3 -1
  12. package/dist/types/overlays/ask-dialog.d.ts +12 -3
  13. package/dist/types/overlays/btw-history-panel.d.ts +16 -2
  14. package/dist/types/overlays/btw-history.d.ts +7 -0
  15. package/dist/types/overlays/btw-panel.d.ts +2 -0
  16. package/dist/types/overlays/context-viewer-format.d.ts +42 -0
  17. package/dist/types/overlays/context-viewer-overview.d.ts +70 -0
  18. package/dist/types/overlays/context-viewer.d.ts +25 -0
  19. package/dist/types/overlays/hook-input.d.ts +1 -0
  20. package/dist/types/overlays/mcp-add-wizard.d.ts +2 -0
  21. package/dist/types/overlays/pause-screen.d.ts +13 -3
  22. package/dist/types/overlays/running-subagent-badge.d.ts +7 -1
  23. package/dist/types/prompt/macos-spelling.d.ts +2 -2
  24. package/dist/types/render/hyperlink.d.ts +15 -2
  25. package/dist/types/render/output-pane.d.ts +1 -1
  26. package/dist/types/render/render-utils.d.ts +7 -1
  27. package/dist/types/status-line/component.d.ts +2 -2
  28. package/dist/types/status-line/context-usage.d.ts +15 -30
  29. package/dist/types/terminal-capabilities.d.ts +7 -0
  30. package/dist/types/theme/symbols.d.ts +1 -1
  31. package/dist/types/tools/ask.d.ts +4 -0
  32. package/dist/types/tools/edit.d.ts +3 -1
  33. package/dist/types/tools/fetch.d.ts +1 -0
  34. package/dist/types/tools/github.d.ts +3 -0
  35. package/dist/types/tools/grouped-file-output.d.ts +2 -0
  36. package/dist/types/tools/mcp.d.ts +3 -3
  37. package/dist/types/tools/read.d.ts +3 -0
  38. package/dist/types/tools/wait.d.ts +16 -2
  39. package/dist/types/tui.d.ts +2 -0
  40. package/dist/types/vim.d.ts +39 -0
  41. package/package.json +9 -9
  42. package/src/app-keybindings.d.ts +5 -0
  43. package/src/app-keybindings.ts +5 -0
  44. package/src/chat/bash-execution.ts +7 -1
  45. package/src/chat/read-tool-group.ts +1 -2
  46. package/src/chat/skill-message.ts +2 -6
  47. package/src/chrome/context-map.ts +62 -0
  48. package/src/chrome/context-presentation.ts +26 -0
  49. package/src/chrome/context-view-model.ts +73 -0
  50. package/src/chrome/transcript-container.ts +89 -59
  51. package/src/components/editor.ts +455 -13
  52. package/src/components/image.d.ts +20 -0
  53. package/src/components/image.ts +83 -18
  54. package/src/components/loader.d.ts +1 -1
  55. package/src/components/loader.ts +1 -1
  56. package/src/components/markdown.ts +109 -7
  57. package/src/hotkeys-markdown.ts +1 -0
  58. package/src/native/blobs.d.ts +9 -0
  59. package/src/native/blobs.ts +3 -2
  60. package/src/overlays/advisor-config.ts +9 -2
  61. package/src/overlays/agent-hub-projection.d.ts +3 -1
  62. package/src/overlays/agent-hub-projection.ts +6 -5
  63. package/src/overlays/agent-hub.ts +51 -42
  64. package/src/overlays/ask-dialog.ts +125 -35
  65. package/src/overlays/btw-history-panel.ts +124 -12
  66. package/src/overlays/btw-history.ts +11 -0
  67. package/src/overlays/btw-panel.ts +8 -4
  68. package/src/overlays/context-viewer-format.ts +145 -0
  69. package/src/overlays/context-viewer-overview.ts +381 -0
  70. package/src/overlays/context-viewer.ts +728 -0
  71. package/src/overlays/hook-input.ts +2 -0
  72. package/src/overlays/mcp-add-wizard.ts +5 -0
  73. package/src/overlays/pause-screen.ts +166 -33
  74. package/src/overlays/running-subagent-badge.ts +12 -1
  75. package/src/overlays/settings-defs.ts +1 -0
  76. package/src/overlays/usage-dashboard.ts +15 -2
  77. package/src/prompt/macos-spelling.ts +24 -15
  78. package/src/render/hyperlink.d.ts +15 -2
  79. package/src/render/hyperlink.ts +41 -18
  80. package/src/render/output-pane.d.ts +1 -1
  81. package/src/render/output-pane.ts +60 -17
  82. package/src/render/render-utils.d.ts +7 -1
  83. package/src/render/render-utils.ts +11 -2
  84. package/src/setup/scenes/sign-in.ts +6 -0
  85. package/src/status-line/component.ts +6 -4
  86. package/src/status-line/context-usage.ts +56 -582
  87. package/src/terminal-capabilities.d.ts +7 -0
  88. package/src/terminal-capabilities.ts +10 -0
  89. package/src/theme/symbols.d.ts +1 -1
  90. package/src/theme/symbols.ts +16 -0
  91. package/src/tools/ask.d.ts +4 -0
  92. package/src/tools/ask.ts +4 -0
  93. package/src/tools/ast-grep.ts +3 -2
  94. package/src/tools/bash.ts +5 -23
  95. package/src/tools/edit.d.ts +3 -1
  96. package/src/tools/edit.ts +8 -4
  97. package/src/tools/fetch.d.ts +1 -0
  98. package/src/tools/fetch.ts +1 -0
  99. package/src/tools/find.ts +3 -10
  100. package/src/tools/github.d.ts +3 -0
  101. package/src/tools/github.ts +23 -3
  102. package/src/tools/glob.ts +4 -3
  103. package/src/tools/grep.ts +3 -4
  104. package/src/tools/grouped-file-output.d.ts +2 -0
  105. package/src/tools/grouped-file-output.ts +8 -2
  106. package/src/tools/mcp.d.ts +3 -3
  107. package/src/tools/mcp.ts +27 -9
  108. package/src/tools/native-view.ts +2 -2
  109. package/src/tools/read.d.ts +3 -0
  110. package/src/tools/read.ts +3 -1
  111. package/src/tools/vibe.ts +14 -3
  112. package/src/tools/wait.d.ts +16 -2
  113. package/src/tools/wait.ts +16 -2
  114. package/src/tui.d.ts +2 -0
  115. package/src/tui.ts +59 -19
  116. package/src/vim.d.ts +39 -0
  117. package/src/vim.ts +313 -22
@@ -1047,6 +1047,16 @@ export function directPlacementLift(line: string): number {
1047
1047
  return m ? Number(m[1]) : 0;
1048
1048
  }
1049
1049
 
1050
+ /**
1051
+ * Re-anchor an {@link Image} direct-placement line `lift` rows above its own
1052
+ * row instead of its encoded `CUU(rows-1)`. The renderer lowers the lift when
1053
+ * the block's top is clipped by the frame: the cursor-up would otherwise climb
1054
+ * past the frame's first row into whatever the terminal shows above it.
1055
+ */
1056
+ export function withDirectPlacementLift(line: string, lift: number): string {
1057
+ return line.replace(DIRECT_PLACEMENT_LIFT, lift > 0 ? `\x1b7\x1b[${lift}A` : "\x1b7");
1058
+ }
1059
+
1050
1060
  /**
1051
1061
  * Rebuild an {@link Image} direct-placement line for the viewport row it is
1052
1062
  * written at. The component-rendered line encodes `CUU(rows-1)`, which clamps
@@ -2,7 +2,7 @@ export type SymbolPreset = "unicode" | "nerd" | "ascii";
2
2
  /**
3
3
  * All available symbol keys organized by category.
4
4
  */
5
- export type SymbolKey = "status.success" | "status.error" | "status.warning" | "status.info" | "status.pending" | "status.disabled" | "status.enabled" | "status.running" | "status.shadowed" | "status.aborted" | "status.done" | "nav.cursor" | "nav.selected" | "nav.expand" | "nav.collapse" | "nav.back" | "tree.branch" | "tree.last" | "tree.vertical" | "tree.horizontal" | "tree.hook" | "progress.filled" | "progress.empty" | "context.speculation" | "context.compaction" | "boxRound.topLeft" | "boxRound.topRight" | "boxRound.bottomLeft" | "boxRound.bottomRight" | "boxRound.horizontal" | "boxRound.vertical" | "boxDotted.horizontal" | "boxDotted.vertical" | "boxSharp.topLeft" | "boxSharp.topRight" | "boxSharp.bottomLeft" | "boxSharp.bottomRight" | "boxSharp.horizontal" | "boxSharp.vertical" | "boxSharp.cross" | "boxSharp.teeDown" | "boxSharp.teeUp" | "boxSharp.teeRight" | "boxSharp.teeLeft" | "sep.powerline" | "sep.powerlineThin" | "sep.powerlineLeft" | "sep.powerlineRight" | "sep.powerlineThinLeft" | "sep.powerlineThinRight" | "sep.powerlineCapLeft" | "sep.block" | "sep.space" | "sep.asciiLeft" | "sep.asciiRight" | "sep.dot" | "sep.slash" | "sep.pipe" | "icon.model" | "icon.plan" | "icon.prewalk" | "icon.goal" | "icon.pause" | "icon.loop" | "icon.folder" | "icon.worktree" | "icon.search" | "icon.scratchFolder" | "icon.file" | "icon.git" | "icon.branch" | "icon.pr" | "icon.pin" | "icon.tokens" | "icon.context" | "icon.cost" | "icon.subscription" | "icon.advisor" | "icon.advisorClosed" | "icon.time" | "icon.omp" | "icon.ghost" | "icon.agents" | "icon.job" | "icon.cache" | "icon.cacheMiss" | "icon.input" | "icon.output" | "icon.throughput" | "icon.intelligence" | "icon.host" | "icon.session" | "icon.package" | "icon.warning" | "icon.rewind" | "icon.auto" | "icon.fast" | "icon.extensionSkill" | "icon.extensionTool" | "icon.extensionSlashCommand" | "icon.extensionMcp" | "icon.extensionRule" | "icon.extensionHook" | "icon.extensionPrompt" | "icon.extensionContextFile" | "icon.extensionInstruction" | "icon.vimNormal" | "icon.vimInsert" | "icon.vimVisual" | "icon.vimVisualLine" | "icon.vimReplace" | "cmd.action" | "cmd.prompt" | "cmd.extension" | "cmd.settings" | "cmd.gear" | "cmd.shield" | "cmd.wave" | "cmd.compass" | "cmd.inbox" | "cmd.swap" | "cmd.expand" | "cmd.computer" | "cmd.eye" | "cmd.todo" | "cmd.stats" | "cmd.news" | "cmd.keyboard" | "cmd.export" | "cmd.clipboard" | "cmd.share" | "cmd.broadcast" | "cmd.globe" | "cmd.copy" | "cmd.plus" | "cmd.restart" | "cmd.eraser" | "cmd.trash" | "cmd.compress" | "cmd.vibrate" | "cmd.handoff" | "cmd.history" | "cmd.question" | "cmd.rocket" | "cmd.stethoscope" | "cmd.redo" | "cmd.bug" | "cmd.memory" | "cmd.pencil" | "cmd.folderMove" | "cmd.folderPlus" | "cmd.folderMinus" | "cmd.hammer" | "cmd.power" | "cmd.cart" | "icon.mic" | "icon.camera" | "thinking.minimal" | "thinking.low" | "thinking.medium" | "thinking.high" | "thinking.xhigh" | "thinking.max" | "thinking.autoPending" | "checkbox.checked" | "checkbox.unchecked" | "radio.selected" | "radio.unselected" | "format.bullet" | "format.dash" | "format.bracketLeft" | "format.bracketRight" | "md.quoteBorder" | "md.hrChar" | "md.bullet" | "md.colorSwatch" | "advisor.rail" | "skill.rail" | "lang.default" | "lang.typescript" | "lang.javascript" | "lang.python" | "lang.rust" | "lang.go" | "lang.java" | "lang.c" | "lang.cpp" | "lang.csharp" | "lang.ruby" | "lang.julia" | "lang.php" | "lang.swift" | "lang.kotlin" | "lang.shell" | "lang.html" | "lang.css" | "lang.json" | "lang.yaml" | "lang.markdown" | "lang.sql" | "lang.docker" | "lang.lua" | "lang.text" | "lang.env" | "lang.toml" | "lang.xml" | "lang.ini" | "lang.conf" | "lang.log" | "lang.csv" | "lang.tsv" | "lang.image" | "lang.pdf" | "lang.archive" | "lang.binary" | "chip.image" | "chip.video" | "chip.paste" | "tab.appearance" | "tab.model" | "tab.interaction" | "tab.context" | "tab.files" | "tab.shell" | "tab.tools" | "tab.memory" | "tab.tasks" | "tab.providers" | "tool.write" | "tool.edit" | "tool.bash" | "tool.ssh" | "tool.lsp" | "tool.gh" | "tool.webSearch" | "tool.exa" | "tool.browser" | "tool.eval" | "tool.debug" | "tool.mcp" | "tool.job" | "tool.launch" | "tool.task" | "tool.todo" | "tool.memory" | "tool.ask" | "tool.resolve" | "tool.review" | "tool.goal" | "tool.irc" | "tool.delete" | "tool.move" | "key.ctrl" | "key.ctrlMac" | "key.shift" | "key.alt" | "key.altMac" | "key.super" | "key.superMac" | "key.joiner" | "key.enter" | "key.esc" | "key.tab" | "key.backspace" | "key.delete" | "key.space" | "key.up" | "key.down" | "key.left" | "key.right";
5
+ export type SymbolKey = "status.success" | "status.error" | "status.warning" | "status.info" | "status.pending" | "status.disabled" | "status.enabled" | "status.running" | "status.shadowed" | "status.aborted" | "status.done" | "nav.cursor" | "nav.selected" | "nav.expand" | "nav.collapse" | "nav.back" | "tree.branch" | "tree.last" | "tree.vertical" | "tree.horizontal" | "tree.hook" | "progress.filled" | "progress.empty" | "context.speculation" | "context.compaction" | "context.content" | "context.messages" | "context.buffer" | "context.free" | "boxRound.topLeft" | "boxRound.topRight" | "boxRound.bottomLeft" | "boxRound.bottomRight" | "boxRound.horizontal" | "boxRound.vertical" | "boxDotted.horizontal" | "boxDotted.vertical" | "boxSharp.topLeft" | "boxSharp.topRight" | "boxSharp.bottomLeft" | "boxSharp.bottomRight" | "boxSharp.horizontal" | "boxSharp.vertical" | "boxSharp.cross" | "boxSharp.teeDown" | "boxSharp.teeUp" | "boxSharp.teeRight" | "boxSharp.teeLeft" | "sep.powerline" | "sep.powerlineThin" | "sep.powerlineLeft" | "sep.powerlineRight" | "sep.powerlineThinLeft" | "sep.powerlineThinRight" | "sep.powerlineCapLeft" | "sep.block" | "sep.space" | "sep.asciiLeft" | "sep.asciiRight" | "sep.dot" | "sep.slash" | "sep.pipe" | "icon.model" | "icon.plan" | "icon.prewalk" | "icon.goal" | "icon.pause" | "icon.loop" | "icon.folder" | "icon.worktree" | "icon.search" | "icon.scratchFolder" | "icon.file" | "icon.git" | "icon.branch" | "icon.pr" | "icon.pin" | "icon.tokens" | "icon.context" | "icon.cost" | "icon.subscription" | "icon.advisor" | "icon.advisorClosed" | "icon.time" | "icon.omp" | "icon.ghost" | "icon.agents" | "icon.job" | "icon.cache" | "icon.cacheMiss" | "icon.input" | "icon.output" | "icon.throughput" | "icon.intelligence" | "icon.host" | "icon.session" | "icon.package" | "icon.warning" | "icon.rewind" | "icon.auto" | "icon.fast" | "icon.extensionSkill" | "icon.extensionTool" | "icon.extensionSlashCommand" | "icon.extensionMcp" | "icon.extensionRule" | "icon.extensionHook" | "icon.extensionPrompt" | "icon.extensionContextFile" | "icon.extensionInstruction" | "icon.vimNormal" | "icon.vimInsert" | "icon.vimVisual" | "icon.vimVisualLine" | "icon.vimReplace" | "cmd.action" | "cmd.prompt" | "cmd.extension" | "cmd.settings" | "cmd.gear" | "cmd.shield" | "cmd.wave" | "cmd.compass" | "cmd.inbox" | "cmd.swap" | "cmd.expand" | "cmd.computer" | "cmd.eye" | "cmd.todo" | "cmd.stats" | "cmd.news" | "cmd.keyboard" | "cmd.export" | "cmd.clipboard" | "cmd.share" | "cmd.broadcast" | "cmd.globe" | "cmd.copy" | "cmd.plus" | "cmd.restart" | "cmd.eraser" | "cmd.trash" | "cmd.compress" | "cmd.vibrate" | "cmd.handoff" | "cmd.history" | "cmd.question" | "cmd.rocket" | "cmd.stethoscope" | "cmd.redo" | "cmd.bug" | "cmd.memory" | "cmd.pencil" | "cmd.folderMove" | "cmd.folderPlus" | "cmd.folderMinus" | "cmd.hammer" | "cmd.power" | "cmd.cart" | "icon.mic" | "icon.camera" | "thinking.minimal" | "thinking.low" | "thinking.medium" | "thinking.high" | "thinking.xhigh" | "thinking.max" | "thinking.autoPending" | "checkbox.checked" | "checkbox.unchecked" | "radio.selected" | "radio.unselected" | "format.bullet" | "format.dash" | "format.bracketLeft" | "format.bracketRight" | "md.quoteBorder" | "md.hrChar" | "md.bullet" | "md.colorSwatch" | "advisor.rail" | "skill.rail" | "lang.default" | "lang.typescript" | "lang.javascript" | "lang.python" | "lang.rust" | "lang.go" | "lang.java" | "lang.c" | "lang.cpp" | "lang.csharp" | "lang.ruby" | "lang.julia" | "lang.php" | "lang.swift" | "lang.kotlin" | "lang.shell" | "lang.html" | "lang.css" | "lang.json" | "lang.yaml" | "lang.markdown" | "lang.sql" | "lang.docker" | "lang.lua" | "lang.text" | "lang.env" | "lang.toml" | "lang.xml" | "lang.ini" | "lang.conf" | "lang.log" | "lang.csv" | "lang.tsv" | "lang.image" | "lang.pdf" | "lang.archive" | "lang.binary" | "chip.image" | "chip.video" | "chip.paste" | "tab.appearance" | "tab.model" | "tab.interaction" | "tab.context" | "tab.files" | "tab.shell" | "tab.tools" | "tab.memory" | "tab.tasks" | "tab.providers" | "tool.write" | "tool.edit" | "tool.bash" | "tool.ssh" | "tool.lsp" | "tool.gh" | "tool.webSearch" | "tool.exa" | "tool.browser" | "tool.eval" | "tool.debug" | "tool.mcp" | "tool.job" | "tool.launch" | "tool.task" | "tool.todo" | "tool.memory" | "tool.ask" | "tool.resolve" | "tool.review" | "tool.goal" | "tool.irc" | "tool.delete" | "tool.move" | "key.ctrl" | "key.ctrlMac" | "key.shift" | "key.alt" | "key.altMac" | "key.super" | "key.superMac" | "key.joiner" | "key.enter" | "key.esc" | "key.tab" | "key.backspace" | "key.delete" | "key.space" | "key.up" | "key.down" | "key.left" | "key.right";
6
6
  export type SymbolMap = Record<SymbolKey, string>;
7
7
  /**
8
8
  * Icon vocabulary for slash-command autocomplete type indicators. Each name
@@ -38,6 +38,10 @@ export type SymbolKey =
38
38
  // Context gauge boundaries
39
39
  | "context.speculation"
40
40
  | "context.compaction"
41
+ | "context.content"
42
+ | "context.messages"
43
+ | "context.buffer"
44
+ | "context.free"
41
45
  // Box Drawing - Rounded
42
46
  | "boxRound.topLeft"
43
47
  | "boxRound.topRight"
@@ -419,6 +423,10 @@ const UNICODE_SYMBOLS: SymbolMap = {
419
423
  // Context gauge boundaries
420
424
  "context.speculation": "╎",
421
425
  "context.compaction": "┃",
426
+ "context.content": "⛁",
427
+ "context.messages": "⛃",
428
+ "context.buffer": "⛝",
429
+ "context.free": "⛶",
422
430
  // Box (rounded)
423
431
  "boxRound.topLeft": "╭",
424
432
  "boxRound.topRight": "╮",
@@ -745,6 +753,10 @@ const NERD_SYMBOLS: SymbolMap = {
745
753
  // Context gauge boundaries — vector intersection starts async speculation; auto-fix applies compaction.
746
754
  "context.speculation": "\u{f055d}",
747
755
  "context.compaction": "\u{f0068}",
756
+ "context.content": "⛁",
757
+ "context.messages": "⛃",
758
+ "context.buffer": "⛝",
759
+ "context.free": "⛶",
748
760
  // Box Drawing - Rounded (same as unicode)
749
761
  // pick: ╭ | alt: ┌ ┏ ╔
750
762
  "boxRound.topLeft": "╭",
@@ -1203,6 +1215,10 @@ const ASCII_SYMBOLS: SymbolMap = {
1203
1215
  // Context gauge boundaries
1204
1216
  "context.speculation": ":",
1205
1217
  "context.compaction": "|",
1218
+ "context.content": "#",
1219
+ "context.messages": "@",
1220
+ "context.buffer": "x",
1221
+ "context.free": ".",
1206
1222
  // Box Drawing - Rounded (ASCII fallback)
1207
1223
  "boxRound.topLeft": "+",
1208
1224
  "boxRound.topRight": "+",
@@ -12,6 +12,8 @@ export interface QuestionResult {
12
12
  customInput?: string;
13
13
  /** Optional note attached to the selected answer in the rich ask dialog. */
14
14
  note?: string;
15
+ /** Label of the option the note is on; unset when it is on the custom answer. */
16
+ noteOption?: string;
15
17
  /** True when the answer was auto-selected because the dialog timed out. */
16
18
  timedOut?: boolean;
17
19
  }
@@ -24,6 +26,8 @@ export interface AskToolDetails {
24
26
  customInput?: string;
25
27
  /** Optional note attached to the selected answer in the rich ask dialog. */
26
28
  note?: string;
29
+ /** Label of the option the note is on; unset when it is on the custom answer. */
30
+ noteOption?: string;
27
31
  /** True when the answer was auto-selected because the dialog timed out. */
28
32
  timedOut?: boolean;
29
33
  /** Multi-part question mode */
package/src/tools/ask.ts CHANGED
@@ -38,6 +38,8 @@ export interface QuestionResult {
38
38
  customInput?: string;
39
39
  /** Optional note attached to the selected answer in the rich ask dialog. */
40
40
  note?: string;
41
+ /** Label of the option the note is on; unset when it is on the custom answer. */
42
+ noteOption?: string;
41
43
  /** True when the answer was auto-selected because the dialog timed out. */
42
44
  timedOut?: boolean;
43
45
  }
@@ -51,6 +53,8 @@ export interface AskToolDetails {
51
53
  customInput?: string;
52
54
  /** Optional note attached to the selected answer in the rich ask dialog. */
53
55
  note?: string;
56
+ /** Label of the option the note is on; unset when it is on the custom answer. */
57
+ noteOption?: string;
54
58
  /** True when the answer was auto-selected because the dialog timed out. */
55
59
  timedOut?: boolean;
56
60
  /** Multi-part question mode */
@@ -2,10 +2,11 @@ import { isRecord, sanitizeText } from "@linxiraos/pi-utils";
2
2
  import type { Component } from "../tui";
3
3
  import { Text } from "../components/text";
4
4
  import type { Theme } from "../theme/theme";
5
- import { Ellipsis, fileHyperlink, renderStatusLine, renderTreeList, truncateToWidth } from "../render";
5
+ import { fileHyperlink, renderStatusLine, renderTreeList } from "../render";
6
6
  import {
7
7
  appendParseErrorsBulletList,
8
8
  createCachedComponent,
9
+ fitHeaderedRows,
9
10
  formatCount,
10
11
  formatEmptyMessage,
11
12
  formatErrorMessage,
@@ -205,7 +206,7 @@ export const astGrepToolRenderer = {
205
206
  },
206
207
  uiTheme,
207
208
  );
208
- return [header, ...matchLines, ...extraLines].map(l => truncateToWidth(l, width, Ellipsis.Omit));
209
+ return fitHeaderedRows(header, [...matchLines, ...extraLines], width);
209
210
  },
210
211
  );
211
212
  },
package/src/tools/bash.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Component } from "../tui";
2
- import { getProjectDir } from "@linxiraos/pi-utils";
2
+ import { getProjectDir, jsonContainerEnd } from "@linxiraos/pi-utils";
3
3
  import { highlightCode, type Theme } from "../theme/theme";
4
4
  import { renderStatusLine } from "../render/status-line";
5
5
  import { framedToolCard, type ToolCardSnapshot } from "../render/tool-card";
@@ -174,28 +174,10 @@ function extractPartialBashEnv(partialJson: string | undefined): Readonly<Record
174
174
  const objectStart = envStart === -1 ? -1 : partialJson.indexOf("{", envStart);
175
175
  if (objectStart !== -1) {
176
176
  // Scan only the env object: stop at its closing brace (outside strings)
177
- // so the keys that follow it are not read as env assignments.
178
- let objectEnd = partialJson.length;
179
- let depth = 0;
180
- for (let i = objectStart + 1; i < partialJson.length; i++) {
181
- const ch = partialJson.charCodeAt(i);
182
- if (ch === 0x22) {
183
- // Skip the string body, honoring escapes; an unterminated string runs to the end.
184
- for (i++; i < partialJson.length; i++) {
185
- const inner = partialJson.charCodeAt(i);
186
- if (inner === 0x5c) i++;
187
- else if (inner === 0x22) break;
188
- }
189
- } else if (ch === 0x7b || ch === 0x5b) {
190
- depth++;
191
- } else if (ch === 0x7d || ch === 0x5d) {
192
- if (depth === 0) {
193
- objectEnd = i;
194
- break;
195
- }
196
- depth--;
197
- }
198
- }
177
+ // so the keys that follow it are not read as env assignments. An
178
+ // unclosed object (still streaming) runs to the end.
179
+ const end = jsonContainerEnd(partialJson, objectStart);
180
+ const objectEnd = end === -1 ? partialJson.length : end - 1;
199
181
  const envBody = partialJson.slice(objectStart + 1, objectEnd);
200
182
  const matcher = /"([A-Za-z_][A-Za-z0-9_]*)"\s*:\s*"((?:\\.|[^"\\])*)(?:"|$)/gu;
201
183
  for (const match of envBody.matchAll(matcher)) {
@@ -51,8 +51,10 @@ export interface EditToolPerFileResult {
51
51
  }
52
52
  /** Diff, diagnostics, and snapshots returned by an edit. */
53
53
  export interface EditToolDetails {
54
- /** Unified diff of the changes made */
54
+ /** Unified diff of the changes made; empty when the edit failed */
55
55
  diff: string;
56
+ /** Why the edit failed, as the engine classed it (`unseen_lines`, `stale_tag`, `parse`, …) */
57
+ errorKind?: string;
56
58
  /** Line number of the first change in the new file (for editor navigation) */
57
59
  firstChangedLine?: number;
58
60
  /** Diagnostic result (if available) */
package/src/tools/edit.ts CHANGED
@@ -95,8 +95,10 @@ export interface EditToolPerFileResult {
95
95
 
96
96
  /** Diff, diagnostics, and snapshots returned by an edit. */
97
97
  export interface EditToolDetails {
98
- /** Unified diff of the changes made */
98
+ /** Unified diff of the changes made; empty when the edit failed */
99
99
  diff: string;
100
+ /** Why the edit failed, as the engine classed it (`unseen_lines`, `stale_tag`, `parse`, …) */
101
+ errorKind?: string;
100
102
  /** Line number of the first change in the new file (for editor navigation) */
101
103
  firstChangedLine?: number;
102
104
  /** Diagnostic result (if available) */
@@ -1418,7 +1420,8 @@ function editFileParts(
1418
1420
  filePathFromEditEntry(firstEdit?.rename) ??
1419
1421
  filePathFromEditEntry(firstEdit?.move) ??
1420
1422
  (details && "move" in details && typeof details.move === "string" ? details.move : undefined);
1421
- const editDiffPreview = details ? undefined : options.renderContext?.editDiffPreview;
1423
+ // Details that only class a failure leave the streamed preview to locate it.
1424
+ const editDiffPreview = details && !("errorKind" in details) ? undefined : options.renderContext?.editDiffPreview;
1422
1425
  const previewDiff = editDiffPreview && !("error" in editDiffPreview) ? editDiffPreview.diff : undefined;
1423
1426
  const diffText = isError ? undefined : details?.diff || previewDiff;
1424
1427
  const firstChangedLine =
@@ -1530,8 +1533,9 @@ function renderSingleFileResult(
1530
1533
  // what happened. The shared streaming `editDiffPreview` is a call-phase
1531
1534
  // artifact (in a batch it reflects only the first file), so consulting it
1532
1535
  // for an empty-diff delete/move/no-op result mislabels the card. Fall
1533
- // back to the preview only when no details exist yet.
1534
- const editDiffPreview = details ? undefined : renderContext?.editDiffPreview;
1536
+ // back to the preview only when no details exist yet, or when they only
1537
+ // class a failure.
1538
+ const editDiffPreview = details && !("errorKind" in details) ? undefined : renderContext?.editDiffPreview;
1535
1539
  const renderDiffFn = renderContext?.renderDiff ?? renderFallbackDiff;
1536
1540
 
1537
1541
  if (diffSectionRenderDiffFn !== renderDiffFn) {
@@ -9,6 +9,7 @@ export interface ReadUrlToolDetails {
9
9
  finalUrl: string;
10
10
  contentType: string;
11
11
  method: string;
12
+ raw?: boolean;
12
13
  truncated: boolean;
13
14
  notes: string[];
14
15
  meta?: OutputMeta;
@@ -28,6 +28,7 @@ export interface ReadUrlToolDetails {
28
28
  finalUrl: string;
29
29
  contentType: string;
30
30
  method: string;
31
+ raw?: boolean;
31
32
  truncated: boolean;
32
33
  notes: string[];
33
34
  meta?: OutputMeta;
package/src/tools/find.ts CHANGED
@@ -7,17 +7,10 @@ import * as path from "node:path";
7
7
  import { formatDuration, formatNumber } from "@linxiraos/pi-utils";
8
8
  import { renderProgressBar } from "../components/progress-bar";
9
9
  import { Text } from "../components/text";
10
- import {
11
- Ellipsis,
12
- fileHyperlink,
13
- getTreeBranch,
14
- renderStatusLine,
15
- renderTreeList,
16
- truncateToWidth,
17
- uriHyperlink,
18
- } from "../render";
10
+ import { fileHyperlink, getTreeBranch, renderStatusLine, renderTreeList, uriHyperlink } from "../render";
19
11
  import {
20
12
  createCachedComponent,
13
+ fitHeaderedRows,
21
14
  formatCount,
22
15
  formatEmptyMessage,
23
16
  formatErrorMessage,
@@ -357,7 +350,7 @@ export const findToolRenderer = {
357
350
  extra.push(uiTheme.fg("dim", `keywords: ${details.keywords.join(", ")}`));
358
351
  for (const failure of stats.failures) extra.push(uiTheme.fg("warning", failure));
359
352
  }
360
- return [header, ...hitLines, ...extra].map(line => truncateToWidth(line, width, Ellipsis.Omit));
353
+ return fitHeaderedRows(header, [...hitLines, ...extra], width);
361
354
  },
362
355
  );
363
356
  },
@@ -85,6 +85,7 @@ export interface GhRunWatchFailedLogDetails {
85
85
  conclusion?: string;
86
86
  tail?: string;
87
87
  available: boolean;
88
+ unavailableReason?: string;
88
89
  }
89
90
  /** Live workflow watcher display snapshot. */
90
91
  export interface GhRunWatchViewDetails {
@@ -130,6 +131,8 @@ export interface GhFailedJobLog {
130
131
  full?: string;
131
132
  tail?: string;
132
133
  available: boolean;
134
+ unavailableReason?: string;
135
+ truncated?: boolean;
133
136
  }
134
137
  /** Choose the terminal conclusion or current job state. */
135
138
  export declare function formatJobState(job: GhRunJobSnapshot): string;
@@ -21,6 +21,7 @@ import {
21
21
  type ToolUIColor,
22
22
  type ToolUIStatus,
23
23
  TRUNCATE_LENGTHS,
24
+ sanitizeDisplayWarning,
24
25
  truncateToWidth as truncateVisualWidth,
25
26
  } from "../render/render-utils";
26
27
 
@@ -236,6 +237,11 @@ function renderRunBlock(run: GhRunWatchRunDetails, width: number, theme: Theme):
236
237
  return lines;
237
238
  }
238
239
 
240
+ function formatUnavailableLog(entry: GhRunWatchFailedLogDetails): string {
241
+ const reason = entry.unavailableReason ? sanitizeDisplayWarning(entry.unavailableReason) : "";
242
+ return `log tail unavailable${reason ? `: ${reason}` : ""}`;
243
+ }
244
+
239
245
  function renderFailedLogs(
240
246
  failedLogs: GhRunWatchFailedLogDetails[],
241
247
  width: number,
@@ -254,7 +260,7 @@ function renderFailedLogs(
254
260
  );
255
261
 
256
262
  if (!entry.available || !entry.tail) {
257
- lines.push(theme.fg("dim", " log tail unavailable"));
263
+ lines.push(theme.fg("dim", truncateVisualWidth(` ${formatUnavailableLog(entry)}`, Math.max(8, width))));
258
264
  continue;
259
265
  }
260
266
 
@@ -463,7 +469,9 @@ function describeWatch(watch: GhRunWatchViewDetails, isError: boolean): NativeTo
463
469
  const failed = (watch.failedLogs ?? []).flatMap((entry): NativeChild[] => {
464
470
  const context = entry.workflowName ? `${entry.workflowName} #${entry.runId}` : `run #${entry.runId}`;
465
471
  const title = text([span(plainText(entry.jobName), "error"), span(` ${plainText(context)}`, "muted")]);
466
- if (!entry.available || !entry.tail) return [title, noteText("log tail unavailable")];
472
+ if (!entry.available || !entry.tail) {
473
+ return [title, noteText(formatUnavailableLog(entry))];
474
+ }
467
475
  return [title, ansi(entry.tail, { follow: true, preview: { lines: PREVIEW_LIMITS.OUTPUT_COLLAPSED } })];
468
476
  });
469
477
  return {
@@ -659,6 +667,7 @@ export interface GhRunWatchFailedLogDetails {
659
667
  conclusion?: string;
660
668
  tail?: string;
661
669
  available: boolean;
670
+ unavailableReason?: string;
662
671
  }
663
672
 
664
673
  /** Live workflow watcher display snapshot. */
@@ -708,6 +717,8 @@ export interface GhFailedJobLog {
708
717
  full?: string;
709
718
  tail?: string;
710
719
  available: boolean;
720
+ unavailableReason?: string;
721
+ truncated?: boolean;
711
722
  }
712
723
 
713
724
  /** Choose the terminal conclusion or current job state. */
@@ -764,12 +775,21 @@ export function renderFailedJobLogs(
764
775
  lines.push("");
765
776
  const logText = options.mode === "full" ? entry.full : entry.tail;
766
777
  if (entry.available && logText) {
767
- lines.push(options.mode === "full" ? "Full log:" : `Last ${options.tail} log lines:`);
778
+ lines.push(
779
+ options.mode === "full"
780
+ ? entry.truncated
781
+ ? "Partial log (capture truncated):"
782
+ : "Full log:"
783
+ : entry.truncated
784
+ ? `Last ${options.tail} captured log lines (log capture truncated):`
785
+ : `Last ${options.tail} log lines:`,
786
+ );
768
787
  lines.push("```text");
769
788
  lines.push(logText);
770
789
  lines.push("```");
771
790
  } else {
772
791
  lines.push(options.mode === "full" ? "Full log unavailable." : "Log tail unavailable.");
792
+ if (entry.unavailableReason) pushLine(lines, "Reason", entry.unavailableReason);
773
793
  }
774
794
  lines.push("");
775
795
  }
package/src/tools/glob.ts CHANGED
@@ -15,9 +15,10 @@ import type { OutputMeta } from "./output-meta";
15
15
  import type { TruncationResult } from "./streaming-output";
16
16
  import { toPathList } from "../render/render-utils";
17
17
  import * as path from "node:path";
18
- import { Ellipsis, fileHyperlink, renderFileList, renderStatusLine, renderTreeList, truncateToWidth } from "../render";
18
+ import { fileHyperlink, renderFileList, renderStatusLine, renderTreeList } from "../render";
19
19
  import {
20
20
  createCachedComponent,
21
+ fitHeaderedRows,
21
22
  formatCount,
22
23
  formatEmptyMessage,
23
24
  formatErrorMessage,
@@ -205,7 +206,7 @@ export const globToolRenderer = {
205
206
  },
206
207
  uiTheme,
207
208
  );
208
- return [header, ...listLines].map(l => truncateToWidth(l, width, Ellipsis.Omit));
209
+ return fitHeaderedRows(header, listLines, width);
209
210
  },
210
211
  );
211
212
  }
@@ -295,7 +296,7 @@ export const globToolRenderer = {
295
296
  },
296
297
  uiTheme,
297
298
  );
298
- return [header, ...fileLines, ...extraLines].map(l => truncateToWidth(l, width, Ellipsis.Omit));
299
+ return fitHeaderedRows(header, [...fileLines, ...extraLines], width);
299
300
  },
300
301
  );
301
302
  },
package/src/tools/grep.ts CHANGED
@@ -16,19 +16,18 @@ import { type Theme } from "../theme/theme";
16
16
  import type { OutputMeta } from "./output-meta";
17
17
  import type { TruncationResult } from "./streaming-output";
18
18
  import {
19
- Ellipsis,
20
19
  fileHyperlink,
21
20
  getTreeBranch,
22
21
  getTreeContinuePrefix,
23
22
  renderStatusLine,
24
23
  renderTreeList,
25
- truncateToWidth,
26
24
  uriHyperlink,
27
25
  } from "../render";
28
26
  import { tuiText, tuiTextFmt } from "../i18n";
29
27
  import {
30
28
  toPathList,
31
29
  createCachedComponent,
30
+ fitHeaderedRows,
32
31
  formatCount,
33
32
  formatEmptyMessage,
34
33
  formatErrorMessage,
@@ -420,7 +419,7 @@ export const grepToolRenderer = {
420
419
  },
421
420
  uiTheme,
422
421
  );
423
- return [header, ...listLines].map(l => truncateToWidth(l, width, Ellipsis.Omit));
422
+ return fitHeaderedRows(header, listLines, width);
424
423
  },
425
424
  );
426
425
  }
@@ -511,7 +510,7 @@ export const grepToolRenderer = {
511
510
  uiTheme,
512
511
  !options.expanded,
513
512
  );
514
- return [header, ...matchLines, ...extraLines].map(l => truncateToWidth(l, width, Ellipsis.Omit));
513
+ return fitHeaderedRows(header, [...matchLines, ...extraLines], width);
515
514
  },
516
515
  );
517
516
  },
@@ -18,6 +18,8 @@ export interface GroupedFileSection {
18
18
  export interface GroupedFilesOutput {
19
19
  model: string[];
20
20
  display: string[];
21
+ /** Per file, the `model` index just past its last line: a head cut keeping `n` lines shows it whole when this is <= n. */
22
+ modelEnds: Map<string, number>;
21
23
  }
22
24
  /**
23
25
  * Render a list of files as a multi-level, prefix-folded directory tree shared by
@@ -31,6 +31,8 @@ export interface GroupedFileSection {
31
31
  export interface GroupedFilesOutput {
32
32
  model: string[];
33
33
  display: string[];
34
+ /** Per file, the `model` index just past its last line: a head cut keeping `n` lines shows it whole when this is <= n. */
35
+ modelEnds: Map<string, number>;
34
36
  }
35
37
 
36
38
  /**
@@ -66,6 +68,7 @@ export function formatGroupedFiles(
66
68
  const tree = buildPathTree(inputs);
67
69
  const model: string[] = [];
68
70
  const display: string[] = [];
71
+ const modelEnds = new Map<string, number>();
69
72
  let emitted = false;
70
73
 
71
74
  for (const event of walkPathTree(tree)) {
@@ -86,9 +89,10 @@ export function formatGroupedFiles(
86
89
  const header = `${hashes} ${event.name}${section.headerSuffix ?? ""}`;
87
90
  model.push(header, ...section.modelLines);
88
91
  display.push(header, ...(section.displayLines ?? section.modelLines));
92
+ modelEnds.set(event.key, model.length);
89
93
  }
90
94
 
91
- return { model, display };
95
+ return { model, display, modelEnds };
92
96
  }
93
97
 
94
98
  /** One file's rendered search matches, plus its hashline tag when editable. */
@@ -122,6 +126,7 @@ export function formatFileMatches(
122
126
  }
123
127
  const model: string[] = [];
124
128
  const display: string[] = [];
129
+ const modelEnds = new Map<string, number>();
125
130
  for (const filePath of files) {
126
131
  const rendered = renderFile(filePath);
127
132
  if (rendered.model.length === 0) continue;
@@ -132,8 +137,9 @@ export function formatFileMatches(
132
137
  if (rendered.tag) model.push(formatHashlineHeader(filePath, rendered.tag));
133
138
  model.push(...rendered.model);
134
139
  display.push(...rendered.display);
140
+ modelEnds.set(filePath, model.length);
135
141
  }
136
- return { model, display };
142
+ return { model, display, modelEnds };
137
143
  }
138
144
 
139
145
  // =============================================================================
@@ -22,12 +22,12 @@ export declare function renderMCPResult(result: {
22
22
  details?: MCPToolDetails;
23
23
  isError?: boolean;
24
24
  }, options: RenderResultOptions, theme: Theme, args?: Record<string, unknown>): Component;
25
- /** Native MCP call view: the head only, inline while pending. */
25
+ /** Native MCP call view: the head plus the folded args, inline while pending. */
26
26
  export declare function describeMCPCall(args: Record<string, unknown>, label: string): NativeToolView;
27
27
  /**
28
28
  * Native MCP result view: JSON output as a JSON tree, Markdown when the
29
- * preference is on, otherwise the raw text as tool output. The head's args
30
- * summary stands in for the ANSI card's Args tree.
29
+ * preference is on, otherwise the raw text as tool output; the folded Args
30
+ * section follows, so the collapsed preview still leads with the output.
31
31
  */
32
32
  export declare function describeMCPResult(result: {
33
33
  content: Array<{
package/src/tools/mcp.ts CHANGED
@@ -9,8 +9,8 @@ import { type Component, Markdown } from "../index";
9
9
  import type { NativeToolHead, NativeToolView, RenderResultOptions } from "./renderer";
10
10
  import { isRecord, sanitizeText } from "@linxiraos/pi-utils";
11
11
  import { INTENT_FIELD } from "@linxiraos/pi-wire";
12
- import { ansi, md } from "../native/describe";
13
- import type { NativeChild } from "../native/node";
12
+ import { ansi, md, node, span } from "../native/describe";
13
+ import type { NativeChild, NativeNode } from "../native/node";
14
14
  import { OwnerMemo } from "../native/memo";
15
15
  import { plainText } from "../native/spans";
16
16
  import { errorText, noteText, truncationNotice } from "./native-view";
@@ -291,8 +291,7 @@ function visibleMcpArgs(args: Record<string, unknown> | undefined): [string, unk
291
291
  const MCP_ARGS_SUMMARY_CHARS = 160;
292
292
 
293
293
  /** Native MCP head: the tool title with a one-line args summary as target. */
294
- function mcpHead(title: string, args: Record<string, unknown> | undefined): NativeToolHead {
295
- const entries = visibleMcpArgs(args);
294
+ function mcpHead(title: string, entries: readonly [string, unknown][]): NativeToolHead {
296
295
  const summary =
297
296
  entries.length > 0
298
297
  ? formatArgsInline(Object.fromEntries(entries), MCP_ARGS_SUMMARY_CHARS, { characterBudget: true })
@@ -300,17 +299,33 @@ function mcpHead(title: string, args: Record<string, unknown> | undefined): Nati
300
299
  return { title, target: summary ? plainText(summary) : undefined, targetKind: "text" };
301
300
  }
302
301
 
303
- /** Native MCP call view: the head only, inline while pending. */
302
+ /**
303
+ * Native counterpart of the ANSI card's Args tree: the complete arguments,
304
+ * folded under an `Args` section because the head summary clips each value.
305
+ */
306
+ function mcpArgsSection(entries: readonly [string, unknown][]): NativeNode | undefined {
307
+ if (entries.length === 0) return undefined;
308
+ return node(
309
+ "section",
310
+ { head: [span("Args", "muted")], collapsible: true, collapsed: true },
311
+ [describeJsonTree(Object.fromEntries(entries))],
312
+ "args",
313
+ );
314
+ }
315
+
316
+ /** Native MCP call view: the head plus the folded args, inline while pending. */
304
317
  export function describeMCPCall(args: Record<string, unknown>, label: string): NativeToolView {
305
- return { tool: mcpHead(label, args), inline: true };
318
+ const entries = visibleMcpArgs(args);
319
+ const section = mcpArgsSection(entries);
320
+ return { tool: mcpHead(label, entries), body: section ? [section] : undefined, inline: true };
306
321
  }
307
322
 
308
323
  const mcpResultMemo = new OwnerMemo<NativeToolView | undefined>();
309
324
 
310
325
  /**
311
326
  * Native MCP result view: JSON output as a JSON tree, Markdown when the
312
- * preference is on, otherwise the raw text as tool output. The head's args
313
- * summary stands in for the ANSI card's Args tree.
327
+ * preference is on, otherwise the raw text as tool output; the folded Args
328
+ * section follows, so the collapsed preview still leads with the output.
314
329
  */
315
330
  export function describeMCPResult(
316
331
  result: { content: Array<{ type: string; text?: string }>; details?: MCPToolDetails; isError?: boolean },
@@ -345,8 +360,11 @@ export function describeMCPResult(
345
360
  else body.push(ansi(output));
346
361
  const warning = truncationNotice(result.details?.meta);
347
362
  if (warning) body.push(warning);
363
+ const entries = visibleMcpArgs(args);
364
+ const section = mcpArgsSection(entries);
365
+ if (section) body.push(section);
348
366
  return {
349
- tool: mcpHead(title, args),
367
+ tool: mcpHead(title, entries),
350
368
  tone: isError ? "error" : undefined,
351
369
  body,
352
370
  preview: { lines: 4 },
@@ -4,10 +4,10 @@
4
4
  * semantic nodes/spans only, with ANSI-free, sanitized text.
5
5
  */
6
6
  import * as path from "node:path";
7
- import { pathToFileURL } from "node:url";
8
7
  import type { TspSpan, TspText, TspTone } from "@linxiraos/pi-wire";
9
8
  import { ansi, code, compact, keyed, node, row, span, text } from "../native/describe";
10
9
  import type { NativeChild, NativeNode } from "../native/node";
10
+ import { tryFileUri } from "../render/hyperlink";
11
11
  import { type ParsedDiagnostic, parseDiagnosticMessage, shortenPath } from "../render/render-utils";
12
12
  import { plainText } from "../native/spans";
13
13
  import type { FileDiagnosticsResult } from "./lsp";
@@ -25,7 +25,7 @@ export function displayPath(filePath: string): string {
25
25
 
26
26
  /** `file://` link for a head's path target, when the path is absolute. */
27
27
  export function fileHref(filePath: string | undefined): string | undefined {
28
- return filePath && path.isAbsolute(filePath) ? pathToFileURL(filePath).href : undefined;
28
+ return filePath && path.isAbsolute(filePath) ? tryFileUri(filePath) : undefined;
29
29
  }
30
30
 
31
31
  /** Diff stats as one head `meta` string, `+8 −1` (U+2212 minus), or undefined when nothing changed. */
@@ -29,7 +29,10 @@ export interface ReadToolDetails {
29
29
  suffixResolution?: {
30
30
  from: string;
31
31
  to: string;
32
+ raw?: boolean;
32
33
  };
34
+ /** Raw source output keeps descriptive diagnostics in details, not in the body. */
35
+ raw?: boolean;
33
36
  url?: string;
34
37
  finalUrl?: string;
35
38
  contentType?: string;