@uinaf/skillcheck 1.7.5 → 1.7.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.
@@ -1,6 +1,35 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import path from "node:path";
3
3
  //#region src/grok-provider.ts
4
+ function record(value) {
5
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6
+ }
7
+ function nonnegativeNumber(value) {
8
+ return typeof value === "number" && Number.isFinite(value) && value >= 0;
9
+ }
10
+ function isGrokEvent(value) {
11
+ if (!record(value) || typeof value.type !== "string") return false;
12
+ if (value.type === "text") return typeof value.data === "string";
13
+ if (value.type === "tool_call" && value.toolName === "read_file") {
14
+ if (typeof value.toolCallId !== "string") return false;
15
+ const input = value.rawInput;
16
+ if (input === void 0 || input === null) return true;
17
+ return record(input) && (input.target_file === void 0 || typeof input.target_file === "string") && (input.path === void 0 || typeof input.path === "string");
18
+ }
19
+ if (value.type === "tool_call_update") return typeof value.toolCallId === "string" && (value.status === void 0 || value.status === null || typeof value.status === "string");
20
+ if (value.type !== "end") return true;
21
+ if (typeof value.stopReason !== "string") return false;
22
+ if (value.usage !== void 0) {
23
+ if (!record(value.usage)) return false;
24
+ for (const key of [
25
+ "input_tokens",
26
+ "output_tokens",
27
+ "total_tokens",
28
+ "cache_read_input_tokens"
29
+ ]) if (value.usage[key] !== void 0 && !nonnegativeNumber(value.usage[key])) return false;
30
+ }
31
+ return value.total_cost_usd === void 0 || nonnegativeNumber(value.total_cost_usd);
32
+ }
4
33
  const OUTPUT_CAP = 1e6;
5
34
  function within(root, file) {
6
35
  const rel = path.relative(root, file);
@@ -67,11 +96,15 @@ var GrokProvider = class {
67
96
  stop("grok emitted invalid streaming JSON");
68
97
  return;
69
98
  }
99
+ if (!isGrokEvent(event)) {
100
+ stop("grok emitted an invalid streaming event");
101
+ return;
102
+ }
70
103
  if (event.type === "text" && typeof event.data === "string") {
71
104
  output += event.data;
72
105
  if (output.length > OUTPUT_CAP) stop("grok output exceeded limit");
73
106
  } else if (event.type === "tool_call" && event.toolName === "read_file") {
74
- const target = event.rawInput?.target_file;
107
+ const target = event.rawInput?.target_file ?? event.rawInput?.path;
75
108
  if (event.toolCallId && typeof target === "string") {
76
109
  const resolved = path.resolve(workdir, target);
77
110
  if (within(workdir, resolved)) reads.set(event.toolCallId, resolved);
package/docs/usage.md CHANGED
@@ -154,7 +154,10 @@ workdir with the skill under `.grok/skills/`. It uses native streaming events
154
154
  to count a completed read of that skill's `SKILL.md` as `skill-used` evidence.
155
155
  Grok must be logged in locally or have its supported credentials configured.
156
156
  The run disables subagents and grants edit permission in the workdir; web
157
- search stays on. `--agent` selects a Grok model ID.
157
+ search stays on. `--agent` selects a Grok model ID. Malformed fields consumed by
158
+ the provider are reported as run errors. Progress-only tool updates and pending read inputs are
159
+ ignored. Skill-read evidence requires a file path on the initial tool call
160
+ (`path` or `target_file`) and a completed update.
158
161
 
159
162
  `--judge` takes either a bare Claude model (graded through the Anthropic
160
163
  selection in [auth](#auth)) or a provider-qualified promptfoo id, passed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uinaf/skillcheck",
3
- "version": "1.7.5",
3
+ "version": "1.7.6",
4
4
  "description": "Lint and eval harness for agent skills",
5
5
  "homepage": "https://github.com/uinaf/skillcheck#readme",
6
6
  "bugs": {