agent-inspect 2.3.0 → 2.5.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.
- package/CHANGELOG.md +24 -0
- package/README.md +33 -4
- package/docs/ADAPTERS.md +47 -0
- package/docs/CLI.md +57 -1
- package/docs/LIMITATIONS.md +6 -0
- package/docs/SCHEMA.md +1 -0
- package/package.json +2 -2
- package/packages/cli/dist/index.cjs +1454 -74
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +1455 -75
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/core/dist/advanced.cjs +581 -3
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +172 -8
- package/packages/core/dist/advanced.d.ts +172 -8
- package/packages/core/dist/advanced.mjs +572 -4
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/checks.d.cts +2 -2
- package/packages/core/dist/checks.d.ts +2 -2
- package/packages/core/dist/{context-yv2VSDQF.d.ts → context-BDZmi53V.d.ts} +3 -3
- package/packages/core/dist/{context-CSKnzpXR.d.cts → context-DjY-jvQk.d.cts} +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/index.d.cts +6 -6
- package/packages/core/dist/index.d.ts +6 -6
- package/packages/core/dist/{inspect-event-CevRYp58.d.cts → inspect-event-CYAV7Hxm.d.cts} +1 -1
- package/packages/core/dist/{inspect-event-CevRYp58.d.ts → inspect-event-CYAV7Hxm.d.ts} +1 -1
- package/packages/core/dist/{log-config-8aE5Kxtr.d.cts → log-config-BNQ9UTmP.d.cts} +1 -1
- package/packages/core/dist/{log-config-DVimQJho.d.ts → log-config-D3Yp1SZN.d.ts} +1 -1
- package/packages/core/dist/logs.d.cts +3 -3
- package/packages/core/dist/logs.d.ts +3 -3
- package/packages/core/dist/{persisted-inspect-event-D-WpXeZX.d.ts → persisted-inspect-event-BLvb0jSX.d.ts} +1 -1
- package/packages/core/dist/{persisted-inspect-event-DHcHPUKv.d.cts → persisted-inspect-event-D5SjBz9b.d.cts} +1 -1
- package/packages/core/dist/persisted.d.cts +5 -5
- package/packages/core/dist/persisted.d.ts +5 -5
- package/packages/core/dist/readers.d.cts +2 -2
- package/packages/core/dist/readers.d.ts +2 -2
- package/packages/core/dist/{types-DgMN3qow.d.cts → types-C-llnPH0.d.cts} +1 -1
- package/packages/core/dist/{types-D-Y1kOU-.d.ts → types-CQun9LW6.d.ts} +1 -1
- package/packages/core/dist/writers.d.cts +2 -2
- package/packages/core/dist/writers.d.ts +2 -2
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
export { C as CreateInspectorOptions, D as DEFAULT_MAX_EVENT_BYTES, f as DEFAULT_MAX_METADATA_VALUE_LENGTH, h as DEFAULT_MAX_PREVIEW_LENGTH, I as Inspector, a as InspectorCaptureOptions, b as InspectorObserveOptions, c as InspectorRunOptions, i as InspectorRuntime, j as InspectorRuntimeContext, k as InspectorRuntimeDiagnostics, l as InspectorRuntimeOptions, d as InspectorStepOptions, T as TraceSafetyOptions, e as createInspector, n as createInspectorRuntime, o as getCurrentContext, g as getCurrentCorrelationMetadata, p as getCurrentDepth, q as getCurrentRunId, r as getCurrentRunName, s as getCurrentStepId, t as getParentStepId, u as getTraceDirFromContext, v as getTraceSafetyFromContext, w as hasActiveContext, x as isAgentInspectEnabled, y as isSilentContext, m as maybeInspectRun, z as prepareMetadataForDisk, A as prepareTraceEventForDisk, B as resolveTraceSafetyOptions, E as runWithContext, F as runWithStepContext } from './context-
|
|
2
|
-
import { R as RedactionProfile, E as ErrorInfo, b as RunStatus, e as StepStatus, h as TraceEvent, j as RunSummary, k as TraceMetadata, l as TraceMetadataStatus, f as StepType, g as TraceCorrelationMetadata } from './types-
|
|
3
|
-
export { A as ActiveStepContext, i as ExecutionContext, I as InspectRunOptions, O as ObserveOptions, a as Run, m as RunCompletedEvent, n as RunStartedEvent, c as Step, o as StepCompletedEvent, d as StepMetadata, S as StepOptions, p as StepStartedEvent, T as TokenMetadata, q as TraceEventBase, r as TraceSchemaVersion, s as isStepStatus, t as isStepType, u as isTraceEvent } from './types-
|
|
4
|
-
import {
|
|
5
|
-
export { A as AttributionConfidence, E as EventSource,
|
|
6
|
-
import { P as PersistedInspectEvent } from './persisted-inspect-event-
|
|
1
|
+
export { C as CreateInspectorOptions, D as DEFAULT_MAX_EVENT_BYTES, f as DEFAULT_MAX_METADATA_VALUE_LENGTH, h as DEFAULT_MAX_PREVIEW_LENGTH, I as Inspector, a as InspectorCaptureOptions, b as InspectorObserveOptions, c as InspectorRunOptions, i as InspectorRuntime, j as InspectorRuntimeContext, k as InspectorRuntimeDiagnostics, l as InspectorRuntimeOptions, d as InspectorStepOptions, T as TraceSafetyOptions, e as createInspector, n as createInspectorRuntime, o as getCurrentContext, g as getCurrentCorrelationMetadata, p as getCurrentDepth, q as getCurrentRunId, r as getCurrentRunName, s as getCurrentStepId, t as getParentStepId, u as getTraceDirFromContext, v as getTraceSafetyFromContext, w as hasActiveContext, x as isAgentInspectEnabled, y as isSilentContext, m as maybeInspectRun, z as prepareMetadataForDisk, A as prepareTraceEventForDisk, B as resolveTraceSafetyOptions, E as runWithContext, F as runWithStepContext } from './context-DjY-jvQk.cjs';
|
|
2
|
+
import { R as RedactionProfile, E as ErrorInfo, b as RunStatus, e as StepStatus, h as TraceEvent, j as RunSummary, k as TraceMetadata, l as TraceMetadataStatus, f as StepType, g as TraceCorrelationMetadata } from './types-C-llnPH0.cjs';
|
|
3
|
+
export { A as ActiveStepContext, i as ExecutionContext, I as InspectRunOptions, O as ObserveOptions, a as Run, m as RunCompletedEvent, n as RunStartedEvent, c as Step, o as StepCompletedEvent, d as StepMetadata, S as StepOptions, p as StepStartedEvent, T as TokenMetadata, q as TraceEventBase, r as TraceSchemaVersion, s as isStepStatus, t as isStepType, u as isTraceEvent } from './types-C-llnPH0.cjs';
|
|
4
|
+
import { b as InspectRunTree } from './inspect-event-CYAV7Hxm.cjs';
|
|
5
|
+
export { A as AttributionConfidence, E as EventSource, a as InspectEvent, I as InspectKind, c as InspectNode } from './inspect-event-CYAV7Hxm.cjs';
|
|
6
|
+
import { P as PersistedInspectEvent } from './persisted-inspect-event-D5SjBz9b.cjs';
|
|
7
7
|
import { Stats } from 'node:fs';
|
|
8
|
+
import { TraceCheckResult, TraceCheckStatus } from './checks.cjs';
|
|
8
9
|
import './writers.cjs';
|
|
9
|
-
import './log-config-
|
|
10
|
+
import './log-config-BNQ9UTmP.cjs';
|
|
11
|
+
import './readers.cjs';
|
|
10
12
|
|
|
11
13
|
interface ResolvedRedactionProfile {
|
|
12
14
|
profile: RedactionProfile;
|
|
@@ -365,6 +367,8 @@ interface TraceSearchOptions {
|
|
|
365
367
|
tool?: string;
|
|
366
368
|
duration?: string;
|
|
367
369
|
limit?: number;
|
|
370
|
+
session?: string;
|
|
371
|
+
correlateGroup?: boolean;
|
|
368
372
|
}
|
|
369
373
|
interface TraceSearchResult {
|
|
370
374
|
runId: string;
|
|
@@ -378,6 +382,7 @@ interface TraceSearchResult {
|
|
|
378
382
|
matchReason: string;
|
|
379
383
|
matchedFields: string[];
|
|
380
384
|
filePath: string;
|
|
385
|
+
sessionId?: string;
|
|
381
386
|
}
|
|
382
387
|
interface ParsedDurationFilter {
|
|
383
388
|
op: ">" | ">=" | "<" | "<=";
|
|
@@ -387,6 +392,165 @@ declare function parseDurationFilter(expr: string): ParsedDurationFilter;
|
|
|
387
392
|
declare function searchTraces(metas: TraceMetadata[], options: TraceSearchOptions): Promise<TraceSearchResult[]>;
|
|
388
393
|
declare function loadTraceMetadataList(_traceDir: string, fileNames: string[], getPath: (fileName: string) => string): Promise<TraceMetadata[]>;
|
|
389
394
|
|
|
395
|
+
/** Known session/workflow metadata keys (v2.4 RFC). */
|
|
396
|
+
declare const SESSION_WORKFLOW_KEYS: readonly ["sessionId", "conversationId", "groupId", "parentGroupId", "attempt", "retryOf", "retryReason", "handoffFrom", "handoffTo", "subAgentId", "subAgentName", "jobId", "queueName", "workflowName", "workflowStep", "toolCallId", "mcpToolCallId", "linkedStepId", "correlationId", "requestId", "decisionId"];
|
|
397
|
+
type SessionWorkflowKey = (typeof SESSION_WORKFLOW_KEYS)[number];
|
|
398
|
+
type SessionConfidence = "explicit" | "correlated" | "heuristic" | "unknown";
|
|
399
|
+
type SessionEdgeSource = "manual" | "adapter" | "json-log" | "log4js" | "mcp-client" | "inferred";
|
|
400
|
+
interface SessionWorkflowMetadata {
|
|
401
|
+
sessionId?: string;
|
|
402
|
+
conversationId?: string;
|
|
403
|
+
groupId?: string;
|
|
404
|
+
parentGroupId?: string;
|
|
405
|
+
attempt?: number;
|
|
406
|
+
retryOf?: string;
|
|
407
|
+
retryReason?: string;
|
|
408
|
+
handoffFrom?: string;
|
|
409
|
+
handoffTo?: string;
|
|
410
|
+
subAgentId?: string;
|
|
411
|
+
subAgentName?: string;
|
|
412
|
+
jobId?: string;
|
|
413
|
+
queueName?: string;
|
|
414
|
+
workflowName?: string;
|
|
415
|
+
workflowStep?: string;
|
|
416
|
+
toolCallId?: string;
|
|
417
|
+
mcpToolCallId?: string;
|
|
418
|
+
linkedStepId?: string;
|
|
419
|
+
correlationId?: string;
|
|
420
|
+
requestId?: string;
|
|
421
|
+
decisionId?: string;
|
|
422
|
+
}
|
|
423
|
+
interface SessionRunRecord {
|
|
424
|
+
runId: string;
|
|
425
|
+
name?: string;
|
|
426
|
+
status?: TraceMetadataStatus;
|
|
427
|
+
startedAt?: number;
|
|
428
|
+
endedAt?: number;
|
|
429
|
+
durationMs?: number;
|
|
430
|
+
filePath?: string;
|
|
431
|
+
metadata?: Record<string, unknown>;
|
|
432
|
+
}
|
|
433
|
+
interface SessionWarning {
|
|
434
|
+
code: string;
|
|
435
|
+
message: string;
|
|
436
|
+
runId?: string;
|
|
437
|
+
sessionId?: string;
|
|
438
|
+
}
|
|
439
|
+
interface HandoffEdge {
|
|
440
|
+
from: string;
|
|
441
|
+
to: string;
|
|
442
|
+
source: SessionEdgeSource;
|
|
443
|
+
confidence: SessionConfidence;
|
|
444
|
+
}
|
|
445
|
+
interface RetryLink {
|
|
446
|
+
runId: string;
|
|
447
|
+
retryOf?: string;
|
|
448
|
+
attempt?: number;
|
|
449
|
+
source: SessionEdgeSource;
|
|
450
|
+
confidence: SessionConfidence;
|
|
451
|
+
}
|
|
452
|
+
interface SessionGroup {
|
|
453
|
+
groupId: string;
|
|
454
|
+
parentGroupId?: string;
|
|
455
|
+
runIds: string[];
|
|
456
|
+
}
|
|
457
|
+
interface CriticalPathStep {
|
|
458
|
+
runId: string;
|
|
459
|
+
name?: string;
|
|
460
|
+
startedAt?: number;
|
|
461
|
+
durationMs?: number;
|
|
462
|
+
source: SessionEdgeSource;
|
|
463
|
+
confidence: SessionConfidence;
|
|
464
|
+
}
|
|
465
|
+
interface SessionSummary {
|
|
466
|
+
sessionId: string;
|
|
467
|
+
runIds: string[];
|
|
468
|
+
groups: SessionGroup[];
|
|
469
|
+
handoffs: HandoffEdge[];
|
|
470
|
+
retries: RetryLink[];
|
|
471
|
+
criticalPath: CriticalPathStep[];
|
|
472
|
+
}
|
|
473
|
+
interface SessionIndex {
|
|
474
|
+
runs: SessionRunRecord[];
|
|
475
|
+
sessions: SessionSummary[];
|
|
476
|
+
unscopedRunIds: string[];
|
|
477
|
+
warnings: SessionWarning[];
|
|
478
|
+
}
|
|
479
|
+
interface BuildSessionIndexOptions {
|
|
480
|
+
/** When true, group runs that share only `groupId` under a synthetic session key. */
|
|
481
|
+
correlateByGroupId?: boolean;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/** Extracts session/workflow metadata from a run metadata or attributes bag. */
|
|
485
|
+
declare function extractSessionWorkflowMetadata(record: Record<string, unknown> | undefined): SessionWorkflowMetadata | undefined;
|
|
486
|
+
declare function sessionKeyForRun(meta: SessionWorkflowMetadata | undefined, options?: {
|
|
487
|
+
correlateByGroupId?: boolean;
|
|
488
|
+
}): string | undefined;
|
|
489
|
+
|
|
490
|
+
/** Enriches trace metadata with run_started metadata for session indexing. */
|
|
491
|
+
declare function enrichSessionRunRecord(meta: TraceMetadata): Promise<SessionRunRecord>;
|
|
492
|
+
/** Builds session run records from extracted trace metadata rows. */
|
|
493
|
+
declare function loadSessionRunRecords(metas: readonly TraceMetadata[]): Promise<SessionRunRecord[]>;
|
|
494
|
+
|
|
495
|
+
interface SessionScopeOptions {
|
|
496
|
+
sessionId?: string;
|
|
497
|
+
groupId?: string;
|
|
498
|
+
correlateByGroupId?: boolean;
|
|
499
|
+
}
|
|
500
|
+
interface SessionScopeResult {
|
|
501
|
+
metas: TraceMetadata[];
|
|
502
|
+
scopeLabel: string;
|
|
503
|
+
scopeKind: "session" | "group";
|
|
504
|
+
runIds: string[];
|
|
505
|
+
warnings: SessionWarning[];
|
|
506
|
+
notFound: boolean;
|
|
507
|
+
}
|
|
508
|
+
/** Filters trace metadata rows to runs in a session or group scope. */
|
|
509
|
+
declare function filterMetasBySessionScope(metas: readonly TraceMetadata[], records: readonly SessionRunRecord[], options: SessionScopeOptions): SessionScopeResult;
|
|
510
|
+
/** Lightweight metadata rows for scope resolution when run_started metadata is absent. */
|
|
511
|
+
declare function traceMetasToSessionRunRecords(metas: readonly TraceMetadata[]): SessionRunRecord[];
|
|
512
|
+
|
|
513
|
+
type SessionCohortKind = "session" | "group";
|
|
514
|
+
interface SessionCohort {
|
|
515
|
+
key: string;
|
|
516
|
+
kind: SessionCohortKind;
|
|
517
|
+
runIds: string[];
|
|
518
|
+
}
|
|
519
|
+
interface GroupSessionCohortsOptions extends BuildSessionIndexOptions {
|
|
520
|
+
groupBy?: "session" | "group";
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Groups runs into session or group cohort buckets for local search/check aggregation.
|
|
524
|
+
* Deterministic; does not infer causality from timestamps.
|
|
525
|
+
*/
|
|
526
|
+
declare function groupSessionCohorts(runs: readonly SessionRunRecord[], options?: GroupSessionCohortsOptions): SessionCohort[];
|
|
527
|
+
|
|
528
|
+
interface TraceSessionCheckResult extends TraceCheckResult {
|
|
529
|
+
scopeKind: "session" | "group";
|
|
530
|
+
scopeLabel: string;
|
|
531
|
+
runIds: string[];
|
|
532
|
+
runResults: Array<{
|
|
533
|
+
runId: string;
|
|
534
|
+
status: TraceCheckStatus;
|
|
535
|
+
}>;
|
|
536
|
+
sessionWarnings?: SessionWarning[];
|
|
537
|
+
}
|
|
538
|
+
/** Aggregates per-run check results for a session or group scope. */
|
|
539
|
+
declare function aggregateSessionCheckResults(perRun: readonly TraceCheckResult[], scope: {
|
|
540
|
+
scopeKind: "session" | "group";
|
|
541
|
+
scopeLabel: string;
|
|
542
|
+
runIds: string[];
|
|
543
|
+
sessionWarnings?: SessionWarning[];
|
|
544
|
+
notFound?: boolean;
|
|
545
|
+
empty?: boolean;
|
|
546
|
+
}): TraceSessionCheckResult;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Builds a deterministic session index from local run records and metadata.
|
|
550
|
+
* Does not read files or infer causality from timestamps alone.
|
|
551
|
+
*/
|
|
552
|
+
declare function buildSessionIndex(inputRuns: readonly SessionRunRecord[], options?: BuildSessionIndexOptions): SessionIndex;
|
|
553
|
+
|
|
390
554
|
/**
|
|
391
555
|
* Safety check for cleanup workflows: returns true only when the file appears to be an AgentInspect trace.
|
|
392
556
|
* This should be conservative: false positives are more dangerous than false negatives.
|
|
@@ -401,4 +565,4 @@ declare function isAgentInspectTrace(filePath: string): Promise<boolean>;
|
|
|
401
565
|
*/
|
|
402
566
|
declare function parseDuration(duration: string): number;
|
|
403
567
|
|
|
404
|
-
export { DEFAULT_TRACE_DIR_NAME, type DurationStats, ErrorInfo, type ExplainFact, type ExplainInference, type ExplainMode, type ExplainOptions, type ExplainResult, FALLBACK_TRACE_DIR, 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, RunStatus, RunSummary, type RunTimeline, type RunWhatSummary, 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 TraceStats, type TraceStatsOptions, type TraceStatsRankedRun, type TraceStatsRankedStep, buildLocalExplanation, buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildTraceStats, createRunId, createStepId, ensureTraceDir, extractMetadata, filterTraces, formatDuration, formatError, formatTerminalName, formatTimestamp, getDefaultTraceDir, getIndent, getRunIdFromTraceFileName, getTraceFilePath, initializeTraceFile, isAgentInspectTrace, listTraceFiles, loadTraceMetadataList, parseDuration, parseDurationFilter, parseTraceJsonl, printError, printFailedAt, printRunComplete, printRunStart, printStepComplete, printStepStart, readTraceEvents, readTraceFile, renderErrorLine, renderRunSummary, renderRunWhat, renderStepLine, renderTimeline, renderTraceStats, resolveRedactionProfile, resolveTraceDir, searchTraces, serializeEvent, truncateName, unknownTraceFormatMessage, validateEvent, warn, writeTraceEvent };
|
|
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 };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
export { C as CreateInspectorOptions, D as DEFAULT_MAX_EVENT_BYTES, f as DEFAULT_MAX_METADATA_VALUE_LENGTH, h as DEFAULT_MAX_PREVIEW_LENGTH, I as Inspector, a as InspectorCaptureOptions, b as InspectorObserveOptions, c as InspectorRunOptions, i as InspectorRuntime, j as InspectorRuntimeContext, k as InspectorRuntimeDiagnostics, l as InspectorRuntimeOptions, d as InspectorStepOptions, T as TraceSafetyOptions, e as createInspector, n as createInspectorRuntime, o as getCurrentContext, g as getCurrentCorrelationMetadata, p as getCurrentDepth, q as getCurrentRunId, r as getCurrentRunName, s as getCurrentStepId, t as getParentStepId, u as getTraceDirFromContext, v as getTraceSafetyFromContext, w as hasActiveContext, x as isAgentInspectEnabled, y as isSilentContext, m as maybeInspectRun, z as prepareMetadataForDisk, A as prepareTraceEventForDisk, B as resolveTraceSafetyOptions, E as runWithContext, F as runWithStepContext } from './context-
|
|
2
|
-
import { R as RedactionProfile, E as ErrorInfo, b as RunStatus, e as StepStatus, h as TraceEvent, j as RunSummary, k as TraceMetadata, l as TraceMetadataStatus, f as StepType, g as TraceCorrelationMetadata } from './types-
|
|
3
|
-
export { A as ActiveStepContext, i as ExecutionContext, I as InspectRunOptions, O as ObserveOptions, a as Run, m as RunCompletedEvent, n as RunStartedEvent, c as Step, o as StepCompletedEvent, d as StepMetadata, S as StepOptions, p as StepStartedEvent, T as TokenMetadata, q as TraceEventBase, r as TraceSchemaVersion, s as isStepStatus, t as isStepType, u as isTraceEvent } from './types-
|
|
4
|
-
import {
|
|
5
|
-
export { A as AttributionConfidence, E as EventSource,
|
|
6
|
-
import { P as PersistedInspectEvent } from './persisted-inspect-event-
|
|
1
|
+
export { C as CreateInspectorOptions, D as DEFAULT_MAX_EVENT_BYTES, f as DEFAULT_MAX_METADATA_VALUE_LENGTH, h as DEFAULT_MAX_PREVIEW_LENGTH, I as Inspector, a as InspectorCaptureOptions, b as InspectorObserveOptions, c as InspectorRunOptions, i as InspectorRuntime, j as InspectorRuntimeContext, k as InspectorRuntimeDiagnostics, l as InspectorRuntimeOptions, d as InspectorStepOptions, T as TraceSafetyOptions, e as createInspector, n as createInspectorRuntime, o as getCurrentContext, g as getCurrentCorrelationMetadata, p as getCurrentDepth, q as getCurrentRunId, r as getCurrentRunName, s as getCurrentStepId, t as getParentStepId, u as getTraceDirFromContext, v as getTraceSafetyFromContext, w as hasActiveContext, x as isAgentInspectEnabled, y as isSilentContext, m as maybeInspectRun, z as prepareMetadataForDisk, A as prepareTraceEventForDisk, B as resolveTraceSafetyOptions, E as runWithContext, F as runWithStepContext } from './context-BDZmi53V.js';
|
|
2
|
+
import { R as RedactionProfile, E as ErrorInfo, b as RunStatus, e as StepStatus, h as TraceEvent, j as RunSummary, k as TraceMetadata, l as TraceMetadataStatus, f as StepType, g as TraceCorrelationMetadata } from './types-CQun9LW6.js';
|
|
3
|
+
export { A as ActiveStepContext, i as ExecutionContext, I as InspectRunOptions, O as ObserveOptions, a as Run, m as RunCompletedEvent, n as RunStartedEvent, c as Step, o as StepCompletedEvent, d as StepMetadata, S as StepOptions, p as StepStartedEvent, T as TokenMetadata, q as TraceEventBase, r as TraceSchemaVersion, s as isStepStatus, t as isStepType, u as isTraceEvent } from './types-CQun9LW6.js';
|
|
4
|
+
import { b as InspectRunTree } from './inspect-event-CYAV7Hxm.js';
|
|
5
|
+
export { A as AttributionConfidence, E as EventSource, a as InspectEvent, I as InspectKind, c as InspectNode } from './inspect-event-CYAV7Hxm.js';
|
|
6
|
+
import { P as PersistedInspectEvent } from './persisted-inspect-event-BLvb0jSX.js';
|
|
7
7
|
import { Stats } from 'node:fs';
|
|
8
|
+
import { TraceCheckResult, TraceCheckStatus } from './checks.js';
|
|
8
9
|
import './writers.js';
|
|
9
|
-
import './log-config-
|
|
10
|
+
import './log-config-D3Yp1SZN.js';
|
|
11
|
+
import './readers.js';
|
|
10
12
|
|
|
11
13
|
interface ResolvedRedactionProfile {
|
|
12
14
|
profile: RedactionProfile;
|
|
@@ -365,6 +367,8 @@ interface TraceSearchOptions {
|
|
|
365
367
|
tool?: string;
|
|
366
368
|
duration?: string;
|
|
367
369
|
limit?: number;
|
|
370
|
+
session?: string;
|
|
371
|
+
correlateGroup?: boolean;
|
|
368
372
|
}
|
|
369
373
|
interface TraceSearchResult {
|
|
370
374
|
runId: string;
|
|
@@ -378,6 +382,7 @@ interface TraceSearchResult {
|
|
|
378
382
|
matchReason: string;
|
|
379
383
|
matchedFields: string[];
|
|
380
384
|
filePath: string;
|
|
385
|
+
sessionId?: string;
|
|
381
386
|
}
|
|
382
387
|
interface ParsedDurationFilter {
|
|
383
388
|
op: ">" | ">=" | "<" | "<=";
|
|
@@ -387,6 +392,165 @@ declare function parseDurationFilter(expr: string): ParsedDurationFilter;
|
|
|
387
392
|
declare function searchTraces(metas: TraceMetadata[], options: TraceSearchOptions): Promise<TraceSearchResult[]>;
|
|
388
393
|
declare function loadTraceMetadataList(_traceDir: string, fileNames: string[], getPath: (fileName: string) => string): Promise<TraceMetadata[]>;
|
|
389
394
|
|
|
395
|
+
/** Known session/workflow metadata keys (v2.4 RFC). */
|
|
396
|
+
declare const SESSION_WORKFLOW_KEYS: readonly ["sessionId", "conversationId", "groupId", "parentGroupId", "attempt", "retryOf", "retryReason", "handoffFrom", "handoffTo", "subAgentId", "subAgentName", "jobId", "queueName", "workflowName", "workflowStep", "toolCallId", "mcpToolCallId", "linkedStepId", "correlationId", "requestId", "decisionId"];
|
|
397
|
+
type SessionWorkflowKey = (typeof SESSION_WORKFLOW_KEYS)[number];
|
|
398
|
+
type SessionConfidence = "explicit" | "correlated" | "heuristic" | "unknown";
|
|
399
|
+
type SessionEdgeSource = "manual" | "adapter" | "json-log" | "log4js" | "mcp-client" | "inferred";
|
|
400
|
+
interface SessionWorkflowMetadata {
|
|
401
|
+
sessionId?: string;
|
|
402
|
+
conversationId?: string;
|
|
403
|
+
groupId?: string;
|
|
404
|
+
parentGroupId?: string;
|
|
405
|
+
attempt?: number;
|
|
406
|
+
retryOf?: string;
|
|
407
|
+
retryReason?: string;
|
|
408
|
+
handoffFrom?: string;
|
|
409
|
+
handoffTo?: string;
|
|
410
|
+
subAgentId?: string;
|
|
411
|
+
subAgentName?: string;
|
|
412
|
+
jobId?: string;
|
|
413
|
+
queueName?: string;
|
|
414
|
+
workflowName?: string;
|
|
415
|
+
workflowStep?: string;
|
|
416
|
+
toolCallId?: string;
|
|
417
|
+
mcpToolCallId?: string;
|
|
418
|
+
linkedStepId?: string;
|
|
419
|
+
correlationId?: string;
|
|
420
|
+
requestId?: string;
|
|
421
|
+
decisionId?: string;
|
|
422
|
+
}
|
|
423
|
+
interface SessionRunRecord {
|
|
424
|
+
runId: string;
|
|
425
|
+
name?: string;
|
|
426
|
+
status?: TraceMetadataStatus;
|
|
427
|
+
startedAt?: number;
|
|
428
|
+
endedAt?: number;
|
|
429
|
+
durationMs?: number;
|
|
430
|
+
filePath?: string;
|
|
431
|
+
metadata?: Record<string, unknown>;
|
|
432
|
+
}
|
|
433
|
+
interface SessionWarning {
|
|
434
|
+
code: string;
|
|
435
|
+
message: string;
|
|
436
|
+
runId?: string;
|
|
437
|
+
sessionId?: string;
|
|
438
|
+
}
|
|
439
|
+
interface HandoffEdge {
|
|
440
|
+
from: string;
|
|
441
|
+
to: string;
|
|
442
|
+
source: SessionEdgeSource;
|
|
443
|
+
confidence: SessionConfidence;
|
|
444
|
+
}
|
|
445
|
+
interface RetryLink {
|
|
446
|
+
runId: string;
|
|
447
|
+
retryOf?: string;
|
|
448
|
+
attempt?: number;
|
|
449
|
+
source: SessionEdgeSource;
|
|
450
|
+
confidence: SessionConfidence;
|
|
451
|
+
}
|
|
452
|
+
interface SessionGroup {
|
|
453
|
+
groupId: string;
|
|
454
|
+
parentGroupId?: string;
|
|
455
|
+
runIds: string[];
|
|
456
|
+
}
|
|
457
|
+
interface CriticalPathStep {
|
|
458
|
+
runId: string;
|
|
459
|
+
name?: string;
|
|
460
|
+
startedAt?: number;
|
|
461
|
+
durationMs?: number;
|
|
462
|
+
source: SessionEdgeSource;
|
|
463
|
+
confidence: SessionConfidence;
|
|
464
|
+
}
|
|
465
|
+
interface SessionSummary {
|
|
466
|
+
sessionId: string;
|
|
467
|
+
runIds: string[];
|
|
468
|
+
groups: SessionGroup[];
|
|
469
|
+
handoffs: HandoffEdge[];
|
|
470
|
+
retries: RetryLink[];
|
|
471
|
+
criticalPath: CriticalPathStep[];
|
|
472
|
+
}
|
|
473
|
+
interface SessionIndex {
|
|
474
|
+
runs: SessionRunRecord[];
|
|
475
|
+
sessions: SessionSummary[];
|
|
476
|
+
unscopedRunIds: string[];
|
|
477
|
+
warnings: SessionWarning[];
|
|
478
|
+
}
|
|
479
|
+
interface BuildSessionIndexOptions {
|
|
480
|
+
/** When true, group runs that share only `groupId` under a synthetic session key. */
|
|
481
|
+
correlateByGroupId?: boolean;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/** Extracts session/workflow metadata from a run metadata or attributes bag. */
|
|
485
|
+
declare function extractSessionWorkflowMetadata(record: Record<string, unknown> | undefined): SessionWorkflowMetadata | undefined;
|
|
486
|
+
declare function sessionKeyForRun(meta: SessionWorkflowMetadata | undefined, options?: {
|
|
487
|
+
correlateByGroupId?: boolean;
|
|
488
|
+
}): string | undefined;
|
|
489
|
+
|
|
490
|
+
/** Enriches trace metadata with run_started metadata for session indexing. */
|
|
491
|
+
declare function enrichSessionRunRecord(meta: TraceMetadata): Promise<SessionRunRecord>;
|
|
492
|
+
/** Builds session run records from extracted trace metadata rows. */
|
|
493
|
+
declare function loadSessionRunRecords(metas: readonly TraceMetadata[]): Promise<SessionRunRecord[]>;
|
|
494
|
+
|
|
495
|
+
interface SessionScopeOptions {
|
|
496
|
+
sessionId?: string;
|
|
497
|
+
groupId?: string;
|
|
498
|
+
correlateByGroupId?: boolean;
|
|
499
|
+
}
|
|
500
|
+
interface SessionScopeResult {
|
|
501
|
+
metas: TraceMetadata[];
|
|
502
|
+
scopeLabel: string;
|
|
503
|
+
scopeKind: "session" | "group";
|
|
504
|
+
runIds: string[];
|
|
505
|
+
warnings: SessionWarning[];
|
|
506
|
+
notFound: boolean;
|
|
507
|
+
}
|
|
508
|
+
/** Filters trace metadata rows to runs in a session or group scope. */
|
|
509
|
+
declare function filterMetasBySessionScope(metas: readonly TraceMetadata[], records: readonly SessionRunRecord[], options: SessionScopeOptions): SessionScopeResult;
|
|
510
|
+
/** Lightweight metadata rows for scope resolution when run_started metadata is absent. */
|
|
511
|
+
declare function traceMetasToSessionRunRecords(metas: readonly TraceMetadata[]): SessionRunRecord[];
|
|
512
|
+
|
|
513
|
+
type SessionCohortKind = "session" | "group";
|
|
514
|
+
interface SessionCohort {
|
|
515
|
+
key: string;
|
|
516
|
+
kind: SessionCohortKind;
|
|
517
|
+
runIds: string[];
|
|
518
|
+
}
|
|
519
|
+
interface GroupSessionCohortsOptions extends BuildSessionIndexOptions {
|
|
520
|
+
groupBy?: "session" | "group";
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Groups runs into session or group cohort buckets for local search/check aggregation.
|
|
524
|
+
* Deterministic; does not infer causality from timestamps.
|
|
525
|
+
*/
|
|
526
|
+
declare function groupSessionCohorts(runs: readonly SessionRunRecord[], options?: GroupSessionCohortsOptions): SessionCohort[];
|
|
527
|
+
|
|
528
|
+
interface TraceSessionCheckResult extends TraceCheckResult {
|
|
529
|
+
scopeKind: "session" | "group";
|
|
530
|
+
scopeLabel: string;
|
|
531
|
+
runIds: string[];
|
|
532
|
+
runResults: Array<{
|
|
533
|
+
runId: string;
|
|
534
|
+
status: TraceCheckStatus;
|
|
535
|
+
}>;
|
|
536
|
+
sessionWarnings?: SessionWarning[];
|
|
537
|
+
}
|
|
538
|
+
/** Aggregates per-run check results for a session or group scope. */
|
|
539
|
+
declare function aggregateSessionCheckResults(perRun: readonly TraceCheckResult[], scope: {
|
|
540
|
+
scopeKind: "session" | "group";
|
|
541
|
+
scopeLabel: string;
|
|
542
|
+
runIds: string[];
|
|
543
|
+
sessionWarnings?: SessionWarning[];
|
|
544
|
+
notFound?: boolean;
|
|
545
|
+
empty?: boolean;
|
|
546
|
+
}): TraceSessionCheckResult;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Builds a deterministic session index from local run records and metadata.
|
|
550
|
+
* Does not read files or infer causality from timestamps alone.
|
|
551
|
+
*/
|
|
552
|
+
declare function buildSessionIndex(inputRuns: readonly SessionRunRecord[], options?: BuildSessionIndexOptions): SessionIndex;
|
|
553
|
+
|
|
390
554
|
/**
|
|
391
555
|
* Safety check for cleanup workflows: returns true only when the file appears to be an AgentInspect trace.
|
|
392
556
|
* This should be conservative: false positives are more dangerous than false negatives.
|
|
@@ -401,4 +565,4 @@ declare function isAgentInspectTrace(filePath: string): Promise<boolean>;
|
|
|
401
565
|
*/
|
|
402
566
|
declare function parseDuration(duration: string): number;
|
|
403
567
|
|
|
404
|
-
export { DEFAULT_TRACE_DIR_NAME, type DurationStats, ErrorInfo, type ExplainFact, type ExplainInference, type ExplainMode, type ExplainOptions, type ExplainResult, FALLBACK_TRACE_DIR, 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, RunStatus, RunSummary, type RunTimeline, type RunWhatSummary, 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 TraceStats, type TraceStatsOptions, type TraceStatsRankedRun, type TraceStatsRankedStep, buildLocalExplanation, buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildTraceStats, createRunId, createStepId, ensureTraceDir, extractMetadata, filterTraces, formatDuration, formatError, formatTerminalName, formatTimestamp, getDefaultTraceDir, getIndent, getRunIdFromTraceFileName, getTraceFilePath, initializeTraceFile, isAgentInspectTrace, listTraceFiles, loadTraceMetadataList, parseDuration, parseDurationFilter, parseTraceJsonl, printError, printFailedAt, printRunComplete, printRunStart, printStepComplete, printStepStart, readTraceEvents, readTraceFile, renderErrorLine, renderRunSummary, renderRunWhat, renderStepLine, renderTimeline, renderTraceStats, resolveRedactionProfile, resolveTraceDir, searchTraces, serializeEvent, truncateName, unknownTraceFormatMessage, validateEvent, warn, writeTraceEvent };
|
|
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 };
|