@agent-inspect/viewer 4.2.0 → 4.3.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/dist/index.cjs +14 -14
- package/dist/index.mjs +13 -13
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var http = require('http');
|
|
4
|
-
var
|
|
4
|
+
var path7 = require('path');
|
|
5
5
|
var async_hooks = require('async_hooks');
|
|
6
6
|
require('crypto');
|
|
7
7
|
var promises = require('fs/promises');
|
|
@@ -13,7 +13,7 @@ require('readline');
|
|
|
13
13
|
|
|
14
14
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var path7__default = /*#__PURE__*/_interopDefault(path7);
|
|
17
17
|
var os__default = /*#__PURE__*/_interopDefault(os);
|
|
18
18
|
|
|
19
19
|
// packages/viewer/src/server.ts
|
|
@@ -490,7 +490,7 @@ function persistedInspectEventsToTraceEvents(events, options) {
|
|
|
490
490
|
}
|
|
491
491
|
var DEFAULT_TRACE_DIR_NAME = ".agent-inspect";
|
|
492
492
|
var RUNS_DIR_NAME = "runs";
|
|
493
|
-
var FALLBACK_TRACE_DIR =
|
|
493
|
+
var FALLBACK_TRACE_DIR = path7__default.default.join(
|
|
494
494
|
os__default.default.tmpdir(),
|
|
495
495
|
"agent-inspect",
|
|
496
496
|
RUNS_DIR_NAME
|
|
@@ -505,7 +505,7 @@ function getDefaultTraceDir() {
|
|
|
505
505
|
if (typeof home !== "string" || home.trim() === "") {
|
|
506
506
|
return FALLBACK_TRACE_DIR;
|
|
507
507
|
}
|
|
508
|
-
return
|
|
508
|
+
return path7__default.default.join(home, DEFAULT_TRACE_DIR_NAME, RUNS_DIR_NAME);
|
|
509
509
|
} catch {
|
|
510
510
|
return FALLBACK_TRACE_DIR;
|
|
511
511
|
}
|
|
@@ -711,7 +711,7 @@ var TraceDirectory = class {
|
|
|
711
711
|
this.#dir = resolveTraceDir(options);
|
|
712
712
|
}
|
|
713
713
|
getPath(filename) {
|
|
714
|
-
return filename ?
|
|
714
|
+
return filename ? path7__default.default.join(this.#dir, filename) : this.#dir;
|
|
715
715
|
}
|
|
716
716
|
async list() {
|
|
717
717
|
try {
|
|
@@ -738,7 +738,7 @@ function parseIsoToMs2(value) {
|
|
|
738
738
|
}
|
|
739
739
|
async function extractMetadata(filePath, _quickScan) {
|
|
740
740
|
const stats = await promises.stat(filePath);
|
|
741
|
-
let runIdFromFile =
|
|
741
|
+
let runIdFromFile = path7__default.default.basename(filePath);
|
|
742
742
|
if (runIdFromFile.endsWith(".jsonl")) {
|
|
743
743
|
runIdFromFile = runIdFromFile.slice(0, -".jsonl".length);
|
|
744
744
|
}
|
|
@@ -1348,12 +1348,12 @@ function buildCriticalPath(runs, handoffs) {
|
|
|
1348
1348
|
handoffs.filter((edge) => edge.confidence === "explicit").map((edge) => edge.from)
|
|
1349
1349
|
);
|
|
1350
1350
|
const ordered = [...runs].sort(compareRuns);
|
|
1351
|
-
const
|
|
1351
|
+
const path8 = [];
|
|
1352
1352
|
const visited = /* @__PURE__ */ new Set();
|
|
1353
1353
|
const pushRun = (run, confidence, source) => {
|
|
1354
1354
|
if (visited.has(run.runId)) return;
|
|
1355
1355
|
visited.add(run.runId);
|
|
1356
|
-
|
|
1356
|
+
path8.push({
|
|
1357
1357
|
runId: run.runId,
|
|
1358
1358
|
name: run.name,
|
|
1359
1359
|
startedAt: run.startedAt,
|
|
@@ -1378,7 +1378,7 @@ function buildCriticalPath(runs, handoffs) {
|
|
|
1378
1378
|
const confidence = explicitTargets.has(run.runId) || explicitSources.has(run.runId) ? "explicit" : "correlated";
|
|
1379
1379
|
pushRun(run, confidence, confidence === "explicit" ? "manual" : "inferred");
|
|
1380
1380
|
}
|
|
1381
|
-
return
|
|
1381
|
+
return path8;
|
|
1382
1382
|
}
|
|
1383
1383
|
function metaRunIdMatches(run, token, runById) {
|
|
1384
1384
|
const meta = extractSessionWorkflowMetadata(run.metadata);
|
|
@@ -1651,7 +1651,7 @@ function summarize(findings, diagnostics) {
|
|
|
1651
1651
|
errors: diagnostics.filter((item) => item.severity === "error").length
|
|
1652
1652
|
};
|
|
1653
1653
|
}
|
|
1654
|
-
function eventEvidence(event,
|
|
1654
|
+
function eventEvidence(event, path8) {
|
|
1655
1655
|
return {
|
|
1656
1656
|
runId: event.runId,
|
|
1657
1657
|
eventId: event.eventId,
|
|
@@ -2342,7 +2342,7 @@ function findReaderByFormat(format, readers) {
|
|
|
2342
2342
|
}
|
|
2343
2343
|
async function jsonlFilesInDirectory(dirPath) {
|
|
2344
2344
|
const entries = await promises.readdir(dirPath, { withFileTypes: true });
|
|
2345
|
-
return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map((entry) =>
|
|
2345
|
+
return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map((entry) => path7__default.default.join(dirPath, entry.name)).sort((a, b) => a.localeCompare(b));
|
|
2346
2346
|
}
|
|
2347
2347
|
async function resolveInput(input) {
|
|
2348
2348
|
const cached = resolvedInputCache.get(input);
|
|
@@ -3879,7 +3879,7 @@ function createViewerServer(options = {}) {
|
|
|
3879
3879
|
return sendJson(res, 200, {
|
|
3880
3880
|
ok: true,
|
|
3881
3881
|
readOnly: true,
|
|
3882
|
-
traceDir:
|
|
3882
|
+
traceDir: path7__default.default.resolve(traceDir)
|
|
3883
3883
|
});
|
|
3884
3884
|
}
|
|
3885
3885
|
const td = new TraceDirectory({ dir: traceDir });
|
|
@@ -3897,7 +3897,7 @@ function createViewerServer(options = {}) {
|
|
|
3897
3897
|
runId: meta.runId,
|
|
3898
3898
|
name: meta.name,
|
|
3899
3899
|
status: meta.status,
|
|
3900
|
-
file:
|
|
3900
|
+
file: path7__default.default.basename(meta.filePath),
|
|
3901
3901
|
startedAt: meta.startedAt,
|
|
3902
3902
|
durationMs: meta.durationMs
|
|
3903
3903
|
}))
|
|
@@ -4012,7 +4012,7 @@ function startViewerServer(options = {}) {
|
|
|
4012
4012
|
resolve({
|
|
4013
4013
|
host,
|
|
4014
4014
|
port: resolvedPort,
|
|
4015
|
-
traceDir:
|
|
4015
|
+
traceDir: path7__default.default.resolve(traceDir),
|
|
4016
4016
|
url: `http://${host}:${resolvedPort}`
|
|
4017
4017
|
});
|
|
4018
4018
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createServer } from 'http';
|
|
2
|
-
import
|
|
2
|
+
import path7 from 'path';
|
|
3
3
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
4
4
|
import 'crypto';
|
|
5
5
|
import { readdir, stat, readFile } from 'fs/promises';
|
|
@@ -483,7 +483,7 @@ function persistedInspectEventsToTraceEvents(events, options) {
|
|
|
483
483
|
}
|
|
484
484
|
var DEFAULT_TRACE_DIR_NAME = ".agent-inspect";
|
|
485
485
|
var RUNS_DIR_NAME = "runs";
|
|
486
|
-
var FALLBACK_TRACE_DIR =
|
|
486
|
+
var FALLBACK_TRACE_DIR = path7.join(
|
|
487
487
|
os.tmpdir(),
|
|
488
488
|
"agent-inspect",
|
|
489
489
|
RUNS_DIR_NAME
|
|
@@ -498,7 +498,7 @@ function getDefaultTraceDir() {
|
|
|
498
498
|
if (typeof home !== "string" || home.trim() === "") {
|
|
499
499
|
return FALLBACK_TRACE_DIR;
|
|
500
500
|
}
|
|
501
|
-
return
|
|
501
|
+
return path7.join(home, DEFAULT_TRACE_DIR_NAME, RUNS_DIR_NAME);
|
|
502
502
|
} catch {
|
|
503
503
|
return FALLBACK_TRACE_DIR;
|
|
504
504
|
}
|
|
@@ -704,7 +704,7 @@ var TraceDirectory = class {
|
|
|
704
704
|
this.#dir = resolveTraceDir(options);
|
|
705
705
|
}
|
|
706
706
|
getPath(filename) {
|
|
707
|
-
return filename ?
|
|
707
|
+
return filename ? path7.join(this.#dir, filename) : this.#dir;
|
|
708
708
|
}
|
|
709
709
|
async list() {
|
|
710
710
|
try {
|
|
@@ -731,7 +731,7 @@ function parseIsoToMs2(value) {
|
|
|
731
731
|
}
|
|
732
732
|
async function extractMetadata(filePath, _quickScan) {
|
|
733
733
|
const stats = await stat(filePath);
|
|
734
|
-
let runIdFromFile =
|
|
734
|
+
let runIdFromFile = path7.basename(filePath);
|
|
735
735
|
if (runIdFromFile.endsWith(".jsonl")) {
|
|
736
736
|
runIdFromFile = runIdFromFile.slice(0, -".jsonl".length);
|
|
737
737
|
}
|
|
@@ -1341,12 +1341,12 @@ function buildCriticalPath(runs, handoffs) {
|
|
|
1341
1341
|
handoffs.filter((edge) => edge.confidence === "explicit").map((edge) => edge.from)
|
|
1342
1342
|
);
|
|
1343
1343
|
const ordered = [...runs].sort(compareRuns);
|
|
1344
|
-
const
|
|
1344
|
+
const path8 = [];
|
|
1345
1345
|
const visited = /* @__PURE__ */ new Set();
|
|
1346
1346
|
const pushRun = (run, confidence, source) => {
|
|
1347
1347
|
if (visited.has(run.runId)) return;
|
|
1348
1348
|
visited.add(run.runId);
|
|
1349
|
-
|
|
1349
|
+
path8.push({
|
|
1350
1350
|
runId: run.runId,
|
|
1351
1351
|
name: run.name,
|
|
1352
1352
|
startedAt: run.startedAt,
|
|
@@ -1371,7 +1371,7 @@ function buildCriticalPath(runs, handoffs) {
|
|
|
1371
1371
|
const confidence = explicitTargets.has(run.runId) || explicitSources.has(run.runId) ? "explicit" : "correlated";
|
|
1372
1372
|
pushRun(run, confidence, confidence === "explicit" ? "manual" : "inferred");
|
|
1373
1373
|
}
|
|
1374
|
-
return
|
|
1374
|
+
return path8;
|
|
1375
1375
|
}
|
|
1376
1376
|
function metaRunIdMatches(run, token, runById) {
|
|
1377
1377
|
const meta = extractSessionWorkflowMetadata(run.metadata);
|
|
@@ -1644,7 +1644,7 @@ function summarize(findings, diagnostics) {
|
|
|
1644
1644
|
errors: diagnostics.filter((item) => item.severity === "error").length
|
|
1645
1645
|
};
|
|
1646
1646
|
}
|
|
1647
|
-
function eventEvidence(event,
|
|
1647
|
+
function eventEvidence(event, path8) {
|
|
1648
1648
|
return {
|
|
1649
1649
|
runId: event.runId,
|
|
1650
1650
|
eventId: event.eventId,
|
|
@@ -2335,7 +2335,7 @@ function findReaderByFormat(format, readers) {
|
|
|
2335
2335
|
}
|
|
2336
2336
|
async function jsonlFilesInDirectory(dirPath) {
|
|
2337
2337
|
const entries = await readdir(dirPath, { withFileTypes: true });
|
|
2338
|
-
return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map((entry) =>
|
|
2338
|
+
return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map((entry) => path7.join(dirPath, entry.name)).sort((a, b) => a.localeCompare(b));
|
|
2339
2339
|
}
|
|
2340
2340
|
async function resolveInput(input) {
|
|
2341
2341
|
const cached = resolvedInputCache.get(input);
|
|
@@ -3872,7 +3872,7 @@ function createViewerServer(options = {}) {
|
|
|
3872
3872
|
return sendJson(res, 200, {
|
|
3873
3873
|
ok: true,
|
|
3874
3874
|
readOnly: true,
|
|
3875
|
-
traceDir:
|
|
3875
|
+
traceDir: path7.resolve(traceDir)
|
|
3876
3876
|
});
|
|
3877
3877
|
}
|
|
3878
3878
|
const td = new TraceDirectory({ dir: traceDir });
|
|
@@ -3890,7 +3890,7 @@ function createViewerServer(options = {}) {
|
|
|
3890
3890
|
runId: meta.runId,
|
|
3891
3891
|
name: meta.name,
|
|
3892
3892
|
status: meta.status,
|
|
3893
|
-
file:
|
|
3893
|
+
file: path7.basename(meta.filePath),
|
|
3894
3894
|
startedAt: meta.startedAt,
|
|
3895
3895
|
durationMs: meta.durationMs
|
|
3896
3896
|
}))
|
|
@@ -4005,7 +4005,7 @@ function startViewerServer(options = {}) {
|
|
|
4005
4005
|
resolve({
|
|
4006
4006
|
host,
|
|
4007
4007
|
port: resolvedPort,
|
|
4008
|
-
traceDir:
|
|
4008
|
+
traceDir: path7.resolve(traceDir),
|
|
4009
4009
|
url: `http://${host}:${resolvedPort}`
|
|
4010
4010
|
});
|
|
4011
4011
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-inspect/viewer",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Optional localhost read-only trace viewer for AgentInspect",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"agent-inspect": "4.
|
|
37
|
+
"agent-inspect": "4.3.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {},
|
|
40
40
|
"publishConfig": {
|