@agent-inspect/viewer 6.29.4 → 6.29.6

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/dist/index.cjs CHANGED
@@ -87,6 +87,17 @@ function isTraceEvent(value) {
87
87
  }
88
88
  }
89
89
 
90
+ // packages/core/src/types/inspect-event.ts
91
+ var ATTRIBUTION_CONFIDENCES = [
92
+ "unknown",
93
+ "heuristic",
94
+ "correlated",
95
+ "explicit"
96
+ ];
97
+ function isAttributionConfidence(value) {
98
+ return typeof value === "string" && ATTRIBUTION_CONFIDENCES.includes(value);
99
+ }
100
+
90
101
  // packages/core/src/types/persisted-inspect-event.ts
91
102
  var INSPECT_KINDS = [
92
103
  "RUN",
@@ -102,12 +113,6 @@ var INSPECT_KINDS = [
102
113
  "LOG",
103
114
  "OUTCOME"
104
115
  ];
105
- var ATTRIBUTION_CONFIDENCES = [
106
- "explicit",
107
- "correlated",
108
- "heuristic",
109
- "unknown"
110
- ];
111
116
  var PERSISTED_EVENT_SOURCE_TYPES = [
112
117
  "manual",
113
118
  "json-log",
@@ -143,9 +148,6 @@ function isOptionalNonNegativeNumber(value) {
143
148
  function isInspectKind(value) {
144
149
  return typeof value === "string" && INSPECT_KINDS.includes(value);
145
150
  }
146
- function isAttributionConfidence(value) {
147
- return typeof value === "string" && ATTRIBUTION_CONFIDENCES.includes(value);
148
- }
149
151
  function isPersistedEventSourceType(value) {
150
152
  return typeof value === "string" && PERSISTED_EVENT_SOURCE_TYPES.includes(value);
151
153
  }
@@ -2354,8 +2356,26 @@ function createToolUsageRule(options) {
2354
2356
  const findings = [];
2355
2357
  for (const required of options.required ?? []) {
2356
2358
  if (!nameSet.has(required)) {
2359
+ const otherKinds = [
2360
+ ...new Set(
2361
+ context.events.filter((event) => {
2362
+ const kind = typeof event.kind === "string" ? event.kind.toUpperCase() : "";
2363
+ if (kind === "TOOL") return false;
2364
+ return resolveCanonicalToolName(event) === required || event.name === required || event.name === `tool:${required}` || event.name.endsWith(`:${required}`);
2365
+ }).map(
2366
+ (event) => typeof event.kind === "string" ? event.kind.toUpperCase() : "UNKNOWN"
2367
+ )
2368
+ )
2369
+ ].sort();
2370
+ const hint = otherKinds.length > 0 ? ` Required name appears under non-TOOL kind(s): ${otherKinds.join(", ")}. tools.required / requiredOrder match TOOL events only.` : "";
2357
2371
  findings.push(
2358
- failFinding("tool.usage", `Required tool ${required} did not appear.`, runEvidence(context.selectedRun), required, names)
2372
+ failFinding(
2373
+ "tool.usage",
2374
+ `Required tool ${required} did not appear.${hint}`,
2375
+ runEvidence(context.selectedRun),
2376
+ required,
2377
+ names
2378
+ )
2359
2379
  );
2360
2380
  }
2361
2381
  }