@uinaf/skillcheck 1.7.5 → 1.7.7
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/grok-provider.js +34 -1
- package/docs/adoption.md +13 -1
- package/docs/usage.md +4 -1
- package/package.json +1 -1
package/dist/grok-provider.js
CHANGED
|
@@ -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/adoption.md
CHANGED
|
@@ -48,7 +48,19 @@ the registry.
|
|
|
48
48
|
Sweeps need model credentials, so they stay off consumer CI and run from an
|
|
49
49
|
operator machine or a job that already holds gateway auth. They also need the
|
|
50
50
|
eval engine, which is an optional peer precisely so the lint-only install
|
|
51
|
-
above stays small.
|
|
51
|
+
above stays small. For pnpm 12 eval installs, add this override to the operator project's
|
|
52
|
+
`pnpm-workspace.yaml` before installing:
|
|
53
|
+
|
|
54
|
+
```yaml
|
|
55
|
+
overrides:
|
|
56
|
+
"promptfoo>@huggingface/transformers": "-"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Skillcheck uses remote models; this omits promptfoo's unused
|
|
60
|
+
local-inference path and its unpatched `sprintf-js` dependency
|
|
61
|
+
([GHSA-hp3w-g68c-fv3c](https://github.com/advisories/GHSA-hp3w-g68c-fv3c)).
|
|
62
|
+
The setting belongs to the installing project; installing Skillcheck does not
|
|
63
|
+
inherit this repository's pnpm policy. Then install the peers next to Skillcheck:
|
|
52
64
|
|
|
53
65
|
```sh
|
|
54
66
|
pnpm add -D promptfoo @anthropic-ai/claude-agent-sdk @openai/codex-sdk
|
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
|