Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(fleet): add native HTTP transport (#6102)

r33drichards2d5f6be3df23
diff --git a/libs/fleet/Cargo.lock b/libs/fleet/Cargo.lock
index 54c73ad3d2..b30f07a15e 100644
--- a/libs/fleet/Cargo.lock
+++ b/libs/fleet/Cargo.lock
@@ -80,6 +80,12 @@ dependencies = [
"syn 3.0.0",
]
+[[package]]
+name = "atomic-waker"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+
[[package]]
name = "autocfg"
version = "1.5.1"
@@ -157,12 +163,39 @@ dependencies = [
"thiserror",
]
+[[package]]
+name = "cc"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9"
+dependencies = [
+ "find-msvc-tools",
+ "shlex",
+]
+
[[package]]
name = "cfg-if"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
+[[package]]
+name = "cfg_aliases"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"
+
+[[package]]
+name = "chacha20"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "rand_core",
+]
+
[[package]]
name = "clap"
version = "4.6.2"
@@ -202,6 +235,31 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
+[[package]]
+name = "core-foundation"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "core-foundation-sys"
+version = "0.8.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
+
+[[package]]
+name = "cpufeatures"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "cyclops-sdk"
version = "0.1.0"
@@ -213,6 +271,7 @@ dependencies = [
"futures-timer",
"gloo-timers",
"js-sys",
+ "reqwest",
"serde",
"serde_json",
"thiserror",
@@ -365,7 +424,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
- "windows-sys",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -374,6 +433,12 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
+[[package]]
+name = "find-msvc-tools"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
+
[[package]]
name = "form_urlencoded"
version = "1.2.2"
@@ -437,6 +502,19 @@ dependencies = [
"slab",
]
+[[package]]
+name = "getrandom"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
+dependencies = [
+ "cfg-if",
+ "js-sys",
+ "libc",
+ "wasi",
+ "wasm-bindgen",
+]
+
[[package]]
name = "getrandom"
version = "0.4.3"
@@ -444,8 +522,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
dependencies = [
"cfg-if",
+ "js-sys",
"libc",
"r-efi",
+ "rand_core",
+ "wasm-bindgen",
]
[[package]]
@@ -499,6 +580,94 @@ dependencies = [
"itoa",
]
+[[package]]
+name = "http-body"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c"
+dependencies = [
+ "bytes",
+ "http",
+]
+
+[[package]]
+name = "http-body-util"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e9f41fd6a08e4d4ec69df65976da761afd5ad5e58a9d4acb46bd1c953a9e3ff2"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "http",
+ "http-body",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "httparse"
+version = "1.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
+
+[[package]]
+name = "hyper"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d22053281f852e11534f5198498373cbb59295120a20771d90f7ed1897490a72"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "futures-channel",
+ "futures-core",
+ "http",
+ "http-body",
+ "httparse",
+ "itoa",
+ "pin-project-lite",
+ "smallvec",
+ "tokio",
+ "want",
+]
+
+[[package]]
+name = "hyper-rustls"
+version = "0.27.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f"
+dependencies = [
+ "http",
+ "hyper",
+ "hyper-util",
+ "rustls",
+ "rustls-native-certs",
+ "tokio",
+ "tokio-rustls",
+ "tower-service",
+]
+
+[[package]]
+name = "hyper-util"
+version = "0.1.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
+dependencies = [
+ "base64",
+ "bytes",
+ "futures-channel",
+ "futures-util",
+ "http",
+ "http-body",
+ "hyper",
+ "ipnet",
+ "libc",
+ "percent-encoding",
+ "pin-project-lite",
+ "socket2",
+ "tokio",
+ "tower-service",
+ "tracing",
+]
+
[[package]]
name = "icu_collections"
version = "2.2.0"
@@ -620,6 +789,12 @@ dependencies = [
"serde_core",
]
+[[package]]
+name = "ipnet"
+version = "2.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2"
+
[[package]]
name = "itoa"
version = "1.0.18"
@@ -752,6 +927,12 @@ version = "0.4.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
+[[package]]
+name = "lru-slab"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
+
[[package]]
name = "memchr"
version = "2.8.3"
@@ -764,6 +945,17 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+[[package]]
+name = "mio"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427"
+dependencies = [
+ "libc",
+ "wasi",
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "nom"
version = "7.1.3"
@@ -789,6 +981,12 @@ version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
+[[package]]
+name = "openssl-probe"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
+
[[package]]
name = "ordered-float"
version = "2.10.1"
@@ -849,6 +1047,62 @@ dependencies = [
"unicode-ident",
]
+[[package]]
+name = "quinn"
+version = "0.11.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8"
+dependencies = [
+ "bytes",
+ "cfg_aliases",
+ "pin-project-lite",
+ "quinn-proto",
+ "quinn-udp",
+ "rustc-hash",
+ "rustls",
+ "socket2",
+ "thiserror",
+ "tokio",
+ "tracing",
+ "web-time",
+]
+
+[[package]]
+name = "quinn-proto"
+version = "0.11.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2f4bfc015262b9df63c8845072ce59068853ff5872180c2ce2f13038b970e560"
+dependencies = [
+ "bytes",
+ "getrandom 0.4.3",
+ "lru-slab",
+ "rand",
+ "rand_pcg",
+ "ring",
+ "rustc-hash",
+ "rustls",
+ "rustls-pki-types",
+ "slab",
+ "thiserror",
+ "tinyvec",
+ "tracing",
+ "web-time",
+]
+
+[[package]]
+name = "quinn-udp"
+version = "0.5.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "35a133f956daabe89a61a685c2649f13d82d5aa4bd5d12d1277e1072a21c0694"
+dependencies = [
+ "cfg_aliases",
+ "libc",
+ "once_cell",
+ "socket2",
+ "tracing",
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "quote"
version = "1.0.47"
@@ -864,6 +1118,32 @@ version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
+[[package]]
+name = "rand"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80"
+dependencies = [
+ "chacha20",
+ "getrandom 0.4.3",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
+
+[[package]]
+name = "rand_pcg"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a"
+dependencies = [
+ "rand_core",
+]
+
[[package]]
name = "ref-cast"
version = "1.0.26"
@@ -884,6 +1164,58 @@ dependencies = [
"syn 3.0.0",
]
+[[package]]
+name = "reqwest"
+version = "0.12.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"
+dependencies = [
+ "base64",
+ "bytes",
+ "futures-core",
+ "http",
+ "http-body",
+ "http-body-util",
+ "hyper",
+ "hyper-rustls",
+ "hyper-util",
+ "js-sys",
+ "log",
+ "percent-encoding",
+ "pin-project-lite",
+ "quinn",
+ "rustls",
+ "rustls-native-certs",
+ "rustls-pki-types",
+ "serde",
+ "serde_json",
+ "serde_urlencoded",
+ "sync_wrapper",
+ "tokio",
+ "tokio-rustls",
+ "tower",
+ "tower-http",
+ "tower-service",
+ "url",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+]
+
+[[package]]
+name = "ring"
+version = "0.17.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
+dependencies = [
+ "cc",
+ "cfg-if",
+ "getrandom 0.2.17",
+ "libc",
+ "untrusted",
+ "windows-sys 0.52.0",
+]
+
[[package]]
name = "rustc-hash"
version = "2.1.3"
@@ -909,7 +1241,54 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
- "windows-sys",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "rustls"
+version = "0.23.42"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c54fcab019b409d04215d3a17cb438fd7fbf192ee61461f20f4fe18704bc138"
+dependencies = [
+ "once_cell",
+ "ring",
+ "rustls-pki-types",
+ "rustls-webpki",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-native-certs"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d"
+dependencies = [
+ "openssl-probe",
+ "rustls-pki-types",
+ "schannel",
+ "security-framework",
+]
+
+[[package]]
+name = "rustls-pki-types"
+version = "1.15.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96"
+dependencies = [
+ "web-time",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-webpki"
+version = "0.103.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
+dependencies = [
+ "ring",
+ "rustls-pki-types",
+ "untrusted",
]
[[package]]
@@ -924,6 +1303,15 @@ version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
+[[package]]
+name = "schannel"
+version = "0.1.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "schemars"
version = "1.2.1"
@@ -969,6 +1357,29 @@ dependencies = [
"syn 2.0.119",
]
+[[package]]
+name = "security-framework"
+version = "3.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
+dependencies = [
+ "bitflags 2.13.1",
+ "core-foundation",
+ "core-foundation-sys",
+ "libc",
+ "security-framework-sys",
+]
+
+[[package]]
+name = "security-framework-sys"
+version = "2.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
[[package]]
name = "semver"
version = "1.0.28"
@@ -1052,6 +1463,18 @@ dependencies = [
"serde_core",
]
+[[package]]
+name = "serde_urlencoded"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
+dependencies = [
+ "form_urlencoded",
+ "itoa",
+ "ryu",
+ "serde",
+]
+
[[package]]
name = "serde_yaml"
version = "0.9.34+deprecated"
@@ -1065,6 +1488,12 @@ dependencies = [
"unsafe-libyaml",
]
+[[package]]
+name = "shlex"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
+
[[package]]
name = "siphasher"
version = "1.0.3"
@@ -1089,6 +1518,16 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8e2fb0f499abb4d162f2bedad68f5ef91a1682b5a03596ddb67efd37768d100"
+[[package]]
+name = "socket2"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
+dependencies = [
+ "libc",
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "stable_deref_trait"
version = "1.2.1"
@@ -1107,6 +1546,12 @@ version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
+[[package]]
+name = "subtle"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
+
[[package]]
name = "syn"
version = "2.0.119"
@@ -1129,6 +1574,15 @@ dependencies = [
"unicode-ident",
]
+[[package]]
+name = "sync_wrapper"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
+dependencies = [
+ "futures-core",
+]
+
[[package]]
name = "synstructure"
version = "0.13.2"
@@ -1147,10 +1601,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
- "getrandom",
+ "getrandom 0.4.3",
"once_cell",
"rustix",
- "windows-sys",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -1192,14 +1646,34 @@ dependencies = [
"zerovec",
]
+[[package]]
+name = "tinyvec"
+version = "1.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+
[[package]]
name = "tokio"
version = "1.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d988bcd52dbe076d3d46903332f58c912b87a2c49b1428419a5845154762ffee"
dependencies = [
+ "bytes",
+ "libc",
+ "mio",
"pin-project-lite",
+ "socket2",
"tokio-macros",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -1213,6 +1687,16 @@ dependencies = [
"syn 2.0.119",
]
+[[package]]
+name = "tokio-rustls"
+version = "0.26.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"
+dependencies = [
+ "rustls",
+ "tokio",
+]
+
[[package]]
name = "toml"
version = "0.9.12+spec-1.1.0"
@@ -1252,6 +1736,76 @@ version = "1.1.2+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
+[[package]]
+name = "tower"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
+dependencies = [
+ "futures-core",
+ "futures-util",
+ "pin-project-lite",
+ "sync_wrapper",
+ "tokio",
+ "tower-layer",
+ "tower-service",
+]
+
+[[package]]
+name = "tower-http"
+version = "0.6.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840"
+dependencies = [
+ "bitflags 2.13.1",
+ "bytes",
+ "futures-util",
+ "http",
+ "http-body",
+ "pin-project-lite",
+ "tower",
+ "tower-layer",
+ "tower-service",
+ "url",
+]
+
+[[package]]
+name = "tower-layer"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
+
+[[package]]
+name = "tower-service"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
+
+[[package]]
+name = "tracing"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
+dependencies = [
+ "pin-project-lite",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-core"
+version = "0.1.36"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
+dependencies = [
+ "once_cell",
+]
+
+[[package]]
+name = "try-lock"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
+
[[package]]
name = "unicode-ident"
version = "1.0.24"
@@ -1386,6 +1940,12 @@ version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
+[[package]]
+name = "untrusted"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
+
[[package]]
name = "url"
version = "2.5.8"
@@ -1404,6 +1964,21 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
+[[package]]
+name = "want"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
+dependencies = [
+ "try-lock",
+]
+
+[[package]]
+name = "wasi"
+version = "0.11.1+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
+
[[package]]
name = "wasm-bindgen"
version = "0.2.126"
@@ -1469,6 +2044,16 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "web-time"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
[[package]]
name = "weedle2"
version = "5.0.0"
@@ -1484,6 +2069,15 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets",
+]
+
[[package]]
name = "windows-sys"
version = "0.61.2"
@@ -1493,6 +2087,70 @@ dependencies = [
"windows-link",
]
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
[[package]]
name = "winnow"
version = "0.7.15"
@@ -1558,6 +2216,12 @@ dependencies = [
"synstructure",
]
+[[package]]
+name = "zeroize"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e"
+
[[package]]
name = "zerotrie"
version = "0.2.4"
diff --git a/libs/fleet/Cargo.toml b/libs/fleet/Cargo.toml
index c55411ffcf..9d3dd8cdd2 100644
--- a/libs/fleet/Cargo.toml
+++ b/libs/fleet/Cargo.toml
@@ -22,3 +22,4 @@ thiserror = "2.0"
tokio = { version = "1.0", features = ["macros", "rt", "sync"] }
uniffi = { version = "=0.31.0", features = ["tokio", "wasm-unstable-single-threaded"] }
url = "2.5"
+reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-native-roots"] }
diff --git a/libs/fleet/scripts/check_sdk_binding_contract_sources.py b/libs/fleet/scripts/check_sdk_binding_contract_sources.py
index 64a2f8f79b..d03f2ece74 100755
--- a/libs/fleet/scripts/check_sdk_binding_contract_sources.py
+++ b/libs/fleet/scripts/check_sdk_binding_contract_sources.py
@@ -273,7 +273,7 @@ def check(root: Path) -> None:
])
require(files["python_live"].read_text(encoding="utf-8"), "Python live environment", r"os\.environ\[\"CUA_CLIENT_ID\"\].*os\.environ\[\"CUA_IMAGE\"\]", files["python_live"])
require_all(source["python_live"], files["python_live"], [
- ("Python live HTTP callback", r"class\s+UrlLibHttpClient\(HttpClient\).*async\s+def\s+execute"),
+ ("Python live native HTTP constructor", r"CyclopsClient\.connect_with_native_http_client\("),
("Python live typed pool", r"PoolSpec\(.*SandboxService\(.*target_port=3000"),
("Python live typed claim", r"CreateClaimRequest\(pool=pool,\s*spec=None\)"),
("Python live MCP retry", r"response\.status\s+in\s+\(502,\s*503,\s*504\)"),
diff --git a/libs/fleet/sdk-bindings/README.md b/libs/fleet/sdk-bindings/README.md
index c4a190e0a4..1f9a1b53c7 100644
--- a/libs/fleet/sdk-bindings/README.md
+++ b/libs/fleet/sdk-bindings/README.md
@@ -19,6 +19,10 @@ Generated binding source is committed so review and drift checks are
reproducible. Native libraries, Cargo target output, Gradle caches, and staged
language runtime directories are not committed.
+## Native HTTP transport
+
+Native bindings can call `CyclopsClient.connect_with_native_http_client(configuration)` instead of implementing a foreign `HttpClient`. Static-token and token-provider flows use `connect_with_access_token_and_native_http_client(configuration, access_token)` and `connect_with_access_token_provider_and_native_http_client(configuration, provider)`. Existing `http_client` constructors remain the advanced path for proxying, custom CA trust, TLS policy, and tests. The native transport uses `reqwest` with Rustls/platform trust roots, a 30-second whole-request timeout, direct connections without proxy environment variables, and no automatic redirects, so bearer credentials are not replayed to redirect hosts. Duplicate headers and status bodies are preserved. Browser/WASM continues to use `connect_browser_with_access_token`.
+
## Prerequisites
- Rust `1.97.0` with `rustfmt` and `clippy` (`cyclops-cs/rust-toolchain.toml`).
diff --git a/libs/fleet/sdk-bindings/examples/python/live_app_controlled.py b/libs/fleet/sdk-bindings/examples/python/live_app_controlled.py
index c31b54f2d1..8cd7616df1 100755
--- a/libs/fleet/sdk-bindings/examples/python/live_app_controlled.py
+++ b/libs/fleet/sdk-bindings/examples/python/live_app_controlled.py
@@ -3,51 +3,20 @@ import asyncio
import json
import os
import time
-import urllib.error
-import urllib.request
-
from cyclops_sdk import (
CreateClaimRequest,
CreatePoolRequest,
CyclopsClient,
CyclopsConfiguration,
CyclopsCredentials,
- HttpClient,
HttpHeader,
HttpRequest,
- HttpResponse,
PoolSpec,
PoolTemplate,
SandboxService,
)
-class UrlLibHttpClient(HttpClient):
- async def execute(self, request: HttpRequest) -> HttpResponse:
- return await asyncio.to_thread(self._execute, request)
-
- def _execute(self, request: HttpRequest) -> HttpResponse:
- native = urllib.request.Request(
- request.url,
- data=request.body,
- method=request.method,
- headers={header.name: header.value for header in request.headers},
- )
- try:
- with urllib.request.urlopen(native, timeout=60) as response:
- return HttpResponse(
- status=response.status,
- headers=[HttpHeader(name=name, value=value) for name, value in response.headers.items()],
- body=response.read(),
- )
- except urllib.error.HTTPError as error: # lint-ignore: swallowed-exception
- return HttpResponse(
- status=error.code,
- headers=[HttpHeader(name=name, value=value) for name, value in error.headers.items()],
- body=error.read(),
- )
-
-
def pool_spec(image: str, image_pull_secret: str) -> PoolSpec:
return PoolSpec(
replicas=1,
@@ -117,7 +86,7 @@ async def main() -> None:
image_pull_secret = os.environ["CUA_IMAGE_PULL_SECRET"]
image = os.environ["CUA_IMAGE"]
- client = CyclopsClient.connect(
+ client = CyclopsClient.connect_with_native_http_client(
CyclopsConfiguration(
base_url=base_url,
token_url=token_url,
@@ -126,8 +95,7 @@ async def main() -> None:
pool_poll_limit=120,
claim_poll_interval_ms=5000,
claim_poll_limit=120,
- ),
- UrlLibHttpClient(),
+ )
)
pool = None
claim = None
diff --git a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/cyclops_sdk.kt b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/cyclops_sdk.kt
index 2a16865d34..43e4eb922e 100644
--- a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/cyclops_sdk.kt
+++ b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/cyclops_sdk.kt
@@ -731,8 +731,14 @@ internal object IntegrityCheckingUniffiLib {
): Short
external fun uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token(
): Short
+ external fun uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client(
+ ): Short
external fun uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider(
): Short
+ external fun uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client(
+ ): Short
+ external fun uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client(
+ ): Short
external fun uniffi_cyclops_sdk_checksum_constructor_cyclopscredentials_new(
): Short
external fun ffi_cyclops_sdk_uniffi_contract_version(
@@ -766,8 +772,14 @@ internal object UniffiLib {
): Long
external fun uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token(`configuration`: RustBuffer.ByValue,`accessToken`: RustBuffer.ByValue,`httpClient`: Long,uniffi_out_err: UniffiRustCallStatus,
): Long
+ external fun uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client(`configuration`: RustBuffer.ByValue,`accessToken`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): Long
external fun uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider(`configuration`: RustBuffer.ByValue,`tokenProvider`: Long,`httpClient`: Long,uniffi_out_err: UniffiRustCallStatus,
): Long
+ external fun uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client(`configuration`: RustBuffer.ByValue,`tokenProvider`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): Long
+ external fun uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client(`configuration`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): Long
external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_create_claim(`ptr`: Long,`request`: RustBuffer.ByValue,
): Long
external fun uniffi_cyclops_sdk_fn_method_cyclopsclient_delete_claim(`ptr`: Long,`claim`: RustBuffer.ByValue,
@@ -979,9 +991,18 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
if (lib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token() != 10148.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
+ if (lib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client() != 42291.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
if (lib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider() != 58487.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
+ if (lib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client() != 62005.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client() != 49301.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
if (lib.uniffi_cyclops_sdk_checksum_constructor_cyclopscredentials_new() != 25746.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
@@ -2302,6 +2323,18 @@ open class CyclopsClient: Disposable, AutoCloseable, CyclopsClientInterface
+ @Throws(SdkException::class) fun `connectWithAccessTokenAndNativeHttpClient`(`configuration`: CyclopsTokenProviderConfiguration, `accessToken`: kotlin.String): CyclopsClient {
+ return FfiConverterTypeCyclopsClient.lift(
+ uniffiRustCallWithError(SdkException) { _status ->
+ UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client(
+
+ FfiConverterTypeCyclopsTokenProviderConfiguration.lower(`configuration`),FfiConverterString.lower(`accessToken`),_status)
+}
+ )
+ }
+
+
+
@Throws(SdkException::class) fun `connectWithAccessTokenProvider`(`configuration`: CyclopsTokenProviderConfiguration, `tokenProvider`: AccessTokenProvider, `httpClient`: HttpClient): CyclopsClient {
return FfiConverterTypeCyclopsClient.lift(
uniffiRustCallWithError(SdkException) { _status ->
@@ -2314,6 +2347,30 @@ open class CyclopsClient: Disposable, AutoCloseable, CyclopsClientInterface
+ @Throws(SdkException::class) fun `connectWithAccessTokenProviderAndNativeHttpClient`(`configuration`: CyclopsTokenProviderConfiguration, `tokenProvider`: AccessTokenProvider): CyclopsClient {
+ return FfiConverterTypeCyclopsClient.lift(
+ uniffiRustCallWithError(SdkException) { _status ->
+ UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client(
+
+ FfiConverterTypeCyclopsTokenProviderConfiguration.lower(`configuration`),FfiConverterTypeAccessTokenProvider.lower(`tokenProvider`),_status)
+}
+ )
+ }
+
+
+
+ @Throws(SdkException::class) fun `connectWithNativeHttpClient`(`configuration`: CyclopsConfiguration): CyclopsClient {
+ return FfiConverterTypeCyclopsClient.lift(
+ uniffiRustCallWithError(SdkException) { _status ->
+ UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client(
+
+ FfiConverterTypeCyclopsConfiguration.lower(`configuration`),_status)
+}
+ )
+ }
+
+
+
}
}
diff --git a/libs/fleet/sdk-bindings/python/cyclops_sdk/_sdk.py b/libs/fleet/sdk-bindings/python/cyclops_sdk/_sdk.py
index 8408cc670b..9e23f40c8b 100644
--- a/libs/fleet/sdk-bindings/python/cyclops_sdk/_sdk.py
+++ b/libs/fleet/sdk-bindings/python/cyclops_sdk/_sdk.py
@@ -488,8 +488,14 @@ def _uniffi_check_api_checksums(lib):
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token() != 10148:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client() != 42291:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider() != 58487:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client() != 62005:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client() != 49301:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim() != 23330:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_pool() != 48557:
@@ -882,6 +888,12 @@ _UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_t
ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client.argtypes = (
+ _UniffiRustBuffer,
+ _UniffiRustBuffer,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider.argtypes = (
_UniffiRustBuffer,
ctypes.c_uint64,
@@ -889,6 +901,17 @@ _UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_t
ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client.argtypes = (
+ _UniffiRustBuffer,
+ ctypes.c_uint64,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client.argtypes = (
+ _UniffiRustBuffer,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_fn_method_cyclopsclient_create_claim.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
@@ -973,9 +996,18 @@ _UniffiLib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_browser
_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim.restype = ctypes.c_uint16
@@ -2718,6 +2750,24 @@ class CyclopsClient(CyclopsClientProtocol):
)
return cls._uniffi_make_instance(_uniffi_ffi_result)
@classmethod
+ def connect_with_access_token_and_native_http_client(cls, configuration: CyclopsTokenProviderConfiguration,access_token: str) -> CyclopsClient:
+
+ _UniffiFfiConverterTypeCyclopsTokenProviderConfiguration.check_lower(configuration)
+
+ _UniffiFfiConverterString.check_lower(access_token)
+ _uniffi_lowered_args = (
+ _UniffiFfiConverterTypeCyclopsTokenProviderConfiguration.lower(configuration),
+ _UniffiFfiConverterString.lower(access_token),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCyclopsClient.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client,
+ *_uniffi_lowered_args,
+ )
+ return cls._uniffi_make_instance(_uniffi_ffi_result)
+ @classmethod
def connect_with_access_token_provider(cls, configuration: CyclopsTokenProviderConfiguration,token_provider: AccessTokenProvider,http_client: HttpClient) -> CyclopsClient:
_UniffiFfiConverterTypeCyclopsTokenProviderConfiguration.check_lower(configuration)
@@ -2738,6 +2788,39 @@ class CyclopsClient(CyclopsClientProtocol):
*_uniffi_lowered_args,
)
return cls._uniffi_make_instance(_uniffi_ffi_result)
+ @classmethod
+ def connect_with_access_token_provider_and_native_http_client(cls, configuration: CyclopsTokenProviderConfiguration,token_provider: AccessTokenProvider) -> CyclopsClient:
+
+ _UniffiFfiConverterTypeCyclopsTokenProviderConfiguration.check_lower(configuration)
+
+ _UniffiFfiConverterTypeAccessTokenProvider.check_lower(token_provider)
+ _uniffi_lowered_args = (
+ _UniffiFfiConverterTypeCyclopsTokenProviderConfiguration.lower(configuration),
+ _UniffiFfiConverterTypeAccessTokenProvider.lower(token_provider),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCyclopsClient.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client,
+ *_uniffi_lowered_args,
+ )
+ return cls._uniffi_make_instance(_uniffi_ffi_result)
+ @classmethod
+ def connect_with_native_http_client(cls, configuration: CyclopsConfiguration) -> CyclopsClient:
+
+ _UniffiFfiConverterTypeCyclopsConfiguration.check_lower(configuration)
+ _uniffi_lowered_args = (
+ _UniffiFfiConverterTypeCyclopsConfiguration.lower(configuration),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCyclopsClient.lift
+ _uniffi_error_converter = _UniffiFfiConverterTypeSdkError
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client,
+ *_uniffi_lowered_args,
+ )
+ return cls._uniffi_make_instance(_uniffi_ffi_result)
def __init__(self, *args, **kwargs):
raise ValueError("This class has no default constructor")
diff --git a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
index ba9aabd627..a183e2d7d4 100644
--- a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
+++ b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
@@ -1875,9 +1875,18 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token,
[RustBuffer.by_value, RustBuffer.by_value, :uint64, RustCallStatus.by_ref],
:uint64
+ attach_function :uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client,
+ [RustBuffer.by_value, RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
attach_function :uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider,
[RustBuffer.by_value, :uint64, :uint64, RustCallStatus.by_ref],
:uint64
+ attach_function :uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client,
+ [RustBuffer.by_value, :uint64, RustCallStatus.by_ref],
+ :uint64
+ attach_function :uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client,
+ [RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
attach_function :uniffi_cyclops_sdk_fn_method_cyclopsclient_create_claim,
[:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
:uint64
@@ -2032,9 +2041,18 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token,
[RustCallStatus.by_ref],
:uint16
+ attach_function :uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client,
+ [RustCallStatus.by_ref],
+ :uint16
attach_function :uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider,
[RustCallStatus.by_ref],
:uint16
+ attach_function :uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client,
+ [RustCallStatus.by_ref],
+ :uint16
+ attach_function :uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client,
+ [RustCallStatus.by_ref],
+ :uint16
attach_function :uniffi_cyclops_sdk_checksum_constructor_cyclopscredentials_new,
[RustCallStatus.by_ref],
:uint16
@@ -2440,6 +2458,16 @@ end
# and just create a new instance with the required handle.
return uniffi_allocate(CyclopsSdk.rust_call_with_error(SdkError,:uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token,RustBuffer.alloc_from_TypeCyclopsTokenProviderConfiguration(configuration),RustBuffer.allocFromString(access_token),(HttpClient.uniffi_lower http_client)))
end
+ def self.connect_with_access_token_and_native_http_client(configuration, access_token)
+ configuration = configuration
+ RustBuffer.check_lower_TypeCyclopsTokenProviderConfiguration(configuration)
+ access_token = CyclopsSdk::uniffi_utf8(access_token)
+
+ # Call the (fallible) function before creating any half-baked object instances.
+ # Lightly yucky way to bypass the usual "initialize" logic
+ # and just create a new instance with the required handle.
+ return uniffi_allocate(CyclopsSdk.rust_call_with_error(SdkError,:uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client,RustBuffer.alloc_from_TypeCyclopsTokenProviderConfiguration(configuration),RustBuffer.allocFromString(access_token)))
+ end
def self.connect_with_access_token_provider(configuration, token_provider, http_client)
configuration = configuration
RustBuffer.check_lower_TypeCyclopsTokenProviderConfiguration(configuration)
@@ -2452,6 +2480,24 @@ end
# and just create a new instance with the required handle.
return uniffi_allocate(CyclopsSdk.rust_call_with_error(SdkError,:uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider,RustBuffer.alloc_from_TypeCyclopsTokenProviderConfiguration(configuration),(AccessTokenProvider.uniffi_lower token_provider),(HttpClient.uniffi_lower http_client)))
end
+ def self.connect_with_access_token_provider_and_native_http_client(configuration, token_provider)
+ configuration = configuration
+ RustBuffer.check_lower_TypeCyclopsTokenProviderConfiguration(configuration)
+ token_provider = token_provider
+ (AccessTokenProvider.uniffi_check_lower token_provider)
+ # Call the (fallible) function before creating any half-baked object instances.
+ # Lightly yucky way to bypass the usual "initialize" logic
+ # and just create a new instance with the required handle.
+ return uniffi_allocate(CyclopsSdk.rust_call_with_error(SdkError,:uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client,RustBuffer.alloc_from_TypeCyclopsTokenProviderConfiguration(configuration),(AccessTokenProvider.uniffi_lower token_provider)))
+ end
+ def self.connect_with_native_http_client(configuration)
+ configuration = configuration
+ RustBuffer.check_lower_TypeCyclopsConfiguration(configuration)
+ # Call the (fallible) function before creating any half-baked object instances.
+ # Lightly yucky way to bypass the usual "initialize" logic
+ # and just create a new instance with the required handle.
+ return uniffi_allocate(CyclopsSdk.rust_call_with_error(SdkError,:uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client,RustBuffer.alloc_from_TypeCyclopsConfiguration(configuration)))
+ end
def create_claim(request)
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
index e451a2d037..23153e182e 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
@@ -874,6 +874,15 @@ public static func connectWithAccessToken(configuration: CyclopsTokenProviderCon
})
}
+public static func connectWithAccessTokenAndNativeHttpClient(configuration: CyclopsTokenProviderConfiguration, accessToken: String)throws -> CyclopsClient {
+ return try FfiConverterTypeCyclopsClient_lift(try rustCallWithError(FfiConverterTypeSdkError_lift) {
+ uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client(
+ FfiConverterTypeCyclopsTokenProviderConfiguration_lower(configuration),
+ FfiConverterString.lower(accessToken),$0
+ )
+})
+}
+
public static func connectWithAccessTokenProvider(configuration: CyclopsTokenProviderConfiguration, tokenProvider: AccessTokenProvider, httpClient: HttpClient)throws -> CyclopsClient {
return try FfiConverterTypeCyclopsClient_lift(try rustCallWithError(FfiConverterTypeSdkError_lift) {
uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider(
@@ -884,6 +893,23 @@ public static func connectWithAccessTokenProvider(configuration: CyclopsTokenPro
})
}
+public static func connectWithAccessTokenProviderAndNativeHttpClient(configuration: CyclopsTokenProviderConfiguration, tokenProvider: AccessTokenProvider)throws -> CyclopsClient {
+ return try FfiConverterTypeCyclopsClient_lift(try rustCallWithError(FfiConverterTypeSdkError_lift) {
+ uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client(
+ FfiConverterTypeCyclopsTokenProviderConfiguration_lower(configuration),
+ FfiConverterTypeAccessTokenProvider_lower(tokenProvider),$0
+ )
+})
+}
+
+public static func connectWithNativeHttpClient(configuration: CyclopsConfiguration)throws -> CyclopsClient {
+ return try FfiConverterTypeCyclopsClient_lift(try rustCallWithError(FfiConverterTypeSdkError_lift) {
+ uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client(
+ FfiConverterTypeCyclopsConfiguration_lower(configuration),$0
+ )
+})
+}
+
open func createClaim(request: CreateClaimRequest)async throws -> Claim {
@@ -2894,9 +2920,18 @@ private let initializationResult: InitializationResult = {
if (uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token() != 10148) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client() != 42291) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider() != 58487) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client() != 62005) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client() != 49301) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cyclops_sdk_checksum_constructor_cyclopscredentials_new() != 25746) {
return InitializationResult.apiChecksumMismatch
}
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h b/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h
index b06b1814cd..5f5d1d2b3c 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h
@@ -298,11 +298,26 @@ uint64_t uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_browser_with_ac
uint64_t uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token(RustBuffer configuration, RustBuffer access_token, uint64_t http_client, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_AND_NATIVE_HTTP_CLIENT
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_AND_NATIVE_HTTP_CLIENT
+uint64_t uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_and_native_http_client(RustBuffer configuration, RustBuffer access_token, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER
uint64_t uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider(RustBuffer configuration, uint64_t token_provider, uint64_t http_client, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER_AND_NATIVE_HTTP_CLIENT
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER_AND_NATIVE_HTTP_CLIENT
+uint64_t uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client(RustBuffer configuration, uint64_t token_provider, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_NATIVE_HTTP_CLIENT
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_NATIVE_HTTP_CLIENT
+uint64_t uniffi_cyclops_sdk_fn_constructor_cyclopsclient_connect_with_native_http_client(RustBuffer configuration, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_CLAIM
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CYCLOPSCLIENT_CREATE_CLAIM
uint64_t uniffi_cyclops_sdk_fn_method_cyclopsclient_create_claim(uint64_t ptr, RustBuffer request
@@ -767,12 +782,30 @@ uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_browser_w
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN
uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_AND_NATIVE_HTTP_CLIENT
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_AND_NATIVE_HTTP_CLIENT
+uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_and_native_http_client(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER
uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER_AND_NATIVE_HTTP_CLIENT
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_ACCESS_TOKEN_PROVIDER_AND_NATIVE_HTTP_CLIENT
+uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_access_token_provider_and_native_http_client(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_NATIVE_HTTP_CLIENT
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCLIENT_CONNECT_WITH_NATIVE_HTTP_CLIENT
+uint16_t uniffi_cyclops_sdk_checksum_constructor_cyclopsclient_connect_with_native_http_client(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_CONSTRUCTOR_CYCLOPSCREDENTIALS_NEW
diff --git a/libs/fleet/sdk-bindings/ts-uniffi-browser/scripts/patch-ubrn-wasm-template.mjs b/libs/fleet/sdk-bindings/ts-uniffi-browser/scripts/patch-ubrn-wasm-template.mjs
index 7cb93ab838..8a3ed9e089 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi-browser/scripts/patch-ubrn-wasm-template.mjs
+++ b/libs/fleet/sdk-bindings/ts-uniffi-browser/scripts/patch-ubrn-wasm-template.mjs
@@ -9,6 +9,7 @@ const templateDirectory = new URL(
await patchTemplate("Cargo.toml.txt", new Map([
['wasm-bindgen = "*"', 'wasm-bindgen = "=0.2.126"\nconsole_error_panic_hook = "0.1.7"'],
['opt-level = "3"', "opt-level = 3"],
+ ["[workspace]", "[workspace]\nresolver = \"2\""],
]))
await patchTemplate("lib.rs", new Map([
diff --git a/libs/fleet/sdk/Cargo.toml b/libs/fleet/sdk/Cargo.toml
index 672343db0b..812c8a6ede 100644
--- a/libs/fleet/sdk/Cargo.toml
+++ b/libs/fleet/sdk/Cargo.toml
@@ -20,6 +20,10 @@ tokio = { workspace = true, features = ["sync"] }
uniffi.workspace = true
url.workspace = true
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+reqwest.workspace = true
+tokio = { workspace = true, features = ["rt-multi-thread"] }
+
[target.'cfg(target_arch = "wasm32")'.dependencies]
gloo-timers = { version = "0.3", features = ["futures"] }
js-sys = "0.3"
diff --git a/libs/fleet/sdk/src/client.rs b/libs/fleet/sdk/src/client.rs
index c0b5fc9d74..c51d0b952d 100644
--- a/libs/fleet/sdk/src/client.rs
+++ b/libs/fleet/sdk/src/client.rs
@@ -66,6 +66,27 @@ impl CyclopsClient {
}))
}
+ #[uniffi::constructor]
+ pub fn connect_with_native_http_client(
+ configuration: CyclopsConfiguration,
+ ) -> Result<Arc<Self>, SdkError> {
+ #[cfg(not(target_arch = "wasm32"))]
+ {
+ Self::connect(
+ configuration,
+ Arc::new(crate::transport::NativeHttpClient::new()?),
+ )
+ }
+ #[cfg(target_arch = "wasm32")]
+ {
+ let _ = configuration;
+ Err(SdkError::Configuration {
+ reason: "connect_with_native_http_client is only available for non-wasm targets"
+ .into(),
+ })
+ }
+ }
+
#[uniffi::constructor]
pub fn connect_with_access_token_provider(
configuration: CyclopsTokenProviderConfiguration,
@@ -118,6 +139,46 @@ impl CyclopsClient {
}))
}
+ #[uniffi::constructor]
+ pub fn connect_with_access_token_and_native_http_client(
+ configuration: CyclopsTokenProviderConfiguration,
+ access_token: String,
+ ) -> Result<Arc<Self>, SdkError> {
+ #[cfg(not(target_arch = "wasm32"))]
+ {
+ Self::connect_with_access_token(
+ configuration,
+ access_token,
+ Arc::new(crate::transport::NativeHttpClient::new()?),
+ )
+ }
+ #[cfg(target_arch = "wasm32")]
+ {
+ let _ = (configuration, access_token);
+ Err(SdkError::Configuration { reason: "connect_with_access_token_and_native_http_client is only available for non-wasm targets".into() })
+ }
+ }
+
+ #[uniffi::constructor]
+ pub fn connect_with_access_token_provider_and_native_http_client(
+ configuration: CyclopsTokenProviderConfiguration,
+ token_provider: Arc<dyn AccessTokenProvider>,
+ ) -> Result<Arc<Self>, SdkError> {
+ #[cfg(not(target_arch = "wasm32"))]
+ {
+ Self::connect_with_access_token_provider(
+ configuration,
+ token_provider,
+ Arc::new(crate::transport::NativeHttpClient::new()?),
+ )
+ }
+ #[cfg(target_arch = "wasm32")]
+ {
+ let _ = (configuration, token_provider);
+ Err(SdkError::Configuration { reason: "connect_with_access_token_provider_and_native_http_client is only available for non-wasm targets".into() })
+ }
+ }
+
#[uniffi::constructor]
pub fn connect_browser_with_access_token(
configuration: CyclopsTokenProviderConfiguration,
diff --git a/libs/fleet/sdk/src/transport.rs b/libs/fleet/sdk/src/transport.rs
index 60c7e4ed09..68146f5664 100644
--- a/libs/fleet/sdk/src/transport.rs
+++ b/libs/fleet/sdk/src/transport.rs
@@ -4,6 +4,8 @@ use crate::{
};
use base64::{Engine, engine::general_purpose::STANDARD};
use serde::Deserialize;
+#[cfg(not(target_arch = "wasm32"))]
+use std::sync::OnceLock;
use std::{
sync::Arc,
time::{Duration, Instant},
@@ -21,6 +23,113 @@ pub(crate) enum AuthenticatedRequestClass {
ServiceProxy,
}
+#[cfg(not(target_arch = "wasm32"))]
+static NATIVE_HTTP_RUNTIME: OnceLock<Result<tokio::runtime::Runtime, String>> = OnceLock::new();
+
+#[cfg(not(target_arch = "wasm32"))]
+fn native_http_runtime() -> Result<&'static tokio::runtime::Runtime, String> {
+ match NATIVE_HTTP_RUNTIME
+ .get_or_init(|| tokio::runtime::Runtime::new().map_err(|error| error.to_string()))
+ {
+ Ok(runtime) => Ok(runtime),
+ Err(reason) => Err(reason.clone()),
+ }
+}
+
+#[cfg(not(target_arch = "wasm32"))]
+pub(crate) struct NativeHttpClient {
+ client: reqwest::Client,
+}
+#[cfg(not(target_arch = "wasm32"))]
+impl NativeHttpClient {
+ pub(crate) fn new() -> Result<Self, SdkError> {
+ native_http_runtime().map_err(|reason| SdkError::Configuration {
+ reason: format!("could not create native HTTP runtime: {reason}"),
+ })?;
+ Ok(Self {
+ client: reqwest::Client::builder()
+ .timeout(Duration::from_secs(30))
+ .redirect(reqwest::redirect::Policy::none())
+ .no_proxy()
+ .build()
+ .map_err(|error| SdkError::Configuration {
+ reason: format!("could not create native HTTP client: {error}"),
+ })?,
+ })
+ }
+}
+#[cfg(not(target_arch = "wasm32"))]
+#[async_trait::async_trait]
+impl HttpClient for NativeHttpClient {
+ async fn execute(&self, request: HttpRequest) -> Result<HttpResponse, HttpError> {
+ let method = reqwest::Method::from_bytes(request.method.as_bytes()).map_err(|error| {
+ HttpError::Transport {
+ reason: format!("invalid HTTP method: {error}"),
+ }
+ })?;
+ let mut headers = reqwest::header::HeaderMap::new();
+ for header in request.headers {
+ let name = reqwest::header::HeaderName::from_bytes(header.name.as_bytes()).map_err(
+ |error| HttpError::Transport {
+ reason: format!("invalid HTTP header name: {error}"),
+ },
+ )?;
+ let value = reqwest::header::HeaderValue::from_str(&header.value).map_err(|error| {
+ HttpError::Transport {
+ reason: format!("invalid HTTP header value: {error}"),
+ }
+ })?;
+ headers.append(name, value);
+ }
+ let mut native = self.client.request(method, request.url).headers(headers);
+ if let Some(body) = request.body {
+ native = native.body(body);
+ }
+ native_http_runtime()
+ .map_err(|reason| HttpError::Transport {
+ reason: format!("could not create native HTTP runtime: {reason}"),
+ })?
+ .spawn(async move {
+ let response = native.send().await.map_err(|error| HttpError::Transport {
+ reason: format!("native HTTP request failed: {error}"),
+ })?;
+ let status = response.status().as_u16();
+ let headers = response
+ .headers()
+ .iter()
+ .map(|(name, value)| {
+ value
+ .to_str()
+ .map(|value| HttpHeader {
+ name: name.as_str().into(),
+ value: value.into(),
+ })
+ .map_err(|error| HttpError::Transport {
+ reason: format!(
+ "native HTTP response contained a non-text header: {error}"
+ ),
+ })
+ })
+ .collect::<Result<Vec<_>, _>>()?;
+ let body = response
+ .bytes()
+ .await
+ .map_err(|error| HttpError::Transport {
+ reason: format!("could not read native HTTP response body: {error}"),
+ })?;
+ Ok(HttpResponse {
+ status,
+ headers,
+ body: body.to_vec(),
+ })
+ })
+ .await
+ .map_err(|error| HttpError::Transport {
+ reason: format!("native HTTP runtime task failed: {error}"),
+ })?
+ }
+}
+
#[uniffi::export(with_foreign)]
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
@@ -446,3 +555,107 @@ fn map_http_error(error: HttpError) -> SdkError {
HttpError::Transport { reason } => SdkError::Transport { reason },
}
}
+
+#[cfg(all(test, not(target_arch = "wasm32")))]
+mod native_http_client_tests {
+ use super::*;
+ use std::{
+ io::{ErrorKind, Read, Write},
+ net::{TcpListener, TcpStream},
+ thread,
+ time::Duration,
+ };
+
+ fn read_request(stream: &mut TcpStream) -> String {
+ stream
+ .set_read_timeout(Some(Duration::from_secs(5)))
+ .unwrap();
+ let mut bytes = Vec::new();
+ let mut chunk = [0; 512];
+ while !bytes.windows(4).any(|window| window == b"\r\n\r\n") {
+ let read = stream.read(&mut chunk).unwrap();
+ assert_ne!(read, 0, "client closed before completing its request");
+ bytes.extend_from_slice(&chunk[..read]);
+ }
+ String::from_utf8(bytes).unwrap()
+ }
+
+ #[tokio::test]
+ async fn native_transport_preserves_duplicate_headers_and_error_bodies() {
+ let listener = TcpListener::bind("127.0.0.1:0").unwrap();
+ let url = format!("http://{}/native", listener.local_addr().unwrap());
+ let server = thread::spawn(move || {
+ let (mut stream, _) = listener.accept().unwrap();
+ let request = read_request(&mut stream).to_ascii_lowercase();
+ assert!(request.contains("x-duplicate: first"));
+ assert!(request.contains("x-duplicate: second"));
+ stream.write_all(b"HTTP/1.1 500 Internal Server Error\r\nx-duplicate: one\r\nx-duplicate: two\r\ncontent-length: 17\r\nconnection: close\r\n\r\nnative error body").unwrap();
+ });
+ let response = NativeHttpClient::new()
+ .unwrap()
+ .execute(HttpRequest {
+ method: "GET".into(),
+ url,
+ headers: vec![
+ HttpHeader {
+ name: "x-duplicate".into(),
+ value: "first".into(),
+ },
+ HttpHeader {
+ name: "x-duplicate".into(),
+ value: "second".into(),
+ },
+ ],
+ body: None,
+ })
+ .await
+ .unwrap();
+ server.join().unwrap();
+ assert_eq!(response.status, 500);
+ assert_eq!(
+ response
+ .headers
+ .iter()
+ .filter(|header| header.name == "x-duplicate")
+ .map(|header| header.value.as_str())
+ .collect::<Vec<_>>(),
+ ["one", "two"]
+ );
+ assert_eq!(response.body, b"native error body");
+ }
+
+ #[tokio::test]
+ async fn native_transport_does_not_replay_bearers_to_redirect_hosts() {
+ let redirected = TcpListener::bind("127.0.0.1:0").unwrap();
+ redirected.set_nonblocking(true).unwrap();
+ let target = format!("http://{}/redirected", redirected.local_addr().unwrap());
+ let listener = TcpListener::bind("127.0.0.1:0").unwrap();
+ let url = format!("http://{}/initial", listener.local_addr().unwrap());
+ let server = thread::spawn(move || {
+ let (mut stream, _) = listener.accept().unwrap();
+ assert!(
+ read_request(&mut stream)
+ .to_ascii_lowercase()
+ .contains("authorization: bearer intended-token")
+ );
+ stream.write_all(format!("HTTP/1.1 302 Found\r\nlocation: {target}\r\ncontent-length: 0\r\nconnection: close\r\n\r\n").as_bytes()).unwrap();
+ });
+ let response = NativeHttpClient::new()
+ .unwrap()
+ .execute(HttpRequest {
+ method: "GET".into(),
+ url,
+ headers: vec![HttpHeader {
+ name: "authorization".into(),
+ value: "Bearer intended-token".into(),
+ }],
+ body: None,
+ })
+ .await
+ .unwrap();
+ server.join().unwrap();
+ thread::sleep(Duration::from_millis(50));
+ assert_eq!(response.status, 302);
+ assert!(matches!(redirected.accept(), Err(error) if error.kind() == ErrorKind::WouldBlock));
+ }
+}
diff --git a/libs/fleet/sdk/tests/binding_generation.rs b/libs/fleet/sdk/tests/binding_generation.rs
index fc462b34a8..24d9291f35 100644
--- a/libs/fleet/sdk/tests/binding_generation.rs
+++ b/libs/fleet/sdk/tests/binding_generation.rs
@@ -51,6 +51,8 @@ fn generated_bindings_hide_raw_credentials_and_claim_update() {
assert!(!python.contains("PoolFailed"));
assert!(!kotlin.contains("PoolTimeout"));
assert!(!kotlin.contains("PoolFailed"));
+ assert!(python.contains("def connect_with_native_http_client"));
+ assert!(python.contains("def connect_with_access_token_and_native_http_client"));
fs::remove_dir_all(output).unwrap();
}
diff --git a/libs/fleet/sdk/tests/public_api.rs b/libs/fleet/sdk/tests/public_api.rs
index cb3dbaa450..acfc56cc62 100644
--- a/libs/fleet/sdk/tests/public_api.rs
+++ b/libs/fleet/sdk/tests/public_api.rs
@@ -97,6 +97,11 @@ fn public_configuration_and_transport_are_constructible() {
assert!(client.is_ok());
}
+#[test]
+fn native_http_client_constructor_is_constructible_without_a_foreign_callback() {
+ assert!(CyclopsClient::connect_with_native_http_client(configuration()).is_ok());
+}
+
#[test]
fn configuration_rejects_invalid_urls_and_polling_values() {
let mut invalid_url = configuration();