Skip to content

Commit 5c6b627

Browse files
chore: raise amplifier-agent floor to 0.12.0, document raw LLM payload capture (0.4.0) (#20)
* chore: raise amplifier-agent floor to 0.12.0 (0.4.0) --host-config has always been forwarded verbatim to `amplifier-agent serve --config`, but below agent 0.12.0 the agent's HTTP face dropped the file's provider.config block on every turn: _session_runner cleared mount_plan["providers"] before per-request injection and called inject_provider with no extra_config. So the flag silently did less under `serve` than the same file does under `run`. 0.12.0 is the first version where it actually applies. This also makes the agent's new debug.rawLlmPayloads key reachable from here. Below 0.12.0 the agent's closed top-level schema rejects it outright as an unknown key, so a user following our --host-config docs would get a hard config error rather than raw payload capture. No launcher change was needed. The passthrough was already correct (cli.py forwards --host-config as --config, covered by tests/test_host_config.py); only the engine it points at had to catch up. AGENT_PINNED_REF derives from MIN_AGENT_VERSION, so the launch-time auto-install and self-heal now target v0.12.0. README, docs/E2E_TESTING.md, and the prereqs rationale comment updated to match. The comment keeps the older floors on record (0.11.0 for namespaced reseller model ids, 0.10.0 for /v1/skills and /v1/modes, 0.9.3 for auth set --stdin) since each is still the reason a distinct feature works. Requires amplifier-agent 0.12.0, which is not yet tagged upstream. 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com> * docs: document raw LLM payload capture via --host-config Adds a "Capture raw LLM requests and responses" section under Advanced usage, next to the existing --host-config docs, since that is the mechanism users already know for configuring the engine. Covers the host_config.json to write, the events.jsonl path the payloads land in, and a snippet for reading fields out of it. The snippet is there because those lines are large enough that opening the file whole is a bad first move; it was run against a live DTU session rather than written from memory. Three warnings are called out rather than left to be discovered: the capture is unredacted full conversation text on disk with no size cap, the value must be a real JSON boolean, and github-copilot accepts the flag but only emits counts and lengths so it will not produce bodies. Troubleshooting gains a pointer to it, plus the three log paths. The doctor covers "is the stack healthy"; nothing there helps when the stack is fine but a reply is wrong, which is exactly when this feature is wanted. 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com> --------- Co-authored-by: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
1 parent d1bc3c2 commit 5c6b627

6 files changed

Lines changed: 108 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@ in 0.2.0.
1010

1111
## [Unreleased]
1212

13+
## [0.4.0] — 2026-07-29
14+
15+
### Changed
16+
17+
- **Agent floor and pinned ref raised to 0.12.0.** `--host-config` has always
18+
been forwarded to `amplifier-agent serve --config`, but below 0.12.0 the
19+
agent's HTTP face dropped the file's `provider.config` block on every turn, so
20+
the flag silently did less under `serve` than it does under `run`. 0.12.0 is
21+
the first version where it actually applies. This also makes the agent's new
22+
`debug.rawLlmPayloads` key reachable from opencode: below 0.12.0 it is
23+
rejected as an unknown top-level key. No launcher change was needed — the
24+
passthrough was already correct; only the engine it points at had to catch up.
25+
1326
## [0.3.0] — 2026-07-29
1427

1528
### Added

README.md

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,19 @@ Common failures and their fix:
254254
| `Could not run \`amplifier-agent providers list --json\`` | Install/upgrade amplifier-agent so the doctor command can query it |
255255
| `opencode config ... is malformed JSON` | Open `~/.config/opencode/opencode.jsonc`, fix or delete it, retry |
256256

257+
If the stack is healthy but a *reply* is wrong, the doctor cannot help. To see
258+
exactly what was sent to the model and what came back, see
259+
[Capture raw LLM requests and responses](#capture-raw-llm-requests-and-responses)
260+
under Advanced usage.
261+
262+
Logs, when you need them:
263+
264+
```
265+
<tempdir>/amplifier-agent.log the backend server's stdout/stderr
266+
~/.local/share/opencode/log/opencode.log opencode's own log
267+
~/.amplifier-agent/state/workspaces/ per-session state and event logs
268+
```
269+
257270
---
258271

259272
## Advanced usage
@@ -291,7 +304,7 @@ Why: `git` is required because amplifier-agent and amplifier-app-opencode are
291304
installed via `git+https://...` URLs (neither is on PyPI yet). `curl` is
292305
required by the uv and opencode one-line installers.
293306

294-
#### 1. amplifier-agent — the backend server (>= 0.11.0 required)
307+
#### 1. amplifier-agent — the backend server (>= 0.12.0 required)
295308

296309
`amplifier-agent` is the OpenAI-compatible HTTP server this adapter talks to.
297310
Use the official one-line installer — it pulls the latest released binary and
@@ -300,19 +313,19 @@ primes the bundle cache so the first run is instant:
300313
```bash
301314
curl -fsSL https://raw.githubusercontent.com/microsoft/amplifier-agent/main/install.sh | bash
302315

303-
# to pin a specific version instead of latest (must be >= 0.11.0, the floor
316+
# to pin a specific version instead of latest (must be >= 0.12.0, the floor
304317
# amplifier-opencode enforces):
305-
# curl -fsSL https://raw.githubusercontent.com/microsoft/amplifier-agent/main/install.sh | bash -s -- --tag v0.11.0
318+
# curl -fsSL https://raw.githubusercontent.com/microsoft/amplifier-agent/main/install.sh | bash -s -- --tag v0.12.0
306319

307320
# ensure ~/.local/bin is on PATH, then verify:
308-
amplifier-agent version --json # → {"version":"0.11.0","protocolVersion":"0.3.0"}
321+
amplifier-agent version --json # → {"version":"0.12.0","protocolVersion":"0.3.0"}
309322
```
310323

311324
The installer needs [`uv`](https://docs.astral.sh/uv/) and `curl` on PATH and
312325
will tell you exactly what to install if either is missing — it will not
313326
bootstrap them silently.
314327

315-
> **Version requirement: `amplifier-agent >= 0.11.0` is mandatory.** Older
328+
> **Version requirement: `amplifier-agent >= 0.12.0` is mandatory.** Older
316329
> versions lack the pieces amplifier-opencode depends on (the `serve
317330
> chat-completions` HTTP face, multi-provider routing, the `auth` subcommand,
318331
> the `/v1/skills` and `/v1/modes` routes the skills and modes bridges read,
@@ -469,6 +482,66 @@ amplifier-opencode launch --host-config /path/to/host_config.json
469482
470483
See [amplifier-agent's host_config documentation](https://github.com/microsoft/amplifier-agent) for the full schema.
471484
485+
### Capture raw LLM requests and responses
486+
487+
When you need to see exactly what went to the model and came back (debugging a
488+
bad reply, a tool call that misfired, or a prompt that did not look the way you
489+
expected), turn on raw payload capture in your `host_config.json`:
490+
491+
```json
492+
{
493+
"provider": { "module": "anthropic" },
494+
"debug": { "rawLlmPayloads": true }
495+
}
496+
```
497+
498+
```bash
499+
amplifier-opencode launch --host-config /path/to/host_config.json
500+
```
501+
502+
Every turn then records the complete outbound request (full message list, system
503+
prompt, and tool schemas) and the complete response (content blocks, usage,
504+
stop reason) into the session's event log:
505+
506+
```
507+
~/.amplifier-agent/state/workspaces/opencode/sessions/http-<session-id>/context-intelligence/events.jsonl
508+
```
509+
510+
The payloads ride on the `llm:request` and `llm:response` events under a `raw`
511+
key. Those lines are large, so pull the fields you want rather than opening the
512+
file whole:
513+
514+
```bash
515+
# summarize the most recent session's captured request and response
516+
python3 - <<'PY'
517+
import glob, json, os
518+
f = max(glob.glob(os.path.expanduser(
519+
"~/.amplifier-agent/state/workspaces/opencode/sessions/*/context-intelligence/events.jsonl"
520+
)), key=os.path.getmtime)
521+
for line in open(f):
522+
e = json.loads(line); d = e.get("data") or {}
523+
if isinstance(d, dict) and "raw" in d and e.get("event", "").startswith("llm:"):
524+
print(e["event"], "->", sorted(d["raw"])[:8])
525+
PY
526+
```
527+
528+
Three things to know before you turn this on:
529+
530+
- **It writes your full conversation text to disk, unredacted.** Secret
531+
redaction matches by key name only and never scans string values, so prompts,
532+
tool results, and file contents are stored as-is. There is no truncation and no
533+
size cap. Do not leave it on for routine work, and be careful where those
534+
session directories end up.
535+
- **The value must be a real JSON boolean.** `"true"` as a string is rejected
536+
with a config error rather than silently accepted.
537+
- **Coverage depends on the provider.** `anthropic`, `openai`, and
538+
`azure-openai` record full payloads. `ollama` records full payloads but does
539+
not redact secrets. `github-copilot` accepts the flag but only emits counts and
540+
lengths, so it will not give you prompt or response bodies.
541+
542+
Requires `amplifier-agent >= 0.12.0`. Older versions reject `debug` as an unknown
543+
config key, and their HTTP face ignored `provider.config` entirely.
544+
472545
### Point at a different amplifier-agent
473546
474547
```bash

docs/E2E_TESTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Transitive runtimes:
7272

7373
The provisioned DTU installs `opencode` at a pinned version (`1.17.20`), plus
7474
`amplifier-agent` (from latest main; must satisfy amplifier-opencode's minimum,
75-
currently `>= 0.11.0`) and `amplifier-opencode`, plus `git`, `curl`, `uv`, and `tmux`.
75+
currently `>= 0.12.0`) and `amplifier-opencode`, plus `git`, `curl`, `uv`, and `tmux`.
7676

7777
## Running
7878

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "amplifier-app-opencode"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
description = "Launch the opencode TUI with auto-discovered amplifier-agent models — checks/starts the chat-completions server, queries /v1/models, writes opencode.json, exec's opencode."
55
readme = "README.md"
66
requires-python = ">=3.11"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""amplifier-app-opencode — launch opencode with auto-discovered amplifier-agent models."""
22

3-
__version__ = "0.3.0"
3+
__version__ = "0.4.0"

src/amplifier_app_opencode/prereqs.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,20 @@
5252
OPENCODE_INSTALL_SH = "https://opencode.ai/install"
5353
OPENCODE_NPM_PACKAGE = "opencode-ai"
5454

55-
# Minimum amplifier-agent version amplifier-opencode requires. >= 0.11.0 is the
56-
# first version that namespaces reseller model ids (`github-copilot/<model>`).
57-
# Below it, Copilot serves `claude-sonnet-5` and `claude-opus-5` under ids
58-
# byte-identical to the native anthropic provider's, and whichever provider is
59-
# enumerated last silently captures the other's traffic. Since we document the
60-
# Copilot setup, the floor has to be the version where that is safe.
61-
# (0.10.0 remains the floor for `GET /v1/skills` and `GET /v1/modes`, which the
62-
# skills and modes bridges read; 0.9.3 for `auth set --stdin`, which onboarding
63-
# uses to hand the provider key to the agent off-argv. 0.11.0 subsumes both.)
64-
MIN_AGENT_VERSION = "0.11.0"
55+
# Minimum amplifier-agent version amplifier-opencode requires. >= 0.12.0 is the
56+
# first version whose HTTP face honours `provider.config` from the host config
57+
# we pass via `--host-config`. Below it, `serve` accepted the file but dropped
58+
# that block on every turn, so `--host-config` silently did less than it does
59+
# under `run` -- and `debug.rawLlmPayloads` is rejected outright as an unknown
60+
# key. Since we document `--host-config` as the way to configure the engine, the
61+
# floor has to be the version where it actually applies.
62+
# (0.11.0 remains the floor for namespaced reseller model ids
63+
# (`github-copilot/<model>`), without which Copilot's `claude-sonnet-5` collides
64+
# with the native anthropic provider's; 0.10.0 for `GET /v1/skills` and
65+
# `GET /v1/modes`, which the skills and modes bridges read; 0.9.3 for
66+
# `auth set --stdin`, which onboarding uses to hand the provider key to the
67+
# agent off-argv. 0.12.0 subsumes all three.)
68+
MIN_AGENT_VERSION = "0.12.0"
6569
# The silent, launch-time auto-install/self-heal targets this exact known-good
6670
# git tag rather than a moving branch, so a reliability tool never drags users
6771
# onto un-vetted ``main``. Kept in lockstep with MIN_AGENT_VERSION: to adopt a

0 commit comments

Comments
 (0)