@letrquan/book 0.3.0 → 0.4.0-beta.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 (148) hide show
  1. package/CHANGELOG.md +1024 -0
  2. package/README.md +6 -3
  3. package/dist/{additional-roots-H7UNAEHS.js → additional-roots-VAWRQ625.js} +8 -7
  4. package/dist/{app-GE4OHJOC.js → app-J7BVPSUH.js} +5397 -2953
  5. package/dist/app-J7BVPSUH.js.map +1 -0
  6. package/dist/chunk-32WBCUAN.js +660 -0
  7. package/dist/chunk-32WBCUAN.js.map +1 -0
  8. package/dist/{chunk-525CAZPY.js → chunk-4DKHLZRI.js} +6 -6
  9. package/dist/{chunk-4AS7LKKQ.js → chunk-62EEAUID.js} +2 -2
  10. package/dist/{chunk-AQEQX4FF.js → chunk-AHC7OU75.js} +385 -55
  11. package/dist/chunk-AHC7OU75.js.map +1 -0
  12. package/dist/{chunk-EFJ2NH6E.js → chunk-AJZWLKLQ.js} +63 -14
  13. package/dist/chunk-AJZWLKLQ.js.map +1 -0
  14. package/dist/chunk-B5FC3MYZ.js +395 -0
  15. package/dist/chunk-B5FC3MYZ.js.map +1 -0
  16. package/dist/{chunk-67UZEWWF.js → chunk-DNFQTSMJ.js} +53 -11
  17. package/dist/chunk-DNFQTSMJ.js.map +1 -0
  18. package/dist/{chunk-TLX3H2CL.js → chunk-E5WLQSKA.js} +231 -40
  19. package/dist/chunk-E5WLQSKA.js.map +1 -0
  20. package/dist/chunk-ECLC4CIJ.js +1181 -0
  21. package/dist/chunk-ECLC4CIJ.js.map +1 -0
  22. package/dist/chunk-EEX6QNXV.js +127 -0
  23. package/dist/chunk-EEX6QNXV.js.map +1 -0
  24. package/dist/chunk-EFXVSQ5J.js +931 -0
  25. package/dist/chunk-EFXVSQ5J.js.map +1 -0
  26. package/dist/{chunk-RFJ6Q6LE.js → chunk-ENLB7NYV.js} +577 -164
  27. package/dist/chunk-ENLB7NYV.js.map +1 -0
  28. package/dist/{chunk-IME7R2UI.js → chunk-FPR7SKIE.js} +1268 -883
  29. package/dist/chunk-FPR7SKIE.js.map +1 -0
  30. package/dist/{chunk-VPNLCMVR.js → chunk-HFB74CLM.js} +13 -5
  31. package/dist/chunk-HFB74CLM.js.map +1 -0
  32. package/dist/{chunk-5RDRAO4B.js → chunk-HOZXKOE3.js} +37 -1
  33. package/dist/chunk-HOZXKOE3.js.map +1 -0
  34. package/dist/chunk-IDYWN37T.js +36 -0
  35. package/dist/chunk-IDYWN37T.js.map +1 -0
  36. package/dist/{chunk-YC6W4EJH.js → chunk-JGF5HLSI.js} +193 -75
  37. package/dist/chunk-JGF5HLSI.js.map +1 -0
  38. package/dist/{chunk-5YHTKWJN.js → chunk-KDNWMKXV.js} +2447 -907
  39. package/dist/chunk-KDNWMKXV.js.map +1 -0
  40. package/dist/{chunk-Y2VHN7TC.js → chunk-MEOB2DZA.js} +11 -1
  41. package/dist/chunk-MEOB2DZA.js.map +1 -0
  42. package/dist/{chunk-KBQS35OV.js → chunk-MV5PQNIA.js} +2 -2
  43. package/dist/chunk-N2G4Q7ME.js +2672 -0
  44. package/dist/chunk-N2G4Q7ME.js.map +1 -0
  45. package/dist/{chunk-62QL5QUP.js → chunk-OJBMDM5H.js} +17 -1
  46. package/dist/chunk-OJBMDM5H.js.map +1 -0
  47. package/dist/{chunk-56SIEMDX.js → chunk-PTDC7ZUP.js} +2 -2
  48. package/dist/{chunk-X4NJT436.js → chunk-REASC2QG.js} +67 -28
  49. package/dist/chunk-REASC2QG.js.map +1 -0
  50. package/dist/chunk-SBTU5BEC.js +114 -0
  51. package/dist/chunk-SBTU5BEC.js.map +1 -0
  52. package/dist/{chunk-HQI7NYGX.js → chunk-SWPDKLNM.js} +2 -2
  53. package/dist/{chunk-W3XFHEF4.js → chunk-UCFJ43OS.js} +140 -28
  54. package/dist/chunk-UCFJ43OS.js.map +1 -0
  55. package/dist/{chunk-QYBD22H5.js → chunk-W7SLYS3M.js} +80 -16
  56. package/dist/chunk-W7SLYS3M.js.map +1 -0
  57. package/dist/{chunk-SOW4WRQP.js → chunk-WV3O5PGX.js} +3 -3
  58. package/dist/{chunk-JTPOI3KU.js → chunk-XJRJVXJR.js} +262 -38
  59. package/dist/chunk-XJRJVXJR.js.map +1 -0
  60. package/dist/{chunk-224FJZLH.js → chunk-YIL6HTJX.js} +228 -5
  61. package/dist/chunk-YIL6HTJX.js.map +1 -0
  62. package/dist/{command-approvals-VBIU6BLM.js → command-approvals-ZRY66LCW.js} +5 -4
  63. package/dist/context-C3RAP6K5.js +41 -0
  64. package/dist/{hook-approvals-ZVT4V7IM.js → hook-approvals-DPQD5H65.js} +5 -4
  65. package/dist/index.js +657 -754
  66. package/dist/index.js.map +1 -1
  67. package/dist/{interactive-assets-T4I4SEHU.js → interactive-assets-73AQO5WP.js} +11 -6
  68. package/dist/{interactive-assets-T4I4SEHU.js.map → interactive-assets-73AQO5WP.js.map} +1 -1
  69. package/dist/job-runner.js +10 -3
  70. package/dist/job-runner.js.map +1 -1
  71. package/dist/job-supervisor.js +13 -4
  72. package/dist/job-supervisor.js.map +1 -1
  73. package/dist/loader-DQNPDKOX.js +27 -0
  74. package/dist/{mcp-approvals-HJ2VDYMC.js → mcp-approvals-27LJYADQ.js} +5 -4
  75. package/dist/{mcp-config-RNB5LEVE.js → mcp-config-GXSODNCM.js} +3 -2
  76. package/dist/memory-store-I6Z54VUN.js +51 -0
  77. package/dist/{model-window-store-MTSQ5JDJ.js → model-window-store-6VKXXTPJ.js} +4 -3
  78. package/dist/{openai-compatible-2OB54YST.js → openai-compatible-IPUNBJ53.js} +5 -3
  79. package/dist/{permission-approvals-YLV6UC5W.js → permission-approvals-Q5IMFEZI.js} +5 -4
  80. package/dist/{permissions-DHOKF3W2.js → permissions-7Y35X6HZ.js} +26 -9
  81. package/dist/provider-approvals-5AGH3RVT.js +76 -0
  82. package/dist/{sandbox-WRYTZH3D.js → sandbox-N2RY72GN.js} +6 -5
  83. package/dist/{scrollback-35ME2GFX.js → scrollback-GD76GNM4.js} +36 -28
  84. package/dist/scrollback-GD76GNM4.js.map +1 -0
  85. package/dist/sdk.d.ts +876 -64
  86. package/dist/sdk.js +57 -37
  87. package/dist/sdk.js.map +1 -1
  88. package/dist/settings-loader-KDBH45AQ.js +43 -0
  89. package/dist/{settings-removed-JWWPT4WA.js → settings-removed-3ATWJEF3.js} +2 -2
  90. package/dist/shell-selection-Z5WORZU4.js +31 -0
  91. package/dist/shell-selection-Z5WORZU4.js.map +1 -0
  92. package/package.json +5 -5
  93. package/dist/app-GE4OHJOC.js.map +0 -1
  94. package/dist/chunk-224FJZLH.js.map +0 -1
  95. package/dist/chunk-5RDRAO4B.js.map +0 -1
  96. package/dist/chunk-5YHTKWJN.js.map +0 -1
  97. package/dist/chunk-62QL5QUP.js.map +0 -1
  98. package/dist/chunk-67UZEWWF.js.map +0 -1
  99. package/dist/chunk-6OQQOMZR.js +0 -785
  100. package/dist/chunk-6OQQOMZR.js.map +0 -1
  101. package/dist/chunk-AQEQX4FF.js.map +0 -1
  102. package/dist/chunk-C7ADUNPR.js +0 -273
  103. package/dist/chunk-C7ADUNPR.js.map +0 -1
  104. package/dist/chunk-EFJ2NH6E.js.map +0 -1
  105. package/dist/chunk-IME7R2UI.js.map +0 -1
  106. package/dist/chunk-J62VZYOB.js +0 -1339
  107. package/dist/chunk-J62VZYOB.js.map +0 -1
  108. package/dist/chunk-JTPOI3KU.js.map +0 -1
  109. package/dist/chunk-QYBD22H5.js.map +0 -1
  110. package/dist/chunk-RFJ6Q6LE.js.map +0 -1
  111. package/dist/chunk-S4JMID4G.js +0 -259
  112. package/dist/chunk-S4JMID4G.js.map +0 -1
  113. package/dist/chunk-TLX3H2CL.js.map +0 -1
  114. package/dist/chunk-VPNLCMVR.js.map +0 -1
  115. package/dist/chunk-W3XFHEF4.js.map +0 -1
  116. package/dist/chunk-X4NJT436.js.map +0 -1
  117. package/dist/chunk-X66I2NQO.js +0 -137
  118. package/dist/chunk-X66I2NQO.js.map +0 -1
  119. package/dist/chunk-Y2VHN7TC.js.map +0 -1
  120. package/dist/chunk-YC6W4EJH.js.map +0 -1
  121. package/dist/context-CBOBDY5Q.js +0 -38
  122. package/dist/loader-S77OVTHH.js +0 -18
  123. package/dist/memory-store-DZUT5HUH.js +0 -75
  124. package/dist/scrollback-35ME2GFX.js.map +0 -1
  125. package/dist/settings-loader-JUNPGAAM.js +0 -35
  126. package/dist/shell-selection-CDHGJ4GC.js +0 -17
  127. /package/dist/{additional-roots-H7UNAEHS.js.map → additional-roots-VAWRQ625.js.map} +0 -0
  128. /package/dist/{chunk-525CAZPY.js.map → chunk-4DKHLZRI.js.map} +0 -0
  129. /package/dist/{chunk-4AS7LKKQ.js.map → chunk-62EEAUID.js.map} +0 -0
  130. /package/dist/{chunk-KBQS35OV.js.map → chunk-MV5PQNIA.js.map} +0 -0
  131. /package/dist/{chunk-56SIEMDX.js.map → chunk-PTDC7ZUP.js.map} +0 -0
  132. /package/dist/{chunk-HQI7NYGX.js.map → chunk-SWPDKLNM.js.map} +0 -0
  133. /package/dist/{chunk-SOW4WRQP.js.map → chunk-WV3O5PGX.js.map} +0 -0
  134. /package/dist/{command-approvals-VBIU6BLM.js.map → command-approvals-ZRY66LCW.js.map} +0 -0
  135. /package/dist/{context-CBOBDY5Q.js.map → context-C3RAP6K5.js.map} +0 -0
  136. /package/dist/{hook-approvals-ZVT4V7IM.js.map → hook-approvals-DPQD5H65.js.map} +0 -0
  137. /package/dist/{loader-S77OVTHH.js.map → loader-DQNPDKOX.js.map} +0 -0
  138. /package/dist/{mcp-approvals-HJ2VDYMC.js.map → mcp-approvals-27LJYADQ.js.map} +0 -0
  139. /package/dist/{mcp-config-RNB5LEVE.js.map → mcp-config-GXSODNCM.js.map} +0 -0
  140. /package/dist/{memory-store-DZUT5HUH.js.map → memory-store-I6Z54VUN.js.map} +0 -0
  141. /package/dist/{model-window-store-MTSQ5JDJ.js.map → model-window-store-6VKXXTPJ.js.map} +0 -0
  142. /package/dist/{openai-compatible-2OB54YST.js.map → openai-compatible-IPUNBJ53.js.map} +0 -0
  143. /package/dist/{permission-approvals-YLV6UC5W.js.map → permission-approvals-Q5IMFEZI.js.map} +0 -0
  144. /package/dist/{permissions-DHOKF3W2.js.map → permissions-7Y35X6HZ.js.map} +0 -0
  145. /package/dist/{sandbox-WRYTZH3D.js.map → provider-approvals-5AGH3RVT.js.map} +0 -0
  146. /package/dist/{settings-loader-JUNPGAAM.js.map → sandbox-N2RY72GN.js.map} +0 -0
  147. /package/dist/{settings-removed-JWWPT4WA.js.map → settings-loader-KDBH45AQ.js.map} +0 -0
  148. /package/dist/{shell-selection-CDHGJ4GC.js.map → settings-removed-3ATWJEF3.js.map} +0 -0
@@ -1,259 +0,0 @@
1
- // src/cli/ink-renderer.ts
2
- import { readFileSync } from "fs";
3
- import { createRequire } from "module";
4
- import { dirname, join } from "path";
5
- import { pathToFileURL } from "url";
6
- var INK_TRAILING_NEWLINE_FIX = "ansiEscapes.cursorUp(previousLines.length - 1)";
7
- function inkBuildDir(from = import.meta.url) {
8
- const require2 = createRequire(from);
9
- return dirname(require2.resolve("ink"));
10
- }
11
- function inkLogUpdatePath(from) {
12
- return join(inkBuildDir(from), "log-update.js");
13
- }
14
- function hasInkTrailingNewlineFix(from) {
15
- try {
16
- return readFileSync(inkLogUpdatePath(from), "utf8").includes(INK_TRAILING_NEWLINE_FIX);
17
- } catch {
18
- return false;
19
- }
20
- }
21
- async function wrapInkLogUpdate(wrap) {
22
- try {
23
- const module = await import(pathToFileURL(inkLogUpdatePath()).href);
24
- const logUpdate = module.default;
25
- logUpdate.create = wrap(logUpdate.create);
26
- return true;
27
- } catch {
28
- return false;
29
- }
30
- }
31
-
32
- // src/cli/ink-scroll-renderer.ts
33
- var pendingHint = null;
34
- var rendererInstalled = false;
35
- function isInkScrollRendererEnabled(value) {
36
- return value === "on";
37
- }
38
- function setTranscriptScrollHint(hint) {
39
- if (!Number.isFinite(hint.delta) || hint.delta === 0) return;
40
- if (pendingHint && pendingHint.top === hint.top && pendingHint.bottom === hint.bottom && Math.sign(pendingHint.delta) === Math.sign(hint.delta)) {
41
- pendingHint = { ...pendingHint, delta: pendingHint.delta + hint.delta };
42
- return;
43
- }
44
- pendingHint = { ...hint };
45
- }
46
- function splitFrame(frame) {
47
- return frame.endsWith("\n") ? frame.slice(0, -1).split("\n") : frame.split("\n");
48
- }
49
- function getFrameEndRow(frame, visibleLineCount) {
50
- return visibleLineCount + (frame.endsWith("\n") ? 1 : 0);
51
- }
52
- function cursorTo(row) {
53
- return `\x1B[${Math.max(1, Math.floor(row))};1H`;
54
- }
55
- function setScrollRegion(top, bottom) {
56
- return `\x1B[${Math.max(1, Math.floor(top))};${Math.max(1, Math.floor(bottom))}r`;
57
- }
58
- function isPureVerticalShift(previousLines, nextLines, hint) {
59
- if (previousLines.length !== nextLines.length) return false;
60
- const top = Math.floor(hint.top) - 1;
61
- const bottom = Math.floor(hint.bottom);
62
- const delta = Math.trunc(hint.delta);
63
- if (top < 0 || bottom > nextLines.length || bottom - top < 2) return false;
64
- if (Math.abs(delta) >= bottom - top) return false;
65
- for (let row = 0; row < top; row++) {
66
- if (previousLines[row] !== nextLines[row]) return false;
67
- }
68
- for (let row = bottom; row < nextLines.length; row++) {
69
- if (previousLines[row] !== nextLines[row]) return false;
70
- }
71
- if (delta > 0) {
72
- for (let row = top; row < bottom - delta; row++) {
73
- if (nextLines[row] !== previousLines[row + delta]) return false;
74
- }
75
- } else {
76
- const distance = Math.abs(delta);
77
- for (let row = top + distance; row < bottom; row++) {
78
- if (nextLines[row] !== previousLines[row - distance]) return false;
79
- }
80
- }
81
- return true;
82
- }
83
- function writeExposedRows(stream, lines, top, bottom, delta) {
84
- const distance = Math.abs(delta);
85
- const first = delta > 0 ? bottom - distance : top;
86
- for (let offset = 0; offset < distance; offset++) {
87
- const row = first + offset;
88
- stream.write(cursorTo(row + 1) + (lines[row] ?? "") + "\x1B[K");
89
- }
90
- }
91
- function createScrollAwareRenderer(stream, options, createBase) {
92
- const base = createBase(stream, options);
93
- let previousFrame = "";
94
- const render = ((output) => {
95
- const hint = pendingHint;
96
- pendingHint = null;
97
- const previousLines = splitFrame(previousFrame);
98
- const nextLines = splitFrame(output);
99
- const terminalRows = stream.rows ?? 0;
100
- const frameEndRow = getFrameEndRow(output, nextLines.length);
101
- const canScroll = Boolean(stream.isTTY) && terminalRows > 0 && frameEndRow <= terminalRows && previousFrame.length > 0 && hint !== null && hint.bottom <= nextLines.length && isPureVerticalShift(previousLines, nextLines, hint);
102
- if (canScroll && hint) {
103
- const top = Math.floor(hint.top);
104
- const bottom = Math.floor(hint.bottom);
105
- const delta = Math.trunc(hint.delta);
106
- stream.write("\x1B[?25l" + setScrollRegion(top, bottom));
107
- stream.write(`\x1B[${Math.abs(delta)}${delta > 0 ? "S" : "T"}`);
108
- writeExposedRows(stream, nextLines, top - 1, bottom, delta);
109
- stream.write(setScrollRegion(1, terminalRows) + cursorTo(frameEndRow));
110
- previousFrame = output;
111
- base.sync(output);
112
- return true;
113
- }
114
- previousFrame = output;
115
- return base(output);
116
- });
117
- render.clear = () => {
118
- pendingHint = null;
119
- previousFrame = "";
120
- base.clear();
121
- };
122
- render.done = () => {
123
- pendingHint = null;
124
- previousFrame = "";
125
- base.done();
126
- };
127
- render.reset = () => {
128
- pendingHint = null;
129
- previousFrame = "";
130
- base.reset?.();
131
- };
132
- render.sync = (output) => {
133
- pendingHint = null;
134
- previousFrame = output;
135
- base.sync(output);
136
- };
137
- render.setCursorPosition = (position) => base.setCursorPosition(position);
138
- render.isCursorDirty = () => base.isCursorDirty();
139
- render.willRender = (output) => {
140
- const shouldRender = base.willRender(output);
141
- if (!shouldRender) pendingHint = null;
142
- return shouldRender;
143
- };
144
- return render;
145
- }
146
- async function installInkScrollRenderer(enabled) {
147
- if (rendererInstalled) return;
148
- if (!(enabled ?? isInkScrollRendererEnabled(process.env.BOOK_SCROLL_RENDERER))) return;
149
- rendererInstalled = true;
150
- await wrapInkLogUpdate(
151
- (createBase) => (stream, options) => createScrollAwareRenderer(stream, options, createBase)
152
- );
153
- }
154
-
155
- // src/cli/frame-buffer.ts
156
- var latestFrame = "";
157
- var lastCursorPosition = null;
158
- var captureInstalled = false;
159
- var frameUpdateListeners = /* @__PURE__ */ new Set();
160
- function notifyFrameUpdate() {
161
- for (const listener of frameUpdateListeners) {
162
- try {
163
- listener();
164
- } catch {
165
- }
166
- }
167
- }
168
- function splitFrame2(frame) {
169
- return frame.endsWith("\n") ? frame.slice(0, -1).split("\n") : frame.split("\n");
170
- }
171
- function toCursorPosition(position) {
172
- if (!position || typeof position !== "object") return null;
173
- const candidate = position;
174
- if (typeof candidate.x !== "number" || typeof candidate.y !== "number") return null;
175
- return { x: candidate.x, y: candidate.y };
176
- }
177
- function getFrameLines() {
178
- return latestFrame.length === 0 ? [] : splitFrame2(latestFrame);
179
- }
180
- function getLastCursorPosition() {
181
- return lastCursorPosition;
182
- }
183
- function subscribeToFrameUpdates(listener) {
184
- frameUpdateListeners.add(listener);
185
- return () => frameUpdateListeners.delete(listener);
186
- }
187
- function createFrameCapturingRenderer(stream, options, createBase) {
188
- const base = createBase(stream, options);
189
- const render = ((output) => {
190
- latestFrame = output;
191
- const rendered = base(output);
192
- if (rendered !== false) notifyFrameUpdate();
193
- return rendered;
194
- });
195
- render.clear = () => {
196
- latestFrame = "";
197
- base.clear();
198
- };
199
- render.done = () => {
200
- latestFrame = "";
201
- lastCursorPosition = null;
202
- base.done();
203
- };
204
- render.reset = () => {
205
- latestFrame = "";
206
- base.reset?.();
207
- };
208
- render.sync = (output) => {
209
- latestFrame = output;
210
- base.sync(output);
211
- notifyFrameUpdate();
212
- };
213
- render.setCursorPosition = (position) => {
214
- lastCursorPosition = toCursorPosition(position);
215
- base.setCursorPosition(position);
216
- };
217
- render.isCursorDirty = () => base.isCursorDirty();
218
- render.willRender = (output) => base.willRender(output);
219
- return render;
220
- }
221
- async function installFrameCapture() {
222
- if (captureInstalled) return;
223
- captureInstalled = true;
224
- await wrapInkLogUpdate(
225
- (createBase) => (stream, options) => createFrameCapturingRenderer(stream, options, createBase)
226
- );
227
- }
228
-
229
- // src/cli/tui-renderer-mode.ts
230
- function resolveTuiRendererMode(value = process.env.BOOK_TUI_RENDERER, context = {}) {
231
- if (context.isTTY === false || context.screenReader) return "safe";
232
- if (context.incrementalRendererFixed === false) return "safe";
233
- if (value === "incremental") return "incremental";
234
- if (value === "experimental-scroll") return "experimental-scroll";
235
- if (value === void 0) return context.platform === "win32" ? "safe" : "incremental";
236
- return "safe";
237
- }
238
- function isCiEnvironment(env = process.env) {
239
- const set = (key) => key in env && env[key] !== "0" && env[key] !== "false";
240
- return set("CI") || set("CONTINUOUS_INTEGRATION");
241
- }
242
- function resolveInkMaxFps(platform = process.platform) {
243
- return platform === "win32" ? 72 : 60;
244
- }
245
-
246
- export {
247
- inkBuildDir,
248
- hasInkTrailingNewlineFix,
249
- setTranscriptScrollHint,
250
- installInkScrollRenderer,
251
- getFrameLines,
252
- getLastCursorPosition,
253
- subscribeToFrameUpdates,
254
- installFrameCapture,
255
- resolveTuiRendererMode,
256
- isCiEnvironment,
257
- resolveInkMaxFps
258
- };
259
- //# sourceMappingURL=chunk-S4JMID4G.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/cli/ink-renderer.ts","../src/cli/ink-scroll-renderer.ts","../src/cli/frame-buffer.ts","../src/cli/tui-renderer-mode.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\n/**\n * The Ink release whose renderer Book's TUI was last verified against. A dependency bump changes\n * `package.json` but not this constant, so the contract test and `npm run verify:ink` fail until\n * someone re-verifies the TUI (docs/guide/development.md, \"Upgrading Ink\") and updates it.\n */\nexport const VERIFIED_INK_VERSION = '7.1.1';\n\n/**\n * The incremental renderer's cursor rewind with Ink's trailing-newline fix (upstream issue 909,\n * shipped in Ink 7.0.0). Without it, a frame that ends in a newline rewinds one row short and\n * later updates land below their rows.\n */\nconst INK_TRAILING_NEWLINE_FIX = 'ansiEscapes.cursorUp(previousLines.length - 1)';\n\n/** The subset of a writable terminal stream Ink's renderer writes through. */\nexport interface InkStream {\n isTTY?: boolean;\n rows?: number;\n write: (data: string) => unknown;\n}\n\n/** Ink's private log-update renderer. Ink 7 added `reset()`; every wrapper must forward it. */\nexport interface LogUpdateRenderer {\n (output: string): boolean | void;\n clear: () => void;\n done: () => void;\n reset?: () => void;\n sync: (output: string) => void;\n setCursorPosition: (position: unknown) => void;\n isCursorDirty: () => boolean;\n willRender: (output: string) => boolean;\n}\n\nexport type CreateLogUpdate = (\n stream: InkStream,\n options?: { incremental?: boolean },\n) => LogUpdateRenderer;\n\n/** Ink's build directory, where its private modules live. Throws when Ink cannot be resolved. */\nexport function inkBuildDir(from: string | URL = import.meta.url): string {\n const require = createRequire(from);\n return dirname(require.resolve('ink'));\n}\n\n/**\n * Ink's private log-update module: the renderer the TUI wraps for frame capture and scroll hints,\n * and the file whose trailing-newline fix decides the renderer mode. Throws when Ink cannot be\n * resolved. `from` is the module Ink is resolved from.\n */\nexport function inkLogUpdatePath(from?: string | URL): string {\n return join(inkBuildDir(from), 'log-update.js');\n}\n\n/** The installed Ink version, or undefined when Ink cannot be resolved. `from` is the module Ink is resolved from. */\nexport function installedInkVersion(from?: string | URL): string | undefined {\n try {\n const manifest = JSON.parse(\n readFileSync(join(inkBuildDir(from), '..', 'package.json'), 'utf8'),\n ) as {\n version?: unknown;\n };\n return typeof manifest.version === 'string' ? manifest.version : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** Incremental rendering is safe only when Ink's renderer carries the trailing-newline fix. `from` is the module Ink is resolved from. */\nexport function hasInkTrailingNewlineFix(from?: string | URL): boolean {\n try {\n return readFileSync(inkLogUpdatePath(from), 'utf8').includes(INK_TRAILING_NEWLINE_FIX);\n } catch {\n return false;\n }\n}\n\n/**\n * Replaces Ink's private `logUpdate.create` with `wrap(original)`, so every renderer Ink creates\n * afterwards goes through the wrapper. Returns false, leaving Ink's renderer in place, when Ink's\n * module layout has changed.\n */\nexport async function wrapInkLogUpdate(\n wrap: (createBase: CreateLogUpdate) => CreateLogUpdate,\n): Promise<boolean> {\n try {\n const module = (await import(pathToFileURL(inkLogUpdatePath()).href)) as {\n default: { create: CreateLogUpdate };\n };\n const logUpdate = module.default;\n logUpdate.create = wrap(logUpdate.create);\n return true;\n } catch {\n return false;\n }\n}\n","import {\n wrapInkLogUpdate,\n type CreateLogUpdate,\n type InkStream,\n type LogUpdateRenderer,\n} from './ink-renderer.js';\n\nexport interface TranscriptScrollHint {\n top: number;\n bottom: number;\n delta: number;\n}\n\nlet pendingHint: TranscriptScrollHint | null = null;\nlet rendererInstalled = false;\n\nexport function isInkScrollRendererEnabled(value?: string): boolean {\n return value === 'on';\n}\n\nexport function setTranscriptScrollHint(hint: TranscriptScrollHint): void {\n if (!Number.isFinite(hint.delta) || hint.delta === 0) return;\n if (\n pendingHint &&\n pendingHint.top === hint.top &&\n pendingHint.bottom === hint.bottom &&\n Math.sign(pendingHint.delta) === Math.sign(hint.delta)\n ) {\n pendingHint = { ...pendingHint, delta: pendingHint.delta + hint.delta };\n return;\n }\n pendingHint = { ...hint };\n}\n\nfunction splitFrame(frame: string): string[] {\n return frame.endsWith('\\n') ? frame.slice(0, -1).split('\\n') : frame.split('\\n');\n}\n\nfunction getFrameEndRow(frame: string, visibleLineCount: number): number {\n return visibleLineCount + (frame.endsWith('\\n') ? 1 : 0);\n}\n\nfunction cursorTo(row: number): string {\n return `\\x1b[${Math.max(1, Math.floor(row))};1H`;\n}\n\nfunction setScrollRegion(top: number, bottom: number): string {\n return `\\x1b[${Math.max(1, Math.floor(top))};${Math.max(1, Math.floor(bottom))}r`;\n}\n\nexport function isPureVerticalShift(\n previousLines: readonly string[],\n nextLines: readonly string[],\n hint: TranscriptScrollHint,\n): boolean {\n if (previousLines.length !== nextLines.length) return false;\n const top = Math.floor(hint.top) - 1;\n const bottom = Math.floor(hint.bottom);\n const delta = Math.trunc(hint.delta);\n if (top < 0 || bottom > nextLines.length || bottom - top < 2) return false;\n if (Math.abs(delta) >= bottom - top) return false;\n\n for (let row = 0; row < top; row++) {\n if (previousLines[row] !== nextLines[row]) return false;\n }\n for (let row = bottom; row < nextLines.length; row++) {\n if (previousLines[row] !== nextLines[row]) return false;\n }\n\n if (delta > 0) {\n for (let row = top; row < bottom - delta; row++) {\n if (nextLines[row] !== previousLines[row + delta]) return false;\n }\n } else {\n const distance = Math.abs(delta);\n for (let row = top + distance; row < bottom; row++) {\n if (nextLines[row] !== previousLines[row - distance]) return false;\n }\n }\n return true;\n}\n\nfunction writeExposedRows(\n stream: InkStream,\n lines: readonly string[],\n top: number,\n bottom: number,\n delta: number,\n): void {\n const distance = Math.abs(delta);\n const first = delta > 0 ? bottom - distance : top;\n for (let offset = 0; offset < distance; offset++) {\n const row = first + offset;\n stream.write(cursorTo(row + 1) + (lines[row] ?? '') + '\\x1b[K');\n }\n}\n\nfunction createScrollAwareRenderer(\n stream: InkStream,\n options: { incremental?: boolean } | undefined,\n createBase: CreateLogUpdate,\n): LogUpdateRenderer {\n const base = createBase(stream, options);\n let previousFrame = '';\n\n const render = ((output: string) => {\n const hint = pendingHint;\n pendingHint = null;\n const previousLines = splitFrame(previousFrame);\n const nextLines = splitFrame(output);\n const terminalRows = stream.rows ?? 0;\n const frameEndRow = getFrameEndRow(output, nextLines.length);\n const canScroll =\n Boolean(stream.isTTY) &&\n terminalRows > 0 &&\n frameEndRow <= terminalRows &&\n previousFrame.length > 0 &&\n hint !== null &&\n hint.bottom <= nextLines.length &&\n isPureVerticalShift(previousLines, nextLines, hint);\n\n if (canScroll && hint) {\n const top = Math.floor(hint.top);\n const bottom = Math.floor(hint.bottom);\n const delta = Math.trunc(hint.delta);\n stream.write('\\x1b[?25l' + setScrollRegion(top, bottom));\n stream.write(`\\x1b[${Math.abs(delta)}${delta > 0 ? 'S' : 'T'}`);\n writeExposedRows(stream, nextLines, top - 1, bottom, delta);\n // Ink's sync() positions the input cursor relative to the frame bottom.\n // Re-anchor there first so its cursor suffix cannot repaint the prompt on\n // a transcript row after a terminal-native scroll.\n stream.write(setScrollRegion(1, terminalRows) + cursorTo(frameEndRow));\n previousFrame = output;\n base.sync(output);\n return true;\n }\n\n previousFrame = output;\n return base(output);\n }) as LogUpdateRenderer;\n\n render.clear = () => {\n pendingHint = null;\n previousFrame = '';\n base.clear();\n };\n render.done = () => {\n pendingHint = null;\n previousFrame = '';\n base.done();\n };\n render.reset = () => {\n pendingHint = null;\n previousFrame = '';\n base.reset?.();\n };\n render.sync = (output: string) => {\n pendingHint = null;\n previousFrame = output;\n base.sync(output);\n };\n render.setCursorPosition = (position: unknown) => base.setCursorPosition(position);\n render.isCursorDirty = () => base.isCursorDirty();\n render.willRender = (output: string) => {\n const shouldRender = base.willRender(output);\n if (!shouldRender) pendingHint = null;\n return shouldRender;\n };\n return render;\n}\n\nexport async function installInkScrollRenderer(enabled?: boolean): Promise<void> {\n if (rendererInstalled) return;\n // DECSTBM/CSI S/T rendering remains available for profiling, but Windows\n // ConPTY can corrupt fixed footer rows after a later incremental repaint.\n if (!(enabled ?? isInkScrollRendererEnabled(process.env.BOOK_SCROLL_RENDERER))) return;\n rendererInstalled = true;\n\n // Keep Ink's built-in renderer when its internal module layout changes:\n // wrapInkLogUpdate reports false and leaves Ink's own renderer in place.\n await wrapInkLogUpdate(\n (createBase) => (stream, options) => createScrollAwareRenderer(stream, options, createBase),\n );\n}\n","import {\n wrapInkLogUpdate,\n type CreateLogUpdate,\n type InkStream,\n type LogUpdateRenderer,\n} from './ink-renderer.js';\n\nexport interface FrameCursorPosition {\n x: number;\n y: number;\n}\n\nlet latestFrame = '';\nlet lastCursorPosition: FrameCursorPosition | null = null;\nlet captureInstalled = false;\nconst frameUpdateListeners = new Set<() => void>();\n\nfunction notifyFrameUpdate(): void {\n for (const listener of frameUpdateListeners) {\n try {\n listener();\n } catch {\n // A terminal overlay must never break Ink's renderer.\n }\n }\n}\n\nfunction splitFrame(frame: string): string[] {\n return frame.endsWith('\\n') ? frame.slice(0, -1).split('\\n') : frame.split('\\n');\n}\n\nfunction toCursorPosition(position: unknown): FrameCursorPosition | null {\n if (!position || typeof position !== 'object') return null;\n const candidate = position as { x?: unknown; y?: unknown };\n if (typeof candidate.x !== 'number' || typeof candidate.y !== 'number') return null;\n return { x: candidate.x, y: candidate.y };\n}\n\n/** Lines of the most recently rendered full-screen frame. */\nexport function getFrameLines(): string[] {\n return latestFrame.length === 0 ? [] : splitFrame(latestFrame);\n}\n\n/** Last cursor position Ink asked the renderer to restore, if any. */\nexport function getLastCursorPosition(): FrameCursorPosition | null {\n return lastCursorPosition;\n}\n\n/** Subscribe to completed Ink frame writes, used to preserve terminal overlays. */\nexport function subscribeToFrameUpdates(listener: () => void): () => void {\n frameUpdateListeners.add(listener);\n return () => frameUpdateListeners.delete(listener);\n}\n\n/** Override the captured snapshot. Used by focused selection tests. */\nexport function setFrameSnapshotForTesting(\n frame: string | null,\n cursor: FrameCursorPosition | null = null,\n): void {\n latestFrame = frame ?? '';\n lastCursorPosition = cursor;\n}\n\nexport function createFrameCapturingRenderer(\n stream: InkStream,\n options: { incremental?: boolean } | undefined,\n createBase: CreateLogUpdate,\n): LogUpdateRenderer {\n const base = createBase(stream, options);\n\n const render = ((output: string) => {\n latestFrame = output;\n const rendered = base(output);\n if (rendered !== false) notifyFrameUpdate();\n return rendered;\n }) as LogUpdateRenderer;\n\n render.clear = () => {\n latestFrame = '';\n base.clear();\n };\n render.done = () => {\n latestFrame = '';\n lastCursorPosition = null;\n base.done();\n };\n // Ink 7 resets its renderer's memory of the last frame after handing the terminal to a child.\n render.reset = () => {\n latestFrame = '';\n base.reset?.();\n };\n render.sync = (output: string) => {\n latestFrame = output;\n base.sync(output);\n notifyFrameUpdate();\n };\n render.setCursorPosition = (position: unknown) => {\n lastCursorPosition = toCursorPosition(position);\n base.setCursorPosition(position);\n };\n render.isCursorDirty = () => base.isCursorDirty();\n render.willRender = (output: string) => base.willRender(output);\n return render;\n}\n\n/** Capture Ink's latest full frame so mouse selection can extract visible text. */\nexport async function installFrameCapture(): Promise<void> {\n if (captureInstalled) return;\n captureInstalled = true;\n\n // Keep the TUI usable if Ink changes its private renderer layout: wrapInkLogUpdate reports\n // false and leaves Ink's own renderer in place.\n await wrapInkLogUpdate(\n (createBase) => (stream, options) => createFrameCapturingRenderer(stream, options, createBase),\n );\n}\n","export type TuiRendererMode = 'safe' | 'incremental' | 'experimental-scroll';\n\ninterface TuiRendererContext {\n isTTY?: boolean;\n screenReader?: boolean;\n incrementalRendererFixed?: boolean;\n platform?: NodeJS.Platform;\n}\n\nexport function resolveTuiRendererMode(\n value = process.env.BOOK_TUI_RENDERER,\n context: TuiRendererContext = {},\n): TuiRendererMode {\n if (context.isTTY === false || context.screenReader) return 'safe';\n if (context.incrementalRendererFixed === false) return 'safe';\n if (value === 'incremental') return 'incremental';\n if (value === 'experimental-scroll') return 'experimental-scroll';\n if (value === undefined) return context.platform === 'win32' ? 'safe' : 'incremental';\n return 'safe';\n}\n\n/**\n * Ink 6 rendered live frames unless it detected CI; Ink 7 also requires a TTY stdout. Book runs its\n * TUI on a non-TTY stdout when a Windows build is launched from WSL, so it passes Ink 6's rule to\n * `render({ interactive })` itself. Same test as Ink's `is-in-ci`.\n */\nexport function isCiEnvironment(env: NodeJS.ProcessEnv = process.env): boolean {\n const set = (key: string) => key in env && env[key] !== '0' && env[key] !== 'false';\n return set('CI') || set('CONTINUOUS_INTEGRATION');\n}\n\n/**\n * The frame cap handed to Ink's `render({ maxFps })`. Ink throttles renders to\n * `ceil(1000 / maxFps)` ms, and on Windows libuv timers fire only on the 15.6 ms system tick:\n * the 17 ms that 60 fps asks for waits two ticks (31 ms) and caps the TUI at about 32 fps, so a\n * transcript scrolled with the wheel or a trackpad moves in visible steps. 72 fps asks for\n * 14 ms, which one tick serves. Elsewhere timers are precise and 60 fps means 60.\n */\nexport function resolveInkMaxFps(platform: NodeJS.Platform = process.platform): number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