@quillmark/wasm 0.83.0 → 0.85.0-rc.1

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/README.md CHANGED
@@ -244,6 +244,24 @@ canvas.style.height = `${result.layoutHeight}px`;
244
244
  enforcement contract and includes the resolved `backendId` for
245
245
  debugging.
246
246
 
247
+ ### Schema model
248
+
249
+ A field's *cell* is inferred from whether its schema declares a `default:`:
250
+
251
+ - **Must Fill** (no `default:`) — `quill.blueprint` renders `<must-fill>`
252
+ in the value cell, and `quill.render(doc)` throws with
253
+ `validation::must_fill_absent` when the field is absent at
254
+ validate time, or `validation::must_fill_sentinel` when the
255
+ `<must-fill>` sentinel survives into the document.
256
+ - **Endorsed** (with `default:`) — `quill.blueprint` renders the
257
+ default value followed by a `; delete-ok` annotation, and the default
258
+ is used when the document omits the field.
259
+
260
+ `QuillFieldSchema` no longer carries a `required` axis. The legacy
261
+ `validation::missing_required` code has been replaced by
262
+ `validation::must_fill_absent`; the `validation::must_fill_sentinel`
263
+ code covers unreplaced sentinels.
264
+
247
265
  ### Errors
248
266
 
249
267
  Every method that can fail throws a JS `Error` with `.diagnostics` attached:
package/bundler/wasm.d.ts CHANGED
@@ -106,13 +106,20 @@ export interface QuillCardBody {
106
106
  example?: string;
107
107
  }
108
108
 
109
- /** Schema entry for a single field declared in a quill's `Quill.yaml`. */
109
+ /** Schema entry for a single field declared in a quill's `Quill.yaml`.
110
+ *
111
+ * A field's *cell* is determined by `default`: a field with a `default`
112
+ * is **Endorsed** (the rendered value is shippable as-is), while a field
113
+ * without a `default` is **Must Fill** (the blueprint carries a
114
+ * `<must-fill>` sentinel and validation reports
115
+ * `validation::must_fill_absent` if the field is absent at validate
116
+ * time). There is no separate `required` axis.
117
+ */
110
118
  export interface QuillFieldSchema {
111
119
  type: "string" | "number" | "integer" | "boolean" | "array" | "object" | "date" | "datetime" | "markdown";
112
120
  description?: string;
113
121
  default?: unknown;
114
122
  example?: unknown;
115
- required?: boolean;
116
123
  enum?: string[];
117
124
  ui?: QuillFieldUi;
118
125
  properties?: Record<string, QuillFieldSchema>;
@@ -214,7 +221,7 @@ export interface Diagnostic {
214
221
  location?: Location;
215
222
  path?: string;
216
223
  hint?: string;
217
- sourceChain: string[];
224
+ sourceChain?: string[];
218
225
  }
219
226
 
220
227
  export interface Location {
@@ -250,6 +257,12 @@ export class Document {
250
257
  private constructor();
251
258
  free(): void;
252
259
  [Symbol.dispose](): void;
260
+ /**
261
+ * Authoring-ergonomics header introducing a blueprint to an LLM/MCP
262
+ * consumer for the given `quillName`. Surfaced verbatim by every binding
263
+ * so the wording stays uniform across CLI / Python / MCP.
264
+ */
265
+ static blueprintInstruction(quill_name: string): string;
253
266
  clone(): Document;
254
267
  /**
255
268
  * Schema version this build writes via [`toJson`](Document::to_json).
@@ -262,6 +275,19 @@ export class Document {
262
275
  * upstream prop updates instead of re-parsing on every keystroke.
263
276
  */
264
277
  equals(other: Document): boolean;
278
+ /**
279
+ * Render a Diagnostic as the canonical pretty-printed text every binding
280
+ * shows (CLI, Python, MCP). Single source of truth so a Diagnostic looks
281
+ * identical no matter which consumer surfaces it.
282
+ */
283
+ static formatDiagnostic(diag: Diagnostic): string;
284
+ /**
285
+ * Authoring-format rules for the card-yaml markdown surface — the same
286
+ * text every binding (CLI, Python, MCP) shows so callers reading errors
287
+ * from one binding can use the rules from any other. Read once at
288
+ * startup and cache; the value never changes between calls.
289
+ */
290
+ static formatRules(): string;
265
291
  /**
266
292
  * Reconstruct a `Document` from a versioned storage DTO string produced
267
293
  * by [`toJson`](Document::to_json). Unknown `schema` tags are rejected.
@@ -19,6 +19,31 @@ export class Document {
19
19
  const ptr = this.__destroy_into_raw();
20
20
  wasm.__wbg_document_free(ptr, 0);
21
21
  }
22
+ /**
23
+ * Authoring-ergonomics header introducing a blueprint to an LLM/MCP
24
+ * consumer for the given `quillName`. Surfaced verbatim by every binding
25
+ * so the wording stays uniform across CLI / Python / MCP.
26
+ * @param {string} quill_name
27
+ * @returns {string}
28
+ */
29
+ static blueprintInstruction(quill_name) {
30
+ let deferred2_0;
31
+ let deferred2_1;
32
+ try {
33
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
34
+ const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
35
+ const len0 = WASM_VECTOR_LEN;
36
+ wasm.document_blueprintInstruction(retptr, ptr0, len0);
37
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
38
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
39
+ deferred2_0 = r0;
40
+ deferred2_1 = r1;
41
+ return getStringFromWasm0(r0, r1);
42
+ } finally {
43
+ wasm.__wbindgen_add_to_stack_pointer(16);
44
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
45
+ }
46
+ }
22
47
  /**
23
48
  * Number of composable cards (excludes the main card). O(1).
24
49
  * @returns {number}
@@ -74,6 +99,52 @@ export class Document {
74
99
  const ret = wasm.document_equals(this.__wbg_ptr, other.__wbg_ptr);
75
100
  return ret !== 0;
76
101
  }
102
+ /**
103
+ * Render a Diagnostic as the canonical pretty-printed text every binding
104
+ * shows (CLI, Python, MCP). Single source of truth so a Diagnostic looks
105
+ * identical no matter which consumer surfaces it.
106
+ * @param {Diagnostic} diag
107
+ * @returns {string}
108
+ */
109
+ static formatDiagnostic(diag) {
110
+ let deferred1_0;
111
+ let deferred1_1;
112
+ try {
113
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
114
+ wasm.document_formatDiagnostic(retptr, addHeapObject(diag));
115
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
116
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
117
+ deferred1_0 = r0;
118
+ deferred1_1 = r1;
119
+ return getStringFromWasm0(r0, r1);
120
+ } finally {
121
+ wasm.__wbindgen_add_to_stack_pointer(16);
122
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
123
+ }
124
+ }
125
+ /**
126
+ * Authoring-format rules for the card-yaml markdown surface — the same
127
+ * text every binding (CLI, Python, MCP) shows so callers reading errors
128
+ * from one binding can use the rules from any other. Read once at
129
+ * startup and cache; the value never changes between calls.
130
+ * @returns {string}
131
+ */
132
+ static formatRules() {
133
+ let deferred1_0;
134
+ let deferred1_1;
135
+ try {
136
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
137
+ wasm.document_formatRules(retptr);
138
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
139
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
140
+ deferred1_0 = r0;
141
+ deferred1_1 = r1;
142
+ return getStringFromWasm0(r0, r1);
143
+ } finally {
144
+ wasm.__wbindgen_add_to_stack_pointer(16);
145
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
146
+ }
147
+ }
77
148
  /**
78
149
  * Reconstruct a `Document` from a versioned storage DTO string produced
79
150
  * by [`toJson`](Document::to_json). Unknown `schema` tags are rejected.
Binary file
@@ -5,11 +5,14 @@ export const __wbg_document_free: (a: number, b: number) => void;
5
5
  export const __wbg_quill_free: (a: number, b: number) => void;
6
6
  export const __wbg_quillmark_free: (a: number, b: number) => void;
7
7
  export const __wbg_rendersession_free: (a: number, b: number) => void;
8
+ export const document_blueprintInstruction: (a: number, b: number, c: number) => void;
8
9
  export const document_cardCount: (a: number) => number;
9
10
  export const document_cards: (a: number) => number;
10
11
  export const document_clone: (a: number) => number;
11
12
  export const document_currentSchemaVersion: (a: number) => void;
12
13
  export const document_equals: (a: number, b: number) => number;
14
+ export const document_formatDiagnostic: (a: number, b: number) => void;
15
+ export const document_formatRules: (a: number) => void;
13
16
  export const document_fromJson: (a: number, b: number, c: number) => void;
14
17
  export const document_fromMarkdown: (a: number, b: number, c: number) => void;
15
18
  export const document_insertCard: (a: number, b: number, c: number, d: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillmark/wasm",
3
- "version": "0.83.0",
3
+ "version": "0.85.0-rc.1",
4
4
  "description": "WebAssembly bindings for quillmark",
5
5
  "type": "module",
6
6
  "license": "MIT OR Apache-2.0",