mlola-ui 1.11.0 → 1.12.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/README.md +21 -0
- package/package.json +5 -1
- package/registry/catalog.json +16 -0
- package/registry/index.json +51 -51
- package/registry/render-ai.d.ts +94 -0
- package/registry/render-ai.js +302 -0
- package/registry/render-app.html +2 -2
- package/registry/render-catalog.json +1 -1
- package/registry/render-rules.json +1 -1
- package/registry/render.d.ts +15 -3
- package/registry/render.js +111 -25
- package/registry/source/packages/components/render-surface/render-surface.tsx +32 -4
- package/registry/source-manifest.json +1 -1
- package/src/cli.js +8 -1
package/README.md
CHANGED
|
@@ -48,6 +48,7 @@ Tailwind's preflight in either import order.
|
|
|
48
48
|
| `migrate [path…] [--write] [--json]` | move a shadcn/ui project's props, toasts and icons to Mlola, and list what needs a person |
|
|
49
49
|
| `render check <file \| -> [--json]` | check A2UI messages an agent composed against the Mlola Render catalog; exits 1 on an error |
|
|
50
50
|
| `render catalog [--schema]` | print the Mlola Render catalog as the guide an agent reads, or as the A2UI catalog |
|
|
51
|
+
| `render prompt [--tool] [--page-theme]` | print the system prompt for a model you call yourself: every answer a surface, or (`--tool`) a tool the model calls when one helps; `--page-theme` leaves themes to the page |
|
|
51
52
|
| `login <token>` | save a Mlola Pro token (from /account) for this user |
|
|
52
53
|
| `logout` | forget the saved token |
|
|
53
54
|
|
|
@@ -171,6 +172,26 @@ comes back to the agent as their next message, with A2UI's action. The A2UI
|
|
|
171
172
|
catalog is `mlola-ui/render/catalog` and
|
|
172
173
|
https://ui.mlola.com/a2ui/catalog/v1.
|
|
173
174
|
|
|
175
|
+
With a model you call yourself, `mlola-ui/render/ai` is what goes around the
|
|
176
|
+
call: the system prompt, a reader for what the model answers (as it streams,
|
|
177
|
+
and however it wrapped the JSON), and the loop that hands a refused reply
|
|
178
|
+
back with its errors. Mlola never calls a model and holds no key:
|
|
179
|
+
|
|
180
|
+
```js
|
|
181
|
+
import { composeRender } from "mlola-ui/render/ai";
|
|
182
|
+
|
|
183
|
+
const { valid, messages, turns } = await composeRender({
|
|
184
|
+
rules,
|
|
185
|
+
request: "A form to book a table for tonight",
|
|
186
|
+
generate: ({ system, messages }) => callYourModel(system, messages), // answers with the model's text
|
|
187
|
+
});
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`renderSystemPrompt`, `renderTool`, `createRenderReader`, `readRenderReply`,
|
|
191
|
+
`checkRenderReply` and `renderRepairPrompt` are the parts, for a stream, a
|
|
192
|
+
tool call or a loop of your own. `npx mlola-ui render prompt` prints the
|
|
193
|
+
prompt for a server in another language.
|
|
194
|
+
|
|
174
195
|
To draw surfaces yourself: `npx mlola-ui add render-surface` in React, or
|
|
175
196
|
`@mlola-ui/behavior/render` on a page without a framework. See
|
|
176
197
|
https://ui.mlola.com/docs/render.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mlola-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"mcpName": "io.github.mlolahq/mlola-ui",
|
|
5
5
|
"description": "Source-copy CLI that writes framework-free Mlola UI items into your project",
|
|
6
6
|
"type": "module",
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
"types": "./registry/render.d.ts",
|
|
15
15
|
"default": "./registry/render.js"
|
|
16
16
|
},
|
|
17
|
+
"./render/ai": {
|
|
18
|
+
"types": "./registry/render-ai.d.ts",
|
|
19
|
+
"default": "./registry/render-ai.js"
|
|
20
|
+
},
|
|
17
21
|
"./render/rules": {
|
|
18
22
|
"types": "./src/render-rules.d.ts",
|
|
19
23
|
"default": "./registry/render-rules.json"
|
package/registry/catalog.json
CHANGED
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"model-compare",
|
|
54
54
|
"prompt-playground",
|
|
55
55
|
"generative-ui",
|
|
56
|
+
"render-pro",
|
|
56
57
|
"transcript"
|
|
57
58
|
],
|
|
58
59
|
"blocks": [
|
|
@@ -836,6 +837,21 @@
|
|
|
836
837
|
"render"
|
|
837
838
|
]
|
|
838
839
|
},
|
|
840
|
+
{
|
|
841
|
+
"name": "render-pro",
|
|
842
|
+
"type": "registry:ui",
|
|
843
|
+
"title": "Render Pro",
|
|
844
|
+
"description": "Draws the interface an agent composed from the Mlola Render Pro catalog: every free component, plus charts and a data grid a person can edit",
|
|
845
|
+
"category": "ai-agents",
|
|
846
|
+
"tags": [
|
|
847
|
+
"agent",
|
|
848
|
+
"a2ui",
|
|
849
|
+
"generative",
|
|
850
|
+
"render",
|
|
851
|
+
"chart",
|
|
852
|
+
"data grid"
|
|
853
|
+
]
|
|
854
|
+
},
|
|
839
855
|
{
|
|
840
856
|
"name": "transcript",
|
|
841
857
|
"type": "registry:ui",
|
package/registry/index.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "./schema/registry-index.schema.json",
|
|
3
3
|
"schemaVersion": 2,
|
|
4
4
|
"name": "mlola-ui",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.12.0",
|
|
6
6
|
"homepage": "https://ui.mlola.com",
|
|
7
7
|
"themeContract": {
|
|
8
8
|
"attribute": "data-theme",
|
|
@@ -179,8 +179,8 @@
|
|
|
179
179
|
},
|
|
180
180
|
"registryDependencies": [],
|
|
181
181
|
"engineDependencies": {
|
|
182
|
-
"@mlola-ui/behavior": "^1.
|
|
183
|
-
"@mlola-ui/icons": "^1.
|
|
182
|
+
"@mlola-ui/behavior": "^1.12.0",
|
|
183
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
184
184
|
},
|
|
185
185
|
"options": [
|
|
186
186
|
{
|
|
@@ -241,7 +241,7 @@
|
|
|
241
241
|
},
|
|
242
242
|
"registryDependencies": [],
|
|
243
243
|
"engineDependencies": {
|
|
244
|
-
"@mlola-ui/icons": "^1.
|
|
244
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
245
245
|
},
|
|
246
246
|
"options": [
|
|
247
247
|
{
|
|
@@ -403,7 +403,7 @@
|
|
|
403
403
|
},
|
|
404
404
|
"registryDependencies": [],
|
|
405
405
|
"engineDependencies": {
|
|
406
|
-
"@mlola-ui/icons": "^1.
|
|
406
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
407
407
|
},
|
|
408
408
|
"options": [
|
|
409
409
|
{
|
|
@@ -495,7 +495,7 @@
|
|
|
495
495
|
},
|
|
496
496
|
"registryDependencies": [],
|
|
497
497
|
"engineDependencies": {
|
|
498
|
-
"@mlola-ui/icons": "^1.
|
|
498
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
499
499
|
},
|
|
500
500
|
"options": [],
|
|
501
501
|
"variants": [],
|
|
@@ -548,7 +548,7 @@
|
|
|
548
548
|
"spinner"
|
|
549
549
|
],
|
|
550
550
|
"engineDependencies": {
|
|
551
|
-
"@mlola-ui/motion": "^1.
|
|
551
|
+
"@mlola-ui/motion": "^1.12.0"
|
|
552
552
|
},
|
|
553
553
|
"options": [
|
|
554
554
|
{
|
|
@@ -716,8 +716,8 @@
|
|
|
716
716
|
},
|
|
717
717
|
"registryDependencies": [],
|
|
718
718
|
"engineDependencies": {
|
|
719
|
-
"@mlola-ui/behavior": "^1.
|
|
720
|
-
"@mlola-ui/icons": "^1.
|
|
719
|
+
"@mlola-ui/behavior": "^1.12.0",
|
|
720
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
721
721
|
},
|
|
722
722
|
"options": [
|
|
723
723
|
{
|
|
@@ -786,7 +786,7 @@
|
|
|
786
786
|
},
|
|
787
787
|
"registryDependencies": [],
|
|
788
788
|
"engineDependencies": {
|
|
789
|
-
"@mlola-ui/icons": "^1.
|
|
789
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
790
790
|
},
|
|
791
791
|
"options": [],
|
|
792
792
|
"variants": [],
|
|
@@ -841,7 +841,7 @@
|
|
|
841
841
|
"modal"
|
|
842
842
|
],
|
|
843
843
|
"engineDependencies": {
|
|
844
|
-
"@mlola-ui/icons": "^1.
|
|
844
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
845
845
|
},
|
|
846
846
|
"options": [],
|
|
847
847
|
"variants": [],
|
|
@@ -905,8 +905,8 @@
|
|
|
905
905
|
},
|
|
906
906
|
"registryDependencies": [],
|
|
907
907
|
"engineDependencies": {
|
|
908
|
-
"@mlola-ui/behavior": "^1.
|
|
909
|
-
"@mlola-ui/icons": "^1.
|
|
908
|
+
"@mlola-ui/behavior": "^1.12.0",
|
|
909
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
910
910
|
},
|
|
911
911
|
"options": [
|
|
912
912
|
{
|
|
@@ -995,7 +995,7 @@
|
|
|
995
995
|
"input"
|
|
996
996
|
],
|
|
997
997
|
"engineDependencies": {
|
|
998
|
-
"@mlola-ui/icons": "^1.
|
|
998
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
999
999
|
},
|
|
1000
1000
|
"options": [],
|
|
1001
1001
|
"variants": [],
|
|
@@ -1220,8 +1220,8 @@
|
|
|
1220
1220
|
},
|
|
1221
1221
|
"registryDependencies": [],
|
|
1222
1222
|
"engineDependencies": {
|
|
1223
|
-
"@mlola-ui/behavior": "^1.
|
|
1224
|
-
"@mlola-ui/icons": "^1.
|
|
1223
|
+
"@mlola-ui/behavior": "^1.12.0",
|
|
1224
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
1225
1225
|
},
|
|
1226
1226
|
"options": [
|
|
1227
1227
|
{
|
|
@@ -1372,7 +1372,7 @@
|
|
|
1372
1372
|
},
|
|
1373
1373
|
"registryDependencies": [],
|
|
1374
1374
|
"engineDependencies": {
|
|
1375
|
-
"@mlola-ui/icons": "^1.
|
|
1375
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
1376
1376
|
},
|
|
1377
1377
|
"options": [],
|
|
1378
1378
|
"variants": [],
|
|
@@ -1423,7 +1423,7 @@
|
|
|
1423
1423
|
},
|
|
1424
1424
|
"registryDependencies": [],
|
|
1425
1425
|
"engineDependencies": {
|
|
1426
|
-
"@mlola-ui/behavior": "^1.
|
|
1426
|
+
"@mlola-ui/behavior": "^1.12.0"
|
|
1427
1427
|
},
|
|
1428
1428
|
"options": [
|
|
1429
1429
|
{
|
|
@@ -1801,7 +1801,7 @@
|
|
|
1801
1801
|
},
|
|
1802
1802
|
"registryDependencies": [],
|
|
1803
1803
|
"engineDependencies": {
|
|
1804
|
-
"@mlola-ui/behavior": "^1.
|
|
1804
|
+
"@mlola-ui/behavior": "^1.12.0"
|
|
1805
1805
|
},
|
|
1806
1806
|
"options": [],
|
|
1807
1807
|
"variants": [],
|
|
@@ -1854,8 +1854,8 @@
|
|
|
1854
1854
|
"input"
|
|
1855
1855
|
],
|
|
1856
1856
|
"engineDependencies": {
|
|
1857
|
-
"@mlola-ui/behavior": "^1.
|
|
1858
|
-
"@mlola-ui/icons": "^1.
|
|
1857
|
+
"@mlola-ui/behavior": "^1.12.0",
|
|
1858
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
1859
1859
|
},
|
|
1860
1860
|
"options": [
|
|
1861
1861
|
{
|
|
@@ -1933,8 +1933,8 @@
|
|
|
1933
1933
|
},
|
|
1934
1934
|
"registryDependencies": [],
|
|
1935
1935
|
"engineDependencies": {
|
|
1936
|
-
"@mlola-ui/behavior": "^1.
|
|
1937
|
-
"@mlola-ui/icons": "^1.
|
|
1936
|
+
"@mlola-ui/behavior": "^1.12.0",
|
|
1937
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
1938
1938
|
},
|
|
1939
1939
|
"options": [
|
|
1940
1940
|
{
|
|
@@ -2080,7 +2080,7 @@
|
|
|
2080
2080
|
"input"
|
|
2081
2081
|
],
|
|
2082
2082
|
"engineDependencies": {
|
|
2083
|
-
"@mlola-ui/behavior": "^1.
|
|
2083
|
+
"@mlola-ui/behavior": "^1.12.0"
|
|
2084
2084
|
},
|
|
2085
2085
|
"options": [
|
|
2086
2086
|
{
|
|
@@ -2148,7 +2148,7 @@
|
|
|
2148
2148
|
"input"
|
|
2149
2149
|
],
|
|
2150
2150
|
"engineDependencies": {
|
|
2151
|
-
"@mlola-ui/behavior": "^1.
|
|
2151
|
+
"@mlola-ui/behavior": "^1.12.0"
|
|
2152
2152
|
},
|
|
2153
2153
|
"options": [
|
|
2154
2154
|
{
|
|
@@ -2308,7 +2308,7 @@
|
|
|
2308
2308
|
},
|
|
2309
2309
|
"registryDependencies": [],
|
|
2310
2310
|
"engineDependencies": {
|
|
2311
|
-
"@mlola-ui/behavior": "^1.
|
|
2311
|
+
"@mlola-ui/behavior": "^1.12.0"
|
|
2312
2312
|
},
|
|
2313
2313
|
"options": [
|
|
2314
2314
|
{
|
|
@@ -2440,7 +2440,7 @@
|
|
|
2440
2440
|
},
|
|
2441
2441
|
"registryDependencies": [],
|
|
2442
2442
|
"engineDependencies": {
|
|
2443
|
-
"@mlola-ui/icons": "^1.
|
|
2443
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
2444
2444
|
},
|
|
2445
2445
|
"options": [
|
|
2446
2446
|
{
|
|
@@ -2528,8 +2528,8 @@
|
|
|
2528
2528
|
"spinner"
|
|
2529
2529
|
],
|
|
2530
2530
|
"engineDependencies": {
|
|
2531
|
-
"@mlola-ui/behavior": "^1.
|
|
2532
|
-
"@mlola-ui/icons": "^1.
|
|
2531
|
+
"@mlola-ui/behavior": "^1.12.0",
|
|
2532
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
2533
2533
|
},
|
|
2534
2534
|
"options": [
|
|
2535
2535
|
{
|
|
@@ -2684,7 +2684,7 @@
|
|
|
2684
2684
|
},
|
|
2685
2685
|
"registryDependencies": [],
|
|
2686
2686
|
"engineDependencies": {
|
|
2687
|
-
"@mlola-ui/behavior": "^1.
|
|
2687
|
+
"@mlola-ui/behavior": "^1.12.0"
|
|
2688
2688
|
},
|
|
2689
2689
|
"options": [
|
|
2690
2690
|
{
|
|
@@ -2761,7 +2761,7 @@
|
|
|
2761
2761
|
},
|
|
2762
2762
|
"registryDependencies": [],
|
|
2763
2763
|
"engineDependencies": {
|
|
2764
|
-
"@mlola-ui/behavior": "^1.
|
|
2764
|
+
"@mlola-ui/behavior": "^1.12.0"
|
|
2765
2765
|
},
|
|
2766
2766
|
"options": [
|
|
2767
2767
|
{
|
|
@@ -2843,7 +2843,7 @@
|
|
|
2843
2843
|
},
|
|
2844
2844
|
"registryDependencies": [],
|
|
2845
2845
|
"engineDependencies": {
|
|
2846
|
-
"@mlola-ui/icons": "^1.
|
|
2846
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
2847
2847
|
},
|
|
2848
2848
|
"options": [
|
|
2849
2849
|
{
|
|
@@ -2915,7 +2915,7 @@
|
|
|
2915
2915
|
"popover"
|
|
2916
2916
|
],
|
|
2917
2917
|
"engineDependencies": {
|
|
2918
|
-
"@mlola-ui/icons": "^1.
|
|
2918
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
2919
2919
|
},
|
|
2920
2920
|
"options": [
|
|
2921
2921
|
{
|
|
@@ -2985,7 +2985,7 @@
|
|
|
2985
2985
|
"popover"
|
|
2986
2986
|
],
|
|
2987
2987
|
"engineDependencies": {
|
|
2988
|
-
"@mlola-ui/icons": "^1.
|
|
2988
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
2989
2989
|
},
|
|
2990
2990
|
"options": [],
|
|
2991
2991
|
"variants": [],
|
|
@@ -3183,8 +3183,8 @@
|
|
|
3183
3183
|
"input"
|
|
3184
3184
|
],
|
|
3185
3185
|
"engineDependencies": {
|
|
3186
|
-
"@mlola-ui/behavior": "^1.
|
|
3187
|
-
"@mlola-ui/icons": "^1.
|
|
3186
|
+
"@mlola-ui/behavior": "^1.12.0",
|
|
3187
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
3188
3188
|
},
|
|
3189
3189
|
"options": [
|
|
3190
3190
|
{
|
|
@@ -3273,7 +3273,7 @@
|
|
|
3273
3273
|
"input"
|
|
3274
3274
|
],
|
|
3275
3275
|
"engineDependencies": {
|
|
3276
|
-
"@mlola-ui/icons": "^1.
|
|
3276
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
3277
3277
|
},
|
|
3278
3278
|
"options": [],
|
|
3279
3279
|
"variants": [],
|
|
@@ -3328,7 +3328,7 @@
|
|
|
3328
3328
|
"input"
|
|
3329
3329
|
],
|
|
3330
3330
|
"engineDependencies": {
|
|
3331
|
-
"@mlola-ui/icons": "^1.
|
|
3331
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
3332
3332
|
},
|
|
3333
3333
|
"options": [],
|
|
3334
3334
|
"variants": [],
|
|
@@ -3391,7 +3391,7 @@
|
|
|
3391
3391
|
"popover"
|
|
3392
3392
|
],
|
|
3393
3393
|
"engineDependencies": {
|
|
3394
|
-
"@mlola-ui/icons": "^1.
|
|
3394
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
3395
3395
|
},
|
|
3396
3396
|
"options": [
|
|
3397
3397
|
{
|
|
@@ -3462,7 +3462,7 @@
|
|
|
3462
3462
|
},
|
|
3463
3463
|
"registryDependencies": [],
|
|
3464
3464
|
"engineDependencies": {
|
|
3465
|
-
"@mlola-ui/icons": "^1.
|
|
3465
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
3466
3466
|
},
|
|
3467
3467
|
"options": [
|
|
3468
3468
|
{
|
|
@@ -3581,8 +3581,8 @@
|
|
|
3581
3581
|
},
|
|
3582
3582
|
"registryDependencies": [],
|
|
3583
3583
|
"engineDependencies": {
|
|
3584
|
-
"@mlola-ui/behavior": "^1.
|
|
3585
|
-
"@mlola-ui/icons": "^1.
|
|
3584
|
+
"@mlola-ui/behavior": "^1.12.0",
|
|
3585
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
3586
3586
|
},
|
|
3587
3587
|
"options": [],
|
|
3588
3588
|
"variants": [],
|
|
@@ -3646,7 +3646,7 @@
|
|
|
3646
3646
|
},
|
|
3647
3647
|
"registryDependencies": [],
|
|
3648
3648
|
"engineDependencies": {
|
|
3649
|
-
"@mlola-ui/behavior": "^1.
|
|
3649
|
+
"@mlola-ui/behavior": "^1.12.0"
|
|
3650
3650
|
},
|
|
3651
3651
|
"options": [
|
|
3652
3652
|
{
|
|
@@ -3733,8 +3733,8 @@
|
|
|
3733
3733
|
},
|
|
3734
3734
|
"registryDependencies": [],
|
|
3735
3735
|
"engineDependencies": {
|
|
3736
|
-
"@mlola-ui/behavior": "^1.
|
|
3737
|
-
"@mlola-ui/icons": "^1.
|
|
3736
|
+
"@mlola-ui/behavior": "^1.12.0",
|
|
3737
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
3738
3738
|
},
|
|
3739
3739
|
"options": [],
|
|
3740
3740
|
"variants": [],
|
|
@@ -3808,7 +3808,7 @@
|
|
|
3808
3808
|
"sheet"
|
|
3809
3809
|
],
|
|
3810
3810
|
"engineDependencies": {
|
|
3811
|
-
"@mlola-ui/icons": "^1.
|
|
3811
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
3812
3812
|
},
|
|
3813
3813
|
"options": [],
|
|
3814
3814
|
"variants": [],
|
|
@@ -3931,7 +3931,7 @@
|
|
|
3931
3931
|
"button"
|
|
3932
3932
|
],
|
|
3933
3933
|
"engineDependencies": {
|
|
3934
|
-
"@mlola-ui/icons": "^1.
|
|
3934
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
3935
3935
|
},
|
|
3936
3936
|
"options": [
|
|
3937
3937
|
{
|
|
@@ -4035,8 +4035,8 @@
|
|
|
4035
4035
|
"input"
|
|
4036
4036
|
],
|
|
4037
4037
|
"engineDependencies": {
|
|
4038
|
-
"@mlola-ui/behavior": "^1.
|
|
4039
|
-
"@mlola-ui/icons": "^1.
|
|
4038
|
+
"@mlola-ui/behavior": "^1.12.0",
|
|
4039
|
+
"@mlola-ui/icons": "^1.12.0"
|
|
4040
4040
|
},
|
|
4041
4041
|
"options": [
|
|
4042
4042
|
{
|
|
@@ -4128,7 +4128,7 @@
|
|
|
4128
4128
|
"toggle"
|
|
4129
4129
|
],
|
|
4130
4130
|
"engineDependencies": {
|
|
4131
|
-
"@mlola-ui/behavior": "^1.
|
|
4131
|
+
"@mlola-ui/behavior": "^1.12.0"
|
|
4132
4132
|
},
|
|
4133
4133
|
"options": [
|
|
4134
4134
|
{
|
|
@@ -4155,7 +4155,7 @@
|
|
|
4155
4155
|
"path": "packages/components/render-surface/render-surface.tsx",
|
|
4156
4156
|
"target": "{{aliases.components}}/render-surface.tsx",
|
|
4157
4157
|
"type": "registry:ui",
|
|
4158
|
-
"integrity": "sha256-
|
|
4158
|
+
"integrity": "sha256-nW48kYLXoa3eeGZQ7gXMD/bTNH9MDeJlWyl1zzrvDwo="
|
|
4159
4159
|
}
|
|
4160
4160
|
],
|
|
4161
4161
|
"themeContract": {
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/** Types for Mlola Render with your own model (ai.js). See docs/render.md. */
|
|
2
|
+
import type { RenderResult, RenderRules } from "./render.js";
|
|
3
|
+
|
|
4
|
+
export interface RenderPromptOptions {
|
|
5
|
+
/** "lines" (the default): every answer is a surface, as A2UI messages one to a line. "tool": the model answers in words and calls a tool when a surface helps. */
|
|
6
|
+
output?: "lines" | "tool";
|
|
7
|
+
/** "surface" (the default): the model may name one of the catalog's themes. "page": it sets none, and the surface takes the theme of the page it is shown on. */
|
|
8
|
+
theme?: "surface" | "page";
|
|
9
|
+
/** The tool's name when `output` is "tool"; "render_ui" when left out. Give `renderTool` the same one. */
|
|
10
|
+
tool?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** What to tell the model, as its system prompt: how to answer, then the catalog's guide. */
|
|
14
|
+
export function renderSystemPrompt(rules: RenderRules, options?: RenderPromptOptions): string;
|
|
15
|
+
|
|
16
|
+
/** A tool in the shape every provider's tool calling is built from. */
|
|
17
|
+
export interface RenderTool {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object";
|
|
22
|
+
properties: { messages: { type: "string"; description: string } };
|
|
23
|
+
required: ["messages"];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The tool a model calls to show a surface. Its messages travel as one string: read them with `checkRenderReply`. */
|
|
28
|
+
export function renderTool(options?: { name?: string }): RenderTool;
|
|
29
|
+
|
|
30
|
+
/** The messages read from a reply, or the error that stopped the read (and then no messages). */
|
|
31
|
+
export interface RenderReply {
|
|
32
|
+
messages: unknown[];
|
|
33
|
+
error: string | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface RenderReader {
|
|
37
|
+
/** Takes the next piece of the model's text and answers with the messages it completed. */
|
|
38
|
+
push(chunk: string): unknown[];
|
|
39
|
+
/** Every message of the reply, or what was wrong with it: a piece that is not JSON, a message cut off, too much text, or no message at all. */
|
|
40
|
+
end(): RenderReply;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Reads A2UI messages out of a model's text as it arrives: JSON Lines, an array, one object, a code fence around them, or {"messages": […]}. */
|
|
44
|
+
export function createRenderReader(rules: RenderRules): RenderReader;
|
|
45
|
+
|
|
46
|
+
/** Reads a whole reply: the model's text, a tool call's arguments, or messages already parsed. */
|
|
47
|
+
export function readRenderReply(reply: unknown, rules: RenderRules): RenderReply;
|
|
48
|
+
|
|
49
|
+
export interface CheckedReply {
|
|
50
|
+
/** True when the reply may be drawn. */
|
|
51
|
+
valid: boolean;
|
|
52
|
+
/** The messages to draw; empty unless `valid`. */
|
|
53
|
+
messages: unknown[];
|
|
54
|
+
/** The check's result. A reply that could not be read, or that shows nothing, is one error at the path "". */
|
|
55
|
+
result: RenderResult;
|
|
56
|
+
/** What to tell the model when the reply was refused: the next user message, or the tool's answer. Null when `valid`. */
|
|
57
|
+
repair: string | null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Reads a reply and checks it against the catalog. */
|
|
61
|
+
export function checkRenderReply(reply: unknown, rules: RenderRules): CheckedReply;
|
|
62
|
+
|
|
63
|
+
/** What to tell the model about a reply the check refused. */
|
|
64
|
+
export function renderRepairPrompt(result: RenderResult): string;
|
|
65
|
+
|
|
66
|
+
export interface RenderTurn {
|
|
67
|
+
role: "user" | "assistant";
|
|
68
|
+
content: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface ComposeRenderOptions {
|
|
72
|
+
/** The catalog: mlola-ui/render/rules. */
|
|
73
|
+
rules: RenderRules;
|
|
74
|
+
/** Calls your model with this system prompt and these turns, and answers with its text. */
|
|
75
|
+
generate: (call: { system: string; messages: RenderTurn[]; attempt: number }) => string | Promise<string>;
|
|
76
|
+
/** What the person asked for, or the conversation so far, ending with the person's turn. */
|
|
77
|
+
request: string | RenderTurn[];
|
|
78
|
+
/** Your own system prompt, with `renderSystemPrompt(rules)` in it. Left out, that prompt alone. */
|
|
79
|
+
system?: string;
|
|
80
|
+
/** Passed to `renderSystemPrompt` when `system` is left out. */
|
|
81
|
+
theme?: "surface" | "page";
|
|
82
|
+
/** How many times the model is asked, from 1 to 10. 3 when left out. */
|
|
83
|
+
attempts?: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface ComposedRender extends CheckedReply {
|
|
87
|
+
/** How many times the model was asked. */
|
|
88
|
+
attempts: number;
|
|
89
|
+
/** The conversation with the model's replies and the corrections in it, to continue from. */
|
|
90
|
+
turns: RenderTurn[];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Asks your model for a surface until one passes the check, or the attempts run out. */
|
|
94
|
+
export function composeRender(options: ComposeRenderOptions): Promise<ComposedRender>;
|