@psnext/slingcli 2.4.20260526-1 → 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 (227) 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 +73 -58
  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/package.json +6 -6
  100. package/slingshot/index.js +246 -244
  101. package/node_modules/koffi/CHANGELOG.md +0 -1093
  102. package/node_modules/koffi/LICENSE.txt +0 -22
  103. package/node_modules/koffi/README.md +0 -43
  104. package/node_modules/koffi/build/koffi/darwin_arm64/koffi.node +0 -0
  105. package/node_modules/koffi/build/koffi/darwin_x64/koffi.node +0 -0
  106. package/node_modules/koffi/build/koffi/freebsd_arm64/koffi.node +0 -0
  107. package/node_modules/koffi/build/koffi/freebsd_ia32/koffi.node +0 -0
  108. package/node_modules/koffi/build/koffi/freebsd_x64/koffi.node +0 -0
  109. package/node_modules/koffi/build/koffi/linux_arm64/koffi.node +0 -0
  110. package/node_modules/koffi/build/koffi/linux_armhf/koffi.node +0 -0
  111. package/node_modules/koffi/build/koffi/linux_ia32/koffi.node +0 -0
  112. package/node_modules/koffi/build/koffi/linux_loong64/koffi.node +0 -0
  113. package/node_modules/koffi/build/koffi/linux_riscv64d/koffi.node +0 -0
  114. package/node_modules/koffi/build/koffi/linux_x64/koffi.node +0 -0
  115. package/node_modules/koffi/build/koffi/musl_arm64/koffi.node +0 -0
  116. package/node_modules/koffi/build/koffi/musl_x64/koffi.node +0 -0
  117. package/node_modules/koffi/build/koffi/openbsd_ia32/koffi.node +0 -0
  118. package/node_modules/koffi/build/koffi/openbsd_x64/koffi.node +0 -0
  119. package/node_modules/koffi/build/koffi/win32_arm64/koffi.exp +0 -0
  120. package/node_modules/koffi/build/koffi/win32_arm64/koffi.lib +0 -0
  121. package/node_modules/koffi/build/koffi/win32_arm64/koffi.node +0 -0
  122. package/node_modules/koffi/build/koffi/win32_ia32/koffi.exp +0 -0
  123. package/node_modules/koffi/build/koffi/win32_ia32/koffi.lib +0 -0
  124. package/node_modules/koffi/build/koffi/win32_ia32/koffi.node +0 -0
  125. package/node_modules/koffi/build/koffi/win32_x64/koffi.exp +0 -0
  126. package/node_modules/koffi/build/koffi/win32_x64/koffi.lib +0 -0
  127. package/node_modules/koffi/build/koffi/win32_x64/koffi.node +0 -0
  128. package/node_modules/koffi/doc/benchmarks.md +0 -126
  129. package/node_modules/koffi/doc/callbacks.md +0 -210
  130. package/node_modules/koffi/doc/contribute.md +0 -148
  131. package/node_modules/koffi/doc/functions.md +0 -250
  132. package/node_modules/koffi/doc/index.md +0 -61
  133. package/node_modules/koffi/doc/input.md +0 -471
  134. package/node_modules/koffi/doc/migration.md +0 -159
  135. package/node_modules/koffi/doc/misc.md +0 -180
  136. package/node_modules/koffi/doc/output.md +0 -305
  137. package/node_modules/koffi/doc/packaging.md +0 -88
  138. package/node_modules/koffi/doc/platforms.md +0 -36
  139. package/node_modules/koffi/doc/pointers.md +0 -328
  140. package/node_modules/koffi/doc/start.md +0 -118
  141. package/node_modules/koffi/doc/unions.md +0 -186
  142. package/node_modules/koffi/doc/variables.md +0 -102
  143. package/node_modules/koffi/index.d.ts +0 -288
  144. package/node_modules/koffi/index.js +0 -634
  145. package/node_modules/koffi/indirect.js +0 -533
  146. package/node_modules/koffi/lib/native/base/base.cc +0 -11015
  147. package/node_modules/koffi/lib/native/base/base.hh +0 -6003
  148. package/node_modules/koffi/lib/native/base/crc.inc +0 -2214
  149. package/node_modules/koffi/lib/native/base/crc_gen.py +0 -72
  150. package/node_modules/koffi/lib/native/base/mimetypes.inc +0 -1248
  151. package/node_modules/koffi/lib/native/base/mimetypes_gen.py +0 -58
  152. package/node_modules/koffi/lib/native/base/tower.cc +0 -821
  153. package/node_modules/koffi/lib/native/base/tower.hh +0 -81
  154. package/node_modules/koffi/lib/native/base/unicode.inc +0 -408
  155. package/node_modules/koffi/lib/native/base/unicode_gen.py +0 -152
  156. package/node_modules/koffi/package.json +0 -38
  157. package/node_modules/koffi/src/cnoke/LICENSE.txt +0 -22
  158. package/node_modules/koffi/src/cnoke/README.md +0 -99
  159. package/node_modules/koffi/src/cnoke/assets/FindCNoke.cmake +0 -127
  160. package/node_modules/koffi/src/cnoke/assets/toolchains.json +0 -126
  161. package/node_modules/koffi/src/cnoke/assets/win_delay_hook.c +0 -36
  162. package/node_modules/koffi/src/cnoke/cnoke.js +0 -170
  163. package/node_modules/koffi/src/cnoke/package.json +0 -24
  164. package/node_modules/koffi/src/cnoke/src/builder.js +0 -511
  165. package/node_modules/koffi/src/cnoke/src/index.js +0 -10
  166. package/node_modules/koffi/src/cnoke/src/tools.js +0 -407
  167. package/node_modules/koffi/src/koffi/CMakeLists.txt +0 -182
  168. package/node_modules/koffi/src/koffi/src/abi_arm32.cc +0 -1018
  169. package/node_modules/koffi/src/koffi/src/abi_arm32_asm.S +0 -169
  170. package/node_modules/koffi/src/koffi/src/abi_arm64.cc +0 -1295
  171. package/node_modules/koffi/src/koffi/src/abi_arm64_asm.S +0 -195
  172. package/node_modules/koffi/src/koffi/src/abi_arm64_asm.asm +0 -174
  173. package/node_modules/koffi/src/koffi/src/abi_loong64.cc +0 -5
  174. package/node_modules/koffi/src/koffi/src/abi_loong64_asm.S +0 -204
  175. package/node_modules/koffi/src/koffi/src/abi_riscv64.cc +0 -915
  176. package/node_modules/koffi/src/koffi/src/abi_riscv64_asm.S +0 -203
  177. package/node_modules/koffi/src/koffi/src/abi_x64_sysv.cc +0 -939
  178. package/node_modules/koffi/src/koffi/src/abi_x64_sysv_asm.S +0 -231
  179. package/node_modules/koffi/src/koffi/src/abi_x64_win.cc +0 -715
  180. package/node_modules/koffi/src/koffi/src/abi_x64_win_asm.S +0 -166
  181. package/node_modules/koffi/src/koffi/src/abi_x64_win_asm.asm +0 -192
  182. package/node_modules/koffi/src/koffi/src/abi_x86.cc +0 -860
  183. package/node_modules/koffi/src/koffi/src/abi_x86_asm.S +0 -193
  184. package/node_modules/koffi/src/koffi/src/abi_x86_asm.asm +0 -177
  185. package/node_modules/koffi/src/koffi/src/call.cc +0 -1326
  186. package/node_modules/koffi/src/koffi/src/call.hh +0 -179
  187. package/node_modules/koffi/src/koffi/src/errno.inc +0 -462
  188. package/node_modules/koffi/src/koffi/src/ffi.cc +0 -2702
  189. package/node_modules/koffi/src/koffi/src/ffi.hh +0 -354
  190. package/node_modules/koffi/src/koffi/src/init.js +0 -105
  191. package/node_modules/koffi/src/koffi/src/parser.cc +0 -220
  192. package/node_modules/koffi/src/koffi/src/parser.hh +0 -54
  193. package/node_modules/koffi/src/koffi/src/util.cc +0 -1807
  194. package/node_modules/koffi/src/koffi/src/util.hh +0 -221
  195. package/node_modules/koffi/src/koffi/src/uv.cc +0 -193
  196. package/node_modules/koffi/src/koffi/src/uv.def +0 -10
  197. package/node_modules/koffi/src/koffi/src/uv.hh +0 -40
  198. package/node_modules/koffi/src/koffi/src/win32.cc +0 -198
  199. package/node_modules/koffi/src/koffi/src/win32.hh +0 -119
  200. package/node_modules/koffi/src/koffi/tools/write_trampolines.js +0 -77
  201. package/node_modules/koffi/vendor/node-addon-api/LICENSE.md +0 -9
  202. package/node_modules/koffi/vendor/node-addon-api/README.md +0 -95
  203. package/node_modules/koffi/vendor/node-addon-api/napi-inl.deprecated.h +0 -186
  204. package/node_modules/koffi/vendor/node-addon-api/napi-inl.h +0 -7033
  205. package/node_modules/koffi/vendor/node-addon-api/napi.h +0 -3309
  206. package/node_modules/koffi/vendor/node-api-headers/LICENSE +0 -21
  207. package/node_modules/koffi/vendor/node-api-headers/README.md +0 -95
  208. package/node_modules/koffi/vendor/node-api-headers/def/js_native_api.def +0 -125
  209. package/node_modules/koffi/vendor/node-api-headers/def/node_api.def +0 -157
  210. package/node_modules/koffi/vendor/node-api-headers/include/js_native_api.h +0 -591
  211. package/node_modules/koffi/vendor/node-api-headers/include/js_native_api_types.h +0 -210
  212. package/node_modules/koffi/vendor/node-api-headers/include/node_api.h +0 -265
  213. package/node_modules/koffi/vendor/node-api-headers/include/node_api_types.h +0 -58
  214. package/node_modules/koffi/vendor/node-api-headers/include/uv/aix.h +0 -32
  215. package/node_modules/koffi/vendor/node-api-headers/include/uv/bsd.h +0 -34
  216. package/node_modules/koffi/vendor/node-api-headers/include/uv/darwin.h +0 -61
  217. package/node_modules/koffi/vendor/node-api-headers/include/uv/errno.h +0 -483
  218. package/node_modules/koffi/vendor/node-api-headers/include/uv/linux.h +0 -34
  219. package/node_modules/koffi/vendor/node-api-headers/include/uv/os390.h +0 -33
  220. package/node_modules/koffi/vendor/node-api-headers/include/uv/posix.h +0 -31
  221. package/node_modules/koffi/vendor/node-api-headers/include/uv/sunos.h +0 -44
  222. package/node_modules/koffi/vendor/node-api-headers/include/uv/threadpool.h +0 -37
  223. package/node_modules/koffi/vendor/node-api-headers/include/uv/tree.h +0 -521
  224. package/node_modules/koffi/vendor/node-api-headers/include/uv/unix.h +0 -512
  225. package/node_modules/koffi/vendor/node-api-headers/include/uv/version.h +0 -43
  226. package/node_modules/koffi/vendor/node-api-headers/include/uv/win.h +0 -698
  227. package/node_modules/koffi/vendor/node-api-headers/include/uv.h +0 -1990
@@ -1,533 +0,0 @@
1
- "use strict";
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __commonJS = (cb, mod3) => function __require() {
4
- return mod3 || (0, cb[__getOwnPropNames(cb)[0]])((mod3 = { exports: {} }).exports, mod3), mod3.exports;
5
- };
6
-
7
- // ../../bin/Koffi/package/src/cnoke/src/tools.js
8
- var require_tools = __commonJS({
9
- "../../bin/Koffi/package/src/cnoke/src/tools.js"(exports2, module2) {
10
- "use strict";
11
- var crypto = require("crypto");
12
- var fs2 = require("fs");
13
- var http = require("https");
14
- var path2 = require("path");
15
- var zlib = require("zlib");
16
- async function download_http(url, dest) {
17
- console.log(">> Downloading " + url);
18
- let [tmp_name, file] = open_temporary_stream(dest);
19
- try {
20
- await new Promise((resolve, reject) => {
21
- let request = http.get(url, (response) => {
22
- if (response.statusCode != 200) {
23
- let err = new Error(`Download failed: ${response.statusMessage} [${response.statusCode}]`);
24
- err.code = response.statusCode;
25
- reject(err);
26
- return;
27
- }
28
- response.pipe(file);
29
- file.on("finish", () => file.close(() => {
30
- try {
31
- fs2.renameSync(file.path, dest);
32
- } catch (err) {
33
- if (!fs2.existsSync(dest))
34
- reject(err);
35
- }
36
- resolve();
37
- }));
38
- });
39
- request.on("error", reject);
40
- file.on("error", reject);
41
- });
42
- } catch (err) {
43
- file.close();
44
- try {
45
- fs2.unlinkSync(tmp_name);
46
- } catch (err2) {
47
- if (err2.code != "ENOENT")
48
- throw err2;
49
- }
50
- throw err;
51
- }
52
- }
53
- function open_temporary_stream(prefix) {
54
- let buf = Buffer.allocUnsafe(4);
55
- for (; ; ) {
56
- try {
57
- crypto.randomFillSync(buf);
58
- let suffix = buf.toString("hex").padStart(8, "0");
59
- let filename2 = `${prefix}.${suffix}`;
60
- let file = fs2.createWriteStream(filename2, { flags: "wx", mode: 420 });
61
- return [filename2, file];
62
- } catch (err) {
63
- if (err.code != "EEXIST")
64
- throw err;
65
- }
66
- }
67
- }
68
- function extract_targz(filename2, dest_dir, strip = 0) {
69
- let reader = fs2.createReadStream(filename2).pipe(zlib.createGunzip());
70
- return new Promise((resolve, reject) => {
71
- let header = null;
72
- let extended = {};
73
- reader.on("readable", () => {
74
- try {
75
- for (; ; ) {
76
- if (header == null) {
77
- let buf = reader.read(512);
78
- if (buf == null)
79
- break;
80
- if (!buf[0])
81
- continue;
82
- header = {
83
- filename: buf.toString("utf-8", 0, 100).replace(/\0/g, ""),
84
- mode: parseInt(buf.toString("ascii", 100, 109), 8),
85
- size: parseInt(buf.toString("ascii", 124, 137), 8),
86
- type: String.fromCharCode(buf[156])
87
- };
88
- Object.assign(header, extended);
89
- extended = {};
90
- header.filename = header.filename.replace(/\\/g, "/");
91
- if (!header.filename.length)
92
- throw new Error(`Insecure empty filename inside TAR archive`);
93
- if (path_is_absolute(header.filename[0]))
94
- throw new Error(`Insecure filename starting with / inside TAR archive`);
95
- if (path_has_dotdot(header.filename))
96
- throw new Error(`Insecure filename containing '..' inside TAR archive`);
97
- for (let i = 0; i < strip; i++)
98
- header.filename = header.filename.substr(header.filename.indexOf("/") + 1);
99
- }
100
- let aligned = Math.floor((header.size + 511) / 512) * 512;
101
- let data = header.size ? reader.read(aligned) : null;
102
- if (data == null) {
103
- if (header.size)
104
- break;
105
- data = Buffer.alloc(0);
106
- }
107
- data = data.subarray(0, header.size);
108
- if (header.type == "0" || header.type == "7") {
109
- let filename3 = dest_dir + "/" + header.filename;
110
- let dirname = path2.dirname(filename3);
111
- fs2.mkdirSync(dirname, { recursive: true, mode: 493 });
112
- fs2.writeFileSync(filename3, data, { mode: header.mode });
113
- } else if (header.type == "5") {
114
- let filename3 = dest_dir + "/" + header.filename;
115
- fs2.mkdirSync(filename3, { recursive: true, mode: header.mode });
116
- } else if (header.type == "L") {
117
- extended.filename = data.toString("utf-8").replace(/\0/g, "");
118
- } else if (header.type == "x") {
119
- let str = data.toString("utf-8");
120
- try {
121
- while (str.length) {
122
- let matches = str.match(/^([0-9]+) ([a-zA-Z0-9\._]+)=(.*)\n/);
123
- let skip = parseInt(matches[1], 10);
124
- let key = matches[2];
125
- let value = matches[3];
126
- switch (key) {
127
- case "path":
128
- {
129
- extended.filename = value;
130
- }
131
- break;
132
- case "size":
133
- {
134
- extended.size = parseInt(value, 10);
135
- }
136
- break;
137
- }
138
- str = str.substr(skip).trimStart();
139
- }
140
- } catch (err) {
141
- throw new Error("Malformed PAX entry");
142
- }
143
- }
144
- header = null;
145
- }
146
- } catch (err) {
147
- reject(err);
148
- }
149
- });
150
- reader.on("error", reject);
151
- reader.on("end", resolve);
152
- });
153
- }
154
- function path_is_absolute(path3) {
155
- if (process.platform == "win32" && path3.match(/^[a-zA-Z]:/))
156
- path3 = path3.substr(2);
157
- return is_path_separator(path3[0]);
158
- }
159
- function path_has_dotdot(path3) {
160
- let start = 0;
161
- for (; ; ) {
162
- let offset = path3.indexOf("..", start);
163
- if (offset < 0)
164
- break;
165
- start = offset + 2;
166
- if (offset && !is_path_separator(path3[offset - 1]))
167
- continue;
168
- if (offset + 2 < path3.length && !is_path_separator(path3[offset + 2]))
169
- continue;
170
- return true;
171
- }
172
- return false;
173
- }
174
- function is_path_separator(c) {
175
- if (c == "/")
176
- return true;
177
- if (process.platform == "win32" && c == "\\")
178
- return true;
179
- return false;
180
- }
181
- function sync_files(src_dir, dest_dir) {
182
- let keep = /* @__PURE__ */ new Set();
183
- {
184
- let entries = fs2.readdirSync(src_dir, { withFileTypes: true });
185
- for (let entry of entries) {
186
- if (!entry.isFile())
187
- continue;
188
- keep.add(entry.name);
189
- fs2.copyFileSync(src_dir + `/${entry.name}`, dest_dir + `/${entry.name}`);
190
- }
191
- }
192
- {
193
- let entries = fs2.readdirSync(dest_dir, { withFileTypes: true });
194
- for (let entry of entries) {
195
- if (!entry.isFile())
196
- continue;
197
- if (keep.has(entry.name))
198
- continue;
199
- fs2.unlinkSync(dest_dir + `/${entry.name}`);
200
- }
201
- }
202
- }
203
- function determine_arch2() {
204
- let arch = process.arch;
205
- if (arch == "riscv32" || arch == "riscv64") {
206
- let buf = read_file_header(process.execPath, 512);
207
- let header = decode_elf_header(buf);
208
- let float_abi = header.e_flags & 6;
209
- switch (float_abi) {
210
- case 0:
211
- {
212
- }
213
- break;
214
- case 2:
215
- {
216
- arch += "f";
217
- }
218
- break;
219
- case 4:
220
- {
221
- arch += "d";
222
- }
223
- break;
224
- case 6:
225
- {
226
- arch += "q";
227
- }
228
- break;
229
- }
230
- } else if (arch == "arm") {
231
- let buf = read_file_header(process.execPath, 512);
232
- let header = decode_elf_header(buf);
233
- if (header.e_flags & 1024) {
234
- arch += "hf";
235
- } else if (header.e_flags & 512) {
236
- arch += "sf";
237
- } else {
238
- throw new Error("Unknown ARM floating-point ABI");
239
- }
240
- }
241
- return arch;
242
- }
243
- function read_file_header(filename2, read) {
244
- let fd = null;
245
- try {
246
- let fd2 = fs2.openSync(filename2);
247
- let buf = Buffer.allocUnsafe(read);
248
- let len = fs2.readSync(fd2, buf);
249
- return buf.subarray(0, len);
250
- } finally {
251
- if (fd != null)
252
- fs2.closeSync(fd);
253
- }
254
- }
255
- function decode_elf_header(buf) {
256
- let header = {};
257
- if (buf.length < 16)
258
- throw new Error("Truncated header");
259
- if (buf[0] != 127 || buf[1] != 69 || buf[2] != 76 || buf[3] != 70)
260
- throw new Error("Invalid magic number");
261
- if (buf[6] != 1)
262
- throw new Error("Invalid ELF version");
263
- if (buf[5] != 1)
264
- throw new Error("Big-endian architectures are not supported");
265
- let machine = buf.readUInt16LE(18);
266
- switch (machine) {
267
- case 3:
268
- {
269
- header.e_machine = "ia32";
270
- }
271
- break;
272
- case 40:
273
- {
274
- header.e_machine = "arm";
275
- }
276
- break;
277
- case 62:
278
- {
279
- header.e_machine = "amd64";
280
- }
281
- break;
282
- case 183:
283
- {
284
- header.e_machine = "arm64";
285
- }
286
- break;
287
- case 243:
288
- {
289
- switch (buf[4]) {
290
- case 1:
291
- {
292
- header.e_machine = "riscv32";
293
- }
294
- break;
295
- case 2:
296
- {
297
- header.e_machine = "riscv64";
298
- }
299
- break;
300
- }
301
- }
302
- break;
303
- case 248:
304
- {
305
- switch (buf[4]) {
306
- case 1:
307
- {
308
- header.e_machine = "loong32";
309
- }
310
- break;
311
- case 2:
312
- {
313
- header.e_machine = "loong64";
314
- }
315
- break;
316
- }
317
- }
318
- break;
319
- default:
320
- throw new Error("Unknown ELF machine type");
321
- }
322
- switch (buf[4]) {
323
- case 1:
324
- {
325
- buf = buf.subarray(0, 68);
326
- if (buf.length < 68)
327
- throw new Error("Truncated ELF header");
328
- header.ei_class = 32;
329
- header.e_flags = buf.readUInt32LE(36);
330
- }
331
- break;
332
- case 2:
333
- {
334
- buf = buf.subarray(0, 120);
335
- if (buf.length < 120)
336
- throw new Error("Truncated ELF header");
337
- header.ei_class = 64;
338
- header.e_flags = buf.readUInt32LE(48);
339
- }
340
- break;
341
- default:
342
- throw new Error("Invalid ELF class");
343
- }
344
- return header;
345
- }
346
- function unlink_recursive(path3) {
347
- try {
348
- fs2.rmSync(path3, { recursive: true, maxRetries: process.platform == "win32" ? 3 : 0 });
349
- } catch (err) {
350
- if (err.code !== "ENOENT")
351
- throw err;
352
- }
353
- }
354
- function get_napi_version2(napi, major) {
355
- if (napi > 8)
356
- return null;
357
- const support = {
358
- 6: ["6.14.2", "6.14.2", "6.14.2"],
359
- 8: ["8.6.0", "8.10.0", "8.11.2"],
360
- 9: ["9.0.0", "9.3.0", "9.11.0"],
361
- 10: ["10.0.0", "10.0.0", "10.0.0", "10.16.0", "10.17.0", "10.20.0", "10.23.0"],
362
- 11: ["11.0.0", "11.0.0", "11.0.0", "11.8.0"],
363
- 12: ["12.0.0", "12.0.0", "12.0.0", "12.0.0", "12.11.0", "12.17.0", "12.19.0", "12.22.0"],
364
- 13: ["13.0.0", "13.0.0", "13.0.0", "13.0.0", "13.0.0"],
365
- 14: ["14.0.0", "14.0.0", "14.0.0", "14.0.0", "14.0.0", "14.0.0", "14.12.0", "14.17.0"],
366
- 15: ["15.0.0", "15.0.0", "15.0.0", "15.0.0", "15.0.0", "15.0.0", "15.0.0", "15.12.0"]
367
- };
368
- const max = Math.max(...Object.keys(support).map((k) => parseInt(k, 10)));
369
- if (major > max)
370
- return major + ".0.0";
371
- if (support[major] == null)
372
- return null;
373
- let required = support[major][napi - 1] || null;
374
- return required;
375
- }
376
- function cmp_version(ver1, ver2) {
377
- ver1 = String(ver1).replace(/-.*$/, "").split(".").reduce((acc, v, idx) => acc + parseInt(v, 10) * Math.pow(10, 2 * (5 - idx)), 0);
378
- ver2 = String(ver2).replace(/-.*$/, "").split(".").reduce((acc, v, idx) => acc + parseInt(v, 10) * Math.pow(10, 2 * (5 - idx)), 0);
379
- let cmp = Math.min(Math.max(ver1 - ver2, -1), 1);
380
- return cmp;
381
- }
382
- module2.exports = {
383
- download_http,
384
- extract_targz,
385
- path_is_absolute,
386
- path_has_dotdot,
387
- sync_files,
388
- determine_arch: determine_arch2,
389
- unlink_recursive,
390
- get_napi_version: get_napi_version2,
391
- cmp_version
392
- };
393
- }
394
- });
395
-
396
- // ../../bin/Koffi/package/src/koffi/package.json
397
- var require_package = __commonJS({
398
- "../../bin/Koffi/package/src/koffi/package.json"(exports2, module2) {
399
- module2.exports = {
400
- name: "koffi",
401
- version: "2.16.2",
402
- description: "Fast and simple C FFI (foreign function interface) for Node.js",
403
- keywords: [
404
- "foreign",
405
- "function",
406
- "interface",
407
- "ffi",
408
- "binding",
409
- "c",
410
- "napi"
411
- ],
412
- repository: {
413
- type: "git",
414
- url: "https://github.com/Koromix/koffi"
415
- },
416
- homepage: "https://koffi.dev/",
417
- author: {
418
- name: "Niels Martign\xE8ne",
419
- email: "niels.martignene@protonmail.com",
420
- url: "https://koromix.dev/"
421
- },
422
- main: "./index.js",
423
- types: "./index.d.ts",
424
- scripts: {
425
- test: "node tools/brew.js test",
426
- prepack: `echo 'Use "npm run package" instead' && false`,
427
- prepublishOnly: `echo 'Use "npm run package" instead' && false`,
428
- package: "node tools/brew.js build"
429
- },
430
- license: "MIT",
431
- cnoke: {
432
- api: "../../vendor/node-api-headers",
433
- output: "../../bin/Koffi/{{ toolchain }}",
434
- node: 16,
435
- napi: 8,
436
- require: "./index.js"
437
- },
438
- funding: "https://liberapay.com/Koromix"
439
- };
440
- }
441
- });
442
-
443
- // ../../bin/Koffi/package/src/koffi/src/init.js
444
- var require_init = __commonJS({
445
- "../../bin/Koffi/package/src/koffi/src/init.js"(exports, module) {
446
- var fs = require("fs");
447
- var path = require("path");
448
- var util = require("util");
449
- var { get_napi_version, determine_arch } = require_tools();
450
- var pkg = require_package();
451
- function detect() {
452
- if (process.versions.napi == null || process.versions.napi < pkg.cnoke.napi) {
453
- let major = parseInt(process.versions.node, 10);
454
- let required = get_napi_version(pkg.cnoke.napi, major);
455
- if (required != null) {
456
- throw new Error(`This engine is based on Node ${process.versions.node}, but ${pkg.name} requires Node >= ${required} in the Node ${major}.x branch (N-API >= ${pkg.cnoke.napi})`);
457
- } else {
458
- throw new Error(`This engine is based on Node ${process.versions.node}, but ${pkg.name} does not support the Node ${major}.x branch (N-API < ${pkg.cnoke.napi})`);
459
- }
460
- }
461
- let arch = determine_arch();
462
- let triplet3 = `${process.platform}_${arch}`;
463
- return triplet3;
464
- }
465
- function init(triplet, native) {
466
- if (native == null) {
467
- let roots = [path.join(__dirname, "..")];
468
- let triplets = [triplet];
469
- if (process.resourcesPath != null)
470
- roots.push(process.resourcesPath);
471
- if (triplet.startsWith("linux_")) {
472
- let musl = triplet.replace(/^linux_/, "musl_");
473
- triplets.push(musl);
474
- }
475
- let filenames = roots.flatMap((root) => triplets.flatMap((triplet3) => [
476
- `${root}/koffi/build/koffi/${triplet3}/koffi.node`,
477
- `${root}/build/koffi/${triplet3}/koffi.node`,
478
- `${root}/koffi/${triplet3}/koffi.node`,
479
- `${root}/node_modules/koffi/build/koffi/${triplet3}/koffi.node`,
480
- `${root}/../../bin/Koffi/${triplet3}/koffi.node`
481
- ]));
482
- let first_err = null;
483
- for (let filename of filenames) {
484
- if (!fs.existsSync(filename))
485
- continue;
486
- try {
487
- native = eval("require")(filename);
488
- } catch (err) {
489
- if (first_err == null)
490
- first_err = err;
491
- continue;
492
- }
493
- break;
494
- }
495
- if (first_err != null)
496
- throw first_err;
497
- }
498
- if (native == null)
499
- throw new Error("Cannot find the native Koffi module; did you bundle it correctly?");
500
- if (native.version != pkg.version)
501
- throw new Error("Mismatched native Koffi modules");
502
- let mod = wrap(native);
503
- return mod;
504
- }
505
- function wrap(native2) {
506
- let obj = {
507
- ...native2,
508
- // Deprecated functions
509
- handle: util.deprecate(native2.opaque, "The koffi.handle() function was deprecated in Koffi 2.1, use koffi.opaque() instead", "KOFFI001"),
510
- callback: util.deprecate(native2.proto, "The koffi.callback() function was deprecated in Koffi 2.4, use koffi.proto() instead", "KOFFI002")
511
- };
512
- obj.load = (...args) => {
513
- let lib = native2.load(...args);
514
- lib.cdecl = util.deprecate((...args2) => lib.func("__cdecl", ...args2), "The koffi.cdecl() function was deprecated in Koffi 2.7, use koffi.func(...) instead", "KOFFI003");
515
- lib.stdcall = util.deprecate((...args2) => lib.func("__stdcall", ...args2), 'The koffi.stdcall() function was deprecated in Koffi 2.7, use koffi.func("__stdcall", ...) instead', "KOFFI004");
516
- lib.fastcall = util.deprecate((...args2) => lib.func("__fastcall", ...args2), 'The koffi.fastcall() function was deprecated in Koffi 2.7, use koffi.func("__fastcall", ...) instead', "KOFFI005");
517
- lib.thiscall = util.deprecate((...args2) => lib.func("__thiscall", ...args2), 'The koffi.thiscall() function was deprecated in Koffi 2.7, use koffi.func("__thiscall", ...) instead', "KOFFI006");
518
- return lib;
519
- };
520
- return obj;
521
- }
522
- module.exports = {
523
- detect,
524
- init
525
- };
526
- }
527
- });
528
-
529
- // ../../bin/Koffi/package/src/koffi/indirect.js
530
- var { detect: detect2, init: init2 } = require_init();
531
- var triplet2 = detect2();
532
- var mod2 = init2(triplet2, null);
533
- module.exports = mod2;