Date: 2026-12-02
openapi.json is the accepted snapshot of the upstream opencode OpenAPI 3.1 document
(ADR-0005). The SDK is built against this snapshot, never against a live branch; the pin is
taken at an upstream release tag. Refresh policy is receipt-governed (ADR-0020): a refresh
consumes an exact commit, normally with an empty patch list, and temporary Restore patches may
repair upstream projection loss under review receipts. spec/receipt.json is the committed
receipt of the current accepted snapshot; active patches live under spec/patches/ beside
their hash-pinned manifests.
| Fact | Value |
|---|---|
| Upstream file | packages/protocol/openapi.json |
| Upstream release tag | v2.4.3 |
| Commit | 4e517ca4987fd57daffef1b47dd16c31c165b114 |
| Upstream product channel | npm @opencode/cli@latest (channel latest); this tag published as 2.4.3, installing the opencode command (plus the transitional opencode2 alias) |
Upstream publishes from the @opencode/cli npm scope on the latest channel, versioned as
semver release tags (v2.0.0…). This pin is the release tag v2.4.3, so
npm install -g @opencode/cli@2.4.3 installs a server built from exactly this commit; later
releases usually work but are not what this repository tests. beta and dev tags still exist
upstream but are not the release channel. The former @opencode-ai/cli scope is frozen: its
next and latest tags stopped at 0.0.0-beta-17823 (published 2026-08-21) and the scope
received no publish after 2026-09-07, so its next dist-tag never publishes again and that
install line no longer reaches a server this SDK can drive.
openapi.json is derived from upstream's own generator output, so upstream's MIT notice
travels with it in THIRD-PARTY-NOTICES.md.
Platform evidence for the OpenCode 2.x line: internal research, 2026-08-16, "The opencode v2 platform: branch, surface, architecture, distribution".
The refresh-spec synchronizer owns refreshes (ADR-0020):
dotnet run --file tools/opencode-tool.cs -- refresh-spec --ref <commit-ish>prepares a candidate: it resolves the reference once to a full SHA and produces the normalized document by running the exact pinned upstream generator, over the ordered Restore patches whenspec/patches/has any — never by copying upstream's committed document — writing the receipt and document to.scratchpad/refresh/<sha>/without touching accepted state. A patch whose repair predicate raw upstream already satisfies refuses, forcing an empty-patch retirement refresh. The production policy owns this rule.- Review the receipt: identity, hashes, operation delta, patch preimages, and prepare's
Moved forandLost anchor forlines. A line foropencode-agents-aigoes to that product; a lost anchor of either owner refuses apply until the anchor is rewritten. refresh-spec --apply <receipt.json>requires a receipt prepared at a named release tag; a commit-only candidate is a dry run, not an applicable pin. Apply validates the candidate and this file's managed identity text before changing accepted artifacts, then installsspec/openapi.json, renders this file's identity table and pin-bearing prose from the receipt and its date from the injectedTimeProvider's UTC date at apply time, moves theexternal/opencodesubmodule checkout to the same commit, re-pinsspec/source-watch.jsonfor any watched hash that moved, and writesspec/receipt.json; it stages and commits nothing. Until the moved submodule gitlink is staged or committed, the Sdk tests refuse to start: their pinned-server prerequisite compares the gitlink recorded in the index with the checked-out submodule. A fresh worktree on a commit that carries the new gitlink passes aftergit submodule update --init --depth 1 external/opencode.
Prepare also observes every entry of spec/source-watch.json at the candidate commit and records
its hash and the verdict of each anchor in the receipt's watchedSources; verify checks those pins against the
submodule checkout and apply re-pins them, so an upstream change under code that this SDK or a product
in its family depends on is reviewed before the snapshot moves.
- Run
generate; resolve what it reports (wall admits, curation rows) and review the regenerated diff.refresh-spec --verifyreproduces the committed identity observationally. - After the refresh merges, run the distributed-build consumer leg as
docs/engineering/quality-gates.mddescribes.