markform 0.1.12 → 0.1.13

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.
@@ -1,6 +1,6 @@
1
1
 
2
- import { L as PatchSchema, V as RunModeSchema } from "./coreTypes-Z8SvQyoL.mjs";
3
- import { C as DEFAULT_RESEARCH_MAX_PATCHES_PER_TURN, L as getWebSearchConfig, S as DEFAULT_RESEARCH_MAX_ISSUES_PER_TURN, T as DEFAULT_ROLE_INSTRUCTIONS, V as MarkformConfigError, W as MarkformParseError, _ as DEFAULT_MAX_ISSUES_PER_TURN, d as serializeForm, i as inspect, m as AGENT_ROLE, r as getFieldsForRoles, t as applyPatches, v as DEFAULT_MAX_PATCHES_PER_TURN, w as DEFAULT_ROLES, x as DEFAULT_PRIORITY, y as DEFAULT_MAX_TURNS } from "./apply-WeeBXwXg.mjs";
2
+ import { L as PatchSchema, V as RunModeSchema } from "./coreTypes-Big8sgih.mjs";
3
+ import { C as DEFAULT_RESEARCH_MAX_ISSUES_PER_TURN, E as DEFAULT_ROLE_INSTRUCTIONS, G as MarkformParseError, H as MarkformConfigError, R as getWebSearchConfig, S as DEFAULT_PRIORITY, T as DEFAULT_ROLES, _ as DEFAULT_MAX_ISSUES_PER_TURN, b as DEFAULT_MAX_TURNS, d as serializeForm, i as inspect, m as AGENT_ROLE, r as getFieldsForRoles, t as applyPatches, v as DEFAULT_MAX_PATCHES_PER_TURN, w as DEFAULT_RESEARCH_MAX_PATCHES_PER_TURN, y as DEFAULT_MAX_STEPS_PER_TURN } from "./apply-D5FLd9Yp.mjs";
4
4
  import { z } from "zod";
5
5
  import Markdoc from "@markdoc/markdoc";
6
6
  import YAML from "yaml";
@@ -2538,12 +2538,12 @@ var FormHarness = class {
2538
2538
  if (this.state !== "wait") throw new Error(`Cannot apply in state: ${this.state}`);
2539
2539
  if (patches.length > this.config.maxPatchesPerTurn) throw new Error(`Too many patches: ${patches.length} > ${this.config.maxPatchesPerTurn}`);
2540
2540
  const applyResult = applyPatches(this.form, patches);
2541
- const patchesActuallyApplied = applyResult.applyStatus === "applied" ? patches.length : 0;
2541
+ const patchesActuallyApplied = applyResult.appliedPatches.length;
2542
2542
  const result = inspect(this.form, { targetRoles: this.config.targetRoles });
2543
2543
  const stepResult = this.computeStepResult(result);
2544
2544
  stepResult.patchesApplied = patchesActuallyApplied;
2545
2545
  stepResult.rejectedPatches = applyResult.rejectedPatches;
2546
- this.recordTurn(issues, patches, result, llmStats, context, applyResult.rejectedPatches, wire);
2546
+ this.recordTurn(issues, patches, result, llmStats, context, applyResult.rejectedPatches, applyResult.warnings, wire);
2547
2547
  if (stepResult.issues.length === 0 || this.turnNumber >= this.config.maxTurns) this.state = "complete";
2548
2548
  else this.state = "wait";
2549
2549
  return stepResult;
@@ -2567,7 +2567,7 @@ var FormHarness = class {
2567
2567
  /**
2568
2568
  * Record a turn in the session transcript.
2569
2569
  */
2570
- recordTurn(issues, patches, result, llmStats, context, rejectedPatches, wire) {
2570
+ recordTurn(issues, patches, result, llmStats, context, rejectedPatches, warnings, wire) {
2571
2571
  const hash = sha256(serializeForm(this.form));
2572
2572
  const requiredIssueCount = result.issues.filter((i) => i.severity === "required").length;
2573
2573
  const turn = {
@@ -2575,7 +2575,8 @@ var FormHarness = class {
2575
2575
  inspect: { issues },
2576
2576
  apply: {
2577
2577
  patches,
2578
- ...rejectedPatches && rejectedPatches.length > 0 && { rejectedPatches }
2578
+ ...rejectedPatches && rejectedPatches.length > 0 && { rejectedPatches },
2579
+ ...warnings && warnings.length > 0 && { warnings }
2579
2580
  },
2580
2581
  after: {
2581
2582
  requiredIssueCount,
@@ -8011,7 +8012,7 @@ var LiveAgent = class {
8011
8012
  callbacks;
8012
8013
  constructor(config) {
8013
8014
  this.model = config.model;
8014
- this.maxStepsPerTurn = config.maxStepsPerTurn ?? 3;
8015
+ this.maxStepsPerTurn = config.maxStepsPerTurn ?? DEFAULT_MAX_STEPS_PER_TURN;
8015
8016
  this.systemPromptAddition = config.systemPromptAddition;
8016
8017
  this.targetRole = config.targetRole ?? AGENT_ROLE;
8017
8018
  this.provider = config.provider;
@@ -8728,7 +8729,8 @@ async function fillForm(options) {
8728
8729
  provider,
8729
8730
  enableWebSearch: options.enableWebSearch,
8730
8731
  additionalTools: options.additionalTools,
8731
- callbacks: options.callbacks
8732
+ callbacks: options.callbacks,
8733
+ maxStepsPerTurn: options.maxStepsPerTurn
8732
8734
  });
8733
8735
  let turnCount = startingTurnNumber;
8734
8736
  let turnsThisCall = 0;
@@ -8957,7 +8959,7 @@ function validateResearchForm(form) {
8957
8959
  //#endregion
8958
8960
  //#region src/index.ts
8959
8961
  /** Markform version (injected at build time). */
8960
- const VERSION = "0.1.12";
8962
+ const VERSION = "0.1.13";
8961
8963
 
8962
8964
  //#endregion
8963
8965
  export { parseRawTable as A, parseScopeRef as C, parseForm as D, formToJsonSchema as E, parseCellValue as O, isQualifiedRef as S, fieldToJsonSchema as T, coerceToFieldPatch as _, resolveHarnessConfig as a, isCellRef as b, getProviderNames as c, createLiveAgent as d, MockAgent as f, coerceInputContext as g, createHarness as h, runResearch as i, parseMarkdownTable as k, resolveModel as l, FormHarness as m, isResearchForm as n, fillForm as o, createMockAgent as p, validateResearchForm as r, getProviderInfo as s, VERSION as t, buildMockWireFormat as u, findFieldById as v, serializeScopeRef as w, isFieldRef as x, getFieldId as y };
@@ -199,6 +199,7 @@ const result = await fillForm({
199
199
  | `startingTurnNumber` | `number` | `0` | Starting turn for progress tracking |
200
200
  | `maxPatchesPerTurn` | `number` | `20` | Maximum patches per turn |
201
201
  | `maxIssuesPerTurn` | `number` | `10` | Maximum issues shown per turn |
202
+ | `maxStepsPerTurn` | `number` | `20` | Maximum AI SDK steps (tool call rounds) per turn |
202
203
  | `targetRoles` | `string[]` | `['agent']` | Roles to fill |
203
204
  | `fillMode` | `FillMode` | `'continue'` | `'continue'` or `'overwrite'` |
204
205
  | `callbacks` | `FillCallbacks` | `undefined` | Progress callbacks |
@@ -45,9 +45,9 @@ turns:
45
45
  - score
46
46
  - votes
47
47
  after:
48
- required_issue_count: 2
49
- markdown_sha256: 4edc8e8f1e858aafa657f32e1c2e56c4bfbe93b37224e1010eb6883c111e1c86
50
- answered_field_count: 0
48
+ required_issue_count: 1
49
+ markdown_sha256: 6dea4cae87738069d3c212e817ac7a59a77fcd3c78d7fac506adf4f5b36caf27
50
+ answered_field_count: 1
51
51
  skipped_field_count: 0
52
52
  context:
53
53
  system_prompt: |-
@@ -125,7 +125,7 @@ turns:
125
125
  Type: table
126
126
  Columns: source, score, votes
127
127
  Rows: min: 1, max: 5
128
- Set: { op: "set_table", fieldId: "ratings", rows: [{ "source": "...", "score": "...", "votes": "..." }, ...] }
128
+ Set: { op: "set_table", fieldId: "ratings", value: [{ "source": "...", "score": "...", "votes": "..." }, ...] }
129
129
  This field is required.
130
130
 
131
131
  - **title** (field): Required field "Title" is empty
@@ -215,7 +215,7 @@ turns:
215
215
  Type: table
216
216
  Columns: source, score, votes
217
217
  Rows: min: 1, max: 5
218
- Set: { op: "set_table", fieldId: "ratings", rows: [{ "source": "...", "score": "...", "votes": "..." }, ...] }
218
+ Set: { op: "set_table", fieldId: "ratings", value: [{ "source": "...", "score": "...", "votes": "..." }, ...] }
219
219
  This field is required.
220
220
 
221
221
  - **title** (field): Required field "Title" is empty
@@ -238,7 +238,7 @@ turns:
238
238
  properties:
239
239
  patches:
240
240
  description: Array of patches to apply to the form
241
- value:
241
+ items:
242
242
  $ref: '#/$defs/patch'
243
243
  type: array
244
244
  required:
@@ -270,12 +270,6 @@ turns:
270
270
  message: Required field "Ratings" is empty
271
271
  severity: required
272
272
  priority: 1
273
- - ref: title
274
- scope: field
275
- reason: required_missing
276
- message: Required field "Title" is empty
277
- severity: required
278
- priority: 1
279
273
  apply:
280
274
  patches:
281
275
  - op: set_table
@@ -287,9 +281,6 @@ turns:
287
281
  - source: Rotten Tomatoes
288
282
  score: 92
289
283
  votes: 450
290
- - op: set_string
291
- field_id: title
292
- value: Test Movie
293
284
  after:
294
285
  required_issue_count: 0
295
286
  markdown_sha256: f45e7cd87b036d57564e3340dec33c1dc5c2094d880e52b903f64da19b3b8ec0
@@ -331,7 +322,7 @@ turns:
331
322
 
332
323
  - **Error:** Cannot apply set_string to table field "ratings"
333
324
  **Correction:** This field is type "table". Use set_table instead.
334
- **Correct format:** { op: "set_table", fieldId: "ratings", rows: [{ "source": "...", "score": "...", "votes": "..." }, ...] }
325
+ **Correct format:** { op: "set_table", fieldId: "ratings", value: [{ "source": "...", "score": "...", "votes": "..." }, ...] }
335
326
 
336
327
  # Current Form State
337
328
 
@@ -362,7 +353,11 @@ turns:
362
353
  Enter rating data with source name, score (0-100), and vote count.
363
354
  {% /instructions %}
364
355
 
365
- {% field kind="string" id="title" label="Title" required=true %}{% /field %}
356
+ {% field kind="string" id="title" label="Title" required=true %}
357
+ ```value
358
+ Test Movie
359
+ ```
360
+ {% /field %}
366
361
 
367
362
  {% /group %}
368
363
 
@@ -372,20 +367,14 @@ turns:
372
367
 
373
368
  # Current Form Issues
374
369
 
375
- You need to address 2 issues. Here are the current issues:
370
+ You need to address 1 issue. Here are the current issues:
376
371
 
377
372
  - **ratings** (field): Required field "Ratings" is empty
378
373
  Severity: required, Priority: P1
379
374
  Type: table
380
375
  Columns: source, score, votes
381
376
  Rows: min: 1, max: 5
382
- Set: { op: "set_table", fieldId: "ratings", rows: [{ "source": "...", "score": "...", "votes": "..." }, ...] }
383
- This field is required.
384
-
385
- - **title** (field): Required field "Title" is empty
386
- Severity: required, Priority: P1
387
- Type: string
388
- Set: { op: "set_string", fieldId: "title", value: "..." }
377
+ Set: { op: "set_table", fieldId: "ratings", value: [{ "source": "...", "score": "...", "votes": "..." }, ...] }
389
378
  This field is required.
390
379
 
391
380
  # General Instructions
@@ -429,7 +418,7 @@ turns:
429
418
 
430
419
  - **Error:** Cannot apply set_string to table field "ratings"
431
420
  **Correction:** This field is type "table". Use set_table instead.
432
- **Correct format:** { op: "set_table", fieldId: "ratings", rows: [{ "source": "...", "score": "...", "votes": "..." }, ...] }
421
+ **Correct format:** { op: "set_table", fieldId: "ratings", value: [{ "source": "...", "score": "...", "votes": "..." }, ...] }
433
422
 
434
423
  # Current Form State
435
424
 
@@ -460,7 +449,11 @@ turns:
460
449
  Enter rating data with source name, score (0-100), and vote count.
461
450
  {% /instructions %}
462
451
 
463
- {% field kind="string" id="title" label="Title" required=true %}{% /field %}
452
+ {% field kind="string" id="title" label="Title" required=true %}
453
+ ```value
454
+ Test Movie
455
+ ```
456
+ {% /field %}
464
457
 
465
458
  {% /group %}
466
459
 
@@ -470,20 +463,14 @@ turns:
470
463
 
471
464
  # Current Form Issues
472
465
 
473
- You need to address 2 issues. Here are the current issues:
466
+ You need to address 1 issue. Here are the current issues:
474
467
 
475
468
  - **ratings** (field): Required field "Ratings" is empty
476
469
  Severity: required, Priority: P1
477
470
  Type: table
478
471
  Columns: source, score, votes
479
472
  Rows: min: 1, max: 5
480
- Set: { op: "set_table", fieldId: "ratings", rows: [{ "source": "...", "score": "...", "votes": "..." }, ...] }
481
- This field is required.
482
-
483
- - **title** (field): Required field "Title" is empty
484
- Severity: required, Priority: P1
485
- Type: string
486
- Set: { op: "set_string", fieldId: "title", value: "..." }
473
+ Set: { op: "set_table", fieldId: "ratings", value: [{ "source": "...", "score": "...", "votes": "..." }, ...] }
487
474
  This field is required.
488
475
 
489
476
  # General Instructions
@@ -500,7 +487,7 @@ turns:
500
487
  properties:
501
488
  patches:
502
489
  description: Array of patches to apply to the form
503
- value:
490
+ items:
504
491
  $ref: '#/$defs/patch'
505
492
  type: array
506
493
  required:
@@ -521,9 +508,6 @@ turns:
521
508
  - score: 92
522
509
  source: Rotten Tomatoes
523
510
  votes: 450
524
- - field_id: title
525
- op: set_string
526
- value: Test Movie
527
511
  tool_results: []
528
512
  text: null
529
513
  usage:
@@ -93,29 +93,49 @@
93
93
  "properties": {
94
94
  "research": {
95
95
  "anyOf": [
96
- { "type": "string", "enum": ["todo", "done", "incomplete", "active", "na"] },
97
- { "type": "boolean" }
96
+ {
97
+ "type": "string",
98
+ "enum": ["todo", "done", "incomplete", "active", "na"]
99
+ },
100
+ {
101
+ "type": "boolean"
102
+ }
98
103
  ],
99
104
  "title": "Research"
100
105
  },
101
106
  "design": {
102
107
  "anyOf": [
103
- { "type": "string", "enum": ["todo", "done", "incomplete", "active", "na"] },
104
- { "type": "boolean" }
108
+ {
109
+ "type": "string",
110
+ "enum": ["todo", "done", "incomplete", "active", "na"]
111
+ },
112
+ {
113
+ "type": "boolean"
114
+ }
105
115
  ],
106
116
  "title": "Design"
107
117
  },
108
118
  "implement": {
109
119
  "anyOf": [
110
- { "type": "string", "enum": ["todo", "done", "incomplete", "active", "na"] },
111
- { "type": "boolean" }
120
+ {
121
+ "type": "string",
122
+ "enum": ["todo", "done", "incomplete", "active", "na"]
123
+ },
124
+ {
125
+ "type": "boolean"
126
+ }
112
127
  ],
113
128
  "title": "Implement"
114
129
  },
115
130
  "test": {
116
131
  "anyOf": [
117
- { "type": "string", "enum": ["todo", "done", "incomplete", "active", "na"] },
118
- { "type": "boolean" }
132
+ {
133
+ "type": "string",
134
+ "enum": ["todo", "done", "incomplete", "active", "na"]
135
+ },
136
+ {
137
+ "type": "boolean"
138
+ }
119
139
  ],
120
140
  "title": "Test"
121
141
  }
@@ -131,11 +151,27 @@
131
151
  "type": "object",
132
152
  "properties": {
133
153
  "read_guidelines": {
134
- "anyOf": [{ "type": "string", "enum": ["todo", "done"] }, { "type": "boolean" }],
154
+ "anyOf": [
155
+ {
156
+ "type": "string",
157
+ "enum": ["todo", "done"]
158
+ },
159
+ {
160
+ "type": "boolean"
161
+ }
162
+ ],
135
163
  "title": "I have read the guidelines"
136
164
  },
137
165
  "agree_terms": {
138
- "anyOf": [{ "type": "string", "enum": ["todo", "done"] }, { "type": "boolean" }],
166
+ "anyOf": [
167
+ {
168
+ "type": "string",
169
+ "enum": ["todo", "done"]
170
+ },
171
+ {
172
+ "type": "boolean"
173
+ }
174
+ ],
139
175
  "title": "I agree to the terms"
140
176
  }
141
177
  },
@@ -150,11 +186,27 @@
150
186
  "type": "object",
151
187
  "properties": {
152
188
  "backed_up": {
153
- "anyOf": [{ "type": "string", "enum": ["unfilled", "yes", "no"] }, { "type": "boolean" }],
189
+ "anyOf": [
190
+ {
191
+ "type": "string",
192
+ "enum": ["unfilled", "yes", "no"]
193
+ },
194
+ {
195
+ "type": "boolean"
196
+ }
197
+ ],
154
198
  "title": "Data has been backed up"
155
199
  },
156
200
  "notified": {
157
- "anyOf": [{ "type": "string", "enum": ["unfilled", "yes", "no"] }, { "type": "boolean" }],
201
+ "anyOf": [
202
+ {
203
+ "type": "string",
204
+ "enum": ["unfilled", "yes", "no"]
205
+ },
206
+ {
207
+ "type": "boolean"
208
+ }
209
+ ],
158
210
  "title": "Stakeholders notified"
159
211
  }
160
212
  },
@@ -93,29 +93,49 @@
93
93
  "properties": {
94
94
  "research": {
95
95
  "anyOf": [
96
- { "type": "string", "enum": ["todo", "done", "incomplete", "active", "na"] },
97
- { "type": "boolean" }
96
+ {
97
+ "type": "string",
98
+ "enum": ["todo", "done", "incomplete", "active", "na"]
99
+ },
100
+ {
101
+ "type": "boolean"
102
+ }
98
103
  ],
99
104
  "title": "Research"
100
105
  },
101
106
  "design": {
102
107
  "anyOf": [
103
- { "type": "string", "enum": ["todo", "done", "incomplete", "active", "na"] },
104
- { "type": "boolean" }
108
+ {
109
+ "type": "string",
110
+ "enum": ["todo", "done", "incomplete", "active", "na"]
111
+ },
112
+ {
113
+ "type": "boolean"
114
+ }
105
115
  ],
106
116
  "title": "Design"
107
117
  },
108
118
  "implement": {
109
119
  "anyOf": [
110
- { "type": "string", "enum": ["todo", "done", "incomplete", "active", "na"] },
111
- { "type": "boolean" }
120
+ {
121
+ "type": "string",
122
+ "enum": ["todo", "done", "incomplete", "active", "na"]
123
+ },
124
+ {
125
+ "type": "boolean"
126
+ }
112
127
  ],
113
128
  "title": "Implement"
114
129
  },
115
130
  "test": {
116
131
  "anyOf": [
117
- { "type": "string", "enum": ["todo", "done", "incomplete", "active", "na"] },
118
- { "type": "boolean" }
132
+ {
133
+ "type": "string",
134
+ "enum": ["todo", "done", "incomplete", "active", "na"]
135
+ },
136
+ {
137
+ "type": "boolean"
138
+ }
119
139
  ],
120
140
  "title": "Test"
121
141
  }
@@ -131,11 +151,27 @@
131
151
  "type": "object",
132
152
  "properties": {
133
153
  "read_guidelines": {
134
- "anyOf": [{ "type": "string", "enum": ["todo", "done"] }, { "type": "boolean" }],
154
+ "anyOf": [
155
+ {
156
+ "type": "string",
157
+ "enum": ["todo", "done"]
158
+ },
159
+ {
160
+ "type": "boolean"
161
+ }
162
+ ],
135
163
  "title": "I have read the guidelines"
136
164
  },
137
165
  "agree_terms": {
138
- "anyOf": [{ "type": "string", "enum": ["todo", "done"] }, { "type": "boolean" }],
166
+ "anyOf": [
167
+ {
168
+ "type": "string",
169
+ "enum": ["todo", "done"]
170
+ },
171
+ {
172
+ "type": "boolean"
173
+ }
174
+ ],
139
175
  "title": "I agree to the terms"
140
176
  }
141
177
  },
@@ -150,11 +186,27 @@
150
186
  "type": "object",
151
187
  "properties": {
152
188
  "backed_up": {
153
- "anyOf": [{ "type": "string", "enum": ["unfilled", "yes", "no"] }, { "type": "boolean" }],
189
+ "anyOf": [
190
+ {
191
+ "type": "string",
192
+ "enum": ["unfilled", "yes", "no"]
193
+ },
194
+ {
195
+ "type": "boolean"
196
+ }
197
+ ],
154
198
  "title": "Data has been backed up"
155
199
  },
156
200
  "notified": {
157
- "anyOf": [{ "type": "string", "enum": ["unfilled", "yes", "no"] }, { "type": "boolean" }],
201
+ "anyOf": [
202
+ {
203
+ "type": "string",
204
+ "enum": ["unfilled", "yes", "no"]
205
+ },
206
+ {
207
+ "type": "boolean"
208
+ }
209
+ ],
158
210
  "title": "Stakeholders notified"
159
211
  }
160
212
  },