@rudderhq/agent-runtime-cursor-local 0.4.6-canary.11 → 0.4.6-canary.12
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rudderhq/agent-runtime-cursor-local",
|
|
3
|
-
"version": "0.4.6-canary.
|
|
3
|
+
"version": "0.4.6-canary.12",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"homepage": "https://github.com/Undertone0809/rudder",
|
|
6
6
|
"bugs": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"typecheck": "tsc --noEmit"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@rudderhq/agent-runtime-utils": "0.4.6-canary.
|
|
70
|
+
"@rudderhq/agent-runtime-utils": "0.4.6-canary.12",
|
|
71
71
|
"picocolors": "^1.1.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: visualize
|
|
3
|
+
description: "Create safe inline visual explanations in Rudder Chat. Use when asked for a chart, plot, diagram, timeline, comparison, static map, simulator, scenario view, or compact visual that materially improves understanding. Prefer Mermaid for static node-and-edge structures; use Rudder's HTML/SVG/CSS artifact path only when thread-scoped output is available. Rudder visuals are declarative and scriptless: convert simulator requests to static scenarios or disclosure-based comparisons and never rely on JavaScript, network access, or external assets."
|
|
4
|
+
compatibility: "Rudder Chat inline visual capture. HTML artifacts require a thread-scoped visualization directory exposed by the current runtime."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Visualize
|
|
8
|
+
|
|
9
|
+
Create a visual only when it materially improves what the user can understand,
|
|
10
|
+
compare, or decide. The Rudder inline runtime is scriptless and has no network
|
|
11
|
+
access, so design for a useful first render with declarative HTML, SVG, and CSS.
|
|
12
|
+
|
|
13
|
+
## Choose The Output
|
|
14
|
+
|
|
15
|
+
1. Use a normal fenced Mermaid block when labeled nodes and edges fully explain
|
|
16
|
+
a static structure or flow. Do not create an HTML artifact for that case.
|
|
17
|
+
2. Use an inline visual for charts, timelines, comparisons, spatial layouts,
|
|
18
|
+
static scenario views, or compact reports that benefit from custom geometry.
|
|
19
|
+
3. Create an HTML artifact only when the current run exposes a writable,
|
|
20
|
+
thread-scoped visualization directory ending in
|
|
21
|
+
`visualizations/YYYY/MM/DD/<thread-id>`. Use the exact directory from the
|
|
22
|
+
runtime's writable roots. Never infer, scan for, or create another thread's
|
|
23
|
+
directory.
|
|
24
|
+
4. If that directory is unavailable, fall back to Mermaid, Markdown tables, or
|
|
25
|
+
concise prose. Do not emit a directive that Rudder cannot resolve.
|
|
26
|
+
|
|
27
|
+
## File And Directive
|
|
28
|
+
|
|
29
|
+
- Choose a concise ASCII lowercase-hyphenated title and write
|
|
30
|
+
`<title>.html` inside the current thread-scoped visualization directory.
|
|
31
|
+
- Write only an HTML fragment. Do not include a doctype or `html`, `head`, or
|
|
32
|
+
`body` elements.
|
|
33
|
+
- Keep every fragment under 2 MiB and emit at most three visuals in one
|
|
34
|
+
assistant message.
|
|
35
|
+
- Give the fragment one top-level markup root, `<div id="widget">`. Bounded
|
|
36
|
+
`<style>` blocks may precede that root.
|
|
37
|
+
- Put any custom CSS in bounded `<style>` elements. Inline `style` attributes
|
|
38
|
+
are removed.
|
|
39
|
+
- Read the file back before replying. Fix escaped markup such as literal `\"`
|
|
40
|
+
or `\n`, missing labels, clipped content, and malformed SVG.
|
|
41
|
+
- Add this exact directive on its own line where the visual should render:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
::codex-inline-vis{file="<title>.html"}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Use only the `file` attribute. The value must be a basename ending in `.html`;
|
|
48
|
+
paths, separators, traversal, extra attributes, and alternate quoting are
|
|
49
|
+
rejected. Keep any necessary explanation outside the fragment and do not add a
|
|
50
|
+
second Markdown link to the file.
|
|
51
|
+
|
|
52
|
+
## Rudder Safety Boundary
|
|
53
|
+
|
|
54
|
+
Rudder sanitizes the fragment before rendering, but generate valid input rather
|
|
55
|
+
than relying on sanitization:
|
|
56
|
+
|
|
57
|
+
- Do not write scripts, event handlers, JavaScript URLs, forms, links, images,
|
|
58
|
+
media, nested frames, embedded objects, canvas, or external resources.
|
|
59
|
+
- Do not use `fetch`, XHR, WebSocket, module imports, CDN libraries, web fonts,
|
|
60
|
+
or URL-bearing CSS. The artifact has no network access.
|
|
61
|
+
- Do not use active controls such as buttons, inputs, selects, or textareas.
|
|
62
|
+
They are removed because the scriptless runtime cannot preserve their state
|
|
63
|
+
or behavior safely.
|
|
64
|
+
- Do not implement a parent bridge, follow-up prompt action, filesystem access,
|
|
65
|
+
or access to Rudder state, credentials, cookies, storage, or APIs.
|
|
66
|
+
- Use `<details>` and `<summary>` for the only stateful native disclosure.
|
|
67
|
+
Use `data-tooltip` on `<summary>` for short supplementary hover/focus text.
|
|
68
|
+
A tooltip on any other preserved element is hover-only and must not contain
|
|
69
|
+
essential information.
|
|
70
|
+
- Keep all data needed for the visual inside the fragment. Use inline SVG for
|
|
71
|
+
charts and supplied geometry; never fetch a basemap or invent geography.
|
|
72
|
+
|
|
73
|
+
Read [references/runtime-contract.md](references/runtime-contract.md) before
|
|
74
|
+
writing custom markup or CSS. Use
|
|
75
|
+
[assets/example-chart.html](assets/example-chart.html) as a structure example,
|
|
76
|
+
not as data or copy to repeat.
|
|
77
|
+
|
|
78
|
+
## Composition
|
|
79
|
+
|
|
80
|
+
- Start with the visual itself. Do not add decorative KPI rows, repeated
|
|
81
|
+
legends, permanent toolbars, or explanatory paragraphs inside the fragment.
|
|
82
|
+
- Use one dominant chart, diagram, or comparison. Add up to three compact
|
|
83
|
+
summary cards only when their values are central to reading the visual.
|
|
84
|
+
- For a requested simulator or adjustable explorer, show representative static
|
|
85
|
+
scenarios or a disclosure-based comparison and state the limitation in the
|
|
86
|
+
surrounding response. Do not pretend controls survived when they cannot.
|
|
87
|
+
- For maps, use only user-supplied or locally available geometry that can be
|
|
88
|
+
embedded as safe SVG. Otherwise choose a table, ranked plot, or schematic.
|
|
89
|
+
- Keep the outer surface transparent and unframed. Use `.card` only for a real
|
|
90
|
+
bounded summary or detail; never nest cards.
|
|
91
|
+
|
|
92
|
+
## Layout And Accessibility
|
|
93
|
+
|
|
94
|
+
- Design for the full Chat width around 736px and reflow cleanly down to 320px.
|
|
95
|
+
- Avoid fixed outer widths, viewport-height layouts, horizontal scrolling,
|
|
96
|
+
fixed positioning, and clipped labels.
|
|
97
|
+
- Use semantic headings sparingly. Do not restate the user prompt or render a
|
|
98
|
+
title inside the fragment when the surrounding Markdown already names it.
|
|
99
|
+
- Give each meaningful SVG `role="img"` plus an accessible name or description.
|
|
100
|
+
Include `<title>` and `<desc>` when they improve screen-reader output.
|
|
101
|
+
- Label important values directly. Add a legend only when multiple series
|
|
102
|
+
cannot be labeled on the marks.
|
|
103
|
+
- Pair color with text, shape, or line style so meaning never depends on color
|
|
104
|
+
alone.
|
|
105
|
+
|
|
106
|
+
## Theme And Utilities
|
|
107
|
+
|
|
108
|
+
- Use Rudder theme variables for every color. Start with `--foreground`,
|
|
109
|
+
`--muted-foreground`, `--border`, and `--viz-series-1`; use
|
|
110
|
+
`--viz-series-2` through `--viz-series-6` only for stable categories.
|
|
111
|
+
- Use host utilities such as `.viz-grid`, `.viz-row`, `.viz-stat`,
|
|
112
|
+
`.viz-stat-value`, `.viz-badge`, `.card`, `.text-small`, `.text-muted`,
|
|
113
|
+
`.text-destructive`, and `.sr-only` before adding custom CSS.
|
|
114
|
+
- Keep custom selectors scoped below `#widget`. Use only theme variables already
|
|
115
|
+
provided by Rudder; custom CSS variables are removed.
|
|
116
|
+
- Use normal text by default and weights 400 or 500. Reserve compact secondary
|
|
117
|
+
text for annotations, never essential labels.
|
|
118
|
+
|
|
119
|
+
## Verification
|
|
120
|
+
|
|
121
|
+
Before replying:
|
|
122
|
+
|
|
123
|
+
1. Confirm the file is in the exact current-thread visualization directory,
|
|
124
|
+
uses an allowed basename, is below 2 MiB, and the message has no more than
|
|
125
|
+
three directives.
|
|
126
|
+
2. Confirm the fragment contains no scripts, handlers, URLs, external assets,
|
|
127
|
+
active controls, document-level elements, or unsupported embeds.
|
|
128
|
+
3. Confirm SVG view boxes, labels, referenced IDs, table semantics, and CSS
|
|
129
|
+
selectors are valid.
|
|
130
|
+
4. Check both narrow and wide layout when a preview path is available. If not,
|
|
131
|
+
keep the geometry responsive and the composition conservative.
|
|
132
|
+
5. Emit the directive only after the file is complete and readable.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Visualize"
|
|
3
|
+
short_description: "Create safe inline visuals in Rudder Chat"
|
|
4
|
+
default_prompt: "Use $visualize to create a clear Rudder-native chart, diagram, comparison, or other inline visual when it improves understanding."
|
|
5
|
+
|
|
6
|
+
policy:
|
|
7
|
+
allow_implicit_invocation: true
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
#widget .example-chart {
|
|
3
|
+
display: grid;
|
|
4
|
+
gap: 12px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
#widget .example-chart-bars {
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
10
|
+
align-items: end;
|
|
11
|
+
gap: 10px;
|
|
12
|
+
min-height: 180px;
|
|
13
|
+
padding-block: 8px;
|
|
14
|
+
border-bottom: 1px solid var(--border);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#widget .example-chart-bar {
|
|
18
|
+
display: grid;
|
|
19
|
+
grid-template-rows: 1fr auto;
|
|
20
|
+
align-items: end;
|
|
21
|
+
gap: 6px;
|
|
22
|
+
min-width: 0;
|
|
23
|
+
color: var(--foreground);
|
|
24
|
+
text-align: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#widget .example-chart-bar-mark {
|
|
28
|
+
width: 100%;
|
|
29
|
+
min-height: 12px;
|
|
30
|
+
border-radius: var(--radius) var(--radius) 0 0;
|
|
31
|
+
background: var(--viz-series-1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#widget .example-chart-bar:nth-child(1) .example-chart-bar-mark {
|
|
35
|
+
height: 52px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#widget .example-chart-bar:nth-child(2) .example-chart-bar-mark {
|
|
39
|
+
height: 72px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#widget .example-chart-bar:nth-child(3) .example-chart-bar-mark {
|
|
43
|
+
height: 98px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#widget .example-chart-bar:nth-child(4) .example-chart-bar-mark {
|
|
47
|
+
height: 118px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@media (max-width: 420px) {
|
|
51
|
+
#widget .example-chart-bars {
|
|
52
|
+
gap: 5px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
</style>
|
|
56
|
+
<div id="widget">
|
|
57
|
+
<figure class="example-chart" aria-labelledby="example-chart-caption">
|
|
58
|
+
<figcaption id="example-chart-caption">
|
|
59
|
+
Completed loops by week
|
|
60
|
+
</figcaption>
|
|
61
|
+
<div class="example-chart-bars" role="img" aria-label="Completed loops rose from 8 to 18 over four weeks">
|
|
62
|
+
<div class="example-chart-bar">
|
|
63
|
+
<div class="example-chart-bar-mark"></div>
|
|
64
|
+
<span class="text-small">8</span>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="example-chart-bar">
|
|
67
|
+
<div class="example-chart-bar-mark"></div>
|
|
68
|
+
<span class="text-small">11</span>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="example-chart-bar">
|
|
71
|
+
<div class="example-chart-bar-mark"></div>
|
|
72
|
+
<span class="text-small">15</span>
|
|
73
|
+
</div>
|
|
74
|
+
<div class="example-chart-bar">
|
|
75
|
+
<div class="example-chart-bar-mark"></div>
|
|
76
|
+
<span class="text-small">18</span>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</figure>
|
|
80
|
+
<details class="card">
|
|
81
|
+
<summary data-tooltip="Show how the sample values are defined">Method</summary>
|
|
82
|
+
<p class="text-small text-muted">Illustrative weekly counts for validating the Rudder fragment contract.</p>
|
|
83
|
+
</details>
|
|
84
|
+
<svg role="img" aria-label="Upward trend marker" viewBox="0 0 120 24">
|
|
85
|
+
<title>Upward trend</title>
|
|
86
|
+
<desc>A line rises from left to right across four points.</desc>
|
|
87
|
+
<polyline points="4,20 40,16 78,9 116,4" fill="none" stroke="var(--viz-series-1)" stroke-width="2" vector-effect="non-scaling-stroke" />
|
|
88
|
+
</svg>
|
|
89
|
+
</div>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Rudder Inline Visual Runtime Contract
|
|
2
|
+
|
|
3
|
+
Read this reference when producing a Rudder inline visual. The runtime is
|
|
4
|
+
scriptless, sanitized, isolated from Rudder state, and has no network access.
|
|
5
|
+
Every fragment must be under 2 MiB, and one assistant message may reference at
|
|
6
|
+
most three fragments.
|
|
7
|
+
|
|
8
|
+
## Output Envelope
|
|
9
|
+
|
|
10
|
+
Write a fragment with one top-level markup root, `<div id="widget">`. Bounded
|
|
11
|
+
`<style>` elements may precede that root. Do not write a doctype or `html`,
|
|
12
|
+
`head`, or `body`; Rudder extracts and sanitizes the CSS before it sanitizes the
|
|
13
|
+
markup.
|
|
14
|
+
|
|
15
|
+
The assistant message must place this exact directive on its own line:
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
::codex-inline-vis{file="<title>.html"}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Only a current-run file from the exact thread-scoped visualization directory is
|
|
22
|
+
eligible for capture. Rudder rejects absolute paths, separators, traversal,
|
|
23
|
+
symlink escapes, missing files, stale files, oversized files, malformed
|
|
24
|
+
directives, unknown attributes, and duplicate attributes.
|
|
25
|
+
|
|
26
|
+
## Preserved Markup
|
|
27
|
+
|
|
28
|
+
Use these common HTML elements:
|
|
29
|
+
|
|
30
|
+
- Structure: `article`, `aside`, `div`, `section`, `main`, `header`, `footer`,
|
|
31
|
+
`figure`, `figcaption`, `blockquote`, `hr`, `br`.
|
|
32
|
+
- Text: `h1` through `h6`, `p`, `span`, `small`, `strong`, `em`, `b`, `i`,
|
|
33
|
+
`mark`, `s`, `u`, `code`, `pre`.
|
|
34
|
+
- Lists and data: `ul`, `ol`, `li`, `dl`, `dt`, `dd`, `table`, `caption`,
|
|
35
|
+
`colgroup`, `col`, `thead`, `tbody`, `tfoot`, `tr`, `th`, `td`, `meter`,
|
|
36
|
+
`progress`.
|
|
37
|
+
- Native disclosure: `<details>` and `<summary>`. This is the only supported
|
|
38
|
+
stateful interaction.
|
|
39
|
+
|
|
40
|
+
Use inline `<svg>` for charts and diagrams. Supported primitives include
|
|
41
|
+
`svg`, `g`, `defs`, `title`, `desc`, `path`, `line`, `rect`, `circle`, `ellipse`,
|
|
42
|
+
`polygon`, `polyline`, `text`, `tspan`, `linearGradient`, `radialGradient`, and
|
|
43
|
+
`stop`. Do not use clipping paths; the runtime does not preserve a safe
|
|
44
|
+
`clip-path` reference.
|
|
45
|
+
|
|
46
|
+
Common preserved attributes include:
|
|
47
|
+
|
|
48
|
+
- Accessibility and structure: `role`, `aria-label`, `aria-labelledby`,
|
|
49
|
+
`aria-describedby`, `aria-hidden`, `id`, `class`, `scope`, `colspan`,
|
|
50
|
+
`rowspan`, `open`, `value`, `min`, and `max`.
|
|
51
|
+
- Tooltip: `data-tooltip`, limited to concise plain text.
|
|
52
|
+
- SVG geometry and paint: `viewBox`, `preserveAspectRatio`, `x`, `y`, `x1`,
|
|
53
|
+
`x2`, `y1`, `y2`, `cx`, `cy`, `r`, `rx`, `ry`, `width`, `height`, `d`,
|
|
54
|
+
`points`, `transform`, `fill`, `stroke`, opacity, line, gradient, text-anchor,
|
|
55
|
+
and vector-effect attributes.
|
|
56
|
+
|
|
57
|
+
IDs and class tokens must start with a letter and contain only letters, digits,
|
|
58
|
+
underscores, and hyphens. Keep each token at most 64 characters. A class list is
|
|
59
|
+
limited to 24 safe tokens. Use `url(#safe-id)` only for an inline SVG paint
|
|
60
|
+
reference such as a gradient; all external URL values are removed.
|
|
61
|
+
|
|
62
|
+
## Removed Markup
|
|
63
|
+
|
|
64
|
+
Do not generate `<script>`, `a`, `button`, `input`, `select`, `textarea`,
|
|
65
|
+
`form`, `img`, `image`, `audio`, `video`, `canvas`, `iframe`, `object`, `embed`,
|
|
66
|
+
`foreignObject`, `use`, SVG animation, document metadata, or external resource
|
|
67
|
+
elements. The runtime removes those elements and every URL-bearing or event
|
|
68
|
+
handler attribute.
|
|
69
|
+
|
|
70
|
+
There is no JavaScript, Lucide runtime, CDN library, parent bridge,
|
|
71
|
+
`window.openai`, API access, storage, cookies, or authenticated context. A
|
|
72
|
+
visual that depends on any of them is not a Rudder inline visual.
|
|
73
|
+
|
|
74
|
+
## CSS
|
|
75
|
+
|
|
76
|
+
Use host classes first:
|
|
77
|
+
|
|
78
|
+
- Layout: `.viz-grid` and `.viz-row`. `.viz-controls` is also available as a
|
|
79
|
+
wrapping layout class, but it does not make removed buttons, inputs, selects,
|
|
80
|
+
or other active controls usable.
|
|
81
|
+
- Summaries: `.card`, `.viz-stat`, `.viz-stat-value`, `.viz-badge`.
|
|
82
|
+
- Text: `.text-small`, `.text-muted`, `.text-destructive`, `.sr-only`.
|
|
83
|
+
- Tooltip: add `data-tooltip="Concise detail"` to `<summary>` for hover and
|
|
84
|
+
keyboard-focus behavior. On another preserved element it is hover-only, so
|
|
85
|
+
keep essential information visible elsewhere.
|
|
86
|
+
|
|
87
|
+
The host provides theme variables including `--background`, `--foreground`,
|
|
88
|
+
`--card`, `--card-foreground`, `--popover`, `--popover-foreground`, `--primary`,
|
|
89
|
+
`--primary-foreground`, `--secondary`, `--secondary-foreground`, `--muted`,
|
|
90
|
+
`--muted-foreground`, `--accent`, `--accent-foreground`, `--destructive`,
|
|
91
|
+
`--border`, `--input`, `--ring`, `--font-size-base`, `--radius`, and
|
|
92
|
+
`--viz-series-1` through `--viz-series-6`.
|
|
93
|
+
|
|
94
|
+
Custom `<style>` content is bounded to eight style blocks and 32 KiB total.
|
|
95
|
+
Use ordinary rules and responsive `@media` rules only. The sanitizer removes
|
|
96
|
+
custom properties, URL values, imports, fonts, namespaces, keyframes, property
|
|
97
|
+
registrations, malformed CSS, unknown functions, and unsupported declarations.
|
|
98
|
+
Inline `style` attributes are always removed.
|
|
99
|
+
|
|
100
|
+
Safe custom CSS commonly uses grid or flex layout, spacing, borders, text,
|
|
101
|
+
theme colors, dimensions, responsive media queries, and static transforms. Keep
|
|
102
|
+
selectors scoped beneath `#widget` and keep the result useful without animation.
|
|
103
|
+
|
|
104
|
+
## Responsive And Accessible Output
|
|
105
|
+
|
|
106
|
+
- Support widths from 736px down to 320px without horizontal overflow.
|
|
107
|
+
- Use responsive SVG view boxes and `max-width: 100%` behavior.
|
|
108
|
+
- Reserve enough space for the longest labels and values.
|
|
109
|
+
- Give charts and diagrams a screen-reader name and, when useful, description.
|
|
110
|
+
- Use tables when exact values matter more than spatial comparison.
|
|
111
|
+
- Pair every color encoding with text, shape, or another non-color cue.
|
|
112
|
+
|
|
113
|
+
See `../assets/example-chart.html` for a minimal contract-valid fragment. Its
|
|
114
|
+
data is illustrative; reuse the structure, not the values.
|