agent-inspect 6.31.22 → 6.31.24
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 +12 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-EMWA5EKU.mjs → chunk-P27XTK5U.mjs} +62 -20
- package/packages/cli/dist/chunk-P27XTK5U.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +97 -49
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +38 -34
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-VZHGOLTO.mjs → src-EWZYLDST.mjs} +3 -3
- package/packages/cli/dist/{src-VZHGOLTO.mjs.map → src-EWZYLDST.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +38 -10
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +6 -6
- package/packages/core/dist/checks.cjs +36 -11
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.mjs +2 -2
- package/packages/core/dist/{chunk-RBXD7BNX.mjs → chunk-77PUPLPG.mjs} +14 -8
- package/packages/core/dist/chunk-77PUPLPG.mjs.map +1 -0
- package/packages/core/dist/{chunk-GCZUWY47.mjs → chunk-AN5MOADW.mjs} +31 -9
- package/packages/core/dist/chunk-AN5MOADW.mjs.map +1 -0
- package/packages/core/dist/{chunk-ZOF6ON65.mjs → chunk-IMCM42W6.mjs} +15 -9
- package/packages/core/dist/chunk-IMCM42W6.mjs.map +1 -0
- package/packages/core/dist/{chunk-S4NU55LU.mjs → chunk-J2ST4VCX.mjs} +3 -3
- package/packages/core/dist/{chunk-S4NU55LU.mjs.map → chunk-J2ST4VCX.mjs.map} +1 -1
- package/packages/core/dist/{chunk-UPGBMRL4.mjs → chunk-JJSL346L.mjs} +12 -3
- package/packages/core/dist/chunk-JJSL346L.mjs.map +1 -0
- package/packages/core/dist/exporters.cjs +38 -31
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.mjs +35 -31
- package/packages/core/dist/exporters.mjs.map +1 -1
- package/packages/core/dist/logs.cjs +14 -5
- package/packages/core/dist/logs.cjs.map +1 -1
- package/packages/core/dist/logs.mjs +3 -3
- package/packages/core/dist/persisted.cjs +185 -163
- package/packages/core/dist/persisted.cjs.map +1 -1
- package/packages/core/dist/persisted.mjs +9 -6
- package/packages/core/dist/persisted.mjs.map +1 -1
- package/packages/core/dist/readers.cjs +189 -161
- package/packages/core/dist/readers.cjs.map +1 -1
- package/packages/core/dist/readers.mjs +4 -4
- package/packages/cli/dist/chunk-EMWA5EKU.mjs.map +0 -1
- package/packages/core/dist/chunk-GCZUWY47.mjs.map +0 -1
- package/packages/core/dist/chunk-RBXD7BNX.mjs.map +0 -1
- package/packages/core/dist/chunk-UPGBMRL4.mjs.map +0 -1
- package/packages/core/dist/chunk-ZOF6ON65.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { extractSessionWorkflowMetadata, sessionKeyForRun, defineTraceContract, runTraceChecks, createRunStatusRule, createToolUsageRule, createRunDurationRule, createRunDepthRule, createToolFailureRule, createLlmUsageRule, createObservedOutcomeRule } from './chunk-
|
|
2
|
-
export { extractSessionWorkflowMetadata, sessionKeyForRun } from './chunk-
|
|
1
|
+
import { extractSessionWorkflowMetadata, sessionKeyForRun, defineTraceContract, runTraceChecks, createRunStatusRule, createToolUsageRule, createRunDurationRule, createRunDepthRule, createToolFailureRule, createLlmUsageRule, createObservedOutcomeRule } from './chunk-IMCM42W6.mjs';
|
|
2
|
+
export { extractSessionWorkflowMetadata, sessionKeyForRun } from './chunk-IMCM42W6.mjs';
|
|
3
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-6C244CAV.mjs';
|
|
4
4
|
import { buildRunTimeline, filterTraces, extractMetadata, buildRunSummary } from './chunk-NX25C7JZ.mjs';
|
|
5
5
|
export { buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildTraceStats, extractMetadata, filterTraces, formatStepLabel, renderRunWhat, renderTimeline, renderTraceStats } from './chunk-NX25C7JZ.mjs';
|
|
@@ -11,13 +11,13 @@ import { escapeHtml, flattenTree } from './chunk-CAWPF22J.mjs';
|
|
|
11
11
|
import { resolveRedactionProfile, readTraceEventsFromFile, stringContainsHighConfidenceCredential } from './chunk-EOXUEQB6.mjs';
|
|
12
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-EOXUEQB6.mjs';
|
|
13
13
|
import { Redactor } from './chunk-VLVCLAPB.mjs';
|
|
14
|
-
import { openTrace } from './chunk-
|
|
15
|
-
import './chunk-
|
|
14
|
+
import { openTrace } from './chunk-JJSL346L.mjs';
|
|
15
|
+
import './chunk-77PUPLPG.mjs';
|
|
16
16
|
import { projectLogicalEvents } from './chunk-AHUZNHFI.mjs';
|
|
17
17
|
import './chunk-S4YWKV4G.mjs';
|
|
18
18
|
import './chunk-S6LQBLX5.mjs';
|
|
19
|
-
import './chunk-
|
|
20
|
-
import './chunk-
|
|
19
|
+
import './chunk-J2ST4VCX.mjs';
|
|
20
|
+
import './chunk-AN5MOADW.mjs';
|
|
21
21
|
import { parseDuration, isTraceEvent, getTraceFilePath } from './chunk-7DHSWDKB.mjs';
|
|
22
22
|
export { DEFAULT_TRACE_DIR_NAME, FALLBACK_TRACE_DIR, MAX_NAME_LENGTH, RUNS_DIR_NAME, createRunId, createStepId, ensureTraceDir, formatDuration, formatError, formatTimestamp, getDefaultTraceDir, getTraceFilePath, isStepStatus, isStepType, isTraceEvent, parseDuration, parseTraceJsonl, truncateName, unknownTraceFormatMessage, warn } from './chunk-7DHSWDKB.mjs';
|
|
23
23
|
import { persistedInspectEventsToTraceEvents } from './chunk-EE5Z2GQ3.mjs';
|
|
@@ -1706,10 +1706,24 @@ function evaluateToolArgumentValue(value, check, evidencePresent) {
|
|
|
1706
1706
|
|
|
1707
1707
|
// packages/core/src/persisted/delivery-identity.ts
|
|
1708
1708
|
var DELIVERY_CONFLICT_ATTR = "agent_inspect.delivery_conflict";
|
|
1709
|
-
var
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1709
|
+
var DELIVERY_EVENT_BASE_ATTR = "agent_inspect.delivery_event_base";
|
|
1710
|
+
var IDENTITY_CONFLICT_ATTR = {
|
|
1711
|
+
/** Comma-separated field names when a conflict survives lossy bounding. */
|
|
1712
|
+
fields: "agent_inspect.identity_conflict.fields"
|
|
1713
|
+
};
|
|
1714
|
+
var MAX_CONFLICT_FIELDS = 8;
|
|
1715
|
+
var MAX_DELIVERY_BASE_LEN = 500;
|
|
1716
|
+
function stripReaderDeliveryDiscriminator(eventId, attributes) {
|
|
1717
|
+
if (!eventId) return eventId;
|
|
1718
|
+
const rawBase = attributes?.[DELIVERY_EVENT_BASE_ATTR];
|
|
1719
|
+
if (typeof rawBase !== "string" || rawBase.trim() === "") return eventId;
|
|
1720
|
+
const base = rawBase.trim().slice(0, MAX_DELIVERY_BASE_LEN);
|
|
1721
|
+
if (eventId === base) return base;
|
|
1722
|
+
const prefix = `${base}:`;
|
|
1723
|
+
if (!eventId.startsWith(prefix)) return eventId;
|
|
1724
|
+
const suffix = eventId.slice(prefix.length);
|
|
1725
|
+
if (/^\d+$/.test(suffix)) return base;
|
|
1726
|
+
return eventId;
|
|
1713
1727
|
}
|
|
1714
1728
|
function canonicalDigest(value) {
|
|
1715
1729
|
if (value === void 0) return null;
|
|
@@ -1743,7 +1757,7 @@ function timeKey(fields) {
|
|
|
1743
1757
|
function deliverySemanticFingerprint(fields) {
|
|
1744
1758
|
const content = capturedContentDigest(fields.attributes);
|
|
1745
1759
|
return JSON.stringify({
|
|
1746
|
-
stableEventId: stripReaderDeliveryDiscriminator(fields.eventId),
|
|
1760
|
+
stableEventId: stripReaderDeliveryDiscriminator(fields.eventId, fields.attributes),
|
|
1747
1761
|
runId: fields.runId,
|
|
1748
1762
|
kind: fields.kind,
|
|
1749
1763
|
name: fields.name,
|
|
@@ -1759,6 +1773,11 @@ function deliverySemanticFingerprint(fields) {
|
|
|
1759
1773
|
resultDigest: content.result
|
|
1760
1774
|
});
|
|
1761
1775
|
}
|
|
1776
|
+
function identityConflictFieldsFromAttributes(attributes) {
|
|
1777
|
+
const raw = attributes?.[IDENTITY_CONFLICT_ATTR.fields];
|
|
1778
|
+
if (typeof raw !== "string" || raw.trim() === "") return [];
|
|
1779
|
+
return raw.split(",").map((part) => part.trim()).filter((part) => part.length > 0).slice(0, MAX_CONFLICT_FIELDS);
|
|
1780
|
+
}
|
|
1762
1781
|
function hasDeliveryConflictMarker(attributes) {
|
|
1763
1782
|
return attributes?.[DELIVERY_CONFLICT_ATTR] === true;
|
|
1764
1783
|
}
|
|
@@ -1928,13 +1947,19 @@ function directNestedIdentityConflicts(event) {
|
|
|
1928
1947
|
const attrs2 = event.attributes;
|
|
1929
1948
|
if (!attrs2 || typeof attrs2 !== "object") return [];
|
|
1930
1949
|
const nested = attrs2.metadata && typeof attrs2.metadata === "object" && !Array.isArray(attrs2.metadata) ? attrs2.metadata : void 0;
|
|
1931
|
-
if (!nested) return [];
|
|
1932
1950
|
const conflicts = [];
|
|
1933
|
-
|
|
1934
|
-
const
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1951
|
+
if (nested) {
|
|
1952
|
+
for (const key of IDENTITY_KEYS) {
|
|
1953
|
+
const direct = attrs2[key];
|
|
1954
|
+
const nestedValue = nested[key];
|
|
1955
|
+
if (direct === void 0 || nestedValue === void 0) continue;
|
|
1956
|
+
if (!identityValuesEqual(direct, nestedValue)) {
|
|
1957
|
+
conflicts.push(key);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
for (const key of identityConflictFieldsFromAttributes(attrs2)) {
|
|
1962
|
+
if (IDENTITY_KEYS.includes(key) && !conflicts.includes(key)) {
|
|
1938
1963
|
conflicts.push(key);
|
|
1939
1964
|
}
|
|
1940
1965
|
}
|