@visual-z/xeno 0.8.4 → 0.9.1

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 (350) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +31 -746
  3. package/bin/xeno.exe +26 -0
  4. package/install.cjs +88 -0
  5. package/package.json +18 -48
  6. package/docs/app-server.md +0 -115
  7. package/docs/foundations.md +0 -88
  8. package/docs/install.md +0 -244
  9. package/docs/providers.md +0 -172
  10. package/docs/research/foundation-clients-2026-10-09.md +0 -27
  11. package/docs/research/foundation-editing-2026-10-09.md +0 -56
  12. package/docs/research/foundation-network-2026-10-09.md +0 -37
  13. package/docs/research/foundation-workflow-2026-10-09.md +0 -37
  14. package/src/apps/acp-server.ts +0 -41
  15. package/src/apps/agent-profiles.ts +0 -19
  16. package/src/apps/app-server.ts +0 -30
  17. package/src/apps/approve.ts +0 -49
  18. package/src/apps/cli.ts +0 -99
  19. package/src/apps/commands.ts +0 -319
  20. package/src/apps/completions.ts +0 -87
  21. package/src/apps/control-transport.ts +0 -90
  22. package/src/apps/export-cli.ts +0 -24
  23. package/src/apps/goal-flow.ts +0 -70
  24. package/src/apps/image-draft.ts +0 -46
  25. package/src/apps/input.ts +0 -312
  26. package/src/apps/model-catalog.ts +0 -69
  27. package/src/apps/preferences.ts +0 -20
  28. package/src/apps/project-trust.ts +0 -9
  29. package/src/apps/provider-connect.ts +0 -346
  30. package/src/apps/question-ui.ts +0 -27
  31. package/src/apps/render.ts +0 -181
  32. package/src/apps/resources.ts +0 -66
  33. package/src/apps/review.ts +0 -109
  34. package/src/apps/session-hub.ts +0 -96
  35. package/src/apps/session-lifecycle.ts +0 -64
  36. package/src/apps/shell.ts +0 -2071
  37. package/src/apps/startup-input.ts +0 -135
  38. package/src/apps/startup.ts +0 -1677
  39. package/src/apps/ui/app.ts +0 -1818
  40. package/src/apps/ui/control-model.ts +0 -43
  41. package/src/apps/ui/extension-host.ts +0 -194
  42. package/src/apps/ui/image-cache.ts +0 -121
  43. package/src/apps/ui/palette.ts +0 -88
  44. package/src/apps/ui/project.ts +0 -127
  45. package/src/apps/ui/standalone.ts +0 -148
  46. package/src/apps/ui/status-model.ts +0 -68
  47. package/src/apps/ui/surface.ts +0 -91
  48. package/src/apps/ui/theme.ts +0 -86
  49. package/src/apps/update-check.ts +0 -112
  50. package/src/apps/workflow.ts +0 -58
  51. package/src/core/acceptance.ts +0 -139
  52. package/src/core/action-defaults.ts +0 -58
  53. package/src/core/activity-status.ts +0 -52
  54. package/src/core/agent-profile.ts +0 -130
  55. package/src/core/attachment-input.ts +0 -17
  56. package/src/core/blind-checks.ts +0 -72
  57. package/src/core/boundary.ts +0 -174
  58. package/src/core/branch-receipt.ts +0 -26
  59. package/src/core/catalog-merge.ts +0 -19
  60. package/src/core/checkpoints.ts +0 -85
  61. package/src/core/churn.ts +0 -61
  62. package/src/core/command-artifacts.ts +0 -94
  63. package/src/core/command-contract.ts +0 -151
  64. package/src/core/completion-action.ts +0 -20
  65. package/src/core/completion-review.ts +0 -98
  66. package/src/core/context-detail.ts +0 -37
  67. package/src/core/context-policy.ts +0 -133
  68. package/src/core/context-window.ts +0 -54
  69. package/src/core/continuation.ts +0 -130
  70. package/src/core/control-protocol.ts +0 -69
  71. package/src/core/control-view.ts +0 -39
  72. package/src/core/cycle.ts +0 -17
  73. package/src/core/data-query.ts +0 -201
  74. package/src/core/deadline.ts +0 -40
  75. package/src/core/derive.ts +0 -516
  76. package/src/core/draft-images.ts +0 -56
  77. package/src/core/edit-plan.ts +0 -200
  78. package/src/core/environment.ts +0 -181
  79. package/src/core/event-validation.ts +0 -220
  80. package/src/core/events.ts +0 -670
  81. package/src/core/evidence-ladder.ts +0 -62
  82. package/src/core/evidence-links.ts +0 -68
  83. package/src/core/evidence.ts +0 -240
  84. package/src/core/execution.ts +0 -18
  85. package/src/core/exhaustive.ts +0 -18
  86. package/src/core/export.ts +0 -179
  87. package/src/core/extension-flags.ts +0 -14
  88. package/src/core/external-effects.ts +0 -488
  89. package/src/core/failure-recovery.ts +0 -173
  90. package/src/core/file-precondition.ts +0 -78
  91. package/src/core/file-references.ts +0 -35
  92. package/src/core/frontmatter.ts +0 -213
  93. package/src/core/git-status.ts +0 -29
  94. package/src/core/goal-view.ts +0 -64
  95. package/src/core/goal.ts +0 -200
  96. package/src/core/handoff.ts +0 -479
  97. package/src/core/history-query.ts +0 -139
  98. package/src/core/history.ts +0 -237
  99. package/src/core/image-limits.ts +0 -72
  100. package/src/core/images.ts +0 -46
  101. package/src/core/integration-health.ts +0 -34
  102. package/src/core/json-event.ts +0 -131
  103. package/src/core/json-pointer.ts +0 -46
  104. package/src/core/keymap.ts +0 -153
  105. package/src/core/lsp-framing.ts +0 -34
  106. package/src/core/mcp-config.ts +0 -68
  107. package/src/core/model-picker.ts +0 -64
  108. package/src/core/model-preferences.ts +0 -28
  109. package/src/core/model-replay.ts +0 -22
  110. package/src/core/model-scope.ts +0 -53
  111. package/src/core/note-guidance.ts +0 -34
  112. package/src/core/oauth-fields.ts +0 -44
  113. package/src/core/observation-view.ts +0 -152
  114. package/src/core/outcome.ts +0 -44
  115. package/src/core/overflow.ts +0 -59
  116. package/src/core/packages.ts +0 -47
  117. package/src/core/patch.ts +0 -130
  118. package/src/core/path-suggestions.ts +0 -59
  119. package/src/core/permissions.ts +0 -410
  120. package/src/core/process-receipt.ts +0 -105
  121. package/src/core/process-state.ts +0 -37
  122. package/src/core/program-status.ts +0 -40
  123. package/src/core/progress.ts +0 -150
  124. package/src/core/project.ts +0 -431
  125. package/src/core/prompt-policy.ts +0 -46
  126. package/src/core/prompts.ts +0 -111
  127. package/src/core/question.ts +0 -94
  128. package/src/core/queue.ts +0 -78
  129. package/src/core/read-bounds.ts +0 -24
  130. package/src/core/read-observation.ts +0 -106
  131. package/src/core/recovery-sources.ts +0 -74
  132. package/src/core/regex-dialect.ts +0 -25
  133. package/src/core/request-budget.ts +0 -23
  134. package/src/core/request-progress.ts +0 -87
  135. package/src/core/request-state.ts +0 -273
  136. package/src/core/resource-selection.ts +0 -36
  137. package/src/core/response-recovery.ts +0 -59
  138. package/src/core/resume.ts +0 -59
  139. package/src/core/review.ts +0 -68
  140. package/src/core/ripgrep-release.ts +0 -64
  141. package/src/core/runtime-target.ts +0 -94
  142. package/src/core/scheduling.ts +0 -8
  143. package/src/core/search-observation.ts +0 -97
  144. package/src/core/secrets.ts +0 -188
  145. package/src/core/session-archive.ts +0 -4
  146. package/src/core/session-browser.ts +0 -82
  147. package/src/core/session-entry.ts +0 -61
  148. package/src/core/session-exit.ts +0 -42
  149. package/src/core/session-format.ts +0 -169
  150. package/src/core/session-position.ts +0 -26
  151. package/src/core/session-tree.ts +0 -147
  152. package/src/core/settings.ts +0 -192
  153. package/src/core/skills.ts +0 -165
  154. package/src/core/sql-query.ts +0 -211
  155. package/src/core/stall.ts +0 -128
  156. package/src/core/stop-report.ts +0 -68
  157. package/src/core/text-normalize.ts +0 -81
  158. package/src/core/theme.ts +0 -166
  159. package/src/core/thinking.ts +0 -26
  160. package/src/core/tokens.ts +0 -151
  161. package/src/core/tool-contract.ts +0 -153
  162. package/src/core/tool-discovery.ts +0 -87
  163. package/src/core/tool-failure.ts +0 -81
  164. package/src/core/tool-input.ts +0 -44
  165. package/src/core/transcript.ts +0 -108
  166. package/src/core/tui-mode.ts +0 -29
  167. package/src/core/update-check.ts +0 -157
  168. package/src/core/version.ts +0 -55
  169. package/src/core/web-content.ts +0 -80
  170. package/src/core/work-state.ts +0 -154
  171. package/src/core/workflow-mode.ts +0 -34
  172. package/src/core/working-set.ts +0 -119
  173. package/src/core/yaml.ts +0 -282
  174. package/src/runtime/acp-agent.ts +0 -289
  175. package/src/runtime/agent-profiles.ts +0 -21
  176. package/src/runtime/auth.ts +0 -367
  177. package/src/runtime/blind-check.ts +0 -36
  178. package/src/runtime/branch-jobs.ts +0 -36
  179. package/src/runtime/catalog.ts +0 -285
  180. package/src/runtime/clipboard.ts +0 -125
  181. package/src/runtime/command-artifacts.ts +0 -64
  182. package/src/runtime/connection-reuse.ts +0 -40
  183. package/src/runtime/control-client.ts +0 -149
  184. package/src/runtime/control-connection.ts +0 -139
  185. package/src/runtime/counter-check.ts +0 -74
  186. package/src/runtime/environment-tools.ts +0 -60
  187. package/src/runtime/evidence-notes.ts +0 -35
  188. package/src/runtime/exec-sessions.ts +0 -456
  189. package/src/runtime/execution-control.ts +0 -40
  190. package/src/runtime/extension-loader.ts +0 -37
  191. package/src/runtime/extension-ui.ts +0 -47
  192. package/src/runtime/extensions.ts +0 -370
  193. package/src/runtime/formatter-tool.ts +0 -38
  194. package/src/runtime/formatter.ts +0 -50
  195. package/src/runtime/foundation.ts +0 -116
  196. package/src/runtime/history-cache.ts +0 -57
  197. package/src/runtime/history-tools.ts +0 -168
  198. package/src/runtime/images.ts +0 -80
  199. package/src/runtime/integrations.ts +0 -216
  200. package/src/runtime/loop.ts +0 -3108
  201. package/src/runtime/lsp-client.ts +0 -201
  202. package/src/runtime/mcp-client.ts +0 -264
  203. package/src/runtime/mcp-oauth.ts +0 -168
  204. package/src/runtime/mcp-schema.ts +0 -51
  205. package/src/runtime/model-config.ts +0 -232
  206. package/src/runtime/model-data.LICENSE +0 -27
  207. package/src/runtime/model-data.ts +0 -21
  208. package/src/runtime/model-discovery.ts +0 -208
  209. package/src/runtime/model-replay.ts +0 -10
  210. package/src/runtime/model-scope.ts +0 -20
  211. package/src/runtime/model-sources.ts +0 -151
  212. package/src/runtime/model.ts +0 -686
  213. package/src/runtime/models-fetch.ts +0 -57
  214. package/src/runtime/oauth-device.ts +0 -86
  215. package/src/runtime/oauth.ts +0 -853
  216. package/src/runtime/open-image.ts +0 -42
  217. package/src/runtime/openai-responses.ts +0 -304
  218. package/src/runtime/openai.ts +0 -697
  219. package/src/runtime/output-schema.ts +0 -26
  220. package/src/runtime/package-manager.ts +0 -125
  221. package/src/runtime/patch-tool.ts +0 -38
  222. package/src/runtime/permission-resources.ts +0 -18
  223. package/src/runtime/pi-provider.ts +0 -423
  224. package/src/runtime/program-status.ts +0 -38
  225. package/src/runtime/progress.ts +0 -26
  226. package/src/runtime/provider-access.ts +0 -21
  227. package/src/runtime/provider-connect.ts +0 -109
  228. package/src/runtime/provider-presets.ts +0 -98
  229. package/src/runtime/provider-protocols.ts +0 -29
  230. package/src/runtime/provider-request.ts +0 -87
  231. package/src/runtime/provider-tool-policy.ts +0 -33
  232. package/src/runtime/provider.ts +0 -580
  233. package/src/runtime/question-tool.ts +0 -62
  234. package/src/runtime/retry.ts +0 -447
  235. package/src/runtime/review-tool.ts +0 -48
  236. package/src/runtime/rich-text.ts +0 -36
  237. package/src/runtime/runtime-target.ts +0 -149
  238. package/src/runtime/secrets.ts +0 -79
  239. package/src/runtime/self-update.ts +0 -74
  240. package/src/runtime/session-control.ts +0 -265
  241. package/src/runtime/session-hub.ts +0 -85
  242. package/src/runtime/stream-idle.ts +0 -80
  243. package/src/runtime/tool-broker.ts +0 -137
  244. package/src/runtime/tool-discovery.ts +0 -58
  245. package/src/runtime/tool-queue.ts +0 -77
  246. package/src/runtime/tools.ts +0 -1820
  247. package/src/runtime/turn-effects.ts +0 -31
  248. package/src/runtime/update-check.ts +0 -48
  249. package/src/runtime/usage.ts +0 -253
  250. package/src/runtime/version.ts +0 -12
  251. package/src/runtime/web-http.ts +0 -56
  252. package/src/runtime/web-tools.ts +0 -88
  253. package/src/runtime/working-notes.ts +0 -60
  254. package/src/runtime/workspace-lifecycle.ts +0 -141
  255. package/src/store/acceptance.ts +0 -15
  256. package/src/store/agent-profile-files.ts +0 -13
  257. package/src/store/atomic.ts +0 -31
  258. package/src/store/auth-store.ts +0 -50
  259. package/src/store/blind-checks.ts +0 -32
  260. package/src/store/blobs.ts +0 -143
  261. package/src/store/checkpoint-history.ts +0 -32
  262. package/src/store/command-artifacts.ts +0 -96
  263. package/src/store/command.ts +0 -111
  264. package/src/store/config.ts +0 -69
  265. package/src/store/context-files.ts +0 -436
  266. package/src/store/file-checkpoints.ts +0 -108
  267. package/src/store/file-index.ts +0 -174
  268. package/src/store/foundation-config.ts +0 -24
  269. package/src/store/git-checkpoints.ts +0 -67
  270. package/src/store/git-status.ts +0 -15
  271. package/src/store/history-search.ts +0 -19
  272. package/src/store/log.ts +0 -725
  273. package/src/store/lsp-document.ts +0 -30
  274. package/src/store/mcp-credentials.ts +0 -85
  275. package/src/store/models.ts +0 -60
  276. package/src/store/observations.ts +0 -224
  277. package/src/store/packages.ts +0 -98
  278. package/src/store/patch.ts +0 -92
  279. package/src/store/permission-paths.ts +0 -34
  280. package/src/store/process-receipts.ts +0 -34
  281. package/src/store/query-source.ts +0 -49
  282. package/src/store/recovery.ts +0 -44
  283. package/src/store/replay.ts +0 -76
  284. package/src/store/resource-index.ts +0 -170
  285. package/src/store/resources.ts +0 -285
  286. package/src/store/restore.ts +0 -110
  287. package/src/store/review.ts +0 -109
  288. package/src/store/runtime-target.ts +0 -64
  289. package/src/store/search.ts +0 -728
  290. package/src/store/secrets.ts +0 -44
  291. package/src/store/serial.ts +0 -13
  292. package/src/store/session-archive.ts +0 -165
  293. package/src/store/session-browser.ts +0 -68
  294. package/src/store/session-position.ts +0 -27
  295. package/src/store/sessions.ts +0 -525
  296. package/src/store/source-cancellation.ts +0 -6
  297. package/src/store/tool-binaries.ts +0 -90
  298. package/src/store/trust.ts +0 -82
  299. package/src/store/update-cache.ts +0 -36
  300. package/src/store/user-settings.ts +0 -30
  301. package/src/store/workspace-clone.ts +0 -42
  302. package/src/store/workspace-observation.ts +0 -113
  303. package/src/store/workspace.ts +0 -115
  304. package/src/store/worktree.ts +0 -278
  305. package/src/tui/ansi-spans.ts +0 -126
  306. package/src/tui/diff.ts +0 -160
  307. package/src/tui/exhaustive.ts +0 -14
  308. package/src/tui/fuzzy.ts +0 -75
  309. package/src/tui/style.ts +0 -208
  310. package/src/tui/ui/atomic-draft.ts +0 -121
  311. package/src/tui/ui/branch-panel.ts +0 -47
  312. package/src/tui/ui/canvas.ts +0 -96
  313. package/src/tui/ui/colors.ts +0 -70
  314. package/src/tui/ui/composer.ts +0 -199
  315. package/src/tui/ui/control-panel.ts +0 -25
  316. package/src/tui/ui/control-sidebar.ts +0 -49
  317. package/src/tui/ui/dialog.ts +0 -398
  318. package/src/tui/ui/draft.ts +0 -23
  319. package/src/tui/ui/duration.ts +0 -16
  320. package/src/tui/ui/edge.ts +0 -186
  321. package/src/tui/ui/image-size.ts +0 -44
  322. package/src/tui/ui/ink.ts +0 -210
  323. package/src/tui/ui/items.ts +0 -42
  324. package/src/tui/ui/keys.ts +0 -40
  325. package/src/tui/ui/layout.ts +0 -74
  326. package/src/tui/ui/list-model.ts +0 -86
  327. package/src/tui/ui/list-view.ts +0 -172
  328. package/src/tui/ui/mascot.ts +0 -67
  329. package/src/tui/ui/messages.ts +0 -518
  330. package/src/tui/ui/motion.ts +0 -28
  331. package/src/tui/ui/paths.ts +0 -10
  332. package/src/tui/ui/pictures.ts +0 -108
  333. package/src/tui/ui/prompt-history.ts +0 -60
  334. package/src/tui/ui/screen.ts +0 -579
  335. package/src/tui/ui/status.ts +0 -403
  336. package/src/tui/ui/styled.ts +0 -85
  337. package/src/tui/ui/tool-card.ts +0 -150
  338. package/src/tui/width.ts +0 -567
  339. package/src/vendor/pi-rich/LICENSE.upstream +0 -21
  340. package/src/vendor/pi-rich/UPSTREAM.json +0 -17
  341. package/src/vendor/pi-rich/clipboard-command.ts +0 -44
  342. package/src/vendor/pi-rich/exif-orientation.ts +0 -182
  343. package/src/vendor/pi-rich/html.ts +0 -51
  344. package/src/vendor/pi-rich/image-convert.ts +0 -49
  345. package/src/vendor/pi-rich/image-resize-core.ts +0 -164
  346. package/src/vendor/pi-rich/image-resize-worker.ts +0 -42
  347. package/src/vendor/pi-rich/image-resize.ts +0 -123
  348. package/src/vendor/pi-rich/mime.ts +0 -116
  349. package/src/vendor/pi-rich/photon.ts +0 -139
  350. package/src/vendor/pi-rich/syntax-highlight.ts +0 -214
package/src/tui/width.ts DELETED
@@ -1,567 +0,0 @@
1
- /**
2
- * Column width of a string, counted the way a terminal counts it.
3
- *
4
- * JavaScript `s.length` is UTF-16 code units. A CJK ideograph is one unit
5
- * and two columns; a combining mark is one unit and zero columns. Wrapping
6
- * and cursor motion both go wrong if those are confused, which is why this
7
- * is a table and not `.length`.
8
- *
9
- * No dependency. The ranges are copied from Unicode 16.0.0 (2024-09-10):
10
- * - WIDE: EastAsianWidth.txt, property W (Wide) or F (Fullwidth).
11
- * https://www.unicode.org/Public/16.0.0/ucd/EastAsianWidth.txt
12
- * UAX #11: https://www.unicode.org/reports/tr11/
13
- * - ZERO: union of DerivedGeneralCategory.txt Cc/Mn/Me/Cf and
14
- * DerivedCoreProperties.txt Default_Ignorable_Code_Point.
15
- * https://www.unicode.org/Public/16.0.0/ucd/
16
- *
17
- * Lookup is ZERO first, then WIDE. A few code points (Hangul fillers at
18
- * U+115F, combining dakuten at U+3099) appear in both source files; they
19
- * must not advance the cursor.
20
- *
21
- * Ambiguous (A) characters are width 1. This is a Western-context terminal,
22
- * not an East-Asian fullwidth locale; UAX #11 leaves A to the locale.
23
- *
24
- * Emoji: characters with EAW W are width 2. Emoji presentation sequences
25
- * that the UCD lists as Neutral are not in WIDE; VS16 (U+FE0F) is ZERO, so
26
- * "B" + VS16 stays width 1, which matches wcwidth and most terminals.
27
- */
28
-
29
- type Range = readonly [start: number, end: number];
30
-
31
- /**
32
- * Width 0. Each range is from Unicode 16.0 DerivedGeneralCategory (Cc, Mn,
33
- * Me, Cf) or DerivedCoreProperties (Default_Ignorable_Code_Point), merged.
34
- * Source of a range is named on the line when it is a well-known block;
35
- * unmarked ranges are the same union, typically script-specific Mn.
36
- */
37
- const ZERO: readonly Range[] = [
38
- [0x0, 0x1F], // C0 controls. DerivedGeneralCategory.txt Cc
39
- [0x7F, 0x9F], // DEL + C1 controls. Cc
40
- [0xAD, 0xAD], // SOFT HYPHEN. Cf
41
- [0x300, 0x36F], // Combining Diacritical Marks. Mn
42
- [0x483, 0x489],
43
- [0x591, 0x5BD],
44
- [0x5BF, 0x5BF],
45
- [0x5C1, 0x5C2],
46
- [0x5C4, 0x5C5],
47
- [0x5C7, 0x5C7],
48
- [0x600, 0x605],
49
- [0x610, 0x61A],
50
- [0x61C, 0x61C],
51
- [0x64B, 0x65F],
52
- [0x670, 0x670],
53
- [0x6D6, 0x6DD],
54
- [0x6DF, 0x6E4],
55
- [0x6E7, 0x6E8],
56
- [0x6EA, 0x6ED],
57
- [0x70F, 0x70F],
58
- [0x711, 0x711],
59
- [0x730, 0x74A],
60
- [0x7A6, 0x7B0],
61
- [0x7EB, 0x7F3],
62
- [0x7FD, 0x7FD],
63
- [0x816, 0x819],
64
- [0x81B, 0x823],
65
- [0x825, 0x827],
66
- [0x829, 0x82D],
67
- [0x859, 0x85B],
68
- [0x890, 0x891],
69
- [0x897, 0x89F],
70
- [0x8CA, 0x902],
71
- [0x93A, 0x93A],
72
- [0x93C, 0x93C],
73
- [0x941, 0x948],
74
- [0x94D, 0x94D],
75
- [0x951, 0x957],
76
- [0x962, 0x963],
77
- [0x981, 0x981],
78
- [0x9BC, 0x9BC],
79
- [0x9C1, 0x9C4],
80
- [0x9CD, 0x9CD],
81
- [0x9E2, 0x9E3],
82
- [0x9FE, 0x9FE],
83
- [0xA01, 0xA02],
84
- [0xA3C, 0xA3C],
85
- [0xA41, 0xA42],
86
- [0xA47, 0xA48],
87
- [0xA4B, 0xA4D],
88
- [0xA51, 0xA51],
89
- [0xA70, 0xA71],
90
- [0xA75, 0xA75],
91
- [0xA81, 0xA82],
92
- [0xABC, 0xABC],
93
- [0xAC1, 0xAC5],
94
- [0xAC7, 0xAC8],
95
- [0xACD, 0xACD],
96
- [0xAE2, 0xAE3],
97
- [0xAFA, 0xAFF],
98
- [0xB01, 0xB01],
99
- [0xB3C, 0xB3C],
100
- [0xB3F, 0xB3F],
101
- [0xB41, 0xB44],
102
- [0xB4D, 0xB4D],
103
- [0xB55, 0xB56],
104
- [0xB62, 0xB63],
105
- [0xB82, 0xB82],
106
- [0xBC0, 0xBC0],
107
- [0xBCD, 0xBCD],
108
- [0xC00, 0xC00],
109
- [0xC04, 0xC04],
110
- [0xC3C, 0xC3C],
111
- [0xC3E, 0xC40],
112
- [0xC46, 0xC48],
113
- [0xC4A, 0xC4D],
114
- [0xC55, 0xC56],
115
- [0xC62, 0xC63],
116
- [0xC81, 0xC81],
117
- [0xCBC, 0xCBC],
118
- [0xCBF, 0xCBF],
119
- [0xCC6, 0xCC6],
120
- [0xCCC, 0xCCD],
121
- [0xCE2, 0xCE3],
122
- [0xD00, 0xD01],
123
- [0xD3B, 0xD3C],
124
- [0xD41, 0xD44],
125
- [0xD4D, 0xD4D],
126
- [0xD62, 0xD63],
127
- [0xD81, 0xD81],
128
- [0xDCA, 0xDCA],
129
- [0xDD2, 0xDD4],
130
- [0xDD6, 0xDD6],
131
- [0xE31, 0xE31],
132
- [0xE34, 0xE3A],
133
- [0xE47, 0xE4E],
134
- [0xEB1, 0xEB1],
135
- [0xEB4, 0xEBC],
136
- [0xEC8, 0xECE],
137
- [0xF18, 0xF19],
138
- [0xF35, 0xF35],
139
- [0xF37, 0xF37],
140
- [0xF39, 0xF39],
141
- [0xF71, 0xF7E],
142
- [0xF80, 0xF84],
143
- [0xF86, 0xF87],
144
- [0xF8D, 0xF97],
145
- [0xF99, 0xFBC],
146
- [0xFC6, 0xFC6],
147
- [0x102D, 0x1030],
148
- [0x1032, 0x1037],
149
- [0x1039, 0x103A],
150
- [0x103D, 0x103E],
151
- [0x1058, 0x1059],
152
- [0x105E, 0x1060],
153
- [0x1071, 0x1074],
154
- [0x1082, 0x1082],
155
- [0x1085, 0x1086],
156
- [0x108D, 0x108D],
157
- [0x109D, 0x109D],
158
- [0x115F, 0x1160],
159
- [0x135D, 0x135F],
160
- [0x1712, 0x1714],
161
- [0x1732, 0x1733],
162
- [0x1752, 0x1753],
163
- [0x1772, 0x1773],
164
- [0x17B4, 0x17B5],
165
- [0x17B7, 0x17BD],
166
- [0x17C6, 0x17C6],
167
- [0x17C9, 0x17D3],
168
- [0x17DD, 0x17DD],
169
- [0x180B, 0x180F],
170
- [0x1885, 0x1886],
171
- [0x18A9, 0x18A9],
172
- [0x1920, 0x1922],
173
- [0x1927, 0x1928],
174
- [0x1932, 0x1932],
175
- [0x1939, 0x193B],
176
- [0x1A17, 0x1A18],
177
- [0x1A1B, 0x1A1B],
178
- [0x1A56, 0x1A56],
179
- [0x1A58, 0x1A5E],
180
- [0x1A60, 0x1A60],
181
- [0x1A62, 0x1A62],
182
- [0x1A65, 0x1A6C],
183
- [0x1A73, 0x1A7C],
184
- [0x1A7F, 0x1A7F],
185
- [0x1AB0, 0x1ACE], // Combining Diacritical Marks Extended. Mn
186
- [0x1B00, 0x1B03],
187
- [0x1B34, 0x1B34],
188
- [0x1B36, 0x1B3A],
189
- [0x1B3C, 0x1B3C],
190
- [0x1B42, 0x1B42],
191
- [0x1B6B, 0x1B73],
192
- [0x1B80, 0x1B81],
193
- [0x1BA2, 0x1BA5],
194
- [0x1BA8, 0x1BA9],
195
- [0x1BAB, 0x1BAD],
196
- [0x1BE6, 0x1BE6],
197
- [0x1BE8, 0x1BE9],
198
- [0x1BED, 0x1BED],
199
- [0x1BEF, 0x1BF1],
200
- [0x1C2C, 0x1C33],
201
- [0x1C36, 0x1C37],
202
- [0x1CD0, 0x1CD2],
203
- [0x1CD4, 0x1CE0],
204
- [0x1CE2, 0x1CE8],
205
- [0x1CED, 0x1CED],
206
- [0x1CF4, 0x1CF4],
207
- [0x1CF8, 0x1CF9],
208
- [0x1DC0, 0x1DFF], // Combining Diacritical Marks Supplement. Mn
209
- [0x200B, 0x200F], // ZWSP / ZWNJ / ZWJ / LRM / RLM. Cf + Default_Ignorable
210
- [0x202A, 0x202E],
211
- [0x2060, 0x206F],
212
- [0x20D0, 0x20F0], // Combining Diacritical Marks for Symbols. Mn
213
- [0x2CEF, 0x2CF1],
214
- [0x2D7F, 0x2D7F],
215
- [0x2DE0, 0x2DFF],
216
- [0x302A, 0x302D],
217
- [0x3099, 0x309A],
218
- [0x3164, 0x3164],
219
- [0xA66F, 0xA672],
220
- [0xA674, 0xA67D],
221
- [0xA69E, 0xA69F],
222
- [0xA6F0, 0xA6F1],
223
- [0xA802, 0xA802],
224
- [0xA806, 0xA806],
225
- [0xA80B, 0xA80B],
226
- [0xA825, 0xA826],
227
- [0xA82C, 0xA82C],
228
- [0xA8C4, 0xA8C5],
229
- [0xA8E0, 0xA8F1],
230
- [0xA8FF, 0xA8FF],
231
- [0xA926, 0xA92D],
232
- [0xA947, 0xA951],
233
- [0xA980, 0xA982],
234
- [0xA9B3, 0xA9B3],
235
- [0xA9B6, 0xA9B9],
236
- [0xA9BC, 0xA9BD],
237
- [0xA9E5, 0xA9E5],
238
- [0xAA29, 0xAA2E],
239
- [0xAA31, 0xAA32],
240
- [0xAA35, 0xAA36],
241
- [0xAA43, 0xAA43],
242
- [0xAA4C, 0xAA4C],
243
- [0xAA7C, 0xAA7C],
244
- [0xAAB0, 0xAAB0],
245
- [0xAAB2, 0xAAB4],
246
- [0xAAB7, 0xAAB8],
247
- [0xAABE, 0xAABF],
248
- [0xAAC1, 0xAAC1],
249
- [0xAAEC, 0xAAED],
250
- [0xAAF6, 0xAAF6],
251
- [0xABE5, 0xABE5],
252
- [0xABE8, 0xABE8],
253
- [0xABED, 0xABED],
254
- [0xFB1E, 0xFB1E],
255
- [0xFE00, 0xFE0F], // Variation Selectors (including VS16 emoji presentation). Mn
256
- [0xFE20, 0xFE2F], // Combining Half Marks. Mn
257
- [0xFEFF, 0xFEFF], // BOM / ZWNBSP. Cf
258
- [0xFFA0, 0xFFA0],
259
- [0xFFF0, 0xFFFB],
260
- [0x101FD, 0x101FD],
261
- [0x102E0, 0x102E0],
262
- [0x10376, 0x1037A],
263
- [0x10A01, 0x10A03],
264
- [0x10A05, 0x10A06],
265
- [0x10A0C, 0x10A0F],
266
- [0x10A38, 0x10A3A],
267
- [0x10A3F, 0x10A3F],
268
- [0x10AE5, 0x10AE6],
269
- [0x10D24, 0x10D27],
270
- [0x10D69, 0x10D6D],
271
- [0x10EAB, 0x10EAC],
272
- [0x10EFC, 0x10EFF],
273
- [0x10F46, 0x10F50],
274
- [0x10F82, 0x10F85],
275
- [0x11001, 0x11001],
276
- [0x11038, 0x11046],
277
- [0x11070, 0x11070],
278
- [0x11073, 0x11074],
279
- [0x1107F, 0x11081],
280
- [0x110B3, 0x110B6],
281
- [0x110B9, 0x110BA],
282
- [0x110BD, 0x110BD],
283
- [0x110C2, 0x110C2],
284
- [0x110CD, 0x110CD],
285
- [0x11100, 0x11102],
286
- [0x11127, 0x1112B],
287
- [0x1112D, 0x11134],
288
- [0x11173, 0x11173],
289
- [0x11180, 0x11181],
290
- [0x111B6, 0x111BE],
291
- [0x111C9, 0x111CC],
292
- [0x111CF, 0x111CF],
293
- [0x1122F, 0x11231],
294
- [0x11234, 0x11234],
295
- [0x11236, 0x11237],
296
- [0x1123E, 0x1123E],
297
- [0x11241, 0x11241],
298
- [0x112DF, 0x112DF],
299
- [0x112E3, 0x112EA],
300
- [0x11300, 0x11301],
301
- [0x1133B, 0x1133C],
302
- [0x11340, 0x11340],
303
- [0x11366, 0x1136C],
304
- [0x11370, 0x11374],
305
- [0x113BB, 0x113C0],
306
- [0x113CE, 0x113CE],
307
- [0x113D0, 0x113D0],
308
- [0x113D2, 0x113D2],
309
- [0x113E1, 0x113E2],
310
- [0x11438, 0x1143F],
311
- [0x11442, 0x11444],
312
- [0x11446, 0x11446],
313
- [0x1145E, 0x1145E],
314
- [0x114B3, 0x114B8],
315
- [0x114BA, 0x114BA],
316
- [0x114BF, 0x114C0],
317
- [0x114C2, 0x114C3],
318
- [0x115B2, 0x115B5],
319
- [0x115BC, 0x115BD],
320
- [0x115BF, 0x115C0],
321
- [0x115DC, 0x115DD],
322
- [0x11633, 0x1163A],
323
- [0x1163D, 0x1163D],
324
- [0x1163F, 0x11640],
325
- [0x116AB, 0x116AB],
326
- [0x116AD, 0x116AD],
327
- [0x116B0, 0x116B5],
328
- [0x116B7, 0x116B7],
329
- [0x1171D, 0x1171D],
330
- [0x1171F, 0x1171F],
331
- [0x11722, 0x11725],
332
- [0x11727, 0x1172B],
333
- [0x1182F, 0x11837],
334
- [0x11839, 0x1183A],
335
- [0x1193B, 0x1193C],
336
- [0x1193E, 0x1193E],
337
- [0x11943, 0x11943],
338
- [0x119D4, 0x119D7],
339
- [0x119DA, 0x119DB],
340
- [0x119E0, 0x119E0],
341
- [0x11A01, 0x11A0A],
342
- [0x11A33, 0x11A38],
343
- [0x11A3B, 0x11A3E],
344
- [0x11A47, 0x11A47],
345
- [0x11A51, 0x11A56],
346
- [0x11A59, 0x11A5B],
347
- [0x11A8A, 0x11A96],
348
- [0x11A98, 0x11A99],
349
- [0x11C30, 0x11C36],
350
- [0x11C38, 0x11C3D],
351
- [0x11C3F, 0x11C3F],
352
- [0x11C92, 0x11CA7],
353
- [0x11CAA, 0x11CB0],
354
- [0x11CB2, 0x11CB3],
355
- [0x11CB5, 0x11CB6],
356
- [0x11D31, 0x11D36],
357
- [0x11D3A, 0x11D3A],
358
- [0x11D3C, 0x11D3D],
359
- [0x11D3F, 0x11D45],
360
- [0x11D47, 0x11D47],
361
- [0x11D90, 0x11D91],
362
- [0x11D95, 0x11D95],
363
- [0x11D97, 0x11D97],
364
- [0x11EF3, 0x11EF4],
365
- [0x11F00, 0x11F01],
366
- [0x11F36, 0x11F3A],
367
- [0x11F40, 0x11F40],
368
- [0x11F42, 0x11F42],
369
- [0x11F5A, 0x11F5A],
370
- [0x13430, 0x13440],
371
- [0x13447, 0x13455],
372
- [0x1611E, 0x16129],
373
- [0x1612D, 0x1612F],
374
- [0x16AF0, 0x16AF4],
375
- [0x16B30, 0x16B36],
376
- [0x16F4F, 0x16F4F],
377
- [0x16F8F, 0x16F92],
378
- [0x16FE4, 0x16FE4],
379
- [0x1BC9D, 0x1BC9E],
380
- [0x1BCA0, 0x1BCA3],
381
- [0x1CF00, 0x1CF2D],
382
- [0x1CF30, 0x1CF46],
383
- [0x1D167, 0x1D169],
384
- [0x1D173, 0x1D182],
385
- [0x1D185, 0x1D18B],
386
- [0x1D1AA, 0x1D1AD],
387
- [0x1D242, 0x1D244],
388
- [0x1DA00, 0x1DA36],
389
- [0x1DA3B, 0x1DA6C],
390
- [0x1DA75, 0x1DA75],
391
- [0x1DA84, 0x1DA84],
392
- [0x1DA9B, 0x1DA9F],
393
- [0x1DAA1, 0x1DAAF],
394
- [0x1E000, 0x1E006],
395
- [0x1E008, 0x1E018],
396
- [0x1E01B, 0x1E021],
397
- [0x1E023, 0x1E024],
398
- [0x1E026, 0x1E02A],
399
- [0x1E08F, 0x1E08F],
400
- [0x1E130, 0x1E136],
401
- [0x1E2AE, 0x1E2AE],
402
- [0x1E2EC, 0x1E2EF],
403
- [0x1E4EC, 0x1E4EF],
404
- [0x1E5EE, 0x1E5EF],
405
- [0x1E8D0, 0x1E8D6],
406
- [0x1E944, 0x1E94A],
407
- [0xE0000, 0xE0FFF], // Tags + Variation Selectors Supplement. Default_Ignorable
408
- ];
409
-
410
- /**
411
- * Width 2. Each range is from Unicode 16.0 EastAsianWidth.txt, property W
412
- * or F, merged. Unmarked ranges are the same file (mostly emoji fragments
413
- * and smaller W blocks).
414
- */
415
- const WIDE: readonly Range[] = [
416
- [0x1100, 0x115F], // Hangul Jamo
417
- [0x231A, 0x231B], // watch / hourglass / media (emoji, BMP)
418
- [0x2329, 0x232A],
419
- [0x23E9, 0x23EC],
420
- [0x23F0, 0x23F0],
421
- [0x23F3, 0x23F3],
422
- [0x25FD, 0x25FE],
423
- [0x2614, 0x2615],
424
- [0x2630, 0x2637],
425
- [0x2648, 0x2653],
426
- [0x267F, 0x267F],
427
- [0x268A, 0x268F],
428
- [0x2693, 0x2693],
429
- [0x26A1, 0x26A1],
430
- [0x26AA, 0x26AB],
431
- [0x26BD, 0x26BE],
432
- [0x26C4, 0x26C5],
433
- [0x26CE, 0x26CE],
434
- [0x26D4, 0x26D4],
435
- [0x26EA, 0x26EA],
436
- [0x26F2, 0x26F3],
437
- [0x26F5, 0x26F5],
438
- [0x26FA, 0x26FA],
439
- [0x26FD, 0x26FD],
440
- [0x2705, 0x2705],
441
- [0x270A, 0x270B],
442
- [0x2728, 0x2728],
443
- [0x274C, 0x274C],
444
- [0x274E, 0x274E],
445
- [0x2753, 0x2755],
446
- [0x2757, 0x2757],
447
- [0x2795, 0x2797],
448
- [0x27B0, 0x27B0],
449
- [0x27BF, 0x27BF],
450
- [0x2B1B, 0x2B1C],
451
- [0x2B50, 0x2B50],
452
- [0x2B55, 0x2B55],
453
- [0x2E80, 0x2E99], // CJK radicals / Kangxi / ideographic description
454
- [0x2E9B, 0x2EF3],
455
- [0x2F00, 0x2FD5],
456
- [0x2FF0, 0x303E],
457
- [0x3041, 0x3096], // Hiragana
458
- [0x3099, 0x30FF], // Katakana (includes combining dakuten, which ZERO wins)
459
- [0x3105, 0x312F], // Bopomofo / Hangul compatibility jamo / CJK strokes
460
- [0x3131, 0x318E],
461
- [0x3190, 0x31E5],
462
- [0x31EF, 0x321E],
463
- [0x3220, 0x3247],
464
- [0x3250, 0xA48C], // Enclosed CJK / CJK Unified Ideographs / Yi
465
- [0xA490, 0xA4C6],
466
- [0xA960, 0xA97C], // Hangul Jamo Extended-A
467
- [0xAC00, 0xD7A3], // Hangul syllables
468
- [0xF900, 0xFAFF], // CJK Compatibility Ideographs
469
- [0xFE10, 0xFE19],
470
- [0xFE30, 0xFE52],
471
- [0xFE54, 0xFE66],
472
- [0xFE68, 0xFE6B],
473
- [0xFF01, 0xFF60], // Fullwidth ASCII variants
474
- [0xFFE0, 0xFFE6], // Fullwidth symbol variants
475
- [0x16FE0, 0x16FE4],
476
- [0x16FF0, 0x16FF1],
477
- [0x17000, 0x187F7], // Tangut
478
- [0x18800, 0x18CD5],
479
- [0x18CFF, 0x18D08],
480
- [0x1AFF0, 0x1AFF3],
481
- [0x1AFF5, 0x1AFFB],
482
- [0x1AFFD, 0x1AFFE],
483
- [0x1B000, 0x1B122],
484
- [0x1B132, 0x1B132],
485
- [0x1B150, 0x1B152],
486
- [0x1B155, 0x1B155],
487
- [0x1B164, 0x1B167],
488
- [0x1B170, 0x1B2FB],
489
- [0x1D300, 0x1D356],
490
- [0x1D360, 0x1D376],
491
- [0x1F004, 0x1F004],
492
- [0x1F0CF, 0x1F0CF],
493
- [0x1F18E, 0x1F18E],
494
- [0x1F191, 0x1F19A],
495
- [0x1F200, 0x1F202],
496
- [0x1F210, 0x1F23B],
497
- [0x1F240, 0x1F248],
498
- [0x1F250, 0x1F251],
499
- [0x1F260, 0x1F265],
500
- [0x1F300, 0x1F320], // Miscellaneous Symbols and Pictographs (emoji)
501
- [0x1F32D, 0x1F335],
502
- [0x1F337, 0x1F37C],
503
- [0x1F37E, 0x1F393],
504
- [0x1F3A0, 0x1F3CA],
505
- [0x1F3CF, 0x1F3D3],
506
- [0x1F3E0, 0x1F3F0],
507
- [0x1F3F4, 0x1F3F4],
508
- [0x1F3F8, 0x1F43E],
509
- [0x1F440, 0x1F440],
510
- [0x1F442, 0x1F4FC],
511
- [0x1F4FF, 0x1F53D],
512
- [0x1F54B, 0x1F54E],
513
- [0x1F550, 0x1F567],
514
- [0x1F57A, 0x1F57A],
515
- [0x1F595, 0x1F596],
516
- [0x1F5A4, 0x1F5A4],
517
- [0x1F5FB, 0x1F64F],
518
- [0x1F680, 0x1F6C5],
519
- [0x1F6CC, 0x1F6CC],
520
- [0x1F6D0, 0x1F6D2],
521
- [0x1F6D5, 0x1F6D7],
522
- [0x1F6DC, 0x1F6DF],
523
- [0x1F6EB, 0x1F6EC],
524
- [0x1F6F4, 0x1F6FC],
525
- [0x1F7E0, 0x1F7EB],
526
- [0x1F7F0, 0x1F7F0],
527
- [0x1F90C, 0x1F93A],
528
- [0x1F93C, 0x1F945],
529
- [0x1F947, 0x1F9FF],
530
- [0x1FA70, 0x1FA7C],
531
- [0x1FA80, 0x1FA89],
532
- [0x1FA8F, 0x1FAC6],
533
- [0x1FACE, 0x1FADC],
534
- [0x1FADF, 0x1FAE9],
535
- [0x1FAF0, 0x1FAF8],
536
- [0x20000, 0x2FFFD], // CJK Unified Ideographs Extension B–F (Plane 2 default W)
537
- [0x30000, 0x3FFFD], // CJK Unified Ideographs Extension G–H (Plane 3 default W)
538
- ];
539
-
540
- function inRanges(cp: number, ranges: readonly Range[]): boolean {
541
- let lo = 0;
542
- let hi = ranges.length - 1;
543
- while (lo <= hi) {
544
- const mid = (lo + hi) >> 1;
545
- const range = ranges[mid];
546
- if (range === undefined) return false;
547
- const [start, end] = range;
548
- if (cp < start) hi = mid - 1;
549
- else if (cp > end) lo = mid + 1;
550
- else return true;
551
- }
552
- return false;
553
- }
554
-
555
- function widthOf(cp: number): number {
556
- if (inRanges(cp, ZERO)) return 0;
557
- if (inRanges(cp, WIDE)) return 2;
558
- return 1;
559
- }
560
-
561
- export function displayWidth(s: string): number {
562
- let w = 0;
563
- for (const ch of s) {
564
- w += widthOf(ch.codePointAt(0)!);
565
- }
566
- return w;
567
- }
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Mario Zechner
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,17 +0,0 @@
1
- {
2
- "repository": "https://github.com/earendil-works/pi",
3
- "commit": "02eed88fd8912e54a804ddebd409e2e4c08ac5ef",
4
- "path": "packages/coding-agent/src/utils",
5
- "files": {
6
- "syntax-highlight.ts": "626f94ab2eae32d77dd473bc24fa2d170fbf07d1",
7
- "html.ts": "a13ad46f4888ad62587de59b0670b641a1e2f0a8",
8
- "mime.ts": "9016b790f09f1073a707a9a94574c4fd3ae1c0f2",
9
- "photon.ts": "6c320705eb975969abe145277566e3297a483272",
10
- "exif-orientation.ts": "d1c47df1b7f1a63837ebbb9adb9cedee308a35e8",
11
- "image-resize-core.ts": "e60820c7baedaf89d8b387b208c811c468d74ae4",
12
- "image-resize.ts": "516a1e57a6be3d6840cb5b0fced3be6b3bc30286",
13
- "image-resize-worker.ts": "ee881b3d9794ae60c28d8f6ee4d575d810638c17",
14
- "image-convert.ts": "f781d53d1b195b1a8ced2822263f840a06350007",
15
- "clipboard-command.ts": "700fc8e609478f76dc614331b5281d0f219f3641"
16
- }
17
- }
@@ -1,44 +0,0 @@
1
- import { spawn } from "node:child_process";
2
-
3
- /** Undefined means the command failed; an empty buffer is a successful result. */
4
- export function runClipboardCommand(
5
- command: string,
6
- args: readonly string[],
7
- options?: { input?: string; timeoutMs?: number; maxBufferBytes?: number },
8
- ): Promise<Buffer | undefined> {
9
- return new Promise((resolve) => {
10
- // Clipboard writers can daemonize. Do not give them output pipes to retain.
11
- const child = spawn(command, args, {
12
- stdio: ["pipe", options?.input === undefined ? "pipe" : "ignore", "ignore"],
13
- windowsHide: true,
14
- });
15
- const chunks: Buffer[] = [];
16
- let length = 0;
17
- let settled = false;
18
- const finish = (result: Buffer | undefined): void => {
19
- if (settled) return;
20
- settled = true;
21
- clearTimeout(timer);
22
- resolve(result);
23
- };
24
- const abort = (): void => {
25
- child.kill("SIGKILL");
26
- child.stdout?.destroy();
27
- child.stdin?.destroy();
28
- finish(undefined);
29
- };
30
- const timer = setTimeout(abort, options?.timeoutMs ?? 3000);
31
- child.on("error", () => finish(undefined));
32
- child.on("close", (code) => {
33
- if (!settled) finish(code === 0 ? Buffer.concat(chunks, length) : undefined);
34
- });
35
- child.stdout?.on("data", (chunk: Buffer) => {
36
- if (settled) return;
37
- length += chunk.length;
38
- if (length > (options?.maxBufferBytes ?? 50 * 1024 * 1024)) abort();
39
- else chunks.push(chunk);
40
- });
41
- child.stdin?.on("error", () => {}); // A writer may exit before consuming all input.
42
- child.stdin?.end(options?.input);
43
- });
44
- }