@psnext/slingcli 2.4.20260525-4 → 2.4.20260527-2

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 (243) hide show
  1. package/bin/sling.js +4 -1
  2. package/node_modules/@aws-sdk/core/package.json +2 -2
  3. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  4. package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js +12 -6
  5. package/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js +12 -6
  6. package/node_modules/@aws-sdk/credential-provider-http/package.json +3 -2
  7. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  8. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  9. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  10. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  11. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +3 -3
  12. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  13. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  14. package/node_modules/@aws-sdk/middleware-websocket/package.json +2 -2
  15. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  16. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  17. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  18. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  19. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  20. package/node_modules/@aws-sdk/nested-clients/package.json +3 -3
  21. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +1 -2
  22. package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
  23. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +18 -24
  24. package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  25. package/node_modules/@earendil-works/pi-ai/dist/cli.js +14 -0
  26. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +78 -63
  27. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +2 -1
  28. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +8 -22
  29. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +1 -1
  30. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +1 -1
  31. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +60 -40
  32. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +1 -1
  33. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +1 -1
  34. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.js +55 -0
  35. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +45 -69
  36. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js +1 -0
  37. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +5 -2
  38. package/node_modules/@earendil-works/pi-ai/package.json +4 -3
  39. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/file-processor.js +2 -3
  40. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +18 -12
  41. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js +2 -1
  42. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.js +3 -2
  43. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +8 -2
  44. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +2 -1
  45. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.js +18 -24
  46. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/index.js +8 -6
  47. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/template.js +6 -3
  48. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js +12 -29
  49. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js +5 -1
  50. package/node_modules/@earendil-works/pi-coding-agent/dist/core/output-guard.js +52 -22
  51. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +63 -36
  52. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.js +6 -20
  53. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js +38 -31
  54. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +9 -4
  55. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js +32 -24
  56. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js +6 -13
  57. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js +8 -22
  58. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +54 -53
  59. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit-diff.js +8 -1
  60. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js +44 -81
  61. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/file-mutation-queue.js +27 -12
  62. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js +2 -3
  63. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js +3 -3
  64. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js +5 -5
  65. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.js +9 -3
  66. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.js +39 -21
  67. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +9 -8
  68. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.js +12 -2
  69. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js +20 -35
  70. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +5 -6
  71. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.js +1 -1
  72. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/footer.js +14 -5
  73. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +29 -4
  74. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/user-message.js +1 -1
  75. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +4 -4
  76. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +37 -28
  77. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.js +64 -7
  78. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +15 -3
  79. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-native.js +14 -8
  80. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js +124 -0
  81. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js +31 -0
  82. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js +75 -115
  83. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/paths.js +33 -7
  84. package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +13 -26
  85. package/node_modules/@earendil-works/pi-coding-agent/package.json +6 -6
  86. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +40 -55
  87. package/node_modules/@earendil-works/pi-tui/dist/components/input.js +2 -2
  88. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +12 -2
  89. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +53 -0
  90. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +4 -1
  91. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +38 -16
  92. package/node_modules/@earendil-works/pi-tui/dist/utils.js +19 -12
  93. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
  94. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
  95. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
  96. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
  97. package/node_modules/@earendil-works/pi-tui/package.json +3 -5
  98. package/node_modules/@smithy/node-http-handler/package.json +2 -2
  99. package/node_modules/undici/lib/api/api-request.js +1 -1
  100. package/node_modules/undici/lib/cache/sqlite-cache-store.js +3 -3
  101. package/node_modules/undici/lib/core/connect.js +16 -0
  102. package/node_modules/undici/lib/core/request.js +17 -2
  103. package/node_modules/undici/lib/core/socks5-client.js +10 -5
  104. package/node_modules/undici/lib/core/socks5-utils.js +17 -22
  105. package/node_modules/undici/lib/dispatcher/client-h1.js +64 -20
  106. package/node_modules/undici/lib/dispatcher/client.js +6 -2
  107. package/node_modules/undici/lib/dispatcher/h2c-client.js +1 -1
  108. package/node_modules/undici/lib/mock/mock-call-history.js +15 -15
  109. package/node_modules/undici/lib/util/cache.js +8 -7
  110. package/node_modules/undici/lib/web/fetch/formdata-parser.js +17 -6
  111. package/node_modules/undici/lib/web/fetch/index.js +5 -2
  112. package/node_modules/undici/lib/web/webidl/index.js +5 -5
  113. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +1 -7
  114. package/node_modules/undici/package.json +1 -1
  115. package/package.json +6 -6
  116. package/slingshot/index.js +269 -266
  117. package/node_modules/koffi/CHANGELOG.md +0 -1093
  118. package/node_modules/koffi/LICENSE.txt +0 -22
  119. package/node_modules/koffi/README.md +0 -43
  120. package/node_modules/koffi/build/koffi/darwin_arm64/koffi.node +0 -0
  121. package/node_modules/koffi/build/koffi/darwin_x64/koffi.node +0 -0
  122. package/node_modules/koffi/build/koffi/freebsd_arm64/koffi.node +0 -0
  123. package/node_modules/koffi/build/koffi/freebsd_ia32/koffi.node +0 -0
  124. package/node_modules/koffi/build/koffi/freebsd_x64/koffi.node +0 -0
  125. package/node_modules/koffi/build/koffi/linux_arm64/koffi.node +0 -0
  126. package/node_modules/koffi/build/koffi/linux_armhf/koffi.node +0 -0
  127. package/node_modules/koffi/build/koffi/linux_ia32/koffi.node +0 -0
  128. package/node_modules/koffi/build/koffi/linux_loong64/koffi.node +0 -0
  129. package/node_modules/koffi/build/koffi/linux_riscv64d/koffi.node +0 -0
  130. package/node_modules/koffi/build/koffi/linux_x64/koffi.node +0 -0
  131. package/node_modules/koffi/build/koffi/musl_arm64/koffi.node +0 -0
  132. package/node_modules/koffi/build/koffi/musl_x64/koffi.node +0 -0
  133. package/node_modules/koffi/build/koffi/openbsd_ia32/koffi.node +0 -0
  134. package/node_modules/koffi/build/koffi/openbsd_x64/koffi.node +0 -0
  135. package/node_modules/koffi/build/koffi/win32_arm64/koffi.exp +0 -0
  136. package/node_modules/koffi/build/koffi/win32_arm64/koffi.lib +0 -0
  137. package/node_modules/koffi/build/koffi/win32_arm64/koffi.node +0 -0
  138. package/node_modules/koffi/build/koffi/win32_ia32/koffi.exp +0 -0
  139. package/node_modules/koffi/build/koffi/win32_ia32/koffi.lib +0 -0
  140. package/node_modules/koffi/build/koffi/win32_ia32/koffi.node +0 -0
  141. package/node_modules/koffi/build/koffi/win32_x64/koffi.exp +0 -0
  142. package/node_modules/koffi/build/koffi/win32_x64/koffi.lib +0 -0
  143. package/node_modules/koffi/build/koffi/win32_x64/koffi.node +0 -0
  144. package/node_modules/koffi/doc/benchmarks.md +0 -126
  145. package/node_modules/koffi/doc/callbacks.md +0 -210
  146. package/node_modules/koffi/doc/contribute.md +0 -148
  147. package/node_modules/koffi/doc/functions.md +0 -250
  148. package/node_modules/koffi/doc/index.md +0 -61
  149. package/node_modules/koffi/doc/input.md +0 -471
  150. package/node_modules/koffi/doc/migration.md +0 -159
  151. package/node_modules/koffi/doc/misc.md +0 -180
  152. package/node_modules/koffi/doc/output.md +0 -305
  153. package/node_modules/koffi/doc/packaging.md +0 -88
  154. package/node_modules/koffi/doc/platforms.md +0 -36
  155. package/node_modules/koffi/doc/pointers.md +0 -328
  156. package/node_modules/koffi/doc/start.md +0 -118
  157. package/node_modules/koffi/doc/unions.md +0 -186
  158. package/node_modules/koffi/doc/variables.md +0 -102
  159. package/node_modules/koffi/index.d.ts +0 -288
  160. package/node_modules/koffi/index.js +0 -634
  161. package/node_modules/koffi/indirect.js +0 -533
  162. package/node_modules/koffi/lib/native/base/base.cc +0 -11015
  163. package/node_modules/koffi/lib/native/base/base.hh +0 -6003
  164. package/node_modules/koffi/lib/native/base/crc.inc +0 -2214
  165. package/node_modules/koffi/lib/native/base/crc_gen.py +0 -72
  166. package/node_modules/koffi/lib/native/base/mimetypes.inc +0 -1248
  167. package/node_modules/koffi/lib/native/base/mimetypes_gen.py +0 -58
  168. package/node_modules/koffi/lib/native/base/tower.cc +0 -821
  169. package/node_modules/koffi/lib/native/base/tower.hh +0 -81
  170. package/node_modules/koffi/lib/native/base/unicode.inc +0 -408
  171. package/node_modules/koffi/lib/native/base/unicode_gen.py +0 -152
  172. package/node_modules/koffi/package.json +0 -38
  173. package/node_modules/koffi/src/cnoke/LICENSE.txt +0 -22
  174. package/node_modules/koffi/src/cnoke/README.md +0 -99
  175. package/node_modules/koffi/src/cnoke/assets/FindCNoke.cmake +0 -127
  176. package/node_modules/koffi/src/cnoke/assets/toolchains.json +0 -126
  177. package/node_modules/koffi/src/cnoke/assets/win_delay_hook.c +0 -36
  178. package/node_modules/koffi/src/cnoke/cnoke.js +0 -170
  179. package/node_modules/koffi/src/cnoke/package.json +0 -24
  180. package/node_modules/koffi/src/cnoke/src/builder.js +0 -511
  181. package/node_modules/koffi/src/cnoke/src/index.js +0 -10
  182. package/node_modules/koffi/src/cnoke/src/tools.js +0 -407
  183. package/node_modules/koffi/src/koffi/CMakeLists.txt +0 -182
  184. package/node_modules/koffi/src/koffi/src/abi_arm32.cc +0 -1018
  185. package/node_modules/koffi/src/koffi/src/abi_arm32_asm.S +0 -169
  186. package/node_modules/koffi/src/koffi/src/abi_arm64.cc +0 -1295
  187. package/node_modules/koffi/src/koffi/src/abi_arm64_asm.S +0 -195
  188. package/node_modules/koffi/src/koffi/src/abi_arm64_asm.asm +0 -174
  189. package/node_modules/koffi/src/koffi/src/abi_loong64.cc +0 -5
  190. package/node_modules/koffi/src/koffi/src/abi_loong64_asm.S +0 -204
  191. package/node_modules/koffi/src/koffi/src/abi_riscv64.cc +0 -915
  192. package/node_modules/koffi/src/koffi/src/abi_riscv64_asm.S +0 -203
  193. package/node_modules/koffi/src/koffi/src/abi_x64_sysv.cc +0 -939
  194. package/node_modules/koffi/src/koffi/src/abi_x64_sysv_asm.S +0 -231
  195. package/node_modules/koffi/src/koffi/src/abi_x64_win.cc +0 -715
  196. package/node_modules/koffi/src/koffi/src/abi_x64_win_asm.S +0 -166
  197. package/node_modules/koffi/src/koffi/src/abi_x64_win_asm.asm +0 -192
  198. package/node_modules/koffi/src/koffi/src/abi_x86.cc +0 -860
  199. package/node_modules/koffi/src/koffi/src/abi_x86_asm.S +0 -193
  200. package/node_modules/koffi/src/koffi/src/abi_x86_asm.asm +0 -177
  201. package/node_modules/koffi/src/koffi/src/call.cc +0 -1326
  202. package/node_modules/koffi/src/koffi/src/call.hh +0 -179
  203. package/node_modules/koffi/src/koffi/src/errno.inc +0 -462
  204. package/node_modules/koffi/src/koffi/src/ffi.cc +0 -2702
  205. package/node_modules/koffi/src/koffi/src/ffi.hh +0 -354
  206. package/node_modules/koffi/src/koffi/src/init.js +0 -105
  207. package/node_modules/koffi/src/koffi/src/parser.cc +0 -220
  208. package/node_modules/koffi/src/koffi/src/parser.hh +0 -54
  209. package/node_modules/koffi/src/koffi/src/util.cc +0 -1807
  210. package/node_modules/koffi/src/koffi/src/util.hh +0 -221
  211. package/node_modules/koffi/src/koffi/src/uv.cc +0 -193
  212. package/node_modules/koffi/src/koffi/src/uv.def +0 -10
  213. package/node_modules/koffi/src/koffi/src/uv.hh +0 -40
  214. package/node_modules/koffi/src/koffi/src/win32.cc +0 -198
  215. package/node_modules/koffi/src/koffi/src/win32.hh +0 -119
  216. package/node_modules/koffi/src/koffi/tools/write_trampolines.js +0 -77
  217. package/node_modules/koffi/vendor/node-addon-api/LICENSE.md +0 -9
  218. package/node_modules/koffi/vendor/node-addon-api/README.md +0 -95
  219. package/node_modules/koffi/vendor/node-addon-api/napi-inl.deprecated.h +0 -186
  220. package/node_modules/koffi/vendor/node-addon-api/napi-inl.h +0 -7033
  221. package/node_modules/koffi/vendor/node-addon-api/napi.h +0 -3309
  222. package/node_modules/koffi/vendor/node-api-headers/LICENSE +0 -21
  223. package/node_modules/koffi/vendor/node-api-headers/README.md +0 -95
  224. package/node_modules/koffi/vendor/node-api-headers/def/js_native_api.def +0 -125
  225. package/node_modules/koffi/vendor/node-api-headers/def/node_api.def +0 -157
  226. package/node_modules/koffi/vendor/node-api-headers/include/js_native_api.h +0 -591
  227. package/node_modules/koffi/vendor/node-api-headers/include/js_native_api_types.h +0 -210
  228. package/node_modules/koffi/vendor/node-api-headers/include/node_api.h +0 -265
  229. package/node_modules/koffi/vendor/node-api-headers/include/node_api_types.h +0 -58
  230. package/node_modules/koffi/vendor/node-api-headers/include/uv/aix.h +0 -32
  231. package/node_modules/koffi/vendor/node-api-headers/include/uv/bsd.h +0 -34
  232. package/node_modules/koffi/vendor/node-api-headers/include/uv/darwin.h +0 -61
  233. package/node_modules/koffi/vendor/node-api-headers/include/uv/errno.h +0 -483
  234. package/node_modules/koffi/vendor/node-api-headers/include/uv/linux.h +0 -34
  235. package/node_modules/koffi/vendor/node-api-headers/include/uv/os390.h +0 -33
  236. package/node_modules/koffi/vendor/node-api-headers/include/uv/posix.h +0 -31
  237. package/node_modules/koffi/vendor/node-api-headers/include/uv/sunos.h +0 -44
  238. package/node_modules/koffi/vendor/node-api-headers/include/uv/threadpool.h +0 -37
  239. package/node_modules/koffi/vendor/node-api-headers/include/uv/tree.h +0 -521
  240. package/node_modules/koffi/vendor/node-api-headers/include/uv/unix.h +0 -512
  241. package/node_modules/koffi/vendor/node-api-headers/include/uv/version.h +0 -43
  242. package/node_modules/koffi/vendor/node-api-headers/include/uv/win.h +0 -698
  243. package/node_modules/koffi/vendor/node-api-headers/include/uv.h +0 -1990
@@ -27,17 +27,19 @@ export class Markdown {
27
27
  paddingY; // Top/bottom padding
28
28
  defaultTextStyle;
29
29
  theme;
30
+ options;
30
31
  defaultStylePrefix;
31
32
  // Cache for rendered output
32
33
  cachedText;
33
34
  cachedWidth;
34
35
  cachedLines;
35
- constructor(text, paddingX, paddingY, theme, defaultTextStyle) {
36
+ constructor(text, paddingX, paddingY, theme, defaultTextStyle, options) {
36
37
  this.text = text;
37
38
  this.paddingX = paddingX;
38
39
  this.paddingY = paddingY;
39
40
  this.theme = theme;
40
41
  this.defaultTextStyle = defaultTextStyle;
42
+ this.options = options ? { ...options } : {};
41
43
  }
42
44
  setText(text) {
43
45
  this.text = text;
@@ -421,6 +423,10 @@ export class Markdown {
421
423
  }
422
424
  return result;
423
425
  }
426
+ getOrderedListMarker(item) {
427
+ const match = /^(?: {0,3})(\d{1,9}[.)])[ \t]+/.exec(item.raw);
428
+ return match ? `${match[1]} ` : undefined;
429
+ }
424
430
  /**
425
431
  * Render a list with proper nesting support
426
432
  */
@@ -431,7 +437,11 @@ export class Markdown {
431
437
  const startNumber = typeof token.start === "number" ? token.start : 1;
432
438
  for (let i = 0; i < token.items.length; i++) {
433
439
  const item = token.items[i];
434
- const bullet = token.ordered ? `${startNumber + i}. ` : "- ";
440
+ const bullet = token.ordered
441
+ ? this.options.preserveOrderedListMarkers
442
+ ? (this.getOrderedListMarker(item) ?? `${startNumber + i}. `)
443
+ : `${startNumber + i}. `
444
+ : "- ";
435
445
  const taskMarker = item.task ? `[${item.checked ? "x" : " "}] ` : "";
436
446
  const marker = bullet + taskMarker;
437
447
  const firstPrefix = indent + this.theme.listBullet(marker);
@@ -0,0 +1,53 @@
1
+ import { createRequire } from "node:module";
2
+ import * as path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ const cjsRequire = createRequire(import.meta.url);
5
+ let nativeModifiersHelper;
6
+ function isNativeModifiersHelper(value) {
7
+ if (typeof value !== "object" || value === null)
8
+ return false;
9
+ const candidate = value.isModifierPressed;
10
+ return typeof candidate === "function";
11
+ }
12
+ function loadNativeModifiersHelper() {
13
+ if (nativeModifiersHelper !== undefined)
14
+ return nativeModifiersHelper ?? undefined;
15
+ nativeModifiersHelper = null;
16
+ if (process.platform !== "darwin")
17
+ return undefined;
18
+ const arch = process.arch;
19
+ if (arch !== "x64" && arch !== "arm64")
20
+ return undefined;
21
+ const moduleDir = path.dirname(fileURLToPath(import.meta.url));
22
+ const nativePath = path.join("native", "darwin", "prebuilds", `darwin-${arch}`, "darwin-modifiers.node");
23
+ const candidates = [
24
+ path.join(moduleDir, "..", nativePath),
25
+ path.join(moduleDir, nativePath),
26
+ path.join(path.dirname(process.execPath), nativePath),
27
+ ];
28
+ for (const modulePath of candidates) {
29
+ try {
30
+ const helper = cjsRequire(modulePath);
31
+ if (isNativeModifiersHelper(helper)) {
32
+ nativeModifiersHelper = helper;
33
+ return helper;
34
+ }
35
+ }
36
+ catch {
37
+ // Try the next possible packaging location.
38
+ }
39
+ }
40
+ return undefined;
41
+ }
42
+ export function isNativeModifierPressed(key) {
43
+ const helper = loadNativeModifiersHelper();
44
+ if (!helper)
45
+ return false;
46
+ try {
47
+ return helper.isModifierPressed(key) === true;
48
+ }
49
+ catch {
50
+ return false;
51
+ }
52
+ }
53
+ //# sourceMappingURL=native-modifiers.js.map
@@ -32,6 +32,9 @@ export function detectCapabilities() {
32
32
  if (process.env.ITERM_SESSION_ID || termProgram === "iterm.app") {
33
33
  return { images: "iterm2", trueColor: true, hyperlinks: true };
34
34
  }
35
+ if (process.env.WT_SESSION) {
36
+ return { images: null, trueColor: true, hyperlinks: true };
37
+ }
35
38
  if (termProgram === "vscode") {
36
39
  return { images: null, trueColor: true, hyperlinks: true };
37
40
  }
@@ -42,7 +45,7 @@ export function detectCapabilities() {
42
45
  // text" on terminals that swallow it, which means the URL disappears from
43
46
  // the rendered output. Default to the legacy `text (url)` behavior unless we
44
47
  // have positively identified a hyperlink-capable terminal above.
45
- return { images: null, trueColor: hasTrueColorHint || !!process.env.WT_SESSION, hyperlinks: false };
48
+ return { images: null, trueColor: hasTrueColorHint, hyperlinks: false };
46
49
  }
47
50
  export function getCapabilities() {
48
51
  if (!cachedCapabilities) {
@@ -1,12 +1,23 @@
1
1
  import * as fs from "node:fs";
2
2
  import { createRequire } from "node:module";
3
3
  import * as path from "node:path";
4
+ import { fileURLToPath } from "node:url";
4
5
  import { setKittyProtocolActive } from "./keys.js";
6
+ import { isNativeModifierPressed } from "./native-modifiers.js";
5
7
  import { StdinBuffer } from "./stdin-buffer.js";
6
8
  const cjsRequire = createRequire(import.meta.url);
7
9
  const TERMINAL_PROGRESS_KEEPALIVE_MS = 1000;
8
10
  const TERMINAL_PROGRESS_ACTIVE_SEQUENCE = "\x1b]9;4;3\x07";
9
11
  const TERMINAL_PROGRESS_CLEAR_SEQUENCE = "\x1b]9;4;0;\x07";
12
+ const APPLE_TERMINAL_SHIFT_ENTER_SEQUENCE = "\x1b[13;2u";
13
+ export function isAppleTerminalSession() {
14
+ return process.platform === "darwin" && process.env.TERM_PROGRAM === "Apple_Terminal";
15
+ }
16
+ export function normalizeAppleTerminalInput(data, isAppleTerminal, isShiftPressed) {
17
+ if (isAppleTerminal && data === "\r" && isShiftPressed)
18
+ return APPLE_TERMINAL_SHIFT_ENTER_SEQUENCE;
19
+ return data;
20
+ }
10
21
  /**
11
22
  * Real terminal using process.stdin/stdout
12
23
  */
@@ -97,7 +108,9 @@ export class ProcessTerminal {
97
108
  }
98
109
  }
99
110
  if (this.inputHandler) {
100
- this.inputHandler(sequence);
111
+ const isAppleTerminal = sequence === "\r" && isAppleTerminalSession();
112
+ const input = normalizeAppleTerminalInput(sequence, isAppleTerminal, isAppleTerminal && isNativeModifierPressed("shift"));
113
+ this.inputHandler(input);
101
114
  }
102
115
  });
103
116
  // Re-wrap paste content with bracketed paste markers for existing editor handling
@@ -146,23 +159,32 @@ export class ProcessTerminal {
146
159
  if (process.platform !== "win32")
147
160
  return;
148
161
  try {
149
- // Dynamic require to avoid bundling koffi's 74MB of cross-platform
150
- // native binaries into every compiled binary. Koffi is only needed
151
- // on Windows for VT input support.
152
- const koffi = cjsRequire("koffi");
153
- const k32 = koffi.load("kernel32.dll");
154
- const GetStdHandle = k32.func("void* __stdcall GetStdHandle(int)");
155
- const GetConsoleMode = k32.func("bool __stdcall GetConsoleMode(void*, _Out_ uint32_t*)");
156
- const SetConsoleMode = k32.func("bool __stdcall SetConsoleMode(void*, uint32_t)");
157
- const STD_INPUT_HANDLE = -10;
158
- const ENABLE_VIRTUAL_TERMINAL_INPUT = 0x0200;
159
- const handle = GetStdHandle(STD_INPUT_HANDLE);
160
- const mode = new Uint32Array(1);
161
- GetConsoleMode(handle, mode);
162
- SetConsoleMode(handle, mode[0] | ENABLE_VIRTUAL_TERMINAL_INPUT);
162
+ const arch = process.arch;
163
+ if (arch !== "x64" && arch !== "arm64")
164
+ return;
165
+ // Dynamic require so non-Windows and bundled/browser paths never load the
166
+ // native helper. In the npm package native/ is next to dist/; in compiled
167
+ // binary archives native/ is copied next to the executable.
168
+ const moduleDir = path.dirname(fileURLToPath(import.meta.url));
169
+ const nativePath = path.join("native", "win32", "prebuilds", `win32-${arch}`, "win32-console-mode.node");
170
+ const candidates = [
171
+ path.join(moduleDir, "..", nativePath),
172
+ path.join(moduleDir, nativePath),
173
+ path.join(path.dirname(process.execPath), nativePath),
174
+ ];
175
+ for (const modulePath of candidates) {
176
+ try {
177
+ const helper = cjsRequire(modulePath);
178
+ helper.enableVirtualTerminalInput?.();
179
+ return;
180
+ }
181
+ catch {
182
+ // Try the next possible packaging location.
183
+ }
184
+ }
163
185
  }
164
186
  catch {
165
- // koffi not available — Shift+Tab won't be distinguishable from Tab
187
+ // Native helper not available — Shift+Tab won't be distinguishable from Tab.
166
188
  }
167
189
  }
168
190
  async drainInput(maxMs = 1000, idleMs = 50) {
@@ -1,11 +1,18 @@
1
1
  import { eastAsianWidth } from "get-east-asian-width";
2
- // Grapheme segmenter (shared instance)
3
- const segmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
2
+ // segmenters (shared instance)
3
+ const graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
4
+ const wordSegmenter = new Intl.Segmenter(undefined, { granularity: "word" });
4
5
  /**
5
6
  * Get the shared grapheme segmenter instance.
6
7
  */
7
- export function getSegmenter() {
8
- return segmenter;
8
+ export function getGraphemeSegmenter() {
9
+ return graphemeSegmenter;
10
+ }
11
+ /**
12
+ * Get the shared word segmenter instance.
13
+ */
14
+ export function getWordSegmenter() {
15
+ return wordSegmenter;
9
16
  }
10
17
  /**
11
18
  * Check if a grapheme cluster (after segmentation) could possibly be an RGI emoji.
@@ -52,7 +59,7 @@ function truncateFragmentToWidth(text, maxWidth) {
52
59
  if (!hasAnsi && !hasTabs) {
53
60
  let result = "";
54
61
  let width = 0;
55
- for (const { segment } of segmenter.segment(text)) {
62
+ for (const { segment } of graphemeSegmenter.segment(text)) {
56
63
  const w = graphemeWidth(segment);
57
64
  if (width + w > maxWidth) {
58
65
  break;
@@ -94,7 +101,7 @@ function truncateFragmentToWidth(text, maxWidth) {
94
101
  }
95
102
  end++;
96
103
  }
97
- for (const { segment } of segmenter.segment(text.slice(i, end))) {
104
+ for (const { segment } of graphemeSegmenter.segment(text.slice(i, end))) {
98
105
  const w = graphemeWidth(segment);
99
106
  if (width + w > maxWidth) {
100
107
  return { text: result, width };
@@ -203,7 +210,7 @@ export function visibleWidth(str) {
203
210
  }
204
211
  // Calculate width
205
212
  let width = 0;
206
- for (const { segment } of segmenter.segment(clean)) {
213
+ for (const { segment } of graphemeSegmenter.segment(clean)) {
207
214
  width += graphemeWidth(segment);
208
215
  }
209
216
  // Cache result
@@ -710,7 +717,7 @@ function breakLongWord(word, width, tracker) {
710
717
  }
711
718
  // Segment this non-ANSI portion into graphemes
712
719
  const textPortion = word.slice(i, end);
713
- for (const seg of segmenter.segment(textPortion)) {
720
+ for (const seg of graphemeSegmenter.segment(textPortion)) {
714
721
  segments.push({ type: "grapheme", value: seg.segment });
715
722
  }
716
723
  i = end;
@@ -812,7 +819,7 @@ export function truncateToWidth(text, maxWidth, ellipsis = "...", pad = false) {
812
819
  const hasAnsi = text.includes("\x1b");
813
820
  const hasTabs = text.includes("\t");
814
821
  if (!hasAnsi && !hasTabs) {
815
- for (const { segment } of segmenter.segment(text)) {
822
+ for (const { segment } of graphemeSegmenter.segment(text)) {
816
823
  const width = graphemeWidth(segment);
817
824
  if (keepContiguousPrefix && keptWidth + width <= targetWidth) {
818
825
  result += segment;
@@ -867,7 +874,7 @@ export function truncateToWidth(text, maxWidth, ellipsis = "...", pad = false) {
867
874
  }
868
875
  end++;
869
876
  }
870
- for (const { segment } of segmenter.segment(text.slice(i, end))) {
877
+ for (const { segment } of graphemeSegmenter.segment(text.slice(i, end))) {
871
878
  const width = graphemeWidth(segment);
872
879
  if (keepContiguousPrefix && keptWidth + width <= targetWidth) {
873
880
  if (pendingAnsi) {
@@ -925,7 +932,7 @@ export function sliceWithWidth(line, startCol, length, strict = false) {
925
932
  let textEnd = i;
926
933
  while (textEnd < line.length && !extractAnsiCode(line, textEnd))
927
934
  textEnd++;
928
- for (const { segment } of segmenter.segment(line.slice(i, textEnd))) {
935
+ for (const { segment } of graphemeSegmenter.segment(line.slice(i, textEnd))) {
929
936
  const w = graphemeWidth(segment);
930
937
  const inRange = currentCol >= startCol && currentCol < endCol;
931
938
  const fits = !strict || currentCol + w <= endCol;
@@ -981,7 +988,7 @@ export function extractSegments(line, beforeEnd, afterStart, afterLen, strictAft
981
988
  let textEnd = i;
982
989
  while (textEnd < line.length && !extractAnsiCode(line, textEnd))
983
990
  textEnd++;
984
- for (const { segment } of segmenter.segment(line.slice(i, textEnd))) {
991
+ for (const { segment } of graphemeSegmenter.segment(line.slice(i, textEnd))) {
985
992
  const w = graphemeWidth(segment);
986
993
  if (currentCol < beforeEnd) {
987
994
  if (pendingAnsiBefore) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earendil-works/pi-tui",
3
- "version": "0.75.4",
3
+ "version": "0.75.5",
4
4
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -12,6 +12,8 @@
12
12
  },
13
13
  "files": [
14
14
  "dist/**/*",
15
+ "native/win32/prebuilds/**/*.node",
16
+ "native/darwin/prebuilds/**/*.node",
15
17
  "README.md"
16
18
  ],
17
19
  "keywords": [
@@ -38,12 +40,8 @@
38
40
  "get-east-asian-width": "1.6.0",
39
41
  "marked": "15.0.12"
40
42
  },
41
- "optionalDependencies": {
42
- "koffi": "2.16.2"
43
- },
44
43
  "devDependencies": {
45
44
  "@xterm/headless": "5.5.0",
46
- "@xterm/xterm": "5.5.0",
47
45
  "chalk": "5.6.2"
48
46
  }
49
47
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/node-http-handler",
3
- "version": "4.7.4",
3
+ "version": "4.7.3",
4
4
  "description": "Provides a way to make requests",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
@@ -26,7 +26,7 @@
26
26
  "module": "./dist-es/index.js",
27
27
  "types": "./dist-types/index.d.ts",
28
28
  "dependencies": {
29
- "@smithy/core": "^3.24.4",
29
+ "@smithy/core": "^3.24.3",
30
30
  "@smithy/types": "^4.14.2",
31
31
  "tslib": "^2.6.2"
32
32
  },
@@ -21,7 +21,7 @@ class RequestHandler extends AsyncResource {
21
21
  throw new InvalidArgumentError('invalid callback')
22
22
  }
23
23
 
24
- if (highWaterMark && (typeof highWaterMark !== 'number' || highWaterMark < 0)) {
24
+ if (highWaterMark != null && (!Number.isFinite(highWaterMark) || highWaterMark < 0)) {
25
25
  throw new InvalidArgumentError('invalid highWaterMark')
26
26
  }
27
27
 
@@ -216,7 +216,7 @@ module.exports = class SqliteCacheStore {
216
216
  SELECT
217
217
  id
218
218
  FROM cacheInterceptorV${VERSION}
219
- ORDER BY cachedAt DESC
219
+ ORDER BY cachedAt ASC
220
220
  LIMIT ?
221
221
  )
222
222
  `)
@@ -283,7 +283,6 @@ module.exports = class SqliteCacheStore {
283
283
  existingValue.id
284
284
  )
285
285
  } else {
286
- this.#prune()
287
286
  // New response, let's insert it
288
287
  this.#insertValueQuery.run(
289
288
  url,
@@ -299,6 +298,7 @@ module.exports = class SqliteCacheStore {
299
298
  value.cachedAt,
300
299
  value.staleAt
301
300
  )
301
+ this.#prune()
302
302
  }
303
303
  }
304
304
 
@@ -409,7 +409,7 @@ module.exports = class SqliteCacheStore {
409
409
  const now = Date.now()
410
410
  for (const value of values) {
411
411
  if (now >= value.deleteAt && !canBeExpired) {
412
- return undefined
412
+ continue
413
413
  }
414
414
 
415
415
  let matches = true
@@ -38,6 +38,22 @@ const SessionCache = class WeakSessionCache {
38
38
  return
39
39
  }
40
40
 
41
+ if (this._sessionCache.has(sessionKey)) {
42
+ this._sessionCache.delete(sessionKey)
43
+ } else if (this._sessionCache.size >= this._maxCachedSessions) {
44
+ for (const [key, ref] of this._sessionCache) {
45
+ if (ref.deref() === undefined) {
46
+ this._sessionCache.delete(key)
47
+ return
48
+ }
49
+ }
50
+
51
+ const oldest = this._sessionCache.keys().next()
52
+ if (!oldest.done) {
53
+ this._sessionCache.delete(oldest.value)
54
+ }
55
+ }
56
+
41
57
  this._sessionCache.set(sessionKey, new WeakRef(session))
42
58
  this._sessionRegistry.register(session, sessionKey)
43
59
  }
@@ -27,6 +27,21 @@ const { headerNameLowerCasedRecord } = require('./constants')
27
27
  // Verifies that a given path is valid does not contain control chars \x00 to \x20
28
28
  const invalidPathRegex = /[^\u0021-\u00ff]/
29
29
 
30
+ function isValidContentLengthHeaderValue (val) {
31
+ if (typeof val !== 'string' || val.length === 0) {
32
+ return false
33
+ }
34
+
35
+ for (let i = 0; i < val.length; i++) {
36
+ const charCode = val.charCodeAt(i)
37
+ if (charCode < 48 || charCode > 57) {
38
+ return false
39
+ }
40
+ }
41
+
42
+ return true
43
+ }
44
+
30
45
  const kHandler = Symbol('handler')
31
46
 
32
47
  class Request {
@@ -402,10 +417,10 @@ function processHeader (request, key, val) {
402
417
  if (request.contentLength !== null) {
403
418
  throw new InvalidArgumentError('duplicate content-length header')
404
419
  }
405
- request.contentLength = parseInt(val, 10)
406
- if (!Number.isFinite(request.contentLength)) {
420
+ if (!isValidContentLengthHeaderValue(val)) {
407
421
  throw new InvalidArgumentError('invalid content-length header')
408
422
  }
423
+ request.contentLength = parseInt(val, 10)
409
424
  } else if (request.contentType === null && headerName === 'content-type') {
410
425
  request.contentType = val
411
426
  request.headers.push(key, val)
@@ -7,6 +7,7 @@ const { debuglog } = require('node:util')
7
7
  const { parseAddress } = require('./socks5-utils')
8
8
 
9
9
  const debug = debuglog('undici:socks5')
10
+ const EMPTY_BUFFER = Buffer.alloc(0)
10
11
 
11
12
  // SOCKS5 constants
12
13
  const SOCKS_VERSION = 0x05
@@ -72,7 +73,10 @@ class Socks5Client extends EventEmitter {
72
73
  this.socket = socket
73
74
  this.options = options
74
75
  this.state = STATES.INITIAL
75
- this.buffer = Buffer.alloc(0)
76
+ this.buffer = EMPTY_BUFFER
77
+ this.onSocketData = this.onData.bind(this)
78
+ this.onSocketError = this.onError.bind(this)
79
+ this.onSocketClose = this.onClose.bind(this)
76
80
 
77
81
  // Authentication settings
78
82
  this.authMethods = []
@@ -82,9 +86,9 @@ class Socks5Client extends EventEmitter {
82
86
  this.authMethods.push(AUTH_METHODS.NO_AUTH)
83
87
 
84
88
  // Socket event handlers
85
- this.socket.on('data', this.onData.bind(this))
86
- this.socket.on('error', this.onError.bind(this))
87
- this.socket.on('close', this.onClose.bind(this))
89
+ this.socket.on('data', this.onSocketData)
90
+ this.socket.on('error', this.onSocketError)
91
+ this.socket.on('close', this.onSocketClose)
88
92
  }
89
93
 
90
94
  /**
@@ -363,8 +367,9 @@ class Socks5Client extends EventEmitter {
363
367
 
364
368
  const boundPort = this.buffer.readUInt16BE(offset)
365
369
 
366
- this.buffer = this.buffer.subarray(responseLength)
370
+ this.buffer = EMPTY_BUFFER
367
371
  this.state = STATES.CONNECTED
372
+ this.socket.removeListener('data', this.onSocketData)
368
373
 
369
374
  debug('connected, bound address:', boundAddress, 'port:', boundPort)
370
375
  this.emit('connected', { address: boundAddress, port: boundPort })
@@ -46,34 +46,29 @@ function parseAddress (address) {
46
46
  */
47
47
  function parseIPv6 (address) {
48
48
  const buffer = Buffer.alloc(16)
49
- const parts = address.split(':')
50
- let partIndex = 0
51
- let bufferIndex = 0
52
49
 
53
50
  // Handle compressed notation (::)
54
51
  const doubleColonIndex = address.indexOf('::')
55
52
  if (doubleColonIndex !== -1) {
56
- // Count non-empty parts
57
- const nonEmptyParts = parts.filter(p => p.length > 0).length
58
- const skipParts = 8 - nonEmptyParts
59
-
60
- for (let i = 0; i < parts.length; i++) {
61
- if (parts[i] === '' && i === doubleColonIndex / 3) {
62
- // Skip empty parts for ::
63
- bufferIndex += skipParts * 2
64
- } else if (parts[i] !== '') {
65
- const value = parseInt(parts[i], 16)
66
- buffer.writeUInt16BE(value, bufferIndex)
67
- bufferIndex += 2
68
- }
53
+ const before = address.slice(0, doubleColonIndex)
54
+ const after = address.slice(doubleColonIndex + 2)
55
+ const beforeParts = before === '' ? [] : before.split(':')
56
+ const afterParts = after === '' ? [] : after.split(':')
57
+
58
+ let bufferIndex = 0
59
+ for (const part of beforeParts) {
60
+ buffer.writeUInt16BE(parseInt(part, 16), bufferIndex)
61
+ bufferIndex += 2
62
+ }
63
+ bufferIndex = 16 - afterParts.length * 2
64
+ for (const part of afterParts) {
65
+ buffer.writeUInt16BE(parseInt(part, 16), bufferIndex)
66
+ bufferIndex += 2
69
67
  }
70
68
  } else {
71
- // No compression, parse normally
72
- for (const part of parts) {
73
- if (part === '') continue
74
- const value = parseInt(part, 16)
75
- buffer.writeUInt16BE(value, partIndex * 2)
76
- partIndex++
69
+ const parts = address.split(':')
70
+ for (let i = 0; i < parts.length; i++) {
71
+ buffer.writeUInt16BE(parseInt(parts[i], 16), i * 2)
77
72
  }
78
73
  }
79
74