@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,179 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // SPDX-FileCopyrightText: 2025 Niels Martignène <niels.martignene@protonmail.com>
3
-
4
- #pragma once
5
-
6
- #include "lib/native/base/base.hh"
7
- #include "ffi.hh"
8
- #include "util.hh"
9
-
10
- #include <napi.h>
11
-
12
- namespace K {
13
-
14
- bool AnalyseFunction(Napi::Env env, InstanceData *instance, FunctionInfo *func);
15
-
16
- struct BackRegisters;
17
-
18
- // I'm not sure why the alignas(8), because alignof(CallData) is 8 without it.
19
- // But on Windows i386, without it, the alignment may not be correct (compiler bug?).
20
- struct alignas(8) CallData {
21
- struct OutArgument {
22
- enum class Kind {
23
- Array,
24
- Buffer,
25
- String,
26
- String16,
27
- String32,
28
- Object
29
- };
30
-
31
- Kind kind;
32
-
33
- napi_ref ref;
34
- const uint8_t *ptr;
35
- const TypeInfo *type;
36
-
37
- Size max_len; // Only for indirect strings
38
- };
39
-
40
- Napi::Env env;
41
- InstanceData *instance;
42
-
43
- InstanceMemory *mem;
44
- Span<uint8_t> old_stack_mem;
45
- Span<uint8_t> old_heap_mem;
46
-
47
- uint8_t *new_sp;
48
- uint8_t *old_sp;
49
-
50
- union {
51
- int8_t i8;
52
- uint8_t u8;
53
- int16_t i16;
54
- uint16_t u16;
55
- int32_t i32;
56
- uint32_t u32;
57
- int64_t i64;
58
- uint64_t u64;
59
- float f;
60
- double d;
61
- void *ptr;
62
- uint8_t buf[32];
63
- } result;
64
- uint8_t *return_ptr = nullptr;
65
-
66
- LocalArray<int16_t, 16> used_trampolines;
67
- HeapArray<OutArgument> out_arguments;
68
-
69
- BlockAllocator alloc;
70
-
71
- public:
72
- CallData(Napi::Env env, InstanceData *instance, InstanceMemory *mem);
73
- ~CallData();
74
-
75
- void Dispose();
76
-
77
- #if defined(UNITY_BUILD)
78
- #if defined(_MSC_VER)
79
- #define INLINE_IF_UNITY __forceinline
80
- #else
81
- #define INLINE_IF_UNITY __attribute__((always_inline)) inline
82
- #endif
83
- #else
84
- #define INLINE_IF_UNITY
85
- #endif
86
-
87
- INLINE_IF_UNITY bool Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info);
88
- INLINE_IF_UNITY void Execute(const FunctionInfo *func, void *native);
89
- INLINE_IF_UNITY Napi::Value Complete(const FunctionInfo *func);
90
-
91
- #undef INLINE_IF_UNITY
92
-
93
- void Relay(Size idx, uint8_t *sp);
94
- void RelayAsync(Size idx, uint8_t *sp);
95
-
96
- void DumpForward(const FunctionInfo *func) const;
97
-
98
- bool PushString(Napi::Value value, int directions, const char **out_str);
99
- bool PushString16(Napi::Value value, int directions, const char16_t **out_str16);
100
- bool PushString32(Napi::Value value, int directions, const char32_t **out_str32);
101
- Size PushStringValue(Napi::Value value, const char **out_str);
102
- Size PushString16Value(Napi::Value value, const char16_t **out_str16);
103
- Size PushString32Value(Napi::Value value, const char32_t **out_str32);
104
- bool PushObject(Napi::Object obj, const TypeInfo *type, uint8_t *origin);
105
- bool PushNormalArray(Napi::Array array, const TypeInfo *type, Size size, uint8_t *origin);
106
- void PushBuffer(Span<const uint8_t> buffer, const TypeInfo *type, uint8_t *origin);
107
- bool PushStringArray(Napi::Value value, const TypeInfo *type, uint8_t *origin);
108
- bool PushPointer(Napi::Value value, const TypeInfo *type, int directions, void **out_ptr);
109
- bool PushCallback(Napi::Value value, const TypeInfo *type, void **out_ptr);
110
- Size PushIndirectString(Napi::Array array, const TypeInfo *ref, uint8_t **out_ptr);
111
-
112
- void *ReserveTrampoline(const FunctionInfo *proto, Napi::Function func);
113
-
114
- template <typename T>
115
- bool AllocStack(Size size, Size align, T **out_ptr);
116
- template <typename T = uint8_t>
117
- T *AllocHeap(Size size, Size align);
118
-
119
- bool CheckDynamicLength(Napi::Object obj, Size element, const char *countedby, Napi::Value value);
120
-
121
- void PopOutArguments();
122
- };
123
-
124
- template <typename T>
125
- inline bool CallData::AllocStack(Size size, Size align, T **out_ptr)
126
- {
127
- uint8_t *ptr = AlignDown(mem->stack.end() - size, align);
128
- Size delta = mem->stack.end() - ptr;
129
-
130
- // Keep 512 bytes for redzone (required in some ABIs)
131
- if (mem->stack.len - 512 < delta) [[unlikely]] {
132
- ThrowError<Napi::Error>(env, "FFI call is taking up too much memory");
133
- return false;
134
- }
135
-
136
- #if defined(K_DEBUG)
137
- MemSet(ptr, 0, delta);
138
- #endif
139
-
140
- mem->stack.len -= delta;
141
-
142
- *out_ptr = (T *)ptr;
143
- return true;
144
- }
145
-
146
- template <typename T>
147
- inline T *CallData::AllocHeap(Size size, Size align)
148
- {
149
- uint8_t *ptr = AlignUp(mem->heap.ptr, align);
150
- Size delta = size + (ptr - mem->heap.ptr);
151
-
152
- if (size < 4096 && delta <= mem->heap.len) [[likely]] {
153
- #if defined(K_DEBUG)
154
- MemSet(mem->heap.ptr, 0, delta);
155
- #endif
156
-
157
- mem->heap.ptr += delta;
158
- mem->heap.len -= delta;
159
-
160
- return ptr;
161
- } else {
162
- #if defined(K_DEBUG)
163
- int flags = (int)AllocFlag::Zero;
164
- #else
165
- int flags = 0;
166
- #endif
167
-
168
- ptr = (uint8_t *)AllocateRaw(&alloc, size + align, flags);
169
- ptr = AlignUp(ptr, align);
170
-
171
- return ptr;
172
- }
173
- }
174
-
175
- void PerformAsyncRelay(napi_env env, napi_value callback, void *ctx, void *udata);
176
-
177
- void *GetTrampoline(int idx);
178
-
179
- }
@@ -1,462 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // SPDX-FileCopyrightText: 2025 Niels Martignène <niels.martignene@protonmail.com>
3
-
4
- #include <errno.h>
5
-
6
- struct ErrnoCodeInfo {
7
- const char *name;
8
- int value;
9
- };
10
-
11
- const ErrnoCodeInfo ErrnoCodes[] = {
12
- #if defined(E2BIG)
13
- {"E2BIG", E2BIG },
14
- #endif
15
- #if defined(EACCES)
16
- {"EACCES", EACCES },
17
- #endif
18
- #if defined(EADDRINUSE)
19
- {"EADDRINUSE", EADDRINUSE },
20
- #endif
21
- #if defined(EADDRNOTAVAIL)
22
- {"EADDRNOTAVAIL", EADDRNOTAVAIL },
23
- #endif
24
- #if defined(EADV)
25
- {"EADV", EADV },
26
- #endif
27
- #if defined(EAFNOSUPPORT)
28
- {"EAFNOSUPPORT", EAFNOSUPPORT },
29
- #endif
30
- #if defined(EAGAIN)
31
- {"EAGAIN", EAGAIN },
32
- #endif
33
- #if defined(EALREADY)
34
- {"EALREADY", EALREADY },
35
- #endif
36
- #if defined(EAUTH)
37
- {"EAUTH", EAUTH },
38
- #endif
39
- #if defined(EBADE)
40
- {"EBADE", EBADE },
41
- #endif
42
- #if defined(EBADF)
43
- {"EBADF", EBADF },
44
- #endif
45
- #if defined(EBADFD)
46
- {"EBADFD", EBADFD },
47
- #endif
48
- #if defined(EBADMSG)
49
- {"EBADMSG", EBADMSG },
50
- #endif
51
- #if defined(EBADR)
52
- {"EBADR", EBADR },
53
- #endif
54
- #if defined(EBADRPC)
55
- {"EBADRPC", EBADRPC },
56
- #endif
57
- #if defined(EBADRQC)
58
- {"EBADRQC", EBADRQC },
59
- #endif
60
- #if defined(EBADSLT)
61
- {"EBADSLT", EBADSLT },
62
- #endif
63
- #if defined(EBFONT)
64
- {"EBFONT", EBFONT },
65
- #endif
66
- #if defined(EBUSY)
67
- {"EBUSY", EBUSY },
68
- #endif
69
- #if defined(ECANCELED)
70
- {"ECANCELED", ECANCELED },
71
- #endif
72
- #if defined(ECAPMODE)
73
- {"ECAPMODE", ECAPMODE },
74
- #endif
75
- #if defined(ECHILD)
76
- {"ECHILD", ECHILD },
77
- #endif
78
- #if defined(ECHRNG)
79
- {"ECHRNG", ECHRNG },
80
- #endif
81
- #if defined(ECOMM)
82
- {"ECOMM", ECOMM },
83
- #endif
84
- #if defined(ECONNABORTED)
85
- {"ECONNABORTED", ECONNABORTED },
86
- #endif
87
- #if defined(ECONNREFUSED)
88
- {"ECONNREFUSED", ECONNREFUSED },
89
- #endif
90
- #if defined(ECONNRESET)
91
- {"ECONNRESET", ECONNRESET },
92
- #endif
93
- #if defined(EDEADLK)
94
- {"EDEADLK", EDEADLK },
95
- #endif
96
- #if defined(EDEADLOCK)
97
- {"EDEADLOCK", EDEADLOCK },
98
- #endif
99
- #if defined(EDESTADDRREQ)
100
- {"EDESTADDRREQ", EDESTADDRREQ },
101
- #endif
102
- #if defined(EDOM)
103
- {"EDOM", EDOM },
104
- #endif
105
- #if defined(EDOOFUS)
106
- {"EDOOFUS", EDOOFUS },
107
- #endif
108
- #if defined(EDOTDOT)
109
- {"EDOTDOT", EDOTDOT },
110
- #endif
111
- #if defined(EDQUOT)
112
- {"EDQUOT", EDQUOT },
113
- #endif
114
- #if defined(EEXIST)
115
- {"EEXIST", EEXIST },
116
- #endif
117
- #if defined(EFAULT)
118
- {"EFAULT", EFAULT },
119
- #endif
120
- #if defined(EFBIG)
121
- {"EFBIG", EFBIG },
122
- #endif
123
- #if defined(EFTYPE)
124
- {"EFTYPE", EFTYPE },
125
- #endif
126
- #if defined(EHOSTDOWN)
127
- {"EHOSTDOWN", EHOSTDOWN },
128
- #endif
129
- #if defined(EHOSTUNREACH)
130
- {"EHOSTUNREACH", EHOSTUNREACH },
131
- #endif
132
- #if defined(EHWPOISON)
133
- {"EHWPOISON", EHWPOISON },
134
- #endif
135
- #if defined(EIDRM)
136
- {"EIDRM", EIDRM },
137
- #endif
138
- #if defined(EILSEQ)
139
- {"EILSEQ", EILSEQ },
140
- #endif
141
- #if defined(EINPROGRESS)
142
- {"EINPROGRESS", EINPROGRESS },
143
- #endif
144
- #if defined(EINTEGRITY)
145
- {"EINTEGRITY", EINTEGRITY },
146
- #endif
147
- #if defined(EINTR)
148
- {"EINTR", EINTR },
149
- #endif
150
- #if defined(EINVAL)
151
- {"EINVAL", EINVAL },
152
- #endif
153
- #if defined(EIO)
154
- {"EIO", EIO },
155
- #endif
156
- #if defined(EISCONN)
157
- {"EISCONN", EISCONN },
158
- #endif
159
- #if defined(EISDIR)
160
- {"EISDIR", EISDIR },
161
- #endif
162
- #if defined(EISNAM)
163
- {"EISNAM", EISNAM },
164
- #endif
165
- #if defined(EKEYEXPIRED)
166
- {"EKEYEXPIRED", EKEYEXPIRED },
167
- #endif
168
- #if defined(EKEYREJECTED)
169
- {"EKEYREJECTED", EKEYREJECTED },
170
- #endif
171
- #if defined(EKEYREVOKED)
172
- {"EKEYREVOKED", EKEYREVOKED },
173
- #endif
174
- #if defined(EL2HLT)
175
- {"EL2HLT", EL2HLT },
176
- #endif
177
- #if defined(EL2NSYNC)
178
- {"EL2NSYNC", EL2NSYNC },
179
- #endif
180
- #if defined(EL3HLT)
181
- {"EL3HLT", EL3HLT },
182
- #endif
183
- #if defined(EL3RST)
184
- {"EL3RST", EL3RST },
185
- #endif
186
- #if defined(ELIBACC)
187
- {"ELIBACC", ELIBACC },
188
- #endif
189
- #if defined(ELIBBAD)
190
- {"ELIBBAD", ELIBBAD },
191
- #endif
192
- #if defined(ELIBEXEC)
193
- {"ELIBEXEC", ELIBEXEC },
194
- #endif
195
- #if defined(ELIBMAX)
196
- {"ELIBMAX", ELIBMAX },
197
- #endif
198
- #if defined(ELIBSCN)
199
- {"ELIBSCN", ELIBSCN },
200
- #endif
201
- #if defined(ELNRNG)
202
- {"ELNRNG", ELNRNG },
203
- #endif
204
- #if defined(ELOOP)
205
- {"ELOOP", ELOOP },
206
- #endif
207
- #if defined(EMEDIUMTYPE)
208
- {"EMEDIUMTYPE", EMEDIUMTYPE },
209
- #endif
210
- #if defined(EMFILE)
211
- {"EMFILE", EMFILE },
212
- #endif
213
- #if defined(EMLINK)
214
- {"EMLINK", EMLINK },
215
- #endif
216
- #if defined(EMSGSIZE)
217
- {"EMSGSIZE", EMSGSIZE },
218
- #endif
219
- #if defined(EMULTIHOP)
220
- {"EMULTIHOP", EMULTIHOP },
221
- #endif
222
- #if defined(ENAMETOOLONG)
223
- {"ENAMETOOLONG", ENAMETOOLONG },
224
- #endif
225
- #if defined(ENAVAIL)
226
- {"ENAVAIL", ENAVAIL },
227
- #endif
228
- #if defined(ENEEDAUTH)
229
- {"ENEEDAUTH", ENEEDAUTH },
230
- #endif
231
- #if defined(ENETDOWN)
232
- {"ENETDOWN", ENETDOWN },
233
- #endif
234
- #if defined(ENETRESET)
235
- {"ENETRESET", ENETRESET },
236
- #endif
237
- #if defined(ENETUNREACH)
238
- {"ENETUNREACH", ENETUNREACH },
239
- #endif
240
- #if defined(ENFILE)
241
- {"ENFILE", ENFILE },
242
- #endif
243
- #if defined(ENOANO)
244
- {"ENOANO", ENOANO },
245
- #endif
246
- #if defined(ENOATTR)
247
- {"ENOATTR", ENOATTR },
248
- #endif
249
- #if defined(ENOBUFS)
250
- {"ENOBUFS", ENOBUFS },
251
- #endif
252
- #if defined(ENOCSI)
253
- {"ENOCSI", ENOCSI },
254
- #endif
255
- #if defined(ENODATA)
256
- {"ENODATA", ENODATA },
257
- #endif
258
- #if defined(ENODEV)
259
- {"ENODEV", ENODEV },
260
- #endif
261
- #if defined(ENOENT)
262
- {"ENOENT", ENOENT },
263
- #endif
264
- #if defined(ENOEXEC)
265
- {"ENOEXEC", ENOEXEC },
266
- #endif
267
- #if defined(ENOKEY)
268
- {"ENOKEY", ENOKEY },
269
- #endif
270
- #if defined(ENOLCK)
271
- {"ENOLCK", ENOLCK },
272
- #endif
273
- #if defined(ENOLINK)
274
- {"ENOLINK", ENOLINK },
275
- #endif
276
- #if defined(ENOMEDIUM)
277
- {"ENOMEDIUM", ENOMEDIUM },
278
- #endif
279
- #if defined(ENOMEM)
280
- {"ENOMEM", ENOMEM },
281
- #endif
282
- #if defined(ENOMSG)
283
- {"ENOMSG", ENOMSG },
284
- #endif
285
- #if defined(ENONET)
286
- {"ENONET", ENONET },
287
- #endif
288
- #if defined(ENOPKG)
289
- {"ENOPKG", ENOPKG },
290
- #endif
291
- #if defined(ENOPROTOOPT)
292
- {"ENOPROTOOPT", ENOPROTOOPT },
293
- #endif
294
- #if defined(ENOSPC)
295
- {"ENOSPC", ENOSPC },
296
- #endif
297
- #if defined(ENOSR)
298
- {"ENOSR", ENOSR },
299
- #endif
300
- #if defined(ENOSTR)
301
- {"ENOSTR", ENOSTR },
302
- #endif
303
- #if defined(ENOSYS)
304
- {"ENOSYS", ENOSYS },
305
- #endif
306
- #if defined(ENOTBLK)
307
- {"ENOTBLK", ENOTBLK },
308
- #endif
309
- #if defined(ENOTCAPABLE)
310
- {"ENOTCAPABLE", ENOTCAPABLE },
311
- #endif
312
- #if defined(ENOTCONN)
313
- {"ENOTCONN", ENOTCONN },
314
- #endif
315
- #if defined(ENOTDIR)
316
- {"ENOTDIR", ENOTDIR },
317
- #endif
318
- #if defined(ENOTEMPTY)
319
- {"ENOTEMPTY", ENOTEMPTY },
320
- #endif
321
- #if defined(ENOTNAM)
322
- {"ENOTNAM", ENOTNAM },
323
- #endif
324
- #if defined(ENOTRECOVERABLE)
325
- {"ENOTRECOVERABLE", ENOTRECOVERABLE },
326
- #endif
327
- #if defined(ENOTSOCK)
328
- {"ENOTSOCK", ENOTSOCK },
329
- #endif
330
- #if defined(ENOTSUP)
331
- {"ENOTSUP", ENOTSUP },
332
- #endif
333
- #if defined(ENOTTY)
334
- {"ENOTTY", ENOTTY },
335
- #endif
336
- #if defined(ENOTUNIQ)
337
- {"ENOTUNIQ", ENOTUNIQ },
338
- #endif
339
- #if defined(ENXIO)
340
- {"ENXIO", ENXIO },
341
- #endif
342
- #if defined(EOPNOTSUPP)
343
- {"EOPNOTSUPP", EOPNOTSUPP },
344
- #endif
345
- #if defined(EOTHER)
346
- {"EOTHER", EOTHER },
347
- #endif
348
- #if defined(EOVERFLOW)
349
- {"EOVERFLOW", EOVERFLOW },
350
- #endif
351
- #if defined(EOWNERDEAD)
352
- {"EOWNERDEAD", EOWNERDEAD },
353
- #endif
354
- #if defined(EPERM)
355
- {"EPERM", EPERM },
356
- #endif
357
- #if defined(EPFNOSUPPORT)
358
- {"EPFNOSUPPORT", EPFNOSUPPORT },
359
- #endif
360
- #if defined(EPIPE)
361
- {"EPIPE", EPIPE },
362
- #endif
363
- #if defined(EPROCLIM)
364
- {"EPROCLIM", EPROCLIM },
365
- #endif
366
- #if defined(EPROCUNAVAIL)
367
- {"EPROCUNAVAIL", EPROCUNAVAIL },
368
- #endif
369
- #if defined(EPROGMISMATCH)
370
- {"EPROGMISMATCH", EPROGMISMATCH },
371
- #endif
372
- #if defined(EPROGUNAVAIL)
373
- {"EPROGUNAVAIL", EPROGUNAVAIL },
374
- #endif
375
- #if defined(EPROTO)
376
- {"EPROTO", EPROTO },
377
- #endif
378
- #if defined(EPROTONOSUPPORT)
379
- {"EPROTONOSUPPORT", EPROTONOSUPPORT },
380
- #endif
381
- #if defined(EPROTOTYPE)
382
- {"EPROTOTYPE", EPROTOTYPE },
383
- #endif
384
- #if defined(ERANGE)
385
- {"ERANGE", ERANGE },
386
- #endif
387
- #if defined(EREMCHG)
388
- {"EREMCHG", EREMCHG },
389
- #endif
390
- #if defined(EREMOTE)
391
- {"EREMOTE", EREMOTE },
392
- #endif
393
- #if defined(EREMOTEIO)
394
- {"EREMOTEIO", EREMOTEIO },
395
- #endif
396
- #if defined(ERESTART)
397
- {"ERESTART", ERESTART },
398
- #endif
399
- #if defined(ERFKILL)
400
- {"ERFKILL", ERFKILL },
401
- #endif
402
- #if defined(EROFS)
403
- {"EROFS", EROFS },
404
- #endif
405
- #if defined(ERPCMISMATCH)
406
- {"ERPCMISMATCH", ERPCMISMATCH },
407
- #endif
408
- #if defined(ESHUTDOWN)
409
- {"ESHUTDOWN", ESHUTDOWN },
410
- #endif
411
- #if defined(ESOCKTNOSUPPORT)
412
- {"ESOCKTNOSUPPORT", ESOCKTNOSUPPORT },
413
- #endif
414
- #if defined(ESPIPE)
415
- {"ESPIPE", ESPIPE },
416
- #endif
417
- #if defined(ESRCH)
418
- {"ESRCH", ESRCH },
419
- #endif
420
- #if defined(ESRMNT)
421
- {"ESRMNT", ESRMNT },
422
- #endif
423
- #if defined(ESTALE)
424
- {"ESTALE", ESTALE },
425
- #endif
426
- #if defined(ESTRPIPE)
427
- {"ESTRPIPE", ESTRPIPE },
428
- #endif
429
- #if defined(ETIME)
430
- {"ETIME", ETIME },
431
- #endif
432
- #if defined(ETIMEDOUT)
433
- {"ETIMEDOUT", ETIMEDOUT },
434
- #endif
435
- #if defined(ETOOMANYREFS)
436
- {"ETOOMANYREFS", ETOOMANYREFS },
437
- #endif
438
- #if defined(ETXTBSY)
439
- {"ETXTBSY", ETXTBSY },
440
- #endif
441
- #if defined(EUCLEAN)
442
- {"EUCLEAN", EUCLEAN },
443
- #endif
444
- #if defined(EUNATCH)
445
- {"EUNATCH", EUNATCH },
446
- #endif
447
- #if defined(EUSERS)
448
- {"EUSERS", EUSERS },
449
- #endif
450
- #if defined(EWOULDBLOCK)
451
- {"EWOULDBLOCK", EWOULDBLOCK },
452
- #endif
453
- #if defined(EXDEV)
454
- {"EXDEV", EXDEV },
455
- #endif
456
- #if defined(EXFULL)
457
- {"EXFULL", EXFULL },
458
- #endif
459
- #if defined(STRUNCATE)
460
- {"STRUNCATE", STRUNCATE },
461
- #endif
462
- };