agent-inspect 6.29.5 → 6.30.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +1 -1
  3. package/docs/CLI.md +27 -5
  4. package/docs/TRACE-CONTRACTS.md +10 -7
  5. package/package.json +1 -1
  6. package/packages/cli/dist/{chunk-XWQEHKGB.mjs → chunk-BDRJENLM.mjs} +2334 -102
  7. package/packages/cli/dist/chunk-BDRJENLM.mjs.map +1 -0
  8. package/packages/cli/dist/index.cjs +3122 -168
  9. package/packages/cli/dist/index.cjs.map +1 -1
  10. package/packages/cli/dist/index.mjs +793 -61
  11. package/packages/cli/dist/index.mjs.map +1 -1
  12. package/packages/cli/dist/{src-XNC4EUN3.mjs → src-ZUGAUXY6.mjs} +3 -3
  13. package/packages/cli/dist/{src-XNC4EUN3.mjs.map → src-ZUGAUXY6.mjs.map} +1 -1
  14. package/packages/core/dist/advanced.cjs +19 -1
  15. package/packages/core/dist/advanced.cjs.map +1 -1
  16. package/packages/core/dist/advanced.d.cts +2 -2
  17. package/packages/core/dist/advanced.d.ts +2 -2
  18. package/packages/core/dist/advanced.mjs +2 -2
  19. package/packages/core/dist/checks.cjs +33 -1
  20. package/packages/core/dist/checks.cjs.map +1 -1
  21. package/packages/core/dist/checks.d.cts +2 -2
  22. package/packages/core/dist/checks.d.ts +2 -2
  23. package/packages/core/dist/checks.mjs +1 -1
  24. package/packages/core/dist/{chunk-TU47EKKS.mjs → chunk-OOX25GTH.mjs} +35 -3
  25. package/packages/core/dist/chunk-OOX25GTH.mjs.map +1 -0
  26. package/packages/core/dist/{index-DvSbXNot.d.ts → index-7hG_qggp.d.ts} +5 -0
  27. package/packages/core/dist/{index-DKv7esIo.d.cts → index-CQJUNPPe.d.cts} +5 -0
  28. package/packages/cli/dist/chunk-XWQEHKGB.mjs.map +0 -1
  29. package/packages/core/dist/chunk-TU47EKKS.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 { aR as SessionWorkflowMetadata, aS as SessionRunRecord, aT as EnrichSessionSummaryOptions, aU as SessionStatus, aV as SessionSummary, aW as SessionIndex, aX as BuildActivitySummaryOptions, aY as ActivitySummary, aZ as SessionWarning, a_ as BuildSessionIndexOptions, N as TraceCheckResult, X as TraceCheckStatus, a2 as TraceContractInput, Z as TraceContract } from './index-DKv7esIo.cjs';
10
- export { a$ as ActivityEntry, b0 as CriticalPathStep, b1 as HandoffEdge, b2 as RetryLink, b3 as SESSION_WORKFLOW_KEYS, b4 as SessionCheckSummary, b5 as SessionConfidence, b6 as SessionEdgeSource, b7 as SessionGroup, b8 as SessionLastError, b9 as SessionWorkflowKey } from './index-DKv7esIo.cjs';
9
+ import { aR as SessionWorkflowMetadata, aS as SessionRunRecord, aT as EnrichSessionSummaryOptions, aU as SessionStatus, aV as SessionSummary, aW as SessionIndex, aX as BuildActivitySummaryOptions, aY as ActivitySummary, aZ as SessionWarning, a_ as BuildSessionIndexOptions, N as TraceCheckResult, X as TraceCheckStatus, a2 as TraceContractInput, Z as TraceContract } from './index-CQJUNPPe.cjs';
10
+ export { a$ as ActivityEntry, b0 as CriticalPathStep, b1 as HandoffEdge, b2 as RetryLink, b3 as SESSION_WORKFLOW_KEYS, b4 as SessionCheckSummary, b5 as SessionConfidence, b6 as SessionEdgeSource, b7 as SessionGroup, b8 as SessionLastError, b9 as SessionWorkflowKey } from './index-CQJUNPPe.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 { aR as SessionWorkflowMetadata, aS as SessionRunRecord, aT as EnrichSessionSummaryOptions, aU as SessionStatus, aV as SessionSummary, aW as SessionIndex, aX as BuildActivitySummaryOptions, aY as ActivitySummary, aZ as SessionWarning, a_ as BuildSessionIndexOptions, N as TraceCheckResult, X as TraceCheckStatus, a2 as TraceContractInput, Z as TraceContract } from './index-DvSbXNot.js';
10
- export { a$ as ActivityEntry, b0 as CriticalPathStep, b1 as HandoffEdge, b2 as RetryLink, b3 as SESSION_WORKFLOW_KEYS, b4 as SessionCheckSummary, b5 as SessionConfidence, b6 as SessionEdgeSource, b7 as SessionGroup, b8 as SessionLastError, b9 as SessionWorkflowKey } from './index-DvSbXNot.js';
9
+ import { aR as SessionWorkflowMetadata, aS as SessionRunRecord, aT as EnrichSessionSummaryOptions, aU as SessionStatus, aV as SessionSummary, aW as SessionIndex, aX as BuildActivitySummaryOptions, aY as ActivitySummary, aZ as SessionWarning, a_ as BuildSessionIndexOptions, N as TraceCheckResult, X as TraceCheckStatus, a2 as TraceContractInput, Z as TraceContract } from './index-7hG_qggp.js';
10
+ export { a$ as ActivityEntry, b0 as CriticalPathStep, b1 as HandoffEdge, b2 as RetryLink, b3 as SESSION_WORKFLOW_KEYS, b4 as SessionCheckSummary, b5 as SessionConfidence, b6 as SessionEdgeSource, b7 as SessionGroup, b8 as SessionLastError, b9 as SessionWorkflowKey } from './index-7hG_qggp.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,5 +1,5 @@
1
- import { extractSessionWorkflowMetadata, sessionKeyForRun, defineTraceContract, runTraceChecks, createRunStatusRule, createToolUsageRule, createRunDurationRule, createLlmUsageRule, createObservedOutcomeRule } from './chunk-TU47EKKS.mjs';
2
- export { extractSessionWorkflowMetadata, sessionKeyForRun } from './chunk-TU47EKKS.mjs';
1
+ import { extractSessionWorkflowMetadata, sessionKeyForRun, defineTraceContract, runTraceChecks, createRunStatusRule, createToolUsageRule, createRunDurationRule, createLlmUsageRule, createObservedOutcomeRule } from './chunk-OOX25GTH.mjs';
2
+ export { extractSessionWorkflowMetadata, sessionKeyForRun } from './chunk-OOX25GTH.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-ZFJ2ICTC.mjs';
4
4
  import { buildRunTimeline, filterTraces, extractMetadata, buildRunSummary } from './chunk-KWBO36PH.mjs';
5
5
  export { buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildTraceStats, extractMetadata, filterTraces, formatStepLabel, renderRunWhat, renderTimeline, renderTraceStats } from './chunk-KWBO36PH.mjs';
@@ -3981,6 +3981,18 @@ function limitFindings(findings, maxFindings) {
3981
3981
  function hasRedactionMarker(value, markers) {
3982
3982
  return markers.some((marker) => value.includes(marker)) || /^\[HASH:[A-Za-z0-9_-]+\]$/.test(value);
3983
3983
  }
3984
+ function isFullyRedactedValue(value, markers = ["[REDACTED]", "[REDACTED:"]) {
3985
+ if (typeof value !== "string") return false;
3986
+ const trimmed = value.trim();
3987
+ if (trimmed.length === 0) return false;
3988
+ if (/^\[HASH:[A-Za-z0-9_-]+\]$/.test(trimmed)) return true;
3989
+ if (/^\[REDACTED:[^\]]*\]$/.test(trimmed)) return true;
3990
+ for (const marker of markers) {
3991
+ if (marker.endsWith(":")) continue;
3992
+ if (trimmed === marker) return true;
3993
+ }
3994
+ return false;
3995
+ }
3984
3996
  function isSensitiveKey(key, sensitiveKeys) {
3985
3997
  return isCredentialSensitiveKey(key, sensitiveKeys);
3986
3998
  }
@@ -4335,8 +4347,26 @@ function createToolUsageRule(options) {
4335
4347
  const findings = [];
4336
4348
  for (const required of options.required ?? []) {
4337
4349
  if (!nameSet.has(required)) {
4350
+ const otherKinds = [
4351
+ ...new Set(
4352
+ context.events.filter((event) => {
4353
+ const kind = typeof event.kind === "string" ? event.kind.toUpperCase() : "";
4354
+ if (kind === "TOOL") return false;
4355
+ return resolveCanonicalToolName(event) === required || event.name === required || event.name === `tool:${required}` || event.name.endsWith(`:${required}`);
4356
+ }).map(
4357
+ (event) => typeof event.kind === "string" ? event.kind.toUpperCase() : "UNKNOWN"
4358
+ )
4359
+ )
4360
+ ].sort();
4361
+ const hint = otherKinds.length > 0 ? ` Required name appears under non-TOOL kind(s): ${otherKinds.join(", ")}. tools.required / requiredOrder match TOOL events only.` : "";
4338
4362
  findings.push(
4339
- failFinding("tool.usage", `Required tool ${required} did not appear.`, runEvidence(context.selectedRun), required, names)
4363
+ failFinding(
4364
+ "tool.usage",
4365
+ `Required tool ${required} did not appear.${hint}`,
4366
+ runEvidence(context.selectedRun),
4367
+ required,
4368
+ names
4369
+ )
4340
4370
  );
4341
4371
  }
4342
4372
  }
@@ -5059,6 +5089,7 @@ function createSafetyRedactionRule(options = {}) {
5059
5089
  function createSafetyRawContentRule(options = {}) {
5060
5090
  const forbiddenKeys = options.forbiddenKeys ?? DEFAULT_RAW_CONTENT_KEYS;
5061
5091
  const safePathPrefixes = options.safePathPrefixes ?? DEFAULT_SAFE_RAW_CONTENT_PATH_PREFIXES;
5092
+ const markers = options.redactedMarkers ?? ["[REDACTED]", "[REDACTED:"];
5062
5093
  return {
5063
5094
  id: "safety.rawPrompt",
5064
5095
  category: "safety",
@@ -5069,6 +5100,7 @@ function createSafetyRawContentRule(options = {}) {
5069
5100
  for (const entry of eventValueEntries(event, { includeSummaries: options.includeSummaries })) {
5070
5101
  const key = entry.key ?? lastPathSegment(entry.path);
5071
5102
  if (!isRawContentPath(entry.path, key, forbiddenKeys, safePathPrefixes)) continue;
5103
+ if (isFullyRedactedValue(entry.value, markers)) continue;
5072
5104
  findings.push(
5073
5105
  failFinding(
5074
5106
  "safety.rawPrompt",