@agentswf/lab 0.0.0-stage → 0.3.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/LICENSE +21 -0
- package/README.md +15 -2
- package/package.json +46 -4
- package/schema/case-check.schema.json +64 -0
- package/schema/case-config.schema.json +187 -0
- package/schema/case-final.schema.json +48 -0
- package/schema/case-good-record.schema.json +70 -0
- package/schema/case-grade.schema.json +49 -0
- package/schema/case-key.schema.json +117 -0
- package/schema/case-label.schema.json +32 -0
- package/schema/case-loop-report.schema.json +210 -0
- package/schema/case-loop.schema.json +141 -0
- package/schema/case-plan.schema.json +117 -0
- package/schema/case-previous.schema.json +70 -0
- package/schema/case-proposal.schema.json +52 -0
- package/schema/case-report.schema.json +892 -0
- package/schema/case-run.schema.json +253 -0
- package/schema/case-runs.schema.json +125 -0
- package/schema/case-score.schema.json +319 -0
- package/schema/case-spread.schema.json +110 -0
- package/schema/case-trial.schema.json +543 -0
- package/schema/case-try.schema.json +113 -0
- package/schema/local.json +155 -0
- package/src/cli.ts +9 -0
- package/src/env/capture.ts +48 -0
- package/src/env/compare.ts +201 -0
- package/src/env/facts.ts +51 -0
- package/src/env/fetch.ts +57 -0
- package/src/env/files.ts +228 -0
- package/src/env/grade-case.ts +80 -0
- package/src/env/grade-helper.ts +352 -0
- package/src/env/grader.ts +128 -0
- package/src/env/index.ts +727 -0
- package/src/env/mock.ts +374 -0
- package/src/env/routes.ts +90 -0
- package/src/env/sources.ts +19 -0
- package/src/env/state.ts +79 -0
- package/src/env/trial.ts +182 -0
- package/src/format/key.ts +144 -0
- package/src/format/loop.ts +178 -0
- package/src/format/output.ts +481 -0
- package/src/format/records.ts +440 -0
- package/src/format/schema-files.ts +64 -0
- package/src/format/settings.ts +552 -0
- package/src/format/trial-env.ts +64 -0
- package/src/format/trial-file.ts +134 -0
- package/src/help/awf-lab.txt +29 -0
- package/src/help/case.txt +38 -0
- package/src/help/config.txt +14 -0
- package/src/help/label.txt +12 -0
- package/src/help/loop.txt +44 -0
- package/src/help/report.txt +20 -0
- package/src/help/run.txt +60 -0
- package/src/help/runs.txt +10 -0
- package/src/help/score.txt +27 -0
- package/src/judge/criteria.workflow.ts +237 -0
- package/src/judge/version.ts +6 -0
- package/src/lab/answer.ts +47 -0
- package/src/lab/blame.ts +204 -0
- package/src/lab/box.ts +249 -0
- package/src/lab/capture-command.ts +298 -0
- package/src/lab/capture.ts +234 -0
- package/src/lab/check-command.ts +187 -0
- package/src/lab/cli.ts +324 -0
- package/src/lab/code-graders.ts +108 -0
- package/src/lab/columns.ts +138 -0
- package/src/lab/command-context.ts +436 -0
- package/src/lab/compare.ts +123 -0
- package/src/lab/config-command.ts +278 -0
- package/src/lab/criteria.ts +69 -0
- package/src/lab/dataset.ts +356 -0
- package/src/lab/eval-files.ts +185 -0
- package/src/lab/expect.ts +79 -0
- package/src/lab/facts.ts +59 -0
- package/src/lab/families.ts +32 -0
- package/src/lab/folders.ts +153 -0
- package/src/lab/git.ts +128 -0
- package/src/lab/good.ts +224 -0
- package/src/lab/grading-stub.txt +8 -0
- package/src/lab/grading.ts +332 -0
- package/src/lab/inspect.ts +226 -0
- package/src/lab/labels.ts +206 -0
- package/src/lab/loop-code.ts +255 -0
- package/src/lab/loop-command.ts +770 -0
- package/src/lab/loop-records.ts +144 -0
- package/src/lab/loop.ts +859 -0
- package/src/lab/marker.ts +23 -0
- package/src/lab/outcome.ts +196 -0
- package/src/lab/pooled.ts +106 -0
- package/src/lab/project-env.ts +39 -0
- package/src/lab/rates.ts +150 -0
- package/src/lab/reach.ts +111 -0
- package/src/lab/record-copies.ts +202 -0
- package/src/lab/refusal.ts +2 -0
- package/src/lab/report-command.ts +156 -0
- package/src/lab/report.ts +838 -0
- package/src/lab/reuse.ts +126 -0
- package/src/lab/run-command.ts +853 -0
- package/src/lab/run-logs.ts +89 -0
- package/src/lab/run-report.ts +259 -0
- package/src/lab/runs-command.ts +163 -0
- package/src/lab/runs.ts +172 -0
- package/src/lab/scaffold.ts +91 -0
- package/src/lab/score-command.ts +189 -0
- package/src/lab/score.ts +396 -0
- package/src/lab/store.ts +383 -0
- package/src/lab/text.ts +29 -0
- package/src/lab/trial-settings.ts +100 -0
- package/src/lab/trial-stub.txt +18 -0
- package/src/lab/trial.ts +443 -0
- package/src/lab/usage.ts +273 -0
- package/src/lab/verdict.ts +161 -0
- package/src/lab/workflow-graders.ts +161 -0
- package/src/lab/workspace.ts +489 -0
- package/src/loop/propose.workflow.ts +84 -0
- package/src/shared/allowance.ts +185 -0
- package/src/shared/compare/index.ts +3 -0
- package/src/shared/compare/paired.ts +397 -0
- package/src/shared/compare/stats.ts +139 -0
- package/src/shared/compare/types.ts +75 -0
- package/src/shared/config.ts +15 -0
- package/src/shared/runner.ts +321 -0
- package/src/shared/validate.ts +181 -0
- package/src/shared/version.ts +41 -0
- package/src/write-schemas.ts +10 -0
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import Type from "typebox";
|
|
2
|
+
import { OUTCOMES, ParamsSchema, RunId } from "./records";
|
|
3
|
+
import { ResolvedLimitsSchema, ResolvedSandboxSchema } from "./settings";
|
|
4
|
+
|
|
5
|
+
// What each command's `--json` prints, each its own kind, named in the command's help.
|
|
6
|
+
|
|
7
|
+
export const REPORT_KIND = "awf.case-report/1";
|
|
8
|
+
export const PLAN_KIND = "awf.case-plan/1";
|
|
9
|
+
export const CHECK_KIND = "awf.case-check/1";
|
|
10
|
+
export const RUNS_KIND = "awf.case-runs/1";
|
|
11
|
+
export const CONFIG_KIND = "awf.case-config/1";
|
|
12
|
+
export const LOOP_REPORT_KIND = "awf.case-loop-report/1";
|
|
13
|
+
|
|
14
|
+
const Text = Type.String({ minLength: 1 });
|
|
15
|
+
const Tally = Type.Object(
|
|
16
|
+
{ alike: Type.Integer({ minimum: 0 }), of: Type.Integer({ minimum: 0 }) },
|
|
17
|
+
{ additionalProperties: false },
|
|
18
|
+
);
|
|
19
|
+
const Counts = Type.Record(Text, Type.Integer({ minimum: 0 }));
|
|
20
|
+
const Interval = Type.Tuple([Type.Number(), Type.Number()]);
|
|
21
|
+
/** A column's rates: cases passed with a 95% interval, cases being the units; see rates.ts. */
|
|
22
|
+
const RatesSchema = Type.Object(
|
|
23
|
+
{
|
|
24
|
+
cases: Type.Integer({ minimum: 0 }),
|
|
25
|
+
passed: Type.Integer({ minimum: 0 }),
|
|
26
|
+
interval: Type.Optional(Interval),
|
|
27
|
+
mean: Type.Optional(
|
|
28
|
+
Type.Object(
|
|
29
|
+
{ mean: Type.Number(), interval: Type.Optional(Interval) },
|
|
30
|
+
{ additionalProperties: false },
|
|
31
|
+
),
|
|
32
|
+
),
|
|
33
|
+
k: Type.Optional(Type.Integer({ minimum: 2 })),
|
|
34
|
+
passAll: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
35
|
+
passAny: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
36
|
+
},
|
|
37
|
+
{ additionalProperties: false },
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
/** Trials labeled one way, and how many the lab or a grader agreed on. */
|
|
41
|
+
const LabelTally = Type.Object(
|
|
42
|
+
{ labeled: Type.Integer({ minimum: 0 }), agreed: Type.Integer({ minimum: 0 }) },
|
|
43
|
+
{ additionalProperties: false },
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
/** A grader's number, pooled over a column's trials: counts summed, or every value. */
|
|
47
|
+
const PooledSchema = Type.Union([
|
|
48
|
+
Type.Object(
|
|
49
|
+
{ count: Type.Number({ minimum: 0 }), of: Type.Number({ minimum: 0 }) },
|
|
50
|
+
{ additionalProperties: false },
|
|
51
|
+
),
|
|
52
|
+
Type.Object({ values: Type.Array(Type.Number()) }, { additionalProperties: false }),
|
|
53
|
+
]);
|
|
54
|
+
|
|
55
|
+
export const CaseReportSchema = Type.Object(
|
|
56
|
+
{
|
|
57
|
+
kind: Type.Literal(REPORT_KIND),
|
|
58
|
+
run: RunId,
|
|
59
|
+
dataset: Text,
|
|
60
|
+
partial: Type.Boolean(),
|
|
61
|
+
exit: Type.Integer({ minimum: 0, maximum: 5 }),
|
|
62
|
+
/** The reference column's parameters: `--param` and each `--vary`'s first value. */
|
|
63
|
+
params: ParamsSchema,
|
|
64
|
+
/** Trials copied from earlier runs, as nothing that shaped them changed. */
|
|
65
|
+
reused: Type.Integer({ minimum: 0 }),
|
|
66
|
+
/** The reference column's rates. */
|
|
67
|
+
rates: RatesSchema,
|
|
68
|
+
/** Each tag of the cases: how many passed in the reference column, and which failed. */
|
|
69
|
+
tags: Type.Array(
|
|
70
|
+
Type.Object(
|
|
71
|
+
{
|
|
72
|
+
tag: Text,
|
|
73
|
+
cases: Type.Integer({ minimum: 0 }),
|
|
74
|
+
passed: Type.Integer({ minimum: 0 }),
|
|
75
|
+
failing: Type.Array(Text),
|
|
76
|
+
},
|
|
77
|
+
{ additionalProperties: false },
|
|
78
|
+
),
|
|
79
|
+
),
|
|
80
|
+
cases: Type.Array(
|
|
81
|
+
Type.Object(
|
|
82
|
+
{
|
|
83
|
+
name: Text,
|
|
84
|
+
verdict: Type.Union([
|
|
85
|
+
Type.Enum(["passed", "failed", "flaky", "unclear"] as const),
|
|
86
|
+
Type.Null(),
|
|
87
|
+
]),
|
|
88
|
+
/** A case with no verdict: why. */
|
|
89
|
+
none: Type.Optional(Type.Enum(["not graded", "graded by numbers"] as const)),
|
|
90
|
+
passed: Type.Integer({ minimum: 0 }),
|
|
91
|
+
trials: Type.Integer({ minimum: 0 }),
|
|
92
|
+
knownFailing: Type.Boolean(),
|
|
93
|
+
outcomes: Type.Array(Type.Enum(OUTCOMES)),
|
|
94
|
+
why: Type.Optional(Type.String()),
|
|
95
|
+
notes: Type.Array(Type.String()),
|
|
96
|
+
history: Type.Array(Type.Enum(["passed", "failed", "flaky", "unclear"] as const)),
|
|
97
|
+
},
|
|
98
|
+
{ additionalProperties: false },
|
|
99
|
+
),
|
|
100
|
+
),
|
|
101
|
+
/** By grader, then by number, your checkout's column. */
|
|
102
|
+
numbers: Type.Record(Text, Type.Record(Text, PooledSchema)),
|
|
103
|
+
/** Trials the workflow failed, which gave no numbers. */
|
|
104
|
+
numbersLeftOut: Type.Integer({ minimum: 0 }),
|
|
105
|
+
agreement: Type.Array(
|
|
106
|
+
Type.Object(
|
|
107
|
+
{ a: Text, b: Text, verdicts: Tally, parts: Tally },
|
|
108
|
+
{ additionalProperties: false },
|
|
109
|
+
),
|
|
110
|
+
),
|
|
111
|
+
/** The person's labels on the run's trials, and the lab's agreement with them. */
|
|
112
|
+
labels: Type.Optional(
|
|
113
|
+
Type.Object(
|
|
114
|
+
{
|
|
115
|
+
good: LabelTally,
|
|
116
|
+
needsWork: LabelTally,
|
|
117
|
+
notCompared: Type.Integer({ minimum: 0 }),
|
|
118
|
+
graders: Type.Array(
|
|
119
|
+
Type.Object(
|
|
120
|
+
{
|
|
121
|
+
grader: Text,
|
|
122
|
+
good: LabelTally,
|
|
123
|
+
needsWork: LabelTally,
|
|
124
|
+
/** What its grades of the run's trials are estimated at. */
|
|
125
|
+
cost: Type.Number({ minimum: 0 }),
|
|
126
|
+
/** False for a `manual` grader, or one the dataset no longer lists: never in the verdict. */
|
|
127
|
+
deciding: Type.Boolean(),
|
|
128
|
+
},
|
|
129
|
+
{ additionalProperties: false },
|
|
130
|
+
),
|
|
131
|
+
),
|
|
132
|
+
disagreements: Type.Array(
|
|
133
|
+
Type.Object(
|
|
134
|
+
{
|
|
135
|
+
case: Text,
|
|
136
|
+
column: Type.Integer({ minimum: 0 }),
|
|
137
|
+
trial: Type.Integer({ minimum: 1 }),
|
|
138
|
+
mark: Type.Enum(["good", "needs-work"] as const),
|
|
139
|
+
note: Type.Optional(Text),
|
|
140
|
+
outcome: Text,
|
|
141
|
+
},
|
|
142
|
+
{ additionalProperties: false },
|
|
143
|
+
),
|
|
144
|
+
),
|
|
145
|
+
},
|
|
146
|
+
{ additionalProperties: false },
|
|
147
|
+
),
|
|
148
|
+
),
|
|
149
|
+
/** Grades `score` would make again, or why that couldn't be told. */
|
|
150
|
+
stale: Type.Optional(
|
|
151
|
+
Type.Union([
|
|
152
|
+
Type.Integer({ minimum: 0 }),
|
|
153
|
+
Type.Object({ unread: Type.String() }, { additionalProperties: false }),
|
|
154
|
+
]),
|
|
155
|
+
),
|
|
156
|
+
/** With `--against` or `--vary`: every other column, its folder, parameters and verdicts. */
|
|
157
|
+
columns: Type.Optional(
|
|
158
|
+
Type.Array(
|
|
159
|
+
Type.Object(
|
|
160
|
+
{
|
|
161
|
+
/** As the report names it: `against 1`, `model=b`. */
|
|
162
|
+
label: Text,
|
|
163
|
+
/** What the dataset's `compare` said of it against the reference, or why it couldn't. */
|
|
164
|
+
compare: Type.Optional(
|
|
165
|
+
Type.Union([
|
|
166
|
+
Type.Object(
|
|
167
|
+
{
|
|
168
|
+
verdict: Type.Object(
|
|
169
|
+
{
|
|
170
|
+
verdict: Type.Enum(["better", "worse", "tie", "undecided"] as const),
|
|
171
|
+
stop: Type.Boolean(),
|
|
172
|
+
reason: Type.String(),
|
|
173
|
+
metrics: Type.Array(Type.Unknown()),
|
|
174
|
+
},
|
|
175
|
+
{ additionalProperties: false },
|
|
176
|
+
),
|
|
177
|
+
},
|
|
178
|
+
{ additionalProperties: false },
|
|
179
|
+
),
|
|
180
|
+
Type.Object({ error: Type.String() }, { additionalProperties: false }),
|
|
181
|
+
]),
|
|
182
|
+
),
|
|
183
|
+
rates: RatesSchema,
|
|
184
|
+
/**
|
|
185
|
+
* Its difference from the reference on the same cases, in pass fraction: the mean,
|
|
186
|
+
* a 95% interval from the per-case differences, and whether a sign test shows one.
|
|
187
|
+
*/
|
|
188
|
+
difference: Type.Optional(
|
|
189
|
+
Type.Object(
|
|
190
|
+
{
|
|
191
|
+
cases: Type.Integer({ minimum: 0 }),
|
|
192
|
+
mean: Type.Number(),
|
|
193
|
+
interval: Type.Optional(Interval),
|
|
194
|
+
shown: Type.Boolean(),
|
|
195
|
+
},
|
|
196
|
+
{ additionalProperties: false },
|
|
197
|
+
),
|
|
198
|
+
),
|
|
199
|
+
path: Text,
|
|
200
|
+
branch: Type.Union([Text, Type.Null()]),
|
|
201
|
+
commit: Type.Union([Text, Type.Null()]),
|
|
202
|
+
dirty: Type.Boolean(),
|
|
203
|
+
params: ParamsSchema,
|
|
204
|
+
/** The version its trials ran under: its `trial.ts`'s, or a loop's id of its code. */
|
|
205
|
+
version: Text,
|
|
206
|
+
/** The sandbox and limits its trials ran under, from its own `trial.ts`. */
|
|
207
|
+
sandbox: ResolvedSandboxSchema,
|
|
208
|
+
limits: ResolvedLimitsSchema,
|
|
209
|
+
numbers: Type.Record(Text, Type.Record(Text, PooledSchema)),
|
|
210
|
+
numbersLeftOut: Type.Integer({ minimum: 0 }),
|
|
211
|
+
cases: Type.Array(
|
|
212
|
+
Type.Object(
|
|
213
|
+
{
|
|
214
|
+
name: Text,
|
|
215
|
+
verdict: Type.Union([
|
|
216
|
+
Type.Enum(["passed", "failed", "flaky", "unclear"] as const),
|
|
217
|
+
Type.Null(),
|
|
218
|
+
]),
|
|
219
|
+
passed: Type.Integer({ minimum: 0 }),
|
|
220
|
+
trials: Type.Integer({ minimum: 0 }),
|
|
221
|
+
},
|
|
222
|
+
{ additionalProperties: false },
|
|
223
|
+
),
|
|
224
|
+
),
|
|
225
|
+
},
|
|
226
|
+
{ additionalProperties: false },
|
|
227
|
+
),
|
|
228
|
+
),
|
|
229
|
+
),
|
|
230
|
+
/** With `--case`: its trials, each its record and every score, newest last. */
|
|
231
|
+
trials: Type.Optional(Type.Array(Type.Unknown())),
|
|
232
|
+
/** On `score`: what it graded again, by grader, and whether its budget stopped it. */
|
|
233
|
+
scored: Type.Optional(
|
|
234
|
+
Type.Object(
|
|
235
|
+
{
|
|
236
|
+
graded: Counts,
|
|
237
|
+
errored: Counts,
|
|
238
|
+
estimate: Type.Number({ minimum: 0 }),
|
|
239
|
+
stopped: Type.Boolean(),
|
|
240
|
+
},
|
|
241
|
+
{ additionalProperties: false },
|
|
242
|
+
),
|
|
243
|
+
),
|
|
244
|
+
},
|
|
245
|
+
{ additionalProperties: false, description: "awf-lab run, score and report --json." },
|
|
246
|
+
);
|
|
247
|
+
export type CaseReport = Type.Static<typeof CaseReportSchema>;
|
|
248
|
+
|
|
249
|
+
const Usd = Type.Number({ minimum: 0 });
|
|
250
|
+
|
|
251
|
+
/** What `run`, `score`, `loop run` and `loop final` will do, before paid work: `--dry-run --json`. */
|
|
252
|
+
export const CasePlanSchema = Type.Object(
|
|
253
|
+
{
|
|
254
|
+
kind: Type.Literal(PLAN_KIND),
|
|
255
|
+
command: Type.Enum(["run", "score", "loop run", "loop final"] as const),
|
|
256
|
+
dataset: Text,
|
|
257
|
+
/** `score`: the run it grades again. */
|
|
258
|
+
run: Type.Optional(RunId),
|
|
259
|
+
/** The loop's name. */
|
|
260
|
+
loop: Type.Optional(Text),
|
|
261
|
+
/** The cases, each its trials: run in each column, or graded again. */
|
|
262
|
+
cases: Type.Array(
|
|
263
|
+
Type.Object(
|
|
264
|
+
{ case: Text, trials: Type.Integer({ minimum: 0 }) },
|
|
265
|
+
{ additionalProperties: false },
|
|
266
|
+
),
|
|
267
|
+
),
|
|
268
|
+
columns: Type.Integer({ minimum: 1 }),
|
|
269
|
+
/** Trials to run, those reused left out; on `score`, trials to grade again. */
|
|
270
|
+
trials: Type.Integer({ minimum: 0 }),
|
|
271
|
+
/** Trials kept from earlier runs that stand in for new ones. */
|
|
272
|
+
reused: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
273
|
+
/** Grades to make again, by grader. */
|
|
274
|
+
grades: Type.Optional(Counts),
|
|
275
|
+
/** Agent grades made only if the graders before them, graded again, now pass. */
|
|
276
|
+
maybe: Type.Optional(Counts),
|
|
277
|
+
/** Graders with no earlier grade to price them by. */
|
|
278
|
+
unpriced: Type.Optional(Type.Array(Text)),
|
|
279
|
+
/** `loop run`: the tries it makes at most, and whether the start runs twice first. */
|
|
280
|
+
rounds: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
281
|
+
spread: Type.Optional(Type.Boolean()),
|
|
282
|
+
/** From earlier trials and grades; absent when there were none. */
|
|
283
|
+
estimate: Type.Optional(
|
|
284
|
+
Type.Object(
|
|
285
|
+
{ usd: Type.Optional(Usd), upTo: Type.Optional(Usd), ms: Type.Optional(Usd) },
|
|
286
|
+
{ additionalProperties: false },
|
|
287
|
+
),
|
|
288
|
+
),
|
|
289
|
+
budget: Type.Optional(Usd),
|
|
290
|
+
concurrency: Type.Integer({ minimum: 1 }),
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
additionalProperties: false,
|
|
294
|
+
description: "awf-lab run, score, loop run and loop final --dry-run --json.",
|
|
295
|
+
},
|
|
296
|
+
);
|
|
297
|
+
export type CasePlan = Type.Static<typeof CasePlanSchema>;
|
|
298
|
+
|
|
299
|
+
/** `case check --json`: each case that failed a check or has a known good record. */
|
|
300
|
+
export const CaseCheckSchema = Type.Object(
|
|
301
|
+
{
|
|
302
|
+
kind: Type.Literal(CHECK_KIND),
|
|
303
|
+
/** Each dataset checked: `--dataset`'s, or every one. */
|
|
304
|
+
datasets: Type.Array(
|
|
305
|
+
Type.Object(
|
|
306
|
+
{
|
|
307
|
+
dataset: Text,
|
|
308
|
+
checked: Type.Integer({ minimum: 0 }),
|
|
309
|
+
/** How many have a known good record. */
|
|
310
|
+
good: Type.Integer({ minimum: 0 }),
|
|
311
|
+
failing: Type.Array(Text),
|
|
312
|
+
cases: Type.Array(
|
|
313
|
+
Type.Object(
|
|
314
|
+
{
|
|
315
|
+
case: Text,
|
|
316
|
+
passed: Type.Boolean(),
|
|
317
|
+
/** What its check said, as the text output's line. */
|
|
318
|
+
said: Text,
|
|
319
|
+
},
|
|
320
|
+
{ additionalProperties: false },
|
|
321
|
+
),
|
|
322
|
+
),
|
|
323
|
+
},
|
|
324
|
+
{ additionalProperties: false },
|
|
325
|
+
),
|
|
326
|
+
),
|
|
327
|
+
},
|
|
328
|
+
{ additionalProperties: false, description: "awf-lab case check --json." },
|
|
329
|
+
);
|
|
330
|
+
export type CaseCheck = Type.Static<typeof CaseCheckSchema>;
|
|
331
|
+
|
|
332
|
+
const Count = Type.Optional(Type.Integer({ minimum: 1 }));
|
|
333
|
+
const VerdictCounts = Type.Object(
|
|
334
|
+
{ passed: Count, failed: Count, flaky: Count, unclear: Count, none: Count },
|
|
335
|
+
{ additionalProperties: false },
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
/** `runs --json`: the runs and loops kept, newest first, and the runs whose records don't read. */
|
|
339
|
+
export const CaseRunsSchema = Type.Object(
|
|
340
|
+
{
|
|
341
|
+
kind: Type.Literal(RUNS_KIND),
|
|
342
|
+
runs: Type.Array(
|
|
343
|
+
Type.Object(
|
|
344
|
+
{
|
|
345
|
+
id: RunId,
|
|
346
|
+
dataset: Text,
|
|
347
|
+
cases: Type.Integer({ minimum: 0 }),
|
|
348
|
+
trials: Type.Integer({ minimum: 0 }),
|
|
349
|
+
columns: Type.Integer({ minimum: 1 }),
|
|
350
|
+
state: Type.Enum(["finished", "partial", "broke"] as const),
|
|
351
|
+
/** The reference column's case verdicts, counted; `none` for a case with none. */
|
|
352
|
+
verdicts: VerdictCounts,
|
|
353
|
+
},
|
|
354
|
+
{ additionalProperties: false },
|
|
355
|
+
),
|
|
356
|
+
),
|
|
357
|
+
loops: Type.Array(
|
|
358
|
+
Type.Object(
|
|
359
|
+
{
|
|
360
|
+
id: Text,
|
|
361
|
+
name: Text,
|
|
362
|
+
dataset: Text,
|
|
363
|
+
started: Text,
|
|
364
|
+
tries: Type.Integer({ minimum: 0 }),
|
|
365
|
+
/** The kept try, 0 for the start. */
|
|
366
|
+
kept: Type.Integer({ minimum: 0 }),
|
|
367
|
+
},
|
|
368
|
+
{ additionalProperties: false },
|
|
369
|
+
),
|
|
370
|
+
),
|
|
371
|
+
unread: Type.Array(Type.Object({ id: Text, why: Text }, { additionalProperties: false })),
|
|
372
|
+
},
|
|
373
|
+
{ additionalProperties: false, description: "awf-lab runs --json." },
|
|
374
|
+
);
|
|
375
|
+
export type CaseRuns = Type.Static<typeof CaseRunsSchema>;
|
|
376
|
+
|
|
377
|
+
/** A resolved value and the file it came from, or `default`. */
|
|
378
|
+
const ValueRow = Type.Object(
|
|
379
|
+
{ name: Text, value: Type.String(), from: Type.String() },
|
|
380
|
+
{ additionalProperties: false },
|
|
381
|
+
);
|
|
382
|
+
|
|
383
|
+
/** `config --json`: every dataset and loop and where each is defined, or one's resolved values. */
|
|
384
|
+
export const CaseConfigSchema = Type.Object(
|
|
385
|
+
{
|
|
386
|
+
kind: Type.Literal(CONFIG_KIND),
|
|
387
|
+
project: Text,
|
|
388
|
+
config: Type.Union([Text, Type.Null()]),
|
|
389
|
+
local: Type.Union([Text, Type.Null()]),
|
|
390
|
+
datasets: Type.Array(
|
|
391
|
+
Type.Object(
|
|
392
|
+
{ name: Text, eval: Text, data: Text, definedIn: Type.Array(Text) },
|
|
393
|
+
{ additionalProperties: false },
|
|
394
|
+
),
|
|
395
|
+
),
|
|
396
|
+
loops: Type.Array(
|
|
397
|
+
Type.Object(
|
|
398
|
+
{ name: Text, dataset: Text, definedIn: Type.Array(Text) },
|
|
399
|
+
{ additionalProperties: false },
|
|
400
|
+
),
|
|
401
|
+
),
|
|
402
|
+
/** With `--dataset`: its every value. */
|
|
403
|
+
dataset: Type.Optional(
|
|
404
|
+
Type.Object({ name: Text, values: Type.Array(ValueRow) }, { additionalProperties: false }),
|
|
405
|
+
),
|
|
406
|
+
/** With `--case`: its values from its key. */
|
|
407
|
+
case: Type.Optional(
|
|
408
|
+
Type.Object({ name: Text, values: Type.Array(ValueRow) }, { additionalProperties: false }),
|
|
409
|
+
),
|
|
410
|
+
/** With `--loop`: its every value, the edits it always denies included. */
|
|
411
|
+
loop: Type.Optional(
|
|
412
|
+
Type.Object({ name: Text, values: Type.Array(ValueRow) }, { additionalProperties: false }),
|
|
413
|
+
),
|
|
414
|
+
},
|
|
415
|
+
{ additionalProperties: false, description: "awf-lab config --json." },
|
|
416
|
+
);
|
|
417
|
+
export type CaseConfig = Type.Static<typeof CaseConfigSchema>;
|
|
418
|
+
|
|
419
|
+
/** `report --loop --json`, and `loop run` and `loop final --json`: a loop's tries and checks. */
|
|
420
|
+
export const LoopReportSchema = Type.Object(
|
|
421
|
+
{
|
|
422
|
+
kind: Type.Literal(LOOP_REPORT_KIND),
|
|
423
|
+
id: Text,
|
|
424
|
+
name: Text,
|
|
425
|
+
dataset: Text,
|
|
426
|
+
started: Text,
|
|
427
|
+
proposer: Text,
|
|
428
|
+
trials: Type.Integer({ minimum: 1 }),
|
|
429
|
+
params: Type.Array(Text),
|
|
430
|
+
tuning: Type.Array(Text),
|
|
431
|
+
holdout: Type.Array(Text),
|
|
432
|
+
/** The start run twice before the first try: its run, or skipped, or not yet. */
|
|
433
|
+
spread: Type.Union([
|
|
434
|
+
Type.Object(
|
|
435
|
+
{
|
|
436
|
+
runId: RunId,
|
|
437
|
+
verdict: Type.Union([Text, Type.Null()]),
|
|
438
|
+
unsteady: Type.Array(Text),
|
|
439
|
+
spend: Usd,
|
|
440
|
+
},
|
|
441
|
+
{ additionalProperties: false },
|
|
442
|
+
),
|
|
443
|
+
Type.Literal("skipped"),
|
|
444
|
+
Type.Null(),
|
|
445
|
+
]),
|
|
446
|
+
tries: Type.Array(
|
|
447
|
+
Type.Object(
|
|
448
|
+
{
|
|
449
|
+
n: Type.Integer({ minimum: 1 }),
|
|
450
|
+
parent: Type.Integer({ minimum: 0 }),
|
|
451
|
+
decision: Text,
|
|
452
|
+
why: Type.String(),
|
|
453
|
+
change: Type.Optional(Type.String()),
|
|
454
|
+
changed: Type.Array(Text),
|
|
455
|
+
runId: Type.Optional(RunId),
|
|
456
|
+
spend: Usd,
|
|
457
|
+
},
|
|
458
|
+
{ additionalProperties: false },
|
|
459
|
+
),
|
|
460
|
+
),
|
|
461
|
+
/** The kept try, 0 for the start. */
|
|
462
|
+
kept: Type.Integer({ minimum: 0 }),
|
|
463
|
+
finals: Type.Array(
|
|
464
|
+
Type.Object(
|
|
465
|
+
{
|
|
466
|
+
k: Type.Integer({ minimum: 1 }),
|
|
467
|
+
incumbent: Type.Integer({ minimum: 0 }),
|
|
468
|
+
runId: RunId,
|
|
469
|
+
verdict: Type.Union([Text, Type.Null()]),
|
|
470
|
+
why: Type.String(),
|
|
471
|
+
spend: Usd,
|
|
472
|
+
},
|
|
473
|
+
{ additionalProperties: false },
|
|
474
|
+
),
|
|
475
|
+
),
|
|
476
|
+
/** The total of its estimates so far: the spread, every try and every final check. */
|
|
477
|
+
estimate: Usd,
|
|
478
|
+
},
|
|
479
|
+
{ additionalProperties: false, description: "awf-lab report --loop --json." },
|
|
480
|
+
);
|
|
481
|
+
export type LoopReport = Type.Static<typeof LoopReportSchema>;
|