From 947501e3052699c26665d57752b4499de479ad6d Mon Sep 17 00:00:00 2001 From: fylorn <249551762+fylorn@users.noreply.github.com> Date: Tue, 29 Sep 2026 02:26:28 +0800 Subject: [PATCH] chore: v0.55.0 Minor release for #223, #224, #226, #227, #228, #229, #230 and #231, and #222 before them. - Bump the workspace version to 0.55.0 - release-notes/0.55.0.md Control-plane protocol 28 (was 27): the protocol `bedrock`, ProviderInput.aws / ProviderView.aws (AwsKeys), ProviderView.region, ProviderPreview.region and AttemptView.model. The request store schema is unchanged (22), so the request history is kept. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 36 +++++++++++++++++----------------- Cargo.toml | 2 +- release-notes/0.55.0.md | 43 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 19 deletions(-) create mode 100644 release-notes/0.55.0.md diff --git a/Cargo.lock b/Cargo.lock index 8f422489..75e32b03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2743,7 +2743,7 @@ dependencies = [ [[package]] name = "tw-api" -version = "0.54.0" +version = "0.55.0" dependencies = [ "serde", "serde_json", @@ -2753,7 +2753,7 @@ dependencies = [ [[package]] name = "tw-bedrock" -version = "0.54.0" +version = "0.55.0" dependencies = [ "aws-credential-types", "aws-sigv4", @@ -2774,7 +2774,7 @@ dependencies = [ [[package]] name = "tw-breaker" -version = "0.54.0" +version = "0.55.0" dependencies = [ "serde", "serde_json", @@ -2782,7 +2782,7 @@ dependencies = [ [[package]] name = "tw-config" -version = "0.54.0" +version = "0.55.0" dependencies = [ "blake3", "libc", @@ -2807,7 +2807,7 @@ dependencies = [ [[package]] name = "tw-control" -version = "0.54.0" +version = "0.55.0" dependencies = [ "axum", "base64", @@ -2847,7 +2847,7 @@ dependencies = [ [[package]] name = "tw-dialect" -version = "0.54.0" +version = "0.55.0" dependencies = [ "serde", "serde_json", @@ -2855,7 +2855,7 @@ dependencies = [ [[package]] name = "tw-engine" -version = "0.54.0" +version = "0.55.0" dependencies = [ "serde", "serde_json", @@ -2868,7 +2868,7 @@ dependencies = [ [[package]] name = "tw-gateway" -version = "0.54.0" +version = "0.55.0" dependencies = [ "arc-swap", "async-stream", @@ -2916,7 +2916,7 @@ dependencies = [ [[package]] name = "tw-guard" -version = "0.54.0" +version = "0.55.0" dependencies = [ "base64", "regex", @@ -2929,7 +2929,7 @@ dependencies = [ [[package]] name = "tw-link" -version = "0.54.0" +version = "0.55.0" dependencies = [ "serde", "serde_json", @@ -2943,7 +2943,7 @@ dependencies = [ [[package]] name = "tw-observe" -version = "0.54.0" +version = "0.55.0" dependencies = [ "tokio", "tracing", @@ -2952,7 +2952,7 @@ dependencies = [ [[package]] name = "tw-pricing" -version = "0.54.0" +version = "0.55.0" dependencies = [ "arc-swap", "flate2", @@ -2965,14 +2965,14 @@ dependencies = [ [[package]] name = "tw-secret" -version = "0.54.0" +version = "0.55.0" dependencies = [ "thiserror", ] [[package]] name = "tw-store" -version = "0.54.0" +version = "0.55.0" dependencies = [ "bytes", "rusqlite", @@ -2989,7 +2989,7 @@ dependencies = [ [[package]] name = "tw-types" -version = "0.54.0" +version = "0.55.0" dependencies = [ "serde", "serde_json", @@ -2998,7 +2998,7 @@ dependencies = [ [[package]] name = "tw-watch" -version = "0.54.0" +version = "0.55.0" dependencies = [ "notify", "tempfile", @@ -3008,7 +3008,7 @@ dependencies = [ [[package]] name = "tw-yaml" -version = "0.54.0" +version = "0.55.0" dependencies = [ "saphyr-parser", "serde_yaml_ng", @@ -3018,7 +3018,7 @@ dependencies = [ [[package]] name = "twcore" -version = "0.54.0" +version = "0.55.0" dependencies = [ "anyhow", "axum", diff --git a/Cargo.toml b/Cargo.toml index 52ad396b..614c11b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,7 @@ categories = ["network-programming", "web-programming::http-server"] # 二进制走 CalVer,crate 走 SemVer —— 两者是两回事,卖给不同的人。 # 这里是 crate 的版本。 -version = "0.54.0" +version = "0.55.0" [workspace.dependencies] # ── 内部 crate ─────────────────────────────────────────── diff --git a/release-notes/0.55.0.md b/release-notes/0.55.0.md new file mode 100644 index 00000000..8c043558 --- /dev/null +++ b/release-notes/0.55.0.md @@ -0,0 +1,43 @@ +This release adds AWS Bedrock upstreams. Requests to them are converted to Converse and signed per request, and prompt-cache breakpoints and Claude's thinking now survive that conversion. Each request is priced by the model it was actually sent as, long-context prices follow the thresholds the price data gives, and an error an upstream reports partway through a stream now counts as a failure. + +**Upgrade notes** + +- The control-plane protocol version (`CONTROL_API_VERSION`) is now 28. ThinkWatch Lite connects only to a core with the same protocol version, and has to regenerate its protocol types from this release to use it. ThinkWatch Lite 2026.9.23 includes 0.54.0 (protocol 27) and does not connect to 0.55.0: a server used with it stays on 0.54.0 until the app is updated to a release that includes 0.55.0. `sudo twcore upgrade --version 0.54.0 --restart` switches a server back to 0.54.0. +- The request store's schema is unchanged (22): the request history is kept. +- Changed in the protocol: + - `Protocol` has `bedrock`. + - `ProviderInput.aws` and `ProviderView.aws` (`AwsKeys`): the access keys, or the name of an AWS profile, and the region to sign for. + - `ProviderView.region` and `ProviderPreview.region`: the region of a Bedrock upstream. + - `AttemptView.model`: the model an attempt sent when a routing rule rewrote it. +- New in the configuration: the protocol `bedrock` and `providers[].aws`. The 200K long-context threshold of a price sheet's `input_above_200k` and `output_above_200k` now counts cache reads and writes (see *Priced by the model that was sent*). +- New message codes: + - `config.credential.`: `bedrock_oauth`, `key_and_aws`, `bedrock_no_credential`, `aws_not_bedrock`, `aws_empty`, `aws_profile_and_keys`, `aws_empty_profile`, `aws_signed_header`, `aws_no_region`, `aws_bad_region`, `aws_region_mismatch` + - `config.aws_profile.`: `no_home`, `unreadable`, `not_found`, `unsupported`, `no_keys` + - `gw.upstream.`: `aws_token_expired`, `aws_profile_expired`, `bedrock_refused`, `bedrock_refused_unnamed`, `sign_failed`, `eventstream_broken`, `stream_exception`, `stream_error` + - `gw.probe.aws_token_expired`, `gw.probe.bedrock_list_denied`, `gw.count_tokens.bedrock_model`, `gw.count_tokens.bedrock_upstream`, `control.replay_bedrock`, `l3.sign_failed` + +**AWS Bedrock upstreams.** An upstream at `https://bedrock-runtime..amazonaws.com` is recognized as `bedrock`. It authenticates in one of three ways: +- A Bedrock API key in `key`, sent as `Authorization: Bearer`. +- AWS access keys in `aws`: `access_key_id`, `secret_access_key` and, for temporary credentials, `session_token`, each of which can be `${VAR}`. Every request is signed with them (SigV4) once its body is final. +- `aws.profile`: the access keys of a profile in the AWS credential files (`~/.aws/credentials`, `~/.aws/config`, or the files `AWS_SHARED_CREDENTIALS_FILE` and `AWS_CONFIG_FILE` name) on the machine core runs on. The files are read again when they change, so a tool that refreshes temporary keys there needs no restart. Nothing is run to obtain a credential: a profile that signs in through IAM Identity Center, runs a `credential_process` or assumes a role is refused, naming the setting. + +Requests in every client format are converted to Converse and ConverseStream. The binary eventstream is turned into server-sent events as it arrives, so usage, the first token, output redaction and tool-call inspection work as they do for any other upstream. The `anthropic-beta` values Bedrock accepts for Claude are carried into the request body. The model list comes from the region's control plane: the foundation models that can be invoked on demand, the inference profiles AWS defines (`us.anthropic.claude-…`, `global.…`), and the account's application inference profiles, listed by the ARN they are invoked by. Checking the connection and the inference speed test go through the same signing. For a VPC endpoint or a proxy, write its address in `base_url` and the region in `aws.region`. + +- AWS's text for a refused credential (HTTP 401 or 403) names the account and the IAM identity. The client receives the gateway's own sentence instead, and AWS's text is not recorded as the request's error. +- An expired session token is named as such; for a profile, the message says to refresh the profile. +- An exception AWS sends inside a stream ends the request as a failure. +- `count_tokens` for a model that only Bedrock upstreams serve is answered with 501 `not_supported`, the answer Claude Code's guidance for gateways names; Claude Code then counts with a one-token request. Bedrock's own CountTokens covers only some older Claude models on `bedrock-runtime`. +- A replay to a Bedrock upstream is refused: a replay sends the recorded request as it was, and Bedrock takes only the Converse format, which no client sends. + +The code that speaks to Bedrock (signing, the eventstream, the endpoints and the model catalog) is the new layer-one crate `tw-bedrock`, which ThinkWatch Enterprise shares. + +**Converse keeps cache breakpoints and thinking.** The conversion to Converse used to drop `cache_control`, so a client that cached its prompt never hit the cache through Bedrock. Cache breakpoints now become `cachePoint` blocks (at most four, as Bedrock allows), with the one-hour TTL where the client asked for it, and cache reads and writes, one-hour writes included, are read back. Claude's thinking and effort are sent in `additionalModelRequestFields`, and its reasoning comes back as reasoning content. + +**Priced by the model that was sent.** A routing rule can send a request as another model, and the upstream charges for the model it received. Each attempt now records the model it sent when a rule rewrote it (`AttemptView.model`), and a request is priced by the model of the attempt that served it. The row still names the model the client asked for. The list of unpriced models names the model a price has to be set for. +- A Bedrock model the price data does not list borrows a price, always marked estimated: an inference profile from the model it is named after, and an Anthropic model on Bedrock from Anthropic's own name for it. +- Long-context tiers are read with the threshold the price data gives (200K for Claude Sonnet 4 and 4.5, 272K for GPT-5.4 and later), including their cache prices. A request's input counts its cache reads and writes when the tier is chosen. The 272K tier was not recognized before, and a request with a warm cache was priced as a short one. +- A price the data does not give is filled in, and the cost is marked estimated whenever it is used: a one-hour cache write costs twice the input price (it used to fall back to the five-minute price), and the missing cache prices of a long-context tier grow with its input price. + +**Errors partway through a stream.** An upstream can answer 200, stream part of an answer and then report an error in the stream: Anthropic's `overloaded_error`, Responses' `response.failed`, an `error` in a Chat or Gemini frame. Such a request was recorded as finished; it is now a failure, with the usage the upstream reported before the error. + +**Listed models.** `GET /v1/models` and `GET /v1/models/:model` no longer stamp each model with the time of the request. `created` and `created_at` are now the Unix epoch, since the gateway does not know when a model was released.