agentworth 0.1.17 → 0.1.19
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/README.md +13 -15
- package/lib/resolver.js +72 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Official npm launcher for **AgentWorth** — discover, normalize, and understand AI-agent histories locally.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npx agentworth
|
|
6
|
+
npx -y agentworth@latest
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
When run with no arguments, `npx agentworth` defaults to launching the local web UI (`serve --open`). All native subcommands and flags are forwarded transparently to the native binary.
|
|
9
|
+
When run with no arguments, `npx -y agentworth@latest` defaults to launching the local web UI (`serve --open`). All native subcommands and flags are forwarded transparently to the native binary.
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@ When run with no arguments, `npx agentworth` defaults to launching the local web
|
|
|
17
17
|
Launch the local interactive UI:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npx agentworth
|
|
20
|
+
npx -y agentworth@latest
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
### CLI Subcommands
|
|
@@ -25,45 +25,45 @@ npx agentworth
|
|
|
25
25
|
Scan and index local agent histories across 11 agent adapters:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npx agentworth scan
|
|
28
|
+
npx -y agentworth@latest scan
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
View summary statistics across all indexed traces:
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
npx agentworth stats
|
|
34
|
+
npx -y agentworth@latest stats
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
Inspect token rollups, costs, and rolling pacing:
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
npx agentworth usage --period day
|
|
41
|
-
npx agentworth usage --pacing
|
|
40
|
+
npx -y agentworth@latest usage --period day
|
|
41
|
+
npx -y agentworth@latest usage --pacing
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Trace file modifications back to the AI agent session and prompt:
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
npx agentworth blame src/main.rs
|
|
47
|
+
npx -y agentworth@latest blame src/main.rs
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
List indexed sessions with filtering by adapter or model:
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
npx agentworth traces --limit 20
|
|
54
|
-
npx agentworth traces --adapter claude_code --json
|
|
53
|
+
npx -y agentworth@latest traces --limit 20
|
|
54
|
+
npx -y agentworth@latest traces --adapter claude_code --json
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
Inspect a specific session with timeline and outcome analysis:
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
|
-
npx agentworth inspect <session-id>
|
|
60
|
+
npx -y agentworth@latest inspect <session-id>
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
Export traces safely with automatic secret and path redaction:
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
|
-
npx agentworth export <session-id> --redact --format atif --output session.atif.json
|
|
66
|
+
npx -y agentworth@latest export <session-id> --redact --format atif --output session.atif.json
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
---
|
|
@@ -92,9 +92,7 @@ You can also install the native AgentWorth binary directly:
|
|
|
92
92
|
| Method | Command | Description |
|
|
93
93
|
| :--- | :--- | :--- |
|
|
94
94
|
| **Standalone Script** | `curl -fsSL https://agentworth.dev/install.sh | sh` | Installs the pre-built native binary directly to `~/.local/bin`. |
|
|
95
|
-
| **
|
|
96
|
-
| **Cargo (Native)** | `cargo install agentworth-cli` | Compiles and installs `agentworth` and its short alias `archie` to `~/.cargo/bin`. |
|
|
97
|
-
| **NPX (Instant)** | `npx agentworth` | Zero-install runner that detects or downloads the native binary. |
|
|
95
|
+
| **NPX (Instant)** | `npx -y agentworth@latest` | Zero-install runner that detects or downloads the native binary. |
|
|
98
96
|
|
|
99
97
|
---
|
|
100
98
|
|
package/lib/resolver.js
CHANGED
|
@@ -308,6 +308,67 @@ function pathBinaryMatchesVersion(binPath, expected) {
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
/**
|
|
312
|
+
* The version a binary reports, or null if it cannot be asked. Any failure — missing
|
|
313
|
+
* binary, wrong arch, timeout, unparseable output — is a null, never a guess.
|
|
314
|
+
*
|
|
315
|
+
* @param {string} binPath
|
|
316
|
+
* @returns {string|null}
|
|
317
|
+
*/
|
|
318
|
+
export function readBinaryVersion(binPath) {
|
|
319
|
+
try {
|
|
320
|
+
const out = execFileSync(binPath, ['--version'], {
|
|
321
|
+
encoding: 'utf8',
|
|
322
|
+
timeout: 5000,
|
|
323
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
324
|
+
});
|
|
325
|
+
const match = out.match(/\d+\.\d+\.\d+/);
|
|
326
|
+
return match ? match[0] : null;
|
|
327
|
+
} catch (_) {
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** `0.1.17` -> `[0, 1, 17]`, or null when the string is not version-shaped. */
|
|
333
|
+
function versionTriplet(v) {
|
|
334
|
+
const match = String(v || '').match(/(\d+)\.(\d+)\.(\d+)/);
|
|
335
|
+
return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* The one line printed when the binary about to run is older than the package that is
|
|
340
|
+
* running it. Null on anything else — an equal or newer binary is fine, and a version
|
|
341
|
+
* either side could not be parsed is not evidence of staleness.
|
|
342
|
+
*
|
|
343
|
+
* This cannot see the case that hurts most, a bare `npx agentworth` reusing a months-old
|
|
344
|
+
* *package* from npx's own cache: the package version is then stale too, and both agree.
|
|
345
|
+
* `archie update` says that part; this covers a stale binary under a current package.
|
|
346
|
+
*
|
|
347
|
+
* @param {string|null} resolved - the version the resolved binary reports
|
|
348
|
+
* @param {string} expected - this package's own version
|
|
349
|
+
* @returns {string|null}
|
|
350
|
+
*/
|
|
351
|
+
export function staleBinaryNotice(resolved, expected) {
|
|
352
|
+
const a = versionTriplet(resolved);
|
|
353
|
+
const b = versionTriplet(expected);
|
|
354
|
+
if (!a || !b) return null;
|
|
355
|
+
for (let i = 0; i < 3; i += 1) {
|
|
356
|
+
if (a[i] !== b[i]) {
|
|
357
|
+
return a[i] < b[i]
|
|
358
|
+
? brandLine('-', 'stale', `binary v${resolved} is older than agentworth v${expected}`)
|
|
359
|
+
: null;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return null;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* The two resolution sources that hand back whatever binary is there without asking its
|
|
367
|
+
* version. Sources 3-7 already refuse a mismatch, and the download cache (8) is versioned
|
|
368
|
+
* by its own path, so only these two can serve something older than this package.
|
|
369
|
+
*/
|
|
370
|
+
const UNVERSIONED_SOURCES = new Set(['env:AGENTWORTH_BIN', 'vendor']);
|
|
371
|
+
|
|
311
372
|
/**
|
|
312
373
|
* Drives the download line: redraws in place on a TTY, prints one line to anything else.
|
|
313
374
|
*
|
|
@@ -659,8 +720,7 @@ export function formatMissingBinaryMessage(platformKey = getPlatformKey()) {
|
|
|
659
720
|
' with whichever of these matches how you got here:',
|
|
660
721
|
'',
|
|
661
722
|
' install script curl -fsSL https://agentworth.dev/install.sh | sh',
|
|
662
|
-
'
|
|
663
|
-
' npx npx -y agentworth',
|
|
723
|
+
' npx npx -y agentworth@latest',
|
|
664
724
|
' release https://github.com/unfoundbox-crew/agentworth/releases/latest',
|
|
665
725
|
' a build you own export AGENTWORTH_BIN=/path/to/archie',
|
|
666
726
|
'',
|
|
@@ -732,7 +792,16 @@ export function run(argv = process.argv.slice(2), options = {}) {
|
|
|
732
792
|
// recursion guard in findPathBinary checks AGENTWORTH_LAUNCHER_ACTIVE). The npm version
|
|
733
793
|
// is threaded through too, purely so `agentworth version`/`agentworth update` can report
|
|
734
794
|
// it -- this launcher never reads it back itself.
|
|
735
|
-
const
|
|
795
|
+
const packageVersion = getPackageVersion(options.baseDir || __dirname);
|
|
796
|
+
|
|
797
|
+
// Say so rather than run something old in silence. Only the sources that were never
|
|
798
|
+
// version-checked are asked, so the usual path costs no extra process.
|
|
799
|
+
if (UNVERSIONED_SOURCES.has(binaryResult.source)) {
|
|
800
|
+
const notice = staleBinaryNotice(readBinaryVersion(binaryResult.path), packageVersion);
|
|
801
|
+
if (notice) console.error(notice);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
const childEnv = buildChildEnv(options.env || process.env, packageVersion);
|
|
736
805
|
const result = spawnSync(binaryResult.path, resolvedArgs, {
|
|
737
806
|
stdio: 'inherit',
|
|
738
807
|
env: childEnv,
|