@xberg-io/liter-llm 1.18.4 → 1.19.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.
package/index.js CHANGED
@@ -4,526 +4,685 @@
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
6
  const { readFileSync } = require('fs')
7
- let nativeBinding = null
8
- const loadErrors = []
7
+ let nativeBinding = null;
8
+ const loadErrors = [];
9
9
 
10
10
  const isMusl = () => {
11
- let musl = false
12
- if (process.platform === 'linux') {
13
- musl = isMuslFromFilesystem()
11
+ let musl = false;
12
+ if (process.platform === "linux") {
13
+ musl = isMuslFromFilesystem();
14
14
  if (musl === null) {
15
- musl = isMuslFromReport()
15
+ musl = isMuslFromReport();
16
16
  }
17
17
  if (musl === null) {
18
- musl = isMuslFromChildProcess()
18
+ musl = isMuslFromChildProcess();
19
19
  }
20
20
  }
21
- return musl
22
- }
21
+ return musl;
22
+ };
23
23
 
24
- const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
24
+ const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
25
25
 
26
26
  const isMuslFromFilesystem = () => {
27
27
  try {
28
- return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
28
+ return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
29
29
  } catch {
30
- return null
30
+ return null;
31
31
  }
32
- }
32
+ };
33
33
 
34
34
  const isMuslFromReport = () => {
35
- let report = null
36
- if (process.report && typeof process.report.getReport === 'function') {
37
- process.report.excludeNetwork = true
38
- report = process.report.getReport()
35
+ let report = null;
36
+ if (process.report && typeof process.report.getReport === "function") {
37
+ process.report.excludeNetwork = true;
38
+ report = process.report.getReport();
39
39
  }
40
40
  if (!report) {
41
- return null
41
+ return null;
42
42
  }
43
43
  if (report.header && report.header.glibcVersionRuntime) {
44
- return false
44
+ return false;
45
45
  }
46
46
  if (Array.isArray(report.sharedObjects)) {
47
47
  if (report.sharedObjects.some(isFileMusl)) {
48
- return true
48
+ return true;
49
49
  }
50
50
  }
51
- return false
52
- }
51
+ return false;
52
+ };
53
53
 
54
54
  const isMuslFromChildProcess = () => {
55
55
  try {
56
- return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
56
+ return require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
57
57
  } catch (e) {
58
58
  // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
59
- return false
59
+ return false;
60
60
  }
61
- }
61
+ };
62
62
 
63
63
  function requireNative() {
64
64
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
65
65
  try {
66
66
  return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
67
67
  } catch (err) {
68
- loadErrors.push(err)
68
+ loadErrors.push(err);
69
69
  }
70
- } else if (process.platform === 'android') {
71
- if (process.arch === 'arm64') {
70
+ } else if (process.platform === "android") {
71
+ if (process.arch === "arm64") {
72
72
  try {
73
- return require('./liter-llm-node.android-arm64.node')
73
+ return require("./liter-llm-node.android-arm64.node");
74
74
  } catch (e) {
75
- loadErrors.push(e)
75
+ loadErrors.push(e);
76
76
  }
77
77
  try {
78
- const binding = require('@xberg-io/liter-llm-android-arm64')
79
- const bindingPackageVersion = require('@xberg-io/liter-llm-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
- }
83
- return binding
78
+ const binding = require("@xberg-io/liter-llm-android-arm64");
79
+ const bindingPackageVersion = require("@xberg-io/liter-llm-android-arm64/package.json").version;
80
+ if (
81
+ bindingPackageVersion !== "1.17.1" &&
82
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
83
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
84
+ ) {
85
+ throw new Error(
86
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
87
+ );
88
+ }
89
+ return binding;
84
90
  } catch (e) {
85
- loadErrors.push(e)
91
+ loadErrors.push(e);
86
92
  }
87
- } else if (process.arch === 'arm') {
93
+ } else if (process.arch === "arm") {
88
94
  try {
89
- return require('./liter-llm-node.android-arm-eabi.node')
95
+ return require("./liter-llm-node.android-arm-eabi.node");
90
96
  } catch (e) {
91
- loadErrors.push(e)
97
+ loadErrors.push(e);
92
98
  }
93
99
  try {
94
- const binding = require('@xberg-io/liter-llm-android-arm-eabi')
95
- const bindingPackageVersion = require('@xberg-io/liter-llm-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
- }
99
- return binding
100
+ const binding = require("@xberg-io/liter-llm-android-arm-eabi");
101
+ const bindingPackageVersion = require("@xberg-io/liter-llm-android-arm-eabi/package.json").version;
102
+ if (
103
+ bindingPackageVersion !== "1.17.1" &&
104
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
105
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
106
+ ) {
107
+ throw new Error(
108
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
109
+ );
110
+ }
111
+ return binding;
100
112
  } catch (e) {
101
- loadErrors.push(e)
113
+ loadErrors.push(e);
102
114
  }
103
115
  } else {
104
- loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
116
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
105
117
  }
106
- } else if (process.platform === 'win32') {
107
- if (process.arch === 'x64') {
108
- if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) {
118
+ } else if (process.platform === "win32") {
119
+ if (process.arch === "x64") {
120
+ if (
121
+ (process.config && process.config.variables && process.config.variables.shlib_suffix === "dll.a") ||
122
+ (process.config && process.config.variables && process.config.variables.node_target_type === "shared_library")
123
+ ) {
109
124
  try {
110
- return require('./liter-llm-node.win32-x64-gnu.node')
111
- } catch (e) {
112
- loadErrors.push(e)
113
- }
114
- try {
115
- const binding = require('@xberg-io/liter-llm-win32-x64-gnu')
116
- const bindingPackageVersion = require('@xberg-io/liter-llm-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
125
+ return require("./liter-llm-node.win32-x64-gnu.node");
126
+ } catch (e) {
127
+ loadErrors.push(e);
128
+ }
129
+ try {
130
+ const binding = require("@xberg-io/liter-llm-win32-x64-gnu");
131
+ const bindingPackageVersion = require("@xberg-io/liter-llm-win32-x64-gnu/package.json").version;
132
+ if (
133
+ bindingPackageVersion !== "1.17.1" &&
134
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
135
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
136
+ ) {
137
+ throw new Error(
138
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
139
+ );
140
+ }
141
+ return binding;
142
+ } catch (e) {
143
+ loadErrors.push(e);
119
144
  }
120
- return binding
121
- } catch (e) {
122
- loadErrors.push(e)
123
- }
124
145
  } else {
125
146
  try {
126
- return require('./liter-llm-node.win32-x64-msvc.node')
127
- } catch (e) {
128
- loadErrors.push(e)
129
- }
130
- try {
131
- const binding = require('@xberg-io/liter-llm-win32-x64-msvc')
132
- const bindingPackageVersion = require('@xberg-io/liter-llm-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
147
+ return require("./liter-llm-node.win32-x64-msvc.node");
148
+ } catch (e) {
149
+ loadErrors.push(e);
150
+ }
151
+ try {
152
+ const binding = require("@xberg-io/liter-llm-win32-x64-msvc");
153
+ const bindingPackageVersion = require("@xberg-io/liter-llm-win32-x64-msvc/package.json").version;
154
+ if (
155
+ bindingPackageVersion !== "1.17.1" &&
156
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
157
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
158
+ ) {
159
+ throw new Error(
160
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
161
+ );
162
+ }
163
+ return binding;
164
+ } catch (e) {
165
+ loadErrors.push(e);
135
166
  }
136
- return binding
137
- } catch (e) {
138
- loadErrors.push(e)
139
- }
140
167
  }
141
- } else if (process.arch === 'ia32') {
168
+ } else if (process.arch === "ia32") {
142
169
  try {
143
- return require('./liter-llm-node.win32-ia32-msvc.node')
170
+ return require("./liter-llm-node.win32-ia32-msvc.node");
144
171
  } catch (e) {
145
- loadErrors.push(e)
172
+ loadErrors.push(e);
146
173
  }
147
174
  try {
148
- const binding = require('@xberg-io/liter-llm-win32-ia32-msvc')
149
- const bindingPackageVersion = require('@xberg-io/liter-llm-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
- }
153
- return binding
175
+ const binding = require("@xberg-io/liter-llm-win32-ia32-msvc");
176
+ const bindingPackageVersion = require("@xberg-io/liter-llm-win32-ia32-msvc/package.json").version;
177
+ if (
178
+ bindingPackageVersion !== "1.17.1" &&
179
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
180
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
181
+ ) {
182
+ throw new Error(
183
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
184
+ );
185
+ }
186
+ return binding;
154
187
  } catch (e) {
155
- loadErrors.push(e)
188
+ loadErrors.push(e);
156
189
  }
157
- } else if (process.arch === 'arm64') {
190
+ } else if (process.arch === "arm64") {
158
191
  try {
159
- return require('./liter-llm-node.win32-arm64-msvc.node')
192
+ return require("./liter-llm-node.win32-arm64-msvc.node");
160
193
  } catch (e) {
161
- loadErrors.push(e)
194
+ loadErrors.push(e);
162
195
  }
163
196
  try {
164
- const binding = require('@xberg-io/liter-llm-win32-arm64-msvc')
165
- const bindingPackageVersion = require('@xberg-io/liter-llm-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
- }
169
- return binding
197
+ const binding = require("@xberg-io/liter-llm-win32-arm64-msvc");
198
+ const bindingPackageVersion = require("@xberg-io/liter-llm-win32-arm64-msvc/package.json").version;
199
+ if (
200
+ bindingPackageVersion !== "1.17.1" &&
201
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
202
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
203
+ ) {
204
+ throw new Error(
205
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
206
+ );
207
+ }
208
+ return binding;
170
209
  } catch (e) {
171
- loadErrors.push(e)
210
+ loadErrors.push(e);
172
211
  }
173
212
  } else {
174
- loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
213
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
175
214
  }
176
- } else if (process.platform === 'darwin') {
215
+ } else if (process.platform === "darwin") {
177
216
  try {
178
- return require('./liter-llm-node.darwin-universal.node')
217
+ return require("./liter-llm-node.darwin-universal.node");
179
218
  } catch (e) {
180
- loadErrors.push(e)
219
+ loadErrors.push(e);
181
220
  }
182
221
  try {
183
- const binding = require('@xberg-io/liter-llm-darwin-universal')
184
- const bindingPackageVersion = require('@xberg-io/liter-llm-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
- }
188
- return binding
222
+ const binding = require("@xberg-io/liter-llm-darwin-universal");
223
+ const bindingPackageVersion = require("@xberg-io/liter-llm-darwin-universal/package.json").version;
224
+ if (
225
+ bindingPackageVersion !== "1.17.1" &&
226
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
227
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
228
+ ) {
229
+ throw new Error(
230
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
231
+ );
232
+ }
233
+ return binding;
189
234
  } catch (e) {
190
- loadErrors.push(e)
235
+ loadErrors.push(e);
191
236
  }
192
- if (process.arch === 'x64') {
237
+ if (process.arch === "x64") {
193
238
  try {
194
- return require('./liter-llm-node.darwin-x64.node')
239
+ return require("./liter-llm-node.darwin-x64.node");
195
240
  } catch (e) {
196
- loadErrors.push(e)
241
+ loadErrors.push(e);
197
242
  }
198
243
  try {
199
- const binding = require('@xberg-io/liter-llm-darwin-x64')
200
- const bindingPackageVersion = require('@xberg-io/liter-llm-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
- }
204
- return binding
244
+ const binding = require("@xberg-io/liter-llm-darwin-x64");
245
+ const bindingPackageVersion = require("@xberg-io/liter-llm-darwin-x64/package.json").version;
246
+ if (
247
+ bindingPackageVersion !== "1.17.1" &&
248
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
249
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
250
+ ) {
251
+ throw new Error(
252
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
253
+ );
254
+ }
255
+ return binding;
205
256
  } catch (e) {
206
- loadErrors.push(e)
257
+ loadErrors.push(e);
207
258
  }
208
- } else if (process.arch === 'arm64') {
259
+ } else if (process.arch === "arm64") {
209
260
  try {
210
- return require('./liter-llm-node.darwin-arm64.node')
261
+ return require("./liter-llm-node.darwin-arm64.node");
211
262
  } catch (e) {
212
- loadErrors.push(e)
263
+ loadErrors.push(e);
213
264
  }
214
265
  try {
215
- const binding = require('@xberg-io/liter-llm-darwin-arm64')
216
- const bindingPackageVersion = require('@xberg-io/liter-llm-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
- }
220
- return binding
266
+ const binding = require("@xberg-io/liter-llm-darwin-arm64");
267
+ const bindingPackageVersion = require("@xberg-io/liter-llm-darwin-arm64/package.json").version;
268
+ if (
269
+ bindingPackageVersion !== "1.17.1" &&
270
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
271
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
272
+ ) {
273
+ throw new Error(
274
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
275
+ );
276
+ }
277
+ return binding;
221
278
  } catch (e) {
222
- loadErrors.push(e)
279
+ loadErrors.push(e);
223
280
  }
224
281
  } else {
225
- loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
282
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
226
283
  }
227
- } else if (process.platform === 'freebsd') {
228
- if (process.arch === 'x64') {
284
+ } else if (process.platform === "freebsd") {
285
+ if (process.arch === "x64") {
229
286
  try {
230
- return require('./liter-llm-node.freebsd-x64.node')
287
+ return require("./liter-llm-node.freebsd-x64.node");
231
288
  } catch (e) {
232
- loadErrors.push(e)
289
+ loadErrors.push(e);
233
290
  }
234
291
  try {
235
- const binding = require('@xberg-io/liter-llm-freebsd-x64')
236
- const bindingPackageVersion = require('@xberg-io/liter-llm-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
- }
240
- return binding
292
+ const binding = require("@xberg-io/liter-llm-freebsd-x64");
293
+ const bindingPackageVersion = require("@xberg-io/liter-llm-freebsd-x64/package.json").version;
294
+ if (
295
+ bindingPackageVersion !== "1.17.1" &&
296
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
297
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
298
+ ) {
299
+ throw new Error(
300
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
301
+ );
302
+ }
303
+ return binding;
241
304
  } catch (e) {
242
- loadErrors.push(e)
305
+ loadErrors.push(e);
243
306
  }
244
- } else if (process.arch === 'arm64') {
307
+ } else if (process.arch === "arm64") {
245
308
  try {
246
- return require('./liter-llm-node.freebsd-arm64.node')
309
+ return require("./liter-llm-node.freebsd-arm64.node");
247
310
  } catch (e) {
248
- loadErrors.push(e)
311
+ loadErrors.push(e);
249
312
  }
250
313
  try {
251
- const binding = require('@xberg-io/liter-llm-freebsd-arm64')
252
- const bindingPackageVersion = require('@xberg-io/liter-llm-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
- }
256
- return binding
314
+ const binding = require("@xberg-io/liter-llm-freebsd-arm64");
315
+ const bindingPackageVersion = require("@xberg-io/liter-llm-freebsd-arm64/package.json").version;
316
+ if (
317
+ bindingPackageVersion !== "1.17.1" &&
318
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
319
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
320
+ ) {
321
+ throw new Error(
322
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
323
+ );
324
+ }
325
+ return binding;
257
326
  } catch (e) {
258
- loadErrors.push(e)
327
+ loadErrors.push(e);
259
328
  }
260
329
  } else {
261
- loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
330
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
262
331
  }
263
- } else if (process.platform === 'linux') {
264
- if (process.arch === 'x64') {
332
+ } else if (process.platform === "linux") {
333
+ if (process.arch === "x64") {
265
334
  if (isMusl()) {
266
335
  try {
267
- return require('./liter-llm-node.linux-x64-musl.node')
336
+ return require("./liter-llm-node.linux-x64-musl.node");
268
337
  } catch (e) {
269
- loadErrors.push(e)
338
+ loadErrors.push(e);
270
339
  }
271
340
  try {
272
- const binding = require('@xberg-io/liter-llm-linux-x64-musl')
273
- const bindingPackageVersion = require('@xberg-io/liter-llm-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
341
+ const binding = require("@xberg-io/liter-llm-linux-x64-musl");
342
+ const bindingPackageVersion = require("@xberg-io/liter-llm-linux-x64-musl/package.json").version;
343
+ if (
344
+ bindingPackageVersion !== "1.17.1" &&
345
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
346
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
347
+ ) {
348
+ throw new Error(
349
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
350
+ );
276
351
  }
277
- return binding
352
+ return binding;
278
353
  } catch (e) {
279
- loadErrors.push(e)
354
+ loadErrors.push(e);
280
355
  }
281
356
  } else {
282
357
  try {
283
- return require('./liter-llm-node.linux-x64-gnu.node')
358
+ return require("./liter-llm-node.linux-x64-gnu.node");
284
359
  } catch (e) {
285
- loadErrors.push(e)
360
+ loadErrors.push(e);
286
361
  }
287
362
  try {
288
- const binding = require('@xberg-io/liter-llm-linux-x64-gnu')
289
- const bindingPackageVersion = require('@xberg-io/liter-llm-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
363
+ const binding = require("@xberg-io/liter-llm-linux-x64-gnu");
364
+ const bindingPackageVersion = require("@xberg-io/liter-llm-linux-x64-gnu/package.json").version;
365
+ if (
366
+ bindingPackageVersion !== "1.17.1" &&
367
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
368
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
369
+ ) {
370
+ throw new Error(
371
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
372
+ );
292
373
  }
293
- return binding
374
+ return binding;
294
375
  } catch (e) {
295
- loadErrors.push(e)
376
+ loadErrors.push(e);
296
377
  }
297
378
  }
298
- } else if (process.arch === 'arm64') {
379
+ } else if (process.arch === "arm64") {
299
380
  if (isMusl()) {
300
381
  try {
301
- return require('./liter-llm-node.linux-arm64-musl.node')
382
+ return require("./liter-llm-node.linux-arm64-musl.node");
302
383
  } catch (e) {
303
- loadErrors.push(e)
384
+ loadErrors.push(e);
304
385
  }
305
386
  try {
306
- const binding = require('@xberg-io/liter-llm-linux-arm64-musl')
307
- const bindingPackageVersion = require('@xberg-io/liter-llm-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
387
+ const binding = require("@xberg-io/liter-llm-linux-arm64-musl");
388
+ const bindingPackageVersion = require("@xberg-io/liter-llm-linux-arm64-musl/package.json").version;
389
+ if (
390
+ bindingPackageVersion !== "1.17.1" &&
391
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
392
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
393
+ ) {
394
+ throw new Error(
395
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
396
+ );
310
397
  }
311
- return binding
398
+ return binding;
312
399
  } catch (e) {
313
- loadErrors.push(e)
400
+ loadErrors.push(e);
314
401
  }
315
402
  } else {
316
403
  try {
317
- return require('./liter-llm-node.linux-arm64-gnu.node')
404
+ return require("./liter-llm-node.linux-arm64-gnu.node");
318
405
  } catch (e) {
319
- loadErrors.push(e)
406
+ loadErrors.push(e);
320
407
  }
321
408
  try {
322
- const binding = require('@xberg-io/liter-llm-linux-arm64-gnu')
323
- const bindingPackageVersion = require('@xberg-io/liter-llm-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
409
+ const binding = require("@xberg-io/liter-llm-linux-arm64-gnu");
410
+ const bindingPackageVersion = require("@xberg-io/liter-llm-linux-arm64-gnu/package.json").version;
411
+ if (
412
+ bindingPackageVersion !== "1.17.1" &&
413
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
414
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
415
+ ) {
416
+ throw new Error(
417
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
418
+ );
326
419
  }
327
- return binding
420
+ return binding;
328
421
  } catch (e) {
329
- loadErrors.push(e)
422
+ loadErrors.push(e);
330
423
  }
331
424
  }
332
- } else if (process.arch === 'arm') {
425
+ } else if (process.arch === "arm") {
333
426
  if (isMusl()) {
334
427
  try {
335
- return require('./liter-llm-node.linux-arm-musleabihf.node')
428
+ return require("./liter-llm-node.linux-arm-musleabihf.node");
336
429
  } catch (e) {
337
- loadErrors.push(e)
430
+ loadErrors.push(e);
338
431
  }
339
432
  try {
340
- const binding = require('@xberg-io/liter-llm-linux-arm-musleabihf')
341
- const bindingPackageVersion = require('@xberg-io/liter-llm-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
433
+ const binding = require("@xberg-io/liter-llm-linux-arm-musleabihf");
434
+ const bindingPackageVersion = require("@xberg-io/liter-llm-linux-arm-musleabihf/package.json").version;
435
+ if (
436
+ bindingPackageVersion !== "1.17.1" &&
437
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
438
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
439
+ ) {
440
+ throw new Error(
441
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
442
+ );
344
443
  }
345
- return binding
444
+ return binding;
346
445
  } catch (e) {
347
- loadErrors.push(e)
446
+ loadErrors.push(e);
348
447
  }
349
448
  } else {
350
449
  try {
351
- return require('./liter-llm-node.linux-arm-gnueabihf.node')
450
+ return require("./liter-llm-node.linux-arm-gnueabihf.node");
352
451
  } catch (e) {
353
- loadErrors.push(e)
452
+ loadErrors.push(e);
354
453
  }
355
454
  try {
356
- const binding = require('@xberg-io/liter-llm-linux-arm-gnueabihf')
357
- const bindingPackageVersion = require('@xberg-io/liter-llm-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
455
+ const binding = require("@xberg-io/liter-llm-linux-arm-gnueabihf");
456
+ const bindingPackageVersion = require("@xberg-io/liter-llm-linux-arm-gnueabihf/package.json").version;
457
+ if (
458
+ bindingPackageVersion !== "1.17.1" &&
459
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
460
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
461
+ ) {
462
+ throw new Error(
463
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
464
+ );
360
465
  }
361
- return binding
466
+ return binding;
362
467
  } catch (e) {
363
- loadErrors.push(e)
468
+ loadErrors.push(e);
364
469
  }
365
470
  }
366
- } else if (process.arch === 'loong64') {
471
+ } else if (process.arch === "loong64") {
367
472
  if (isMusl()) {
368
473
  try {
369
- return require('./liter-llm-node.linux-loong64-musl.node')
474
+ return require("./liter-llm-node.linux-loong64-musl.node");
370
475
  } catch (e) {
371
- loadErrors.push(e)
476
+ loadErrors.push(e);
372
477
  }
373
478
  try {
374
- const binding = require('@xberg-io/liter-llm-linux-loong64-musl')
375
- const bindingPackageVersion = require('@xberg-io/liter-llm-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ const binding = require("@xberg-io/liter-llm-linux-loong64-musl");
480
+ const bindingPackageVersion = require("@xberg-io/liter-llm-linux-loong64-musl/package.json").version;
481
+ if (
482
+ bindingPackageVersion !== "1.17.1" &&
483
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
484
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
485
+ ) {
486
+ throw new Error(
487
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
488
+ );
378
489
  }
379
- return binding
490
+ return binding;
380
491
  } catch (e) {
381
- loadErrors.push(e)
492
+ loadErrors.push(e);
382
493
  }
383
494
  } else {
384
495
  try {
385
- return require('./liter-llm-node.linux-loong64-gnu.node')
496
+ return require("./liter-llm-node.linux-loong64-gnu.node");
386
497
  } catch (e) {
387
- loadErrors.push(e)
498
+ loadErrors.push(e);
388
499
  }
389
500
  try {
390
- const binding = require('@xberg-io/liter-llm-linux-loong64-gnu')
391
- const bindingPackageVersion = require('@xberg-io/liter-llm-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
501
+ const binding = require("@xberg-io/liter-llm-linux-loong64-gnu");
502
+ const bindingPackageVersion = require("@xberg-io/liter-llm-linux-loong64-gnu/package.json").version;
503
+ if (
504
+ bindingPackageVersion !== "1.17.1" &&
505
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
506
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
507
+ ) {
508
+ throw new Error(
509
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
510
+ );
394
511
  }
395
- return binding
512
+ return binding;
396
513
  } catch (e) {
397
- loadErrors.push(e)
514
+ loadErrors.push(e);
398
515
  }
399
516
  }
400
- } else if (process.arch === 'riscv64') {
517
+ } else if (process.arch === "riscv64") {
401
518
  if (isMusl()) {
402
519
  try {
403
- return require('./liter-llm-node.linux-riscv64-musl.node')
520
+ return require("./liter-llm-node.linux-riscv64-musl.node");
404
521
  } catch (e) {
405
- loadErrors.push(e)
522
+ loadErrors.push(e);
406
523
  }
407
524
  try {
408
- const binding = require('@xberg-io/liter-llm-linux-riscv64-musl')
409
- const bindingPackageVersion = require('@xberg-io/liter-llm-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
525
+ const binding = require("@xberg-io/liter-llm-linux-riscv64-musl");
526
+ const bindingPackageVersion = require("@xberg-io/liter-llm-linux-riscv64-musl/package.json").version;
527
+ if (
528
+ bindingPackageVersion !== "1.17.1" &&
529
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
530
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
531
+ ) {
532
+ throw new Error(
533
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
534
+ );
412
535
  }
413
- return binding
536
+ return binding;
414
537
  } catch (e) {
415
- loadErrors.push(e)
538
+ loadErrors.push(e);
416
539
  }
417
540
  } else {
418
541
  try {
419
- return require('./liter-llm-node.linux-riscv64-gnu.node')
542
+ return require("./liter-llm-node.linux-riscv64-gnu.node");
420
543
  } catch (e) {
421
- loadErrors.push(e)
544
+ loadErrors.push(e);
422
545
  }
423
546
  try {
424
- const binding = require('@xberg-io/liter-llm-linux-riscv64-gnu')
425
- const bindingPackageVersion = require('@xberg-io/liter-llm-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
547
+ const binding = require("@xberg-io/liter-llm-linux-riscv64-gnu");
548
+ const bindingPackageVersion = require("@xberg-io/liter-llm-linux-riscv64-gnu/package.json").version;
549
+ if (
550
+ bindingPackageVersion !== "1.17.1" &&
551
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
552
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
553
+ ) {
554
+ throw new Error(
555
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
556
+ );
428
557
  }
429
- return binding
558
+ return binding;
430
559
  } catch (e) {
431
- loadErrors.push(e)
560
+ loadErrors.push(e);
432
561
  }
433
562
  }
434
- } else if (process.arch === 'ppc64') {
563
+ } else if (process.arch === "ppc64") {
435
564
  try {
436
- return require('./liter-llm-node.linux-ppc64-gnu.node')
565
+ return require("./liter-llm-node.linux-ppc64-gnu.node");
437
566
  } catch (e) {
438
- loadErrors.push(e)
567
+ loadErrors.push(e);
439
568
  }
440
569
  try {
441
- const binding = require('@xberg-io/liter-llm-linux-ppc64-gnu')
442
- const bindingPackageVersion = require('@xberg-io/liter-llm-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
- }
446
- return binding
570
+ const binding = require("@xberg-io/liter-llm-linux-ppc64-gnu");
571
+ const bindingPackageVersion = require("@xberg-io/liter-llm-linux-ppc64-gnu/package.json").version;
572
+ if (
573
+ bindingPackageVersion !== "1.17.1" &&
574
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
575
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
576
+ ) {
577
+ throw new Error(
578
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
579
+ );
580
+ }
581
+ return binding;
447
582
  } catch (e) {
448
- loadErrors.push(e)
583
+ loadErrors.push(e);
449
584
  }
450
- } else if (process.arch === 's390x') {
585
+ } else if (process.arch === "s390x") {
451
586
  try {
452
- return require('./liter-llm-node.linux-s390x-gnu.node')
587
+ return require("./liter-llm-node.linux-s390x-gnu.node");
453
588
  } catch (e) {
454
- loadErrors.push(e)
589
+ loadErrors.push(e);
455
590
  }
456
591
  try {
457
- const binding = require('@xberg-io/liter-llm-linux-s390x-gnu')
458
- const bindingPackageVersion = require('@xberg-io/liter-llm-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
- }
462
- return binding
592
+ const binding = require("@xberg-io/liter-llm-linux-s390x-gnu");
593
+ const bindingPackageVersion = require("@xberg-io/liter-llm-linux-s390x-gnu/package.json").version;
594
+ if (
595
+ bindingPackageVersion !== "1.17.1" &&
596
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
597
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
598
+ ) {
599
+ throw new Error(
600
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
601
+ );
602
+ }
603
+ return binding;
463
604
  } catch (e) {
464
- loadErrors.push(e)
605
+ loadErrors.push(e);
465
606
  }
466
607
  } else {
467
- loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
608
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
468
609
  }
469
- } else if (process.platform === 'openharmony') {
470
- if (process.arch === 'arm64') {
610
+ } else if (process.platform === "openharmony") {
611
+ if (process.arch === "arm64") {
471
612
  try {
472
- return require('./liter-llm-node.openharmony-arm64.node')
613
+ return require("./liter-llm-node.openharmony-arm64.node");
473
614
  } catch (e) {
474
- loadErrors.push(e)
615
+ loadErrors.push(e);
475
616
  }
476
617
  try {
477
- const binding = require('@xberg-io/liter-llm-openharmony-arm64')
478
- const bindingPackageVersion = require('@xberg-io/liter-llm-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
- }
482
- return binding
618
+ const binding = require("@xberg-io/liter-llm-openharmony-arm64");
619
+ const bindingPackageVersion = require("@xberg-io/liter-llm-openharmony-arm64/package.json").version;
620
+ if (
621
+ bindingPackageVersion !== "1.17.1" &&
622
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
623
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
624
+ ) {
625
+ throw new Error(
626
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
627
+ );
628
+ }
629
+ return binding;
483
630
  } catch (e) {
484
- loadErrors.push(e)
631
+ loadErrors.push(e);
485
632
  }
486
- } else if (process.arch === 'x64') {
633
+ } else if (process.arch === "x64") {
487
634
  try {
488
- return require('./liter-llm-node.openharmony-x64.node')
635
+ return require("./liter-llm-node.openharmony-x64.node");
489
636
  } catch (e) {
490
- loadErrors.push(e)
637
+ loadErrors.push(e);
491
638
  }
492
639
  try {
493
- const binding = require('@xberg-io/liter-llm-openharmony-x64')
494
- const bindingPackageVersion = require('@xberg-io/liter-llm-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
- }
498
- return binding
640
+ const binding = require("@xberg-io/liter-llm-openharmony-x64");
641
+ const bindingPackageVersion = require("@xberg-io/liter-llm-openharmony-x64/package.json").version;
642
+ if (
643
+ bindingPackageVersion !== "1.17.1" &&
644
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
645
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
646
+ ) {
647
+ throw new Error(
648
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
649
+ );
650
+ }
651
+ return binding;
499
652
  } catch (e) {
500
- loadErrors.push(e)
653
+ loadErrors.push(e);
501
654
  }
502
- } else if (process.arch === 'arm') {
655
+ } else if (process.arch === "arm") {
503
656
  try {
504
- return require('./liter-llm-node.openharmony-arm.node')
657
+ return require("./liter-llm-node.openharmony-arm.node");
505
658
  } catch (e) {
506
- loadErrors.push(e)
659
+ loadErrors.push(e);
507
660
  }
508
661
  try {
509
- const binding = require('@xberg-io/liter-llm-openharmony-arm')
510
- const bindingPackageVersion = require('@xberg-io/liter-llm-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '1.17.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
- throw new Error(`Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
- }
514
- return binding
662
+ const binding = require("@xberg-io/liter-llm-openharmony-arm");
663
+ const bindingPackageVersion = require("@xberg-io/liter-llm-openharmony-arm/package.json").version;
664
+ if (
665
+ bindingPackageVersion !== "1.17.1" &&
666
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
667
+ process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
668
+ ) {
669
+ throw new Error(
670
+ `Native binding package version mismatch, expected 1.17.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
671
+ );
672
+ }
673
+ return binding;
515
674
  } catch (e) {
516
- loadErrors.push(e)
675
+ loadErrors.push(e);
517
676
  }
518
677
  } else {
519
- loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
678
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
520
679
  }
521
680
  } else {
522
- loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
681
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
523
682
  }
524
683
  }
525
684
 
526
- nativeBinding = requireNative()
685
+ nativeBinding = requireNative();
527
686
 
528
687
  // NAPI_RS_FORCE_WASI is a tri-state flag:
529
688
  // unset / any other value → native binding preferred, WASI is only a fallback
@@ -532,39 +691,38 @@ nativeBinding = requireNative()
532
691
  // Treating any non-empty string as truthy (the historical behavior) meant
533
692
  // NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered
534
693
  // the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file.
535
- const forceWasi =
536
- process.env.NAPI_RS_FORCE_WASI === 'true' || process.env.NAPI_RS_FORCE_WASI === 'error'
694
+ const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || process.env.NAPI_RS_FORCE_WASI === "error";
537
695
 
538
696
  if (!nativeBinding || forceWasi) {
539
- let wasiBinding = null
540
- let wasiBindingError = null
697
+ let wasiBinding = null;
698
+ let wasiBindingError = null;
541
699
  try {
542
- wasiBinding = require('./liter-llm-node.wasi.cjs')
543
- nativeBinding = wasiBinding
700
+ wasiBinding = require("./liter-llm-node.wasi.cjs");
701
+ nativeBinding = wasiBinding;
544
702
  } catch (err) {
545
703
  if (forceWasi) {
546
- wasiBindingError = err
704
+ wasiBindingError = err;
547
705
  }
548
706
  }
549
707
  if (!nativeBinding || forceWasi) {
550
708
  try {
551
- wasiBinding = require('@xberg-io/liter-llm-wasm32-wasi')
552
- nativeBinding = wasiBinding
709
+ wasiBinding = require("@xberg-io/liter-llm-wasm32-wasi");
710
+ nativeBinding = wasiBinding;
553
711
  } catch (err) {
554
712
  if (forceWasi) {
555
713
  if (!wasiBindingError) {
556
- wasiBindingError = err
714
+ wasiBindingError = err;
557
715
  } else {
558
- wasiBindingError.cause = err
716
+ wasiBindingError.cause = err;
559
717
  }
560
- loadErrors.push(err)
718
+ loadErrors.push(err);
561
719
  }
562
720
  }
563
721
  }
564
- if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
565
- const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
566
- error.cause = wasiBindingError
567
- throw error
722
+ if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
723
+ const error = new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
724
+ error.cause = wasiBindingError;
725
+ throw error;
568
726
  }
569
727
  }
570
728
 
@@ -573,82 +731,82 @@ if (!nativeBinding) {
573
731
  const error = new Error(
574
732
  `Cannot find native binding. ` +
575
733
  `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
576
- 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
577
- )
734
+ "Please try `npm i` again after removing both package-lock.json and node_modules directory.",
735
+ );
578
736
  // assign instead of the `new Error(message, { cause })` options form,
579
737
  // which Node < 16.9 silently ignores
580
738
  error.cause = loadErrors.reduce((err, cur) => {
581
- cur.cause = err
582
- return cur
583
- })
584
- throw error
739
+ cur.cause = err;
740
+ return cur;
741
+ });
742
+ throw error;
585
743
  }
586
- throw new Error(`Failed to load native binding`)
744
+ throw new Error(`Failed to load native binding`);
587
745
  }
588
746
 
589
- module.exports = nativeBinding
590
- module.exports.ChatStreamIterator = nativeBinding.ChatStreamIterator
591
- module.exports.DefaultClient = nativeBinding.DefaultClient
592
- module.exports.JsDefaultClient = nativeBinding.JsDefaultClient
593
- module.exports.JsLiterLlmErrorInfo = nativeBinding.JsLiterLlmErrorInfo
594
- module.exports.SingleflightResult = nativeBinding.SingleflightResult
595
- module.exports.JsSingleflightResult = nativeBinding.JsSingleflightResult
596
- module.exports.allProviders = nativeBinding.allProviders
597
- module.exports.AuthHeaderFormat = nativeBinding.AuthHeaderFormat
598
- module.exports.JsAuthHeaderFormat = nativeBinding.JsAuthHeaderFormat
599
- module.exports.AuthType = nativeBinding.AuthType
600
- module.exports.JsAuthType = nativeBinding.JsAuthType
601
- module.exports.BatchStatus = nativeBinding.BatchStatus
602
- module.exports.JsBatchStatus = nativeBinding.JsBatchStatus
603
- module.exports.budgetConfigDefault = nativeBinding.budgetConfigDefault
604
- module.exports.cacheConfigDefault = nativeBinding.cacheConfigDefault
605
- module.exports.capabilities = nativeBinding.capabilities
606
- module.exports.catalogRefreshConfigDefault = nativeBinding.catalogRefreshConfigDefault
607
- module.exports.chatStream = nativeBinding.chatStream
608
- module.exports.checkBound = nativeBinding.checkBound
609
- module.exports.CircuitState = nativeBinding.CircuitState
610
- module.exports.JsCircuitState = nativeBinding.JsCircuitState
611
- module.exports.clear = nativeBinding.clear
612
- module.exports.clearCatalogOverlay = nativeBinding.clearCatalogOverlay
613
- module.exports.completionCost = nativeBinding.completionCost
614
- module.exports.completionCostWithCache = nativeBinding.completionCostWithCache
615
- module.exports.complexProviderNames = nativeBinding.complexProviderNames
616
- module.exports.countRequestTokens = nativeBinding.countRequestTokens
617
- module.exports.countTokens = nativeBinding.countTokens
618
- module.exports.createClient = nativeBinding.createClient
619
- module.exports.createClientFromJson = nativeBinding.createClientFromJson
620
- module.exports.decodeDataUrl = nativeBinding.decodeDataUrl
621
- module.exports.EmbeddingFormat = nativeBinding.EmbeddingFormat
622
- module.exports.JsEmbeddingFormat = nativeBinding.JsEmbeddingFormat
623
- module.exports.encodeDataUrl = nativeBinding.encodeDataUrl
624
- module.exports.Enforcement = nativeBinding.Enforcement
625
- module.exports.JsEnforcement = nativeBinding.JsEnforcement
626
- module.exports.ensureCryptoProvider = nativeBinding.ensureCryptoProvider
627
- module.exports.FilePurpose = nativeBinding.FilePurpose
628
- module.exports.JsFilePurpose = nativeBinding.JsFilePurpose
629
- module.exports.FinishReason = nativeBinding.FinishReason
630
- module.exports.JsFinishReason = nativeBinding.JsFinishReason
631
- module.exports.HealthStatus = nativeBinding.HealthStatus
632
- module.exports.JsHealthStatus = nativeBinding.JsHealthStatus
633
- module.exports.ImageDetail = nativeBinding.ImageDetail
634
- module.exports.JsImageDetail = nativeBinding.JsImageDetail
635
- module.exports.installCatalogOverlayFromStr = nativeBinding.installCatalogOverlayFromStr
636
- module.exports.Modality = nativeBinding.Modality
637
- module.exports.JsModality = nativeBinding.JsModality
638
- module.exports.modelInfo = nativeBinding.modelInfo
639
- module.exports.rateLimitConfigDefault = nativeBinding.rateLimitConfigDefault
640
- module.exports.ReasoningEffort = nativeBinding.ReasoningEffort
641
- module.exports.JsReasoningEffort = nativeBinding.JsReasoningEffort
642
- module.exports.recordCostUsd = nativeBinding.recordCostUsd
643
- module.exports.refreshCatalog = nativeBinding.refreshCatalog
644
- module.exports.RefreshOutcome = nativeBinding.RefreshOutcome
645
- module.exports.JsRefreshOutcome = nativeBinding.JsRefreshOutcome
646
- module.exports.registerCustomProvider = nativeBinding.registerCustomProvider
647
- module.exports.StreamFormat = nativeBinding.StreamFormat
648
- module.exports.JsStreamFormat = nativeBinding.JsStreamFormat
649
- module.exports.ToolChoiceMode = nativeBinding.ToolChoiceMode
650
- module.exports.JsToolChoiceMode = nativeBinding.JsToolChoiceMode
651
- module.exports.ToolType = nativeBinding.ToolType
652
- module.exports.JsToolType = nativeBinding.JsToolType
653
- module.exports.unregisterCustomProvider = nativeBinding.unregisterCustomProvider
654
- module.exports.waitForBatchConfigDefault = nativeBinding.waitForBatchConfigDefault
747
+ module.exports = nativeBinding;
748
+ module.exports.ChatStreamIterator = nativeBinding.ChatStreamIterator;
749
+ module.exports.DefaultClient = nativeBinding.DefaultClient;
750
+ module.exports.JsDefaultClient = nativeBinding.JsDefaultClient;
751
+ module.exports.JsLiterLlmErrorInfo = nativeBinding.JsLiterLlmErrorInfo;
752
+ module.exports.SingleflightResult = nativeBinding.SingleflightResult;
753
+ module.exports.JsSingleflightResult = nativeBinding.JsSingleflightResult;
754
+ module.exports.allProviders = nativeBinding.allProviders;
755
+ module.exports.AuthHeaderFormat = nativeBinding.AuthHeaderFormat;
756
+ module.exports.JsAuthHeaderFormat = nativeBinding.JsAuthHeaderFormat;
757
+ module.exports.AuthType = nativeBinding.AuthType;
758
+ module.exports.JsAuthType = nativeBinding.JsAuthType;
759
+ module.exports.BatchStatus = nativeBinding.BatchStatus;
760
+ module.exports.JsBatchStatus = nativeBinding.JsBatchStatus;
761
+ module.exports.budgetConfigDefault = nativeBinding.budgetConfigDefault;
762
+ module.exports.cacheConfigDefault = nativeBinding.cacheConfigDefault;
763
+ module.exports.capabilities = nativeBinding.capabilities;
764
+ module.exports.catalogRefreshConfigDefault = nativeBinding.catalogRefreshConfigDefault;
765
+ module.exports.chatStream = nativeBinding.chatStream;
766
+ module.exports.checkBound = nativeBinding.checkBound;
767
+ module.exports.CircuitState = nativeBinding.CircuitState;
768
+ module.exports.JsCircuitState = nativeBinding.JsCircuitState;
769
+ module.exports.clear = nativeBinding.clear;
770
+ module.exports.clearCatalogOverlay = nativeBinding.clearCatalogOverlay;
771
+ module.exports.completionCost = nativeBinding.completionCost;
772
+ module.exports.completionCostWithCache = nativeBinding.completionCostWithCache;
773
+ module.exports.complexProviderNames = nativeBinding.complexProviderNames;
774
+ module.exports.countRequestTokens = nativeBinding.countRequestTokens;
775
+ module.exports.countTokens = nativeBinding.countTokens;
776
+ module.exports.createClient = nativeBinding.createClient;
777
+ module.exports.createClientFromJson = nativeBinding.createClientFromJson;
778
+ module.exports.decodeDataUrl = nativeBinding.decodeDataUrl;
779
+ module.exports.EmbeddingFormat = nativeBinding.EmbeddingFormat;
780
+ module.exports.JsEmbeddingFormat = nativeBinding.JsEmbeddingFormat;
781
+ module.exports.encodeDataUrl = nativeBinding.encodeDataUrl;
782
+ module.exports.Enforcement = nativeBinding.Enforcement;
783
+ module.exports.JsEnforcement = nativeBinding.JsEnforcement;
784
+ module.exports.ensureCryptoProvider = nativeBinding.ensureCryptoProvider;
785
+ module.exports.FilePurpose = nativeBinding.FilePurpose;
786
+ module.exports.JsFilePurpose = nativeBinding.JsFilePurpose;
787
+ module.exports.FinishReason = nativeBinding.FinishReason;
788
+ module.exports.JsFinishReason = nativeBinding.JsFinishReason;
789
+ module.exports.HealthStatus = nativeBinding.HealthStatus;
790
+ module.exports.JsHealthStatus = nativeBinding.JsHealthStatus;
791
+ module.exports.ImageDetail = nativeBinding.ImageDetail;
792
+ module.exports.JsImageDetail = nativeBinding.JsImageDetail;
793
+ module.exports.installCatalogOverlayFromStr = nativeBinding.installCatalogOverlayFromStr;
794
+ module.exports.Modality = nativeBinding.Modality;
795
+ module.exports.JsModality = nativeBinding.JsModality;
796
+ module.exports.modelInfo = nativeBinding.modelInfo;
797
+ module.exports.rateLimitConfigDefault = nativeBinding.rateLimitConfigDefault;
798
+ module.exports.ReasoningEffort = nativeBinding.ReasoningEffort;
799
+ module.exports.JsReasoningEffort = nativeBinding.JsReasoningEffort;
800
+ module.exports.recordCostUsd = nativeBinding.recordCostUsd;
801
+ module.exports.refreshCatalog = nativeBinding.refreshCatalog;
802
+ module.exports.RefreshOutcome = nativeBinding.RefreshOutcome;
803
+ module.exports.JsRefreshOutcome = nativeBinding.JsRefreshOutcome;
804
+ module.exports.registerCustomProvider = nativeBinding.registerCustomProvider;
805
+ module.exports.StreamFormat = nativeBinding.StreamFormat;
806
+ module.exports.JsStreamFormat = nativeBinding.JsStreamFormat;
807
+ module.exports.ToolChoiceMode = nativeBinding.ToolChoiceMode;
808
+ module.exports.JsToolChoiceMode = nativeBinding.JsToolChoiceMode;
809
+ module.exports.ToolType = nativeBinding.ToolType;
810
+ module.exports.JsToolType = nativeBinding.JsToolType;
811
+ module.exports.unregisterCustomProvider = nativeBinding.unregisterCustomProvider;
812
+ module.exports.waitForBatchConfigDefault = nativeBinding.waitForBatchConfigDefault;