Skip to content

Views

The agent can show results next to the chat, not only as text (SI-548). Ask “show me this week’s top Signal items about AI”, and a card list of those items opens in the page while the chat stays on the left. Pin a view to keep it under Views in the rail (5; on phones under Settings → Pages). A pinned view shows today’s items each time you open it.

You can also make and change views without the agent: Pin as view in the stream keeps its filters as a view, and Edit on a pinned view changes what it shows (By hand).

Code: agent/views.ts (the spec, its check, filling it in, saved views), the show_view tool in agent/tools.ts, the page in ViewCanvas.svelte.

Blocks

A view has a title and one to six blocks. There are six kinds, and no others:

Block Shows The spec says
card_list Item cards: image, title, source, date, summary, scores Items by item_ids (at most 20), or a question: about, tag, topic, since_days, sort, min_signal, min_facts, max_hype, unread_only, limit
story An item and every other source that reported its story item_id
comparison 2–4 items side by side: source, date, scores, keywords, summary item_ids
table Rows and columns columns (at most 6), rows of text or numbers (at most 50)
chart Bars for categories, a line for a time series kind, labels (at most 31), series (at most 3, a value per label), unit
keyword_cloud Your keywords, larger on more items, colored by weight limit

Each block can have its own title.

about is the name of one of your keywords, or else words for full-text search. With the keyword, the card list shows items with that keyword. Without one, it searches your items for the words, as search.md does, and leaves out what the gate filtered and what a filter mutes. The page says which one it used. tag and topic are the names of one of your tags and topics, in any case: only items of the sources with that tag, and only items with a keyword in that topic, also in a full-text search. A name you don’t have (a renamed tag) shows an empty list that says so. sort is foryou (the default), newest, signal, facts or hype, as in the stream.

By hand

  • Pin as view in the stream’s lede, when a tag, a keyword, a topic, an order or a score bound is set: a view with one card list of those filters, Unread as unread_only, 20 items. It’s named after them (““Svelte” from “Tech”, most Signal first”) and opens at once. A sort or bound by one of your checks has no place in a view yet: the button says so instead.
  • Edit on a pinned view: its title, and for each card list that finds its items, its heading, about (with your keywords to pick from), tag, topic, last N days, order, score bounds, unread only and how many. A keyword cloud’s heading and size. What the agent picked or wrote (items by ID, a story, a comparison, a table, a chart) stays as it is. The page previews the draft a moment after each change, through /api/v1/views/resolve, and Save keeps it; Cancel leaves the view as it was.
  • A pinned view’s title is its own: renaming it renames the page’s heading too.

The agent writes a spec, never HTML

  • The agent calls show_view with the view’s spec as JSON. A single JSON Schema (VIEW_SPEC_SCHEMA) is both the tool’s parameters and the check every spec passes. pi-durable checks the call against it, and the tool checks it again, along with what the schema can’t express: a table row has one cell per column, a series has one value per label, and a card list takes item_ids or a question, not both.
  • Items come from your stream. The spec names items by ID or describes them with a question. Their titles, summaries, links and images are looked up for the reader the conversation belongs to. An item ID that isn’t in your stream shows nothing, and the block says how many are missing. Only tables and charts carry the agent’s own text and numbers.
  • Everything is shown as text. The page has no {@html}, so a cell that says <b> shows <b>.
  • The agent learns what it showed in counts: “a card list of 3 items from a full-text search”. It doesn’t get the items’ titles back, so feed text has no new way to reach it (agent-tools.md).

Invalid specs fail safely

  • From the agent: the tool call fails with every problem and where it is (/blocks/0/rows/0: 1 cells, expected 2). Nothing is shown. The transcript shows “Show view: failed” with the reason, and the agent can fix the spec and try again.
  • Stored specs are checked again whenever they are read: a tool result in the chat, and a pinned view. A spec that no longer passes, for example after the blocks change, isn’t shown. A pinned one opens with “This view can’t be shown” and the problems.
  • From a client: the API answers 422 with problems.

Where it shows

  • A view the agent shows while the panel is open opens at /views/chat/<message>, in the page next to the chat. Opening the panel on an older chat doesn’t take you anywhere.
  • The tool’s line in the transcript has Open “”</strong>, which opens it again.</li> <li><strong>Pin</strong> keeps it (<code>saved_views</code>, migration <code>0025_saved_views</code>): its spec, not its items. Pinning the same spec twice keeps one. You can pin up to 50 views. <strong>Unpin</strong> removes it.</li> <li>The chat keeps its newest 100 messages in view. An older view is gone from the chat: pin the ones you want to keep.</li> </ul> <h2 id="api">API</h2> <table> <thead> <tr> <th></th> <th></th> </tr> </thead> <tbody> <tr> <td><code>POST /api/v1/views/resolve</code></td> <td><code>{ spec }</code> → <code>{ view }</code>: the blocks with your items, stories and keywords filled in. Changes nothing, so a read token may call it too. <code>422</code> <code>{ error: "invalid", problems }</code></td> </tr> <tr> <td><code>GET /api/v1/views</code></td> <td><code>{ views: [{ id, title, spec, problems, createdAt, updatedAt }] }</code>, newest first. <code>spec</code> is null when it no longer passes the check</td> </tr> <tr> <td><code>POST /api/v1/views</code></td> <td><code>{ spec, title? }</code> → 201 <code>{ view }</code>. The same spec again returns the view already pinned. <code>409</code> over 50</td> </tr> <tr> <td><code>GET /api/v1/views/:id</code></td> <td><code>{ view, resolved }</code>, <code>resolved</code> with today’s items, or null for an invalid spec</td> </tr> <tr> <td><code>PATCH /api/v1/views/:id</code></td> <td><code>{ title?, spec? }</code> → <code>{ view }</code>: renames it, changes its spec, or both. <code>422</code> with <code>problems</code> for an invalid spec</td> </tr> <tr> <td><code>DELETE /api/v1/views/:id</code></td> <td>204. <code>404</code> for another reader’s view</td> </tr> </tbody> </table> <p>Chat messages of <code>show_view</code> carry the spec as <code>view</code> (<a href="/docs/chat/#api">chat.md</a>). The SDK: <code>resolveView(spec)</code>, <code>savedViews()</code>, <code>savedView(id)</code>, <code>saveView(spec, title?)</code>, <code>updateView(id, { title?, spec? })</code>, <code>deleteView(id)</code>, and the <code>viewSpec</code> schema for clients that build one.</p> <h2 id="charts">Charts</h2> <p>One axis, at most three series in the fixed order of the <code>--chart-1</code> … <code>--chart-3</code> tokens (the firefly, sky and ember hues in the dark lightness band, checked with the dataviz palette validator against <code>--night-1</code>). Two series or more get a legend. Hovering a column shows its values. <strong>Numbers</strong> opens them as a table.</p> <h2 id="not-yet">Not yet</h2> <ul> <li>Adding, removing and reordering blocks by hand, and making a view from nothing in the page: pin a stream or ask the agent.</li> <li>Views on phones: the agent panel is hidden there, but pinned views work.</li> <li>More blocks, and views the agent updates as the chat goes on.</li> </ul> </div><footer class="sl-flex" data-astro-cid-n5bb73zb><div class="meta sl-flex" data-astro-cid-n5bb73zb></div><div class="pagination-links print:hidden" dir="ltr" data-astro-cid-jpihjwyt><a href="/docs/stream/" rel="prev" data-astro-cid-jpihjwyt><svg data-astro-cid-jpihjwyt="true" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;" data-astro-cid-i7xblkan><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span data-astro-cid-jpihjwyt>Previous<br data-astro-cid-jpihjwyt><span class="link-title" data-astro-cid-jpihjwyt>Stream</span></span></a><a href="/docs/search/" rel="next" data-astro-cid-jpihjwyt><svg data-astro-cid-jpihjwyt="true" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;" data-astro-cid-i7xblkan><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span data-astro-cid-jpihjwyt>Next<br data-astro-cid-jpihjwyt><span class="link-title" data-astro-cid-jpihjwyt>Search</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>