agent-inspect 1.8.0 → 2.0.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.
Files changed (100) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +146 -23
  3. package/docs/ADAPTER-CONFORMANCE.md +1 -1
  4. package/docs/ADAPTERS.md +41 -6
  5. package/docs/API.md +123 -36
  6. package/docs/CLI.md +75 -11
  7. package/docs/EXPORTS.md +1 -1
  8. package/docs/GETTING-STARTED.md +72 -16
  9. package/docs/KNOWN-ISSUES.md +8 -3
  10. package/docs/LIMITATIONS.md +6 -6
  11. package/docs/LOG-TO-TREE-QUICKSTART.md +1 -2
  12. package/docs/MIGRATION.md +67 -0
  13. package/docs/SCHEMA.md +29 -12
  14. package/package.json +2 -2
  15. package/packages/cli/dist/index.cjs +7604 -7660
  16. package/packages/cli/dist/index.cjs.map +1 -1
  17. package/packages/cli/dist/index.mjs +7604 -7660
  18. package/packages/cli/dist/index.mjs.map +1 -1
  19. package/packages/core/dist/advanced.cjs +2047 -26
  20. package/packages/core/dist/advanced.cjs.map +1 -1
  21. package/packages/core/dist/advanced.d.cts +346 -196
  22. package/packages/core/dist/advanced.d.ts +346 -196
  23. package/packages/core/dist/advanced.mjs +628 -5
  24. package/packages/core/dist/advanced.mjs.map +1 -1
  25. package/packages/core/dist/checks.d.cts +1 -1
  26. package/packages/core/dist/checks.d.ts +1 -1
  27. package/packages/core/dist/chunk-2ZXEMWGK.mjs +549 -0
  28. package/packages/core/dist/chunk-2ZXEMWGK.mjs.map +1 -0
  29. package/packages/core/dist/{chunk-57S5D6HR.mjs → chunk-4JVGFNQH.mjs} +50 -6
  30. package/packages/core/dist/chunk-4JVGFNQH.mjs.map +1 -0
  31. package/packages/core/dist/{chunk-6QSLZCBJ.mjs → chunk-A4V2H3YU.mjs} +329 -163
  32. package/packages/core/dist/chunk-A4V2H3YU.mjs.map +1 -0
  33. package/packages/core/dist/{chunk-74XZ6N7Q.mjs → chunk-IZBJAZGF.mjs} +12 -4
  34. package/packages/core/dist/chunk-IZBJAZGF.mjs.map +1 -0
  35. package/packages/core/dist/{chunk-VTIB5MDK.mjs → chunk-NQZPZ2FN.mjs} +15 -10
  36. package/packages/core/dist/chunk-NQZPZ2FN.mjs.map +1 -0
  37. package/packages/core/dist/{chunk-TZISEVLQ.mjs → chunk-XUNJMAPD.mjs} +3 -3
  38. package/packages/core/dist/{chunk-TZISEVLQ.mjs.map → chunk-XUNJMAPD.mjs.map} +1 -1
  39. package/packages/core/dist/context-CSKnzpXR.d.cts +177 -0
  40. package/packages/core/dist/context-yv2VSDQF.d.ts +177 -0
  41. package/packages/core/dist/diff.d.cts +2 -2
  42. package/packages/core/dist/diff.d.ts +2 -2
  43. package/packages/core/dist/diff.mjs +473 -3
  44. package/packages/core/dist/diff.mjs.map +1 -1
  45. package/packages/core/dist/exporters.cjs +691 -0
  46. package/packages/core/dist/exporters.cjs.map +1 -1
  47. package/packages/core/dist/exporters.d.cts +24 -3
  48. package/packages/core/dist/exporters.d.ts +24 -3
  49. package/packages/core/dist/exporters.mjs +1113 -3
  50. package/packages/core/dist/exporters.mjs.map +1 -1
  51. package/packages/core/dist/index.cjs +1385 -8022
  52. package/packages/core/dist/index.cjs.map +1 -1
  53. package/packages/core/dist/index.d.cts +8 -313
  54. package/packages/core/dist/index.d.ts +8 -313
  55. package/packages/core/dist/index.mjs +18 -1331
  56. package/packages/core/dist/index.mjs.map +1 -1
  57. package/packages/core/dist/{log-config-DanPV3P9.d.cts → log-config-8aE5Kxtr.d.cts} +1 -1
  58. package/packages/core/dist/{log-config-BPHS4Sds.d.ts → log-config-DVimQJho.d.ts} +1 -1
  59. package/packages/core/dist/logs.d.cts +2 -2
  60. package/packages/core/dist/logs.d.ts +2 -2
  61. package/packages/core/dist/logs.mjs +785 -2
  62. package/packages/core/dist/logs.mjs.map +1 -1
  63. package/packages/core/dist/{persisted-inspect-event-Cw7TeYGr.d.ts → persisted-inspect-event-D-WpXeZX.d.ts} +14 -5
  64. package/packages/core/dist/{persisted-inspect-event-DHPfzUd8.d.cts → persisted-inspect-event-DHcHPUKv.d.cts} +14 -5
  65. package/packages/core/dist/persisted.cjs +11 -1
  66. package/packages/core/dist/persisted.cjs.map +1 -1
  67. package/packages/core/dist/persisted.d.cts +4 -4
  68. package/packages/core/dist/persisted.d.ts +4 -4
  69. package/packages/core/dist/persisted.mjs +150 -3
  70. package/packages/core/dist/persisted.mjs.map +1 -1
  71. package/packages/core/dist/readers.cjs +27 -10
  72. package/packages/core/dist/readers.cjs.map +1 -1
  73. package/packages/core/dist/readers.d.cts +1 -1
  74. package/packages/core/dist/readers.d.ts +1 -1
  75. package/packages/core/dist/readers.mjs +1580 -4
  76. package/packages/core/dist/readers.mjs.map +1 -1
  77. package/packages/core/dist/{types-Ap9uMdx_.d.ts → types-D-Y1kOU-.d.ts} +2 -2
  78. package/packages/core/dist/{types-B2-BU5CS.d.cts → types-DgMN3qow.d.cts} +2 -2
  79. package/packages/core/dist/writers.cjs +49 -3
  80. package/packages/core/dist/writers.cjs.map +1 -1
  81. package/packages/core/dist/writers.d.cts +1 -1
  82. package/packages/core/dist/writers.d.ts +1 -1
  83. package/packages/core/dist/writers.mjs +341 -4
  84. package/packages/core/dist/writers.mjs.map +1 -1
  85. package/packages/core/dist/chunk-57S5D6HR.mjs.map +0 -1
  86. package/packages/core/dist/chunk-6QSLZCBJ.mjs.map +0 -1
  87. package/packages/core/dist/chunk-6SZPTECC.mjs +0 -342
  88. package/packages/core/dist/chunk-6SZPTECC.mjs.map +0 -1
  89. package/packages/core/dist/chunk-74XZ6N7Q.mjs.map +0 -1
  90. package/packages/core/dist/chunk-HR7G62IE.mjs +0 -785
  91. package/packages/core/dist/chunk-HR7G62IE.mjs.map +0 -1
  92. package/packages/core/dist/chunk-TFLPUZ56.mjs +0 -1571
  93. package/packages/core/dist/chunk-TFLPUZ56.mjs.map +0 -1
  94. package/packages/core/dist/chunk-U2BGPESY.mjs +0 -150
  95. package/packages/core/dist/chunk-U2BGPESY.mjs.map +0 -1
  96. package/packages/core/dist/chunk-VTIB5MDK.mjs.map +0 -1
  97. package/packages/core/dist/chunk-Y56BPA3B.mjs +0 -990
  98. package/packages/core/dist/chunk-Y56BPA3B.mjs.map +0 -1
  99. package/packages/core/dist/chunk-YWAOOXLR.mjs +0 -475
  100. package/packages/core/dist/chunk-YWAOOXLR.mjs.map +0 -1
@@ -0,0 +1,177 @@
1
+ import { R as RedactionProfile, d as StepMetadata, h as TraceEvent, I as InspectRunOptions, i as ExecutionContext, g as TraceCorrelationMetadata, f as StepType } from './types-DgMN3qow.cjs';
2
+ import { P as PersistedInspectEvent } from './persisted-inspect-event-DHcHPUKv.cjs';
3
+ import { TraceWriterStats, TraceWriter } from './writers.cjs';
4
+ import { R as RedactionRule } from './log-config-8aE5Kxtr.cjs';
5
+
6
+ /** Default max length for string metadata values (non-preview keys). */
7
+ declare const DEFAULT_MAX_METADATA_VALUE_LENGTH = 2000;
8
+ /** Default max length for preview-like metadata keys (contains `preview`, case-insensitive). */
9
+ declare const DEFAULT_MAX_PREVIEW_LENGTH = 500;
10
+ /** Default max serialized JSONL line size in bytes (UTF-8). */
11
+ declare const DEFAULT_MAX_EVENT_BYTES = 65536;
12
+ /** Resolved trace safety settings used at write time. */
13
+ interface TraceSafetyOptions {
14
+ redactEnabled: boolean;
15
+ redactionRules?: RedactionRule[];
16
+ redactionProfile: RedactionProfile;
17
+ profileExtraKeys: readonly string[];
18
+ maxMetadataValueLength: number;
19
+ maxPreviewLength: number;
20
+ maxEventBytes: number;
21
+ }
22
+
23
+ /** Resolves {@link InspectRunOptions} trace safety fields with safe defaults. */
24
+ declare function resolveTraceSafetyOptions(options?: Pick<InspectRunOptions, "redact" | "redactionProfile" | "maxEventBytes" | "maxMetadataValueLength" | "maxPreviewLength">): TraceSafetyOptions;
25
+ /** Redacts (when enabled) and truncates metadata values for disk persistence. */
26
+ declare function prepareMetadataForDisk(metadata: Record<string, unknown> | StepMetadata, opts: TraceSafetyOptions): Record<string, unknown>;
27
+ /**
28
+ * Applies redaction, metadata truncation, and final serialized size bounds.
29
+ * Never throws; returns a schema-valid event or a minimally truncated variant.
30
+ */
31
+ declare function prepareTraceEventForDisk(event: TraceEvent, opts: TraceSafetyOptions): TraceEvent;
32
+
33
+ interface InspectorRuntimeOptions {
34
+ enabled?: boolean;
35
+ writer?: TraceWriter;
36
+ traceSafety?: TraceSafetyOptions;
37
+ }
38
+ interface InspectorRuntimeContext extends ExecutionContext {
39
+ runtimeId: string;
40
+ }
41
+ interface InspectorRuntimeDiagnostics {
42
+ instrumentationErrors: number;
43
+ lastInstrumentationError?: string;
44
+ writerStats?: TraceWriterStats;
45
+ }
46
+ interface InspectorRuntime {
47
+ readonly runtimeId: string;
48
+ readonly enabled: boolean;
49
+ runWithContext<T>(context: ExecutionContext, fn: () => Promise<T> | T): Promise<T>;
50
+ runWithStepContext<T>(stepId: string, fn: () => Promise<T> | T): Promise<T>;
51
+ getCurrentContext(): InspectorRuntimeContext | undefined;
52
+ getCurrentCorrelationMetadata(): TraceCorrelationMetadata | undefined;
53
+ getCurrentStepId(): string | undefined;
54
+ getCurrentDepth(): number;
55
+ getTraceSafety(): TraceSafetyOptions;
56
+ write(event: PersistedInspectEvent): Promise<void>;
57
+ flush(): Promise<void>;
58
+ close(): Promise<void>;
59
+ getDiagnostics(): InspectorRuntimeDiagnostics;
60
+ }
61
+ declare function createInspectorRuntime(options?: InspectorRuntimeOptions): InspectorRuntime;
62
+
63
+ interface InspectorCaptureOptions {
64
+ onSuccess?: "none" | "metadata-only";
65
+ onError?: "none" | "metadata-only";
66
+ }
67
+ interface CreateInspectorOptions {
68
+ enabled?: boolean;
69
+ writer?: TraceWriter;
70
+ /**
71
+ * Context metadata only. Does not configure writer output; use
72
+ * `fileWriter({ dir })` or another explicit writer for persistence paths.
73
+ *
74
+ * @experimental
75
+ */
76
+ traceDir?: string;
77
+ /**
78
+ * Context metadata only for compatibility with existing terminal helpers.
79
+ * `createInspector()` does not print lifecycle output.
80
+ *
81
+ * @experimental
82
+ */
83
+ silent?: boolean;
84
+ metadata?: Record<string, unknown>;
85
+ redactionProfile?: RedactionProfile;
86
+ /**
87
+ * Metadata-only summaries for persisted run/step completion rows.
88
+ * This never stores raw return values, prompts, outputs, or thrown objects.
89
+ *
90
+ * @experimental
91
+ */
92
+ capture?: InspectorCaptureOptions;
93
+ traceSafety?: TraceSafetyOptions;
94
+ }
95
+ interface InspectorRunOptions {
96
+ runId?: string;
97
+ traceDir?: string;
98
+ silent?: boolean;
99
+ metadata?: Record<string, unknown>;
100
+ }
101
+ interface InspectorStepOptions {
102
+ type?: StepType;
103
+ metadata?: StepMetadata;
104
+ }
105
+ type InspectorObserveOptions = InspectorStepOptions;
106
+ interface Inspector {
107
+ /**
108
+ * Low-level runtime access is retained for v1.6 compatibility. Prefer
109
+ * `getDiagnostics()` unless you need advanced runtime context primitives.
110
+ *
111
+ * @experimental
112
+ */
113
+ readonly runtime: InspectorRuntime;
114
+ run<T>(name: string, fn: () => T | Promise<T>, options?: InspectorRunOptions): Promise<T>;
115
+ step<T>(name: string, fn: () => T | Promise<T>, options?: InspectorStepOptions): Promise<T>;
116
+ tool<T>(name: string, fn: () => T | Promise<T>, options?: InspectorStepOptions): Promise<T>;
117
+ llm<T>(name: string, fn: () => T | Promise<T>, options?: InspectorStepOptions): Promise<T>;
118
+ observe<TFunction extends (...args: any[]) => any>(name: string, fn: TFunction, options?: InspectorObserveOptions): (...args: Parameters<TFunction>) => Promise<Awaited<ReturnType<TFunction>>>;
119
+ getDiagnostics(): ReturnType<InspectorRuntime["getDiagnostics"]>;
120
+ flush(): Promise<void>;
121
+ close(): Promise<void>;
122
+ }
123
+ declare function createInspector(options?: CreateInspectorOptions): Inspector;
124
+
125
+ /**
126
+ * Returns true when `value` is one of the recognized AGENT_INSPECT enable tokens
127
+ * (`1`, `true`, `yes`, `on`, `enabled`, case-insensitive). Undefined or any other value is false.
128
+ */
129
+ declare function isAgentInspectEnabled(value?: string): boolean;
130
+ /**
131
+ * Runs `fn` with tracing when enabled; otherwise passthrough (no trace file, no context).
132
+ *
133
+ * Enablement order: explicit `options.enabled` wins; when omitted, reads `process.env.AGENT_INSPECT`.
134
+ * Unset or unrecognized env values disable tracing.
135
+ */
136
+ declare function maybeInspectRun<T>(name: string, fn: () => Promise<T> | T, options?: InspectRunOptions): Promise<T>;
137
+
138
+ /** Returns the active run context, without internal step fields. */
139
+ declare function getCurrentContext(): ExecutionContext | undefined;
140
+ /** Active `runId` when inside `runWithContext`, else `undefined`. */
141
+ declare function getCurrentRunId(): string | undefined;
142
+ /**
143
+ * Correlation metadata for the active run (`correlationId`, `requestId`, `decisionId`, `groupId`).
144
+ * `undefined` outside `inspectRun` / `maybeInspectRun` or when no correlation fields were set.
145
+ */
146
+ declare function getCurrentCorrelationMetadata(): TraceCorrelationMetadata | undefined;
147
+ /** Active `runName` when inside `runWithContext`, else `undefined`. */
148
+ declare function getCurrentRunName(): string | undefined;
149
+ /**
150
+ * Active step id in this async scope (parent for nested `step()` calls).
151
+ * `undefined` at run root or outside any run.
152
+ */
153
+ declare function getCurrentStepId(): string | undefined;
154
+ /** Alias of {@link getCurrentStepId} for readability in step instrumentation. */
155
+ declare function getParentStepId(): string | undefined;
156
+ /**
157
+ * Nesting depth: `0` at run root, increments by one per nested `runWithStepContext`.
158
+ * Returns `0` outside any run.
159
+ */
160
+ declare function getCurrentDepth(): number;
161
+ declare function hasActiveContext(): boolean;
162
+ declare function getTraceDirFromContext(): string | undefined;
163
+ declare function isSilentContext(): boolean;
164
+ /** Resolved trace safety settings for the active run (redaction + size bounds). */
165
+ declare function getTraceSafetyFromContext(): TraceSafetyOptions | undefined;
166
+ /**
167
+ * Runs `fn` with a fresh AgentInspect run context (depth 0, no active step).
168
+ * Propagates sync/async results and rejections; does not swallow user errors.
169
+ */
170
+ declare function runWithContext<T>(context: ExecutionContext, fn: () => Promise<T> | T, traceSafety?: TraceSafetyOptions): Promise<T>;
171
+ /**
172
+ * Runs `fn` with `stepId` as the active step (incremented depth).
173
+ * If no run is active, runs `fn` without altering async context.
174
+ */
175
+ declare function runWithStepContext<T>(stepId: string, fn: () => Promise<T> | T): Promise<T>;
176
+
177
+ export { prepareTraceEventForDisk as A, resolveTraceSafetyOptions as B, type CreateInspectorOptions as C, DEFAULT_MAX_EVENT_BYTES as D, runWithContext as E, runWithStepContext as F, type Inspector as I, type TraceSafetyOptions as T, type InspectorCaptureOptions as a, type InspectorObserveOptions as b, type InspectorRunOptions as c, type InspectorStepOptions as d, createInspector as e, DEFAULT_MAX_METADATA_VALUE_LENGTH as f, getCurrentCorrelationMetadata as g, DEFAULT_MAX_PREVIEW_LENGTH as h, type InspectorRuntime as i, type InspectorRuntimeContext as j, type InspectorRuntimeDiagnostics as k, type InspectorRuntimeOptions as l, maybeInspectRun as m, createInspectorRuntime as n, getCurrentContext as o, getCurrentDepth as p, getCurrentRunId as q, getCurrentRunName as r, getCurrentStepId as s, getParentStepId as t, getTraceDirFromContext as u, getTraceSafetyFromContext as v, hasActiveContext as w, isAgentInspectEnabled as x, isSilentContext as y, prepareMetadataForDisk as z };
@@ -0,0 +1,177 @@
1
+ import { R as RedactionProfile, d as StepMetadata, h as TraceEvent, I as InspectRunOptions, i as ExecutionContext, g as TraceCorrelationMetadata, f as StepType } from './types-D-Y1kOU-.js';
2
+ import { P as PersistedInspectEvent } from './persisted-inspect-event-D-WpXeZX.js';
3
+ import { TraceWriterStats, TraceWriter } from './writers.js';
4
+ import { R as RedactionRule } from './log-config-DVimQJho.js';
5
+
6
+ /** Default max length for string metadata values (non-preview keys). */
7
+ declare const DEFAULT_MAX_METADATA_VALUE_LENGTH = 2000;
8
+ /** Default max length for preview-like metadata keys (contains `preview`, case-insensitive). */
9
+ declare const DEFAULT_MAX_PREVIEW_LENGTH = 500;
10
+ /** Default max serialized JSONL line size in bytes (UTF-8). */
11
+ declare const DEFAULT_MAX_EVENT_BYTES = 65536;
12
+ /** Resolved trace safety settings used at write time. */
13
+ interface TraceSafetyOptions {
14
+ redactEnabled: boolean;
15
+ redactionRules?: RedactionRule[];
16
+ redactionProfile: RedactionProfile;
17
+ profileExtraKeys: readonly string[];
18
+ maxMetadataValueLength: number;
19
+ maxPreviewLength: number;
20
+ maxEventBytes: number;
21
+ }
22
+
23
+ /** Resolves {@link InspectRunOptions} trace safety fields with safe defaults. */
24
+ declare function resolveTraceSafetyOptions(options?: Pick<InspectRunOptions, "redact" | "redactionProfile" | "maxEventBytes" | "maxMetadataValueLength" | "maxPreviewLength">): TraceSafetyOptions;
25
+ /** Redacts (when enabled) and truncates metadata values for disk persistence. */
26
+ declare function prepareMetadataForDisk(metadata: Record<string, unknown> | StepMetadata, opts: TraceSafetyOptions): Record<string, unknown>;
27
+ /**
28
+ * Applies redaction, metadata truncation, and final serialized size bounds.
29
+ * Never throws; returns a schema-valid event or a minimally truncated variant.
30
+ */
31
+ declare function prepareTraceEventForDisk(event: TraceEvent, opts: TraceSafetyOptions): TraceEvent;
32
+
33
+ interface InspectorRuntimeOptions {
34
+ enabled?: boolean;
35
+ writer?: TraceWriter;
36
+ traceSafety?: TraceSafetyOptions;
37
+ }
38
+ interface InspectorRuntimeContext extends ExecutionContext {
39
+ runtimeId: string;
40
+ }
41
+ interface InspectorRuntimeDiagnostics {
42
+ instrumentationErrors: number;
43
+ lastInstrumentationError?: string;
44
+ writerStats?: TraceWriterStats;
45
+ }
46
+ interface InspectorRuntime {
47
+ readonly runtimeId: string;
48
+ readonly enabled: boolean;
49
+ runWithContext<T>(context: ExecutionContext, fn: () => Promise<T> | T): Promise<T>;
50
+ runWithStepContext<T>(stepId: string, fn: () => Promise<T> | T): Promise<T>;
51
+ getCurrentContext(): InspectorRuntimeContext | undefined;
52
+ getCurrentCorrelationMetadata(): TraceCorrelationMetadata | undefined;
53
+ getCurrentStepId(): string | undefined;
54
+ getCurrentDepth(): number;
55
+ getTraceSafety(): TraceSafetyOptions;
56
+ write(event: PersistedInspectEvent): Promise<void>;
57
+ flush(): Promise<void>;
58
+ close(): Promise<void>;
59
+ getDiagnostics(): InspectorRuntimeDiagnostics;
60
+ }
61
+ declare function createInspectorRuntime(options?: InspectorRuntimeOptions): InspectorRuntime;
62
+
63
+ interface InspectorCaptureOptions {
64
+ onSuccess?: "none" | "metadata-only";
65
+ onError?: "none" | "metadata-only";
66
+ }
67
+ interface CreateInspectorOptions {
68
+ enabled?: boolean;
69
+ writer?: TraceWriter;
70
+ /**
71
+ * Context metadata only. Does not configure writer output; use
72
+ * `fileWriter({ dir })` or another explicit writer for persistence paths.
73
+ *
74
+ * @experimental
75
+ */
76
+ traceDir?: string;
77
+ /**
78
+ * Context metadata only for compatibility with existing terminal helpers.
79
+ * `createInspector()` does not print lifecycle output.
80
+ *
81
+ * @experimental
82
+ */
83
+ silent?: boolean;
84
+ metadata?: Record<string, unknown>;
85
+ redactionProfile?: RedactionProfile;
86
+ /**
87
+ * Metadata-only summaries for persisted run/step completion rows.
88
+ * This never stores raw return values, prompts, outputs, or thrown objects.
89
+ *
90
+ * @experimental
91
+ */
92
+ capture?: InspectorCaptureOptions;
93
+ traceSafety?: TraceSafetyOptions;
94
+ }
95
+ interface InspectorRunOptions {
96
+ runId?: string;
97
+ traceDir?: string;
98
+ silent?: boolean;
99
+ metadata?: Record<string, unknown>;
100
+ }
101
+ interface InspectorStepOptions {
102
+ type?: StepType;
103
+ metadata?: StepMetadata;
104
+ }
105
+ type InspectorObserveOptions = InspectorStepOptions;
106
+ interface Inspector {
107
+ /**
108
+ * Low-level runtime access is retained for v1.6 compatibility. Prefer
109
+ * `getDiagnostics()` unless you need advanced runtime context primitives.
110
+ *
111
+ * @experimental
112
+ */
113
+ readonly runtime: InspectorRuntime;
114
+ run<T>(name: string, fn: () => T | Promise<T>, options?: InspectorRunOptions): Promise<T>;
115
+ step<T>(name: string, fn: () => T | Promise<T>, options?: InspectorStepOptions): Promise<T>;
116
+ tool<T>(name: string, fn: () => T | Promise<T>, options?: InspectorStepOptions): Promise<T>;
117
+ llm<T>(name: string, fn: () => T | Promise<T>, options?: InspectorStepOptions): Promise<T>;
118
+ observe<TFunction extends (...args: any[]) => any>(name: string, fn: TFunction, options?: InspectorObserveOptions): (...args: Parameters<TFunction>) => Promise<Awaited<ReturnType<TFunction>>>;
119
+ getDiagnostics(): ReturnType<InspectorRuntime["getDiagnostics"]>;
120
+ flush(): Promise<void>;
121
+ close(): Promise<void>;
122
+ }
123
+ declare function createInspector(options?: CreateInspectorOptions): Inspector;
124
+
125
+ /**
126
+ * Returns true when `value` is one of the recognized AGENT_INSPECT enable tokens
127
+ * (`1`, `true`, `yes`, `on`, `enabled`, case-insensitive). Undefined or any other value is false.
128
+ */
129
+ declare function isAgentInspectEnabled(value?: string): boolean;
130
+ /**
131
+ * Runs `fn` with tracing when enabled; otherwise passthrough (no trace file, no context).
132
+ *
133
+ * Enablement order: explicit `options.enabled` wins; when omitted, reads `process.env.AGENT_INSPECT`.
134
+ * Unset or unrecognized env values disable tracing.
135
+ */
136
+ declare function maybeInspectRun<T>(name: string, fn: () => Promise<T> | T, options?: InspectRunOptions): Promise<T>;
137
+
138
+ /** Returns the active run context, without internal step fields. */
139
+ declare function getCurrentContext(): ExecutionContext | undefined;
140
+ /** Active `runId` when inside `runWithContext`, else `undefined`. */
141
+ declare function getCurrentRunId(): string | undefined;
142
+ /**
143
+ * Correlation metadata for the active run (`correlationId`, `requestId`, `decisionId`, `groupId`).
144
+ * `undefined` outside `inspectRun` / `maybeInspectRun` or when no correlation fields were set.
145
+ */
146
+ declare function getCurrentCorrelationMetadata(): TraceCorrelationMetadata | undefined;
147
+ /** Active `runName` when inside `runWithContext`, else `undefined`. */
148
+ declare function getCurrentRunName(): string | undefined;
149
+ /**
150
+ * Active step id in this async scope (parent for nested `step()` calls).
151
+ * `undefined` at run root or outside any run.
152
+ */
153
+ declare function getCurrentStepId(): string | undefined;
154
+ /** Alias of {@link getCurrentStepId} for readability in step instrumentation. */
155
+ declare function getParentStepId(): string | undefined;
156
+ /**
157
+ * Nesting depth: `0` at run root, increments by one per nested `runWithStepContext`.
158
+ * Returns `0` outside any run.
159
+ */
160
+ declare function getCurrentDepth(): number;
161
+ declare function hasActiveContext(): boolean;
162
+ declare function getTraceDirFromContext(): string | undefined;
163
+ declare function isSilentContext(): boolean;
164
+ /** Resolved trace safety settings for the active run (redaction + size bounds). */
165
+ declare function getTraceSafetyFromContext(): TraceSafetyOptions | undefined;
166
+ /**
167
+ * Runs `fn` with a fresh AgentInspect run context (depth 0, no active step).
168
+ * Propagates sync/async results and rejections; does not swallow user errors.
169
+ */
170
+ declare function runWithContext<T>(context: ExecutionContext, fn: () => Promise<T> | T, traceSafety?: TraceSafetyOptions): Promise<T>;
171
+ /**
172
+ * Runs `fn` with `stepId` as the active step (incremented depth).
173
+ * If no run is active, runs `fn` without altering async context.
174
+ */
175
+ declare function runWithStepContext<T>(stepId: string, fn: () => Promise<T> | T): Promise<T>;
176
+
177
+ export { prepareTraceEventForDisk as A, resolveTraceSafetyOptions as B, type CreateInspectorOptions as C, DEFAULT_MAX_EVENT_BYTES as D, runWithContext as E, runWithStepContext as F, type Inspector as I, type TraceSafetyOptions as T, type InspectorCaptureOptions as a, type InspectorObserveOptions as b, type InspectorRunOptions as c, type InspectorStepOptions as d, createInspector as e, DEFAULT_MAX_METADATA_VALUE_LENGTH as f, getCurrentCorrelationMetadata as g, DEFAULT_MAX_PREVIEW_LENGTH as h, type InspectorRuntime as i, type InspectorRuntimeContext as j, type InspectorRuntimeDiagnostics as k, type InspectorRuntimeOptions as l, maybeInspectRun as m, createInspectorRuntime as n, getCurrentContext as o, getCurrentDepth as p, getCurrentRunId as q, getCurrentRunName as r, getCurrentStepId as s, getParentStepId as t, getTraceDirFromContext as u, getTraceSafetyFromContext as v, hasActiveContext as w, isAgentInspectEnabled as x, isSilentContext as y, prepareMetadataForDisk as z };
@@ -1,5 +1,5 @@
1
- import { T as TraceEvent } from './types-B2-BU5CS.cjs';
2
- import './log-config-DanPV3P9.cjs';
1
+ import { h as TraceEvent } from './types-DgMN3qow.cjs';
2
+ import './log-config-8aE5Kxtr.cjs';
3
3
  import './inspect-event-CevRYp58.cjs';
4
4
 
5
5
  type DiffSeverity = "info" | "warning" | "error";
@@ -1,5 +1,5 @@
1
- import { T as TraceEvent } from './types-Ap9uMdx_.js';
2
- import './log-config-BPHS4Sds.js';
1
+ import { h as TraceEvent } from './types-D-Y1kOU-.js';
2
+ import './log-config-DVimQJho.js';
3
3
  import './inspect-event-CevRYp58.js';
4
4
 
5
5
  type DiffSeverity = "info" | "warning" | "error";