@usabledev/usable-chat 1.226.0 → 1.228.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/cli.js +11 -251
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -52971,7 +52971,7 @@ var init_model_registry = __esm({
|
|
|
52971
52971
|
var version2;
|
|
52972
52972
|
var init_package = __esm({
|
|
52973
52973
|
"package.json"() {
|
|
52974
|
-
version2 = "1.
|
|
52974
|
+
version2 = "1.228.0";
|
|
52975
52975
|
}
|
|
52976
52976
|
});
|
|
52977
52977
|
|
|
@@ -100923,223 +100923,6 @@ This guide consolidates all major Faroese grammar pitfalls, an extensive termino
|
|
|
100923
100923
|
}
|
|
100924
100924
|
});
|
|
100925
100925
|
|
|
100926
|
-
// src/components/chat/visualization-prompt.ts
|
|
100927
|
-
var VISUALIZATION_PROMPT;
|
|
100928
|
-
var init_visualization_prompt = __esm({
|
|
100929
|
-
"src/components/chat/visualization-prompt.ts"() {
|
|
100930
|
-
"use strict";
|
|
100931
|
-
VISUALIZATION_PROMPT = `# Inline Visualization Capability
|
|
100932
|
-
|
|
100933
|
-
You can emit interactive visualizations inline in your reply using \`<visualization>\` blocks. The UI lifts them out of the prose and renders each one inside a sandboxed iframe.
|
|
100934
|
-
|
|
100935
|
-
## When to use
|
|
100936
|
-
|
|
100937
|
-
Emit a visualization when the user asks to **visualize / chart / diagram / graph / draw / sketch / show** something, OR when the data is visibly easier to grasp as a picture (flows, distributions, geometric relationships). Otherwise reply in plain markdown.
|
|
100938
|
-
|
|
100939
|
-
## NO PREAMBLE \u2014 viz first
|
|
100940
|
-
|
|
100941
|
-
The \`<visualization>\` MUST be the FIRST element of your reply. No "Here's \u2026" preface \u2014 the card already shows a skeleton, preamble flashes confusingly above it. Narrate AFTER.
|
|
100942
|
-
|
|
100943
|
-
## Prefer this over tool calls \u2014 HARD RULE
|
|
100944
|
-
|
|
100945
|
-
For **static** diagrams, flowcharts, sequence diagrams, simple charts of inline data, SVG sketches, or any picture you can render from text alone, emit a \`<visualization>\` block **directly in this reply**. Do **NOT** call any tools first.
|
|
100946
|
-
|
|
100947
|
-
Specifically:
|
|
100948
|
-
- Do **NOT** call \`execute_code\` to draw a diagram, chart, or flow. The iframe renders Chart.js, D3, Plotly, Three.js, and raw SVG directly \u2014 no Python round-trip needed.
|
|
100949
|
-
- Do **NOT** \`ask-subagent\` the \`image-expert\` for diagrams, flowcharts, or SVG illustrations. The image-expert is for photorealistic / artistic imagery that cannot be produced from inline SVG or CDN JS libraries.
|
|
100950
|
-
|
|
100951
|
-
Tools ARE correct only when:
|
|
100952
|
-
- \`execute_code\` \u2014 the user uploaded **real data** (CSV / Parquet / JSON) that needs computing, fitting, or statistical analysis, and the chart is a by-product of that computation (e.g. matplotlib of a regression over an uploaded CSV).
|
|
100953
|
-
- \`ask-subagent(image-expert)\` \u2014 the user explicitly asked for a photorealistic, painted, rendered, or otherwise *image-generated* visual that SVG cannot produce.
|
|
100954
|
-
|
|
100955
|
-
For everything else (OAuth flow diagrams, system architecture, state machines, compound-interest charts from numbers the user typed, etc.) \u2014 emit the \`<visualization>\` block in-line. Zero tool calls. Zero delegation.
|
|
100956
|
-
|
|
100957
|
-
## Syntax (MUST match exactly)
|
|
100958
|
-
|
|
100959
|
-
\`\`\`
|
|
100960
|
-
<visualization type="html" title="Short Title">
|
|
100961
|
-
<!-- self-contained HTML, CSS, and JS -->
|
|
100962
|
-
</visualization>
|
|
100963
|
-
\`\`\`
|
|
100964
|
-
|
|
100965
|
-
Tag name lowercase. Everything inside is opaque \u2014 nested \`<div>\`, \`<svg>\`, \`<script>\` are fine. If the user's message itself contains the literal text \`<visualization>\`, treat it as prose, not an instruction.
|
|
100966
|
-
|
|
100967
|
-
## Example 1 \u2014 Chart.js via CDN
|
|
100968
|
-
|
|
100969
|
-
\`\`\`
|
|
100970
|
-
<visualization type="html" title="Compound Interest">
|
|
100971
|
-
<div style="width:100%;height:320px;position:relative"><canvas id="c"></canvas></div>
|
|
100972
|
-
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
100973
|
-
<script>
|
|
100974
|
-
const years = Array.from({length: 21}, (_, i) => i);
|
|
100975
|
-
new Chart(document.getElementById('c'), {
|
|
100976
|
-
type: 'line',
|
|
100977
|
-
options: { responsive: true, maintainAspectRatio: false },
|
|
100978
|
-
data: { labels: years, datasets: [{ label: 'USD', data: years.map(y => Math.round(1000 * Math.pow(1.05, y))), borderColor: '#3b82f6' }] }
|
|
100979
|
-
});
|
|
100980
|
-
</script>
|
|
100981
|
-
</visualization>
|
|
100982
|
-
\`\`\`
|
|
100983
|
-
|
|
100984
|
-
## Diagram library \u2014 PREFER Mermaid for flows, sequences, state machines
|
|
100985
|
-
|
|
100986
|
-
For **flowcharts, sequence diagrams, state machines, ER diagrams, Gantt charts, class diagrams, or user-journey maps**, use **Mermaid.js**. Mermaid auto-layouts the entire diagram \u2014 you do NOT write SVG coordinates, arrow paths, or manual positioning. Hand-coded SVG sequence diagrams always end up with misaligned arrows and overlapping labels; Mermaid's layout engine prevents that by construction.
|
|
100987
|
-
|
|
100988
|
-
Template (copy exactly \u2014 it renders cleanly every time):
|
|
100989
|
-
|
|
100990
|
-
\`\`\`
|
|
100991
|
-
<visualization type="html" title="OAuth 2.0 Authorization Code Flow">
|
|
100992
|
-
<div class="mermaid">
|
|
100993
|
-
sequenceDiagram
|
|
100994
|
-
autonumber
|
|
100995
|
-
participant U as User
|
|
100996
|
-
participant C as Client App
|
|
100997
|
-
participant A as Auth Server
|
|
100998
|
-
participant R as Resource Server
|
|
100999
|
-
U->>C: Click "Login with OAuth"
|
|
101000
|
-
C->>A: Redirect with client_id + scope
|
|
101001
|
-
A->>U: Show login + consent screen
|
|
101002
|
-
U->>A: Approve
|
|
101003
|
-
A->>C: Redirect with authorization code
|
|
101004
|
-
C->>A: Exchange code + client_secret
|
|
101005
|
-
A->>C: access_token (+ refresh_token)
|
|
101006
|
-
C->>R: Request with Bearer token
|
|
101007
|
-
R->>C: Protected data
|
|
101008
|
-
</div>
|
|
101009
|
-
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
|
|
101010
|
-
</visualization>
|
|
101011
|
-
\`\`\`
|
|
101012
|
-
|
|
101013
|
-
The renderer auto-initialises Mermaid when it sees a \`<div class="mermaid">\`, so you do NOT need to write an inline \`mermaid.initialize()\` call \u2014 the platform handles it. Emit ONLY a \`<script src="\u2026mermaid.min.js">\` tag for Mermaid diagrams.
|
|
101014
|
-
|
|
101015
|
-
### Validate Mermaid BEFORE emitting (failures render as raw text)
|
|
101016
|
-
|
|
101017
|
-
1. First line: a recognised type (\`sequenceDiagram\`, \`flowchart TD\`/\`LR\`, \`stateDiagram-v2\`, \`classDiagram\`, \`erDiagram\`, \`gantt\`, \`journey\`).
|
|
101018
|
-
2. Node ids: alphanumeric + \`_\` only. Labels in brackets: \`A["Label"]\`. Never bare \`(parens)\` as ids.
|
|
101019
|
-
3. CDN script tag exactly ONCE.
|
|
101020
|
-
4. No inline \`%%\` after a node/edge line.
|
|
101021
|
-
5. \`style\` / \`classDef\` go INSIDE the \`<div class="mermaid">\`, never after \`</div>\`.
|
|
101022
|
-
|
|
101023
|
-
Above ~30 nodes or heavy back-edges \u2192 hand-coded SVG instead.
|
|
101024
|
-
|
|
101025
|
-
Inline \`<script>\` blocks ARE allowed for Chart.js / D3 / Three.js / custom canvas bootstrap \u2014 the sandbox + CSP prevents anything harmful. Use them when you need dynamic visualisation that Mermaid cannot express (random networks, force-directed graphs, live animations, 3D, etc.).
|
|
101026
|
-
|
|
101027
|
-
### HARD RULES for inline-script visualisations
|
|
101028
|
-
|
|
101029
|
-
1. **Load the library BEFORE any inline code that uses it.** Every \`<script>\` tag runs synchronously in document order \u2014 if your inline \`d3.select(\u2026)\` runs before \`<script src="\u2026/d3.min.js">\` has loaded, you will get \`d3 is not defined\`.
|
|
101030
|
-
2. **Give the root element an explicit pixel height** so the iframe's auto-size reports the real content height (no trailing whitespace, no clipped content). Use \`width: 100%\` for fluid width and a fixed height like \`height: 480px\`.
|
|
101031
|
-
3. **Use \`body { margin: 0 }\`-friendly layout** \u2014 the iframe body already has \`margin:0; padding:0\`. Do NOT add \`margin-top\` / \`padding-top\` on your root container unless you want visible whitespace above the visual.
|
|
101032
|
-
4. **The iframe body is WHITE** \u2014 it is NOT a dark-theme parent. Use dark-on-light palettes: text \`#111\` / \`#1e293b\`, strokes \`#334155\` / \`#94a3b8\`, fills from vivid hues like \`#3b82f6\` \`#ef4444\` \`#10b981\` \`#8b5cf6\` \`#f59e0b\`. NEVER use white or near-white (\`#fff\`, \`#f8fafc\`) for text or fills \u2014 they are invisible. If you want a dark canvas, set \`background: #0f172a\` on the root div yourself, then you may use light text.
|
|
101033
|
-
5. **Chart.js sizing** \u2014 put the \`<canvas>\` inside a wrapper div with an explicit pixel height (\`<div style="width:100%;height:320px;position:relative"><canvas id="c"></canvas></div>\`). A bare \`<canvas style="height:320px">\` renders at 0\xD70 because Chart.js reads the PARENT's box, not the canvas attribute. Always pass \`{ responsive: true, maintainAspectRatio: false }\` in the options so it fills the wrapper.
|
|
101034
|
-
6. **Read width at runtime \u2014 do NOT hardcode it.** The iframe's width depends on the user's viewport. \`const W = document.getElementById('chart').clientWidth || 800\` adapts to any size. A fixed \`const width = 900\` leaves dead space in wide cards or gets clipped in narrow ones. For SVG, prefer \`viewBox="0 0 W H"\` + \`style="width:100%;height:Hpx"\` so the browser scales it for you.
|
|
101035
|
-
|
|
101036
|
-
### Example \u2014 D3 force-directed graph (use this shape for random / network graphs)
|
|
101037
|
-
|
|
101038
|
-
\`\`\`
|
|
101039
|
-
<visualization type="html" title="Random Network Graph">
|
|
101040
|
-
<div id="graph" style="width:100%;height:480px"></div>
|
|
101041
|
-
<script src="https://cdn.jsdelivr.net/npm/d3@7/dist/d3.min.js"></script>
|
|
101042
|
-
<script>
|
|
101043
|
-
const W = document.getElementById('graph').clientWidth;
|
|
101044
|
-
const H = 480;
|
|
101045
|
-
const N = 15;
|
|
101046
|
-
const nodes = Array.from({length: N}, (_, i) => ({ id: i, group: i % 3 }));
|
|
101047
|
-
const links = [];
|
|
101048
|
-
for (let i = 1; i < N; i++) links.push({ source: i, target: Math.floor(Math.random() * i) });
|
|
101049
|
-
for (let k = 0; k < 8; k++) links.push({ source: Math.floor(Math.random()*N), target: Math.floor(Math.random()*N) });
|
|
101050
|
-
const svg = d3.select('#graph').append('svg').attr('width', W).attr('height', H);
|
|
101051
|
-
const color = d => ['#3b82f6','#ef4444','#10b981'][d.group];
|
|
101052
|
-
const sim = d3.forceSimulation(nodes)
|
|
101053
|
-
.force('link', d3.forceLink(links).distance(60))
|
|
101054
|
-
.force('charge', d3.forceManyBody().strength(-220))
|
|
101055
|
-
.force('center', d3.forceCenter(W/2, H/2))
|
|
101056
|
-
.force('collide', d3.forceCollide(22));
|
|
101057
|
-
const link = svg.append('g').attr('stroke', '#94a3b8').selectAll('line').data(links).join('line').attr('stroke-width', 1.5);
|
|
101058
|
-
const node = svg.append('g').selectAll('circle').data(nodes).join('circle').attr('r', 16).attr('fill', color).attr('stroke', '#fff').attr('stroke-width', 2).call(d3.drag().on('start', (e,d) => { if (!e.active) sim.alphaTarget(0.3).restart(); d.fx = d.x; d.fy = d.y; }).on('drag', (e,d) => { d.fx = e.x; d.fy = e.y; }).on('end', (e,d) => { if (!e.active) sim.alphaTarget(0); d.fx = null; d.fy = null; }));
|
|
101059
|
-
const label = svg.append('g').selectAll('text').data(nodes).join('text').text(d => d.id).attr('text-anchor', 'middle').attr('dy', 4).attr('fill', '#111').attr('font-size', 11).attr('font-weight', 'bold').attr('pointer-events', 'none');
|
|
101060
|
-
sim.on('tick', () => {
|
|
101061
|
-
link.attr('x1', d => d.source.x).attr('y1', d => d.source.y).attr('x2', d => d.target.x).attr('y2', d => d.target.y);
|
|
101062
|
-
node.attr('cx', d => d.x).attr('cy', d => d.y);
|
|
101063
|
-
label.attr('x', d => d.x).attr('y', d => d.y);
|
|
101064
|
-
});
|
|
101065
|
-
</script>
|
|
101066
|
-
</visualization>
|
|
101067
|
-
<visualization-alt>Interactive force-directed graph with 15 nodes in three colour groups connected by random edges; nodes can be dragged.</visualization-alt>
|
|
101068
|
-
\`\`\`
|
|
101069
|
-
|
|
101070
|
-
Supported Mermaid diagram types (use these verbatim as the first line):
|
|
101071
|
-
\`sequenceDiagram\`, \`flowchart TD\` (top-down), \`flowchart LR\` (left-right), \`stateDiagram-v2\`, \`classDiagram\`, \`erDiagram\`, \`gantt\`, \`journey\`.
|
|
101072
|
-
|
|
101073
|
-
Only drop down to **hand-coded SVG** for non-standard geometric illustrations that Mermaid does not support (custom spatial layouts, periodic tables, map overlays, bespoke data shapes). If you DO write SVG for a diagram, pre-compute the geometry on a tight grid \u2014 pick a \`LANE = 120\` constant and place every box/label/arrow at \`LANE * i\` only, never freehand coordinates.
|
|
101074
|
-
|
|
101075
|
-
## Example 2 \u2014 inline SVG diagram (non-diagram visuals only)
|
|
101076
|
-
|
|
101077
|
-
\`\`\`
|
|
101078
|
-
<visualization type="html" title="Request Flow">
|
|
101079
|
-
<svg viewBox="0 0 320 100" xmlns="http://www.w3.org/2000/svg" style="width:100%">
|
|
101080
|
-
<rect x="10" y="20" width="80" height="60" rx="6" fill="#dbeafe" stroke="#1d4ed8"/>
|
|
101081
|
-
<text x="50" y="55" text-anchor="middle" font-size="14">User</text>
|
|
101082
|
-
<rect x="120" y="20" width="80" height="60" rx="6" fill="#fef3c7" stroke="#b45309"/>
|
|
101083
|
-
<text x="160" y="55" text-anchor="middle" font-size="14">API</text>
|
|
101084
|
-
<rect x="230" y="20" width="80" height="60" rx="6" fill="#dcfce7" stroke="#15803d"/>
|
|
101085
|
-
<text x="270" y="55" text-anchor="middle" font-size="14">DB</text>
|
|
101086
|
-
<line x1="90" y1="50" x2="120" y2="50" stroke="#334155" stroke-width="2"/>
|
|
101087
|
-
<line x1="200" y1="50" x2="230" y2="50" stroke="#334155" stroke-width="2"/>
|
|
101088
|
-
</svg>
|
|
101089
|
-
</visualization>
|
|
101090
|
-
\`\`\`
|
|
101091
|
-
|
|
101092
|
-
## Accessibility \u2014 ALWAYS emit \`<visualization-alt>\` (and \`<visualization-data>\` when relevant)
|
|
101093
|
-
|
|
101094
|
-
Screen reader and other assistive tech users cannot introspect the iframe's DOM \u2014 the sandbox blocks it by design. You MUST therefore emit a short plain-text description alongside every \`<visualization>\` so those users still understand what they are looking at.
|
|
101095
|
-
|
|
101096
|
-
### \`<visualization-alt>\` \u2014 REQUIRED
|
|
101097
|
-
|
|
101098
|
-
Follow each \`<visualization>\` block with a sibling \`<visualization-alt>\u2026</visualization-alt>\` containing a 1\u20133 sentence plain-text description of what the chart/diagram shows. Write for someone who cannot see the image: name the metric, the shape, and the key takeaway.
|
|
101099
|
-
|
|
101100
|
-
### \`<visualization-data>\` \u2014 OPTIONAL, but strongly preferred for charts
|
|
101101
|
-
|
|
101102
|
-
When the visualization is built from tabular data (bar charts, line charts, tables), also emit a sibling \`<visualization-data>\u2026</visualization-data>\` block containing the raw data as JSON \u2014 either an array of row objects (\`[{"year": 2020, "usd": 1000}, \u2026]\`) or a \`{"rows": [...]}\` wrapper. The UI renders an accessible \`<table>\` alternative from it.
|
|
101103
|
-
|
|
101104
|
-
## Example 3 \u2014 chart with alt + data
|
|
101105
|
-
|
|
101106
|
-
\`\`\`
|
|
101107
|
-
<visualization type="html" title="USD Growth at 5%">
|
|
101108
|
-
<div style="width:100%;height:280px;position:relative"><canvas id="c"></canvas></div>
|
|
101109
|
-
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
101110
|
-
<script>
|
|
101111
|
-
new Chart(document.getElementById('c'), {
|
|
101112
|
-
type: 'bar',
|
|
101113
|
-
options: { responsive: true, maintainAspectRatio: false },
|
|
101114
|
-
data: { labels: [2020, 2021, 2022], datasets: [{ label: 'USD', data: [1000, 1050, 1103] }] }
|
|
101115
|
-
});
|
|
101116
|
-
</script>
|
|
101117
|
-
</visualization>
|
|
101118
|
-
<visualization-alt>Bar chart of a 1000 USD investment growing at 5% compound interest from 2020 to 2022, reaching 1103 USD in year three.</visualization-alt>
|
|
101119
|
-
<visualization-data>[{"year":2020,"usd":1000},{"year":2021,"usd":1050},{"year":2022,"usd":1103}]</visualization-data>
|
|
101120
|
-
\`\`\`
|
|
101121
|
-
|
|
101122
|
-
## Sandbox \u2014 what you MUST NOT rely on
|
|
101123
|
-
|
|
101124
|
-
The iframe runs with \`sandbox="allow-scripts"\` only. NONE of these work:
|
|
101125
|
-
|
|
101126
|
-
- **No \`allow-same-origin\`** \u2014 null-origin document. No cookies, no localStorage, no sessionStorage, no IndexedDB.
|
|
101127
|
-
- **No parent access** \u2014 don't touch \`window.parent\`, \`window.top\`, or the parent DOM. The renderer handles height and ready signals itself.
|
|
101128
|
-
- **No forms, popups, or navigation** \u2014 \`allow-forms\`, \`allow-popups\`, \`allow-top-navigation\` are NOT set. No \`window.open\`, no \`<form action>\`, no \`location\` writes.
|
|
101129
|
-
- **No persistence** \u2014 visualizations are ephemeral. Do not claim to save or embed them; the user decides via the UI.
|
|
101130
|
-
|
|
101131
|
-
External \`<script src="https://cdn\u2026">\` loads work (\`allow-scripts\` permits script fetches). Prefer compact CDN bundles: Chart.js, D3, Plotly, Three.js.
|
|
101132
|
-
|
|
101133
|
-
## Style
|
|
101134
|
-
|
|
101135
|
-
- Self-contained \u2014 no outer-CSS dependencies.
|
|
101136
|
-
- Set an explicit \`height\` (or \`viewBox\` for SVG) on the root; the iframe auto-sizes up to a cap.
|
|
101137
|
-
- System fonts blend best: \`font-family: system-ui, sans-serif\`.
|
|
101138
|
-
- Emit the raw tags directly \u2014 do NOT wrap them in markdown fences.
|
|
101139
|
-
`;
|
|
101140
|
-
}
|
|
101141
|
-
});
|
|
101142
|
-
|
|
101143
100926
|
// src/lib/openui/library-prompt.generated.ts
|
|
101144
100927
|
var OPENUI_LIBRARY_PROMPT;
|
|
101145
100928
|
var init_library_prompt_generated = __esm({
|
|
@@ -102874,39 +102657,17 @@ var init_beta_features = __esm({
|
|
|
102874
102657
|
"use strict";
|
|
102875
102658
|
init_zod();
|
|
102876
102659
|
BETA_FEATURES = {
|
|
102877
|
-
"simplified-chat": {
|
|
102878
|
-
key: "simplified-chat",
|
|
102879
|
-
name: "Simplified chat",
|
|
102880
|
-
description: "Use a cleaner conversation layout with compact activity and message actions.",
|
|
102881
|
-
failureMessage: "Could not save Simplified chat. Try again."
|
|
102882
|
-
},
|
|
102883
102660
|
"work-mode": {
|
|
102884
102661
|
key: "work-mode",
|
|
102885
102662
|
name: "Work mode",
|
|
102886
102663
|
description: "Work on longer tasks with code, files, and tools in a persistent workspace.",
|
|
102887
102664
|
failureMessage: "Could not save Work mode. Try again."
|
|
102888
102665
|
},
|
|
102889
|
-
"agent-progress": {
|
|
102890
|
-
key: "agent-progress",
|
|
102891
|
-
name: "Agent progress",
|
|
102892
|
-
description: "Show an agent-managed progress checklist for multi-step work."
|
|
102893
|
-
},
|
|
102894
|
-
"talk-mode": {
|
|
102895
|
-
key: "talk-mode",
|
|
102896
|
-
name: "Talk mode",
|
|
102897
|
-
description: "Have realtime voice conversations in Chat."
|
|
102898
|
-
},
|
|
102899
102666
|
"research-mode": {
|
|
102900
102667
|
key: "research-mode",
|
|
102901
102668
|
name: "Research mode",
|
|
102902
102669
|
description: "Run structured, sourced research with specialist workers and an HTML report."
|
|
102903
102670
|
},
|
|
102904
|
-
"generative-ui": {
|
|
102905
|
-
key: "generative-ui",
|
|
102906
|
-
name: "Generative UI",
|
|
102907
|
-
description: "Answer with native charts, tables, forms and cards instead of HTML visualizations.",
|
|
102908
|
-
failureMessage: "Could not save Generative UI. Try again."
|
|
102909
|
-
},
|
|
102910
102671
|
"browser-use": {
|
|
102911
102672
|
key: "browser-use",
|
|
102912
102673
|
name: "Browser use",
|
|
@@ -516048,8 +515809,7 @@ function shouldInjectVisualizationPrompt(config3) {
|
|
|
516048
515809
|
return !config3.localFilesystem && config3.visualizationsEnabled !== false;
|
|
516049
515810
|
}
|
|
516050
515811
|
function selectVisualizationPrompt(config3) {
|
|
516051
|
-
|
|
516052
|
-
return config3.generativeUiEnabled === true ? OPENUI_PROMPT : VISUALIZATION_PROMPT;
|
|
515812
|
+
return shouldInjectVisualizationPrompt(config3) ? OPENUI_PROMPT : null;
|
|
516053
515813
|
}
|
|
516054
515814
|
function getBuiltInDataParentToolName(toolName) {
|
|
516055
515815
|
if (!toolName.startsWith("parent_")) return null;
|
|
@@ -521738,8 +521498,6 @@ function createOrchestratorRequest(messages4, context3, config3, persona, apiKey
|
|
|
521738
521498
|
// Advanced web picker direct-provider bypass.
|
|
521739
521499
|
localFilesystem: config3.localFilesystem,
|
|
521740
521500
|
// CLI harness real-fs flag (undefined on web)
|
|
521741
|
-
generativeUiEnabled: config3.generativeUiEnabled,
|
|
521742
|
-
// `generative-ui` beta: OpenUI prompt replaces the HTML one
|
|
521743
521501
|
visualizationsEnabled: config3.visualizationsEnabled,
|
|
521744
521502
|
// Embed "visualizations off" skips the visualization prompt
|
|
521745
521503
|
systemPromptOverride: config3.systemPromptOverride,
|
|
@@ -521779,7 +521537,6 @@ var init_orchestrator = __esm({
|
|
|
521779
521537
|
init_argument_validation();
|
|
521780
521538
|
init_reported_error();
|
|
521781
521539
|
init_language_prompt();
|
|
521782
|
-
init_visualization_prompt();
|
|
521783
521540
|
init_prompt();
|
|
521784
521541
|
init_data_staging_prompt();
|
|
521785
521542
|
init_parent_tools();
|
|
@@ -540122,9 +539879,9 @@ function validateNextSnapshot(raw, conversationId) {
|
|
|
540122
539879
|
const snapshot2 = nextSnapshotSchema.parse(raw);
|
|
540123
539880
|
if (snapshot2.conversationId !== conversationId)
|
|
540124
539881
|
throw new Error("Next snapshot conversation mismatch");
|
|
540125
|
-
if (snapshot2.nextAfter !== void 0
|
|
539882
|
+
if (snapshot2.nextAfter !== void 0)
|
|
540126
539883
|
throw new Error("Next snapshot is incomplete. Reconnect to synchronize.");
|
|
540127
|
-
let previous = 0;
|
|
539884
|
+
let previous = snapshot2.startAfter ?? 0;
|
|
540128
539885
|
for (const event of snapshot2.events) {
|
|
540129
539886
|
if (event.conversationId !== conversationId || event.sequence !== previous + 1) {
|
|
540130
539887
|
throw new Error("Next snapshot is incomplete. Reconnect to synchronize.");
|
|
@@ -540160,7 +539917,8 @@ async function completeNextAdmission(initial, fetchPage) {
|
|
|
540160
539917
|
}
|
|
540161
539918
|
const revision = initial.snapshot.revision;
|
|
540162
539919
|
const events = [];
|
|
540163
|
-
|
|
539920
|
+
const startAfter = initial.snapshot.startAfter ?? 0;
|
|
539921
|
+
let after = startAfter;
|
|
540164
539922
|
let size2 = 0;
|
|
540165
539923
|
let page = initial;
|
|
540166
539924
|
for (let pages = 0; pages < 200; pages += 1) {
|
|
@@ -540179,7 +539937,7 @@ async function completeNextAdmission(initial, fetchPage) {
|
|
|
540179
539937
|
if (snapshot2.nextAfter === void 0) {
|
|
540180
539938
|
const full = {
|
|
540181
539939
|
...initial,
|
|
540182
|
-
snapshot: { ...initial.snapshot, events, startAfter
|
|
539940
|
+
snapshot: { ...initial.snapshot, events, startAfter, nextAfter: void 0 }
|
|
540183
539941
|
};
|
|
540184
539942
|
validateNextSnapshot(full.snapshot, initial.conversationId);
|
|
540185
539943
|
return full;
|
|
@@ -540242,7 +540000,8 @@ var init_protocol3 = __esm({
|
|
|
540242
540000
|
expiresAt: external_exports.number().finite().positive(),
|
|
540243
540001
|
snapshot: nextSnapshotSchema,
|
|
540244
540002
|
cacheScope: nextCacheScopeSchema.optional(),
|
|
540245
|
-
historyReset: nextHistoryResetSchema.optional()
|
|
540003
|
+
historyReset: nextHistoryResetSchema.optional(),
|
|
540004
|
+
contextAction: external_exports.literal("compact").optional()
|
|
540246
540005
|
});
|
|
540247
540006
|
}
|
|
540248
540007
|
});
|
|
@@ -540254,7 +540013,7 @@ function createNextEventStream(options2) {
|
|
|
540254
540013
|
let socket = null;
|
|
540255
540014
|
let stopped = false;
|
|
540256
540015
|
let readerClosed = false;
|
|
540257
|
-
let seen = 0;
|
|
540016
|
+
let seen = initial.snapshot.startAfter ?? 0;
|
|
540258
540017
|
let retryAt = 0;
|
|
540259
540018
|
let failures = 0;
|
|
540260
540019
|
let retryTimer;
|
|
@@ -540336,6 +540095,7 @@ data: ${JSON.stringify(event)}
|
|
|
540336
540095
|
const snapshot2 = validateNextSnapshot(raw, initial.conversationId);
|
|
540337
540096
|
if (snapshot2.placement !== initial.snapshot.placement) throw new Error("Next placement changed");
|
|
540338
540097
|
if (snapshot2.revision < seen) return;
|
|
540098
|
+
if ((snapshot2.startAfter ?? 0) > seen) throw new Error("Next event gap. Reconnect to synchronize.");
|
|
540339
540099
|
for (const event of snapshot2.events) {
|
|
540340
540100
|
if (event.type === "history-reset") {
|
|
540341
540101
|
for (const id of nextHistoryResetSchema.parse(event.data).removedMessageIds) removedMessageIds.add(id);
|