agent-inspect 6.31.28 → 6.31.30

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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { ATTRIBUTION_CONFIDENCES, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createSafetyOversizedAttributeRule, resolveTraceDir, parseDuration, buildSessionIndex, resolveBundleRunIds, getTraceFilePath, openTrace, sha256Hex, collectTraceSchemaVersions, aggregateBundleSafeStatus, bundleFailsOnSafety, bundleRunAssetRelativePath, buildPlaceholderArtifact, EVIDENCE_HTML_FILENAME, EVIDENCE_MANIFEST_FILENAME, buildBundleMetadata, buildBundleSummaryMarkdown, buildEvidenceHtmlShell, buildEvidenceProvenanceViewHtml, EVIDENCE_FORMAT_VERSION, inferEvidenceFileRole, buildEvidenceSafetyViewHtml, buildEvidenceDiffViewHtml, buildEvidenceCircuitViewHtml, buildEvidenceOutcomesViewHtml, buildEvidenceContractsViewHtml, buildEvidenceToolsLlmViewHtml, buildEvidenceCausalFailureViewHtml, buildEvidenceTimelineViewHtml, buildEvidenceTreeViewHtml, buildEvidenceManifest, serializeEvidenceManifest, buildZipArchive, assertBundlePathContained, enrichSessionRunRecord, normalizeBundleOutputPath, sanitizeBundleRunId, defaultBundleOutputPath, runTraceChecks, assertEvidenceRelativePath, TraceDirectory, loadTraceMetadataList, loadSessionRunRecords, TraceReadError, resolveRedactionProfile, applyProfileMetadataCaps, Redactor, flattenTree, escapeHtml, safeString, compactAttributes, stableJson, escapeMarkdown, IDENTITY_CONFLICT_ATTR, DELIVERY_CONFLICT_ATTR, DELIVERY_EVENT_BASE_ATTR, DEFAULT_REDACT_KEYS, truncateStringForProfile, stringContainsHighConfidenceCredential, isCredentialSensitiveKey, extractMetadata, filterTraces, truncateName, buildRunSummary, formatDuration, formatTimestamp, renderErrorLine, isAgentInspectTrace, persistedInspectEventsToRunTrees, defineTraceContract, filterMetasBySessionScope, evaluateTraceContract, aggregateSessionCheckResults, createBaselineRegressionRule, summarizeSemanticParity, buildEvidenceCiPackage, verifyEvidenceDirectory, diffTraceEvents, renderRunDiff, buildRunTimeline, renderTimeline, buildTraceStats, renderTraceStats, parseDurationFilter, searchTraces, formatStepLabel, buildActivitySummary, renderActivitySummaryHuman, buildRunWhatSummary, renderRunWhat, buildLocalExplanation, resolveSuiteTemplate, defaultSuiteConfigTemplate, loadSuiteConfig, validateSuiteConfig, runSuite, renderSuiteReport, analyzeCohort, renderCohortReport, gateHasThresholds, runGate, renderGateReport, persistedInspectEventsToTraceEvents, renderStepLine, getIndent, TreeBuilder, validateEvent, traceEventToPersistedInspectEvent, isPersistedInspectEvent, createRunStatusRule, createStructureOrphanRule, createStructureCycleRule, createRunDurationRule, createMaxStepDurationRule, createRequireCompletedRule, createStallDetectionRule, createObservedOutcomeRule, createRunDepthRule, createToolUsageRule, createLlmUsageRule, createStructureRelationshipRule, createStructureParallelWidthRule, projectLogicalEvents, summarizeObservedOutcomes, extractOutcomesFromTraceEvents, renderObservedOutcomesMarkdown, renderObservedOutcomesHtml, DEFAULT_SUITE_ARTIFACTS_DIR, parseCohortMetricList, COHORT_METRIC_IDS, parseGateList, nanoid, isAttributionConfidence, zeroKinds, diffRuns, manualTraceEventsToComparableRun } from './chunk-4GTOJ3G2.mjs';
2
+ import { ATTRIBUTION_CONFIDENCES, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createSafetyOversizedAttributeRule, resolveTraceDir, parseDuration, buildSessionIndex, resolveBundleRunIds, getTraceFilePath, openTrace, sha256Hex, collectTraceSchemaVersions, persistedInspectEventsToRunTrees, aggregateBundleSafeStatus, bundleFailsOnSafety, bundleRunAssetRelativePath, buildPlaceholderArtifact, EVIDENCE_HTML_FILENAME, EVIDENCE_MANIFEST_FILENAME, buildBundleMetadata, buildBundleSummaryMarkdown, buildEvidenceHtmlShell, buildEvidenceProvenanceViewHtml, EVIDENCE_FORMAT_VERSION, inferEvidenceFileRole, buildEvidenceSafetyViewHtml, buildEvidenceDiffViewHtml, buildEvidenceCircuitViewHtml, buildEvidenceOutcomesViewHtml, buildEvidenceContractsViewHtml, buildEvidenceToolsLlmViewHtml, buildEvidenceCausalFailureViewHtml, buildEvidenceTimelineViewHtml, buildEvidenceTreeViewHtml, buildEvidenceManifest, serializeEvidenceManifest, buildZipArchive, assertBundlePathContained, enrichSessionRunRecord, normalizeBundleOutputPath, sanitizeBundleRunId, defaultBundleOutputPath, runTraceChecks, assertEvidenceRelativePath, TraceDirectory, loadTraceMetadataList, loadSessionRunRecords, TraceReadError, resolveRedactionProfile, applyProfileMetadataCaps, Redactor, flattenTree, escapeHtml, safeString, compactAttributes, stableJson, escapeMarkdown, IDENTITY_CONFLICT_ATTR, DELIVERY_CONFLICT_ATTR, DELIVERY_EVENT_BASE_ATTR, DEFAULT_REDACT_KEYS, truncateStringForProfile, stringContainsHighConfidenceCredential, isCredentialSensitiveKey, extractMetadata, filterTraces, truncateName, buildRunSummary, formatDuration, formatTimestamp, renderErrorLine, isAgentInspectTrace, defineTraceContract, filterMetasBySessionScope, evaluateTraceContract, aggregateSessionCheckResults, createBaselineRegressionRule, summarizeSemanticParity, buildEvidenceCiPackage, verifyEvidenceDirectory, diffTraceEvents, renderRunDiff, buildRunTimeline, renderTimeline, buildTraceStats, renderTraceStats, parseDurationFilter, searchTraces, formatStepLabel, buildActivitySummary, renderActivitySummaryHuman, buildRunWhatSummary, renderRunWhat, buildLocalExplanation, resolveSuiteTemplate, defaultSuiteConfigTemplate, loadSuiteConfig, validateSuiteConfig, runSuite, renderSuiteReport, analyzeCohort, renderCohortReport, gateHasThresholds, runGate, renderGateReport, persistedInspectEventsToTraceEvents, renderStepLine, getIndent, TreeBuilder, validateEvent, traceEventToPersistedInspectEvent, isPersistedInspectEvent, createRunStatusRule, createStructureOrphanRule, createStructureCycleRule, createRunDurationRule, createMaxStepDurationRule, createRequireCompletedRule, createStallDetectionRule, createObservedOutcomeRule, createRunDepthRule, createToolUsageRule, createLlmUsageRule, createStructureRelationshipRule, createStructureParallelWidthRule, projectLogicalEvents, summarizeObservedOutcomes, extractOutcomesFromTraceEvents, renderObservedOutcomesMarkdown, renderObservedOutcomesHtml, DEFAULT_SUITE_ARTIFACTS_DIR, parseCohortMetricList, COHORT_METRIC_IDS, parseGateList, nanoid, isAttributionConfidence, zeroKinds, diffRuns, manualTraceEventsToComparableRun } from './chunk-4GTOJ3G2.mjs';
3
3
  import { realpathSync, constants as constants$1, existsSync, readFileSync } from 'fs';
4
4
  import path19 from 'path';
5
5
  import { fileURLToPath, pathToFileURL } from 'url';
@@ -14,7 +14,7 @@ import { createServer } from 'http';
14
14
  import { createRequire } from 'module';
15
15
 
16
16
  // package.json
17
- var version = "6.31.28";
17
+ var version = "6.31.30";
18
18
 
19
19
  // packages/cli/src/trace-dir-scale.ts
20
20
  var TRACE_COUNT_WARN = 1e3;
@@ -2173,6 +2173,96 @@ function redactRunTreeForExport(tree, options) {
2173
2173
  return clone;
2174
2174
  }
2175
2175
 
2176
+ // packages/core/src/exporters/presentation-lifecycle.ts
2177
+ function stepIdOf(event) {
2178
+ const value = event.attributes?.stepId;
2179
+ return typeof value === "string" && value.trim() !== "" ? value : void 0;
2180
+ }
2181
+ function lifecycleKey(event) {
2182
+ if (event.kind === "RUN") return `run:${event.runId}`;
2183
+ const stepId = stepIdOf(event);
2184
+ if (stepId !== void 0) return `step:${stepId}`;
2185
+ return `event:${event.eventId}`;
2186
+ }
2187
+ function isTerminal(status) {
2188
+ return status === "ok" || status === "error";
2189
+ }
2190
+ function cloneNode(node) {
2191
+ return {
2192
+ event: {
2193
+ ...node.event,
2194
+ ...node.event.attributes !== void 0 ? { attributes: { ...node.event.attributes } } : {}
2195
+ },
2196
+ children: node.children.map(cloneNode),
2197
+ depth: node.depth
2198
+ };
2199
+ }
2200
+ function joinSiblingGroup(group) {
2201
+ if (group.length <= 1) return group;
2202
+ const terminals = group.filter((n) => isTerminal(n.event.status));
2203
+ const runnings = group.filter((n) => n.event.status === "running");
2204
+ const terminalStatuses = new Set(terminals.map((n) => n.event.status));
2205
+ if (terminalStatuses.size > 1) {
2206
+ return group;
2207
+ }
2208
+ if (terminals.length >= 1) {
2209
+ const terminal = terminals[terminals.length - 1];
2210
+ const start = runnings[0];
2211
+ const childMap = /* @__PURE__ */ new Map();
2212
+ for (const n of group) {
2213
+ for (const child of n.children) {
2214
+ childMap.set(child.event.eventId, child);
2215
+ }
2216
+ }
2217
+ return [
2218
+ {
2219
+ event: {
2220
+ ...terminal.event,
2221
+ name: start?.event.name ?? terminal.event.name,
2222
+ kind: start?.event.kind ?? terminal.event.kind,
2223
+ ...start?.event.timestamp !== void 0 && terminal.event.durationMs === void 0 ? {} : {}
2224
+ },
2225
+ children: presentSiblingNodes([...childMap.values()]),
2226
+ depth: terminal.depth
2227
+ }
2228
+ ];
2229
+ }
2230
+ return group;
2231
+ }
2232
+ function presentSiblingNodes(nodes) {
2233
+ const prepared = nodes.map((n) => ({
2234
+ ...cloneNode(n),
2235
+ children: presentSiblingNodes(n.children)
2236
+ }));
2237
+ const order = [];
2238
+ const groups = /* @__PURE__ */ new Map();
2239
+ for (const node of prepared) {
2240
+ const key = lifecycleKey(node.event);
2241
+ if (!groups.has(key)) {
2242
+ groups.set(key, []);
2243
+ order.push(key);
2244
+ }
2245
+ groups.get(key).push(node);
2246
+ }
2247
+ const out = [];
2248
+ for (const key of order) {
2249
+ out.push(...joinSiblingGroup(groups.get(key)));
2250
+ }
2251
+ return out;
2252
+ }
2253
+ function presentLifecycleJoinedTree(tree) {
2254
+ return {
2255
+ ...tree,
2256
+ children: presentSiblingNodes(tree.children),
2257
+ metadata: {
2258
+ ...tree.metadata,
2259
+ confidenceBreakdown: { ...tree.metadata.confidenceBreakdown },
2260
+ kinds: { ...tree.metadata.kinds },
2261
+ ...tree.metadata.relationshipSummary !== void 0 ? { relationshipSummary: { ...tree.metadata.relationshipSummary } } : {}
2262
+ }
2263
+ };
2264
+ }
2265
+
2176
2266
  // packages/core/src/exporters/html-exporter.ts
2177
2267
  function renderTreeHtml(nodes, ulClass = "tree") {
2178
2268
  if (nodes.length === 0) return "";
@@ -2200,32 +2290,33 @@ function exportHtml(tree, options) {
2200
2290
  const includeErrors = options?.includeErrors ?? true;
2201
2291
  const maxLen = options?.maxAttributeLength ?? 500;
2202
2292
  const redacted = options?.redacted ?? true;
2203
- const titleName = escapeHtml(tree.name ?? tree.runId);
2293
+ const view2 = presentLifecycleJoinedTree(tree);
2294
+ const titleName = escapeHtml(view2.name ?? view2.runId);
2204
2295
  const summaryRows = [];
2205
2296
  summaryRows.push(
2206
- `<tr><th scope="row">runId</th><td><code>${escapeHtml(tree.runId)}</code></td></tr>`
2297
+ `<tr><th scope="row">runId</th><td><code>${escapeHtml(view2.runId)}</code></td></tr>`
2207
2298
  );
2208
- if (tree.name !== void 0) {
2209
- summaryRows.push(`<tr><th scope="row">name</th><td>${escapeHtml(tree.name)}</td></tr>`);
2299
+ if (view2.name !== void 0) {
2300
+ summaryRows.push(`<tr><th scope="row">name</th><td>${escapeHtml(view2.name)}</td></tr>`);
2210
2301
  }
2211
2302
  summaryRows.push(
2212
- `<tr><th scope="row">status</th><td>${escapeHtml(String(tree.status ?? "unknown"))}</td></tr>`
2303
+ `<tr><th scope="row">status</th><td>${escapeHtml(String(view2.status ?? "unknown"))}</td></tr>`
2213
2304
  );
2214
2305
  summaryRows.push(
2215
- `<tr><th scope="row">durationMs</th><td>${tree.durationMs !== void 0 ? escapeHtml(String(tree.durationMs)) : "\u2014"}</td></tr>`
2306
+ `<tr><th scope="row">durationMs</th><td>${view2.durationMs !== void 0 ? escapeHtml(String(view2.durationMs)) : "\u2014"}</td></tr>`
2216
2307
  );
2217
2308
  summaryRows.push(
2218
- `<tr><th scope="row">startedAt</th><td>${tree.startedAt !== void 0 ? escapeHtml(String(tree.startedAt)) : "\u2014"}</td></tr>`
2309
+ `<tr><th scope="row">startedAt</th><td>${view2.startedAt !== void 0 ? escapeHtml(String(view2.startedAt)) : "\u2014"}</td></tr>`
2219
2310
  );
2220
2311
  summaryRows.push(
2221
- `<tr><th scope="row">endedAt</th><td>${tree.endedAt !== void 0 ? escapeHtml(String(tree.endedAt)) : "\u2014"}</td></tr>`
2312
+ `<tr><th scope="row">endedAt</th><td>${view2.endedAt !== void 0 ? escapeHtml(String(view2.endedAt)) : "\u2014"}</td></tr>`
2222
2313
  );
2223
2314
  summaryRows.push(
2224
- `<tr><th scope="row">totalEvents</th><td>${escapeHtml(String(tree.metadata.totalEvents))}</td></tr>`
2315
+ `<tr><th scope="row">totalEvents</th><td>${escapeHtml(String(view2.metadata.totalEvents))}</td></tr>`
2225
2316
  );
2226
2317
  let confidenceHtml = "";
2227
2318
  if (includeMetadata) {
2228
- const cb = tree.metadata.confidenceBreakdown;
2319
+ const cb = view2.metadata.confidenceBreakdown;
2229
2320
  confidenceHtml += "<h3>Confidence breakdown</h3><table><thead><tr><th>bucket</th><th>count</th></tr></thead><tbody>";
2230
2321
  for (const k of Object.keys(cb).sort()) {
2231
2322
  const key = k;
@@ -2233,14 +2324,14 @@ function exportHtml(tree, options) {
2233
2324
  }
2234
2325
  confidenceHtml += "</tbody></table>";
2235
2326
  confidenceHtml += "<h3>Kind breakdown</h3><table><thead><tr><th>kind</th><th>count</th></tr></thead><tbody>";
2236
- for (const k of Object.keys(tree.metadata.kinds).sort()) {
2327
+ for (const k of Object.keys(view2.metadata.kinds).sort()) {
2237
2328
  const key = k;
2238
- const c = tree.metadata.kinds[key];
2329
+ const c = view2.metadata.kinds[key];
2239
2330
  if (c > 0) confidenceHtml += `<tr><td>${escapeHtml(key)}</td><td>${c}</td></tr>`;
2240
2331
  }
2241
2332
  confidenceHtml += "</tbody></table>";
2242
2333
  }
2243
- const flat = flattenTree(tree);
2334
+ const flat = flattenTree(view2);
2244
2335
  const errors = flat.filter((n) => n.event.status === "error");
2245
2336
  let errorsHtml = "";
2246
2337
  if (includeErrors && errors.length > 0) {
@@ -2295,7 +2386,7 @@ footer{margin-top:2rem;font-size:0.85rem;color:#555}
2295
2386
  <header><h1>AgentInspect Run: ${titleName}</h1></header>
2296
2387
  <p class="note">Generated locally by AgentInspect.</p>
2297
2388
  ${includeMetadata ? `<section class="summary"><h2>Summary</h2><table>${summaryRows.join("")}</table>${confidenceHtml}</section>` : ""}
2298
- <section class="tree"><h2>Execution tree</h2>${tree.children.length > 0 ? renderTreeHtml(tree.children) : "<p>No steps recorded.</p>"}</section>
2389
+ <section class="tree"><h2>Execution tree</h2>${view2.children.length > 0 ? renderTreeHtml(view2.children) : "<p>No steps recorded.</p>"}</section>
2299
2390
  ${errorsHtml}
2300
2391
  ${attrsHtml}
2301
2392
  <footer>Generated locally by AgentInspect. Review for sensitive data before sharing.</footer>
@@ -2336,7 +2427,8 @@ function exportMarkdown(tree, options) {
2336
2427
  const includeErrors = options?.includeErrors ?? true;
2337
2428
  const maxLen = options?.maxAttributeLength ?? 500;
2338
2429
  const redacted = options?.redacted ?? true;
2339
- const titleName = tree.name ?? tree.runId;
2430
+ const view2 = presentLifecycleJoinedTree(tree);
2431
+ const titleName = view2.name ?? view2.runId;
2340
2432
  const lines = [];
2341
2433
  lines.push(`# AgentInspect Run: ${escapeMarkdown(titleName)}`);
2342
2434
  lines.push("");
@@ -2345,28 +2437,28 @@ function exportMarkdown(tree, options) {
2345
2437
  if (includeMetadata) {
2346
2438
  lines.push("## Summary");
2347
2439
  lines.push("");
2348
- lines.push(`- **runId**: ${escapeMarkdown(tree.runId)}`);
2349
- if (tree.name !== void 0) lines.push(`- **name**: ${escapeMarkdown(tree.name)}`);
2350
- lines.push(`- **status**: ${escapeMarkdown(String(tree.status ?? "unknown"))}`);
2440
+ lines.push(`- **runId**: ${escapeMarkdown(view2.runId)}`);
2441
+ if (view2.name !== void 0) lines.push(`- **name**: ${escapeMarkdown(view2.name)}`);
2442
+ lines.push(`- **status**: ${escapeMarkdown(String(view2.status ?? "unknown"))}`);
2351
2443
  lines.push(
2352
- `- **durationMs**: ${tree.durationMs !== void 0 ? escapeMarkdown(String(tree.durationMs)) : "-"}`
2444
+ `- **durationMs**: ${view2.durationMs !== void 0 ? escapeMarkdown(String(view2.durationMs)) : "-"}`
2353
2445
  );
2354
2446
  lines.push(
2355
- `- **startedAt**: ${tree.startedAt !== void 0 ? escapeMarkdown(String(tree.startedAt)) : "-"}`
2447
+ `- **startedAt**: ${view2.startedAt !== void 0 ? escapeMarkdown(String(view2.startedAt)) : "-"}`
2356
2448
  );
2357
2449
  lines.push(
2358
- `- **endedAt**: ${tree.endedAt !== void 0 ? escapeMarkdown(String(tree.endedAt)) : "-"}`
2450
+ `- **endedAt**: ${view2.endedAt !== void 0 ? escapeMarkdown(String(view2.endedAt)) : "-"}`
2359
2451
  );
2360
- lines.push(`- **totalEvents**: ${tree.metadata.totalEvents}`);
2452
+ lines.push(`- **totalEvents**: ${view2.metadata.totalEvents}`);
2361
2453
  lines.push("");
2362
2454
  lines.push("### Confidence breakdown");
2363
2455
  lines.push("");
2364
2456
  lines.push("| bucket | count |");
2365
2457
  lines.push("| --- | --- |");
2366
- for (const k of Object.keys(tree.metadata.confidenceBreakdown).sort()) {
2458
+ for (const k of Object.keys(view2.metadata.confidenceBreakdown).sort()) {
2367
2459
  const key = k;
2368
2460
  lines.push(
2369
- `| ${escapeMarkdown(key)} | ${tree.metadata.confidenceBreakdown[key]} |`
2461
+ `| ${escapeMarkdown(key)} | ${view2.metadata.confidenceBreakdown[key]} |`
2370
2462
  );
2371
2463
  }
2372
2464
  lines.push("");
@@ -2374,9 +2466,9 @@ function exportMarkdown(tree, options) {
2374
2466
  lines.push("");
2375
2467
  lines.push("| kind | count |");
2376
2468
  lines.push("| --- | --- |");
2377
- for (const k of Object.keys(tree.metadata.kinds).sort()) {
2469
+ for (const k of Object.keys(view2.metadata.kinds).sort()) {
2378
2470
  const key = k;
2379
- const c = tree.metadata.kinds[key];
2471
+ const c = view2.metadata.kinds[key];
2380
2472
  if (c > 0) lines.push(`| ${escapeMarkdown(key)} | ${c} |`);
2381
2473
  }
2382
2474
  lines.push("");
@@ -2385,11 +2477,11 @@ function exportMarkdown(tree, options) {
2385
2477
  lines.push("");
2386
2478
  lines.push("```text");
2387
2479
  lines.push(
2388
- tree.children.length > 0 ? renderTreeAscii(tree.children) : "(no steps)"
2480
+ view2.children.length > 0 ? renderTreeAscii(view2.children) : "(no steps)"
2389
2481
  );
2390
2482
  lines.push("```");
2391
2483
  lines.push("");
2392
- const flat = flattenTree(tree);
2484
+ const flat = flattenTree(view2);
2393
2485
  const errors = flat.filter((n) => n.event.status === "error");
2394
2486
  if (includeErrors && errors.length > 0) {
2395
2487
  lines.push("## Errors");
@@ -12022,11 +12114,14 @@ async function bundleCommand(runIdArg, options = {}) {
12022
12114
  ...finding.action !== void 0 ? { action: finding.action } : {}
12023
12115
  });
12024
12116
  }
12025
- if (artifactTree) {
12026
- artifactTrees.push(artifactTree);
12027
- } else {
12028
- const selected2 = read.runs.find((run) => run.runId === runId);
12029
- if (selected2) artifactTrees.push(selected2);
12117
+ const persistedForRun = artifactEventsByRun.get(runId) ?? read.events.filter((event) => event.runId === runId);
12118
+ const presentationTrees = persistedInspectEventsToRunTrees(persistedForRun, {
12119
+ coalesceLifecycle: true,
12120
+ skipInvalid: true
12121
+ });
12122
+ const presentationTree = presentationTrees.find((candidate) => candidate.runId === runId) ?? presentationTrees[0] ?? artifactTree ?? read.runs.find((run) => run.runId === runId);
12123
+ if (presentationTree) {
12124
+ artifactTrees.push(presentationTree);
12030
12125
  }
12031
12126
  const status = safetyStatusFromAssess(artifactSafety.status);
12032
12127
  checkRuns.push({
@@ -12037,8 +12132,17 @@ async function bundleCommand(runIdArg, options = {}) {
12037
12132
  warnings: artifactSafety.summary.warnings,
12038
12133
  findings: artifactSafety.summary.findings
12039
12134
  });
12040
- const selected = read.runs.find((run) => run.runId === runId);
12041
- const runReport = exportRunTree(selected ?? read.runs[0], {
12135
+ if (!presentationTree) {
12136
+ const message = `No run tree could be built for HTML presentation: ${runId}`;
12137
+ if (options.json) {
12138
+ console.log(writeJson4({ ok: false, error: message }).trimEnd());
12139
+ } else {
12140
+ console.error(`[AgentInspect] bundle failed: ${message}`);
12141
+ }
12142
+ process.exitCode = 1;
12143
+ return;
12144
+ }
12145
+ const runReport = exportRunTree(presentationTree, {
12042
12146
  format: "html",
12043
12147
  redacted: true,
12044
12148
  redactionProfile: toReportProfile(profile)