paseo-plugin-genui 0.3.2 → 0.3.3

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/OVERVIEW.md CHANGED
@@ -14,7 +14,7 @@ When automatic instructions are enabled, new agents receive the Generative UI co
14
14
  - **Confined file reading**: `Load(path)`, `Snippet(path, from, to)`, and `Image(path)` read JSON, CSV, TSV, logs, test reports (Vitest, Jest, JUnit), coverage (`lcov`, Istanbul, `coverage.py`, Go), lint and typecheck findings (ESLint, SARIF, `tsc`, Ruff), HAR traces, and benchmarks. Reads are strictly confined to the agent's workspace directory, its per-agent thread storage directory (`/tmp/opencode/genui-storage/<agentId>`), `/tmp`, and any extra folders added in settings.
15
15
  - **Live workspace and git state**: `Changes()`, `Commits()`, `PullRequest()`, `Threads()`, and `Environments()` read the workspace's git diff, commits, pull request status, subagents, and worktrees on the daemon host.
16
16
  - **Replies the user builds**: Agents can let you answer a card in your own words before anything is sent. A `Queue` button adds its text to your reply instead of sending it, `comments: true` adds a Comment action to each item of a Plan, Steps, List, Table, Findings, Decision or OptionCards, `editable: true` lets you rewrite an item's text, and `Other()` opens a free-form box. The queued parts from every card in the chat show in a composer pill, where you can remove them, send them, or clear them; the next Send sends them together with its own text as one message. The queue is kept in the app's local storage per chat. A message you type in Paseo's composer does not include the queue.
17
- - **Checked UI with the `render_ui` tool**: The plugin gives each agent a `render_ui` tool through Paseo's agent tools. The agent passes a `ui` spec and a one-sentence answer, which the plugin shows as text above the card; the daemon checks the spec (compile, file loads, render) and adds it to the chat only when it renders, otherwise it returns the errors so the agent fixes them in the same turn. The plugin approves `render_ui` permission prompts on its own, because the tool only reads files the plugin can already read and adds UI to the chat. Agents whose provider cannot reach Paseo's agent tools write `ui` blocks in their reply instead.
17
+ - **Optional `render_ui` tool**: Agents write `ui` blocks in their reply by default, and the plugin asks them once to fix a block that fails. The plugin also gives each agent an optional `render_ui` tool through Paseo's agent tools. The agent passes a `ui` spec and a one-sentence answer, which the plugin shows as text above the card; the daemon checks the spec (compile, file loads, render) and adds it to the chat only when it renders, otherwise it returns the errors so the agent fixes them in the same turn. The plugin approves `render_ui` permission prompts on its own, because the tool only reads files the plugin can already read and adds UI to the chat.
18
18
  - **Repair of broken blocks**: When an agent's turn ends, the daemon checks each `ui` block in its reply. If a block fails to compile, load a file, or render, the plugin sends the agent one follow-up message that starts with `[genui]` and lists the errors, and the agent replies with corrected blocks. It sends at most one such message per user message and skips subagents. The follow-up shows in the chat as a user message. Turning off automatic agent instructions in settings also turns this off.
19
19
  - **Sandboxed mini-apps**: `app` blocks run self-contained HTML and JavaScript inside a sandboxed iframe (`sandbox="allow-scripts"`) with a network-blocking Content Security Policy on desktop and web clients.
20
20
  - **Settings and web lookups**: Under **Settings -> Plugins -> Generative UI**, you can toggle automatic agent instructions for new sessions and toggle server-side web lookups, and add extra folders (for example `~/dev/scratch`) that file reads may use. When web lookups are on, the daemon fetches photo searches from Wikimedia Commons (`commons.wikimedia.org` / `upload.wikimedia.org`), geocoding from Photon (`photon.komoot.io`), map tiles from OpenStreetMap (`tile.openstreetmap.org`), and HTTPS images through an address-checked proxy that rejects loopback, private, and link-local IP addresses. No cookies, credentials, or conversation text beyond the specific search query or place name are sent. Turning web lookups off disables all external network requests.
package/README.md CHANGED
@@ -28,7 +28,7 @@ Requires Paseo 0.14.0 or later.
28
28
 
29
29
  ## What an answer looks like
30
30
 
31
- The agent passes a UI spec and a one-sentence answer to its `render_ui` tool. The plugin shows the answer as text above the card, so it reaches the user even when the agent wrote it only in its reasoning. The plugin checks the spec first and adds the card to the chat only when it renders; otherwise the tool returns the errors and the agent fixes them in the same turn. Agents without the tool write the same spec as a ```ui block in their reply, and the plugin asks them once to fix a block that fails.
31
+ The agent writes a UI spec as a ```ui block in its reply, after a plain answer sentence. If a block fails, the plugin asks the agent once to fix it. Agents can also pass a spec and a one-sentence answer to the optional `render_ui` tool, which checks the spec first and adds the card only when it renders; the plugin shows the answer as text above the card. Agents used UI far more often with blocks than with the tool, so blocks are the default.
32
32
 
33
33
  A spec looks like this:
34
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paseo-plugin-genui",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Paseo plugin: agents answer with charts, diagrams, maps, plans and forms rendered inline in the chat.",
5
5
  "keywords": [
6
6
  "paseo",
@@ -11,7 +11,7 @@ export const renderUiTool = defineAgentTool({
11
11
  name: "render_ui",
12
12
  title: "Show UI",
13
13
  description:
14
- "Show a ui spec to the user as live UI; use it instead of writing a ```ui block. The spec is checked first: if it has errors, nothing is shown and the errors come back. Fix them and call again without mentioning the errors or the retry to the user. Put the answer sentence in `answer`: it is shown as text above the UI, so do not also write it in the reply, and do not repeat the UI's content in text after it.",
14
+ "Optional: show a ui spec to the user as live UI, checked first. A ```ui block in the reply is the usual way; use this when the spec loads files you have not checked. If the spec has errors, nothing is shown and the errors come back. Fix them and call again without mentioning the errors or the retry to the user. Put the answer sentence in `answer`: it is shown as text above the UI, so do not also write it in the reply, and do not repeat the UI's content in text after it.",
15
15
  input: z.object({
16
16
  answer: z.string().min(1).describe("One plain sentence that gives the answer; shown above the UI"),
17
17
  spec: z.string().describe("The ui spec, without the ``` fence"),
@@ -77,7 +77,7 @@ Card("Dark mode", [Estimate([{title: "Theme tokens", low: 0.5, high: 1}, {title:
77
77
 
78
78
  export const AGENT_INSTRUCTIONS = `# Inline UI
79
79
  This chat renders \`\`\`ui and \`\`\`app code blocks as live UI, and the user prefers them to markdown. Use them only in replies to the user, including after a task; never in progress notes, files, commits, PR text or tool input.
80
- Show each ui spec with the render_ui tool instead of a \`\`\`ui block: call render_ui with the answer sentence in answer and the spec (no fence). It shows the UI only when the spec renders; otherwise it returns the errors, and you fix them and call again without telling the user. Write a \`\`\`ui block only when you have no render_ui tool. \`\`\`app blocks stay in the reply.
80
+ Write each ui spec as a \`\`\`ui block in your reply, after the answer sentence. If a block has errors, you get one request to fix it after the turn. The render_ui tool is optional: it checks a spec before showing it, so use it when a spec loads files you have not checked; put the answer sentence in its answer field. \`\`\`app blocks stay in the reply.
81
81
  Write \`\`\`ui instead of a markdown table, a comparison of options, a plan (dated items on a Calendar, status or effort as Steps), a series of numbers (chart it), a list of changed files or commits (Changes(), Changes(sha), Commits(), PullRequest() read them from Paseo), or pasted output: save it to $BB_THREAD_STORAGE and Load it into its component (Inline UI for code work, above). For a calculation (how much, what if), make the user's numbers sliders and a list of items with amounts an EditableTable, and compute the result live. To let the user pick, give buttons; to ask more than one question, one Form; never a question tool or a numbered list. When you explain how something works (a flow, a request path, a lifecycle), put it in a \`\`\`ui block, even when asked to be brief: a Diagram of the flow, the steps as Steps({title, detail}) instead of a numbered list in prose, and Snippets of the key lines; file:line references go in the step details. When the user asks to see code or where something is, answer with a Snippet of those lines; to see an image file, an Image. The user never sees what your tools read: a file or image you opened is not on their screen, and pasted code drifts. Open the reply with one plain sentence that gives the answer (previews show only text); the UI carries the rest, so never restate it.
82
82
  Match the content: a trip, places or a route → a Map of the stops, beside any day-by-day plan; a physical thing with parts → Hotspots on its image; a worked solution → Walkthrough; products or places → Entity cards in a Grid, the pages you read → Sources; activity per day → CalendarHeatmap; shares of a whole → SegmentedBar; a funnel → Chart("funnel"); colours → Swatches; picture options → OptionCards. Give a Diagram's key nodes details (text or a Snippet) so a click explains them. When the next steps are questions, end with FollowUps.
83
83
  Wrap each UI in one Card. Examples: