Merge branch 'worktree-agent-abc9e7b0a4e0a0f54'

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-02 20:05:02 +00:00
49 changed files with 3067 additions and 133 deletions
+54
View File
@@ -100,6 +100,60 @@ The generic tool rows for `mcp__pipelines__*` (Claude), `pipelines_*`
visible. OpenCode V2 runs MCP tools from its code-mode `execute` script, and
that row stays visible because it can contain other code.
## Snapshots, replace, run cards and follow-ups (2026-12-02)
- **Argument validation.** `chattools.ValidateArguments` checks every call
against the tool's declared schema (the schemas say
`additionalProperties: false`): unknown or misnamed fields, missing required
ones and wrong types are refused with the expected field list, before any
effect. Each tool then decodes its own argument struct.
- **Item ids and `replace`.** Every `show_*` result ends with the item id.
`replace: <id>` (an item of this chat, same kind; file and image are one
family) stores the new item over the old one with the same `id` and
`created_at` plus `updated_at`; the client merges by id, so the card is
updated where it is.
- **File snapshots.** `show_file` / `show_image` copy a file up to 5 MiB into
`<data dir>/chat-shown/<session>/<id>-<nonce>/<name>` (inside home, so
`/files` serves it): `snapshot: true`, `source` = the path named. A larger
file stays live with `mod_time` and `sha256` (hash up to 64 MiB); the
subscribe reply sets `state: changed | missing`. Snapshot directories no
retained item references are swept (after a 1 minute grace).
- **Web images.** `show_image` with an https URL is downloaded by the server:
every dialed address (redirects included, checked after DNS resolution) must
be public unicast, no proxy, https-only redirects (at most 5), 20 s timeout,
PNG/JPEG/GIF/WebP/AVIF/BMP only (SVG refused) with content that sniffs as an
image, at most 10 MiB. The bytes become the item's snapshot; `url` keeps the
address. A failure is an error to the model and records nothing.
- **`show_run`.** A `run` item with `{id, pipeline, title, status, outcome,
current_stage, workspace, started_at, finished_at}`. The run event hub's
observer (`runEventHub.observe`) tells the tool service a followed run
changed; after 400 ms it rereads the run summary, stores a changed body over
the item and pushes it. The subscribe reply rereads followed runs too; a
finished run is no longer followed.
- **`show_diff`** takes `head` (compare that revision instead of the work tree,
against `base`'s merge base or HEAD) and `paths` (at most 50 relative
paths/globs; no `..`, absolute paths, leading `-` or `:`; passed as
`:(literal)` / `:(glob)` pathspecs).
- **`schedule_followup`** queues a durable prompt with `send_at` (1 minute to 7
days), operation id `followup-…`, sender label "Agent follow-up", at most 3
pending per chat. It is removable like any queued prompt. Unlike an
operator's scheduled prompt, a follow-up that is not due yet does not hold
the FIFO queue: `chatQueueHead` skips it, so the operator's prompts go
through.
- **HTML theme.** A document that declares dark support
(`prefers-color-scheme`, `color-scheme` or `light-dark()`) is shown in the
app's theme (not the system's): `artifact_html_theme.dart` inserts a
`color-scheme` meta naming that scheme and rewrites each
`prefers-color-scheme` query to always/never match, and the web frame gets the
same `color-scheme` (canvas `Canvas` when dark). Any other document stays
light on white, since its colours were chosen for that. The tool description
tells the model so.
- **Cards.** Every shown card is held to one width (`chatShownCardMaxWidth`,
720). Diff file rows are one dense line (path, counts). A run card shows
pipeline, title, status chip, `#id · stage · duration` (ticking while it
runs) and opens the run. File cards show "Changed since shown" / "No longer
exists" (a missing file loads and opens nothing).
## Per-harness registration
`server.ConfigureChatTools(store, addr)` runs at startup, before any harness