@json-render/core 0.12.0 → 0.12.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 +1 -1
- package/dist/index.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -227,7 +227,7 @@ Schema options:
|
|
|
227
227
|
| `ActionBinding` | Action binding with `action`, `params`, `confirm`, `preventDefault`, etc. |
|
|
228
228
|
| `BuiltInAction` | Built-in action definition with `name` and `description` |
|
|
229
229
|
|
|
230
|
-
###
|
|
230
|
+
### Inline Mode (Mixed Streams)
|
|
231
231
|
|
|
232
232
|
| Export | Purpose |
|
|
233
233
|
|--------|---------|
|
package/dist/index.d.mts
CHANGED
|
@@ -462,11 +462,14 @@ interface PromptOptions {
|
|
|
462
462
|
/**
|
|
463
463
|
* Output mode for the generated prompt.
|
|
464
464
|
*
|
|
465
|
-
* - `"
|
|
466
|
-
* - `"
|
|
465
|
+
* - `"standalone"` (default): The LLM should output only JSONL patches (no prose).
|
|
466
|
+
* - `"inline"`: The LLM should respond conversationally first, then output JSONL patches.
|
|
467
467
|
* Includes rules about interleaving text with JSONL and not wrapping in code fences.
|
|
468
|
+
*
|
|
469
|
+
* @deprecated `"generate"` — use `"standalone"` instead.
|
|
470
|
+
* @deprecated `"chat"` — use `"inline"` instead.
|
|
468
471
|
*/
|
|
469
|
-
mode?: "generate" | "chat";
|
|
472
|
+
mode?: "standalone" | "inline" | "generate" | "chat";
|
|
470
473
|
}
|
|
471
474
|
/**
|
|
472
475
|
* Context provided to prompt templates
|
package/dist/index.d.ts
CHANGED
|
@@ -462,11 +462,14 @@ interface PromptOptions {
|
|
|
462
462
|
/**
|
|
463
463
|
* Output mode for the generated prompt.
|
|
464
464
|
*
|
|
465
|
-
* - `"
|
|
466
|
-
* - `"
|
|
465
|
+
* - `"standalone"` (default): The LLM should output only JSONL patches (no prose).
|
|
466
|
+
* - `"inline"`: The LLM should respond conversationally first, then output JSONL patches.
|
|
467
467
|
* Includes rules about interleaving text with JSONL and not wrapping in code fences.
|
|
468
|
+
*
|
|
469
|
+
* @deprecated `"generate"` — use `"standalone"` instead.
|
|
470
|
+
* @deprecated `"chat"` — use `"inline"` instead.
|
|
468
471
|
*/
|
|
469
|
-
mode?: "generate" | "chat";
|
|
472
|
+
mode?: "standalone" | "inline" | "generate" | "chat";
|
|
470
473
|
}
|
|
471
474
|
/**
|
|
472
475
|
* Context provided to prompt templates
|
package/dist/index.js
CHANGED
|
@@ -1745,12 +1745,17 @@ function generatePrompt(catalog, options) {
|
|
|
1745
1745
|
const {
|
|
1746
1746
|
system = "You are a UI generator that outputs JSON.",
|
|
1747
1747
|
customRules = [],
|
|
1748
|
-
mode = "
|
|
1748
|
+
mode: rawMode = "standalone"
|
|
1749
1749
|
} = options;
|
|
1750
|
+
const mode = rawMode === "chat" ? (console.warn(
|
|
1751
|
+
'[json-render] mode "chat" is deprecated, use "inline" instead'
|
|
1752
|
+
), "inline") : rawMode === "generate" ? (console.warn(
|
|
1753
|
+
'[json-render] mode "generate" is deprecated, use "standalone" instead'
|
|
1754
|
+
), "standalone") : rawMode;
|
|
1750
1755
|
const lines = [];
|
|
1751
1756
|
lines.push(system);
|
|
1752
1757
|
lines.push("");
|
|
1753
|
-
if (mode === "
|
|
1758
|
+
if (mode === "inline") {
|
|
1754
1759
|
lines.push("OUTPUT FORMAT (text + JSONL, RFC 6902 JSON Patch):");
|
|
1755
1760
|
lines.push(
|
|
1756
1761
|
"You respond conversationally. When generating UI, first write a brief explanation (1-3 sentences), then output JSONL patch lines wrapped in a ```spec code fence."
|
|
@@ -2142,7 +2147,7 @@ Note: state patches appear right after the elements that use them, so the UI fil
|
|
|
2142
2147
|
lines.push("");
|
|
2143
2148
|
}
|
|
2144
2149
|
lines.push("RULES:");
|
|
2145
|
-
const baseRules = mode === "
|
|
2150
|
+
const baseRules = mode === "inline" ? [
|
|
2146
2151
|
"When generating UI, wrap all JSONL patches in a ```spec code fence - one JSON object per line inside the fence",
|
|
2147
2152
|
"Write a brief conversational response before any JSONL output",
|
|
2148
2153
|
'First set root: {"op":"add","path":"/root","value":"<root-key>"}',
|