Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chore(deps): bump deps (#3011)

Sean Aye571b28607e3a
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lock
index baffff7db7..835893d9e1 100644
--- a/rust/cloud-storage/Cargo.lock
+++ b/rust/cloud-storage/Cargo.lock
@@ -59,7 +59,7 @@ dependencies = [
"macro_user_id",
"model_file_type",
"rand 0.9.3",
- "reqwest",
+ "reqwest 0.13.3",
"schemars",
"secrecy",
"serde",
@@ -206,7 +206,7 @@ version = "0.1.0"
dependencies = [
"chrono",
"hex",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"serde_json",
"sha2",
@@ -283,14 +283,14 @@ dependencies = [
"lazy_static",
"rand 0.9.3",
"regex",
- "reqwest",
- "reqwest-eventsource",
+ "reqwest 0.13.3",
"schemars",
"serde",
"serde_json",
"thiserror 2.0.17",
"tokio",
"tokio-stream",
+ "tokio-util",
"tracing",
]
@@ -423,9 +423,9 @@ dependencies = [
[[package]]
name = "async-openai"
-version = "0.28.3"
+version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4df839a6643e1e3248733b01f229dc4f462d7256f808bbaf04cac40739b345c2"
+checksum = "dafa6acfa9d5138539abe815de90b0a4b7127420e6846c71bb23cf68660641ba"
dependencies = [
"async-openai-macros",
"backoff",
@@ -434,24 +434,26 @@ dependencies = [
"derive_builder",
"eventsource-stream",
"futures",
- "rand 0.8.5",
- "reqwest",
- "reqwest-eventsource",
+ "getrandom 0.3.1",
+ "rand 0.9.3",
+ "reqwest 0.13.3",
"secrecy",
"serde",
"serde_json",
+ "serde_urlencoded",
"thiserror 2.0.17",
"tokio",
"tokio-stream",
"tokio-util",
"tracing",
+ "url",
]
[[package]]
name = "async-openai-macros"
-version = "0.1.0"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0289cba6d5143bfe8251d57b4a8cac036adf158525a76533a7082ba65ec76398"
+checksum = "81872a8e595e8ceceab71c6ba1f9078e313b452a1e31934e6763ef5d308705e4"
dependencies = [
"proc-macro2",
"quote",
@@ -651,7 +653,7 @@ dependencies = [
"redis",
"referral",
"remote_env_var",
- "reqwest",
+ "reqwest 0.13.3",
"roles_and_permissions",
"rsa",
"secretsmanager_client",
@@ -685,7 +687,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"model",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"thiserror 2.0.17",
"tracing",
@@ -1436,39 +1438,6 @@ dependencies = [
"syn 2.0.98",
]
-[[package]]
-name = "axum_rpc"
-version = "0.1.0"
-dependencies = [
- "anyhow",
- "async-trait",
- "axum_rpc_emit",
- "http 1.3.1",
- "js-sys",
- "reqwest-middleware",
- "web-sys",
-]
-
-[[package]]
-name = "axum_rpc_emit"
-version = "0.1.0"
-dependencies = [
- "axum_rpc_parse",
- "cool_asserts",
- "proc-macro2",
- "quote",
- "unsynn",
-]
-
-[[package]]
-name = "axum_rpc_parse"
-version = "0.1.0"
-dependencies = [
- "cool_asserts",
- "quote",
- "unsynn",
-]
-
[[package]]
name = "backfill_entity_access"
version = "0.1.0"
@@ -1557,7 +1526,7 @@ version = "0.71.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"cexpr",
"clang-sys",
"itertools 0.12.1",
@@ -1600,11 +1569,11 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
-version = "2.8.0"
+version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
+checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3"
dependencies = [
- "serde",
+ "serde_core",
]
[[package]]
@@ -1830,6 +1799,12 @@ dependencies = [
"shlex",
]
+[[package]]
+name = "cesu8"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
+
[[package]]
name = "cexpr"
version = "0.6.0"
@@ -2182,7 +2157,7 @@ dependencies = [
"models_opensearch",
"models_permissions",
"notification",
- "reqwest",
+ "reqwest 0.13.3",
"rootcause",
"secretsmanager_client",
"serde",
@@ -2208,7 +2183,7 @@ dependencies = [
"chrono",
"model",
"models_comms",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"serde_json",
"thiserror 2.0.17",
@@ -2302,7 +2277,7 @@ dependencies = [
"anyhow",
"connection_gateway_models",
"model-entity",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"serde_json",
"tracing",
@@ -2578,6 +2553,12 @@ dependencies = [
"cfg-if",
]
+[[package]]
+name = "critical-section"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
+
[[package]]
name = "cron"
version = "0.16.0"
@@ -2590,6 +2571,15 @@ dependencies = [
"winnow",
]
+[[package]]
+name = "crossbeam-channel"
+version = "0.5.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
+dependencies = [
+ "crossbeam-utils",
+]
+
[[package]]
name = "crossbeam-deque"
version = "0.8.6"
@@ -3025,6 +3015,21 @@ dependencies = [
"syn 2.0.98",
]
+[[package]]
+name = "device-info"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2ca8e71544c1b67dcdbc2699ab258828aff985e5bc8d5f6b486d90d7df2f848"
+dependencies = [
+ "core-foundation 0.10.0",
+ "jni 0.21.1",
+ "libc",
+ "thiserror 2.0.17",
+ "wasm-bindgen",
+ "web-sys",
+ "windows-sys 0.59.0",
+]
+
[[package]]
name = "digest"
version = "0.10.7"
@@ -3043,7 +3048,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"objc2",
]
@@ -3125,7 +3130,7 @@ dependencies = [
"readonly_pool",
"redis",
"regex",
- "reqwest",
+ "reqwest 0.13.3",
"roles_and_permissions",
"schemars",
"search_service_client",
@@ -3161,7 +3166,7 @@ dependencies = [
"chrono",
"model",
"models_dcs",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"serde_json",
"thiserror 2.0.17",
@@ -3244,7 +3249,7 @@ dependencies = [
"readonly_pool",
"redis",
"regex",
- "reqwest",
+ "reqwest 0.13.3",
"s3_key",
"saved_views",
"schemars",
@@ -3279,7 +3284,7 @@ dependencies = [
"model",
"models_bulk_upload",
"models_permissions",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"serde_json",
"thiserror 2.0.17",
@@ -3363,7 +3368,7 @@ dependencies = [
"models_permissions",
"models_properties",
"non_empty",
- "reqwest",
+ "reqwest 0.13.3",
"s3_key",
"schemars",
"serde",
@@ -3809,7 +3814,7 @@ dependencies = [
"openssl",
"redis",
"regex",
- "reqwest",
+ "reqwest 0.13.3",
"s3_client",
"schemars",
"scraper",
@@ -3844,7 +3849,7 @@ dependencies = [
"email",
"model",
"models_email",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"serde_json",
"tokio",
@@ -4308,7 +4313,7 @@ dependencies = [
"anyhow",
"base64 0.22.1",
"macro_env",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"serde_json",
"serde_urlencoded",
@@ -4425,12 +4430,6 @@ version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
-[[package]]
-name = "futures-timer"
-version = "3.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24"
-
[[package]]
name = "futures-util"
version = "0.3.31"
@@ -4587,7 +4586,7 @@ dependencies = [
"models_permissions",
"redis",
"regex",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"serde_json",
"sha2",
@@ -4621,7 +4620,7 @@ dependencies = [
"mockall",
"models_email",
"regex",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"serde_json",
"tokio",
@@ -4790,9 +4789,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "hickory-proto"
-version = "0.24.4"
+version = "0.25.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92652067c9ce6f66ce53cc38d1169daa36e6e7eb7dd3b63b5103bd9d97117248"
+checksum = "f8a6fe56c0038198998a6f217ca4e7ef3a5e51f46163bd6dd60b5c71ca6c6502"
dependencies = [
"async-trait",
"cfg-if",
@@ -4804,8 +4803,9 @@ dependencies = [
"idna",
"ipnet",
"once_cell",
- "rand 0.8.5",
- "thiserror 1.0.69",
+ "rand 0.9.3",
+ "ring",
+ "thiserror 2.0.17",
"tinyvec",
"tokio",
"tracing",
@@ -4814,21 +4814,21 @@ dependencies = [
[[package]]
name = "hickory-resolver"
-version = "0.24.4"
+version = "0.25.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cbb117a1ca520e111743ab2f6688eddee69db4e0ea242545a604dce8a66fd22e"
+checksum = "dc62a9a99b0bfb44d2ab95a7208ac952d31060efc16241c87eaf36406fecf87a"
dependencies = [
"cfg-if",
"futures-util",
"hickory-proto",
"ipconfig",
- "lru-cache",
+ "moka",
"once_cell",
"parking_lot",
- "rand 0.8.5",
+ "rand 0.9.3",
"resolv-conf",
"smallvec",
- "thiserror 1.0.69",
+ "thiserror 2.0.17",
"tokio",
"tracing",
]
@@ -5166,7 +5166,7 @@ dependencies = [
"tokio",
"tower-service",
"tracing",
- "windows-registry",
+ "windows-registry 0.5.2",
]
[[package]]
@@ -5414,7 +5414,7 @@ dependencies = [
"macro_env",
"macro_middleware",
"model",
- "reqwest",
+ "reqwest 0.13.3",
"secretsmanager_client",
"serde",
"serde_json",
@@ -5511,7 +5511,7 @@ version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fddf93031af70e75410a2511ec04d49e758ed2f26dad3404a934e0fb45cc12a"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"crossterm",
"dyn-clone",
"fuzzy-matcher",
@@ -5570,14 +5570,15 @@ dependencies = [
[[package]]
name = "ipconfig"
-version = "0.3.2"
+version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f"
+checksum = "4d40460c0ce33d6ce4b0630ad68ff63d6661961c48b6dba35e5a4d81cfb48222"
dependencies = [
- "socket2 0.5.10",
+ "socket2 0.6.1",
"widestring",
- "windows-sys 0.48.0",
- "winreg",
+ "windows-registry 0.6.1",
+ "windows-result 0.4.1",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -5667,6 +5668,80 @@ version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
+[[package]]
+name = "jni"
+version = "0.21.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97"
+dependencies = [
+ "cesu8",
+ "cfg-if",
+ "combine",
+ "jni-sys 0.3.1",
+ "log",
+ "thiserror 1.0.69",
+ "walkdir",
+ "windows-sys 0.45.0",
+]
+
+[[package]]
+name = "jni"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498"
+dependencies = [
+ "cfg-if",
+ "combine",
+ "jni-macros",
+ "jni-sys 0.4.1",
+ "log",
+ "simd_cesu8",
+ "thiserror 2.0.17",
+ "walkdir",
+ "windows-link 0.2.1",
+]
+
+[[package]]
+name = "jni-macros"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "rustc_version",
+ "simd_cesu8",
+ "syn 2.0.98",
+]
+
+[[package]]
+name = "jni-sys"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258"
+dependencies = [
+ "jni-sys 0.4.1",
+]
+
+[[package]]
+name = "jni-sys"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2"
+dependencies = [
+ "jni-sys-macros",
+]
+
+[[package]]
+name = "jni-sys-macros"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264"
+dependencies = [
+ "quote",
+ "syn 2.0.98",
+]
+
[[package]]
name = "jobserver"
version = "0.1.32"
@@ -5678,10 +5753,12 @@ dependencies = [
[[package]]
name = "js-sys"
-version = "0.3.83"
+version = "0.3.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8"
+checksum = "a1840c94c045fbcf8ba2812c95db44499f7c64910a912551aaaa541decebcacf"
dependencies = [
+ "cfg-if",
+ "futures-util",
"once_cell",
"wasm-bindgen",
]
@@ -5829,7 +5906,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"models_search",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"serde_json",
"tokio",
@@ -5894,12 +5971,6 @@ dependencies = [
"glob",
]
-[[package]]
-name = "linked-hash-map"
-version = "0.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
-
[[package]]
name = "linux-raw-sys"
version = "0.9.4"
@@ -5914,11 +5985,12 @@ checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
[[package]]
name = "livekit-api"
-version = "0.4.16"
+version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "020c7eaab7cec16b69a058659f9acff32067e0e2d4f81e80639f3ffa29464b09"
+checksum = "900451a686a1ce8488c420e81a2135831383b03aade6bc3075cf80463d3dd6a4"
dependencies = [
"base64 0.21.7",
+ "device-info",
"http 1.3.1",
"jsonwebtoken 10.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"livekit-protocol",
@@ -5928,20 +6000,20 @@ dependencies = [
"pbjson-types",
"prost 0.12.6",
"rand 0.9.3",
- "reqwest",
+ "reqwest 0.12.28",
"scopeguard",
"serde",
"serde_json",
"sha2",
- "thiserror 1.0.69",
+ "thiserror 2.0.17",
"url",
]
[[package]]
name = "livekit-protocol"
-version = "0.7.2"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c21d56b4dc2598b1296ca891abb225bf1c05ea007d6f43bc4fd48c31be64bf59"
+checksum = "6cf1cc4ab39d7857fb31be648f43aa7068acb54a6960270dccd300dd5c8d0a98"
dependencies = [
"futures-util",
"livekit-runtime",
@@ -5950,7 +6022,7 @@ dependencies = [
"pbjson-types",
"prost 0.12.6",
"serde",
- "thiserror 1.0.69",
+ "thiserror 2.0.17",
"tokio",
]
@@ -5992,7 +6064,7 @@ version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26a24302899fc10d7a785ea5d810ba3c41faa37d0f77847d9f0b16195d3c7a6c"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"cfg-if",
"cssparser 0.35.0",
"encoding_rs",
@@ -6022,15 +6094,6 @@ dependencies = [
"hashbrown 0.16.1",
]
-[[package]]
-name = "lru-cache"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c"
-dependencies = [
- "linked-hash-map",
-]
-
[[package]]
name = "lru-slab"
version = "0.1.2"
@@ -7017,6 +7080,23 @@ dependencies = [
"uuid",
]
+[[package]]
+name = "moka"
+version = "0.12.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "957228ad12042ee839f93c8f257b62b4c0ab5eaae1d4fa60de53b27c9d7c5046"
+dependencies = [
+ "crossbeam-channel",
+ "crossbeam-epoch",
+ "crossbeam-utils",
+ "equivalent",
+ "parking_lot",
+ "portable-atomic",
+ "smallvec",
+ "tagptr",
+ "uuid",
+]
+
[[package]]
name = "moxcms"
version = "0.7.9"
@@ -7117,7 +7197,7 @@ dependencies = [
"axum",
"cool_asserts",
"futures",
- "reqwest",
+ "reqwest 0.13.3",
"rootcause",
"semver",
"serde",
@@ -7151,7 +7231,7 @@ version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"cfg-if",
"cfg_aliases",
"libc",
@@ -7163,7 +7243,7 @@ version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"cfg-if",
"cfg_aliases",
"libc",
@@ -7236,7 +7316,7 @@ dependencies = [
"models_pagination",
"rate_limit",
"redis",
- "reqwest",
+ "reqwest 0.13.3",
"rootcause",
"schemars",
"serde",
@@ -7473,7 +7553,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"objc2",
"objc2-foundation",
]
@@ -7494,7 +7574,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"dispatch2",
"objc2",
]
@@ -7505,7 +7585,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"dispatch2",
"objc2",
"objc2-core-foundation",
@@ -7538,7 +7618,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"objc2",
"objc2-core-foundation",
"objc2-core-graphics",
@@ -7556,7 +7636,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"block2",
"libc",
"objc2",
@@ -7569,7 +7649,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"objc2",
"objc2-core-foundation",
]
@@ -7580,7 +7660,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"objc2",
"objc2-core-foundation",
"objc2-foundation",
@@ -7592,7 +7672,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"block2",
"objc2",
"objc2-cloud-kit",
@@ -7622,6 +7702,10 @@ name = "once_cell"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+dependencies = [
+ "critical-section",
+ "portable-atomic",
+]
[[package]]
name = "opensearch"
@@ -7634,7 +7718,7 @@ dependencies = [
"dyn-clone",
"lazy_static",
"percent-encoding",
- "reqwest",
+ "reqwest 0.12.28",
"rustc_version",
"serde",
"serde_json",
@@ -7678,7 +7762,7 @@ version = "0.10.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"cfg-if",
"foreign-types",
"libc",
@@ -7750,7 +7834,7 @@ dependencies = [
"bytes",
"http 1.3.1",
"opentelemetry",
- "reqwest",
+ "reqwest 0.12.28",
]
[[package]]
@@ -7765,7 +7849,7 @@ dependencies = [
"opentelemetry-proto",
"opentelemetry_sdk",
"prost 0.14.3",
- "reqwest",
+ "reqwest 0.12.28",
"thiserror 2.0.17",
"tokio",
"tonic",
@@ -8003,7 +8087,7 @@ version = "0.8.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2773a939ec2c736640f5f2e62a325c2e1a997d694961c50f17cadfb4c8682e84"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"bytemuck",
"bytes",
"chrono",
@@ -8256,13 +8340,19 @@ version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97baced388464909d42d89643fe4361939af9b7ce7a31ee32a168f832a70f2a0"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"crc32fast",
"fdeflate",
"flate2",
"miniz_oxide",
]
+[[package]]
+name = "portable-atomic"
+version = "1.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
+
[[package]]
name = "powerfmt"
version = "0.2.0"
@@ -8614,6 +8704,7 @@ version = "0.11.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098"
dependencies = [
+ "aws-lc-rs",
"bytes",
"getrandom 0.3.1",
"lru-slab",
@@ -8917,7 +9008,7 @@ version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
]
[[package]]
@@ -9021,37 +9112,26 @@ dependencies = [
[[package]]
name = "reqwest"
-version = "0.12.20"
+version = "0.12.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eabf4c97d9130e2bf606614eb937e86edac8292eaa6f422f995d7e8de1eb1813"
+checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"
dependencies = [
- "async-compression",
"base64 0.22.1",
"bytes",
- "encoding_rs",
"futures-channel",
"futures-core",
"futures-util",
- "h2 0.4.13",
- "hickory-resolver",
"http 1.3.1",
"http-body 1.0.1",
"http-body-util",
"hyper 1.6.0",
- "hyper-rustls 0.27.5",
"hyper-tls 0.6.0",
"hyper-util",
"js-sys",
"log",
- "mime",
- "mime_guess",
"native-tls",
- "once_cell",
"percent-encoding",
"pin-project-lite",
- "quinn",
- "rustls 0.23.36",
- "rustls-native-certs",
"rustls-pki-types",
"serde",
"serde_json",
@@ -9059,46 +9139,60 @@ dependencies = [
"sync_wrapper",
"tokio",
"tokio-native-tls",
- "tokio-rustls 0.26.4",
- "tokio-util",
"tower 0.5.2",
"tower-http",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
- "wasm-streams",
"web-sys",
]
[[package]]
-name = "reqwest-eventsource"
-version = "0.6.0"
+name = "reqwest"
+version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "632c55746dbb44275691640e7b40c907c16a2dc1a5842aa98aaec90da6ec6bde"
+checksum = "62e0021ea2c22aed41653bc7e1419abb2c97e038ff2c33d0e1309e49a97deec0"
dependencies = [
- "eventsource-stream",
+ "base64 0.22.1",
+ "bytes",
+ "encoding_rs",
"futures-core",
- "futures-timer",
+ "futures-util",
+ "h2 0.4.13",
+ "hickory-resolver",
+ "http 1.3.1",
+ "http-body 1.0.1",
+ "http-body-util",
+ "hyper 1.6.0",
+ "hyper-rustls 0.27.5",
+ "hyper-util",
+ "js-sys",
+ "log",
"mime",
- "nom 7.1.3",
+ "mime_guess",
+ "once_cell",
+ "percent-encoding",
"pin-project-lite",
- "reqwest",
- "thiserror 1.0.69",
-]
-
-[[package]]
-name = "reqwest-middleware"
-version = "0.4.2"
-source = "git+https://github.com/seanaye/reqwest-middleware#1e4298aaac963498ffe3c84c83c6748afd03593d"
-dependencies = [
- "anyhow",
- "async-trait",
- "http 1.3.1",
- "reqwest",
+ "quinn",
+ "rustls 0.23.36",
+ "rustls-pki-types",
+ "rustls-platform-verifier",
"serde",
- "thiserror 2.0.17",
+ "serde_json",
+ "serde_urlencoded",
+ "sync_wrapper",
+ "tokio",
+ "tokio-rustls 0.26.4",
+ "tokio-util",
+ "tower 0.5.2",
+ "tower-http",
"tower-service",
+ "url",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "wasm-streams",
+ "web-sys",
]
[[package]]
@@ -9321,7 +9415,7 @@ version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"errno",
"libc",
"linux-raw-sys",
@@ -9364,7 +9458,7 @@ dependencies = [
"openssl-probe",
"rustls-pki-types",
"schannel",
- "security-framework 3.2.0",
+ "security-framework 3.7.0",
]
[[package]]
@@ -9377,6 +9471,33 @@ dependencies = [
"zeroize",
]
+[[package]]
+name = "rustls-platform-verifier"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0"
+dependencies = [
+ "core-foundation 0.10.0",
+ "core-foundation-sys",
+ "jni 0.22.4",
+ "log",
+ "once_cell",
+ "rustls 0.23.36",
+ "rustls-native-certs",
+ "rustls-platform-verifier-android",
+ "rustls-webpki 0.103.12",
+ "security-framework 3.7.0",
+ "security-framework-sys",
+ "webpki-root-certs",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "rustls-platform-verifier-android"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
+
[[package]]
name = "rustls-webpki"
version = "0.101.7"
@@ -9687,7 +9808,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"models_search",
- "reqwest",
+ "reqwest 0.13.3",
"tracing",
]
@@ -9766,7 +9887,7 @@ version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"core-foundation 0.9.4",
"core-foundation-sys",
"libc",
@@ -9775,11 +9896,11 @@ dependencies = [
[[package]]
name = "security-framework"
-version = "3.2.0"
+version = "3.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316"
+checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"core-foundation 0.10.0",
"core-foundation-sys",
"libc",
@@ -9788,9 +9909,9 @@ dependencies = [
[[package]]
name = "security-framework-sys"
-version = "2.14.0"
+version = "2.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32"
+checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"
dependencies = [
"core-foundation-sys",
"libc",
@@ -9822,7 +9943,7 @@ dependencies = [
"models_email",
"models_permissions",
"rand 0.9.3",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"serde_json",
"sqlx",
@@ -9838,7 +9959,7 @@ version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eb30575f3638fc8f6815f448d50cb1a2e255b0897985c8c59f4d37b72a07b06"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"cssparser 0.31.2",
"derive_more",
"fxhash",
@@ -9857,7 +9978,7 @@ version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b75e048a93e14929e68e37b82e207db957cbb368375a80ed3ca28ac75080856"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"cssparser 0.35.0",
"derive_more",
"fxhash",
@@ -10210,6 +10331,16 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
+[[package]]
+name = "simd_cesu8"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94f90157bb87cddf702797c5dadfa0be7d266cdf49e22da2fcaa32eff75b2c33"
+dependencies = [
+ "rustc_version",
+ "simdutf8",
+]
+
[[package]]
name = "simd_helpers"
version = "0.1.0"
@@ -10219,6 +10350,12 @@ dependencies = [
"quote",
]
+[[package]]
+name = "simdutf8"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
+
[[package]]
name = "simple_asn1"
version = "0.6.3"
@@ -10508,7 +10645,7 @@ checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526"
dependencies = [
"atoi",
"base64 0.22.1",
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"byteorder",
"bytes",
"chrono",
@@ -10552,7 +10689,7 @@ checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46"
dependencies = [
"atoi",
"base64 0.22.1",
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"byteorder",
"chrono",
"crc",
@@ -10669,7 +10806,7 @@ dependencies = [
"mime",
"model-entity",
"non_empty",
- "reqwest",
+ "reqwest 0.13.3",
"tracing",
]
@@ -10716,7 +10853,7 @@ dependencies = [
"anyhow",
"bytes",
"models_sfs",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"serde_json",
"tokio",
@@ -10843,7 +10980,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"model",
- "reqwest",
+ "reqwest 0.13.3",
"serde",
"tokio",
"tracing",
@@ -10875,7 +11012,7 @@ version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"core-foundation 0.9.4",
"system-configuration-sys",
]
@@ -10907,6 +11044,12 @@ dependencies = [
"uuid",
]
+[[package]]
+name = "tagptr"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
+
[[package]]
name = "teams"
version = "0.1.0"
@@ -11323,12 +11466,12 @@ dependencies = [
[[package]]
name = "tower-http"
-version = "0.6.6"
+version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2"
+checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
dependencies = [
"async-compression",
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"bytes",
"futures-core",
"futures-util",
@@ -11533,7 +11676,7 @@ dependencies = [
"macro_cors",
"macro_entrypoint",
"macro_env",
- "reqwest",
+ "reqwest 0.13.3",
"scraper",
"serde",
"serde_json",
@@ -11944,9 +12087,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
[[package]]
name = "wasm-bindgen"
-version = "0.2.106"
+version = "0.2.120"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd"
+checksum = "df52b6d9b87e0c74c9edfa1eb2d9bf85e5d63515474513aa50fa181b3c4f5db1"
dependencies = [
"cfg-if",
"once_cell",
@@ -11957,21 +12100,19 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.45"
+version = "0.4.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b"
+checksum = "af934872acec734c2d80e6617bbb5ff4f12b052dd8e6332b0817bce889516084"
dependencies = [
- "cfg-if",
"js-sys",
"wasm-bindgen",
- "web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.106"
+version = "0.2.120"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3"
+checksum = "78b1041f495fb322e64aca85f5756b2172e35cd459376e67f2a6c9dffcedb103"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -11979,9 +12120,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.106"
+version = "0.2.120"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40"
+checksum = "9dcd0ff20416988a18ac686d4d4d0f6aae9ebf08a389ff5d29012b05af2a1b41"
dependencies = [
"bumpalo",
"proc-macro2",
@@ -11992,9 +12133,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.106"
+version = "0.2.120"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4"
+checksum = "49757b3c82ebf16c57d69365a142940b384176c24df52a087fb748e2085359ea"
dependencies = [
"unicode-ident",
]
@@ -12023,9 +12164,9 @@ dependencies = [
[[package]]
name = "wasm-streams"
-version = "0.4.2"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65"
+checksum = "9d1ec4f6517c9e11ae630e200b2b65d193279042e28edd4a2cda233e46670bbb"
dependencies = [
"futures-util",
"js-sys",
@@ -12040,7 +12181,7 @@ version = "0.244.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"hashbrown 0.15.2",
"indexmap 2.12.1",
"semver",
@@ -12048,9 +12189,9 @@ dependencies = [
[[package]]
name = "web-sys"
-version = "0.3.72"
+version = "0.3.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112"
+checksum = "2eadbac71025cd7b0834f20d1fe8472e8495821b4e9801eb0a60bd1f19827602"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -12088,6 +12229,15 @@ dependencies = [
"libwebp-sys",
]
+[[package]]
+name = "webpki-root-certs"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f31141ce3fc3e300ae89b78c0dd67f9708061d1d2eda54b8209346fd6be9a92c"
+dependencies = [
+ "rustls-pki-types",
+]
+
[[package]]
name = "webpki-roots"
version = "0.26.11"
@@ -12187,8 +12337,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3bab093bdd303a1240bb99b8aba8ea8a69ee19d34c9e2ef9594e708a4878820"
dependencies = [
"windows-link 0.1.1",
- "windows-result",
- "windows-strings",
+ "windows-result 0.3.4",
+ "windows-strings 0.4.2",
+]
+
+[[package]]
+name = "windows-registry"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
+dependencies = [
+ "windows-link 0.2.1",
+ "windows-result 0.4.1",
+ "windows-strings 0.5.1",
]
[[package]]
@@ -12200,6 +12361,15 @@ dependencies = [
"windows-link 0.1.1",
]
+[[package]]
+name = "windows-result"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
+dependencies = [
+ "windows-link 0.2.1",
+]
+
[[package]]
name = "windows-strings"
version = "0.4.2"
@@ -12209,6 +12379,24 @@ dependencies = [
"windows-link 0.1.1",
]
+[[package]]
+name = "windows-strings"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
+dependencies = [
+ "windows-link 0.2.1",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.45.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
+dependencies = [
+ "windows-targets 0.42.2",
+]
+
[[package]]
name = "windows-sys"
version = "0.48.0"
@@ -12254,6 +12442,21 @@ dependencies = [
"windows-link 0.2.1",
]
+[[package]]
+name = "windows-targets"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
+dependencies = [
+ "windows_aarch64_gnullvm 0.42.2",
+ "windows_aarch64_msvc 0.42.2",
+ "windows_i686_gnu 0.42.2",
+ "windows_i686_msvc 0.42.2",
+ "windows_x86_64_gnu 0.42.2",
+ "windows_x86_64_gnullvm 0.42.2",
+ "windows_x86_64_msvc 0.42.2",
+]
+
[[package]]
name = "windows-targets"
version = "0.48.5"
@@ -12302,6 +12505,12 @@ dependencies = [
"windows_x86_64_msvc 0.53.1",
]
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
+
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
@@ -12320,6 +12529,12 @@ version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
+
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
@@ -12338,6 +12553,12 @@ version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
+[[package]]
+name = "windows_i686_gnu"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
+
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
@@ -12368,6 +12589,12 @@ version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
+[[package]]
+name = "windows_i686_msvc"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
+
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
@@ -12386,6 +12613,12 @@ version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
+
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
@@ -12404,6 +12637,12 @@ version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
+
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
@@ -12422,6 +12661,12 @@ version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
+
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
@@ -12449,16 +12694,6 @@ dependencies = [
"memchr",
]
-[[package]]
-name = "winreg"
-version = "0.50.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
-dependencies = [
- "cfg-if",
- "windows-sys 0.48.0",
-]
-
[[package]]
name = "wit-bindgen"
version = "0.51.0"
@@ -12485,7 +12720,7 @@ version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
dependencies = [
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
]
[[package]]
@@ -12526,7 +12761,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"
dependencies = [
"anyhow",
- "bitflags 2.8.0",
+ "bitflags 2.11.1",
"indexmap 2.12.1",
"log",
"serde",
diff --git a/rust/cloud-storage/Cargo.toml b/rust/cloud-storage/Cargo.toml
index b466bd9cfc..26fe047cee 100644
--- a/rust/cloud-storage/Cargo.toml
+++ b/rust/cloud-storage/Cargo.toml
@@ -110,9 +110,6 @@ members = [
"readonly_pool",
"referral",
"roles_and_permissions",
- "rpc/axum_rpc",
- "rpc/axum_rpc_emit",
- "rpc/axum_rpc_parse",
"s3_client",
"s3_key",
"scheduled_action",
@@ -146,7 +143,7 @@ members = [
[workspace.dependencies]
anyhow = "1.0.93"
askama = "0.14"
-async-openai = { version = "0.28.3", features = ["byot"] }
+async-openai = { version = "0.36.1", features = ["byot", "chat-completion", "completions"] }
async-stream = "0.3.6"
async-trait = "0.1.86"
aws-config = { version = "1.8.12", features = ["behavior-version-latest"] }
@@ -203,8 +200,7 @@ rand = "0.9.0"
recursion = "0.5.4"
redis = "1.0.3"
regex = "1.11.1"
-reqwest = { version = "0.12.12", features = ["hickory-dns", "json"] }
-reqwest-middleware = { git = "https://github.com/seanaye/reqwest-middleware" }
+reqwest = { version = "0.13", features = ["form", "hickory-dns", "json"] }
rootcause = "0.11"
schemars = { version = "1.0.4", features = ["chrono04", "uuid1"] }
semver = { version = "1", features = ["serde"] }
diff --git a/rust/cloud-storage/ai/src/chat_completion.rs b/rust/cloud-storage/ai/src/chat_completion.rs
index 9afc26657a..a4d5d1ad0b 100644
--- a/rust/cloud-storage/ai/src/chat_completion.rs
+++ b/rust/cloud-storage/ai/src/chat_completion.rs
@@ -1,6 +1,6 @@
/* Non-streaming chat completion via Anthropic */
use crate::types::{AnthropicClient, ChatCompletionError, ChatCompletionRequest, ExtendedClient};
-use async_openai::types::CreateChatCompletionRequest;
+use async_openai::types::chat::CreateChatCompletionRequest;
use futures::StreamExt;
#[tracing::instrument(skip(request), fields(model=?request.model, message_count=?request.messages.len()))]
diff --git a/rust/cloud-storage/ai/src/chat_stream.rs b/rust/cloud-storage/ai/src/chat_stream.rs
index 349765cf56..b0e2dffb4a 100644
--- a/rust/cloud-storage/ai/src/chat_stream.rs
+++ b/rust/cloud-storage/ai/src/chat_stream.rs
@@ -2,7 +2,7 @@
use crate::types::OpenRouterClient;
use crate::types::{ChatCompletionRequest, ChatStreamCompletionResponse};
use anyhow::{Context, Result};
-use async_openai::types::CreateChatCompletionRequest;
+use async_openai::types::chat::CreateChatCompletionRequest;
use futures::{Stream, StreamExt};
use std::pin::Pin;
diff --git a/rust/cloud-storage/ai/src/openai_toolset.rs b/rust/cloud-storage/ai/src/openai_toolset.rs
index c4aa95bc20..a3f1aedbdf 100644
--- a/rust/cloud-storage/ai/src/openai_toolset.rs
+++ b/rust/cloud-storage/ai/src/openai_toolset.rs
@@ -5,12 +5,11 @@
use ai_toolset::ToolSet;
use ai_toolset::tool_object::ToolObject;
-use async_openai::types::{ChatCompletionTool, ChatCompletionToolType, FunctionObject};
+use async_openai::types::chat::{ChatCompletionTool, ChatCompletionTools, FunctionObject};
/// Converts a ToolObject to an OpenAI ChatCompletionTool.
pub fn tool_object_to_chat_completion_tool<T>(value: &ToolObject<T>) -> ChatCompletionTool {
ChatCompletionTool {
- r#type: ChatCompletionToolType::Function,
function: FunctionObject {
name: value.name.clone(),
description: Some(value.description.clone()),
@@ -25,14 +24,14 @@ pub trait OpenAIToolSetExt {
/// Converts this toolset to a vector of OpenAI chat completion tools.
///
/// Returns tool definitions suitable for use with OpenAI's function calling API.
- fn openai_chatcompletion_toolset(&self) -> Vec<ChatCompletionTool>;
+ fn openai_chatcompletion_toolset(&self) -> Vec<ChatCompletionTools>;
}
impl<T> OpenAIToolSetExt for ToolSet<ToolObject<T>> {
- fn openai_chatcompletion_toolset(&self) -> Vec<ChatCompletionTool> {
+ fn openai_chatcompletion_toolset(&self) -> Vec<ChatCompletionTools> {
self.tools
.values()
- .map(tool_object_to_chat_completion_tool)
+ .map(|t| ChatCompletionTools::Function(tool_object_to_chat_completion_tool(t)))
.collect()
}
}
diff --git a/rust/cloud-storage/ai/src/simple_completion.rs b/rust/cloud-storage/ai/src/simple_completion.rs
index 1b95031cb4..ea864fa08d 100644
--- a/rust/cloud-storage/ai/src/simple_completion.rs
+++ b/rust/cloud-storage/ai/src/simple_completion.rs
@@ -1,7 +1,8 @@
use crate::types::Model;
use crate::types::OpenRouterClient;
use anyhow::Result;
-use async_openai::types::{CreateCompletionRequestArgs, Prompt};
+use async_openai::types::chat::Prompt;
+use async_openai::types::completions::CreateCompletionRequestArgs;
pub async fn simple_completion(prompt: &str, request: &str, model: Model) -> Result<String> {
let client = OpenRouterClient::new();
diff --git a/rust/cloud-storage/ai/src/structured_output.rs b/rust/cloud-storage/ai/src/structured_output.rs
index 9000b4c7cd..65d6681fd4 100644
--- a/rust/cloud-storage/ai/src/structured_output.rs
+++ b/rust/cloud-storage/ai/src/structured_output.rs
@@ -1,5 +1,5 @@
use anyhow::{Context, Result};
-use async_openai::types::{
+use async_openai::types::chat::{
ChatCompletionRequestSystemMessage, ChatCompletionRequestUserMessage,
CreateChatCompletionRequestArgs, ResponseFormat, ResponseFormatJsonSchema,
};
diff --git a/rust/cloud-storage/ai/src/tool/completion.rs b/rust/cloud-storage/ai/src/tool/completion.rs
index 3783436fab..7bc1b33cd1 100644
--- a/rust/cloud-storage/ai/src/tool/completion.rs
+++ b/rust/cloud-storage/ai/src/tool/completion.rs
@@ -3,7 +3,10 @@ use super::types::tool_object::ToolObject;
use crate::openai_toolset::tool_object_to_chat_completion_tool;
use crate::types::{AiError, Result};
use crate::types::{ChatCompletionRequest, OpenRouterClient};
-use async_openai::types::{ChatCompletionToolChoiceOption, CreateChatCompletionRequest};
+use async_openai::types::chat::{
+ ChatCompletionMessageToolCalls, ChatCompletionToolChoiceOption, ChatCompletionTools,
+ CreateChatCompletionRequest, ToolChoiceOptions,
+};
#[tracing::instrument(skip(tool))]
pub async fn tool_completion<T>(
@@ -11,9 +14,13 @@ pub async fn tool_completion<T>(
tool: &ToolObject<T>,
) -> Result<ToolCall> {
let mut request: CreateChatCompletionRequest = request.try_into()?;
- request.tools = Some(vec![tool_object_to_chat_completion_tool(tool)]);
+ request.tools = Some(vec![ChatCompletionTools::Function(
+ tool_object_to_chat_completion_tool(tool),
+ )]);
request.n = Some(1);
- request.tool_choice = Some(ChatCompletionToolChoiceOption::Required);
+ request.tool_choice = Some(ChatCompletionToolChoiceOption::Mode(
+ ToolChoiceOptions::Required,
+ ));
let client = OpenRouterClient::new();
let response = client.chat().create(request).await?;
@@ -30,10 +37,15 @@ pub async fn tool_completion<T>(
.ok_or_else(|| AiError::from(anyhow::anyhow!("No tool calls")))?
.first()
.ok_or_else(|| AiError::from(anyhow::anyhow!("No tool calls")))?;
- Ok(ToolCall {
- id: call.id.clone(),
- json: serde_json::from_str(&call.function.arguments)?,
- name: call.function.name.clone(),
- })
+ match call {
+ ChatCompletionMessageToolCalls::Function(tool_call) => Ok(ToolCall {
+ id: tool_call.id.clone(),
+ json: serde_json::from_str(&tool_call.function.arguments)?,
+ name: tool_call.function.name.clone(),
+ }),
+ ChatCompletionMessageToolCalls::Custom(_) => Err(AiError::from(anyhow::anyhow!(
+ "Unexpected custom tool call"
+ ))),
+ }
})
}
diff --git a/rust/cloud-storage/ai/src/tool/tool_loop/chat/agent.rs b/rust/cloud-storage/ai/src/tool/tool_loop/chat/agent.rs
index 145e28ee4f..eeda1dc820 100644
--- a/rust/cloud-storage/ai/src/tool/tool_loop/chat/agent.rs
+++ b/rust/cloud-storage/ai/src/tool/tool_loop/chat/agent.rs
@@ -8,11 +8,11 @@ use crate::types::openai::message::convert_message;
use crate::types::traits::{ExtendedOpenAIStream, ExtendedOpenAIStreamItem};
use crate::types::{ChatCompletionRequest, ChatMessage, ChatMessages};
use crate::types::{ExtendedClient, Result};
-use async_openai::types::{
- ChatCompletionMessageToolCall, ChatCompletionRequestAssistantMessage,
- ChatCompletionRequestAssistantMessageContent, ChatCompletionRequestMessage,
- ChatCompletionRequestToolMessage, ChatCompletionStreamOptions, CreateChatCompletionRequest,
- FinishReason, FunctionCall,
+use async_openai::types::chat::{
+ ChatCompletionMessageToolCall, ChatCompletionMessageToolCalls,
+ ChatCompletionRequestAssistantMessage, ChatCompletionRequestAssistantMessageContent,
+ ChatCompletionRequestMessage, ChatCompletionRequestToolMessage, ChatCompletionStreamOptions,
+ CreateChatCompletionRequest, FinishReason, FunctionCall,
};
use async_stream::stream;
use futures::stream::StreamExt;
@@ -160,7 +160,7 @@ where
// Current assistant segment being built
let mut content = String::new();
- let mut tool_calls: Vec<ChatCompletionMessageToolCall> = vec![];
+ let mut tool_calls: Vec<ChatCompletionMessageToolCalls> = vec![];
let mut pending_tool_messages: Vec<ChatCompletionRequestMessage> = vec![];
for item in stream_parts {
@@ -171,14 +171,15 @@ where
StreamPart::ToolCall(call) => {
self.tool_call_id_name_mapping
.insert(call.id.clone(), call.name.clone());
- tool_calls.push(ChatCompletionMessageToolCall {
- id: call.id.clone(),
- r#type: async_openai::types::ChatCompletionToolType::Function,
- function: FunctionCall {
- arguments: call.json.to_string(),
- name: call.name.clone(),
+ tool_calls.push(ChatCompletionMessageToolCalls::Function(
+ ChatCompletionMessageToolCall {
+ id: call.id.clone(),
+ function: FunctionCall {
+ arguments: call.json.to_string(),
+ name: call.name.clone(),
+ },
},
- });
+ ));
}
StreamPart::Content(text) => content.push_str(text.as_str()),
StreamPart::ToolResponse(ToolResponse::Json { id, json, .. }) => {
@@ -193,7 +194,7 @@ where
.unwrap_or_else(|_| "internal error parsing".into());
new_messages.push(ChatCompletionRequestMessage::Tool(
ChatCompletionRequestToolMessage {
- content: async_openai::types::ChatCompletionRequestToolMessageContent::Text(
+ content: async_openai::types::chat::ChatCompletionRequestToolMessageContent::Text(
content_text,
),
tool_call_id: id,
@@ -208,14 +209,15 @@ where
StreamPart::ToolCall(call) => {
self.tool_call_id_name_mapping
.insert(call.id.clone(), call.name.clone());
- tool_calls.push(ChatCompletionMessageToolCall {
- id: call.id.clone(),
- r#type: async_openai::types::ChatCompletionToolType::Function,
- function: FunctionCall {
- arguments: call.json.to_string(),
- name: call.name.clone(),
+ tool_calls.push(ChatCompletionMessageToolCalls::Function(
+ ChatCompletionMessageToolCall {
+ id: call.id.clone(),
+ function: FunctionCall {
+ arguments: call.json.to_string(),
+ name: call.name.clone(),
+ },
},
- });
+ ));
let tool_response_text = match self
.toolset
@@ -266,7 +268,7 @@ where
// response message in message chain
pending_tool_messages.push(ChatCompletionRequestMessage::Tool(
ChatCompletionRequestToolMessage {
- content: async_openai::types::ChatCompletionRequestToolMessageContent::Text(
+ content: async_openai::types::chat::ChatCompletionRequestToolMessageContent::Text(
tool_response_text,
),
tool_call_id: call.id,
@@ -292,7 +294,7 @@ where
fn make_assistant_message(
&self,
content: &mut String,
- tool_calls: &mut Vec<ChatCompletionMessageToolCall>,
+ tool_calls: &mut Vec<ChatCompletionMessageToolCalls>,
) -> ChatCompletionRequestMessage {
ChatCompletionRequestMessage::Assistant(ChatCompletionRequestAssistantMessage {
content: if content.is_empty() {
@@ -400,7 +402,8 @@ where
self.request.tools = Some(self.toolset.openai_chatcompletion_toolset());
self.request.stream = Some(true);
self.request.stream_options = Some(ChatCompletionStreamOptions {
- include_usage: true,
+ include_usage: Some(true),
+ include_obfuscation: None,
});
self.client.chat_stream(self.request.clone()).await
@@ -413,13 +416,13 @@ fn correct_message_chain(
messages: Vec<ChatCompletionRequestMessage>,
) -> Vec<ChatCompletionRequestMessage> {
let mut corrected = vec![];
- let mut pending_tool_calls: Option<Vec<ChatCompletionMessageToolCall>> = None;
+ let mut pending_tool_call_ids: Option<Vec<String>> = None;
let mut i = 0;
while i < messages.len() {
let msg = &messages[i];
- if let Some(expected) = pending_tool_calls.take() {
+ if let Some(expected_ids) = pending_tool_call_ids.take() {
// Consume as many matching tool responses as we can
let mut responded: HashSet<String> = HashSet::new();
while i < messages.len() {
@@ -432,14 +435,14 @@ fn correct_message_chain(
}
}
// Backfill any missing tool responses
- for call in &expected {
- if !responded.contains(&call.id) {
- tracing::warn!(call_id=?call.id, "missing tool response");
+ for id in &expected_ids {
+ if !responded.contains(id) {
+ tracing::warn!(call_id=?id, "missing tool response");
corrected.push(ChatCompletionRequestMessage::Tool(
ChatCompletionRequestToolMessage {
- tool_call_id: call.id.clone(),
+ tool_call_id: id.clone(),
content:
- async_openai::types::ChatCompletionRequestToolMessageContent::Text(
+ async_openai::types::chat::ChatCompletionRequestToolMessageContent::Text(
"No response from server".into(),
),
},
@@ -448,7 +451,15 @@ fn correct_message_chain(
}
} else {
if let ChatCompletionRequestMessage::Assistant(assistant) = msg {
- pending_tool_calls = assistant.tool_calls.clone();
+ pending_tool_call_ids = assistant.tool_calls.as_ref().map(|calls| {
+ calls
+ .iter()
+ .filter_map(|c| match c {
+ ChatCompletionMessageToolCalls::Function(f) => Some(f.id.clone()),
+ _ => None,
+ })
+ .collect()
+ });
}
corrected.push(messages[i].clone());
i += 1;
@@ -456,15 +467,16 @@ fn correct_message_chain(
}
// Handle trailing assistant with tool_calls but no responses at end of messages
- if let Some(expected) = pending_tool_calls {
- for call in &expected {
- tracing::warn!(call_id=?call.id, "missing tool response");
+ if let Some(expected_ids) = pending_tool_call_ids {
+ for id in &expected_ids {
+ tracing::warn!(call_id=?id, "missing tool response");
corrected.push(ChatCompletionRequestMessage::Tool(
ChatCompletionRequestToolMessage {
- tool_call_id: call.id.clone(),
- content: async_openai::types::ChatCompletionRequestToolMessageContent::Text(
- "No response from server".into(),
- ),
+ tool_call_id: id.clone(),
+ content:
+ async_openai::types::chat::ChatCompletionRequestToolMessageContent::Text(
+ "No response from server".into(),
+ ),
},
));
}
diff --git a/rust/cloud-storage/ai/src/tool/tool_loop/chat/test.rs b/rust/cloud-storage/ai/src/tool/tool_loop/chat/test.rs
index 32c1ce9cfe..d9a6e98eee 100644
--- a/rust/cloud-storage/ai/src/tool/tool_loop/chat/test.rs
+++ b/rust/cloud-storage/ai/src/tool/tool_loop/chat/test.rs
@@ -8,11 +8,11 @@ use crate::types::openai::message::convert_message;
use crate::types::traits::{ExtendedOpenAIStream, ExtendedOpenAIStreamItem};
use crate::types::{ChatCompletionRequest, ChatMessage, ChatMessages};
use crate::types::{ExtendedClient, Result};
-use async_openai::types::{
- ChatCompletionMessageToolCall, ChatCompletionRequestAssistantMessage,
- ChatCompletionRequestAssistantMessageContent, ChatCompletionRequestMessage,
- ChatCompletionRequestToolMessage, ChatCompletionStreamOptions, CreateChatCompletionRequest,
- FinishReason, FunctionCall,
+use async_openai::types::chat::{
+ ChatCompletionMessageToolCall, ChatCompletionMessageToolCalls,
+ ChatCompletionRequestAssistantMessage, ChatCompletionRequestAssistantMessageContent,
+ ChatCompletionRequestMessage, ChatCompletionRequestToolMessage, ChatCompletionStreamOptions,
+ CreateChatCompletionRequest, FinishReason, FunctionCall,
};
use async_stream::stream;
use futures::stream::StreamExt;
@@ -153,7 +153,7 @@ where
// Current assistant segment being built
let mut content = String::new();
- let mut tool_calls: Vec<ChatCompletionMessageToolCall> = vec![];
+ let mut tool_calls: Vec<ChatCompletionMessageToolCalls> = vec![];
let mut pending_tool_messages: Vec<ChatCompletionRequestMessage> = vec![];
for item in stream_parts {
@@ -164,14 +164,15 @@ where
StreamPart::ToolCall(call) => {
self.tool_call_id_name_mapping
.insert(call.id.clone(), call.name.clone());
- tool_calls.push(ChatCompletionMessageToolCall {
- id: call.id.clone(),
- r#type: async_openai::types::ChatCompletionToolType::Function,
- function: FunctionCall {
- arguments: call.json.to_string(),
- name: call.name.clone(),
+ tool_calls.push(ChatCompletionMessageToolCalls::Function(
+ ChatCompletionMessageToolCall {
+ id: call.id.clone(),
+ function: FunctionCall {
+ arguments: call.json.to_string(),
+ name: call.name.clone(),
+ },
},
- });
+ ));
}
StreamPart::Content(text) => content.push_str(text.as_str()),
StreamPart::ToolResponse(ToolResponse::Json { id, json, .. }) => {
@@ -186,7 +187,7 @@ where
.unwrap_or_else(|_| "internal error parsing".into());
messages.push(ChatCompletionRequestMessage::Tool(
ChatCompletionRequestToolMessage {
- content: async_openai::types::ChatCompletionRequestToolMessageContent::Text(
+ content: async_openai::types::chat::ChatCompletionRequestToolMessageContent::Text(
content_text,
),
tool_call_id: id,
@@ -201,14 +202,15 @@ where
StreamPart::ToolCall(call) => {
self.tool_call_id_name_mapping
.insert(call.id.clone(), call.name.clone());
- tool_calls.push(ChatCompletionMessageToolCall {
- id: call.id.clone(),
- r#type: async_openai::types::ChatCompletionToolType::Function,
- function: FunctionCall {
- arguments: call.json.to_string(),
- name: call.name.clone(),
+ tool_calls.push(ChatCompletionMessageToolCalls::Function(
+ ChatCompletionMessageToolCall {
+ id: call.id.clone(),
+ function: FunctionCall {
+ arguments: call.json.to_string(),
+ name: call.name.clone(),
+ },
},
- });
+ ));
let tool_response = match self
.toolset
@@ -254,7 +256,7 @@ where
pending_tool_messages.push(ChatCompletionRequestMessage::Tool(
ChatCompletionRequestToolMessage {
- content: async_openai::types::ChatCompletionRequestToolMessageContent::Text(
+ content: async_openai::types::chat::ChatCompletionRequestToolMessageContent::Text(
tool_response,
),
tool_call_id: call.id,
@@ -280,7 +282,7 @@ where
fn make_assistant_message(
&self,
content: &mut String,
- tool_calls: &mut Vec<ChatCompletionMessageToolCall>,
+ tool_calls: &mut Vec<ChatCompletionMessageToolCalls>,
) -> ChatCompletionRequestMessage {
ChatCompletionRequestMessage::Assistant(ChatCompletionRequestAssistantMessage {
content: if content.is_empty() {
@@ -388,7 +390,8 @@ where
self.request.tools = Some(self.toolset.openai_chatcompletion_toolset());
self.request.stream = Some(true);
self.request.stream_options = Some(ChatCompletionStreamOptions {
- include_usage: true,
+ include_usage: Some(true),
+ include_obfuscation: None,
});
self.client.chat_stream(self.request.clone()).await
@@ -400,11 +403,11 @@ mod tests {
use super::*;
use crate::types::noop::NoOpClient;
use crate::types::{AssistantMessagePart, ChatMessageContent, Role};
- use async_openai::types::{
- ChatCompletionMessageToolCall, ChatCompletionRequestAssistantMessage,
- ChatCompletionRequestAssistantMessageContent, ChatCompletionRequestMessage,
- ChatCompletionRequestToolMessage, ChatCompletionRequestToolMessageContent,
- ChatCompletionToolType, FunctionCall,
+ use async_openai::types::chat::{
+ ChatCompletionMessageToolCall, ChatCompletionMessageToolCalls,
+ ChatCompletionRequestAssistantMessage, ChatCompletionRequestAssistantMessageContent,
+ ChatCompletionRequestMessage, ChatCompletionRequestToolMessage,
+ ChatCompletionRequestToolMessageContent, FunctionCall,
};
use serde_json::json;
@@ -428,18 +431,20 @@ mod tests {
// Add some initial messages
chat.messages = vec![
ChatCompletionRequestMessage::System(
- async_openai::types::ChatCompletionRequestSystemMessage {
- content: async_openai::types::ChatCompletionRequestSystemMessageContent::Text(
- "System message".to_string(),
- ),
+ async_openai::types::chat::ChatCompletionRequestSystemMessage {
+ content:
+ async_openai::types::chat::ChatCompletionRequestSystemMessageContent::Text(
+ "System message".to_string(),
+ ),
..Default::default()
},
),
ChatCompletionRequestMessage::User(
- async_openai::types::ChatCompletionRequestUserMessage {
- content: async_openai::types::ChatCompletionRequestUserMessageContent::Text(
- "User message".to_string(),
- ),
+ async_openai::types::chat::ChatCompletionRequestUserMessage {
+ content:
+ async_openai::types::chat::ChatCompletionRequestUserMessageContent::Text(
+ "User message".to_string(),
+ ),
..Default::default()
},
),
@@ -485,14 +490,15 @@ mod tests {
content: Some(ChatCompletionRequestAssistantMessageContent::Text(
"I'll help you with that.".to_string(),
)),
- tool_calls: Some(vec![ChatCompletionMessageToolCall {
- id: tool_call_id.clone(),
- function: FunctionCall {
- name: tool_name.clone(),
- arguments: json!({"param": "value"}).to_string(),
+ tool_calls: Some(vec![ChatCompletionMessageToolCalls::Function(
+ ChatCompletionMessageToolCall {
+ id: tool_call_id.clone(),
+ function: FunctionCall {
+ name: tool_name.clone(),
+ arguments: json!({"param": "value"}).to_string(),
+ },
},
- r#type: ChatCompletionToolType::Function,
- }]),
+ )]),
..Default::default()
}),
ChatCompletionRequestMessage::Tool(ChatCompletionRequestToolMessage {
diff --git a/rust/cloud-storage/ai/src/types/client/anthropic.rs b/rust/cloud-storage/ai/src/types/client/anthropic.rs
index 970ec25790..47ff428512 100644
--- a/rust/cloud-storage/ai/src/types/client/anthropic.rs
+++ b/rust/cloud-storage/ai/src/types/client/anthropic.rs
@@ -44,7 +44,7 @@ impl ExtendedClient for AnthropicClient {
type ResponseExtension = AnthropicResponseExtension;
async fn chat_stream(
&self,
- request: async_openai::types::CreateChatCompletionRequest,
+ request: async_openai::types::chat::CreateChatCompletionRequest,
) -> anyhow::Result<super::traits::ExtendedOpenAIStream<Self::ResponseExtension>, AiError> {
Ok(Box::pin(
self.inner
diff --git a/rust/cloud-storage/ai/src/types/client/noop.rs b/rust/cloud-storage/ai/src/types/client/noop.rs
index f06ba0c87c..d6c6ba2ba7 100644
--- a/rust/cloud-storage/ai/src/types/client/noop.rs
+++ b/rust/cloud-storage/ai/src/types/client/noop.rs
@@ -14,7 +14,7 @@ impl ExtendedClient for NoOpClient {
async fn chat_stream(
&self,
- _: async_openai::types::CreateChatCompletionRequest,
+ _: async_openai::types::chat::CreateChatCompletionRequest,
) -> Result<ExtendedOpenAIStream<Self::ResponseExtension>, AiError> {
Err(anyhow!("noop").into())
}
diff --git a/rust/cloud-storage/ai/src/types/client/openrouter/client.rs b/rust/cloud-storage/ai/src/types/client/openrouter/client.rs
index 8e6da07b8c..76736447b5 100644
--- a/rust/cloud-storage/ai/src/types/client/openrouter/client.rs
+++ b/rust/cloud-storage/ai/src/types/client/openrouter/client.rs
@@ -6,7 +6,7 @@ use crate::types::{
};
use async_openai::Client as OpenAiClient;
-use async_openai::types::{CreateChatCompletionRequest, CreateChatCompletionStreamResponse};
+use async_openai::types::chat::{CreateChatCompletionRequest, CreateChatCompletionStreamResponse};
use futures::StreamExt;
#[derive(Clone)]
diff --git a/rust/cloud-storage/ai/src/types/client/traits.rs b/rust/cloud-storage/ai/src/types/client/traits.rs
index a791b2dc94..27734585fe 100644
--- a/rust/cloud-storage/ai/src/types/client/traits.rs
+++ b/rust/cloud-storage/ai/src/types/client/traits.rs
@@ -2,7 +2,7 @@ use crate::tool::StreamPart;
use crate::types::AiError;
use anyhow::Result;
use async_openai::error::OpenAIError;
-use async_openai::types::{CreateChatCompletionRequest, CreateChatCompletionStreamResponse};
+use async_openai::types::chat::{CreateChatCompletionRequest, CreateChatCompletionStreamResponse};
use futures::Stream;
use std::fmt::Debug;
use std::future::Future;
diff --git a/rust/cloud-storage/ai/src/types/providers/openai/message.rs b/rust/cloud-storage/ai/src/types/providers/openai/message.rs
index 730afde6e5..28fd1cf6ce 100644
--- a/rust/cloud-storage/ai/src/types/providers/openai/message.rs
+++ b/rust/cloud-storage/ai/src/types/providers/openai/message.rs
@@ -1,11 +1,12 @@
-use async_openai::types::{
- ChatCompletionMessageToolCall, ChatCompletionRequestAssistantMessage,
- ChatCompletionRequestAssistantMessageContent, ChatCompletionRequestAssistantMessageContentPart,
- ChatCompletionRequestMessage, ChatCompletionRequestMessageContentPartImage,
- ChatCompletionRequestMessageContentPartText, ChatCompletionRequestSystemMessage,
- ChatCompletionRequestToolMessage, ChatCompletionRequestToolMessageContent,
- ChatCompletionRequestUserMessage, ChatCompletionRequestUserMessageContent,
- ChatCompletionRequestUserMessageContentPart, FunctionCall, ImageDetail, ImageUrl,
+use async_openai::types::chat::{
+ ChatCompletionMessageToolCall, ChatCompletionMessageToolCalls,
+ ChatCompletionRequestAssistantMessage, ChatCompletionRequestAssistantMessageContent,
+ ChatCompletionRequestAssistantMessageContentPart, ChatCompletionRequestMessage,
+ ChatCompletionRequestMessageContentPartImage, ChatCompletionRequestMessageContentPartText,
+ ChatCompletionRequestSystemMessage, ChatCompletionRequestToolMessage,
+ ChatCompletionRequestToolMessageContent, ChatCompletionRequestUserMessage,
+ ChatCompletionRequestUserMessageContent, ChatCompletionRequestUserMessageContentPart,
+ FunctionCall, ImageDetail, ImageUrl,
};
use crate::types::{AssistantMessagePart, ChatMessage, ChatMessageContent, ChatMessages, Role};
@@ -30,86 +31,84 @@ fn image_into_openai_image_url(image: ImageData) -> ImageUrl {
impl From<ChatMessage> for Vec<ChatCompletionRequestMessage> {
fn from(value: ChatMessage) -> Self {
match value.content {
- ChatMessageContent::Text(text) => {
- match value.role {
- Role::Assistant => {
- vec![ChatCompletionRequestMessage::Assistant(
- ChatCompletionRequestAssistantMessage {
- content: Some(ChatCompletionRequestAssistantMessageContent::Text(
- text.to_owned(),
- )),
- ..Default::default()
- },
- )]
- }
- Role::User => {
- if let Some(attachments) = value.attachments {
- let formatted = attachments.into_formatted_parts().compact();
- let mut user_message_content =
- vec![ChatCompletionRequestUserMessageContentPart::Text(
- ChatCompletionRequestMessageContentPartText { text },
- )];
-
- for part in formatted.into_parts().into_inner() {
- match part {
- TextOrImage::Text(attachment_text) => {
- user_message_content.push(
- ChatCompletionRequestUserMessageContentPart::Text(
- ChatCompletionRequestMessageContentPartText {
- text: attachment_text,
- },
- ),
- );
- }
- TextOrImage::Image(image) => {
- user_message_content.push(
- ChatCompletionRequestUserMessageContentPart::ImageUrl(
- ChatCompletionRequestMessageContentPartImage {
- image_url: image_into_openai_image_url(image),
- },
- ),
- );
- }
+ ChatMessageContent::Text(text) => match value.role {
+ Role::Assistant => {
+ vec![ChatCompletionRequestMessage::Assistant(
+ ChatCompletionRequestAssistantMessage {
+ content: Some(ChatCompletionRequestAssistantMessageContent::Text(
+ text.to_owned(),
+ )),
+ ..Default::default()
+ },
+ )]
+ }
+ Role::User => {
+ if let Some(attachments) = value.attachments {
+ let formatted = attachments.into_formatted_parts().compact();
+ let mut user_message_content =
+ vec![ChatCompletionRequestUserMessageContentPart::Text(
+ ChatCompletionRequestMessageContentPartText { text },
+ )];
+
+ for part in formatted.into_parts().into_inner() {
+ match part {
+ TextOrImage::Text(attachment_text) => {
+ user_message_content.push(
+ ChatCompletionRequestUserMessageContentPart::Text(
+ ChatCompletionRequestMessageContentPartText {
+ text: attachment_text,
+ },
+ ),
+ );
+ }
+ TextOrImage::Image(image) => {
+ user_message_content.push(
+ ChatCompletionRequestUserMessageContentPart::ImageUrl(
+ ChatCompletionRequestMessageContentPartImage {
+ image_url: image_into_openai_image_url(image),
+ },
+ ),
+ );
}
}
-
- vec![ChatCompletionRequestMessage::User(
- ChatCompletionRequestUserMessage {
- name: None,
- content: ChatCompletionRequestUserMessageContent::Array(
- user_message_content,
- ),
- },
- )]
- } else {
- vec![ChatCompletionRequestMessage::User(
- ChatCompletionRequestUserMessage {
- name: None,
- content: ChatCompletionRequestUserMessageContent::Text(text),
- },
- )]
}
+
+ vec![ChatCompletionRequestMessage::User(
+ ChatCompletionRequestUserMessage {
+ name: None,
+ content: ChatCompletionRequestUserMessageContent::Array(
+ user_message_content,
+ ),
+ },
+ )]
+ } else {
+ vec![ChatCompletionRequestMessage::User(
+ ChatCompletionRequestUserMessage {
+ name: None,
+ content: ChatCompletionRequestUserMessageContent::Text(text),
+ },
+ )]
}
- Role::System => {
- vec![ChatCompletionRequestMessage::System(ChatCompletionRequestSystemMessage {
+ }
+ Role::System => {
+ vec![ChatCompletionRequestMessage::System(ChatCompletionRequestSystemMessage {
content:
- async_openai::types::ChatCompletionRequestSystemMessageContent::Text(
+ async_openai::types::chat::ChatCompletionRequestSystemMessageContent::Text(
text,
),
..Default::default()
})]
- }
}
- }
+ },
ChatMessageContent::AssistantMessageParts(parts) => {
let mut messages = Vec::new();
let mut pending_text = None::<String>;
- let mut pending_tool_calls: Vec<ChatCompletionMessageToolCall> = Vec::new();
+ let mut pending_tool_calls: Vec<ChatCompletionMessageToolCalls> = Vec::new();
fn flush_pending(
messages: &mut Vec<ChatCompletionRequestMessage>,
pending_text: &mut Option<String>,
- pending_tool_calls: &mut Vec<ChatCompletionMessageToolCall>,
+ pending_tool_calls: &mut Vec<ChatCompletionMessageToolCalls>,
) {
if pending_text.is_some() || !pending_tool_calls.is_empty() {
messages.push(ChatCompletionRequestMessage::Assistant(
@@ -146,15 +145,16 @@ impl From<ChatMessage> for Vec<ChatCompletionRequestMessage> {
}
}
AssistantMessagePart::ToolCall { name, json, id } => {
- let tool_call = ChatCompletionMessageToolCall {
- function: FunctionCall {
- arguments: serde_json::to_string(&json)
- .unwrap_or(String::new()),
- name: name.clone(),
+ let tool_call = ChatCompletionMessageToolCalls::Function(
+ ChatCompletionMessageToolCall {
+ function: FunctionCall {
+ arguments: serde_json::to_string(&json)
+ .unwrap_or(String::new()),
+ name: name.clone(),
+ },
+ id: id.clone(),
},
- id: id.clone(),
- r#type: async_openai::types::ChatCompletionToolType::Function,
- };
+ );
pending_tool_calls.push(tool_call);
}
AssistantMessagePart::ToolCallResponseJson { json, id, .. } => {
@@ -215,12 +215,14 @@ pub fn convert_message(
ChatCompletionRequestMessage::System(system_msg) => ChatMessage {
role: Role::System,
content: match system_msg.content {
- async_openai::types::ChatCompletionRequestSystemMessageContent::Text(text) => {
- ChatMessageContent::Text(text)
- }
- async_openai::types::ChatCompletionRequestSystemMessageContent::Array(parts) => {
+ async_openai::types::chat::ChatCompletionRequestSystemMessageContent::Text(
+ text,
+ ) => ChatMessageContent::Text(text),
+ async_openai::types::chat::ChatCompletionRequestSystemMessageContent::Array(
+ parts,
+ ) => {
let text_parts: Vec<String> = parts.iter().map(|part| {
- let async_openai::types::ChatCompletionRequestSystemMessageContentPart::Text(text_part) = part;
+ let async_openai::types::chat::ChatCompletionRequestSystemMessageContentPart::Text(text_part) = part;
text_part.text.clone()
}).collect();
ChatMessageContent::Text(text_parts.join(" "))
@@ -292,7 +294,11 @@ pub fn convert_message(
if let Some(tool_calls) = assistant_msg.tool_calls {
for tool_call in tool_calls {
- if let Ok(json_value) = serde_json::from_str(&tool_call.function.arguments) {
+ if let async_openai::types::chat::ChatCompletionMessageToolCalls::Function(
+ tool_call,
+ ) = tool_call
+ && let Ok(json_value) = serde_json::from_str(&tool_call.function.arguments)
+ {
parts.push(AssistantMessagePart::ToolCall {
name: tool_call.function.name,
json: json_value,
diff --git a/rust/cloud-storage/ai/src/types/providers/openai/request.rs b/rust/cloud-storage/ai/src/types/providers/openai/request.rs
index 47c2425c35..ff8ad9dd30 100644
--- a/rust/cloud-storage/ai/src/types/providers/openai/request.rs
+++ b/rust/cloud-storage/ai/src/types/providers/openai/request.rs
@@ -1,7 +1,7 @@
use crate::traits::Metadata;
use crate::types::ChatCompletionRequest;
use anyhow::Context;
-use async_openai::types::{
+use async_openai::types::chat::{
ChatCompletionRequestMessage, ChatCompletionRequestSystemMessage,
ChatCompletionRequestSystemMessageContent, CreateChatCompletionRequest,
CreateChatCompletionRequestArgs, ResponseFormat, ResponseFormatJsonSchema,
diff --git a/rust/cloud-storage/ai/src/types/providers/openai/response.rs b/rust/cloud-storage/ai/src/types/providers/openai/response.rs
index f6bff0adba..e78d3dc6f8 100644
--- a/rust/cloud-storage/ai/src/types/providers/openai/response.rs
+++ b/rust/cloud-storage/ai/src/types/providers/openai/response.rs
@@ -1,6 +1,6 @@
use crate::types::{ChatCompletionRequest, response::ChatStreamCompletionResponse};
use anyhow::Context;
-use async_openai::types::{
+use async_openai::types::chat::{
ChatCompletionRequestMessage, ChatCompletionRequestSystemMessage,
ChatCompletionRequestSystemMessageContent, CreateChatCompletionRequest,
CreateChatCompletionRequestArgs, CreateChatCompletionStreamResponse,
diff --git a/rust/cloud-storage/ai/src/types/response.rs b/rust/cloud-storage/ai/src/types/response.rs
index cf155f7bfa..15de47a09e 100644
--- a/rust/cloud-storage/ai/src/types/response.rs
+++ b/rust/cloud-storage/ai/src/types/response.rs
@@ -1,4 +1,4 @@
-use async_openai::{error::OpenAIError, types::CompletionUsage};
+use async_openai::{error::OpenAIError, types::chat::CompletionUsage};
#[derive(Debug, Clone)]
pub struct Usage {
diff --git a/rust/cloud-storage/anthropic/Cargo.toml b/rust/cloud-storage/anthropic/Cargo.toml
index 1e60fb0532..ef9357d8e4 100644
--- a/rust/cloud-storage/anthropic/Cargo.toml
+++ b/rust/cloud-storage/anthropic/Cargo.toml
@@ -16,8 +16,8 @@ rand = { workspace = true }
tokio = { workspace = true, features = ["sync"]}
async-stream = { workspace = true }
futures = { workspace = true }
-reqwest = { workspace = true }
-reqwest-eventsource = "0.6.0"
+reqwest = { workspace = true, features = ["stream"] }
+tokio-util = { workspace = true, features = ["io"] }
schemars = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
diff --git a/rust/cloud-storage/anthropic/examples/chat_openai.rs b/rust/cloud-storage/anthropic/examples/chat_openai.rs
index 4c1dae883a..70c79e3ee7 100644
--- a/rust/cloud-storage/anthropic/examples/chat_openai.rs
+++ b/rust/cloud-storage/anthropic/examples/chat_openai.rs
@@ -3,7 +3,7 @@ use std::process::exit;
use anthropic::client::Client;
use anthropic::types::response::{ContentDeltaEvent, StreamEvent};
-use async_openai::types::{
+use async_openai::types::chat::{
ChatCompletionRequestAssistantMessage, ChatCompletionRequestAssistantMessageContent,
ChatCompletionRequestMessage, ChatCompletionRequestSystemMessageArgs,
ChatCompletionRequestUserMessage, ChatCompletionRequestUserMessageContent,
diff --git a/rust/cloud-storage/anthropic/examples/only_openai_chat.rs b/rust/cloud-storage/anthropic/examples/only_openai_chat.rs
index bcdcc0c5c6..bc68559a9f 100644
--- a/rust/cloud-storage/anthropic/examples/only_openai_chat.rs
+++ b/rust/cloud-storage/anthropic/examples/only_openai_chat.rs
@@ -2,8 +2,9 @@
use std::error::Error;
use std::io::{Write, stdout};
-use async_openai::types::ChatCompletionRequestUserMessageArgs;
-use async_openai::types::CreateChatCompletionRequestArgs;
+use async_openai::types::chat::{
+ ChatCompletionRequestUserMessageArgs, CreateChatCompletionRequestArgs,
+};
use futures::StreamExt;
#[tokio::main]
diff --git a/rust/cloud-storage/anthropic/examples/only_openai_tools.rs b/rust/cloud-storage/anthropic/examples/only_openai_tools.rs
index 0c625a31f6..5761a39781 100644
--- a/rust/cloud-storage/anthropic/examples/only_openai_tools.rs
+++ b/rust/cloud-storage/anthropic/examples/only_openai_tools.rs
@@ -4,12 +4,12 @@ use std::error::Error;
use std::io::{Write, stdout};
use std::sync::Arc;
-use async_openai::types::CreateChatCompletionRequestArgs;
-use async_openai::types::{
- ChatCompletionMessageToolCall, ChatCompletionRequestAssistantMessageArgs,
- ChatCompletionRequestMessage, ChatCompletionRequestToolMessageArgs,
- ChatCompletionRequestUserMessageArgs, ChatCompletionToolArgs, ChatCompletionToolType,
- FinishReason, FunctionCall, FunctionObjectArgs,
+use async_openai::types::chat::{
+ ChatCompletionMessageToolCall, ChatCompletionMessageToolCalls,
+ ChatCompletionRequestAssistantMessageArgs, ChatCompletionRequestMessage,
+ ChatCompletionRequestToolMessageArgs, ChatCompletionRequestUserMessageArgs, ChatCompletionTool,
+ ChatCompletionTools, CreateChatCompletionRequestArgs, FinishReason, FunctionCall,
+ FunctionObjectArgs,
};
use futures::StreamExt;
use rand::prelude::*;
@@ -19,28 +19,23 @@ use tokio::sync::Mutex;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let user_prompt = "What's the weather like in Boston and Atlanta?";
- let tools = vec![
- ChatCompletionToolArgs::default()
- .r#type(ChatCompletionToolType::Function)
- .function(
- FunctionObjectArgs::default()
- .name("get_current_weather")
- .description("Get the current weather in a given location")
- .parameters(json!({
- "type": "object",
- "properties": {
- "location": {
- "type": "string",
- "description": "The city and state, e.g. San Francisco, CA",
- },
- "unit": { "type": "string", "enum": ["celsius", "fahrenheit"] },
- },
- "required": ["location"],
- }))
- .build()?,
- )
+ let tools = vec![ChatCompletionTool {
+ function: FunctionObjectArgs::default()
+ .name("get_current_weather")
+ .description("Get the current weather in a given location")
+ .parameters(json!({
+ "type": "object",
+ "properties": {
+ "location": {
+ "type": "string",
+ "description": "The city and state, e.g. San Francisco, CA",
+ },
+ "unit": { "type": "string", "enum": ["celsius", "fahrenheit"] },
+ },
+ "required": ["location"],
+ }))
.build()?,
- ];
+ }];
let request = CreateChatCompletionRequestArgs::default()
.max_tokens(6000_u32)
.model("claude-haiku-4-5")
@@ -48,7 +43,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.content(user_prompt)
.build()?
.into()])
- .tools(tools.clone())
+ .tools(
+ tools
+ .iter()
+ .cloned()
+ .map(ChatCompletionTools::Function)
+ .collect::<Vec<_>>(),
+ )
.build()?;
let client = anthropic::client::Client::dangerously_try_from_env(None);
@@ -74,7 +75,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let state = states_lock.entry(key).or_insert_with(|| {
ChatCompletionMessageToolCall {
id: tool_call_data.id.clone().unwrap_or_default(),
- r#type: ChatCompletionToolType::Function,
function: FunctionCall {
name: tool_call_data
.function
@@ -142,10 +142,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.into(),
];
- let tool_calls: Vec<ChatCompletionMessageToolCall> =
+ let tool_calls: Vec<ChatCompletionMessageToolCalls> =
function_responses_lock
.iter()
- .map(|tc| tc.0.clone())
+ .map(|tc| {
+ ChatCompletionMessageToolCalls::Function(tc.0.clone())
+ })
.collect();
let assistant_messages: ChatCompletionRequestMessage =
@@ -177,7 +179,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.max_tokens(6000_u32)
.model("claude-haiku-4-5")
.messages(messages)
- .tools(tools.clone())
+ .tools(
+ tools
+ .iter()
+ .cloned()
+ .map(ChatCompletionTools::Function)
+ .collect::<Vec<_>>(),
+ )
.build()
.map_err(|e| Box::new(e) as Box<dyn std::error::Error>)?;
diff --git a/rust/cloud-storage/anthropic/examples/tools_openai.rs b/rust/cloud-storage/anthropic/examples/tools_openai.rs
index 6c6d3a961c..003564e5b6 100644
--- a/rust/cloud-storage/anthropic/examples/tools_openai.rs
+++ b/rust/cloud-storage/anthropic/examples/tools_openai.rs
@@ -1,9 +1,8 @@
use anthropic::client::Client;
use anthropic::types::response::{ContentDeltaEvent, StreamEvent};
-use async_openai::types::{
- ChatCompletionRequestUserMessage, ChatCompletionRequestUserMessageContent,
- ChatCompletionToolArgs, ChatCompletionToolType, CreateChatCompletionRequestArgs,
- FunctionObjectArgs,
+use async_openai::types::chat::{
+ ChatCompletionRequestUserMessage, ChatCompletionRequestUserMessageContent, ChatCompletionTool,
+ CreateChatCompletionRequestArgs, FunctionObjectArgs,
};
use futures::StreamExt;
use serde_json::json;
@@ -11,28 +10,24 @@ use std::io::Write;
#[tokio::main]
async fn main() {
- let weather_tool = ChatCompletionToolArgs::default()
- .r#type(ChatCompletionToolType::Function)
- .function(
- FunctionObjectArgs::default()
- .name("get_current_weather")
- .description("Get the current weather in a given location")
- .parameters(json!({
- "type": "object",
- "properties": {
- "location": {
- "type": "string",
- "description": "The city and state, e.g. San Francisco, CA",
- },
- "unit": { "type": "string", "enum": ["celsius", "fahrenheit"] },
+ let weather_tool = ChatCompletionTool {
+ function: FunctionObjectArgs::default()
+ .name("get_current_weather")
+ .description("Get the current weather in a given location")
+ .parameters(json!({
+ "type": "object",
+ "properties": {
+ "location": {
+ "type": "string",
+ "description": "The city and state, e.g. San Francisco, CA",
},
- "required": ["location"],
- }))
- .build()
- .unwrap(),
- )
- .build()
- .expect("tool");
+ "unit": { "type": "string", "enum": ["celsius", "fahrenheit"] },
+ },
+ "required": ["location"],
+ }))
+ .build()
+ .unwrap(),
+ };
let client = Client::dangerously_try_from_env(None);
let request = CreateChatCompletionRequestArgs::default()
@@ -45,7 +40,7 @@ async fn main() {
name: None,
}
.into()])
- .tools(vec![weather_tool])
+ .tools(weather_tool)
.build()
.expect("request");
diff --git a/rust/cloud-storage/anthropic/src/client/mod.rs b/rust/cloud-storage/anthropic/src/client/mod.rs
index 4378aa77c8..bebe9f22bf 100644
--- a/rust/cloud-storage/anthropic/src/client/mod.rs
+++ b/rust/cloud-storage/anthropic/src/client/mod.rs
@@ -6,9 +6,10 @@ use crate::types::request::{CODE_EXECUTION_TOOL_HEADER, WEB_FETCH_TOOL_HEADER};
use crate::{config::Config, openai::request::AnthropicRequestExtensions};
use futures::stream::{Stream, StreamExt};
use reqwest::Client as RequestClient;
-use reqwest_eventsource::{Event, EventSource, RequestBuilderExt};
use serde::{Serialize, de::DeserializeOwned};
use std::pin::Pin;
+use tokio::io::{AsyncBufReadExt, BufReader};
+use tokio_util::io::StreamReader;
#[derive(Clone, Debug)]
pub struct Client {
@@ -74,73 +75,75 @@ impl Client {
O: DeserializeOwned + Send + Sync + 'static,
{
tracing::debug!("{:#?}", request);
- let event_source = self
+ let fut = self
.http_client
.post(format!("{}{}", self.config.api_base, path))
.headers(self.config.headers.clone())
.json(&request)
- .eventsource()
- .expect("event source");
+ .send();
- stream(event_source).await
- }
-}
+ let (tx, rx) = tokio::sync::mpsc::unbounded_channel();
-async fn stream<O>(
- mut event_source: EventSource,
-) -> Pin<Box<dyn Stream<Item = Result<O, AnthropicError>> + Send>>
-where
- O: DeserializeOwned + std::marker::Send + 'static,
-{
- let (tx, rx) = tokio::sync::mpsc::unbounded_channel();
-
- tokio::spawn(async move {
- while let Some(ev) = event_source.next().await {
- match ev {
+ tokio::spawn(async move {
+ let response = match fut.await {
Err(e) => {
- match e {
- reqwest_eventsource::Error::StreamEnded => break,
- reqwest_eventsource::Error::InvalidStatusCode(code, response) => {
- let response_err = match response.json::<serde_json::Value>().await {
- Err(e) => AnthropicError::Reqwest(e),
- Ok(json) => match serde_json::from_value::<ApiError>(json) {
- Ok(api_error) => AnthropicError::ApiError {
- api_error,
- status_code: code,
- },
- Err(deserial) => AnthropicError::JsonDeserialize(deserial),
- },
- };
- let _ = tx.send(Err(response_err));
- }
- other => {
- let _ = tx.send(Err(AnthropicError::StreamError(other.to_string())));
- }
- }
- break;
+ let _ = tx.send(Err(AnthropicError::Reqwest(e)));
+ return;
}
- Ok(event) => match event {
- Event::Message(message) => {
- if message.data == "[DONE]" {
- break;
- }
+ Ok(r) => r,
+ };
- let response = match serde_json::from_str::<O>(&message.data) {
- Err(e) => Err(AnthropicError::JsonDeserialize(e)),
- Ok(output) => Ok(output),
- };
+ if !response.status().is_success() {
+ let code = response.status();
+ let err = match response.json::<serde_json::Value>().await {
+ Err(e) => AnthropicError::Reqwest(e),
+ Ok(json) => match serde_json::from_value::<ApiError>(json) {
+ Ok(api_error) => AnthropicError::ApiError {
+ api_error,
+ status_code: code,
+ },
+ Err(e) => AnthropicError::JsonDeserialize(e),
+ },
+ };
+ let _ = tx.send(Err(err));
+ return;
+ }
+
+ let byte_stream = response
+ .bytes_stream()
+ .map(|r| r.map_err(std::io::Error::other));
+ let reader = BufReader::new(StreamReader::new(byte_stream));
+ let mut lines = reader.lines();
+ let mut pending_data = String::new();
- if let Err(_e) = tx.send(response) {
- // rx dropped
- break;
+ loop {
+ match lines.next_line().await {
+ Err(e) => {
+ let _ = tx.send(Err(AnthropicError::StreamError(e.to_string())));
+ break;
+ }
+ Ok(None) => break,
+ Ok(Some(line)) => {
+ if let Some(data) = line.strip_prefix("data: ") {
+ pending_data = data.to_string();
+ } else if line.is_empty() && !pending_data.is_empty() {
+ if pending_data == "[DONE]" {
+ break;
+ }
+ let result = match serde_json::from_str::<O>(&pending_data) {
+ Err(e) => Err(AnthropicError::JsonDeserialize(e)),
+ Ok(output) => Ok(output),
+ };
+ pending_data.clear();
+ if tx.send(result).is_err() {
+ break;
+ }
}
}
- Event::Open => continue,
- },
+ }
}
- }
+ });
- event_source.close();
- });
- Box::pin(tokio_stream::wrappers::UnboundedReceiverStream::new(rx))
+ Box::pin(tokio_stream::wrappers::UnboundedReceiverStream::new(rx))
+ }
}
diff --git a/rust/cloud-storage/anthropic/src/openai/request/conversions.rs b/rust/cloud-storage/anthropic/src/openai/request/conversions.rs
index bbfa7c9dda..f959cd345b 100644
--- a/rust/cloud-storage/anthropic/src/openai/request/conversions.rs
+++ b/rust/cloud-storage/anthropic/src/openai/request/conversions.rs
@@ -2,12 +2,13 @@ use crate::{
prelude::{ClientTool, ImageSource},
types::request::{self, SystemPrompt},
};
-use async_openai::types::{
+use async_openai::types::chat::{
ChatCompletionRequestAssistantMessage, ChatCompletionRequestDeveloperMessage,
ChatCompletionRequestFunctionMessage, ChatCompletionRequestMessage,
ChatCompletionRequestSystemMessage, ChatCompletionRequestSystemMessageContentPart,
ChatCompletionRequestToolMessage, ChatCompletionRequestUserMessage, ChatCompletionTool,
- ChatCompletionToolChoiceOption, CreateChatCompletionRequest,
+ ChatCompletionToolChoiceOption, ChatCompletionTools, CreateChatCompletionRequest,
+ StopConfiguration, ToolChoiceOptions,
};
#[derive(Debug, Clone)]
@@ -38,9 +39,11 @@ impl From<CreateChatCompletionRequest> for request::CreateMessageRequestBody {
};
if let Some(user) = msg.metadata.and_then(|meta| {
- meta.get("user_id")
- .and_then(|user| user.as_str())
- .map(|s| s.to_string())
+ serde_json::to_value(&meta).ok().and_then(|v| {
+ v.get("user_id")
+ .and_then(|u| u.as_str())
+ .map(|s| s.to_string())
+ })
}) {
request.metadata = Some(request::Metadata {
user_id: Some(user.to_owned()),
@@ -48,21 +51,23 @@ impl From<CreateChatCompletionRequest> for request::CreateMessageRequestBody {
}
if let Some(stop_sequences) = msg.stop {
match stop_sequences {
- async_openai::types::Stop::String(text) => {
- request.stop_sequences = Some(vec![text])
- }
- async_openai::types::Stop::StringArray(parts) => {
- request.stop_sequences = Some(parts)
- }
+ StopConfiguration::String(text) => request.stop_sequences = Some(vec![text]),
+ StopConfiguration::StringArray(parts) => request.stop_sequences = Some(parts),
}
}
request.model = msg.model;
request.stream = msg.stream;
request.temperature = msg.temperature;
request.tool_choice = msg.tool_choice.map(Into::into);
- request.tools = msg
- .tools
- .map(|tools| tools.into_iter().map(Into::into).collect());
+ request.tools = msg.tools.map(|tools| {
+ tools
+ .into_iter()
+ .filter_map(|t| match t {
+ ChatCompletionTools::Function(tool) => Some(tool.into()),
+ ChatCompletionTools::Custom(_) => None,
+ })
+ .collect()
+ });
request.top_p = msg.top_p;
let mut prompt_messages = Vec::new();
@@ -182,15 +187,15 @@ impl From<ChatCompletionRequestToolMessage> for request::RequestMessage {
tool_use_id: tool_msg.tool_call_id,
cache_control: None,
content: match tool_msg.content {
- async_openai::types::ChatCompletionRequestToolMessageContent::Array(parts) => parts
+ async_openai::types::chat::ChatCompletionRequestToolMessageContent::Array(parts) => parts
.into_iter()
.map(|part| match part {
- async_openai::types::ChatCompletionRequestToolMessageContentPart::Text(
+ async_openai::types::chat::ChatCompletionRequestToolMessageContentPart::Text(
text,
) => text.text,
})
.collect::<String>(),
- async_openai::types::ChatCompletionRequestToolMessageContent::Text(text) => text,
+ async_openai::types::chat::ChatCompletionRequestToolMessageContent::Text(text) => text,
},
is_err: None,
};
@@ -205,20 +210,21 @@ impl From<ChatCompletionRequestToolMessage> for request::RequestMessage {
impl From<ChatCompletionRequestUserMessage> for request::RequestMessage {
fn from(user: ChatCompletionRequestUserMessage) -> Self {
match user.content {
- async_openai::types::ChatCompletionRequestUserMessageContent::Array(arr) => {
+ async_openai::types::chat::ChatCompletionRequestUserMessageContent::Array(arr) => {
let content: Vec<request::RequestContentKind> = arr.into_iter()
.filter_map(|part| {
match part {
- async_openai::types::ChatCompletionRequestUserMessageContentPart::ImageUrl(url) => {
+ async_openai::types::chat::ChatCompletionRequestUserMessageContentPart::ImageUrl(url) => {
Some(request::RequestContentKind::Image {
cache_control: None,
source: url_to_image_source(url.image_url.url)
})
},
- async_openai::types::ChatCompletionRequestUserMessageContentPart::Text(text) =>
+ async_openai::types::chat::ChatCompletionRequestUserMessageContentPart::Text(text) =>
Some(request::RequestContentKind::Text { text: text.text, cache_control: None, citations: vec![] }),
- // sound is unsupported and will fail silently
- async_openai::types::ChatCompletionRequestUserMessageContentPart::InputAudio(_) => None
+ // sound and file are unsupported and will fail silently
+ async_openai::types::chat::ChatCompletionRequestUserMessageContentPart::InputAudio(_) => None,
+ async_openai::types::chat::ChatCompletionRequestUserMessageContentPart::File(_) => None
}
})
.collect();
@@ -227,10 +233,12 @@ impl From<ChatCompletionRequestUserMessage> for request::RequestMessage {
role: request::Role::User,
}
}
- async_openai::types::ChatCompletionRequestUserMessageContent::Text(text) => Self {
- role: request::Role::User,
- content: request::RequestContent::Text(text),
- },
+ async_openai::types::chat::ChatCompletionRequestUserMessageContent::Text(text) => {
+ Self {
+ role: request::Role::User,
+ content: request::RequestContent::Text(text),
+ }
+ }
}
}
}
@@ -240,16 +248,18 @@ impl From<ChatCompletionRequestAssistantMessage> for request::RequestMessage {
fn from(assistant_msg: ChatCompletionRequestAssistantMessage) -> Self {
let content = if let Some(content) = assistant_msg.content {
match content {
- async_openai::types::ChatCompletionRequestAssistantMessageContent::Text(text) => {
- request::RequestContent::Text(text)
- }
- async_openai::types::ChatCompletionRequestAssistantMessageContent::Array(parts) => {
+ async_openai::types::chat::ChatCompletionRequestAssistantMessageContent::Text(
+ text,
+ ) => request::RequestContent::Text(text),
+ async_openai::types::chat::ChatCompletionRequestAssistantMessageContent::Array(
+ parts,
+ ) => {
let parts = parts.into_iter()
.map(|part| match part {
- async_openai::types::ChatCompletionRequestAssistantMessageContentPart::Text(text) => {
+ async_openai::types::chat::ChatCompletionRequestAssistantMessageContentPart::Text(text) => {
request::RequestContentKind::Text { text: text.text, cache_control: None, citations: vec![]}
}
- async_openai::types::ChatCompletionRequestAssistantMessageContentPart::Refusal(message) => {
+ async_openai::types::chat::ChatCompletionRequestAssistantMessageContentPart::Refusal(message) => {
request::RequestContentKind::Text { text: message.refusal, cache_control: None, citations: vec![] }
}
@@ -267,14 +277,21 @@ impl From<ChatCompletionRequestAssistantMessage> for request::RequestMessage {
// TODO handle errors better
// anthropic requries tool calls to be valid json, openai doesn't
.filter_map(|tool_call| {
- serde_json::from_str(&tool_call.function.arguments)
- .map(|good| request::RequestContentKind::ToolUse {
- id: tool_call.id,
- input: good,
- name: tool_call.function.name,
- cache_control: None,
- })
- .ok()
+ if let async_openai::types::chat::ChatCompletionMessageToolCalls::Function(
+ tool_call,
+ ) = tool_call
+ {
+ serde_json::from_str(&tool_call.function.arguments)
+ .map(|good| request::RequestContentKind::ToolUse {
+ id: tool_call.id,
+ input: good,
+ name: tool_call.function.name,
+ cache_control: None,
+ })
+ .ok()
+ } else {
+ None
+ }
})
.collect()
} else {
@@ -311,15 +328,19 @@ impl From<ChatCompletionRequestAssistantMessage> for request::RequestMessage {
impl From<ChatCompletionToolChoiceOption> for request::ToolChoice {
fn from(value: ChatCompletionToolChoiceOption) -> Self {
match value {
- ChatCompletionToolChoiceOption::Auto => Self::Auto {
+ ChatCompletionToolChoiceOption::Mode(ToolChoiceOptions::Auto) => Self::Auto {
disable_parallel_tool_use: false,
},
- ChatCompletionToolChoiceOption::Named(named) => Self::Tool {
+ ChatCompletionToolChoiceOption::Function(named) => Self::Tool {
name: named.function.name,
disable_parallel_tool_use: false,
},
- ChatCompletionToolChoiceOption::None => Self::None,
- ChatCompletionToolChoiceOption::Required => Self::Any {
+ ChatCompletionToolChoiceOption::Mode(ToolChoiceOptions::None) => Self::None,
+ ChatCompletionToolChoiceOption::Mode(ToolChoiceOptions::Required) => Self::Any {
+ disable_parallel_tool_use: false,
+ },
+ ChatCompletionToolChoiceOption::AllowedTools(_)
+ | ChatCompletionToolChoiceOption::Custom(_) => Self::Auto {
disable_parallel_tool_use: false,
},
}
@@ -357,13 +378,15 @@ fn url_to_image_source(url: String) -> ImageSource {
fn system_message_as_text_pars(sys_msg: &ChatCompletionRequestSystemMessage) -> Vec<&str> {
match sys_msg.content {
- async_openai::types::ChatCompletionRequestSystemMessageContent::Array(ref parts) => parts
- .iter()
- .map(|part| match part {
- ChatCompletionRequestSystemMessageContentPart::Text(text) => text.text.as_str(),
- })
- .collect(),
- async_openai::types::ChatCompletionRequestSystemMessageContent::Text(ref text) => {
+ async_openai::types::chat::ChatCompletionRequestSystemMessageContent::Array(ref parts) => {
+ parts
+ .iter()
+ .map(|part| match part {
+ ChatCompletionRequestSystemMessageContentPart::Text(text) => text.text.as_str(),
+ })
+ .collect()
+ }
+ async_openai::types::chat::ChatCompletionRequestSystemMessageContent::Text(ref text) => {
vec![text.as_str()]
}
}
@@ -371,10 +394,12 @@ fn system_message_as_text_pars(sys_msg: &ChatCompletionRequestSystemMessage) ->
fn developer_message_as_text_parts(dev_msg: &ChatCompletionRequestDeveloperMessage) -> Vec<&str> {
match dev_msg.content {
- async_openai::types::ChatCompletionRequestDeveloperMessageContent::Array(ref parts) => {
- parts.iter().map(|part| part.text.as_str()).collect()
+ async_openai::types::chat::ChatCompletionRequestDeveloperMessageContent::Array(ref parts) => {
+ parts.iter().map(|part| match part {
+ async_openai::types::chat::ChatCompletionRequestDeveloperMessageContentPart::Text(t) => t.text.as_str(),
+ }).collect()
}
- async_openai::types::ChatCompletionRequestDeveloperMessageContent::Text(ref t) => vec![t],
+ async_openai::types::chat::ChatCompletionRequestDeveloperMessageContent::Text(ref t) => vec![t],
}
}
diff --git a/rust/cloud-storage/anthropic/src/openai/request/test.rs b/rust/cloud-storage/anthropic/src/openai/request/test.rs
index 5baf141229..fdc56c6470 100644
--- a/rust/cloud-storage/anthropic/src/openai/request/test.rs
+++ b/rust/cloud-storage/anthropic/src/openai/request/test.rs
@@ -1,5 +1,5 @@
use crate::types::request::*;
-use async_openai::types::CreateChatCompletionRequest;
+use async_openai::types::chat::CreateChatCompletionRequest;
fn failed_tool_calls() -> CreateChatCompletionRequest {
let request = r#"
diff --git a/rust/cloud-storage/anthropic/src/openai/stream_extension.rs b/rust/cloud-storage/anthropic/src/openai/stream_extension.rs
index 5b86e23c37..797840951d 100644
--- a/rust/cloud-storage/anthropic/src/openai/stream_extension.rs
+++ b/rust/cloud-storage/anthropic/src/openai/stream_extension.rs
@@ -6,7 +6,7 @@ use crate::types::response::code_execution::{
use crate::types::response::web_fetch::WebFetchResponse;
use crate::types::response::web_search::WebSearchResponse;
use async_openai::error::OpenAIError;
-use async_openai::types::CreateChatCompletionStreamResponse;
+use async_openai::types::chat::CreateChatCompletionStreamResponse;
use futures::Stream;
use std::pin::Pin;
diff --git a/rust/cloud-storage/anthropic/src/openai/stream_response.rs b/rust/cloud-storage/anthropic/src/openai/stream_response.rs
index 5740fc827e..681cc33da5 100644
--- a/rust/cloud-storage/anthropic/src/openai/stream_response.rs
+++ b/rust/cloud-storage/anthropic/src/openai/stream_response.rs
@@ -7,10 +7,10 @@ use crate::prelude::{ServerToolUse, transform_request_web_fetch};
use crate::types::response::{ContentDeltaEvent, StopReason, StreamEvent, Usage};
use crate::{client::chat::Chat, prelude::CreateMessageRequestBody};
use async_openai::error::{ApiError, OpenAIError};
-use async_openai::types::{
+use async_openai::types::chat::{
ChatChoiceStream, ChatCompletionMessageToolCallChunk, ChatCompletionResponseStream,
- ChatCompletionStreamResponseDelta, ChatCompletionToolType, CreateChatCompletionStreamResponse,
- FinishReason, FunctionCallStream, Role,
+ ChatCompletionStreamResponseDelta, CreateChatCompletionStreamResponse, FinishReason,
+ FunctionCallStream, FunctionType, Role,
};
use async_stream::stream;
use futures::StreamExt;
@@ -24,7 +24,7 @@ fn create_response(
index: u32,
delta: ChatCompletionStreamResponseDelta,
finish_reason: Option<FinishReason>,
- usage: Option<async_openai::types::CompletionUsage>,
+ usage: Option<async_openai::types::chat::CompletionUsage>,
) -> CreateChatCompletionStreamResponse {
CreateChatCompletionStreamResponse {
id: message_id.to_string(),
@@ -36,6 +36,7 @@ fn create_response(
}],
created,
model: model.to_string(),
+ #[allow(deprecated)]
system_fingerprint: None,
object: "chat.completion.chunk".to_string(),
service_tier: None,
@@ -68,7 +69,7 @@ fn create_content_delta(content: String) -> ChatCompletionStreamResponseDelta {
fn create_tool_call_delta(
index: u32,
id: Option<String>,
- type_: Option<ChatCompletionToolType>,
+ type_: Option<FunctionType>,
name: Option<String>,
arguments: Option<String>,
) -> ChatCompletionStreamResponseDelta {
@@ -119,7 +120,7 @@ impl TryFrom<PartialTool> for ServerToolUse {
type Error = OpenAIError;
fn try_from(value: PartialTool) -> Result<Self, Self::Error> {
let any = serde_json::from_str::<serde_json::Value>(&value.input)
- .map_err(OpenAIError::JSONDeserialize)?;
+ .map_err(|e| OpenAIError::JSONDeserialize(e, String::new()))?;
Ok(Self {
id: value.id,
name: value.name,
@@ -154,9 +155,9 @@ fn map_stream_extended(mut stream: MessageCompletionResponseStream) -> ExtendedS
while let Some(part) = stream.next().await {
if let Err(e) = part {
yield Err(match e {
- AnthropicError::JsonDeserialize(e) => OpenAIError::JSONDeserialize(e),
- AnthropicError::Reqwest(e) => OpenAIError::Reqwest(e),
- AnthropicError::StreamError(e) => OpenAIError::StreamError(e),
+ AnthropicError::JsonDeserialize(e) => OpenAIError::JSONDeserialize(e, String::new()),
+ AnthropicError::Reqwest(e) => OpenAIError::StreamError(Box::new(async_openai::error::StreamError::EventStream(e.to_string()))),
+ AnthropicError::StreamError(e) => OpenAIError::StreamError(Box::new(async_openai::error::StreamError::EventStream(e))),
AnthropicError::ApiError { status_code, api_error } => {
OpenAIError::ApiError(ApiError {
message: api_error.error.message,
@@ -192,7 +193,7 @@ fn map_stream_extended(mut stream: MessageCompletionResponseStream) -> ExtendedS
create_tool_call_delta(
index,
Some(id.clone()),
- Some(ChatCompletionToolType::Function),
+ Some(FunctionType::Function),
Some(name.clone()),
Some(String::new()),
),
@@ -362,8 +363,8 @@ fn map_stream_lossy(stream: MessageCompletionResponseStream) -> ChatCompletionRe
}))
}
-impl From<Usage> for async_openai::types::CompletionUsage {
- fn from(value: Usage) -> async_openai::types::CompletionUsage {
+impl From<Usage> for async_openai::types::chat::CompletionUsage {
+ fn from(value: Usage) -> async_openai::types::chat::CompletionUsage {
Self {
prompt_tokens: value.input_tokens,
completion_tokens: value.output_tokens,
diff --git a/rust/cloud-storage/deny.toml b/rust/cloud-storage/deny.toml
index 34b8360b5d..3e583e3fc0 100644
--- a/rust/cloud-storage/deny.toml
+++ b/rust/cloud-storage/deny.toml
@@ -75,6 +75,10 @@ ignore = [
{ id = "RUSTSEC-2024-0436", reason = "Paste is a 'finished' crate which is heavily depended on" },
{ id = "RUSTSEC-2025-0012", reason = "Cannot remove dep due to 3rd party openai dependency" },
{ id = "RUSTSEC-2025-0057", reason = "We should switch to rustc-hash, but haven't got to that yet" },
+ { id = "RUSTSEC-2026-0118", reason = "hickory-proto 0.26.1 fix not yet available via reqwest 0.13 constraints" },
+ { id = "RUSTSEC-2026-0119", reason = "hickory-proto 0.26.1 fix not yet available via reqwest 0.13 constraints" },
+ { id = "RUSTSEC-2026-0118", reason = "hickory-proto 0.26.1 fix blocked by reqwest 0.13 pinning hickory-resolver ^0.25; revisit on next reqwest release" },
+ { id = "RUSTSEC-2026-0119", reason = "hickory-proto 0.26.1 fix blocked by reqwest 0.13 pinning hickory-resolver ^0.25; revisit on next reqwest release" },
{ id = "RUSTSEC-2026-0098", reason = "rustls-webpki 0.101.7 pinned by AWS SDK via rustls 0.21" },
{ id = "RUSTSEC-2026-0099", reason = "rustls-webpki 0.101.7 pinned by AWS SDK via rustls 0.21" },
{ id = "RUSTSEC-2026-0104", reason = "rustls-webpki 0.101.7 pinned by AWS SDK via rustls 0.21" },
@@ -255,8 +259,11 @@ skip = [
{ crate = "hyper", reason = "AWS SDK uses older hyper version" },
{ crate = "hyper-rustls", reason = "TLS dependencies version mismatch" },
{ crate = "hyper-tls", reason = "TLS dependencies version mismatch" },
+ { crate = "reqwest", reason = "livekit-api pins reqwest 0.12 via services-tokio feature; workspace uses 0.13" },
{ crate = "infer", reason = "File type detection dependencies" },
{ crate = "itertools", reason = "Various dependencies require different versions" },
+ { crate = "jni", reason = "Different dependencies require different versions" },
+ { crate = "jni-sys", reason = "Different dependencies require different versions" },
{ crate = "jsonwebtoken", reason = "Git fork and crates.io version coexist" },
{ crate = "match_token", reason = "HTML parsing dependencies" },
{ crate = "markup5ever", reason = "HTML parsing dependencies" },
@@ -307,6 +314,9 @@ skip = [
{ crate = "windows_x86_64_gnullvm", reason = "Windows dependencies" },
{ crate = "windows_x86_64_msvc", reason = "Windows dependencies" },
{ crate = "windows-link", reason = "Windows dependencies" },
+ { crate = "windows-registry", reason = "Windows dependencies version mismatch" },
+ { crate = "windows-result", reason = "Windows dependencies version mismatch" },
+ { crate = "windows-strings", reason = "Windows dependencies version mismatch" },
{ crate = "windows_i686_gnullvm", reason = "Windows dependencies" },
{ crate = "zerocopy", reason = "Zero-copy serialization dependencies" },
{ crate = "zip", reason = "Different dependencies require different versions" },
@@ -337,7 +347,6 @@ unknown-git = "warn"
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
# List of URLs for allowed Git repositories
allow-git = [
- "git+https://github.com/seanaye/reqwest-middleware",
"git+https://github.com/whutchinson98/jsonwebtoken",
]
diff --git a/rust/cloud-storage/email_db_client/src/user_history/mod.rs b/rust/cloud-storage/email_db_client/src/user_history/mod.rs
index 15aedf51b5..a0ab4f77fd 100644
--- a/rust/cloud-storage/email_db_client/src/user_history/mod.rs
+++ b/rust/cloud-storage/email_db_client/src/user_history/mod.rs
@@ -166,13 +166,9 @@ pub async fn get_thread_summary_info(
updated_at: row.last_message_ts,
// if the last time the user viewed the thread was before the most recent message came in,
// the user hasn't viewed the most recent message.
- viewed_at: row.viewed_at.and_then(|viewed| {
- if viewed >= row.last_message_ts {
- Some(viewed)
- } else {
- None
- }
- }),
+ viewed_at: row
+ .viewed_at
+ .filter(|&viewed| viewed >= row.last_message_ts),
sender: row.sender,
pretty_sender: row.pretty_sender,
is_read: row.is_read,
diff --git a/rust/cloud-storage/rpc/axum_rpc/.helix/languages.toml b/rust/cloud-storage/rpc/axum_rpc/.helix/languages.toml
deleted file mode 100644
index da038d03e5..0000000000
--- a/rust/cloud-storage/rpc/axum_rpc/.helix/languages.toml
+++ /dev/null
@@ -1,5 +0,0 @@
-[[language]]
-name = "rust"
-
-[language-server.rust-analyzer.config]
-cargo.target = "wasm32-unknown-unknown"
diff --git a/rust/cloud-storage/rpc/axum_rpc/Cargo.toml b/rust/cloud-storage/rpc/axum_rpc/Cargo.toml
deleted file mode 100644
index f103cb56d5..0000000000
--- a/rust/cloud-storage/rpc/axum_rpc/Cargo.toml
+++ /dev/null
@@ -1,17 +0,0 @@
-[package]
-edition = "2024"
-name = "axum_rpc"
-publish = false
-version = "0.1.0"
-
-
-[dependencies]
-anyhow = { workspace = true }
-axum_rpc_emit = { path = "../axum_rpc_emit" }
-
-[target.'cfg(target_arch = "wasm32")'.dependencies]
-async-trait = { workspace = true }
-http = { workspace = true }
-js-sys = { workspace = true }
-reqwest-middleware = { workspace = true }
-web-sys = { version = "0.3", features = ["Headers", "console"] }
diff --git a/rust/cloud-storage/rpc/axum_rpc/src/lib.rs b/rust/cloud-storage/rpc/axum_rpc/src/lib.rs
deleted file mode 100644
index db44a5a435..0000000000
--- a/rust/cloud-storage/rpc/axum_rpc/src/lib.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-pub use anyhow;
-pub use axum_rpc_emit::*;
-
-#[cfg(target_family = "wasm")]
-pub trait MaybeSend {}
-#[cfg(target_family = "wasm")]
-impl<T> MaybeSend for T {}
-
-#[cfg(not(target_family = "wasm"))]
-pub trait MaybeSend: Send {}
-#[cfg(not(target_family = "wasm"))]
-impl<T> MaybeSend for T where T: Send {}
-
-#[cfg(target_family = "wasm")]
-pub trait MaybeSync {}
-#[cfg(target_family = "wasm")]
-impl<T> MaybeSync for T {}
-
-#[cfg(not(target_family = "wasm"))]
-pub trait MaybeSync: Sync {}
-#[cfg(not(target_family = "wasm"))]
-impl<T> MaybeSync for T where T: Sync {}
-
-macro_rules! if_wasm {
- ($($item:item)*) => {$(
- #[cfg(target_arch = "wasm32")]
- $item
- )*}
-}
-
-if_wasm! {
- pub mod wasm;
-}
diff --git a/rust/cloud-storage/rpc/axum_rpc/src/wasm.rs b/rust/cloud-storage/rpc/axum_rpc/src/wasm.rs
deleted file mode 100644
index 3e956912b3..0000000000
--- a/rust/cloud-storage/rpc/axum_rpc/src/wasm.rs
+++ /dev/null
@@ -1,123 +0,0 @@
-use std::sync::Arc;
-
-use http::Extensions;
-use js_sys::wasm_bindgen::{JsCast, JsValue};
-use js_sys::{Array, Reflect};
-use reqwest_middleware::Next;
-use reqwest_middleware::reqwest::{Request, Response};
-use reqwest_middleware::{
- Middleware,
- reqwest::header::{HeaderMap, HeaderName, HeaderValue},
-};
-
-trait JsCastRes: Sized {
- /// attempt to cast the jsvalue into T at runtime
- fn cast<T: JsCast>(self) -> Result<T, JsValue>;
- /// uses cast and logs the error if the received value was incorrect
- fn cast_and_log<T: JsCast>(self) -> Option<T> {
- match self.cast() {
- Ok(v) => Some(v),
- Err(e) => {
- web_sys::console::log_2(
- &JsValue::from_str(&format!(
- "Expected to receive a value of type {}, but instead received:",
- std::any::type_name::<T>()
- )),
- &e,
- );
- None
- }
- }
- }
-}
-
-impl JsCastRes for Result<JsValue, JsValue> {
- fn cast<T: JsCast>(self) -> Result<T, JsValue> {
- self.and_then(|ok| ok.dyn_into())
- }
-}
-
-/// Helper function to convert web_sys::Headers to reqwest::HeaderMap
-fn headers_to_headermap(headers: &web_sys::Headers) -> HeaderMap {
- let mut map = HeaderMap::new();
-
- // Get the entries iterator
- let entries = headers.entries();
-
- loop {
- let Ok(next) = entries.next() else {
- web_sys::console::log_1(&JsValue::from_str("Failed to get next entry"));
- break;
- };
-
- // Check if done
- let done = Reflect::get(&next, &JsValue::from_str("done"))
- .ok()
- .and_then(|v| v.as_bool())
- .unwrap_or(true);
-
- if done {
- break;
- }
-
- // Get the value [name, value]
- if let Ok(value) = Reflect::get(&next, &JsValue::from_str("value")) {
- if let Ok(array) = value.dyn_into::<Array>() {
- if let (Some(name), Some(val)) =
- (array.get(0).as_string(), array.get(1).as_string())
- {
- if let (Ok(header_name), Ok(header_value)) = (
- HeaderName::from_bytes(name.as_bytes()),
- HeaderValue::from_str(&val),
- ) {
- map.insert(header_name, header_value);
- }
- }
- }
- }
- }
-
- map
-}
-
-pub struct JsHeaderMiddleware {
- inner: Arc<dyn Fn() -> HeaderMap>,
-}
-
-// SAFETY: browser based wasm only has 1 thread so this is never actually sent
-// THIS IS UNSOUND IN THREADED WASM ENVIRONMENTS
-unsafe impl Send for JsHeaderMiddleware {}
-unsafe impl Sync for JsHeaderMiddleware {}
-
-impl JsHeaderMiddleware {
- pub fn new(f: js_sys::Function) -> Self {
- let inner = Arc::new(move || {
- let Some(res) = f
- .call0(&JsValue::UNDEFINED)
- .cast_and_log::<web_sys::Headers>()
- else {
- return HeaderMap::default();
- };
- headers_to_headermap(&res)
- });
-
- Self { inner }
- }
-}
-
-#[async_trait::async_trait(?Send)]
-impl Middleware for JsHeaderMiddleware {
- async fn handle(
- &self,
- mut req: Request,
- extensions: &mut Extensions,
- next: Next<'_>,
- ) -> Result<Response, reqwest_middleware::Error> {
- let headers = req.headers_mut();
- let merge = (self.inner)();
-
- headers.extend(merge.into_iter().filter_map(|(k, v)| Some((k?, v))));
-
- next.run(req, extensions).await
- }
-}
diff --git a/rust/cloud-storage/rpc/axum_rpc_emit/Cargo.toml b/rust/cloud-storage/rpc/axum_rpc_emit/Cargo.toml
deleted file mode 100644
index dac08e02fe..0000000000
--- a/rust/cloud-storage/rpc/axum_rpc_emit/Cargo.toml
+++ /dev/null
@@ -1,17 +0,0 @@
-[package]
-edition = "2024"
-name = "axum_rpc_emit"
-publish = false
-version = "0.1.0"
-
-[lib]
-proc-macro = true
-
-[dependencies]
-axum_rpc_parse = { path = "../axum_rpc_parse" }
-proc-macro2 = "1.0.103"
-quote = { workspace = true }
-unsynn = { workspace = true }
-
-[dev-dependencies]
-cool_asserts = "2"
diff --git a/rust/cloud-storage/rpc/axum_rpc_emit/src/lib.rs b/rust/cloud-storage/rpc/axum_rpc_emit/src/lib.rs
deleted file mode 100644
index ac2c59d873..0000000000
--- a/rust/cloud-storage/rpc/axum_rpc_emit/src/lib.rs
+++ /dev/null
@@ -1,632 +0,0 @@
-use axum_rpc_parse::{ClientDirective, KRouter, ModPath, Trait, TraitFn, TraitItem};
-use proc_macro2::TokenStream;
-use quote::quote;
-use unsynn::*;
-
-fn attr_macros_inner(attr: TokenStream, mut input: TokenStream) -> TokenStream {
- let mut i = input.clone().to_token_iter();
-
- let target = parse_top_level_attr(&attr);
-
- match i.parse::<Cons<Trait, EndOfStream>>() {
- Ok(Cons { first, .. }) => {
- input.extend(generate_target(target, first));
- input
- }
- Err(err) => {
- panic!("Could not parse type declaration: {input}\nError: {err}");
- }
- }
-}
-
-enum ToGenerate {
- Client { bindgen: bool },
- Router,
-}
-
-fn parse_top_level_attr(attr: &TokenStream) -> ToGenerate {
- let mut i = attr.to_token_iter();
-
- match i.parse::<Cons<CommaDelimitedVec<Either<KRouter, ClientDirective>>, EndOfStream>>() {
- Ok(Cons { first, .. }) => {
- let has_router = first.iter().any(|v| matches!(v.value, Either::First(_)));
- let bindgen = first.iter().find_map(|v| match &v.value {
- Either::Second(a) => Some(a.inner.as_ref().map(|_| true).unwrap_or_default()),
- _ => None,
- });
- match (has_router, bindgen) {
- (true, None) => ToGenerate::Router,
- (false, Some(bindgen)) => ToGenerate::Client { bindgen },
- _ => panic!("Expected one of `router` or `client`"),
- }
- }
- Err(err) => {
- panic!("Could not parse type declaration {attr}\nError: {err}");
- }
- }
-}
-
-#[proc_macro_attribute]
-pub fn attr_macros(
- attr: proc_macro::TokenStream,
- input: proc_macro::TokenStream,
-) -> proc_macro::TokenStream {
- attr_macros_inner(attr.into(), input.into()).into()
-}
-
-fn generate_target(target: ToGenerate, tokens: Trait) -> TokenStream {
- // Validate that all trait functions have exactly 1 argument (besides &self)
- validate_trait_functions(&tokens);
-
- match target {
- ToGenerate::Client { bindgen } => generate_client(&tokens, bindgen),
- ToGenerate::Router => generate_router(&tokens),
- }
-}
-
-fn validate_trait_functions(tokens: &Trait) {
- for item in tokens.body.content.iter() {
- if let TraitItem::Fn(f) = &item.value {
- let args_count = f.args.content.second.len();
- if args_count > 2 {
- panic!(
- "RPC trait method '{}' must have 0, 1, or 2 arguments (besides &self), but found {}. \
- RPC methods should take the form: fn method_name(&self, [extractor: Self::AssociatedType,] [arg: ArgType]) -> ...",
- f.name, args_count
- );
- }
- }
- }
-}
-
-/// Check if a ModPath represents an associated type (e.g., Self::SomeType)
-fn is_associated_type(path: &ModPath) -> bool {
- // Check if path is Self::Something (no leading ::, first ident is "Self", has at least 2 segments)
- if path.first.is_some() {
- return false; // Has leading ::, not an associated type
- }
-
- let segments = &path.second;
- if segments.len() < 2 {
- return false; // Need at least Self::TypeName
- }
-
- // Check if first segment is "Self"
- segments.first().map(|d| d.value == "Self").unwrap_or(false)
-}
-
-fn generate_bindgen(tokens: &Trait, client_name: &Ident) -> TokenStream {
- fn generate_client_method(f: &TraitFn, trait_name: &Ident) -> TokenStream {
- let method_name = &f.name;
- let args = &f.args.content.second;
-
- // Separate extractor args from JSON args - wasm_bindgen can't handle associated types
- let json_args: Vec<_> = args
- .iter()
- .filter(|arg| !is_associated_type(&arg.value.val))
- .collect();
-
- // Generate argument streams only for non-extractor args
- let arg_streams: Vec<_> = json_args
- .iter()
- .map(|arg| {
- let name = &arg.value.name;
- let val = generate_mod_path(&arg.value.val);
- quote! { #name: #val }
- })
- .collect();
-
- // Generate argument names to pass to trait method
- // For extractors, pass (), for JSON args pass the actual value
- let call_args: Vec<_> = args
- .iter()
- .map(|arg| {
- let name = &arg.value.name;
- if is_associated_type(&arg.value.val) {
- quote! { () }
- } else {
- quote! { #name }
- }
- })
- .collect();
-
- let ok = f.return_type.ok.to_token_stream();
-
- quote! {
- pub async fn #method_name(&self, #(#arg_streams),*) -> Result<#ok, String> {
- #trait_name::#method_name(self, #(#call_args),*).await.map_err(|e| e.to_string())
- }
- }
- }
-
- let methods = tokens
- .body
- .content
- .iter()
- .filter_map(|Delimited { value, .. }| match value {
- TraitItem::Fn(f) => Some(generate_client_method(f, &tokens.name)),
- TraitItem::AssociatedType(_) => None,
- });
-
- quote! {
- #[::wasm_bindgen::prelude::wasm_bindgen]
- impl #client_name {
- pub fn construct(s: String) -> Result<Self, String> {
- let url = s.parse().map_err(|_| String::from("invalid url"))?;
- Ok(Self::builder().build(url).map_err(|e| e.to_string())?)
- }
-
- pub fn construct_with_headers(
- s: String,
- // TODO: fix this it causes the compile to fail
- // consider moving this code outside of quote
- // #[wasm_bindgen(typescript_type = "() => Headers")]
- headers_fn: ::js_sys::Function
- ) -> Result<Self, String> {
- let url = s.parse().map_err(|_| String::from("invalid url"))?;
- let middleware = ::axum_rpc::wasm::JsHeaderMiddleware::new(headers_fn);
- Ok(Self::builder()
- .with(middleware)
- .build(url)
- .map_err(|e| e.to_string())?)
- }
-
- #(#methods)*
-
- }
-
- }
-}
-
-fn generate_client(tokens: &Trait, bindgen: bool) -> TokenStream {
- let trait_name = &tokens.name;
- let name_str = trait_name.to_string();
- let client_name = quote::format_ident!("{name_str}Client");
- let builder_name = quote::format_ident!("{name_str}ClientBuilder");
-
- let methods = generate_client_methods(tokens);
- let associated_types = generate_client_associated_types(tokens);
-
- let mut output = match bindgen {
- true => quote! {
- #[::wasm_bindgen::prelude::wasm_bindgen]
- },
- false => quote! {},
- };
-
- output.extend(quote! {
- #[derive(Clone)]
- pub struct #client_name {
- endpoint: ::url::Url,
- client: ::std::sync::Arc<::reqwest_middleware::ClientWithMiddleware>
- }
-
-
- impl #client_name {
- pub fn builder() -> #builder_name {
- #builder_name::new()
- }
-
- fn get_endpoint(&self, s: &'static str) -> ::url::Url {
- let mut url = self.endpoint.clone();
- url.path_segments_mut().unwrap().push(s);
- url
- }
- }
-
- impl #trait_name for #client_name {
- #(#associated_types)*
-
- #(#methods)*
- }
-
-
- pub struct #builder_name {
- builder: ::reqwest_middleware::ClientBuilder,
- }
-
- #[derive(Debug)]
- pub struct CannotBeBase;
-
- impl std::fmt::Display for CannotBeBase {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- write!(f, "Url cannot be a base. Must pass a qualified url e.g. https://macro.com")
- }
- }
-
-
- impl #builder_name {
- pub fn new_with_client(client: ::reqwest::Client) -> Self {
- #builder_name {
- builder: ::reqwest_middleware::ClientBuilder::new(client)
- }
- }
-
- pub fn new() -> Self {
- let client = ::reqwest::Client::new();
- Self::new_with_client(client)
- }
-
- pub fn with<M: ::reqwest_middleware::Middleware>(self, middleware: M) -> Self {
- let #builder_name { builder } = self;
- #builder_name { builder: builder.with(middleware) }
- }
-
- pub fn build(self, endpoint: ::url::Url) -> Result<#client_name, CannotBeBase> {
- let #builder_name { builder } = self;
-
- let false = endpoint.cannot_be_a_base() else {
- return Err(CannotBeBase);
- };
-
- Ok(#client_name {
- endpoint,
- client: ::std::sync::Arc::new(builder.build())
- })
- }
- }
-
-
- });
-
- if bindgen {
- output.extend(generate_bindgen(tokens, &client_name));
- }
-
- output
-}
-
-fn generate_client_method(f: &TraitFn) -> TokenStream {
- let method_name = &f.name;
- let ok = f.return_type.ok.to_token_stream();
- let err = f.return_type.err.to_token_stream();
- let literal = proc_macro2::Literal::string(&f.name.to_string());
-
- let args = &f.args.content.second;
-
- // Separate extractor args from JSON args
- let mut extractor_args = vec![];
- let mut json_arg = None;
-
- for arg in args.iter() {
- if is_associated_type(&arg.value.val) {
- extractor_args.push(arg);
- } else {
- json_arg = Some(arg);
- }
- }
-
- // Generate function signature with all arguments
- // For extractor args (Self::AssociatedType), use () in the client impl
- let all_args = args.iter().map(|arg| {
- let arg_name = &arg.value.name;
- if is_associated_type(&arg.value.val) {
- // Extractor argument - use () for client
- quote! { #arg_name: () }
- } else {
- let arg_val = generate_mod_path(&arg.value.val);
- quote! { #arg_name: #arg_val }
- }
- });
-
- match json_arg {
- Some(arg) => {
- // Has JSON body
- let arg_name = &arg.value.name;
-
- quote! {
- async fn #method_name(&self, #(#all_args),*) -> Result<#ok, #err> {
- let endpoint = self.get_endpoint(#literal);
- Ok(self.client.post(endpoint).with_inner_builder(|builder| builder.fetch_credentials_include()).json(&#arg_name).send().await?.error_for_status()?.json().await?)
- }
- }
- }
- None => {
- // No JSON body (only extractor args or no args at all)
- if extractor_args.is_empty() {
- // No arguments at all
- quote! {
- async fn #method_name(&self) -> Result<#ok, #err> {
- let endpoint = self.get_endpoint(#literal);
- Ok(self.client.post(endpoint).with_inner_builder(|builder| builder.fetch_credentials_include()).send().await?.error_for_status()?.json().await?)
- }
- }
- } else {
- // Only extractor args (passed but not used in HTTP call)
- quote! {
- async fn #method_name(&self, #(#all_args),*) -> Result<#ok, #err> {
- let endpoint = self.get_endpoint(#literal);
- Ok(self.client.post(endpoint).with_inner_builder(|builder| builder.fetch_credentials_include()).send().await?.error_for_status()?.json().await?)
- }
- }
- }
- }
- }
-}
-
-fn generate_mod_path(path: &ModPath) -> TokenStream {
- let mut tokens = TokenStream::new();
-
- // Add optional leading ::
- if let Some(path_sep) = &path.first {
- tokens.extend(path_sep.to_token_stream());
- }
-
- // Add the path segments (ident :: ident :: ident)
- tokens.extend(path.second.to_token_stream());
-
- tokens
-}
-
-/// Generate a mod path, replacing Self with the given type name for use in impl blocks
-fn generate_mod_path_replace_self(path: &ModPath, replacement: &Ident) -> TokenStream {
- // Check if first segment is "Self" and replace it
- let segments = &path.second;
- if let Some(first_seg) = segments.first()
- && first_seg.value == "Self"
- {
- // Build new path with replacement
- let mut tokens = TokenStream::new();
-
- // Add optional leading ::
- if let Some(path_sep) = &path.first {
- tokens.extend(path_sep.to_token_stream());
- }
-
- // Add the replacement for Self
- tokens.extend(replacement.to_token_stream());
-
- // Add the rest (::TypeName)
- // Get the tail of segments after Self
- for i in 1..segments.len() {
- tokens.extend(quote! { :: });
- if let Some(seg) = segments.get(i) {
- tokens.extend(seg.value.to_token_stream());
- }
- }
-
- return tokens;
- }
-
- // No Self to replace, use original
- generate_mod_path(path)
-}
-
-fn generate_client_methods(tokens: &Trait) -> impl Iterator<Item = TokenStream> + '_ {
- tokens
- .body
- .content
- .iter()
- .filter_map(|Delimited { value, .. }| match value {
- TraitItem::Fn(f) => Some(generate_client_method(f)),
- TraitItem::AssociatedType(_) => None,
- })
-}
-
-fn generate_client_associated_types(tokens: &Trait) -> impl Iterator<Item = TokenStream> + '_ {
- tokens
- .body
- .content
- .iter()
- .filter_map(|Delimited { value, .. }| match value {
- TraitItem::AssociatedType(at) => {
- let type_name = &at.name;
- Some(quote! {
- type #type_name = ();
- })
- }
- TraitItem::Fn(_) => None,
- })
-}
-
-fn generate_router(tokens: &Trait) -> TokenStream {
- let trait_name = &tokens.name;
- let name_str = trait_name.to_string();
- let builder_name = quote::format_ident!("{name_str}RouterBuilder");
-
- let handlers = generate_handlers(tokens);
- let handler_fns = generate_handler_fns(tokens);
- let build_where_bounds = generate_build_where_bounds(tokens);
-
- quote! {
-
- pub struct #builder_name<T> {
- state: T
- }
-
-
- #handler_fns
-
- impl<T: #trait_name + Clone> #builder_name<T> {
- pub fn new(state: T) -> Self {
- Self {
- state
- }
-
- }
-
- pub fn build<S: Send + Sync>(self) -> ::axum::Router<S>
- where
- #(#build_where_bounds),*
- {
- ::axum::Router::new()#handlers.with_state(self.state)
- }
- }
- }
-}
-
-fn generate_build_where_bounds(tokens: &Trait) -> Vec<TokenStream> {
- use std::collections::HashSet;
-
- // Collect all associated types that are actually used as extractors
- let mut used_extractors = HashSet::new();
-
- for item in tokens.body.content.iter() {
- if let TraitItem::Fn(f) = &item.value {
- let args = &f.args.content.second;
- for arg in args.iter() {
- if is_associated_type(&arg.value.val) {
- // Extract the type name from Self::TypeName
- if let Some(type_name_ident) = arg.value.val.second.get(1) {
- used_extractors.insert(type_name_ident.value.to_string());
- }
- }
- }
- }
- }
-
- // Generate where bounds only for used extractors
- used_extractors
- .into_iter()
- .map(|type_name_str| {
- let type_name = quote::format_ident!("{}", type_name_str);
- quote! {
- T::#type_name: ::axum::extract::FromRequestParts<T> + Send
- }
- })
- .collect()
-}
-
-fn generate_handlers(tokens: &Trait) -> TokenStream {
- tokens
- .body
- .content
- .iter()
- .filter_map(|Delimited { value, .. }| match value {
- TraitItem::Fn(f) => {
- let literal = proc_macro2::Literal::string(&format!("/{}", &f.name));
- let HandlerName { handler_name } = HandlerName::new(f);
-
- Some(quote! {
- .route(#literal, ::axum::routing::post(#handler_name::<T>))
- })
- }
- TraitItem::AssociatedType(_) => None,
- })
- .collect()
-}
-
-struct HandlerName {
- handler_name: Ident,
-}
-
-impl HandlerName {
- fn new(f: &TraitFn) -> Self {
- let handler_name = quote::format_ident!("{}_handler", f.name.to_string());
- HandlerName { handler_name }
- }
-}
-
-fn generate_handler_fns(tokens: &Trait) -> TokenStream {
- let trait_name = &tokens.name;
-
- tokens
- .body
- .content
- .iter()
- .filter_map(|Delimited { value, .. }| {
- let f = match value {
- TraitItem::Fn(f) => f,
- TraitItem::AssociatedType(_) => return None,
- };
-
- let args = &f.args.content.second;
- let ok = f.return_type.ok.to_token_stream();
- let err = f.return_type.err.to_token_stream();
-
- let HandlerName { handler_name } = HandlerName::new(f);
- let method_name = &f.name;
-
- // Separate extractor args from JSON args
- let mut extractor_args = vec![];
- let mut json_arg = None;
-
- for arg in args.iter() {
- if is_associated_type(&arg.value.val) {
- extractor_args.push(arg);
- } else {
- json_arg = Some(arg);
- }
- }
-
- // Generate extractor parameters only for the ones used in this method
- // Replace Self:: with T:: for use in handler function
- let t_ident = quote::format_ident!("T");
- let extractor_params = extractor_args.iter().map(|arg| {
- let arg_name = &arg.value.name;
- let arg_val = generate_mod_path_replace_self(&arg.value.val, &t_ident);
- quote! {
- #arg_name: #arg_val
- }
- });
-
- // Generate where bounds only for the extractors used in this method
- let where_bounds = extractor_args.iter().map(|arg| {
- let arg_val = generate_mod_path_replace_self(&arg.value.val, &t_ident);
- quote! {
- #arg_val: ::axum::extract::FromRequestParts<T> + Send
- }
- });
-
- // Generate the argument names to pass to the trait method
- let method_call_args = args.iter().map(|arg| {
- let arg_name = &arg.value.name;
- quote! { #arg_name }
- });
-
- match json_arg {
- Some(arg) => {
- // Has JSON body
- let json_arg_name = &arg.value.name;
- let json_arg_val = generate_mod_path(&arg.value.val);
-
- if extractor_args.is_empty() {
- // No extractors, only JSON
- Some(quote! {
- async fn #handler_name<T>(
- state: ::axum::extract::State<T>,
- ::axum::extract::Json(#json_arg_name): ::axum::extract::Json<#json_arg_val>
- ) -> Result<::axum::extract::Json<#ok>, #err>
- where
- T: #trait_name,
- #(#where_bounds),*
- {
- state.0.#method_name(#(#method_call_args),*).await.map(::axum::extract::Json)
- }
- })
- } else {
- // Both extractors and JSON
- Some(quote! {
- async fn #handler_name<T>(
- state: ::axum::extract::State<T>,
- #(#extractor_params,)*
- ::axum::extract::Json(#json_arg_name): ::axum::extract::Json<#json_arg_val>
- ) -> Result<::axum::extract::Json<#ok>, #err>
- where
- T: #trait_name,
- #(#where_bounds),*
- {
- state.0.#method_name(#(#method_call_args),*).await.map(::axum::extract::Json)
- }
- })
- }
- }
- None => {
- // No JSON body (only extractor args or no args at all)
- Some(quote! {
- async fn #handler_name<T>(
- state: ::axum::extract::State<T>,
- #(#extractor_params),*
- ) -> Result<::axum::extract::Json<#ok>, #err>
- where
- T: #trait_name,
- #(#where_bounds),*
- {
- state.0.#method_name(#(#method_call_args),*).await.map(::axum::extract::Json)
- }
- })
- }
- }
- })
- .collect()
-}
diff --git a/rust/cloud-storage/rpc/axum_rpc_parse/Cargo.toml b/rust/cloud-storage/rpc/axum_rpc_parse/Cargo.toml
deleted file mode 100644
index c2e4be5dea..0000000000
--- a/rust/cloud-storage/rpc/axum_rpc_parse/Cargo.toml
+++ /dev/null
@@ -1,12 +0,0 @@
-[package]
-edition = "2024"
-name = "axum_rpc_parse"
-publish = false
-version = "0.1.0"
-
-[dependencies]
-quote = { workspace = true }
-unsynn = { workspace = true }
-
-[dev-dependencies]
-cool_asserts = "2"
diff --git a/rust/cloud-storage/rpc/axum_rpc_parse/src/lib.rs b/rust/cloud-storage/rpc/axum_rpc_parse/src/lib.rs
deleted file mode 100644
index 7ed9d72db2..0000000000
--- a/rust/cloud-storage/rpc/axum_rpc_parse/src/lib.rs
+++ /dev/null
@@ -1,524 +0,0 @@
-#![allow(clippy::result_large_err)]
-use unsynn::*;
-
-keyword! {
- pub KPub = "pub";
- pub KIn = "in";
- pub KRepr = "repr";
- pub KRouter = "router";
- pub KClient = "client";
- pub KBindgen = "bindgen";
- pub KIgnore = "ignore";
- pub KDoc = "doc";
- pub KTrait = "trait";
- pub KWhere = "where";
- pub KConst = "const";
- pub KJson = "json";
- pub KFn = "fn";
- pub KImpl = "impl";
- pub KFuture = "Future";
- pub KOutput = "Output";
- pub KResult = "Result";
- pub KSelf = "self";
- pub KType = "type";
-}
-
-operator! {
- /// Represents the '=' operator.
- Eq = "=";
- /// Represents the ';' operator.
- Semi = ";";
- /// Represents the apostrophe '\'' operator.
- Apostrophe = "'";
- /// Represents the double semicolon '::' operator.
- DoubleSemicolon = "::";
- /// Represents the '&'
- Ampersand = "&";
-}
-
-/// Represents a module path, consisting of an optional path separator followed by
-/// a path-separator-delimited sequence of identifiers.
-pub type ModPath = Cons<Option<PathSep>, DelimitedVec<Ident, PathSep>>;
-
-/// Represents type bounds, consisting of a colon followed by tokens until
-/// a comma, equals sign, or closing angle bracket is encountered.
-pub type Bounds = Cons<Colon, VerbatimUntil<Either<Comma, Eq, Gt>>>;
-
-/// Parses tokens and groups until `C` is found on the current token tree level.
-pub type VerbatimUntil<C> = Any<Cons<Except<C>, AngleTokenTree>>;
-
-/// Vector of `T` delimited by `;`
-pub type SemicolonDelimitedVec<T> = DelimitedVec<T, Semicolon, TrailingDelimiter::Mandatory>;
-
-unsynn! {
-
-/// Represents visibility modifiers for items.
-enum Vis {
- /// `pub(in? crate::foo::bar)`/`pub(in? ::foo::bar)`
- PubIn(Cons<KPub, ParenthesisGroupContaining<Cons<Option<KIn>, ModPath>>>),
- /// Public visibility, indicated by the "pub" keyword.
- Pub(KPub),
-}
-
-/// Represents an attribute annotation on a field, typically in the form `#[attr]`.
-pub struct Attribute {
- /// The pound sign preceding the attribute.
- pub _pound: Pound,
- /// The content of the attribute enclosed in square brackets.
- pub body: BracketGroupContaining<AttributeInner>,
-}
-
-/// Represents the inner content of an attribute annotation.
-pub enum AttributeInner {
- /// A server attribute that can contain specialized metadata.
- Router(RouterAttr),
-
- /// A documentation attribute typically used for generating documentation.
- Doc(DocInner),
- /// A representation attribute that specifies how data should be laid out.
- Repr(ReprInner),
- /// Any other attribute represented as a sequence of token trees.
- Any(Vec<TokenTree>),
-}
-
-
-
-pub struct RouterAttr {
- /// The keyword for the router attribute.
- _router: KRouter,
- /// The inner content of the client attribute.
- pub inner: ParenthesisGroupContaining<CommaDelimitedVec<RouterInner>>,
-}
-
-pub enum RouterInner {
- ClientDirective(ClientDirective),
- JsonDirective(KJson),
-}
-
-pub struct ClientDirective {
- _client: KClient,
- pub inner: Option<ParenthesisGroupContaining<ClientDirectiveValue>>
-}
-
-pub struct ClientDirectiveValue {
- bindgen: KBindgen
-}
-
-/// Represents documentation for an item.
-pub struct DocInner {
- /// The "doc" keyword.
- pub _kw_doc: KDoc,
- /// The equality operator.
- pub _eq: Eq,
- /// The documentation content as a literal string.
- pub value: LiteralString,
-}
-
-/// Represents the inner content of a `repr` attribute, typically used for specifying
-/// memory layout or representation hints.
-pub struct ReprInner {
- /// The "repr" keyword.
- pub _kw_repr: KRepr,
- /// The representation attributes enclosed in parentheses.
- pub attr: ParenthesisGroupContaining<CommaDelimitedVec<Ident>>,
-}
-
-/// Represents an associated type in a trait.
-pub struct AssociatedType {
- /// Zero or more attributes (including doc comments)
- pub attributes: Option<Many<Attribute>>,
- /// The "type" keyword.
- pub _type: KType,
- /// The name of the associated type.
- pub name: Ident,
- /// Optional bounds and default type.
- pub rest: VerbatimUntil<Semicolon>,
-}
-
-pub struct TraitFn {
- /// Zero or more attributes (including doc comments)
- pub attributes: Option<Many<Attribute>>,
- pub _fn: KFn,
- /// the name of the function
- pub name: Ident,
- /// Generic parameters for the trait, if any.
- pub generics: Option<GenericParams>,
- /// The representation attributes enclosed in parentheses.
- pub args: ParenthesisGroupContaining<Cons<Receiver, CommaDelimitedVec<FnArg>, Option<Comma>>>,
- pub return_type: AsyncReturnType,
-}
-
-pub struct AsyncReturnType {
- _arrow: RArrow,
- _impl: KImpl,
- _fut: KFuture,
- _lt: Lt,
- _output: KOutput,
- _eq: Eq,
- _res: KResult,
- _lt2: Lt,
- pub ok: VerbatimUntil<Comma>,
- _comma: Comma,
- pub err: AngleTokenTree,
- _gt: Gt,
- _gt2: Gt,
- pub rest: VerbatimUntil<Semicolon>,
-}
-
-pub struct Receiver {
- _amp: Ampersand,
- _self: KSelf,
- _comma: Option<Comma>
-}
-
-pub struct FnArg {
- pub attr: Option<Many<Attribute>>,
- pub name: Ident,
- _colon: Colon,
- pub val: ModPath
-}
-
-/// Represents an item within a trait body.
-pub enum TraitItem {
- /// An associated type declaration.
- AssociatedType(AssociatedType),
- /// A trait function.
- Fn(TraitFn),
-}
-
-/// Represents a trait definition.
-pub struct Trait {
- /// Attributes applied to the struct.
- pub attributes: Option<Many<Attribute>>,
- /// The visibility modifier of the struct (e.g., `pub`).
- pub vis: Option<Vis>,
- /// The "struct" keyword.
- pub _kw_struct: KTrait,
- /// The name of the struct.
- pub name: Ident,
- /// Generic parameters for the trait, if any.
- pub generics: Option<GenericParams>,
-
- pub super_traits: Option<Cons<Colon, VerbatimUntil<Either<KWhere, BraceGroup>>>>,
-
- /// Optional where clauses.
- pub clauses: Option<WhereClauses>,
- /// The enum variants enclosed in braces `{}`.
- pub body: BraceGroupContaining<SemicolonDelimitedVec<TraitItem>>,
-}
-
-/// Represents a `where` clause attached to a definition.
-/// e.g., `where T: Trait, 'a: 'b`.
-#[derive(Clone)]
-pub struct WhereClauses {
- /// The `where` keyword.
- pub _kw_where: KWhere,
- /// The comma-delimited list of where clause predicates.
- pub clauses: CommaDelimitedVec<WhereClause>,
-}
-
-/// Represents a single predicate within a `where` clause.
-/// e.g., `T: Trait` or `'a: 'b`.
-#[derive(Clone)]
-pub struct WhereClause {
- // FIXME: This likely breaks for absolute `::` paths
- /// The type or lifetime being constrained (e.g., `T` or `'a`).
- pub _pred: VerbatimUntil<Colon>,
- /// The colon separating the constrained item and its bounds.
- pub _colon: Colon,
- /// The bounds applied to the type or lifetime (e.g., `Trait` or `'b`).
- pub bounds: VerbatimUntil<Either<Comma, Semicolon, BraceGroup>>,
-}
-
-/// Represents the generic parameters of a struct or enum definition, enclosed in angle brackets.
-/// e.g., `<'a, T: Trait, const N: usize>`.
-pub struct GenericParams {
- /// The opening angle bracket `<`.
- pub _lt: Lt,
- /// The comma-delimited list of generic parameters.
- pub params: CommaDelimitedVec<GenericParam>,
- /// The closing angle bracket `>`.
- pub _gt: Gt,
-}
-
-/// Represents a single generic parameter within a `GenericParams` list.
-pub enum GenericParam {
- /// A lifetime parameter, e.g., `'a` or `'a: 'b + 'c`.
- Lifetime {
- /// The lifetime identifier (e.g., `'a`).
- name: Lifetime,
- /// Optional lifetime bounds (e.g., `: 'b + 'c`).
- bounds: Option<Cons<Colon, VerbatimUntil<Either<Comma, Gt>>>>,
- },
- /// A const generic parameter, e.g., `const N: usize = 10`.
- Const {
- /// The `const` keyword.
- _const: KConst,
- /// The name of the const parameter (e.g., `N`).
- name: Ident,
- /// The colon separating the name and type.
- _colon: Colon,
- /// The type of the const parameter (e.g., `usize`).
- typ: VerbatimUntil<Either<Comma, Gt, Eq>>,
- /// An optional default value (e.g., `= 10`).
- default: Option<Cons<Eq, VerbatimUntil<Either<Comma, Gt>>>>,
- },
- /// A type parameter, e.g., `T: Trait = DefaultType`.
- Type {
- /// The name of the type parameter (e.g., `T`).
- name: Ident,
- /// Optional type bounds (e.g., `: Trait`).
- bounds: Option<Bounds>,
- /// An optional default type (e.g., `= DefaultType`).
- default: Option<Cons<Eq, VerbatimUntil<Either<Comma, Gt>>>>,
- },
-}
-
-/// Represents a lifetime annotation, like `'a`.
-pub struct Lifetime {
- /// The apostrophe `'` starting the lifetime.
- pub _apostrophe: PunctJoint<'\''>,
- /// The identifier name of the lifetime (e.g., `a`).
- pub name: Ident,
-}
-
-/// Parses either a `TokenTree` or `<...>` grouping (which is not a [`Group`] as far as proc-macros
-/// are concerned).
-#[derive(Clone)]
-pub struct AngleTokenTree(
- #[allow(clippy::type_complexity)] // look,
- pub Either<Cons<Lt, Vec<Cons<Except<Gt>, AngleTokenTree>>, Gt>, TokenTree>,
-);
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use cool_asserts::assert_matches;
- use unsynn::ToTokens;
-
- static TRAIT_FN: &str = r#"
- fn hello(
- &self,
- arg: Arg,
- ) -> impl Future<Output = Result<String, MyErr>> + Send;
- "#;
-
- #[test]
- fn it_parses_trait_fn() {
- let mut token_iter = TRAIT_FN.to_token_iter();
- let f: Cons<SemicolonDelimitedVec<TraitItem>, EndOfStream> = token_iter.parse().unwrap();
- assert_matches!(&f.first.first().unwrap().value, TraitItem::Fn(TraitFn { attributes: None, _fn, name: _, generics: None, args: ParenthesisGroupContaining { content: Cons { first: _, second, third: _, .. } }, return_type: _ }) => {
- let arg = second.first().unwrap();
- assert_eq!(arg.value.name.to_string(), "arg");
- dbg!(arg);
- });
- }
-
- #[test]
- fn it_parses_multiple_trait_fn() {
- let input = r#"
- fn method(&self) -> impl Future<Output = Result<String, String>> + Send;
- fn method2(&self, req: String) -> impl Future<Output = Result<String, String>> + Send;
- "#;
- let mut token_iter = input.to_token_iter();
- let _result: Cons<SemicolonDelimitedVec<TraitItem>, EndOfStream> =
- token_iter.parse().unwrap();
- }
-
- #[test]
- fn it_parses_mod_path() {
- let mut token_iter = "axum::http::HeaderMap".to_token_iter();
- let m: ModPath = token_iter.parse().unwrap();
- assert_matches!(m, Cons { first: None, second, .. } => {
- let f = second.first().unwrap().value.to_string();
- assert_eq!(f, "axum");
- let f = second.get(1).unwrap().value.to_string();
- assert_eq!(f, "http");
- let f = second.get(2).unwrap().value.to_string();
- assert_eq!(f, "HeaderMap");
- });
- }
-
- #[test]
- fn it_parses_trait_without_super_traits() {
- let input = r#"
- pub trait MyTrait {
- type ServerContext;
- fn method(&self) -> impl Future<Output = Result<String, String>> + Send;
- }
- "#;
- let mut token_iter = input.to_token_iter();
- let result: Result<Cons<Trait, EndOfStream>> = token_iter.parse();
- if let Err(e) = &result {
- eprintln!("Parse error: {}", e);
- }
- assert!(result.is_ok(), "Failed to parse trait without super traits");
- }
-
- #[test]
- fn it_parses_trait_with_super_traits() {
- let input = r#"
- pub trait MyTrait: Send + Sync {
- type ServerContext: 'static;
- fn method(&self) -> impl Future<Output = Result<String, String>> + Send;
- fn method2(&self, req: String) -> impl Future<Output = Result<String, String>> + Send;
- }
- "#;
- let mut token_iter = input.to_token_iter();
- let result: Result<Cons<Trait, EndOfStream>> = token_iter.parse();
- if let Err(e) = &result {
- eprintln!("Parse error with super traits: {}", e);
- }
- assert!(result.is_ok(), "Failed to parse trait with super traits");
- }
-
- #[test]
- fn it_parses_associated_type() {
- let input = r#"
- type ServerContext: 'static;
- "#;
- let mut token_iter = input.to_token_iter();
- let result: Result<Cons<TraitItem, Semicolon, EndOfStream>> = token_iter.parse();
- result.unwrap();
- }
-
- #[test]
- fn it_parses_associated_type_directly() {
- let input = r#"type A;"#;
- let mut token_iter = input.to_token_iter();
- let result: Result<Cons<AssociatedType, Semicolon, EndOfStream>> = token_iter.parse();
- if let Err(e) = &result {
- eprintln!("Parse error direct: {}", e);
- }
- result.unwrap();
- }
-
- #[test]
- fn it_parses_one_associated_type_in_vec() {
- let input = r#"
- type A;
- "#;
- let mut token_iter = input.to_token_iter();
- let result: Result<Cons<SemicolonDelimitedVec<TraitItem>, EndOfStream>> =
- token_iter.parse();
- if let Err(e) = &result {
- eprintln!("Parse error: {}", e);
- }
- result.unwrap();
- }
-
- #[test]
- fn it_parses_two_associated_types() {
- let input = r#"
- type A: 'static;
- type B;
- "#;
- let mut token_iter = input.to_token_iter();
- let result: Result<Cons<SemicolonDelimitedVec<TraitItem>, EndOfStream>> =
- token_iter.parse();
- if let Err(e) = &result {
- eprintln!("Parse error: {}", e);
- }
- result.unwrap();
- }
-
- #[test]
- fn it_parses_trait_body() {
- let input = r#"
- {
- fn method(&self) -> impl Future<Output = Result<String, String>> + Send;
- fn patch_user_group(
- &self,
- req: PatchUserGroupRequest,
- ) -> impl Future<Output = Result<(), LegacyPermErr>> + Send;
- }
- "#;
-
- let mut token_iter = input.to_token_iter();
- let result: Result<
- Cons<BraceGroupContaining<SemicolonDelimitedVec<TraitItem>>, EndOfStream>,
- > = token_iter.parse();
- result.unwrap();
- }
-
- #[test]
- fn it_parses_trait_body2() {
- let input = r#"
- {
- fn method(&self) -> impl Future<Output = Result<String, String>> + Send;
- fn patch_user_group(
- &self,
- req: String,
- ) -> impl Future<Output = Result<String, String>> + Send;
- }
- "#;
-
- let mut token_iter = input.to_token_iter();
- let result: Result<
- Cons<BraceGroupContaining<SemicolonDelimitedVec<TraitItem>>, EndOfStream>,
- > = token_iter.parse();
- result.unwrap();
- }
-
- #[test]
- fn it_parses_full_trait() {
- let input = r#"
- pub trait LegacyGqlRpc: Send + Sync + 'static {
- type ServerContext: 'static;
- fn get_legacy_user_permissions(
- &self,
- ) -> impl Future<Output = Result<GetLegacyUserPermissionsResponse, LegacyPermErr>> + Send;
- fn get_user_organization(
- &self,
- ) -> impl Future<Output = Result<UserOrganizationResponse, LegacyPermErr>> + Send;
- fn patch_user_group(
- &self,
- req: PatchUserGroupRequest,
- ) -> impl Future<Output = Result<(), LegacyPermErr>> + Send;
- fn patch_user_onboarding(
- &self,
- req: PatchUserOnboardingRequest,
- ) -> impl Future<Output = Result<(), LegacyPermErr>> + Send;
- }
- "#;
-
- let mut token_iter = input.to_token_iter();
- let _: Cons<Trait, EndOfStream> = token_iter.parse().unwrap();
- }
-
- #[test]
- fn it_parses_advanced() {
- let input = r#"
-
-pub trait LegacyGqlRpc: Send + Sync + 'static {
- type GetPermsExtractor: 'static;
-
- fn get_legacy_user_permissions(
- &self,
- ctx: Self::GetPermsExtractor,
- ) -> impl Future<Output = Result<GetLegacyUserPermissionsResponse, LegacyPermErr>> + Send;
-
- type OrgExtractor: 'static;
-
- fn get_user_organization(
- &self,
- ctx: Self::OrgExtractor,
- ) -> impl Future<Output = Result<Option<UserOrganizationResponse>, LegacyPermErr>> + Send;
-
- fn patch_user_group(
- &self,
- req: PatchUserGroupRequest,
- ) -> impl Future<Output = Result<(), LegacyPermErr>> + Send;
-
- fn patch_user_onboarding(
- &self,
- req: PatchUserOnboardingRequest,
- ) -> impl Future<Output = Result<(), LegacyPermErr>> + Send;
-}
- "#;
-
- let mut token_iter = input.to_token_iter();
- let _: Cons<Trait, EndOfStream> = token_iter.parse().unwrap();
- }
-}