agent-inspect 6.31.34 → 6.31.35
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/LIMITATIONS.md +22 -0
- package/docs/SAFE-TRACE-SHARING.md +1 -1
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-6TXW53UR.mjs → chunk-RLFYFWIZ.mjs} +46 -7
- package/packages/cli/dist/chunk-RLFYFWIZ.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +46 -7
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +4 -4
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-GCLC4DIC.mjs → src-S23RCPL2.mjs} +3 -3
- package/packages/cli/dist/{src-GCLC4DIC.mjs.map → src-S23RCPL2.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +44 -5
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +2 -2
- package/packages/core/dist/checks.cjs +44 -5
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.mjs +1 -1
- package/packages/core/dist/{chunk-CXC7L4PY.mjs → chunk-3OMB34E6.mjs} +46 -7
- package/packages/core/dist/chunk-3OMB34E6.mjs.map +1 -0
- package/packages/cli/dist/chunk-6TXW53UR.mjs.map +0 -1
- package/packages/core/dist/chunk-CXC7L4PY.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-3OMB34E6.mjs';
|
|
2
|
+
export { extractSessionWorkflowMetadata, sessionKeyForRun } from './chunk-3OMB34E6.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-X5RP2E2H.mjs';
|
|
4
4
|
import { buildRunTimeline, filterTraces, extractMetadata, buildRunSummary } from './chunk-2SKAI5ZN.mjs';
|
|
5
5
|
export { buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildTraceStats, extractMetadata, filterTraces, formatStepLabel, renderRunWhat, renderTimeline, renderTraceStats } from './chunk-2SKAI5ZN.mjs';
|
|
@@ -4160,11 +4160,27 @@ function eventTimestamp(finding, eventById) {
|
|
|
4160
4160
|
const eventId = finding.evidence[0]?.eventId;
|
|
4161
4161
|
return eventId ? eventById.get(eventId)?.timestamp ?? "" : "";
|
|
4162
4162
|
}
|
|
4163
|
+
function isObservedToolPolicyFinding(finding) {
|
|
4164
|
+
return finding.ruleId === "tool.usage" && finding.evidence[0]?.eventId !== void 0;
|
|
4165
|
+
}
|
|
4166
|
+
function isMissingToolConsequenceFinding(finding) {
|
|
4167
|
+
if (finding.evidence[0]?.eventId !== void 0) return false;
|
|
4168
|
+
if (finding.ruleId === "tool.usage" && /did not appear/.test(finding.message)) {
|
|
4169
|
+
return true;
|
|
4170
|
+
}
|
|
4171
|
+
return finding.ruleId.startsWith("contract.tool.arguments") && /^No finished tool named /.test(finding.message);
|
|
4172
|
+
}
|
|
4163
4173
|
function compareFindings(eventById) {
|
|
4164
4174
|
return (a, b) => {
|
|
4165
4175
|
if (SEVERITY_RANK[a.severity] !== SEVERITY_RANK[b.severity]) {
|
|
4166
4176
|
return SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity];
|
|
4167
4177
|
}
|
|
4178
|
+
const aPolicy = isObservedToolPolicyFinding(a);
|
|
4179
|
+
const bPolicy = isObservedToolPolicyFinding(b);
|
|
4180
|
+
const aMissing = isMissingToolConsequenceFinding(a);
|
|
4181
|
+
const bMissing = isMissingToolConsequenceFinding(b);
|
|
4182
|
+
if (aPolicy && bMissing) return -1;
|
|
4183
|
+
if (bPolicy && aMissing) return 1;
|
|
4168
4184
|
const byRule = a.ruleId.localeCompare(b.ruleId);
|
|
4169
4185
|
if (byRule !== 0) return byRule;
|
|
4170
4186
|
if (STATUS_RANK[a.status] !== STATUS_RANK[b.status]) {
|
|
@@ -4300,20 +4316,43 @@ function failFinding(ruleId, message, evidence, expected, actual, meta) {
|
|
|
4300
4316
|
function toolName(event) {
|
|
4301
4317
|
return resolveCanonicalToolName(event);
|
|
4302
4318
|
}
|
|
4319
|
+
var MAX_TOOL_NAME_CODEPOINT_DETAILS = 3;
|
|
4320
|
+
function isAsciiLetterCodePoint(codePoint) {
|
|
4321
|
+
return codePoint >= 65 && codePoint <= 90 || codePoint >= 97 && codePoint <= 122;
|
|
4322
|
+
}
|
|
4323
|
+
function isRiskyToolNameCodePoint(codePoint) {
|
|
4324
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) return true;
|
|
4325
|
+
return codePoint === 1564 || codePoint === 8203 || codePoint === 8204 || codePoint === 8205 || codePoint === 8206 || codePoint === 8207 || codePoint >= 8234 && codePoint <= 8238 || codePoint >= 8294 && codePoint <= 8297 || codePoint === 65279;
|
|
4326
|
+
}
|
|
4327
|
+
function formatCodePointDetail(codePoint, index) {
|
|
4328
|
+
return `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")} at index ${index}`;
|
|
4329
|
+
}
|
|
4303
4330
|
function formatToolNameForMessage(name) {
|
|
4331
|
+
let hasAsciiLetter = false;
|
|
4332
|
+
let hasNonAscii = false;
|
|
4333
|
+
let hasRisky = false;
|
|
4304
4334
|
const details = [];
|
|
4305
4335
|
for (let index = 0; index < name.length; ) {
|
|
4306
4336
|
const codePoint = name.codePointAt(index);
|
|
4307
4337
|
const width = codePoint > 65535 ? 2 : 1;
|
|
4338
|
+
if (isAsciiLetterCodePoint(codePoint)) hasAsciiLetter = true;
|
|
4339
|
+
const risky = isRiskyToolNameCodePoint(codePoint);
|
|
4340
|
+
if (risky) hasRisky = true;
|
|
4308
4341
|
if (codePoint > 127) {
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4342
|
+
hasNonAscii = true;
|
|
4343
|
+
details.push(formatCodePointDetail(codePoint, index));
|
|
4344
|
+
} else if (risky) {
|
|
4345
|
+
details.push(formatCodePointDetail(codePoint, index));
|
|
4312
4346
|
}
|
|
4313
4347
|
index += width;
|
|
4314
4348
|
}
|
|
4315
|
-
if (details.length === 0)
|
|
4316
|
-
|
|
4349
|
+
if (!hasRisky && !(hasAsciiLetter && hasNonAscii) || details.length === 0) {
|
|
4350
|
+
return name;
|
|
4351
|
+
}
|
|
4352
|
+
const shown = details.slice(0, MAX_TOOL_NAME_CODEPOINT_DETAILS);
|
|
4353
|
+
const remaining = details.length - shown.length;
|
|
4354
|
+
const detailText = remaining > 0 ? `${shown.join("; ")}; and ${remaining} more` : shown.join("; ");
|
|
4355
|
+
return `"${name}" (contains ${detailText})`;
|
|
4317
4356
|
}
|
|
4318
4357
|
function describeRunningEvent(event) {
|
|
4319
4358
|
if (event.kind === "TOOL") {
|