@book.dev/sdk 3.7.0 → 3.9.0
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/dist/ai.d.ts +12 -2
- package/dist/ai.js.map +1 -1
- package/dist/blockCatalogue.d.ts +560 -0
- package/dist/blockCatalogue.js +336 -0
- package/dist/blockCatalogue.js.map +1 -0
- package/dist/bookFolder.d.ts +9 -1
- package/dist/bookFolder.js +64 -2
- package/dist/bookFolder.js.map +1 -1
- package/dist/client.d.ts +22 -2
- package/dist/client.js +6 -2
- package/dist/client.js.map +1 -1
- package/dist/content.d.ts +40 -1
- package/dist/content.js +29 -7
- package/dist/content.js.map +1 -1
- package/dist/forwarding/forwardingClient.d.ts +68 -2
- package/dist/forwarding/forwardingClient.js +126 -12
- package/dist/forwarding/forwardingClient.js.map +1 -1
- package/dist/forwarding/index.d.ts +2 -1
- package/dist/forwarding/index.js +2 -1
- package/dist/forwarding/index.js.map +1 -1
- package/dist/forwarding/namespacedKeyStore.d.ts +52 -0
- package/dist/forwarding/namespacedKeyStore.js +99 -0
- package/dist/forwarding/namespacedKeyStore.js.map +1 -0
- package/dist/index.d.ts +10 -5
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/ledger.d.ts +29 -0
- package/dist/ledger.js +43 -0
- package/dist/ledger.js.map +1 -1
- package/dist/ledgerExportSection.d.ts +160 -0
- package/dist/ledgerExportSection.js +594 -0
- package/dist/ledgerExportSection.js.map +1 -0
- package/dist/orderKeys.d.ts +36 -0
- package/dist/orderKeys.js +88 -0
- package/dist/orderKeys.js.map +1 -0
- package/dist/plugins.d.ts +76 -4
- package/dist/plugins.js +95 -12
- package/dist/plugins.js.map +1 -1
- package/dist/provenance.d.ts +13 -0
- package/dist/registryClient.d.ts +227 -0
- package/dist/registryClient.js +397 -0
- package/dist/registryClient.js.map +1 -0
- package/dist/routes.d.ts +9 -0
- package/dist/routes.js +9 -0
- package/dist/routes.js.map +1 -1
- package/dist/suggestions.d.ts +12 -2
- package/dist/tableSnapshot.d.ts +233 -0
- package/dist/tableSnapshot.js +680 -0
- package/dist/tableSnapshot.js.map +1 -0
- package/dist/templates.d.ts +8 -0
- package/dist/templates.js +7 -2
- package/dist/templates.js.map +1 -1
- package/package.json +1 -1
package/dist/ai.d.ts
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* only provider that sends content off the machine.
|
|
20
20
|
*/
|
|
21
21
|
import type { StoredSuggestion } from './suggestions';
|
|
22
|
+
import type { TableOpKind } from './tableSnapshot';
|
|
22
23
|
export type AiProvider = 'off' | 'mock' | 'llama' | 'mlx' | 'openai' | 'claude';
|
|
23
24
|
/**
|
|
24
25
|
* How hard the agent works on a turn. One knob maps (server-side, in one
|
|
@@ -231,8 +232,17 @@ export interface AgentChatMessage {
|
|
|
231
232
|
export interface AgentProposal {
|
|
232
233
|
/** Stable id within the turn's change set. */
|
|
233
234
|
id: string;
|
|
234
|
-
/**
|
|
235
|
-
|
|
235
|
+
/**
|
|
236
|
+
* Which write tool produced it (drives how the bridge applies it). The
|
|
237
|
+
* `table_*` kinds (API-3) are the TABLE STRUCTURE ops — the bridge replays each
|
|
238
|
+
* by calling the editor's own `model.ts` op inside the proposal's single CRDT
|
|
239
|
+
* transaction, so an accepted table suggestion is one undo step and behaves
|
|
240
|
+
* exactly like the context-menu item. Their payloads carry SORTED (render-order)
|
|
241
|
+
* coordinates — `{tableId, rowIndex}` / `{tableId, colIndex}` / `{tableId,
|
|
242
|
+
* rowIndex, toIndex}` / `{tableId, rowIndex, colIndex, text}` — or a `cellId`
|
|
243
|
+
* (which resolves both indices), matching `cellPosition`.
|
|
244
|
+
*/
|
|
245
|
+
kind: 'set_kit_value' | 'set_db_cell' | 'update_block' | 'append_blocks' | 'set_page_theme' | 'delete_block' | 'set_block_props' | TableOpKind;
|
|
236
246
|
/** One-line human summary, e.g. `Set "budget" = 1200`. */
|
|
237
247
|
summary: string;
|
|
238
248
|
/** The page this change targets (for block/kit writes). */
|
package/dist/ai.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAmEH;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAgB,EAAE,QAAoB;IACrE,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IACxB,IAAI,QAAQ,KAAK,MAAM,CAAC,QAAQ,EAAE,CAAC;QACjC,OAAO,EAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAC,CAAC;IACzI,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,QAAoB;IACjD,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,QAAQ,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The block-type catalogue — the ONE types-only description of every block the
|
|
3
|
+
* editor can render, shared by every layer that must reason about block types
|
|
4
|
+
* without importing React:
|
|
5
|
+
*
|
|
6
|
+
* - the UI's block model derives `BlockType`, `TEXT_BLOCKS` and
|
|
7
|
+
* `CONTAINER_BLOCKS` FROM this file (packages/ui/src/blockeditor/model.ts),
|
|
8
|
+
* so the core union cannot drift from the catalogue by construction;
|
|
9
|
+
* - the UI's runtime registry (registry.tsx + kit) is pinned to the `kit`
|
|
10
|
+
* entries by a drift-guard test (packages/ui/src/blockeditor/
|
|
11
|
+
* registryCatalogue.test.tsx) that registers every built-in custom block and
|
|
12
|
+
* fails when the registry and the catalogue disagree in either direction;
|
|
13
|
+
* - the server agent and the MCP server validate `add_blocks` /
|
|
14
|
+
* `create_artifact_page` / `update_block_props` payloads against it and
|
|
15
|
+
* serve it via their `list_block_types` tools.
|
|
16
|
+
*
|
|
17
|
+
* History: before this file the agent kept a hand-written `KNOWN_BLOCK_TYPES`
|
|
18
|
+
* and the MCP server a hand-written `ARTIFACT_TYPES`; the two disagreed with
|
|
19
|
+
* each other AND with the real registry (table/row/cell, image, notes, and
|
|
20
|
+
* several kit blocks were missing from one or both). Those lists are gone —
|
|
21
|
+
* everything reads this catalogue.
|
|
22
|
+
*
|
|
23
|
+
* Plugin blocks are NOT enumerated here (they are installed per library, not
|
|
24
|
+
* compiled in). They are namespaced `<pluginId>/<type>` (plugins/api.ts), a
|
|
25
|
+
* plugin declares its block types in its manifest (`PluginManifest.blocks`),
|
|
26
|
+
* and validators accept them by pattern + an installed-plugin lookup where one
|
|
27
|
+
* is available — see {@link isPluginBlockType} and {@link findUnknownBlockType}.
|
|
28
|
+
*/
|
|
29
|
+
/** How a block stores content: `container` blocks carry child blocks in
|
|
30
|
+
* `children`, `text` blocks carry rich text in `text`, `void` blocks carry
|
|
31
|
+
* only `props` (all kit widgets are void). */
|
|
32
|
+
export type BlockNature = 'container' | 'text' | 'void';
|
|
33
|
+
/** The value shapes per-type prop validation understands. Deliberately coarse
|
|
34
|
+
* — a permissive-but-typed check, not a schema language. */
|
|
35
|
+
export type BlockPropType = 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
36
|
+
export interface BlockTypeInfo {
|
|
37
|
+
/** The block `type` discriminator as stored in the document. */
|
|
38
|
+
readonly type: string;
|
|
39
|
+
/** `core` renders natively in the editor; `kit` is registered through the
|
|
40
|
+
* custom-block registry at startup (artifact kit, reactive blocks, dbview).
|
|
41
|
+
* Installed plugins contribute a third, per-library `plugin` category — see
|
|
42
|
+
* the module note. */
|
|
43
|
+
readonly category: 'core' | 'kit';
|
|
44
|
+
readonly nature: BlockNature;
|
|
45
|
+
/** For child-only types: the ONE container this type must sit directly
|
|
46
|
+
* inside (column→columns, row→table, cell→row, tab→tabs,
|
|
47
|
+
* accordionsection→accordion). */
|
|
48
|
+
readonly parent?: string;
|
|
49
|
+
/** Well-known props → expected value type. Validation is permissive: props
|
|
50
|
+
* NOT declared here always pass (the editor ignores what it doesn't know);
|
|
51
|
+
* declared ones must match, `null` always passes (it removes the key). */
|
|
52
|
+
readonly props?: Readonly<Record<string, BlockPropType>>;
|
|
53
|
+
/** Publishes a named value into the page's reactive kit scope (mirrors
|
|
54
|
+
* `INPUT_TYPES` in packages/ui/src/blockeditor/kit/scope.ts). */
|
|
55
|
+
readonly kitValue?: boolean;
|
|
56
|
+
/** One-line usage hint surfaced in tool descriptions / list_block_types. */
|
|
57
|
+
readonly hint?: string;
|
|
58
|
+
}
|
|
59
|
+
declare const CATALOGUE_LITERAL: readonly [{
|
|
60
|
+
readonly type: "paragraph";
|
|
61
|
+
readonly category: "core";
|
|
62
|
+
readonly nature: "text";
|
|
63
|
+
readonly hint: "plain rich text";
|
|
64
|
+
}, {
|
|
65
|
+
readonly type: "heading";
|
|
66
|
+
readonly category: "core";
|
|
67
|
+
readonly nature: "text";
|
|
68
|
+
readonly props: {
|
|
69
|
+
readonly level: "number";
|
|
70
|
+
};
|
|
71
|
+
readonly hint: "{level:1|2|3}";
|
|
72
|
+
}, {
|
|
73
|
+
readonly type: "list";
|
|
74
|
+
readonly category: "core";
|
|
75
|
+
readonly nature: "text";
|
|
76
|
+
readonly props: {
|
|
77
|
+
readonly kind: "string";
|
|
78
|
+
};
|
|
79
|
+
readonly hint: "{kind:\"bullet\"|\"number\"} — one block per item";
|
|
80
|
+
}, {
|
|
81
|
+
readonly type: "todo";
|
|
82
|
+
readonly category: "core";
|
|
83
|
+
readonly nature: "text";
|
|
84
|
+
readonly props: {
|
|
85
|
+
readonly checked: "boolean";
|
|
86
|
+
};
|
|
87
|
+
readonly hint: "{checked?}";
|
|
88
|
+
}, {
|
|
89
|
+
readonly type: "quote";
|
|
90
|
+
readonly category: "core";
|
|
91
|
+
readonly nature: "text";
|
|
92
|
+
}, {
|
|
93
|
+
readonly type: "callout";
|
|
94
|
+
readonly category: "core";
|
|
95
|
+
readonly nature: "text";
|
|
96
|
+
readonly props: {
|
|
97
|
+
readonly variant: "string";
|
|
98
|
+
};
|
|
99
|
+
readonly hint: "{variant:\"info\"|\"warn\"|\"success\"}";
|
|
100
|
+
}, {
|
|
101
|
+
readonly type: "code";
|
|
102
|
+
readonly category: "core";
|
|
103
|
+
readonly nature: "text";
|
|
104
|
+
readonly props: {
|
|
105
|
+
readonly language: "string";
|
|
106
|
+
readonly live: "boolean";
|
|
107
|
+
readonly name: "string";
|
|
108
|
+
readonly collapsed: "boolean";
|
|
109
|
+
};
|
|
110
|
+
readonly hint: "{language?,live?,name?,collapsed?}";
|
|
111
|
+
}, {
|
|
112
|
+
readonly type: "notes";
|
|
113
|
+
readonly category: "core";
|
|
114
|
+
readonly nature: "text";
|
|
115
|
+
readonly hint: "speaker note — presenter view only, never exported";
|
|
116
|
+
}, {
|
|
117
|
+
readonly type: "divider";
|
|
118
|
+
readonly category: "core";
|
|
119
|
+
readonly nature: "void";
|
|
120
|
+
}, {
|
|
121
|
+
readonly type: "image";
|
|
122
|
+
readonly category: "core";
|
|
123
|
+
readonly nature: "void";
|
|
124
|
+
readonly props: {
|
|
125
|
+
readonly assetId: "string";
|
|
126
|
+
readonly src: "string";
|
|
127
|
+
readonly alt: "string";
|
|
128
|
+
readonly width: "string";
|
|
129
|
+
};
|
|
130
|
+
readonly hint: "{assetId|src,alt?,width?:\"60%\"}";
|
|
131
|
+
}, {
|
|
132
|
+
readonly type: "htmlArtifact";
|
|
133
|
+
readonly category: "core";
|
|
134
|
+
readonly nature: "void";
|
|
135
|
+
readonly props: {
|
|
136
|
+
readonly assetId: "string";
|
|
137
|
+
readonly name: "string";
|
|
138
|
+
readonly height: "number";
|
|
139
|
+
};
|
|
140
|
+
readonly hint: "sandboxed HTML document {assetId,name?,height?}";
|
|
141
|
+
}, {
|
|
142
|
+
readonly type: "columns";
|
|
143
|
+
readonly category: "core";
|
|
144
|
+
readonly nature: "container";
|
|
145
|
+
readonly hint: "side-by-side layout → column children (spans sum to 12)";
|
|
146
|
+
}, {
|
|
147
|
+
readonly type: "column";
|
|
148
|
+
readonly category: "core";
|
|
149
|
+
readonly nature: "container";
|
|
150
|
+
readonly parent: "columns";
|
|
151
|
+
readonly props: {
|
|
152
|
+
readonly span: "number";
|
|
153
|
+
};
|
|
154
|
+
readonly hint: "{span:1-12}";
|
|
155
|
+
}, {
|
|
156
|
+
readonly type: "table";
|
|
157
|
+
readonly category: "core";
|
|
158
|
+
readonly nature: "container";
|
|
159
|
+
readonly hint: "table → row → cell; give every row the same number of cells";
|
|
160
|
+
}, {
|
|
161
|
+
readonly type: "row";
|
|
162
|
+
readonly category: "core";
|
|
163
|
+
readonly nature: "container";
|
|
164
|
+
readonly parent: "table";
|
|
165
|
+
readonly props: {
|
|
166
|
+
readonly header: "boolean";
|
|
167
|
+
};
|
|
168
|
+
readonly hint: "{header?} for the header row";
|
|
169
|
+
}, {
|
|
170
|
+
readonly type: "cell";
|
|
171
|
+
readonly category: "core";
|
|
172
|
+
readonly nature: "text";
|
|
173
|
+
readonly parent: "row";
|
|
174
|
+
readonly hint: "one table cell (rich text)";
|
|
175
|
+
}, {
|
|
176
|
+
readonly type: "group";
|
|
177
|
+
readonly category: "core";
|
|
178
|
+
readonly nature: "container";
|
|
179
|
+
readonly props: {
|
|
180
|
+
readonly name: "string";
|
|
181
|
+
readonly locked: "boolean";
|
|
182
|
+
};
|
|
183
|
+
readonly hint: "{name?,locked?}";
|
|
184
|
+
}, {
|
|
185
|
+
readonly type: "tabs";
|
|
186
|
+
readonly category: "core";
|
|
187
|
+
readonly nature: "container";
|
|
188
|
+
readonly hint: "tabs → tab children";
|
|
189
|
+
}, {
|
|
190
|
+
readonly type: "tab";
|
|
191
|
+
readonly category: "core";
|
|
192
|
+
readonly nature: "container";
|
|
193
|
+
readonly parent: "tabs";
|
|
194
|
+
readonly props: {
|
|
195
|
+
readonly label: "string";
|
|
196
|
+
};
|
|
197
|
+
readonly hint: "{label}";
|
|
198
|
+
}, {
|
|
199
|
+
readonly type: "accordion";
|
|
200
|
+
readonly category: "core";
|
|
201
|
+
readonly nature: "container";
|
|
202
|
+
readonly props: {
|
|
203
|
+
readonly name: "string";
|
|
204
|
+
readonly gated: "boolean";
|
|
205
|
+
};
|
|
206
|
+
readonly hint: "{name?,gated?} → accordionsection children";
|
|
207
|
+
}, {
|
|
208
|
+
readonly type: "accordionsection";
|
|
209
|
+
readonly category: "core";
|
|
210
|
+
readonly nature: "container";
|
|
211
|
+
readonly parent: "accordion";
|
|
212
|
+
readonly props: {
|
|
213
|
+
readonly label: "string";
|
|
214
|
+
readonly collapsed: "boolean";
|
|
215
|
+
};
|
|
216
|
+
readonly hint: "{label,collapsed?}";
|
|
217
|
+
}, {
|
|
218
|
+
readonly type: "slider";
|
|
219
|
+
readonly category: "kit";
|
|
220
|
+
readonly nature: "void";
|
|
221
|
+
readonly kitValue: true;
|
|
222
|
+
readonly props: {
|
|
223
|
+
readonly name: "string";
|
|
224
|
+
readonly label: "string";
|
|
225
|
+
readonly value: "number";
|
|
226
|
+
readonly min: "number";
|
|
227
|
+
readonly max: "number";
|
|
228
|
+
readonly step: "number";
|
|
229
|
+
};
|
|
230
|
+
readonly hint: "{name,label?,value,min,max,step?}";
|
|
231
|
+
}, {
|
|
232
|
+
readonly type: "number";
|
|
233
|
+
readonly category: "kit";
|
|
234
|
+
readonly nature: "void";
|
|
235
|
+
readonly kitValue: true;
|
|
236
|
+
readonly props: {
|
|
237
|
+
readonly name: "string";
|
|
238
|
+
readonly label: "string";
|
|
239
|
+
readonly value: "number";
|
|
240
|
+
readonly min: "number";
|
|
241
|
+
readonly max: "number";
|
|
242
|
+
readonly step: "number";
|
|
243
|
+
};
|
|
244
|
+
readonly hint: "{name,label?,value,min?,max?,step?}";
|
|
245
|
+
}, {
|
|
246
|
+
readonly type: "textfield";
|
|
247
|
+
readonly category: "kit";
|
|
248
|
+
readonly nature: "void";
|
|
249
|
+
readonly kitValue: true;
|
|
250
|
+
readonly props: {
|
|
251
|
+
readonly name: "string";
|
|
252
|
+
readonly label: "string";
|
|
253
|
+
readonly value: "string";
|
|
254
|
+
readonly placeholder: "string";
|
|
255
|
+
};
|
|
256
|
+
readonly hint: "{name,label?,value?,placeholder?}";
|
|
257
|
+
}, {
|
|
258
|
+
readonly type: "longtext";
|
|
259
|
+
readonly category: "kit";
|
|
260
|
+
readonly nature: "void";
|
|
261
|
+
readonly kitValue: true;
|
|
262
|
+
readonly props: {
|
|
263
|
+
readonly name: "string";
|
|
264
|
+
readonly label: "string";
|
|
265
|
+
readonly value: "string";
|
|
266
|
+
readonly placeholder: "string";
|
|
267
|
+
};
|
|
268
|
+
readonly hint: "{name,label?,value?,placeholder?}";
|
|
269
|
+
}, {
|
|
270
|
+
readonly type: "richtext";
|
|
271
|
+
readonly category: "kit";
|
|
272
|
+
readonly nature: "void";
|
|
273
|
+
readonly kitValue: true;
|
|
274
|
+
readonly props: {
|
|
275
|
+
readonly name: "string";
|
|
276
|
+
readonly label: "string";
|
|
277
|
+
readonly runs: "array";
|
|
278
|
+
};
|
|
279
|
+
readonly hint: "{name,label?} — formatted long text";
|
|
280
|
+
}, {
|
|
281
|
+
readonly type: "toggle";
|
|
282
|
+
readonly category: "kit";
|
|
283
|
+
readonly nature: "void";
|
|
284
|
+
readonly kitValue: true;
|
|
285
|
+
readonly props: {
|
|
286
|
+
readonly name: "string";
|
|
287
|
+
readonly label: "string";
|
|
288
|
+
readonly value: "boolean";
|
|
289
|
+
};
|
|
290
|
+
readonly hint: "{name,label?,value:boolean}";
|
|
291
|
+
}, {
|
|
292
|
+
readonly type: "radio";
|
|
293
|
+
readonly category: "kit";
|
|
294
|
+
readonly nature: "void";
|
|
295
|
+
readonly kitValue: true;
|
|
296
|
+
readonly props: {
|
|
297
|
+
readonly name: "string";
|
|
298
|
+
readonly label: "string";
|
|
299
|
+
readonly opts: "array";
|
|
300
|
+
};
|
|
301
|
+
readonly hint: "{name,label?,value,opts:[{label,value}]}";
|
|
302
|
+
}, {
|
|
303
|
+
readonly type: "dropdown";
|
|
304
|
+
readonly category: "kit";
|
|
305
|
+
readonly nature: "void";
|
|
306
|
+
readonly kitValue: true;
|
|
307
|
+
readonly props: {
|
|
308
|
+
readonly name: "string";
|
|
309
|
+
readonly label: "string";
|
|
310
|
+
readonly opts: "array";
|
|
311
|
+
};
|
|
312
|
+
readonly hint: "{name,label?,value,opts:[{label,value}]}";
|
|
313
|
+
}, {
|
|
314
|
+
readonly type: "checklist";
|
|
315
|
+
readonly category: "kit";
|
|
316
|
+
readonly nature: "void";
|
|
317
|
+
readonly kitValue: true;
|
|
318
|
+
readonly props: {
|
|
319
|
+
readonly name: "string";
|
|
320
|
+
readonly label: "string";
|
|
321
|
+
readonly selected: "array";
|
|
322
|
+
readonly opts: "array";
|
|
323
|
+
};
|
|
324
|
+
readonly hint: "{name,label?,selected:[],opts}";
|
|
325
|
+
}, {
|
|
326
|
+
readonly type: "choicecards";
|
|
327
|
+
readonly category: "kit";
|
|
328
|
+
readonly nature: "void";
|
|
329
|
+
readonly kitValue: true;
|
|
330
|
+
readonly props: {
|
|
331
|
+
readonly name: "string";
|
|
332
|
+
readonly label: "string";
|
|
333
|
+
readonly opts: "array";
|
|
334
|
+
readonly multi: "boolean";
|
|
335
|
+
};
|
|
336
|
+
readonly hint: "{name,label?,value,opts:[{label,value,icon?}],multi?}";
|
|
337
|
+
}, {
|
|
338
|
+
readonly type: "searchselect";
|
|
339
|
+
readonly category: "kit";
|
|
340
|
+
readonly nature: "void";
|
|
341
|
+
readonly kitValue: true;
|
|
342
|
+
readonly props: {
|
|
343
|
+
readonly name: "string";
|
|
344
|
+
readonly label: "string";
|
|
345
|
+
readonly opts: "array";
|
|
346
|
+
readonly multi: "boolean";
|
|
347
|
+
};
|
|
348
|
+
readonly hint: "{name,label?,value,opts,multi?}";
|
|
349
|
+
}, {
|
|
350
|
+
readonly type: "tagfield";
|
|
351
|
+
readonly category: "kit";
|
|
352
|
+
readonly nature: "void";
|
|
353
|
+
readonly kitValue: true;
|
|
354
|
+
readonly props: {
|
|
355
|
+
readonly name: "string";
|
|
356
|
+
readonly label: "string";
|
|
357
|
+
readonly selected: "array";
|
|
358
|
+
readonly freeEntry: "boolean";
|
|
359
|
+
};
|
|
360
|
+
readonly hint: "{name,label?,selected:[],freeEntry?}";
|
|
361
|
+
}, {
|
|
362
|
+
readonly type: "location";
|
|
363
|
+
readonly category: "kit";
|
|
364
|
+
readonly nature: "void";
|
|
365
|
+
readonly kitValue: true;
|
|
366
|
+
readonly props: {
|
|
367
|
+
readonly name: "string";
|
|
368
|
+
readonly label: "string";
|
|
369
|
+
};
|
|
370
|
+
readonly hint: "{name,label?}";
|
|
371
|
+
}, {
|
|
372
|
+
readonly type: "actionbutton";
|
|
373
|
+
readonly category: "kit";
|
|
374
|
+
readonly nature: "void";
|
|
375
|
+
readonly props: {
|
|
376
|
+
readonly btnlabel: "string";
|
|
377
|
+
readonly action: "string";
|
|
378
|
+
readonly target: "string";
|
|
379
|
+
readonly amount: "number";
|
|
380
|
+
readonly url: "string";
|
|
381
|
+
};
|
|
382
|
+
readonly hint: "{btnlabel,action:\"increment\"|\"set\"|\"toggle\"|\"link\",target?,amount?,url?}";
|
|
383
|
+
}, {
|
|
384
|
+
readonly type: "kitchart";
|
|
385
|
+
readonly category: "kit";
|
|
386
|
+
readonly nature: "void";
|
|
387
|
+
readonly props: {
|
|
388
|
+
readonly kind: "string";
|
|
389
|
+
readonly title: "string";
|
|
390
|
+
readonly labels: "string";
|
|
391
|
+
readonly source: "string";
|
|
392
|
+
};
|
|
393
|
+
readonly hint: "{kind:\"line\"|\"area\"|\"bar\"|\"pie\"|\"donut\"|\"scatter\"|\"funnel\",title?,labels?,source}";
|
|
394
|
+
}, {
|
|
395
|
+
readonly type: "statuslight";
|
|
396
|
+
readonly category: "kit";
|
|
397
|
+
readonly nature: "void";
|
|
398
|
+
readonly props: {
|
|
399
|
+
readonly label: "string";
|
|
400
|
+
readonly source: "string";
|
|
401
|
+
readonly okAt: "number";
|
|
402
|
+
readonly warnAt: "number";
|
|
403
|
+
};
|
|
404
|
+
readonly hint: "{label?,source,okAt,warnAt}";
|
|
405
|
+
}, {
|
|
406
|
+
readonly type: "progressbar";
|
|
407
|
+
readonly category: "kit";
|
|
408
|
+
readonly nature: "void";
|
|
409
|
+
readonly props: {
|
|
410
|
+
readonly label: "string";
|
|
411
|
+
readonly source: "string";
|
|
412
|
+
readonly max: "number";
|
|
413
|
+
readonly format: "string";
|
|
414
|
+
};
|
|
415
|
+
readonly hint: "{label?,source,max?,format?}";
|
|
416
|
+
}, {
|
|
417
|
+
readonly type: "formula";
|
|
418
|
+
readonly category: "kit";
|
|
419
|
+
readonly nature: "void";
|
|
420
|
+
readonly props: {
|
|
421
|
+
readonly source: "string";
|
|
422
|
+
};
|
|
423
|
+
readonly hint: "{source} — a JS expression over input names";
|
|
424
|
+
}, {
|
|
425
|
+
readonly type: "linkcard";
|
|
426
|
+
readonly category: "kit";
|
|
427
|
+
readonly nature: "void";
|
|
428
|
+
readonly props: {
|
|
429
|
+
readonly title: "string";
|
|
430
|
+
readonly url: "string";
|
|
431
|
+
readonly description: "string";
|
|
432
|
+
};
|
|
433
|
+
readonly hint: "{title,url,description?}";
|
|
434
|
+
}, {
|
|
435
|
+
readonly type: "tooltipcard";
|
|
436
|
+
readonly category: "kit";
|
|
437
|
+
readonly nature: "void";
|
|
438
|
+
readonly props: {
|
|
439
|
+
readonly term: "string";
|
|
440
|
+
readonly tip: "string";
|
|
441
|
+
};
|
|
442
|
+
readonly hint: "{term,tip}";
|
|
443
|
+
}, {
|
|
444
|
+
readonly type: "dbview";
|
|
445
|
+
readonly category: "kit";
|
|
446
|
+
readonly nature: "void";
|
|
447
|
+
readonly props: {
|
|
448
|
+
readonly pageId: "string";
|
|
449
|
+
};
|
|
450
|
+
readonly hint: "embedded live database view {pageId} — the page hosting the database";
|
|
451
|
+
}];
|
|
452
|
+
/** The core block `type` union — the UI's `BlockType` is THIS type, so the
|
|
453
|
+
* editor model and the catalogue cannot disagree about the core set. */
|
|
454
|
+
export type CoreBlockType = Extract<(typeof CATALOGUE_LITERAL)[number], {
|
|
455
|
+
category: 'core';
|
|
456
|
+
}>['type'];
|
|
457
|
+
/** The catalogue, widened to the interface type for consumers (the `as const`
|
|
458
|
+
* literal view above exists only for {@link CoreBlockType} extraction). */
|
|
459
|
+
export declare const BLOCK_TYPE_CATALOGUE: readonly BlockTypeInfo[];
|
|
460
|
+
/** The catalogue entry for a type, or undefined (plugin/unknown types). */
|
|
461
|
+
export declare const blockTypeInfo: (type: string) => BlockTypeInfo | undefined;
|
|
462
|
+
/** Every catalogued (core + kit) type id. */
|
|
463
|
+
export declare const KNOWN_BLOCK_TYPE_IDS: ReadonlySet<string>;
|
|
464
|
+
/** Core types whose `children` hold ordinary blocks. */
|
|
465
|
+
export declare const CONTAINER_BLOCK_TYPES: ReadonlySet<CoreBlockType>;
|
|
466
|
+
/** Core types that carry editable rich text. */
|
|
467
|
+
export declare const TEXT_BLOCK_TYPES: ReadonlySet<CoreBlockType>;
|
|
468
|
+
/** Child-only types → the one container each must sit directly inside. */
|
|
469
|
+
export declare const CHILD_ONLY_PARENT: Readonly<Record<string, string>>;
|
|
470
|
+
/**
|
|
471
|
+
* Whether `type` is plugin-NAMESPACED: `<pluginId>/<blockType>` (plugins/api.ts
|
|
472
|
+
* prefixes every registered plugin block with its manifest id). Pattern only —
|
|
473
|
+
* says nothing about whether such a plugin is installed.
|
|
474
|
+
*/
|
|
475
|
+
export declare const isPluginBlockType: (type: string) => boolean;
|
|
476
|
+
/** The `<pluginId>` prefix of a plugin-namespaced type, or null. */
|
|
477
|
+
export declare const pluginIdOfBlockType: (type: string) => string | null;
|
|
478
|
+
/** Why {@link findUnknownBlockType} rejected a type. */
|
|
479
|
+
export interface UnknownBlockType {
|
|
480
|
+
type: string;
|
|
481
|
+
reason: 'unknown' | 'plugin-not-installed';
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* The first block type (anywhere in the tree) that is neither catalogued nor an
|
|
485
|
+
* acceptable plugin type, or null when every type is fine.
|
|
486
|
+
*
|
|
487
|
+
* Plugin types (`<pluginId>/<type>`) validate by pattern, then — when the
|
|
488
|
+
* caller CAN enumerate installed plugins — by an installed-plugin lookup on the
|
|
489
|
+
* id prefix. Pass `installedPluginIds: undefined` when no plugin listing is
|
|
490
|
+
* available (older server, no client): pattern-valid plugin types are then
|
|
491
|
+
* accepted opaquely, as the apply layer always has (never crash on them).
|
|
492
|
+
*/
|
|
493
|
+
export declare function findUnknownBlockType(blocks: readonly unknown[], opts?: {
|
|
494
|
+
installedPluginIds?: ReadonlySet<string>;
|
|
495
|
+
}, depth?: number): UnknownBlockType | null;
|
|
496
|
+
/** A caller-facing message for an {@link UnknownBlockType}, or null. */
|
|
497
|
+
export declare function unknownBlockTypeMessage(bad: UnknownBlockType | null): string | null;
|
|
498
|
+
/**
|
|
499
|
+
* Max nesting depth for one write. Deep enough for every real layout —
|
|
500
|
+
* `columns → column → table → row → cell → group → tabs → tab → paragraph` is
|
|
501
|
+
* 9 with room to spare at 8 for the practical trees — and shallow enough that a
|
|
502
|
+
* runaway/recursive model response can't build a pathological tree the editor
|
|
503
|
+
* then has to render.
|
|
504
|
+
*/
|
|
505
|
+
export declare const MAX_BLOCK_DEPTH = 8;
|
|
506
|
+
/**
|
|
507
|
+
* Max TOTAL blocks (all levels) in one write. A 20×8 table is 180 nodes, so
|
|
508
|
+
* this fits any sane single write while bounding one request's cost; a bigger
|
|
509
|
+
* document is several appends.
|
|
510
|
+
*/
|
|
511
|
+
export declare const MAX_BLOCK_NODES = 400;
|
|
512
|
+
/**
|
|
513
|
+
* Validate a nested block payload's STRUCTURE against the catalogue: a
|
|
514
|
+
* `children` array only on a container-nature type (anything else silently
|
|
515
|
+
* drops the children at apply time), a child-only type only directly inside its
|
|
516
|
+
* matching container, every `table` square (each `row` holding the same number
|
|
517
|
+
* of `cell` children — a ragged table renders holes), and the depth/node caps.
|
|
518
|
+
* Returns an actionable message, or null when the payload is fine.
|
|
519
|
+
*
|
|
520
|
+
* Block TYPES are not this function's business ({@link findUnknownBlockType}
|
|
521
|
+
* covers those) — plugin/unknown leaf types walk through untouched.
|
|
522
|
+
*/
|
|
523
|
+
export declare function blockTreeError(blocks: readonly unknown[], opts?: {
|
|
524
|
+
maxDepth?: number;
|
|
525
|
+
maxNodes?: number;
|
|
526
|
+
}): string | null;
|
|
527
|
+
/**
|
|
528
|
+
* Per-type prop VALUE validation for one block's props patch. Permissive but
|
|
529
|
+
* typed: only props the catalogue declares for `type` (plus the common block
|
|
530
|
+
* props) are checked; unknown props pass, `null` passes (it removes the key),
|
|
531
|
+
* and plugin/unknown types pass entirely. Returns a message, or null.
|
|
532
|
+
*/
|
|
533
|
+
export declare function invalidBlockProps(type: string, props: Record<string, unknown>): string | null;
|
|
534
|
+
/** The manifest-declared blocks of an installed plugin, as the catalogue
|
|
535
|
+
* listing consumes them (a structural subset of the SDK's `StoredPlugin`). */
|
|
536
|
+
export interface PluginBlockSource {
|
|
537
|
+
manifest: {
|
|
538
|
+
id: string;
|
|
539
|
+
name?: string;
|
|
540
|
+
blocks?: ReadonlyArray<{
|
|
541
|
+
type: string;
|
|
542
|
+
description?: string;
|
|
543
|
+
}>;
|
|
544
|
+
};
|
|
545
|
+
enabled?: boolean;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* The full catalogue as `list_block_types` text: every core + kit entry, then
|
|
549
|
+
* one `plugin` entry per block each installed plugin DECLARES in its manifest
|
|
550
|
+
* (`PluginManifest.blocks`). Pass the installed plugins where a listing is
|
|
551
|
+
* available; omit it and the plugin section says so instead of guessing.
|
|
552
|
+
*/
|
|
553
|
+
export declare function blockCatalogueText(plugins?: readonly PluginBlockSource[]): string;
|
|
554
|
+
/**
|
|
555
|
+
* The `add_blocks` tool description, generated from the catalogue so the type
|
|
556
|
+
* list in the model's guidance can never drift from what validation accepts
|
|
557
|
+
* (this replaces the old hand-written BLOCK_CATALOGUE prose in the agent).
|
|
558
|
+
*/
|
|
559
|
+
export declare function addBlocksGuidance(): string;
|
|
560
|
+
export {};
|