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.
Files changed (58) hide show
  1. package/README.md +56 -78
  2. package/dist/bin.cjs +211 -204
  3. package/dist/bin.mjs +211 -204
  4. package/dist/cli-runtime.cjs +2 -2
  5. package/dist/cli-runtime.d.cts +1 -1
  6. package/dist/cli-runtime.d.mts +1 -1
  7. package/dist/cli-runtime.mjs +2 -2
  8. package/dist/client-BfdjFtlV.mjs +305 -0
  9. package/dist/{client-C9m0uLCz.d.cts → client-BgRs8JvW.d.mts} +2150 -174
  10. package/dist/{client-TFCLuMv8.d.mts → client-BirFO3jz.d.cts} +2150 -174
  11. package/dist/client-C-P2I00z.cjs +346 -0
  12. package/dist/{compiler-DXlpU_In.mjs → compiler-D96wI7UP.mjs} +108 -75
  13. package/dist/{compiler-Ap8DM-JU.cjs → compiler-uwb1pkdK.cjs} +116 -83
  14. package/dist/config.cjs +1 -1
  15. package/dist/config.d.cts +1 -1
  16. package/dist/config.d.mts +1 -1
  17. package/dist/config.mjs +1 -1
  18. package/dist/{errors-C9bQUcA3.mjs → errors-B0YknR5V.mjs} +3 -19
  19. package/dist/{errors-Boum34f5.cjs → errors-BX1wry8K.cjs} +3 -19
  20. package/dist/{errors-BK3f7Rdr.d.cts → errors-aGrd21jy.d.cts} +0 -3
  21. package/dist/{errors-BK3f7Rdr.d.mts → errors-aGrd21jy.d.mts} +0 -3
  22. package/dist/eval-judges-BkmiVLLq.cjs +59 -0
  23. package/dist/eval-judges-CwTvTq7N.mjs +42 -0
  24. package/dist/eval-judges-DPPUftbh.d.cts +48 -0
  25. package/dist/eval-judges-DPPUftbh.d.mts +48 -0
  26. package/dist/eval-validations-BRdoZrTQ.mjs +113 -0
  27. package/dist/eval-validations-_MlnQ_uv.cjs +148 -0
  28. package/dist/eval.cjs +1 -1
  29. package/dist/eval.d.cts +60 -6
  30. package/dist/eval.d.mts +60 -6
  31. package/dist/eval.mjs +1 -1
  32. package/dist/evals-B6aT3xgH.d.cts +1364 -0
  33. package/dist/evals-B6aT3xgH.d.mts +1364 -0
  34. package/dist/evals-Dcc_x6jW.mjs +582 -0
  35. package/dist/evals-DouMsrsM.cjs +737 -0
  36. package/dist/index.cjs +23 -99
  37. package/dist/index.d.cts +138 -34
  38. package/dist/index.d.mts +138 -34
  39. package/dist/index.mjs +23 -99
  40. package/dist/source.d.cts +1 -1
  41. package/dist/source.d.mts +1 -1
  42. package/dist/{types-oaMF6-E1.d.mts → types-Codjaq-o.d.mts} +146 -45
  43. package/dist/{types-H9L450Iu.d.cts → types-ISsteq95.d.cts} +146 -45
  44. package/dist/validator-runtime.cjs +238 -0
  45. package/dist/validator-runtime.d.cts +9 -0
  46. package/dist/validator-runtime.d.mts +9 -0
  47. package/dist/validator-runtime.mjs +237 -0
  48. package/dist/validators.cjs +10 -0
  49. package/dist/validators.d.cts +8 -0
  50. package/dist/validators.d.mts +8 -0
  51. package/dist/validators.mjs +9 -0
  52. package/package.json +11 -1
  53. package/dist/client-5K3dMI5Q.mjs +0 -849
  54. package/dist/client-Ci0woWLW.cjs +0 -890
  55. package/dist/evals-BEgEmfiO.d.cts +0 -603
  56. package/dist/evals-BEgEmfiO.d.mts +0 -603
  57. package/dist/harness-profile-BMjsN460.mjs +0 -43
  58. 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). Run coding agent evals across harnesses, models, and sandboxes, and manage versioned prompts from the same client.
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
- ## Run an eval
11
+ ## Define an eval
12
12
 
13
13
  ```ts
14
- import { Anpord } from "anpord";
15
-
16
- const anpord = new Anpord({ apiKey: process.env.ANPORD_API_KEY });
14
+ import { defineEval, empty } from "anpord";
17
15
 
18
- const run = await anpord.evals.startAndWait({
16
+ export default defineEval({
17
+ name: "greeting",
18
+ source: empty,
19
+ prompt: "{{task}}",
19
20
  cases: [
20
21
  {
21
- name: "writes the requested file",
22
+ name: "writes hello",
22
23
  variables: { task: "Create hello.txt containing exactly hello" },
23
- verify: "test \"$(cat hello.txt)\" = hello",
24
+ verify: 'test "$(cat hello.txt)" = hello',
24
25
  },
25
26
  ],
26
- prompt: "{{task}}",
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
- For a TypeScript validator, export the function from its own file:
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
- Reference it directly from `greeting.eval.ts`:
36
+ With no file, the CLI discovers every `**/*.eval.ts` suite.
46
37
 
47
- ```ts
48
- import { defineEval } from "anpord";
49
- import { hasGreeting } from "./validators/greeting";
38
+ ## Mock MCP and CLI
50
39
 
51
- export default defineEval({
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
- npx anpord eval
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 api = server({
84
- name: "example",
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: z.object({ id: z.string(), name: z.string() }),
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 client = cli({
116
- path: "example",
70
+ export const usersCli = cli({
71
+ path: "users",
117
72
  version: "1.0.0",
118
73
  commands: [
119
74
  command({
120
- path: ["users", "get"],
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
- export default defineEval({
130
- cli: [client],
131
- // cases, prompt, tasks, and trials
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 built-in agent receives the executable on `PATH`. Validators can inspect
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
- ## Resolve a prompt
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
- const prompt = await anpord.prompts.get({ id: "support-reply" });
142
- console.log(prompt.content, prompt.version);
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
- See the [documentation](https://docs.anpord.com) for eval concepts, prompt releases, SDK methods, and the API reference.
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