markform 0.1.1 → 0.1.3
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/DOCS.md +546 -0
- package/README.md +340 -71
- package/SPEC.md +2779 -0
- package/dist/ai-sdk.d.mts +2 -2
- package/dist/ai-sdk.mjs +5 -3
- package/dist/{apply-BQdd-fdx.mjs → apply-00UmzDKL.mjs} +849 -730
- package/dist/bin.mjs +6 -3
- package/dist/{cli-pjOiHgCW.mjs → cli-D--Lel-e.mjs} +1374 -428
- package/dist/cli.mjs +6 -3
- package/dist/{coreTypes--6etkcwb.d.mts → coreTypes-BXhhz9Iq.d.mts} +1946 -794
- package/dist/coreTypes-Dful87E0.mjs +537 -0
- package/dist/index.d.mts +116 -19
- package/dist/index.mjs +5 -3
- package/dist/session-Bqnwi9wp.mjs +110 -0
- package/dist/session-DdAtY2Ni.mjs +4 -0
- package/dist/shared-D7gf27Tr.mjs +3 -0
- package/dist/shared-N_s1M-_K.mjs +176 -0
- package/dist/src-Dm8jZ5dl.mjs +7587 -0
- package/examples/celebrity-deep-research/celebrity-deep-research.form.md +912 -0
- package/examples/earnings-analysis/earnings-analysis.form.md +6 -1
- package/examples/earnings-analysis/earnings-analysis.valid.ts +119 -59
- package/examples/movie-research/movie-research-basic.form.md +164 -0
- package/examples/movie-research/movie-research-deep.form.md +486 -0
- package/examples/movie-research/movie-research-minimal.form.md +54 -0
- package/examples/simple/simple-mock-filled.form.md +17 -13
- package/examples/simple/simple-skipped-filled.form.md +32 -9
- package/examples/simple/simple-with-skips.session.yaml +102 -143
- package/examples/simple/simple.form.md +13 -13
- package/examples/simple/simple.session.yaml +80 -69
- package/examples/startup-deep-research/startup-deep-research.form.md +60 -8
- package/examples/startup-research/startup-research-mock-filled.form.md +1 -1
- package/examples/startup-research/startup-research.form.md +1 -1
- package/package.json +10 -14
- package/dist/src-Cs4_9lWP.mjs +0 -2151
- package/examples/political-research/political-research.form.md +0 -233
- package/examples/political-research/political-research.mock.lincoln.form.md +0 -355
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/engine/coreTypes.ts
|
|
4
|
+
/**
|
|
5
|
+
* Core types and Zod schemas for Markform.
|
|
6
|
+
*
|
|
7
|
+
* This module defines all TypeScript types and their corresponding Zod schemas
|
|
8
|
+
* for forms, fields, values, validation, patches, and session transcripts.
|
|
9
|
+
*/
|
|
10
|
+
const IdSchema = z.string().min(1);
|
|
11
|
+
const OptionIdSchema = z.string().min(1);
|
|
12
|
+
const NoteIdSchema = z.string().min(1);
|
|
13
|
+
const ValidatorRefSchema = z.union([z.string(), z.object({ id: z.string() }).passthrough()]);
|
|
14
|
+
const AnswerStateSchema = z.enum([
|
|
15
|
+
"unanswered",
|
|
16
|
+
"answered",
|
|
17
|
+
"skipped",
|
|
18
|
+
"aborted"
|
|
19
|
+
]);
|
|
20
|
+
const MultiCheckboxStateSchema = z.enum([
|
|
21
|
+
"todo",
|
|
22
|
+
"done",
|
|
23
|
+
"incomplete",
|
|
24
|
+
"active",
|
|
25
|
+
"na"
|
|
26
|
+
]);
|
|
27
|
+
const SimpleCheckboxStateSchema = z.enum(["todo", "done"]);
|
|
28
|
+
const ExplicitCheckboxValueSchema = z.enum([
|
|
29
|
+
"unfilled",
|
|
30
|
+
"yes",
|
|
31
|
+
"no"
|
|
32
|
+
]);
|
|
33
|
+
const CheckboxValueSchema = z.union([MultiCheckboxStateSchema, ExplicitCheckboxValueSchema]);
|
|
34
|
+
const CheckboxModeSchema = z.enum([
|
|
35
|
+
"multi",
|
|
36
|
+
"simple",
|
|
37
|
+
"explicit"
|
|
38
|
+
]);
|
|
39
|
+
const FillModeSchema = z.enum(["continue", "overwrite"]);
|
|
40
|
+
const MockModeSchema = z.enum(["mock", "live"]);
|
|
41
|
+
const ApprovalModeSchema = z.enum(["none", "blocking"]);
|
|
42
|
+
const FieldKindSchema = z.enum([
|
|
43
|
+
"string",
|
|
44
|
+
"number",
|
|
45
|
+
"string_list",
|
|
46
|
+
"checkboxes",
|
|
47
|
+
"single_select",
|
|
48
|
+
"multi_select",
|
|
49
|
+
"url",
|
|
50
|
+
"url_list",
|
|
51
|
+
"date",
|
|
52
|
+
"year"
|
|
53
|
+
]);
|
|
54
|
+
const FieldPriorityLevelSchema = z.enum([
|
|
55
|
+
"high",
|
|
56
|
+
"medium",
|
|
57
|
+
"low"
|
|
58
|
+
]);
|
|
59
|
+
const OptionSchema = z.object({
|
|
60
|
+
id: IdSchema,
|
|
61
|
+
label: z.string()
|
|
62
|
+
});
|
|
63
|
+
const FieldBaseSchemaPartial = {
|
|
64
|
+
id: IdSchema,
|
|
65
|
+
label: z.string(),
|
|
66
|
+
required: z.boolean(),
|
|
67
|
+
priority: FieldPriorityLevelSchema,
|
|
68
|
+
role: z.string(),
|
|
69
|
+
validate: z.array(ValidatorRefSchema).optional()
|
|
70
|
+
};
|
|
71
|
+
const StringFieldSchema = z.object({
|
|
72
|
+
...FieldBaseSchemaPartial,
|
|
73
|
+
kind: z.literal("string"),
|
|
74
|
+
multiline: z.boolean().optional(),
|
|
75
|
+
pattern: z.string().optional(),
|
|
76
|
+
minLength: z.number().int().nonnegative().optional(),
|
|
77
|
+
maxLength: z.number().int().nonnegative().optional()
|
|
78
|
+
});
|
|
79
|
+
const NumberFieldSchema = z.object({
|
|
80
|
+
...FieldBaseSchemaPartial,
|
|
81
|
+
kind: z.literal("number"),
|
|
82
|
+
min: z.number().optional(),
|
|
83
|
+
max: z.number().optional(),
|
|
84
|
+
integer: z.boolean().optional()
|
|
85
|
+
});
|
|
86
|
+
const StringListFieldSchema = z.object({
|
|
87
|
+
...FieldBaseSchemaPartial,
|
|
88
|
+
kind: z.literal("string_list"),
|
|
89
|
+
minItems: z.number().int().nonnegative().optional(),
|
|
90
|
+
maxItems: z.number().int().nonnegative().optional(),
|
|
91
|
+
itemMinLength: z.number().int().nonnegative().optional(),
|
|
92
|
+
itemMaxLength: z.number().int().nonnegative().optional(),
|
|
93
|
+
uniqueItems: z.boolean().optional()
|
|
94
|
+
});
|
|
95
|
+
const CheckboxesFieldSchema = z.object({
|
|
96
|
+
...FieldBaseSchemaPartial,
|
|
97
|
+
kind: z.literal("checkboxes"),
|
|
98
|
+
checkboxMode: CheckboxModeSchema,
|
|
99
|
+
minDone: z.number().int().optional(),
|
|
100
|
+
options: z.array(OptionSchema),
|
|
101
|
+
approvalMode: ApprovalModeSchema
|
|
102
|
+
});
|
|
103
|
+
const SingleSelectFieldSchema = z.object({
|
|
104
|
+
...FieldBaseSchemaPartial,
|
|
105
|
+
kind: z.literal("single_select"),
|
|
106
|
+
options: z.array(OptionSchema)
|
|
107
|
+
});
|
|
108
|
+
const MultiSelectFieldSchema = z.object({
|
|
109
|
+
...FieldBaseSchemaPartial,
|
|
110
|
+
kind: z.literal("multi_select"),
|
|
111
|
+
options: z.array(OptionSchema),
|
|
112
|
+
minSelections: z.number().int().nonnegative().optional(),
|
|
113
|
+
maxSelections: z.number().int().nonnegative().optional()
|
|
114
|
+
});
|
|
115
|
+
const UrlFieldSchema = z.object({
|
|
116
|
+
...FieldBaseSchemaPartial,
|
|
117
|
+
kind: z.literal("url")
|
|
118
|
+
});
|
|
119
|
+
const UrlListFieldSchema = z.object({
|
|
120
|
+
...FieldBaseSchemaPartial,
|
|
121
|
+
kind: z.literal("url_list"),
|
|
122
|
+
minItems: z.number().int().nonnegative().optional(),
|
|
123
|
+
maxItems: z.number().int().nonnegative().optional(),
|
|
124
|
+
uniqueItems: z.boolean().optional()
|
|
125
|
+
});
|
|
126
|
+
const DateFieldSchema = z.object({
|
|
127
|
+
...FieldBaseSchemaPartial,
|
|
128
|
+
kind: z.literal("date"),
|
|
129
|
+
min: z.string().optional(),
|
|
130
|
+
max: z.string().optional()
|
|
131
|
+
});
|
|
132
|
+
const YearFieldSchema = z.object({
|
|
133
|
+
...FieldBaseSchemaPartial,
|
|
134
|
+
kind: z.literal("year"),
|
|
135
|
+
min: z.number().int().optional(),
|
|
136
|
+
max: z.number().int().optional()
|
|
137
|
+
});
|
|
138
|
+
const FieldSchema = z.discriminatedUnion("kind", [
|
|
139
|
+
StringFieldSchema,
|
|
140
|
+
NumberFieldSchema,
|
|
141
|
+
StringListFieldSchema,
|
|
142
|
+
CheckboxesFieldSchema,
|
|
143
|
+
SingleSelectFieldSchema,
|
|
144
|
+
MultiSelectFieldSchema,
|
|
145
|
+
UrlFieldSchema,
|
|
146
|
+
UrlListFieldSchema,
|
|
147
|
+
DateFieldSchema,
|
|
148
|
+
YearFieldSchema
|
|
149
|
+
]);
|
|
150
|
+
const FieldGroupSchema = z.object({
|
|
151
|
+
id: IdSchema,
|
|
152
|
+
title: z.string().optional(),
|
|
153
|
+
validate: z.array(ValidatorRefSchema).optional(),
|
|
154
|
+
children: z.array(FieldSchema)
|
|
155
|
+
});
|
|
156
|
+
const FormSchemaSchema = z.object({
|
|
157
|
+
id: IdSchema,
|
|
158
|
+
title: z.string().optional(),
|
|
159
|
+
groups: z.array(FieldGroupSchema)
|
|
160
|
+
});
|
|
161
|
+
const StringValueSchema = z.object({
|
|
162
|
+
kind: z.literal("string"),
|
|
163
|
+
value: z.string().nullable()
|
|
164
|
+
});
|
|
165
|
+
const NumberValueSchema = z.object({
|
|
166
|
+
kind: z.literal("number"),
|
|
167
|
+
value: z.number().nullable()
|
|
168
|
+
});
|
|
169
|
+
const StringListValueSchema = z.object({
|
|
170
|
+
kind: z.literal("string_list"),
|
|
171
|
+
items: z.array(z.string())
|
|
172
|
+
});
|
|
173
|
+
const CheckboxesValueSchema = z.object({
|
|
174
|
+
kind: z.literal("checkboxes"),
|
|
175
|
+
values: z.record(OptionIdSchema, CheckboxValueSchema)
|
|
176
|
+
});
|
|
177
|
+
const SingleSelectValueSchema = z.object({
|
|
178
|
+
kind: z.literal("single_select"),
|
|
179
|
+
selected: OptionIdSchema.nullable()
|
|
180
|
+
});
|
|
181
|
+
const MultiSelectValueSchema = z.object({
|
|
182
|
+
kind: z.literal("multi_select"),
|
|
183
|
+
selected: z.array(OptionIdSchema)
|
|
184
|
+
});
|
|
185
|
+
const UrlValueSchema = z.object({
|
|
186
|
+
kind: z.literal("url"),
|
|
187
|
+
value: z.string().nullable()
|
|
188
|
+
});
|
|
189
|
+
const UrlListValueSchema = z.object({
|
|
190
|
+
kind: z.literal("url_list"),
|
|
191
|
+
items: z.array(z.string())
|
|
192
|
+
});
|
|
193
|
+
const DateValueSchema = z.object({
|
|
194
|
+
kind: z.literal("date"),
|
|
195
|
+
value: z.string().nullable()
|
|
196
|
+
});
|
|
197
|
+
const YearValueSchema = z.object({
|
|
198
|
+
kind: z.literal("year"),
|
|
199
|
+
value: z.number().int().nullable()
|
|
200
|
+
});
|
|
201
|
+
const FieldValueSchema = z.discriminatedUnion("kind", [
|
|
202
|
+
StringValueSchema,
|
|
203
|
+
NumberValueSchema,
|
|
204
|
+
StringListValueSchema,
|
|
205
|
+
CheckboxesValueSchema,
|
|
206
|
+
SingleSelectValueSchema,
|
|
207
|
+
MultiSelectValueSchema,
|
|
208
|
+
UrlValueSchema,
|
|
209
|
+
UrlListValueSchema,
|
|
210
|
+
DateValueSchema,
|
|
211
|
+
YearValueSchema
|
|
212
|
+
]);
|
|
213
|
+
const FieldResponseSchema = z.object({
|
|
214
|
+
state: AnswerStateSchema,
|
|
215
|
+
value: FieldValueSchema.optional(),
|
|
216
|
+
reason: z.string().optional()
|
|
217
|
+
});
|
|
218
|
+
const NoteSchema = z.object({
|
|
219
|
+
id: NoteIdSchema,
|
|
220
|
+
ref: IdSchema,
|
|
221
|
+
role: z.string(),
|
|
222
|
+
text: z.string()
|
|
223
|
+
});
|
|
224
|
+
const DocumentationTagSchema = z.enum([
|
|
225
|
+
"description",
|
|
226
|
+
"instructions",
|
|
227
|
+
"documentation"
|
|
228
|
+
]);
|
|
229
|
+
const DocumentationBlockSchema = z.object({
|
|
230
|
+
tag: DocumentationTagSchema,
|
|
231
|
+
ref: z.string(),
|
|
232
|
+
bodyMarkdown: z.string()
|
|
233
|
+
});
|
|
234
|
+
const FrontmatterHarnessConfigSchema = z.object({
|
|
235
|
+
maxTurns: z.number().int().positive().optional(),
|
|
236
|
+
maxPatchesPerTurn: z.number().int().positive().optional(),
|
|
237
|
+
maxIssuesPerTurn: z.number().int().positive().optional()
|
|
238
|
+
});
|
|
239
|
+
const FormMetadataSchema = z.object({
|
|
240
|
+
markformVersion: z.string(),
|
|
241
|
+
roles: z.array(z.string()).min(1),
|
|
242
|
+
roleInstructions: z.record(z.string(), z.string()),
|
|
243
|
+
harnessConfig: FrontmatterHarnessConfigSchema.optional()
|
|
244
|
+
});
|
|
245
|
+
const SeveritySchema = z.enum([
|
|
246
|
+
"error",
|
|
247
|
+
"warning",
|
|
248
|
+
"info"
|
|
249
|
+
]);
|
|
250
|
+
const SourcePositionSchema = z.object({
|
|
251
|
+
line: z.number().int().positive(),
|
|
252
|
+
col: z.number().int().positive()
|
|
253
|
+
});
|
|
254
|
+
const SourceRangeSchema = z.object({
|
|
255
|
+
start: SourcePositionSchema,
|
|
256
|
+
end: SourcePositionSchema
|
|
257
|
+
});
|
|
258
|
+
const ValidationIssueSchema = z.object({
|
|
259
|
+
severity: SeveritySchema,
|
|
260
|
+
message: z.string(),
|
|
261
|
+
code: z.string().optional(),
|
|
262
|
+
ref: IdSchema.optional(),
|
|
263
|
+
path: z.string().optional(),
|
|
264
|
+
range: SourceRangeSchema.optional(),
|
|
265
|
+
validatorId: z.string().optional(),
|
|
266
|
+
source: z.enum([
|
|
267
|
+
"builtin",
|
|
268
|
+
"code",
|
|
269
|
+
"llm"
|
|
270
|
+
])
|
|
271
|
+
});
|
|
272
|
+
const ErrorLocationSchema = z.object({
|
|
273
|
+
line: z.number().int().positive().optional(),
|
|
274
|
+
column: z.number().int().positive().optional(),
|
|
275
|
+
fieldId: IdSchema.optional(),
|
|
276
|
+
noteId: NoteIdSchema.optional()
|
|
277
|
+
});
|
|
278
|
+
const ParseErrorSchema = z.object({
|
|
279
|
+
type: z.literal("parse"),
|
|
280
|
+
message: z.string(),
|
|
281
|
+
location: ErrorLocationSchema.optional()
|
|
282
|
+
});
|
|
283
|
+
const MarkformValidationErrorSchema = z.object({
|
|
284
|
+
type: z.literal("validation"),
|
|
285
|
+
message: z.string(),
|
|
286
|
+
location: ErrorLocationSchema.optional()
|
|
287
|
+
});
|
|
288
|
+
const MarkformErrorSchema = z.discriminatedUnion("type", [ParseErrorSchema, MarkformValidationErrorSchema]);
|
|
289
|
+
const IssueReasonSchema = z.enum([
|
|
290
|
+
"validation_error",
|
|
291
|
+
"required_missing",
|
|
292
|
+
"checkbox_incomplete",
|
|
293
|
+
"min_items_not_met",
|
|
294
|
+
"optional_empty"
|
|
295
|
+
]);
|
|
296
|
+
const IssueScopeSchema = z.enum([
|
|
297
|
+
"form",
|
|
298
|
+
"group",
|
|
299
|
+
"field",
|
|
300
|
+
"option"
|
|
301
|
+
]);
|
|
302
|
+
const InspectIssueSchema = z.object({
|
|
303
|
+
ref: z.union([IdSchema, z.string()]),
|
|
304
|
+
scope: IssueScopeSchema,
|
|
305
|
+
reason: IssueReasonSchema,
|
|
306
|
+
message: z.string(),
|
|
307
|
+
severity: z.enum(["required", "recommended"]),
|
|
308
|
+
priority: z.number().int().positive(),
|
|
309
|
+
blockedBy: IdSchema.optional()
|
|
310
|
+
});
|
|
311
|
+
const ProgressStateSchema = z.enum([
|
|
312
|
+
"empty",
|
|
313
|
+
"incomplete",
|
|
314
|
+
"invalid",
|
|
315
|
+
"complete"
|
|
316
|
+
]);
|
|
317
|
+
const CheckboxProgressCountsSchema = z.object({
|
|
318
|
+
total: z.number().int().nonnegative(),
|
|
319
|
+
todo: z.number().int().nonnegative(),
|
|
320
|
+
done: z.number().int().nonnegative(),
|
|
321
|
+
incomplete: z.number().int().nonnegative(),
|
|
322
|
+
active: z.number().int().nonnegative(),
|
|
323
|
+
na: z.number().int().nonnegative(),
|
|
324
|
+
unfilled: z.number().int().nonnegative(),
|
|
325
|
+
yes: z.number().int().nonnegative(),
|
|
326
|
+
no: z.number().int().nonnegative()
|
|
327
|
+
});
|
|
328
|
+
const FieldProgressSchema = z.object({
|
|
329
|
+
kind: FieldKindSchema,
|
|
330
|
+
required: z.boolean(),
|
|
331
|
+
answerState: AnswerStateSchema,
|
|
332
|
+
hasNotes: z.boolean(),
|
|
333
|
+
noteCount: z.number().int().nonnegative(),
|
|
334
|
+
empty: z.boolean(),
|
|
335
|
+
valid: z.boolean(),
|
|
336
|
+
issueCount: z.number().int().nonnegative(),
|
|
337
|
+
checkboxProgress: CheckboxProgressCountsSchema.optional()
|
|
338
|
+
});
|
|
339
|
+
const ProgressCountsSchema = z.object({
|
|
340
|
+
totalFields: z.number().int().nonnegative(),
|
|
341
|
+
requiredFields: z.number().int().nonnegative(),
|
|
342
|
+
unansweredFields: z.number().int().nonnegative(),
|
|
343
|
+
answeredFields: z.number().int().nonnegative(),
|
|
344
|
+
skippedFields: z.number().int().nonnegative(),
|
|
345
|
+
abortedFields: z.number().int().nonnegative(),
|
|
346
|
+
validFields: z.number().int().nonnegative(),
|
|
347
|
+
invalidFields: z.number().int().nonnegative(),
|
|
348
|
+
emptyFields: z.number().int().nonnegative(),
|
|
349
|
+
filledFields: z.number().int().nonnegative(),
|
|
350
|
+
emptyRequiredFields: z.number().int().nonnegative(),
|
|
351
|
+
totalNotes: z.number().int().nonnegative()
|
|
352
|
+
});
|
|
353
|
+
const ProgressSummarySchema = z.object({
|
|
354
|
+
counts: ProgressCountsSchema,
|
|
355
|
+
fields: z.record(IdSchema, FieldProgressSchema)
|
|
356
|
+
});
|
|
357
|
+
const StructureSummarySchema = z.object({
|
|
358
|
+
groupCount: z.number().int().nonnegative(),
|
|
359
|
+
fieldCount: z.number().int().nonnegative(),
|
|
360
|
+
optionCount: z.number().int().nonnegative(),
|
|
361
|
+
fieldCountByKind: z.record(FieldKindSchema, z.number().int().nonnegative()),
|
|
362
|
+
groupsById: z.record(IdSchema, z.literal("field_group")),
|
|
363
|
+
fieldsById: z.record(IdSchema, FieldKindSchema),
|
|
364
|
+
optionsById: z.record(z.string(), z.object({
|
|
365
|
+
parentFieldId: IdSchema,
|
|
366
|
+
parentFieldKind: FieldKindSchema
|
|
367
|
+
}))
|
|
368
|
+
});
|
|
369
|
+
const InspectResultSchema = z.object({
|
|
370
|
+
structureSummary: StructureSummarySchema,
|
|
371
|
+
progressSummary: ProgressSummarySchema,
|
|
372
|
+
issues: z.array(InspectIssueSchema),
|
|
373
|
+
isComplete: z.boolean(),
|
|
374
|
+
formState: ProgressStateSchema
|
|
375
|
+
});
|
|
376
|
+
const ApplyResultSchema = z.object({
|
|
377
|
+
applyStatus: z.enum(["applied", "rejected"]),
|
|
378
|
+
structureSummary: StructureSummarySchema,
|
|
379
|
+
progressSummary: ProgressSummarySchema,
|
|
380
|
+
issues: z.array(InspectIssueSchema),
|
|
381
|
+
isComplete: z.boolean(),
|
|
382
|
+
formState: ProgressStateSchema
|
|
383
|
+
});
|
|
384
|
+
const SetStringPatchSchema = z.object({
|
|
385
|
+
op: z.literal("set_string"),
|
|
386
|
+
fieldId: IdSchema,
|
|
387
|
+
value: z.string().nullable()
|
|
388
|
+
});
|
|
389
|
+
const SetNumberPatchSchema = z.object({
|
|
390
|
+
op: z.literal("set_number"),
|
|
391
|
+
fieldId: IdSchema,
|
|
392
|
+
value: z.number().nullable()
|
|
393
|
+
});
|
|
394
|
+
const SetStringListPatchSchema = z.object({
|
|
395
|
+
op: z.literal("set_string_list"),
|
|
396
|
+
fieldId: IdSchema,
|
|
397
|
+
items: z.array(z.string())
|
|
398
|
+
});
|
|
399
|
+
const SetCheckboxesPatchSchema = z.object({
|
|
400
|
+
op: z.literal("set_checkboxes"),
|
|
401
|
+
fieldId: IdSchema,
|
|
402
|
+
values: z.record(OptionIdSchema, CheckboxValueSchema)
|
|
403
|
+
});
|
|
404
|
+
const SetSingleSelectPatchSchema = z.object({
|
|
405
|
+
op: z.literal("set_single_select"),
|
|
406
|
+
fieldId: IdSchema,
|
|
407
|
+
selected: OptionIdSchema.nullable()
|
|
408
|
+
});
|
|
409
|
+
const SetMultiSelectPatchSchema = z.object({
|
|
410
|
+
op: z.literal("set_multi_select"),
|
|
411
|
+
fieldId: IdSchema,
|
|
412
|
+
selected: z.array(OptionIdSchema)
|
|
413
|
+
});
|
|
414
|
+
const SetUrlPatchSchema = z.object({
|
|
415
|
+
op: z.literal("set_url"),
|
|
416
|
+
fieldId: IdSchema,
|
|
417
|
+
value: z.string().nullable()
|
|
418
|
+
});
|
|
419
|
+
const SetUrlListPatchSchema = z.object({
|
|
420
|
+
op: z.literal("set_url_list"),
|
|
421
|
+
fieldId: IdSchema,
|
|
422
|
+
items: z.array(z.string())
|
|
423
|
+
});
|
|
424
|
+
const SetDatePatchSchema = z.object({
|
|
425
|
+
op: z.literal("set_date"),
|
|
426
|
+
fieldId: IdSchema,
|
|
427
|
+
value: z.string().nullable()
|
|
428
|
+
});
|
|
429
|
+
const SetYearPatchSchema = z.object({
|
|
430
|
+
op: z.literal("set_year"),
|
|
431
|
+
fieldId: IdSchema,
|
|
432
|
+
value: z.number().int().nullable()
|
|
433
|
+
});
|
|
434
|
+
const ClearFieldPatchSchema = z.object({
|
|
435
|
+
op: z.literal("clear_field"),
|
|
436
|
+
fieldId: IdSchema
|
|
437
|
+
});
|
|
438
|
+
const SkipFieldPatchSchema = z.object({
|
|
439
|
+
op: z.literal("skip_field"),
|
|
440
|
+
fieldId: IdSchema,
|
|
441
|
+
role: z.string(),
|
|
442
|
+
reason: z.string().optional()
|
|
443
|
+
});
|
|
444
|
+
const AbortFieldPatchSchema = z.object({
|
|
445
|
+
op: z.literal("abort_field"),
|
|
446
|
+
fieldId: IdSchema,
|
|
447
|
+
role: z.string(),
|
|
448
|
+
reason: z.string().optional()
|
|
449
|
+
});
|
|
450
|
+
const AddNotePatchSchema = z.object({
|
|
451
|
+
op: z.literal("add_note"),
|
|
452
|
+
ref: IdSchema,
|
|
453
|
+
role: z.string(),
|
|
454
|
+
text: z.string()
|
|
455
|
+
});
|
|
456
|
+
const RemoveNotePatchSchema = z.object({
|
|
457
|
+
op: z.literal("remove_note"),
|
|
458
|
+
noteId: NoteIdSchema
|
|
459
|
+
});
|
|
460
|
+
const PatchSchema = z.discriminatedUnion("op", [
|
|
461
|
+
SetStringPatchSchema,
|
|
462
|
+
SetNumberPatchSchema,
|
|
463
|
+
SetStringListPatchSchema,
|
|
464
|
+
SetCheckboxesPatchSchema,
|
|
465
|
+
SetSingleSelectPatchSchema,
|
|
466
|
+
SetMultiSelectPatchSchema,
|
|
467
|
+
SetUrlPatchSchema,
|
|
468
|
+
SetUrlListPatchSchema,
|
|
469
|
+
SetDatePatchSchema,
|
|
470
|
+
SetYearPatchSchema,
|
|
471
|
+
ClearFieldPatchSchema,
|
|
472
|
+
SkipFieldPatchSchema,
|
|
473
|
+
AbortFieldPatchSchema,
|
|
474
|
+
AddNotePatchSchema,
|
|
475
|
+
RemoveNotePatchSchema
|
|
476
|
+
]);
|
|
477
|
+
const StepResultSchema = z.object({
|
|
478
|
+
structureSummary: StructureSummarySchema,
|
|
479
|
+
progressSummary: ProgressSummarySchema,
|
|
480
|
+
issues: z.array(InspectIssueSchema),
|
|
481
|
+
stepBudget: z.number().int().nonnegative(),
|
|
482
|
+
isComplete: z.boolean(),
|
|
483
|
+
turnNumber: z.number().int().positive()
|
|
484
|
+
});
|
|
485
|
+
const HarnessConfigSchema = z.object({
|
|
486
|
+
maxIssuesPerTurn: z.number().int().positive(),
|
|
487
|
+
maxPatchesPerTurn: z.number().int().positive(),
|
|
488
|
+
maxTurns: z.number().int().positive(),
|
|
489
|
+
maxFieldsPerTurn: z.number().int().positive().optional(),
|
|
490
|
+
maxGroupsPerTurn: z.number().int().positive().optional(),
|
|
491
|
+
targetRoles: z.array(z.string()).optional(),
|
|
492
|
+
fillMode: FillModeSchema.optional()
|
|
493
|
+
});
|
|
494
|
+
const SessionTurnStatsSchema = z.object({
|
|
495
|
+
inputTokens: z.number().int().nonnegative().optional(),
|
|
496
|
+
outputTokens: z.number().int().nonnegative().optional(),
|
|
497
|
+
toolCalls: z.array(z.object({
|
|
498
|
+
name: z.string(),
|
|
499
|
+
count: z.number().int().positive()
|
|
500
|
+
})).optional()
|
|
501
|
+
});
|
|
502
|
+
const SessionTurnSchema = z.object({
|
|
503
|
+
turn: z.number().int().positive(),
|
|
504
|
+
inspect: z.object({ issues: z.array(InspectIssueSchema) }),
|
|
505
|
+
apply: z.object({ patches: z.array(PatchSchema) }),
|
|
506
|
+
after: z.object({
|
|
507
|
+
requiredIssueCount: z.number().int().nonnegative(),
|
|
508
|
+
markdownSha256: z.string(),
|
|
509
|
+
answeredFieldCount: z.number().int().nonnegative(),
|
|
510
|
+
skippedFieldCount: z.number().int().nonnegative()
|
|
511
|
+
}),
|
|
512
|
+
llm: SessionTurnStatsSchema.optional()
|
|
513
|
+
});
|
|
514
|
+
const SessionFinalSchema = z.object({
|
|
515
|
+
expectComplete: z.boolean(),
|
|
516
|
+
expectedCompletedForm: z.string()
|
|
517
|
+
});
|
|
518
|
+
const SessionTranscriptSchema = z.object({
|
|
519
|
+
sessionVersion: z.string(),
|
|
520
|
+
mode: MockModeSchema,
|
|
521
|
+
form: z.object({ path: z.string() }),
|
|
522
|
+
validators: z.object({ code: z.string().optional() }).optional(),
|
|
523
|
+
mock: z.object({ completedMock: z.string() }).optional(),
|
|
524
|
+
live: z.object({ modelId: z.string() }).optional(),
|
|
525
|
+
harness: HarnessConfigSchema,
|
|
526
|
+
turns: z.array(SessionTurnSchema),
|
|
527
|
+
final: SessionFinalSchema
|
|
528
|
+
});
|
|
529
|
+
const MarkformFrontmatterSchema = z.object({
|
|
530
|
+
markformVersion: z.string(),
|
|
531
|
+
formSummary: StructureSummarySchema,
|
|
532
|
+
formProgress: ProgressSummarySchema,
|
|
533
|
+
formState: ProgressStateSchema
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
//#endregion
|
|
537
|
+
export { StringFieldSchema as $, NumberValueSchema as A, SetCheckboxesPatchSchema as B, IssueReasonSchema as C, MultiSelectFieldSchema as D, MultiCheckboxStateSchema as E, ProgressStateSchema as F, SetStringPatchSchema as G, SetNumberPatchSchema as H, ProgressSummarySchema as I, SingleSelectFieldSchema as J, SeveritySchema as K, SessionFinalSchema as L, OptionSchema as M, PatchSchema as N, MultiSelectValueSchema as O, ProgressCountsSchema as P, StepResultSchema as Q, SessionTranscriptSchema as R, InspectResultSchema as S, MarkformFrontmatterSchema as T, SetSingleSelectPatchSchema as U, SetMultiSelectPatchSchema as V, SetStringListPatchSchema as W, SourcePositionSchema as X, SingleSelectValueSchema as Y, SourceRangeSchema as Z, FieldValueSchema as _, CheckboxValueSchema as a, ValidatorRefSchema as at, IdSchema as b, ClearFieldPatchSchema as c, ExplicitCheckboxValueSchema as d, StringListFieldSchema as et, FieldGroupSchema as f, FieldSchema as g, FieldResponseSchema as h, CheckboxProgressCountsSchema as i, ValidationIssueSchema as it, OptionIdSchema as j, NumberFieldSchema as k, DocumentationBlockSchema as l, FieldProgressSchema as m, ApplyResultSchema as n, StringValueSchema as nt, CheckboxesFieldSchema as o, FieldKindSchema as p, SimpleCheckboxStateSchema as q, CheckboxModeSchema as r, StructureSummarySchema as rt, CheckboxesValueSchema as s, AnswerStateSchema as t, StringListValueSchema as tt, DocumentationTagSchema as u, FormSchemaSchema as v, IssueScopeSchema as w, InspectIssueSchema as x, HarnessConfigSchema as y, SessionTurnSchema as z };
|