agent-inspect 6.14.1 → 6.14.2
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 +11 -1
- package/docs/KNOWN-ISSUES.md +2 -1
- package/package.json +2 -2
- package/packages/cli/dist/{chunk-MEO2Z3KE.mjs → chunk-AACUXCHT.mjs} +205 -35
- package/packages/cli/dist/chunk-AACUXCHT.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +265 -35
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +59 -6
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-6VZNGIF6.mjs → src-ABTS4GO4.mjs} +3 -3
- package/packages/cli/dist/{src-6VZNGIF6.mjs.map → src-ABTS4GO4.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +156 -19
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +17 -9
- package/packages/core/dist/advanced.d.ts +17 -9
- package/packages/core/dist/advanced.mjs +6 -6
- package/packages/core/dist/checks.cjs +108 -18
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.d.cts +4 -4
- package/packages/core/dist/checks.d.ts +4 -4
- package/packages/core/dist/checks.mjs +1 -1
- package/packages/core/dist/{chunk-CTA6XNDP.mjs → chunk-5N2OBM7S.mjs} +3 -3
- package/packages/core/dist/{chunk-CTA6XNDP.mjs.map → chunk-5N2OBM7S.mjs.map} +1 -1
- package/packages/core/dist/chunk-AK5EN4U2.mjs +174 -0
- package/packages/core/dist/chunk-AK5EN4U2.mjs.map +1 -0
- package/packages/core/dist/{chunk-BS2QCAJX.mjs → chunk-BHMXLDLK.mjs} +110 -20
- package/packages/core/dist/chunk-BHMXLDLK.mjs.map +1 -0
- package/packages/core/dist/{chunk-UOPVGCOB.mjs → chunk-NXQF73EC.mjs} +3 -3
- package/packages/core/dist/{chunk-UOPVGCOB.mjs.map → chunk-NXQF73EC.mjs.map} +1 -1
- package/packages/core/dist/{chunk-LFWZEO2L.mjs → chunk-SGL4JGCD.mjs} +3 -3
- package/packages/core/dist/{chunk-LFWZEO2L.mjs.map → chunk-SGL4JGCD.mjs.map} +1 -1
- package/packages/core/dist/{context-BHAgRjOe.d.cts → context-Ca5yK8Cs.d.cts} +3 -3
- package/packages/core/dist/{context-Blyjb5my.d.ts → context-D6cS4XIL.d.ts} +3 -3
- package/packages/core/dist/diff.d.cts +3 -3
- package/packages/core/dist/diff.d.ts +3 -3
- package/packages/core/dist/exporters.d.cts +3 -3
- package/packages/core/dist/exporters.d.ts +3 -3
- package/packages/core/dist/exporters.mjs +1 -1
- package/packages/core/dist/{index-CmXMS-MF.d.cts → index-BY6XZ5aG.d.cts} +3 -3
- package/packages/core/dist/{index-Bu_vOjql.d.ts → index-D9HBequ_.d.ts} +3 -3
- package/packages/core/dist/index.d.cts +6 -6
- package/packages/core/dist/index.d.ts +6 -6
- package/packages/core/dist/{inspect-event-DVg84S4v.d.cts → inspect-event-DRthdZlf.d.cts} +9 -0
- package/packages/core/dist/{inspect-event-DVg84S4v.d.ts → inspect-event-DRthdZlf.d.ts} +9 -0
- package/packages/core/dist/{log-config-BG1WmWf2.d.cts → log-config-CFlIJHTf.d.cts} +1 -1
- package/packages/core/dist/{log-config-Ck0aT_Ou.d.ts → log-config-OZRfpHED.d.ts} +1 -1
- package/packages/core/dist/logs.cjs +95 -15
- package/packages/core/dist/logs.cjs.map +1 -1
- package/packages/core/dist/logs.d.cts +3 -3
- package/packages/core/dist/logs.d.ts +3 -3
- package/packages/core/dist/logs.mjs +2 -2
- package/packages/core/dist/{persisted-inspect-event-ChE7pGb7.d.ts → persisted-inspect-event-BVucFVrP.d.ts} +1 -1
- package/packages/core/dist/{persisted-inspect-event-d-mSP8kd.d.cts → persisted-inspect-event-CVZWZldL.d.cts} +1 -1
- package/packages/core/dist/persisted.cjs +95 -15
- package/packages/core/dist/persisted.cjs.map +1 -1
- package/packages/core/dist/persisted.d.cts +5 -5
- package/packages/core/dist/persisted.d.ts +5 -5
- package/packages/core/dist/persisted.mjs +3 -3
- package/packages/core/dist/readers.cjs +95 -15
- package/packages/core/dist/readers.cjs.map +1 -1
- package/packages/core/dist/readers.d.cts +2 -2
- package/packages/core/dist/readers.d.ts +2 -2
- package/packages/core/dist/readers.mjs +3 -3
- package/packages/core/dist/{types-MuwXSJ4b.d.ts → types--ainI31J.d.ts} +1 -1
- package/packages/core/dist/{types-BLX3tiOW.d.cts → types-UnrNaTo2.d.cts} +1 -1
- package/packages/core/dist/writers.d.cts +2 -2
- package/packages/core/dist/writers.d.ts +2 -2
- package/packages/cli/dist/chunk-MEO2Z3KE.mjs.map +0 -1
- package/packages/core/dist/chunk-BS2QCAJX.mjs.map +0 -1
- package/packages/core/dist/chunk-T5MASTIW.mjs +0 -94
- package/packages/core/dist/chunk-T5MASTIW.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.14.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4850b62: Swarm relationship and safety precision: fix self-parent capture/ordering, normalize legacy self-edges, cycle-safe trees, and stop treating token-configuration fields as credentials.
|
|
8
|
+
|
|
3
9
|
## 6.14.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -10,7 +16,11 @@
|
|
|
10
16
|
|
|
11
17
|
### Patch
|
|
12
18
|
|
|
13
|
-
- (
|
|
19
|
+
- Swarm relationship and safety precision (6.14.2): parent resolution before child index registration, self-parent capture/logical defenses, cycle-safe trees, contextual credential-key classification (token config fields such as `ls_max_tokens` are not credentials), and moderate/deep-swarm regression fixtures with packed check→gate→bundle→verify E2E.
|
|
20
|
+
|
|
21
|
+
### Documentation
|
|
22
|
+
|
|
23
|
+
- Activate the v6.14.1 swarm stability roadmap (`6.14.2` → `6.16.0` → conditional v7): baseline audit, release-train plans, and AGENTS/state precedence. No runtime or schema change in this docs activation.
|
|
14
24
|
|
|
15
25
|
## 6.14.0
|
|
16
26
|
|
package/docs/KNOWN-ISSUES.md
CHANGED
|
@@ -33,8 +33,9 @@ AgentInspect is **local-first** and **CLI-first**. These behaviors are intention
|
|
|
33
33
|
- **LangGraph support** is currently a documented boundary through `@agent-inspect/langchain`, not a dedicated package.
|
|
34
34
|
- **LangChain adapter** captures **metadata-oriented** signals by default; it does not replace full framework observability.
|
|
35
35
|
- **LangChain `stream: true`** records chunk counts and timing only — not a full token replay. Per-token JSONL events are not emitted.
|
|
36
|
+
- **Deep swarm / nested RunnableSequence (6.14.2+):** capture resolves parents before registering child indexes and rejects `parentId === stepId`. Legacy traces that still contain self-parent edges are normalized in logical projection (`AI_LOGICAL_SELF_PARENT_REMOVED`) and rendered with visibility-first, cycle-safe trees so nested LLM/tool steps remain visible.
|
|
36
37
|
- **Correlation metadata** (`correlationId`, `requestId`, `decisionId`, `groupId`) is written on `run_started` but **CLI list/view does not filter by correlation fields** yet.
|
|
37
|
-
- **Built-in check/contract semantics (6.12.2+)** use an additive `logicalEvents` projection that pairs v0.1 start/complete rows. Custom rules that only read raw `context.events` still see bridged `running` TOOL starts and separate LOGIC completions—opt into `logicalEvents` for lifecycle-aware matching. Formal `TraceFacts` promotion
|
|
38
|
+
- **Built-in check/contract semantics (6.12.2+)** use an additive `logicalEvents` projection that pairs v0.1 start/complete rows. Custom rules that only read raw `context.events` still see bridged `running` TOOL starts and separate LOGIC completions—opt into `logicalEvents` for lifecycle-aware matching. Formal `TraceFacts` promotion shipped experimentally in 6.13.
|
|
38
39
|
|
|
39
40
|
## Structured log parsing
|
|
40
41
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-inspect",
|
|
3
|
-
"version": "6.14.
|
|
3
|
+
"version": "6.14.2",
|
|
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",
|
|
@@ -234,7 +234,7 @@
|
|
|
234
234
|
"test:all": "pnpm run typecheck && pnpm run linked-versions:check && pnpm run build && pnpm run test && pnpm run size",
|
|
235
235
|
"prepublish:checks": "pnpm run typecheck && pnpm run test && pnpm run test:coverage && pnpm run build && pnpm run fixtures:check && pnpm run recipes:check && pnpm run size && pnpm run linked-versions:check && pnpm run pack:smoke",
|
|
236
236
|
"pack:dry-run": "pnpm run build && npm pack --dry-run",
|
|
237
|
-
"pack:smoke": "pnpm run build && node scripts/package-smoke.mjs && node scripts/packed-quickstart-e2e.mjs && node scripts/packed-semantic-loop-e2e.mjs",
|
|
237
|
+
"pack:smoke": "pnpm run build && node scripts/package-smoke.mjs && node scripts/packed-quickstart-e2e.mjs && node scripts/packed-semantic-loop-e2e.mjs && node scripts/packed-swarm-loop-e2e.mjs",
|
|
238
238
|
"linked-versions:check": "node scripts/check-linked-versions.mjs",
|
|
239
239
|
"docs:commands": "node scripts/validate-doc-commands.mjs",
|
|
240
240
|
"docs:links": "node scripts/validate-doc-links.mjs",
|
|
@@ -6047,6 +6047,23 @@ function projectLogicalEvents(events) {
|
|
|
6047
6047
|
}
|
|
6048
6048
|
}
|
|
6049
6049
|
if (!remapped) {
|
|
6050
|
+
if (originalParentId === event.eventId) {
|
|
6051
|
+
diagnostics.push({
|
|
6052
|
+
code: "AI_LOGICAL_SELF_PARENT_REMOVED",
|
|
6053
|
+
message: `Removed self-parent edge on ${event.eventId}.`,
|
|
6054
|
+
eventIds: [event.eventId]
|
|
6055
|
+
});
|
|
6056
|
+
const { parentId: _drop, ...rest } = event;
|
|
6057
|
+
normalized.push({
|
|
6058
|
+
...rest,
|
|
6059
|
+
projection: {
|
|
6060
|
+
...event.projection,
|
|
6061
|
+
parentNormalized: true,
|
|
6062
|
+
originalParentId
|
|
6063
|
+
}
|
|
6064
|
+
});
|
|
6065
|
+
continue;
|
|
6066
|
+
}
|
|
6050
6067
|
if (!logicalById.has(originalParentId) && !logicalByRawId.has(originalParentId)) {
|
|
6051
6068
|
const mapping = event.attributes?.parentMapping;
|
|
6052
6069
|
const unresolved = mapping === "unresolved" || event.attributes?.parentUnresolved === true || event.attributes?.unresolvedParent === true || // LangGraph/framework scaffolding sentinel labels are not event ids.
|
|
@@ -6062,6 +6079,23 @@ function projectLogicalEvents(events) {
|
|
|
6062
6079
|
normalized.push(event);
|
|
6063
6080
|
continue;
|
|
6064
6081
|
}
|
|
6082
|
+
if (nextParent === event.eventId) {
|
|
6083
|
+
diagnostics.push({
|
|
6084
|
+
code: "AI_LOGICAL_SELF_PARENT_REMOVED",
|
|
6085
|
+
message: `Removed self-parent edge on ${event.eventId} (was ${originalParentId}).`,
|
|
6086
|
+
eventIds: [event.eventId]
|
|
6087
|
+
});
|
|
6088
|
+
const { parentId: _drop, ...rest } = event;
|
|
6089
|
+
normalized.push({
|
|
6090
|
+
...rest,
|
|
6091
|
+
projection: {
|
|
6092
|
+
...event.projection,
|
|
6093
|
+
parentNormalized: true,
|
|
6094
|
+
originalParentId
|
|
6095
|
+
}
|
|
6096
|
+
});
|
|
6097
|
+
continue;
|
|
6098
|
+
}
|
|
6065
6099
|
diagnostics.push({
|
|
6066
6100
|
code: "AI_LOGICAL_PARENT_REMAPPED",
|
|
6067
6101
|
message: `Remapped parent ${originalParentId} \u2192 ${nextParent} for ${event.eventId}.`,
|
|
@@ -6135,6 +6169,73 @@ function summarizeSemanticParity(events) {
|
|
|
6135
6169
|
};
|
|
6136
6170
|
}
|
|
6137
6171
|
|
|
6172
|
+
// packages/core/src/safety/sensitive-key.ts
|
|
6173
|
+
function normalizeSensitiveKey(value) {
|
|
6174
|
+
return value.toLowerCase().replace(/[^a-z0-9_]/g, "");
|
|
6175
|
+
}
|
|
6176
|
+
var NON_CREDENTIAL_TOKEN_CONFIG_KEYS = new Set(
|
|
6177
|
+
[
|
|
6178
|
+
"tokens",
|
|
6179
|
+
"max_tokens",
|
|
6180
|
+
"min_tokens",
|
|
6181
|
+
"ls_max_tokens",
|
|
6182
|
+
"token_count",
|
|
6183
|
+
"token_limit",
|
|
6184
|
+
"token_budget",
|
|
6185
|
+
"input_tokens",
|
|
6186
|
+
"output_tokens",
|
|
6187
|
+
"total_tokens",
|
|
6188
|
+
"cached_tokens",
|
|
6189
|
+
"prompt_tokens",
|
|
6190
|
+
"completion_tokens"
|
|
6191
|
+
].map(normalizeSensitiveKey)
|
|
6192
|
+
);
|
|
6193
|
+
var DEFAULT_CREDENTIAL_SENSITIVE_KEYS = [
|
|
6194
|
+
"authorization",
|
|
6195
|
+
"cookie",
|
|
6196
|
+
"token",
|
|
6197
|
+
"access_token",
|
|
6198
|
+
"accesstoken",
|
|
6199
|
+
"auth_token",
|
|
6200
|
+
"authtoken",
|
|
6201
|
+
"refresh_token",
|
|
6202
|
+
"refreshtoken",
|
|
6203
|
+
"id_token",
|
|
6204
|
+
"idtoken",
|
|
6205
|
+
"bearer_token",
|
|
6206
|
+
"bearertoken",
|
|
6207
|
+
"api_token",
|
|
6208
|
+
"apitoken",
|
|
6209
|
+
"apikey",
|
|
6210
|
+
"api_key",
|
|
6211
|
+
"password",
|
|
6212
|
+
"secret",
|
|
6213
|
+
"email"
|
|
6214
|
+
];
|
|
6215
|
+
function isTokenCredentialKey(normalized) {
|
|
6216
|
+
if (NON_CREDENTIAL_TOKEN_CONFIG_KEYS.has(normalized)) return false;
|
|
6217
|
+
if (normalized === "token") return true;
|
|
6218
|
+
if (normalized.endsWith("tokens")) return false;
|
|
6219
|
+
return normalized.endsWith("token");
|
|
6220
|
+
}
|
|
6221
|
+
function isCredentialSensitiveKey(key, sensitiveKeys = DEFAULT_CREDENTIAL_SENSITIVE_KEYS) {
|
|
6222
|
+
if (!key) return false;
|
|
6223
|
+
const normalized = normalizeSensitiveKey(key);
|
|
6224
|
+
if (!normalized) return false;
|
|
6225
|
+
if (NON_CREDENTIAL_TOKEN_CONFIG_KEYS.has(normalized)) return false;
|
|
6226
|
+
for (const sensitive of sensitiveKeys) {
|
|
6227
|
+
const s = normalizeSensitiveKey(sensitive);
|
|
6228
|
+
if (!s) continue;
|
|
6229
|
+
if (s === "token") {
|
|
6230
|
+
if (isTokenCredentialKey(normalized)) return true;
|
|
6231
|
+
continue;
|
|
6232
|
+
}
|
|
6233
|
+
if (normalized === s) return true;
|
|
6234
|
+
if (normalized.endsWith(`_${s}`) || normalized.startsWith(`${s}_`)) return true;
|
|
6235
|
+
}
|
|
6236
|
+
return false;
|
|
6237
|
+
}
|
|
6238
|
+
|
|
6138
6239
|
// packages/core/src/checks/index.ts
|
|
6139
6240
|
var SEVERITY_RANK = {
|
|
6140
6241
|
error: 0,
|
|
@@ -6152,16 +6253,7 @@ var CONFIDENCE_RANK = {
|
|
|
6152
6253
|
correlated: 2,
|
|
6153
6254
|
explicit: 3
|
|
6154
6255
|
};
|
|
6155
|
-
var DEFAULT_SENSITIVE_KEYS =
|
|
6156
|
-
"authorization",
|
|
6157
|
-
"cookie",
|
|
6158
|
-
"token",
|
|
6159
|
-
"apikey",
|
|
6160
|
-
"api_key",
|
|
6161
|
-
"password",
|
|
6162
|
-
"secret",
|
|
6163
|
-
"email"
|
|
6164
|
-
];
|
|
6256
|
+
var DEFAULT_SENSITIVE_KEYS = DEFAULT_CREDENTIAL_SENSITIVE_KEYS;
|
|
6165
6257
|
var DEFAULT_RAW_CONTENT_KEYS = [
|
|
6166
6258
|
"body",
|
|
6167
6259
|
"headers",
|
|
@@ -6583,9 +6675,7 @@ function hasRedactionMarker(value, markers) {
|
|
|
6583
6675
|
return markers.some((marker) => value.includes(marker)) || /^\[HASH:[A-Za-z0-9_-]+\]$/.test(value);
|
|
6584
6676
|
}
|
|
6585
6677
|
function isSensitiveKey(key, sensitiveKeys) {
|
|
6586
|
-
|
|
6587
|
-
const normalized = normalizedKey(key);
|
|
6588
|
-
return sensitiveKeys.some((sensitive) => normalized.includes(normalizedKey(sensitive)));
|
|
6678
|
+
return isCredentialSensitiveKey(key, sensitiveKeys);
|
|
6589
6679
|
}
|
|
6590
6680
|
function isRawContentKey(key, forbiddenKeys) {
|
|
6591
6681
|
if (!key) return false;
|
|
@@ -6908,7 +6998,7 @@ function createToolUsageRule(options) {
|
|
|
6908
6998
|
}
|
|
6909
6999
|
}
|
|
6910
7000
|
const forbidden = new Set(options.forbidden ?? []);
|
|
6911
|
-
const allowed = options.allowed ? new Set(options.allowed) : void 0;
|
|
7001
|
+
const allowed = options.allowed?.length ? new Set(options.allowed) : void 0;
|
|
6912
7002
|
for (const event of tools) {
|
|
6913
7003
|
const name = toolName(event);
|
|
6914
7004
|
if (forbidden.has(name)) {
|
|
@@ -6944,9 +7034,9 @@ function createLlmUsageRule(options) {
|
|
|
6944
7034
|
evaluate(context) {
|
|
6945
7035
|
const llms = finishedEvents(context, "LLM");
|
|
6946
7036
|
const findings = [];
|
|
6947
|
-
const allowedModels = options.allowedModels ? new Set(options.allowedModels) : void 0;
|
|
6948
|
-
const allowedProviders = options.allowedProviders ? new Set(options.allowedProviders) : void 0;
|
|
6949
|
-
const finishReasons = options.finishReasons ? new Set(options.finishReasons) : void 0;
|
|
7037
|
+
const allowedModels = options.allowedModels?.length ? new Set(options.allowedModels) : void 0;
|
|
7038
|
+
const allowedProviders = options.allowedProviders?.length ? new Set(options.allowedProviders) : void 0;
|
|
7039
|
+
const finishReasons = options.finishReasons?.length ? new Set(options.finishReasons) : void 0;
|
|
6950
7040
|
if (options.maxCalls !== void 0 && llms.length > options.maxCalls) {
|
|
6951
7041
|
findings.push(
|
|
6952
7042
|
failFinding(
|
|
@@ -7895,6 +7985,20 @@ function traceEventsToPersistedInspectEvents(events, options) {
|
|
|
7895
7985
|
function inc(map, key) {
|
|
7896
7986
|
map[key] = (map[key] ?? 0) + 1;
|
|
7897
7987
|
}
|
|
7988
|
+
function confidenceRank(confidence) {
|
|
7989
|
+
switch (confidence) {
|
|
7990
|
+
case "unknown":
|
|
7991
|
+
return 0;
|
|
7992
|
+
case "heuristic":
|
|
7993
|
+
return 1;
|
|
7994
|
+
case "correlated":
|
|
7995
|
+
return 2;
|
|
7996
|
+
case "explicit":
|
|
7997
|
+
return 3;
|
|
7998
|
+
default:
|
|
7999
|
+
return 0;
|
|
8000
|
+
}
|
|
8001
|
+
}
|
|
7898
8002
|
function computeRunStatus(events) {
|
|
7899
8003
|
let runTerminal;
|
|
7900
8004
|
let sawRunEvent = false;
|
|
@@ -7915,6 +8019,84 @@ function computeRunStatus(events) {
|
|
|
7915
8019
|
}
|
|
7916
8020
|
return hasRunning ? "running" : "ok";
|
|
7917
8021
|
}
|
|
8022
|
+
function linkNodesVisibilityFirst(nodes) {
|
|
8023
|
+
let selfParentCount = 0;
|
|
8024
|
+
let unresolvedParentCount = 0;
|
|
8025
|
+
let normalizedEdgeCount = 0;
|
|
8026
|
+
let cycleCount = 0;
|
|
8027
|
+
const pending = [];
|
|
8028
|
+
for (const node of nodes.values()) {
|
|
8029
|
+
const parentId = node.event.parentId;
|
|
8030
|
+
if (!parentId) continue;
|
|
8031
|
+
if (parentId === node.event.eventId) {
|
|
8032
|
+
selfParentCount += 1;
|
|
8033
|
+
normalizedEdgeCount += 1;
|
|
8034
|
+
continue;
|
|
8035
|
+
}
|
|
8036
|
+
if (!nodes.has(parentId)) {
|
|
8037
|
+
unresolvedParentCount += 1;
|
|
8038
|
+
continue;
|
|
8039
|
+
}
|
|
8040
|
+
pending.push({
|
|
8041
|
+
childId: node.event.eventId,
|
|
8042
|
+
parentId,
|
|
8043
|
+
childTimestamp: node.event.timestamp,
|
|
8044
|
+
childConfidence: node.event.confidence
|
|
8045
|
+
});
|
|
8046
|
+
}
|
|
8047
|
+
pending.sort((a, b) => {
|
|
8048
|
+
const conf = confidenceRank(b.childConfidence) - confidenceRank(a.childConfidence);
|
|
8049
|
+
if (conf !== 0) return conf;
|
|
8050
|
+
return a.childTimestamp - b.childTimestamp;
|
|
8051
|
+
});
|
|
8052
|
+
const parentOf = /* @__PURE__ */ new Map();
|
|
8053
|
+
for (const edge of pending) {
|
|
8054
|
+
parentOf.set(edge.childId, edge.parentId);
|
|
8055
|
+
let cursor = edge.parentId;
|
|
8056
|
+
const seen = /* @__PURE__ */ new Set([edge.childId]);
|
|
8057
|
+
let cyclic = false;
|
|
8058
|
+
while (cursor) {
|
|
8059
|
+
if (seen.has(cursor)) {
|
|
8060
|
+
cyclic = true;
|
|
8061
|
+
break;
|
|
8062
|
+
}
|
|
8063
|
+
seen.add(cursor);
|
|
8064
|
+
cursor = parentOf.get(cursor);
|
|
8065
|
+
}
|
|
8066
|
+
if (cyclic) {
|
|
8067
|
+
parentOf.delete(edge.childId);
|
|
8068
|
+
cycleCount += 1;
|
|
8069
|
+
normalizedEdgeCount += 1;
|
|
8070
|
+
}
|
|
8071
|
+
}
|
|
8072
|
+
for (const [childId, parentId] of parentOf) {
|
|
8073
|
+
nodes.get(parentId).children.push(nodes.get(childId));
|
|
8074
|
+
}
|
|
8075
|
+
const roots = [];
|
|
8076
|
+
for (const node of nodes.values()) {
|
|
8077
|
+
if (!parentOf.has(node.event.eventId)) {
|
|
8078
|
+
roots.push(node);
|
|
8079
|
+
}
|
|
8080
|
+
}
|
|
8081
|
+
const assignDepth = (n, depth, stack) => {
|
|
8082
|
+
if (stack.has(n.event.eventId)) return;
|
|
8083
|
+
n.depth = depth;
|
|
8084
|
+
stack.add(n.event.eventId);
|
|
8085
|
+
for (const c of n.children) assignDepth(c, depth + 1, stack);
|
|
8086
|
+
stack.delete(n.event.eventId);
|
|
8087
|
+
};
|
|
8088
|
+
for (const r of roots) assignDepth(r, 0, /* @__PURE__ */ new Set());
|
|
8089
|
+
return {
|
|
8090
|
+
roots,
|
|
8091
|
+
summary: {
|
|
8092
|
+
rootCount: roots.length,
|
|
8093
|
+
selfParentCount,
|
|
8094
|
+
cycleCount,
|
|
8095
|
+
unresolvedParentCount,
|
|
8096
|
+
normalizedEdgeCount
|
|
8097
|
+
}
|
|
8098
|
+
};
|
|
8099
|
+
}
|
|
7918
8100
|
var TreeBuilder = class {
|
|
7919
8101
|
constructor(options) {
|
|
7920
8102
|
void options?.config;
|
|
@@ -7932,20 +8114,7 @@ var TreeBuilder = class {
|
|
|
7932
8114
|
for (const e of sorted) {
|
|
7933
8115
|
nodes.set(e.eventId, { event: e, children: [], depth: 0 });
|
|
7934
8116
|
}
|
|
7935
|
-
const roots =
|
|
7936
|
-
for (const node of nodes.values()) {
|
|
7937
|
-
const parentId = node.event.parentId;
|
|
7938
|
-
if (parentId && nodes.has(parentId)) {
|
|
7939
|
-
nodes.get(parentId).children.push(node);
|
|
7940
|
-
} else {
|
|
7941
|
-
roots.push(node);
|
|
7942
|
-
}
|
|
7943
|
-
}
|
|
7944
|
-
const assignDepth = (n, depth) => {
|
|
7945
|
-
n.depth = depth;
|
|
7946
|
-
for (const c of n.children) assignDepth(c, depth + 1);
|
|
7947
|
-
};
|
|
7948
|
-
for (const r of roots) assignDepth(r, 0);
|
|
8117
|
+
const { roots, summary } = linkNodesVisibilityFirst(nodes);
|
|
7949
8118
|
const confidenceBreakdown = {
|
|
7950
8119
|
explicit: 0,
|
|
7951
8120
|
correlated: 0,
|
|
@@ -7973,7 +8142,8 @@ var TreeBuilder = class {
|
|
|
7973
8142
|
metadata: {
|
|
7974
8143
|
totalEvents: sorted.length,
|
|
7975
8144
|
confidenceBreakdown,
|
|
7976
|
-
kinds
|
|
8145
|
+
kinds,
|
|
8146
|
+
relationshipSummary: summary
|
|
7977
8147
|
}
|
|
7978
8148
|
});
|
|
7979
8149
|
}
|
|
@@ -11045,6 +11215,6 @@ function renderGateReport(result, options = {}) {
|
|
|
11045
11215
|
return renderGateSummaryMarkdown(result);
|
|
11046
11216
|
}
|
|
11047
11217
|
|
|
11048
|
-
export { COHORT_METRIC_IDS, 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, diffRuns, diffTraceEvents, enrichSessionRunRecord, escapeHtml, escapeMarkdown, extractMetadata, extractOutcomesFromTraceEvents, filterMetasBySessionScope, filterTraces, flattenTree, formatDuration2 as formatDuration, formatTimestamp, gateHasThresholds, getIndent, getTraceFilePath, inferEvidenceFileRole, isAgentInspectTrace, isPersistedInspectEvent, loadSessionRunRecords, loadSuiteConfig, loadTraceMetadataList, manualTraceEventsToComparableRun, nanoid, normalizeBundleOutputPath, openTrace, parseCohortMetricList, parseDuration, parseDurationFilter, parseGateList, parseTraceJsonl, persistedInspectEventsToTraceEvents, 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, summarizeObservedOutcomes, summarizeSemanticParity, traceEventToPersistedInspectEvent, truncateName, truncateStringForProfile, validateEvent, validateSuiteConfig, verifyEvidenceDirectory, zeroKinds };
|
|
11049
|
-
//# sourceMappingURL=chunk-
|
|
11050
|
-
//# sourceMappingURL=chunk-
|
|
11218
|
+
export { COHORT_METRIC_IDS, 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, diffRuns, diffTraceEvents, enrichSessionRunRecord, escapeHtml, escapeMarkdown, extractMetadata, extractOutcomesFromTraceEvents, filterMetasBySessionScope, filterTraces, flattenTree, formatDuration2 as formatDuration, formatStepLabel, formatTimestamp, gateHasThresholds, getIndent, getTraceFilePath, inferEvidenceFileRole, isAgentInspectTrace, isPersistedInspectEvent, loadSessionRunRecords, loadSuiteConfig, loadTraceMetadataList, manualTraceEventsToComparableRun, nanoid, normalizeBundleOutputPath, openTrace, parseCohortMetricList, parseDuration, parseDurationFilter, parseGateList, parseTraceJsonl, persistedInspectEventsToTraceEvents, 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, summarizeObservedOutcomes, summarizeSemanticParity, traceEventToPersistedInspectEvent, truncateName, truncateStringForProfile, validateEvent, validateSuiteConfig, verifyEvidenceDirectory, zeroKinds };
|
|
11219
|
+
//# sourceMappingURL=chunk-AACUXCHT.mjs.map
|
|
11220
|
+
//# sourceMappingURL=chunk-AACUXCHT.mjs.map
|