agent-inspect 4.1.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -462,6 +462,47 @@ interface CriticalPathStep {
462
462
  source: SessionEdgeSource;
463
463
  confidence: SessionConfidence;
464
464
  }
465
+ /** Session lifecycle status (v4.2 RFC). */
466
+ type SessionStatus = "running" | "waiting_input" | "idle" | "completed" | "error" | "stale" | "unknown";
467
+ interface SessionLastError {
468
+ runId: string;
469
+ message: string;
470
+ code?: string;
471
+ }
472
+ interface SessionCheckSummary {
473
+ pass: number;
474
+ fail: number;
475
+ warn: number;
476
+ }
477
+ interface EnrichSessionSummaryOptions {
478
+ /** Reference clock for staleness (default Date.now()). */
479
+ nowMs?: number;
480
+ /** Inactivity threshold before marking a session stale (default 24h). */
481
+ staleThresholdMs?: number;
482
+ }
483
+ interface ActivityEntry {
484
+ sessionId: string;
485
+ status: SessionStatus;
486
+ summary: string;
487
+ lastActivity: string;
488
+ runCount: number;
489
+ }
490
+ interface ActivitySummary {
491
+ since: string;
492
+ sessions: number;
493
+ failed: number;
494
+ stale: number;
495
+ guardrailWarnings: number;
496
+ entries: ActivityEntry[];
497
+ }
498
+ interface BuildActivitySummaryOptions {
499
+ /** Duration window (e.g. 7d, 24h). Default 7d. */
500
+ since?: string;
501
+ /** Reference clock (default Date.now()). */
502
+ nowMs?: number;
503
+ /** Max entries returned (default 20). */
504
+ limit?: number;
505
+ }
465
506
  interface SessionSummary {
466
507
  sessionId: string;
467
508
  runIds: string[];
@@ -469,6 +510,23 @@ interface SessionSummary {
469
510
  handoffs: HandoffEdge[];
470
511
  retries: RetryLink[];
471
512
  criticalPath: CriticalPathStep[];
513
+ /** Derived session status (v4.2+). */
514
+ status: SessionStatus;
515
+ /** Earliest run start time in the session. */
516
+ startedAt?: number;
517
+ /** Latest run end time when all runs have ended. */
518
+ endedAt?: number;
519
+ /** endedAt - startedAt when both are present. */
520
+ durationMs?: number;
521
+ correlationId?: string;
522
+ jobId?: string;
523
+ workflowId?: string;
524
+ lastError?: SessionLastError;
525
+ /** ISO-8601 timestamp of the most recent run activity. */
526
+ lastActivity: string;
527
+ retryCount: number;
528
+ observationSummary?: string;
529
+ checkSummary?: SessionCheckSummary;
472
530
  }
473
531
  interface SessionIndex {
474
532
  runs: SessionRunRecord[];
@@ -479,6 +537,10 @@ interface SessionIndex {
479
537
  interface BuildSessionIndexOptions {
480
538
  /** When true, group runs that share only `groupId` under a synthetic session key. */
481
539
  correlateByGroupId?: boolean;
540
+ /** Reference clock for session staleness (v4.2+). */
541
+ nowMs?: number;
542
+ /** Inactivity threshold before marking a session stale (v4.2+, default 24h). */
543
+ staleThresholdMs?: number;
482
544
  }
483
545
 
484
546
  /** Extracts session/workflow metadata from a run metadata or attributes bag. */
@@ -487,6 +549,22 @@ declare function sessionKeyForRun(meta: SessionWorkflowMetadata | undefined, opt
487
549
  correlateByGroupId?: boolean;
488
550
  }): string | undefined;
489
551
 
552
+ /** Derives session status from run records per the v4.2 RFC (no timestamp-only causality). */
553
+ declare function deriveSessionStatus(runs: readonly SessionRunRecord[], options?: EnrichSessionSummaryOptions): SessionStatus;
554
+ /**
555
+ * Enriches a session summary with v4.2 derived fields (status, timing, errors).
556
+ * Pure function; does not read trace files.
557
+ */
558
+ declare function enrichSessionSummary(summary: Omit<SessionSummary, "status" | "lastActivity" | "retryCount" | "startedAt" | "endedAt" | "durationMs" | "correlationId" | "jobId" | "workflowId" | "lastError" | "observationSummary" | "checkSummary">, runs: readonly SessionRunRecord[], options?: EnrichSessionSummaryOptions): SessionSummary;
559
+
560
+ /**
561
+ * Builds a deterministic activity summary from a session index (v4.2).
562
+ * Read-only; does not mutate traces or invent relationships.
563
+ */
564
+ declare function buildActivitySummary(index: SessionIndex, options?: BuildActivitySummaryOptions): ActivitySummary;
565
+ /** Renders a human activity summary for terminal output. */
566
+ declare function renderActivitySummaryHuman(summary: ActivitySummary): string;
567
+
490
568
  /** Enriches trace metadata with run_started metadata for session indexing. */
491
569
  declare function enrichSessionRunRecord(meta: TraceMetadata): Promise<SessionRunRecord>;
492
570
  /** Builds session run records from extracted trace metadata rows. */
@@ -565,4 +643,96 @@ declare function isAgentInspectTrace(filePath: string): Promise<boolean>;
565
643
  */
566
644
  declare function parseDuration(duration: string): number;
567
645
 
568
- export { type BuildSessionIndexOptions, type CriticalPathStep, DEFAULT_TRACE_DIR_NAME, type DurationStats, ErrorInfo, type ExplainFact, type ExplainInference, type ExplainMode, type ExplainOptions, type ExplainResult, FALLBACK_TRACE_DIR, type GroupSessionCohortsOptions, type HandoffEdge, InspectRunTree, MAX_NAME_LENGTH, MAX_TERMINAL_DEPTH, MAX_TERMINAL_NAME_LENGTH, type ParseTraceJsonlOptions, type ParseTraceJsonlResult, type ParsedDurationFilter, RUNS_DIR_NAME, RedactionProfile, type RenderTimelineOptions, type RenderWhatOptions, type ResolvedRedactionProfile, type RetryLink, RunStatus, RunSummary, type RunTimeline, type RunWhatSummary, SESSION_WORKFLOW_KEYS, type SessionCohort, type SessionCohortKind, type SessionConfidence, type SessionEdgeSource, type SessionGroup, type SessionIndex, type SessionRunRecord, type SessionScopeOptions, type SessionScopeResult, type SessionSummary, type SessionWarning, type SessionWorkflowKey, type SessionWorkflowMetadata, StepStatus, StepType, TERMINAL_INDENT, type TimelineEntry, type TimelineFocus, type TimelineOptions, TraceCorrelationMetadata, TraceDirectory, type TraceDirectoryOptions, TraceEvent, type TraceFilterOptions, type TraceJsonlFormat, TraceMetadata, TraceMetadataStatus, type TraceSearchOptions, type TraceSearchResult, type TraceSessionCheckResult, type TraceStats, type TraceStatsOptions, type TraceStatsRankedRun, type TraceStatsRankedStep, aggregateSessionCheckResults, buildLocalExplanation, buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildSessionIndex, buildTraceStats, createRunId, createStepId, enrichSessionRunRecord, ensureTraceDir, extractMetadata, extractSessionWorkflowMetadata, filterMetasBySessionScope, filterTraces, formatDuration, formatError, formatTerminalName, formatTimestamp, getDefaultTraceDir, getIndent, getRunIdFromTraceFileName, getTraceFilePath, groupSessionCohorts, initializeTraceFile, isAgentInspectTrace, listTraceFiles, loadSessionRunRecords, loadTraceMetadataList, parseDuration, parseDurationFilter, parseTraceJsonl, printError, printFailedAt, printRunComplete, printRunStart, printStepComplete, printStepStart, readTraceEvents, readTraceFile, renderErrorLine, renderRunSummary, renderRunWhat, renderStepLine, renderTimeline, renderTraceStats, resolveRedactionProfile, resolveTraceDir, searchTraces, serializeEvent, sessionKeyForRun, traceMetasToSessionRunRecords, truncateName, unknownTraceFormatMessage, validateEvent, warn, writeTraceEvent };
646
+ /** Aggregate verify-safe status for a bundle. */
647
+ type BundleSafeStatus = "SAFE" | "SAFE WITH WARNINGS" | "UNSAFE" | "UNKNOWN";
648
+ /** Metadata-safe status (underscore form). */
649
+ type BundleSafeStatusMetadata = "SAFE" | "SAFE_WITH_WARNINGS" | "UNSAFE" | "UNKNOWN";
650
+ type BundleRedactionProfile = "local" | "share" | "strict";
651
+ interface BundleMetadata {
652
+ createdAt: string;
653
+ agentInspectVersion: string;
654
+ redactionProfile: BundleRedactionProfile;
655
+ sourceTraceCount: number;
656
+ runIds: string[];
657
+ safeStatus: BundleSafeStatusMetadata;
658
+ files: string[];
659
+ note: string;
660
+ sessionId?: string;
661
+ since?: string;
662
+ }
663
+ interface BundleRedactionReportRun {
664
+ runId: string;
665
+ findings: number;
666
+ detectors: string[];
667
+ }
668
+ interface BundleRedactionReport {
669
+ profile: BundleRedactionProfile;
670
+ totalFindings: number;
671
+ runs: BundleRedactionReportRun[];
672
+ }
673
+ interface BundleCheckRunResult {
674
+ runId: string;
675
+ status: BundleSafeStatus;
676
+ errors: number;
677
+ warnings: number;
678
+ findings: number;
679
+ }
680
+ interface BundleCheckResults {
681
+ aggregateStatus: BundleSafeStatus;
682
+ runs: BundleCheckRunResult[];
683
+ }
684
+ interface BundleResolveOptions {
685
+ runId?: string;
686
+ sessionId?: string;
687
+ since?: string;
688
+ }
689
+ interface BundleResolveResult {
690
+ runIds: string[];
691
+ sessionId?: string;
692
+ since?: string;
693
+ }
694
+ interface BundlePlaceholderArtifact {
695
+ status: "not_requested";
696
+ note: string;
697
+ }
698
+
699
+ /**
700
+ * Resolves which run ids belong in a bundle.
701
+ *
702
+ * @throws when target mode is missing, ambiguous, or yields zero runs.
703
+ */
704
+ declare function resolveBundleRunIds(index: SessionIndex, runs: readonly SessionRunRecord[], options: BundleResolveOptions): BundleResolveResult;
705
+
706
+ declare function buildBundleMetadata(parts: {
707
+ agentInspectVersion: string;
708
+ profile: BundleRedactionProfile;
709
+ resolve: BundleResolveResult;
710
+ checks: BundleCheckResults;
711
+ files: string[];
712
+ createdAt?: string;
713
+ }): BundleMetadata;
714
+ declare function buildPlaceholderArtifact(): BundlePlaceholderArtifact;
715
+
716
+ /**
717
+ * Builds a human-readable bundle summary for `summary.md`.
718
+ */
719
+ declare function buildBundleSummaryMarkdown(parts: {
720
+ metadata: BundleMetadata;
721
+ checks: BundleCheckResults;
722
+ redaction: BundleRedactionReport;
723
+ }): string;
724
+
725
+ declare function aggregateBundleSafeStatus(statuses: readonly BundleSafeStatus[]): BundleSafeStatus;
726
+ declare function toMetadataSafeStatus(status: BundleSafeStatus): BundleSafeStatusMetadata;
727
+ declare function bundleFailsOnSafety(status: BundleSafeStatus, allowUnsafe: boolean): boolean;
728
+
729
+ /**
730
+ * Normalizes bundle output path. Strips a `.zip` suffix (folder-first MVP).
731
+ */
732
+ declare function normalizeBundleOutputPath(out: string): string;
733
+ /**
734
+ * Default bundle directory when --out is omitted.
735
+ */
736
+ declare function defaultBundleOutputPath(runIds: readonly string[]): string;
737
+
738
+ export { type ActivityEntry, type ActivitySummary, type BuildActivitySummaryOptions, type BuildSessionIndexOptions, type BundleCheckResults, type BundleCheckRunResult, type BundleMetadata, type BundlePlaceholderArtifact, type BundleRedactionProfile, type BundleRedactionReport, type BundleRedactionReportRun, type BundleResolveOptions, type BundleResolveResult, type BundleSafeStatus, type BundleSafeStatusMetadata, type CriticalPathStep, DEFAULT_TRACE_DIR_NAME, type DurationStats, type EnrichSessionSummaryOptions, ErrorInfo, type ExplainFact, type ExplainInference, type ExplainMode, type ExplainOptions, type ExplainResult, FALLBACK_TRACE_DIR, type GroupSessionCohortsOptions, type HandoffEdge, InspectRunTree, MAX_NAME_LENGTH, MAX_TERMINAL_DEPTH, MAX_TERMINAL_NAME_LENGTH, type ParseTraceJsonlOptions, type ParseTraceJsonlResult, type ParsedDurationFilter, RUNS_DIR_NAME, RedactionProfile, type RenderTimelineOptions, type RenderWhatOptions, type ResolvedRedactionProfile, type RetryLink, RunStatus, RunSummary, type RunTimeline, type RunWhatSummary, SESSION_WORKFLOW_KEYS, type SessionCheckSummary, type SessionCohort, type SessionCohortKind, type SessionConfidence, type SessionEdgeSource, type SessionGroup, type SessionIndex, type SessionLastError, type SessionRunRecord, type SessionScopeOptions, type SessionScopeResult, type SessionStatus, type SessionSummary, type SessionWarning, type SessionWorkflowKey, type SessionWorkflowMetadata, StepStatus, StepType, TERMINAL_INDENT, type TimelineEntry, type TimelineFocus, type TimelineOptions, TraceCorrelationMetadata, TraceDirectory, type TraceDirectoryOptions, TraceEvent, type TraceFilterOptions, type TraceJsonlFormat, TraceMetadata, TraceMetadataStatus, type TraceSearchOptions, type TraceSearchResult, type TraceSessionCheckResult, type TraceStats, type TraceStatsOptions, type TraceStatsRankedRun, type TraceStatsRankedStep, aggregateBundleSafeStatus, aggregateSessionCheckResults, buildActivitySummary, buildBundleMetadata, buildBundleSummaryMarkdown, buildLocalExplanation, buildPlaceholderArtifact, buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildSessionIndex, buildTraceStats, bundleFailsOnSafety, createRunId, createStepId, defaultBundleOutputPath, deriveSessionStatus, enrichSessionRunRecord, enrichSessionSummary, ensureTraceDir, extractMetadata, extractSessionWorkflowMetadata, filterMetasBySessionScope, filterTraces, formatDuration, formatError, formatTerminalName, formatTimestamp, getDefaultTraceDir, getIndent, getRunIdFromTraceFileName, getTraceFilePath, groupSessionCohorts, initializeTraceFile, isAgentInspectTrace, listTraceFiles, loadSessionRunRecords, loadTraceMetadataList, normalizeBundleOutputPath, parseDuration, parseDurationFilter, parseTraceJsonl, printError, printFailedAt, printRunComplete, printRunStart, printStepComplete, printStepStart, readTraceEvents, readTraceFile, renderActivitySummaryHuman, renderErrorLine, renderRunSummary, renderRunWhat, renderStepLine, renderTimeline, renderTraceStats, resolveBundleRunIds, resolveRedactionProfile, resolveTraceDir, searchTraces, serializeEvent, sessionKeyForRun, toMetadataSafeStatus, traceMetasToSessionRunRecords, truncateName, unknownTraceFormatMessage, validateEvent, warn, writeTraceEvent };
@@ -462,6 +462,47 @@ interface CriticalPathStep {
462
462
  source: SessionEdgeSource;
463
463
  confidence: SessionConfidence;
464
464
  }
465
+ /** Session lifecycle status (v4.2 RFC). */
466
+ type SessionStatus = "running" | "waiting_input" | "idle" | "completed" | "error" | "stale" | "unknown";
467
+ interface SessionLastError {
468
+ runId: string;
469
+ message: string;
470
+ code?: string;
471
+ }
472
+ interface SessionCheckSummary {
473
+ pass: number;
474
+ fail: number;
475
+ warn: number;
476
+ }
477
+ interface EnrichSessionSummaryOptions {
478
+ /** Reference clock for staleness (default Date.now()). */
479
+ nowMs?: number;
480
+ /** Inactivity threshold before marking a session stale (default 24h). */
481
+ staleThresholdMs?: number;
482
+ }
483
+ interface ActivityEntry {
484
+ sessionId: string;
485
+ status: SessionStatus;
486
+ summary: string;
487
+ lastActivity: string;
488
+ runCount: number;
489
+ }
490
+ interface ActivitySummary {
491
+ since: string;
492
+ sessions: number;
493
+ failed: number;
494
+ stale: number;
495
+ guardrailWarnings: number;
496
+ entries: ActivityEntry[];
497
+ }
498
+ interface BuildActivitySummaryOptions {
499
+ /** Duration window (e.g. 7d, 24h). Default 7d. */
500
+ since?: string;
501
+ /** Reference clock (default Date.now()). */
502
+ nowMs?: number;
503
+ /** Max entries returned (default 20). */
504
+ limit?: number;
505
+ }
465
506
  interface SessionSummary {
466
507
  sessionId: string;
467
508
  runIds: string[];
@@ -469,6 +510,23 @@ interface SessionSummary {
469
510
  handoffs: HandoffEdge[];
470
511
  retries: RetryLink[];
471
512
  criticalPath: CriticalPathStep[];
513
+ /** Derived session status (v4.2+). */
514
+ status: SessionStatus;
515
+ /** Earliest run start time in the session. */
516
+ startedAt?: number;
517
+ /** Latest run end time when all runs have ended. */
518
+ endedAt?: number;
519
+ /** endedAt - startedAt when both are present. */
520
+ durationMs?: number;
521
+ correlationId?: string;
522
+ jobId?: string;
523
+ workflowId?: string;
524
+ lastError?: SessionLastError;
525
+ /** ISO-8601 timestamp of the most recent run activity. */
526
+ lastActivity: string;
527
+ retryCount: number;
528
+ observationSummary?: string;
529
+ checkSummary?: SessionCheckSummary;
472
530
  }
473
531
  interface SessionIndex {
474
532
  runs: SessionRunRecord[];
@@ -479,6 +537,10 @@ interface SessionIndex {
479
537
  interface BuildSessionIndexOptions {
480
538
  /** When true, group runs that share only `groupId` under a synthetic session key. */
481
539
  correlateByGroupId?: boolean;
540
+ /** Reference clock for session staleness (v4.2+). */
541
+ nowMs?: number;
542
+ /** Inactivity threshold before marking a session stale (v4.2+, default 24h). */
543
+ staleThresholdMs?: number;
482
544
  }
483
545
 
484
546
  /** Extracts session/workflow metadata from a run metadata or attributes bag. */
@@ -487,6 +549,22 @@ declare function sessionKeyForRun(meta: SessionWorkflowMetadata | undefined, opt
487
549
  correlateByGroupId?: boolean;
488
550
  }): string | undefined;
489
551
 
552
+ /** Derives session status from run records per the v4.2 RFC (no timestamp-only causality). */
553
+ declare function deriveSessionStatus(runs: readonly SessionRunRecord[], options?: EnrichSessionSummaryOptions): SessionStatus;
554
+ /**
555
+ * Enriches a session summary with v4.2 derived fields (status, timing, errors).
556
+ * Pure function; does not read trace files.
557
+ */
558
+ declare function enrichSessionSummary(summary: Omit<SessionSummary, "status" | "lastActivity" | "retryCount" | "startedAt" | "endedAt" | "durationMs" | "correlationId" | "jobId" | "workflowId" | "lastError" | "observationSummary" | "checkSummary">, runs: readonly SessionRunRecord[], options?: EnrichSessionSummaryOptions): SessionSummary;
559
+
560
+ /**
561
+ * Builds a deterministic activity summary from a session index (v4.2).
562
+ * Read-only; does not mutate traces or invent relationships.
563
+ */
564
+ declare function buildActivitySummary(index: SessionIndex, options?: BuildActivitySummaryOptions): ActivitySummary;
565
+ /** Renders a human activity summary for terminal output. */
566
+ declare function renderActivitySummaryHuman(summary: ActivitySummary): string;
567
+
490
568
  /** Enriches trace metadata with run_started metadata for session indexing. */
491
569
  declare function enrichSessionRunRecord(meta: TraceMetadata): Promise<SessionRunRecord>;
492
570
  /** Builds session run records from extracted trace metadata rows. */
@@ -565,4 +643,96 @@ declare function isAgentInspectTrace(filePath: string): Promise<boolean>;
565
643
  */
566
644
  declare function parseDuration(duration: string): number;
567
645
 
568
- export { type BuildSessionIndexOptions, type CriticalPathStep, DEFAULT_TRACE_DIR_NAME, type DurationStats, ErrorInfo, type ExplainFact, type ExplainInference, type ExplainMode, type ExplainOptions, type ExplainResult, FALLBACK_TRACE_DIR, type GroupSessionCohortsOptions, type HandoffEdge, InspectRunTree, MAX_NAME_LENGTH, MAX_TERMINAL_DEPTH, MAX_TERMINAL_NAME_LENGTH, type ParseTraceJsonlOptions, type ParseTraceJsonlResult, type ParsedDurationFilter, RUNS_DIR_NAME, RedactionProfile, type RenderTimelineOptions, type RenderWhatOptions, type ResolvedRedactionProfile, type RetryLink, RunStatus, RunSummary, type RunTimeline, type RunWhatSummary, SESSION_WORKFLOW_KEYS, type SessionCohort, type SessionCohortKind, type SessionConfidence, type SessionEdgeSource, type SessionGroup, type SessionIndex, type SessionRunRecord, type SessionScopeOptions, type SessionScopeResult, type SessionSummary, type SessionWarning, type SessionWorkflowKey, type SessionWorkflowMetadata, StepStatus, StepType, TERMINAL_INDENT, type TimelineEntry, type TimelineFocus, type TimelineOptions, TraceCorrelationMetadata, TraceDirectory, type TraceDirectoryOptions, TraceEvent, type TraceFilterOptions, type TraceJsonlFormat, TraceMetadata, TraceMetadataStatus, type TraceSearchOptions, type TraceSearchResult, type TraceSessionCheckResult, type TraceStats, type TraceStatsOptions, type TraceStatsRankedRun, type TraceStatsRankedStep, aggregateSessionCheckResults, buildLocalExplanation, buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildSessionIndex, buildTraceStats, createRunId, createStepId, enrichSessionRunRecord, ensureTraceDir, extractMetadata, extractSessionWorkflowMetadata, filterMetasBySessionScope, filterTraces, formatDuration, formatError, formatTerminalName, formatTimestamp, getDefaultTraceDir, getIndent, getRunIdFromTraceFileName, getTraceFilePath, groupSessionCohorts, initializeTraceFile, isAgentInspectTrace, listTraceFiles, loadSessionRunRecords, loadTraceMetadataList, parseDuration, parseDurationFilter, parseTraceJsonl, printError, printFailedAt, printRunComplete, printRunStart, printStepComplete, printStepStart, readTraceEvents, readTraceFile, renderErrorLine, renderRunSummary, renderRunWhat, renderStepLine, renderTimeline, renderTraceStats, resolveRedactionProfile, resolveTraceDir, searchTraces, serializeEvent, sessionKeyForRun, traceMetasToSessionRunRecords, truncateName, unknownTraceFormatMessage, validateEvent, warn, writeTraceEvent };
646
+ /** Aggregate verify-safe status for a bundle. */
647
+ type BundleSafeStatus = "SAFE" | "SAFE WITH WARNINGS" | "UNSAFE" | "UNKNOWN";
648
+ /** Metadata-safe status (underscore form). */
649
+ type BundleSafeStatusMetadata = "SAFE" | "SAFE_WITH_WARNINGS" | "UNSAFE" | "UNKNOWN";
650
+ type BundleRedactionProfile = "local" | "share" | "strict";
651
+ interface BundleMetadata {
652
+ createdAt: string;
653
+ agentInspectVersion: string;
654
+ redactionProfile: BundleRedactionProfile;
655
+ sourceTraceCount: number;
656
+ runIds: string[];
657
+ safeStatus: BundleSafeStatusMetadata;
658
+ files: string[];
659
+ note: string;
660
+ sessionId?: string;
661
+ since?: string;
662
+ }
663
+ interface BundleRedactionReportRun {
664
+ runId: string;
665
+ findings: number;
666
+ detectors: string[];
667
+ }
668
+ interface BundleRedactionReport {
669
+ profile: BundleRedactionProfile;
670
+ totalFindings: number;
671
+ runs: BundleRedactionReportRun[];
672
+ }
673
+ interface BundleCheckRunResult {
674
+ runId: string;
675
+ status: BundleSafeStatus;
676
+ errors: number;
677
+ warnings: number;
678
+ findings: number;
679
+ }
680
+ interface BundleCheckResults {
681
+ aggregateStatus: BundleSafeStatus;
682
+ runs: BundleCheckRunResult[];
683
+ }
684
+ interface BundleResolveOptions {
685
+ runId?: string;
686
+ sessionId?: string;
687
+ since?: string;
688
+ }
689
+ interface BundleResolveResult {
690
+ runIds: string[];
691
+ sessionId?: string;
692
+ since?: string;
693
+ }
694
+ interface BundlePlaceholderArtifact {
695
+ status: "not_requested";
696
+ note: string;
697
+ }
698
+
699
+ /**
700
+ * Resolves which run ids belong in a bundle.
701
+ *
702
+ * @throws when target mode is missing, ambiguous, or yields zero runs.
703
+ */
704
+ declare function resolveBundleRunIds(index: SessionIndex, runs: readonly SessionRunRecord[], options: BundleResolveOptions): BundleResolveResult;
705
+
706
+ declare function buildBundleMetadata(parts: {
707
+ agentInspectVersion: string;
708
+ profile: BundleRedactionProfile;
709
+ resolve: BundleResolveResult;
710
+ checks: BundleCheckResults;
711
+ files: string[];
712
+ createdAt?: string;
713
+ }): BundleMetadata;
714
+ declare function buildPlaceholderArtifact(): BundlePlaceholderArtifact;
715
+
716
+ /**
717
+ * Builds a human-readable bundle summary for `summary.md`.
718
+ */
719
+ declare function buildBundleSummaryMarkdown(parts: {
720
+ metadata: BundleMetadata;
721
+ checks: BundleCheckResults;
722
+ redaction: BundleRedactionReport;
723
+ }): string;
724
+
725
+ declare function aggregateBundleSafeStatus(statuses: readonly BundleSafeStatus[]): BundleSafeStatus;
726
+ declare function toMetadataSafeStatus(status: BundleSafeStatus): BundleSafeStatusMetadata;
727
+ declare function bundleFailsOnSafety(status: BundleSafeStatus, allowUnsafe: boolean): boolean;
728
+
729
+ /**
730
+ * Normalizes bundle output path. Strips a `.zip` suffix (folder-first MVP).
731
+ */
732
+ declare function normalizeBundleOutputPath(out: string): string;
733
+ /**
734
+ * Default bundle directory when --out is omitted.
735
+ */
736
+ declare function defaultBundleOutputPath(runIds: readonly string[]): string;
737
+
738
+ export { type ActivityEntry, type ActivitySummary, type BuildActivitySummaryOptions, type BuildSessionIndexOptions, type BundleCheckResults, type BundleCheckRunResult, type BundleMetadata, type BundlePlaceholderArtifact, type BundleRedactionProfile, type BundleRedactionReport, type BundleRedactionReportRun, type BundleResolveOptions, type BundleResolveResult, type BundleSafeStatus, type BundleSafeStatusMetadata, type CriticalPathStep, DEFAULT_TRACE_DIR_NAME, type DurationStats, type EnrichSessionSummaryOptions, ErrorInfo, type ExplainFact, type ExplainInference, type ExplainMode, type ExplainOptions, type ExplainResult, FALLBACK_TRACE_DIR, type GroupSessionCohortsOptions, type HandoffEdge, InspectRunTree, MAX_NAME_LENGTH, MAX_TERMINAL_DEPTH, MAX_TERMINAL_NAME_LENGTH, type ParseTraceJsonlOptions, type ParseTraceJsonlResult, type ParsedDurationFilter, RUNS_DIR_NAME, RedactionProfile, type RenderTimelineOptions, type RenderWhatOptions, type ResolvedRedactionProfile, type RetryLink, RunStatus, RunSummary, type RunTimeline, type RunWhatSummary, SESSION_WORKFLOW_KEYS, type SessionCheckSummary, type SessionCohort, type SessionCohortKind, type SessionConfidence, type SessionEdgeSource, type SessionGroup, type SessionIndex, type SessionLastError, type SessionRunRecord, type SessionScopeOptions, type SessionScopeResult, type SessionStatus, type SessionSummary, type SessionWarning, type SessionWorkflowKey, type SessionWorkflowMetadata, StepStatus, StepType, TERMINAL_INDENT, type TimelineEntry, type TimelineFocus, type TimelineOptions, TraceCorrelationMetadata, TraceDirectory, type TraceDirectoryOptions, TraceEvent, type TraceFilterOptions, type TraceJsonlFormat, TraceMetadata, TraceMetadataStatus, type TraceSearchOptions, type TraceSearchResult, type TraceSessionCheckResult, type TraceStats, type TraceStatsOptions, type TraceStatsRankedRun, type TraceStatsRankedStep, aggregateBundleSafeStatus, aggregateSessionCheckResults, buildActivitySummary, buildBundleMetadata, buildBundleSummaryMarkdown, buildLocalExplanation, buildPlaceholderArtifact, buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildSessionIndex, buildTraceStats, bundleFailsOnSafety, createRunId, createStepId, defaultBundleOutputPath, deriveSessionStatus, enrichSessionRunRecord, enrichSessionSummary, ensureTraceDir, extractMetadata, extractSessionWorkflowMetadata, filterMetasBySessionScope, filterTraces, formatDuration, formatError, formatTerminalName, formatTimestamp, getDefaultTraceDir, getIndent, getRunIdFromTraceFileName, getTraceFilePath, groupSessionCohorts, initializeTraceFile, isAgentInspectTrace, listTraceFiles, loadSessionRunRecords, loadTraceMetadataList, normalizeBundleOutputPath, parseDuration, parseDurationFilter, parseTraceJsonl, printError, printFailedAt, printRunComplete, printRunStart, printStepComplete, printStepStart, readTraceEvents, readTraceFile, renderActivitySummaryHuman, renderErrorLine, renderRunSummary, renderRunWhat, renderStepLine, renderTimeline, renderTraceStats, resolveBundleRunIds, resolveRedactionProfile, resolveTraceDir, searchTraces, serializeEvent, sessionKeyForRun, toMetadataSafeStatus, traceMetasToSessionRunRecords, truncateName, unknownTraceFormatMessage, validateEvent, warn, writeTraceEvent };