From bd5a50e1d34418555cfb0429bed7c160dd40d023 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 31 Oct 2026 05:41:33 +0100 Subject: [PATCH] lease_client: vendor the connector lease_v2 byte goldens (ModelConnector c1802d8) and pin the kit to that merged commit The client decodes every published refusal and the grant and encodes the request and each message back to the same bytes. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 2 +- crates/mind-body/Cargo.toml | 4 +- .../src/lease_client/lease_v2/README.md | 16 +++++++ .../src/lease_client/lease_v2/grant.bin | Bin 0 -> 331 bytes .../lease_client/lease_v2/refusal_busy.bin | Bin 0 -> 66 bytes .../lease_client/lease_v2/refusal_expired.bin | Bin 0 -> 69 bytes .../lease_v2/refusal_provider_rejected.bin | Bin 0 -> 78 bytes .../lease_v2/refusal_unknown_caller.bin | Bin 0 -> 75 bytes .../src/lease_client/lease_v2/request.bin | Bin 0 -> 66 bytes crates/mind-body/src/lease_client/tests.rs | 43 ++++++++++++++++++ 10 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 crates/mind-body/src/lease_client/lease_v2/README.md create mode 100644 crates/mind-body/src/lease_client/lease_v2/grant.bin create mode 100644 crates/mind-body/src/lease_client/lease_v2/refusal_busy.bin create mode 100644 crates/mind-body/src/lease_client/lease_v2/refusal_expired.bin create mode 100644 crates/mind-body/src/lease_client/lease_v2/refusal_provider_rejected.bin create mode 100644 crates/mind-body/src/lease_client/lease_v2/refusal_unknown_caller.bin create mode 100644 crates/mind-body/src/lease_client/lease_v2/request.bin diff --git a/Cargo.lock b/Cargo.lock index 302b562..685b066 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1156,7 +1156,7 @@ dependencies = [ [[package]] name = "model-connector" version = "0.1.0" -source = "git+https://eureka.gamecult.org/forge/GameCult/ModelConnector.git?rev=9db62027eb1e6a2f7a47fdfb3cb5f118c5b96da7#9db62027eb1e6a2f7a47fdfb3cb5f118c5b96da7" +source = "git+https://eureka.gamecult.org/forge/GameCult/ModelConnector.git?rev=c1802d85bee3ae04b0c5737563c8343c1fef515d#c1802d85bee3ae04b0c5737563c8343c1fef515d" dependencies = [ "aes-gcm", "base64", diff --git a/crates/mind-body/Cargo.toml b/crates/mind-body/Cargo.toml index 31b4d90..4f37524 100644 --- a/crates/mind-body/Cargo.toml +++ b/crates/mind-body/Cargo.toml @@ -33,7 +33,7 @@ cultnet-rs.workspace = true eureka-pipeline = { path = "../eureka-pipeline" } eureka-state = { path = "../eureka-state", default-features = false } huginn-mind = { path = "../huginn-mind" } -model-connector = { git = "https://eureka.gamecult.org/forge/GameCult/ModelConnector.git", rev = "9db62027eb1e6a2f7a47fdfb3cb5f118c5b96da7", package = "model-connector" } +model-connector = { git = "https://eureka.gamecult.org/forge/GameCult/ModelConnector.git", rev = "c1802d85bee3ae04b0c5737563c8343c1fef515d", package = "model-connector" } rmp-serde = "1" serde = { version = "1", features = ["derive"] } serde_json = "1" @@ -53,7 +53,7 @@ rustix = { version = "1", default-features = false, features = ["std", "net"] } [dev-dependencies] # The kit's serve loop and service, for the test that runs the connector client # against the real server with a fake provider behind it. -model-connector = { git = "https://eureka.gamecult.org/forge/GameCult/ModelConnector.git", rev = "9db62027eb1e6a2f7a47fdfb3cb5f118c5b96da7", package = "model-connector", features = ["daemon"] } +model-connector = { git = "https://eureka.gamecult.org/forge/GameCult/ModelConnector.git", rev = "c1802d85bee3ae04b0c5737563c8343c1fef515d", package = "model-connector", features = ["daemon"] } proc-macro2 = "1" quote = "1" syn = { version = "2", features = ["full"] } diff --git a/crates/mind-body/src/lease_client/lease_v2/README.md b/crates/mind-body/src/lease_client/lease_v2/README.md new file mode 100644 index 0000000..e62045e --- /dev/null +++ b/crates/mind-body/src/lease_client/lease_v2/README.md @@ -0,0 +1,16 @@ +# lease_v2 fixtures + +The exact bytes of the claude lease protocol v2: each file is one whole frame (a u32 +big-endian length, then the named-MessagePack map `{kind, value}`). + +- `request.bin`: `claude_lease_request`. +- `refusal_unknown_caller.bin`, `refusal_expired.bin`, `refusal_busy.bin`, + `refusal_provider_rejected.bin`: `claude_lease_refusal`; `kind` is the variant name as a + PascalCase string. +- `grant.bin`: `claude_lease_grant` with `lease_id` and `plan_quota` carrying `five_hour` and + `seven_day` windows (utilization_permille, resets_at_unix_ms, status, observed_at_unix_ms). + On the wire the grant travels with one SCM_RIGHTS fd; the file holds the frame only. + +Huginn's lease client vendors these files from this repository and tests against the same +bytes. Generator: `tests/lease_wire_golden.rs`; run it with `LEASE_V2_REGENERATE=1`, then +review the diff: a changed byte is a wire change. diff --git a/crates/mind-body/src/lease_client/lease_v2/grant.bin b/crates/mind-body/src/lease_client/lease_v2/grant.bin new file mode 100644 index 0000000000000000000000000000000000000000..bc0a78d2d274b08e489ffcf5c9a6008f76bb8b17 GIT binary patch literal 331 zcmaLQO-=$q5Cz~KxeIGW@rSVI7?px9uwqR&_RkEmBw@jp8<^mLYzXQBxPT#H=Lxum zMu-aqcl9bS?^7yi3?_GM^h--HY62nj1RaMaJY^`62D9CZ^+);ps-2!y&M&H$SJyY# zY-wu$&hxIIf%|9!j)z75HE#3gHfIF4HoCVMSh$aYt${ANltt)0nJgW73LY>(G~9#K zua!z3M`?Xk_<$k$DT>&f^s8-pavAAA-IG-PfSxikpz+}_SlS)|i}gnB!Nneg9Gzj) H`4|2KHq3{H literal 0 HcmV?d00001 diff --git a/crates/mind-body/src/lease_client/lease_v2/refusal_busy.bin b/crates/mind-body/src/lease_client/lease_v2/refusal_busy.bin new file mode 100644 index 0000000000000000000000000000000000000000..f6a0887727c88ea29c9784fce3a531b8ad1a7568 GIT binary patch literal 66 zcmZQzV6bailAW2CvL!huu{0$$J|{J?I5oZ~HLbKbF=uI6Voqr)M8OiL(&EZxDXAri QnK`RUGExc2 c)U4FxlGK!CDXArinK`RUGEx = grant.plan_quota.iter().map(|plan| plan.window.as_str()).collect(); + assert_eq!(windows, ["five_hour", "seven_day"]); + assert_eq!(encode_frame(&message).unwrap(), GRANT); + } +}