@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.mjs CHANGED
@@ -80,6 +80,17 @@ function isTraceEvent(value) {
80
80
  }
81
81
  }
82
82
 
83
+ // packages/core/src/types/inspect-event.ts
84
+ var ATTRIBUTION_CONFIDENCES = [
85
+ "unknown",
86
+ "heuristic",
87
+ "correlated",
88
+ "explicit"
89
+ ];
90
+ function isAttributionConfidence(value) {
91
+ return typeof value === "string" && ATTRIBUTION_CONFIDENCES.includes(value);
92
+ }
93
+
83
94
  // packages/core/src/types/persisted-inspect-event.ts
84
95
  var INSPECT_KINDS = [
85
96
  "RUN",
@@ -95,12 +106,6 @@ var INSPECT_KINDS = [
95
106
  "LOG",
96
107
  "OUTCOME"
97
108
  ];
98
- var ATTRIBUTION_CONFIDENCES = [
99
- "explicit",
100
- "correlated",
101
- "heuristic",
102
- "unknown"
103
- ];
104
109
  var PERSISTED_EVENT_SOURCE_TYPES = [
105
110
  "manual",
106
111
  "json-log",
@@ -136,9 +141,6 @@ function isOptionalNonNegativeNumber(value) {
136
141
  function isInspectKind(value) {
137
142
  return typeof value === "string" && INSPECT_KINDS.includes(value);
138
143
  }
139
- function isAttributionConfidence(value) {
140
- return typeof value === "string" && ATTRIBUTION_CONFIDENCES.includes(value);
141
- }
142
144
  function isPersistedEventSourceType(value) {
143
145
  return typeof value === "string" && PERSISTED_EVENT_SOURCE_TYPES.includes(value);
144
146
  }
@@ -2347,8 +2349,26 @@ function createToolUsageRule(options) {
2347
2349
  const findings = [];
2348
2350
  for (const required of options.required ?? []) {
2349
2351
  if (!nameSet.has(required)) {
2352
+ const otherKinds = [
2353
+ ...new Set(
2354
+ context.events.filter((event) => {
2355
+ const kind = typeof event.kind === "string" ? event.kind.toUpperCase() : "";
2356
+ if (kind === "TOOL") return false;
2357
+ return resolveCanonicalToolName(event) === required || event.name === required || event.name === `tool:${required}` || event.name.endsWith(`:${required}`);
2358
+ }).map(
2359
+ (event) => typeof event.kind === "string" ? event.kind.toUpperCase() : "UNKNOWN"
2360
+ )
2361
+ )
2362
+ ].sort();
2363
+ const hint = otherKinds.length > 0 ? ` Required name appears under non-TOOL kind(s): ${otherKinds.join(", ")}. tools.required / requiredOrder match TOOL events only.` : "";
2350
2364
  findings.push(
2351
- failFinding("tool.usage", `Required tool ${required} did not appear.`, runEvidence(context.selectedRun), required, names)
2365
+ failFinding(
2366
+ "tool.usage",
2367
+ `Required tool ${required} did not appear.${hint}`,
2368
+ runEvidence(context.selectedRun),
2369
+ required,
2370
+ names
2371
+ )
2352
2372
  );
2353
2373
  }
2354
2374
  }