anpord 0.1.11 → 0.1.13
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/README.md +56 -78
- package/dist/bin.cjs +211 -204
- package/dist/bin.mjs +211 -204
- package/dist/cli-runtime.cjs +2 -2
- package/dist/cli-runtime.d.cts +1 -1
- package/dist/cli-runtime.d.mts +1 -1
- package/dist/cli-runtime.mjs +2 -2
- package/dist/client-BfdjFtlV.mjs +305 -0
- package/dist/{client-C9m0uLCz.d.cts → client-BgRs8JvW.d.mts} +2150 -174
- package/dist/{client-TFCLuMv8.d.mts → client-BirFO3jz.d.cts} +2150 -174
- package/dist/client-C-P2I00z.cjs +346 -0
- package/dist/{compiler-DXlpU_In.mjs → compiler-D96wI7UP.mjs} +108 -75
- package/dist/{compiler-Ap8DM-JU.cjs → compiler-uwb1pkdK.cjs} +116 -83
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/{errors-C9bQUcA3.mjs → errors-B0YknR5V.mjs} +3 -19
- package/dist/{errors-Boum34f5.cjs → errors-BX1wry8K.cjs} +3 -19
- package/dist/{errors-BK3f7Rdr.d.cts → errors-aGrd21jy.d.cts} +0 -3
- package/dist/{errors-BK3f7Rdr.d.mts → errors-aGrd21jy.d.mts} +0 -3
- package/dist/eval-judges-BkmiVLLq.cjs +59 -0
- package/dist/eval-judges-CwTvTq7N.mjs +42 -0
- package/dist/eval-judges-DPPUftbh.d.cts +48 -0
- package/dist/eval-judges-DPPUftbh.d.mts +48 -0
- package/dist/eval-validations-BRdoZrTQ.mjs +113 -0
- package/dist/eval-validations-_MlnQ_uv.cjs +148 -0
- package/dist/eval.cjs +1 -1
- package/dist/eval.d.cts +60 -6
- package/dist/eval.d.mts +60 -6
- package/dist/eval.mjs +1 -1
- package/dist/evals-B6aT3xgH.d.cts +1364 -0
- package/dist/evals-B6aT3xgH.d.mts +1364 -0
- package/dist/evals-Dcc_x6jW.mjs +582 -0
- package/dist/evals-DouMsrsM.cjs +737 -0
- package/dist/index.cjs +23 -99
- package/dist/index.d.cts +138 -34
- package/dist/index.d.mts +138 -34
- package/dist/index.mjs +23 -99
- package/dist/source.d.cts +1 -1
- package/dist/source.d.mts +1 -1
- package/dist/{types-oaMF6-E1.d.mts → types-Codjaq-o.d.mts} +146 -45
- package/dist/{types-H9L450Iu.d.cts → types-ISsteq95.d.cts} +146 -45
- package/dist/validator-runtime.cjs +238 -0
- package/dist/validator-runtime.d.cts +9 -0
- package/dist/validator-runtime.d.mts +9 -0
- package/dist/validator-runtime.mjs +237 -0
- package/dist/validators.cjs +10 -0
- package/dist/validators.d.cts +8 -0
- package/dist/validators.d.mts +8 -0
- package/dist/validators.mjs +9 -0
- package/package.json +11 -1
- package/dist/client-5K3dMI5Q.mjs +0 -849
- package/dist/client-Ci0woWLW.cjs +0 -890
- package/dist/evals-BEgEmfiO.d.cts +0 -603
- package/dist/evals-BEgEmfiO.d.mts +0 -603
- package/dist/harness-profile-BMjsN460.mjs +0 -43
- package/dist/harness-profile-CDQpPLPd.cjs +0 -78
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# anpord
|
|
2
2
|
|
|
3
|
-
TypeScript SDK for [Anpord](https://anpord.com).
|
|
3
|
+
TypeScript SDK for [Anpord](https://anpord.com). Define coding-agent evals, run them across agents and sandboxes, and manage versioned prompts.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -8,116 +8,71 @@ TypeScript SDK for [Anpord](https://anpord.com). Run coding agent evals across h
|
|
|
8
8
|
npm install anpord
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Define an eval
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
const anpord = new Anpord({ apiKey: process.env.ANPORD_API_KEY });
|
|
14
|
+
import { defineEval, empty } from "anpord";
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
export default defineEval({
|
|
17
|
+
name: "greeting",
|
|
18
|
+
source: empty,
|
|
19
|
+
prompt: "{{task}}",
|
|
19
20
|
cases: [
|
|
20
21
|
{
|
|
21
|
-
name: "writes
|
|
22
|
+
name: "writes hello",
|
|
22
23
|
variables: { task: "Create hello.txt containing exactly hello" },
|
|
23
|
-
verify:
|
|
24
|
+
verify: 'test "$(cat hello.txt)" = hello',
|
|
24
25
|
},
|
|
25
26
|
],
|
|
26
|
-
|
|
27
|
-
tasks: [{ harness: "codex", model: "gpt-5.6-sol", provider: "daytona" }],
|
|
27
|
+
tasks: [{ harness: "codex", model: "model-id", provider: "daytona" }],
|
|
28
28
|
trials: 3,
|
|
29
29
|
});
|
|
30
|
-
|
|
31
|
-
for (const cell of run.cells) {
|
|
32
|
-
console.log(cell.caseName, cell.distribution?.passRate);
|
|
33
|
-
}
|
|
34
30
|
```
|
|
35
31
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
import type { Validator } from "anpord";
|
|
40
|
-
|
|
41
|
-
export const hasGreeting: Validator = async ({ readText }) =>
|
|
42
|
-
(await readText("hello.txt")) === "hello";
|
|
32
|
+
```sh
|
|
33
|
+
npx anpord eval ./greeting.eval.ts
|
|
43
34
|
```
|
|
44
35
|
|
|
45
|
-
|
|
36
|
+
With no file, the CLI discovers every `**/*.eval.ts` suite.
|
|
46
37
|
|
|
47
|
-
|
|
48
|
-
import { defineEval } from "anpord";
|
|
49
|
-
import { hasGreeting } from "./validators/greeting";
|
|
38
|
+
## Mock MCP and CLI
|
|
50
39
|
|
|
51
|
-
|
|
52
|
-
name: "greeting",
|
|
53
|
-
cases: [
|
|
54
|
-
{
|
|
55
|
-
name: "greeting",
|
|
56
|
-
variables: { task: "Write hello.txt" },
|
|
57
|
-
validate: hasGreeting,
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
prompt: "{{task}}",
|
|
61
|
-
tasks: [{ harness: "codex", model: "gpt-5.6-sol", provider: "daytona" }],
|
|
62
|
-
trials: 3,
|
|
63
|
-
});
|
|
64
|
-
```
|
|
40
|
+
Install Zod for the examples:
|
|
65
41
|
|
|
66
42
|
```sh
|
|
67
|
-
|
|
43
|
+
npm install zod
|
|
68
44
|
```
|
|
69
45
|
|
|
70
|
-
With no paths, the CLI discovers every `**/*.eval.ts` file and starts the
|
|
71
|
-
suites concurrently. Pass files or directories to run a smaller set.
|
|
72
|
-
|
|
73
|
-
## Mock MCP servers
|
|
74
|
-
|
|
75
|
-
Define local MCP dependencies once and Anpord gives every built-in agent trial
|
|
76
|
-
a fresh stdio server:
|
|
77
|
-
|
|
78
46
|
```ts
|
|
79
47
|
import { z } from "zod";
|
|
80
|
-
import { defineEval } from "anpord";
|
|
81
48
|
import { server, tool } from "anpord/mcp";
|
|
82
49
|
|
|
83
|
-
const
|
|
84
|
-
|
|
50
|
+
const User = z.object({ id: z.string(), name: z.string() });
|
|
51
|
+
|
|
52
|
+
export const usersMcp = server({
|
|
53
|
+
name: "users",
|
|
85
54
|
version: "1.0.0",
|
|
86
55
|
tools: [
|
|
87
56
|
tool({
|
|
88
57
|
name: "users_get",
|
|
89
58
|
inputSchema: z.object({ id: z.string() }),
|
|
90
|
-
outputSchema:
|
|
59
|
+
outputSchema: User,
|
|
91
60
|
handler: ({ id }) => ({ id, name: "Ada" }),
|
|
92
61
|
}),
|
|
93
62
|
],
|
|
94
63
|
});
|
|
95
|
-
|
|
96
|
-
export default defineEval({
|
|
97
|
-
mcp: [api],
|
|
98
|
-
// cases, prompt, tasks, and trials
|
|
99
|
-
});
|
|
100
64
|
```
|
|
101
65
|
|
|
102
|
-
Handlers return plain values or promises. Validators can inspect exact calls
|
|
103
|
-
with `await context.mcp.calls("example")`. No service credentials are needed.
|
|
104
|
-
|
|
105
|
-
## Mock CLIs
|
|
106
|
-
|
|
107
|
-
Define a local executable with the same Standard Schema fixtures and attach it
|
|
108
|
-
to any eval:
|
|
109
|
-
|
|
110
66
|
```ts
|
|
111
67
|
import { z } from "zod";
|
|
112
|
-
import { defineEval } from "anpord";
|
|
113
68
|
import { cli, command } from "anpord/cli";
|
|
114
69
|
|
|
115
|
-
const
|
|
116
|
-
path: "
|
|
70
|
+
export const usersCli = cli({
|
|
71
|
+
path: "users",
|
|
117
72
|
version: "1.0.0",
|
|
118
73
|
commands: [
|
|
119
74
|
command({
|
|
120
|
-
path: ["
|
|
75
|
+
path: ["get"],
|
|
121
76
|
inputSchema: z.object({ id: z.string() }),
|
|
122
77
|
outputSchema: z.object({ id: z.string(), name: z.string() }),
|
|
123
78
|
options: { id: { type: "string" } },
|
|
@@ -125,24 +80,47 @@ const client = cli({
|
|
|
125
80
|
}),
|
|
126
81
|
],
|
|
127
82
|
});
|
|
83
|
+
```
|
|
128
84
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
85
|
+
Attach definitions with `mcp: [usersMcp]` or `cli: [usersCli]`. Handlers use plain TypeScript. Schemas infer handler types and validate calls at runtime.
|
|
86
|
+
|
|
87
|
+
## Model judges
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import { judge } from "anpord/validators";
|
|
91
|
+
|
|
92
|
+
const correctness = judge({
|
|
93
|
+
name: "correctness",
|
|
94
|
+
harness: "codex",
|
|
95
|
+
model: "gpt-5.6-sol",
|
|
96
|
+
rubric: "The answer matches the reference without inventing facts.",
|
|
97
|
+
expected: "Ada",
|
|
98
|
+
choices: { correct: 1, incorrect: 0 },
|
|
132
99
|
});
|
|
133
100
|
```
|
|
134
101
|
|
|
135
|
-
Every
|
|
136
|
-
calls with `await context.cli.calls("example")`.
|
|
102
|
+
Set `validate: correctness`, or combine it with code: `validate: [checkToolCalls, correctness]`. Every check must pass. Judges use the organization's harness connection, including Codex subscriptions. For direct OpenAI calls, use `provider: "openai"` and configure an OpenAI key in the environment connection.
|
|
137
103
|
|
|
138
|
-
|
|
104
|
+
See [model judges](https://docs.anpord.com/evals/judges) for isolation, authentication, and unscored failures.
|
|
105
|
+
|
|
106
|
+
## Use the API
|
|
139
107
|
|
|
140
108
|
```ts
|
|
141
|
-
|
|
142
|
-
|
|
109
|
+
import { Anpord } from "anpord";
|
|
110
|
+
import { compileEval } from "anpord/eval";
|
|
111
|
+
|
|
112
|
+
const anpord = new Anpord();
|
|
113
|
+
const run = await anpord.evals.startAndWait(
|
|
114
|
+
await compileEval("./greeting.eval.ts")
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
console.log(run.status, run.cells);
|
|
118
|
+
await anpord.dispose();
|
|
143
119
|
```
|
|
144
120
|
|
|
145
|
-
|
|
121
|
+
The client reads `ANPORD_API_KEY`.
|
|
122
|
+
|
|
123
|
+
See the [documentation](https://docs.anpord.com) for cases, validators, profiles, mock interfaces, prompt releases, and the API reference.
|
|
146
124
|
|
|
147
125
|
## License
|
|
148
126
|
|