@agent-inspect/viewer 5.1.0 → 5.2.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 path12 = require('path');
|
|
5
5
|
var async_hooks = require('async_hooks');
|
|
6
6
|
require('crypto');
|
|
7
7
|
var promises = require('fs/promises');
|
|
@@ -14,7 +14,7 @@ require('url');
|
|
|
14
14
|
|
|
15
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var path12__default = /*#__PURE__*/_interopDefault(path12);
|
|
18
18
|
var os__default = /*#__PURE__*/_interopDefault(os);
|
|
19
19
|
|
|
20
20
|
// packages/viewer/src/server.ts
|
|
@@ -525,7 +525,7 @@ function persistedInspectEventsToTraceEvents(events, options) {
|
|
|
525
525
|
}
|
|
526
526
|
var DEFAULT_TRACE_DIR_NAME = ".agent-inspect";
|
|
527
527
|
var RUNS_DIR_NAME = "runs";
|
|
528
|
-
var FALLBACK_TRACE_DIR =
|
|
528
|
+
var FALLBACK_TRACE_DIR = path12__default.default.join(
|
|
529
529
|
os__default.default.tmpdir(),
|
|
530
530
|
"agent-inspect",
|
|
531
531
|
RUNS_DIR_NAME
|
|
@@ -540,7 +540,7 @@ function getDefaultTraceDir() {
|
|
|
540
540
|
if (typeof home !== "string" || home.trim() === "") {
|
|
541
541
|
return FALLBACK_TRACE_DIR;
|
|
542
542
|
}
|
|
543
|
-
return
|
|
543
|
+
return path12__default.default.join(home, DEFAULT_TRACE_DIR_NAME, RUNS_DIR_NAME);
|
|
544
544
|
} catch {
|
|
545
545
|
return FALLBACK_TRACE_DIR;
|
|
546
546
|
}
|
|
@@ -749,7 +749,7 @@ var TraceDirectory = class {
|
|
|
749
749
|
this.#dir = resolveTraceDir(options);
|
|
750
750
|
}
|
|
751
751
|
getPath(filename) {
|
|
752
|
-
return filename ?
|
|
752
|
+
return filename ? path12__default.default.join(this.#dir, filename) : this.#dir;
|
|
753
753
|
}
|
|
754
754
|
async list() {
|
|
755
755
|
try {
|
|
@@ -776,7 +776,7 @@ function parseIsoToMs2(value) {
|
|
|
776
776
|
}
|
|
777
777
|
async function extractMetadata(filePath, _quickScan) {
|
|
778
778
|
const stats = await promises.stat(filePath);
|
|
779
|
-
let runIdFromFile =
|
|
779
|
+
let runIdFromFile = path12__default.default.basename(filePath);
|
|
780
780
|
if (runIdFromFile.endsWith(".jsonl")) {
|
|
781
781
|
runIdFromFile = runIdFromFile.slice(0, -".jsonl".length);
|
|
782
782
|
}
|
|
@@ -1386,12 +1386,12 @@ function buildCriticalPath(runs, handoffs) {
|
|
|
1386
1386
|
handoffs.filter((edge) => edge.confidence === "explicit").map((edge) => edge.from)
|
|
1387
1387
|
);
|
|
1388
1388
|
const ordered = [...runs].sort(compareRuns);
|
|
1389
|
-
const
|
|
1389
|
+
const path13 = [];
|
|
1390
1390
|
const visited = /* @__PURE__ */ new Set();
|
|
1391
1391
|
const pushRun = (run, confidence, source) => {
|
|
1392
1392
|
if (visited.has(run.runId)) return;
|
|
1393
1393
|
visited.add(run.runId);
|
|
1394
|
-
|
|
1394
|
+
path13.push({
|
|
1395
1395
|
runId: run.runId,
|
|
1396
1396
|
name: run.name,
|
|
1397
1397
|
startedAt: run.startedAt,
|
|
@@ -1416,7 +1416,7 @@ function buildCriticalPath(runs, handoffs) {
|
|
|
1416
1416
|
const confidence = explicitTargets.has(run.runId) || explicitSources.has(run.runId) ? "explicit" : "correlated";
|
|
1417
1417
|
pushRun(run, confidence, confidence === "explicit" ? "manual" : "inferred");
|
|
1418
1418
|
}
|
|
1419
|
-
return
|
|
1419
|
+
return path13;
|
|
1420
1420
|
}
|
|
1421
1421
|
function metaRunIdMatches(run, token, runById) {
|
|
1422
1422
|
const meta = extractSessionWorkflowMetadata(run.metadata);
|
|
@@ -1689,7 +1689,7 @@ function summarize(findings, diagnostics) {
|
|
|
1689
1689
|
errors: diagnostics.filter((item) => item.severity === "error").length
|
|
1690
1690
|
};
|
|
1691
1691
|
}
|
|
1692
|
-
function eventEvidence(event,
|
|
1692
|
+
function eventEvidence(event, path13) {
|
|
1693
1693
|
return {
|
|
1694
1694
|
runId: event.runId,
|
|
1695
1695
|
eventId: event.eventId,
|
|
@@ -2417,7 +2417,7 @@ function findReaderByFormat(format, readers) {
|
|
|
2417
2417
|
}
|
|
2418
2418
|
async function jsonlFilesInDirectory(dirPath) {
|
|
2419
2419
|
const entries = await promises.readdir(dirPath, { withFileTypes: true });
|
|
2420
|
-
return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map((entry) =>
|
|
2420
|
+
return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map((entry) => path12__default.default.join(dirPath, entry.name)).sort((a, b) => a.localeCompare(b));
|
|
2421
2421
|
}
|
|
2422
2422
|
async function resolveInput(input) {
|
|
2423
2423
|
const cached = resolvedInputCache.get(input);
|
|
@@ -3954,7 +3954,7 @@ function createViewerServer(options = {}) {
|
|
|
3954
3954
|
return sendJson(res, 200, {
|
|
3955
3955
|
ok: true,
|
|
3956
3956
|
readOnly: true,
|
|
3957
|
-
traceDir:
|
|
3957
|
+
traceDir: path12__default.default.resolve(traceDir)
|
|
3958
3958
|
});
|
|
3959
3959
|
}
|
|
3960
3960
|
const td = new TraceDirectory({ dir: traceDir });
|
|
@@ -3972,7 +3972,7 @@ function createViewerServer(options = {}) {
|
|
|
3972
3972
|
runId: meta.runId,
|
|
3973
3973
|
name: meta.name,
|
|
3974
3974
|
status: meta.status,
|
|
3975
|
-
file:
|
|
3975
|
+
file: path12__default.default.basename(meta.filePath),
|
|
3976
3976
|
startedAt: meta.startedAt,
|
|
3977
3977
|
durationMs: meta.durationMs
|
|
3978
3978
|
}))
|
|
@@ -4087,7 +4087,7 @@ function startViewerServer(options = {}) {
|
|
|
4087
4087
|
resolve({
|
|
4088
4088
|
host,
|
|
4089
4089
|
port: resolvedPort,
|
|
4090
|
-
traceDir:
|
|
4090
|
+
traceDir: path12__default.default.resolve(traceDir),
|
|
4091
4091
|
url: `http://${host}:${resolvedPort}`
|
|
4092
4092
|
});
|
|
4093
4093
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createServer } from 'http';
|
|
2
|
-
import
|
|
2
|
+
import path12 from 'path';
|
|
3
3
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
4
4
|
import 'crypto';
|
|
5
5
|
import { readdir, stat, readFile } from 'fs/promises';
|
|
@@ -518,7 +518,7 @@ function persistedInspectEventsToTraceEvents(events, options) {
|
|
|
518
518
|
}
|
|
519
519
|
var DEFAULT_TRACE_DIR_NAME = ".agent-inspect";
|
|
520
520
|
var RUNS_DIR_NAME = "runs";
|
|
521
|
-
var FALLBACK_TRACE_DIR =
|
|
521
|
+
var FALLBACK_TRACE_DIR = path12.join(
|
|
522
522
|
os.tmpdir(),
|
|
523
523
|
"agent-inspect",
|
|
524
524
|
RUNS_DIR_NAME
|
|
@@ -533,7 +533,7 @@ function getDefaultTraceDir() {
|
|
|
533
533
|
if (typeof home !== "string" || home.trim() === "") {
|
|
534
534
|
return FALLBACK_TRACE_DIR;
|
|
535
535
|
}
|
|
536
|
-
return
|
|
536
|
+
return path12.join(home, DEFAULT_TRACE_DIR_NAME, RUNS_DIR_NAME);
|
|
537
537
|
} catch {
|
|
538
538
|
return FALLBACK_TRACE_DIR;
|
|
539
539
|
}
|
|
@@ -742,7 +742,7 @@ var TraceDirectory = class {
|
|
|
742
742
|
this.#dir = resolveTraceDir(options);
|
|
743
743
|
}
|
|
744
744
|
getPath(filename) {
|
|
745
|
-
return filename ?
|
|
745
|
+
return filename ? path12.join(this.#dir, filename) : this.#dir;
|
|
746
746
|
}
|
|
747
747
|
async list() {
|
|
748
748
|
try {
|
|
@@ -769,7 +769,7 @@ function parseIsoToMs2(value) {
|
|
|
769
769
|
}
|
|
770
770
|
async function extractMetadata(filePath, _quickScan) {
|
|
771
771
|
const stats = await stat(filePath);
|
|
772
|
-
let runIdFromFile =
|
|
772
|
+
let runIdFromFile = path12.basename(filePath);
|
|
773
773
|
if (runIdFromFile.endsWith(".jsonl")) {
|
|
774
774
|
runIdFromFile = runIdFromFile.slice(0, -".jsonl".length);
|
|
775
775
|
}
|
|
@@ -1379,12 +1379,12 @@ function buildCriticalPath(runs, handoffs) {
|
|
|
1379
1379
|
handoffs.filter((edge) => edge.confidence === "explicit").map((edge) => edge.from)
|
|
1380
1380
|
);
|
|
1381
1381
|
const ordered = [...runs].sort(compareRuns);
|
|
1382
|
-
const
|
|
1382
|
+
const path13 = [];
|
|
1383
1383
|
const visited = /* @__PURE__ */ new Set();
|
|
1384
1384
|
const pushRun = (run, confidence, source) => {
|
|
1385
1385
|
if (visited.has(run.runId)) return;
|
|
1386
1386
|
visited.add(run.runId);
|
|
1387
|
-
|
|
1387
|
+
path13.push({
|
|
1388
1388
|
runId: run.runId,
|
|
1389
1389
|
name: run.name,
|
|
1390
1390
|
startedAt: run.startedAt,
|
|
@@ -1409,7 +1409,7 @@ function buildCriticalPath(runs, handoffs) {
|
|
|
1409
1409
|
const confidence = explicitTargets.has(run.runId) || explicitSources.has(run.runId) ? "explicit" : "correlated";
|
|
1410
1410
|
pushRun(run, confidence, confidence === "explicit" ? "manual" : "inferred");
|
|
1411
1411
|
}
|
|
1412
|
-
return
|
|
1412
|
+
return path13;
|
|
1413
1413
|
}
|
|
1414
1414
|
function metaRunIdMatches(run, token, runById) {
|
|
1415
1415
|
const meta = extractSessionWorkflowMetadata(run.metadata);
|
|
@@ -1682,7 +1682,7 @@ function summarize(findings, diagnostics) {
|
|
|
1682
1682
|
errors: diagnostics.filter((item) => item.severity === "error").length
|
|
1683
1683
|
};
|
|
1684
1684
|
}
|
|
1685
|
-
function eventEvidence(event,
|
|
1685
|
+
function eventEvidence(event, path13) {
|
|
1686
1686
|
return {
|
|
1687
1687
|
runId: event.runId,
|
|
1688
1688
|
eventId: event.eventId,
|
|
@@ -2410,7 +2410,7 @@ function findReaderByFormat(format, readers) {
|
|
|
2410
2410
|
}
|
|
2411
2411
|
async function jsonlFilesInDirectory(dirPath) {
|
|
2412
2412
|
const entries = await readdir(dirPath, { withFileTypes: true });
|
|
2413
|
-
return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map((entry) =>
|
|
2413
|
+
return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map((entry) => path12.join(dirPath, entry.name)).sort((a, b) => a.localeCompare(b));
|
|
2414
2414
|
}
|
|
2415
2415
|
async function resolveInput(input) {
|
|
2416
2416
|
const cached = resolvedInputCache.get(input);
|
|
@@ -3947,7 +3947,7 @@ function createViewerServer(options = {}) {
|
|
|
3947
3947
|
return sendJson(res, 200, {
|
|
3948
3948
|
ok: true,
|
|
3949
3949
|
readOnly: true,
|
|
3950
|
-
traceDir:
|
|
3950
|
+
traceDir: path12.resolve(traceDir)
|
|
3951
3951
|
});
|
|
3952
3952
|
}
|
|
3953
3953
|
const td = new TraceDirectory({ dir: traceDir });
|
|
@@ -3965,7 +3965,7 @@ function createViewerServer(options = {}) {
|
|
|
3965
3965
|
runId: meta.runId,
|
|
3966
3966
|
name: meta.name,
|
|
3967
3967
|
status: meta.status,
|
|
3968
|
-
file:
|
|
3968
|
+
file: path12.basename(meta.filePath),
|
|
3969
3969
|
startedAt: meta.startedAt,
|
|
3970
3970
|
durationMs: meta.durationMs
|
|
3971
3971
|
}))
|
|
@@ -4080,7 +4080,7 @@ function startViewerServer(options = {}) {
|
|
|
4080
4080
|
resolve({
|
|
4081
4081
|
host,
|
|
4082
4082
|
port: resolvedPort,
|
|
4083
|
-
traceDir:
|
|
4083
|
+
traceDir: path12.resolve(traceDir),
|
|
4084
4084
|
url: `http://${host}:${resolvedPort}`
|
|
4085
4085
|
});
|
|
4086
4086
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-inspect/viewer",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.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": "5.
|
|
37
|
+
"agent-inspect": "5.2.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {},
|
|
40
40
|
"publishConfig": {
|