agent-inspect 6.31.11 → 6.31.13
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 +12 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-MQYHJL3W.mjs → chunk-ZAYVAHIH.mjs} +206 -34
- package/packages/cli/dist/chunk-ZAYVAHIH.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +413 -67
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +209 -36
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-76R6E2LQ.mjs → src-KP4UIFK5.mjs} +3 -3
- package/packages/cli/dist/{src-76R6E2LQ.mjs.map → src-KP4UIFK5.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +204 -32
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +151 -28
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/{chunk-OAUNS5CS.mjs → chunk-JE3TUFAQ.mjs} +3 -3
- package/packages/core/dist/{chunk-OAUNS5CS.mjs.map → chunk-JE3TUFAQ.mjs.map} +1 -1
- package/packages/core/dist/{chunk-QOC3PJO3.mjs → chunk-NJUSSJX3.mjs} +3 -3
- package/packages/core/dist/{chunk-QOC3PJO3.mjs.map → chunk-NJUSSJX3.mjs.map} +1 -1
- package/packages/core/dist/{chunk-AK5EN4U2.mjs → chunk-YU6XT5A2.mjs} +58 -9
- package/packages/core/dist/chunk-YU6XT5A2.mjs.map +1 -0
- package/packages/core/dist/exporters.cjs +205 -32
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.mjs +205 -32
- package/packages/core/dist/exporters.mjs.map +1 -1
- package/packages/core/dist/logs.cjs +56 -7
- package/packages/core/dist/logs.cjs.map +1 -1
- package/packages/core/dist/logs.mjs +2 -2
- package/packages/core/dist/persisted.cjs +56 -7
- package/packages/core/dist/persisted.cjs.map +1 -1
- package/packages/core/dist/persisted.mjs +3 -3
- package/packages/core/dist/readers.cjs +56 -7
- package/packages/core/dist/readers.cjs.map +1 -1
- package/packages/core/dist/readers.mjs +3 -3
- package/packages/cli/dist/chunk-MQYHJL3W.mjs.map +0 -1
- package/packages/core/dist/chunk-AK5EN4U2.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.31.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- be67c1b: Stability C04–C06: prefer explicit RUN start/end/duration in tree summaries; exclude OUTCOME from execution-step counts and slowest ranking; bounded recursive OTLP AnyValue/int64/uint64 producer validation.
|
|
8
|
+
|
|
9
|
+
## 6.31.12
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 31d187e: Stability C00–C03: reconcile release-state tables to 6.31.11; Promptfoo recipe/reviewer-kit verifier freshness and exact matrix identity; strict nested suite config (no string/typo coercion); OpenAI Node recipe runs SDK create inside inspector.llm with RequestOptions and distinct HTTP vs completion IDs.
|
|
14
|
+
|
|
3
15
|
## 6.31.11
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -213,7 +213,7 @@ The root package is enough for custom capture, the CLI, checks, and Evidence wor
|
|
|
213
213
|
|
|
214
214
|
## Status and documentation
|
|
215
215
|
|
|
216
|
-
**Current published baseline:** **6.31.
|
|
216
|
+
**Current published baseline:** **6.31.13** · persisted schema `1.0` · Node.js `>=20` · MIT.
|
|
217
217
|
|
|
218
218
|
Legacy v0.1 and v0.2 traces remain readable. Check the npm badge and [changelog](CHANGELOG.md) for the current published version.
|
|
219
219
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-inspect",
|
|
3
|
-
"version": "6.31.
|
|
3
|
+
"version": "6.31.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Local evidence debugger and trajectory-test toolkit for TypeScript AI agents — execution trees, TraceContract checks, Evidence v2, and read-only MCP",
|
|
@@ -3002,12 +3002,14 @@ function topKinds(run) {
|
|
|
3002
3002
|
function countErrorNodes(nodes) {
|
|
3003
3003
|
return nodes.filter((entry) => entry.node.event.status === "error").length;
|
|
3004
3004
|
}
|
|
3005
|
+
function isExecutionStepKind(kind) {
|
|
3006
|
+
return kind !== "RUN" && kind !== "OUTCOME";
|
|
3007
|
+
}
|
|
3005
3008
|
function slowestNode(nodes) {
|
|
3006
3009
|
return nodes.filter(
|
|
3007
3010
|
(entry) => entry.node.event.durationMs !== void 0 && // The RUN boundary spans the whole run, so its duration always dominates
|
|
3008
|
-
// and shadows every real step.
|
|
3009
|
-
|
|
3010
|
-
entry.node.event.kind !== "RUN"
|
|
3011
|
+
// and shadows every real step. OUTCOME is a linked result, not execution.
|
|
3012
|
+
isExecutionStepKind(entry.node.event.kind)
|
|
3011
3013
|
).sort((a, b) => {
|
|
3012
3014
|
const delta = (b.node.event.durationMs ?? 0) - (a.node.event.durationMs ?? 0);
|
|
3013
3015
|
return delta !== 0 ? delta : a.index - b.index;
|
|
@@ -3060,6 +3062,12 @@ function buildFacts(run, redactor, events) {
|
|
|
3060
3062
|
const scoped = events.filter((event) => event.runId === run.runId);
|
|
3061
3063
|
const { logicalEvents: logical } = projectLogicalEvents(scoped);
|
|
3062
3064
|
const logicalSteps = logical.filter((event) => event.kind !== "RUN");
|
|
3065
|
+
const executionSteps = logical.filter((event) => isExecutionStepKind(event.kind));
|
|
3066
|
+
const executionByKind = {
|
|
3067
|
+
LLM: executionSteps.filter((event) => event.kind === "LLM").length,
|
|
3068
|
+
TOOL: executionSteps.filter((event) => event.kind === "TOOL").length,
|
|
3069
|
+
LOGIC: executionSteps.filter((event) => event.kind === "LOGIC").length
|
|
3070
|
+
};
|
|
3063
3071
|
facts.push(
|
|
3064
3072
|
fact("run.rawEventCount", "Raw persisted event count", scoped.length, redactor),
|
|
3065
3073
|
fact(
|
|
@@ -3073,9 +3081,21 @@ function buildFacts(run, redactor, events) {
|
|
|
3073
3081
|
"Logical lifecycle event count (including RUN)",
|
|
3074
3082
|
logical.length,
|
|
3075
3083
|
redactor
|
|
3084
|
+
),
|
|
3085
|
+
fact(
|
|
3086
|
+
"run.executionStepCount",
|
|
3087
|
+
"Execution step count (excludes RUN and OUTCOME)",
|
|
3088
|
+
executionSteps.length,
|
|
3089
|
+
redactor
|
|
3090
|
+
),
|
|
3091
|
+
fact(
|
|
3092
|
+
"run.executionStepKinds",
|
|
3093
|
+
"Execution step kind counts",
|
|
3094
|
+
executionByKind,
|
|
3095
|
+
redactor
|
|
3076
3096
|
)
|
|
3077
3097
|
);
|
|
3078
|
-
const slowestLogical = [...
|
|
3098
|
+
const slowestLogical = [...executionSteps].filter((event) => typeof event.durationMs === "number").sort((a, b) => {
|
|
3079
3099
|
const delta = (b.durationMs ?? 0) - (a.durationMs ?? 0);
|
|
3080
3100
|
return delta !== 0 ? delta : a.eventId.localeCompare(b.eventId);
|
|
3081
3101
|
})[0];
|
|
@@ -11324,25 +11344,86 @@ function asStringArray(value, label) {
|
|
|
11324
11344
|
function asPositiveNumber(value, label) {
|
|
11325
11345
|
if (value === void 0) return void 0;
|
|
11326
11346
|
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
11327
|
-
throw new Error(`${label} must be a non-negative number.`);
|
|
11347
|
+
throw new Error(`${label} must be a non-negative finite number.`);
|
|
11328
11348
|
}
|
|
11329
11349
|
return value;
|
|
11330
11350
|
}
|
|
11331
|
-
function
|
|
11351
|
+
function asBoolean(value, label) {
|
|
11332
11352
|
if (value === void 0) return void 0;
|
|
11353
|
+
if (typeof value !== "boolean") {
|
|
11354
|
+
throw new Error(`${label} must be a boolean (not a string or other type).`);
|
|
11355
|
+
}
|
|
11356
|
+
return value;
|
|
11357
|
+
}
|
|
11358
|
+
function assertObject(value, label) {
|
|
11333
11359
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
11334
11360
|
throw new Error(`${label} must be an object.`);
|
|
11335
11361
|
}
|
|
11336
|
-
|
|
11362
|
+
return value;
|
|
11363
|
+
}
|
|
11364
|
+
function assertKnownKeys(raw, allowed, label) {
|
|
11365
|
+
const allowedSet = new Set(allowed);
|
|
11366
|
+
for (const key of Object.keys(raw)) {
|
|
11367
|
+
if (!allowedSet.has(key)) {
|
|
11368
|
+
throw new Error(`${label} has unknown key "${key}".`);
|
|
11369
|
+
}
|
|
11370
|
+
}
|
|
11371
|
+
}
|
|
11372
|
+
var CASE_KEYS = [
|
|
11373
|
+
"id",
|
|
11374
|
+
"trace",
|
|
11375
|
+
"runId",
|
|
11376
|
+
"input",
|
|
11377
|
+
"requireTools",
|
|
11378
|
+
"forbidTools",
|
|
11379
|
+
"maxDurationMs",
|
|
11380
|
+
"expectedObservations",
|
|
11381
|
+
"expect"
|
|
11382
|
+
];
|
|
11383
|
+
var EXPECT_KEYS = [
|
|
11384
|
+
"checkStatus",
|
|
11385
|
+
"findingRuleIds",
|
|
11386
|
+
"rejectUnexpectedFindings",
|
|
11387
|
+
"minAssertions"
|
|
11388
|
+
];
|
|
11389
|
+
var CHECKS_KEYS = ["select", "run", "tool", "llm"];
|
|
11390
|
+
var CHECKS_RUN_KEYS = ["maxDurationMs", "maxDepth"];
|
|
11391
|
+
var CHECKS_TOOL_KEYS = ["required", "forbidden"];
|
|
11392
|
+
var CHECKS_LLM_KEYS = ["allowedModels", "maxTotalTokens"];
|
|
11393
|
+
var EVAL_KEYS = [
|
|
11394
|
+
"requireSuccess",
|
|
11395
|
+
"requiredTools",
|
|
11396
|
+
"forbiddenTools",
|
|
11397
|
+
"maxDurationMs",
|
|
11398
|
+
"maxDepth",
|
|
11399
|
+
"maxRetries",
|
|
11400
|
+
"maxTotalTokens"
|
|
11401
|
+
];
|
|
11402
|
+
var ROOT_KEYS = [
|
|
11403
|
+
"name",
|
|
11404
|
+
"traces",
|
|
11405
|
+
"cases",
|
|
11406
|
+
"checks",
|
|
11407
|
+
"eval",
|
|
11408
|
+
"redactionProfile",
|
|
11409
|
+
"artifacts",
|
|
11410
|
+
"baseline",
|
|
11411
|
+
"candidate"
|
|
11412
|
+
];
|
|
11413
|
+
function asExpectConfig(value, label) {
|
|
11414
|
+
if (value === void 0) return void 0;
|
|
11415
|
+
const raw = assertObject(value, label);
|
|
11416
|
+
assertKnownKeys(raw, EXPECT_KEYS, label);
|
|
11337
11417
|
const checkStatus = raw.checkStatus;
|
|
11338
11418
|
if (checkStatus !== "pass" && checkStatus !== "fail" && checkStatus !== "error") {
|
|
11339
11419
|
throw new Error(`${label}.checkStatus must be "pass", "fail", or "error".`);
|
|
11340
11420
|
}
|
|
11341
11421
|
const findingRuleIds = asStringArray(raw.findingRuleIds, `${label}.findingRuleIds`);
|
|
11342
11422
|
const minAssertions = asPositiveNumber(raw.minAssertions, `${label}.minAssertions`);
|
|
11343
|
-
const rejectUnexpectedFindings =
|
|
11344
|
-
|
|
11345
|
-
|
|
11423
|
+
const rejectUnexpectedFindings = asBoolean(
|
|
11424
|
+
raw.rejectUnexpectedFindings,
|
|
11425
|
+
`${label}.rejectUnexpectedFindings`
|
|
11426
|
+
);
|
|
11346
11427
|
return {
|
|
11347
11428
|
checkStatus,
|
|
11348
11429
|
...findingRuleIds !== void 0 ? { findingRuleIds } : {},
|
|
@@ -11350,6 +11431,56 @@ function asExpectConfig(value, label) {
|
|
|
11350
11431
|
...minAssertions !== void 0 ? { minAssertions } : {}
|
|
11351
11432
|
};
|
|
11352
11433
|
}
|
|
11434
|
+
function asChecksConfig(value, label) {
|
|
11435
|
+
const raw = assertObject(value, label);
|
|
11436
|
+
assertKnownKeys(raw, CHECKS_KEYS, label);
|
|
11437
|
+
const checks = {};
|
|
11438
|
+
const select = asStringArray(raw.select, `${label}.select`);
|
|
11439
|
+
if (select !== void 0) checks.select = select;
|
|
11440
|
+
if (raw.run !== void 0) {
|
|
11441
|
+
const run = assertObject(raw.run, `${label}.run`);
|
|
11442
|
+
assertKnownKeys(run, CHECKS_RUN_KEYS, `${label}.run`);
|
|
11443
|
+
checks.run = {
|
|
11444
|
+
...asPositiveNumber(run.maxDurationMs, `${label}.run.maxDurationMs`) !== void 0 ? { maxDurationMs: asPositiveNumber(run.maxDurationMs, `${label}.run.maxDurationMs`) } : {},
|
|
11445
|
+
...asPositiveNumber(run.maxDepth, `${label}.run.maxDepth`) !== void 0 ? { maxDepth: asPositiveNumber(run.maxDepth, `${label}.run.maxDepth`) } : {}
|
|
11446
|
+
};
|
|
11447
|
+
}
|
|
11448
|
+
if (raw.tool !== void 0) {
|
|
11449
|
+
const tool = assertObject(raw.tool, `${label}.tool`);
|
|
11450
|
+
assertKnownKeys(tool, CHECKS_TOOL_KEYS, `${label}.tool`);
|
|
11451
|
+
checks.tool = {
|
|
11452
|
+
...asStringArray(tool.required, `${label}.tool.required`) !== void 0 ? { required: asStringArray(tool.required, `${label}.tool.required`) } : {},
|
|
11453
|
+
...asStringArray(tool.forbidden, `${label}.tool.forbidden`) !== void 0 ? { forbidden: asStringArray(tool.forbidden, `${label}.tool.forbidden`) } : {}
|
|
11454
|
+
};
|
|
11455
|
+
}
|
|
11456
|
+
if (raw.llm !== void 0) {
|
|
11457
|
+
const llm = assertObject(raw.llm, `${label}.llm`);
|
|
11458
|
+
assertKnownKeys(llm, CHECKS_LLM_KEYS, `${label}.llm`);
|
|
11459
|
+
checks.llm = {
|
|
11460
|
+
...asStringArray(llm.allowedModels, `${label}.llm.allowedModels`) !== void 0 ? { allowedModels: asStringArray(llm.allowedModels, `${label}.llm.allowedModels`) } : {},
|
|
11461
|
+
...asPositiveNumber(llm.maxTotalTokens, `${label}.llm.maxTotalTokens`) !== void 0 ? {
|
|
11462
|
+
maxTotalTokens: asPositiveNumber(
|
|
11463
|
+
llm.maxTotalTokens,
|
|
11464
|
+
`${label}.llm.maxTotalTokens`
|
|
11465
|
+
)
|
|
11466
|
+
} : {}
|
|
11467
|
+
};
|
|
11468
|
+
}
|
|
11469
|
+
return checks;
|
|
11470
|
+
}
|
|
11471
|
+
function asEvalConfig(value, label) {
|
|
11472
|
+
const raw = assertObject(value, label);
|
|
11473
|
+
assertKnownKeys(raw, EVAL_KEYS, label);
|
|
11474
|
+
return {
|
|
11475
|
+
...asBoolean(raw.requireSuccess, `${label}.requireSuccess`) !== void 0 ? { requireSuccess: asBoolean(raw.requireSuccess, `${label}.requireSuccess`) } : {},
|
|
11476
|
+
...asStringArray(raw.requiredTools, `${label}.requiredTools`) !== void 0 ? { requiredTools: asStringArray(raw.requiredTools, `${label}.requiredTools`) } : {},
|
|
11477
|
+
...asStringArray(raw.forbiddenTools, `${label}.forbiddenTools`) !== void 0 ? { forbiddenTools: asStringArray(raw.forbiddenTools, `${label}.forbiddenTools`) } : {},
|
|
11478
|
+
...asPositiveNumber(raw.maxDurationMs, `${label}.maxDurationMs`) !== void 0 ? { maxDurationMs: asPositiveNumber(raw.maxDurationMs, `${label}.maxDurationMs`) } : {},
|
|
11479
|
+
...asPositiveNumber(raw.maxDepth, `${label}.maxDepth`) !== void 0 ? { maxDepth: asPositiveNumber(raw.maxDepth, `${label}.maxDepth`) } : {},
|
|
11480
|
+
...asPositiveNumber(raw.maxRetries, `${label}.maxRetries`) !== void 0 ? { maxRetries: asPositiveNumber(raw.maxRetries, `${label}.maxRetries`) } : {},
|
|
11481
|
+
...asPositiveNumber(raw.maxTotalTokens, `${label}.maxTotalTokens`) !== void 0 ? { maxTotalTokens: asPositiveNumber(raw.maxTotalTokens, `${label}.maxTotalTokens`) } : {}
|
|
11482
|
+
};
|
|
11483
|
+
}
|
|
11353
11484
|
function validateCaseConfig(value, index) {
|
|
11354
11485
|
const diagnostics = [];
|
|
11355
11486
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -11360,6 +11491,7 @@ function validateCaseConfig(value, index) {
|
|
|
11360
11491
|
}
|
|
11361
11492
|
const raw = value;
|
|
11362
11493
|
try {
|
|
11494
|
+
assertKnownKeys(raw, CASE_KEYS, `cases[${index}]`);
|
|
11363
11495
|
const id = asString(raw.id, `cases[${index}].id`);
|
|
11364
11496
|
if (id === void 0) {
|
|
11365
11497
|
diagnostics.push(
|
|
@@ -11408,6 +11540,7 @@ function normalizeSuiteConfig(value) {
|
|
|
11408
11540
|
throw new Error("Suite config must export an object.");
|
|
11409
11541
|
}
|
|
11410
11542
|
const raw = value;
|
|
11543
|
+
assertKnownKeys(raw, ROOT_KEYS, "suite config");
|
|
11411
11544
|
const name = asString(raw.name, "name");
|
|
11412
11545
|
const traces = asString(raw.traces, "traces");
|
|
11413
11546
|
if (name === void 0) throw new Error("name is required.");
|
|
@@ -11436,25 +11569,15 @@ function normalizeSuiteConfig(value) {
|
|
|
11436
11569
|
}
|
|
11437
11570
|
const config = { name, traces, cases };
|
|
11438
11571
|
if (raw.checks !== void 0) {
|
|
11439
|
-
|
|
11440
|
-
throw new Error("checks must be an object.");
|
|
11441
|
-
}
|
|
11442
|
-
config.checks = raw.checks;
|
|
11572
|
+
config.checks = asChecksConfig(raw.checks, "checks");
|
|
11443
11573
|
}
|
|
11444
11574
|
if (raw.eval !== void 0) {
|
|
11445
|
-
|
|
11446
|
-
throw new Error("eval must be an object.");
|
|
11447
|
-
}
|
|
11448
|
-
config.eval = raw.eval;
|
|
11575
|
+
config.eval = asEvalConfig(raw.eval, "eval");
|
|
11449
11576
|
}
|
|
11450
11577
|
if (raw.artifacts !== void 0) {
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
const outputDir = asString(
|
|
11455
|
-
raw.artifacts.outputDir,
|
|
11456
|
-
"artifacts.outputDir"
|
|
11457
|
-
);
|
|
11578
|
+
const artifacts = assertObject(raw.artifacts, "artifacts");
|
|
11579
|
+
assertKnownKeys(artifacts, ["outputDir"], "artifacts");
|
|
11580
|
+
const outputDir = asString(artifacts.outputDir, "artifacts.outputDir");
|
|
11458
11581
|
config.artifacts = outputDir !== void 0 ? { outputDir } : {};
|
|
11459
11582
|
}
|
|
11460
11583
|
if (raw.baseline !== void 0) {
|
|
@@ -12007,18 +12130,16 @@ var TreeBuilder = class {
|
|
|
12007
12130
|
inc(confidenceBreakdown, e.confidence);
|
|
12008
12131
|
kinds[e.kind] = (kinds[e.kind] ?? 0) + 1;
|
|
12009
12132
|
}
|
|
12010
|
-
const startedAt = sorted.length > 0 ? sorted[0].timestamp : void 0;
|
|
12011
|
-
const endedAt = sorted.length > 0 ? sorted[sorted.length - 1].timestamp : void 0;
|
|
12012
|
-
const status = computeRunStatus(sorted);
|
|
12013
|
-
const durationMs = startedAt !== void 0 && endedAt !== void 0 && Number.isFinite(startedAt) && Number.isFinite(endedAt) && endedAt >= startedAt && status !== "running" ? endedAt - startedAt : void 0;
|
|
12014
12133
|
const name = sorted.find((e) => e.kind === "RUN")?.name;
|
|
12134
|
+
const status = computeRunStatus(sorted);
|
|
12135
|
+
const timing = resolveRunTiming(sorted, status);
|
|
12015
12136
|
out.push({
|
|
12016
12137
|
runId,
|
|
12017
12138
|
name,
|
|
12018
12139
|
status,
|
|
12019
|
-
startedAt,
|
|
12020
|
-
endedAt:
|
|
12021
|
-
durationMs,
|
|
12140
|
+
startedAt: timing.startedAt,
|
|
12141
|
+
endedAt: timing.endedAt,
|
|
12142
|
+
durationMs: timing.durationMs,
|
|
12022
12143
|
children: roots,
|
|
12023
12144
|
metadata: {
|
|
12024
12145
|
totalEvents: sorted.length,
|
|
@@ -12032,6 +12153,57 @@ var TreeBuilder = class {
|
|
|
12032
12153
|
return out;
|
|
12033
12154
|
}
|
|
12034
12155
|
};
|
|
12156
|
+
function resolveRunTiming(sorted, status) {
|
|
12157
|
+
let startedAtMs;
|
|
12158
|
+
let endedAtMs;
|
|
12159
|
+
let explicitDurationMs;
|
|
12160
|
+
for (const event of sorted) {
|
|
12161
|
+
if (event.kind !== "RUN") continue;
|
|
12162
|
+
const attrs = event.attributes ?? {};
|
|
12163
|
+
if (typeof attrs.startedAtMs === "number" && Number.isFinite(attrs.startedAtMs)) {
|
|
12164
|
+
startedAtMs = startedAtMs === void 0 ? attrs.startedAtMs : Math.min(startedAtMs, attrs.startedAtMs);
|
|
12165
|
+
}
|
|
12166
|
+
if (typeof attrs.endedAtMs === "number" && Number.isFinite(attrs.endedAtMs)) {
|
|
12167
|
+
endedAtMs = endedAtMs === void 0 ? attrs.endedAtMs : Math.max(endedAtMs, attrs.endedAtMs);
|
|
12168
|
+
}
|
|
12169
|
+
if ((event.status === "ok" || event.status === "error") && typeof event.durationMs === "number" && Number.isFinite(event.durationMs) && event.durationMs >= 0) {
|
|
12170
|
+
explicitDurationMs = event.durationMs;
|
|
12171
|
+
if (endedAtMs === void 0 && startedAtMs !== void 0) {
|
|
12172
|
+
endedAtMs = startedAtMs + event.durationMs;
|
|
12173
|
+
} else if (endedAtMs === void 0 && Number.isFinite(event.timestamp)) {
|
|
12174
|
+
endedAtMs = event.timestamp + event.durationMs;
|
|
12175
|
+
if (startedAtMs === void 0) {
|
|
12176
|
+
startedAtMs = event.timestamp;
|
|
12177
|
+
}
|
|
12178
|
+
}
|
|
12179
|
+
}
|
|
12180
|
+
if (startedAtMs === void 0 && event.status === "running" && Number.isFinite(event.timestamp)) {
|
|
12181
|
+
startedAtMs = event.timestamp;
|
|
12182
|
+
}
|
|
12183
|
+
}
|
|
12184
|
+
if (startedAtMs !== void 0 && endedAtMs !== void 0 && Number.isFinite(startedAtMs) && Number.isFinite(endedAtMs) && endedAtMs >= startedAtMs && status !== "running") {
|
|
12185
|
+
return {
|
|
12186
|
+
startedAt: startedAtMs,
|
|
12187
|
+
endedAt: endedAtMs,
|
|
12188
|
+
durationMs: endedAtMs - startedAtMs
|
|
12189
|
+
};
|
|
12190
|
+
}
|
|
12191
|
+
if (startedAtMs !== void 0 && explicitDurationMs !== void 0 && status !== "running") {
|
|
12192
|
+
return {
|
|
12193
|
+
startedAt: startedAtMs,
|
|
12194
|
+
endedAt: startedAtMs + explicitDurationMs,
|
|
12195
|
+
durationMs: explicitDurationMs
|
|
12196
|
+
};
|
|
12197
|
+
}
|
|
12198
|
+
const startedAt = sorted.length > 0 ? sorted[0].timestamp : void 0;
|
|
12199
|
+
const endedAt = sorted.length > 0 ? sorted[sorted.length - 1].timestamp : void 0;
|
|
12200
|
+
const durationMs = startedAt !== void 0 && endedAt !== void 0 && Number.isFinite(startedAt) && Number.isFinite(endedAt) && endedAt >= startedAt && status !== "running" ? endedAt - startedAt : void 0;
|
|
12201
|
+
return {
|
|
12202
|
+
startedAt,
|
|
12203
|
+
endedAt: status === "running" ? void 0 : endedAt,
|
|
12204
|
+
durationMs
|
|
12205
|
+
};
|
|
12206
|
+
}
|
|
12035
12207
|
|
|
12036
12208
|
// packages/core/src/persisted/to-inspect-event.ts
|
|
12037
12209
|
function compactAttributes3(entries) {
|
|
@@ -15375,5 +15547,5 @@ function renderGateReport(result, options = {}) {
|
|
|
15375
15547
|
}
|
|
15376
15548
|
|
|
15377
15549
|
export { ATTRIBUTION_CONFIDENCES, COHORT_METRIC_IDS, DEFAULT_REDACT_KEYS, DEFAULT_SUITE_ARTIFACTS_DIR, EVIDENCE_FORMAT_VERSION, EVIDENCE_HTML_FILENAME, EVIDENCE_MANIFEST_FILENAME, Redactor, TraceDirectory, TraceReadError, TreeBuilder, aggregateBundleSafeStatus, aggregateSessionCheckResults, analyzeCohort, applyProfileMetadataCaps, assertBundlePathContained, assertEvidenceRelativePath, buildActivitySummary, buildBundleMetadata, buildBundleSummaryMarkdown, buildEvidenceCausalFailureViewHtml, buildEvidenceCiPackage, buildEvidenceCircuitViewHtml, buildEvidenceContractsViewHtml, buildEvidenceDiffViewHtml, buildEvidenceHtmlShell, buildEvidenceManifest, buildEvidenceOutcomesViewHtml, buildEvidenceProvenanceViewHtml, buildEvidenceSafetyViewHtml, buildEvidenceTimelineViewHtml, buildEvidenceToolsLlmViewHtml, buildEvidenceTreeViewHtml, buildLocalExplanation, buildPlaceholderArtifact, buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildSessionIndex, buildTraceStats, buildZipArchive, bundleFailsOnSafety, bundleRunAssetRelativePath, collectTraceSchemaVersions, compactAttributes, createBaselineRegressionRule, createLlmUsageRule, createMaxStepDurationRule, createObservedOutcomeRule, createRequireCompletedRule, createRunDepthRule, createRunDurationRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStructureCycleRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolUsageRule, defaultBundleOutputPath, defaultSuiteConfigTemplate, defineTraceContract, diffRuns, diffTraceEvents, enrichSessionRunRecord, escapeHtml, escapeMarkdown, evaluateTraceContract, extractMetadata, extractOutcomesFromTraceEvents, filterMetasBySessionScope, filterTraces, flattenTree, formatDuration2 as formatDuration, formatStepLabel, formatTimestamp, gateHasThresholds, getIndent, getTraceFilePath, inferEvidenceFileRole, isAgentInspectTrace, isAttributionConfidence, isCredentialSensitiveKey, isPersistedInspectEvent, loadSessionRunRecords, loadSuiteConfig, loadTraceMetadataList, manualTraceEventsToComparableRun, nanoid, normalizeBundleOutputPath, openTrace, parseCohortMetricList, parseDuration, parseDurationFilter, parseGateList, parseTraceJsonl, persistedInspectEventsToRunTrees, persistedInspectEventsToTraceEvents, projectLogicalEvents, renderActivitySummaryHuman, renderCohortReport, renderErrorLine, renderGateReport, renderObservedOutcomesHtml, renderObservedOutcomesMarkdown, renderRunDiff, renderRunWhat, renderStepLine, renderSuiteReport, renderTimeline, renderTraceStats, resolveBundleRunIds, resolveRedactionProfile, resolveSuiteTemplate, resolveTraceDir, runGate, runSuite, runTraceChecks, safeString, sanitizeBundleRunId, searchTraces, serializeEvidenceManifest, sha256Hex, stableJson, stringContainsHighConfidenceCredential, summarizeObservedOutcomes, summarizeSemanticParity, traceEventToPersistedInspectEvent, truncateName, truncateStringForProfile, validateEvent, validateSuiteConfig, verifyEvidenceDirectory, zeroKinds };
|
|
15378
|
-
//# sourceMappingURL=chunk-
|
|
15379
|
-
//# sourceMappingURL=chunk-
|
|
15550
|
+
//# sourceMappingURL=chunk-ZAYVAHIH.mjs.map
|
|
15551
|
+
//# sourceMappingURL=chunk-ZAYVAHIH.mjs.map
|