@agentswf/lab 0.0.0-stage → 0.4.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.
Files changed (125) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -2
  3. package/package.json +46 -4
  4. package/schema/lab-check.schema.json +64 -0
  5. package/schema/lab-config.schema.json +187 -0
  6. package/schema/lab-final.schema.json +48 -0
  7. package/schema/lab-good-record.schema.json +70 -0
  8. package/schema/lab-grade.schema.json +49 -0
  9. package/schema/lab-key.schema.json +124 -0
  10. package/schema/lab-label.schema.json +32 -0
  11. package/schema/lab-loop-report.schema.json +221 -0
  12. package/schema/lab-loop.schema.json +141 -0
  13. package/schema/lab-plan.schema.json +128 -0
  14. package/schema/lab-previous.schema.json +70 -0
  15. package/schema/lab-proposal.schema.json +52 -0
  16. package/schema/lab-report.schema.json +1128 -0
  17. package/schema/lab-run.schema.json +253 -0
  18. package/schema/lab-runs.schema.json +132 -0
  19. package/schema/lab-score.schema.json +319 -0
  20. package/schema/lab-spread.schema.json +110 -0
  21. package/schema/lab-trial.schema.json +543 -0
  22. package/schema/lab-try.schema.json +113 -0
  23. package/schema/local.json +155 -0
  24. package/src/cli.ts +9 -0
  25. package/src/env/capture.ts +48 -0
  26. package/src/env/compare.ts +201 -0
  27. package/src/env/facts.ts +51 -0
  28. package/src/env/fetch.ts +57 -0
  29. package/src/env/files.ts +228 -0
  30. package/src/env/grade-case.ts +80 -0
  31. package/src/env/grade-helper.ts +352 -0
  32. package/src/env/grader.ts +131 -0
  33. package/src/env/index.ts +727 -0
  34. package/src/env/mock.ts +374 -0
  35. package/src/env/routes.ts +90 -0
  36. package/src/env/sources.ts +19 -0
  37. package/src/env/state.ts +79 -0
  38. package/src/env/trial.ts +185 -0
  39. package/src/format/key.ts +168 -0
  40. package/src/format/loop.ts +179 -0
  41. package/src/format/output.ts +542 -0
  42. package/src/format/records.ts +443 -0
  43. package/src/format/schema-files.ts +64 -0
  44. package/src/format/settings.ts +559 -0
  45. package/src/format/trial-env.ts +67 -0
  46. package/src/format/trial-file.ts +134 -0
  47. package/src/help/awf-lab.txt +29 -0
  48. package/src/help/case.txt +39 -0
  49. package/src/help/config.txt +14 -0
  50. package/src/help/label.txt +12 -0
  51. package/src/help/loop.txt +44 -0
  52. package/src/help/report.txt +20 -0
  53. package/src/help/run.txt +61 -0
  54. package/src/help/runs.txt +11 -0
  55. package/src/help/score.txt +28 -0
  56. package/src/judge/criteria.workflow.ts +237 -0
  57. package/src/judge/version.ts +6 -0
  58. package/src/lab/answer.ts +47 -0
  59. package/src/lab/blame.ts +204 -0
  60. package/src/lab/box.ts +251 -0
  61. package/src/lab/capture-command.ts +302 -0
  62. package/src/lab/capture.ts +234 -0
  63. package/src/lab/check-command.ts +187 -0
  64. package/src/lab/cli.ts +325 -0
  65. package/src/lab/code-graders.ts +108 -0
  66. package/src/lab/columns.ts +138 -0
  67. package/src/lab/command-context.ts +436 -0
  68. package/src/lab/compare.ts +123 -0
  69. package/src/lab/config-command.ts +283 -0
  70. package/src/lab/criteria.ts +69 -0
  71. package/src/lab/dataset.ts +375 -0
  72. package/src/lab/eval-files.ts +196 -0
  73. package/src/lab/expect.ts +79 -0
  74. package/src/lab/facts.ts +59 -0
  75. package/src/lab/families.ts +32 -0
  76. package/src/lab/folders.ts +172 -0
  77. package/src/lab/git.ts +128 -0
  78. package/src/lab/good.ts +224 -0
  79. package/src/lab/grading-stub.txt +8 -0
  80. package/src/lab/grading.ts +332 -0
  81. package/src/lab/inspect.ts +227 -0
  82. package/src/lab/labels.ts +211 -0
  83. package/src/lab/loop-code.ts +255 -0
  84. package/src/lab/loop-command.ts +774 -0
  85. package/src/lab/loop-records.ts +144 -0
  86. package/src/lab/loop.ts +864 -0
  87. package/src/lab/marker.ts +23 -0
  88. package/src/lab/outcome.ts +196 -0
  89. package/src/lab/pooled.ts +106 -0
  90. package/src/lab/project-env.ts +39 -0
  91. package/src/lab/rates.ts +155 -0
  92. package/src/lab/reach.ts +111 -0
  93. package/src/lab/record-copies.ts +202 -0
  94. package/src/lab/refusal.ts +2 -0
  95. package/src/lab/report-command.ts +157 -0
  96. package/src/lab/report.ts +936 -0
  97. package/src/lab/reuse.ts +134 -0
  98. package/src/lab/run-command.ts +958 -0
  99. package/src/lab/run-logs.ts +89 -0
  100. package/src/lab/run-report.ts +286 -0
  101. package/src/lab/runs-command.ts +171 -0
  102. package/src/lab/runs.ts +172 -0
  103. package/src/lab/scaffold.ts +94 -0
  104. package/src/lab/score-command.ts +197 -0
  105. package/src/lab/score.ts +396 -0
  106. package/src/lab/store.ts +383 -0
  107. package/src/lab/target-stub.txt +18 -0
  108. package/src/lab/text.ts +29 -0
  109. package/src/lab/trial-settings.ts +105 -0
  110. package/src/lab/trial.ts +439 -0
  111. package/src/lab/usage.ts +274 -0
  112. package/src/lab/verdict.ts +161 -0
  113. package/src/lab/workflow-graders.ts +164 -0
  114. package/src/lab/workspace.ts +496 -0
  115. package/src/loop/propose.workflow.ts +84 -0
  116. package/src/shared/allowance.ts +185 -0
  117. package/src/shared/compare/index.ts +3 -0
  118. package/src/shared/compare/paired.ts +397 -0
  119. package/src/shared/compare/stats.ts +139 -0
  120. package/src/shared/compare/types.ts +75 -0
  121. package/src/shared/config.ts +15 -0
  122. package/src/shared/runner.ts +321 -0
  123. package/src/shared/validate.ts +181 -0
  124. package/src/shared/version.ts +41 -0
  125. package/src/write-schemas.ts +10 -0
@@ -0,0 +1,110 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "awf-lab loop's spread.json",
4
+ "anyOf": [
5
+ {
6
+ "type": "object",
7
+ "required": ["kind", "at", "skipped"],
8
+ "properties": {
9
+ "kind": {
10
+ "type": "string",
11
+ "const": "awf.lab-spread/1"
12
+ },
13
+ "at": {
14
+ "type": "string",
15
+ "minLength": 1
16
+ },
17
+ "skipped": {
18
+ "type": "boolean",
19
+ "const": true
20
+ }
21
+ },
22
+ "additionalProperties": false
23
+ },
24
+ {
25
+ "type": "object",
26
+ "required": ["kind", "at", "labRun", "trials", "cases", "decision", "unsteady", "estimate"],
27
+ "properties": {
28
+ "kind": {
29
+ "type": "string",
30
+ "const": "awf.lab-spread/1"
31
+ },
32
+ "at": {
33
+ "type": "string",
34
+ "minLength": 1
35
+ },
36
+ "labRun": {
37
+ "type": "string",
38
+ "minLength": 1
39
+ },
40
+ "trials": {
41
+ "type": "integer",
42
+ "minimum": 1
43
+ },
44
+ "cases": {
45
+ "type": "integer",
46
+ "minimum": 0
47
+ },
48
+ "decision": {
49
+ "anyOf": [
50
+ {
51
+ "type": "string",
52
+ "minLength": 1
53
+ },
54
+ {
55
+ "type": "null"
56
+ }
57
+ ]
58
+ },
59
+ "primary": {
60
+ "type": "object",
61
+ "required": ["name", "difference"],
62
+ "properties": {
63
+ "name": {
64
+ "type": "string",
65
+ "minLength": 1
66
+ },
67
+ "difference": {
68
+ "anyOf": [
69
+ {
70
+ "type": "number"
71
+ },
72
+ {
73
+ "type": "null"
74
+ }
75
+ ]
76
+ }
77
+ },
78
+ "additionalProperties": false
79
+ },
80
+ "unsteady": {
81
+ "type": "array",
82
+ "items": {
83
+ "type": "object",
84
+ "required": ["case", "a", "b"],
85
+ "properties": {
86
+ "case": {
87
+ "type": "string",
88
+ "minLength": 1
89
+ },
90
+ "a": {
91
+ "type": "string",
92
+ "minLength": 1
93
+ },
94
+ "b": {
95
+ "type": "string",
96
+ "minLength": 1
97
+ }
98
+ },
99
+ "additionalProperties": false
100
+ }
101
+ },
102
+ "estimate": {
103
+ "type": "number",
104
+ "minimum": 0
105
+ }
106
+ },
107
+ "additionalProperties": false
108
+ }
109
+ ]
110
+ }
@@ -0,0 +1,543 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "awf-lab trial",
4
+ "type": "object",
5
+ "required": [
6
+ "kind",
7
+ "labRun",
8
+ "dataset",
9
+ "case",
10
+ "column",
11
+ "trial",
12
+ "params",
13
+ "version",
14
+ "awf",
15
+ "input",
16
+ "sandbox",
17
+ "limits",
18
+ "models",
19
+ "at",
20
+ "ms",
21
+ "files",
22
+ "unused",
23
+ "refused",
24
+ "leaked"
25
+ ],
26
+ "properties": {
27
+ "kind": {
28
+ "type": "string",
29
+ "const": "awf.lab-trial/1"
30
+ },
31
+ "labRun": {
32
+ "type": "string",
33
+ "pattern": "^[0-9]{8}-[0-9]{6}-[0-9a-f]{4}$"
34
+ },
35
+ "dataset": {
36
+ "type": "string",
37
+ "minLength": 1
38
+ },
39
+ "case": {
40
+ "type": "string",
41
+ "minLength": 1
42
+ },
43
+ "column": {
44
+ "type": "integer",
45
+ "minimum": 0
46
+ },
47
+ "trial": {
48
+ "type": "integer",
49
+ "minimum": 1
50
+ },
51
+ "params": {
52
+ "type": "object",
53
+ "patternProperties": {
54
+ "^[A-Za-z][A-Za-z0-9_-]*$": {
55
+ "type": "string",
56
+ "minLength": 1
57
+ }
58
+ }
59
+ },
60
+ "version": {
61
+ "type": "string",
62
+ "minLength": 1
63
+ },
64
+ "reuse": {
65
+ "type": "string",
66
+ "pattern": "^[0-9a-f]{64}$"
67
+ },
68
+ "reused": {
69
+ "type": "object",
70
+ "required": ["labRun", "column", "trial"],
71
+ "properties": {
72
+ "labRun": {
73
+ "type": "string",
74
+ "pattern": "^[0-9]{8}-[0-9]{6}-[0-9a-f]{4}$"
75
+ },
76
+ "column": {
77
+ "type": "integer",
78
+ "minimum": 0
79
+ },
80
+ "trial": {
81
+ "type": "integer",
82
+ "minimum": 1
83
+ }
84
+ },
85
+ "additionalProperties": false
86
+ },
87
+ "awf": {
88
+ "type": "object",
89
+ "required": ["bin", "version"],
90
+ "properties": {
91
+ "bin": {
92
+ "type": "string",
93
+ "minLength": 1
94
+ },
95
+ "version": {
96
+ "type": "string",
97
+ "minLength": 1
98
+ }
99
+ },
100
+ "additionalProperties": false
101
+ },
102
+ "input": {
103
+ "type": "string",
104
+ "pattern": "^[0-9a-f]{64}$"
105
+ },
106
+ "sandbox": {
107
+ "anyOf": [
108
+ {
109
+ "type": "object",
110
+ "required": ["by", "provider", "network"],
111
+ "properties": {
112
+ "by": {
113
+ "type": "string",
114
+ "const": "lab"
115
+ },
116
+ "provider": {
117
+ "type": "string",
118
+ "const": "srt"
119
+ },
120
+ "network": {
121
+ "type": "object",
122
+ "required": ["agents", "code", "webSearch", "sockets"],
123
+ "properties": {
124
+ "agents": {
125
+ "type": "array",
126
+ "items": {
127
+ "type": "string",
128
+ "pattern": "^(\\*\\.)?[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*$"
129
+ }
130
+ },
131
+ "code": {
132
+ "type": "array",
133
+ "items": {
134
+ "type": "string",
135
+ "pattern": "^(\\*\\.)?[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*$"
136
+ }
137
+ },
138
+ "webSearch": {
139
+ "type": "boolean"
140
+ },
141
+ "sockets": {
142
+ "type": "array",
143
+ "items": {
144
+ "type": "string",
145
+ "minLength": 1
146
+ }
147
+ }
148
+ },
149
+ "additionalProperties": false
150
+ }
151
+ },
152
+ "additionalProperties": false
153
+ },
154
+ {
155
+ "type": "object",
156
+ "required": ["by", "network"],
157
+ "properties": {
158
+ "by": {
159
+ "type": "string",
160
+ "const": "workflow"
161
+ },
162
+ "network": {
163
+ "type": "object",
164
+ "required": ["agents", "code", "webSearch", "sockets"],
165
+ "properties": {
166
+ "agents": {
167
+ "type": "array",
168
+ "items": {
169
+ "type": "string",
170
+ "pattern": "^(\\*\\.)?[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*$"
171
+ }
172
+ },
173
+ "code": {
174
+ "type": "array",
175
+ "items": {
176
+ "type": "string",
177
+ "pattern": "^(\\*\\.)?[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*$"
178
+ }
179
+ },
180
+ "webSearch": {
181
+ "type": "boolean"
182
+ },
183
+ "sockets": {
184
+ "type": "array",
185
+ "items": {
186
+ "type": "string",
187
+ "minLength": 1
188
+ }
189
+ }
190
+ },
191
+ "additionalProperties": false
192
+ }
193
+ },
194
+ "additionalProperties": false
195
+ }
196
+ ]
197
+ },
198
+ "limits": {
199
+ "type": "object",
200
+ "required": ["setup", "workflow", "after"],
201
+ "properties": {
202
+ "setup": {
203
+ "type": "string",
204
+ "pattern": "^[1-9][0-9]*(ms|s|m|h)$"
205
+ },
206
+ "workflow": {
207
+ "type": "string",
208
+ "pattern": "^[1-9][0-9]*(ms|s|m|h)$"
209
+ },
210
+ "after": {
211
+ "type": "string",
212
+ "pattern": "^[1-9][0-9]*(ms|s|m|h)$"
213
+ }
214
+ },
215
+ "additionalProperties": false
216
+ },
217
+ "models": {
218
+ "type": "array",
219
+ "items": {
220
+ "type": "string",
221
+ "minLength": 1
222
+ }
223
+ },
224
+ "at": {
225
+ "type": "string",
226
+ "format": "date-time"
227
+ },
228
+ "workflow": {
229
+ "type": "object",
230
+ "required": ["name"],
231
+ "properties": {
232
+ "name": {
233
+ "type": "string",
234
+ "minLength": 1
235
+ },
236
+ "version": {
237
+ "type": "string"
238
+ }
239
+ },
240
+ "additionalProperties": false
241
+ },
242
+ "trialId": {
243
+ "type": "string",
244
+ "minLength": 1
245
+ },
246
+ "runOutcome": {
247
+ "type": "string",
248
+ "minLength": 1
249
+ },
250
+ "runReason": {
251
+ "type": "string"
252
+ },
253
+ "ms": {
254
+ "type": "number",
255
+ "minimum": 0
256
+ },
257
+ "setupMs": {
258
+ "type": "number",
259
+ "minimum": 0
260
+ },
261
+ "estimate": {
262
+ "type": "number",
263
+ "minimum": 0
264
+ },
265
+ "known": {
266
+ "type": "integer",
267
+ "minimum": 0
268
+ },
269
+ "priced": {
270
+ "type": "integer",
271
+ "minimum": 0
272
+ },
273
+ "agents": {
274
+ "type": "integer",
275
+ "minimum": 0
276
+ },
277
+ "result": {},
278
+ "stages": {
279
+ "type": "object",
280
+ "patternProperties": {
281
+ "^.*$": {}
282
+ }
283
+ },
284
+ "stubbedStages": {
285
+ "type": "object",
286
+ "patternProperties": {
287
+ "^.*$": {}
288
+ }
289
+ },
290
+ "stoppedAfter": {
291
+ "type": "string"
292
+ },
293
+ "calls": {
294
+ "type": "object",
295
+ "patternProperties": {
296
+ "^.*$": {
297
+ "type": "object",
298
+ "patternProperties": {
299
+ "^.*$": {
300
+ "type": "array",
301
+ "items": {
302
+ "type": "array",
303
+ "items": {}
304
+ }
305
+ }
306
+ }
307
+ }
308
+ }
309
+ },
310
+ "requests": {
311
+ "type": "array",
312
+ "items": {
313
+ "type": "object",
314
+ "required": ["method", "url"],
315
+ "properties": {
316
+ "method": {
317
+ "type": "string"
318
+ },
319
+ "url": {
320
+ "type": "string"
321
+ },
322
+ "body": {
323
+ "type": "string"
324
+ },
325
+ "unix": {
326
+ "type": "string"
327
+ }
328
+ },
329
+ "additionalProperties": false
330
+ }
331
+ },
332
+ "values": {},
333
+ "files": {
334
+ "type": "array",
335
+ "items": {
336
+ "type": "string"
337
+ }
338
+ },
339
+ "runFacts": {
340
+ "type": "object",
341
+ "patternProperties": {
342
+ "^_": {
343
+ "type": "number",
344
+ "minimum": 0
345
+ }
346
+ },
347
+ "additionalProperties": false
348
+ },
349
+ "stageMs": {
350
+ "type": "object",
351
+ "patternProperties": {
352
+ "^.*$": {
353
+ "type": "number",
354
+ "minimum": 0
355
+ }
356
+ }
357
+ },
358
+ "unused": {
359
+ "type": "array",
360
+ "items": {
361
+ "type": "string"
362
+ }
363
+ },
364
+ "refused": {
365
+ "type": "array",
366
+ "items": {
367
+ "type": "object",
368
+ "required": ["what", "by", "phase", "message"],
369
+ "properties": {
370
+ "what": {
371
+ "type": "string"
372
+ },
373
+ "by": {
374
+ "anyOf": [
375
+ {
376
+ "type": "string",
377
+ "const": "function"
378
+ },
379
+ {
380
+ "type": "string",
381
+ "const": "host"
382
+ }
383
+ ]
384
+ },
385
+ "phase": {
386
+ "enum": ["setup", "body", "evidence", "teardown"]
387
+ },
388
+ "message": {
389
+ "type": "string"
390
+ }
391
+ },
392
+ "additionalProperties": false
393
+ }
394
+ },
395
+ "leaked": {
396
+ "type": "boolean"
397
+ },
398
+ "reach": {
399
+ "type": "object",
400
+ "required": ["ok", "problems", "sockets", "sandboxes"],
401
+ "properties": {
402
+ "ok": {
403
+ "type": "boolean"
404
+ },
405
+ "problems": {
406
+ "type": "array",
407
+ "items": {
408
+ "type": "string"
409
+ }
410
+ },
411
+ "sockets": {
412
+ "type": "array",
413
+ "items": {
414
+ "type": "string"
415
+ }
416
+ },
417
+ "sandboxes": {
418
+ "type": "array",
419
+ "items": {
420
+ "type": "object",
421
+ "required": ["key", "provider", "network", "webSearch", "agents"],
422
+ "properties": {
423
+ "key": {
424
+ "type": "string"
425
+ },
426
+ "provider": {
427
+ "type": "string"
428
+ },
429
+ "network": {
430
+ "type": "array",
431
+ "items": {
432
+ "type": "string"
433
+ }
434
+ },
435
+ "webSearch": {
436
+ "type": "boolean"
437
+ },
438
+ "agents": {
439
+ "type": "array",
440
+ "items": {
441
+ "type": "string"
442
+ }
443
+ }
444
+ },
445
+ "additionalProperties": false
446
+ }
447
+ }
448
+ },
449
+ "additionalProperties": false
450
+ },
451
+ "stopped": {
452
+ "type": "string"
453
+ },
454
+ "workflowError": {
455
+ "type": "string"
456
+ },
457
+ "errored": {
458
+ "type": "object",
459
+ "required": ["by", "phase", "reason"],
460
+ "properties": {
461
+ "by": {
462
+ "anyOf": [
463
+ {
464
+ "type": "string",
465
+ "const": "dataset"
466
+ },
467
+ {
468
+ "type": "string",
469
+ "const": "grading"
470
+ },
471
+ {
472
+ "type": "string",
473
+ "const": "provider"
474
+ },
475
+ {
476
+ "type": "string",
477
+ "const": "harness"
478
+ },
479
+ {
480
+ "type": "string",
481
+ "const": "lab"
482
+ }
483
+ ]
484
+ },
485
+ "phase": {
486
+ "anyOf": [
487
+ {
488
+ "type": "string",
489
+ "const": "setup"
490
+ },
491
+ {
492
+ "type": "string",
493
+ "const": "body"
494
+ },
495
+ {
496
+ "type": "string",
497
+ "const": "evidence"
498
+ },
499
+ {
500
+ "type": "string",
501
+ "const": "teardown"
502
+ },
503
+ {
504
+ "type": "string",
505
+ "const": "after"
506
+ },
507
+ {
508
+ "type": "string",
509
+ "const": "facts"
510
+ }
511
+ ]
512
+ },
513
+ "code": {
514
+ "enum": [
515
+ "threw",
516
+ "timed-out",
517
+ "refused",
518
+ "prepare",
519
+ "workflow-missing",
520
+ "workflow-loaded-early",
521
+ "events",
522
+ "given-refused",
523
+ "facts-missing",
524
+ "fact-type",
525
+ "evidence",
526
+ "stage-not-entered",
527
+ "precondition",
528
+ "reach",
529
+ "login"
530
+ ]
531
+ },
532
+ "reason": {
533
+ "type": "string"
534
+ }
535
+ },
536
+ "additionalProperties": false
537
+ },
538
+ "retried": {
539
+ "type": "boolean"
540
+ }
541
+ },
542
+ "additionalProperties": false
543
+ }