Files
pipelines/internal/author/skill/references/chat.md
T
2026-12-02 20:05:02 +00:00

68 lines
5.7 KiB
Markdown

# Working in a Pipelines chat
A Pipelines chat runs on OpenCode, Claude Code or Codex. The operator reads it in
the Pipelines app (desktop, web or phone), often not at this machine's terminal.
## Pipelines tools (`pipelines` MCP server)
Each `show_*` call adds a persisted item to the transcript and returns one short
line ending with the item's id; a refusal comes back as an error with the
reason. Arguments are checked against the tool's schema: an unknown or
misnamed field is refused with the list of expected fields. Paths must resolve
inside the operator's home (absolute, `~/...`, or relative to the chat's
directory).
Every `show_*` tool takes `replace?`: the id of an item this chat showed
earlier, of the same kind (file and image count as one). The card is updated
where it is instead of a new one being added; use it for a chart or diff you
regenerate, or a file you rewrote.
| Tool | Arguments | Use for |
| --- | --- | --- |
| `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 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. |
| `notify` | `title`, `message`, `priority?` | A notification on every Pipelines app the operator is signed in to (web tabs, desktop, Android) and their phone (ntfy); a tap opens this chat. Opening the chat, or tapping or dismissing it on any device, clears it on all of them. Pipelines already notifies when the reply ends and for questions and approvals, so use it only for news mid-turn or after background work the turn does not wait for; a turn that notified sends no separate "replied" notification. 5 per minute per chat; the result says where it went, and undelivered sends report why. |
`show_diff` lists at most 300 files; a file patch over 256 KiB or a total over
1 MiB is shown partially and says so; binaries have no patch; renames show as
delete plus add. `base` and `head` are plain revision names, and `paths` stay
inside the repository (no `..`, absolute paths or pathspec magic). Tools are absent when the
harness could not register them (logged); then name paths instead.
## References sent into the chat
The operator can send a run, a pipeline or a run artifact to a chat. It arrives
in the composer draft as text naming the run id, title, pipeline/version and,
for an artifact, stage, visit and a readable URL. Treat it as a pointer: read
`pipelines inspect RUN_ID --json` (or `pipelines show NAME --version N`) for the
authoritative record before acting.
## Questions and approvals
Claude Code questions appear as a form. The operator may pick an option, answer
in their own words, or dismiss it; a dismissal arrives as a denial saying they
will reply in the chat, so wait for that message. Question text, descriptions
and option descriptions render Markdown.
## Chat protocol (via `pipelines rpc -`)
Only when the user asks to drive another chat. Envelopes carry `type` and `id`:
- `chat_sessions`: the operator's chats (`id`, `directory`, `title`, `backend`).
- `chat_prompt` with `chat_prompt: {session_id, text, send_at?}`: sends a
prompt (at most 64 KiB). A busy chat queues it durably, in order, across
restarts. `send_at` (epoch milliseconds, future) holds it until that time;
prompts queued after it wait behind it.
- `chat_unqueue` with `chat_unqueue: {session_id, operation_id}` removes a
prompt not yet delivered.
- `chat_interrupt` with `chat_query: {session_id}` stops the current turn;
`chat_stop_tasks` (same body) stops background tasks without interrupting it.
Chat sessions are separate from pipeline run sessions; `pipelines chat-adopt
SESSION_ID [--harness opencode|claude|codex]` brings an existing harness session
into the chat list. Do not keep using an adopted session elsewhere.