markform 0.1.3 → 0.1.4

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 (35) hide show
  1. package/README.md +81 -28
  2. package/dist/ai-sdk.d.mts +2 -2
  3. package/dist/ai-sdk.mjs +5 -5
  4. package/dist/{apply-00UmzDKL.mjs → apply-C54EMAJ1.mjs} +371 -26
  5. package/dist/bin.mjs +6 -6
  6. package/dist/{cli-D--Lel-e.mjs → cli-BhWhn6L9.mjs} +383 -87
  7. package/dist/cli.mjs +6 -6
  8. package/dist/{coreTypes-BXhhz9Iq.d.mts → coreTypes-cbNTYAcb.d.mts} +1878 -325
  9. package/dist/{coreTypes-Dful87E0.mjs → coreTypes-pyctKRgc.mjs} +79 -5
  10. package/dist/index.d.mts +142 -5
  11. package/dist/index.mjs +5 -5
  12. package/dist/session-B_stoXQn.mjs +4 -0
  13. package/dist/{session-Bqnwi9wp.mjs → session-uF0e6m6k.mjs} +9 -5
  14. package/dist/{shared-N_s1M-_K.mjs → shared-BqPnYXrn.mjs} +82 -1
  15. package/dist/shared-CZsyShck.mjs +3 -0
  16. package/dist/{src-Dm8jZ5dl.mjs → src-BNh7Cx9P.mjs} +801 -121
  17. package/docs/markform-apis.md +194 -0
  18. package/{DOCS.md → docs/markform-reference.md} +111 -50
  19. package/{SPEC.md → docs/markform-spec.md} +342 -91
  20. package/examples/celebrity-deep-research/celebrity-deep-research.form.md +196 -141
  21. package/examples/earnings-analysis/earnings-analysis.form.md +236 -226
  22. package/examples/movie-research/movie-research-basic.form.md +25 -21
  23. package/examples/movie-research/movie-research-deep.form.md +74 -62
  24. package/examples/movie-research/movie-research-minimal.form.md +25 -11
  25. package/examples/simple/simple-mock-filled.form.md +93 -29
  26. package/examples/simple/simple-skipped-filled.form.md +91 -29
  27. package/examples/simple/simple-with-skips.session.yaml +93 -25
  28. package/examples/simple/simple.form.md +74 -20
  29. package/examples/simple/simple.session.yaml +98 -25
  30. package/examples/startup-deep-research/startup-deep-research.form.md +108 -81
  31. package/examples/startup-research/startup-research-mock-filled.form.md +43 -43
  32. package/examples/startup-research/startup-research.form.md +24 -24
  33. package/package.json +18 -19
  34. package/dist/session-DdAtY2Ni.mjs +0 -4
  35. package/dist/shared-D7gf27Tr.mjs +0 -3
package/README.md CHANGED
@@ -63,39 +63,53 @@ markform:
63
63
  ---
64
64
  {% form id="movie_research_minimal" title="Movie Research (Minimal)" %}
65
65
 
66
- <!-- The first field group is filled in by the user (role="user"): -->
66
+ ## Movie Research Example
67
67
 
68
68
  {% field-group id="movie_input" title="Movie Identification" %}
69
69
 
70
- {% string-field id="movie" label="Movie" role="user" required=true minLength=1 maxLength=300 %}{% /string-field %}
70
+ What movie do you want to research? \[*This field is filled in by the user (`role="user"`).*\]
71
+
72
+ {% field kind="string" id="movie" label="Movie" role="user" required=true minLength=1 maxLength=300 %}{% /field %}
71
73
  {% instructions ref="movie" %}Enter the movie title (add year or details for disambiguation).{% /instructions %}
72
74
 
73
75
  {% /field-group %}
74
76
 
75
- <!-- Everything else is filled in by the agent (role="agent"): -->
77
+ ## About the Movie
76
78
 
77
79
  {% field-group id="about_the_movie" title="About the Movie" %}
78
80
 
79
- {% string-field id="full_title" label="Full Title" role="agent" required=true %}{% /string-field %}
80
- {% instructions ref="full_title" %}Official title including subtitle if any.{% /instructions %}
81
+ **Title:**
82
+
83
+ {% field kind="string" id="full_title" label="Full Title" role="agent" required=true %}{% /field %}
84
+ {% instructions ref="full_title" %}Official title, including subtitle if any.{% /instructions %}
85
+
86
+ **Release year:**
81
87
 
82
- {% number-field id="year" label="Release Year" role="agent" required=true min=1888 max=2030 %}{% /number-field %}
88
+ {% field kind="number" id="year" label="Release Year" role="agent" required=true min=1888 max=2030 %}{% /field %}
83
89
 
84
- {% url-field id="imdb_url" label="IMDB URL" role="agent" required=true %}{% /url-field %}
90
+ **IMDB:**
85
91
 
86
- {% single-select id="mpaa_rating" label="MPAA Rating" role="agent" %}
92
+ {% field kind="url" id="imdb_url" label="IMDB URL" role="agent" required=true %}{% /field %}
93
+
94
+ **MPAA rating:**
95
+
96
+ {% field kind="single_select" id="mpaa_rating" label="MPAA Rating" role="agent" %}
87
97
  - [ ] G {% #g %}
88
98
  - [ ] PG {% #pg %}
89
99
  - [ ] PG-13 {% #pg_13 %}
90
100
  - [ ] R {% #r %}
91
101
  - [ ] NC-17 {% #nc_17 %}
92
102
  - [ ] NR/Unrated {% #nr %}
93
- {% /single-select %}
103
+ {% /field %}
104
+
105
+ **IMDB rating:**
94
106
 
95
- {% number-field id="imdb_rating" label="IMDB Rating" role="agent" min=1.0 max=10.0 %}{% /number-field %}
107
+ {% field kind="number" id="imdb_rating" label="IMDB Rating" role="agent" min=1.0 max=10.0 %}{% /field %}
96
108
  {% instructions ref="imdb_rating" %}IMDB user rating (1.0-10.0 scale).{% /instructions %}
97
109
 
98
- {% string-field id="logline" label="One-Line Summary" role="agent" maxLength=300 %}{% /string-field %}
110
+ **Summary:**
111
+
112
+ {% field kind="string" id="logline" label="One-Line Summary" role="agent" maxLength=300 %}{% /field %}
99
113
  {% instructions ref="logline" %}Brief plot summary in 1-2 sentences, no spoilers.{% /instructions %}
100
114
 
101
115
  {% /field-group %}
@@ -103,18 +117,48 @@ markform:
103
117
  {% /form %}
104
118
  ```
105
119
 
106
- This is the minimal movie research form.
120
+ Run the `npx markform examples` and select the `Movie Research (Minimal)` example and
121
+ view the report:
122
+
123
+ ```markdown
124
+ # Movie Research (Minimal)
125
+
126
+ ## Movie Identification
127
+
128
+ Movie:
129
+ shawshank redemption
130
+
131
+ ## About the Movie
132
+
133
+ Full Title:
134
+ The Shawshank Redemption
135
+
136
+ Release Year:
137
+ 1994
138
+
139
+ IMDB URL:
140
+ https://www.imdb.com/title/tt0111161/
141
+
142
+ MPAA Rating:
143
+ R
144
+
145
+ IMDB Rating:
146
+ 9.3
147
+
148
+ One-Line Summary:
149
+ Convicted banker Andy Dufresne is sent to Shawshank State Penitentiary, where he forms an unexpected friendship with inmate Red while holding onto hope and striving to maintain his dignity in a corrupt prison system.
150
+ ```
151
+
107
152
  See the
108
153
  [examples/](https://github.com/jlevy/markform/tree/main/packages/markform/examples)
109
- directory for forms with more fields, including multiple rating sources (IMDB, Rotten
110
- Tomatoes, Metacritic) and comprehensive analysis.
154
+ directory for a few more complex form examples.
111
155
 
112
156
  **Key concepts:**
113
157
 
114
158
  - **Roles**: Define who fills what (`user` for humans, `agent` for AI)
115
159
 
116
- - **Field types**: `string-field`, `number-field`, `url-field`, `string-list`,
117
- `single-select`, `multi-select`, `checkboxes`
160
+ - **Field kinds**: `string-field`, `number-field`, `date-field`, `year-field`,
161
+ `url-field`, `url-list`, `string-list`, `single-select`, `multi-select`, `checkboxes`
118
162
 
119
163
  - **Validation**: `required`, `min/max`, `minLength/maxLength`, `pattern`
120
164
 
@@ -137,7 +181,7 @@ The package includes example forms in
137
181
  \- Comprehensive analysis with streaming, box office
138
182
 
139
183
  - [`simple/simple.form.md`](https://github.com/jlevy/markform/blob/main/packages/markform/examples/simple/simple.form.md)
140
- \- Basic form demonstrating all field types
184
+ \- Basic form demonstrating all field kinds
141
185
 
142
186
  - [`earnings-analysis/earnings-analysis.form.md`](https://github.com/jlevy/markform/blob/main/packages/markform/examples/earnings-analysis/earnings-analysis.form.md)
143
187
  \- Financial analysis form
@@ -250,9 +294,12 @@ markform serve my-form.form.md
250
294
  # Quick reference for writing forms (agent-friendly)
251
295
  markform docs
252
296
 
253
- # Full specification (SPEC.md)
297
+ # Full specification
254
298
  markform spec
255
299
 
300
+ # TypeScript and AI SDK API documentation
301
+ markform apis
302
+
256
303
  # This README
257
304
  markform readme
258
305
 
@@ -391,7 +438,8 @@ But it’s been useful for me already.
391
438
 
392
439
  It’s all written by LLMs but using a strongly spec-driven process, using rules from
393
440
  [Speculate](https://github.com/jlevy/speculate).
394
- See [the spec](SPEC.md) and the architecture docs and specs in [docs/](docs/).
441
+ See [the spec](docs/markform-spec.md) and the architecture docs and specs in
442
+ [docs/](docs/).
395
443
 
396
444
  ### What are the goals of Markform?
397
445
 
@@ -446,12 +494,13 @@ Not really. The closest alternatives are:
446
494
  human-friendly UI. But these do not have a human-friendly text format for use by
447
495
  agents as well as humans.
448
496
 
449
- | Approach | Human-readable | Agent-editable | Custom validations |
450
- | --- | :---: | :---: | :---: |
451
- | Plain Markdown | ✅ | ⚠️ fragile | ❌ |
452
- | JSON Schema | | ✅ | ✅ |
453
- | PDF Forms, SaaS tools | ⚠️ | | ⚠️ |
454
- | **Markform** | ✅ | | ✅ |
497
+ | Approach | Has GUI | Human-readable text format | Agent-editable | APIs and validation rules |
498
+ | --- | :---: | :---: | :---: | :---: |
499
+ | Plain Markdown | ☑️ existing tools | ✅ | ⚠️ fragile | ❌ |
500
+ | JSON with schema | ☑️ existing tools | ⚠️ hey it’s JSON | ✅ | ✅ |
501
+ | SaaS tools (Typeform, Docusign, PDF forms) | ✅ | ⚠️ rarely | ⚠️ if they add it | ⚠️ if they add it |
502
+ | Excel/Google Sheets | ✅ | .xlsx | ⚠️ with tools | ✅ |
503
+ | **Markform** | ☑️ existing tools | ✅ | ✅ | ✅ |
455
504
 
456
505
  ### What are example use cases?
457
506
 
@@ -496,11 +545,15 @@ Or see [markdoc/language-server](https://github.com/markdoc/language-server).
496
545
  ## Documentation
497
546
 
498
547
  - **[Quick
499
- Reference](https://github.com/jlevy/markform/blob/main/packages/markform/DOCS.md)**
548
+ Reference](https://github.com/jlevy/markform/blob/main/docs/markform-reference.md)**
500
549
  (or run `markform docs`) - Concise syntax reference (agent-friendly)
501
550
 
502
- - **[Markform Spec](https://github.com/jlevy/markform/blob/main/SPEC.md)** (or run
503
- `markform spec`) - Complete syntax and semantics
551
+ - **[Markform Spec](https://github.com/jlevy/markform/blob/main/docs/markform-spec.md)**
552
+ (or run `markform spec`) - Complete syntax and semantics
553
+
554
+ - **[API
555
+ Documentation](https://github.com/jlevy/markform/blob/main/docs/markform-apis.md)**
556
+ (or run `markform apis`) - TypeScript and AI SDK APIs
504
557
 
505
558
  - **[Design
506
559
  Doc](https://github.com/jlevy/markform/blob/main/docs/project/architecture/current/arch-markform-design.md)**
package/dist/ai-sdk.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { H as Id, L as FormSchema, Sn as ValidatorRegistry, _t as ParsedForm, j as FieldResponse, q as InspectResult, r as ApplyResult, vt as Patch, yt as PatchSchema } from "./coreTypes-BXhhz9Iq.mjs";
3
+ import { Dt as PatchSchema, Et as Patch, G as FormSchema, Tt as ParsedForm, X as Id, ar as ValidatorRegistry, r as ApplyResult, tt as InspectResult, z as FieldResponse } from "./coreTypes-cbNTYAcb.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/integrations/toolTypes.d.ts
@@ -62,7 +62,7 @@ interface MarkformToolSet {
62
62
  markform_get_markdown?: MarkformTool<Record<string, never>, GetMarkdownToolResult>;
63
63
  }
64
64
  //#endregion
65
- //#region src/integrations/ai-sdk.d.ts
65
+ //#region src/integrations/vercelAiSdkTools.d.ts
66
66
  /**
67
67
  * Session store for managing form state during AI interactions.
68
68
  *
package/dist/ai-sdk.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { N as PatchSchema } from "./coreTypes-Dful87E0.mjs";
2
- import { r as inspect, t as applyPatches, u as serialize } from "./apply-00UmzDKL.mjs";
1
+ import { L as PatchSchema } from "./coreTypes-pyctKRgc.mjs";
2
+ import { r as inspect, t as applyPatches, u as serialize } from "./apply-C54EMAJ1.mjs";
3
3
  import { z } from "zod";
4
4
 
5
- //#region src/integrations/ai-sdk.ts
5
+ //#region src/integrations/vercelAiSdkTools.ts
6
6
  /**
7
7
  * AI SDK Integration for Markform.
8
8
  *
@@ -63,7 +63,7 @@ const InspectInputSchema = z.object({}).describe("No input parameters required.
63
63
  /**
64
64
  * Input schema for markform_apply tool.
65
65
  */
66
- const ApplyInputSchema = z.object({ patches: z.array(PatchSchema).min(1).max(20).describe("Array of patches to apply to the form. Each patch sets or clears a field value. Operations: set_string, set_number, set_string_list, set_single_select, set_multi_select, set_checkboxes, clear_field. Example: [{ \"op\": \"set_string\", \"fieldId\": \"name\", \"value\": \"Alice\" }]") }).describe("Apply patches to update form field values.");
66
+ const ApplyInputSchema = z.object({ patches: z.array(PatchSchema).min(1).max(20).describe("Array of patches to apply to the form. Each patch sets or clears a field value. Operations: set_string, set_number, set_string_list, set_single_select, set_multi_select, set_checkboxes, set_url, set_url_list, set_date, set_year, set_table, clear_field, skip_field, abort_field. Example: [{ \"op\": \"set_string\", \"fieldId\": \"name\", \"value\": \"Alice\" }]") }).describe("Apply patches to update form field values.");
67
67
  /**
68
68
  * Input schema for markform_export tool (no parameters).
69
69
  */
@@ -115,7 +115,7 @@ function createMarkformTools(options) {
115
115
  }
116
116
  },
117
117
  markform_apply: {
118
- description: "Apply patches to update form field values. Use this after inspecting the form to set values for fields that need to be filled. Patches are applied as a transaction - all succeed or all fail. Returns the updated form state and any remaining issues. Patch operations: set_string, set_number, set_string_list, set_single_select, set_multi_select, set_checkboxes, clear_field.",
118
+ description: "Apply patches to update form field values. Use this after inspecting the form to set values for fields that need to be filled. Patches are applied as a transaction - all succeed or all fail. Returns the updated form state and any remaining issues. Patch operations: set_string, set_number, set_string_list, set_single_select, set_multi_select, set_checkboxes, set_url, set_url_list, set_date, set_year, set_table, clear_field, skip_field, abort_field.",
119
119
  inputSchema: ApplyInputSchema,
120
120
  execute: ({ patches }) => {
121
121
  const form = sessionStore.getForm();