agent-inspect 6.29.0 → 6.29.2
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 +18 -0
- package/README.md +1 -1
- package/docs/API.md +4 -0
- package/docs/CLI.md +21 -1
- package/docs/LIMITATIONS.md +2 -1
- package/docs/NETWORK-BEHAVIOR.md +8 -0
- package/docs/SAFE-TRACE-SHARING.md +1 -1
- package/docs/STANDARDS.md +1 -1
- package/docs/TRACE-CONTRACTS.md +11 -0
- package/package.json +2 -2
- package/packages/cli/dist/{chunk-D7PT6TXM.mjs → chunk-UK4HD5M3.mjs} +126 -26
- package/packages/cli/dist/chunk-UK4HD5M3.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +240 -106
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +108 -82
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-QONEBW2F.mjs → src-CMPIJGUE.mjs} +3 -3
- package/packages/cli/dist/{src-QONEBW2F.mjs.map → src-CMPIJGUE.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +138 -25
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +13 -2
- package/packages/core/dist/advanced.d.ts +13 -2
- package/packages/core/dist/advanced.mjs +109 -33
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/checks.cjs +240 -35
- 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-TNOPL75V.mjs → chunk-5RF7FYGL.mjs} +3 -3
- package/packages/core/dist/{chunk-TNOPL75V.mjs.map → chunk-5RF7FYGL.mjs.map} +1 -1
- package/packages/core/dist/{chunk-3B24355S.mjs → chunk-65LFRW2T.mjs} +3 -3
- package/packages/core/dist/{chunk-3B24355S.mjs.map → chunk-65LFRW2T.mjs.map} +1 -1
- package/packages/core/dist/{chunk-MVRZ7JBH.mjs → chunk-COZPMOUF.mjs} +3 -3
- package/packages/core/dist/{chunk-MVRZ7JBH.mjs.map → chunk-COZPMOUF.mjs.map} +1 -1
- package/packages/core/dist/{chunk-LGTPSHH2.mjs → chunk-QZIXYP7U.mjs} +243 -38
- package/packages/core/dist/chunk-QZIXYP7U.mjs.map +1 -0
- package/packages/core/dist/{chunk-TIGBAVED.mjs → chunk-XRI3GB6I.mjs} +42 -5
- package/packages/core/dist/chunk-XRI3GB6I.mjs.map +1 -0
- package/packages/core/dist/exporters.cjs +10 -5
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.d.cts +12 -2
- package/packages/core/dist/exporters.d.ts +12 -2
- package/packages/core/dist/exporters.mjs +13 -8
- package/packages/core/dist/exporters.mjs.map +1 -1
- package/packages/core/dist/{index-C61p7wBR.d.cts → index-BaQ48jrq.d.cts} +9 -1
- package/packages/core/dist/{index-DTO2iGeq.d.ts → index-CrnEOoRu.d.ts} +9 -1
- package/packages/core/dist/index.cjs +38 -1
- package/packages/core/dist/index.cjs.map +1 -1
- package/packages/core/dist/index.mjs +4 -4
- package/packages/core/dist/writers.mjs +1 -1
- package/packages/cli/dist/chunk-D7PT6TXM.mjs.map +0 -1
- package/packages/core/dist/chunk-LGTPSHH2.mjs.map +0 -1
- package/packages/core/dist/chunk-TIGBAVED.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OBSERVED_OUTCOME_METHODS, extractOutcomesFromPersistedEvents, outcomesMatchingStatus } from './chunk-
|
|
1
|
+
import { OBSERVED_OUTCOME_METHODS, extractOutcomesFromPersistedEvents, outcomesMatchingStatus } from './chunk-COZPMOUF.mjs';
|
|
2
2
|
import { formatProgrammaticDiagnostic } from './chunk-FWK3Q3OJ.mjs';
|
|
3
3
|
|
|
4
4
|
// packages/core/src/sessions/metadata.ts
|
|
@@ -1342,6 +1342,76 @@ function evaluateControlRules(events, rules, runEvidence2, observationNames) {
|
|
|
1342
1342
|
return findings;
|
|
1343
1343
|
}
|
|
1344
1344
|
|
|
1345
|
+
// packages/core/src/checks/canonical-equality.ts
|
|
1346
|
+
var DEFAULT_MAX_DEPTH = 8;
|
|
1347
|
+
var DEFAULT_MAX_BYTES = 16384;
|
|
1348
|
+
function sortKeysDeep(input, depth, maxDepth) {
|
|
1349
|
+
if (depth > maxDepth) {
|
|
1350
|
+
throw new Error("AI_CHECK_CANONICAL_DEPTH_EXCEEDED");
|
|
1351
|
+
}
|
|
1352
|
+
if (input === null || typeof input !== "object") return input;
|
|
1353
|
+
if (Array.isArray(input)) {
|
|
1354
|
+
return input.map((item) => sortKeysDeep(item, depth + 1, maxDepth));
|
|
1355
|
+
}
|
|
1356
|
+
const record = input;
|
|
1357
|
+
const out = {};
|
|
1358
|
+
for (const key of Object.keys(record).sort()) {
|
|
1359
|
+
out[key] = sortKeysDeep(record[key], depth + 1, maxDepth);
|
|
1360
|
+
}
|
|
1361
|
+
return out;
|
|
1362
|
+
}
|
|
1363
|
+
function encodeCanonicalStructured(value, limits) {
|
|
1364
|
+
const maxDepth = DEFAULT_MAX_DEPTH;
|
|
1365
|
+
const maxBytes = DEFAULT_MAX_BYTES;
|
|
1366
|
+
try {
|
|
1367
|
+
const sorted = sortKeysDeep(value, 0, maxDepth);
|
|
1368
|
+
const encoded = JSON.stringify(sorted);
|
|
1369
|
+
if (encoded === void 0) {
|
|
1370
|
+
return {
|
|
1371
|
+
ok: false,
|
|
1372
|
+
reason: "Value is not JSON-serializable for canonical comparison.",
|
|
1373
|
+
code: "AI_CHECK_CANONICAL_UNSERIALIZABLE"
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1376
|
+
if (Buffer.byteLength(encoded, "utf8") > maxBytes) {
|
|
1377
|
+
return {
|
|
1378
|
+
ok: false,
|
|
1379
|
+
reason: "Canonical structured value exceeds bounded size limit.",
|
|
1380
|
+
code: "AI_CHECK_CANONICAL_SIZE_EXCEEDED"
|
|
1381
|
+
};
|
|
1382
|
+
}
|
|
1383
|
+
return { ok: true, value: encoded };
|
|
1384
|
+
} catch (error) {
|
|
1385
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1386
|
+
if (message === "AI_CHECK_CANONICAL_DEPTH_EXCEEDED") {
|
|
1387
|
+
return {
|
|
1388
|
+
ok: false,
|
|
1389
|
+
reason: "Canonical structured value exceeds bounded depth limit.",
|
|
1390
|
+
code: "AI_CHECK_CANONICAL_DEPTH_EXCEEDED"
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
return {
|
|
1394
|
+
ok: false,
|
|
1395
|
+
reason: "Canonical structured encoding failed.",
|
|
1396
|
+
code: "AI_CHECK_CANONICAL_UNSERIALIZABLE"
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
function canonicalStructuredEqual(left, right, limits) {
|
|
1401
|
+
const a = encodeCanonicalStructured(left);
|
|
1402
|
+
if (!a.ok) return { equal: false, reason: a.reason, code: a.code };
|
|
1403
|
+
const b = encodeCanonicalStructured(right);
|
|
1404
|
+
if (!b.ok) return { equal: false, reason: b.reason, code: b.code };
|
|
1405
|
+
if (a.value !== b.value) {
|
|
1406
|
+
return {
|
|
1407
|
+
equal: false,
|
|
1408
|
+
reason: "Canonical structured values differ.",
|
|
1409
|
+
code: "AI_CHECK_CANONICAL_NOT_EQUAL"
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
return { equal: true };
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1345
1415
|
// packages/core/src/checks/tool-arguments.ts
|
|
1346
1416
|
function decodeToken(token) {
|
|
1347
1417
|
return token.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
@@ -1387,17 +1457,30 @@ function jsonType(value) {
|
|
|
1387
1457
|
return typeof value;
|
|
1388
1458
|
}
|
|
1389
1459
|
function valuesEqual(left, right) {
|
|
1390
|
-
return
|
|
1460
|
+
return canonicalStructuredEqual(left, right).equal === true;
|
|
1461
|
+
}
|
|
1462
|
+
function isStructuredArgumentEvidence(value) {
|
|
1463
|
+
return value !== void 0 && value !== null && typeof value === "object";
|
|
1391
1464
|
}
|
|
1392
1465
|
function extractToolArgumentPayload(event) {
|
|
1393
1466
|
const attrs2 = event.attributes ?? {};
|
|
1394
1467
|
for (const key of ["arguments", "input", "toolArguments"]) {
|
|
1395
1468
|
const candidate = attrs2[key];
|
|
1396
|
-
if (candidate
|
|
1469
|
+
if (isStructuredArgumentEvidence(candidate)) {
|
|
1397
1470
|
return { present: true, value: candidate };
|
|
1398
1471
|
}
|
|
1399
1472
|
}
|
|
1400
|
-
|
|
1473
|
+
const metadata = attrs2.metadata;
|
|
1474
|
+
if (isStructuredArgumentEvidence(metadata) && !Array.isArray(metadata)) {
|
|
1475
|
+
const nested = metadata;
|
|
1476
|
+
for (const key of ["arguments", "input", "toolArguments"]) {
|
|
1477
|
+
const candidate = nested[key];
|
|
1478
|
+
if (isStructuredArgumentEvidence(candidate)) {
|
|
1479
|
+
return { present: true, value: candidate };
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
if (isStructuredArgumentEvidence(event.inputSummary)) {
|
|
1401
1484
|
return { present: true, value: event.inputSummary };
|
|
1402
1485
|
}
|
|
1403
1486
|
return { present: false, value: void 0 };
|
|
@@ -1860,11 +1943,9 @@ function argumentDigestOf(event) {
|
|
|
1860
1943
|
function argumentFingerprint(event) {
|
|
1861
1944
|
const payload = extractToolArgumentPayload(event);
|
|
1862
1945
|
if (payload.present) {
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
return { kind: "missing" };
|
|
1867
|
-
}
|
|
1946
|
+
const encoded = encodeCanonicalStructured(payload.value);
|
|
1947
|
+
if (!encoded.ok) return { kind: "missing" };
|
|
1948
|
+
return { kind: "structured", value: encoded.value };
|
|
1868
1949
|
}
|
|
1869
1950
|
const digest = argumentDigestOf(event);
|
|
1870
1951
|
if (digest) return { kind: "digest", value: digest };
|
|
@@ -1959,19 +2040,84 @@ function llmReferencesTool(llm, toolEvent, requireExplicit) {
|
|
|
1959
2040
|
if (toolCallId && refs.has(toolCallId)) return true;
|
|
1960
2041
|
return false;
|
|
1961
2042
|
}
|
|
2043
|
+
function attemptIdOf2(event) {
|
|
2044
|
+
const value = workflowFor2(event).attemptId;
|
|
2045
|
+
return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
2046
|
+
}
|
|
2047
|
+
function hasDuplicateAttemptIds2(members) {
|
|
2048
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2049
|
+
for (const event of members) {
|
|
2050
|
+
const id = attemptIdOf2(event);
|
|
2051
|
+
if (!id) continue;
|
|
2052
|
+
if (seen.has(id)) return true;
|
|
2053
|
+
seen.add(id);
|
|
2054
|
+
}
|
|
2055
|
+
return false;
|
|
2056
|
+
}
|
|
2057
|
+
function findRetryTarget(members, retryOf) {
|
|
2058
|
+
return members.find(
|
|
2059
|
+
(candidate) => candidate.eventId === retryOf || attemptIdOf2(candidate) === retryOf || workflowFor2(candidate).operationId === retryOf
|
|
2060
|
+
);
|
|
2061
|
+
}
|
|
1962
2062
|
function groupToolAttempts(events, toolName2) {
|
|
2063
|
+
const members = events.filter(
|
|
2064
|
+
(event) => event.kind === "TOOL" && resolveCanonicalToolName(event) === toolName2
|
|
2065
|
+
);
|
|
2066
|
+
const parent = /* @__PURE__ */ new Map();
|
|
2067
|
+
const ensure = (id) => {
|
|
2068
|
+
if (!parent.has(id)) parent.set(id, id);
|
|
2069
|
+
return id;
|
|
2070
|
+
};
|
|
2071
|
+
const find = (id) => {
|
|
2072
|
+
ensure(id);
|
|
2073
|
+
let cur = id;
|
|
2074
|
+
while (parent.get(cur) !== cur) {
|
|
2075
|
+
cur = parent.get(cur);
|
|
2076
|
+
}
|
|
2077
|
+
let walk = id;
|
|
2078
|
+
while (parent.get(walk) !== cur) {
|
|
2079
|
+
const next = parent.get(walk);
|
|
2080
|
+
parent.set(walk, cur);
|
|
2081
|
+
walk = next;
|
|
2082
|
+
}
|
|
2083
|
+
return cur;
|
|
2084
|
+
};
|
|
2085
|
+
const union = (a, b) => {
|
|
2086
|
+
const ra = find(a);
|
|
2087
|
+
const rb = find(b);
|
|
2088
|
+
if (ra !== rb) parent.set(ra, rb);
|
|
2089
|
+
};
|
|
2090
|
+
const nodeId = (event) => {
|
|
2091
|
+
const operationId = workflowFor2(event).operationId;
|
|
2092
|
+
if (typeof operationId === "string" && operationId.trim() !== "") {
|
|
2093
|
+
return `op:${operationId.trim()}`;
|
|
2094
|
+
}
|
|
2095
|
+
return `event:${event.eventId}`;
|
|
2096
|
+
};
|
|
2097
|
+
for (const event of members) {
|
|
2098
|
+
ensure(nodeId(event));
|
|
2099
|
+
}
|
|
2100
|
+
for (const event of members) {
|
|
2101
|
+
const retryOf = workflowFor2(event).retryOf;
|
|
2102
|
+
if (typeof retryOf !== "string" || retryOf.trim() === "") continue;
|
|
2103
|
+
const target = findRetryTarget(members, retryOf.trim());
|
|
2104
|
+
if (target) {
|
|
2105
|
+
union(nodeId(event), nodeId(target));
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
1963
2108
|
const groups = /* @__PURE__ */ new Map();
|
|
1964
|
-
for (const event of
|
|
1965
|
-
|
|
1966
|
-
if (resolveCanonicalToolName(event) !== toolName2) continue;
|
|
1967
|
-
const workflow = workflowFor2(event);
|
|
1968
|
-
const key = workflow.operationId ?? `__tool__:${toolName2}`;
|
|
2109
|
+
for (const event of members) {
|
|
2110
|
+
const key = find(nodeId(event));
|
|
1969
2111
|
const list = groups.get(key) ?? [];
|
|
1970
2112
|
list.push(event);
|
|
1971
2113
|
groups.set(key, list);
|
|
1972
2114
|
}
|
|
1973
2115
|
return groups;
|
|
1974
2116
|
}
|
|
2117
|
+
function latestAttempt(ordered) {
|
|
2118
|
+
if (ordered.length === 0) return void 0;
|
|
2119
|
+
return ordered[ordered.length - 1];
|
|
2120
|
+
}
|
|
1975
2121
|
function evaluateRecoveryOperations(events, operations) {
|
|
1976
2122
|
const findings = [];
|
|
1977
2123
|
const llmEvents = events.filter((event) => event.kind === "LLM");
|
|
@@ -1994,6 +2140,17 @@ function evaluateRecoveryOperations(events, operations) {
|
|
|
1994
2140
|
}
|
|
1995
2141
|
for (const [operationKey, members] of groups) {
|
|
1996
2142
|
const ordered = sortByTime2(members);
|
|
2143
|
+
if (hasDuplicateAttemptIds2(members)) {
|
|
2144
|
+
findings.push(
|
|
2145
|
+
fail3(
|
|
2146
|
+
"contract.retry.operations.duplicate-attempt-id",
|
|
2147
|
+
`Tool ${operation.tool} operation ${operationKey} has duplicate attemptId values.`,
|
|
2148
|
+
members.slice(0, 4).map(eventEvidence2),
|
|
2149
|
+
"unique attemptId",
|
|
2150
|
+
"duplicate"
|
|
2151
|
+
)
|
|
2152
|
+
);
|
|
2153
|
+
}
|
|
1997
2154
|
if (operation.maxAttempts !== void 0) {
|
|
1998
2155
|
const count = countOperationAttempts(members);
|
|
1999
2156
|
if (count > operation.maxAttempts) {
|
|
@@ -2030,8 +2187,21 @@ function evaluateRecoveryOperations(events, operations) {
|
|
|
2030
2187
|
let sawEarlierError = false;
|
|
2031
2188
|
let sawLaterOkAfterError = false;
|
|
2032
2189
|
let lastOk;
|
|
2190
|
+
let identityUnavailable = false;
|
|
2033
2191
|
for (const event of ordered) {
|
|
2034
2192
|
const classification = classifyRetryAttempt(event, prior, members);
|
|
2193
|
+
if (classification.kind === "unknown") {
|
|
2194
|
+
identityUnavailable = true;
|
|
2195
|
+
findings.push(
|
|
2196
|
+
fail3(
|
|
2197
|
+
"contract.retry.operations.attempt-identity",
|
|
2198
|
+
`Tool ${operation.tool} operation ${operationKey} has ambiguous attempt identity (${classification.reason}).`,
|
|
2199
|
+
[eventEvidence2(event)],
|
|
2200
|
+
"explicit operationId/attemptId/retryOf chronology",
|
|
2201
|
+
{ code: "AI_CHECK_RECOVERY_ATTEMPT_IDENTITY_UNAVAILABLE", reason: classification.reason }
|
|
2202
|
+
)
|
|
2203
|
+
);
|
|
2204
|
+
}
|
|
2035
2205
|
const isRetry = classification.kind === "retry";
|
|
2036
2206
|
if (isRetry && operation.requireFailureBeforeRetry) {
|
|
2037
2207
|
const earlierFailure = prior.some(
|
|
@@ -2066,6 +2236,16 @@ function evaluateRecoveryOperations(events, operations) {
|
|
|
2066
2236
|
)
|
|
2067
2237
|
);
|
|
2068
2238
|
}
|
|
2239
|
+
} else {
|
|
2240
|
+
findings.push(
|
|
2241
|
+
fail3(
|
|
2242
|
+
"contract.retry.operations.retryable-error",
|
|
2243
|
+
`Retry of tool ${operation.tool} has no prior error code evidence.`,
|
|
2244
|
+
[eventEvidence2(event)],
|
|
2245
|
+
[...allowed],
|
|
2246
|
+
null
|
|
2247
|
+
)
|
|
2248
|
+
);
|
|
2069
2249
|
}
|
|
2070
2250
|
}
|
|
2071
2251
|
if (isRetry && (operation.requireSameArguments === true || operation.requireSameArguments === "structured-or-digest")) {
|
|
@@ -2083,6 +2263,16 @@ function evaluateRecoveryOperations(events, operations) {
|
|
|
2083
2263
|
)
|
|
2084
2264
|
);
|
|
2085
2265
|
}
|
|
2266
|
+
} else {
|
|
2267
|
+
findings.push(
|
|
2268
|
+
fail3(
|
|
2269
|
+
"contract.retry.operations.same-arguments",
|
|
2270
|
+
"Structured or digest argument evidence unavailable for same-arguments check.",
|
|
2271
|
+
[eventEvidence2(event)],
|
|
2272
|
+
"matching structured args or digests",
|
|
2273
|
+
{ code: "AI_CHECK_RECOVERY_ARGUMENT_EVIDENCE_UNAVAILABLE" }
|
|
2274
|
+
)
|
|
2275
|
+
);
|
|
2086
2276
|
}
|
|
2087
2277
|
}
|
|
2088
2278
|
if (event.status === "error") {
|
|
@@ -2095,23 +2285,23 @@ function evaluateRecoveryOperations(events, operations) {
|
|
|
2095
2285
|
}
|
|
2096
2286
|
prior.push(event);
|
|
2097
2287
|
}
|
|
2288
|
+
const latest = latestAttempt(ordered);
|
|
2098
2289
|
if (operation.requireTerminalSuccess) {
|
|
2099
|
-
|
|
2100
|
-
if (!hasOk) {
|
|
2290
|
+
if (!latest || latest.status !== "ok") {
|
|
2101
2291
|
findings.push(
|
|
2102
2292
|
fail3(
|
|
2103
2293
|
"contract.retry.operations.terminal-success",
|
|
2104
|
-
`Tool ${operation.tool} operation ${operationKey}
|
|
2294
|
+
`Tool ${operation.tool} operation ${operationKey} does not terminate with ok on the latest attempt.`,
|
|
2105
2295
|
ordered.slice(0, 4).map(eventEvidence2),
|
|
2106
|
-
"ok",
|
|
2107
|
-
|
|
2296
|
+
"latest attempt ok",
|
|
2297
|
+
latest?.status ?? "missing"
|
|
2108
2298
|
)
|
|
2109
2299
|
);
|
|
2110
2300
|
}
|
|
2111
2301
|
}
|
|
2112
2302
|
if (operation.requireRecoveredFailureVisible) {
|
|
2113
|
-
const
|
|
2114
|
-
if (ordered.length > 1 &&
|
|
2303
|
+
const latestOk = latest?.status === "ok";
|
|
2304
|
+
if (ordered.length > 1 && latestOk && !sawLaterOkAfterError) {
|
|
2115
2305
|
findings.push(
|
|
2116
2306
|
fail3(
|
|
2117
2307
|
"contract.retry.operations.recovered-failure-visible",
|
|
@@ -2124,21 +2314,36 @@ function evaluateRecoveryOperations(events, operations) {
|
|
|
2124
2314
|
}
|
|
2125
2315
|
}
|
|
2126
2316
|
const dependency = operation.successfulResultDependency;
|
|
2127
|
-
if (dependency?.consumerKind === "LLM"
|
|
2128
|
-
const
|
|
2129
|
-
|
|
2130
|
-
(
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2317
|
+
if (dependency?.consumerKind === "LLM") {
|
|
2318
|
+
const successForDependency = latest?.status === "ok" ? latest : identityUnavailable ? void 0 : lastOk;
|
|
2319
|
+
if (successForDependency) {
|
|
2320
|
+
if (sideEffectClass === "write" && isUnevaluableWriteCompletion(successForDependency) && !hasIdempotencyEvidence2(successForDependency)) {
|
|
2321
|
+
findings.push(
|
|
2322
|
+
fail3(
|
|
2323
|
+
"contract.retry.operations.successful-result-dependency",
|
|
2324
|
+
`Successful ${operation.tool} result dependency is unevaluable because write completion evidence is unavailable.`,
|
|
2325
|
+
[eventEvidence2(successForDependency)],
|
|
2326
|
+
"LLM reference to successful tool event",
|
|
2327
|
+
{ code: "AI_CHECK_RECOVERY_WRITE_COMPLETION_UNAVAILABLE" }
|
|
2328
|
+
)
|
|
2329
|
+
);
|
|
2330
|
+
} else {
|
|
2331
|
+
const requireExplicit = dependency.requireExplicitReference === true;
|
|
2332
|
+
const referenced = llmEvents.some(
|
|
2333
|
+
(llmEvent) => llmReferencesTool(llmEvent, successForDependency, requireExplicit)
|
|
2334
|
+
);
|
|
2335
|
+
if (!referenced) {
|
|
2336
|
+
findings.push(
|
|
2337
|
+
fail3(
|
|
2338
|
+
"contract.retry.operations.successful-result-dependency",
|
|
2339
|
+
requireExplicit ? `Successful ${operation.tool} result is not explicitly referenced by a later LLM event.` : `Successful ${operation.tool} result has no later LLM consumer.`,
|
|
2340
|
+
[eventEvidence2(successForDependency)],
|
|
2341
|
+
"LLM reference to successful tool event",
|
|
2342
|
+
{ code: "AI_CHECK_RECOVERY_RESULT_DEPENDENCY_MISSING" }
|
|
2343
|
+
)
|
|
2344
|
+
);
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2142
2347
|
}
|
|
2143
2348
|
}
|
|
2144
2349
|
}
|
|
@@ -5129,5 +5334,5 @@ function runTraceChecks(input, options = {}) {
|
|
|
5129
5334
|
}
|
|
5130
5335
|
|
|
5131
5336
|
export { buildTraceFacts, createBaselineRegressionRule, createDecisionRule, createGuardrailRule, createLlmUsageRule, createMaxStepDurationRule, createObservedOutcomeRule, createRequireCompletedRule, createRetrievalRule, createRunDepthRule, createRunDurationRule, createRunEventCountRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStructureCycleRule, createStructureIncompleteRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolFailureRule, createToolOrderingRule, createToolUsageRule, defineTraceContract, deriveFailureFacts, deriveRelationshipFacts, evaluateToolArgumentValue, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, extractSessionWorkflowMetadata, extractToolArgumentPayload, lintTraceContract, projectLogicalEvents, resolveCanonicalToolName, resolveJsonPointer, resolveTraceContractScope, runTraceChecks, sessionKeyForRun, summarizeSemanticParity, workflowMetadataForRun };
|
|
5132
|
-
//# sourceMappingURL=chunk-
|
|
5133
|
-
//# sourceMappingURL=chunk-
|
|
5337
|
+
//# sourceMappingURL=chunk-QZIXYP7U.mjs.map
|
|
5338
|
+
//# sourceMappingURL=chunk-QZIXYP7U.mjs.map
|