agent-inspect 6.31.31 → 6.31.32
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 +6 -0
- package/README.md +1 -1
- package/docs/CLI.md +3 -1
- package/docs/TRACE-CONTRACTS.md +2 -0
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-4GTOJ3G2.mjs → chunk-PEGM6T2X.mjs} +82 -9
- package/packages/cli/dist/chunk-PEGM6T2X.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +100 -11
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +23 -7
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-BF74ZVDF.mjs → src-CWUJTMRD.mjs} +3 -3
- package/packages/cli/dist/{src-BF74ZVDF.mjs.map → src-CWUJTMRD.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +4 -0
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +2 -2
- package/packages/core/dist/advanced.d.ts +2 -2
- package/packages/core/dist/advanced.mjs +9 -9
- package/packages/core/dist/checks.cjs +76 -7
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.d.cts +2 -2
- package/packages/core/dist/checks.d.ts +2 -2
- package/packages/core/dist/checks.mjs +3 -3
- package/packages/core/dist/{chunk-BYNAJPNH.mjs → chunk-6G67ZN72.mjs} +79 -10
- package/packages/core/dist/chunk-6G67ZN72.mjs.map +1 -0
- package/packages/core/dist/{chunk-76QIWWJ5.mjs → chunk-6S666BF4.mjs} +3 -3
- package/packages/core/dist/{chunk-76QIWWJ5.mjs.map → chunk-6S666BF4.mjs.map} +1 -1
- package/packages/core/dist/{chunk-QMO3ITYF.mjs → chunk-FBPDF7HO.mjs} +3 -3
- package/packages/core/dist/{chunk-QMO3ITYF.mjs.map → chunk-FBPDF7HO.mjs.map} +1 -1
- package/packages/core/dist/{chunk-XM27TZLD.mjs → chunk-RB6WANSW.mjs} +6 -2
- package/packages/core/dist/chunk-RB6WANSW.mjs.map +1 -0
- package/packages/core/dist/{chunk-JTJN4KBJ.mjs → chunk-VIEJJ5JB.mjs} +4 -4
- package/packages/core/dist/{chunk-JTJN4KBJ.mjs.map → chunk-VIEJJ5JB.mjs.map} +1 -1
- package/packages/core/dist/exporters.cjs +4 -0
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.mjs +3 -3
- package/packages/core/dist/{index-DACU4Dy1.d.cts → index-Ceyw5x7b.d.cts} +4 -2
- package/packages/core/dist/{index-b4tIGrzq.d.ts → index-K5Cinf1r.d.ts} +4 -2
- package/packages/core/dist/index.cjs +4 -0
- package/packages/core/dist/index.cjs.map +1 -1
- package/packages/core/dist/index.mjs +4 -4
- package/packages/core/dist/writers.cjs +4 -0
- package/packages/core/dist/writers.cjs.map +1 -1
- package/packages/core/dist/writers.mjs +1 -1
- package/packages/cli/dist/chunk-4GTOJ3G2.mjs.map +0 -1
- package/packages/core/dist/chunk-BYNAJPNH.mjs.map +0 -1
- package/packages/core/dist/chunk-XM27TZLD.mjs.map +0 -1
|
@@ -6,8 +6,8 @@ import { a as InspectRunTree } from './inspect-event-ClM5Z8om.cjs';
|
|
|
6
6
|
export { b as ATTRIBUTION_CONFIDENCES, c as ATTRIBUTION_CONFIDENCE_RANK, A as AttributionConfidence, E as EventSource, d as InspectEvent, I as InspectKind, e as InspectNode, i as isAttributionConfidence } from './inspect-event-ClM5Z8om.cjs';
|
|
7
7
|
import { P as PersistedInspectEvent } from './persisted-inspect-event-q2ViiBW6.cjs';
|
|
8
8
|
import { Stats } from 'node:fs';
|
|
9
|
-
import { aZ as SessionWorkflowMetadata, a_ as SessionRunRecord, a$ as EnrichSessionSummaryOptions, b0 as SessionStatus, b1 as SessionSummary, b2 as SessionIndex, b3 as BuildActivitySummaryOptions, b4 as ActivitySummary, b5 as SessionWarning, b6 as BuildSessionIndexOptions, U as TraceCheckResult, _ as TraceCheckStatus, a5 as TraceContractInput, a0 as TraceContract } from './index-
|
|
10
|
-
export { b7 as ActivityEntry, b8 as CriticalPathStep, b9 as HandoffEdge, ba as RetryLink, bb as SESSION_WORKFLOW_KEYS, bc as SessionCheckSummary, bd as SessionConfidence, be as SessionEdgeSource, bf as SessionGroup, bg as SessionLastError, bh as SessionWorkflowKey } from './index-
|
|
9
|
+
import { aZ as SessionWorkflowMetadata, a_ as SessionRunRecord, a$ as EnrichSessionSummaryOptions, b0 as SessionStatus, b1 as SessionSummary, b2 as SessionIndex, b3 as BuildActivitySummaryOptions, b4 as ActivitySummary, b5 as SessionWarning, b6 as BuildSessionIndexOptions, U as TraceCheckResult, _ as TraceCheckStatus, a5 as TraceContractInput, a0 as TraceContract } from './index-Ceyw5x7b.cjs';
|
|
10
|
+
export { b7 as ActivityEntry, b8 as CriticalPathStep, b9 as HandoffEdge, ba as RetryLink, bb as SESSION_WORKFLOW_KEYS, bc as SessionCheckSummary, bd as SessionConfidence, be as SessionEdgeSource, bf as SessionGroup, bg as SessionLastError, bh as SessionWorkflowKey } from './index-Ceyw5x7b.cjs';
|
|
11
11
|
import { b as ObservedOutcome } from './types-BA_IOdg4.cjs';
|
|
12
12
|
export { a as ObservedOutcomeStatus } from './types-BA_IOdg4.cjs';
|
|
13
13
|
import './writers.cjs';
|
|
@@ -6,8 +6,8 @@ import { a as InspectRunTree } from './inspect-event-ClM5Z8om.js';
|
|
|
6
6
|
export { b as ATTRIBUTION_CONFIDENCES, c as ATTRIBUTION_CONFIDENCE_RANK, A as AttributionConfidence, E as EventSource, d as InspectEvent, I as InspectKind, e as InspectNode, i as isAttributionConfidence } from './inspect-event-ClM5Z8om.js';
|
|
7
7
|
import { P as PersistedInspectEvent } from './persisted-inspect-event-DG02LhEP.js';
|
|
8
8
|
import { Stats } from 'node:fs';
|
|
9
|
-
import { aZ as SessionWorkflowMetadata, a_ as SessionRunRecord, a$ as EnrichSessionSummaryOptions, b0 as SessionStatus, b1 as SessionSummary, b2 as SessionIndex, b3 as BuildActivitySummaryOptions, b4 as ActivitySummary, b5 as SessionWarning, b6 as BuildSessionIndexOptions, U as TraceCheckResult, _ as TraceCheckStatus, a5 as TraceContractInput, a0 as TraceContract } from './index-
|
|
10
|
-
export { b7 as ActivityEntry, b8 as CriticalPathStep, b9 as HandoffEdge, ba as RetryLink, bb as SESSION_WORKFLOW_KEYS, bc as SessionCheckSummary, bd as SessionConfidence, be as SessionEdgeSource, bf as SessionGroup, bg as SessionLastError, bh as SessionWorkflowKey } from './index-
|
|
9
|
+
import { aZ as SessionWorkflowMetadata, a_ as SessionRunRecord, a$ as EnrichSessionSummaryOptions, b0 as SessionStatus, b1 as SessionSummary, b2 as SessionIndex, b3 as BuildActivitySummaryOptions, b4 as ActivitySummary, b5 as SessionWarning, b6 as BuildSessionIndexOptions, U as TraceCheckResult, _ as TraceCheckStatus, a5 as TraceContractInput, a0 as TraceContract } from './index-K5Cinf1r.js';
|
|
10
|
+
export { b7 as ActivityEntry, b8 as CriticalPathStep, b9 as HandoffEdge, ba as RetryLink, bb as SESSION_WORKFLOW_KEYS, bc as SessionCheckSummary, bd as SessionConfidence, be as SessionEdgeSource, bf as SessionGroup, bg as SessionLastError, bh as SessionWorkflowKey } from './index-K5Cinf1r.js';
|
|
11
11
|
import { b as ObservedOutcome } from './types-BA_IOdg4.js';
|
|
12
12
|
export { a as ObservedOutcomeStatus } from './types-BA_IOdg4.js';
|
|
13
13
|
import './writers.js';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { extractSessionWorkflowMetadata, sessionKeyForRun, defineTraceContract, runTraceChecks, createRunStatusRule, createToolUsageRule, createRunDurationRule, createRunDepthRule, createToolFailureRule, createLlmUsageRule, createObservedOutcomeRule } from './chunk-
|
|
2
|
-
export { extractSessionWorkflowMetadata, sessionKeyForRun } from './chunk-
|
|
3
|
-
export { MAX_TERMINAL_DEPTH, MAX_TERMINAL_NAME_LENGTH, TERMINAL_INDENT, TraceDirectory, createInspector, createInspectorRuntime, formatTerminalName, getCurrentContext, getCurrentCorrelationMetadata, getCurrentDepth, getCurrentRunId, getCurrentRunName, getCurrentStepId, getIndent, getParentStepId, getTraceDirFromContext, getTraceSafetyFromContext, hasActiveContext, isAgentInspectEnabled, isSilentContext, maybeInspectRun, printError, printFailedAt, printRunComplete, printRunStart, printStepComplete, printStepStart, renderErrorLine, renderRunSummary, renderStepLine, resolveTraceDir, runWithContext, runWithStepContext } from './chunk-
|
|
4
|
-
import { buildRunTimeline, filterTraces, extractMetadata, buildRunSummary } from './chunk-
|
|
5
|
-
export { buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildTraceStats, extractMetadata, filterTraces, formatStepLabel, renderRunWhat, renderTimeline, renderTraceStats } from './chunk-
|
|
6
|
-
import { extractOutcomesFromTraceEvents, parseObservationFilter, summarizeObservedOutcomes, extractOutcomesFromPersistedEvents, renderObservedOutcomesHtml } from './chunk-
|
|
7
|
-
export { extractOutcomesFromPersistedEvents, extractOutcomesFromTraceEvents } from './chunk-
|
|
1
|
+
import { extractSessionWorkflowMetadata, sessionKeyForRun, defineTraceContract, runTraceChecks, createRunStatusRule, createToolUsageRule, createRunDurationRule, createRunDepthRule, createToolFailureRule, createLlmUsageRule, createObservedOutcomeRule } from './chunk-6G67ZN72.mjs';
|
|
2
|
+
export { extractSessionWorkflowMetadata, sessionKeyForRun } from './chunk-6G67ZN72.mjs';
|
|
3
|
+
export { MAX_TERMINAL_DEPTH, MAX_TERMINAL_NAME_LENGTH, TERMINAL_INDENT, TraceDirectory, createInspector, createInspectorRuntime, formatTerminalName, getCurrentContext, getCurrentCorrelationMetadata, getCurrentDepth, getCurrentRunId, getCurrentRunName, getCurrentStepId, getIndent, getParentStepId, getTraceDirFromContext, getTraceSafetyFromContext, hasActiveContext, isAgentInspectEnabled, isSilentContext, maybeInspectRun, printError, printFailedAt, printRunComplete, printRunStart, printStepComplete, printStepStart, renderErrorLine, renderRunSummary, renderStepLine, resolveTraceDir, runWithContext, runWithStepContext } from './chunk-VIEJJ5JB.mjs';
|
|
4
|
+
import { buildRunTimeline, filterTraces, extractMetadata, buildRunSummary } from './chunk-6S666BF4.mjs';
|
|
5
|
+
export { buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildTraceStats, extractMetadata, filterTraces, formatStepLabel, renderRunWhat, renderTimeline, renderTraceStats } from './chunk-6S666BF4.mjs';
|
|
6
|
+
import { extractOutcomesFromTraceEvents, parseObservationFilter, summarizeObservedOutcomes, extractOutcomesFromPersistedEvents, renderObservedOutcomesHtml } from './chunk-FBPDF7HO.mjs';
|
|
7
|
+
export { extractOutcomesFromPersistedEvents, extractOutcomesFromTraceEvents } from './chunk-FBPDF7HO.mjs';
|
|
8
8
|
import { diffTraceEvents, renderRunDiff } from './chunk-F7STQ5JF.mjs';
|
|
9
9
|
import './chunk-BT7CATSD.mjs';
|
|
10
10
|
import { escapeHtml, flattenTree } from './chunk-CAWPF22J.mjs';
|
|
11
|
-
import { resolveRedactionProfile, readTraceEventsFromFile, stringContainsHighConfidenceCredential } from './chunk-
|
|
12
|
-
export { DEFAULT_MAX_EVENT_BYTES, DEFAULT_MAX_METADATA_VALUE_LENGTH, DEFAULT_MAX_PREVIEW_LENGTH, getRunIdFromTraceFileName, initializeTraceFile, listTraceFiles, prepareMetadataForDisk, prepareTraceEventForDisk, readTraceEvents, readTraceFile, resolveRedactionProfile, resolveTraceSafetyOptions, serializeEvent, validateEvent, writeTraceEvent } from './chunk-
|
|
11
|
+
import { resolveRedactionProfile, readTraceEventsFromFile, stringContainsHighConfidenceCredential } from './chunk-RB6WANSW.mjs';
|
|
12
|
+
export { DEFAULT_MAX_EVENT_BYTES, DEFAULT_MAX_METADATA_VALUE_LENGTH, DEFAULT_MAX_PREVIEW_LENGTH, getRunIdFromTraceFileName, initializeTraceFile, listTraceFiles, prepareMetadataForDisk, prepareTraceEventForDisk, readTraceEvents, readTraceFile, resolveRedactionProfile, resolveTraceSafetyOptions, serializeEvent, validateEvent, writeTraceEvent } from './chunk-RB6WANSW.mjs';
|
|
13
13
|
import { Redactor } from './chunk-VLVCLAPB.mjs';
|
|
14
14
|
import { openTrace } from './chunk-JJSL346L.mjs';
|
|
15
15
|
import './chunk-77PUPLPG.mjs';
|
|
@@ -3972,6 +3972,12 @@ var SAFE_USAGE_LEAF_KEYS = /* @__PURE__ */ new Set([
|
|
|
3972
3972
|
var DEFAULT_SECRET_PATTERNS = [
|
|
3973
3973
|
{ id: "bearer-token", pattern: /Bearer\s+[A-Za-z0-9._~+/-]{12,}=*/ },
|
|
3974
3974
|
{ id: "openai-key", pattern: /sk-[A-Za-z0-9_-]{16,}/ },
|
|
3975
|
+
// Stripe + Slack: keep in sync with packages/redact + credential-value-patterns (#520).
|
|
3976
|
+
{
|
|
3977
|
+
id: "stripe-key",
|
|
3978
|
+
pattern: /\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}\b/
|
|
3979
|
+
},
|
|
3980
|
+
{ id: "slack-token", pattern: /\bxox[abposr]-[A-Za-z0-9-]{10,}\b/ },
|
|
3975
3981
|
{ id: "aws-access-key", pattern: /AKIA[0-9A-Z]{16}/ },
|
|
3976
3982
|
{ id: "github-token", pattern: /gh[opsu]_[A-Za-z0-9_]{20,}/ },
|
|
3977
3983
|
// Keep in sync with packages/redact/src/key-value-secret.ts (KEY_VALUE_SECRET_PATTERN_SOURCE).
|
|
@@ -4352,6 +4358,56 @@ function eventEndMs(event) {
|
|
|
4352
4358
|
}
|
|
4353
4359
|
return void 0;
|
|
4354
4360
|
}
|
|
4361
|
+
function rowIndexByEventId(events) {
|
|
4362
|
+
const index = /* @__PURE__ */ new Map();
|
|
4363
|
+
for (const [position, event] of events.entries()) {
|
|
4364
|
+
if (!index.has(event.eventId)) index.set(event.eventId, position);
|
|
4365
|
+
}
|
|
4366
|
+
return index;
|
|
4367
|
+
}
|
|
4368
|
+
function recordedRowSpan(rowIndex, event) {
|
|
4369
|
+
const sourceIds = "sourceEventIds" in event && Array.isArray(event.sourceEventIds) ? event.sourceEventIds : [event.eventId];
|
|
4370
|
+
const rows = [];
|
|
4371
|
+
for (const id of sourceIds) {
|
|
4372
|
+
const row = typeof id === "string" ? rowIndex.get(id) : void 0;
|
|
4373
|
+
if (row === void 0) return void 0;
|
|
4374
|
+
rows.push(row);
|
|
4375
|
+
}
|
|
4376
|
+
if (rows.length === 0) return void 0;
|
|
4377
|
+
return { first: Math.min(...rows), last: Math.max(...rows) };
|
|
4378
|
+
}
|
|
4379
|
+
function recordedTieOrder(context, tiedBefore, tiedAfter) {
|
|
4380
|
+
const rowIndex = rowIndexByEventId(context.events);
|
|
4381
|
+
let lastFinished;
|
|
4382
|
+
let firstStarted;
|
|
4383
|
+
for (const event of tiedBefore) {
|
|
4384
|
+
const span = recordedRowSpan(rowIndex, event);
|
|
4385
|
+
if (span === void 0) return { inOrder: void 0 };
|
|
4386
|
+
if (lastFinished === void 0 || span.last > lastFinished.row) {
|
|
4387
|
+
lastFinished = { event, row: span.last };
|
|
4388
|
+
}
|
|
4389
|
+
}
|
|
4390
|
+
for (const event of tiedAfter) {
|
|
4391
|
+
const span = recordedRowSpan(rowIndex, event);
|
|
4392
|
+
if (span === void 0) return { inOrder: void 0 };
|
|
4393
|
+
if (firstStarted === void 0 || span.first < firstStarted.row) {
|
|
4394
|
+
firstStarted = { event, row: span.first };
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
if (lastFinished === void 0 || firstStarted === void 0) return { inOrder: void 0 };
|
|
4398
|
+
return {
|
|
4399
|
+
inOrder: lastFinished.row < firstStarted.row,
|
|
4400
|
+
lastFinishedBefore: lastFinished.event,
|
|
4401
|
+
firstStartedAfter: firstStarted.event
|
|
4402
|
+
};
|
|
4403
|
+
}
|
|
4404
|
+
function tieResolution(order) {
|
|
4405
|
+
return order.inOrder === void 0 ? "recorded-order-unavailable" : "recorded-order";
|
|
4406
|
+
}
|
|
4407
|
+
function tieMessage(order, beforeLabel, afterLabel) {
|
|
4408
|
+
if (order === void 0 || order.inOrder === true) return "";
|
|
4409
|
+
return order.inOrder === void 0 ? " Their timestamps tie at the same millisecond and the recorded event order could not be resolved." : ` Their timestamps tie at the same millisecond; the recorded event order shows ${afterLabel} started before ${beforeLabel} finished.`;
|
|
4410
|
+
}
|
|
4355
4411
|
function sortedStrings(values) {
|
|
4356
4412
|
return [...values ?? []].sort((a, b) => a.localeCompare(b));
|
|
4357
4413
|
}
|
|
@@ -4970,16 +5026,18 @@ function createStepOrderingRule(options) {
|
|
|
4970
5026
|
)
|
|
4971
5027
|
];
|
|
4972
5028
|
}
|
|
4973
|
-
|
|
5029
|
+
const tie = beforeEnd === afterStart ? recordedTieOrder(context, [beforeEvent], [afterEvent]) : void 0;
|
|
5030
|
+
if (beforeEnd > afterStart || tie !== void 0 && tie.inOrder !== true) {
|
|
4974
5031
|
return [
|
|
4975
5032
|
failFinding(
|
|
4976
5033
|
ruleId,
|
|
4977
|
-
`${subject} ${beforeLabel} must finish before ${afterLabel} starts
|
|
5034
|
+
`${subject} ${beforeLabel} must finish before ${afterLabel} starts.${tieMessage(tie, beforeLabel, afterLabel)}`,
|
|
4978
5035
|
[eventEvidence3(beforeEvent), eventEvidence3(afterEvent)],
|
|
4979
5036
|
expected,
|
|
4980
5037
|
{
|
|
4981
5038
|
beforeEndedAt: new Date(beforeEnd).toISOString(),
|
|
4982
|
-
afterStartedAt: new Date(afterStart).toISOString()
|
|
5039
|
+
afterStartedAt: new Date(afterStart).toISOString(),
|
|
5040
|
+
...tie !== void 0 ? { resolvedBy: tieResolution(tie) } : {}
|
|
4983
5041
|
}
|
|
4984
5042
|
)
|
|
4985
5043
|
];
|
|
@@ -5042,16 +5100,27 @@ function createStepOrderingRule(options) {
|
|
|
5042
5100
|
)
|
|
5043
5101
|
];
|
|
5044
5102
|
}
|
|
5045
|
-
|
|
5103
|
+
const tiedEnd = latestBefore.end;
|
|
5104
|
+
const tiedStart = earliestAfter.start;
|
|
5105
|
+
const tie = tiedEnd === tiedStart ? recordedTieOrder(
|
|
5106
|
+
context,
|
|
5107
|
+
beforeEvents.filter((event) => eventEndMs(event) === tiedEnd),
|
|
5108
|
+
afterEvents.filter((event) => eventStartMs(event) === tiedStart)
|
|
5109
|
+
) : void 0;
|
|
5110
|
+
if (latestBefore.end > earliestAfter.start || tie !== void 0 && tie.inOrder !== true) {
|
|
5046
5111
|
return [
|
|
5047
5112
|
failFinding(
|
|
5048
5113
|
ruleId,
|
|
5049
|
-
bothTools ? `Every ${options.before.name} tool call must finish before any ${options.after.name} tool call starts.` : `Every ${beforeLabel} must finish before any ${afterLabel} starts
|
|
5050
|
-
[
|
|
5114
|
+
(bothTools ? `Every ${options.before.name} tool call must finish before any ${options.after.name} tool call starts.` : `Every ${beforeLabel} must finish before any ${afterLabel} starts.`) + tieMessage(tie, beforeLabel, afterLabel),
|
|
5115
|
+
[
|
|
5116
|
+
eventEvidence3(tie?.lastFinishedBefore ?? latestBefore.event),
|
|
5117
|
+
eventEvidence3(tie?.firstStartedAfter ?? earliestAfter.event)
|
|
5118
|
+
],
|
|
5051
5119
|
expected,
|
|
5052
5120
|
{
|
|
5053
5121
|
latestBeforeEndedAt: new Date(latestBefore.end).toISOString(),
|
|
5054
|
-
earliestAfterStartedAt: new Date(earliestAfter.start).toISOString()
|
|
5122
|
+
earliestAfterStartedAt: new Date(earliestAfter.start).toISOString(),
|
|
5123
|
+
...tie !== void 0 ? { resolvedBy: tieResolution(tie) } : {}
|
|
5055
5124
|
}
|
|
5056
5125
|
)
|
|
5057
5126
|
];
|