@opentraceai/trace 0.3.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/lib/main.js +45 -0
- package/package.json +29 -0
package/lib/main.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { spawnSync } = require('child_process');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
|
|
8
|
+
const PLATFORM_PACKAGES = {
|
|
9
|
+
'linux-x64': '@opentraceai/trace-linux-x64',
|
|
10
|
+
'linux-arm64': '@opentraceai/trace-linux-arm64',
|
|
11
|
+
'darwin-x64': '@opentraceai/trace-darwin-x64',
|
|
12
|
+
'darwin-arm64': '@opentraceai/trace-darwin-arm64',
|
|
13
|
+
'win32-x64': '@opentraceai/trace-win32-x64',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function getBinaryPath() {
|
|
17
|
+
const key = `${process.platform}-${os.arch()}`;
|
|
18
|
+
const pkg = PLATFORM_PACKAGES[key];
|
|
19
|
+
if (!pkg) {
|
|
20
|
+
console.error(`@opentraceai/trace: unsupported platform ${key}`);
|
|
21
|
+
console.error(`Supported: ${Object.keys(PLATFORM_PACKAGES).join(', ')}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
// require.resolve finds the platform package's package.json,
|
|
26
|
+
// then we navigate to the binary alongside it.
|
|
27
|
+
const pkgJson = require.resolve(`${pkg}/package.json`);
|
|
28
|
+
const pkgDir = path.dirname(pkgJson);
|
|
29
|
+
const bin = process.platform === 'win32'
|
|
30
|
+
? path.join(pkgDir, 'trace.exe')
|
|
31
|
+
: path.join(pkgDir, 'bin', 'trace');
|
|
32
|
+
return bin;
|
|
33
|
+
} catch {
|
|
34
|
+
console.error(`@opentraceai/trace: platform package '${pkg}' not installed.`);
|
|
35
|
+
console.error(`Run: npm install ${pkg}`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const result = spawnSync(getBinaryPath(), process.argv.slice(2), {
|
|
41
|
+
stdio: 'inherit',
|
|
42
|
+
cwd: process.cwd(),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentraceai/trace",
|
|
3
|
+
"version": "0.3.2",
|
|
4
|
+
"description": "The strace of LLM calls — local-first LLM observability proxy",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/jmamda/OpenTrace.git"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=16"
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"trace": "./lib/main.js"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"lib"
|
|
18
|
+
],
|
|
19
|
+
"optionalDependencies": {
|
|
20
|
+
"@opentraceai/trace-linux-x64": "0.3.2",
|
|
21
|
+
"@opentraceai/trace-linux-arm64": "0.3.2",
|
|
22
|
+
"@opentraceai/trace-darwin-x64": "0.3.2",
|
|
23
|
+
"@opentraceai/trace-darwin-arm64": "0.3.2",
|
|
24
|
+
"@opentraceai/trace-win32-x64": "0.3.2"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
}
|
|
29
|
+
}
|