agent-inspect 6.7.3 → 6.7.5
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 +21 -0
- package/README.md +1 -1
- package/docs/CLI.md +4 -4
- package/docs/NESTJS.md +10 -0
- package/package.json +2 -2
- package/packages/cli/dist/{chunk-EMYDJREA.mjs → chunk-TO4VENHV.mjs} +228 -234
- package/packages/cli/dist/chunk-TO4VENHV.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +523 -1176
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +126 -44
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/src-Z5W27YCW.mjs +419 -0
- package/packages/cli/dist/src-Z5W27YCW.mjs.map +1 -0
- package/packages/core/dist/advanced.cjs +225 -199
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +26 -241
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/{chunk-X2FLDF7M.mjs → chunk-CTA6XNDP.mjs} +3 -3
- package/packages/core/dist/{chunk-X2FLDF7M.mjs.map → chunk-CTA6XNDP.mjs.map} +1 -1
- package/packages/core/dist/{chunk-3USJVBLA.mjs → chunk-KDDU2R5P.mjs} +236 -5
- package/packages/core/dist/chunk-KDDU2R5P.mjs.map +1 -0
- package/packages/core/dist/{chunk-E5F2LQCX.mjs → chunk-T5MASTIW.mjs} +15 -4
- package/packages/core/dist/chunk-T5MASTIW.mjs.map +1 -0
- package/packages/core/dist/{chunk-KNYL56KZ.mjs → chunk-UOPVGCOB.mjs} +3 -3
- package/packages/core/dist/{chunk-KNYL56KZ.mjs.map → chunk-UOPVGCOB.mjs.map} +1 -1
- package/packages/core/dist/exporters.cjs +136 -129
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.mjs +1 -1
- package/packages/core/dist/logs.cjs +13 -2
- package/packages/core/dist/logs.cjs.map +1 -1
- package/packages/core/dist/logs.mjs +2 -2
- package/packages/core/dist/persisted.cjs +13 -2
- package/packages/core/dist/persisted.cjs.map +1 -1
- package/packages/core/dist/persisted.mjs +3 -3
- package/packages/core/dist/readers.cjs +13 -2
- package/packages/core/dist/readers.cjs.map +1 -1
- package/packages/core/dist/readers.mjs +3 -3
- package/packages/cli/dist/chunk-EMYDJREA.mjs.map +0 -1
- package/packages/cli/dist/src-IPJNFV37.mjs +0 -1160
- package/packages/cli/dist/src-IPJNFV37.mjs.map +0 -1
- package/packages/core/dist/chunk-3USJVBLA.mjs.map +0 -1
- package/packages/core/dist/chunk-E5F2LQCX.mjs.map +0 -1
|
@@ -11,9 +11,9 @@ var tty = require('tty');
|
|
|
11
11
|
var fs = require('fs');
|
|
12
12
|
var readline = require('readline');
|
|
13
13
|
var url = require('url');
|
|
14
|
+
var module$1 = require('module');
|
|
14
15
|
var commander = require('commander');
|
|
15
16
|
var http = require('http');
|
|
16
|
-
var module$1 = require('module');
|
|
17
17
|
|
|
18
18
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
19
19
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -24,44 +24,15 @@ var path26__default = /*#__PURE__*/_interopDefault(path26);
|
|
|
24
24
|
var process3__default = /*#__PURE__*/_interopDefault(process3);
|
|
25
25
|
var tty__default = /*#__PURE__*/_interopDefault(tty);
|
|
26
26
|
|
|
27
|
-
var __create = Object.create;
|
|
28
27
|
var __defProp = Object.defineProperty;
|
|
29
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
30
28
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
31
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
32
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
33
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
34
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
35
|
-
}) : x)(function(x) {
|
|
36
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
37
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
38
|
-
});
|
|
39
29
|
var __esm = (fn, res) => function __init() {
|
|
40
30
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
41
31
|
};
|
|
42
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
43
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
44
|
-
};
|
|
45
32
|
var __export = (target, all) => {
|
|
46
33
|
for (var name in all)
|
|
47
34
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
48
35
|
};
|
|
49
|
-
var __copyProps = (to, from, except, desc) => {
|
|
50
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
51
|
-
for (let key of __getOwnPropNames(from))
|
|
52
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
53
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
54
|
-
}
|
|
55
|
-
return to;
|
|
56
|
-
};
|
|
57
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
58
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
59
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
60
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
61
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
62
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
63
|
-
mod
|
|
64
|
-
));
|
|
65
36
|
|
|
66
37
|
// packages/core/src/correlation-metadata.ts
|
|
67
38
|
function isNonEmptyString(value) {
|
|
@@ -2114,8 +2085,8 @@ function buildRunSummary(events) {
|
|
|
2114
2085
|
let hasCachedTokens = false;
|
|
2115
2086
|
const depthCache = /* @__PURE__ */ new Map();
|
|
2116
2087
|
const computeDepth = (stepId) => {
|
|
2117
|
-
const
|
|
2118
|
-
if (
|
|
2088
|
+
const cached2 = depthCache.get(stepId);
|
|
2089
|
+
if (cached2 !== void 0) return cached2;
|
|
2119
2090
|
const node = steps.get(stepId);
|
|
2120
2091
|
if (!node) return 0;
|
|
2121
2092
|
const parent = node.parentId;
|
|
@@ -2225,6 +2196,210 @@ var init_trace_filter = __esm({
|
|
|
2225
2196
|
}
|
|
2226
2197
|
});
|
|
2227
2198
|
|
|
2199
|
+
// packages/core/src/stats.ts
|
|
2200
|
+
function percentile(sorted, p) {
|
|
2201
|
+
if (sorted.length === 0) return void 0;
|
|
2202
|
+
const idx = Math.min(
|
|
2203
|
+
sorted.length - 1,
|
|
2204
|
+
Math.max(0, Math.ceil(p / 100 * sorted.length) - 1)
|
|
2205
|
+
);
|
|
2206
|
+
return sorted[idx];
|
|
2207
|
+
}
|
|
2208
|
+
async function readRunStartedMetadata(filePath) {
|
|
2209
|
+
try {
|
|
2210
|
+
const events = await readTraceEventsFromFile(filePath);
|
|
2211
|
+
for (const event of events) {
|
|
2212
|
+
if (event.event !== "run_started") continue;
|
|
2213
|
+
const rs = event;
|
|
2214
|
+
if (rs.metadata && typeof rs.metadata === "object") {
|
|
2215
|
+
return rs.metadata;
|
|
2216
|
+
}
|
|
2217
|
+
return void 0;
|
|
2218
|
+
}
|
|
2219
|
+
} catch {
|
|
2220
|
+
}
|
|
2221
|
+
return void 0;
|
|
2222
|
+
}
|
|
2223
|
+
function metaMatchesCorrelation(metadata, correlationId, groupId) {
|
|
2224
|
+
if (correlationId) {
|
|
2225
|
+
const v = metadata?.correlationId;
|
|
2226
|
+
if (typeof v !== "string" || v !== correlationId) return false;
|
|
2227
|
+
}
|
|
2228
|
+
if (groupId) {
|
|
2229
|
+
const v = metadata?.groupId;
|
|
2230
|
+
if (typeof v !== "string" || v !== groupId) return false;
|
|
2231
|
+
}
|
|
2232
|
+
return true;
|
|
2233
|
+
}
|
|
2234
|
+
async function buildTraceStats(metas, options) {
|
|
2235
|
+
let filtered = filterTraces(metas, { since: options.since });
|
|
2236
|
+
if (options.correlationId || options.groupId) {
|
|
2237
|
+
const next = [];
|
|
2238
|
+
for (const m of filtered) {
|
|
2239
|
+
const md = await readRunStartedMetadata(m.filePath);
|
|
2240
|
+
if (metaMatchesCorrelation(md, options.correlationId, options.groupId)) {
|
|
2241
|
+
next.push(m);
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
filtered = next;
|
|
2245
|
+
}
|
|
2246
|
+
let successCount = 0;
|
|
2247
|
+
let errorCount = 0;
|
|
2248
|
+
let runningCount = 0;
|
|
2249
|
+
let unknownCount = 0;
|
|
2250
|
+
const durations = [];
|
|
2251
|
+
let totalSteps = 0;
|
|
2252
|
+
let totalLlmSteps = 0;
|
|
2253
|
+
let totalToolSteps = 0;
|
|
2254
|
+
let totalErrorSteps = 0;
|
|
2255
|
+
const slowestRuns = [];
|
|
2256
|
+
const slowestSteps = [];
|
|
2257
|
+
for (const m of filtered) {
|
|
2258
|
+
if (m.status === "success") successCount += 1;
|
|
2259
|
+
else if (m.status === "error") errorCount += 1;
|
|
2260
|
+
else if (m.status === "running") runningCount += 1;
|
|
2261
|
+
else unknownCount += 1;
|
|
2262
|
+
if (typeof m.durationMs === "number" && Number.isFinite(m.durationMs) && m.durationMs >= 0) {
|
|
2263
|
+
durations.push(m.durationMs);
|
|
2264
|
+
slowestRuns.push({
|
|
2265
|
+
runId: m.runId,
|
|
2266
|
+
name: m.name,
|
|
2267
|
+
durationMs: m.durationMs,
|
|
2268
|
+
status: m.status
|
|
2269
|
+
});
|
|
2270
|
+
}
|
|
2271
|
+
try {
|
|
2272
|
+
const events = await readTraceEventsFromFile(m.filePath);
|
|
2273
|
+
if (events.length === 0) continue;
|
|
2274
|
+
const summary = buildRunSummary(events);
|
|
2275
|
+
totalSteps += summary.totalSteps;
|
|
2276
|
+
totalLlmSteps += summary.llmSteps;
|
|
2277
|
+
totalToolSteps += summary.toolSteps;
|
|
2278
|
+
totalErrorSteps += summary.errorSteps;
|
|
2279
|
+
const steps = collectCompletedSteps(events, m.runId);
|
|
2280
|
+
for (const s of steps) {
|
|
2281
|
+
slowestSteps.push(s);
|
|
2282
|
+
}
|
|
2283
|
+
} catch {
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
slowestRuns.sort((a, b) => (b.durationMs ?? 0) - (a.durationMs ?? 0));
|
|
2287
|
+
slowestSteps.sort((a, b) => b.durationMs - a.durationMs);
|
|
2288
|
+
const runLimit = options.slowRunLimit ?? 5;
|
|
2289
|
+
const stepLimit = options.slowStepLimit ?? 5;
|
|
2290
|
+
const sortedDur = [...durations].sort((a, b) => a - b);
|
|
2291
|
+
const totalRuns = filtered.length;
|
|
2292
|
+
const errorRate = totalRuns > 0 ? errorCount / totalRuns : 0;
|
|
2293
|
+
const sumDur = durations.reduce((a, b) => a + b, 0);
|
|
2294
|
+
return {
|
|
2295
|
+
traceDir: options.traceDir,
|
|
2296
|
+
...options.since ? { since: options.since } : {},
|
|
2297
|
+
...options.correlationId ? { correlationId: options.correlationId } : {},
|
|
2298
|
+
...options.groupId ? { groupId: options.groupId } : {},
|
|
2299
|
+
totalRuns,
|
|
2300
|
+
successCount,
|
|
2301
|
+
errorCount,
|
|
2302
|
+
runningCount,
|
|
2303
|
+
unknownCount,
|
|
2304
|
+
errorRate,
|
|
2305
|
+
duration: {
|
|
2306
|
+
...sortedDur.length > 0 ? {
|
|
2307
|
+
minMs: sortedDur[0],
|
|
2308
|
+
maxMs: sortedDur[sortedDur.length - 1],
|
|
2309
|
+
avgMs: sumDur / sortedDur.length,
|
|
2310
|
+
p50Ms: percentile(sortedDur, 50),
|
|
2311
|
+
p95Ms: percentile(sortedDur, 95)
|
|
2312
|
+
} : {}
|
|
2313
|
+
},
|
|
2314
|
+
totalSteps,
|
|
2315
|
+
avgStepsPerRun: totalRuns > 0 ? totalSteps / totalRuns : 0,
|
|
2316
|
+
totalLlmSteps,
|
|
2317
|
+
totalToolSteps,
|
|
2318
|
+
totalErrorSteps,
|
|
2319
|
+
slowestRuns: slowestRuns.slice(0, runLimit),
|
|
2320
|
+
slowestSteps: slowestSteps.slice(0, stepLimit)
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2323
|
+
function collectCompletedSteps(events, runId) {
|
|
2324
|
+
const started = /* @__PURE__ */ new Map();
|
|
2325
|
+
const out = [];
|
|
2326
|
+
for (const e of events) {
|
|
2327
|
+
if (e.event === "step_started") {
|
|
2328
|
+
const s = e;
|
|
2329
|
+
started.set(s.stepId, { name: s.name, type: s.type });
|
|
2330
|
+
}
|
|
2331
|
+
if (e.event === "step_completed") {
|
|
2332
|
+
const c = e;
|
|
2333
|
+
if (c.status !== "success" && c.status !== "error") continue;
|
|
2334
|
+
if (typeof c.durationMs !== "number" || !Number.isFinite(c.durationMs)) {
|
|
2335
|
+
continue;
|
|
2336
|
+
}
|
|
2337
|
+
const meta2 = started.get(c.stepId);
|
|
2338
|
+
out.push({
|
|
2339
|
+
runId,
|
|
2340
|
+
stepName: meta2?.name ?? c.stepId,
|
|
2341
|
+
stepType: meta2?.type ?? "logic",
|
|
2342
|
+
durationMs: c.durationMs
|
|
2343
|
+
});
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
return out;
|
|
2347
|
+
}
|
|
2348
|
+
function formatStepLabel(stepType, stepName) {
|
|
2349
|
+
return stepName.startsWith(`${stepType}:`) ? stepName : `${stepType}:${stepName}`;
|
|
2350
|
+
}
|
|
2351
|
+
function renderTraceStats(stats) {
|
|
2352
|
+
const lines = [];
|
|
2353
|
+
lines.push("Trace stats (local)");
|
|
2354
|
+
lines.push(`Directory: ${stats.traceDir}`);
|
|
2355
|
+
if (stats.since) lines.push(`Since: ${stats.since}`);
|
|
2356
|
+
if (stats.correlationId) lines.push(`Correlation ID: ${stats.correlationId}`);
|
|
2357
|
+
if (stats.groupId) lines.push(`Group ID: ${stats.groupId}`);
|
|
2358
|
+
lines.push("");
|
|
2359
|
+
lines.push(`Runs: ${stats.totalRuns}`);
|
|
2360
|
+
lines.push(
|
|
2361
|
+
` success: ${stats.successCount} error: ${stats.errorCount} running: ${stats.runningCount} unknown: ${stats.unknownCount}`
|
|
2362
|
+
);
|
|
2363
|
+
lines.push(`Error rate: ${(stats.errorRate * 100).toFixed(1)}%`);
|
|
2364
|
+
if (stats.duration.avgMs !== void 0) {
|
|
2365
|
+
lines.push(
|
|
2366
|
+
`Duration: min ${formatDuration2(stats.duration.minMs ?? 0)} | avg ${formatDuration2(stats.duration.avgMs)} | p50 ${formatDuration2(stats.duration.p50Ms ?? 0)} | p95 ${formatDuration2(stats.duration.p95Ms ?? 0)} | max ${formatDuration2(stats.duration.maxMs ?? 0)}`
|
|
2367
|
+
);
|
|
2368
|
+
}
|
|
2369
|
+
lines.push("");
|
|
2370
|
+
lines.push(`Steps: ${stats.totalSteps} (avg ${stats.avgStepsPerRun.toFixed(1)} per run)`);
|
|
2371
|
+
lines.push(
|
|
2372
|
+
` LLM: ${stats.totalLlmSteps} tool: ${stats.totalToolSteps} errors: ${stats.totalErrorSteps}`
|
|
2373
|
+
);
|
|
2374
|
+
if (stats.slowestRuns.length > 0) {
|
|
2375
|
+
lines.push("");
|
|
2376
|
+
lines.push("Slowest runs:");
|
|
2377
|
+
for (const r of stats.slowestRuns) {
|
|
2378
|
+
lines.push(
|
|
2379
|
+
` ${r.runId} | ${r.name ?? "-"} | ${formatDuration2(r.durationMs ?? 0)} | ${r.status}`
|
|
2380
|
+
);
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
if (stats.slowestSteps.length > 0) {
|
|
2384
|
+
lines.push("");
|
|
2385
|
+
lines.push("Slowest steps:");
|
|
2386
|
+
for (const s of stats.slowestSteps) {
|
|
2387
|
+
lines.push(
|
|
2388
|
+
` ${s.runId} | ${formatStepLabel(s.stepType, s.stepName)} | ${formatDuration2(s.durationMs)}`
|
|
2389
|
+
);
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
return lines.join("\n");
|
|
2393
|
+
}
|
|
2394
|
+
var init_stats = __esm({
|
|
2395
|
+
"packages/core/src/stats.ts"() {
|
|
2396
|
+
init_trace_metadata();
|
|
2397
|
+
init_trace_filter();
|
|
2398
|
+
init_storage();
|
|
2399
|
+
init_utils();
|
|
2400
|
+
}
|
|
2401
|
+
});
|
|
2402
|
+
|
|
2228
2403
|
// packages/core/src/timeline.ts
|
|
2229
2404
|
function finite(n) {
|
|
2230
2405
|
return typeof n === "number" && Number.isFinite(n);
|
|
@@ -2294,8 +2469,8 @@ function buildRunTimeline(events, options = {}) {
|
|
|
2294
2469
|
}
|
|
2295
2470
|
const depthCache = /* @__PURE__ */ new Map();
|
|
2296
2471
|
const computeDepth = (stepId) => {
|
|
2297
|
-
const
|
|
2298
|
-
if (
|
|
2472
|
+
const cached2 = depthCache.get(stepId);
|
|
2473
|
+
if (cached2 !== void 0) return cached2;
|
|
2299
2474
|
const node = steps.get(stepId);
|
|
2300
2475
|
if (!node) return 0;
|
|
2301
2476
|
const parent = node.parentId;
|
|
@@ -2382,7 +2557,7 @@ function renderTimeline(timeline, options = {}) {
|
|
|
2382
2557
|
const dur = e.durationMs !== void 0 ? formatDuration2(e.durationMs) : "-";
|
|
2383
2558
|
const err = e.isError ? " error" : "";
|
|
2384
2559
|
const off = formatDuration2(e.offsetMs);
|
|
2385
|
-
let line = `${prefix}+${off} ${typeTag
|
|
2560
|
+
let line = `${prefix}+${off} ${formatStepLabel(typeTag, e.name)} (${dur})${err}`;
|
|
2386
2561
|
if (e.streaming?.chunkCount !== void 0) {
|
|
2387
2562
|
line += ` chunks=${e.streaming.chunkCount}`;
|
|
2388
2563
|
}
|
|
@@ -2395,6 +2570,7 @@ function renderTimeline(timeline, options = {}) {
|
|
|
2395
2570
|
}
|
|
2396
2571
|
var init_timeline = __esm({
|
|
2397
2572
|
"packages/core/src/timeline.ts"() {
|
|
2573
|
+
init_stats();
|
|
2398
2574
|
init_utils();
|
|
2399
2575
|
}
|
|
2400
2576
|
});
|
|
@@ -2545,6 +2721,12 @@ var init_what = __esm({
|
|
|
2545
2721
|
});
|
|
2546
2722
|
|
|
2547
2723
|
// packages/core/src/explain.ts
|
|
2724
|
+
function toDisplayStatus(status) {
|
|
2725
|
+
if (status === "ok") return "success";
|
|
2726
|
+
if (status === "error") return "error";
|
|
2727
|
+
if (status === "running") return "running";
|
|
2728
|
+
return "unknown";
|
|
2729
|
+
}
|
|
2548
2730
|
function flatten(nodes, out = []) {
|
|
2549
2731
|
for (const node of nodes) {
|
|
2550
2732
|
out.push({ node, index: out.length + 1 });
|
|
@@ -2602,7 +2784,7 @@ function buildFacts(run, redactor) {
|
|
|
2602
2784
|
const facts = [
|
|
2603
2785
|
fact("run.id", "Run id", run.runId, redactor),
|
|
2604
2786
|
fact("run.name", "Run name", run.name ?? run.runId, redactor),
|
|
2605
|
-
fact("run.status", "Run status", run.status
|
|
2787
|
+
fact("run.status", "Run status", toDisplayStatus(run.status), redactor),
|
|
2606
2788
|
fact("run.totalEvents", "Total events", run.metadata.totalEvents, redactor),
|
|
2607
2789
|
fact("run.stepCount", "Top-level step count", run.children.length, redactor),
|
|
2608
2790
|
fact("run.nodeCount", "Total node count", nodes.length, redactor),
|
|
@@ -2678,7 +2860,7 @@ function buildLocalExplanation(run, options = {}) {
|
|
|
2678
2860
|
mode,
|
|
2679
2861
|
runId: String(redactValue(redactor, "runId", run.runId)),
|
|
2680
2862
|
...run.name !== void 0 ? { name: String(redactValue(redactor, "name", run.name)) } : {},
|
|
2681
|
-
...run.status !== void 0 ? { status: run.status } : {},
|
|
2863
|
+
...run.status !== void 0 ? { status: toDisplayStatus(run.status) } : {},
|
|
2682
2864
|
redactionProfile,
|
|
2683
2865
|
facts,
|
|
2684
2866
|
inferences: mode === "dry-run" ? [] : buildInferences(run, facts),
|
|
@@ -2689,210 +2871,9 @@ function buildLocalExplanation(run, options = {}) {
|
|
|
2689
2871
|
};
|
|
2690
2872
|
}
|
|
2691
2873
|
var init_explain = __esm({
|
|
2692
|
-
"packages/core/src/explain.ts"() {
|
|
2693
|
-
init_redactor();
|
|
2694
|
-
init_redaction_profiles();
|
|
2695
|
-
}
|
|
2696
|
-
});
|
|
2697
|
-
|
|
2698
|
-
// packages/core/src/stats.ts
|
|
2699
|
-
function percentile(sorted, p) {
|
|
2700
|
-
if (sorted.length === 0) return void 0;
|
|
2701
|
-
const idx = Math.min(
|
|
2702
|
-
sorted.length - 1,
|
|
2703
|
-
Math.max(0, Math.ceil(p / 100 * sorted.length) - 1)
|
|
2704
|
-
);
|
|
2705
|
-
return sorted[idx];
|
|
2706
|
-
}
|
|
2707
|
-
async function readRunStartedMetadata(filePath) {
|
|
2708
|
-
try {
|
|
2709
|
-
const events = await readTraceEventsFromFile(filePath);
|
|
2710
|
-
for (const event of events) {
|
|
2711
|
-
if (event.event !== "run_started") continue;
|
|
2712
|
-
const rs = event;
|
|
2713
|
-
if (rs.metadata && typeof rs.metadata === "object") {
|
|
2714
|
-
return rs.metadata;
|
|
2715
|
-
}
|
|
2716
|
-
return void 0;
|
|
2717
|
-
}
|
|
2718
|
-
} catch {
|
|
2719
|
-
}
|
|
2720
|
-
return void 0;
|
|
2721
|
-
}
|
|
2722
|
-
function metaMatchesCorrelation(metadata, correlationId, groupId) {
|
|
2723
|
-
if (correlationId) {
|
|
2724
|
-
const v = metadata?.correlationId;
|
|
2725
|
-
if (typeof v !== "string" || v !== correlationId) return false;
|
|
2726
|
-
}
|
|
2727
|
-
if (groupId) {
|
|
2728
|
-
const v = metadata?.groupId;
|
|
2729
|
-
if (typeof v !== "string" || v !== groupId) return false;
|
|
2730
|
-
}
|
|
2731
|
-
return true;
|
|
2732
|
-
}
|
|
2733
|
-
async function buildTraceStats(metas, options) {
|
|
2734
|
-
let filtered = filterTraces(metas, { since: options.since });
|
|
2735
|
-
if (options.correlationId || options.groupId) {
|
|
2736
|
-
const next = [];
|
|
2737
|
-
for (const m of filtered) {
|
|
2738
|
-
const md = await readRunStartedMetadata(m.filePath);
|
|
2739
|
-
if (metaMatchesCorrelation(md, options.correlationId, options.groupId)) {
|
|
2740
|
-
next.push(m);
|
|
2741
|
-
}
|
|
2742
|
-
}
|
|
2743
|
-
filtered = next;
|
|
2744
|
-
}
|
|
2745
|
-
let successCount = 0;
|
|
2746
|
-
let errorCount = 0;
|
|
2747
|
-
let runningCount = 0;
|
|
2748
|
-
let unknownCount = 0;
|
|
2749
|
-
const durations = [];
|
|
2750
|
-
let totalSteps = 0;
|
|
2751
|
-
let totalLlmSteps = 0;
|
|
2752
|
-
let totalToolSteps = 0;
|
|
2753
|
-
let totalErrorSteps = 0;
|
|
2754
|
-
const slowestRuns = [];
|
|
2755
|
-
const slowestSteps = [];
|
|
2756
|
-
for (const m of filtered) {
|
|
2757
|
-
if (m.status === "success") successCount += 1;
|
|
2758
|
-
else if (m.status === "error") errorCount += 1;
|
|
2759
|
-
else if (m.status === "running") runningCount += 1;
|
|
2760
|
-
else unknownCount += 1;
|
|
2761
|
-
if (typeof m.durationMs === "number" && Number.isFinite(m.durationMs) && m.durationMs >= 0) {
|
|
2762
|
-
durations.push(m.durationMs);
|
|
2763
|
-
slowestRuns.push({
|
|
2764
|
-
runId: m.runId,
|
|
2765
|
-
name: m.name,
|
|
2766
|
-
durationMs: m.durationMs,
|
|
2767
|
-
status: m.status
|
|
2768
|
-
});
|
|
2769
|
-
}
|
|
2770
|
-
try {
|
|
2771
|
-
const events = await readTraceEventsFromFile(m.filePath);
|
|
2772
|
-
if (events.length === 0) continue;
|
|
2773
|
-
const summary = buildRunSummary(events);
|
|
2774
|
-
totalSteps += summary.totalSteps;
|
|
2775
|
-
totalLlmSteps += summary.llmSteps;
|
|
2776
|
-
totalToolSteps += summary.toolSteps;
|
|
2777
|
-
totalErrorSteps += summary.errorSteps;
|
|
2778
|
-
const steps = collectCompletedSteps(events, m.runId);
|
|
2779
|
-
for (const s of steps) {
|
|
2780
|
-
slowestSteps.push(s);
|
|
2781
|
-
}
|
|
2782
|
-
} catch {
|
|
2783
|
-
}
|
|
2784
|
-
}
|
|
2785
|
-
slowestRuns.sort((a, b) => (b.durationMs ?? 0) - (a.durationMs ?? 0));
|
|
2786
|
-
slowestSteps.sort((a, b) => b.durationMs - a.durationMs);
|
|
2787
|
-
const runLimit = options.slowRunLimit ?? 5;
|
|
2788
|
-
const stepLimit = options.slowStepLimit ?? 5;
|
|
2789
|
-
const sortedDur = [...durations].sort((a, b) => a - b);
|
|
2790
|
-
const totalRuns = filtered.length;
|
|
2791
|
-
const errorRate = totalRuns > 0 ? errorCount / totalRuns : 0;
|
|
2792
|
-
const sumDur = durations.reduce((a, b) => a + b, 0);
|
|
2793
|
-
return {
|
|
2794
|
-
traceDir: options.traceDir,
|
|
2795
|
-
...options.since ? { since: options.since } : {},
|
|
2796
|
-
...options.correlationId ? { correlationId: options.correlationId } : {},
|
|
2797
|
-
...options.groupId ? { groupId: options.groupId } : {},
|
|
2798
|
-
totalRuns,
|
|
2799
|
-
successCount,
|
|
2800
|
-
errorCount,
|
|
2801
|
-
runningCount,
|
|
2802
|
-
unknownCount,
|
|
2803
|
-
errorRate,
|
|
2804
|
-
duration: {
|
|
2805
|
-
...sortedDur.length > 0 ? {
|
|
2806
|
-
minMs: sortedDur[0],
|
|
2807
|
-
maxMs: sortedDur[sortedDur.length - 1],
|
|
2808
|
-
avgMs: sumDur / sortedDur.length,
|
|
2809
|
-
p50Ms: percentile(sortedDur, 50),
|
|
2810
|
-
p95Ms: percentile(sortedDur, 95)
|
|
2811
|
-
} : {}
|
|
2812
|
-
},
|
|
2813
|
-
totalSteps,
|
|
2814
|
-
avgStepsPerRun: totalRuns > 0 ? totalSteps / totalRuns : 0,
|
|
2815
|
-
totalLlmSteps,
|
|
2816
|
-
totalToolSteps,
|
|
2817
|
-
totalErrorSteps,
|
|
2818
|
-
slowestRuns: slowestRuns.slice(0, runLimit),
|
|
2819
|
-
slowestSteps: slowestSteps.slice(0, stepLimit)
|
|
2820
|
-
};
|
|
2821
|
-
}
|
|
2822
|
-
function collectCompletedSteps(events, runId) {
|
|
2823
|
-
const started = /* @__PURE__ */ new Map();
|
|
2824
|
-
const out = [];
|
|
2825
|
-
for (const e of events) {
|
|
2826
|
-
if (e.event === "step_started") {
|
|
2827
|
-
const s = e;
|
|
2828
|
-
started.set(s.stepId, { name: s.name, type: s.type });
|
|
2829
|
-
}
|
|
2830
|
-
if (e.event === "step_completed") {
|
|
2831
|
-
const c = e;
|
|
2832
|
-
if (c.status !== "success" && c.status !== "error") continue;
|
|
2833
|
-
if (typeof c.durationMs !== "number" || !Number.isFinite(c.durationMs)) {
|
|
2834
|
-
continue;
|
|
2835
|
-
}
|
|
2836
|
-
const meta2 = started.get(c.stepId);
|
|
2837
|
-
out.push({
|
|
2838
|
-
runId,
|
|
2839
|
-
stepName: meta2?.name ?? c.stepId,
|
|
2840
|
-
stepType: meta2?.type ?? "logic",
|
|
2841
|
-
durationMs: c.durationMs
|
|
2842
|
-
});
|
|
2843
|
-
}
|
|
2844
|
-
}
|
|
2845
|
-
return out;
|
|
2846
|
-
}
|
|
2847
|
-
function renderTraceStats(stats) {
|
|
2848
|
-
const lines = [];
|
|
2849
|
-
lines.push("Trace stats (local)");
|
|
2850
|
-
lines.push(`Directory: ${stats.traceDir}`);
|
|
2851
|
-
if (stats.since) lines.push(`Since: ${stats.since}`);
|
|
2852
|
-
if (stats.correlationId) lines.push(`Correlation ID: ${stats.correlationId}`);
|
|
2853
|
-
if (stats.groupId) lines.push(`Group ID: ${stats.groupId}`);
|
|
2854
|
-
lines.push("");
|
|
2855
|
-
lines.push(`Runs: ${stats.totalRuns}`);
|
|
2856
|
-
lines.push(
|
|
2857
|
-
` success: ${stats.successCount} error: ${stats.errorCount} running: ${stats.runningCount} unknown: ${stats.unknownCount}`
|
|
2858
|
-
);
|
|
2859
|
-
lines.push(`Error rate: ${(stats.errorRate * 100).toFixed(1)}%`);
|
|
2860
|
-
if (stats.duration.avgMs !== void 0) {
|
|
2861
|
-
lines.push(
|
|
2862
|
-
`Duration: min ${formatDuration2(stats.duration.minMs ?? 0)} | avg ${formatDuration2(stats.duration.avgMs)} | p50 ${formatDuration2(stats.duration.p50Ms ?? 0)} | p95 ${formatDuration2(stats.duration.p95Ms ?? 0)} | max ${formatDuration2(stats.duration.maxMs ?? 0)}`
|
|
2863
|
-
);
|
|
2864
|
-
}
|
|
2865
|
-
lines.push("");
|
|
2866
|
-
lines.push(`Steps: ${stats.totalSteps} (avg ${stats.avgStepsPerRun.toFixed(1)} per run)`);
|
|
2867
|
-
lines.push(
|
|
2868
|
-
` LLM: ${stats.totalLlmSteps} tool: ${stats.totalToolSteps} errors: ${stats.totalErrorSteps}`
|
|
2869
|
-
);
|
|
2870
|
-
if (stats.slowestRuns.length > 0) {
|
|
2871
|
-
lines.push("");
|
|
2872
|
-
lines.push("Slowest runs:");
|
|
2873
|
-
for (const r of stats.slowestRuns) {
|
|
2874
|
-
lines.push(
|
|
2875
|
-
` ${r.runId} | ${r.name ?? "-"} | ${formatDuration2(r.durationMs ?? 0)} | ${r.status}`
|
|
2876
|
-
);
|
|
2877
|
-
}
|
|
2878
|
-
}
|
|
2879
|
-
if (stats.slowestSteps.length > 0) {
|
|
2880
|
-
lines.push("");
|
|
2881
|
-
lines.push("Slowest steps:");
|
|
2882
|
-
for (const s of stats.slowestSteps) {
|
|
2883
|
-
lines.push(
|
|
2884
|
-
` ${s.runId} | ${s.stepType}:${s.stepName} | ${formatDuration2(s.durationMs)}`
|
|
2885
|
-
);
|
|
2886
|
-
}
|
|
2887
|
-
}
|
|
2888
|
-
return lines.join("\n");
|
|
2889
|
-
}
|
|
2890
|
-
var init_stats = __esm({
|
|
2891
|
-
"packages/core/src/stats.ts"() {
|
|
2892
|
-
init_trace_metadata();
|
|
2893
|
-
init_trace_filter();
|
|
2894
|
-
init_storage();
|
|
2895
|
-
init_utils();
|
|
2874
|
+
"packages/core/src/explain.ts"() {
|
|
2875
|
+
init_redactor();
|
|
2876
|
+
init_redaction_profiles();
|
|
2896
2877
|
}
|
|
2897
2878
|
});
|
|
2898
2879
|
|
|
@@ -2962,6 +2943,12 @@ async function searchTraces(metas, options) {
|
|
|
2962
2943
|
...sessionLabel ? { sessionId: sessionLabel } : {}
|
|
2963
2944
|
});
|
|
2964
2945
|
}
|
|
2946
|
+
results.sort((a, b) => {
|
|
2947
|
+
const ta = a.timestamp ?? 0;
|
|
2948
|
+
const tb = b.timestamp ?? 0;
|
|
2949
|
+
if (ta !== tb) return tb - ta;
|
|
2950
|
+
return a.runId.localeCompare(b.runId);
|
|
2951
|
+
});
|
|
2965
2952
|
return results.slice(0, limit);
|
|
2966
2953
|
}
|
|
2967
2954
|
for (const m of filtered) {
|
|
@@ -3009,7 +2996,7 @@ async function searchTraces(metas, options) {
|
|
|
3009
2996
|
results.sort((a, b) => {
|
|
3010
2997
|
const ta = a.timestamp ?? 0;
|
|
3011
2998
|
const tb = b.timestamp ?? 0;
|
|
3012
|
-
if (ta !== tb) return
|
|
2999
|
+
if (ta !== tb) return tb - ta;
|
|
3013
3000
|
const runCmp = a.runId.localeCompare(b.runId);
|
|
3014
3001
|
if (runCmp !== 0) return runCmp;
|
|
3015
3002
|
return (a.stepName ?? "").localeCompare(b.stepName ?? "");
|
|
@@ -5942,17 +5929,17 @@ function normalizeTokenUsage(value) {
|
|
|
5942
5929
|
const input3 = nonNegativeFinite(value.input);
|
|
5943
5930
|
const output2 = nonNegativeFinite(value.output);
|
|
5944
5931
|
const suppliedTotal = nonNegativeFinite(value.total);
|
|
5945
|
-
const
|
|
5932
|
+
const cached2 = nonNegativeFinite(value.cached);
|
|
5946
5933
|
const derivedTotal = input3 !== void 0 && output2 !== void 0 && Number.isFinite(input3 + output2) ? input3 + output2 : void 0;
|
|
5947
5934
|
const total = suppliedTotal ?? derivedTotal;
|
|
5948
|
-
if (input3 === void 0 && output2 === void 0 && total === void 0 &&
|
|
5935
|
+
if (input3 === void 0 && output2 === void 0 && total === void 0 && cached2 === void 0) {
|
|
5949
5936
|
return void 0;
|
|
5950
5937
|
}
|
|
5951
5938
|
return {
|
|
5952
5939
|
...input3 !== void 0 ? { input: input3 } : {},
|
|
5953
5940
|
...output2 !== void 0 ? { output: output2 } : {},
|
|
5954
5941
|
...total !== void 0 ? { total } : {},
|
|
5955
|
-
...
|
|
5942
|
+
...cached2 !== void 0 ? { cached: cached2 } : {}
|
|
5956
5943
|
};
|
|
5957
5944
|
}
|
|
5958
5945
|
var init_token_usage = __esm({
|
|
@@ -6213,13 +6200,24 @@ function inc(map, key) {
|
|
|
6213
6200
|
map[key] = (map[key] ?? 0) + 1;
|
|
6214
6201
|
}
|
|
6215
6202
|
function computeRunStatus(events) {
|
|
6203
|
+
let runTerminal;
|
|
6204
|
+
let sawRunEvent = false;
|
|
6205
|
+
for (const e of events) {
|
|
6206
|
+
if (e.kind !== "RUN") continue;
|
|
6207
|
+
sawRunEvent = true;
|
|
6208
|
+
if (e.status === "ok" || e.status === "error") {
|
|
6209
|
+
runTerminal = e.status;
|
|
6210
|
+
}
|
|
6211
|
+
}
|
|
6212
|
+
if (sawRunEvent) {
|
|
6213
|
+
return runTerminal ?? "running";
|
|
6214
|
+
}
|
|
6216
6215
|
let hasRunning = false;
|
|
6217
6216
|
for (const e of events) {
|
|
6218
6217
|
if (e.status === "error") return "error";
|
|
6219
6218
|
if (e.status === "running") hasRunning = true;
|
|
6220
6219
|
}
|
|
6221
|
-
|
|
6222
|
-
return "ok";
|
|
6220
|
+
return hasRunning ? "running" : "ok";
|
|
6223
6221
|
}
|
|
6224
6222
|
var TreeBuilder;
|
|
6225
6223
|
var init_tree_builder = __esm({
|
|
@@ -6502,8 +6500,8 @@ async function jsonlFilesInDirectory(dirPath) {
|
|
|
6502
6500
|
return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map((entry) => path26__default.default.join(dirPath, entry.name)).sort((a, b) => a.localeCompare(b));
|
|
6503
6501
|
}
|
|
6504
6502
|
async function resolveInput(input3) {
|
|
6505
|
-
const
|
|
6506
|
-
if (
|
|
6503
|
+
const cached2 = resolvedInputCache.get(input3);
|
|
6504
|
+
if (cached2) return cached2;
|
|
6507
6505
|
const promise = resolveInputUncached(input3);
|
|
6508
6506
|
resolvedInputCache.set(input3, promise);
|
|
6509
6507
|
return promise;
|
|
@@ -6939,7 +6937,7 @@ function readOpenInferenceTokenUsage(attributes) {
|
|
|
6939
6937
|
const prompt = attributes["llm.token_count.prompt"];
|
|
6940
6938
|
const completion = attributes["llm.token_count.completion"];
|
|
6941
6939
|
const total = attributes["llm.token_count.total"];
|
|
6942
|
-
const
|
|
6940
|
+
const cached2 = attributes["llm.token_count.prompt_details.cache_read"];
|
|
6943
6941
|
const usage = {};
|
|
6944
6942
|
if (typeof prompt === "number" && Number.isFinite(prompt) && prompt >= 0) {
|
|
6945
6943
|
usage.input = prompt;
|
|
@@ -6950,8 +6948,8 @@ function readOpenInferenceTokenUsage(attributes) {
|
|
|
6950
6948
|
if (typeof total === "number" && Number.isFinite(total) && total >= 0) {
|
|
6951
6949
|
usage.total = total;
|
|
6952
6950
|
}
|
|
6953
|
-
if (typeof
|
|
6954
|
-
usage.cached =
|
|
6951
|
+
if (typeof cached2 === "number" && Number.isFinite(cached2) && cached2 >= 0) {
|
|
6952
|
+
usage.cached = cached2;
|
|
6955
6953
|
}
|
|
6956
6954
|
if (usage.total === void 0 && usage.input !== void 0 && usage.output !== void 0) {
|
|
6957
6955
|
usage.total = usage.input + usage.output;
|
|
@@ -9482,899 +9480,141 @@ function renderGateGithubStepSummary(result) {
|
|
|
9482
9480
|
`| ${check.name} | ${check.ok ? "pass" : "fail"} | ${check.message.replace(/\|/g, "/")} |`
|
|
9483
9481
|
);
|
|
9484
9482
|
}
|
|
9485
|
-
if (result.diagnostics.length > 0) {
|
|
9486
|
-
lines.push("");
|
|
9487
|
-
lines.push("**Diagnostics**");
|
|
9488
|
-
for (const item of result.diagnostics) lines.push(`- ${item}`);
|
|
9489
|
-
}
|
|
9490
|
-
return lines.join("\n").trimEnd();
|
|
9491
|
-
}
|
|
9492
|
-
function renderGateReportHtml(result) {
|
|
9493
|
-
const rows = result.checks.map(
|
|
9494
|
-
(check) => `<tr><td>${escapeHtml(check.name)}</td><td>${check.ok ? "PASS" : "FAIL"}</td><td>${escapeHtml(check.message)}</td></tr>`
|
|
9495
|
-
).join("");
|
|
9496
|
-
return `<!DOCTYPE html>
|
|
9497
|
-
<html lang="en">
|
|
9498
|
-
<head>
|
|
9499
|
-
<meta charset="utf-8" />
|
|
9500
|
-
<title>Gate report</title>
|
|
9501
|
-
<style>
|
|
9502
|
-
body { font-family: system-ui, sans-serif; margin: 2rem; }
|
|
9503
|
-
table { border-collapse: collapse; width: 100%; }
|
|
9504
|
-
th, td { border: 1px solid #ddd; padding: 0.5rem; text-align: left; }
|
|
9505
|
-
th { background: #f6f6f6; }
|
|
9506
|
-
</style>
|
|
9507
|
-
</head>
|
|
9508
|
-
<body>
|
|
9509
|
-
<h1>AgentInspect gate</h1>
|
|
9510
|
-
<p>Status: <strong>${result.ok ? "PASS" : "FAIL"}</strong> (exit ${result.exitCode})</p>
|
|
9511
|
-
<h2>Checks</h2>
|
|
9512
|
-
<table>
|
|
9513
|
-
<thead><tr><th>Check</th><th>Status</th><th>Details</th></tr></thead>
|
|
9514
|
-
<tbody>${rows}</tbody>
|
|
9515
|
-
</table>
|
|
9516
|
-
</body>
|
|
9517
|
-
</html>`;
|
|
9518
|
-
}
|
|
9519
|
-
function renderGateJUnit(result) {
|
|
9520
|
-
const failures = result.checks.filter((check) => !check.ok).length;
|
|
9521
|
-
const tests = result.checks.length;
|
|
9522
|
-
const cases = result.checks.map((check) => {
|
|
9523
|
-
if (check.ok) {
|
|
9524
|
-
return ` <testcase name="${escapeXml(check.name)}" classname="gate" />`;
|
|
9525
|
-
}
|
|
9526
|
-
return ` <testcase name="${escapeXml(check.name)}" classname="gate">
|
|
9527
|
-
<failure message="${escapeXml(check.message)}">${escapeXml(check.message)}</failure>
|
|
9528
|
-
</testcase>`;
|
|
9529
|
-
}).join("\n");
|
|
9530
|
-
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
9531
|
-
<testsuites tests="${tests}" failures="${failures}" errors="0" time="0">
|
|
9532
|
-
<testsuite name="agent-inspect-gate" tests="${tests}" failures="${failures}" errors="0" time="0">
|
|
9533
|
-
${cases}
|
|
9534
|
-
</testsuite>
|
|
9535
|
-
</testsuites>`;
|
|
9536
|
-
}
|
|
9537
|
-
function renderGateReport(result, options = {}) {
|
|
9538
|
-
const format = options.format ?? "markdown";
|
|
9539
|
-
if (format === "json") return JSON.stringify(result, null, 2);
|
|
9540
|
-
if (format === "html") return renderGateReportHtml(result);
|
|
9541
|
-
if (format === "junit") return renderGateJUnit(result);
|
|
9542
|
-
if (format === "github") return renderGateGithubStepSummary(result);
|
|
9543
|
-
return renderGateSummaryMarkdown(result);
|
|
9544
|
-
}
|
|
9545
|
-
var init_render3 = __esm({
|
|
9546
|
-
"packages/core/src/gate/render.ts"() {
|
|
9547
|
-
init_helpers();
|
|
9548
|
-
}
|
|
9549
|
-
});
|
|
9550
|
-
|
|
9551
|
-
// packages/core/src/gate/index.ts
|
|
9552
|
-
var init_gate = __esm({
|
|
9553
|
-
"packages/core/src/gate/index.ts"() {
|
|
9554
|
-
init_parse();
|
|
9555
|
-
init_evaluate();
|
|
9556
|
-
init_run2();
|
|
9557
|
-
init_render3();
|
|
9558
|
-
}
|
|
9559
|
-
});
|
|
9560
|
-
|
|
9561
|
-
// packages/core/src/inspect-run.ts
|
|
9562
|
-
var init_inspect_run = __esm({
|
|
9563
|
-
"packages/core/src/inspect-run.ts"() {
|
|
9564
|
-
init_correlation_metadata();
|
|
9565
|
-
init_context();
|
|
9566
|
-
init_storage();
|
|
9567
|
-
init_terminal();
|
|
9568
|
-
init_trace_directory();
|
|
9569
|
-
init_trace_event_safety();
|
|
9570
|
-
init_utils();
|
|
9571
|
-
}
|
|
9572
|
-
});
|
|
9573
|
-
|
|
9574
|
-
// packages/core/src/maybe-inspect-run.ts
|
|
9575
|
-
var init_maybe_inspect_run = __esm({
|
|
9576
|
-
"packages/core/src/maybe-inspect-run.ts"() {
|
|
9577
|
-
init_inspect_run();
|
|
9578
|
-
}
|
|
9579
|
-
});
|
|
9580
|
-
|
|
9581
|
-
// packages/core/src/entries/advanced.ts
|
|
9582
|
-
var init_advanced = __esm({
|
|
9583
|
-
"packages/core/src/entries/advanced.ts"() {
|
|
9584
|
-
init_context();
|
|
9585
|
-
init_inspector();
|
|
9586
|
-
init_inspector_runtime();
|
|
9587
|
-
init_trace_event_safety();
|
|
9588
|
-
init_terminal();
|
|
9589
|
-
init_utils();
|
|
9590
|
-
init_types();
|
|
9591
|
-
init_storage();
|
|
9592
|
-
init_read_trace();
|
|
9593
|
-
init_trace_directory();
|
|
9594
|
-
init_trace_metadata();
|
|
9595
|
-
init_trace_filter();
|
|
9596
|
-
init_timeline();
|
|
9597
|
-
init_what();
|
|
9598
|
-
init_explain();
|
|
9599
|
-
init_stats();
|
|
9600
|
-
init_search();
|
|
9601
|
-
init_sessions();
|
|
9602
|
-
init_trace_verification();
|
|
9603
|
-
init_duration();
|
|
9604
|
-
init_bundle();
|
|
9605
|
-
init_suite();
|
|
9606
|
-
init_templates();
|
|
9607
|
-
init_extract();
|
|
9608
|
-
init_cohort2();
|
|
9609
|
-
init_gate();
|
|
9610
|
-
init_maybe_inspect_run();
|
|
9611
|
-
}
|
|
9612
|
-
});
|
|
9613
|
-
|
|
9614
|
-
// packages/index-sqlite/src/types.ts
|
|
9615
|
-
var INDEX_SCHEMA_VERSION, INDEX_DB_FILENAME;
|
|
9616
|
-
var init_types6 = __esm({
|
|
9617
|
-
"packages/index-sqlite/src/types.ts"() {
|
|
9618
|
-
INDEX_SCHEMA_VERSION = "1";
|
|
9619
|
-
INDEX_DB_FILENAME = "trace-index.sqlite";
|
|
9620
|
-
}
|
|
9621
|
-
});
|
|
9622
|
-
|
|
9623
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/util.js
|
|
9624
|
-
var require_util = __commonJS({
|
|
9625
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/util.js"(exports$1) {
|
|
9626
|
-
exports$1.getBooleanOption = (options, key) => {
|
|
9627
|
-
let value = false;
|
|
9628
|
-
if (key in options && typeof (value = options[key]) !== "boolean") {
|
|
9629
|
-
throw new TypeError(`Expected the "${key}" option to be a boolean`);
|
|
9630
|
-
}
|
|
9631
|
-
return value;
|
|
9632
|
-
};
|
|
9633
|
-
exports$1.cppdb = /* @__PURE__ */ Symbol();
|
|
9634
|
-
exports$1.inspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
9635
|
-
}
|
|
9636
|
-
});
|
|
9637
|
-
|
|
9638
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/sqlite-error.js
|
|
9639
|
-
var require_sqlite_error = __commonJS({
|
|
9640
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/sqlite-error.js"(exports$1, module) {
|
|
9641
|
-
var descriptor = { value: "SqliteError", writable: true, enumerable: false, configurable: true };
|
|
9642
|
-
function SqliteError(message, code) {
|
|
9643
|
-
if (new.target !== SqliteError) {
|
|
9644
|
-
return new SqliteError(message, code);
|
|
9645
|
-
}
|
|
9646
|
-
if (typeof code !== "string") {
|
|
9647
|
-
throw new TypeError("Expected second argument to be a string");
|
|
9648
|
-
}
|
|
9649
|
-
Error.call(this, message);
|
|
9650
|
-
descriptor.value = "" + message;
|
|
9651
|
-
Object.defineProperty(this, "message", descriptor);
|
|
9652
|
-
Error.captureStackTrace(this, SqliteError);
|
|
9653
|
-
this.code = code;
|
|
9654
|
-
}
|
|
9655
|
-
Object.setPrototypeOf(SqliteError, Error);
|
|
9656
|
-
Object.setPrototypeOf(SqliteError.prototype, Error.prototype);
|
|
9657
|
-
Object.defineProperty(SqliteError.prototype, "name", descriptor);
|
|
9658
|
-
module.exports = SqliteError;
|
|
9659
|
-
}
|
|
9660
|
-
});
|
|
9661
|
-
|
|
9662
|
-
// node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/index.js
|
|
9663
|
-
var require_file_uri_to_path = __commonJS({
|
|
9664
|
-
"node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/index.js"(exports$1, module) {
|
|
9665
|
-
var sep = __require("path").sep || "/";
|
|
9666
|
-
module.exports = fileUriToPath;
|
|
9667
|
-
function fileUriToPath(uri) {
|
|
9668
|
-
if ("string" != typeof uri || uri.length <= 7 || "file://" != uri.substring(0, 7)) {
|
|
9669
|
-
throw new TypeError("must pass in a file:// URI to convert to a file path");
|
|
9670
|
-
}
|
|
9671
|
-
var rest = decodeURI(uri.substring(7));
|
|
9672
|
-
var firstSlash = rest.indexOf("/");
|
|
9673
|
-
var host = rest.substring(0, firstSlash);
|
|
9674
|
-
var path37 = rest.substring(firstSlash + 1);
|
|
9675
|
-
if ("localhost" == host) host = "";
|
|
9676
|
-
if (host) {
|
|
9677
|
-
host = sep + sep + host;
|
|
9678
|
-
}
|
|
9679
|
-
path37 = path37.replace(/^(.+)\|/, "$1:");
|
|
9680
|
-
if (sep == "\\") {
|
|
9681
|
-
path37 = path37.replace(/\//g, "\\");
|
|
9682
|
-
}
|
|
9683
|
-
if (/^.+\:/.test(path37)) ; else {
|
|
9684
|
-
path37 = sep + path37;
|
|
9685
|
-
}
|
|
9686
|
-
return host + path37;
|
|
9687
|
-
}
|
|
9688
|
-
}
|
|
9689
|
-
});
|
|
9690
|
-
|
|
9691
|
-
// node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js
|
|
9692
|
-
var require_bindings = __commonJS({
|
|
9693
|
-
"node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js"(exports$1, module) {
|
|
9694
|
-
var fs = __require("fs");
|
|
9695
|
-
var path37 = __require("path");
|
|
9696
|
-
var fileURLToPath3 = require_file_uri_to_path();
|
|
9697
|
-
var join = path37.join;
|
|
9698
|
-
var dirname = path37.dirname;
|
|
9699
|
-
var exists2 = fs.accessSync && function(path38) {
|
|
9700
|
-
try {
|
|
9701
|
-
fs.accessSync(path38);
|
|
9702
|
-
} catch (e) {
|
|
9703
|
-
return false;
|
|
9704
|
-
}
|
|
9705
|
-
return true;
|
|
9706
|
-
} || fs.existsSync || path37.existsSync;
|
|
9707
|
-
var defaults = {
|
|
9708
|
-
arrow: process.env.NODE_BINDINGS_ARROW || " \u2192 ",
|
|
9709
|
-
compiled: process.env.NODE_BINDINGS_COMPILED_DIR || "compiled",
|
|
9710
|
-
platform: process.platform,
|
|
9711
|
-
arch: process.arch,
|
|
9712
|
-
nodePreGyp: "node-v" + process.versions.modules + "-" + process.platform + "-" + process.arch,
|
|
9713
|
-
version: process.versions.node,
|
|
9714
|
-
bindings: "bindings.node",
|
|
9715
|
-
try: [
|
|
9716
|
-
// node-gyp's linked version in the "build" dir
|
|
9717
|
-
["module_root", "build", "bindings"],
|
|
9718
|
-
// node-waf and gyp_addon (a.k.a node-gyp)
|
|
9719
|
-
["module_root", "build", "Debug", "bindings"],
|
|
9720
|
-
["module_root", "build", "Release", "bindings"],
|
|
9721
|
-
// Debug files, for development (legacy behavior, remove for node v0.9)
|
|
9722
|
-
["module_root", "out", "Debug", "bindings"],
|
|
9723
|
-
["module_root", "Debug", "bindings"],
|
|
9724
|
-
// Release files, but manually compiled (legacy behavior, remove for node v0.9)
|
|
9725
|
-
["module_root", "out", "Release", "bindings"],
|
|
9726
|
-
["module_root", "Release", "bindings"],
|
|
9727
|
-
// Legacy from node-waf, node <= 0.4.x
|
|
9728
|
-
["module_root", "build", "default", "bindings"],
|
|
9729
|
-
// Production "Release" buildtype binary (meh...)
|
|
9730
|
-
["module_root", "compiled", "version", "platform", "arch", "bindings"],
|
|
9731
|
-
// node-qbs builds
|
|
9732
|
-
["module_root", "addon-build", "release", "install-root", "bindings"],
|
|
9733
|
-
["module_root", "addon-build", "debug", "install-root", "bindings"],
|
|
9734
|
-
["module_root", "addon-build", "default", "install-root", "bindings"],
|
|
9735
|
-
// node-pre-gyp path ./lib/binding/{node_abi}-{platform}-{arch}
|
|
9736
|
-
["module_root", "lib", "binding", "nodePreGyp", "bindings"]
|
|
9737
|
-
]
|
|
9738
|
-
};
|
|
9739
|
-
function bindings(opts) {
|
|
9740
|
-
if (typeof opts == "string") {
|
|
9741
|
-
opts = { bindings: opts };
|
|
9742
|
-
} else if (!opts) {
|
|
9743
|
-
opts = {};
|
|
9744
|
-
}
|
|
9745
|
-
Object.keys(defaults).map(function(i2) {
|
|
9746
|
-
if (!(i2 in opts)) opts[i2] = defaults[i2];
|
|
9747
|
-
});
|
|
9748
|
-
if (!opts.module_root) {
|
|
9749
|
-
opts.module_root = exports$1.getRoot(exports$1.getFileName());
|
|
9750
|
-
}
|
|
9751
|
-
if (path37.extname(opts.bindings) != ".node") {
|
|
9752
|
-
opts.bindings += ".node";
|
|
9753
|
-
}
|
|
9754
|
-
var requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
9755
|
-
var tries = [], i = 0, l = opts.try.length, n, b, err;
|
|
9756
|
-
for (; i < l; i++) {
|
|
9757
|
-
n = join.apply(
|
|
9758
|
-
null,
|
|
9759
|
-
opts.try[i].map(function(p) {
|
|
9760
|
-
return opts[p] || p;
|
|
9761
|
-
})
|
|
9762
|
-
);
|
|
9763
|
-
tries.push(n);
|
|
9764
|
-
try {
|
|
9765
|
-
b = opts.path ? requireFunc.resolve(n) : requireFunc(n);
|
|
9766
|
-
if (!opts.path) {
|
|
9767
|
-
b.path = n;
|
|
9768
|
-
}
|
|
9769
|
-
return b;
|
|
9770
|
-
} catch (e) {
|
|
9771
|
-
if (e.code !== "MODULE_NOT_FOUND" && e.code !== "QUALIFIED_PATH_RESOLUTION_FAILED" && !/not find/i.test(e.message)) {
|
|
9772
|
-
throw e;
|
|
9773
|
-
}
|
|
9774
|
-
}
|
|
9775
|
-
}
|
|
9776
|
-
err = new Error(
|
|
9777
|
-
"Could not locate the bindings file. Tried:\n" + tries.map(function(a) {
|
|
9778
|
-
return opts.arrow + a;
|
|
9779
|
-
}).join("\n")
|
|
9780
|
-
);
|
|
9781
|
-
err.tries = tries;
|
|
9782
|
-
throw err;
|
|
9783
|
-
}
|
|
9784
|
-
module.exports = exports$1 = bindings;
|
|
9785
|
-
exports$1.getFileName = function getFileName(calling_file) {
|
|
9786
|
-
var origPST = Error.prepareStackTrace, origSTL = Error.stackTraceLimit, dummy = {}, fileName;
|
|
9787
|
-
Error.stackTraceLimit = 10;
|
|
9788
|
-
Error.prepareStackTrace = function(e, st) {
|
|
9789
|
-
for (var i = 0, l = st.length; i < l; i++) {
|
|
9790
|
-
fileName = st[i].getFileName();
|
|
9791
|
-
if (fileName !== __filename) {
|
|
9792
|
-
if (calling_file) {
|
|
9793
|
-
if (fileName !== calling_file) {
|
|
9794
|
-
return;
|
|
9795
|
-
}
|
|
9796
|
-
} else {
|
|
9797
|
-
return;
|
|
9798
|
-
}
|
|
9799
|
-
}
|
|
9800
|
-
}
|
|
9801
|
-
};
|
|
9802
|
-
Error.captureStackTrace(dummy);
|
|
9803
|
-
dummy.stack;
|
|
9804
|
-
Error.prepareStackTrace = origPST;
|
|
9805
|
-
Error.stackTraceLimit = origSTL;
|
|
9806
|
-
var fileSchema = "file://";
|
|
9807
|
-
if (fileName.indexOf(fileSchema) === 0) {
|
|
9808
|
-
fileName = fileURLToPath3(fileName);
|
|
9809
|
-
}
|
|
9810
|
-
return fileName;
|
|
9811
|
-
};
|
|
9812
|
-
exports$1.getRoot = function getRoot(file) {
|
|
9813
|
-
var dir = dirname(file), prev;
|
|
9814
|
-
while (true) {
|
|
9815
|
-
if (dir === ".") {
|
|
9816
|
-
dir = process.cwd();
|
|
9817
|
-
}
|
|
9818
|
-
if (exists2(join(dir, "package.json")) || exists2(join(dir, "node_modules"))) {
|
|
9819
|
-
return dir;
|
|
9820
|
-
}
|
|
9821
|
-
if (prev === dir) {
|
|
9822
|
-
throw new Error(
|
|
9823
|
-
'Could not find module root given file: "' + file + '". Do you have a `package.json` file? '
|
|
9824
|
-
);
|
|
9825
|
-
}
|
|
9826
|
-
prev = dir;
|
|
9827
|
-
dir = join(dir, "..");
|
|
9828
|
-
}
|
|
9829
|
-
};
|
|
9830
|
-
}
|
|
9831
|
-
});
|
|
9832
|
-
|
|
9833
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/wrappers.js
|
|
9834
|
-
var require_wrappers = __commonJS({
|
|
9835
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/wrappers.js"(exports$1) {
|
|
9836
|
-
var { cppdb } = require_util();
|
|
9837
|
-
exports$1.prepare = function prepare(sql) {
|
|
9838
|
-
return this[cppdb].prepare(sql, this, false);
|
|
9839
|
-
};
|
|
9840
|
-
exports$1.exec = function exec(sql) {
|
|
9841
|
-
this[cppdb].exec(sql);
|
|
9842
|
-
return this;
|
|
9843
|
-
};
|
|
9844
|
-
exports$1.close = function close() {
|
|
9845
|
-
this[cppdb].close();
|
|
9846
|
-
return this;
|
|
9847
|
-
};
|
|
9848
|
-
exports$1.loadExtension = function loadExtension(...args) {
|
|
9849
|
-
this[cppdb].loadExtension(...args);
|
|
9850
|
-
return this;
|
|
9851
|
-
};
|
|
9852
|
-
exports$1.defaultSafeIntegers = function defaultSafeIntegers(...args) {
|
|
9853
|
-
this[cppdb].defaultSafeIntegers(...args);
|
|
9854
|
-
return this;
|
|
9855
|
-
};
|
|
9856
|
-
exports$1.unsafeMode = function unsafeMode(...args) {
|
|
9857
|
-
this[cppdb].unsafeMode(...args);
|
|
9858
|
-
return this;
|
|
9859
|
-
};
|
|
9860
|
-
exports$1.getters = {
|
|
9861
|
-
name: {
|
|
9862
|
-
get: function name() {
|
|
9863
|
-
return this[cppdb].name;
|
|
9864
|
-
},
|
|
9865
|
-
enumerable: true
|
|
9866
|
-
},
|
|
9867
|
-
open: {
|
|
9868
|
-
get: function open3() {
|
|
9869
|
-
return this[cppdb].open;
|
|
9870
|
-
},
|
|
9871
|
-
enumerable: true
|
|
9872
|
-
},
|
|
9873
|
-
inTransaction: {
|
|
9874
|
-
get: function inTransaction() {
|
|
9875
|
-
return this[cppdb].inTransaction;
|
|
9876
|
-
},
|
|
9877
|
-
enumerable: true
|
|
9878
|
-
},
|
|
9879
|
-
readonly: {
|
|
9880
|
-
get: function readonly() {
|
|
9881
|
-
return this[cppdb].readonly;
|
|
9882
|
-
},
|
|
9883
|
-
enumerable: true
|
|
9884
|
-
},
|
|
9885
|
-
memory: {
|
|
9886
|
-
get: function memory() {
|
|
9887
|
-
return this[cppdb].memory;
|
|
9888
|
-
},
|
|
9889
|
-
enumerable: true
|
|
9890
|
-
}
|
|
9891
|
-
};
|
|
9892
|
-
}
|
|
9893
|
-
});
|
|
9894
|
-
|
|
9895
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/transaction.js
|
|
9896
|
-
var require_transaction = __commonJS({
|
|
9897
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/transaction.js"(exports$1, module) {
|
|
9898
|
-
var { cppdb } = require_util();
|
|
9899
|
-
var controllers = /* @__PURE__ */ new WeakMap();
|
|
9900
|
-
module.exports = function transaction(fn) {
|
|
9901
|
-
if (typeof fn !== "function") throw new TypeError("Expected first argument to be a function");
|
|
9902
|
-
const db = this[cppdb];
|
|
9903
|
-
const controller = getController(db, this);
|
|
9904
|
-
const { apply } = Function.prototype;
|
|
9905
|
-
const properties = {
|
|
9906
|
-
default: { value: wrapTransaction(apply, fn, db, controller.default) },
|
|
9907
|
-
deferred: { value: wrapTransaction(apply, fn, db, controller.deferred) },
|
|
9908
|
-
immediate: { value: wrapTransaction(apply, fn, db, controller.immediate) },
|
|
9909
|
-
exclusive: { value: wrapTransaction(apply, fn, db, controller.exclusive) },
|
|
9910
|
-
database: { value: this, enumerable: true }
|
|
9911
|
-
};
|
|
9912
|
-
Object.defineProperties(properties.default.value, properties);
|
|
9913
|
-
Object.defineProperties(properties.deferred.value, properties);
|
|
9914
|
-
Object.defineProperties(properties.immediate.value, properties);
|
|
9915
|
-
Object.defineProperties(properties.exclusive.value, properties);
|
|
9916
|
-
return properties.default.value;
|
|
9917
|
-
};
|
|
9918
|
-
var getController = (db, self) => {
|
|
9919
|
-
let controller = controllers.get(db);
|
|
9920
|
-
if (!controller) {
|
|
9921
|
-
const shared = {
|
|
9922
|
-
commit: db.prepare("COMMIT", self, false),
|
|
9923
|
-
rollback: db.prepare("ROLLBACK", self, false),
|
|
9924
|
-
savepoint: db.prepare("SAVEPOINT ` _bs3. `", self, false),
|
|
9925
|
-
release: db.prepare("RELEASE ` _bs3. `", self, false),
|
|
9926
|
-
rollbackTo: db.prepare("ROLLBACK TO ` _bs3. `", self, false)
|
|
9927
|
-
};
|
|
9928
|
-
controllers.set(db, controller = {
|
|
9929
|
-
default: Object.assign({ begin: db.prepare("BEGIN", self, false) }, shared),
|
|
9930
|
-
deferred: Object.assign({ begin: db.prepare("BEGIN DEFERRED", self, false) }, shared),
|
|
9931
|
-
immediate: Object.assign({ begin: db.prepare("BEGIN IMMEDIATE", self, false) }, shared),
|
|
9932
|
-
exclusive: Object.assign({ begin: db.prepare("BEGIN EXCLUSIVE", self, false) }, shared)
|
|
9933
|
-
});
|
|
9934
|
-
}
|
|
9935
|
-
return controller;
|
|
9936
|
-
};
|
|
9937
|
-
var wrapTransaction = (apply, fn, db, { begin, commit, rollback, savepoint, release, rollbackTo }) => function sqliteTransaction() {
|
|
9938
|
-
let before, after, undo;
|
|
9939
|
-
if (db.inTransaction) {
|
|
9940
|
-
before = savepoint;
|
|
9941
|
-
after = release;
|
|
9942
|
-
undo = rollbackTo;
|
|
9943
|
-
} else {
|
|
9944
|
-
before = begin;
|
|
9945
|
-
after = commit;
|
|
9946
|
-
undo = rollback;
|
|
9947
|
-
}
|
|
9948
|
-
before.run();
|
|
9949
|
-
try {
|
|
9950
|
-
const result = apply.call(fn, this, arguments);
|
|
9951
|
-
if (result && typeof result.then === "function") {
|
|
9952
|
-
throw new TypeError("Transaction function cannot return a promise");
|
|
9953
|
-
}
|
|
9954
|
-
after.run();
|
|
9955
|
-
return result;
|
|
9956
|
-
} catch (ex) {
|
|
9957
|
-
if (db.inTransaction) {
|
|
9958
|
-
undo.run();
|
|
9959
|
-
if (undo !== rollback) after.run();
|
|
9960
|
-
}
|
|
9961
|
-
throw ex;
|
|
9962
|
-
}
|
|
9963
|
-
};
|
|
9964
|
-
}
|
|
9965
|
-
});
|
|
9966
|
-
|
|
9967
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/pragma.js
|
|
9968
|
-
var require_pragma = __commonJS({
|
|
9969
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/pragma.js"(exports$1, module) {
|
|
9970
|
-
var { getBooleanOption, cppdb } = require_util();
|
|
9971
|
-
module.exports = function pragma(source, options) {
|
|
9972
|
-
if (options == null) options = {};
|
|
9973
|
-
if (typeof source !== "string") throw new TypeError("Expected first argument to be a string");
|
|
9974
|
-
if (typeof options !== "object") throw new TypeError("Expected second argument to be an options object");
|
|
9975
|
-
const simple = getBooleanOption(options, "simple");
|
|
9976
|
-
const stmt = this[cppdb].prepare(`PRAGMA ${source}`, this, true);
|
|
9977
|
-
return simple ? stmt.pluck().get() : stmt.all();
|
|
9978
|
-
};
|
|
9979
|
-
}
|
|
9980
|
-
});
|
|
9981
|
-
|
|
9982
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/backup.js
|
|
9983
|
-
var require_backup = __commonJS({
|
|
9984
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/backup.js"(exports$1, module) {
|
|
9985
|
-
var fs = __require("fs");
|
|
9986
|
-
var path37 = __require("path");
|
|
9987
|
-
var { promisify } = __require("util");
|
|
9988
|
-
var { cppdb } = require_util();
|
|
9989
|
-
var fsAccess = promisify(fs.access);
|
|
9990
|
-
module.exports = async function backup(filename, options) {
|
|
9991
|
-
if (options == null) options = {};
|
|
9992
|
-
if (typeof filename !== "string") throw new TypeError("Expected first argument to be a string");
|
|
9993
|
-
if (typeof options !== "object") throw new TypeError("Expected second argument to be an options object");
|
|
9994
|
-
filename = filename.trim();
|
|
9995
|
-
const attachedName = "attached" in options ? options.attached : "main";
|
|
9996
|
-
const handler = "progress" in options ? options.progress : null;
|
|
9997
|
-
if (!filename) throw new TypeError("Backup filename cannot be an empty string");
|
|
9998
|
-
if (filename === ":memory:") throw new TypeError('Invalid backup filename ":memory:"');
|
|
9999
|
-
if (typeof attachedName !== "string") throw new TypeError('Expected the "attached" option to be a string');
|
|
10000
|
-
if (!attachedName) throw new TypeError('The "attached" option cannot be an empty string');
|
|
10001
|
-
if (handler != null && typeof handler !== "function") throw new TypeError('Expected the "progress" option to be a function');
|
|
10002
|
-
await fsAccess(path37.dirname(filename)).catch(() => {
|
|
10003
|
-
throw new TypeError("Cannot save backup because the directory does not exist");
|
|
10004
|
-
});
|
|
10005
|
-
const isNewFile = await fsAccess(filename).then(() => false, () => true);
|
|
10006
|
-
return runBackup(this[cppdb].backup(this, attachedName, filename, isNewFile), handler || null);
|
|
10007
|
-
};
|
|
10008
|
-
var runBackup = (backup, handler) => {
|
|
10009
|
-
let rate = 0;
|
|
10010
|
-
let useDefault = true;
|
|
10011
|
-
return new Promise((resolve, reject) => {
|
|
10012
|
-
setImmediate(function step() {
|
|
10013
|
-
try {
|
|
10014
|
-
const progress = backup.transfer(rate);
|
|
10015
|
-
if (!progress.remainingPages) {
|
|
10016
|
-
backup.close();
|
|
10017
|
-
resolve(progress);
|
|
10018
|
-
return;
|
|
10019
|
-
}
|
|
10020
|
-
if (useDefault) {
|
|
10021
|
-
useDefault = false;
|
|
10022
|
-
rate = 100;
|
|
10023
|
-
}
|
|
10024
|
-
if (handler) {
|
|
10025
|
-
const ret = handler(progress);
|
|
10026
|
-
if (ret !== void 0) {
|
|
10027
|
-
if (typeof ret === "number" && ret === ret) rate = Math.max(0, Math.min(2147483647, Math.round(ret)));
|
|
10028
|
-
else throw new TypeError("Expected progress callback to return a number or undefined");
|
|
10029
|
-
}
|
|
10030
|
-
}
|
|
10031
|
-
setImmediate(step);
|
|
10032
|
-
} catch (err) {
|
|
10033
|
-
backup.close();
|
|
10034
|
-
reject(err);
|
|
10035
|
-
}
|
|
10036
|
-
});
|
|
10037
|
-
});
|
|
10038
|
-
};
|
|
10039
|
-
}
|
|
10040
|
-
});
|
|
10041
|
-
|
|
10042
|
-
// node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/serialize.js
|
|
10043
|
-
var require_serialize = __commonJS({
|
|
10044
|
-
"node_modules/.pnpm/better-sqlite3@11.10.0/node_modules/better-sqlite3/lib/methods/serialize.js"(exports$1, module) {
|
|
10045
|
-
var { cppdb } = require_util();
|
|
10046
|
-
module.exports = function serialize(options) {
|
|
10047
|
-
if (options == null) options = {};
|
|
10048
|
-
if (typeof options !== "object") throw new TypeError("Expected first argument to be an options object");
|
|
10049
|
-
const attachedName = "attached" in options ? options.attached : "main";
|
|
10050
|
-
if (typeof attachedName !== "string") throw new TypeError('Expected the "attached" option to be a string');
|
|
10051
|
-
if (!attachedName) throw new TypeError('The "attached" option cannot be an empty string');
|
|
10052
|
-
return this[cppdb].serialize(attachedName);
|
|
10053
|
-
};
|
|
9483
|
+
if (result.diagnostics.length > 0) {
|
|
9484
|
+
lines.push("");
|
|
9485
|
+
lines.push("**Diagnostics**");
|
|
9486
|
+
for (const item of result.diagnostics) lines.push(`- ${item}`);
|
|
10054
9487
|
}
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
9488
|
+
return lines.join("\n").trimEnd();
|
|
9489
|
+
}
|
|
9490
|
+
function renderGateReportHtml(result) {
|
|
9491
|
+
const rows = result.checks.map(
|
|
9492
|
+
(check) => `<tr><td>${escapeHtml(check.name)}</td><td>${check.ok ? "PASS" : "FAIL"}</td><td>${escapeHtml(check.message)}</td></tr>`
|
|
9493
|
+
).join("");
|
|
9494
|
+
return `<!DOCTYPE html>
|
|
9495
|
+
<html lang="en">
|
|
9496
|
+
<head>
|
|
9497
|
+
<meta charset="utf-8" />
|
|
9498
|
+
<title>Gate report</title>
|
|
9499
|
+
<style>
|
|
9500
|
+
body { font-family: system-ui, sans-serif; margin: 2rem; }
|
|
9501
|
+
table { border-collapse: collapse; width: 100%; }
|
|
9502
|
+
th, td { border: 1px solid #ddd; padding: 0.5rem; text-align: left; }
|
|
9503
|
+
th { background: #f6f6f6; }
|
|
9504
|
+
</style>
|
|
9505
|
+
</head>
|
|
9506
|
+
<body>
|
|
9507
|
+
<h1>AgentInspect gate</h1>
|
|
9508
|
+
<p>Status: <strong>${result.ok ? "PASS" : "FAIL"}</strong> (exit ${result.exitCode})</p>
|
|
9509
|
+
<h2>Checks</h2>
|
|
9510
|
+
<table>
|
|
9511
|
+
<thead><tr><th>Check</th><th>Status</th><th>Details</th></tr></thead>
|
|
9512
|
+
<tbody>${rows}</tbody>
|
|
9513
|
+
</table>
|
|
9514
|
+
</body>
|
|
9515
|
+
</html>`;
|
|
9516
|
+
}
|
|
9517
|
+
function renderGateJUnit(result) {
|
|
9518
|
+
const failures = result.checks.filter((check) => !check.ok).length;
|
|
9519
|
+
const tests = result.checks.length;
|
|
9520
|
+
const cases = result.checks.map((check) => {
|
|
9521
|
+
if (check.ok) {
|
|
9522
|
+
return ` <testcase name="${escapeXml(check.name)}" classname="gate" />`;
|
|
9523
|
+
}
|
|
9524
|
+
return ` <testcase name="${escapeXml(check.name)}" classname="gate">
|
|
9525
|
+
<failure message="${escapeXml(check.message)}">${escapeXml(check.message)}</failure>
|
|
9526
|
+
</testcase>`;
|
|
9527
|
+
}).join("\n");
|
|
9528
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
9529
|
+
<testsuites tests="${tests}" failures="${failures}" errors="0" time="0">
|
|
9530
|
+
<testsuite name="agent-inspect-gate" tests="${tests}" failures="${failures}" errors="0" time="0">
|
|
9531
|
+
${cases}
|
|
9532
|
+
</testsuite>
|
|
9533
|
+
</testsuites>`;
|
|
9534
|
+
}
|
|
9535
|
+
function renderGateReport(result, options = {}) {
|
|
9536
|
+
const format = options.format ?? "markdown";
|
|
9537
|
+
if (format === "json") return JSON.stringify(result, null, 2);
|
|
9538
|
+
if (format === "html") return renderGateReportHtml(result);
|
|
9539
|
+
if (format === "junit") return renderGateJUnit(result);
|
|
9540
|
+
if (format === "github") return renderGateGithubStepSummary(result);
|
|
9541
|
+
return renderGateSummaryMarkdown(result);
|
|
9542
|
+
}
|
|
9543
|
+
var init_render3 = __esm({
|
|
9544
|
+
"packages/core/src/gate/render.ts"() {
|
|
9545
|
+
init_helpers();
|
|
10084
9546
|
}
|
|
10085
9547
|
});
|
|
10086
9548
|
|
|
10087
|
-
//
|
|
10088
|
-
var
|
|
10089
|
-
"
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
if (!name) throw new TypeError("User-defined function name cannot be an empty string");
|
|
10095
|
-
const start = "start" in options ? options.start : null;
|
|
10096
|
-
const step = getFunctionOption(options, "step", true);
|
|
10097
|
-
const inverse = getFunctionOption(options, "inverse", false);
|
|
10098
|
-
const result = getFunctionOption(options, "result", false);
|
|
10099
|
-
const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
|
|
10100
|
-
const deterministic = getBooleanOption(options, "deterministic");
|
|
10101
|
-
const directOnly = getBooleanOption(options, "directOnly");
|
|
10102
|
-
const varargs = getBooleanOption(options, "varargs");
|
|
10103
|
-
let argCount = -1;
|
|
10104
|
-
if (!varargs) {
|
|
10105
|
-
argCount = Math.max(getLength(step), inverse ? getLength(inverse) : 0);
|
|
10106
|
-
if (argCount > 0) argCount -= 1;
|
|
10107
|
-
if (argCount > 100) throw new RangeError("User-defined functions cannot have more than 100 arguments");
|
|
10108
|
-
}
|
|
10109
|
-
this[cppdb].aggregate(start, step, inverse, result, name, argCount, safeIntegers, deterministic, directOnly);
|
|
10110
|
-
return this;
|
|
10111
|
-
};
|
|
10112
|
-
var getFunctionOption = (options, key, required) => {
|
|
10113
|
-
const value = key in options ? options[key] : null;
|
|
10114
|
-
if (typeof value === "function") return value;
|
|
10115
|
-
if (value != null) throw new TypeError(`Expected the "${key}" option to be a function`);
|
|
10116
|
-
if (required) throw new TypeError(`Missing required option "${key}"`);
|
|
10117
|
-
return null;
|
|
10118
|
-
};
|
|
10119
|
-
var getLength = ({ length }) => {
|
|
10120
|
-
if (Number.isInteger(length) && length >= 0) return length;
|
|
10121
|
-
throw new TypeError("Expected function.length to be a positive integer");
|
|
10122
|
-
};
|
|
9549
|
+
// packages/core/src/gate/index.ts
|
|
9550
|
+
var init_gate = __esm({
|
|
9551
|
+
"packages/core/src/gate/index.ts"() {
|
|
9552
|
+
init_parse();
|
|
9553
|
+
init_evaluate();
|
|
9554
|
+
init_run2();
|
|
9555
|
+
init_render3();
|
|
10123
9556
|
}
|
|
10124
9557
|
});
|
|
10125
9558
|
|
|
10126
|
-
//
|
|
10127
|
-
var
|
|
10128
|
-
"
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
factory = defer(parseTableDefinition(factory, "used", name));
|
|
10137
|
-
} else {
|
|
10138
|
-
if (typeof factory !== "function") throw new TypeError("Expected second argument to be a function or a table definition object");
|
|
10139
|
-
factory = wrapFactory(factory);
|
|
10140
|
-
}
|
|
10141
|
-
this[cppdb].table(factory, name, eponymous);
|
|
10142
|
-
return this;
|
|
10143
|
-
};
|
|
10144
|
-
function wrapFactory(factory) {
|
|
10145
|
-
return function virtualTableFactory(moduleName, databaseName, tableName, ...args) {
|
|
10146
|
-
const thisObject = {
|
|
10147
|
-
module: moduleName,
|
|
10148
|
-
database: databaseName,
|
|
10149
|
-
table: tableName
|
|
10150
|
-
};
|
|
10151
|
-
const def = apply.call(factory, thisObject, args);
|
|
10152
|
-
if (typeof def !== "object" || def === null) {
|
|
10153
|
-
throw new TypeError(`Virtual table module "${moduleName}" did not return a table definition object`);
|
|
10154
|
-
}
|
|
10155
|
-
return parseTableDefinition(def, "returned", moduleName);
|
|
10156
|
-
};
|
|
10157
|
-
}
|
|
10158
|
-
function parseTableDefinition(def, verb, moduleName) {
|
|
10159
|
-
if (!hasOwnProperty.call(def, "rows")) {
|
|
10160
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "rows" property`);
|
|
10161
|
-
}
|
|
10162
|
-
if (!hasOwnProperty.call(def, "columns")) {
|
|
10163
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "columns" property`);
|
|
10164
|
-
}
|
|
10165
|
-
const rows = def.rows;
|
|
10166
|
-
if (typeof rows !== "function" || Object.getPrototypeOf(rows) !== GeneratorFunctionPrototype) {
|
|
10167
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "rows" property (should be a generator function)`);
|
|
10168
|
-
}
|
|
10169
|
-
let columns = def.columns;
|
|
10170
|
-
if (!Array.isArray(columns) || !(columns = [...columns]).every((x) => typeof x === "string")) {
|
|
10171
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "columns" property (should be an array of strings)`);
|
|
10172
|
-
}
|
|
10173
|
-
if (columns.length !== new Set(columns).size) {
|
|
10174
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate column names`);
|
|
10175
|
-
}
|
|
10176
|
-
if (!columns.length) {
|
|
10177
|
-
throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with zero columns`);
|
|
10178
|
-
}
|
|
10179
|
-
let parameters;
|
|
10180
|
-
if (hasOwnProperty.call(def, "parameters")) {
|
|
10181
|
-
parameters = def.parameters;
|
|
10182
|
-
if (!Array.isArray(parameters) || !(parameters = [...parameters]).every((x) => typeof x === "string")) {
|
|
10183
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "parameters" property (should be an array of strings)`);
|
|
10184
|
-
}
|
|
10185
|
-
} else {
|
|
10186
|
-
parameters = inferParameters(rows);
|
|
10187
|
-
}
|
|
10188
|
-
if (parameters.length !== new Set(parameters).size) {
|
|
10189
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate parameter names`);
|
|
10190
|
-
}
|
|
10191
|
-
if (parameters.length > 32) {
|
|
10192
|
-
throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with more than the maximum number of 32 parameters`);
|
|
10193
|
-
}
|
|
10194
|
-
for (const parameter of parameters) {
|
|
10195
|
-
if (columns.includes(parameter)) {
|
|
10196
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with column "${parameter}" which was ambiguously defined as both a column and parameter`);
|
|
10197
|
-
}
|
|
10198
|
-
}
|
|
10199
|
-
let safeIntegers = 2;
|
|
10200
|
-
if (hasOwnProperty.call(def, "safeIntegers")) {
|
|
10201
|
-
const bool = def.safeIntegers;
|
|
10202
|
-
if (typeof bool !== "boolean") {
|
|
10203
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "safeIntegers" property (should be a boolean)`);
|
|
10204
|
-
}
|
|
10205
|
-
safeIntegers = +bool;
|
|
10206
|
-
}
|
|
10207
|
-
let directOnly = false;
|
|
10208
|
-
if (hasOwnProperty.call(def, "directOnly")) {
|
|
10209
|
-
directOnly = def.directOnly;
|
|
10210
|
-
if (typeof directOnly !== "boolean") {
|
|
10211
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "directOnly" property (should be a boolean)`);
|
|
10212
|
-
}
|
|
10213
|
-
}
|
|
10214
|
-
const columnDefinitions = [
|
|
10215
|
-
...parameters.map(identifier).map((str2) => `${str2} HIDDEN`),
|
|
10216
|
-
...columns.map(identifier)
|
|
10217
|
-
];
|
|
10218
|
-
return [
|
|
10219
|
-
`CREATE TABLE x(${columnDefinitions.join(", ")});`,
|
|
10220
|
-
wrapGenerator(rows, new Map(columns.map((x, i) => [x, parameters.length + i])), moduleName),
|
|
10221
|
-
parameters,
|
|
10222
|
-
safeIntegers,
|
|
10223
|
-
directOnly
|
|
10224
|
-
];
|
|
10225
|
-
}
|
|
10226
|
-
function wrapGenerator(generator, columnMap, moduleName) {
|
|
10227
|
-
return function* virtualTable(...args) {
|
|
10228
|
-
const output2 = args.map((x) => Buffer.isBuffer(x) ? Buffer.from(x) : x);
|
|
10229
|
-
for (let i = 0; i < columnMap.size; ++i) {
|
|
10230
|
-
output2.push(null);
|
|
10231
|
-
}
|
|
10232
|
-
for (const row of generator(...args)) {
|
|
10233
|
-
if (Array.isArray(row)) {
|
|
10234
|
-
extractRowArray(row, output2, columnMap.size, moduleName);
|
|
10235
|
-
yield output2;
|
|
10236
|
-
} else if (typeof row === "object" && row !== null) {
|
|
10237
|
-
extractRowObject(row, output2, columnMap, moduleName);
|
|
10238
|
-
yield output2;
|
|
10239
|
-
} else {
|
|
10240
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded something that isn't a valid row object`);
|
|
10241
|
-
}
|
|
10242
|
-
}
|
|
10243
|
-
};
|
|
10244
|
-
}
|
|
10245
|
-
function extractRowArray(row, output2, columnCount, moduleName) {
|
|
10246
|
-
if (row.length !== columnCount) {
|
|
10247
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an incorrect number of columns`);
|
|
10248
|
-
}
|
|
10249
|
-
const offset = output2.length - columnCount;
|
|
10250
|
-
for (let i = 0; i < columnCount; ++i) {
|
|
10251
|
-
output2[i + offset] = row[i];
|
|
10252
|
-
}
|
|
10253
|
-
}
|
|
10254
|
-
function extractRowObject(row, output2, columnMap, moduleName) {
|
|
10255
|
-
let count = 0;
|
|
10256
|
-
for (const key of Object.keys(row)) {
|
|
10257
|
-
const index = columnMap.get(key);
|
|
10258
|
-
if (index === void 0) {
|
|
10259
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an undeclared column "${key}"`);
|
|
10260
|
-
}
|
|
10261
|
-
output2[index] = row[key];
|
|
10262
|
-
count += 1;
|
|
10263
|
-
}
|
|
10264
|
-
if (count !== columnMap.size) {
|
|
10265
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with missing columns`);
|
|
10266
|
-
}
|
|
10267
|
-
}
|
|
10268
|
-
function inferParameters({ length }) {
|
|
10269
|
-
if (!Number.isInteger(length) || length < 0) {
|
|
10270
|
-
throw new TypeError("Expected function.length to be a positive integer");
|
|
10271
|
-
}
|
|
10272
|
-
const params = [];
|
|
10273
|
-
for (let i = 0; i < length; ++i) {
|
|
10274
|
-
params.push(`$${i + 1}`);
|
|
10275
|
-
}
|
|
10276
|
-
return params;
|
|
10277
|
-
}
|
|
10278
|
-
var { hasOwnProperty } = Object.prototype;
|
|
10279
|
-
var { apply } = Function.prototype;
|
|
10280
|
-
var GeneratorFunctionPrototype = Object.getPrototypeOf(function* () {
|
|
10281
|
-
});
|
|
10282
|
-
var identifier = (str2) => `"${str2.replace(/"/g, '""')}"`;
|
|
10283
|
-
var defer = (x) => () => x;
|
|
9559
|
+
// packages/core/src/inspect-run.ts
|
|
9560
|
+
var init_inspect_run = __esm({
|
|
9561
|
+
"packages/core/src/inspect-run.ts"() {
|
|
9562
|
+
init_correlation_metadata();
|
|
9563
|
+
init_context();
|
|
9564
|
+
init_storage();
|
|
9565
|
+
init_terminal();
|
|
9566
|
+
init_trace_directory();
|
|
9567
|
+
init_trace_event_safety();
|
|
9568
|
+
init_utils();
|
|
10284
9569
|
}
|
|
10285
9570
|
});
|
|
10286
9571
|
|
|
10287
|
-
//
|
|
10288
|
-
var
|
|
10289
|
-
"
|
|
10290
|
-
|
|
10291
|
-
};
|
|
10292
|
-
module.exports = function inspect(depth, opts) {
|
|
10293
|
-
return Object.assign(new DatabaseInspection(), this);
|
|
10294
|
-
};
|
|
9572
|
+
// packages/core/src/maybe-inspect-run.ts
|
|
9573
|
+
var init_maybe_inspect_run = __esm({
|
|
9574
|
+
"packages/core/src/maybe-inspect-run.ts"() {
|
|
9575
|
+
init_inspect_run();
|
|
10295
9576
|
}
|
|
10296
9577
|
});
|
|
10297
9578
|
|
|
10298
|
-
//
|
|
10299
|
-
var
|
|
10300
|
-
"
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
if (readonly && anonymous && !buffer) throw new TypeError("In-memory/temporary databases cannot be readonly");
|
|
10329
|
-
if (!Number.isInteger(timeout) || timeout < 0) throw new TypeError('Expected the "timeout" option to be a positive integer');
|
|
10330
|
-
if (timeout > 2147483647) throw new RangeError('Option "timeout" cannot be greater than 2147483647');
|
|
10331
|
-
if (verbose != null && typeof verbose !== "function") throw new TypeError('Expected the "verbose" option to be a function');
|
|
10332
|
-
if (nativeBinding != null && typeof nativeBinding !== "string" && typeof nativeBinding !== "object") throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');
|
|
10333
|
-
let addon;
|
|
10334
|
-
if (nativeBinding == null) {
|
|
10335
|
-
addon = DEFAULT_ADDON || (DEFAULT_ADDON = require_bindings()("better_sqlite3.node"));
|
|
10336
|
-
} else if (typeof nativeBinding === "string") {
|
|
10337
|
-
const requireFunc = typeof __non_webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
10338
|
-
addon = requireFunc(path37.resolve(nativeBinding).replace(/(\.node)?$/, ".node"));
|
|
10339
|
-
} else {
|
|
10340
|
-
addon = nativeBinding;
|
|
10341
|
-
}
|
|
10342
|
-
if (!addon.isInitialized) {
|
|
10343
|
-
addon.setErrorConstructor(SqliteError);
|
|
10344
|
-
addon.isInitialized = true;
|
|
10345
|
-
}
|
|
10346
|
-
if (!anonymous && !fs.existsSync(path37.dirname(filename))) {
|
|
10347
|
-
throw new TypeError("Cannot open database because the directory does not exist");
|
|
10348
|
-
}
|
|
10349
|
-
Object.defineProperties(this, {
|
|
10350
|
-
[util.cppdb]: { value: new addon.Database(filename, filenameGiven, anonymous, readonly, fileMustExist, timeout, verbose || null, buffer || null) },
|
|
10351
|
-
...wrappers.getters
|
|
10352
|
-
});
|
|
10353
|
-
}
|
|
10354
|
-
var wrappers = require_wrappers();
|
|
10355
|
-
Database3.prototype.prepare = wrappers.prepare;
|
|
10356
|
-
Database3.prototype.transaction = require_transaction();
|
|
10357
|
-
Database3.prototype.pragma = require_pragma();
|
|
10358
|
-
Database3.prototype.backup = require_backup();
|
|
10359
|
-
Database3.prototype.serialize = require_serialize();
|
|
10360
|
-
Database3.prototype.function = require_function();
|
|
10361
|
-
Database3.prototype.aggregate = require_aggregate();
|
|
10362
|
-
Database3.prototype.table = require_table();
|
|
10363
|
-
Database3.prototype.loadExtension = wrappers.loadExtension;
|
|
10364
|
-
Database3.prototype.exec = wrappers.exec;
|
|
10365
|
-
Database3.prototype.close = wrappers.close;
|
|
10366
|
-
Database3.prototype.defaultSafeIntegers = wrappers.defaultSafeIntegers;
|
|
10367
|
-
Database3.prototype.unsafeMode = wrappers.unsafeMode;
|
|
10368
|
-
Database3.prototype[util.inspect] = require_inspect();
|
|
10369
|
-
module.exports = Database3;
|
|
9579
|
+
// packages/core/src/entries/advanced.ts
|
|
9580
|
+
var init_advanced = __esm({
|
|
9581
|
+
"packages/core/src/entries/advanced.ts"() {
|
|
9582
|
+
init_context();
|
|
9583
|
+
init_inspector();
|
|
9584
|
+
init_inspector_runtime();
|
|
9585
|
+
init_trace_event_safety();
|
|
9586
|
+
init_terminal();
|
|
9587
|
+
init_utils();
|
|
9588
|
+
init_types();
|
|
9589
|
+
init_storage();
|
|
9590
|
+
init_read_trace();
|
|
9591
|
+
init_trace_directory();
|
|
9592
|
+
init_trace_metadata();
|
|
9593
|
+
init_trace_filter();
|
|
9594
|
+
init_timeline();
|
|
9595
|
+
init_what();
|
|
9596
|
+
init_explain();
|
|
9597
|
+
init_stats();
|
|
9598
|
+
init_search();
|
|
9599
|
+
init_sessions();
|
|
9600
|
+
init_trace_verification();
|
|
9601
|
+
init_duration();
|
|
9602
|
+
init_bundle();
|
|
9603
|
+
init_suite();
|
|
9604
|
+
init_templates();
|
|
9605
|
+
init_extract();
|
|
9606
|
+
init_cohort2();
|
|
9607
|
+
init_gate();
|
|
9608
|
+
init_maybe_inspect_run();
|
|
10370
9609
|
}
|
|
10371
9610
|
});
|
|
10372
9611
|
|
|
10373
|
-
//
|
|
10374
|
-
var
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
9612
|
+
// packages/index-sqlite/src/types.ts
|
|
9613
|
+
var INDEX_SCHEMA_VERSION, INDEX_DB_FILENAME;
|
|
9614
|
+
var init_types6 = __esm({
|
|
9615
|
+
"packages/index-sqlite/src/types.ts"() {
|
|
9616
|
+
INDEX_SCHEMA_VERSION = "1";
|
|
9617
|
+
INDEX_DB_FILENAME = "trace-index.sqlite";
|
|
10378
9618
|
}
|
|
10379
9619
|
});
|
|
10380
9620
|
|
|
@@ -10469,6 +9709,24 @@ GROUP BY session_id;
|
|
|
10469
9709
|
};
|
|
10470
9710
|
}
|
|
10471
9711
|
});
|
|
9712
|
+
function loadBetterSqlite3() {
|
|
9713
|
+
if (cached !== void 0) return cached;
|
|
9714
|
+
try {
|
|
9715
|
+
const require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
9716
|
+
cached = require2("better-sqlite3");
|
|
9717
|
+
return cached;
|
|
9718
|
+
} catch (error) {
|
|
9719
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
9720
|
+
throw new Error(
|
|
9721
|
+
`better-sqlite3 native driver is unavailable (${detail}). Install a prebuild for your Node/OS (see better-sqlite3 docs) or fall back to JSONL directory scans without the SQLite index. Core agent-inspect remains usable without this optional package.`
|
|
9722
|
+
);
|
|
9723
|
+
}
|
|
9724
|
+
}
|
|
9725
|
+
var cached;
|
|
9726
|
+
var init_load_sqlite = __esm({
|
|
9727
|
+
"packages/index-sqlite/src/load-sqlite.ts"() {
|
|
9728
|
+
}
|
|
9729
|
+
});
|
|
10472
9730
|
function resolveIndexDbPath(traceDir, dbPath) {
|
|
10473
9731
|
if (dbPath && dbPath.trim() !== "") return path26__default.default.resolve(dbPath);
|
|
10474
9732
|
return path26__default.default.join(path26__default.default.resolve(traceDir), INDEX_DB_FILENAME);
|
|
@@ -10565,7 +9823,8 @@ async function buildIndex(options = {}) {
|
|
|
10565
9823
|
}
|
|
10566
9824
|
await promises.mkdir(path26__default.default.dirname(dbPath), { recursive: true });
|
|
10567
9825
|
await promises.rm(dbPath, { force: true });
|
|
10568
|
-
const
|
|
9826
|
+
const Sqlite = loadBetterSqlite3();
|
|
9827
|
+
const db = new Sqlite(dbPath);
|
|
10569
9828
|
let runCount = 0;
|
|
10570
9829
|
let stepCount = 0;
|
|
10571
9830
|
let errorCount = 0;
|
|
@@ -10622,7 +9881,8 @@ async function buildIndex(options = {}) {
|
|
|
10622
9881
|
}
|
|
10623
9882
|
function readMetaValue(dbPath, key) {
|
|
10624
9883
|
try {
|
|
10625
|
-
const
|
|
9884
|
+
const Sqlite = loadBetterSqlite3();
|
|
9885
|
+
const db = new Sqlite(dbPath, { readonly: true, fileMustExist: true });
|
|
10626
9886
|
try {
|
|
10627
9887
|
const row = db.prepare(`SELECT value FROM meta WHERE key = ?`).get(key);
|
|
10628
9888
|
return row?.value ?? null;
|
|
@@ -10638,12 +9898,12 @@ async function cleanIndex(dbPath) {
|
|
|
10638
9898
|
await promises.rm(`${dbPath}-wal`, { force: true });
|
|
10639
9899
|
await promises.rm(`${dbPath}-shm`, { force: true });
|
|
10640
9900
|
}
|
|
10641
|
-
var
|
|
9901
|
+
var DEFAULT_MAX_RUNS, rebuildIndex;
|
|
10642
9902
|
var init_builder = __esm({
|
|
10643
9903
|
"packages/index-sqlite/src/builder.ts"() {
|
|
10644
|
-
import_better_sqlite3 = __toESM(require_lib());
|
|
10645
9904
|
init_advanced();
|
|
10646
9905
|
init_schema();
|
|
9906
|
+
init_load_sqlite();
|
|
10647
9907
|
init_types6();
|
|
10648
9908
|
DEFAULT_MAX_RUNS = 1e4;
|
|
10649
9909
|
rebuildIndex = buildIndex;
|
|
@@ -10651,8 +9911,14 @@ var init_builder = __esm({
|
|
|
10651
9911
|
});
|
|
10652
9912
|
function openHealthy(dbPath) {
|
|
10653
9913
|
if (!fs.existsSync(dbPath)) return null;
|
|
9914
|
+
let Sqlite;
|
|
9915
|
+
try {
|
|
9916
|
+
Sqlite = loadBetterSqlite3();
|
|
9917
|
+
} catch {
|
|
9918
|
+
return null;
|
|
9919
|
+
}
|
|
10654
9920
|
try {
|
|
10655
|
-
const db = new
|
|
9921
|
+
const db = new Sqlite(dbPath, { readonly: true, fileMustExist: true });
|
|
10656
9922
|
try {
|
|
10657
9923
|
const result = db.pragma("integrity_check", { simple: true });
|
|
10658
9924
|
if (result !== "ok") {
|
|
@@ -10774,10 +10040,9 @@ function queryRuns(dbPath, query = {}) {
|
|
|
10774
10040
|
db.close();
|
|
10775
10041
|
}
|
|
10776
10042
|
}
|
|
10777
|
-
var import_better_sqlite32;
|
|
10778
10043
|
var init_query = __esm({
|
|
10779
10044
|
"packages/index-sqlite/src/query.ts"() {
|
|
10780
|
-
|
|
10045
|
+
init_load_sqlite();
|
|
10781
10046
|
init_schema();
|
|
10782
10047
|
}
|
|
10783
10048
|
});
|
|
@@ -10804,7 +10069,7 @@ var init_src = __esm({
|
|
|
10804
10069
|
});
|
|
10805
10070
|
|
|
10806
10071
|
// package.json
|
|
10807
|
-
var version = "6.7.
|
|
10072
|
+
var version = "6.7.5";
|
|
10808
10073
|
|
|
10809
10074
|
// packages/cli/src/list.ts
|
|
10810
10075
|
init_advanced();
|
|
@@ -13733,6 +12998,20 @@ ${attrsSection}
|
|
|
13733
12998
|
// packages/core/src/entries/exporters.ts
|
|
13734
12999
|
init_helpers();
|
|
13735
13000
|
|
|
13001
|
+
// packages/cli/src/cli-option-aliases.ts
|
|
13002
|
+
function resolveOutputOption(options) {
|
|
13003
|
+
const canonical = options.output?.trim();
|
|
13004
|
+
if (canonical) return canonical;
|
|
13005
|
+
const legacy = options.out?.trim();
|
|
13006
|
+
return legacy || void 0;
|
|
13007
|
+
}
|
|
13008
|
+
function resolveRedactionProfileOption(options) {
|
|
13009
|
+
const canonical = options.redactionProfile?.trim();
|
|
13010
|
+
if (canonical) return canonical;
|
|
13011
|
+
const legacy = options.profile?.trim();
|
|
13012
|
+
return legacy || void 0;
|
|
13013
|
+
}
|
|
13014
|
+
|
|
13736
13015
|
// packages/cli/src/export.ts
|
|
13737
13016
|
function parseRedactionProfile(s) {
|
|
13738
13017
|
const v = (s ?? "local").trim().toLowerCase();
|
|
@@ -13763,7 +13042,7 @@ async function exportCommand(runId, options = {}) {
|
|
|
13763
13042
|
let redactionProfile;
|
|
13764
13043
|
try {
|
|
13765
13044
|
format = parseExportFormat(options.format);
|
|
13766
|
-
redactionProfile = parseRedactionProfile(options
|
|
13045
|
+
redactionProfile = parseRedactionProfile(resolveRedactionProfileOption(options));
|
|
13767
13046
|
} catch (e) {
|
|
13768
13047
|
const msg = e instanceof Error ? e.message : String(e);
|
|
13769
13048
|
console.error(msg);
|
|
@@ -13811,7 +13090,8 @@ Trace directory: ${traceDir}`);
|
|
|
13811
13090
|
if (validation !== void 0 && !validation.ok) {
|
|
13812
13091
|
process.exitCode = 1;
|
|
13813
13092
|
}
|
|
13814
|
-
const
|
|
13093
|
+
const resolvedOutput = resolveOutputOption(options);
|
|
13094
|
+
const outPath = resolvedOutput !== void 0 ? path26__default.default.resolve(resolvedOutput) : void 0;
|
|
13815
13095
|
if (outPath !== void 0) {
|
|
13816
13096
|
await promises.mkdir(path26__default.default.dirname(outPath), { recursive: true });
|
|
13817
13097
|
await promises.writeFile(outPath, result.content, "utf-8");
|
|
@@ -15082,7 +14362,7 @@ async function reportCommand(runId, options = {}) {
|
|
|
15082
14362
|
let redactionProfile;
|
|
15083
14363
|
try {
|
|
15084
14364
|
format = parseReportFormat(options.format);
|
|
15085
|
-
redactionProfile = parseRedactionProfile2(options
|
|
14365
|
+
redactionProfile = parseRedactionProfile2(resolveRedactionProfileOption(options));
|
|
15086
14366
|
} catch (e) {
|
|
15087
14367
|
const msg = e instanceof Error ? e.message : String(e);
|
|
15088
14368
|
console.error(msg);
|
|
@@ -15114,7 +14394,8 @@ async function reportCommand(runId, options = {}) {
|
|
|
15114
14394
|
correlation: !options.noCorrelation,
|
|
15115
14395
|
...options.section ? { section: options.section } : {}
|
|
15116
14396
|
});
|
|
15117
|
-
const
|
|
14397
|
+
const resolvedOutput = resolveOutputOption(options);
|
|
14398
|
+
const outPath = resolvedOutput !== void 0 ? path26__default.default.resolve(resolvedOutput) : void 0;
|
|
15118
14399
|
if (outPath !== void 0) {
|
|
15119
14400
|
await promises.mkdir(path26__default.default.dirname(outPath), { recursive: true });
|
|
15120
14401
|
await promises.writeFile(outPath, result.content, "utf-8");
|
|
@@ -15633,11 +14914,12 @@ function redactTraceContent(content, profile) {
|
|
|
15633
14914
|
return redactDocument(content, profile);
|
|
15634
14915
|
}
|
|
15635
14916
|
async function redactCommand(target, options = {}, stdin = process.stdin) {
|
|
15636
|
-
const profile = parseRedactionProfile3(options
|
|
14917
|
+
const profile = parseRedactionProfile3(resolveRedactionProfileOption(options));
|
|
15637
14918
|
const source = await contentFromTarget(target, options, stdin);
|
|
15638
14919
|
const redacted = redactDocument(source.content, profile);
|
|
15639
|
-
|
|
15640
|
-
|
|
14920
|
+
const outputPath = resolveOutputOption(options);
|
|
14921
|
+
if (outputPath !== void 0) {
|
|
14922
|
+
await promises.writeFile(outputPath, redacted.content, "utf-8");
|
|
15641
14923
|
}
|
|
15642
14924
|
if (options.json) {
|
|
15643
14925
|
console.log(
|
|
@@ -15646,9 +14928,9 @@ async function redactCommand(target, options = {}, stdin = process.stdin) {
|
|
|
15646
14928
|
ok: true,
|
|
15647
14929
|
profile,
|
|
15648
14930
|
source: source.source,
|
|
15649
|
-
output:
|
|
14931
|
+
output: outputPath,
|
|
15650
14932
|
findings: redacted.findings,
|
|
15651
|
-
content:
|
|
14933
|
+
content: outputPath === void 0 ? redacted.content : void 0
|
|
15652
14934
|
}),
|
|
15653
14935
|
null,
|
|
15654
14936
|
2
|
|
@@ -15656,7 +14938,7 @@ async function redactCommand(target, options = {}, stdin = process.stdin) {
|
|
|
15656
14938
|
);
|
|
15657
14939
|
return;
|
|
15658
14940
|
}
|
|
15659
|
-
if (
|
|
14941
|
+
if (outputPath === void 0) {
|
|
15660
14942
|
process.stdout.write(redacted.content);
|
|
15661
14943
|
}
|
|
15662
14944
|
}
|
|
@@ -15734,7 +15016,7 @@ async function explainCommand(target, options = {}, stdin = process.stdin) {
|
|
|
15734
15016
|
}
|
|
15735
15017
|
let redactionProfile;
|
|
15736
15018
|
try {
|
|
15737
|
-
redactionProfile = parseRedactionProfile4(options
|
|
15019
|
+
redactionProfile = parseRedactionProfile4(resolveRedactionProfileOption(options));
|
|
15738
15020
|
} catch (error) {
|
|
15739
15021
|
process.exitCode = 1;
|
|
15740
15022
|
console.error(error instanceof Error ? error.message : String(error));
|
|
@@ -16902,9 +16184,20 @@ function buildRules(config, options) {
|
|
|
16902
16184
|
...asStringArray2(checks2.select) ?? [],
|
|
16903
16185
|
...options.rule ?? []
|
|
16904
16186
|
];
|
|
16187
|
+
if (select.length === 0) {
|
|
16188
|
+
const auto = new Set(DEFAULT_SELECT);
|
|
16189
|
+
for (const rule of rules) {
|
|
16190
|
+
if (rule.id !== "run.status") auto.add(rule.id);
|
|
16191
|
+
}
|
|
16192
|
+
return {
|
|
16193
|
+
rules,
|
|
16194
|
+
select: [...auto],
|
|
16195
|
+
diagnostics
|
|
16196
|
+
};
|
|
16197
|
+
}
|
|
16905
16198
|
return {
|
|
16906
16199
|
rules,
|
|
16907
|
-
select
|
|
16200
|
+
select,
|
|
16908
16201
|
diagnostics
|
|
16909
16202
|
};
|
|
16910
16203
|
}
|
|
@@ -19685,8 +18978,9 @@ function safetyStatusFromAssess(status) {
|
|
|
19685
18978
|
return "UNKNOWN";
|
|
19686
18979
|
}
|
|
19687
18980
|
async function resolveOutputDir(options, runIds, cwd) {
|
|
19688
|
-
|
|
19689
|
-
|
|
18981
|
+
const out = resolveOutputOption(options);
|
|
18982
|
+
if (out !== void 0) {
|
|
18983
|
+
const normalized = normalizeBundleOutputPath(out);
|
|
19690
18984
|
try {
|
|
19691
18985
|
const location = resolveWorkspaceLocation(cwd);
|
|
19692
18986
|
const manifest = await readWorkspaceManifestFile(location);
|
|
@@ -19756,7 +19050,7 @@ function extractHtmlBody(content) {
|
|
|
19756
19050
|
return match?.[1]?.trim() ?? content;
|
|
19757
19051
|
}
|
|
19758
19052
|
async function bundleCommand(runIdArg, options = {}) {
|
|
19759
|
-
const profile = parseBundleProfile(options
|
|
19053
|
+
const profile = parseBundleProfile(resolveRedactionProfileOption(options));
|
|
19760
19054
|
const traceDir = resolveTraceDir({ dir: options.dir });
|
|
19761
19055
|
const cwd = process.cwd();
|
|
19762
19056
|
let resolveResult;
|
|
@@ -20641,42 +19935,67 @@ async function traceDirWritable(traceDir) {
|
|
|
20641
19935
|
};
|
|
20642
19936
|
}
|
|
20643
19937
|
}
|
|
20644
|
-
function
|
|
19938
|
+
function readPackageVersionNearEntry(entryPath, packageName) {
|
|
19939
|
+
let dir = path26__default.default.dirname(path26__default.default.resolve(entryPath));
|
|
19940
|
+
const { root } = path26__default.default.parse(dir);
|
|
19941
|
+
while (true) {
|
|
19942
|
+
const candidate = path26__default.default.join(dir, "package.json");
|
|
19943
|
+
if (fs.existsSync(candidate)) {
|
|
19944
|
+
try {
|
|
19945
|
+
const pkg = JSON.parse(fs.readFileSync(candidate, "utf8"));
|
|
19946
|
+
if (pkg.name === packageName && typeof pkg.version === "string") {
|
|
19947
|
+
return pkg.version;
|
|
19948
|
+
}
|
|
19949
|
+
} catch {
|
|
19950
|
+
}
|
|
19951
|
+
}
|
|
19952
|
+
if (dir === root) break;
|
|
19953
|
+
const parent = path26__default.default.dirname(dir);
|
|
19954
|
+
if (parent === dir) break;
|
|
19955
|
+
dir = parent;
|
|
19956
|
+
}
|
|
19957
|
+
return void 0;
|
|
19958
|
+
}
|
|
19959
|
+
function resolveInstalledPackage(cwd, name) {
|
|
20645
19960
|
const require2 = module$1.createRequire(path26__default.default.join(cwd, "package.json"));
|
|
20646
19961
|
try {
|
|
20647
|
-
const
|
|
20648
|
-
|
|
20649
|
-
|
|
19962
|
+
const entry = require2.resolve(name);
|
|
19963
|
+
let version2;
|
|
19964
|
+
try {
|
|
19965
|
+
const pkgPath = require2.resolve(`${name}/package.json`);
|
|
19966
|
+
const pkg = require2(pkgPath);
|
|
19967
|
+
if (typeof pkg.version === "string") version2 = pkg.version;
|
|
19968
|
+
} catch {
|
|
19969
|
+
version2 = readPackageVersionNearEntry(entry, name);
|
|
19970
|
+
}
|
|
19971
|
+
return { ok: true, version: version2, entry };
|
|
20650
19972
|
} catch {
|
|
20651
19973
|
return { ok: false };
|
|
20652
19974
|
}
|
|
20653
19975
|
}
|
|
20654
19976
|
function importSmoke(cwd) {
|
|
20655
19977
|
const results = [];
|
|
20656
|
-
const
|
|
20657
|
-
|
|
20658
|
-
require2.resolve("agent-inspect");
|
|
19978
|
+
const resolved = resolveInstalledPackage(cwd, "agent-inspect");
|
|
19979
|
+
if (resolved.ok) {
|
|
20659
19980
|
results.push({
|
|
20660
19981
|
id: "import-agent-inspect",
|
|
20661
19982
|
status: "pass",
|
|
20662
|
-
message: "agent-inspect resolves from the current project."
|
|
19983
|
+
message: "agent-inspect resolves from the current project.",
|
|
19984
|
+
evidence: resolved.entry
|
|
20663
19985
|
});
|
|
20664
|
-
|
|
19986
|
+
results.push({
|
|
19987
|
+
id: "import-agent-inspect-cjs",
|
|
19988
|
+
status: "pass",
|
|
19989
|
+
message: "CJS resolution for agent-inspect succeeded.",
|
|
19990
|
+
evidence: resolved.entry
|
|
19991
|
+
});
|
|
19992
|
+
} else {
|
|
20665
19993
|
results.push({
|
|
20666
19994
|
id: "import-agent-inspect",
|
|
20667
19995
|
status: "warn",
|
|
20668
19996
|
message: "agent-inspect is not installed in the current project.",
|
|
20669
19997
|
remediation: "Run npm install agent-inspect (or pnpm add agent-inspect)."
|
|
20670
19998
|
});
|
|
20671
|
-
}
|
|
20672
|
-
try {
|
|
20673
|
-
require2.resolve("agent-inspect/package.json");
|
|
20674
|
-
results.push({
|
|
20675
|
-
id: "import-agent-inspect-cjs",
|
|
20676
|
-
status: "pass",
|
|
20677
|
-
message: "CJS resolution for agent-inspect succeeded."
|
|
20678
|
-
});
|
|
20679
|
-
} catch {
|
|
20680
19999
|
results.push({
|
|
20681
20000
|
id: "import-agent-inspect-cjs",
|
|
20682
20001
|
status: "skipped",
|
|
@@ -20694,7 +20013,7 @@ function optionalPackageChecks(cwd, framework) {
|
|
|
20694
20013
|
"@agent-inspect/eval"
|
|
20695
20014
|
];
|
|
20696
20015
|
return packages.map((name) => {
|
|
20697
|
-
const resolved =
|
|
20016
|
+
const resolved = resolveInstalledPackage(cwd, name);
|
|
20698
20017
|
if (!resolved.ok) {
|
|
20699
20018
|
return {
|
|
20700
20019
|
id: `optional-package-${name}`,
|
|
@@ -20712,7 +20031,7 @@ function optionalPackageChecks(cwd, framework) {
|
|
|
20712
20031
|
});
|
|
20713
20032
|
}
|
|
20714
20033
|
function versionMismatchCheck(cwd) {
|
|
20715
|
-
const root =
|
|
20034
|
+
const root = resolveInstalledPackage(cwd, "agent-inspect");
|
|
20716
20035
|
if (!root.ok || root.version === void 0) {
|
|
20717
20036
|
return {
|
|
20718
20037
|
id: "version-alignment",
|
|
@@ -22074,11 +21393,17 @@ function createCliProgram() {
|
|
|
22074
21393
|
"openinference",
|
|
22075
21394
|
"otlp-json"
|
|
22076
21395
|
])
|
|
22077
|
-
).option("-o, --output <path>", "write export to file (creates parent dirs)").option("--json", "emit JSON wrapper about the export (includes content when writing to stdout)").option("--validate", "validate exported payload shape after generation").option("--include-attributes", "include bounded attributes (review before sharing)").option("--no-metadata", "omit summary / metadata sections").option("--no-errors", "omit error sections").addOption(
|
|
21396
|
+
).option("-o, --output <path>", "write export to file (creates parent dirs)").option("--out <path>", "alias for --output").option("--json", "emit JSON wrapper about the export (includes content when writing to stdout)").option("--validate", "validate exported payload shape after generation").option("--include-attributes", "include bounded attributes (review before sharing)").option("--no-metadata", "omit summary / metadata sections").option("--no-errors", "omit error sections").addOption(
|
|
22078
21397
|
new commander.Option(
|
|
22079
21398
|
"--redaction-profile <profile>",
|
|
22080
21399
|
"redaction profile for exported copies: local, share, strict (default: local)"
|
|
22081
21400
|
).choices(["local", "share", "strict"])
|
|
21401
|
+
).addOption(
|
|
21402
|
+
new commander.Option("--profile <profile>", "alias for --redaction-profile").choices([
|
|
21403
|
+
"local",
|
|
21404
|
+
"share",
|
|
21405
|
+
"strict"
|
|
21406
|
+
])
|
|
22082
21407
|
).action((runId, opts) => {
|
|
22083
21408
|
runCommand(() => exportCommand(runId, opts));
|
|
22084
21409
|
});
|
|
@@ -22214,7 +21539,12 @@ function createCliProgram() {
|
|
|
22214
21539
|
});
|
|
22215
21540
|
program.command("bundle").description("Create a share-safe offline trace bundle (local folder)").argument("[run-id]", "run id to bundle (optional with --session or --since)").option("--dir <path>", "trace directory for run/session lookup").option("--session <session-id>", "bundle all runs in a session").option("--since <duration>", "bundle runs with activity since a duration (e.g. 24h)").addOption(
|
|
22216
21541
|
new commander.Option("--profile <profile>", "redaction profile for exported copies").choices(["local", "share", "strict"]).default("share")
|
|
22217
|
-
).
|
|
21542
|
+
).addOption(
|
|
21543
|
+
new commander.Option(
|
|
21544
|
+
"--redaction-profile <profile>",
|
|
21545
|
+
"alias for --profile (canonical spelling)"
|
|
21546
|
+
).choices(["local", "share", "strict"])
|
|
21547
|
+
).option("--out <path>", "output directory (folder; .zip suffix is stripped)").option("--output <path>", "alias for --out (canonical spelling)").option("--allow-unsafe", "write bundle even when verify-safe reports UNSAFE").option("--json", "print deterministic JSON manifest").action((runId, opts) => {
|
|
22218
21548
|
runCommand(() => bundleCommand(runId, opts));
|
|
22219
21549
|
});
|
|
22220
21550
|
program.command("ci-summary").description("Summarize local reporter artifact manifests for CI").argument("<manifest...>", "reporter artifact manifest JSON files").option("-o, --output <path>", "write Markdown summary to a local file").option("--github-summary <path>", "append Markdown summary to this local file, e.g. GITHUB_STEP_SUMMARY").option("--json", "print deterministic JSON summary").action((manifest, opts) => {
|
|
@@ -22307,7 +21637,7 @@ function createCliProgram() {
|
|
|
22307
21637
|
"markdown",
|
|
22308
21638
|
"html"
|
|
22309
21639
|
])
|
|
22310
|
-
).option("-o, --output <path>", "write report to file (creates parent dirs)").option("--json", "emit JSON wrapper (includes content when writing to stdout)").option("--include-attributes", "include bounded step attributes in tree section").option("--no-errors", "omit error details from tree section").option("--no-correlation", "omit correlation metadata from what section").addOption(
|
|
21640
|
+
).option("-o, --output <path>", "write report to file (creates parent dirs)").option("--out <path>", "alias for --output").option("--json", "emit JSON wrapper (includes content when writing to stdout)").option("--include-attributes", "include bounded step attributes in tree section").option("--no-errors", "omit error details from tree section").option("--no-correlation", "omit correlation metadata from what section").addOption(
|
|
22311
21641
|
new commander.Option("--section <section>", "report section (default: all)").choices([
|
|
22312
21642
|
"all",
|
|
22313
21643
|
"observations",
|
|
@@ -22320,6 +21650,12 @@ function createCliProgram() {
|
|
|
22320
21650
|
"--redaction-profile <profile>",
|
|
22321
21651
|
"redaction profile for entire report: local, share, strict (default: local)"
|
|
22322
21652
|
).choices(["local", "share", "strict"])
|
|
21653
|
+
).addOption(
|
|
21654
|
+
new commander.Option("--profile <profile>", "alias for --redaction-profile").choices([
|
|
21655
|
+
"local",
|
|
21656
|
+
"share",
|
|
21657
|
+
"strict"
|
|
21658
|
+
])
|
|
22323
21659
|
).action((runId, opts) => {
|
|
22324
21660
|
runCommand(() => reportCommand(runId, opts));
|
|
22325
21661
|
});
|
|
@@ -22328,7 +21664,12 @@ function createCliProgram() {
|
|
|
22328
21664
|
"--profile <profile>",
|
|
22329
21665
|
"redaction profile: local, share, strict (default: share)"
|
|
22330
21666
|
).choices(["local", "share", "strict"])
|
|
22331
|
-
).
|
|
21667
|
+
).addOption(
|
|
21668
|
+
new commander.Option(
|
|
21669
|
+
"--redaction-profile <profile>",
|
|
21670
|
+
"alias for --profile (canonical spelling)"
|
|
21671
|
+
).choices(["local", "share", "strict"])
|
|
21672
|
+
).option("-o, --output <path>", "write redacted content to a file").option("--out <path>", "alias for --output").option("--json", "print deterministic JSON wrapper with findings").action((target, opts) => {
|
|
22332
21673
|
runCommand(() => redactCommand(target, opts));
|
|
22333
21674
|
});
|
|
22334
21675
|
program.command("explain").description("Explain a local trace with deterministic facts (no provider calls)").argument("<trace-path-or-run-id>", "trace file, directory, stdin -, or run id").option("--dir <path>", "trace directory for run-id lookup").addOption(
|
|
@@ -22345,6 +21686,12 @@ function createCliProgram() {
|
|
|
22345
21686
|
"--redaction-profile <profile>",
|
|
22346
21687
|
"redaction profile for explanation payload: local, share, strict (default: local)"
|
|
22347
21688
|
).choices(["local", "share", "strict"])
|
|
21689
|
+
).addOption(
|
|
21690
|
+
new commander.Option("--profile <profile>", "alias for --redaction-profile").choices([
|
|
21691
|
+
"local",
|
|
21692
|
+
"share",
|
|
21693
|
+
"strict"
|
|
21694
|
+
])
|
|
22348
21695
|
).action((target, opts) => {
|
|
22349
21696
|
runCommand(() => explainCommand(target, opts));
|
|
22350
21697
|
});
|