relayburn 1.10.0 → 2.0.0
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/CHANGELOG.md +6 -0
- package/README.md +13 -2
- package/bin/burn.js +138 -1
- package/package.json +11 -8
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to `relayburn`.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [2.0.0] - 2026-05-07
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- `relayburn` now prefers the prebuilt Rust `burn` binary from per-platform `@relayburn/cli-<platform>` packages, with `@relayburn/cli` kept as a fallback for unsupported or missing native packages.
|
|
12
|
+
|
|
7
13
|
## [1.6.2] - 2026-05-02
|
|
8
14
|
|
|
9
15
|
### Changed
|
package/README.md
CHANGED
|
@@ -6,7 +6,12 @@ Install the [`burn`](https://github.com/AgentWorkforce/burn) CLI globally:
|
|
|
6
6
|
npm i -g relayburn
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
This is a thin wrapper
|
|
9
|
+
This package is a thin install wrapper. It declares the per-platform
|
|
10
|
+
`@relayburn/cli-<platform>` packages as `optionalDependencies`; npm's
|
|
11
|
+
`os` / `cpu` filters install only the one matching your machine, and the
|
|
12
|
+
`burn` shim resolves and execs the prebuilt Rust binary it ships. If a
|
|
13
|
+
native package is not available, the shim falls back to the generic
|
|
14
|
+
TypeScript `@relayburn/cli` package.
|
|
10
15
|
|
|
11
16
|
```sh
|
|
12
17
|
burn --help
|
|
@@ -14,4 +19,10 @@ burn summary --since 7d
|
|
|
14
19
|
burn hotspots --since 7d
|
|
15
20
|
```
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
Prebuilt platforms: `darwin-arm64`, `darwin-x64`, `linux-arm64-gnu`
|
|
23
|
+
(glibc), `linux-x64-gnu` (glibc). Other hosts use the TypeScript CLI
|
|
24
|
+
fallback. Windows native binary support is tracked in
|
|
25
|
+
[#359](https://github.com/AgentWorkforce/burn/issues/359).
|
|
26
|
+
|
|
27
|
+
See the project [README](https://github.com/AgentWorkforce/burn#readme)
|
|
28
|
+
for full documentation.
|
package/bin/burn.js
CHANGED
|
@@ -1,2 +1,139 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
// Platform-resolving spawner for the `burn` Rust binary. Mirrors the
|
|
3
|
+
// `@relayburn/sdk` napi-rs dispatcher pattern (see
|
|
4
|
+
// `packages/sdk-node/src/binding.cjs`): the umbrella `relayburn` package
|
|
5
|
+
// declares the per-platform packages plus the generic `@relayburn/cli`
|
|
6
|
+
// fallback as `optionalDependencies`, npm installs the matching native
|
|
7
|
+
// package when available, and this script `require.resolve`s the native
|
|
8
|
+
// `burn` binary first, then falls back to the TS CLI when needed.
|
|
9
|
+
//
|
|
10
|
+
// The actual binaries live in `packages/relayburn/npm/<platform>/bin/burn`
|
|
11
|
+
// and are dropped there by the cli-build CI matrix at publish time. They
|
|
12
|
+
// are gitignored at rest.
|
|
13
|
+
//
|
|
14
|
+
// ESM is fine here — the umbrella declares `"type": "module"` and engines
|
|
15
|
+
// pins Node >=22.
|
|
16
|
+
|
|
17
|
+
import { createRequire } from 'node:module';
|
|
18
|
+
import { spawnSync } from 'node:child_process';
|
|
19
|
+
|
|
20
|
+
const require = createRequire(import.meta.url);
|
|
21
|
+
|
|
22
|
+
// Map (process.platform, process.arch) → platform-package short string.
|
|
23
|
+
// Linux glibc-vs-musl detection follows the same `process.report` probe
|
|
24
|
+
// the napi-rs loader uses; we only ship glibc artifacts today, so a musl
|
|
25
|
+
// host falls through to the generic CLI fallback below.
|
|
26
|
+
function detectShort() {
|
|
27
|
+
const { platform, arch } = process;
|
|
28
|
+
|
|
29
|
+
if (platform === 'darwin' && arch === 'arm64') return 'darwin-arm64';
|
|
30
|
+
if (platform === 'darwin' && arch === 'x64') return 'darwin-x64';
|
|
31
|
+
if (platform === 'linux' && arch === 'arm64' && !isMusl()) return 'linux-arm64-gnu';
|
|
32
|
+
if (platform === 'linux' && arch === 'x64' && !isMusl()) return 'linux-x64-gnu';
|
|
33
|
+
|
|
34
|
+
// Forward-compat for #359 (Windows). The win32-x64 package is not
|
|
35
|
+
// published yet, so resolution will fail with the same actionable
|
|
36
|
+
// error path as any other unsupported platform — but the mapping is
|
|
37
|
+
// here so #359 only needs to add a matrix leg + optionalDependency,
|
|
38
|
+
// not touch this dispatcher.
|
|
39
|
+
if (platform === 'win32' && arch === 'x64') return 'win32-x64';
|
|
40
|
+
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function isMusl() {
|
|
45
|
+
if (!process.report) return false;
|
|
46
|
+
try {
|
|
47
|
+
const { glibcVersionRuntime } = (process.report.getReport() || {}).header || {};
|
|
48
|
+
return !glibcVersionRuntime;
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function binSuffix() {
|
|
55
|
+
return process.platform === 'win32' ? '.exe' : '';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const short = detectShort();
|
|
59
|
+
const fallbackSpecifier = '@relayburn/cli/dist/cli.js';
|
|
60
|
+
const passthroughArgs = process.argv.slice(2);
|
|
61
|
+
|
|
62
|
+
function formatError(err) {
|
|
63
|
+
return err && err.message ? err.message : String(err);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function writeResolveFailure(prebuiltError, fallbackError) {
|
|
67
|
+
if (!short) {
|
|
68
|
+
process.stderr.write(
|
|
69
|
+
`relayburn: unsupported prebuilt platform ${process.platform}-${process.arch}.\n` +
|
|
70
|
+
`Supported prebuilt packages: darwin-arm64, darwin-x64, linux-arm64-gnu (glibc), linux-x64-gnu (glibc).\n` +
|
|
71
|
+
`Track native Windows support at https://github.com/AgentWorkforce/burn/issues/359.\n` +
|
|
72
|
+
`Tried generic TypeScript CLI fallback \`${fallbackSpecifier}\`, but it was not installed.\n` +
|
|
73
|
+
`Reinstall \`relayburn\` with optional dependencies enabled or install \`@relayburn/cli\`.\n` +
|
|
74
|
+
`\nFallback resolution error: ${formatError(fallbackError)}\n`,
|
|
75
|
+
);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const pkg = `@relayburn/cli-${short}`;
|
|
80
|
+
process.stderr.write(
|
|
81
|
+
`relayburn: failed to resolve prebuilt \`burn\` binary for ${short}.\n` +
|
|
82
|
+
`Expected the optional dependency \`${pkg}\` to be installed; it ships the binary\n` +
|
|
83
|
+
`at \`bin/burn${binSuffix()}\`. This usually means \`npm install\` skipped the optional\n` +
|
|
84
|
+
`dependency (e.g. \`--no-optional\`, a lockfile pinned without it, or an unsupported\n` +
|
|
85
|
+
`platform filter).\n` +
|
|
86
|
+
`Tried generic TypeScript CLI fallback \`${fallbackSpecifier}\`, but it also failed.\n` +
|
|
87
|
+
`Reinstall \`relayburn\` without \`--no-optional\` and try again.\n` +
|
|
88
|
+
`\nPrebuilt resolution error: ${formatError(prebuiltError)}\n` +
|
|
89
|
+
`Fallback resolution error: ${formatError(fallbackError)}\n`,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
let command = null;
|
|
94
|
+
let childArgs = passthroughArgs;
|
|
95
|
+
let prebuiltError = null;
|
|
96
|
+
|
|
97
|
+
if (short) {
|
|
98
|
+
const pkg = `@relayburn/cli-${short}`;
|
|
99
|
+
const binSpecifier = `${pkg}/bin/burn${binSuffix()}`;
|
|
100
|
+
try {
|
|
101
|
+
command = require.resolve(binSpecifier);
|
|
102
|
+
} catch (err) {
|
|
103
|
+
prebuiltError = err;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (!command) {
|
|
108
|
+
try {
|
|
109
|
+
command = process.execPath;
|
|
110
|
+
childArgs = [require.resolve(fallbackSpecifier), ...passthroughArgs];
|
|
111
|
+
} catch (fallbackError) {
|
|
112
|
+
writeResolveFailure(prebuiltError, fallbackError);
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const child = spawnSync(command, childArgs, {
|
|
118
|
+
stdio: 'inherit',
|
|
119
|
+
windowsHide: false,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
if (child.error) {
|
|
123
|
+
process.stderr.write(`relayburn: failed to spawn \`burn\`: ${child.error.message}\n`);
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Propagate signal exits the same way Node's own child-process docs
|
|
128
|
+
// recommend — POSIX shells map signal-terminated children to
|
|
129
|
+
// `128 + signo`, and many CI environments key off that exact code.
|
|
130
|
+
if (child.signal) {
|
|
131
|
+
// `os.constants.signals` is the Node-side mapping, but it's keyed by
|
|
132
|
+
// signal name and we have it in hand already; defer to the standard
|
|
133
|
+
// 128+signo formula via `process.kill` fallback for unknown names.
|
|
134
|
+
const { constants } = await import('node:os');
|
|
135
|
+
const signo = constants.signals[child.signal];
|
|
136
|
+
process.exit(typeof signo === 'number' ? 128 + signo : 1);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
process.exit(child.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "relayburn",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Token usage & cost attribution for agent CLIs (installs the `burn` command)",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Token usage & cost attribution for agent CLIs (installs the `burn` command). Resolves a prebuilt Rust binary from the `@relayburn/cli-<platform>` packages with a TypeScript CLI fallback.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"burn": "./bin/burn.js"
|
|
@@ -12,11 +12,17 @@
|
|
|
12
12
|
"CHANGELOG.md",
|
|
13
13
|
"package.json"
|
|
14
14
|
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "chmod +x bin/burn.js"
|
|
17
|
+
},
|
|
15
18
|
"engines": {
|
|
16
19
|
"node": ">=22"
|
|
17
20
|
},
|
|
18
|
-
"
|
|
19
|
-
"@relayburn/cli": "
|
|
21
|
+
"optionalDependencies": {
|
|
22
|
+
"@relayburn/cli-darwin-arm64": "2.0.0",
|
|
23
|
+
"@relayburn/cli-darwin-x64": "2.0.0",
|
|
24
|
+
"@relayburn/cli-linux-arm64-gnu": "2.0.0",
|
|
25
|
+
"@relayburn/cli-linux-x64-gnu": "2.0.0"
|
|
20
26
|
},
|
|
21
27
|
"repository": {
|
|
22
28
|
"type": "git",
|
|
@@ -25,8 +31,5 @@
|
|
|
25
31
|
},
|
|
26
32
|
"publishConfig": {
|
|
27
33
|
"access": "public"
|
|
28
|
-
},
|
|
29
|
-
"scripts": {
|
|
30
|
-
"build": "chmod +x bin/burn.js"
|
|
31
34
|
}
|
|
32
|
-
}
|
|
35
|
+
}
|