anpord 0.1.13 → 0.1.16

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 (65) hide show
  1. package/dist/api-context.cjs +18 -0
  2. package/dist/api-context.d.cts +8 -0
  3. package/dist/api-context.d.mts +8 -0
  4. package/dist/api-context.mjs +17 -0
  5. package/dist/api-mocks-B3qngoqS.cjs +68 -0
  6. package/dist/api-mocks-BfKw_hXc.mjs +33 -0
  7. package/dist/api-mocks-Bz3G00ve.d.cts +101 -0
  8. package/dist/api-mocks-Bz3G00ve.d.mts +101 -0
  9. package/dist/api-runtime.cjs +4 -0
  10. package/dist/api-runtime.d.cts +13 -0
  11. package/dist/api-runtime.d.mts +13 -0
  12. package/dist/api-runtime.mjs +2 -0
  13. package/dist/api.cjs +5 -0
  14. package/dist/api.d.cts +4 -0
  15. package/dist/api.d.mts +4 -0
  16. package/dist/api.mjs +2 -0
  17. package/dist/bin.cjs +8 -8
  18. package/dist/bin.mjs +6 -6
  19. package/dist/cli-runtime.cjs +1 -1
  20. package/dist/cli-runtime.mjs +1 -1
  21. package/dist/{client-BgRs8JvW.d.mts → client-C8tBcLYs.d.mts} +17 -17
  22. package/dist/{client-BirFO3jz.d.cts → client-CMkx-LKC.d.cts} +16 -16
  23. package/dist/{client-C-P2I00z.cjs → client-CfYNoI3L.cjs} +4 -91
  24. package/dist/{client-BfdjFtlV.mjs → client-YWKJd3f-.mjs} +3 -90
  25. package/dist/{compiler-uwb1pkdK.cjs → compiler-4FKsNxZ-.cjs} +89 -33
  26. package/dist/{compiler-D96wI7UP.mjs → compiler-Dsltkkj5.mjs} +77 -21
  27. package/dist/config.cjs +1 -1
  28. package/dist/config.d.cts +1 -1
  29. package/dist/config.d.mts +1 -1
  30. package/dist/config.mjs +1 -1
  31. package/dist/define-NZvmQuIv.d.cts +34 -0
  32. package/dist/define-NZvmQuIv.d.mts +34 -0
  33. package/dist/{eval-judges-DPPUftbh.d.cts → eval-judges-JiC8cUCE.d.cts} +1 -1
  34. package/dist/{eval-judges-DPPUftbh.d.mts → eval-judges-JiC8cUCE.d.mts} +1 -1
  35. package/dist/{eval-validations-BRdoZrTQ.mjs → eval-validations-Bmagd2y7.mjs} +2 -2
  36. package/dist/{eval-validations-_MlnQ_uv.cjs → eval-validations-CqMUt5ra.cjs} +7 -1
  37. package/dist/eval.cjs +1 -1
  38. package/dist/eval.d.cts +42 -21
  39. package/dist/eval.d.mts +42 -21
  40. package/dist/eval.mjs +1 -1
  41. package/dist/{evals-B6aT3xgH.d.cts → evals-B2UuSop0.d.cts} +136 -136
  42. package/dist/{evals-B6aT3xgH.d.mts → evals-B2UuSop0.d.mts} +136 -136
  43. package/dist/{types-Codjaq-o.d.mts → evals-api-CfAA3cew.d.mts} +12 -112
  44. package/dist/{types-ISsteq95.d.cts → evals-api-Clbj_nEN.d.cts} +11 -111
  45. package/dist/{evals-Dcc_x6jW.mjs → evals-api-DDv4gXU1.mjs} +95 -4
  46. package/dist/{evals-DouMsrsM.cjs → evals-api-kOuyIqvB.cjs} +103 -72
  47. package/dist/index.cjs +2 -2
  48. package/dist/index.d.cts +6 -6
  49. package/dist/index.d.mts +7 -7
  50. package/dist/index.mjs +2 -2
  51. package/dist/mcp-runtime.cjs +1 -1
  52. package/dist/mcp-runtime.mjs +1 -1
  53. package/dist/runtime-C0_JPkef.mjs +269 -0
  54. package/dist/runtime-YVJP5P2r.cjs +292 -0
  55. package/dist/source.d.cts +1 -1
  56. package/dist/source.d.mts +1 -1
  57. package/dist/types-BHokRQpg.d.mts +112 -0
  58. package/dist/types-UKEi5CCa.d.cts +112 -0
  59. package/dist/validator-runtime.cjs +6 -1
  60. package/dist/validator-runtime.d.cts +1 -1
  61. package/dist/validator-runtime.d.mts +1 -1
  62. package/dist/validator-runtime.mjs +6 -1
  63. package/dist/validators.d.cts +1 -1
  64. package/dist/validators.d.mts +1 -1
  65. package/package.json +21 -1
@@ -1,12 +1,6 @@
1
1
  import "./errors-aGrd21jy.mjs";
2
- import { t as EvalJudge } from "./eval-judges-DPPUftbh.mjs";
3
- import { f as EvalSource, o as EvalHarness } from "./evals-B6aT3xgH.mjs";
4
- import { t as McpCall } from "./calls-DYqBi5FA.mjs";
5
- import { n as McpServerDefinition } from "./define-HK0eeSNn.mjs";
6
- import { t as CliCall } from "./calls-Drj_dZpu.mjs";
7
- import { n as CliDefinition } from "./define-BEiYXrC5.mjs";
8
- import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSecurity } from "@effect/platform";
9
2
  import { Context, Schema } from "effect";
3
+ import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSecurity } from "@effect/platform";
10
4
  //#region ../schema/src/public/evals-api.d.ts
11
5
  declare const PublicStartEvalRequest: Schema.Struct<{
12
6
  trigger: Schema.optional<Schema.Struct<{
@@ -14,6 +8,7 @@ declare const PublicStartEvalRequest: Schema.Struct<{
14
8
  url: Schema.optional<Schema.filter<Schema.filter<typeof Schema.String>>>;
15
9
  }>>;
16
10
  cases: Schema.filter<Schema.filter<Schema.Array$<Schema.refine<{
11
+ readonly name: string;
17
12
  readonly source?: {
18
13
  readonly kind: "empty";
19
14
  } | {
@@ -30,14 +25,13 @@ declare const PublicStartEvalRequest: Schema.Struct<{
30
25
  readonly key: string;
31
26
  readonly path: string;
32
27
  } | undefined;
33
- readonly name: string;
34
28
  readonly prepare?: {
35
- readonly source: string;
36
29
  readonly name: string;
30
+ readonly source: string;
37
31
  } | null | undefined;
38
32
  readonly validator?: ({
39
- readonly source: string;
40
33
  readonly name: string;
34
+ readonly source: string;
41
35
  readonly capture?: boolean | undefined;
42
36
  readonly manifest?: readonly {
43
37
  readonly name: string;
@@ -57,8 +51,8 @@ declare const PublicStartEvalRequest: Schema.Struct<{
57
51
  readonly content: string;
58
52
  }[] | undefined;
59
53
  readonly checks: readonly {
60
- readonly source: string;
61
54
  readonly name: string;
55
+ readonly source: string;
62
56
  readonly capture?: boolean | undefined;
63
57
  readonly manifest?: readonly {
64
58
  readonly name: string;
@@ -67,10 +61,10 @@ declare const PublicStartEvalRequest: Schema.Struct<{
67
61
  }[];
68
62
  readonly judges: readonly ({
69
63
  readonly harness?: undefined;
64
+ readonly model: string;
70
65
  readonly name: string;
71
66
  readonly kind: "judge";
72
67
  readonly provider: "openai";
73
- readonly model: string;
74
68
  readonly rubric: string;
75
69
  readonly expected?: string | undefined;
76
70
  readonly choices: {
@@ -79,11 +73,11 @@ declare const PublicStartEvalRequest: Schema.Struct<{
79
73
  readonly threshold: number;
80
74
  readonly timeoutMs: number;
81
75
  } | {
82
- readonly harness: "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen" | "cursor";
76
+ readonly harness: "cursor" | "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen";
77
+ readonly model: string;
83
78
  readonly name: string;
84
79
  readonly kind: "judge";
85
80
  readonly provider?: undefined;
86
- readonly model: string;
87
81
  readonly rubric: string;
88
82
  readonly expected?: string | undefined;
89
83
  readonly choices: {
@@ -100,7 +94,7 @@ declare const PublicStartEvalRequest: Schema.Struct<{
100
94
  }, Schema.Struct<{
101
95
  cache: Schema.optional<Schema.Struct<{
102
96
  key: Schema.filter<typeof Schema.String>;
103
- path: Schema.filter<Schema.filter<typeof Schema.String>>;
97
+ path: Schema.filter<Schema.filter<Schema.filter<typeof Schema.String>>>;
104
98
  }>>;
105
99
  name: Schema.refine<string, typeof Schema.String>;
106
100
  prepare: Schema.optional<Schema.NullOr<Schema.Struct<{
@@ -160,7 +154,7 @@ declare const PublicStartEvalRequest: Schema.Struct<{
160
154
  }>;
161
155
  }>, Schema.Struct<{
162
156
  provider: Schema.optional<typeof Schema.Never>;
163
- harness: Schema.SchemaClass<"codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen" | "cursor", "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen" | "cursor", never>;
157
+ harness: Schema.SchemaClass<"cursor" | "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen", "cursor" | "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen", never>;
164
158
  kind: Schema.Literal<["judge"]>;
165
159
  name: Schema.filter<Schema.filter<typeof Schema.String>>;
166
160
  model: Schema.filter<Schema.filter<typeof Schema.String>>;
@@ -185,7 +179,7 @@ declare const PublicStartEvalRequest: Schema.Struct<{
185
179
  name: Schema.optional<Schema.filter<Schema.filter<typeof Schema.String>>>;
186
180
  prompt: Schema.refine<string, typeof Schema.String>;
187
181
  tasks: Schema.filter<Schema.filter<Schema.Array$<Schema.refine<{
188
- readonly harness: "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen" | "cursor" | "command";
182
+ readonly harness: "cursor" | "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen" | "command";
189
183
  readonly model: string;
190
184
  readonly profile?: {
191
185
  readonly name: string;
@@ -217,98 +211,4 @@ declare const PublicStartEvalRequest: Schema.Struct<{
217
211
  }>;
218
212
  type PublicStartEvalRequest = typeof PublicStartEvalRequest.Type;
219
213
  //#endregion
220
- //#region src/evals/types.d.ts
221
- type EvalTaskRequest = PublicStartEvalRequest["tasks"][number];
222
- /** A profile directory beside the eval file; `dir` resolves against it. */
223
- interface ProfileRef {
224
- readonly dir: string;
225
- readonly name: string;
226
- }
227
- type HarnessRef = EvalHarness | {
228
- readonly base: EvalHarness;
229
- readonly profile: ProfileRef;
230
- };
231
- interface EvalTaskDefinition {
232
- readonly harness: HarnessRef;
233
- readonly model: EvalTaskRequest["model"];
234
- readonly sandbox?: EvalTaskRequest["sandbox"];
235
- }
236
- interface CommandResult {
237
- readonly exitCode: number;
238
- readonly stderr: string;
239
- readonly stdout: string;
240
- }
241
- interface ExecOptions {
242
- readonly cwd?: string;
243
- readonly env?: Readonly<Record<string, string>>;
244
- readonly timeoutMs?: number;
245
- }
246
- /** Entries are write-once, so the key must name everything the contents
247
- * depend on -- a lockfile hash above all. */
248
- interface CaseCache {
249
- readonly key: string;
250
- /** Relative to the workspace. */
251
- readonly path: string;
252
- }
253
- interface PrepareContext {
254
- /** True when the runner restored a cached directory, so a prepare can skip
255
- * the work that produced it. */
256
- readonly cached: boolean;
257
- readonly exec: (file: string, args?: readonly string[], options?: ExecOptions) => Promise<CommandResult>;
258
- readonly exists: (path: string) => Promise<boolean>;
259
- readonly readText: (path: string) => Promise<string>;
260
- readonly workspace: string;
261
- }
262
- type PrepareValue = Readonly<Record<string, unknown>>;
263
- type Prepare = (context: PrepareContext) => Promise<PrepareValue | undefined> | PrepareValue | undefined;
264
- interface ValidatorContext {
265
- /** Empty when the agent said nothing. */
266
- readonly answer: () => Promise<string>;
267
- readonly cli: {
268
- readonly calls: (cli?: string) => Promise<readonly CliCall[]>;
269
- };
270
- readonly exec: (command: string) => Promise<CommandResult>;
271
- readonly exists: (path: string) => Promise<boolean>;
272
- readonly mcp: {
273
- readonly calls: (server?: string) => Promise<readonly McpCall[]>;
274
- };
275
- readonly prepared: Readonly<Record<string, unknown>>;
276
- readonly readText: (path: string) => Promise<string>;
277
- /** Every reply, oldest first, separated by a blank line. */
278
- readonly transcript: () => Promise<string>;
279
- }
280
- interface ValidatorResult {
281
- readonly message?: string;
282
- readonly passed: boolean;
283
- }
284
- type Validator = (context: ValidatorContext) => boolean | ValidatorResult | Promise<boolean | ValidatorResult>;
285
- type DeclaredSource = EvalSource | string;
286
- interface EvalCaseBase {
287
- /** Restored before the prepare runs, saved after it succeeds. */
288
- readonly cache?: CaseCache;
289
- readonly name: string;
290
- readonly prepare?: Prepare | null;
291
- readonly source?: DeclaredSource;
292
- readonly variables?: Readonly<Record<string, string>>;
293
- }
294
- type EvalCaseDefinition = EvalCaseBase & ({
295
- readonly validate: Validator | EvalJudge | readonly (Validator | EvalJudge)[];
296
- readonly verify?: never;
297
- } | {
298
- readonly validate?: never;
299
- readonly verify: string;
300
- });
301
- interface EvalDefinition {
302
- readonly captureSource?: boolean;
303
- readonly captureValidation?: boolean;
304
- readonly cases: readonly EvalCaseDefinition[];
305
- readonly cli?: readonly CliDefinition[];
306
- readonly mcp?: readonly McpServerDefinition[];
307
- readonly name: string;
308
- readonly prompt: string;
309
- readonly source?: DeclaredSource;
310
- readonly tasks: readonly EvalTaskDefinition[];
311
- readonly trials: number;
312
- }
313
- //#endregion
314
- export { EvalTaskDefinition as a, Prepare as c, ProfileRef as d, Validator as f, PublicStartEvalRequest as h, EvalDefinition as i, PrepareContext as l, ValidatorResult as m, CommandResult as n, ExecOptions as o, ValidatorContext as p, EvalCaseDefinition as r, HarnessRef as s, CaseCache as t, PrepareValue as u };
214
+ export { PublicStartEvalRequest as t };
@@ -1,10 +1,4 @@
1
1
  import "./errors-aGrd21jy.cjs";
2
- import { t as EvalJudge } from "./eval-judges-DPPUftbh.cjs";
3
- import { f as EvalSource, o as EvalHarness } from "./evals-B6aT3xgH.cjs";
4
- import { t as McpCall } from "./calls-DYqBi5FA.cjs";
5
- import { n as McpServerDefinition } from "./define-HK0eeSNn.cjs";
6
- import { t as CliCall } from "./calls-Drj_dZpu.cjs";
7
- import { n as CliDefinition } from "./define-BEiYXrC5.cjs";
8
2
  import { Schema } from "effect";
9
3
  import "@effect/platform";
10
4
  //#region ../schema/src/public/evals-api.d.ts
@@ -14,6 +8,7 @@ declare const PublicStartEvalRequest: Schema.Struct<{
14
8
  url: Schema.optional<Schema.filter<Schema.filter<typeof Schema.String>>>;
15
9
  }>>;
16
10
  cases: Schema.filter<Schema.filter<Schema.Array$<Schema.refine<{
11
+ readonly name: string;
17
12
  readonly source?: {
18
13
  readonly kind: "empty";
19
14
  } | {
@@ -30,14 +25,13 @@ declare const PublicStartEvalRequest: Schema.Struct<{
30
25
  readonly key: string;
31
26
  readonly path: string;
32
27
  } | undefined;
33
- readonly name: string;
34
28
  readonly prepare?: {
35
- readonly source: string;
36
29
  readonly name: string;
30
+ readonly source: string;
37
31
  } | null | undefined;
38
32
  readonly validator?: ({
39
- readonly source: string;
40
33
  readonly name: string;
34
+ readonly source: string;
41
35
  readonly capture?: boolean | undefined;
42
36
  readonly manifest?: readonly {
43
37
  readonly name: string;
@@ -57,8 +51,8 @@ declare const PublicStartEvalRequest: Schema.Struct<{
57
51
  readonly content: string;
58
52
  }[] | undefined;
59
53
  readonly checks: readonly {
60
- readonly source: string;
61
54
  readonly name: string;
55
+ readonly source: string;
62
56
  readonly capture?: boolean | undefined;
63
57
  readonly manifest?: readonly {
64
58
  readonly name: string;
@@ -67,10 +61,10 @@ declare const PublicStartEvalRequest: Schema.Struct<{
67
61
  }[];
68
62
  readonly judges: readonly ({
69
63
  readonly harness?: undefined;
64
+ readonly model: string;
70
65
  readonly name: string;
71
66
  readonly kind: "judge";
72
67
  readonly provider: "openai";
73
- readonly model: string;
74
68
  readonly rubric: string;
75
69
  readonly expected?: string | undefined;
76
70
  readonly choices: {
@@ -79,11 +73,11 @@ declare const PublicStartEvalRequest: Schema.Struct<{
79
73
  readonly threshold: number;
80
74
  readonly timeoutMs: number;
81
75
  } | {
82
- readonly harness: "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen" | "cursor";
76
+ readonly harness: "cursor" | "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen";
77
+ readonly model: string;
83
78
  readonly name: string;
84
79
  readonly kind: "judge";
85
80
  readonly provider?: undefined;
86
- readonly model: string;
87
81
  readonly rubric: string;
88
82
  readonly expected?: string | undefined;
89
83
  readonly choices: {
@@ -100,7 +94,7 @@ declare const PublicStartEvalRequest: Schema.Struct<{
100
94
  }, Schema.Struct<{
101
95
  cache: Schema.optional<Schema.Struct<{
102
96
  key: Schema.filter<typeof Schema.String>;
103
- path: Schema.filter<Schema.filter<typeof Schema.String>>;
97
+ path: Schema.filter<Schema.filter<Schema.filter<typeof Schema.String>>>;
104
98
  }>>;
105
99
  name: Schema.refine<string, typeof Schema.String>;
106
100
  prepare: Schema.optional<Schema.NullOr<Schema.Struct<{
@@ -160,7 +154,7 @@ declare const PublicStartEvalRequest: Schema.Struct<{
160
154
  }>;
161
155
  }>, Schema.Struct<{
162
156
  provider: Schema.optional<typeof Schema.Never>;
163
- harness: Schema.SchemaClass<"codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen" | "cursor", "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen" | "cursor", never>;
157
+ harness: Schema.SchemaClass<"cursor" | "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen", "cursor" | "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen", never>;
164
158
  kind: Schema.Literal<["judge"]>;
165
159
  name: Schema.filter<Schema.filter<typeof Schema.String>>;
166
160
  model: Schema.filter<Schema.filter<typeof Schema.String>>;
@@ -185,7 +179,7 @@ declare const PublicStartEvalRequest: Schema.Struct<{
185
179
  name: Schema.optional<Schema.filter<Schema.filter<typeof Schema.String>>>;
186
180
  prompt: Schema.refine<string, typeof Schema.String>;
187
181
  tasks: Schema.filter<Schema.filter<Schema.Array$<Schema.refine<{
188
- readonly harness: "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen" | "cursor" | "command";
182
+ readonly harness: "cursor" | "codex" | "opencode" | "pi" | "fx" | "claude" | "gemini" | "qwen" | "command";
189
183
  readonly model: string;
190
184
  readonly profile?: {
191
185
  readonly name: string;
@@ -217,98 +211,4 @@ declare const PublicStartEvalRequest: Schema.Struct<{
217
211
  }>;
218
212
  type PublicStartEvalRequest = typeof PublicStartEvalRequest.Type;
219
213
  //#endregion
220
- //#region src/evals/types.d.ts
221
- type EvalTaskRequest = PublicStartEvalRequest["tasks"][number];
222
- /** A profile directory beside the eval file; `dir` resolves against it. */
223
- interface ProfileRef {
224
- readonly dir: string;
225
- readonly name: string;
226
- }
227
- type HarnessRef = EvalHarness | {
228
- readonly base: EvalHarness;
229
- readonly profile: ProfileRef;
230
- };
231
- interface EvalTaskDefinition {
232
- readonly harness: HarnessRef;
233
- readonly model: EvalTaskRequest["model"];
234
- readonly sandbox?: EvalTaskRequest["sandbox"];
235
- }
236
- interface CommandResult {
237
- readonly exitCode: number;
238
- readonly stderr: string;
239
- readonly stdout: string;
240
- }
241
- interface ExecOptions {
242
- readonly cwd?: string;
243
- readonly env?: Readonly<Record<string, string>>;
244
- readonly timeoutMs?: number;
245
- }
246
- /** Entries are write-once, so the key must name everything the contents
247
- * depend on -- a lockfile hash above all. */
248
- interface CaseCache {
249
- readonly key: string;
250
- /** Relative to the workspace. */
251
- readonly path: string;
252
- }
253
- interface PrepareContext {
254
- /** True when the runner restored a cached directory, so a prepare can skip
255
- * the work that produced it. */
256
- readonly cached: boolean;
257
- readonly exec: (file: string, args?: readonly string[], options?: ExecOptions) => Promise<CommandResult>;
258
- readonly exists: (path: string) => Promise<boolean>;
259
- readonly readText: (path: string) => Promise<string>;
260
- readonly workspace: string;
261
- }
262
- type PrepareValue = Readonly<Record<string, unknown>>;
263
- type Prepare = (context: PrepareContext) => Promise<PrepareValue | undefined> | PrepareValue | undefined;
264
- interface ValidatorContext {
265
- /** Empty when the agent said nothing. */
266
- readonly answer: () => Promise<string>;
267
- readonly cli: {
268
- readonly calls: (cli?: string) => Promise<readonly CliCall[]>;
269
- };
270
- readonly exec: (command: string) => Promise<CommandResult>;
271
- readonly exists: (path: string) => Promise<boolean>;
272
- readonly mcp: {
273
- readonly calls: (server?: string) => Promise<readonly McpCall[]>;
274
- };
275
- readonly prepared: Readonly<Record<string, unknown>>;
276
- readonly readText: (path: string) => Promise<string>;
277
- /** Every reply, oldest first, separated by a blank line. */
278
- readonly transcript: () => Promise<string>;
279
- }
280
- interface ValidatorResult {
281
- readonly message?: string;
282
- readonly passed: boolean;
283
- }
284
- type Validator = (context: ValidatorContext) => boolean | ValidatorResult | Promise<boolean | ValidatorResult>;
285
- type DeclaredSource = EvalSource | string;
286
- interface EvalCaseBase {
287
- /** Restored before the prepare runs, saved after it succeeds. */
288
- readonly cache?: CaseCache;
289
- readonly name: string;
290
- readonly prepare?: Prepare | null;
291
- readonly source?: DeclaredSource;
292
- readonly variables?: Readonly<Record<string, string>>;
293
- }
294
- type EvalCaseDefinition = EvalCaseBase & ({
295
- readonly validate: Validator | EvalJudge | readonly (Validator | EvalJudge)[];
296
- readonly verify?: never;
297
- } | {
298
- readonly validate?: never;
299
- readonly verify: string;
300
- });
301
- interface EvalDefinition {
302
- readonly captureSource?: boolean;
303
- readonly captureValidation?: boolean;
304
- readonly cases: readonly EvalCaseDefinition[];
305
- readonly cli?: readonly CliDefinition[];
306
- readonly mcp?: readonly McpServerDefinition[];
307
- readonly name: string;
308
- readonly prompt: string;
309
- readonly source?: DeclaredSource;
310
- readonly tasks: readonly EvalTaskDefinition[];
311
- readonly trials: number;
312
- }
313
- //#endregion
314
- export { EvalTaskDefinition as a, Prepare as c, ProfileRef as d, Validator as f, PublicStartEvalRequest as h, EvalDefinition as i, PrepareContext as l, ValidatorResult as m, CommandResult as n, ExecOptions as o, ValidatorContext as p, EvalCaseDefinition as r, HarnessRef as s, CaseCache as t, PrepareValue as u };
214
+ export { PublicStartEvalRequest as t };
@@ -1,6 +1,15 @@
1
1
  import { n as EvalJudgment, r as EvalHarness$1, t as EvalJudge } from "./eval-judges-CwTvTq7N.mjs";
2
- import { t as EvalValidations } from "./eval-validations-BRdoZrTQ.mjs";
3
- import { Schema } from "effect";
2
+ import { t as EvalValidations } from "./eval-validations-Bmagd2y7.mjs";
3
+ import { Context, Schema } from "effect";
4
+ import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, HttpApiSecurity, OpenApi } from "@effect/platform";
5
+ //#region ../schema/src/domain/errors.ts
6
+ var NotFound = class extends Schema.TaggedError()("NotFound", { message: Schema.String }, HttpApiSchema.annotations({ status: 404 })) {};
7
+ var Conflict = class extends Schema.TaggedError()("Conflict", { message: Schema.String }, HttpApiSchema.annotations({ status: 409 })) {};
8
+ var BadRequest = class extends Schema.TaggedError()("BadRequest", { message: Schema.String }, HttpApiSchema.annotations({ status: 400 })) {};
9
+ var Unauthorized = class extends Schema.TaggedError()("Unauthorized", { message: Schema.String }, HttpApiSchema.annotations({ status: 401 })) {};
10
+ var Forbidden = class extends Schema.TaggedError()("Forbidden", { message: Schema.String }, HttpApiSchema.annotations({ status: 403 })) {};
11
+ Schema.TaggedError()("InternalError", { message: Schema.String }, HttpApiSchema.annotations({ status: 500 }));
12
+ //#endregion
4
13
  //#region ../schema/src/domain/eval-limits.ts
5
14
  const PROMPT_LIMIT = 16384;
6
15
  const VERIFY_LIMIT = 8192;
@@ -232,7 +241,10 @@ const EvalVariables = Schema.Record({
232
241
  });
233
242
  const CaseCache = Schema.Struct({
234
243
  key: Schema.String.pipe(Schema.minLength(1)),
235
- path: Schema.String.pipe(Schema.minLength(1), Schema.filter((value) => !(value.startsWith("/") || value.split("/").includes("..")), { message: () => "a cache path must stay inside the workspace" }))
244
+ path: Schema.String.pipe(Schema.minLength(1), Schema.filter((value) => !(value.startsWith("/") || value.split("/").includes("..")), { message: () => "a cache path must stay inside the workspace" }), Schema.filter((value) => {
245
+ const directory = value.split("/").find((part) => part !== "" && part !== ".");
246
+ return directory !== void 0 && directory !== ".anpord";
247
+ }, { message: () => "a cache must name a subdirectory outside the reserved .anpord runtime" }))
236
248
  }).annotations({ identifier: "CaseCache" });
237
249
  const EvalCase = Schema.Struct({
238
250
  cache: Schema.optional(CaseCache),
@@ -579,4 +591,83 @@ const ModelCatalogue = Schema.Struct({
579
591
  identifier: "ModelCatalogue"
580
592
  });
581
593
  //#endregion
582
- export { EvalTrigger as C, EvalVerify as E, EvalSourceFiles as S, EvalPrompt as T, HarnessProfile as _, EvalPageCursor as a, ProfilePath as b, EvalRunPage as c, EvalValidator as d, EvalVariables as f, EnvName as g, StartedEval as h, EvalName as i, EvalSandbox as l, RerunCellRequest as m, EvalCellHistoryEntry as n, EvalPrepare as o, ModelCatalogue as p, EvalHarness as r, EvalRun as s, CaseCache as t, EvalSource as u, PROFILE_HARNESS_RULE as v, EvalCaseName as w, profileFitsHarness as x, PROFILE_LIMITS as y };
594
+ //#region ../schema/src/internal/authentication.ts
595
+ var CurrentActor = class extends Context.Tag("@anpord/schema/CurrentActor")() {};
596
+ HttpApiMiddleware.Tag()("@anpord/schema/Authentication", {
597
+ failure: Unauthorized,
598
+ provides: CurrentActor,
599
+ security: { session: HttpApiSecurity.apiKey({
600
+ in: "cookie",
601
+ key: "anpord.session_token"
602
+ }) }
603
+ });
604
+ //#endregion
605
+ //#region ../schema/src/public/authentication.ts
606
+ var ApiKeyAuthentication = class extends HttpApiMiddleware.Tag()("@anpord/schema/ApiKeyAuthentication", {
607
+ failure: Unauthorized,
608
+ provides: CurrentActor,
609
+ security: { bearer: HttpApiSecurity.bearer }
610
+ }) {};
611
+ //#endregion
612
+ //#region ../schema/src/public/evals-api.ts
613
+ const EvalRunRequest = Schema.Struct({ id: Schema.String }).annotations({
614
+ description: "Select an eval run by id.",
615
+ identifier: "EvalRunRequest"
616
+ });
617
+ const EvalCellRequest = Schema.Struct({ cellKey: Schema.String }).annotations({
618
+ description: "Select an eval cell by its stable key.",
619
+ identifier: "EvalCellRequest"
620
+ });
621
+ const EvalModelsRequest = Schema.Struct({
622
+ harness: EvalHarness,
623
+ q: Schema.optional(Schema.String)
624
+ }).annotations({
625
+ description: "Select a harness whose available models should be listed.",
626
+ identifier: "EvalModelsRequest"
627
+ });
628
+ const PublicEvalSandbox = EvalSandbox.annotations({
629
+ description: "The hosted sandbox a task runs in.",
630
+ identifier: "PublicEvalSandbox"
631
+ });
632
+ const ListEvalsRequest = Schema.Struct({
633
+ cursor: Schema.optional(Schema.NullOr(EvalPageCursor)),
634
+ limit: Schema.optional(Schema.Int)
635
+ }).annotations({
636
+ description: "Where to read from, and how much.",
637
+ identifier: "ListEvalsRequest"
638
+ });
639
+ const PublicEvalCase = Schema.Struct({
640
+ cache: Schema.optional(CaseCache),
641
+ name: EvalCaseName,
642
+ prepare: Schema.optional(Schema.NullOr(EvalPrepare)),
643
+ source: Schema.optional(EvalSource),
644
+ validator: Schema.optional(Schema.NullOr(EvalValidator)),
645
+ variables: Schema.optional(EvalVariables),
646
+ verify: Schema.NullOr(EvalVerify)
647
+ }).pipe(Schema.filter(({ validator, verify }) => !(validator !== void 0 && validator !== null && verify !== null), { message: () => "Use either validator or verify, not both." })).annotations({
648
+ description: "A task, workspace source, setup command, and verifier.",
649
+ identifier: "StartEvalCase"
650
+ });
651
+ const PublicEvalTask = Schema.Struct({
652
+ harness: EvalHarness,
653
+ model: Schema.String.pipe(Schema.minLength(1)),
654
+ profile: Schema.optional(HarnessProfile),
655
+ sandbox: Schema.optional(PublicEvalSandbox)
656
+ }).pipe(Schema.filter(profileFitsHarness, { message: () => PROFILE_HARNESS_RULE })).annotations({
657
+ description: `A harness and model, with an optional sandbox and an optional profile layered on the harness. Omit the sandbox to use the default. ${PROFILE_HARNESS_RULE}`,
658
+ identifier: "StartEvalTask"
659
+ });
660
+ const PublicStartEvalRequest = Schema.Struct({
661
+ trigger: Schema.optional(EvalTrigger),
662
+ cases: Schema.Array(PublicEvalCase).pipe(Schema.minItems(1), Schema.maxItems(100)),
663
+ name: Schema.optional(EvalName),
664
+ prompt: EvalPrompt,
665
+ tasks: Schema.Array(PublicEvalTask).pipe(Schema.minItems(1), Schema.maxItems(20)),
666
+ trials: Schema.Int.pipe(Schema.between(1, 10))
667
+ }).annotations({
668
+ description: `Start a grid with at most 100 total case, task, and trial combinations.`,
669
+ identifier: "StartEvalRequest"
670
+ });
671
+ var PublicEvalsGroup = class extends HttpApiGroup.make("evals").add(HttpApiEndpoint.post("list", "/evals.list").setPayload(ListEvalsRequest).addSuccess(EvalRunPage).annotate(OpenApi.Summary, "List eval runs").annotate(OpenApi.Description, "Newest first. Pass the `next` cursor from a response to read the page after it; a null `next` means there are no more.")).add(HttpApiEndpoint.post("start", "/evals.start").setPayload(PublicStartEvalRequest).addSuccess(StartedEval).annotate(OpenApi.Summary, "Start an eval run").annotate(OpenApi.Description, `Starts the grid and returns its id while trials continue in the background. ${PROFILE_HARNESS_RULE}`)).add(HttpApiEndpoint.post("get", "/evals.get").setPayload(EvalRunRequest).addSuccess(EvalRun).annotate(OpenApi.Summary, "Get an eval run")).add(HttpApiEndpoint.post("cellHistory", "/evals.cellHistory").setPayload(EvalCellRequest).addSuccess(Schema.Array(EvalCellHistoryEntry)).annotate(OpenApi.Summary, "List a cell's history").annotate(OpenApi.Description, "Returns the 20 most recent results.")).add(HttpApiEndpoint.post("rerunCell", "/evals.rerunCell").setPayload(Schema.extend(EvalRunRequest, Schema.extend(EvalCellRequest, RerunCellRequest))).addSuccess(StartedEval).annotate(OpenApi.Summary, "Rerun one cell")).add(HttpApiEndpoint.post("models", "/evals.models").setPayload(EvalModelsRequest).addSuccess(ModelCatalogue).annotate(OpenApi.Summary, "List models available to the harness").annotate(OpenApi.Description, "The command harness has no catalogue of its own, so its list is empty: the model is whatever the profile's run command reads from ANPORD_MODEL.")).addError(BadRequest).addError(Conflict).addError(Forbidden).addError(NotFound).middleware(ApiKeyAuthentication).annotate(OpenApi.Title, "Evals").annotate(OpenApi.Description, "Run cases across harness, model, and sandbox combinations and compare the results with their baselines.") {};
672
+ //#endregion
673
+ export { EvalValidator as a, PROFILE_LIMITS as c, EvalSourceFiles as d, EvalTrigger as f, NotFound as g, Forbidden as h, EvalRun as i, ProfilePath as l, Conflict as m, PublicStartEvalRequest as n, EnvName as o, BadRequest as p, ApiKeyAuthentication as r, HarnessProfile as s, PublicEvalsGroup as t, profileFitsHarness as u };