opencode/packages
Shoubhit Dash a4cec2c78a refactor(ai): type each protocol's provider metadata round-trip
Every protocol wrote its own provider metadata onto stream events through
an untyped `providerMetadata(key, Record<string, unknown>)` one-liner —
copied verbatim into anthropic-messages, bedrock-converse and gemini — and
read it back in request lowering with `isRecord(x) && typeof x.signature
=== "string"`. Writer and reader of the same namespace never met at
compile time, so a typo on either side only showed up as a signature that
failed to round-trip.

`ProviderShared.providerMetadata(schema)` now pairs a typed `write` with a
synchronous `read` (`decodeUnknownOption`). Each of anthropic-messages,
bedrock-converse, gemini, open-responses and openai-chat declares one
`Schema.Struct` of the fields it publishes under its `providerMetadataKey`
and uses the pair; the hand-written readers are deleted, and
responses-compaction's raw metadata literal goes through the typed writer.

Fields use `lenient` because the old readers were independent per field:
a malformed `signature` never dropped `redactedData`. A new test pins
that. Every reader was probed against v2 for undefined/null/array/string/
empty-object metadata and unknown keys; behaviour is unchanged. Bedrock
keeps its own two-field struct rather than importing Anthropic's, since no
protocol depends on another protocol's internals. Raw usage passthroughs
stay raw: they forward each provider's usage object and are never read
back.
2026-09-18 19:49:06 +05:30
..
ai refactor(ai): type each protocol's provider metadata round-trip 2026-09-18 19:49:06 +05:30
app perf(app): load draft image bytes on demand (#49703) 2026-09-18 19:32:15 +10:00
cli sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
client sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
codemode sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
console sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
containers chore: bump Bun to 1.4.2 (#47446) 2026-09-05 01:21:42 -05:00
core refactor(core): move native compaction mechanisms into a plugin (#49575) 2026-09-18 17:15:44 +05:30
desktop sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
effect-drizzle-sqlite refactor(core): internalize effect sqlite adapter 2026-08-11 21:33:23 -04:00
enterprise sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
function sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
http-recorder sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
httpapi-codegen sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
identity
latex sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
merman sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
plugin sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
plugin-browser sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
posts refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
protocol sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
schema sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
script feat(release): isolate v2 stable publishing (#48546) 2026-09-11 15:50:35 -04:00
sdk sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
server sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
session-ui sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
simulation sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
stats sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
storybook feat(desktop): add SSH server connections (#47753) 2026-09-09 09:32:38 +08:00
theme sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
tui sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
ui sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
util sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00
web sync release versions for v2.0.8 2026-09-18 09:12:33 +00:00