App: dark-aware HTML views, run cards, changed/missing file notes, one card width, dense diff rows

show_html documents that declare dark support follow the app theme; others
stay light. Tool description and skill docs say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-02 19:54:58 +00:00
parent d204ce3187
commit f02ff56dfe
27 changed files with 1086 additions and 61 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ only when asked). Stage use: `references/format.md`.
## In a Pipelines chat
A chat's agent has a `pipelines` MCP server: `show_file`, `show_image`,
`show_html` (follows the operator's light/dark theme), `show_diff` (show the
`show_html` (follows the light/dark theme when it styles for dark), `show_diff` (show the
operator changes, e.g. before a pull request; `head`, `paths`), `show_run` (a
live run card), `schedule_followup` (come back to this chat later) and `notify`
(phone, only when the operator must look now). Show instead of telling the
+1 -1
View File
@@ -21,7 +21,7 @@ regenerate, or a file you rewrote.
| --- | --- | --- |
| `show_file` | `path`, `title?`, `replace?` | Any file the operator should see: images inline, other files as a preview card. Use instead of naming a path. A file up to 5 MiB is copied when shown, so the card keeps that version; a larger one stays linked and its card says "changed since shown" or "no longer exists". |
| `show_image` | `url_or_path`, `title?`, `alt?`, `replace?` | A home `image/*` file, or an `https://` URL that Pipelines downloads and keeps (public hosts only, PNG/JPEG/GIF/WebP/AVIF/BMP, at most 10 MiB, no credentials, no redirect to plain http). A failed download is an error and nothing is shown. |
| `show_html` | `html`, `title?`, `height_hint?` (120-600), `replace?` | Self-contained HTML/SVG: diagrams, charts, tables. Sandboxed: no JavaScript, no network; inline CSS/SVG, `<details>`, `:hover`. Follows the operator's light/dark theme: style both with `@media (prefers-color-scheme: dark)` or `Canvas`/`CanvasText`, or set your own background and text colours. Refused above 512 KiB. |
| `show_html` | `html`, `title?`, `height_hint?` (120-600), `replace?` | Self-contained HTML/SVG: diagrams, charts, tables. Sandboxed: no JavaScript, no network; inline CSS/SVG, `<details>`, `:hover`. Follows the operator's light/dark theme only when it declares dark support: `@media (prefers-color-scheme: dark)`, `color-scheme` or `light-dark()`; anything else is always shown light, on white. Refused above 512 KiB. |
| `show_diff` | `path?`, `base?`, `head?`, `paths?`, `committed_only?`, `title?`, `replace?` | A Git diff card when the operator asks to see the changes, or before submitting a pull request. No `base`: uncommitted work (staged, unstaged, untracked) against HEAD. `base` (e.g. `main`): everything since the merge base, which is what a PR contains, plus uncommitted work unless `committed_only`. `head` (e.g. `pipelines/run-123`): that revision instead of the work tree, against `base` or HEAD. `paths`: repository-relative files, directories or globs (`*.go`), at most 50. Pipelines runs Git; do not paste the diff. |
| `show_run` | `run_id`, `title?`, `replace?` | A live card for a run: pipeline, title, status, current stage, duration; it updates as the run progresses and opens the run when tapped. |
| `schedule_followup` | `message`, `at?` or `after_minutes?` | Queue a prompt to yourself in this chat, 1 minute to 7 days ahead (`at` is RFC 3339). It is a scheduled message from "Agent follow-up" the operator can remove; it does not hold the operator's own messages back, and is delivered when the chat is free at that time. At most 3 pending per chat. Do not wait for it in the current turn. |
+3 -3
View File
@@ -112,9 +112,9 @@ func definitions() []toolDefinition {
Description: "Render a self-contained HTML or SVG document inline in the Pipelines chat: diagrams, charts, tables, small visual views. " +
"It is shown in a sandbox with no scripts, no network and no access to the app: use inline CSS and inline SVG, " +
"<details> for expandable parts and CSS :hover for interaction; JavaScript does not run and external resources do not load. " +
"The view follows the operator's light or dark theme (color-scheme and prefers-color-scheme): style for both with " +
"@media (prefers-color-scheme: dark) or CSS system colors (Canvas, CanvasText), or set your own background and text colors; " +
"unstyled text uses the theme's default colors. " +
"A document that supports dark mode follows the operator's light or dark theme: style for both with " +
"@media (prefers-color-scheme: dark), a color-scheme declaration or light-dark() colors (with color-scheme, " +
"unstyled text and the page use the theme's Canvas/CanvasText). A document without any of these is always shown light, on white. " +
"The operator can open it full screen. At most 512 KiB. The result names the item's id: pass it as replace to update the view.",
InputSchema: objectSchema([]string{"html"}, map[string]any{
"html": stringProperty("The complete HTML (or a bare <svg>) document."),
+1 -1
View File
@@ -83,7 +83,7 @@ func (s *chatToolService) run(ctx context.Context, sessionID, tool, id string, a
return fail("Nothing was shown: html is not valid UTF-8.")
}
item := protocol.ChatShownItem{Kind: protocol.ChatShownHTML, Title: boundedLine(in.Title, 200), HTML: in.HTML, HTMLBytes: len(in.HTML), HeightHint: clampHeightHint(in.HeightHint)}
return &item, chattools.Result{Text: fmt.Sprintf("Shown in the operator's Pipelines chat (%s, sandboxed: scripts and network are disabled; it follows the operator's light or dark theme).", humanBytes(int64(len(in.HTML))))}
return &item, chattools.Result{Text: fmt.Sprintf("Shown in the operator's Pipelines chat (%s, sandboxed: scripts and network are disabled; it follows the operator's light or dark theme only if it styles itself for dark mode).", humanBytes(int64(len(in.HTML))))}
case chattools.ToolShowDiff:
var in struct {
Path string `json:"path"`