markform 0.1.8 → 0.1.10

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 (28) hide show
  1. package/README.md +45 -55
  2. package/dist/ai-sdk.d.mts +1 -1
  3. package/dist/ai-sdk.mjs +2 -2
  4. package/dist/{apply-BUU2QcJ2.mjs → apply-BTFCHpYV.mjs} +402 -341
  5. package/dist/bin.mjs +1 -1
  6. package/dist/{cli-BZh25bvy.mjs → cli-BZa4fYR9.mjs} +518 -65
  7. package/dist/cli.mjs +1 -1
  8. package/dist/{coreTypes-DJtu8OOp.mjs → coreTypes-B1oI7qvV.mjs} +36 -3
  9. package/dist/{coreTypes-BSPJ9H27.d.mts → coreTypes-JCPm418M.d.mts} +215 -9
  10. package/dist/index.d.mts +180 -17
  11. package/dist/index.mjs +5 -5
  12. package/dist/{session-DSTNiHza.mjs → session-CzCh6JeY.mjs} +1 -1
  13. package/dist/{session-CmHdAPyg.mjs → session-Dxqwt0RC.mjs} +3 -3
  14. package/dist/{shared-C9yW5FLZ.mjs → shared-CNqwaxUt.mjs} +1 -1
  15. package/dist/{shared-DQ6y3Ggc.mjs → shared-D3dNi-Gn.mjs} +1 -1
  16. package/dist/{src-kUggXhN1.mjs → src-CYnyLwBe.mjs} +297 -128
  17. package/docs/markform-spec.md +104 -53
  18. package/examples/movie-research/movie-deep-research-mock-filled.form.md +601 -0
  19. package/examples/movie-research/{movie-research-deep.form.md → movie-deep-research.form.md} +2 -2
  20. package/examples/rejection-test/rejection-test.session.yaml +446 -0
  21. package/examples/simple/simple-with-skips.session.yaml +1966 -18
  22. package/examples/simple/simple.session.yaml +1979 -18
  23. package/examples/startup-deep-research/startup-deep-research.form.md +21 -36
  24. package/package.json +1 -1
  25. package/examples/earnings-analysis/earnings-analysis.form.md +0 -159
  26. package/examples/earnings-analysis/earnings-analysis.raw.md +0 -801
  27. package/examples/earnings-analysis/earnings-analysis.valid.ts +0 -198
  28. package/examples/movie-research/movie-research-basic.form.md +0 -169
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Markform
2
2
 
3
+ [![CI](https://github.com/jlevy/markform/actions/workflows/ci.yml/badge.svg)](https://github.com/jlevy/markform/actions/workflows/ci.yml)
4
+ ![Coverage](./badges/packages/markform/coverage-total.svg) [![X (formerly Twitter)
5
+ Follow](https://img.shields.io/twitter/follow/ojoshe)](https://x.com/ojoshe)
6
+
3
7
  **Markform** is a text format for defining structured forms that humans can read,
4
8
  machines can parse, and agents can fill via tool calls.
5
9
 
@@ -113,21 +117,23 @@ Fields have types defined by the attributes.
113
117
  Values are filled in incrementally, just like any form.
114
118
  Once filled in, values appear directly inside the tags, in Markdown format:
115
119
 
116
- ```jinja
120
+ ````jinja
117
121
  {% field kind="string" id="movie" label="Movie" role="user"
118
122
  required=true minLength=1 maxLength=300 %}
123
+ ```value
119
124
  The Shawshank Redemption
125
+ ```
120
126
  {% /field %}
121
127
 
122
128
  {% field kind="single_select" id="mpaa_rating" role="agent" label="MPAA Rating" %}
123
129
  - [ ] G {% #g %}
124
130
  - [ ] PG {% #pg %}
125
131
  - [ ] PG-13 {% #pg_13 %}
126
- - [X] R {% #r %}
132
+ - [x] R {% #r %}
127
133
  - [ ] NC-17 {% #nc_17 %}
128
134
  - [ ] NR/Unrated {% #nr %}
129
135
  {% /field %}
130
- ```
136
+ ````
131
137
 
132
138
  Note fields can have a `role="user"` to indicate they are filled interactively by the
133
139
  user, or a `role="agent"` to indicate an agent should fill them in.
@@ -283,7 +289,10 @@ Enter the movie title (add year or details for disambiguation).
283
289
  {% /field %}
284
290
 
285
291
  {% instructions ref="ratings_table" %}
286
- Fill in scores and vote counts from each source:IMDB: Rating (1.0-10.0 scale), vote countRT Critics: Tomatometer (0-100%), review countRT Audience: Audience Score (0-100%), rating count
292
+ Fill in scores and vote counts from each source:
293
+ - IMDB: Rating (1.0-10.0 scale), vote count
294
+ - RT Critics: Tomatometer (0-100%), review count
295
+ - RT Audience: Audience Score (0-100%), rating count
287
296
  {% /instructions %}
288
297
 
289
298
  {% /group %}
@@ -371,14 +380,37 @@ View them with `markform examples --list`, copy with `markform examples`, and ru
371
380
  - [`movie-research-demo.form.md`](https://github.com/jlevy/markform/blob/main/packages/markform/examples/movie-research/movie-research-demo.form.md)
372
381
  \- The quick example above.
373
382
 
374
- - [`movie-research-basic.form.md`](https://github.com/jlevy/markform/blob/main/packages/markform/examples/movie-research/movie-research-basic.form.md)
375
- \- Standard movie research with IMDB, Rotten Tomatoes, Metacritic.
383
+ - [`movie-deep-research.form.md`](https://github.com/jlevy/markform/blob/main/packages/markform/examples/movie-research/movie-deep-research.form.md)
384
+ \- Comprehensive movie analysis with streaming, box office, technical specs.
376
385
 
377
- - [`movie-research-deep.form.md`](https://github.com/jlevy/markform/blob/main/packages/markform/examples/movie-research/movie-research-deep.form.md)
378
- \- Comprehensive movie analysis with streaming, box office, analysis.
386
+ ### Why a New Format?
387
+
388
+ The closest alternatives I’ve seen are:
389
+
390
+ - Plain Markdown docs can be used as templates and filled in by agents.
391
+ These are more expressive, but it is hard to edit them programmatically or use LLMs to
392
+ update them reliably.
393
+
394
+ - JSON + JSON Schema which are good for struture but terrible for additional
395
+ unstructured context like instructions Markdown.
396
+
397
+ - Agent to-do lists are part of many chat or coding interfaces and are programmatically
398
+ edited by agents. But these are limited to simple checklists, not forms with other
399
+ fields.
400
+
401
+ - Numerous tools like Typeform, Google Forms, PDF forms, and Docusign offer
402
+ human-friendly UI. But these do not have a human-friendly text format for use by
403
+ agents as well as humans.
404
+
405
+ | Approach | Usable GUI editor | Human-readable source format | Agent-editable | APIs and validation rules |
406
+ | --- | :---: | :---: | :---: | :---: |
407
+ | Plain Markdown | ✅<br>IDEs/editors | ✅ | ⚠️<br>fragile | ❌ |
408
+ | JSON + JSON Schema | ✅<br>IDEs/editors | ⚠️<br>no free text | ✅ | ✅ |
409
+ | SaaS tools (Typeform, Docusign, PDF forms) | ✅ | ⚠️<br>rarely | ⚠️<br>sometimes | ⚠️<br>sometimes |
410
+ | HTML/web Forms | ✅<br>IDEs/editors | ⚠️<br>HTML+code | ⚠️<br>coding agent | ✅ |
411
+ | Excel/Google Sheets | ✅<br>app | ❌<br>.csv/.xlsx | ⚠️<br>with tools | ✅<br>with some coding |
412
+ | **Markform** | ✅<br>IDEs/editors | ✅ | ✅<br>with this package | ✅<br>with this package |
379
413
 
380
- - [`earnings-analysis.form.md`](https://github.com/jlevy/markform/blob/main/packages/markform/examples/earnings-analysis/earnings-analysis.form.md)
381
- \- Financial analysis form.
382
414
  ## Architecture
383
415
 
384
416
  This repo has a specification and an implementation.
@@ -453,10 +485,8 @@ flowchart LR
453
485
  ```bash
454
486
  # Copy all bundled examples to ./forms/
455
487
  markform examples
456
-
457
488
  # List available examples
458
489
  markform examples --list
459
-
460
490
  # Copy a specific example
461
491
  markform examples --name movie-research-demo
462
492
  ```
@@ -466,7 +496,6 @@ markform examples --name movie-research-demo
466
496
  ```bash
467
497
  # Browse forms in ./forms/ and run one interactively
468
498
  markform run
469
-
470
499
  # Run a specific form directly
471
500
  markform run forms/movie-research-demo.form.md
472
501
  ```
@@ -483,7 +512,6 @@ markform status my-form.form.md
483
512
  ```bash
484
513
  # View form structure, progress, and validation issues
485
514
  markform inspect my-form.form.md
486
-
487
515
  # Output as JSON
488
516
  markform inspect my-form.form.md --format=json
489
517
  ```
@@ -493,10 +521,8 @@ markform inspect my-form.form.md --format=json
493
521
  ```bash
494
522
  # Interactive mode: fill user-role fields via prompts
495
523
  markform fill my-form.form.md --interactive
496
-
497
524
  # Agent mode: use an LLM to fill agent-role fields
498
525
  markform fill my-form.form.md --model=anthropic/claude-sonnet-4-5
499
-
500
526
  # Mock agent for testing (uses pre-filled form as source)
501
527
  markform fill my-form.form.md --mock --mock-source filled.form.md
502
528
  ```
@@ -506,13 +532,10 @@ markform fill my-form.form.md --mock --mock-source filled.form.md
506
532
  ```bash
507
533
  # Export as readable markdown (strips Markdoc tags)
508
534
  markform export my-form.form.md --format=markdown
509
-
510
535
  # Export values as JSON
511
536
  markform export my-form.form.md --format=json
512
-
513
537
  # Export values as YAML
514
538
  markform export my-form.form.md --format=yaml
515
-
516
539
  # Dump just the current values
517
540
  markform dump my-form.form.md
518
541
  ```
@@ -522,10 +545,8 @@ markform dump my-form.form.md
522
545
  ```bash
523
546
  # Export form structure as JSON Schema (for validation, code generation, etc.)
524
547
  markform schema my-form.form.md
525
-
526
548
  # Pure JSON Schema without Markform extensions
527
549
  markform schema my-form.form.md --pure
528
-
529
550
  # Specify JSON Schema draft version
530
551
  markform schema my-form.form.md --draft draft-07
531
552
  ```
@@ -549,19 +570,14 @@ markform serve my-form.form.md
549
570
  ```bash
550
571
  # Quick reference for writing forms (agent-friendly)
551
572
  markform docs
552
-
553
573
  # Full specification
554
574
  markform spec
555
-
556
575
  # TypeScript and AI SDK API documentation
557
576
  markform apis
558
-
559
577
  # This README
560
578
  markform readme
561
-
562
579
  # See supported AI providers and example models
563
580
  markform models
564
-
565
581
  # See all commands
566
582
  markform --help
567
583
  ```
@@ -594,17 +610,17 @@ applications.
594
610
  ### Basic Parsing
595
611
 
596
612
  ```typescript
597
- import { parseForm, serializeForm } from "markform";
613
+ import { parseForm, serialize } from "markform";
598
614
 
599
615
  // Parse a .form.md file
600
616
  const form = parseForm(markdownContent);
601
617
 
602
618
  // Access schema and values
603
619
  console.log(form.schema.title);
604
- console.log(form.values);
620
+ console.log(form.responsesByFieldId);
605
621
 
606
622
  // Serialize back to markdown
607
- const output = serializeForm(form);
623
+ const output = serialize(form);
608
624
  ```
609
625
 
610
626
  ### AI SDK Integration
@@ -763,32 +779,6 @@ This enables powerful AI workflows that assemble information in a defined struct
763
779
  - An **agent execution harness** for step-by-step form filling, enabling deep research
764
780
  agents that assemble validated output in a structured format.
765
781
 
766
- ### Does anything like this already exist?
767
-
768
- Not that I have seen.
769
- The closest alternatives are:
770
-
771
- - Plain Markdown docs can be used as templates and filled in by agents.
772
- These are more expressive, but it is hard to edit them programmatically or use LLMs to
773
- update them reliably.
774
-
775
- - Agent to-do lists are part of many chat or coding interfaces and are programmatically
776
- edited by agents. But these are limited to simple checklists, not forms with other
777
- fields.
778
-
779
- - Numerous tools like Typeform, Google Forms, PDF forms, and Docusign offer
780
- human-friendly UI. But these do not have a human-friendly text format for use by
781
- agents as well as humans.
782
-
783
- | Approach | Usable GUI editor | Human-readable source format | Agent-editable | APIs and validation rules |
784
- | --- | :---: | :---: | :---: | :---: |
785
- | Plain Markdown | ✅ IDEs/editors | ✅ | ⚠️ fragile | ❌ |
786
- | JSON + JSON Schema | ✅ IDEs/editors | ⚠️ no free text | ✅ | ✅ |
787
- | SaaS tools (Typeform, Docusign, PDF forms) | ✅ | ⚠️ rarely | ⚠️ sometimes | ⚠️ sometimes |
788
- | HTML/web Forms | ✅ IDEs/editors | ⚠️ HTML+code | ⚠️ coding agent | ✅ |
789
- | Excel/Google Sheets | ✅ app | ❌ .csv/.xlsx | ⚠️ with tools | ✅ with some coding |
790
- | **Markform** | ✅ IDEs/editors | ✅ | ✅ with this package | ✅ with this package |
791
-
792
782
  ### What are example use cases?
793
783
 
794
784
  - Deep research tools where agents need to follow codified processes to assemble
package/dist/ai-sdk.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { At as PatchSchema, Dt as ParsedForm, Ot as Patch, Q as Id, V as FieldResponse, dr as ValidatorRegistry, q as FormSchema, r as ApplyResult, rt as InspectResult } from "./coreTypes-BSPJ9H27.mjs";
2
+ import { At as PatchSchema, Dt as ParsedForm, Ot as Patch, Q as Id, V as FieldResponse, dr as ValidatorRegistry, q as FormSchema, r as ApplyResult, rt as InspectResult } from "./coreTypes-JCPm418M.mjs";
3
3
  import { z } from "zod";
4
4
 
5
5
  //#region src/integrations/toolTypes.d.ts
package/dist/ai-sdk.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
- import { L as PatchSchema } from "./coreTypes-DJtu8OOp.mjs";
3
- import { d as serialize, i as inspect, t as applyPatches } from "./apply-BUU2QcJ2.mjs";
2
+ import { L as PatchSchema } from "./coreTypes-B1oI7qvV.mjs";
3
+ import { d as serialize, i as inspect, t as applyPatches } from "./apply-BTFCHpYV.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/integrations/vercelAiSdkTools.ts