agent-inspect 1.9.0 → 2.1.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 +14 -0
- package/README.md +27 -10
- package/docs/ADAPTER-CONFORMANCE.md +1 -1
- package/docs/ADAPTERS.md +4 -0
- package/docs/API.md +76 -35
- package/docs/CLI.md +129 -11
- package/docs/COMPARE.md +5 -4
- package/docs/EXPORTS.md +1 -1
- package/docs/GETTING-STARTED.md +26 -7
- package/docs/KNOWN-ISSUES.md +15 -3
- package/docs/LIMITATIONS.md +9 -7
- package/docs/MIGRATION.md +8 -8
- package/docs/SCHEMA.md +29 -12
- package/package.json +2 -2
- package/packages/cli/dist/index.cjs +9808 -8624
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +9807 -8623
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/core/dist/advanced.cjs +2047 -26
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +346 -196
- package/packages/core/dist/advanced.d.ts +346 -196
- package/packages/core/dist/advanced.mjs +628 -5
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/checks.d.cts +1 -1
- package/packages/core/dist/checks.d.ts +1 -1
- package/packages/core/dist/chunk-2ZXEMWGK.mjs +549 -0
- package/packages/core/dist/chunk-2ZXEMWGK.mjs.map +1 -0
- package/packages/core/dist/{chunk-57S5D6HR.mjs → chunk-4JVGFNQH.mjs} +50 -6
- package/packages/core/dist/chunk-4JVGFNQH.mjs.map +1 -0
- package/packages/core/dist/{chunk-6QSLZCBJ.mjs → chunk-A4V2H3YU.mjs} +329 -163
- package/packages/core/dist/chunk-A4V2H3YU.mjs.map +1 -0
- package/packages/core/dist/{chunk-74XZ6N7Q.mjs → chunk-IZBJAZGF.mjs} +12 -4
- package/packages/core/dist/chunk-IZBJAZGF.mjs.map +1 -0
- package/packages/core/dist/{chunk-VTIB5MDK.mjs → chunk-NQZPZ2FN.mjs} +15 -10
- package/packages/core/dist/chunk-NQZPZ2FN.mjs.map +1 -0
- package/packages/core/dist/{chunk-TZISEVLQ.mjs → chunk-XUNJMAPD.mjs} +3 -3
- package/packages/core/dist/{chunk-TZISEVLQ.mjs.map → chunk-XUNJMAPD.mjs.map} +1 -1
- package/packages/core/dist/context-CSKnzpXR.d.cts +177 -0
- package/packages/core/dist/context-yv2VSDQF.d.ts +177 -0
- package/packages/core/dist/diff.d.cts +2 -2
- package/packages/core/dist/diff.d.ts +2 -2
- package/packages/core/dist/diff.mjs +473 -3
- package/packages/core/dist/diff.mjs.map +1 -1
- package/packages/core/dist/exporters.cjs +691 -0
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.d.cts +24 -3
- package/packages/core/dist/exporters.d.ts +24 -3
- package/packages/core/dist/exporters.mjs +1113 -3
- package/packages/core/dist/exporters.mjs.map +1 -1
- package/packages/core/dist/index.cjs +1385 -8168
- package/packages/core/dist/index.cjs.map +1 -1
- package/packages/core/dist/index.d.cts +8 -350
- package/packages/core/dist/index.d.ts +8 -350
- package/packages/core/dist/index.mjs +18 -1478
- package/packages/core/dist/index.mjs.map +1 -1
- package/packages/core/dist/{log-config-DanPV3P9.d.cts → log-config-8aE5Kxtr.d.cts} +1 -1
- package/packages/core/dist/{log-config-BPHS4Sds.d.ts → log-config-DVimQJho.d.ts} +1 -1
- package/packages/core/dist/logs.d.cts +2 -2
- package/packages/core/dist/logs.d.ts +2 -2
- package/packages/core/dist/logs.mjs +785 -2
- package/packages/core/dist/logs.mjs.map +1 -1
- package/packages/core/dist/{persisted-inspect-event-Cw7TeYGr.d.ts → persisted-inspect-event-D-WpXeZX.d.ts} +14 -5
- package/packages/core/dist/{persisted-inspect-event-DHPfzUd8.d.cts → persisted-inspect-event-DHcHPUKv.d.cts} +14 -5
- package/packages/core/dist/persisted.cjs +11 -1
- package/packages/core/dist/persisted.cjs.map +1 -1
- package/packages/core/dist/persisted.d.cts +4 -4
- package/packages/core/dist/persisted.d.ts +4 -4
- package/packages/core/dist/persisted.mjs +150 -3
- package/packages/core/dist/persisted.mjs.map +1 -1
- package/packages/core/dist/readers.cjs +27 -10
- package/packages/core/dist/readers.cjs.map +1 -1
- package/packages/core/dist/readers.d.cts +1 -1
- package/packages/core/dist/readers.d.ts +1 -1
- package/packages/core/dist/readers.mjs +1580 -4
- package/packages/core/dist/readers.mjs.map +1 -1
- package/packages/core/dist/{types-Ap9uMdx_.d.ts → types-D-Y1kOU-.d.ts} +2 -2
- package/packages/core/dist/{types-B2-BU5CS.d.cts → types-DgMN3qow.d.cts} +2 -2
- package/packages/core/dist/writers.cjs +49 -3
- package/packages/core/dist/writers.cjs.map +1 -1
- package/packages/core/dist/writers.d.cts +1 -1
- package/packages/core/dist/writers.d.ts +1 -1
- package/packages/core/dist/writers.mjs +341 -4
- package/packages/core/dist/writers.mjs.map +1 -1
- package/packages/core/dist/chunk-57S5D6HR.mjs.map +0 -1
- package/packages/core/dist/chunk-6QSLZCBJ.mjs.map +0 -1
- package/packages/core/dist/chunk-6SZPTECC.mjs +0 -342
- package/packages/core/dist/chunk-6SZPTECC.mjs.map +0 -1
- package/packages/core/dist/chunk-74XZ6N7Q.mjs.map +0 -1
- package/packages/core/dist/chunk-HR7G62IE.mjs +0 -785
- package/packages/core/dist/chunk-HR7G62IE.mjs.map +0 -1
- package/packages/core/dist/chunk-TFLPUZ56.mjs +0 -1571
- package/packages/core/dist/chunk-TFLPUZ56.mjs.map +0 -1
- package/packages/core/dist/chunk-U2BGPESY.mjs +0 -150
- package/packages/core/dist/chunk-U2BGPESY.mjs.map +0 -1
- package/packages/core/dist/chunk-VTIB5MDK.mjs.map +0 -1
- package/packages/core/dist/chunk-Y56BPA3B.mjs +0 -990
- package/packages/core/dist/chunk-Y56BPA3B.mjs.map +0 -1
- package/packages/core/dist/chunk-YWAOOXLR.mjs +0 -475
- package/packages/core/dist/chunk-YWAOOXLR.mjs.map +0 -1
|
@@ -1,339 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export { L as LogEventMapping, a as LogIngestConfig, R as RedactionRule, b as RedactionStrategy } from './log-config-BPHS4Sds.js';
|
|
9
|
-
export { DEFAULT_LOG_INGEST_CONFIG, DEFAULT_REDACT_KEYS, EventNormalizer, JsonLogParser, LiveLogAccumulator, LiveLogAccumulatorOptions, LiveLogUpdate, Log4jsParser, LogSourceFormat, LogToTreeResult, NormalizeOptions, ParseLogLineOptions, ParseLogsOptions, ParseResult, ParserWarning, ParserWarningCode, RawLogRecord, Redactor, RedactorOptions, RenderTreeOptions, TreeBuilder, TreeBuilderOptions, loadLogIngestConfig, matchMapping, mergeLogIngestConfig, parseLogLine, parseLogsToTrees, renderRunTree, renderRunTrees, wildcardMatch } from './logs.js';
|
|
10
|
-
export { CreateInspectorOptions, DEFAULT_MAX_EVENT_BYTES, DEFAULT_MAX_METADATA_VALUE_LENGTH, DEFAULT_MAX_PREVIEW_LENGTH, DEFAULT_TRACE_DIR_NAME, FALLBACK_TRACE_DIR, Inspector, InspectorCaptureOptions, InspectorObserveOptions, InspectorRunOptions, InspectorRuntime, InspectorRuntimeContext, InspectorRuntimeDiagnostics, InspectorRuntimeOptions, InspectorStepOptions, MAX_NAME_LENGTH, MAX_TERMINAL_DEPTH, MAX_TERMINAL_NAME_LENGTH, RUNS_DIR_NAME, ResolvedRedactionProfile, TERMINAL_INDENT, TraceSafetyOptions, createInspector, createInspectorRuntime, createRunId, createStepId, ensureTraceDir, formatDuration, formatError, formatTerminalName, formatTimestamp, getCurrentContext, getCurrentCorrelationMetadata, getCurrentDepth, getCurrentRunId, getCurrentRunName, getCurrentStepId, getDefaultTraceDir, getIndent, getParentStepId, getTraceDirFromContext, getTraceFilePath, getTraceSafetyFromContext, hasActiveContext, isSilentContext, prepareMetadataForDisk, prepareTraceEventForDisk, printError, printFailedAt, printRunComplete, printRunStart, printStepComplete, printStepStart, renderErrorLine, renderRunSummary, renderStepLine, resolveRedactionProfile, resolveTraceSafetyOptions, runWithContext, runWithStepContext, truncateName, warn } from './advanced.js';
|
|
11
|
-
import { Stats } from 'node:fs';
|
|
12
|
-
export { BufferedFileWriterOptions, BufferedFileWriterOverflowMode, CompositeTraceWriterOptions, FileTraceWriterOptions, MemoryTraceWriter, TraceWriter, TraceWriterStats, bufferedFileWriter, compositeWriter, fileWriter, memoryWriter, nullWriter } from './writers.js';
|
|
13
|
-
export { DEFAULT_TRACE_READERS, TraceFormatCandidate, TraceFormatDetectionResult, TraceFormatDetectionStatus, TraceInput, TraceReadError, TraceReadErrorCode, TraceReadOptions, TraceReadResult, TraceReadWarning, TraceReadWarningSeverity, TraceReader, TraceReaderDetectOptions, TraceReaderReadOptions, agentInspectJsonlReader, detectTraceFormat, openTrace, readTrace } from './readers.js';
|
|
14
|
-
export { DiffKind, DiffOptions, DiffPath, DiffPathSegment, DiffSeverity, RenderDiffOptions, RunComparable, RunDiffItem, RunDiffResult, RunDiffSummary, StepComparable, diffRuns, diffTraceEvents, manualTraceEventsToComparableRun, renderRunDiff } from './diff.js';
|
|
15
|
-
export { EXPORT_PAYLOAD_VERSION, ExportFormat, ExportOptions, ExportResult, ExportValidationResult, OpenInferenceExport, OpenInferenceSpan, TraceExporter, compactAttributes, escapeHtml, escapeMarkdown, exportHtml, exportMarkdown, exportOpenInference, exportOtlpJson, exportRunTree, flattenTree, manualTraceEventsToRunTree, mergeExportDefaults, redactRunTreeForExport, safeString, stableJson, summarizeTree, validateExport, validateExportContent } from './exporters.js';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Strict MVP validation before writing JSONL. Rejects empty ids, non-finite times, and malformed payloads.
|
|
19
|
-
*/
|
|
20
|
-
declare function validateEvent(event: unknown): event is TraceEvent;
|
|
21
|
-
/** Serializes a trace line as compact JSON without a trailing newline. */
|
|
22
|
-
declare function serializeEvent(event: TraceEvent): string;
|
|
23
|
-
/**
|
|
24
|
-
* Creates (or truncates) an empty JSONL file for a run. Uses {@link ensureTraceDir} then {@link getTraceFilePath}.
|
|
25
|
-
* On failure, retries once under {@link FALLBACK_TRACE_DIR}.
|
|
26
|
-
*/
|
|
27
|
-
declare function initializeTraceFile(runId: string, traceDir: string): Promise<string | undefined>;
|
|
28
|
-
declare function writeTraceEvent(event: TraceEvent, traceDir: string): Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Reads raw JSONL file contents for a run, or `undefined` if missing or unreadable.
|
|
31
|
-
*/
|
|
32
|
-
declare function readTraceFile(runId: string, traceDir: string): Promise<string | undefined>;
|
|
33
|
-
/**
|
|
34
|
-
* Parses JSONL into validated {@link TraceEvent} rows (v0.1 native or v0.2 normalized).
|
|
35
|
-
* Invalid lines are skipped with a warning.
|
|
36
|
-
*/
|
|
37
|
-
declare function readTraceEvents(runId: string, traceDir: string): Promise<TraceEvent[]>;
|
|
38
|
-
/**
|
|
39
|
-
* Lists `.jsonl` file names in `traceDir`, newest by mtime first (name sort as tie-breaker).
|
|
40
|
-
*/
|
|
41
|
-
declare function listTraceFiles(traceDir: string): Promise<string[]>;
|
|
42
|
-
/** Maps a `.jsonl` file name to its run id (basename only; no traversal). */
|
|
43
|
-
declare function getRunIdFromTraceFileName(fileName: string): string | undefined;
|
|
44
|
-
|
|
45
|
-
type TraceJsonlFormat = "0.1" | "0.2" | "mixed" | "empty";
|
|
46
|
-
type ParsedTraceJsonlRow = {
|
|
47
|
-
format: "0.1";
|
|
48
|
-
event: TraceEvent;
|
|
49
|
-
sourceLine: number;
|
|
50
|
-
} | {
|
|
51
|
-
format: "0.2";
|
|
52
|
-
event: PersistedInspectEvent;
|
|
53
|
-
sourceLine: number;
|
|
54
|
-
};
|
|
55
|
-
interface ParseTraceJsonlResult {
|
|
56
|
-
format: TraceJsonlFormat;
|
|
57
|
-
/** Count of valid source JSONL rows before any one-to-many normalization. */
|
|
58
|
-
sourceEventCount: number;
|
|
59
|
-
events: TraceEvent[];
|
|
60
|
-
persisted: PersistedInspectEvent[];
|
|
61
|
-
/** Valid source rows in JSONL order, before cross-version normalization. */
|
|
62
|
-
rows: ParsedTraceJsonlRow[];
|
|
63
|
-
}
|
|
64
|
-
interface ParseTraceJsonlOptions {
|
|
65
|
-
validate?: (value: unknown) => value is TraceEvent;
|
|
66
|
-
/** Emit parse warnings through the standard AgentInspect warning channel (default true). */
|
|
67
|
-
warnings?: boolean;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Parses JSONL content into normalized v0.1 {@link TraceEvent} rows.
|
|
71
|
-
* Accepts homogenous v0.1 or v0.2 files; mixed files are converted with a warning.
|
|
72
|
-
*/
|
|
73
|
-
declare function parseTraceJsonl(raw: string, options?: ParseTraceJsonlOptions): ParseTraceJsonlResult;
|
|
74
|
-
/**
|
|
75
|
-
* Returns a user-facing message when a trace file uses an unsupported schema version.
|
|
76
|
-
*/
|
|
77
|
-
declare function unknownTraceFormatMessage(): string;
|
|
78
|
-
|
|
79
|
-
interface TraceDirectoryOptions {
|
|
80
|
-
dir?: string;
|
|
81
|
-
}
|
|
82
|
-
declare function resolveTraceDir(options?: TraceDirectoryOptions): string;
|
|
83
|
-
declare class TraceDirectory {
|
|
84
|
-
#private;
|
|
85
|
-
constructor(options?: TraceDirectoryOptions);
|
|
86
|
-
getPath(filename?: string): string;
|
|
87
|
-
list(): Promise<string[]>;
|
|
88
|
-
getFileStats(filename: string): Promise<Stats>;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
declare function extractMetadata(filePath: string, _quickScan?: boolean): Promise<TraceMetadata>;
|
|
92
|
-
declare function buildRunSummary(events: TraceEvent[]): RunSummary;
|
|
93
|
-
|
|
94
|
-
interface TraceFilterOptions {
|
|
95
|
-
status?: TraceMetadataStatus;
|
|
96
|
-
name?: string;
|
|
97
|
-
since?: string;
|
|
98
|
-
limit?: number;
|
|
99
|
-
}
|
|
100
|
-
declare function filterTraces(traces: TraceMetadata[], options: TraceFilterOptions): TraceMetadata[];
|
|
101
|
-
|
|
102
|
-
type TimelineFocus = "all" | "slow";
|
|
103
|
-
interface TimelineEntry {
|
|
104
|
-
stepId: string;
|
|
105
|
-
name: string;
|
|
106
|
-
type: StepType;
|
|
107
|
-
status: StepStatus;
|
|
108
|
-
depth: number;
|
|
109
|
-
startedAt: number;
|
|
110
|
-
offsetMs: number;
|
|
111
|
-
durationMs?: number;
|
|
112
|
-
isError: boolean;
|
|
113
|
-
slow?: boolean;
|
|
114
|
-
streaming?: {
|
|
115
|
-
chunkCount?: number;
|
|
116
|
-
streamDurationMs?: number;
|
|
117
|
-
streamedCharCount?: number;
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
interface RunTimeline {
|
|
121
|
-
runId: string;
|
|
122
|
-
name?: string;
|
|
123
|
-
status: TraceMetadataStatus;
|
|
124
|
-
startedAt?: number;
|
|
125
|
-
endedAt?: number;
|
|
126
|
-
durationMs?: number;
|
|
127
|
-
correlation?: {
|
|
128
|
-
correlationId?: string;
|
|
129
|
-
requestId?: string;
|
|
130
|
-
decisionId?: string;
|
|
131
|
-
groupId?: string;
|
|
132
|
-
};
|
|
133
|
-
entries: TimelineEntry[];
|
|
134
|
-
}
|
|
135
|
-
interface TimelineOptions {
|
|
136
|
-
focus?: TimelineFocus;
|
|
137
|
-
slowTopN?: number;
|
|
138
|
-
}
|
|
139
|
-
declare function buildRunTimeline(events: TraceEvent[], options?: TimelineOptions): RunTimeline;
|
|
140
|
-
interface RenderTimelineOptions {
|
|
141
|
-
focus?: TimelineFocus;
|
|
142
|
-
}
|
|
143
|
-
declare function renderTimeline(timeline: RunTimeline, options?: RenderTimelineOptions): string;
|
|
144
|
-
|
|
145
|
-
interface RunWhatSummary {
|
|
146
|
-
runId: string;
|
|
147
|
-
name?: string;
|
|
148
|
-
status: TraceMetadataStatus;
|
|
149
|
-
durationMs?: number;
|
|
150
|
-
totalSteps: number;
|
|
151
|
-
llmSteps: number;
|
|
152
|
-
toolSteps: number;
|
|
153
|
-
logicSteps: number;
|
|
154
|
-
errorSteps: number;
|
|
155
|
-
maxDepth: number;
|
|
156
|
-
longestStep?: {
|
|
157
|
-
name: string;
|
|
158
|
-
durationMs: number;
|
|
159
|
-
type: string;
|
|
160
|
-
};
|
|
161
|
-
totalTokens?: {
|
|
162
|
-
input: number;
|
|
163
|
-
output: number;
|
|
164
|
-
total?: number;
|
|
165
|
-
cached?: number;
|
|
166
|
-
};
|
|
167
|
-
correlation?: TraceCorrelationMetadata;
|
|
168
|
-
failedStepNames: string[];
|
|
169
|
-
runErrorMessage?: string;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Build a concise inspection summary for `what` / report workflows.
|
|
173
|
-
* Read-only over in-memory v0.1 {@link TraceEvent} rows.
|
|
174
|
-
*/
|
|
175
|
-
declare function buildRunWhatSummary(events: TraceEvent[]): RunWhatSummary;
|
|
176
|
-
interface RenderWhatOptions {
|
|
177
|
-
/** Include correlation ids when present (default true). */
|
|
178
|
-
correlation?: boolean;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Render a human-readable `what` summary (plain text, no ANSI).
|
|
182
|
-
*/
|
|
183
|
-
declare function renderRunWhat(summary: RunWhatSummary, options?: RenderWhatOptions): string;
|
|
184
|
-
|
|
185
|
-
type ReportFormat = "markdown" | "html";
|
|
186
|
-
interface ReportOptions {
|
|
187
|
-
format: ReportFormat;
|
|
188
|
-
includeAttributes?: boolean;
|
|
189
|
-
includeErrors?: boolean;
|
|
190
|
-
redactionProfile?: RedactionProfile;
|
|
191
|
-
/** Include correlation ids in the what section (default true). */
|
|
192
|
-
correlation?: boolean;
|
|
193
|
-
}
|
|
194
|
-
interface ReportResult {
|
|
195
|
-
format: ReportFormat;
|
|
196
|
-
content: string;
|
|
197
|
-
contentType: string;
|
|
198
|
-
fileExtension: string;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Build a local inspection report (markdown or HTML) from v0.1 trace events.
|
|
202
|
-
* Composes `what`, timeline, and execution-tree sections.
|
|
203
|
-
*/
|
|
204
|
-
declare function buildRunReport(events: TraceEvent[], options: ReportOptions): ReportResult;
|
|
205
|
-
|
|
206
|
-
type ExplainMode = "dry-run" | "local";
|
|
207
|
-
interface ExplainFact {
|
|
208
|
-
id: string;
|
|
209
|
-
label: string;
|
|
210
|
-
value: unknown;
|
|
211
|
-
source: "trace";
|
|
212
|
-
confidence: "observed";
|
|
213
|
-
}
|
|
214
|
-
interface ExplainInference {
|
|
215
|
-
id: string;
|
|
216
|
-
label: string;
|
|
217
|
-
text: string;
|
|
218
|
-
evidence: string[];
|
|
219
|
-
confidence: "deterministic";
|
|
220
|
-
}
|
|
221
|
-
interface ExplainResult {
|
|
222
|
-
mode: ExplainMode;
|
|
223
|
-
runId: string;
|
|
224
|
-
name?: string;
|
|
225
|
-
status?: string;
|
|
226
|
-
redactionProfile: RedactionProfile;
|
|
227
|
-
facts: ExplainFact[];
|
|
228
|
-
inferences: ExplainInference[];
|
|
229
|
-
notes: string[];
|
|
230
|
-
}
|
|
231
|
-
interface ExplainOptions {
|
|
232
|
-
mode?: ExplainMode;
|
|
233
|
-
redactionProfile?: RedactionProfile;
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Build a local, deterministic explanation payload from a reader-selected run.
|
|
237
|
-
*
|
|
238
|
-
* This helper performs no network I/O and does not call a model provider.
|
|
239
|
-
*/
|
|
240
|
-
declare function buildLocalExplanation(run: InspectRunTree, options?: ExplainOptions): ExplainResult;
|
|
241
|
-
|
|
242
|
-
interface DurationStats {
|
|
243
|
-
minMs?: number;
|
|
244
|
-
maxMs?: number;
|
|
245
|
-
avgMs?: number;
|
|
246
|
-
p50Ms?: number;
|
|
247
|
-
p95Ms?: number;
|
|
248
|
-
}
|
|
249
|
-
interface TraceStatsRankedRun {
|
|
250
|
-
runId: string;
|
|
251
|
-
name?: string;
|
|
252
|
-
durationMs?: number;
|
|
253
|
-
status: string;
|
|
254
|
-
}
|
|
255
|
-
interface TraceStatsRankedStep {
|
|
256
|
-
runId: string;
|
|
257
|
-
stepName: string;
|
|
258
|
-
stepType: string;
|
|
259
|
-
durationMs: number;
|
|
260
|
-
}
|
|
261
|
-
interface TraceStats {
|
|
262
|
-
traceDir: string;
|
|
263
|
-
since?: string;
|
|
264
|
-
correlationId?: string;
|
|
265
|
-
groupId?: string;
|
|
266
|
-
totalRuns: number;
|
|
267
|
-
successCount: number;
|
|
268
|
-
errorCount: number;
|
|
269
|
-
runningCount: number;
|
|
270
|
-
unknownCount: number;
|
|
271
|
-
errorRate: number;
|
|
272
|
-
duration: DurationStats;
|
|
273
|
-
totalSteps: number;
|
|
274
|
-
avgStepsPerRun: number;
|
|
275
|
-
totalLlmSteps: number;
|
|
276
|
-
totalToolSteps: number;
|
|
277
|
-
totalErrorSteps: number;
|
|
278
|
-
slowestRuns: TraceStatsRankedRun[];
|
|
279
|
-
slowestSteps: TraceStatsRankedStep[];
|
|
280
|
-
}
|
|
281
|
-
interface TraceStatsOptions {
|
|
282
|
-
traceDir: string;
|
|
283
|
-
since?: string;
|
|
284
|
-
correlationId?: string;
|
|
285
|
-
groupId?: string;
|
|
286
|
-
slowRunLimit?: number;
|
|
287
|
-
slowStepLimit?: number;
|
|
288
|
-
}
|
|
289
|
-
declare function buildTraceStats(metas: TraceMetadata[], options: TraceStatsOptions): Promise<TraceStats>;
|
|
290
|
-
declare function renderTraceStats(stats: TraceStats): string;
|
|
291
|
-
|
|
292
|
-
interface TraceSearchOptions {
|
|
293
|
-
traceDir: string;
|
|
294
|
-
since?: string;
|
|
295
|
-
status?: "success" | "error" | "running" | "unknown";
|
|
296
|
-
kind?: string;
|
|
297
|
-
type?: string;
|
|
298
|
-
name?: string;
|
|
299
|
-
tool?: string;
|
|
300
|
-
duration?: string;
|
|
301
|
-
limit?: number;
|
|
302
|
-
}
|
|
303
|
-
interface TraceSearchResult {
|
|
304
|
-
runId: string;
|
|
305
|
-
runName?: string;
|
|
306
|
-
runStatus: string;
|
|
307
|
-
stepId?: string;
|
|
308
|
-
stepName?: string;
|
|
309
|
-
stepType?: string;
|
|
310
|
-
timestamp?: number;
|
|
311
|
-
durationMs?: number;
|
|
312
|
-
matchReason: string;
|
|
313
|
-
matchedFields: string[];
|
|
314
|
-
filePath: string;
|
|
315
|
-
}
|
|
316
|
-
interface ParsedDurationFilter {
|
|
317
|
-
op: ">" | ">=" | "<" | "<=";
|
|
318
|
-
ms: number;
|
|
319
|
-
}
|
|
320
|
-
declare function parseDurationFilter(expr: string): ParsedDurationFilter;
|
|
321
|
-
declare function searchTraces(metas: TraceMetadata[], options: TraceSearchOptions): Promise<TraceSearchResult[]>;
|
|
322
|
-
declare function loadTraceMetadataList(_traceDir: string, fileNames: string[], getPath: (fileName: string) => string): Promise<TraceMetadata[]>;
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Safety check for cleanup workflows: returns true only when the file appears to be an AgentInspect trace.
|
|
326
|
-
* This should be conservative: false positives are more dangerous than false negatives.
|
|
327
|
-
*/
|
|
328
|
-
declare function isAgentInspectTrace(filePath: string): Promise<boolean>;
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* v0.2 shared duration utilities.
|
|
332
|
-
*
|
|
333
|
-
* `parseDuration` is used for filters such as "since" / "older-than".
|
|
334
|
-
* `formatDuration` is used for compact display in CLI and summaries.
|
|
335
|
-
*/
|
|
336
|
-
declare function parseDuration(duration: string): number;
|
|
1
|
+
import { I as InspectRunOptions, S as StepOptions, O as ObserveOptions } from './types-D-Y1kOU-.js';
|
|
2
|
+
export { E as ErrorInfo, R as RedactionProfile, a as Run, b as RunStatus, c as Step, d as StepMetadata, e as StepStatus, f as StepType, T as TokenMetadata, g as TraceCorrelationMetadata } from './types-D-Y1kOU-.js';
|
|
3
|
+
export { C as CreateInspectorOptions, I as Inspector, a as InspectorCaptureOptions, b as InspectorObserveOptions, c as InspectorRunOptions, d as InspectorStepOptions, e as createInspector, g as getCurrentCorrelationMetadata, m as maybeInspectRun } from './context-yv2VSDQF.js';
|
|
4
|
+
import './log-config-DVimQJho.js';
|
|
5
|
+
import './inspect-event-CevRYp58.js';
|
|
6
|
+
import './persisted-inspect-event-D-WpXeZX.js';
|
|
7
|
+
import './writers.js';
|
|
337
8
|
|
|
338
9
|
/**
|
|
339
10
|
* Stable v1.0 API for local manual run tracing.
|
|
@@ -343,19 +14,6 @@ declare function parseDuration(duration: string): number;
|
|
|
343
14
|
*/
|
|
344
15
|
declare function inspectRun<T>(name: string, fn: () => Promise<T> | T, options?: InspectRunOptions): Promise<T>;
|
|
345
16
|
|
|
346
|
-
/**
|
|
347
|
-
* Returns true when `value` is one of the recognized AGENT_INSPECT enable tokens
|
|
348
|
-
* (`1`, `true`, `yes`, `on`, `enabled`, case-insensitive). Undefined or any other value is false.
|
|
349
|
-
*/
|
|
350
|
-
declare function isAgentInspectEnabled(value?: string): boolean;
|
|
351
|
-
/**
|
|
352
|
-
* Runs `fn` with tracing when enabled; otherwise passthrough (no trace file, no context).
|
|
353
|
-
*
|
|
354
|
-
* Enablement order: explicit `options.enabled` wins; when omitted, reads `process.env.AGENT_INSPECT`.
|
|
355
|
-
* Unset or unrecognized env values disable tracing.
|
|
356
|
-
*/
|
|
357
|
-
declare function maybeInspectRun<T>(name: string, fn: () => Promise<T> | T, options?: InspectRunOptions): Promise<T>;
|
|
358
|
-
|
|
359
17
|
/**
|
|
360
18
|
* Stable v1.0 API for instrumenting a named step inside an AgentInspect run.
|
|
361
19
|
*
|
|
@@ -384,4 +42,4 @@ declare const step: StepFunction;
|
|
|
384
42
|
*/
|
|
385
43
|
declare function observe<T>(agent: T, options?: ObserveOptions): T;
|
|
386
44
|
|
|
387
|
-
export {
|
|
45
|
+
export { InspectRunOptions, ObserveOptions, StepOptions, inspectRun, observe, step };
|