@swestash/agent-lens 0.16.0 → 0.17.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/agent-lens.js +30 -11
- package/dist/agent-lens.js.map +1 -1
- package/package.json +1 -1
- package/web/404.html +2 -2
- package/web/assets/AboutView-BiuYVPOe.js +1 -0
- package/web/assets/{Dashboard-DF8Xb9E1.js → Dashboard-fPsqJm-5.js} +2 -2
- package/web/assets/FileView-CX-Pe5S0.js +1 -0
- package/web/assets/{FilesView-DW_bHt2e.js → FilesView-CPaEQFkv.js} +1 -1
- package/web/assets/SecurityView-D3qd2-q5.js +1 -0
- package/web/assets/SessionView-DtykJhVv.js +19 -0
- package/web/assets/{SkillView-BdZwKqK6.js → SkillView-D72WQ-Xv.js} +1 -1
- package/web/assets/SkillsView-CW8sNMN7.js +1 -0
- package/web/assets/{WorkflowView-yNhKNcg9.js → WorkflowView-Dek4WLJa.js} +1 -1
- package/web/assets/index-CG2N8ixY.js +69 -0
- package/web/assets/{index-BuG6Awf5.js → index-DLoMRgQ8.js} +1 -1
- package/web/assets/index-DN9qB28e.css +1 -0
- package/web/assets/jsonish-B0CzuJ3V.js +1 -0
- package/web/assets/theme-DiAReGS9.js +1 -0
- package/web/assets/{useResetOn-BEUZVwM5.js → useResetOn-CoUOqjZU.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/AboutView-BExwxt7F.js +0 -1
- package/web/assets/FileView-hDF8bAaa.js +0 -1
- package/web/assets/SecurityView-DPRI6HpG.js +0 -1
- package/web/assets/SessionView-eGmw43Bq.js +0 -15
- package/web/assets/SkillsView-DUrXsvh_.js +0 -1
- package/web/assets/index-B6dWnwqZ.css +0 -1
- package/web/assets/index-CMT9aRT7.js +0 -69
- package/web/assets/jsonish-DI8SpR-J.js +0 -1
- package/web/assets/theme-DiOdnv26.js +0 -1
package/dist/agent-lens.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { existsSync as
|
|
4
|
+
import { existsSync as existsSync11, writeFileSync as writeFileSync3 } from "node:fs";
|
|
5
5
|
import { join as join12 } from "node:path";
|
|
6
6
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
7
7
|
|
|
@@ -4643,11 +4643,12 @@ function runMetrics(argv = process.argv.slice(2)) {
|
|
|
4643
4643
|
}
|
|
4644
4644
|
|
|
4645
4645
|
// ../server/dist/run.js
|
|
4646
|
-
import { existsSync as
|
|
4646
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
4647
4647
|
import { dirname as dirname7 } from "node:path";
|
|
4648
4648
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
4649
4649
|
|
|
4650
4650
|
// ../server/dist/db.js
|
|
4651
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
4651
4652
|
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
4652
4653
|
|
|
4653
4654
|
// ../server/dist/sql-util.js
|
|
@@ -5105,6 +5106,17 @@ function getSession(db, id) {
|
|
|
5105
5106
|
file_changes: loadFileChanges(db, id)
|
|
5106
5107
|
};
|
|
5107
5108
|
}
|
|
5109
|
+
function sessionLocation(db, id) {
|
|
5110
|
+
const session = queryGet(db, "SELECT source_id FROM sessions WHERE id = ?", id);
|
|
5111
|
+
if (!session)
|
|
5112
|
+
return null;
|
|
5113
|
+
const files = queryAll(db, "SELECT DISTINCT source_file FROM events WHERE session_id = ? AND source_file IS NOT NULL", id).map((r) => r.source_file);
|
|
5114
|
+
if (files.length === 0)
|
|
5115
|
+
return null;
|
|
5116
|
+
const live = files.filter((f) => !f.includes("/.versions/"));
|
|
5117
|
+
const path3 = live.find((f) => f.endsWith(`/${id}.jsonl`)) ?? live[0] ?? files[0];
|
|
5118
|
+
return { session_id: id, path: path3, exists: existsSync6(path3), source_id: session.source_id };
|
|
5119
|
+
}
|
|
5108
5120
|
function safeJson(s) {
|
|
5109
5121
|
if (!s)
|
|
5110
5122
|
return null;
|
|
@@ -5468,7 +5480,7 @@ function securitySummary(db) {
|
|
|
5468
5480
|
}
|
|
5469
5481
|
|
|
5470
5482
|
// ../server/dist/app.js
|
|
5471
|
-
import { existsSync as
|
|
5483
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
5472
5484
|
import Fastify from "fastify";
|
|
5473
5485
|
import fastifyStatic from "@fastify/static";
|
|
5474
5486
|
|
|
@@ -5956,7 +5968,7 @@ function findingsOverTime(db, w, bucket) {
|
|
|
5956
5968
|
}
|
|
5957
5969
|
|
|
5958
5970
|
// ../server/dist/refresh.js
|
|
5959
|
-
import { existsSync as
|
|
5971
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync5 } from "node:fs";
|
|
5960
5972
|
import { join as join10 } from "node:path";
|
|
5961
5973
|
var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "[::1]"]);
|
|
5962
5974
|
function originAllowed(origin) {
|
|
@@ -5984,7 +5996,7 @@ function runRefresh() {
|
|
|
5984
5996
|
try {
|
|
5985
5997
|
const collected = collectAll();
|
|
5986
5998
|
const archiveRoot = resolveArchiveDir();
|
|
5987
|
-
if (!
|
|
5999
|
+
if (!existsSync7(archiveRoot))
|
|
5988
6000
|
mkdirSync5(archiveRoot, { recursive: true });
|
|
5989
6001
|
runIngest([]);
|
|
5990
6002
|
return { ok: true, collected };
|
|
@@ -6286,6 +6298,13 @@ async function createApp(db, opts = {}) {
|
|
|
6286
6298
|
return notFound(reply);
|
|
6287
6299
|
return result;
|
|
6288
6300
|
});
|
|
6301
|
+
app.get("/api/sessions/:id/location", async (req, reply) => {
|
|
6302
|
+
const { id } = req.params;
|
|
6303
|
+
const result = sessionLocation(db, id);
|
|
6304
|
+
if (!result)
|
|
6305
|
+
return notFound(reply, "no archive path recorded for this session");
|
|
6306
|
+
return result;
|
|
6307
|
+
});
|
|
6289
6308
|
app.get("/api/workflows/:run_id", async (req, reply) => {
|
|
6290
6309
|
const { run_id } = req.params;
|
|
6291
6310
|
const result = getWorkflow(db, run_id);
|
|
@@ -6405,7 +6424,7 @@ async function createApp(db, opts = {}) {
|
|
|
6405
6424
|
return notFound(reply);
|
|
6406
6425
|
reply.header("content-type", "text/markdown; charset=utf-8").header("content-disposition", `attachment; filename="${out.filename}"`).send(out.markdown);
|
|
6407
6426
|
});
|
|
6408
|
-
if (opts.webDist &&
|
|
6427
|
+
if (opts.webDist && existsSync8(opts.webDist)) {
|
|
6409
6428
|
await app.register(fastifyStatic, { root: opts.webDist });
|
|
6410
6429
|
app.setNotFoundHandler((req, reply) => {
|
|
6411
6430
|
if (req.url.startsWith("/api/"))
|
|
@@ -6430,7 +6449,7 @@ async function startServer(overrides = {}) {
|
|
|
6430
6449
|
console.error(`agent-lens-server: refusing to bind non-loopback host '${host}' (privacy). Set AGENT_LENS_ALLOW_NONLOCAL=1 to override.`);
|
|
6431
6450
|
process.exit(1);
|
|
6432
6451
|
}
|
|
6433
|
-
if (!
|
|
6452
|
+
if (!existsSync9(dbPath)) {
|
|
6434
6453
|
console.error(`agent-lens-server: db not found: ${dbPath} (run ingest first)`);
|
|
6435
6454
|
process.exit(1);
|
|
6436
6455
|
}
|
|
@@ -6446,7 +6465,7 @@ async function startServer(overrides = {}) {
|
|
|
6446
6465
|
try {
|
|
6447
6466
|
await app.listen({ host, port });
|
|
6448
6467
|
console.log(`agent-lens-server: http://${host}:${port} (db: ${dbPath})`);
|
|
6449
|
-
if (!
|
|
6468
|
+
if (!existsSync9(webDist))
|
|
6450
6469
|
console.log(" note: web SPA not built \u2014 run `pnpm --filter @agent-lens/web build`");
|
|
6451
6470
|
} catch (err) {
|
|
6452
6471
|
console.error(err);
|
|
@@ -6455,7 +6474,7 @@ async function startServer(overrides = {}) {
|
|
|
6455
6474
|
}
|
|
6456
6475
|
|
|
6457
6476
|
// src/watch.ts
|
|
6458
|
-
import { existsSync as
|
|
6477
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
6459
6478
|
import { join as join11 } from "node:path";
|
|
6460
6479
|
import chokidar from "chokidar";
|
|
6461
6480
|
async function runWatch(opts = {}) {
|
|
@@ -6493,7 +6512,7 @@ async function runWatch(opts = {}) {
|
|
|
6493
6512
|
}
|
|
6494
6513
|
};
|
|
6495
6514
|
cycle();
|
|
6496
|
-
const watchPaths = sources.map((s) => join11(s.configDir, "projects")).filter((p) =>
|
|
6515
|
+
const watchPaths = sources.map((s) => join11(s.configDir, "projects")).filter((p) => existsSync10(p));
|
|
6497
6516
|
if (watchPaths.length === 0) {
|
|
6498
6517
|
console.error("agent-lens watch: no source 'projects' directories found \u2014 nothing to watch");
|
|
6499
6518
|
}
|
|
@@ -6570,7 +6589,7 @@ cli.command("metrics", "Re-run classification over an already-ingested DB").opti
|
|
|
6570
6589
|
});
|
|
6571
6590
|
cli.command("export <sessionId>", "Write a session to a shareable Markdown file (redacted by default)").option("--out <file>", "Write to this file (default: stdout)").option("--level <level>", "Redaction level: secrets (default) | structure").option("--no-redact", "Verbatim, UNREDACTED output (opt-out)").option("--db <path>", "SQLite DB path (overrides AGENT_LENS_DB / config db)").action((sessionId, opts) => {
|
|
6572
6591
|
const { path: dbPath } = resolveDbPath(opts.db);
|
|
6573
|
-
if (!
|
|
6592
|
+
if (!existsSync11(dbPath)) {
|
|
6574
6593
|
console.error(`agent-lens: db not found: ${dbPath} (run ingest first)`);
|
|
6575
6594
|
process.exit(1);
|
|
6576
6595
|
}
|