anpord 0.1.2 → 0.1.4
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 +69 -4
- package/dist/cli.cjs +274 -19
- package/dist/cli.mjs +275 -20
- package/dist/client-BCZEcfVE.cjs +759 -0
- package/dist/client-BfhmGRQl.mjs +718 -0
- package/dist/compiler-CKiewwUc.mjs +188 -0
- package/dist/compiler-CZoX4jkx.cjs +198 -0
- package/dist/config.cjs +1 -1
- package/dist/config.mjs +1 -1
- package/dist/{errors-C0E5A8fN.cjs → errors-Boum34f5.cjs} +30 -0
- package/dist/{errors-DEfS6oaQ.mjs → errors-C9bQUcA3.mjs} +25 -1
- package/dist/eval.cjs +4 -0
- package/dist/eval.d.cts +25 -0
- package/dist/eval.d.mts +25 -0
- package/dist/eval.mjs +2 -0
- package/dist/evals-api-DUNVUGUy.d.mts +93 -0
- package/dist/evals-api-sqVNeWet.d.cts +93 -0
- package/dist/index.cjs +428 -8
- package/dist/index.d.cts +2372 -195
- package/dist/index.d.mts +2372 -195
- package/dist/index.mjs +424 -10
- package/dist/source-DQ8HChlm.d.cts +478 -0
- package/dist/source-DQ8HChlm.d.mts +478 -0
- package/dist/source-DvlGawEw.cjs +76 -0
- package/dist/source-Fg1h2VNn.mjs +47 -0
- package/dist/source.cjs +5 -0
- package/dist/source.d.cts +2 -0
- package/dist/source.d.mts +2 -0
- package/dist/source.mjs +2 -0
- package/package.json +18 -4
- package/dist/client-Cno4LwRq.cjs +0 -277
- package/dist/client-bJBNwTKq.mjs +0 -236
|
@@ -0,0 +1,718 @@
|
|
|
1
|
+
import { FetchHttpClient, HttpApi, HttpApiClient, HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, HttpApiSecurity, HttpClient, HttpClientRequest, OpenApi } from "@effect/platform";
|
|
2
|
+
import { Context, Effect, Layer, Redacted, Schema } from "effect";
|
|
3
|
+
//#region ../schema/src/domain/errors.ts
|
|
4
|
+
var NotFound = class extends Schema.TaggedError()("NotFound", { message: Schema.String }, HttpApiSchema.annotations({ status: 404 })) {};
|
|
5
|
+
var Conflict = class extends Schema.TaggedError()("Conflict", { message: Schema.String }, HttpApiSchema.annotations({ status: 409 })) {};
|
|
6
|
+
var BadRequest = class extends Schema.TaggedError()("BadRequest", { message: Schema.String }, HttpApiSchema.annotations({ status: 400 })) {};
|
|
7
|
+
var Unauthorized = class extends Schema.TaggedError()("Unauthorized", { message: Schema.String }, HttpApiSchema.annotations({ status: 401 })) {};
|
|
8
|
+
/** Distinct from Unauthorized: the caller is who they say they are, and the
|
|
9
|
+
* answer is still no. Signing in again cannot help, so the client must not
|
|
10
|
+
* treat this as an expired session. */
|
|
11
|
+
var Forbidden = class extends Schema.TaggedError()("Forbidden", { message: Schema.String }, HttpApiSchema.annotations({ status: 403 })) {};
|
|
12
|
+
Schema.TaggedError()("InternalError", { message: Schema.String }, HttpApiSchema.annotations({ status: 500 }));
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region ../schema/src/domain/credentials.ts
|
|
15
|
+
const CredentialScope = Schema.Literal("organization", "personal");
|
|
16
|
+
const CredentialStatus = Schema.Literal("active", "invalid");
|
|
17
|
+
const CredentialField = Schema.Struct({
|
|
18
|
+
/** The shape of the value, shown as a placeholder beside the label. Absent
|
|
19
|
+
* where the label already says it, as a bare API key does. */
|
|
20
|
+
hint: Schema.optional(Schema.String),
|
|
21
|
+
label: Schema.String,
|
|
22
|
+
name: Schema.String,
|
|
23
|
+
required: Schema.Boolean,
|
|
24
|
+
secret: Schema.Boolean
|
|
25
|
+
});
|
|
26
|
+
const CredentialAuthMethod = Schema.Struct({
|
|
27
|
+
fields: Schema.Array(CredentialField),
|
|
28
|
+
id: Schema.String,
|
|
29
|
+
kind: Schema.Literal("secret", "device"),
|
|
30
|
+
label: Schema.String
|
|
31
|
+
});
|
|
32
|
+
Schema.Struct({
|
|
33
|
+
authMethods: Schema.Array(CredentialAuthMethod),
|
|
34
|
+
category: Schema.Literal("harness", "sandbox"),
|
|
35
|
+
id: Schema.String,
|
|
36
|
+
label: Schema.String
|
|
37
|
+
});
|
|
38
|
+
Schema.Struct({
|
|
39
|
+
integrationId: Schema.String,
|
|
40
|
+
/** Display names of the members holding one, so the reader knows who to
|
|
41
|
+
* ask. Never ids: this is read by everyone in the organization. */
|
|
42
|
+
owners: Schema.Array(Schema.String)
|
|
43
|
+
}).annotations({
|
|
44
|
+
description: "Who else in the organization has an integration connected.",
|
|
45
|
+
identifier: "IntegrationAwareness"
|
|
46
|
+
});
|
|
47
|
+
Schema.Struct({
|
|
48
|
+
authMethodId: Schema.String,
|
|
49
|
+
createdAt: Schema.DateTimeUtc,
|
|
50
|
+
id: Schema.String,
|
|
51
|
+
integrationId: Schema.String,
|
|
52
|
+
isDefault: Schema.Boolean,
|
|
53
|
+
lastUsedAt: Schema.NullOr(Schema.DateTimeUtc),
|
|
54
|
+
lastVerifiedAt: Schema.NullOr(Schema.DateTimeUtc),
|
|
55
|
+
name: Schema.String,
|
|
56
|
+
scope: CredentialScope,
|
|
57
|
+
status: CredentialStatus
|
|
58
|
+
});
|
|
59
|
+
const CredentialValues = Schema.Record({
|
|
60
|
+
key: Schema.String,
|
|
61
|
+
value: Schema.String
|
|
62
|
+
});
|
|
63
|
+
Schema.Struct({
|
|
64
|
+
authMethodId: Schema.String,
|
|
65
|
+
connectionId: Schema.String,
|
|
66
|
+
integrationId: Schema.String,
|
|
67
|
+
revision: Schema.Int,
|
|
68
|
+
values: CredentialValues
|
|
69
|
+
});
|
|
70
|
+
Schema.Struct({
|
|
71
|
+
authMethodId: Schema.String,
|
|
72
|
+
integrationId: Schema.String,
|
|
73
|
+
isDefault: Schema.optionalWith(Schema.Boolean, { default: () => false }),
|
|
74
|
+
name: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(80)),
|
|
75
|
+
scope: CredentialScope,
|
|
76
|
+
values: CredentialValues
|
|
77
|
+
});
|
|
78
|
+
const CredentialBindings = Schema.Struct({
|
|
79
|
+
harnessConnectionId: Schema.optional(Schema.String),
|
|
80
|
+
sandboxConnectionId: Schema.optional(Schema.String)
|
|
81
|
+
});
|
|
82
|
+
const CredentialSelections = Schema.Record({
|
|
83
|
+
key: Schema.String,
|
|
84
|
+
value: Schema.String
|
|
85
|
+
});
|
|
86
|
+
Schema.Struct({ values: CredentialValues });
|
|
87
|
+
Schema.Struct({
|
|
88
|
+
integrationId: Schema.Literal("codex"),
|
|
89
|
+
name: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(80)),
|
|
90
|
+
scope: CredentialScope
|
|
91
|
+
});
|
|
92
|
+
Schema.Struct({
|
|
93
|
+
attemptId: Schema.String,
|
|
94
|
+
code: Schema.String,
|
|
95
|
+
expiresAt: Schema.DateTimeUtc,
|
|
96
|
+
verificationUrl: Schema.String
|
|
97
|
+
});
|
|
98
|
+
Schema.Struct({
|
|
99
|
+
connectionId: Schema.NullOr(Schema.String),
|
|
100
|
+
status: Schema.Literal("pending", "complete", "failed", "expired")
|
|
101
|
+
});
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region ../schema/src/domain/evals.ts
|
|
104
|
+
const EvalProvider = Schema.Literal("daytona", "e2b", "upstash", "modal", "cloudflare", "vercel");
|
|
105
|
+
EvalProvider.literals;
|
|
106
|
+
const EvalHarness = Schema.Literal("codex", "opencode", "pi", "fx", "claude", "gemini", "qwen", "cursor");
|
|
107
|
+
Schema.Struct({
|
|
108
|
+
commands: Schema.Boolean,
|
|
109
|
+
fileChanges: Schema.Boolean,
|
|
110
|
+
streaming: Schema.Boolean,
|
|
111
|
+
usage: Schema.Boolean
|
|
112
|
+
});
|
|
113
|
+
const EvalTrialStatus = Schema.Literal("queued", "running", "passed", "failed", "void", "exceeded");
|
|
114
|
+
const EvalRunStatus = Schema.Literal("running", "finished", "failed");
|
|
115
|
+
const EvalSource = Schema.Union(Schema.Struct({ kind: Schema.Literal("empty") }), Schema.Struct({
|
|
116
|
+
kind: Schema.Literal("repo"),
|
|
117
|
+
ref: Schema.NullOr(Schema.String),
|
|
118
|
+
url: Schema.String.pipe(Schema.minLength(1), Schema.annotations({ message: () => "Give the repository a URL." }))
|
|
119
|
+
}), Schema.Struct({
|
|
120
|
+
files: Schema.Record({
|
|
121
|
+
key: Schema.String,
|
|
122
|
+
value: Schema.String
|
|
123
|
+
}),
|
|
124
|
+
kind: Schema.Literal("files")
|
|
125
|
+
})).annotations({
|
|
126
|
+
description: "The workspace available to the harness before setup runs.",
|
|
127
|
+
identifier: "EvalSource"
|
|
128
|
+
});
|
|
129
|
+
const EvalValidator = Schema.Struct({
|
|
130
|
+
name: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(100)),
|
|
131
|
+
source: Schema.String.pipe(Schema.minLength(1), Schema.maxLength(1e6))
|
|
132
|
+
}).annotations({
|
|
133
|
+
description: "A bundled TypeScript validator and its exported function name.",
|
|
134
|
+
identifier: "EvalValidator"
|
|
135
|
+
});
|
|
136
|
+
const EvalVariables = Schema.Record({
|
|
137
|
+
key: Schema.String,
|
|
138
|
+
value: Schema.String
|
|
139
|
+
}).annotations({
|
|
140
|
+
description: "Values for the placeholders the run prompt names, such as {{task}}.",
|
|
141
|
+
identifier: "EvalVariables"
|
|
142
|
+
});
|
|
143
|
+
const EvalCase = Schema.Struct({
|
|
144
|
+
name: Schema.String,
|
|
145
|
+
setup: Schema.NullOr(Schema.String),
|
|
146
|
+
source: EvalSource,
|
|
147
|
+
variables: Schema.optionalWith(EvalVariables, { default: () => ({}) }),
|
|
148
|
+
validator: Schema.optionalWith(Schema.NullOr(EvalValidator), { default: () => null }),
|
|
149
|
+
verify: Schema.NullOr(Schema.String)
|
|
150
|
+
});
|
|
151
|
+
const EvalTask = Schema.Struct({
|
|
152
|
+
harness: EvalHarness,
|
|
153
|
+
harnessVersion: Schema.String,
|
|
154
|
+
model: Schema.String,
|
|
155
|
+
provider: EvalProvider
|
|
156
|
+
}).annotations({
|
|
157
|
+
description: "The harness, installed version, model, and sandbox for a cell.",
|
|
158
|
+
identifier: "EvalTask"
|
|
159
|
+
});
|
|
160
|
+
const EvalTaskRequest = Schema.Struct({
|
|
161
|
+
credentials: Schema.optional(CredentialBindings),
|
|
162
|
+
harness: EvalHarness,
|
|
163
|
+
model: Schema.String,
|
|
164
|
+
provider: EvalProvider
|
|
165
|
+
});
|
|
166
|
+
Schema.Struct({
|
|
167
|
+
cases: Schema.Array(EvalCase).pipe(Schema.minItems(1)),
|
|
168
|
+
prompt: Schema.String,
|
|
169
|
+
tasks: Schema.Array(EvalTaskRequest).pipe(Schema.minItems(1)),
|
|
170
|
+
trials: Schema.Int.pipe(Schema.between(1, 10))
|
|
171
|
+
});
|
|
172
|
+
const OccurredAtMillis = Schema.NullOr(Schema.Number);
|
|
173
|
+
const EvalUsage = Schema.Struct({
|
|
174
|
+
cacheReadTokens: Schema.Int,
|
|
175
|
+
cacheWriteTokens: Schema.Int,
|
|
176
|
+
costUsd: Schema.optional(Schema.NullOr(Schema.Number)),
|
|
177
|
+
inputTokens: Schema.Int,
|
|
178
|
+
outputTokens: Schema.Int,
|
|
179
|
+
totalTokens: Schema.Int
|
|
180
|
+
}).annotations({
|
|
181
|
+
description: "Token usage reported by the harness.",
|
|
182
|
+
identifier: "EvalUsage"
|
|
183
|
+
});
|
|
184
|
+
const EvalJournalEntry = Schema.Union(Schema.Struct({
|
|
185
|
+
_tag: Schema.Literal("command"),
|
|
186
|
+
command: Schema.String,
|
|
187
|
+
exitCode: Schema.NullOr(Schema.Int),
|
|
188
|
+
finishedAtMillis: OccurredAtMillis,
|
|
189
|
+
output: Schema.String,
|
|
190
|
+
startedAtMillis: OccurredAtMillis
|
|
191
|
+
}), Schema.Struct({
|
|
192
|
+
_tag: Schema.Literal("message"),
|
|
193
|
+
finishedAtMillis: OccurredAtMillis,
|
|
194
|
+
text: Schema.String,
|
|
195
|
+
usage: Schema.optional(Schema.NullOr(EvalUsage))
|
|
196
|
+
}), Schema.Struct({
|
|
197
|
+
_tag: Schema.Literal("toolCall"),
|
|
198
|
+
finishedAtMillis: OccurredAtMillis,
|
|
199
|
+
name: Schema.String,
|
|
200
|
+
startedAtMillis: Schema.optional(OccurredAtMillis),
|
|
201
|
+
status: Schema.NullOr(Schema.String)
|
|
202
|
+
}), Schema.Struct({
|
|
203
|
+
_tag: Schema.Literal("fileChange"),
|
|
204
|
+
finishedAtMillis: OccurredAtMillis,
|
|
205
|
+
paths: Schema.Array(Schema.String)
|
|
206
|
+
})).annotations({
|
|
207
|
+
description: "A normalized event recorded from the harness trajectory.",
|
|
208
|
+
identifier: "EvalJournalEntry"
|
|
209
|
+
});
|
|
210
|
+
const EvalVerifyStep = Schema.Struct({
|
|
211
|
+
command: Schema.String,
|
|
212
|
+
exitCode: Schema.Int
|
|
213
|
+
}).annotations({
|
|
214
|
+
description: "One condition of the verifier, and how it exited. Only the steps that ran are listed: the script stops at the first failure.",
|
|
215
|
+
identifier: "EvalVerifyStep"
|
|
216
|
+
});
|
|
217
|
+
const EvalTrial = Schema.Struct({
|
|
218
|
+
commands: Schema.Int,
|
|
219
|
+
exitCode: Schema.Int,
|
|
220
|
+
failedCommands: Schema.Int,
|
|
221
|
+
filesChanged: Schema.Array(Schema.String),
|
|
222
|
+
modelMs: Schema.Int,
|
|
223
|
+
ordinal: Schema.Int,
|
|
224
|
+
passed: Schema.Boolean,
|
|
225
|
+
sandboxId: Schema.NullOr(Schema.String),
|
|
226
|
+
sandboxMs: Schema.Int,
|
|
227
|
+
status: EvalTrialStatus,
|
|
228
|
+
timed: Schema.Boolean,
|
|
229
|
+
trajectory: Schema.Array(EvalJournalEntry),
|
|
230
|
+
usage: Schema.NullOr(EvalUsage),
|
|
231
|
+
verifySteps: Schema.Array(EvalVerifyStep),
|
|
232
|
+
voidFields: Schema.Array(Schema.String)
|
|
233
|
+
}).annotations({
|
|
234
|
+
description: "One sandbox attempt for a grid cell.",
|
|
235
|
+
identifier: "EvalTrial"
|
|
236
|
+
});
|
|
237
|
+
const EvalDistribution = Schema.Struct({
|
|
238
|
+
commandMax: Schema.Int,
|
|
239
|
+
commandMedian: Schema.Number,
|
|
240
|
+
commandMin: Schema.Int,
|
|
241
|
+
deterministic: Schema.Boolean,
|
|
242
|
+
failed: Schema.Int,
|
|
243
|
+
passRate: Schema.Number,
|
|
244
|
+
passed: Schema.Int,
|
|
245
|
+
scored: Schema.Int,
|
|
246
|
+
trials: Schema.Int,
|
|
247
|
+
voided: Schema.Int
|
|
248
|
+
}).annotations({
|
|
249
|
+
description: "The scored outcome across all trials in a cell.",
|
|
250
|
+
identifier: "EvalDistribution"
|
|
251
|
+
});
|
|
252
|
+
const EvalVerdict = Schema.Literal("improved", "incomparable", "regressed", "unchanged");
|
|
253
|
+
const EvalComparison = Schema.Struct({
|
|
254
|
+
baselinePassRate: Schema.Number,
|
|
255
|
+
candidatePassRate: Schema.Number,
|
|
256
|
+
delta: Schema.Number,
|
|
257
|
+
determinismLost: Schema.Boolean,
|
|
258
|
+
reason: Schema.NullOr(Schema.String),
|
|
259
|
+
verdict: EvalVerdict
|
|
260
|
+
}).annotations({
|
|
261
|
+
description: "The cell result compared with its most recent baseline.",
|
|
262
|
+
identifier: "EvalComparison"
|
|
263
|
+
});
|
|
264
|
+
const EvalSetup = Schema.Struct({
|
|
265
|
+
prompt: Schema.String,
|
|
266
|
+
repoRef: Schema.NullOr(Schema.String),
|
|
267
|
+
repoUrl: Schema.NullOr(Schema.String),
|
|
268
|
+
setupCommand: Schema.NullOr(Schema.String),
|
|
269
|
+
validatorName: Schema.NullOr(Schema.String),
|
|
270
|
+
verifyCommand: Schema.NullOr(Schema.String),
|
|
271
|
+
workspace: Schema.String
|
|
272
|
+
}).annotations({
|
|
273
|
+
description: "The prompt, workspace, setup, and verifier used by a cell.",
|
|
274
|
+
identifier: "EvalSetup"
|
|
275
|
+
});
|
|
276
|
+
const EvalCell = Schema.Struct({
|
|
277
|
+
caseName: Schema.String,
|
|
278
|
+
cellKey: Schema.NullOr(Schema.String),
|
|
279
|
+
comparison: Schema.NullOr(EvalComparison),
|
|
280
|
+
distribution: Schema.NullOr(EvalDistribution),
|
|
281
|
+
internalId: Schema.NullOr(Schema.String),
|
|
282
|
+
setup: Schema.NullOr(EvalSetup),
|
|
283
|
+
status: EvalRunStatus,
|
|
284
|
+
taskIndex: Schema.Int,
|
|
285
|
+
trials: Schema.Array(EvalTrial)
|
|
286
|
+
}).annotations({
|
|
287
|
+
description: "One case and task combination in an eval grid.",
|
|
288
|
+
identifier: "EvalCell"
|
|
289
|
+
});
|
|
290
|
+
const EvalTimestamp = Schema.DateTimeUtc.annotations({
|
|
291
|
+
description: "An ISO-8601 timestamp in UTC.",
|
|
292
|
+
identifier: "EvalTimestamp",
|
|
293
|
+
jsonSchema: { format: "date-time" }
|
|
294
|
+
});
|
|
295
|
+
const EvalRun = Schema.Struct({
|
|
296
|
+
cases: Schema.Array(Schema.String),
|
|
297
|
+
cells: Schema.Array(EvalCell),
|
|
298
|
+
failure: Schema.NullOr(Schema.String),
|
|
299
|
+
finishedAt: Schema.NullOr(EvalTimestamp),
|
|
300
|
+
id: Schema.String,
|
|
301
|
+
startedAt: EvalTimestamp,
|
|
302
|
+
status: EvalRunStatus,
|
|
303
|
+
tasks: Schema.Array(EvalTask)
|
|
304
|
+
}).annotations({
|
|
305
|
+
description: "A complete eval run with its cells and trials.",
|
|
306
|
+
identifier: "EvalRun"
|
|
307
|
+
});
|
|
308
|
+
const EvalRunSummary = Schema.Struct({
|
|
309
|
+
caseCount: Schema.Int,
|
|
310
|
+
columns: Schema.Array(EvalTask),
|
|
311
|
+
commandMax: Schema.NullOr(Schema.Int),
|
|
312
|
+
commandMin: Schema.NullOr(Schema.Int),
|
|
313
|
+
failure: Schema.NullOr(Schema.String),
|
|
314
|
+
finishedAt: Schema.NullOr(EvalTimestamp),
|
|
315
|
+
id: Schema.String,
|
|
316
|
+
name: Schema.NullOr(Schema.String),
|
|
317
|
+
passed: Schema.Int,
|
|
318
|
+
scored: Schema.Int,
|
|
319
|
+
startedAt: EvalTimestamp,
|
|
320
|
+
status: EvalRunStatus,
|
|
321
|
+
taskCount: Schema.Int,
|
|
322
|
+
voided: Schema.Int
|
|
323
|
+
}).annotations({
|
|
324
|
+
description: "A compact eval run returned by the run list.",
|
|
325
|
+
identifier: "EvalRunSummary"
|
|
326
|
+
});
|
|
327
|
+
const EvalPageCursor = Schema.Struct({
|
|
328
|
+
id: Schema.String,
|
|
329
|
+
startedAtMillis: Schema.Int
|
|
330
|
+
});
|
|
331
|
+
/** One page of runs. `next` is null at the end rather than an empty cursor, so
|
|
332
|
+
* a caller stops because there is nothing more rather than because a fetch
|
|
333
|
+
* came back empty. */
|
|
334
|
+
const EvalRunPage = Schema.Struct({
|
|
335
|
+
next: Schema.NullOr(EvalPageCursor),
|
|
336
|
+
runs: Schema.Array(EvalRunSummary),
|
|
337
|
+
/** Every run the organization has, so a listing can say how far it goes
|
|
338
|
+
* rather than only whether there is more. */
|
|
339
|
+
total: Schema.Int
|
|
340
|
+
});
|
|
341
|
+
const EvalCellHistoryEntry = Schema.Struct({
|
|
342
|
+
distribution: EvalDistribution,
|
|
343
|
+
finishedAt: Schema.NullOr(EvalTimestamp),
|
|
344
|
+
internalId: Schema.String,
|
|
345
|
+
runId: Schema.String,
|
|
346
|
+
trials: Schema.Array(EvalTrial)
|
|
347
|
+
}).annotations({
|
|
348
|
+
description: "A previous scored result for the same cell identity.",
|
|
349
|
+
identifier: "EvalCellHistoryEntry"
|
|
350
|
+
});
|
|
351
|
+
const PlaygroundCaseView = Schema.Struct({
|
|
352
|
+
name: Schema.String,
|
|
353
|
+
setup: Schema.NullOr(Schema.String),
|
|
354
|
+
source: EvalSource,
|
|
355
|
+
variables: Schema.optionalWith(EvalVariables, { default: () => ({}) }),
|
|
356
|
+
verify: Schema.NullOr(Schema.String)
|
|
357
|
+
});
|
|
358
|
+
const PlaygroundColumnView = Schema.Struct({
|
|
359
|
+
harness: EvalHarness,
|
|
360
|
+
model: Schema.String,
|
|
361
|
+
provider: EvalProvider
|
|
362
|
+
});
|
|
363
|
+
const PlaygroundConfigView = Schema.Struct({
|
|
364
|
+
cases: Schema.Array(PlaygroundCaseView),
|
|
365
|
+
columns: Schema.Array(PlaygroundColumnView),
|
|
366
|
+
connections: Schema.optionalWith(CredentialSelections, { default: () => ({}) }),
|
|
367
|
+
prompt: Schema.String,
|
|
368
|
+
trials: Schema.Int.pipe(Schema.between(1, 10))
|
|
369
|
+
});
|
|
370
|
+
const EvalDraftCase = Schema.Struct({
|
|
371
|
+
name: Schema.String.pipe(Schema.minLength(1), Schema.annotations({ message: () => "Name this case." })),
|
|
372
|
+
setup: Schema.NullOr(Schema.String),
|
|
373
|
+
source: EvalSource,
|
|
374
|
+
variables: EvalVariables.pipe(Schema.filter((values) => Object.values(values).some((value) => value.trim() !== ""), { message: () => "Say what the agent should do." })),
|
|
375
|
+
verify: Schema.NullOr(Schema.String)
|
|
376
|
+
});
|
|
377
|
+
const EvalAgent = Schema.Struct({
|
|
378
|
+
harness: EvalHarness,
|
|
379
|
+
model: Schema.String
|
|
380
|
+
});
|
|
381
|
+
Schema.Struct({
|
|
382
|
+
agents: Schema.mutable(Schema.Array(EvalAgent)).pipe(Schema.minItems(1), Schema.annotations({ message: () => "Choose at least one agent." })),
|
|
383
|
+
cases: Schema.mutable(Schema.Array(EvalDraftCase)).pipe(Schema.minItems(1), Schema.annotations({ message: () => "Add at least one case." })),
|
|
384
|
+
connections: CredentialSelections,
|
|
385
|
+
name: Schema.String,
|
|
386
|
+
prompt: Schema.String,
|
|
387
|
+
providers: Schema.mutable(Schema.Array(EvalProvider)).pipe(Schema.minItems(1), Schema.annotations({ message: () => "Choose at least one sandbox." })),
|
|
388
|
+
trials: Schema.Int.pipe(Schema.between(1, 10), Schema.annotations({ message: () => "Run between 1 and 10 trials." }))
|
|
389
|
+
});
|
|
390
|
+
Schema.Struct({
|
|
391
|
+
config: PlaygroundConfigView,
|
|
392
|
+
id: Schema.String,
|
|
393
|
+
lastRunId: Schema.NullOr(Schema.String),
|
|
394
|
+
name: Schema.String,
|
|
395
|
+
problems: Schema.Array(Schema.String),
|
|
396
|
+
ungated: Schema.Array(Schema.String),
|
|
397
|
+
updatedAt: Schema.DateTimeUtc
|
|
398
|
+
});
|
|
399
|
+
Schema.Struct({ name: Schema.String.pipe(Schema.minLength(1)) });
|
|
400
|
+
Schema.Struct({
|
|
401
|
+
config: PlaygroundConfigView,
|
|
402
|
+
name: Schema.String.pipe(Schema.minLength(1))
|
|
403
|
+
});
|
|
404
|
+
const StartedEval = Schema.Struct({ id: Schema.String }).annotations({
|
|
405
|
+
description: "The id of an eval run accepted for background execution.",
|
|
406
|
+
identifier: "StartedEval"
|
|
407
|
+
});
|
|
408
|
+
const RerunCellRequest = Schema.Struct({ trials: Schema.Int.pipe(Schema.between(1, 10)) });
|
|
409
|
+
const CatalogueModel = Schema.Struct({
|
|
410
|
+
displayName: Schema.String,
|
|
411
|
+
id: Schema.String,
|
|
412
|
+
summary: Schema.NullOr(Schema.String),
|
|
413
|
+
vendor: Schema.NullOr(Schema.String)
|
|
414
|
+
}).annotations({
|
|
415
|
+
description: "A model available to the installed harness.",
|
|
416
|
+
identifier: "CatalogueModel"
|
|
417
|
+
});
|
|
418
|
+
const ModelCatalogue = Schema.Struct({
|
|
419
|
+
harness: EvalHarness,
|
|
420
|
+
models: Schema.Array(CatalogueModel),
|
|
421
|
+
total: Schema.Int
|
|
422
|
+
}).annotations({
|
|
423
|
+
description: "Models available to the installed harness.",
|
|
424
|
+
identifier: "ModelCatalogue"
|
|
425
|
+
});
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region ../schema/src/internal/authentication.ts
|
|
428
|
+
var CurrentActor = class extends Context.Tag("@anpord/schema/CurrentActor")() {};
|
|
429
|
+
HttpApiMiddleware.Tag()("@anpord/schema/Authentication", {
|
|
430
|
+
failure: Unauthorized,
|
|
431
|
+
provides: CurrentActor,
|
|
432
|
+
security: { session: HttpApiSecurity.apiKey({
|
|
433
|
+
in: "cookie",
|
|
434
|
+
key: "anpord.session_token"
|
|
435
|
+
}) }
|
|
436
|
+
});
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region ../schema/src/public/authentication.ts
|
|
439
|
+
var ApiKeyAuthentication = class extends HttpApiMiddleware.Tag()("@anpord/schema/ApiKeyAuthentication", {
|
|
440
|
+
failure: Unauthorized,
|
|
441
|
+
provides: CurrentActor,
|
|
442
|
+
security: { bearer: HttpApiSecurity.bearer }
|
|
443
|
+
}) {};
|
|
444
|
+
//#endregion
|
|
445
|
+
//#region ../schema/src/public/evals-api.ts
|
|
446
|
+
const EvalRunRequest = Schema.Struct({ id: Schema.String }).annotations({
|
|
447
|
+
description: "Select an eval run by id.",
|
|
448
|
+
identifier: "EvalRunRequest"
|
|
449
|
+
});
|
|
450
|
+
const EvalCellRequest = Schema.Struct({ cellKey: Schema.String }).annotations({
|
|
451
|
+
description: "Select an eval cell by its stable key.",
|
|
452
|
+
identifier: "EvalCellRequest"
|
|
453
|
+
});
|
|
454
|
+
const EvalModelsRequest = Schema.Struct({
|
|
455
|
+
harness: EvalHarness,
|
|
456
|
+
/** Narrows to models whose id or name contains this. */
|
|
457
|
+
q: Schema.optional(Schema.String)
|
|
458
|
+
}).annotations({
|
|
459
|
+
description: "Select a harness whose available models should be listed.",
|
|
460
|
+
identifier: "EvalModelsRequest"
|
|
461
|
+
});
|
|
462
|
+
const PublicEvalProvider = EvalProvider.annotations({
|
|
463
|
+
description: "A hosted sandbox provider.",
|
|
464
|
+
identifier: "PublicEvalProvider"
|
|
465
|
+
});
|
|
466
|
+
const ListEvalsRequest = Schema.Struct({
|
|
467
|
+
cursor: Schema.optional(Schema.NullOr(EvalPageCursor)),
|
|
468
|
+
limit: Schema.optional(Schema.Int)
|
|
469
|
+
}).annotations({
|
|
470
|
+
description: "Where to read from, and how much.",
|
|
471
|
+
identifier: "ListEvalsRequest"
|
|
472
|
+
});
|
|
473
|
+
const PublicEvalCase = Schema.Struct({
|
|
474
|
+
name: Schema.String,
|
|
475
|
+
setup: Schema.optional(Schema.NullOr(Schema.String)),
|
|
476
|
+
source: Schema.optional(EvalSource),
|
|
477
|
+
validator: Schema.optional(Schema.NullOr(EvalValidator)),
|
|
478
|
+
variables: Schema.optional(EvalVariables),
|
|
479
|
+
verify: Schema.NullOr(Schema.String)
|
|
480
|
+
}).pipe(Schema.filter(({ validator, verify }) => !(validator !== void 0 && validator !== null && verify !== null), { message: () => "Use either validator or verify, not both." })).annotations({
|
|
481
|
+
description: "A task, workspace source, setup command, and verifier.",
|
|
482
|
+
identifier: "StartEvalCase"
|
|
483
|
+
});
|
|
484
|
+
const PublicEvalTask = Schema.Struct({
|
|
485
|
+
harness: EvalHarness,
|
|
486
|
+
model: Schema.String.pipe(Schema.minLength(1)),
|
|
487
|
+
provider: PublicEvalProvider
|
|
488
|
+
}).annotations({
|
|
489
|
+
description: "A harness, model, and hosted sandbox combination.",
|
|
490
|
+
identifier: "StartEvalTask"
|
|
491
|
+
});
|
|
492
|
+
const PublicStartEvalRequest = Schema.Struct({
|
|
493
|
+
cases: Schema.Array(PublicEvalCase).pipe(Schema.minItems(1)),
|
|
494
|
+
prompt: Schema.String,
|
|
495
|
+
tasks: Schema.Array(PublicEvalTask).pipe(Schema.minItems(1)),
|
|
496
|
+
trials: Schema.Int.pipe(Schema.between(1, 10))
|
|
497
|
+
}).annotations({
|
|
498
|
+
description: "Start a grid with at most 100 total case, task, and trial combinations.",
|
|
499
|
+
identifier: "StartEvalRequest"
|
|
500
|
+
});
|
|
501
|
+
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.")).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")).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.") {};
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region ../schema/src/domain/prompts.ts
|
|
504
|
+
const ChannelName = Schema.String.pipe(Schema.minLength(1), Schema.maxLength(36), Schema.pattern(/^[a-z0-9][a-z0-9_-]*$/, { message: () => "Channel must be lowercase alphanumeric, optionally with - or _" }), Schema.brand("ChannelName")).annotations({ description: "Addresses a version. `latest` is derived from the highest version rather than stored, so it cannot drift from the version table." });
|
|
505
|
+
ChannelName.make("production");
|
|
506
|
+
ChannelName.make("latest");
|
|
507
|
+
const PromptId = Schema.String.pipe(Schema.minLength(1), Schema.maxLength(255), Schema.pattern(/^[a-z0-9][a-z0-9/_-]*$/, { message: () => "Prompt id must be lowercase alphanumeric, optionally with / _ or -" }), Schema.brand("PromptId"));
|
|
508
|
+
const PromptName = Schema.String.pipe(Schema.minLength(1), Schema.maxLength(255), Schema.brand("PromptName"));
|
|
509
|
+
const VersionNumber = Schema.Int.pipe(Schema.positive(), Schema.brand("VersionNumber"));
|
|
510
|
+
Schema.NumberFromString.pipe(Schema.int(), Schema.positive(), Schema.brand("VersionNumber"));
|
|
511
|
+
Schema.NumberFromString.pipe(Schema.int(), Schema.positive(), Schema.lessThanOrEqualTo(100));
|
|
512
|
+
const Timestamp = Schema.Union(Schema.DateFromSelf, Schema.Date);
|
|
513
|
+
const CommitMessage = Schema.String.pipe(Schema.maxLength(500));
|
|
514
|
+
const PromptContent = Schema.String.pipe(Schema.minLength(1), Schema.maxLength(262144, { message: () => "Prompt content is longer than 256 KB" }));
|
|
515
|
+
const PromptDescription = Schema.String.pipe(Schema.maxLength(2e3));
|
|
516
|
+
const PromptConfig = Schema.Record({
|
|
517
|
+
key: Schema.String,
|
|
518
|
+
value: Schema.Unknown
|
|
519
|
+
});
|
|
520
|
+
const Author = Schema.Struct({
|
|
521
|
+
image: Schema.NullOr(Schema.String),
|
|
522
|
+
name: Schema.String
|
|
523
|
+
});
|
|
524
|
+
Schema.Struct({
|
|
525
|
+
author: Schema.NullOr(Author),
|
|
526
|
+
channel: Schema.NullOr(ChannelName),
|
|
527
|
+
commitMessage: Schema.NullOr(CommitMessage),
|
|
528
|
+
config: PromptConfig,
|
|
529
|
+
content: Schema.String,
|
|
530
|
+
createdAt: Timestamp,
|
|
531
|
+
id: PromptId,
|
|
532
|
+
name: PromptName,
|
|
533
|
+
version: VersionNumber,
|
|
534
|
+
versionId: Schema.String
|
|
535
|
+
});
|
|
536
|
+
Schema.Struct({
|
|
537
|
+
channel: ChannelName,
|
|
538
|
+
updatedAt: Timestamp,
|
|
539
|
+
updatedBy: Schema.NullOr(Author),
|
|
540
|
+
version: VersionNumber
|
|
541
|
+
});
|
|
542
|
+
const PromptSummary = Schema.Struct({
|
|
543
|
+
author: Schema.NullOr(Author),
|
|
544
|
+
description: Schema.NullOr(Schema.String),
|
|
545
|
+
id: PromptId,
|
|
546
|
+
latestVersion: Schema.NullOr(VersionNumber),
|
|
547
|
+
name: PromptName,
|
|
548
|
+
productionVersion: Schema.NullOr(VersionNumber),
|
|
549
|
+
updatedAt: Timestamp
|
|
550
|
+
});
|
|
551
|
+
Schema.Struct({
|
|
552
|
+
id: PromptId,
|
|
553
|
+
updatedAt: Timestamp
|
|
554
|
+
});
|
|
555
|
+
Schema.Literal("all", "draft", "live");
|
|
556
|
+
Schema.Literal("name", "updated");
|
|
557
|
+
Schema.Struct({
|
|
558
|
+
items: Schema.Array(PromptSummary),
|
|
559
|
+
/** Opaque to callers, and null once the last page has been read. */
|
|
560
|
+
nextCursor: Schema.NullOr(Schema.String)
|
|
561
|
+
});
|
|
562
|
+
Schema.Struct({
|
|
563
|
+
commitMessage: Schema.optional(CommitMessage),
|
|
564
|
+
config: Schema.optional(PromptConfig),
|
|
565
|
+
content: PromptContent,
|
|
566
|
+
description: Schema.optional(PromptDescription),
|
|
567
|
+
id: PromptId,
|
|
568
|
+
name: PromptName,
|
|
569
|
+
publish: Schema.optional(Schema.Boolean)
|
|
570
|
+
});
|
|
571
|
+
Schema.Struct({
|
|
572
|
+
commitMessage: Schema.optional(CommitMessage),
|
|
573
|
+
config: Schema.optional(PromptConfig),
|
|
574
|
+
content: PromptContent,
|
|
575
|
+
publish: Schema.optional(Schema.Boolean)
|
|
576
|
+
});
|
|
577
|
+
Schema.Struct({
|
|
578
|
+
commitMessage: Schema.optional(CommitMessage),
|
|
579
|
+
config: Schema.optional(PromptConfig),
|
|
580
|
+
content: PromptContent
|
|
581
|
+
});
|
|
582
|
+
Schema.Struct({
|
|
583
|
+
description: Schema.optional(PromptDescription),
|
|
584
|
+
id: Schema.optional(PromptId),
|
|
585
|
+
name: Schema.optional(PromptName)
|
|
586
|
+
});
|
|
587
|
+
Schema.Struct({
|
|
588
|
+
channel: ChannelName,
|
|
589
|
+
version: VersionNumber
|
|
590
|
+
});
|
|
591
|
+
Schema.Struct({
|
|
592
|
+
channel: Schema.optional(ChannelName),
|
|
593
|
+
version: Schema.optional(VersionNumber)
|
|
594
|
+
});
|
|
595
|
+
//#endregion
|
|
596
|
+
//#region ../schema/src/public/requests.ts
|
|
597
|
+
const GetPromptRequest = Schema.Struct({
|
|
598
|
+
channel: Schema.optional(ChannelName),
|
|
599
|
+
id: PromptId,
|
|
600
|
+
includeVersions: Schema.optional(Schema.Boolean),
|
|
601
|
+
version: Schema.optional(VersionNumber)
|
|
602
|
+
}).annotations({
|
|
603
|
+
description: "Resolve a prompt. Give a version to pin one, a channel to follow one, or neither for the organization's default channel.",
|
|
604
|
+
identifier: "GetPromptRequest"
|
|
605
|
+
});
|
|
606
|
+
Schema.Struct({ id: PromptId }).annotations({
|
|
607
|
+
description: "Show a prompt's version history.",
|
|
608
|
+
identifier: "ListVersionsRequest"
|
|
609
|
+
});
|
|
610
|
+
const ListPromptsRequest = Schema.Record({
|
|
611
|
+
key: Schema.String,
|
|
612
|
+
value: Schema.Never
|
|
613
|
+
}).annotations({
|
|
614
|
+
description: "No parameters; returns up to 100 prompts in the organization.",
|
|
615
|
+
identifier: "ListPromptsRequest"
|
|
616
|
+
});
|
|
617
|
+
const CreatePromptRequest = Schema.Struct({
|
|
618
|
+
config: Schema.optional(PromptConfig),
|
|
619
|
+
content: PromptContent,
|
|
620
|
+
description: Schema.optional(Schema.String),
|
|
621
|
+
id: PromptId,
|
|
622
|
+
message: Schema.optional(CommitMessage),
|
|
623
|
+
name: PromptName
|
|
624
|
+
}).annotations({
|
|
625
|
+
description: "Create a prompt and publish its first version to the default channel.",
|
|
626
|
+
identifier: "CreatePromptRequest"
|
|
627
|
+
});
|
|
628
|
+
const UpdatePromptRequest = Schema.Struct({
|
|
629
|
+
config: Schema.optional(PromptConfig),
|
|
630
|
+
content: PromptContent,
|
|
631
|
+
id: PromptId,
|
|
632
|
+
message: Schema.optional(CommitMessage)
|
|
633
|
+
}).annotations({
|
|
634
|
+
description: "Add a version to a prompt. The new version becomes latest, and omitted config is stored as an empty object.",
|
|
635
|
+
identifier: "UpdatePromptRequest"
|
|
636
|
+
});
|
|
637
|
+
const PromotePromptRequest = Schema.Struct({
|
|
638
|
+
channel: ChannelName,
|
|
639
|
+
id: PromptId,
|
|
640
|
+
version: VersionNumber
|
|
641
|
+
}).annotations({
|
|
642
|
+
description: "Point a channel at a version.",
|
|
643
|
+
identifier: "PromotePromptRequest"
|
|
644
|
+
});
|
|
645
|
+
Schema.Struct({ id: PromptId }).annotations({
|
|
646
|
+
description: "Archive a prompt. Existing selectors stay readable.",
|
|
647
|
+
identifier: "ArchivePromptRequest"
|
|
648
|
+
});
|
|
649
|
+
const Ok = Schema.Struct({ ok: Schema.Literal(true) }).annotations({
|
|
650
|
+
description: "The operation succeeded.",
|
|
651
|
+
identifier: "Ok"
|
|
652
|
+
});
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region ../schema/src/public/shapes.ts
|
|
655
|
+
const Instant = Schema.DateTimeUtc.annotations({
|
|
656
|
+
description: "An ISO-8601 timestamp in UTC.",
|
|
657
|
+
identifier: "Instant",
|
|
658
|
+
jsonSchema: { format: "date-time" }
|
|
659
|
+
});
|
|
660
|
+
const PublicPrompt = Schema.Struct({
|
|
661
|
+
channel: Schema.NullOr(ChannelName),
|
|
662
|
+
config: PromptConfig,
|
|
663
|
+
content: Schema.String,
|
|
664
|
+
createdAt: Instant,
|
|
665
|
+
id: PromptId,
|
|
666
|
+
message: Schema.NullOr(CommitMessage),
|
|
667
|
+
name: PromptName,
|
|
668
|
+
version: VersionNumber
|
|
669
|
+
}).annotations({
|
|
670
|
+
description: "A prompt resolved at a specific version.",
|
|
671
|
+
identifier: "ResolvedPrompt"
|
|
672
|
+
});
|
|
673
|
+
const PublicVersion = Schema.Struct({
|
|
674
|
+
createdAt: Instant,
|
|
675
|
+
message: Schema.NullOr(CommitMessage),
|
|
676
|
+
version: VersionNumber
|
|
677
|
+
}).annotations({
|
|
678
|
+
description: "One entry in a prompt's history.",
|
|
679
|
+
identifier: "Version"
|
|
680
|
+
});
|
|
681
|
+
const PublicPromptWithVersions = Schema.extend(PublicPrompt, Schema.Struct({ versions: Schema.optional(Schema.Array(PublicVersion)) })).annotations({
|
|
682
|
+
description: "A prompt, with its version history when `includeVersions` is set.",
|
|
683
|
+
identifier: "Prompt"
|
|
684
|
+
});
|
|
685
|
+
const PublicPromptSummary = Schema.Struct({
|
|
686
|
+
id: PromptId,
|
|
687
|
+
latestVersion: Schema.NullOr(VersionNumber),
|
|
688
|
+
name: PromptName,
|
|
689
|
+
productionVersion: Schema.NullOr(VersionNumber),
|
|
690
|
+
updatedAt: Instant
|
|
691
|
+
}).annotations({
|
|
692
|
+
description: "A prompt without its content.",
|
|
693
|
+
identifier: "PromptSummary"
|
|
694
|
+
});
|
|
695
|
+
const PromptList = Schema.Struct({ data: Schema.Array(PublicPromptSummary) }).annotations({
|
|
696
|
+
description: "Every prompt in the organization.",
|
|
697
|
+
identifier: "PromptList"
|
|
698
|
+
});
|
|
699
|
+
//#endregion
|
|
700
|
+
//#region ../schema/src/public/prompts-api.ts
|
|
701
|
+
var PublicPromptsGroup = class extends HttpApiGroup.make("prompts").add(HttpApiEndpoint.post("get", "/prompts.get").setPayload(GetPromptRequest).addSuccess(PublicPromptWithVersions).annotate(OpenApi.Summary, "Resolve a prompt").annotate(OpenApi.Description, "Returns the content a caller should send to a model. With no selector this follows the organization's default channel.")).add(HttpApiEndpoint.post("list", "/prompts.list").setPayload(ListPromptsRequest).addSuccess(PromptList).annotate(OpenApi.Summary, "List prompts").annotate(OpenApi.Description, "Up to 100 prompts in the organization, without content.")).add(HttpApiEndpoint.post("create", "/prompts.create").setPayload(CreatePromptRequest).addSuccess(PublicPromptWithVersions).annotate(OpenApi.Summary, "Create a prompt").annotate(OpenApi.Description, "Creates the prompt and its first version in one call.")).add(HttpApiEndpoint.post("update", "/prompts.update").setPayload(UpdatePromptRequest).addSuccess(PublicPromptWithVersions).annotate(OpenApi.Summary, "Add a version").annotate(OpenApi.Description, "Content is versioned, so updating a prompt appends a version rather than overwriting one. Earlier versions stay readable.")).add(HttpApiEndpoint.post("promote", "/prompts.promote").setPayload(PromotePromptRequest).addSuccess(Ok).annotate(OpenApi.Summary, "Promote a version to a channel").annotate(OpenApi.Description, "Points a channel, such as production, at a version. This is how a version goes live without callers changing anything.")).addError(BadRequest).addError(Forbidden).addError(Conflict).addError(NotFound).middleware(ApiKeyAuthentication).annotate(OpenApi.Title, "Prompts").annotate(OpenApi.Description, "Read and write prompts. Content is versioned, so writes append rather than overwrite, and channels decide which version callers receive.") {};
|
|
702
|
+
//#endregion
|
|
703
|
+
//#region ../schema/src/public/api.ts
|
|
704
|
+
var PublicApi = class extends HttpApi.make("anpord-public").add(PublicEvalsGroup).add(PublicPromptsGroup).prefix("/v1").annotate(OpenApi.Title, "Anpord API").annotate(OpenApi.Version, "1.0.0").annotate(OpenApi.Description, "Run agent evals and manage prompts. Every endpoint takes a JSON body over POST and authenticates with a bearer API key.").annotate(OpenApi.Servers, [{
|
|
705
|
+
description: "Production",
|
|
706
|
+
url: "https://api.anpord.com"
|
|
707
|
+
}]) {};
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region ../schema/src/public/client.ts
|
|
710
|
+
const DEFAULT_BASE_URL = "https://api.anpord.com";
|
|
711
|
+
const make = ({ apiKey, baseUrl = DEFAULT_BASE_URL }) => HttpApiClient.make(PublicApi, {
|
|
712
|
+
baseUrl,
|
|
713
|
+
transformClient: HttpClient.mapRequest(HttpClientRequest.bearerToken(Redacted.value(apiKey)))
|
|
714
|
+
});
|
|
715
|
+
var AnpordApi = class extends Effect.Tag("@anpord/sdk/AnpordApi")() {};
|
|
716
|
+
const layer = (options) => Layer.effect(AnpordApi, make(options)).pipe(Layer.provide(FetchHttpClient.layer));
|
|
717
|
+
//#endregion
|
|
718
|
+
export { ChannelName as a, make as i, DEFAULT_BASE_URL as n, PromptId as o, layer as r, VersionNumber as s, AnpordApi as t };
|