@introspection-ai/recipes 0.57.0 → 0.58.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.
- package/dist/batch/index.d.ts +2 -0
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/batch/index.js +2 -1
- package/dist/batch/index.js.map +1 -1
- package/dist/batch/runner.d.ts +5 -0
- package/dist/batch/runner.d.ts.map +1 -1
- package/dist/batch/runner.js +6 -0
- package/dist/batch/runner.js.map +1 -1
- package/dist/judges/classifier.d.ts +8 -0
- package/dist/judges/classifier.d.ts.map +1 -0
- package/dist/judges/classifier.js +30 -0
- package/dist/judges/classifier.js.map +1 -0
- package/dist/judges/cli-main.d.ts +41 -0
- package/dist/judges/cli-main.d.ts.map +1 -0
- package/dist/judges/cli-main.js +182 -0
- package/dist/judges/cli-main.js.map +1 -0
- package/dist/judges/cli.d.ts +2 -0
- package/dist/judges/cli.d.ts.map +1 -0
- package/dist/judges/cli.js +43 -0
- package/dist/judges/cli.js.map +1 -0
- package/dist/judges/controller.d.ts +78 -0
- package/dist/judges/controller.d.ts.map +1 -0
- package/dist/judges/controller.js +243 -0
- package/dist/judges/controller.js.map +1 -0
- package/dist/judges/definition.d.ts +86 -0
- package/dist/judges/definition.d.ts.map +1 -0
- package/dist/judges/definition.js +100 -0
- package/dist/judges/definition.js.map +1 -0
- package/dist/judges/gate.d.ts +46 -0
- package/dist/judges/gate.d.ts.map +1 -0
- package/dist/judges/gate.js +256 -0
- package/dist/judges/gate.js.map +1 -0
- package/dist/judges/identity.d.ts +21 -0
- package/dist/judges/identity.d.ts.map +1 -0
- package/dist/judges/identity.js +48 -0
- package/dist/judges/identity.js.map +1 -0
- package/dist/judges/index.d.ts +10 -0
- package/dist/judges/index.d.ts.map +1 -0
- package/dist/judges/index.js +10 -0
- package/dist/judges/index.js.map +1 -0
- package/dist/judges/resolve-hooks.d.ts +10 -0
- package/dist/judges/resolve-hooks.d.ts.map +1 -0
- package/dist/judges/resolve-hooks.js +25 -0
- package/dist/judges/resolve-hooks.js.map +1 -0
- package/dist/judges/run.d.ts +123 -0
- package/dist/judges/run.d.ts.map +1 -0
- package/dist/judges/run.js +319 -0
- package/dist/judges/run.js.map +1 -0
- package/dist/judges/session.d.ts +9 -0
- package/dist/judges/session.d.ts.map +1 -0
- package/dist/judges/session.js +109 -0
- package/dist/judges/session.js.map +1 -0
- package/dist/judges/trajectory.d.ts +91 -0
- package/dist/judges/trajectory.d.ts.map +1 -0
- package/dist/judges/trajectory.js +223 -0
- package/dist/judges/trajectory.js.map +1 -0
- package/dist/judges/verdict.d.ts +31 -0
- package/dist/judges/verdict.d.ts.map +1 -0
- package/dist/judges/verdict.js +121 -0
- package/dist/judges/verdict.js.map +1 -0
- package/dist/model-binding.d.ts +10 -0
- package/dist/model-binding.d.ts.map +1 -1
- package/dist/model-binding.js +27 -6
- package/dist/model-binding.js.map +1 -1
- package/dist/recipe/manifest.generated.d.ts +1 -1
- package/dist/recipe/manifest.generated.js +1 -1
- package/dist/recipe/model.d.ts +5 -12
- package/dist/recipe/model.d.ts.map +1 -1
- package/dist/recipe/model.js +197 -263
- package/dist/recipe/model.js.map +1 -1
- package/dist/session.d.ts +6 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +4 -2
- package/dist/session.js.map +1 -1
- package/docs/README.md +1 -0
- package/docs/judges.md +269 -0
- package/docs/recipe-format.md +9 -9
- package/docs/recipe-judges.md +119 -59
- package/package.json +10 -6
package/docs/recipe-judges.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Recipe judge definitions
|
|
2
2
|
|
|
3
|
-
Recipe judges are optional, recipe-owned
|
|
3
|
+
Recipe judges are optional, recipe-owned grading definitions. Author them
|
|
4
4
|
as direct children of `judges/` using a lowercase `.yaml` or `.yml` extension:
|
|
5
5
|
|
|
6
6
|
```text
|
|
@@ -18,19 +18,20 @@ sources have no judge diagnostics.
|
|
|
18
18
|
The validator behind `introspection check` owns the portable authored YAML
|
|
19
19
|
specification and its static, file-oriented diagnostics.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
transcript protection, model requests,
|
|
23
|
-
evaluation identity.
|
|
24
|
-
|
|
25
|
-
must land in this checker and its contract tests rather than appearing in only
|
|
26
|
-
one evaluator.
|
|
21
|
+
`@introspection-ai/recipes/judges` owns execution: applicability checks,
|
|
22
|
+
transcript assembly and protection, model requests, verdict normalization and
|
|
23
|
+
evaluation identity. See [Running judges](judges.md). New authored fields must
|
|
24
|
+
land in the checker and its contract tests as well as in the runner.
|
|
27
25
|
|
|
28
26
|
Validation reports do not contain normalized judge definitions or
|
|
29
27
|
host-specific registry data.
|
|
30
28
|
|
|
31
29
|
## Definition shape
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
A judge is answered either by a chat model reading `instructions`, or by a
|
|
32
|
+
classifier answering yes-or-no `questions`. It declares exactly one of the two.
|
|
33
|
+
|
|
34
|
+
The minimal LLM judge is:
|
|
34
35
|
|
|
35
36
|
```yaml
|
|
36
37
|
name: helpful
|
|
@@ -38,19 +39,18 @@ name: helpful
|
|
|
38
39
|
instructions: |
|
|
39
40
|
Determine whether the assistant answered the user correctly.
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
model:
|
|
42
|
+
ai:
|
|
43
|
+
model: anthropic/claude-sonnet-5-5
|
|
43
44
|
```
|
|
44
45
|
|
|
45
|
-
`name`, `instructions
|
|
46
|
-
lowercase kebab-case and must be unique across all judge files in one
|
|
47
|
-
As with `agents/*.yaml`, the filename has no semantic meaning.
|
|
48
|
-
`llm.provider` to `openai`.
|
|
46
|
+
`name`, `ai.model` and one of `instructions` and `questions` are required.
|
|
47
|
+
Names use lowercase kebab-case and must be unique across all judge files in one
|
|
48
|
+
Recipe. As with `agents/*.yaml`, the filename has no semantic meaning.
|
|
49
49
|
|
|
50
50
|
Legacy definitions using `judge:` remain accepted as a deprecated input alias.
|
|
51
51
|
Parsers normalize that field to `name`; a definition cannot declare both.
|
|
52
52
|
|
|
53
|
-
The
|
|
53
|
+
The expanded definition is:
|
|
54
54
|
|
|
55
55
|
```yaml
|
|
56
56
|
name: helpful
|
|
@@ -64,24 +64,95 @@ on:
|
|
|
64
64
|
instructions: |
|
|
65
65
|
Determine whether the assistant answered the user correctly.
|
|
66
66
|
|
|
67
|
+
ai:
|
|
68
|
+
model: anthropic/claude-sonnet-5-5
|
|
69
|
+
fallbacks:
|
|
70
|
+
- openai/gpt-6-luna
|
|
71
|
+
thinking_level: low
|
|
72
|
+
options:
|
|
73
|
+
temperature: 0
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Unknown fields are errors at every level.
|
|
77
|
+
|
|
78
|
+
### The older `llm:` block
|
|
79
|
+
|
|
80
|
+
A judge declares its model under `ai:`. The `llm:` block that earlier versions
|
|
81
|
+
read is still accepted in its place, but never beside it: a judge with both, or
|
|
82
|
+
with neither, reports `judge.kind_invalid`. Every reader of the judge
|
|
83
|
+
(the checker, the runner and the hosted platform) sees the `ai:` block it maps
|
|
84
|
+
to:
|
|
85
|
+
|
|
86
|
+
| `llm:` | `ai:` |
|
|
87
|
+
| -------------------------- | ------------------------------------------------------------ |
|
|
88
|
+
| `provider` and `model` | `model: <provider>/<model>`; `provider` defaults to `openai` |
|
|
89
|
+
| `request.max_tokens` | `options.max_tokens` |
|
|
90
|
+
| `request.temperature` | `options.temperature`, unless it is 0 (the model's default) |
|
|
91
|
+
| `request.reasoning_effort` | `thinking_level`; `none` is `off` |
|
|
92
|
+
| `transport` | dropped: the host owns timeouts and retries |
|
|
93
|
+
| `local` | dropped with the warning `judge.llm.local_ignored` |
|
|
94
|
+
|
|
95
|
+
`ai:` cannot name a local endpoint, so a judge that declared `llm.local` runs on
|
|
96
|
+
its provider's hosted model. A `reasoning_effort` that names no thinking level
|
|
97
|
+
is an error.
|
|
98
|
+
|
|
99
|
+
```yaml
|
|
100
|
+
# Read as ai: { model: anthropic/claude-sonnet-5-5, thinking_level: low }
|
|
67
101
|
llm:
|
|
68
|
-
provider:
|
|
69
|
-
model:
|
|
102
|
+
provider: anthropic
|
|
103
|
+
model: claude-sonnet-5-5
|
|
70
104
|
request:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
105
|
+
reasoning_effort: low
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Model settings
|
|
109
|
+
|
|
110
|
+
`ai:` is the block an agent declares, with the same keys and the same rules:
|
|
111
|
+
`model`, `fallbacks`, `thinking_level`, `options` and `providers`. See
|
|
112
|
+
[Agents](recipe-format.md#agents). A judge has no `session:` block; the host's
|
|
113
|
+
retry settings apply.
|
|
114
|
+
|
|
115
|
+
An LLM judge returns `pass`, `fail` or `not_applicable` with a short reason.
|
|
116
|
+
That contract is the runner's and cannot be authored.
|
|
117
|
+
|
|
118
|
+
### Classifier judges
|
|
119
|
+
|
|
120
|
+
A classifier judge asks a decision model yes-or-no questions and reads a
|
|
121
|
+
probability for each:
|
|
122
|
+
|
|
123
|
+
```yaml
|
|
124
|
+
name: polite
|
|
125
|
+
|
|
126
|
+
ai:
|
|
127
|
+
model: typesafe/jev-latest
|
|
128
|
+
fallbacks:
|
|
129
|
+
- openai/gpt-6-luna
|
|
130
|
+
|
|
131
|
+
questions:
|
|
132
|
+
greeted:
|
|
133
|
+
instructions: Did the assistant greet the user?
|
|
134
|
+
criteria:
|
|
135
|
+
"true": The first reply opens with a greeting.
|
|
136
|
+
"false": It does not.
|
|
137
|
+
threshold: 0.8
|
|
138
|
+
apologised:
|
|
139
|
+
instructions: Did the assistant apologise for the delay?
|
|
140
|
+
criteria:
|
|
141
|
+
"true": It says sorry for the wait.
|
|
142
|
+
"false": It does not mention the wait.
|
|
81
143
|
```
|
|
82
144
|
|
|
83
|
-
|
|
84
|
-
|
|
145
|
+
- `questions` maps between one and eight lowercase snake_case names to
|
|
146
|
+
questions.
|
|
147
|
+
- `instructions` is non-empty text, and `criteria` describes both `true` and
|
|
148
|
+
`false`.
|
|
149
|
+
- `threshold` is the probability of yes, above 0 and at most 1, that the
|
|
150
|
+
question must reach. It defaults to 0.5.
|
|
151
|
+
- The judge is `pass` when every question reaches its own threshold, and `fail`
|
|
152
|
+
otherwise. A classifier cannot abstain: `not_applicable` comes only from
|
|
153
|
+
`on`.
|
|
154
|
+
- `ai.model` names a classifier model. `thinking_level` and `options` do not
|
|
155
|
+
apply to one.
|
|
85
156
|
|
|
86
157
|
## Judge types
|
|
87
158
|
|
|
@@ -123,33 +194,8 @@ questions:
|
|
|
123
194
|
describes both `true` and `false` in non-empty text.
|
|
124
195
|
- `attributes` lists the request attributes the judge sees, and is empty to show
|
|
125
196
|
them all.
|
|
126
|
-
- `on` and `
|
|
127
|
-
judge; `
|
|
128
|
-
|
|
129
|
-
### LLM settings
|
|
130
|
-
|
|
131
|
-
- `provider` is a 1-64 byte lowercase slug containing ASCII letters, digits,
|
|
132
|
-
and hyphens. The portable checker does not restrict it to managed platform
|
|
133
|
-
providers because custom slugs can be used with an explicit local endpoint.
|
|
134
|
-
- `model` is a trimmed, non-empty string of at most 255 bytes.
|
|
135
|
-
- `request.temperature` is a finite number from 0 through 2 and defaults to 0.
|
|
136
|
-
- `request.max_tokens` is an integer from 1 through 131072 when present;
|
|
137
|
-
explicit `null` is treated as omitted.
|
|
138
|
-
- `request.reasoning_effort` is a 1-64 byte lowercase slug containing ASCII
|
|
139
|
-
letters and hyphens; explicit `null` is treated as omitted.
|
|
140
|
-
- `transport.timeout_ms` is an integer from 1 through 600000 and defaults to
|
|
141
|
-
60000.
|
|
142
|
-
- `transport.max_retries` is an integer from 0 through 10 and defaults to 0.
|
|
143
|
-
- `transport.max_retry_delay_ms` is an integer from 0 through 60000 and
|
|
144
|
-
defaults to 5000.
|
|
145
|
-
- `local` requires both `base_url` and `api_key_env`. The URL must be HTTP(S),
|
|
146
|
-
have a host, contain no embedded credentials, query, or fragment, and use
|
|
147
|
-
HTTPS unless it targets `localhost`, `127.0.0.1`, or `::1`. `api_key_env` is
|
|
148
|
-
an environment-variable name, not a credential value.
|
|
149
|
-
|
|
150
|
-
Transport and local settings affect execution but not authored grading
|
|
151
|
-
identity. The evaluator remains responsible for applying defaults, building
|
|
152
|
-
requests, and routing execution.
|
|
197
|
+
- `on` and `ai` belong to `online` judges and are rejected on a mission
|
|
198
|
+
judge; `attributes` is rejected on online judges.
|
|
153
199
|
|
|
154
200
|
## Applicability
|
|
155
201
|
|
|
@@ -173,10 +219,24 @@ on:
|
|
|
173
219
|
sentiment: negative
|
|
174
220
|
```
|
|
175
221
|
|
|
176
|
-
Match keys are non-empty field paths. Regex literals
|
|
177
|
-
|
|
222
|
+
Match keys are non-empty field paths. Regex literals support unique `i`, `m`,
|
|
223
|
+
`s`, and `u` flags. A pattern must compile both as a Rust regex, which the
|
|
224
|
+
hosted platform evaluates, and as a JavaScript `RegExp`, which the runner
|
|
225
|
+
evaluates. The runner compiles a pattern with the `v` flag and, when that
|
|
226
|
+
refuses it, with the `u` flag, so `[\w-]+` (which only `u` compiles) and
|
|
227
|
+
`[\w--\d]+` (which only `v` compiles) are both valid. The checker reports
|
|
228
|
+
`judge.on.regex_invalid` for a pattern either engine refuses, such as a
|
|
229
|
+
lookahead (`(?=…)`, which Rust refuses) or a Rust named group (`(?P<name>…)`,
|
|
230
|
+
which JavaScript refuses under both flags). `environment`, `runtime_group`, and
|
|
178
231
|
paths ending in `pattern_id` are platform-owned and cannot appear as authored
|
|
179
|
-
match fields. The
|
|
232
|
+
match fields. The runner owns dotted-path traversal and gate evaluation.
|
|
233
|
+
|
|
234
|
+
The checker compiles the JavaScript side with a Rust implementation of the
|
|
235
|
+
`RegExp` grammar, not with the runner's own engine, and the two differ at the
|
|
236
|
+
edges: the checker accepts `\Afoo\z`, `\-` and `\#`, which the runner refuses,
|
|
237
|
+
and `[[:alpha:]]` is a POSIX class to Rust and a nested class to JavaScript. A
|
|
238
|
+
pattern the checker accepts can therefore still be refused by the runner at
|
|
239
|
+
run time, where it records an error for that judgement.
|
|
180
240
|
|
|
181
241
|
## Diagnostics
|
|
182
242
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@introspection-ai/recipes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.0",
|
|
4
4
|
"description": "The open format for vertical agents, built on Pi.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -65,6 +65,10 @@
|
|
|
65
65
|
"types": "./dist/batch/index.d.ts",
|
|
66
66
|
"import": "./dist/batch/index.js"
|
|
67
67
|
},
|
|
68
|
+
"./judges": {
|
|
69
|
+
"types": "./dist/judges/index.d.ts",
|
|
70
|
+
"import": "./dist/judges/index.js"
|
|
71
|
+
},
|
|
68
72
|
"./recipe": {
|
|
69
73
|
"types": "./dist/recipe/resolve.d.ts",
|
|
70
74
|
"import": "./dist/recipe/resolve.js"
|
|
@@ -142,10 +146,10 @@
|
|
|
142
146
|
"@introspection-ai/recipe-productivity-microsoft": ">=0.1.0",
|
|
143
147
|
"@introspection-ai/recipe-search": ">=0.1.0",
|
|
144
148
|
"@introspection-ai/recipe-signature": ">=0.1.0",
|
|
145
|
-
"@introspection-ai/mcp-client-linux-x64": "0.
|
|
146
|
-
"@introspection-ai/mcp-client-linux-arm64": "0.
|
|
147
|
-
"@introspection-ai/mcp-client-darwin-arm64": "0.
|
|
148
|
-
"@introspection-ai/mcp-client-darwin-x64": "0.
|
|
149
|
+
"@introspection-ai/mcp-client-linux-x64": "0.58.0",
|
|
150
|
+
"@introspection-ai/mcp-client-linux-arm64": "0.58.0",
|
|
151
|
+
"@introspection-ai/mcp-client-darwin-arm64": "0.58.0",
|
|
152
|
+
"@introspection-ai/mcp-client-darwin-x64": "0.58.0"
|
|
149
153
|
},
|
|
150
154
|
"peerDependencies": {
|
|
151
155
|
"@earendil-works/pi-agent-core": ">=1.1.0 <2.0.0",
|
|
@@ -193,7 +197,7 @@
|
|
|
193
197
|
"format": "prettier --write \"{src,test,packages,examples}/**/*.{ts,mjs,md}\" \"*.{ts,mjs}\"",
|
|
194
198
|
"format:check": "prettier --check \"{src,test,packages,examples}/**/*.{ts,mjs,md}\" \"*.{ts,mjs}\"",
|
|
195
199
|
"knip": "pnpm manifest && pnpm schemas && knip --no-gitignore",
|
|
196
|
-
"test": "pnpm build:ts && cargo test -p pi-mcp-client -p introspection-recipe-check && cargo build -p pi-mcp-client && MCP_CLIENT_BIN=target/debug/mcp-client node scripts/package-mcp-client.mjs && vitest run && pnpm --filter './examples' test",
|
|
200
|
+
"test": "pnpm build:ts && cargo test -p pi-mcp-client -p introspection-recipe-check && cargo build -p pi-mcp-client -p introspection-recipe-check && MCP_CLIENT_BIN=target/debug/mcp-client node scripts/package-mcp-client.mjs && vitest run && pnpm --filter './examples' test",
|
|
197
201
|
"pack:check": "pnpm pack --dry-run --json | node scripts/check-npm-pack.mjs && pnpm --filter './packages/**' pack:check",
|
|
198
202
|
"clean": "rm -rf dist .turbo node_modules target vendor/mcp-client",
|
|
199
203
|
"report:tool-modes": "node scripts/tool-modes-report.mjs && prettier --write test/recordings/tool-modes/report.md"
|