@kreuzberg/liter-llm-node 1.4.0-rc.32 → 1.4.0-rc.33
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
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { platform, arch } = process;
|
|
4
|
+
const isWindows = platform === "win32";
|
|
5
|
+
const isMusl = () => {
|
|
6
|
+
// Prefer the report-header `glibcVersion` string when present — fastest and
|
|
7
|
+
// unambiguous on Node builds that populate it. On Node 22+, certain CI
|
|
8
|
+
// environments leave `glibcVersion` undefined even on glibc systems, so the
|
|
9
|
+
// `=== undefined` branch from older napi-rs templates produces a false
|
|
10
|
+
// "is musl" positive. Fall through to the filesystem heuristic instead: on
|
|
11
|
+
// glibc systems `/lib64/ld-musl-x86_64.so.1` does not exist; on musl systems
|
|
12
|
+
// it always does. statSync errors → not musl.
|
|
13
|
+
if (typeof process.report === "object" && typeof process.report.getReport === "function") {
|
|
14
|
+
const report = process.report.getReport();
|
|
15
|
+
if (report && report.header && typeof report.header.glibcVersion === "string") {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
require("fs").statSync("/lib64/ld-musl-x86_64.so.1");
|
|
21
|
+
return true;
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
let nativeBinding = null;
|
|
28
|
+
const loadErrors = [];
|
|
29
|
+
|
|
30
|
+
function requireOptionalDependency(name) {
|
|
31
|
+
try {
|
|
32
|
+
return require(name);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
loadErrors.push(`Optional dependency ${name}: ${e.message}`);
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const tryLoadBinding = () => {
|
|
40
|
+
// Local `.node` files are named after `napi.binaryName` (binary file name on disk).
|
|
41
|
+
// Optional-dep packages are named after `napi.packageName` (npm subpackage names),
|
|
42
|
+
// which inherits any scope prefix from the parent package.
|
|
43
|
+
const targets = [
|
|
44
|
+
[
|
|
45
|
+
"linux",
|
|
46
|
+
"x64",
|
|
47
|
+
"gnu",
|
|
48
|
+
"./liter-llm-node.linux-x64-gnu.node",
|
|
49
|
+
"@kreuzberg/liter-llm-node-linux-x64-gnu",
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
"linux",
|
|
53
|
+
"x64",
|
|
54
|
+
"musl",
|
|
55
|
+
"./liter-llm-node.linux-x64-musl.node",
|
|
56
|
+
"@kreuzberg/liter-llm-node-linux-x64-musl",
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
"linux",
|
|
60
|
+
"arm64",
|
|
61
|
+
"gnu",
|
|
62
|
+
"./liter-llm-node.linux-arm64-gnu.node",
|
|
63
|
+
"@kreuzberg/liter-llm-node-linux-arm64-gnu",
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
"linux",
|
|
67
|
+
"arm64",
|
|
68
|
+
"musl",
|
|
69
|
+
"./liter-llm-node.linux-arm64-musl.node",
|
|
70
|
+
"@kreuzberg/liter-llm-node-linux-arm64-musl",
|
|
71
|
+
],
|
|
72
|
+
[
|
|
73
|
+
"darwin",
|
|
74
|
+
"x64",
|
|
75
|
+
null,
|
|
76
|
+
"./liter-llm-node.darwin-x64.node",
|
|
77
|
+
"@kreuzberg/liter-llm-node-darwin-x64",
|
|
78
|
+
],
|
|
79
|
+
[
|
|
80
|
+
"darwin",
|
|
81
|
+
"arm64",
|
|
82
|
+
null,
|
|
83
|
+
"./liter-llm-node.darwin-arm64.node",
|
|
84
|
+
"@kreuzberg/liter-llm-node-darwin-arm64",
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
"win32",
|
|
88
|
+
"x64",
|
|
89
|
+
null,
|
|
90
|
+
"./liter-llm-node.win32-x64-msvc.node",
|
|
91
|
+
"@kreuzberg/liter-llm-node-win32-x64-msvc",
|
|
92
|
+
],
|
|
93
|
+
[
|
|
94
|
+
"win32",
|
|
95
|
+
"arm64",
|
|
96
|
+
null,
|
|
97
|
+
"./liter-llm-node.win32-arm64-msvc.node",
|
|
98
|
+
"@kreuzberg/liter-llm-node-win32-arm64-msvc",
|
|
99
|
+
],
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
for (const [plat, a, abi, localPath, optionalDep] of targets) {
|
|
103
|
+
if (platform !== plat || arch !== a) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (plat === "linux" && abi) {
|
|
108
|
+
const isCurMusl = isMusl();
|
|
109
|
+
if ((abi === "musl") !== isCurMusl) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
try {
|
|
115
|
+
nativeBinding = require(localPath);
|
|
116
|
+
if (nativeBinding) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
} catch (e) {
|
|
120
|
+
loadErrors.push(e.message);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
try {
|
|
124
|
+
const optBinding = requireOptionalDependency(optionalDep);
|
|
125
|
+
if (optBinding) {
|
|
126
|
+
nativeBinding = optBinding;
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
} catch (e) {
|
|
130
|
+
loadErrors.push(e.message);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
tryLoadBinding();
|
|
136
|
+
|
|
137
|
+
if (!nativeBinding) {
|
|
138
|
+
throw new Error(
|
|
139
|
+
`Failed to load native binding for ${platform}-${arch}. Errors: ${loadErrors.join(", ")}`,
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
module.exports = nativeBinding;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kreuzberg/liter-llm-node",
|
|
3
|
-
"version": "1.4.0-rc.
|
|
3
|
+
"version": "1.4.0-rc.33",
|
|
4
4
|
"description": "Universal LLM API client with Rust-powered polyglot bindings.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"napi": {
|
|
26
26
|
"binaryName": "liter-llm-node",
|
|
27
|
+
"packageName": "@kreuzberg/liter-llm-node",
|
|
27
28
|
"targets": [
|
|
28
29
|
"x86_64-unknown-linux-gnu",
|
|
29
30
|
"aarch64-unknown-linux-gnu",
|