agent-inspect 1.1.0 → 1.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.
- package/CHANGELOG.md +46 -4
- package/README.md +27 -9
- package/SECURITY.md +1 -1
- package/docs/ADAPTERS.md +22 -1
- package/docs/API.md +45 -11
- package/docs/ARCHITECTURE.md +1 -0
- package/docs/CLI.md +56 -1
- package/docs/DIFF.md +127 -0
- package/docs/EXPORTS.md +14 -0
- package/docs/GETTING-STARTED.md +7 -2
- package/docs/KNOWN-ISSUES.md +53 -0
- package/docs/LIMITATIONS.md +17 -0
- package/docs/SCHEMA.md +41 -2
- package/package.json +2 -1
- package/packages/cli/dist/index.cjs +890 -109
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +884 -104
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/core/dist/index.cjs +1627 -136
- package/packages/core/dist/index.cjs.map +1 -1
- package/packages/core/dist/index.d.cts +190 -3
- package/packages/core/dist/index.d.ts +190 -3
- package/packages/core/dist/index.mjs +1611 -133
- package/packages/core/dist/index.mjs.map +1 -1
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
var promises = require('fs/promises');
|
|
4
4
|
var crypto = require('crypto');
|
|
5
|
-
var nanoid = require('nanoid');
|
|
6
5
|
var os = require('os');
|
|
7
6
|
var path = require('path');
|
|
8
7
|
var async_hooks = require('async_hooks');
|
|
9
8
|
var fs = require('fs');
|
|
10
9
|
var readline = require('readline');
|
|
11
|
-
var
|
|
10
|
+
var process2 = require('process');
|
|
11
|
+
var tty = require('tty');
|
|
12
12
|
|
|
13
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
|
|
15
15
|
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
16
16
|
var os__default = /*#__PURE__*/_interopDefault(os);
|
|
17
17
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
18
|
-
var
|
|
18
|
+
var process2__default = /*#__PURE__*/_interopDefault(process2);
|
|
19
|
+
var tty__default = /*#__PURE__*/_interopDefault(tty);
|
|
19
20
|
|
|
20
21
|
// packages/core/src/types.ts
|
|
21
22
|
var STEP_TYPES = [
|
|
@@ -63,7 +64,793 @@ function isTraceEvent(value) {
|
|
|
63
64
|
return false;
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
|
|
68
|
+
// packages/core/src/types/persisted-inspect-event.ts
|
|
69
|
+
var INSPECT_KINDS = [
|
|
70
|
+
"RUN",
|
|
71
|
+
"AGENT",
|
|
72
|
+
"LLM",
|
|
73
|
+
"TOOL",
|
|
74
|
+
"CHAIN",
|
|
75
|
+
"RETRIEVER",
|
|
76
|
+
"DECISION",
|
|
77
|
+
"RESULT",
|
|
78
|
+
"ERROR",
|
|
79
|
+
"LOGIC",
|
|
80
|
+
"LOG"
|
|
81
|
+
];
|
|
82
|
+
var ATTRIBUTION_CONFIDENCES = [
|
|
83
|
+
"explicit",
|
|
84
|
+
"correlated",
|
|
85
|
+
"heuristic",
|
|
86
|
+
"unknown"
|
|
87
|
+
];
|
|
88
|
+
var PERSISTED_EVENT_SOURCE_TYPES = [
|
|
89
|
+
"manual",
|
|
90
|
+
"json-log",
|
|
91
|
+
"log4js",
|
|
92
|
+
"adapter",
|
|
93
|
+
"ai-sdk",
|
|
94
|
+
"otel"
|
|
95
|
+
];
|
|
96
|
+
var PERSISTED_EVENT_STATUSES = [
|
|
97
|
+
"running",
|
|
98
|
+
"ok",
|
|
99
|
+
"error",
|
|
100
|
+
"unknown"
|
|
101
|
+
];
|
|
102
|
+
function isRecord2(value) {
|
|
103
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
104
|
+
}
|
|
105
|
+
function isString(value) {
|
|
106
|
+
return typeof value === "string";
|
|
107
|
+
}
|
|
108
|
+
function isNonEmptyString(value) {
|
|
109
|
+
return typeof value === "string" && value.length > 0;
|
|
110
|
+
}
|
|
111
|
+
function isOptionalString(value) {
|
|
112
|
+
return value === void 0 || isString(value);
|
|
113
|
+
}
|
|
114
|
+
function isNonNegativeNumber(value) {
|
|
115
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
116
|
+
}
|
|
117
|
+
function isOptionalNonNegativeNumber(value) {
|
|
118
|
+
return value === void 0 || isNonNegativeNumber(value);
|
|
119
|
+
}
|
|
120
|
+
function isInspectKind(value) {
|
|
121
|
+
return typeof value === "string" && INSPECT_KINDS.includes(value);
|
|
122
|
+
}
|
|
123
|
+
function isAttributionConfidence(value) {
|
|
124
|
+
return typeof value === "string" && ATTRIBUTION_CONFIDENCES.includes(value);
|
|
125
|
+
}
|
|
126
|
+
function isPersistedEventSourceType(value) {
|
|
127
|
+
return typeof value === "string" && PERSISTED_EVENT_SOURCE_TYPES.includes(value);
|
|
128
|
+
}
|
|
129
|
+
function isPersistedEventStatus(value) {
|
|
130
|
+
return typeof value === "string" && PERSISTED_EVENT_STATUSES.includes(value);
|
|
131
|
+
}
|
|
132
|
+
function isPersistedEventSource(value) {
|
|
133
|
+
if (!isRecord2(value)) return false;
|
|
134
|
+
if (!isPersistedEventSourceType(value.type)) return false;
|
|
135
|
+
if (!isOptionalString(value.name)) return false;
|
|
136
|
+
if (!isOptionalString(value.version)) return false;
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
function isPersistedInspectError(value) {
|
|
140
|
+
if (!isRecord2(value)) return false;
|
|
141
|
+
if (!isNonEmptyString(value.message)) return false;
|
|
142
|
+
if (!isOptionalString(value.name)) return false;
|
|
143
|
+
if (!isOptionalString(value.code)) return false;
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
function isPersistedTokenUsage(value) {
|
|
147
|
+
if (!isRecord2(value)) return false;
|
|
148
|
+
if (!isOptionalNonNegativeNumber(value.input)) return false;
|
|
149
|
+
if (!isOptionalNonNegativeNumber(value.output)) return false;
|
|
150
|
+
if (!isOptionalNonNegativeNumber(value.total)) return false;
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
function isPersistedTraceContext(value) {
|
|
154
|
+
if (!isRecord2(value)) return false;
|
|
155
|
+
if (!isOptionalString(value.traceId)) return false;
|
|
156
|
+
if (!isOptionalString(value.spanId)) return false;
|
|
157
|
+
if (!isOptionalString(value.parentSpanId)) return false;
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
function isPersistedInspectEvent(value) {
|
|
161
|
+
if (!isRecord2(value)) return false;
|
|
162
|
+
if (value.schemaVersion !== "0.2") return false;
|
|
163
|
+
if (!isNonEmptyString(value.eventId)) return false;
|
|
164
|
+
if (!isNonEmptyString(value.runId)) return false;
|
|
165
|
+
if (!isInspectKind(value.kind)) return false;
|
|
166
|
+
if (!isNonEmptyString(value.name)) return false;
|
|
167
|
+
if (!isNonEmptyString(value.timestamp)) return false;
|
|
168
|
+
if (!isAttributionConfidence(value.confidence)) return false;
|
|
169
|
+
if (!isPersistedEventSource(value.source)) return false;
|
|
170
|
+
if (value.parentId !== void 0 && !isNonEmptyString(value.parentId)) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
if (value.status !== void 0 && !isPersistedEventStatus(value.status)) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
if (!isOptionalString(value.startedAt)) return false;
|
|
177
|
+
if (!isOptionalString(value.endedAt)) return false;
|
|
178
|
+
if (value.durationMs !== void 0 && !isNonNegativeNumber(value.durationMs)) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
if (value.attributes !== void 0 && !isRecord2(value.attributes)) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
if (value.error !== void 0 && !isPersistedInspectError(value.error)) {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
if (value.tokenUsage !== void 0 && !isPersistedTokenUsage(value.tokenUsage)) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
if (value.trace !== void 0 && !isPersistedTraceContext(value.trace)) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// packages/core/src/correlation-metadata.ts
|
|
197
|
+
var TRACE_CORRELATION_KEYS = [
|
|
198
|
+
"correlationId",
|
|
199
|
+
"requestId",
|
|
200
|
+
"decisionId",
|
|
201
|
+
"groupId"
|
|
202
|
+
];
|
|
203
|
+
function isNonEmptyString2(value) {
|
|
204
|
+
return typeof value === "string" && value.length > 0;
|
|
205
|
+
}
|
|
206
|
+
function extractCorrelationMetadata(record) {
|
|
207
|
+
if (!record) {
|
|
208
|
+
return void 0;
|
|
209
|
+
}
|
|
210
|
+
const out = {};
|
|
211
|
+
let found = false;
|
|
212
|
+
for (const key of TRACE_CORRELATION_KEYS) {
|
|
213
|
+
const value = record[key];
|
|
214
|
+
if (isNonEmptyString2(value)) {
|
|
215
|
+
out[key] = value;
|
|
216
|
+
found = true;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return found ? out : void 0;
|
|
220
|
+
}
|
|
221
|
+
function buildRunStartedMetadata(options) {
|
|
222
|
+
if (!options) {
|
|
223
|
+
return void 0;
|
|
224
|
+
}
|
|
225
|
+
const merged = options.metadata !== void 0 ? { ...options.metadata } : {};
|
|
226
|
+
if (isNonEmptyString2(options.correlationId)) {
|
|
227
|
+
merged.correlationId = options.correlationId;
|
|
228
|
+
}
|
|
229
|
+
if (isNonEmptyString2(options.requestId)) {
|
|
230
|
+
merged.requestId = options.requestId;
|
|
231
|
+
}
|
|
232
|
+
if (isNonEmptyString2(options.decisionId)) {
|
|
233
|
+
merged.decisionId = options.decisionId;
|
|
234
|
+
}
|
|
235
|
+
if (isNonEmptyString2(options.groupId)) {
|
|
236
|
+
merged.groupId = options.groupId;
|
|
237
|
+
}
|
|
238
|
+
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// packages/core/src/persisted/from-trace-event.ts
|
|
242
|
+
function sanitizeIdPart(value) {
|
|
243
|
+
return value.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
244
|
+
}
|
|
245
|
+
function nodeIdForEvent(event) {
|
|
246
|
+
switch (event.event) {
|
|
247
|
+
case "run_started":
|
|
248
|
+
case "run_completed":
|
|
249
|
+
return event.runId;
|
|
250
|
+
case "step_started":
|
|
251
|
+
case "step_completed":
|
|
252
|
+
return event.stepId;
|
|
253
|
+
default:
|
|
254
|
+
return "unknown";
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function createPersistedEventId(event, eventIndex) {
|
|
258
|
+
const runId = sanitizeIdPart(event.runId);
|
|
259
|
+
const ev = sanitizeIdPart(event.event);
|
|
260
|
+
const node = sanitizeIdPart(nodeIdForEvent(event));
|
|
261
|
+
return `manual:${runId}:${ev}:${node}:${eventIndex}`;
|
|
262
|
+
}
|
|
263
|
+
function toIsoTimestamp(ms) {
|
|
264
|
+
if (typeof ms !== "number" || !Number.isFinite(ms)) {
|
|
265
|
+
return { iso: (/* @__PURE__ */ new Date(0)).toISOString(), invalidTimestamp: true };
|
|
266
|
+
}
|
|
267
|
+
return { iso: new Date(ms).toISOString(), invalidTimestamp: false };
|
|
268
|
+
}
|
|
269
|
+
function buildSource(options) {
|
|
270
|
+
return {
|
|
271
|
+
type: "manual",
|
|
272
|
+
name: options?.sourceName ?? "trace-event",
|
|
273
|
+
version: options?.sourceVersion ?? "0.1"
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function mapStepTypeToInspectKind(type) {
|
|
277
|
+
switch (type) {
|
|
278
|
+
case "run":
|
|
279
|
+
return "RUN";
|
|
280
|
+
case "llm":
|
|
281
|
+
return "LLM";
|
|
282
|
+
case "tool":
|
|
283
|
+
return "TOOL";
|
|
284
|
+
case "decision":
|
|
285
|
+
return "DECISION";
|
|
286
|
+
case "logic":
|
|
287
|
+
case "state":
|
|
288
|
+
case "custom":
|
|
289
|
+
return "LOGIC";
|
|
290
|
+
default:
|
|
291
|
+
return "LOGIC";
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
function mapRunOrStepStatus(status) {
|
|
295
|
+
return status === "success" ? "ok" : "error";
|
|
296
|
+
}
|
|
297
|
+
function mapErrorInfo(error) {
|
|
298
|
+
if (!error?.message) {
|
|
299
|
+
return {};
|
|
300
|
+
}
|
|
301
|
+
const out = {
|
|
302
|
+
persisted: {
|
|
303
|
+
message: error.message,
|
|
304
|
+
name: "Error"
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
if (typeof error.stack === "string" && error.stack.length > 0) {
|
|
308
|
+
out.errorStack = error.stack;
|
|
309
|
+
}
|
|
310
|
+
return out;
|
|
311
|
+
}
|
|
312
|
+
function mapTokenUsageFromMetadata(metadata) {
|
|
313
|
+
const tokens = metadata?.tokens;
|
|
314
|
+
if (!tokens || typeof tokens !== "object") {
|
|
315
|
+
return void 0;
|
|
316
|
+
}
|
|
317
|
+
const input = typeof tokens.input === "number" && Number.isFinite(tokens.input) && tokens.input >= 0 ? tokens.input : void 0;
|
|
318
|
+
const output = typeof tokens.output === "number" && Number.isFinite(tokens.output) && tokens.output >= 0 ? tokens.output : void 0;
|
|
319
|
+
if (input === void 0 && output === void 0) {
|
|
320
|
+
return void 0;
|
|
321
|
+
}
|
|
322
|
+
const usage = {};
|
|
323
|
+
if (input !== void 0) usage.input = input;
|
|
324
|
+
if (output !== void 0) usage.output = output;
|
|
325
|
+
if (input !== void 0 && output !== void 0) {
|
|
326
|
+
usage.total = input + output;
|
|
327
|
+
}
|
|
328
|
+
return usage;
|
|
329
|
+
}
|
|
330
|
+
function compactAttributes(entries) {
|
|
331
|
+
const out = {};
|
|
332
|
+
for (const [key, value] of Object.entries(entries)) {
|
|
333
|
+
if (value !== void 0) {
|
|
334
|
+
out[key] = value;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
338
|
+
}
|
|
339
|
+
function traceEventToPersistedInspectEvent(event, options) {
|
|
340
|
+
const eventIndex = options?.eventIndex ?? 0;
|
|
341
|
+
const eventId = createPersistedEventId(event, eventIndex);
|
|
342
|
+
const source = buildSource(options);
|
|
343
|
+
const tsMain = toIsoTimestamp(event.timestamp);
|
|
344
|
+
switch (event.event) {
|
|
345
|
+
case "run_started": {
|
|
346
|
+
const tsStart = toIsoTimestamp(event.startTime);
|
|
347
|
+
const correlation = extractCorrelationMetadata(event.metadata);
|
|
348
|
+
const attributes = compactAttributes({
|
|
349
|
+
legacyEvent: "run_started",
|
|
350
|
+
metadata: event.metadata !== void 0 ? { ...event.metadata } : void 0,
|
|
351
|
+
correlationId: correlation?.correlationId,
|
|
352
|
+
requestId: correlation?.requestId,
|
|
353
|
+
decisionId: correlation?.decisionId,
|
|
354
|
+
groupId: correlation?.groupId,
|
|
355
|
+
invalidTimestamp: tsMain.invalidTimestamp || tsStart.invalidTimestamp ? true : void 0
|
|
356
|
+
});
|
|
357
|
+
return {
|
|
358
|
+
schemaVersion: "0.2",
|
|
359
|
+
eventId,
|
|
360
|
+
runId: event.runId,
|
|
361
|
+
kind: "RUN",
|
|
362
|
+
name: event.name,
|
|
363
|
+
status: "running",
|
|
364
|
+
timestamp: tsMain.iso,
|
|
365
|
+
startedAt: tsStart.iso,
|
|
366
|
+
confidence: "explicit",
|
|
367
|
+
source,
|
|
368
|
+
attributes
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
case "run_completed": {
|
|
372
|
+
const tsEnd = toIsoTimestamp(event.endTime);
|
|
373
|
+
const { persisted: error, errorStack } = mapErrorInfo(event.error);
|
|
374
|
+
const attributes = compactAttributes({
|
|
375
|
+
legacyEvent: "run_completed",
|
|
376
|
+
errorStack,
|
|
377
|
+
invalidTimestamp: tsMain.invalidTimestamp || tsEnd.invalidTimestamp ? true : void 0
|
|
378
|
+
});
|
|
379
|
+
return {
|
|
380
|
+
schemaVersion: "0.2",
|
|
381
|
+
eventId,
|
|
382
|
+
runId: event.runId,
|
|
383
|
+
kind: "RUN",
|
|
384
|
+
name: "run",
|
|
385
|
+
status: mapRunOrStepStatus(event.status),
|
|
386
|
+
timestamp: tsMain.iso,
|
|
387
|
+
endedAt: tsEnd.iso,
|
|
388
|
+
durationMs: event.durationMs,
|
|
389
|
+
confidence: "explicit",
|
|
390
|
+
source,
|
|
391
|
+
attributes,
|
|
392
|
+
error
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
case "step_started": {
|
|
396
|
+
const tsStart = toIsoTimestamp(event.startTime);
|
|
397
|
+
const tokenUsage = mapTokenUsageFromMetadata(event.metadata);
|
|
398
|
+
const attributes = compactAttributes({
|
|
399
|
+
legacyEvent: "step_started",
|
|
400
|
+
stepId: event.stepId,
|
|
401
|
+
stepType: event.type,
|
|
402
|
+
metadata: event.metadata !== void 0 ? { ...event.metadata } : void 0,
|
|
403
|
+
invalidTimestamp: tsMain.invalidTimestamp || tsStart.invalidTimestamp ? true : void 0
|
|
404
|
+
});
|
|
405
|
+
const out = {
|
|
406
|
+
schemaVersion: "0.2",
|
|
407
|
+
eventId,
|
|
408
|
+
runId: event.runId,
|
|
409
|
+
kind: mapStepTypeToInspectKind(event.type),
|
|
410
|
+
name: event.name,
|
|
411
|
+
status: "running",
|
|
412
|
+
timestamp: tsMain.iso,
|
|
413
|
+
startedAt: tsStart.iso,
|
|
414
|
+
confidence: "explicit",
|
|
415
|
+
source,
|
|
416
|
+
attributes
|
|
417
|
+
};
|
|
418
|
+
if (event.parentId !== void 0) {
|
|
419
|
+
out.parentId = event.parentId;
|
|
420
|
+
}
|
|
421
|
+
if (tokenUsage !== void 0) {
|
|
422
|
+
out.tokenUsage = tokenUsage;
|
|
423
|
+
}
|
|
424
|
+
return out;
|
|
425
|
+
}
|
|
426
|
+
case "step_completed": {
|
|
427
|
+
const tsEnd = toIsoTimestamp(event.endTime);
|
|
428
|
+
const { persisted: error, errorStack } = mapErrorInfo(event.error);
|
|
429
|
+
const attributes = compactAttributes({
|
|
430
|
+
legacyEvent: "step_completed",
|
|
431
|
+
stepId: event.stepId,
|
|
432
|
+
errorStack,
|
|
433
|
+
invalidTimestamp: tsMain.invalidTimestamp || tsEnd.invalidTimestamp ? true : void 0
|
|
434
|
+
});
|
|
435
|
+
return {
|
|
436
|
+
schemaVersion: "0.2",
|
|
437
|
+
eventId,
|
|
438
|
+
runId: event.runId,
|
|
439
|
+
kind: "LOGIC",
|
|
440
|
+
name: event.stepId,
|
|
441
|
+
status: mapRunOrStepStatus(event.status),
|
|
442
|
+
timestamp: tsMain.iso,
|
|
443
|
+
endedAt: tsEnd.iso,
|
|
444
|
+
durationMs: event.durationMs,
|
|
445
|
+
confidence: "explicit",
|
|
446
|
+
source,
|
|
447
|
+
attributes,
|
|
448
|
+
error
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
default: {
|
|
452
|
+
const _exhaustive = event;
|
|
453
|
+
throw new Error(`Unsupported trace event: ${_exhaustive.event}`);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
function traceEventsToPersistedInspectEvents(events, options) {
|
|
458
|
+
return events.map(
|
|
459
|
+
(event, index) => traceEventToPersistedInspectEvent(event, { ...options, eventIndex: index })
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// packages/core/src/persisted/from-inspect-event.ts
|
|
464
|
+
function sanitizeIdPart2(value) {
|
|
465
|
+
return value.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
466
|
+
}
|
|
467
|
+
function createFallbackEventId(event, eventIndex) {
|
|
468
|
+
const runId = sanitizeIdPart2(event.runId);
|
|
469
|
+
const kind = sanitizeIdPart2(event.kind);
|
|
470
|
+
const name = sanitizeIdPart2(event.name);
|
|
471
|
+
return `inspect:${runId}:${kind}:${name}:${eventIndex}`;
|
|
472
|
+
}
|
|
473
|
+
function toIsoTimestamp2(ms) {
|
|
474
|
+
if (typeof ms !== "number" || !Number.isFinite(ms)) {
|
|
475
|
+
return { iso: (/* @__PURE__ */ new Date(0)).toISOString(), invalidTimestamp: true };
|
|
476
|
+
}
|
|
477
|
+
return { iso: new Date(ms).toISOString(), invalidTimestamp: false };
|
|
478
|
+
}
|
|
479
|
+
function compactAttributes2(entries) {
|
|
480
|
+
const out = {};
|
|
481
|
+
for (const [key, value] of Object.entries(entries)) {
|
|
482
|
+
if (value !== void 0) {
|
|
483
|
+
out[key] = value;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
487
|
+
}
|
|
488
|
+
function mapInspectSourceToPersisted(source, options) {
|
|
489
|
+
const name = options?.sourceName;
|
|
490
|
+
const version = options?.sourceVersion;
|
|
491
|
+
switch (source.type) {
|
|
492
|
+
case "pino":
|
|
493
|
+
return {
|
|
494
|
+
persistedSource: {
|
|
495
|
+
type: "json-log",
|
|
496
|
+
name: name ?? "pino",
|
|
497
|
+
version
|
|
498
|
+
},
|
|
499
|
+
originalSourceType: "pino"
|
|
500
|
+
};
|
|
501
|
+
case "winston":
|
|
502
|
+
return {
|
|
503
|
+
persistedSource: {
|
|
504
|
+
type: "json-log",
|
|
505
|
+
name: name ?? "winston",
|
|
506
|
+
version
|
|
507
|
+
},
|
|
508
|
+
originalSourceType: "winston"
|
|
509
|
+
};
|
|
510
|
+
case "manual":
|
|
511
|
+
case "json-log":
|
|
512
|
+
case "log4js":
|
|
513
|
+
case "adapter":
|
|
514
|
+
return {
|
|
515
|
+
persistedSource: {
|
|
516
|
+
type: source.type,
|
|
517
|
+
name,
|
|
518
|
+
version
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
default:
|
|
522
|
+
return {
|
|
523
|
+
persistedSource: {
|
|
524
|
+
type: "json-log",
|
|
525
|
+
name,
|
|
526
|
+
version
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
function mapTokenUsageFromAttributes(attributes) {
|
|
532
|
+
const tokens = attributes?.tokens;
|
|
533
|
+
if (!tokens || typeof tokens !== "object" || Array.isArray(tokens)) {
|
|
534
|
+
return void 0;
|
|
535
|
+
}
|
|
536
|
+
const rec = tokens;
|
|
537
|
+
const input = typeof rec.input === "number" && Number.isFinite(rec.input) && rec.input >= 0 ? rec.input : void 0;
|
|
538
|
+
const output = typeof rec.output === "number" && Number.isFinite(rec.output) && rec.output >= 0 ? rec.output : void 0;
|
|
539
|
+
if (input === void 0 && output === void 0) {
|
|
540
|
+
return void 0;
|
|
541
|
+
}
|
|
542
|
+
const usage = {};
|
|
543
|
+
if (input !== void 0) usage.input = input;
|
|
544
|
+
if (output !== void 0) usage.output = output;
|
|
545
|
+
if (input !== void 0 && output !== void 0) {
|
|
546
|
+
usage.total = input + output;
|
|
547
|
+
}
|
|
548
|
+
return usage;
|
|
549
|
+
}
|
|
550
|
+
function mapErrorFromAttributes(event) {
|
|
551
|
+
if (event.status !== "error" || !event.attributes) {
|
|
552
|
+
return void 0;
|
|
553
|
+
}
|
|
554
|
+
const message = event.attributes.errorMessage;
|
|
555
|
+
if (typeof message !== "string" || message.length === 0) {
|
|
556
|
+
return void 0;
|
|
557
|
+
}
|
|
558
|
+
const err = { message };
|
|
559
|
+
if (typeof event.attributes.errorName === "string") {
|
|
560
|
+
err.name = event.attributes.errorName;
|
|
561
|
+
}
|
|
562
|
+
return err;
|
|
563
|
+
}
|
|
564
|
+
function inspectEventToPersistedInspectEvent(event, options) {
|
|
565
|
+
const eventIndex = options?.eventIndex ?? 0;
|
|
566
|
+
const eventId = typeof event.eventId === "string" && event.eventId.length > 0 ? event.eventId : createFallbackEventId(event, eventIndex);
|
|
567
|
+
const ts = toIsoTimestamp2(event.timestamp);
|
|
568
|
+
const { persistedSource, originalSourceType } = mapInspectSourceToPersisted(
|
|
569
|
+
event.source,
|
|
570
|
+
options
|
|
571
|
+
);
|
|
572
|
+
const attrsBase = event.attributes !== void 0 ? { ...event.attributes } : {};
|
|
573
|
+
const attributes = compactAttributes2({
|
|
574
|
+
...attrsBase,
|
|
575
|
+
sourceFile: event.source.file,
|
|
576
|
+
sourceLine: event.source.line,
|
|
577
|
+
originalSourceType,
|
|
578
|
+
invalidTimestamp: ts.invalidTimestamp ? true : void 0
|
|
579
|
+
});
|
|
580
|
+
const tokenUsage = mapTokenUsageFromAttributes(event.attributes);
|
|
581
|
+
const error = mapErrorFromAttributes(event);
|
|
582
|
+
const inputPreview = event.attributes?.inputPreview;
|
|
583
|
+
const outputPreview = event.attributes?.outputPreview;
|
|
584
|
+
const out = {
|
|
585
|
+
schemaVersion: "0.2",
|
|
586
|
+
eventId,
|
|
587
|
+
runId: event.runId,
|
|
588
|
+
kind: event.kind,
|
|
589
|
+
name: event.name,
|
|
590
|
+
timestamp: ts.iso,
|
|
591
|
+
confidence: event.confidence,
|
|
592
|
+
source: persistedSource,
|
|
593
|
+
attributes
|
|
594
|
+
};
|
|
595
|
+
if (event.parentId !== void 0) {
|
|
596
|
+
out.parentId = event.parentId;
|
|
597
|
+
}
|
|
598
|
+
if (event.status !== void 0) {
|
|
599
|
+
out.status = event.status;
|
|
600
|
+
}
|
|
601
|
+
if (event.durationMs !== void 0 && Number.isFinite(event.durationMs) && event.durationMs >= 0) {
|
|
602
|
+
out.durationMs = event.durationMs;
|
|
603
|
+
}
|
|
604
|
+
if (tokenUsage !== void 0) {
|
|
605
|
+
out.tokenUsage = tokenUsage;
|
|
606
|
+
}
|
|
607
|
+
if (error !== void 0) {
|
|
608
|
+
out.error = error;
|
|
609
|
+
}
|
|
610
|
+
if (inputPreview !== void 0) {
|
|
611
|
+
out.inputSummary = inputPreview;
|
|
612
|
+
}
|
|
613
|
+
if (outputPreview !== void 0) {
|
|
614
|
+
out.outputSummary = outputPreview;
|
|
615
|
+
}
|
|
616
|
+
return out;
|
|
617
|
+
}
|
|
618
|
+
function inspectEventsToPersistedInspectEvents(events, options) {
|
|
619
|
+
return events.map(
|
|
620
|
+
(event, index) => inspectEventToPersistedInspectEvent(event, { ...options, eventIndex: index })
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// packages/core/src/persisted/to-inspect-event.ts
|
|
625
|
+
function compactAttributes3(entries) {
|
|
626
|
+
const out = {};
|
|
627
|
+
for (const [key, value] of Object.entries(entries)) {
|
|
628
|
+
if (value !== void 0) {
|
|
629
|
+
out[key] = value;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
633
|
+
}
|
|
634
|
+
function parseIsoToMs(iso) {
|
|
635
|
+
const parsed = Date.parse(iso);
|
|
636
|
+
if (!Number.isFinite(parsed)) {
|
|
637
|
+
return { ms: 0, invalidTimestamp: true };
|
|
638
|
+
}
|
|
639
|
+
return { ms: parsed, invalidTimestamp: false };
|
|
640
|
+
}
|
|
641
|
+
function mapPersistedSourceToInspect(event) {
|
|
642
|
+
const attrs = event.attributes ?? {};
|
|
643
|
+
const sourceName = event.source.name;
|
|
644
|
+
if (sourceName === "pino") {
|
|
645
|
+
return {
|
|
646
|
+
type: "pino",
|
|
647
|
+
file: typeof attrs.sourceFile === "string" ? attrs.sourceFile : void 0,
|
|
648
|
+
line: typeof attrs.sourceLine === "number" ? attrs.sourceLine : void 0
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
if (sourceName === "winston") {
|
|
652
|
+
return {
|
|
653
|
+
type: "winston",
|
|
654
|
+
file: typeof attrs.sourceFile === "string" ? attrs.sourceFile : void 0,
|
|
655
|
+
line: typeof attrs.sourceLine === "number" ? attrs.sourceLine : void 0
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
const mapType = (t) => {
|
|
659
|
+
switch (t) {
|
|
660
|
+
case "manual":
|
|
661
|
+
return "manual";
|
|
662
|
+
case "json-log":
|
|
663
|
+
return "json-log";
|
|
664
|
+
case "log4js":
|
|
665
|
+
return "log4js";
|
|
666
|
+
case "adapter":
|
|
667
|
+
case "ai-sdk":
|
|
668
|
+
case "otel":
|
|
669
|
+
return "adapter";
|
|
670
|
+
default:
|
|
671
|
+
return "json-log";
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
return {
|
|
675
|
+
type: mapType(event.source.type),
|
|
676
|
+
file: typeof attrs.sourceFile === "string" ? attrs.sourceFile : void 0,
|
|
677
|
+
line: typeof attrs.sourceLine === "number" ? attrs.sourceLine : void 0
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
function buildInspectAttributes(event) {
|
|
681
|
+
const attrs = event.attributes !== void 0 ? { ...event.attributes } : {};
|
|
682
|
+
if (event.inputSummary !== void 0) {
|
|
683
|
+
attrs.inputSummary = event.inputSummary;
|
|
684
|
+
}
|
|
685
|
+
if (event.outputSummary !== void 0) {
|
|
686
|
+
attrs.outputSummary = event.outputSummary;
|
|
687
|
+
}
|
|
688
|
+
if (event.error) {
|
|
689
|
+
if (event.error.name !== void 0) {
|
|
690
|
+
attrs.errorName = event.error.name;
|
|
691
|
+
}
|
|
692
|
+
attrs.errorMessage = event.error.message;
|
|
693
|
+
if (event.error.code !== void 0) {
|
|
694
|
+
attrs.errorCode = event.error.code;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
if (event.tokenUsage) {
|
|
698
|
+
attrs.tokens = { ...event.tokenUsage };
|
|
699
|
+
}
|
|
700
|
+
if (event.source.type === "ai-sdk" || event.source.type === "otel") {
|
|
701
|
+
attrs.originalSourceType = event.source.type;
|
|
702
|
+
}
|
|
703
|
+
if (event.source.name !== void 0) {
|
|
704
|
+
attrs.sourceName = event.source.name;
|
|
705
|
+
}
|
|
706
|
+
if (event.source.version !== void 0) {
|
|
707
|
+
attrs.sourceVersion = event.source.version;
|
|
708
|
+
}
|
|
709
|
+
return attrs;
|
|
710
|
+
}
|
|
711
|
+
function persistedInspectEventToInspectEvent(event) {
|
|
712
|
+
if (!isPersistedInspectEvent(event)) {
|
|
713
|
+
throw new Error("Invalid PersistedInspectEvent: failed isPersistedInspectEvent");
|
|
714
|
+
}
|
|
715
|
+
const ts = parseIsoToMs(event.timestamp);
|
|
716
|
+
const attrs = buildInspectAttributes(event);
|
|
717
|
+
if (ts.invalidTimestamp) {
|
|
718
|
+
attrs.invalidTimestamp = true;
|
|
719
|
+
}
|
|
720
|
+
let status;
|
|
721
|
+
if (event.status === "running" || event.status === "ok" || event.status === "error") {
|
|
722
|
+
status = event.status;
|
|
723
|
+
} else if (event.status === "unknown") {
|
|
724
|
+
attrs.persistedStatus = "unknown";
|
|
725
|
+
}
|
|
726
|
+
const out = {
|
|
727
|
+
eventId: event.eventId,
|
|
728
|
+
runId: event.runId,
|
|
729
|
+
name: event.name,
|
|
730
|
+
kind: event.kind,
|
|
731
|
+
timestamp: ts.ms,
|
|
732
|
+
confidence: event.confidence,
|
|
733
|
+
source: mapPersistedSourceToInspect(event),
|
|
734
|
+
attributes: compactAttributes3(attrs)
|
|
735
|
+
};
|
|
736
|
+
if (event.parentId !== void 0) {
|
|
737
|
+
out.parentId = event.parentId;
|
|
738
|
+
}
|
|
739
|
+
if (status !== void 0) {
|
|
740
|
+
out.status = status;
|
|
741
|
+
}
|
|
742
|
+
if (event.durationMs !== void 0 && Number.isFinite(event.durationMs) && event.durationMs >= 0) {
|
|
743
|
+
out.durationMs = event.durationMs;
|
|
744
|
+
}
|
|
745
|
+
return out;
|
|
746
|
+
}
|
|
747
|
+
function persistedInspectEventsToInspectEvents(events, options) {
|
|
748
|
+
const skipInvalid = options?.skipInvalid === true;
|
|
749
|
+
const out = [];
|
|
750
|
+
for (const event of events) {
|
|
751
|
+
if (!isPersistedInspectEvent(event)) {
|
|
752
|
+
if (skipInvalid) {
|
|
753
|
+
continue;
|
|
754
|
+
}
|
|
755
|
+
throw new Error("Invalid PersistedInspectEvent: failed isPersistedInspectEvent");
|
|
756
|
+
}
|
|
757
|
+
out.push(persistedInspectEventToInspectEvent(event));
|
|
758
|
+
}
|
|
759
|
+
return out;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
// packages/core/src/logs/tree-builder.ts
|
|
763
|
+
function inc(map, key) {
|
|
764
|
+
map[key] = (map[key] ?? 0) + 1;
|
|
765
|
+
}
|
|
766
|
+
function computeRunStatus(events) {
|
|
767
|
+
let hasRunning = false;
|
|
768
|
+
for (const e of events) {
|
|
769
|
+
if (e.status === "error") return "error";
|
|
770
|
+
if (e.status === "running") hasRunning = true;
|
|
771
|
+
}
|
|
772
|
+
if (hasRunning) return "running";
|
|
773
|
+
return "ok";
|
|
774
|
+
}
|
|
775
|
+
var TreeBuilder = class {
|
|
776
|
+
constructor(options) {
|
|
777
|
+
void options?.config;
|
|
778
|
+
}
|
|
779
|
+
build(events) {
|
|
780
|
+
const byRun = /* @__PURE__ */ new Map();
|
|
781
|
+
for (const e of events) {
|
|
782
|
+
if (!byRun.has(e.runId)) byRun.set(e.runId, []);
|
|
783
|
+
byRun.get(e.runId).push(e);
|
|
784
|
+
}
|
|
785
|
+
const out = [];
|
|
786
|
+
for (const [runId, runEvents] of byRun.entries()) {
|
|
787
|
+
const sorted = [...runEvents].sort((a, b) => a.timestamp - b.timestamp);
|
|
788
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
789
|
+
for (const e of sorted) {
|
|
790
|
+
nodes.set(e.eventId, { event: e, children: [], depth: 0 });
|
|
791
|
+
}
|
|
792
|
+
const roots = [];
|
|
793
|
+
for (const node of nodes.values()) {
|
|
794
|
+
const parentId = node.event.parentId;
|
|
795
|
+
if (parentId && nodes.has(parentId)) {
|
|
796
|
+
nodes.get(parentId).children.push(node);
|
|
797
|
+
} else {
|
|
798
|
+
roots.push(node);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
const assignDepth = (n, depth) => {
|
|
802
|
+
n.depth = depth;
|
|
803
|
+
for (const c of n.children) assignDepth(c, depth + 1);
|
|
804
|
+
};
|
|
805
|
+
for (const r of roots) assignDepth(r, 0);
|
|
806
|
+
const confidenceBreakdown = {
|
|
807
|
+
explicit: 0,
|
|
808
|
+
correlated: 0,
|
|
809
|
+
heuristic: 0,
|
|
810
|
+
unknown: 0
|
|
811
|
+
};
|
|
812
|
+
const kinds = {};
|
|
813
|
+
for (const e of sorted) {
|
|
814
|
+
inc(confidenceBreakdown, e.confidence);
|
|
815
|
+
kinds[e.kind] = (kinds[e.kind] ?? 0) + 1;
|
|
816
|
+
}
|
|
817
|
+
const startedAt = sorted.length > 0 ? sorted[0].timestamp : void 0;
|
|
818
|
+
const endedAt = sorted.length > 0 ? sorted[sorted.length - 1].timestamp : void 0;
|
|
819
|
+
const status = computeRunStatus(sorted);
|
|
820
|
+
const durationMs = startedAt !== void 0 && endedAt !== void 0 && Number.isFinite(startedAt) && Number.isFinite(endedAt) && endedAt >= startedAt && status !== "running" ? endedAt - startedAt : void 0;
|
|
821
|
+
const name = sorted.find((e) => e.kind === "RUN")?.name;
|
|
822
|
+
out.push({
|
|
823
|
+
runId,
|
|
824
|
+
name,
|
|
825
|
+
status,
|
|
826
|
+
startedAt,
|
|
827
|
+
endedAt: status === "running" ? void 0 : endedAt,
|
|
828
|
+
durationMs,
|
|
829
|
+
children: roots,
|
|
830
|
+
metadata: {
|
|
831
|
+
totalEvents: sorted.length,
|
|
832
|
+
confidenceBreakdown,
|
|
833
|
+
kinds
|
|
834
|
+
}
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
out.sort((a, b) => (b.startedAt ?? 0) - (a.startedAt ?? 0));
|
|
838
|
+
return out;
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
|
|
842
|
+
// packages/core/src/persisted/tree-bridge.ts
|
|
843
|
+
function persistedInspectEventsToRunTrees(events, options) {
|
|
844
|
+
const inspectEvents = persistedInspectEventsToInspectEvents(events, {
|
|
845
|
+
skipInvalid: options?.skipInvalid
|
|
846
|
+
});
|
|
847
|
+
return new TreeBuilder().build(inspectEvents);
|
|
848
|
+
}
|
|
849
|
+
function traceEventsToPersistedRunTrees(events) {
|
|
850
|
+
const persisted = traceEventsToPersistedInspectEvents(events);
|
|
851
|
+
return persistedInspectEventsToRunTrees(persisted);
|
|
852
|
+
}
|
|
853
|
+
function isRecord3(v) {
|
|
67
854
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
68
855
|
}
|
|
69
856
|
function isNonEmptyStringArray(v) {
|
|
@@ -75,7 +862,7 @@ function validateRedact(redact) {
|
|
|
75
862
|
}
|
|
76
863
|
for (const r of redact) {
|
|
77
864
|
if (typeof r === "string") continue;
|
|
78
|
-
if (!
|
|
865
|
+
if (!isRecord3(r)) {
|
|
79
866
|
throw new Error("Invalid config: redact entries must be strings or objects");
|
|
80
867
|
}
|
|
81
868
|
if (typeof r.key !== "string" || r.key.trim() === "") {
|
|
@@ -94,7 +881,7 @@ function validateRedact(redact) {
|
|
|
94
881
|
}
|
|
95
882
|
}
|
|
96
883
|
function validateMappings(mappings) {
|
|
97
|
-
if (!
|
|
884
|
+
if (!isRecord3(mappings)) {
|
|
98
885
|
throw new Error("Invalid config: mappings must be an object");
|
|
99
886
|
}
|
|
100
887
|
}
|
|
@@ -144,7 +931,7 @@ async function loadLogIngestConfig(configPath) {
|
|
|
144
931
|
const msg = e instanceof Error ? e.message : String(e);
|
|
145
932
|
throw new Error(`Invalid JSON in config file: ${configPath} (${msg})`);
|
|
146
933
|
}
|
|
147
|
-
if (!
|
|
934
|
+
if (!isRecord3(parsed)) {
|
|
148
935
|
throw new Error("Invalid config: expected a JSON object at top-level");
|
|
149
936
|
}
|
|
150
937
|
const user = parsed;
|
|
@@ -181,7 +968,7 @@ async function loadLogIngestConfig(configPath) {
|
|
|
181
968
|
}
|
|
182
969
|
return mergeLogIngestConfig(DEFAULT_LOG_INGEST_CONFIG, user);
|
|
183
970
|
}
|
|
184
|
-
function
|
|
971
|
+
function isRecord4(v) {
|
|
185
972
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
186
973
|
}
|
|
187
974
|
var JsonLogParser = class {
|
|
@@ -206,7 +993,7 @@ var JsonLogParser = class {
|
|
|
206
993
|
});
|
|
207
994
|
continue;
|
|
208
995
|
}
|
|
209
|
-
if (!
|
|
996
|
+
if (!isRecord4(parsed)) {
|
|
210
997
|
warnings.push({
|
|
211
998
|
code: "MALFORMED_JSON",
|
|
212
999
|
message: "JSON log line must be an object",
|
|
@@ -237,7 +1024,7 @@ var JsonLogParser = class {
|
|
|
237
1024
|
return this.parseLines(lines, filePath);
|
|
238
1025
|
}
|
|
239
1026
|
};
|
|
240
|
-
function
|
|
1027
|
+
function isRecord5(v) {
|
|
241
1028
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
242
1029
|
}
|
|
243
1030
|
function findLastJsonObjectSubstring(line) {
|
|
@@ -313,7 +1100,7 @@ var Log4jsParser = class {
|
|
|
313
1100
|
});
|
|
314
1101
|
continue;
|
|
315
1102
|
}
|
|
316
|
-
if (!
|
|
1103
|
+
if (!isRecord5(parsed)) {
|
|
317
1104
|
warnings.push({
|
|
318
1105
|
code: "UNSUPPORTED_LOG4JS_PAYLOAD",
|
|
319
1106
|
message: "Embedded JSON payload must be an object",
|
|
@@ -391,7 +1178,7 @@ var DEFAULT_REDACT_KEYS = [
|
|
|
391
1178
|
"secret",
|
|
392
1179
|
"email"
|
|
393
1180
|
];
|
|
394
|
-
function
|
|
1181
|
+
function isRecord6(v) {
|
|
395
1182
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
396
1183
|
}
|
|
397
1184
|
function toKey(s) {
|
|
@@ -401,7 +1188,7 @@ function stableHash(value) {
|
|
|
401
1188
|
const h = crypto__default.default.createHash("sha256").update(value, "utf8").digest("hex");
|
|
402
1189
|
return h.slice(0, 8);
|
|
403
1190
|
}
|
|
404
|
-
function compileRules(rules) {
|
|
1191
|
+
function compileRules(rules, extraKeys) {
|
|
405
1192
|
const out = /* @__PURE__ */ new Map();
|
|
406
1193
|
const set = (r) => {
|
|
407
1194
|
const k = toKey(r.key);
|
|
@@ -410,6 +1197,11 @@ function compileRules(rules) {
|
|
|
410
1197
|
for (const k of DEFAULT_REDACT_KEYS) {
|
|
411
1198
|
set({ key: k, strategy: "full" });
|
|
412
1199
|
}
|
|
1200
|
+
for (const k of extraKeys ?? []) {
|
|
1201
|
+
if (typeof k === "string" && k.length > 0) {
|
|
1202
|
+
set({ key: k, strategy: "full" });
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
413
1205
|
for (const r of rules ?? []) {
|
|
414
1206
|
if (typeof r === "string") {
|
|
415
1207
|
set({ key: r, strategy: "full" });
|
|
@@ -427,7 +1219,7 @@ function compileRules(rules) {
|
|
|
427
1219
|
var Redactor = class {
|
|
428
1220
|
#rules;
|
|
429
1221
|
constructor(options) {
|
|
430
|
-
this.#rules = compileRules(options?.rules);
|
|
1222
|
+
this.#rules = compileRules(options?.rules, options?.extraKeys);
|
|
431
1223
|
}
|
|
432
1224
|
redactValue(key, value) {
|
|
433
1225
|
const k = toKey(key);
|
|
@@ -459,7 +1251,7 @@ var Redactor = class {
|
|
|
459
1251
|
if (Array.isArray(value)) {
|
|
460
1252
|
return value.map((v) => this.#redactNested(v));
|
|
461
1253
|
}
|
|
462
|
-
if (
|
|
1254
|
+
if (isRecord6(value)) {
|
|
463
1255
|
const out = {};
|
|
464
1256
|
for (const [k, v] of Object.entries(value)) {
|
|
465
1257
|
out[k] = this.redactValue(k, v);
|
|
@@ -469,6 +1261,36 @@ var Redactor = class {
|
|
|
469
1261
|
return value;
|
|
470
1262
|
}
|
|
471
1263
|
};
|
|
1264
|
+
|
|
1265
|
+
// node_modules/.pnpm/nanoid@5.1.11/node_modules/nanoid/url-alphabet/index.js
|
|
1266
|
+
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1267
|
+
|
|
1268
|
+
// node_modules/.pnpm/nanoid@5.1.11/node_modules/nanoid/index.js
|
|
1269
|
+
var POOL_SIZE_MULTIPLIER = 128;
|
|
1270
|
+
var pool;
|
|
1271
|
+
var poolOffset;
|
|
1272
|
+
function fillPool(bytes) {
|
|
1273
|
+
if (bytes < 0 || bytes > 1024) throw new RangeError("Wrong ID size");
|
|
1274
|
+
if (!pool || pool.length < bytes) {
|
|
1275
|
+
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
|
|
1276
|
+
crypto.webcrypto.getRandomValues(pool);
|
|
1277
|
+
poolOffset = 0;
|
|
1278
|
+
} else if (poolOffset + bytes > pool.length) {
|
|
1279
|
+
crypto.webcrypto.getRandomValues(pool);
|
|
1280
|
+
poolOffset = 0;
|
|
1281
|
+
}
|
|
1282
|
+
poolOffset += bytes;
|
|
1283
|
+
}
|
|
1284
|
+
function nanoid(size = 21) {
|
|
1285
|
+
fillPool(size |= 0);
|
|
1286
|
+
let id = "";
|
|
1287
|
+
for (let i = poolOffset - size; i < poolOffset; i++) {
|
|
1288
|
+
id += urlAlphabet[pool[i] & 63];
|
|
1289
|
+
}
|
|
1290
|
+
return id;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
// packages/core/src/logs/normalizer.ts
|
|
472
1294
|
function isFiniteNumber(v) {
|
|
473
1295
|
return typeof v === "number" && Number.isFinite(v);
|
|
474
1296
|
}
|
|
@@ -603,7 +1425,7 @@ var EventNormalizer = class {
|
|
|
603
1425
|
attributes[k] = v;
|
|
604
1426
|
}
|
|
605
1427
|
const event = {
|
|
606
|
-
eventId: nanoid
|
|
1428
|
+
eventId: nanoid(10),
|
|
607
1429
|
runId,
|
|
608
1430
|
...parentId ? { parentId } : {},
|
|
609
1431
|
name,
|
|
@@ -649,86 +1471,6 @@ var EventNormalizer = class {
|
|
|
649
1471
|
}
|
|
650
1472
|
};
|
|
651
1473
|
|
|
652
|
-
// packages/core/src/logs/tree-builder.ts
|
|
653
|
-
function inc(map, key) {
|
|
654
|
-
map[key] = (map[key] ?? 0) + 1;
|
|
655
|
-
}
|
|
656
|
-
function computeRunStatus(events) {
|
|
657
|
-
let hasRunning = false;
|
|
658
|
-
for (const e of events) {
|
|
659
|
-
if (e.status === "error") return "error";
|
|
660
|
-
if (e.status === "running") hasRunning = true;
|
|
661
|
-
}
|
|
662
|
-
if (hasRunning) return "running";
|
|
663
|
-
return "ok";
|
|
664
|
-
}
|
|
665
|
-
var TreeBuilder = class {
|
|
666
|
-
constructor(options) {
|
|
667
|
-
void options?.config;
|
|
668
|
-
}
|
|
669
|
-
build(events) {
|
|
670
|
-
const byRun = /* @__PURE__ */ new Map();
|
|
671
|
-
for (const e of events) {
|
|
672
|
-
if (!byRun.has(e.runId)) byRun.set(e.runId, []);
|
|
673
|
-
byRun.get(e.runId).push(e);
|
|
674
|
-
}
|
|
675
|
-
const out = [];
|
|
676
|
-
for (const [runId, runEvents] of byRun.entries()) {
|
|
677
|
-
const sorted = [...runEvents].sort((a, b) => a.timestamp - b.timestamp);
|
|
678
|
-
const nodes = /* @__PURE__ */ new Map();
|
|
679
|
-
for (const e of sorted) {
|
|
680
|
-
nodes.set(e.eventId, { event: e, children: [], depth: 0 });
|
|
681
|
-
}
|
|
682
|
-
const roots = [];
|
|
683
|
-
for (const node of nodes.values()) {
|
|
684
|
-
const parentId = node.event.parentId;
|
|
685
|
-
if (parentId && nodes.has(parentId)) {
|
|
686
|
-
nodes.get(parentId).children.push(node);
|
|
687
|
-
} else {
|
|
688
|
-
roots.push(node);
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
const assignDepth = (n, depth) => {
|
|
692
|
-
n.depth = depth;
|
|
693
|
-
for (const c of n.children) assignDepth(c, depth + 1);
|
|
694
|
-
};
|
|
695
|
-
for (const r of roots) assignDepth(r, 0);
|
|
696
|
-
const confidenceBreakdown = {
|
|
697
|
-
explicit: 0,
|
|
698
|
-
correlated: 0,
|
|
699
|
-
heuristic: 0,
|
|
700
|
-
unknown: 0
|
|
701
|
-
};
|
|
702
|
-
const kinds = {};
|
|
703
|
-
for (const e of sorted) {
|
|
704
|
-
inc(confidenceBreakdown, e.confidence);
|
|
705
|
-
kinds[e.kind] = (kinds[e.kind] ?? 0) + 1;
|
|
706
|
-
}
|
|
707
|
-
const startedAt = sorted.length > 0 ? sorted[0].timestamp : void 0;
|
|
708
|
-
const endedAt = sorted.length > 0 ? sorted[sorted.length - 1].timestamp : void 0;
|
|
709
|
-
const status = computeRunStatus(sorted);
|
|
710
|
-
const durationMs = startedAt !== void 0 && endedAt !== void 0 && Number.isFinite(startedAt) && Number.isFinite(endedAt) && endedAt >= startedAt && status !== "running" ? endedAt - startedAt : void 0;
|
|
711
|
-
const name = sorted.find((e) => e.kind === "RUN")?.name;
|
|
712
|
-
out.push({
|
|
713
|
-
runId,
|
|
714
|
-
name,
|
|
715
|
-
status,
|
|
716
|
-
startedAt,
|
|
717
|
-
endedAt: status === "running" ? void 0 : endedAt,
|
|
718
|
-
durationMs,
|
|
719
|
-
children: roots,
|
|
720
|
-
metadata: {
|
|
721
|
-
totalEvents: sorted.length,
|
|
722
|
-
confidenceBreakdown,
|
|
723
|
-
kinds
|
|
724
|
-
}
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
out.sort((a, b) => (b.startedAt ?? 0) - (a.startedAt ?? 0));
|
|
728
|
-
return out;
|
|
729
|
-
}
|
|
730
|
-
};
|
|
731
|
-
|
|
732
1474
|
// packages/core/src/logs/tree-renderer.ts
|
|
733
1475
|
function truncate(v, max) {
|
|
734
1476
|
if (v.length <= max) return v;
|
|
@@ -1068,10 +1810,10 @@ var FALLBACK_TRACE_DIR = path__default.default.join(
|
|
|
1068
1810
|
);
|
|
1069
1811
|
var MAX_NAME_LENGTH = 100;
|
|
1070
1812
|
function createRunId() {
|
|
1071
|
-
return `run_${nanoid
|
|
1813
|
+
return `run_${nanoid(10)}`;
|
|
1072
1814
|
}
|
|
1073
1815
|
function createStepId() {
|
|
1074
|
-
return `step_${nanoid
|
|
1816
|
+
return `step_${nanoid(10)}`;
|
|
1075
1817
|
}
|
|
1076
1818
|
function formatDuration2(ms) {
|
|
1077
1819
|
return formatDuration(ms);
|
|
@@ -1182,7 +1924,92 @@ function warn(message, error) {
|
|
|
1182
1924
|
}
|
|
1183
1925
|
console.warn(`${base}: ${formatError(error).message}`);
|
|
1184
1926
|
}
|
|
1185
|
-
|
|
1927
|
+
|
|
1928
|
+
// packages/core/src/redaction-profiles.ts
|
|
1929
|
+
var SHARE_PROFILE_EXTRA_KEYS = [
|
|
1930
|
+
"userEmail",
|
|
1931
|
+
"customerEmail",
|
|
1932
|
+
"phone",
|
|
1933
|
+
"phoneNumber",
|
|
1934
|
+
"address",
|
|
1935
|
+
"ip",
|
|
1936
|
+
"ipAddress",
|
|
1937
|
+
"sessionId",
|
|
1938
|
+
"requestId",
|
|
1939
|
+
"correlationId",
|
|
1940
|
+
"decisionId",
|
|
1941
|
+
"groupId",
|
|
1942
|
+
"customerId",
|
|
1943
|
+
"userId",
|
|
1944
|
+
"accountId",
|
|
1945
|
+
"tenantId",
|
|
1946
|
+
"orgId",
|
|
1947
|
+
"organizationId",
|
|
1948
|
+
"traceId",
|
|
1949
|
+
"spanId",
|
|
1950
|
+
"parentSpanId"
|
|
1951
|
+
];
|
|
1952
|
+
var STRICT_PROFILE_EXTRA_KEYS = [
|
|
1953
|
+
"prompt",
|
|
1954
|
+
"completion",
|
|
1955
|
+
"input",
|
|
1956
|
+
"output",
|
|
1957
|
+
"inputPreview",
|
|
1958
|
+
"outputPreview",
|
|
1959
|
+
"message",
|
|
1960
|
+
"messages",
|
|
1961
|
+
"transcript",
|
|
1962
|
+
"context",
|
|
1963
|
+
"document",
|
|
1964
|
+
"documents",
|
|
1965
|
+
"chunk",
|
|
1966
|
+
"chunks",
|
|
1967
|
+
"retrieval",
|
|
1968
|
+
"query"
|
|
1969
|
+
];
|
|
1970
|
+
function resolveRedactionProfile(profile = "local") {
|
|
1971
|
+
switch (profile) {
|
|
1972
|
+
case "local":
|
|
1973
|
+
return { profile: "local", extraKeys: [] };
|
|
1974
|
+
case "share":
|
|
1975
|
+
return {
|
|
1976
|
+
profile: "share",
|
|
1977
|
+
extraKeys: SHARE_PROFILE_EXTRA_KEYS,
|
|
1978
|
+
maxMetadataValueLengthCap: 500,
|
|
1979
|
+
maxPreviewLengthCap: 200
|
|
1980
|
+
};
|
|
1981
|
+
case "strict":
|
|
1982
|
+
return {
|
|
1983
|
+
profile: "strict",
|
|
1984
|
+
extraKeys: [...SHARE_PROFILE_EXTRA_KEYS, ...STRICT_PROFILE_EXTRA_KEYS],
|
|
1985
|
+
maxMetadataValueLengthCap: 200,
|
|
1986
|
+
maxPreviewLengthCap: 80
|
|
1987
|
+
};
|
|
1988
|
+
default:
|
|
1989
|
+
return { profile: "local", extraKeys: [] };
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
function isPreviewKey(key) {
|
|
1993
|
+
return key.toLowerCase().includes("preview");
|
|
1994
|
+
}
|
|
1995
|
+
function applyProfileMetadataCaps(maxMetadataValueLength, maxPreviewLength, resolved) {
|
|
1996
|
+
let meta = maxMetadataValueLength;
|
|
1997
|
+
let preview = maxPreviewLength;
|
|
1998
|
+
if (resolved.maxMetadataValueLengthCap !== void 0) {
|
|
1999
|
+
meta = Math.min(meta, resolved.maxMetadataValueLengthCap);
|
|
2000
|
+
}
|
|
2001
|
+
if (resolved.maxPreviewLengthCap !== void 0) {
|
|
2002
|
+
preview = Math.min(preview, resolved.maxPreviewLengthCap);
|
|
2003
|
+
}
|
|
2004
|
+
return { maxMetadataValueLength: meta, maxPreviewLength: preview };
|
|
2005
|
+
}
|
|
2006
|
+
function truncateStringForProfile(value, key, maxMetadataValueLength, maxPreviewLength) {
|
|
2007
|
+
const max = isPreviewKey(key) ? maxPreviewLength : maxMetadataValueLength;
|
|
2008
|
+
if (max <= 0) return "\u2026";
|
|
2009
|
+
if (value.length <= max) return value;
|
|
2010
|
+
return `${value.slice(0, max)}\u2026`;
|
|
2011
|
+
}
|
|
2012
|
+
function isRecord7(value) {
|
|
1186
2013
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1187
2014
|
}
|
|
1188
2015
|
function nonEmptyString(value) {
|
|
@@ -1193,7 +2020,7 @@ function finiteNumber(value) {
|
|
|
1193
2020
|
}
|
|
1194
2021
|
function optionalErrorInfo(value) {
|
|
1195
2022
|
if (value === void 0) return true;
|
|
1196
|
-
if (!
|
|
2023
|
+
if (!isRecord7(value)) return false;
|
|
1197
2024
|
if (typeof value.message !== "string") return false;
|
|
1198
2025
|
if ("stack" in value && value.stack !== void 0) {
|
|
1199
2026
|
if (typeof value.stack !== "string") return false;
|
|
@@ -1201,7 +2028,7 @@ function optionalErrorInfo(value) {
|
|
|
1201
2028
|
return true;
|
|
1202
2029
|
}
|
|
1203
2030
|
function validateEvent(event) {
|
|
1204
|
-
if (!
|
|
2031
|
+
if (!isRecord7(event)) return false;
|
|
1205
2032
|
if (event.schemaVersion !== "0.1") return false;
|
|
1206
2033
|
if (!finiteNumber(event.timestamp)) return false;
|
|
1207
2034
|
if (typeof event.event !== "string") return false;
|
|
@@ -1210,7 +2037,7 @@ function validateEvent(event) {
|
|
|
1210
2037
|
if (!nonEmptyString(event.runId) || !nonEmptyString(event.name) || !finiteNumber(event.startTime)) {
|
|
1211
2038
|
return false;
|
|
1212
2039
|
}
|
|
1213
|
-
if (event.metadata !== void 0 && !
|
|
2040
|
+
if (event.metadata !== void 0 && !isRecord7(event.metadata)) {
|
|
1214
2041
|
return false;
|
|
1215
2042
|
}
|
|
1216
2043
|
return true;
|
|
@@ -1225,7 +2052,7 @@ function validateEvent(event) {
|
|
|
1225
2052
|
if (event.parentId !== void 0 && typeof event.parentId !== "string") {
|
|
1226
2053
|
return false;
|
|
1227
2054
|
}
|
|
1228
|
-
if (event.metadata !== void 0 && !
|
|
2055
|
+
if (event.metadata !== void 0 && !isRecord7(event.metadata)) {
|
|
1229
2056
|
return false;
|
|
1230
2057
|
}
|
|
1231
2058
|
return true;
|
|
@@ -1382,10 +2209,10 @@ function getRunIdFromTraceFileName(fileName) {
|
|
|
1382
2209
|
var DEFAULT_MAX_METADATA_VALUE_LENGTH = 2e3;
|
|
1383
2210
|
var DEFAULT_MAX_PREVIEW_LENGTH = 500;
|
|
1384
2211
|
var DEFAULT_MAX_EVENT_BYTES = 65536;
|
|
1385
|
-
function
|
|
2212
|
+
function isRecord8(value) {
|
|
1386
2213
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1387
2214
|
}
|
|
1388
|
-
function
|
|
2215
|
+
function isPreviewKey2(key) {
|
|
1389
2216
|
return key.toLowerCase().includes("preview");
|
|
1390
2217
|
}
|
|
1391
2218
|
function truncateString(value, maxLen) {
|
|
@@ -1404,15 +2231,32 @@ function resolveTraceSafetyOptions(options) {
|
|
|
1404
2231
|
redactEnabled = false;
|
|
1405
2232
|
} else if (redact === true || redact === void 0) {
|
|
1406
2233
|
redactEnabled = true;
|
|
1407
|
-
} else if (
|
|
2234
|
+
} else if (isRecord8(redact)) {
|
|
1408
2235
|
redactEnabled = true;
|
|
1409
2236
|
redactionRules = redact.rules;
|
|
1410
2237
|
}
|
|
2238
|
+
const profile = options?.redactionProfile ?? "local";
|
|
2239
|
+
const resolvedProfile = resolveRedactionProfile(profile);
|
|
2240
|
+
const userMaxMetadata = typeof options?.maxMetadataValueLength === "number" && Number.isFinite(options.maxMetadataValueLength) && options.maxMetadataValueLength >= 0 ? Math.floor(options.maxMetadataValueLength) : void 0;
|
|
2241
|
+
const userMaxPreview = typeof options?.maxPreviewLength === "number" && Number.isFinite(options.maxPreviewLength) && options.maxPreviewLength >= 0 ? Math.floor(options.maxPreviewLength) : void 0;
|
|
2242
|
+
let maxMetadataValueLength = userMaxMetadata ?? DEFAULT_MAX_METADATA_VALUE_LENGTH;
|
|
2243
|
+
let maxPreviewLength = userMaxPreview ?? DEFAULT_MAX_PREVIEW_LENGTH;
|
|
2244
|
+
if (redactEnabled && profile !== "local") {
|
|
2245
|
+
const capped = applyProfileMetadataCaps(
|
|
2246
|
+
maxMetadataValueLength,
|
|
2247
|
+
maxPreviewLength,
|
|
2248
|
+
resolvedProfile
|
|
2249
|
+
);
|
|
2250
|
+
maxMetadataValueLength = capped.maxMetadataValueLength;
|
|
2251
|
+
maxPreviewLength = capped.maxPreviewLength;
|
|
2252
|
+
}
|
|
1411
2253
|
return {
|
|
1412
2254
|
redactEnabled,
|
|
1413
2255
|
redactionRules,
|
|
1414
|
-
|
|
1415
|
-
|
|
2256
|
+
redactionProfile: profile,
|
|
2257
|
+
profileExtraKeys: redactEnabled ? resolvedProfile.extraKeys : [],
|
|
2258
|
+
maxMetadataValueLength,
|
|
2259
|
+
maxPreviewLength,
|
|
1416
2260
|
maxEventBytes: typeof options?.maxEventBytes === "number" && Number.isFinite(options.maxEventBytes) && options.maxEventBytes > 0 ? Math.floor(options.maxEventBytes) : DEFAULT_MAX_EVENT_BYTES
|
|
1417
2261
|
};
|
|
1418
2262
|
}
|
|
@@ -1420,7 +2264,7 @@ function boundMetadataValue(key, value, opts, seen, depth) {
|
|
|
1420
2264
|
if (depth > 32) return "[MaxDepth]";
|
|
1421
2265
|
if (value === null || typeof value !== "object") {
|
|
1422
2266
|
if (typeof value === "string") {
|
|
1423
|
-
const max =
|
|
2267
|
+
const max = isPreviewKey2(key) ? opts.maxPreviewLength : opts.maxMetadataValueLength;
|
|
1424
2268
|
return truncateString(value, max);
|
|
1425
2269
|
}
|
|
1426
2270
|
return value;
|
|
@@ -1446,7 +2290,10 @@ function boundMetadataValue(key, value, opts, seen, depth) {
|
|
|
1446
2290
|
}
|
|
1447
2291
|
function redactMetadata(metadata, opts) {
|
|
1448
2292
|
if (!opts.redactEnabled) return { ...metadata };
|
|
1449
|
-
const redactor = new Redactor({
|
|
2293
|
+
const redactor = new Redactor({
|
|
2294
|
+
rules: opts.redactionRules,
|
|
2295
|
+
extraKeys: opts.profileExtraKeys
|
|
2296
|
+
});
|
|
1450
2297
|
return redactor.redactRecord(metadata);
|
|
1451
2298
|
}
|
|
1452
2299
|
function prepareMetadataForDisk(metadata, opts) {
|
|
@@ -1460,7 +2307,7 @@ function prepareMetadataForDisk(metadata, opts) {
|
|
|
1460
2307
|
seen,
|
|
1461
2308
|
0
|
|
1462
2309
|
);
|
|
1463
|
-
return
|
|
2310
|
+
return isRecord8(bounded) ? bounded : {};
|
|
1464
2311
|
} catch {
|
|
1465
2312
|
return { truncated: true, reason: "metadataPreparationFailed" };
|
|
1466
2313
|
}
|
|
@@ -1618,6 +2465,13 @@ function getCurrentRunId() {
|
|
|
1618
2465
|
return void 0;
|
|
1619
2466
|
}
|
|
1620
2467
|
}
|
|
2468
|
+
function getCurrentCorrelationMetadata() {
|
|
2469
|
+
try {
|
|
2470
|
+
return extractCorrelationMetadata(storage.getStore()?.metadata);
|
|
2471
|
+
} catch {
|
|
2472
|
+
return void 0;
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
1621
2475
|
function getCurrentRunName() {
|
|
1622
2476
|
try {
|
|
1623
2477
|
return storage.getStore()?.runName;
|
|
@@ -1986,7 +2840,7 @@ var KNOWN_EVENTS = /* @__PURE__ */ new Set([
|
|
|
1986
2840
|
"step_started",
|
|
1987
2841
|
"step_completed"
|
|
1988
2842
|
]);
|
|
1989
|
-
function
|
|
2843
|
+
function isRecord9(value) {
|
|
1990
2844
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1991
2845
|
}
|
|
1992
2846
|
function safeParse(line) {
|
|
@@ -2008,7 +2862,7 @@ async function isAgentInspectTrace(filePath) {
|
|
|
2008
2862
|
if (trimmed === "") continue;
|
|
2009
2863
|
const parsed = safeParse(trimmed);
|
|
2010
2864
|
if (!parsed) continue;
|
|
2011
|
-
if (!
|
|
2865
|
+
if (!isRecord9(parsed)) continue;
|
|
2012
2866
|
checked += 1;
|
|
2013
2867
|
if (isTraceEvent(parsed)) return true;
|
|
2014
2868
|
const ev = parsed.event;
|
|
@@ -2171,7 +3025,7 @@ function stableJson(value, pretty) {
|
|
|
2171
3025
|
const sorted = sortKeysDeep(value);
|
|
2172
3026
|
return pretty === true ? JSON.stringify(sorted, null, 2) : JSON.stringify(sorted);
|
|
2173
3027
|
}
|
|
2174
|
-
function
|
|
3028
|
+
function compactAttributes4(attrs, options) {
|
|
2175
3029
|
if (attrs === void 0) return {};
|
|
2176
3030
|
const maxLen = options?.maxLength ?? 500;
|
|
2177
3031
|
const redacted = options?.redacted ?? true;
|
|
@@ -2526,6 +3380,498 @@ function diffRuns(left, right, options) {
|
|
|
2526
3380
|
};
|
|
2527
3381
|
return { summary, differences };
|
|
2528
3382
|
}
|
|
3383
|
+
|
|
3384
|
+
// node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
3385
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
3386
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
3387
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
3388
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
3389
|
+
var styles = {
|
|
3390
|
+
modifier: {
|
|
3391
|
+
reset: [0, 0],
|
|
3392
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
3393
|
+
bold: [1, 22],
|
|
3394
|
+
dim: [2, 22],
|
|
3395
|
+
italic: [3, 23],
|
|
3396
|
+
underline: [4, 24],
|
|
3397
|
+
overline: [53, 55],
|
|
3398
|
+
inverse: [7, 27],
|
|
3399
|
+
hidden: [8, 28],
|
|
3400
|
+
strikethrough: [9, 29]
|
|
3401
|
+
},
|
|
3402
|
+
color: {
|
|
3403
|
+
black: [30, 39],
|
|
3404
|
+
red: [31, 39],
|
|
3405
|
+
green: [32, 39],
|
|
3406
|
+
yellow: [33, 39],
|
|
3407
|
+
blue: [34, 39],
|
|
3408
|
+
magenta: [35, 39],
|
|
3409
|
+
cyan: [36, 39],
|
|
3410
|
+
white: [37, 39],
|
|
3411
|
+
// Bright color
|
|
3412
|
+
blackBright: [90, 39],
|
|
3413
|
+
gray: [90, 39],
|
|
3414
|
+
// Alias of `blackBright`
|
|
3415
|
+
grey: [90, 39],
|
|
3416
|
+
// Alias of `blackBright`
|
|
3417
|
+
redBright: [91, 39],
|
|
3418
|
+
greenBright: [92, 39],
|
|
3419
|
+
yellowBright: [93, 39],
|
|
3420
|
+
blueBright: [94, 39],
|
|
3421
|
+
magentaBright: [95, 39],
|
|
3422
|
+
cyanBright: [96, 39],
|
|
3423
|
+
whiteBright: [97, 39]
|
|
3424
|
+
},
|
|
3425
|
+
bgColor: {
|
|
3426
|
+
bgBlack: [40, 49],
|
|
3427
|
+
bgRed: [41, 49],
|
|
3428
|
+
bgGreen: [42, 49],
|
|
3429
|
+
bgYellow: [43, 49],
|
|
3430
|
+
bgBlue: [44, 49],
|
|
3431
|
+
bgMagenta: [45, 49],
|
|
3432
|
+
bgCyan: [46, 49],
|
|
3433
|
+
bgWhite: [47, 49],
|
|
3434
|
+
// Bright color
|
|
3435
|
+
bgBlackBright: [100, 49],
|
|
3436
|
+
bgGray: [100, 49],
|
|
3437
|
+
// Alias of `bgBlackBright`
|
|
3438
|
+
bgGrey: [100, 49],
|
|
3439
|
+
// Alias of `bgBlackBright`
|
|
3440
|
+
bgRedBright: [101, 49],
|
|
3441
|
+
bgGreenBright: [102, 49],
|
|
3442
|
+
bgYellowBright: [103, 49],
|
|
3443
|
+
bgBlueBright: [104, 49],
|
|
3444
|
+
bgMagentaBright: [105, 49],
|
|
3445
|
+
bgCyanBright: [106, 49],
|
|
3446
|
+
bgWhiteBright: [107, 49]
|
|
3447
|
+
}
|
|
3448
|
+
};
|
|
3449
|
+
Object.keys(styles.modifier);
|
|
3450
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
3451
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
3452
|
+
[...foregroundColorNames, ...backgroundColorNames];
|
|
3453
|
+
function assembleStyles() {
|
|
3454
|
+
const codes = /* @__PURE__ */ new Map();
|
|
3455
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
3456
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
3457
|
+
styles[styleName] = {
|
|
3458
|
+
open: `\x1B[${style[0]}m`,
|
|
3459
|
+
close: `\x1B[${style[1]}m`
|
|
3460
|
+
};
|
|
3461
|
+
group[styleName] = styles[styleName];
|
|
3462
|
+
codes.set(style[0], style[1]);
|
|
3463
|
+
}
|
|
3464
|
+
Object.defineProperty(styles, groupName, {
|
|
3465
|
+
value: group,
|
|
3466
|
+
enumerable: false
|
|
3467
|
+
});
|
|
3468
|
+
}
|
|
3469
|
+
Object.defineProperty(styles, "codes", {
|
|
3470
|
+
value: codes,
|
|
3471
|
+
enumerable: false
|
|
3472
|
+
});
|
|
3473
|
+
styles.color.close = "\x1B[39m";
|
|
3474
|
+
styles.bgColor.close = "\x1B[49m";
|
|
3475
|
+
styles.color.ansi = wrapAnsi16();
|
|
3476
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
3477
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
3478
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
3479
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
3480
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
3481
|
+
Object.defineProperties(styles, {
|
|
3482
|
+
rgbToAnsi256: {
|
|
3483
|
+
value(red, green, blue) {
|
|
3484
|
+
if (red === green && green === blue) {
|
|
3485
|
+
if (red < 8) {
|
|
3486
|
+
return 16;
|
|
3487
|
+
}
|
|
3488
|
+
if (red > 248) {
|
|
3489
|
+
return 231;
|
|
3490
|
+
}
|
|
3491
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
3492
|
+
}
|
|
3493
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
3494
|
+
},
|
|
3495
|
+
enumerable: false
|
|
3496
|
+
},
|
|
3497
|
+
hexToRgb: {
|
|
3498
|
+
value(hex) {
|
|
3499
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
3500
|
+
if (!matches) {
|
|
3501
|
+
return [0, 0, 0];
|
|
3502
|
+
}
|
|
3503
|
+
let [colorString] = matches;
|
|
3504
|
+
if (colorString.length === 3) {
|
|
3505
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
3506
|
+
}
|
|
3507
|
+
const integer = Number.parseInt(colorString, 16);
|
|
3508
|
+
return [
|
|
3509
|
+
/* eslint-disable no-bitwise */
|
|
3510
|
+
integer >> 16 & 255,
|
|
3511
|
+
integer >> 8 & 255,
|
|
3512
|
+
integer & 255
|
|
3513
|
+
/* eslint-enable no-bitwise */
|
|
3514
|
+
];
|
|
3515
|
+
},
|
|
3516
|
+
enumerable: false
|
|
3517
|
+
},
|
|
3518
|
+
hexToAnsi256: {
|
|
3519
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
3520
|
+
enumerable: false
|
|
3521
|
+
},
|
|
3522
|
+
ansi256ToAnsi: {
|
|
3523
|
+
value(code) {
|
|
3524
|
+
if (code < 8) {
|
|
3525
|
+
return 30 + code;
|
|
3526
|
+
}
|
|
3527
|
+
if (code < 16) {
|
|
3528
|
+
return 90 + (code - 8);
|
|
3529
|
+
}
|
|
3530
|
+
let red;
|
|
3531
|
+
let green;
|
|
3532
|
+
let blue;
|
|
3533
|
+
if (code >= 232) {
|
|
3534
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
3535
|
+
green = red;
|
|
3536
|
+
blue = red;
|
|
3537
|
+
} else {
|
|
3538
|
+
code -= 16;
|
|
3539
|
+
const remainder = code % 36;
|
|
3540
|
+
red = Math.floor(code / 36) / 5;
|
|
3541
|
+
green = Math.floor(remainder / 6) / 5;
|
|
3542
|
+
blue = remainder % 6 / 5;
|
|
3543
|
+
}
|
|
3544
|
+
const value = Math.max(red, green, blue) * 2;
|
|
3545
|
+
if (value === 0) {
|
|
3546
|
+
return 30;
|
|
3547
|
+
}
|
|
3548
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
3549
|
+
if (value === 2) {
|
|
3550
|
+
result += 60;
|
|
3551
|
+
}
|
|
3552
|
+
return result;
|
|
3553
|
+
},
|
|
3554
|
+
enumerable: false
|
|
3555
|
+
},
|
|
3556
|
+
rgbToAnsi: {
|
|
3557
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
3558
|
+
enumerable: false
|
|
3559
|
+
},
|
|
3560
|
+
hexToAnsi: {
|
|
3561
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
3562
|
+
enumerable: false
|
|
3563
|
+
}
|
|
3564
|
+
});
|
|
3565
|
+
return styles;
|
|
3566
|
+
}
|
|
3567
|
+
var ansiStyles = assembleStyles();
|
|
3568
|
+
var ansi_styles_default = ansiStyles;
|
|
3569
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2__default.default.argv) {
|
|
3570
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
3571
|
+
const position = argv.indexOf(prefix + flag);
|
|
3572
|
+
const terminatorPosition = argv.indexOf("--");
|
|
3573
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
3574
|
+
}
|
|
3575
|
+
var { env } = process2__default.default;
|
|
3576
|
+
var flagForceColor;
|
|
3577
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
3578
|
+
flagForceColor = 0;
|
|
3579
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
3580
|
+
flagForceColor = 1;
|
|
3581
|
+
}
|
|
3582
|
+
function envForceColor() {
|
|
3583
|
+
if ("FORCE_COLOR" in env) {
|
|
3584
|
+
if (env.FORCE_COLOR === "true") {
|
|
3585
|
+
return 1;
|
|
3586
|
+
}
|
|
3587
|
+
if (env.FORCE_COLOR === "false") {
|
|
3588
|
+
return 0;
|
|
3589
|
+
}
|
|
3590
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
function translateLevel(level) {
|
|
3594
|
+
if (level === 0) {
|
|
3595
|
+
return false;
|
|
3596
|
+
}
|
|
3597
|
+
return {
|
|
3598
|
+
level,
|
|
3599
|
+
hasBasic: true,
|
|
3600
|
+
has256: level >= 2,
|
|
3601
|
+
has16m: level >= 3
|
|
3602
|
+
};
|
|
3603
|
+
}
|
|
3604
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
3605
|
+
const noFlagForceColor = envForceColor();
|
|
3606
|
+
if (noFlagForceColor !== void 0) {
|
|
3607
|
+
flagForceColor = noFlagForceColor;
|
|
3608
|
+
}
|
|
3609
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
3610
|
+
if (forceColor === 0) {
|
|
3611
|
+
return 0;
|
|
3612
|
+
}
|
|
3613
|
+
if (sniffFlags) {
|
|
3614
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
3615
|
+
return 3;
|
|
3616
|
+
}
|
|
3617
|
+
if (hasFlag("color=256")) {
|
|
3618
|
+
return 2;
|
|
3619
|
+
}
|
|
3620
|
+
}
|
|
3621
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
3622
|
+
return 1;
|
|
3623
|
+
}
|
|
3624
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
3625
|
+
return 0;
|
|
3626
|
+
}
|
|
3627
|
+
const min = forceColor || 0;
|
|
3628
|
+
if (env.TERM === "dumb") {
|
|
3629
|
+
return min;
|
|
3630
|
+
}
|
|
3631
|
+
if (process2__default.default.platform === "win32") {
|
|
3632
|
+
const osRelease = os__default.default.release().split(".");
|
|
3633
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
3634
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
3635
|
+
}
|
|
3636
|
+
return 1;
|
|
3637
|
+
}
|
|
3638
|
+
if ("CI" in env) {
|
|
3639
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
|
|
3640
|
+
return 3;
|
|
3641
|
+
}
|
|
3642
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
3643
|
+
return 1;
|
|
3644
|
+
}
|
|
3645
|
+
return min;
|
|
3646
|
+
}
|
|
3647
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
3648
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
3649
|
+
}
|
|
3650
|
+
if (env.COLORTERM === "truecolor") {
|
|
3651
|
+
return 3;
|
|
3652
|
+
}
|
|
3653
|
+
if (env.TERM === "xterm-kitty") {
|
|
3654
|
+
return 3;
|
|
3655
|
+
}
|
|
3656
|
+
if (env.TERM === "xterm-ghostty") {
|
|
3657
|
+
return 3;
|
|
3658
|
+
}
|
|
3659
|
+
if (env.TERM === "wezterm") {
|
|
3660
|
+
return 3;
|
|
3661
|
+
}
|
|
3662
|
+
if ("TERM_PROGRAM" in env) {
|
|
3663
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
3664
|
+
switch (env.TERM_PROGRAM) {
|
|
3665
|
+
case "iTerm.app": {
|
|
3666
|
+
return version >= 3 ? 3 : 2;
|
|
3667
|
+
}
|
|
3668
|
+
case "Apple_Terminal": {
|
|
3669
|
+
return 2;
|
|
3670
|
+
}
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
3674
|
+
return 2;
|
|
3675
|
+
}
|
|
3676
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
3677
|
+
return 1;
|
|
3678
|
+
}
|
|
3679
|
+
if ("COLORTERM" in env) {
|
|
3680
|
+
return 1;
|
|
3681
|
+
}
|
|
3682
|
+
return min;
|
|
3683
|
+
}
|
|
3684
|
+
function createSupportsColor(stream, options = {}) {
|
|
3685
|
+
const level = _supportsColor(stream, {
|
|
3686
|
+
streamIsTTY: stream && stream.isTTY,
|
|
3687
|
+
...options
|
|
3688
|
+
});
|
|
3689
|
+
return translateLevel(level);
|
|
3690
|
+
}
|
|
3691
|
+
var supportsColor = {
|
|
3692
|
+
stdout: createSupportsColor({ isTTY: tty__default.default.isatty(1) }),
|
|
3693
|
+
stderr: createSupportsColor({ isTTY: tty__default.default.isatty(2) })
|
|
3694
|
+
};
|
|
3695
|
+
var supports_color_default = supportsColor;
|
|
3696
|
+
|
|
3697
|
+
// node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
|
|
3698
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
3699
|
+
let index = string.indexOf(substring);
|
|
3700
|
+
if (index === -1) {
|
|
3701
|
+
return string;
|
|
3702
|
+
}
|
|
3703
|
+
const substringLength = substring.length;
|
|
3704
|
+
let endIndex = 0;
|
|
3705
|
+
let returnValue = "";
|
|
3706
|
+
do {
|
|
3707
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
3708
|
+
endIndex = index + substringLength;
|
|
3709
|
+
index = string.indexOf(substring, endIndex);
|
|
3710
|
+
} while (index !== -1);
|
|
3711
|
+
returnValue += string.slice(endIndex);
|
|
3712
|
+
return returnValue;
|
|
3713
|
+
}
|
|
3714
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
3715
|
+
let endIndex = 0;
|
|
3716
|
+
let returnValue = "";
|
|
3717
|
+
do {
|
|
3718
|
+
const gotCR = string[index - 1] === "\r";
|
|
3719
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
3720
|
+
endIndex = index + 1;
|
|
3721
|
+
index = string.indexOf("\n", endIndex);
|
|
3722
|
+
} while (index !== -1);
|
|
3723
|
+
returnValue += string.slice(endIndex);
|
|
3724
|
+
return returnValue;
|
|
3725
|
+
}
|
|
3726
|
+
|
|
3727
|
+
// node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
|
|
3728
|
+
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
3729
|
+
var GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
|
|
3730
|
+
var STYLER = /* @__PURE__ */ Symbol("STYLER");
|
|
3731
|
+
var IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
|
|
3732
|
+
var levelMapping = [
|
|
3733
|
+
"ansi",
|
|
3734
|
+
"ansi",
|
|
3735
|
+
"ansi256",
|
|
3736
|
+
"ansi16m"
|
|
3737
|
+
];
|
|
3738
|
+
var styles2 = /* @__PURE__ */ Object.create(null);
|
|
3739
|
+
var applyOptions = (object, options = {}) => {
|
|
3740
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
3741
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
3742
|
+
}
|
|
3743
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
3744
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
3745
|
+
};
|
|
3746
|
+
var chalkFactory = (options) => {
|
|
3747
|
+
const chalk2 = (...strings) => strings.join(" ");
|
|
3748
|
+
applyOptions(chalk2, options);
|
|
3749
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
3750
|
+
return chalk2;
|
|
3751
|
+
};
|
|
3752
|
+
function createChalk(options) {
|
|
3753
|
+
return chalkFactory(options);
|
|
3754
|
+
}
|
|
3755
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
3756
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
3757
|
+
styles2[styleName] = {
|
|
3758
|
+
get() {
|
|
3759
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
3760
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
3761
|
+
return builder;
|
|
3762
|
+
}
|
|
3763
|
+
};
|
|
3764
|
+
}
|
|
3765
|
+
styles2.visible = {
|
|
3766
|
+
get() {
|
|
3767
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
3768
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
3769
|
+
return builder;
|
|
3770
|
+
}
|
|
3771
|
+
};
|
|
3772
|
+
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
3773
|
+
if (model === "rgb") {
|
|
3774
|
+
if (level === "ansi16m") {
|
|
3775
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
3776
|
+
}
|
|
3777
|
+
if (level === "ansi256") {
|
|
3778
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
3779
|
+
}
|
|
3780
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
3781
|
+
}
|
|
3782
|
+
if (model === "hex") {
|
|
3783
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
3784
|
+
}
|
|
3785
|
+
return ansi_styles_default[type][model](...arguments_);
|
|
3786
|
+
};
|
|
3787
|
+
var usedModels = ["rgb", "hex", "ansi256"];
|
|
3788
|
+
for (const model of usedModels) {
|
|
3789
|
+
styles2[model] = {
|
|
3790
|
+
get() {
|
|
3791
|
+
const { level } = this;
|
|
3792
|
+
return function(...arguments_) {
|
|
3793
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
3794
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
3795
|
+
};
|
|
3796
|
+
}
|
|
3797
|
+
};
|
|
3798
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
3799
|
+
styles2[bgModel] = {
|
|
3800
|
+
get() {
|
|
3801
|
+
const { level } = this;
|
|
3802
|
+
return function(...arguments_) {
|
|
3803
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
3804
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
3805
|
+
};
|
|
3806
|
+
}
|
|
3807
|
+
};
|
|
3808
|
+
}
|
|
3809
|
+
var proto = Object.defineProperties(() => {
|
|
3810
|
+
}, {
|
|
3811
|
+
...styles2,
|
|
3812
|
+
level: {
|
|
3813
|
+
enumerable: true,
|
|
3814
|
+
get() {
|
|
3815
|
+
return this[GENERATOR].level;
|
|
3816
|
+
},
|
|
3817
|
+
set(level) {
|
|
3818
|
+
this[GENERATOR].level = level;
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
});
|
|
3822
|
+
var createStyler = (open, close, parent) => {
|
|
3823
|
+
let openAll;
|
|
3824
|
+
let closeAll;
|
|
3825
|
+
if (parent === void 0) {
|
|
3826
|
+
openAll = open;
|
|
3827
|
+
closeAll = close;
|
|
3828
|
+
} else {
|
|
3829
|
+
openAll = parent.openAll + open;
|
|
3830
|
+
closeAll = close + parent.closeAll;
|
|
3831
|
+
}
|
|
3832
|
+
return {
|
|
3833
|
+
open,
|
|
3834
|
+
close,
|
|
3835
|
+
openAll,
|
|
3836
|
+
closeAll,
|
|
3837
|
+
parent
|
|
3838
|
+
};
|
|
3839
|
+
};
|
|
3840
|
+
var createBuilder = (self, _styler, _isEmpty) => {
|
|
3841
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
3842
|
+
Object.setPrototypeOf(builder, proto);
|
|
3843
|
+
builder[GENERATOR] = self;
|
|
3844
|
+
builder[STYLER] = _styler;
|
|
3845
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
3846
|
+
return builder;
|
|
3847
|
+
};
|
|
3848
|
+
var applyStyle = (self, string) => {
|
|
3849
|
+
if (self.level <= 0 || !string) {
|
|
3850
|
+
return self[IS_EMPTY] ? "" : string;
|
|
3851
|
+
}
|
|
3852
|
+
let styler = self[STYLER];
|
|
3853
|
+
if (styler === void 0) {
|
|
3854
|
+
return string;
|
|
3855
|
+
}
|
|
3856
|
+
const { openAll, closeAll } = styler;
|
|
3857
|
+
if (string.includes("\x1B")) {
|
|
3858
|
+
while (styler !== void 0) {
|
|
3859
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
3860
|
+
styler = styler.parent;
|
|
3861
|
+
}
|
|
3862
|
+
}
|
|
3863
|
+
const lfIndex = string.indexOf("\n");
|
|
3864
|
+
if (lfIndex !== -1) {
|
|
3865
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
3866
|
+
}
|
|
3867
|
+
return openAll + string + closeAll;
|
|
3868
|
+
};
|
|
3869
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
3870
|
+
var chalk = createChalk();
|
|
3871
|
+
createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
3872
|
+
var source_default = chalk;
|
|
3873
|
+
|
|
3874
|
+
// packages/core/src/diff/renderer.ts
|
|
2529
3875
|
function formatPath(path5) {
|
|
2530
3876
|
if (path5 === void 0 || path5.path.length === 0) {
|
|
2531
3877
|
return "(run)";
|
|
@@ -2549,9 +3895,9 @@ function renderRunDiff(result, options) {
|
|
|
2549
3895
|
}
|
|
2550
3896
|
const sev = (s, level) => {
|
|
2551
3897
|
if (!color) return s;
|
|
2552
|
-
if (level === "error") return
|
|
2553
|
-
if (level === "warning") return
|
|
2554
|
-
return
|
|
3898
|
+
if (level === "error") return source_default.red(s);
|
|
3899
|
+
if (level === "warning") return source_default.yellow(s);
|
|
3900
|
+
return source_default.gray(s);
|
|
2555
3901
|
};
|
|
2556
3902
|
const lines = [];
|
|
2557
3903
|
const { summary } = result;
|
|
@@ -2614,6 +3960,8 @@ function diffTraceEvents(leftEvents, rightEvents, options) {
|
|
|
2614
3960
|
const right = manualTraceEventsToComparableRun(rightEvents);
|
|
2615
3961
|
return diffRuns(left, right, options);
|
|
2616
3962
|
}
|
|
3963
|
+
|
|
3964
|
+
// packages/core/src/terminal.ts
|
|
2617
3965
|
var TERMINAL_INDENT = " ";
|
|
2618
3966
|
var MAX_TERMINAL_NAME_LENGTH = 80;
|
|
2619
3967
|
var MAX_TERMINAL_DEPTH = 10;
|
|
@@ -2639,24 +3987,24 @@ function formatTerminalName(name) {
|
|
|
2639
3987
|
return truncateName(name, MAX_TERMINAL_NAME_LENGTH);
|
|
2640
3988
|
}
|
|
2641
3989
|
function getStatusIcon(status) {
|
|
2642
|
-
if (status === "success") return
|
|
2643
|
-
if (status === "error") return
|
|
2644
|
-
return
|
|
3990
|
+
if (status === "success") return source_default.green("\u2714");
|
|
3991
|
+
if (status === "error") return source_default.red("\u2716");
|
|
3992
|
+
return source_default.yellow("\u23F3");
|
|
2645
3993
|
}
|
|
2646
3994
|
function renderStepLine(name, durationMs, status, depth) {
|
|
2647
3995
|
try {
|
|
2648
3996
|
const nm = formatTerminalName(name);
|
|
2649
3997
|
const ind = getIndent(depth ?? 0);
|
|
2650
3998
|
if (status === "running" && durationMs === void 0) {
|
|
2651
|
-
return `${ind}${
|
|
3999
|
+
return `${ind}${source_default.yellow("\u23F3")} ${nm}`;
|
|
2652
4000
|
}
|
|
2653
4001
|
const hasDur = durationMs !== void 0 && Number.isFinite(durationMs);
|
|
2654
4002
|
const dur = hasDur ? formatDuration2(durationMs) : void 0;
|
|
2655
4003
|
if (status === "running") {
|
|
2656
|
-
return dur !== void 0 ? `${ind}${
|
|
4004
|
+
return dur !== void 0 ? `${ind}${source_default.yellow("\u23F3")} ${nm} (${dur})` : `${ind}${source_default.yellow("\u23F3")} ${nm}`;
|
|
2657
4005
|
}
|
|
2658
4006
|
if (!hasDur || dur === void 0) {
|
|
2659
|
-
return `${ind}${
|
|
4007
|
+
return `${ind}${source_default.yellow("\u23F3")} ${nm}`;
|
|
2660
4008
|
}
|
|
2661
4009
|
if (status === "success") {
|
|
2662
4010
|
return `${ind}${getStatusIcon("success")} ${nm} (${dur})`;
|
|
@@ -2692,7 +4040,7 @@ function printRunStart(runId, name) {
|
|
|
2692
4040
|
if (isSilentContext()) return;
|
|
2693
4041
|
try {
|
|
2694
4042
|
safePrint("");
|
|
2695
|
-
const header = `${
|
|
4043
|
+
const header = `${source_default.cyan.bold("\u{1F50D} AgentInspect:")} ${formatTerminalName(name)} ${source_default.dim(`(${runId})`)}`;
|
|
2696
4044
|
safePrint(header);
|
|
2697
4045
|
} catch {
|
|
2698
4046
|
}
|
|
@@ -2725,10 +4073,10 @@ function printRunComplete(_name, _runId, durationMs, status, traceFilePath) {
|
|
|
2725
4073
|
for (let i = 0; i < lines.length; i++) {
|
|
2726
4074
|
const line = lines[i];
|
|
2727
4075
|
if (i === 0) {
|
|
2728
|
-
const color = status === "error" ?
|
|
4076
|
+
const color = status === "error" ? source_default.red : status === "running" ? source_default.yellow : source_default.green;
|
|
2729
4077
|
safePrint(color(line));
|
|
2730
4078
|
} else {
|
|
2731
|
-
safePrint(
|
|
4079
|
+
safePrint(source_default.dim(line));
|
|
2732
4080
|
}
|
|
2733
4081
|
}
|
|
2734
4082
|
} catch {
|
|
@@ -2767,12 +4115,13 @@ async function inspectRun(name, fn, options) {
|
|
|
2767
4115
|
const runId = createRunId();
|
|
2768
4116
|
const traceDir = resolveTraceDir({ dir: options?.traceDir });
|
|
2769
4117
|
const traceSafety = resolveTraceSafetyOptions(options);
|
|
4118
|
+
const runMetadata = buildRunStartedMetadata(options);
|
|
2770
4119
|
const context = {
|
|
2771
4120
|
runId,
|
|
2772
4121
|
runName,
|
|
2773
4122
|
traceDir,
|
|
2774
4123
|
silent: options?.silent ?? false,
|
|
2775
|
-
metadata:
|
|
4124
|
+
metadata: runMetadata
|
|
2776
4125
|
};
|
|
2777
4126
|
return runWithContext(context, async () => {
|
|
2778
4127
|
const startTime = Date.now();
|
|
@@ -2788,7 +4137,7 @@ async function inspectRun(name, fn, options) {
|
|
|
2788
4137
|
runId,
|
|
2789
4138
|
name: runName,
|
|
2790
4139
|
startTime,
|
|
2791
|
-
...
|
|
4140
|
+
...runMetadata !== void 0 ? { metadata: runMetadata } : {}
|
|
2792
4141
|
};
|
|
2793
4142
|
await writeTraceEvent(
|
|
2794
4143
|
prepareTraceEventForDisk(started, traceSafety),
|
|
@@ -3073,6 +4422,134 @@ function observe(agent, options) {
|
|
|
3073
4422
|
// packages/core/src/exporters/types.ts
|
|
3074
4423
|
var EXPORT_PAYLOAD_VERSION = "0.1.2";
|
|
3075
4424
|
|
|
4425
|
+
// packages/core/src/exporters/redact-export.ts
|
|
4426
|
+
function isRecord10(value) {
|
|
4427
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4428
|
+
}
|
|
4429
|
+
function deepClone(value) {
|
|
4430
|
+
if (value === null || typeof value !== "object") {
|
|
4431
|
+
return value;
|
|
4432
|
+
}
|
|
4433
|
+
if (Array.isArray(value)) {
|
|
4434
|
+
return value.map((item) => deepClone(item));
|
|
4435
|
+
}
|
|
4436
|
+
const out = {};
|
|
4437
|
+
for (const [k, v] of Object.entries(value)) {
|
|
4438
|
+
out[k] = deepClone(v);
|
|
4439
|
+
}
|
|
4440
|
+
return out;
|
|
4441
|
+
}
|
|
4442
|
+
function boundAttributeValues(record, maxMetadataValueLength, maxPreviewLength, seen, depth) {
|
|
4443
|
+
if (depth > 32) {
|
|
4444
|
+
return { truncated: true, reason: "maxDepth" };
|
|
4445
|
+
}
|
|
4446
|
+
const out = {};
|
|
4447
|
+
for (const [key, value] of Object.entries(record)) {
|
|
4448
|
+
out[key] = boundValue(value, key, maxMetadataValueLength, maxPreviewLength, seen, depth);
|
|
4449
|
+
}
|
|
4450
|
+
return out;
|
|
4451
|
+
}
|
|
4452
|
+
function boundValue(value, key, maxMetadataValueLength, maxPreviewLength, seen, depth) {
|
|
4453
|
+
if (value === null || typeof value !== "object") {
|
|
4454
|
+
if (typeof value === "string") {
|
|
4455
|
+
return truncateStringForProfile(
|
|
4456
|
+
value,
|
|
4457
|
+
key,
|
|
4458
|
+
maxMetadataValueLength,
|
|
4459
|
+
maxPreviewLength
|
|
4460
|
+
);
|
|
4461
|
+
}
|
|
4462
|
+
return value;
|
|
4463
|
+
}
|
|
4464
|
+
if (seen.has(value)) return "[Circular]";
|
|
4465
|
+
seen.add(value);
|
|
4466
|
+
if (Array.isArray(value)) {
|
|
4467
|
+
return value.slice(0, 50).map(
|
|
4468
|
+
(item, index) => boundValue(
|
|
4469
|
+
item,
|
|
4470
|
+
String(index),
|
|
4471
|
+
maxMetadataValueLength,
|
|
4472
|
+
maxPreviewLength,
|
|
4473
|
+
seen,
|
|
4474
|
+
depth + 1
|
|
4475
|
+
)
|
|
4476
|
+
);
|
|
4477
|
+
}
|
|
4478
|
+
return boundAttributeValues(
|
|
4479
|
+
value,
|
|
4480
|
+
maxMetadataValueLength,
|
|
4481
|
+
maxPreviewLength,
|
|
4482
|
+
seen,
|
|
4483
|
+
depth + 1
|
|
4484
|
+
);
|
|
4485
|
+
}
|
|
4486
|
+
function redactEventAttributes(attrs, redactor, maxMetadataValueLength, maxPreviewLength) {
|
|
4487
|
+
if (!attrs || Object.keys(attrs).length === 0) {
|
|
4488
|
+
return attrs;
|
|
4489
|
+
}
|
|
4490
|
+
const redacted = redactor.redactRecord(attrs);
|
|
4491
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
4492
|
+
const bounded = boundAttributeValues(
|
|
4493
|
+
redacted,
|
|
4494
|
+
maxMetadataValueLength,
|
|
4495
|
+
maxPreviewLength,
|
|
4496
|
+
seen,
|
|
4497
|
+
0
|
|
4498
|
+
);
|
|
4499
|
+
const err = bounded.error;
|
|
4500
|
+
if (isRecord10(err) && typeof err.message === "string") {
|
|
4501
|
+
bounded.error = {
|
|
4502
|
+
...err,
|
|
4503
|
+
message: truncateStringForProfile(
|
|
4504
|
+
err.message,
|
|
4505
|
+
"message",
|
|
4506
|
+
maxMetadataValueLength,
|
|
4507
|
+
maxPreviewLength
|
|
4508
|
+
),
|
|
4509
|
+
...typeof err.stack === "string" ? {
|
|
4510
|
+
stack: truncateStringForProfile(
|
|
4511
|
+
err.stack,
|
|
4512
|
+
"stack",
|
|
4513
|
+
maxMetadataValueLength,
|
|
4514
|
+
maxPreviewLength
|
|
4515
|
+
)
|
|
4516
|
+
} : {}
|
|
4517
|
+
};
|
|
4518
|
+
}
|
|
4519
|
+
return bounded;
|
|
4520
|
+
}
|
|
4521
|
+
function redactRunTreeForExport(tree, options) {
|
|
4522
|
+
const profile = options?.redactionProfile ?? "local";
|
|
4523
|
+
if (profile === "local") {
|
|
4524
|
+
return deepClone(tree);
|
|
4525
|
+
}
|
|
4526
|
+
const resolved = resolveRedactionProfile(profile);
|
|
4527
|
+
const { maxMetadataValueLength, maxPreviewLength } = applyProfileMetadataCaps(
|
|
4528
|
+
2e3,
|
|
4529
|
+
500,
|
|
4530
|
+
resolved
|
|
4531
|
+
);
|
|
4532
|
+
const redactor = new Redactor({ extraKeys: resolved.extraKeys });
|
|
4533
|
+
const clone = deepClone(tree);
|
|
4534
|
+
function walk(nodes) {
|
|
4535
|
+
for (const node of nodes) {
|
|
4536
|
+
if (node.event.attributes !== void 0) {
|
|
4537
|
+
node.event.attributes = redactEventAttributes(
|
|
4538
|
+
node.event.attributes,
|
|
4539
|
+
redactor,
|
|
4540
|
+
maxMetadataValueLength,
|
|
4541
|
+
maxPreviewLength
|
|
4542
|
+
);
|
|
4543
|
+
}
|
|
4544
|
+
if (node.children.length > 0) {
|
|
4545
|
+
walk(node.children);
|
|
4546
|
+
}
|
|
4547
|
+
}
|
|
4548
|
+
}
|
|
4549
|
+
walk(clone.children);
|
|
4550
|
+
return clone;
|
|
4551
|
+
}
|
|
4552
|
+
|
|
3076
4553
|
// packages/core/src/exporters/html-exporter.ts
|
|
3077
4554
|
function renderTreeHtml(nodes, ulClass = "tree") {
|
|
3078
4555
|
if (nodes.length === 0) return "";
|
|
@@ -3159,7 +4636,7 @@ function exportHtml(tree, options) {
|
|
|
3159
4636
|
attrsHtml += "<h2>Attributes (bounded)</h2>";
|
|
3160
4637
|
for (const n of flat) {
|
|
3161
4638
|
if (!n.event.attributes || Object.keys(n.event.attributes).length === 0) continue;
|
|
3162
|
-
const compact =
|
|
4639
|
+
const compact = compactAttributes4(n.event.attributes, {
|
|
3163
4640
|
maxLength: maxLen,
|
|
3164
4641
|
redacted
|
|
3165
4642
|
});
|
|
@@ -3310,7 +4787,7 @@ function exportMarkdown(tree, options) {
|
|
|
3310
4787
|
lines.push("");
|
|
3311
4788
|
for (const n of flat) {
|
|
3312
4789
|
if (!n.event.attributes || Object.keys(n.event.attributes).length === 0) continue;
|
|
3313
|
-
const compact =
|
|
4790
|
+
const compact = compactAttributes4(n.event.attributes, {
|
|
3314
4791
|
maxLength: maxLen,
|
|
3315
4792
|
redacted
|
|
3316
4793
|
});
|
|
@@ -3809,20 +5286,22 @@ function mergeExportDefaults(options) {
|
|
|
3809
5286
|
includeErrors: options.includeErrors ?? true,
|
|
3810
5287
|
pretty: options.pretty ?? true,
|
|
3811
5288
|
redacted: options.redacted ?? true,
|
|
3812
|
-
maxAttributeLength: options.maxAttributeLength ?? 500
|
|
5289
|
+
maxAttributeLength: options.maxAttributeLength ?? 500,
|
|
5290
|
+
redactionProfile: options.redactionProfile ?? "local"
|
|
3813
5291
|
};
|
|
3814
5292
|
}
|
|
3815
5293
|
function exportRunTree(tree, options) {
|
|
3816
5294
|
const opts = mergeExportDefaults(options);
|
|
5295
|
+
const exportTree = opts.redactionProfile === "local" ? tree : redactRunTreeForExport(tree, { redactionProfile: opts.redactionProfile });
|
|
3817
5296
|
switch (opts.format) {
|
|
3818
5297
|
case "markdown":
|
|
3819
|
-
return exportMarkdown(
|
|
5298
|
+
return exportMarkdown(exportTree, opts);
|
|
3820
5299
|
case "html":
|
|
3821
|
-
return exportHtml(
|
|
5300
|
+
return exportHtml(exportTree, opts);
|
|
3822
5301
|
case "openinference":
|
|
3823
|
-
return exportOpenInference(
|
|
5302
|
+
return exportOpenInference(exportTree, opts);
|
|
3824
5303
|
case "otlp-json":
|
|
3825
|
-
return exportOtlpJson(
|
|
5304
|
+
return exportOtlpJson(exportTree, opts);
|
|
3826
5305
|
default: {
|
|
3827
5306
|
const _x = opts.format;
|
|
3828
5307
|
throw new Error(`Unsupported export format: ${String(_x)}`);
|
|
@@ -3860,7 +5339,7 @@ exports.TERMINAL_INDENT = TERMINAL_INDENT;
|
|
|
3860
5339
|
exports.TraceDirectory = TraceDirectory;
|
|
3861
5340
|
exports.TreeBuilder = TreeBuilder;
|
|
3862
5341
|
exports.buildRunSummary = buildRunSummary;
|
|
3863
|
-
exports.compactAttributes =
|
|
5342
|
+
exports.compactAttributes = compactAttributes4;
|
|
3864
5343
|
exports.createRunId = createRunId;
|
|
3865
5344
|
exports.createStepId = createStepId;
|
|
3866
5345
|
exports.diffRuns = diffRuns;
|
|
@@ -3881,6 +5360,7 @@ exports.formatError = formatError;
|
|
|
3881
5360
|
exports.formatTerminalName = formatTerminalName;
|
|
3882
5361
|
exports.formatTimestamp = formatTimestamp;
|
|
3883
5362
|
exports.getCurrentContext = getCurrentContext;
|
|
5363
|
+
exports.getCurrentCorrelationMetadata = getCurrentCorrelationMetadata;
|
|
3884
5364
|
exports.getCurrentDepth = getCurrentDepth;
|
|
3885
5365
|
exports.getCurrentRunId = getCurrentRunId;
|
|
3886
5366
|
exports.getCurrentRunName = getCurrentRunName;
|
|
@@ -3894,9 +5374,12 @@ exports.getTraceFilePath = getTraceFilePath;
|
|
|
3894
5374
|
exports.getTraceSafetyFromContext = getTraceSafetyFromContext;
|
|
3895
5375
|
exports.hasActiveContext = hasActiveContext;
|
|
3896
5376
|
exports.initializeTraceFile = initializeTraceFile;
|
|
5377
|
+
exports.inspectEventToPersistedInspectEvent = inspectEventToPersistedInspectEvent;
|
|
5378
|
+
exports.inspectEventsToPersistedInspectEvents = inspectEventsToPersistedInspectEvents;
|
|
3897
5379
|
exports.inspectRun = inspectRun;
|
|
3898
5380
|
exports.isAgentInspectEnabled = isAgentInspectEnabled;
|
|
3899
5381
|
exports.isAgentInspectTrace = isAgentInspectTrace;
|
|
5382
|
+
exports.isPersistedInspectEvent = isPersistedInspectEvent;
|
|
3900
5383
|
exports.isSilentContext = isSilentContext;
|
|
3901
5384
|
exports.isStepStatus = isStepStatus;
|
|
3902
5385
|
exports.isStepType = isStepType;
|
|
@@ -3913,6 +5396,9 @@ exports.observe = observe;
|
|
|
3913
5396
|
exports.parseDuration = parseDuration;
|
|
3914
5397
|
exports.parseLogLine = parseLogLine;
|
|
3915
5398
|
exports.parseLogsToTrees = parseLogsToTrees;
|
|
5399
|
+
exports.persistedInspectEventToInspectEvent = persistedInspectEventToInspectEvent;
|
|
5400
|
+
exports.persistedInspectEventsToInspectEvents = persistedInspectEventsToInspectEvents;
|
|
5401
|
+
exports.persistedInspectEventsToRunTrees = persistedInspectEventsToRunTrees;
|
|
3916
5402
|
exports.prepareMetadataForDisk = prepareMetadataForDisk;
|
|
3917
5403
|
exports.prepareTraceEventForDisk = prepareTraceEventForDisk;
|
|
3918
5404
|
exports.printError = printError;
|
|
@@ -3923,12 +5409,14 @@ exports.printStepComplete = printStepComplete;
|
|
|
3923
5409
|
exports.printStepStart = printStepStart;
|
|
3924
5410
|
exports.readTraceEvents = readTraceEvents;
|
|
3925
5411
|
exports.readTraceFile = readTraceFile;
|
|
5412
|
+
exports.redactRunTreeForExport = redactRunTreeForExport;
|
|
3926
5413
|
exports.renderErrorLine = renderErrorLine;
|
|
3927
5414
|
exports.renderRunDiff = renderRunDiff;
|
|
3928
5415
|
exports.renderRunSummary = renderRunSummary;
|
|
3929
5416
|
exports.renderRunTree = renderRunTree;
|
|
3930
5417
|
exports.renderRunTrees = renderRunTrees;
|
|
3931
5418
|
exports.renderStepLine = renderStepLine;
|
|
5419
|
+
exports.resolveRedactionProfile = resolveRedactionProfile;
|
|
3932
5420
|
exports.resolveTraceDir = resolveTraceDir;
|
|
3933
5421
|
exports.resolveTraceSafetyOptions = resolveTraceSafetyOptions;
|
|
3934
5422
|
exports.runWithContext = runWithContext;
|
|
@@ -3938,6 +5426,9 @@ exports.serializeEvent = serializeEvent;
|
|
|
3938
5426
|
exports.stableJson = stableJson;
|
|
3939
5427
|
exports.step = step;
|
|
3940
5428
|
exports.summarizeTree = summarizeTree;
|
|
5429
|
+
exports.traceEventToPersistedInspectEvent = traceEventToPersistedInspectEvent;
|
|
5430
|
+
exports.traceEventsToPersistedInspectEvents = traceEventsToPersistedInspectEvents;
|
|
5431
|
+
exports.traceEventsToPersistedRunTrees = traceEventsToPersistedRunTrees;
|
|
3941
5432
|
exports.truncateName = truncateName;
|
|
3942
5433
|
exports.validateEvent = validateEvent;
|
|
3943
5434
|
exports.validateExport = validateExport;
|