@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 34 lines 1.28 KB
Raw
1 // @neon/config-runtime 1.6.1, dist/lib/native-packages.js: RUNTIME_TARGET.
2 export const neonRuntimeTarget = {
3 os: "linux",
4 cpu: "arm64",
5 libc: "glibc",
6 } as const;
7
8 export const nativeArtifactError = (file: string, content: Uint8Array): string | undefined => {
9 const elf =
10 content[0] === 0x7f && content[1] === 0x45 && content[2] === 0x4c && content[3] === 0x46;
11 const magic =
12 ((content[0]! << 24) | (content[1]! << 16) | (content[2]! << 8) | content[3]!) >>> 0;
13 if (elf) {
14 // Header checks reject incompatible targets; addon ABI still needs runtime verification.
15 if (
16 content.length < 64 ||
17 content[4] !== 2 ||
18 content[5] !== 1 ||
19 content[6] !== 1 ||
20 ![0, 3].includes(content[7]!) ||
21 ![2, 3].includes(content[16]!) ||
22 content[17] !== 0 ||
23 content[18] !== 183 ||
24 content[19] !== 0 ||
25 Buffer.from(content).includes(Buffer.from("ld-musl-"))
26 )
27 return `Native file is not Linux ARM64 glibc compatible: ${file}.`;
28 } else if (
29 /\.(?:node|dylib|dll|so(?:\.\d+)*)$/.test(file) ||
30 [0xfeedface, 0xfeedfacf, 0xcefaedfe, 0xcffaedfe, 0xcafebabe, 0xbebafeca].includes(magic) ||
31 (content[0] === 0x4d && content[1] === 0x5a)
32 )
33 return `Unsupported native format: ${file}. Expected Linux ARM64 glibc.`;
34 };