From 53672c3f14bbf83959cea3e6fe0132a2e8b800af Mon Sep 17 00:00:00 2001 From: Jack Amadeo Date: Tue, 15 Sep 2026 15:55:23 +0000 Subject: [PATCH] gpt-live API support (#12011) Co-authored-by: Lifei Zhou --- Cargo.lock | 1008 +++++++------ crates/goose-providers/Cargo.toml | 14 +- .../goose-providers/examples/openai_live.rs | 28 + .../src/browser_live_transport.rs | 103 ++ crates/goose-providers/src/lib.rs | 14 + crates/goose-providers/src/live.rs | 298 ++++ .../src/live_transport_websocket.rs | 86 ++ .../src/live_voice_provider.rs | 225 +++ crates/goose-providers/src/openai_live.rs | 1265 +++++++++++++++++ .../src/openai_live_voice_provider.rs | 308 ++++ crates/goose-providers/tests/live_session.rs | 396 ++++++ .../goose-providers/tests/live_websocket.rs | 58 + crates/goose/Cargo.toml | 10 +- 13 files changed, 3336 insertions(+), 477 deletions(-) create mode 100644 crates/goose-providers/examples/openai_live.rs create mode 100644 crates/goose-providers/src/browser_live_transport.rs create mode 100644 crates/goose-providers/src/live.rs create mode 100644 crates/goose-providers/src/live_transport_websocket.rs create mode 100644 crates/goose-providers/src/live_voice_provider.rs create mode 100644 crates/goose-providers/src/openai_live.rs create mode 100644 crates/goose-providers/src/openai_live_voice_provider.rs create mode 100644 crates/goose-providers/tests/live_session.rs create mode 100644 crates/goose-providers/tests/live_websocket.rs diff --git a/Cargo.lock b/Cargo.lock index b27c07588..92b3449ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -33,7 +33,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "cipher 0.4.4", "cpufeatures 0.2.17", ] @@ -92,7 +92,7 @@ version = "2.0.0" source = "git+https://github.com/agentclientprotocol/rust-sdk?rev=c97a5203d3392f7f231514d84eea014f9f43e6fb#c97a5203d3392f7f231514d84eea014f9f43e6fb" dependencies = [ "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -133,7 +133,7 @@ version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "getrandom 0.3.4", "once_cell", "serde", @@ -303,9 +303,9 @@ checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" [[package]] name = "askama" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf825125edd887a019d0a3a837dcc5499a68b0d034cc3eb594070c3e18addc" +checksum = "6024d73179f43f15ccd2b881bfea6fee7f3a46ec53f33b52210dea749ebebaa4" dependencies = [ "askama_macros", "itoa", @@ -316,9 +316,9 @@ dependencies = [ [[package]] name = "askama_derive" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1c7065972a130eafa84215f21352ae15b4a7393da48c1f5e103904490736738" +checksum = "071ee5ebf2138e3ad180e0aacf6940c2cab5e6d8333741d9925c7bee2b153f39" dependencies = [ "askama_parser", "basic-toml", @@ -329,23 +329,23 @@ dependencies = [ "rustc-hash 2.1.3", "serde", "serde_derive", - "syn 2.0.119", + "syn 3.0.5", ] [[package]] name = "askama_macros" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e23b1d2c4bd39a41971f6124cef4cc6fd0540913ecb90919b69ab3bbe44ae1a" +checksum = "643e1c7cbb6aec1d920332fe51a7c0d8219e273dcb8602db03f5263e4d16487b" dependencies = [ "askama_derive", ] [[package]] name = "askama_parser" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7db09fde9143e7ac4513358fb32ee32847125b63b18ea715afd487956da715da" +checksum = "2c5ae75772275d268b03ab8bdccdd12117b6169ee23256942b34e46c9f476583" dependencies = [ "rustc-hash 2.1.3", "serde", @@ -428,9 +428,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.44" +version = "0.4.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "515a1f282e33d55983c499d7e9e87082e81cbc32974825bf9032f928392d5844" +checksum = "ef217a77a86a6e3dab9a5b3c81dc445b603fe743a90c1cb10a2f2144628d8cfa" dependencies = [ "compression-codecs", "compression-core", @@ -445,7 +445,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" dependencies = [ "autocfg", - "cfg-if 1.0.4", + "cfg-if", "concurrent-queue", "futures-io", "futures-lite", @@ -485,7 +485,7 @@ dependencies = [ "async-signal", "async-task", "blocking", - "cfg-if 1.0.4", + "cfg-if", "event-listener", "futures-lite", "rustix 1.1.4", @@ -500,7 +500,7 @@ dependencies = [ "async-io", "async-lock", "atomic-waker", - "cfg-if 1.0.4", + "cfg-if", "futures-core", "futures-io", "rustix 1.1.4", @@ -545,7 +545,7 @@ checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -647,9 +647,9 @@ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" [[package]] name = "aws-config" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a767267da9e2c2e189b2f9df8b5657e850ecf5352644734ba130d4a57095cf1b" +checksum = "b8d7b388a9fc3a6db15a5ec778c38b354eff1364882c94d08e0252f7a47dcaa4" dependencies = [ "aws-credential-types", "aws-runtime", @@ -714,9 +714,9 @@ dependencies = [ [[package]] name = "aws-runtime" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9007227e10b5fed2f3e0a2beff489211e2b5604c400b7a9d5d81ca9d64c24bb" +checksum = "ef47857a1d4488b528f4a5d5715fa7c3300820897824152234d3fa22b1426657" dependencies = [ "aws-credential-types", "aws-sigv4", @@ -740,9 +740,9 @@ dependencies = [ [[package]] name = "aws-sdk-bedrockruntime" -version = "1.142.0" +version = "1.143.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4844547a354fb4e41895f4c9c423e7a7de13e3b2adc3f3493a2f2d8aa397c294" +checksum = "492a63a8e903a7b8f7c77537ef05fc75d71ba268cf23a0eee41fb6f0da605029" dependencies = [ "arc-swap", "aws-credential-types", @@ -769,9 +769,9 @@ dependencies = [ [[package]] name = "aws-sdk-sagemakerruntime" -version = "1.112.0" +version = "1.113.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c5ba611251eb92f1a7b838c753bb2ed2ff7b41a1e3ae6cfed3f665175d3621d" +checksum = "d8d877671dac1fc19e77e6440dead0b3de4a339af1d2c535967722d9441f8f92" dependencies = [ "arc-swap", "aws-credential-types", @@ -796,9 +796,9 @@ dependencies = [ [[package]] name = "aws-sdk-sso" -version = "1.108.0" +version = "1.109.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c15301b04372832947916607983b114b3374b9db0be058a00fb7513800de1f05" +checksum = "c3cfe74df5d9ad2fedd691973ad3521ebf4f27a3c68c792556686aedb5519bab" dependencies = [ "arc-swap", "aws-credential-types", @@ -822,9 +822,9 @@ dependencies = [ [[package]] name = "aws-sdk-ssooidc" -version = "1.110.0" +version = "1.111.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72cc2c205cb27108183cf1856333f7d584c2ba0f505421b4209ca5828f9ea899" +checksum = "81b0ec31ed6191bd11350aae4b2004198f2db21350cb0a20c57e0a92e55dd161" dependencies = [ "arc-swap", "aws-credential-types", @@ -848,9 +848,9 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "1.113.0" +version = "1.114.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68182ecb449f7537db0f4d5d25917789cf41e32074a9fe47b6a0b847fe1d2032" +checksum = "ef45745026107ec30c4ef86bd8ae4b002e7e5f6a86e4225240bdf6b06a0b944a" dependencies = [ "arc-swap", "aws-credential-types", @@ -1078,9 +1078,9 @@ dependencies = [ [[package]] name = "aws-types" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eec1cd5469f328c782dc3e33d4153cf118a54e33cbb3356d60d16f89883e1f94" +checksum = "209f3a6d82a6e9e5f94abbed94c7a26e1c052341002bf57a5fb5481f625896fc" dependencies = [ "aws-credential-types", "aws-smithy-async", @@ -1207,7 +1207,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" dependencies = [ "addr2line", - "cfg-if 1.0.4", + "cfg-if", "libc", "miniz_oxide 0.8.9", "object 0.37.3", @@ -1298,7 +1298,7 @@ dependencies = [ "encoding_rs", "flate2", "globset", - "indexmap 2.14.1", + "indexmap 2.14.2", "itertools 0.14.0", "nu-ansi-term", "once_cell", @@ -1353,7 +1353,7 @@ version = "0.72.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "cexpr", "clang-sys", "itertools 0.13.0", @@ -1393,7 +1393,7 @@ dependencies = [ "biome_json_parser", "biome_json_syntax", "biome_rowan", - "bitflags 2.13.1", + "bitflags 2.13.2", "indexmap 1.9.3", "serde", "serde_json", @@ -1413,7 +1413,7 @@ dependencies = [ "biome_rowan", "biome_text_edit", "biome_text_size", - "bitflags 2.13.1", + "bitflags 2.13.2", "bpaf", "serde", "termcolor", @@ -1452,7 +1452,7 @@ dependencies = [ "biome_deserialize", "biome_diagnostics", "biome_rowan", - "cfg-if 1.0.4", + "cfg-if", "countme", "drop_bomb", "indexmap 1.9.3", @@ -1487,7 +1487,7 @@ dependencies = [ "biome_json_syntax", "biome_rowan", "biome_text_size", - "cfg-if 1.0.4", + "cfg-if", "smallvec", "tracing", "unicode-width 0.1.14", @@ -1506,8 +1506,8 @@ dependencies = [ "biome_js_unicode_table", "biome_parser", "biome_rowan", - "bitflags 2.13.1", - "cfg-if 1.0.4", + "bitflags 2.13.2", + "cfg-if", "drop_bomb", "indexmap 1.9.3", "rustc-hash 1.1.0", @@ -1591,7 +1591,7 @@ dependencies = [ "biome_console", "biome_diagnostics", "biome_rowan", - "bitflags 2.13.1", + "bitflags 2.13.2", "drop_bomb", ] @@ -1678,7 +1678,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6712f9c6fd6785b3b270884e57c441c403dc5d7e19ca45368c97c7a1de3000ec" dependencies = [ "bitcoin-internals", - "hex-conservative 1.2.0", + "hex-conservative 1.3.0", "serde", ] @@ -1715,7 +1715,7 @@ checksum = "5304e53726dbe5f93141535e102ed97b5bf4714fbecefdda8f9fb98d7fdaff0e" dependencies = [ "bitcoin-consensus-encoding", "bitcoin-internals", - "hex-conservative 1.2.0", + "hex-conservative 1.3.0", "serde", ] @@ -1727,9 +1727,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.13.1" +version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" dependencies = [ "serde_core", ] @@ -1754,7 +1754,7 @@ checksum = "6d9e454fc11f76977dc803893aff6304ed33d6a26efae8696573bea74baa27ae" dependencies = [ "arrayvec", "cc", - "cfg-if 1.0.4", + "cfg-if", "constant_time_eq", "cpufeatures 0.3.1", ] @@ -1825,25 +1825,25 @@ dependencies = [ [[package]] name = "bon" -version = "3.10.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3fac94a66da67200398458a25412bcc3f9b6443b5119a6cad9cf3ccfcd8cc6" +checksum = "60eafe0d77c3a2fc292c1d1346c3041b33c0a108085a2afabf672b70f69dbbc9" dependencies = [ "bon-macros", ] [[package]] name = "bon-macros" -version = "3.10.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4654961ad0494e4774c5c60b4cb4cd0ae9b9d92d039d901638b1dba97ebebf5" +checksum = "bd0f9631d8aaaee112c41985d675ef269e02acbd4f33122836af4f0c5f699ff6" dependencies = [ "darling 0.24.1", "ident_case", "prettyplease 0.3.0", "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -1949,13 +1949,13 @@ dependencies = [ [[package]] name = "bytemuck_derive" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0e56a716f1e132ff6bf4bdac1c944a3fcdc1cae65f70a4a2a1ac3b401d2d1f" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -2029,9 +2029,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.2.5" +version = "1.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1307f12aa967b5a58416e87b3653360e0fd614a016b6e970db08fecbb1b80d" +checksum = "bbbad30e4b4c14a39e3cc8aed085a12a327257c316619c93581e017bc52be591" dependencies = [ "serde_core", ] @@ -2216,9 +2216,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.4.4" +version = "1.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273" +checksum = "a3eb0f42d6c360dc3f8a821f6bf2fdea7f72bfd36b3076eb0e6d1e9e0752fff4" dependencies = [ "find-msvc-tools", "jobserver", @@ -2252,12 +2252,6 @@ dependencies = [ "web-time", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.4" @@ -2276,7 +2270,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "cipher 0.4.4", "cpufeatures 0.2.17", ] @@ -2287,7 +2281,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "cpufeatures 0.3.1", "rand_core 0.10.1", ] @@ -2363,9 +2357,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.6.6" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "473c7e07f409a8d772161724aa8db6a765a2532a70f9667eeb7b49d3d02fbdca" +checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946" dependencies = [ "clap_builder", "clap_derive", @@ -2373,9 +2367,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.6.6" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b48fea5a88e9ae728a2dcbedbfc0e730f7d60da42e1cb049a83c9fb8b789889" +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" dependencies = [ "anstream", "anstyle", @@ -2385,9 +2379,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.6.9" +version = "4.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be2ad0423bdbbb0e25bc89add796f3559706d4a95e1bc98e4d9662a957b6a19" +checksum = "78ab9a1a7094014a0d0813f8e7c5a0058ad8fe6cf7475b9151364259f5a35d0f" dependencies = [ "clap", ] @@ -2404,21 +2398,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.6.4" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d012d2b9d65aca7f18f4d9878a045bc17899bba951561ba5ec3c2ba1eed9a061" +checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0" dependencies = [ "heck", "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] name = "clap_lex" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" +checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486" [[package]] name = "clap_mangen" @@ -2459,7 +2453,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d9334f725b46fb9bed8580b9b47a932587e044fadb344ed7fa98774b067ac1a" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "windows 0.56.0", ] @@ -2559,7 +2553,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f" dependencies = [ "castaway", - "cfg-if 1.0.4", + "cfg-if", "itoa", "ryu", "static_assertions", @@ -2572,7 +2566,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9dfdd1c2274d9aa354115b09dc9a901d6c5576818cdf70d14cae2bdb47df00ab" dependencies = [ "castaway", - "cfg-if 1.0.4", + "cfg-if", "itoa", "rustversion", "ryu", @@ -2582,9 +2576,9 @@ dependencies = [ [[package]] name = "compression-codecs" -version = "0.4.39" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fe67f2944eef52fc7b106b8c9450d243a88701a0c065f7f57235e76abaed7df" +checksum = "257c7085cbb71be72d8fb97edff08b03d86d5d9f2222b9cc34a6bec87093bc10" dependencies = [ "brotli", "compression-core", @@ -2611,9 +2605,9 @@ dependencies = [ [[package]] name = "console" -version = "0.16.4" +version = "0.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fe5f465a4f6fee88fad41b85d990f84c835335e85b5d9e6e63e0d06d28cba7c" +checksum = "e96a4956774c13c126a8b5af4daa79384f4d826534c95a02d76afb39e2ab64e3" dependencies = [ "encode_unicode", "libc", @@ -2754,6 +2748,12 @@ dependencies = [ "libc", ] +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + [[package]] name = "core_maths" version = "0.1.1" @@ -2819,11 +2819,11 @@ checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853" [[package]] name = "crc32fast" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8498c871161e1742aaa9d52551b2d6ebdd4c3d45a3be423e3728f33b955be550" +checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", ] [[package]] @@ -2857,18 +2857,18 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.16" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d85363c37faeca707aef026efa9f3b34d077bce547e48f770770625c6013679e" +checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5181e0de7b61eb03a81e347d6dd8797bae9da5146707b51077e2d71a54ec0ceb" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -2876,27 +2876,27 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.20" +version = "0.9.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-queue" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "803d13fb3b09d88be9f4dbc29062c66b19bf7170867ceb746d2a8689bf6c7a26" +checksum = "03e8bd762f7479489c70ed6c768ddca99d7296857de437a68dcb2a94365b3fae" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.22" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" [[package]] name = "crunchy" @@ -3009,7 +3009,7 @@ version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "cpufeatures 0.2.17", "curve25519-dalek-derive", "digest 0.10.7", @@ -3025,7 +3025,7 @@ version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5eed333089e2e1c1ac8c6c0398e5e2497b4c9926ca6d0365ed1e099afa5bc23" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "cpufeatures 0.3.1", "curve25519-dalek-derive", "digest 0.11.3", @@ -3121,7 +3121,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -3154,7 +3154,7 @@ checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" dependencies = [ "darling_core 0.24.1", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -3172,7 +3172,7 @@ version = "5.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "hashbrown 0.14.5", "lock_api", "once_cell", @@ -3185,7 +3185,7 @@ version = "6.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6361d5c062261c78a176addb82d4c821ae42bed6089de0e12603cd25de2059c" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "crossbeam-utils", "hashbrown 0.14.5", "lock_api", @@ -3216,7 +3216,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c54e03a951783e8b327515db3f2a2fd0e3bed362a96b066f341ce66ed49b4ead" dependencies = [ "data-encoding", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -3365,7 +3365,7 @@ dependencies = [ "deno_media_type", "deno_path_util", "http 1.5.0", - "indexmap 2.14.1", + "indexmap 2.14.2", "log", "once_cell", "parking_lot", @@ -3394,7 +3394,7 @@ dependencies = [ "glob", "ignore", "import_map", - "indexmap 2.14.1", + "indexmap 2.14.2", "jsonc-parser", "log", "serde", @@ -3425,7 +3425,7 @@ dependencies = [ "deno_path_util", "deno_unsync", "futures", - "indexmap 2.14.1", + "indexmap 2.14.2", "libc", "parking_lot", "percent-encoding", @@ -3517,7 +3517,7 @@ dependencies = [ "deno_lockfile", "deno_semver", "futures", - "indexmap 2.14.1", + "indexmap 2.14.2", "log", "monch", "serde", @@ -3532,7 +3532,7 @@ version = "0.257.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9dd9aa20a48be11c922d9451a524afecde323a22d5defacc1dd79f8deac728fb" dependencies = [ - "indexmap 2.14.1", + "indexmap 2.14.2", "proc-macro2", "quote", "stringcase", @@ -3554,7 +3554,7 @@ dependencies = [ "deno_maybe_sync", "deno_path_util", "deno_semver", - "indexmap 2.14.1", + "indexmap 2.14.2", "serde", "serde_json", "sys_traits", @@ -3603,7 +3603,7 @@ dependencies = [ "dissimilar", "futures", "import_map", - "indexmap 2.14.1", + "indexmap 2.14.2", "jsonc-parser", "log", "node_resolver", @@ -3671,9 +3671,9 @@ dependencies = [ [[package]] name = "der" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a69dedd701da44b0536442edf09c81a64b0ab97a7a4a5e3d1971f00027cbc63d" +checksum = "a878c850e9e421b20262e9b41f9c860e4785fa07541c266b62ff9d1ef998a80a" dependencies = [ "const-oid 0.10.2", "pem-rfc7468 1.0.0", @@ -3872,7 +3872,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "block2", "libc", "objc2", @@ -3886,7 +3886,7 @@ checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -3924,7 +3924,7 @@ dependencies = [ "base64 0.22.1", "crc32fast", "image 0.25.10", - "quick-xml", + "quick-xml 0.41.0", "serde", "serde_json", "smallvec", @@ -4145,11 +4145,17 @@ checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" [[package]] name = "encoding_rs" -version = "0.8.35" +version = "0.8.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +checksum = "7b5ef0006ac9ab233c38522f5ae99cae3625151de8f706cacee1cba4b8e2832a" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", + "core_detect", + "multiversion", + "multiversion_no_op", + "rustversion", + "scopeguard", + "simdutf8", ] [[package]] @@ -4178,7 +4184,7 @@ checksum = "0590c4a94da3372e83493b956755a6e2266830b6e4e3b101afe66e3f39477b91" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -4250,7 +4256,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de48cc4d1c1d97a20fd819def54b890cadde72ed3ad0c614822a0a433361be96" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "windows-sys 0.61.2", ] @@ -4321,9 +4327,9 @@ dependencies = [ [[package]] name = "fancy-regex" -version = "0.19.0" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476de73bddf2ef8490aa4ee8f1cf40b430bf1d56c48c22080e5186952cd580e6" +checksum = "d301f5bf187b3c295fce6468d3875037a0bccc5f6b151c63cac2f85babf21912" dependencies = [ "bit-set", "regex-automata", @@ -4389,15 +4395,15 @@ version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "libc", ] [[package]] name = "find-msvc-tools" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890" +checksum = "3e0f1c7c3a72c66fd80abe965175f7523475c0489a87d3ff9d6e8c87d87a9d2d" [[package]] name = "find_cuda_helper" @@ -4504,7 +4510,7 @@ checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -4705,7 +4711,7 @@ checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -4739,12 +4745,9 @@ dependencies = [ [[package]] name = "gearhash" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8cf82cf76cd16485e56295a1377c775ce708c9f1a0be6b029076d60a245d213" -dependencies = [ - "cfg-if 0.1.10", -] +checksum = "616e8f476a586f1b078d9eece21f7a071f27997e709e2b471f5697deea53bda9" [[package]] name = "gemm" @@ -4991,7 +4994,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3b854b0e584ead1a33f18b2fcad7cf7be18b3875c78816b753639aa501513ae" dependencies = [ "cc", - "cfg-if 1.0.4", + "cfg-if", "libc", "log", "rustversion", @@ -5026,7 +5029,7 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "js-sys", "libc", "wasi 0.11.1+wasi-snapshot-preview1", @@ -5039,7 +5042,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "js-sys", "libc", "r-efi 5.3.0", @@ -5053,7 +5056,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "js-sys", "libc", "r-efi 6.0.0", @@ -5211,7 +5214,7 @@ dependencies = [ "ignore", "image 0.24.9", "include_dir", - "indexmap 2.14.1", + "indexmap 2.14.2", "indoc", "insta", "jsonschema", @@ -5236,13 +5239,13 @@ dependencies = [ "pastey", "pctx_code_mode", "pem 4.0.0", - "process-wrap", + "process-wrap 9.1.0", "rand 0.10.2", "rayon", "rcgen", "regex", - "reqwest 0.13.4", - "rmcp 3.2.0", + "reqwest 0.13.5", + "rmcp 3.3.0", "rubato", "rustls", "schemars 1.2.2", @@ -5303,7 +5306,7 @@ name = "goose-acp-macros" version = "1.50.0" dependencies = [ "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -5314,7 +5317,7 @@ dependencies = [ "async-trait", "futures", "goose-provider-types", - "rmcp 3.2.0", + "rmcp 3.3.0", "schemars 1.2.2", "serde", "serde_json", @@ -5362,8 +5365,8 @@ dependencies = [ "qrcode", "rand 0.10.2", "regex", - "reqwest 0.13.4", - "rmcp 3.2.0", + "reqwest 0.13.5", + "rmcp 3.3.0", "rustyline", "serde", "serde_json", @@ -5397,7 +5400,7 @@ dependencies = [ "goose-provider-types", "include_dir", "minijinja", - "rmcp 3.2.0", + "rmcp 3.3.0", "serde", "serde_json", "tokio", @@ -5410,7 +5413,7 @@ version = "0.1.0-alpha.9" dependencies = [ "anyhow", "once_cell", - "reqwest 0.13.4", + "reqwest 0.13.5", "serde", "tokio", "tracing", @@ -5439,7 +5442,7 @@ dependencies = [ "minijinja", "pulldown-cmark", "regex", - "rmcp 3.2.0", + "rmcp 3.3.0", "safemlx", "safemlx-lm", "safemlx-lm-utils", @@ -5464,8 +5467,8 @@ dependencies = [ "indoc", "lopdf", "once_cell", - "process-wrap", - "rmcp 3.2.0", + "process-wrap 9.1.0", + "rmcp 3.3.0", "schemars 1.2.2", "serde", "serde_json", @@ -5492,8 +5495,8 @@ dependencies = [ "once_cell", "rand 0.10.2", "regex", - "reqwest 0.13.4", - "rmcp 3.2.0", + "reqwest 0.13.5", + "rmcp 3.3.0", "serde", "serde_json", "strum 0.28.0", @@ -5514,17 +5517,19 @@ dependencies = [ "anyhow", "async-stream", "async-trait", + "base64 0.23.1", "chrono", "env-lock", "flate2", "futures", "goose-local-inference", "goose-provider-types", + "http 1.5.0", "include_dir", "pem 4.0.0", "pkcs8 0.11.0", - "reqwest 0.13.4", - "rmcp 3.2.0", + "reqwest 0.13.5", + "rmcp 3.3.0", "sec1 0.8.1", "serde", "serde_json", @@ -5532,10 +5537,12 @@ dependencies = [ "test-case", "tokio", "tokio-stream", + "tokio-tungstenite 0.28.0", "tokio-util", "tracing", "url", "urlencoding", + "uuid", "wiremock", ] @@ -5571,7 +5578,7 @@ dependencies = [ "goose-context-management", "goose-providers", "goose-sdk-types", - "rmcp 3.2.0", + "rmcp 3.3.0", "serde_json", "thiserror 2.0.20", "tokio", @@ -5605,7 +5612,7 @@ dependencies = [ "axum", "env-lock", "opentelemetry 0.32.0", - "rmcp 3.2.0", + "rmcp 3.3.0", "serde_json", "tokio", ] @@ -5642,7 +5649,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.5.0", - "indexmap 2.14.1", + "indexmap 2.14.2", "slab", "tokio", "tokio-util", @@ -5656,7 +5663,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" dependencies = [ "bytemuck", - "cfg-if 1.0.4", + "cfg-if", "crunchy", "num-traits", "rand 0.9.5", @@ -5783,9 +5790,9 @@ dependencies = [ [[package]] name = "hex-conservative" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35431185f361ccf3ffc58254628af5f1f5d5f28531da2e02e5d6c82bbc282a10" +checksum = "271e0d19bcb473b6675739a2b536076b24a082316cb5199ad918edce10c599e8" dependencies = [ "arrayvec", ] @@ -5806,7 +5813,7 @@ dependencies = [ "hyper", "pathdiff", "percent-encoding", - "reqwest 0.13.4", + "reqwest 0.13.5", "serde", "serde_json", "sha2 0.11.0", @@ -5846,38 +5853,32 @@ dependencies = [ [[package]] name = "hickory-net" -version = "0.26.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2295ed2f9c31e471e1428a8f88a3f0e1f4b27c15049592138d1eebe9c35b183" +checksum = "c480823ed7c2c5d0f09c41020cb6b7c28029ce60ec42dc942158dcf22f8e0a4d" dependencies = [ "async-trait", - "bytes", - "cfg-if 1.0.4", + "cfg-if", "data-encoding", "futures-channel", "futures-io", "futures-util", - "h2", "hickory-proto", - "http 1.5.0", "idna", "ipnet", "jni 0.22.4", "rand 0.10.2", - "rustls", "thiserror 2.0.20", "tinyvec", - "tokio", - "tokio-rustls", "tracing", "url", ] [[package]] name = "hickory-proto" -version = "0.26.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bab31817bfb44672a252e97fe81cd0c18d1b2cf892108922f6818820df8c643" +checksum = "12b92608f679a6fa515dd1d15c1ff89443026e391200a2c840c7afcba482893d" dependencies = [ "data-encoding", "idna", @@ -5895,29 +5896,21 @@ dependencies = [ [[package]] name = "hickory-resolver" -version = "0.26.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d58d28879ceecde6607729660c2667a081ccdc082e082675042793960f178c" +checksum = "3f3da5255c95d5a716857d54b5b8f4e8d67c3484d3beaaaae2ce25063b3ba981" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "futures-util", "hickory-net", "hickory-proto", - "ipconfig", "ipnet", - "jni 0.22.4", "moka", - "ndk-context", "once_cell", "parking_lot", "rand 0.10.2", - "resolv-conf", - "rustls", "smallvec", - "system-configuration", "thiserror 2.0.20", - "tokio", - "tokio-rustls", "tracing", ] @@ -6075,9 +6068,9 @@ checksum = "15cdd26707701c53297e2fa6afb323d55fbc1d0810c3aec078ae3ef0424c3c15" [[package]] name = "hybrid-array" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707114b52a152fa7bdb290cd7cd5912d9467273b6d74e21b8d81aca1f8533f6b" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" dependencies = [ "typenum", ] @@ -6167,7 +6160,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "socket2", - "system-configuration", + "system-configuration 0.7.0", "tokio", "tower-service", "tracing", @@ -6429,7 +6422,7 @@ checksum = "f83a4958a41489355816028239fee373797435384d162f4908e7980c83c3bb1b" dependencies = [ "boxed_error", "deno_error", - "indexmap 2.14.1", + "indexmap 2.14.2", "log", "percent-encoding", "serde", @@ -6470,9 +6463,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.14.1" +version = "2.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07aa2048142242915a31d35844fb311e0e53fcca590c3a0a40dcf1b841fa09eb" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" dependencies = [ "equivalent", "hashbrown 0.17.1", @@ -6548,9 +6541,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.12.1" +version = "2.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a756c3fac73139e83f14c2d742155dd2b78d3ee56597b419a0579b7bdd6dd78" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" dependencies = [ "serde", ] @@ -6590,7 +6583,7 @@ dependencies = [ "pin-project", "portable-atomic", "rand 0.10.2", - "reqwest 0.13.4", + "reqwest 0.13.5", "rustc-hash 2.1.3", "rustls", "rustls-pki-types", @@ -6608,9 +6601,9 @@ dependencies = [ [[package]] name = "iroh-base" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ccf4cde68a02ef03c0095ab2c031c6adfe508f3bc8e7c258558a027ebe64a8e" +checksum = "ffd1efd1aaecd68d4d1b0727a30c5811f43fb822843e48f65f6e5db3b7256cc9" dependencies = [ "curve25519-dalek 5.0.0", "data-encoding", @@ -6627,18 +6620,17 @@ dependencies = [ [[package]] name = "iroh-dns" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a41224eb0140a5c519935d4073fc6b236d174080be401f9bf7da126b2ee3aa4" +checksum = "80276761b56e904e26ea71d0863beef0bb8d5ab6b639cbd1338e4b615209e3a1" dependencies = [ "arc-swap", "cfg_aliases", "derive_more", - "hickory-resolver", "iroh-base", + "n0-dns-resolver", "n0-error", "n0-future", - "ndk-context", "portable-atomic", "rand 0.10.2", "rustls", @@ -6662,7 +6654,7 @@ dependencies = [ "itoa", "n0-error", "portable-atomic", - "reqwest 0.13.4", + "reqwest 0.13.5", "rustls", "rustls-platform-verifier", "ryu", @@ -6686,9 +6678,9 @@ dependencies = [ [[package]] name = "iroh-relay" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5f6f07e2c9b0c4bc82e2864be09f4aea4320165d5316e668616dbc822f428a" +checksum = "beb2294a9749d6a25fd7cd8bcf0fccd932f20716d4f967d85d3f23c7135ae6a2" dependencies = [ "blake3", "bytes", @@ -6698,7 +6690,6 @@ dependencies = [ "data-encoding", "derive_more", "getrandom 0.4.3", - "hickory-resolver", "http 1.5.0", "http-body-util", "hyper", @@ -6717,7 +6708,7 @@ dependencies = [ "rand 0.10.2", "rcgen", "reloadable-state", - "reqwest 0.13.4", + "reqwest 0.13.5", "rustls", "rustls-cert-file-reader", "rustls-cert-reloadable-resolver", @@ -6734,7 +6725,7 @@ dependencies = [ "tokio-rustls-acme", "tokio-util", "tokio-websockets", - "toml 1.1.5+spec-1.1.0", + "toml 1.1.6+spec-1.1.0", "tracing", "tracing-subscriber", "url", @@ -6826,9 +6817,9 @@ checksum = "47f142fe24a9c9944451e8349de0a56af5f3e7226dc46f3ed4d4ecc0b85af75e" [[package]] name = "jiff" -version = "0.2.35" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668b7183bd07af9a4885f5c35b0cc5c83c4607a913c16b7e17291832910d2dcc" +checksum = "0ab1baf72f08796de0260609515130699b890ac25f30e610ad894bc5856cafdb" dependencies = [ "defmt", "jiff-core", @@ -6843,18 +6834,19 @@ dependencies = [ [[package]] name = "jiff-core" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7feca88439efe53da3754500c1851dedf3cb36c524dd5cf8225cc0794de95d09" +checksum = "5e52fe76043ccecc9005d2305ebaadf7d7fc0cc89ca6baa10a94d6bc68c7128c" dependencies = [ "defmt", + "log", ] [[package]] name = "jiff-static" -version = "0.2.35" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a69dcb3a21cfb32ce1cd056169337ca284af0766dd766e7878819b251a49204" +checksum = "378268a1116ad67ae6228701118ac9f491d78fda38a40a1f1a9e1348de6f7212" dependencies = [ "jiff-core", "proc-macro2", @@ -6884,7 +6876,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" dependencies = [ "cesu8", - "cfg-if 1.0.4", + "cfg-if", "combine", "jni-sys 0.3.1", "log", @@ -6899,7 +6891,7 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "combine", "jni-macros", "jni-sys 0.4.1", @@ -6972,11 +6964,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.104" +version = "0.3.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a" +checksum = "ce57d20d1ea864ce2ac172ab472d409214f4fd359f0b2a2775abdf522e2af99e" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "futures-util", "wasm-bindgen", ] @@ -7000,7 +6992,7 @@ dependencies = [ "bytecount", "data-encoding", "email_address", - "fancy-regex 0.19.0", + "fancy-regex 0.19.2", "fraction", "getrandom 0.3.4", "itoa", @@ -7168,7 +7160,7 @@ version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "windows-link", ] @@ -7178,7 +7170,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "windows-link", ] @@ -7190,9 +7182,9 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libredox" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d8f1ea3f21fd3405dcaf6c9b5c1630af9afc422d9073ea39c5f6d6c772e08ed" +checksum = "6480ccc157a1389bb2e4891b24751b0f798ba640d22386f23143fbcc89da195a" dependencies = [ "libc", ] @@ -7226,7 +7218,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83270a18e9f90d0707c41e9f35efada77b64c0e6f3f1810e71c8368a864d5590" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "libc", ] @@ -7303,7 +7295,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "generator", "scoped-tls", "tracing", @@ -7317,14 +7309,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfffda0fe1ab0157e1a13c14bebd3f28671f2fccb7922f0722ec53926e6922d3" dependencies = [ "aes 0.9.3", - "bitflags 2.13.1", + "bitflags 2.13.2", "brotli-decompressor", "cbc 0.2.1", "ecb", "encoding_rs", "flate2", "getrandom 0.4.3", - "indexmap 2.14.1", + "indexmap 2.14.2", "itoa", "log", "md-5", @@ -7348,9 +7340,9 @@ dependencies = [ [[package]] name = "lru-slab" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" +checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f" [[package]] name = "lz4_flex" @@ -7422,7 +7414,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69b6441f590336821bb897fb28fc622898ccceb1d6cea3fde5ea86b090c4de98" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "digest 0.11.3", ] @@ -7463,7 +7455,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "block", "core-graphics-types", "foreign-types 0.5.0", @@ -7557,7 +7549,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a6ceddfe3ce334925e96bf420fdb2dcee5bed6c632a168ece622676dadeaf8a" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "downcast", "fragile", "mockall_derive", @@ -7571,7 +7563,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cfe16fbe8a314aeec0b861ac24e60b1e123e97634bab045475b9d6a18416fd8" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "proc-macro2", "quote", "syn 2.0.119", @@ -7638,6 +7630,58 @@ dependencies = [ "pxfm", ] +[[package]] +name = "multiversion" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ca4bea16ffc3f443cf7d866912118196bfef4c6a1556ca00f9f9b00bb43f7c" +dependencies = [ + "multiversion-macros", +] + +[[package]] +name = "multiversion-macros" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d416831a7317ef4b08bee00b69cbbb9c8763da7959a7026244d6266869f9c83" +dependencies = [ + "proc-macro2", + "quote", + "rustversion", + "syn 3.0.5", +] + +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + +[[package]] +name = "n0-dns-resolver" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "535c99c9a786bee714155d2ee4fc2477405c2c43536e1bc6a51de09a0d1448f7" +dependencies = [ + "derive_more", + "ipconfig", + "jni 0.22.4", + "lru", + "n0-error", + "n0-future", + "ndk-context", + "rand 0.10.2", + "reqwest 0.13.5", + "rustc-hash 2.1.3", + "rustls", + "simple-dns", + "system-configuration 0.8.0", + "tokio", + "tokio-rustls", + "tracing", + "webpki-roots 1.0.9", +] + [[package]] name = "n0-error" version = "1.0.1" @@ -7731,9 +7775,9 @@ checksum = "81c353b400a5503efdcf398f11a83fb7aa84f59f5d76fc4bf5bbc1e4f5366caa" [[package]] name = "netdev" -version = "0.45.0" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "569dfbdd2efd771b24ec9bb57f956e04d4fbfc72f62b2f11961723f9b3f4b020" +checksum = "096c44b66a9b09b99b4dd36b1c295ff3a492039ccecaf55466bd6ddcdba59968" dependencies = [ "block2", "dispatch2", @@ -7758,9 +7802,9 @@ dependencies = [ [[package]] name = "netdev" -version = "0.46.2" +version = "0.46.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4db4135b187ddae3b6813c4f9d9ac9d5181859fa6a08b4e006c63a130974ed62" +checksum = "c3c52c2584961c68f5a6e3356797344061f818c93b8acc9cd6d7e284795e563e" dependencies = [ "block2", "dispatch2", @@ -7801,7 +7845,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2288fcb784eb3defd5fb16f4c4160d5f477de192eac730f43e1d11c24d9a007" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "libc", "log", "netlink-packet-core 0.8.2", @@ -7813,7 +7857,7 @@ version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59d48ffc8b73a506e1ff0878528c72668f2bfbc3d875b6be890a96be5d0d5576" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "libc", "log", "netlink-packet-core 0.9.0", @@ -7875,8 +7919,8 @@ dependencies = [ "n0-error", "n0-future", "n0-watcher", - "netdev 0.45.0", - "netdev 0.46.2", + "netdev 0.45.1", + "netdev 0.46.3", "netlink-packet-core 0.8.2", "netlink-packet-route 0.31.0", "netlink-proto", @@ -7918,8 +7962,8 @@ version = "0.31.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" dependencies = [ - "bitflags 2.13.1", - "cfg-if 1.0.4", + "bitflags 2.13.2", + "cfg-if", "cfg_aliases", "libc", ] @@ -7976,9 +8020,9 @@ dependencies = [ [[package]] name = "noq" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e6c57353d26be91a242f0ec96073066c4481a03f6be874daafb18902394515" +checksum = "b78be567e796cfa74bb9bdc4117790af2d505eb887019cf8803244353eb09d89" dependencies = [ "bytes", "cfg_aliases", @@ -7998,9 +8042,9 @@ dependencies = [ [[package]] name = "noq-proto" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a46813e306c29c4f86357b6ffa39a8e1c97bb274b9a296a19a56d62e4111225" +checksum = "7c1e5b6fe668491eca022f745a0a9402585626c73a7b839b3424ace15d6a9c8f" dependencies = [ "aes-gcm", "aws-lc-rs", @@ -8027,9 +8071,9 @@ dependencies = [ [[package]] name = "noq-udp" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b56d621ed2c1773b5356ab39cc68c819f8d0103f7493d8661c4a5f5f8ea55f40" +checksum = "4dc50afea61aff926e150a36c31f06094608848e114a3fe667d76ec233163b1c" dependencies = [ "cfg_aliases", "libc", @@ -8040,9 +8084,9 @@ dependencies = [ [[package]] name = "nostr" -version = "0.45.4" +version = "0.45.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67bacf4195a119bc55d576ec6b54cc103723cb46fff5f907b8bdac8fd29ac4a0" +checksum = "38ca5c25a6df8d4d78fdf39b42792438f6ce22b4809ccbfdb27582ed9ca45407" dependencies = [ "base64 0.22.1", "bech32", @@ -8065,9 +8109,9 @@ dependencies = [ [[package]] name = "nostr-database" -version = "0.45.1" +version = "0.45.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b1fdb9fcba732e32719662afad1b267e50322dbe89e506017ec13f24361bddf" +checksum = "309950383c9854ca413d195705400e78b1376aedc48f3256754a86c609c047e8" dependencies = [ "nostr", "opaquerr", @@ -8075,9 +8119,9 @@ dependencies = [ [[package]] name = "nostr-gossip" -version = "0.45.0" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa07539e52a71cb91fe0d693facaa298f03fcf9edcd66a521094e18e286e2336" +checksum = "4ea822fd48ff6b84b81ddf84169e6edf1dc0bc9b312c8e41685b2278debaac3d" dependencies = [ "nostr", "opaquerr", @@ -8085,9 +8129,9 @@ dependencies = [ [[package]] name = "nostr-sdk" -version = "0.45.2" +version = "0.45.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245f8642b10feecb0a40739a886ca1850e3be4e35dc6592b806ec437403ab9c9" +checksum = "c53a37469ce2df8fe6471b6a4d1c4da833f86c7ba0138ac95299b6f37f69ec84" dependencies = [ "async-utility", "async-wsocket", @@ -8330,7 +8374,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "objc2", "objc2-core-graphics", "objc2-foundation", @@ -8342,7 +8386,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "block2", "dispatch2", "libc", @@ -8355,7 +8399,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "dispatch2", "objc2", "objc2-core-foundation", @@ -8368,7 +8412,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71e34919aba0d701380d911702455038a8a3587467fe0141d6a71501e7ffe48" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "objc2", "objc2-core-foundation", "objc2-foundation", @@ -8388,7 +8432,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "block2", "libc", "objc2", @@ -8411,7 +8455,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "objc2", "objc2-core-foundation", ] @@ -8422,7 +8466,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "block2", "dispatch2", "objc2", @@ -8436,7 +8480,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "709fe137109bd1e8b5a99390f77a7d8b2961dafc1a1c5db8f2e60329ad6d895a" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "objc2", "objc2-core-foundation", ] @@ -8457,7 +8501,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7216bd11cbda54ccabcab84d523dc93b858ec75ecfb3a7d89513fa22464da396" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "dispatch2", "libc", "objc2", @@ -8520,7 +8564,7 @@ version = "6.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cc3cbf698f9438986c11a880c90a6d04b9de27575afd28bbf45b154b6c709e2" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "libc", "once_cell", "onig_sys", @@ -8550,9 +8594,9 @@ checksum = "4f933a4265d5cdad61d19bbdfc972ea5726d56cd8d3d57b8f2d3c365dd42bee9" [[package]] name = "open" -version = "5.4.3" +version = "5.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c603ab8300cf18bc3b14146b19fe3dfcc4843ae5a400cd0e7a30b95aa366634" +checksum = "aa576c76302b7b808eecc68061e67336c47833ef9d22caa74dda10fa9675eebc" dependencies = [ "is-wsl", "libc", @@ -8564,8 +8608,8 @@ version = "0.10.81" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45" dependencies = [ - "bitflags 2.13.1", - "cfg-if 1.0.4", + "bitflags 2.13.2", + "cfg-if", "foreign-types 0.3.2", "libc", "openssl-macros", @@ -8674,7 +8718,7 @@ dependencies = [ "bytes", "http 1.5.0", "opentelemetry 0.32.0", - "reqwest 0.13.4", + "reqwest 0.13.5", ] [[package]] @@ -8708,7 +8752,7 @@ dependencies = [ "opentelemetry-proto 0.32.0", "opentelemetry_sdk 0.32.1", "prost", - "reqwest 0.13.4", + "reqwest 0.13.5", "thiserror 2.0.20", ] @@ -8865,7 +8909,7 @@ version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "libc", "redox_syscall", "smallvec", @@ -8957,7 +9001,7 @@ dependencies = [ "biome_js_syntax", "handlebars", "heck", - "indexmap 2.14.1", + "indexmap 2.14.2", "regex", "schemars 0.8.22", "serde", @@ -8977,11 +9021,11 @@ dependencies = [ "base64 0.22.1", "camino", "http 1.5.0", - "indexmap 2.14.1", + "indexmap 2.14.2", "keyring", "opentelemetry-otlp 0.31.1", "opentelemetry_sdk 0.31.0", - "reqwest 0.13.4", + "reqwest 0.13.5", "rmcp 1.8.0", "serde", "serde_json", @@ -9104,9 +9148,9 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pest" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a07a60cc7a4d00c91f95c685609d1d2f79050e6804b70ebedd7650f0b839bcf" +checksum = "6d45aeb61b4bf818e12d4205f2466f8c4748f85f4fce0146d1c03d69d753f0ad" dependencies = [ "memchr", "ucd-trie", @@ -9114,9 +9158,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a83744a5c8455b8b3e0dc5031362780a347c878bdd11584d1a8984228cc88d" +checksum = "89cc5a242e25ed4e7704d0be240f2cfbe20a8c27e7e252d94835be93d92dc39f" dependencies = [ "pest", "pest_generator", @@ -9124,9 +9168,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd3451aa3de60d4b9a1e736885e4dea6b31617598026f12256ad566d63304a" +checksum = "7abf21475cc3820fe4b2ca2dc2142902f67a02189f3b5b3a229f4febc01a43e5" dependencies = [ "pest", "pest_meta", @@ -9137,9 +9181,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e04d3a0849e241d7dfce834c83b1c5edc8622009e8dd51a12ba1927c32f05496" +checksum = "adba4db388f687393c18c51348d44a41d870ca9df71a2c98172ea3035dc6936e" dependencies = [ "pest", ] @@ -9327,7 +9371,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "451913da69c775a56034ea8d9003d27ee8948e12443eae7c038ba100a4f21cb7" dependencies = [ - "der 0.8.1", + "der 0.8.2", "spki 0.8.0", ] @@ -9345,13 +9389,13 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" [[package]] name = "plist" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da1d65da6dd5d1e44199ac0f58712d241c0f439f80adea8924d832384087f85" +checksum = "2896bade328c13f7042a297ea5ac5b0951f6cf989dea5f32c2fd98da398195cb" dependencies = [ - "base64 0.22.1", - "indexmap 2.14.1", - "quick-xml", + "base64 0.23.1", + "indexmap 2.14.2", + "quick-xml 0.42.0", "serde", "time", ] @@ -9375,7 +9419,7 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "crc32fast", "fdeflate", "flate2", @@ -9388,7 +9432,7 @@ version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "concurrent-queue", "hermit-abi", "pin-project-lite", @@ -9413,7 +9457,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "cpufeatures 0.2.17", "opaque-debug", "universal-hash", @@ -9430,9 +9474,9 @@ dependencies = [ [[package]] name = "portable-atomic-util" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" dependencies = [ "portable-atomic", ] @@ -9551,7 +9595,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bfe0f4c752e450fc2faf62654f1c134747922825d5b04ca717b8874f41a40c0" dependencies = [ "proc-macro2", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -9611,7 +9655,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e842efad9119158434d193c6682e2ebee4b44d6ad801d7b349623b3f57cdf55" dependencies = [ "futures", - "indexmap 2.14.1", + "indexmap 2.14.2", + "nix", + "tokio", + "tracing", + "windows 0.62.2", +] + +[[package]] +name = "process-wrap" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e3f4237d0e4741eb50bc5584db701f1299c85fa31ff0274dd6445e79dc42d12" +dependencies = [ + "futures", + "indexmap 2.14.2", "nix", "tokio", "tracing", @@ -9673,7 +9731,7 @@ version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9f068eba8e7071c5f9511831b44f32c740d5adf574e990f946ddb53db2f314e" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "memchr", "unicase", ] @@ -9685,7 +9743,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96b86df24f0a7ddd5e4b95c94fc9ed8a98f1ca94d3b01bdce2824097e7835907" dependencies = [ "bytemuck", - "cfg-if 1.0.4", + "cfg-if", "libm", "num-complex", "reborrow", @@ -9699,7 +9757,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046aa45b989642ec2e4717c8e72d677b13edd831a4d3b6cf37d9a3e54912496a" dependencies = [ "bytemuck", - "cfg-if 1.0.4", + "cfg-if", "libm", "num-complex", "paste", @@ -9748,10 +9806,19 @@ dependencies = [ ] [[package]] -name = "quinn" -version = "0.11.11" +name = "quick-xml" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8" +checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b" +dependencies = [ + "memchr", +] + +[[package]] +name = "quinn" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11" dependencies = [ "bytes", "cfg_aliases", @@ -9769,9 +9836,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.17" +version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04759210543be93709136e28212294a659ef5001836ff4eab4d663e4529bba83" +checksum = "a9746dbde176634f4f2f1faf2404e30a31b2bc1e9cafb5329c95d8177a18c9fc" dependencies = [ "aws-lc-rs", "bytes", @@ -9948,7 +10015,7 @@ version = "11.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", ] [[package]] @@ -10018,7 +10085,7 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", ] [[package]] @@ -10049,7 +10116,7 @@ checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -10166,11 +10233,11 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.13.4" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3" +checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "bytes", "cookie", "cookie_store", @@ -10224,7 +10291,7 @@ dependencies = [ "anyhow", "async-trait", "http 1.5.0", - "reqwest 0.13.4", + "reqwest 0.13.5", "thiserror 2.0.20", "tower-service", ] @@ -10239,12 +10306,6 @@ dependencies = [ "serde_core", ] -[[package]] -name = "resolv-conf" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7" - [[package]] name = "rfc6979" version = "0.4.0" @@ -10271,7 +10332,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", - "cfg-if 1.0.4", + "cfg-if", "getrandom 0.2.17", "libc", "untrusted 0.9.0", @@ -10291,8 +10352,8 @@ dependencies = [ "http 1.5.0", "pastey", "pin-project-lite", - "process-wrap", - "reqwest 0.13.4", + "process-wrap 9.1.0", + "reqwest 0.13.5", "rmcp-macros 1.8.0", "schemars 1.2.2", "serde", @@ -10307,9 +10368,9 @@ dependencies = [ [[package]] name = "rmcp" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42b6914fac0be956fe704a38239c3f44a9f841d1b06a5713d2f638065593f5b5" +checksum = "b88db56b8ae316560e9e868b6b978ea940f27cb883323fc90e07435e44158f5c" dependencies = [ "async-trait", "base64 0.23.1", @@ -10321,14 +10382,14 @@ dependencies = [ "http-body-util", "hyper", "hyper-util", - "indexmap 2.14.1", + "indexmap 2.14.2", "oauth2", "pastey", "pin-project-lite", - "process-wrap", + "process-wrap 10.0.0", "rand 0.10.2", - "reqwest 0.13.4", - "rmcp-macros 3.2.0", + "reqwest 0.13.5", + "rmcp-macros 3.3.0", "schemars 1.2.2", "serde", "serde_json", @@ -10358,15 +10419,15 @@ dependencies = [ [[package]] name = "rmcp-macros" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf1c49bd4d52014b94db0877410db273c2008f01628b0252a2e9460ad9b7fda" +checksum = "873b730df6f0a9b74b13eb514e0dca4c2db0d8b68b74af98a2e9bf3f9d436585" dependencies = [ "darling 0.24.1", "proc-macro2", "quote", "serde_json", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -10451,7 +10512,7 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "errno", "libc", "linux-raw-sys 0.4.15", @@ -10464,7 +10525,7 @@ version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "errno", "libc", "linux-raw-sys 0.12.1", @@ -10473,9 +10534,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.43" +version = "0.23.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06" +checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634" dependencies = [ "aws-lc-rs", "log", @@ -10594,8 +10655,8 @@ version = "18.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53f6a737db68eb1a8ccff86b584b2fc13eca6a7bb6f78ebc7c529547e3ab9684" dependencies = [ - "bitflags 2.13.1", - "cfg-if 1.0.4", + "bitflags 2.13.2", + "cfg-if", "clipboard-win", "home", "libc", @@ -10821,7 +10882,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals 0.30.0", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -10876,7 +10937,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d56d437c2f19203ce5f7122e507831de96f3d2d4d3be5af44a0b0a09d8a80e4d" dependencies = [ - "der 0.8.1", + "der 0.8.2", "zeroize", ] @@ -10906,7 +10967,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "core-foundation 0.9.4", "core-foundation-sys", "libc", @@ -10919,7 +10980,7 @@ version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "core-foundation 0.10.1", "core-foundation-sys", "libc", @@ -11001,7 +11062,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -11023,7 +11084,7 @@ checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -11032,7 +11093,7 @@ version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" dependencies = [ - "indexmap 2.14.1", + "indexmap 2.14.2", "itoa", "memchr", "serde", @@ -11079,7 +11140,7 @@ checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -11119,16 +11180,16 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.22.0" +version = "3.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee78f1fbe43ac4a0e47aadb3dbd357b69eb0d3793e948624cd03dd2750ab1c0a" +checksum = "935177bb8c0cd8ca1a4e6d1a2ac8988bea69cab4f9d3a31311e012ad27868ea4" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "bs58", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.14.1", + "indexmap 2.14.2", "jiff", "schemars 0.9.0", "schemars 1.2.2", @@ -11140,14 +11201,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.22.0" +version = "3.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8705578779c2b6bd90d84d66eb2e206b708b1a4d7b9f17641b293545bf1c7e46" +checksum = "1d607aa01a3cb0ad757d6fd216136910db3c97b102fe686585689615a02dbcdc" dependencies = [ - "darling 0.23.0", + "darling 0.24.1", "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.5", ] [[package]] @@ -11156,7 +11217,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.14.1", + "indexmap 2.14.2", "itoa", "ryu", "serde", @@ -11192,7 +11253,7 @@ checksum = "a22144e767da4ddd8416dbf383700542ffd8a5dc493dfecedfe1fe3ad03c98ae" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -11201,7 +11262,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "cpufeatures 0.2.17", "digest 0.10.7", ] @@ -11212,7 +11273,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "cpufeatures 0.3.1", "digest 0.11.3", ] @@ -11229,7 +11290,7 @@ version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "cpufeatures 0.2.17", "digest 0.10.7", ] @@ -11240,7 +11301,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "cpufeatures 0.3.1", "digest 0.11.3", ] @@ -11372,7 +11433,7 @@ checksum = "9b97c5a866f849a9445ae657bef0caa2db053a82827e6dae3a2b3de9c15a6a1a" dependencies = [ "base64 0.22.1", "hex", - "reqwest 0.13.4", + "reqwest 0.13.5", "serde", "serde_json", "sigstore-crypto", @@ -11416,7 +11477,7 @@ dependencies = [ "hex", "jiff", "rand 0.9.5", - "reqwest 0.13.4", + "reqwest 0.13.5", "rustls-pki-types", "rustls-webpki", "sigstore-crypto", @@ -11436,7 +11497,7 @@ dependencies = [ "globset", "hex", "jiff", - "reqwest 0.13.4", + "reqwest 0.13.5", "serde", "serde_json", "sha2 0.10.9", @@ -11531,7 +11592,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b6f884fa9a8d48101774bfbd3aeb81e968dd22cffd19a372da69f183db22c1a" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", ] [[package]] @@ -11566,9 +11627,9 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" -version = "1.16.0" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9be42f50aa861c555654aa3a37f52f4b1074bacf4e48fe0ef7fa584e80f1f0f" +checksum = "ba467056f1b547ed52077911161fc86985becbc60e8e1857c8a144dab0def891" dependencies = [ "serde", ] @@ -11600,7 +11661,7 @@ dependencies = [ "aws-smithy-types", "http 1.5.0", "parking_lot", - "reqwest 0.13.4", + "reqwest 0.13.5", ] [[package]] @@ -11686,7 +11747,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d9efca8738c78ee9484207732f728b1ef517bbb1833d6fc0879ca898a522f6f" dependencies = [ "base64ct", - "der 0.8.1", + "der 0.8.2", ] [[package]] @@ -11728,7 +11789,7 @@ checksum = "05b44e85bf579a8eeb4ceaa77a3a523baf2bf0e9bac7e40f405d537b5d2d5ccb" dependencies = [ "base64 0.22.1", "bytes", - "cfg-if 1.0.4", + "cfg-if", "chrono", "crc", "crossbeam-queue", @@ -11740,7 +11801,7 @@ dependencies = [ "futures-util", "hashbrown 0.16.1", "hashlink", - "indexmap 2.14.1", + "indexmap 2.14.2", "log", "memchr", "native-tls", @@ -11777,7 +11838,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb8d96de5fdc85a5c4ec813432b523ec637e80ba98f046555f75f7908ddac7c3" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "dotenvy", "either", "heck", @@ -11803,7 +11864,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90b8020fe17c5f2c245bfa2505d7ef59c5604839527c740266ad2214acebea27" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "byteorder", "bytes", "chrono", @@ -11832,7 +11893,7 @@ checksum = "87a2bdd6e83f6b3ea525ca9fee568030508b58355a43d0b2c1674d5f79dcd65e" dependencies = [ "atoi", "base64 0.22.1", - "bitflags 2.13.1", + "bitflags 2.13.2", "byteorder", "chrono", "crc", @@ -11911,7 +11972,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707f49d46706bacf8a2b00d51dace3f9de527c13eec3778f570c411f89e69967" dependencies = [ "cc", - "cfg-if 1.0.4", + "cfg-if", "libc", "psm", "windows-sys 0.61.2", @@ -12094,7 +12155,7 @@ checksum = "72e90b52ee734ded867104612218101722ad87ff4cf74fe30383bd244a533f97" dependencies = [ "anyhow", "bytes-str", - "indexmap 2.14.1", + "indexmap 2.14.2", "serde", "serde_json", "swc_config_macro", @@ -12118,7 +12179,7 @@ version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a573a0c72850dec8d4d8085f152d5778af35a2520c3093b242d2d1d50776da7c" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "is-macro", "num-bigint", "once_cell", @@ -12173,7 +12234,7 @@ version = "26.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e82f7747e052c6ff6e111fa4adeb14e33b46ee6e94fe5ef717601f651db48fc" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "either", "num-bigint", "rustc-hash 2.1.3", @@ -12210,7 +12271,7 @@ version = "27.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f1a51af1a92cd4904c073b293e491bbc0918400a45d58227b34c961dd6f52d7" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "either", "num-bigint", "phf 0.11.3", @@ -12232,7 +12293,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "250f6f165578ca4fee47bd57585c1b9597c94bf4ea6591df47f2b5fa5b1883fe" dependencies = [ "better_scoped_tls", - "indexmap 2.14.1", + "indexmap 2.14.2", "once_cell", "par-core", "phf 0.11.3", @@ -12298,7 +12359,7 @@ checksum = "03de12e38e47ac1c96ac576f793ad37a9d7b16fbf4f2203881f89152f2498682" dependencies = [ "base64 0.22.1", "bytes-str", - "indexmap 2.14.1", + "indexmap 2.14.2", "once_cell", "rustc-hash 2.1.3", "serde", @@ -12338,7 +12399,7 @@ version = "24.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fb99e179988cabd473779a4452ab942bcb777176983ca3cbaf22a8f056a65b0" dependencies = [ - "indexmap 2.14.1", + "indexmap 2.14.2", "num_cpus", "once_cell", "par-core", @@ -12525,7 +12586,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01c412864d599d4750d0c3d684d7e093ec05e5309681ef5252cc1096a437f6e0" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "bytemuck", "lazy_static", "log", @@ -12606,9 +12667,9 @@ dependencies = [ [[package]] name = "syn" -version = "3.0.4" +version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f" +checksum = "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9" dependencies = [ "proc-macro2", "quote", @@ -12700,7 +12761,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01198a2debb237c62b6826ec7081082d951f46dbb64b0e8c7649a452230d1dfc" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "byteorder", "enum-as-inner", "libc", @@ -12728,11 +12789,22 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "core-foundation 0.9.4", "system-configuration-sys", ] +[[package]] +name = "system-configuration" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501336eb7ba9e417300a6a0fa985721065467aa83a6dcf0422a8e43e4c0328fa" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "system-configuration-sys", +] + [[package]] name = "system-configuration-sys" version = "0.6.0" @@ -12826,7 +12898,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a46bb5364467da040298c573c8a95dbf9a512efc039630409a03126e3703e90" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "libc", "memchr", "mio", @@ -12841,7 +12913,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b3f27d9a8a177e57545481faec87acb45c6e854ed1e5a3658ad186c106f38ed" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "libc", "windows-sys 0.61.2", ] @@ -12867,7 +12939,7 @@ version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adcb7fd841cd518e279be3d5a3eb0636409487998a4aff22f3de87b81e88384f" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "proc-macro2", "quote", "syn 2.0.119", @@ -12942,7 +13014,7 @@ checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -12957,7 +13029,7 @@ version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", ] [[package]] @@ -13056,18 +13128,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.12.0" +version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" [[package]] name = "tls_codec" @@ -13206,7 +13269,7 @@ checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -13243,9 +13306,9 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.4" +version = "0.26.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +checksum = "b0c85f2c3ef0b1cd58b36682f4b17aaa995f0e5db534d85692b4903abce21f67" dependencies = [ "rustls", "tokio", @@ -13266,7 +13329,7 @@ dependencies = [ "pem 3.0.6", "proc-macro2", "rcgen", - "reqwest 0.13.4", + "reqwest 0.13.5", "ring", "rustls", "serde", @@ -13311,9 +13374,11 @@ checksum = "d25a406cddcc431a75d3d9afc6a7c0f7428d4891dd973e4d54c56b46127bf857" dependencies = [ "futures-util", "log", + "native-tls", "rustls", "rustls-pki-types", "tokio", + "tokio-native-tls", "tokio-rustls", "tungstenite 0.28.0", "webpki-roots 0.26.11", @@ -13401,7 +13466,7 @@ version = "0.9.12+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" dependencies = [ - "indexmap 2.14.1", + "indexmap 2.14.2", "serde_core", "serde_spanned", "toml_datetime 0.7.5+spec-1.1.0", @@ -13412,11 +13477,11 @@ dependencies = [ [[package]] name = "toml" -version = "1.1.5+spec-1.1.0" +version = "1.1.6+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12c0ba9680044b4ce98d391a62094047eada0d64860b80166c39f4a6b5640785" +checksum = "920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a" dependencies = [ - "indexmap 2.14.1", + "indexmap 2.14.2", "serde_core", "serde_spanned", "toml_datetime 1.1.1+spec-1.1.0", @@ -13445,11 +13510,11 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.25.13+spec-1.1.0" +version = "0.25.15+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6975367e4d2ef766d86af01ffad14b622fecc8d4357a998fbc4deb6e9bacaf9b" +checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614" dependencies = [ - "indexmap 2.14.1", + "indexmap 2.14.2", "toml_datetime 1.1.1+spec-1.1.0", "toml_parser", "winnow 1.0.4", @@ -13518,7 +13583,7 @@ checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" dependencies = [ "futures-core", "futures-util", - "indexmap 2.14.1", + "indexmap 2.14.2", "pin-project-lite", "slab", "sync_wrapper", @@ -13536,7 +13601,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" dependencies = [ "async-compression", - "bitflags 2.13.1", + "bitflags 2.13.2", "bytes", "futures-core", "futures-util", @@ -13558,7 +13623,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08a05a66a4fdd61cbbe0a1d755ffe0ca6aba159dd4820936a0ff8a8278245b9c" dependencies = [ - "bitflags 2.13.1", + "bitflags 2.13.2", "bytes", "http 1.5.0", "percent-encoding", @@ -13832,6 +13897,7 @@ dependencies = [ "http 1.5.0", "httparse", "log", + "native-tls", "rand 0.9.5", "rustls", "rustls-pki-types", @@ -13955,7 +14021,7 @@ dependencies = [ "md-5", "num-traits", "phf 0.14.0", - "quick-xml", + "quick-xml 0.41.0", "rand 0.10.2", "rgb", "sha2 0.11.0", @@ -14061,9 +14127,9 @@ checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" [[package]] name = "uniffi" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a782a48d72cfd7a2d65cfc7c691dbf5375c43104b3c195f7eccc716dcc3540c8" +checksum = "edf78ecfb9bb8d7c4f8da11e8eb2ab6304e8ec0adb3ab32d8fc77c21a5bb0b86" dependencies = [ "anyhow", "camino", @@ -14077,9 +14143,9 @@ dependencies = [ [[package]] name = "uniffi_bindgen" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "533b0312c73e3b54eb78a4b257ceae390962dd4767995778309a74644643f9ac" +checksum = "cdea7c4574723928bef87dfc04b203d96321d0bf34ab295a56379e633be579f3" dependencies = [ "anyhow", "askama", @@ -14089,12 +14155,12 @@ dependencies = [ "glob", "goblin", "heck", - "indexmap 2.14.1", + "indexmap 2.14.2", "once_cell", "serde", "tempfile", "textwrap", - "toml 1.1.5+spec-1.1.0", + "toml 1.1.6+spec-1.1.0", "uniffi_internal_macros", "uniffi_meta", "uniffi_pipeline", @@ -14103,9 +14169,9 @@ dependencies = [ [[package]] name = "uniffi_core" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e32e261c5b0dfaba6488f536e71957dddd6b1a498ac7eb791bee56b60a086be" +checksum = "f8b1c62ee415b805f063c82e8ef6bbcaa1b87f8eed360cf217537b7724e05601" dependencies = [ "anyhow", "bytes", @@ -14115,12 +14181,12 @@ dependencies = [ [[package]] name = "uniffi_internal_macros" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84ae78069a5e6772ef694fd5bdb628532c88d2c2f0e7142bf6a384636eadb1af" +checksum = "c79d4a3129d6c2c15e367d3954886a0533dd3e85d445ce4d93379f62c6949d7b" dependencies = [ "anyhow", - "indexmap 2.14.1", + "indexmap 2.14.2", "proc-macro2", "quote", "syn 2.0.119", @@ -14128,9 +14194,9 @@ dependencies = [ [[package]] name = "uniffi_macros" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "330be6770532e86320df31f54c70bb0be67588594e8e77fa56e9083a3fed5d0d" +checksum = "2f6a9826a83f1140b2ec67c7944f562e1ef616e6eaf40e76247adccbd5b8a091" dependencies = [ "camino", "fs-err", @@ -14139,15 +14205,15 @@ dependencies = [ "quote", "serde", "syn 2.0.119", - "toml 1.1.5+spec-1.1.0", + "toml 1.1.6+spec-1.1.0", "uniffi_meta", ] [[package]] name = "uniffi_meta" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78de021f5547e56ab16c665a49d67d4fd3d31e77422f7739a2e9359d328cd9e7" +checksum = "cf233eb014b595e8997c98df4ac6863b486a4ac6d54bd00230c7700753d7ef13" dependencies = [ "anyhow", "siphasher 1.0.3", @@ -14157,22 +14223,22 @@ dependencies = [ [[package]] name = "uniffi_pipeline" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8201bb1907ed8a42d80e11cbc25c8a033e7a31c3cff1d911f56eedb81d4948" +checksum = "55179706fbb6e7a23e729780d2c6165e6afe1ce725fa63754bcf217b440afc04" dependencies = [ "anyhow", "heck", - "indexmap 2.14.1", + "indexmap 2.14.2", "tempfile", "uniffi_internal_macros", ] [[package]] name = "uniffi_udl" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6e57996bc58009cc29bf04845d627ae313c2547b87171c1c349d6c51a1656c0" +checksum = "421a9add7a19c5a264a2aba760514125ef3840a8b246ec88237fc91e3f2f79b1" dependencies = [ "anyhow", "textwrap", @@ -14263,7 +14329,7 @@ version = "5.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bde15df68e80b16c7d16b9616e80770ad158988daa56a27dccd1e55558b0160" dependencies = [ - "indexmap 2.14.1", + "indexmap 2.14.2", "serde", "serde_json", "utoipa-gen", @@ -14282,9 +14348,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.26.0" +version = "1.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5772d71c9be8a8a6ac2117d949c5b224c1b72241bb611d9a3012edcf8af7812" +checksum = "2ef6dac1e96601b4fb3acccccff2139741fcb757cb9a36089bf5be91cfb285ce" dependencies = [ "getrandom 0.4.3", "js-sys", @@ -14315,7 +14381,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f84468f393984251db025e944544590a8fb429d5088b78102bd72f09232f0da" dependencies = [ "bindgen", - "bitflags 2.13.1", + "bitflags 2.13.2", "fslock", "gzip-header", "home", @@ -14429,11 +14495,11 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.127" +version = "0.2.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70" +checksum = "aecb87a33d3b0c5e3b7aa46336eaf486cffafbd281b195e4c8b80d50df2351bf" dependencies = [ - "cfg-if 1.0.4", + "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", @@ -14442,9 +14508,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.77" +version = "0.4.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7777d5cc23d0e91404e53ce2d5e8ec7acae3026b16233dba62cd3246457950" +checksum = "6ef4c5d3d2cdf5c54f4231181768f5510842e350db025faf1f7163b1030ed928" dependencies = [ "js-sys", "wasm-bindgen", @@ -14452,9 +14518,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.127" +version = "0.2.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1" +checksum = "a690d511e3c1a8b3a55e33511e3c2c00c78415cd23650f32b808627f5696b9ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -14462,22 +14528,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.127" +version = "0.2.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284" +checksum = "411e4887f0071ef2d2164a9d5fdf2d20efbef78fccd3a78b0c10a1dc5295e48a" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.5", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.127" +version = "0.2.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf" +checksum = "81941cd78d0c92026c33e5e01312845a4cb1e9af3407f9134b100dd03144103e" dependencies = [ "unicode-ident", ] @@ -14507,9 +14573,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.104" +version = "0.3.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c435338968042f4f59a557f690a253676d47ce13ceb55d70100e7facf6620a30" +checksum = "9fbddc4a036f00ec4f18c83445bd3115cb306a91da554919a099d9222fe4a7f8" dependencies = [ "js-sys", "wasm-bindgen", @@ -15263,7 +15329,7 @@ dependencies = [ "more-asserts", "rand 0.10.2", "redb", - "reqwest 0.13.4", + "reqwest 0.13.5", "reqwest-middleware", "serde", "serde_json", @@ -15370,7 +15436,7 @@ dependencies = [ "oneshot", "pin-project", "rand 0.10.2", - "reqwest 0.13.4", + "reqwest 0.13.5", "serde", "serde_json", "shellexpand", @@ -15464,18 +15530,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.56" +version = "0.8.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb" +checksum = "d35102a9f36d089ccae9e4c6802bc118be4487b80aaffc0ab4e0cf5ce92d2873" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.56" +version = "0.8.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1" +checksum = "146c01f5ab44258da43cf276c74a2763db2ff3969c9c652c3f2de07041d0b2bc" dependencies = [ "proc-macro2", "quote", @@ -15555,7 +15621,7 @@ checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" dependencies = [ "proc-macro2", "quote", - "syn 3.0.4", + "syn 3.0.5", ] [[package]] @@ -15566,7 +15632,7 @@ checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b" dependencies = [ "crc32fast", "flate2", - "indexmap 2.14.1", + "indexmap 2.14.2", "memchr", "typed-path", "zopfli", @@ -15574,9 +15640,9 @@ dependencies = [ [[package]] name = "zlib-rs" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34b31d188d9d685a4f9c7b46d6e36631b07058d2cfe190267adce54dc230bf12" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" [[package]] name = "zmij" @@ -15611,27 +15677,27 @@ dependencies = [ [[package]] name = "zstd" -version = "0.13.3" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" +checksum = "bf06bd8162af0734b344780deb55b42a2429ae430870d13fcc12f238e880fe6e" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "7.2.4" +version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" +checksum = "ae42c0555055784c70058d19ba8e275528e8a99a706684868ace5da4e716a4ab" dependencies = [ "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.16+zstd.1.5.7" +version = "2.1.0+zstd.1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748" +checksum = "0ef0a8027ec3ee71300ab3bcbcd0393f434aa72b91ca6d635a39941deae8eea0" dependencies = [ "cc", "pkg-config", diff --git a/crates/goose-providers/Cargo.toml b/crates/goose-providers/Cargo.toml index 65c912307..7cb33f37e 100644 --- a/crates/goose-providers/Cargo.toml +++ b/crates/goose-providers/Cargo.toml @@ -13,6 +13,7 @@ workspace = true [features] default = [] +test-utils = [] local-inference = ["dep:goose-local-inference"] local-inference-hf-hub = ["local-inference", "goose-local-inference/hf-hub"] cuda = ["local-inference", "goose-local-inference/cuda"] @@ -21,13 +22,16 @@ mlx = ["local-inference", "goose-local-inference/mlx"] rustls-tls = [ "reqwest/rustls", "rmcp/reqwest", + "tokio-tungstenite?/rustls-tls-webpki-roots", ] +live-websocket = ["dep:tokio-tungstenite", "dep:http"] native-tls = [ "dep:pem", "dep:pkcs8", "dep:sec1", "reqwest/native-tls", "rmcp/reqwest-native-tls", + "tokio-tungstenite?/native-tls", ] [dependencies] @@ -48,6 +52,10 @@ tokio-stream = { workspace = true, features = ["io-util"] } tokio-util = { workspace = true, features = ["compat"] } url = { workspace = true } urlencoding = { workspace = true } +uuid = { workspace = true, features = ["v4"] } +base64 = { workspace = true } +tokio-tungstenite = { version = "0.28", default-features = false, features = ["connect", "handshake"], optional = true } +http = { workspace = true, optional = true } pem = { version = "4.0.0", default-features = false, features = ["std"], optional = true } pkcs8 = { version = "0.11", default-features = false, features = ["alloc", "std"], optional = true } sec1 = { version = "0.8", default-features = false, features = ["der", "std"], optional = true } @@ -56,7 +64,7 @@ include_dir = { workspace = true } [dev-dependencies] test-case = { workspace = true } tempfile = { workspace = true } -tokio = { workspace = true, features = ["io-util", "macros", "net", "rt-multi-thread", "time"] } +tokio = { workspace = true, features = ["io-util", "macros", "net", "rt-multi-thread", "test-util", "time"] } tokio-stream = { workspace = true } env-lock = { workspace = true } wiremock.workspace = true @@ -66,3 +74,7 @@ reqwest = { workspace = true, features = ["gzip"] } [[example]] name = "streaming" required-features = ["rustls-tls"] + +[[example]] +name = "openai_live" +required-features = ["live-websocket", "rustls-tls"] diff --git a/crates/goose-providers/examples/openai_live.rs b/crates/goose-providers/examples/openai_live.rs new file mode 100644 index 000000000..307c68a65 --- /dev/null +++ b/crates/goose-providers/examples/openai_live.rs @@ -0,0 +1,28 @@ +//! OpenAI Live low-level API examples. + +use anyhow::Result; +use goose_providers::openai_live::{OpenAiLiveClient, OpenAiLiveSessionConfig}; + +fn config() -> OpenAiLiveSessionConfig { + OpenAiLiveSessionConfig { + model: "gpt-live-1".into(), + instructions: "Be concise.".into(), + voice: Some("marin".into()), + input_messages: vec![], + extra_session_fields: Default::default(), + } +} + +#[cfg(feature = "live-websocket")] +async fn primary_websocket(client: &OpenAiLiveClient) -> Result<()> { + let mut connected = client.websocket(config()).connect().await?; + let event = connected.recv().await?; + println!("{event:?}"); + connected.close().await +} + +fn main() { + let _ = OpenAiLiveClient::from_env; + #[cfg(feature = "live-websocket")] + let _ = primary_websocket; +} diff --git a/crates/goose-providers/src/browser_live_transport.rs b/crates/goose-providers/src/browser_live_transport.rs new file mode 100644 index 000000000..57fb94d17 --- /dev/null +++ b/crates/goose-providers/src/browser_live_transport.rs @@ -0,0 +1,103 @@ +//! Message bridge for browser-owned WebRTC data channels. +//! +//! Audio remains on WebRTC media tracks; this transport carries only protocol +//! control messages and events between Rust and the browser data channel. + +use crate::live::LiveTransport; +use anyhow::Result; +use async_trait::async_trait; +use serde_json::Value; +use tokio::sync::{mpsc, watch, Mutex}; + +pub struct BrowserLiveOutbound { + receiver: mpsc::Receiver, + closed: watch::Receiver, +} + +impl BrowserLiveOutbound { + pub async fn recv(&mut self) -> Option { + tokio::select! { + biased; + _ = self.closed.wait_for(|closed| *closed) => None, + message = self.receiver.recv() => message, + } + } +} + +pub struct BrowserLiveTransport { + outbound_tx: mpsc::Sender, + outbound_rx: Mutex>>, + incoming_tx: mpsc::Sender, + incoming_rx: Mutex>, + closed_tx: watch::Sender, +} + +impl BrowserLiveTransport { + pub fn new() -> Self { + let (outbound_tx, outbound_rx) = mpsc::channel(256); + let (incoming_tx, incoming_rx) = mpsc::channel(256); + let (closed_tx, _) = watch::channel(false); + Self { + outbound_tx, + outbound_rx: Mutex::new(Some(outbound_rx)), + incoming_tx, + incoming_rx: Mutex::new(incoming_rx), + closed_tx, + } + } + + pub async fn take_outbound(&self) -> Result { + let receiver = self + .outbound_rx + .lock() + .await + .take() + .ok_or_else(|| anyhow::anyhow!("browser live receiver was already taken"))?; + Ok(BrowserLiveOutbound { + receiver, + closed: self.closed_tx.subscribe(), + }) + } + + pub async fn push_incoming(&self, message: Value) -> Result<()> { + let mut closed = self.closed_tx.subscribe(); + tokio::select! { + biased; + _ = closed.wait_for(|closed| *closed) => anyhow::bail!("browser live transport is closed"), + result = self.incoming_tx.send(message) => result.map_err(Into::into), + } + } +} + +impl Default for BrowserLiveTransport { + fn default() -> Self { + Self::new() + } +} + +#[async_trait] +impl LiveTransport for BrowserLiveTransport { + async fn send(&self, message: Value) -> Result<()> { + let mut closed = self.closed_tx.subscribe(); + tokio::select! { + biased; + _ = closed.wait_for(|closed| *closed) => anyhow::bail!("browser live transport is closed"), + result = self.outbound_tx.send(message) => result.map_err(Into::into), + } + } + + async fn receive(&self) -> Result> { + let mut closed = self.closed_tx.subscribe(); + let mut incoming = self.incoming_rx.lock().await; + tokio::select! { + biased; + _ = closed.wait_for(|closed| *closed) => Ok(None), + message = incoming.recv() => Ok(message), + } + } + + async fn close(&self) -> Result<()> { + self.closed_tx.send_replace(true); + Ok(()) + } +} diff --git a/crates/goose-providers/src/lib.rs b/crates/goose-providers/src/lib.rs index 10089ed88..92d39db79 100644 --- a/crates/goose-providers/src/lib.rs +++ b/crates/goose-providers/src/lib.rs @@ -1,3 +1,9 @@ +#[cfg(all( + feature = "live-websocket", + not(any(feature = "rustls-tls", feature = "native-tls")) +))] +compile_error!("feature `live-websocket` requires either `rustls-tls` or `native-tls`"); + pub mod anthropic; pub mod api_client; pub mod azure_foundry; @@ -9,13 +15,21 @@ pub use goose_provider_types::{ base, cache_semantics, canonical, context_limit, conversation, documents, errors, formats, goose_mode, images, json, model, permission, request_log, retry, thinking, utils, }; +pub mod browser_live_transport; pub mod declarative; pub mod http_status; +pub mod live; +#[cfg(feature = "live-websocket")] +pub mod live_transport_websocket; +pub mod live_voice_provider; #[cfg(feature = "local-inference")] pub mod local_inference; pub mod ollama; pub mod openai; pub mod openai_compatible; +pub mod openai_live; +#[cfg(feature = "live-websocket")] +pub mod openai_live_voice_provider; pub mod openrouter; pub mod openrouter_format; diff --git a/crates/goose-providers/src/live.rs b/crates/goose-providers/src/live.rs new file mode 100644 index 000000000..461d64d84 --- /dev/null +++ b/crates/goose-providers/src/live.rs @@ -0,0 +1,298 @@ +//! Runtime primitives for provider-specific live sessions. +//! +//! A single actor owns transport I/O and lifecycle transitions so sends, +//! shutdown, and incoming events have deterministic ordering. + +use anyhow::{anyhow, bail, Result}; +use async_trait::async_trait; +use serde_json::Value; +use std::sync::Arc; +use tokio::{ + sync::{broadcast, mpsc, oneshot, watch}, + time::{timeout, Duration}, +}; + +pub(crate) const LIVE_EVENT_CHANNEL_CAPACITY: usize = 256; +const TRANSPORT_SEND_TIMEOUT: Duration = Duration::from_secs(5); +const TRANSPORT_CLOSE_TIMEOUT: Duration = Duration::from_secs(5); +const CLOSE_ACKNOWLEDGEMENT_TIMEOUT: Duration = Duration::from_secs(12); + +#[async_trait] +pub trait LiveTransport: Send + Sync { + async fn send(&self, message: Value) -> Result<()>; + async fn receive(&self) -> Result>; + async fn close(&self) -> Result<()>; +} + +pub trait LiveProtocol: Send + Sync + 'static { + type Command: Send + 'static; + type Event: Clone + Send + 'static; + + fn encode(&self, command: Self::Command) -> Result; + fn decode(&self, message: Value) -> Result; + fn close_command(&self) -> Option; + fn is_close_acknowledgement(&self, event: &Self::Event) -> bool; +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum LiveSessionEndReason { + Closed, + CloseTimedOut, + TransportClosed, + TransportFailed, + ProtocolFailed, + DecodeFailed, +} + +#[derive(Debug, Clone)] +struct LiveSessionOutcome { + reason: LiveSessionEndReason, + error: Option>, +} + +impl LiveSessionOutcome { + fn result(&self) -> Result<()> { + match &self.error { + Some(error) => Err(anyhow!(error.to_string())), + None if self.reason == LiveSessionEndReason::Closed => Ok(()), + None => Err(anyhow!("live session ended ({:?})", self.reason)), + } + } +} + +#[derive(Debug, Clone)] +pub enum LiveSessionEvent { + Message(E), + Ended { + reason: LiveSessionEndReason, + error: Option>, + }, +} + +impl LiveSessionEvent { + fn ended(reason: LiveSessionEndReason, error: Option) -> Self { + Self::Ended { + reason, + error: error.map(Arc::new), + } + } +} + +enum ActorCommand { + Send { + command: C, + result: oneshot::Sender>, + }, + Close { + result: oneshot::Sender>, + }, +} + +pub struct LiveSession { + commands: mpsc::Sender>, + events: broadcast::Sender>, + ended: watch::Receiver>, +} + +impl Clone for LiveSession

{ + fn clone(&self) -> Self { + Self { + commands: self.commands.clone(), + events: self.events.clone(), + ended: self.ended.clone(), + } + } +} + +impl LiveSession

{ + pub fn connect( + protocol: Arc

, + transport: Arc, + ) -> (Self, broadcast::Receiver>) { + let (commands, command_rx) = mpsc::channel(256); + let (events, initial_events) = broadcast::channel(LIVE_EVENT_CHANNEL_CAPACITY); + let (ended_tx, ended) = watch::channel(None); + tokio::spawn(run_actor( + protocol, + transport, + command_rx, + events.clone(), + ended_tx, + )); + ( + Self { + commands, + events, + ended, + }, + initial_events, + ) + } + + pub fn subscribe(&self) -> broadcast::Receiver> { + self.events.subscribe() + } + + pub fn end_reason(&self) -> Option { + self.ended.borrow().as_ref().map(|outcome| outcome.reason) + } + + pub async fn send(&self, command: P::Command) -> Result<()> { + if let Some(reason) = self.end_reason() { + bail!("live session ended ({reason:?})"); + } + let (result_tx, result_rx) = oneshot::channel(); + self.commands + .send(ActorCommand::Send { + command, + result: result_tx, + }) + .await + .map_err(|_| anyhow!("live session ended"))?; + result_rx.await.map_err(|_| anyhow!("live session ended"))? + } + + pub async fn close(&self) -> Result<()> { + let outcome = self.ended.borrow().clone(); + if let Some(outcome) = outcome { + return outcome.result(); + } + let (result_tx, result_rx) = oneshot::channel(); + if self + .commands + .send(ActorCommand::Close { result: result_tx }) + .await + .is_err() + { + return self.wait_for_end().await; + } + match result_rx.await { + Ok(result) => result, + Err(_) => self.wait_for_end().await, + } + } + + async fn wait_for_end(&self) -> Result<()> { + let mut ended = self.ended.clone(); + loop { + let outcome = ended.borrow().clone(); + if let Some(outcome) = outcome { + return outcome.result(); + } + ended + .changed() + .await + .map_err(|_| anyhow!("live session ended without an outcome"))?; + } + } +} + +async fn run_actor( + protocol: Arc

, + transport: Arc, + mut commands: mpsc::Receiver>, + events: broadcast::Sender>, + ended: watch::Sender>, +) { + let mut close_waiters = Vec::new(); + let mut closing = false; + let close_timeout = tokio::time::sleep(CLOSE_ACKNOWLEDGEMENT_TIMEOUT); + tokio::pin!(close_timeout); + + let (reason, error) = loop { + tokio::select! { + command = commands.recv() => match command { + Some(ActorCommand::Send { command, result }) if !closing => { + let message = match protocol.encode(command) { + Ok(message) => message, + Err(error) => { + let _ = result.send(Err(error)); + continue; + } + }; + let send_result = send_transport(&transport, message).await; + let failed = send_result.is_err(); + let error = send_result.as_ref().err().map(|error| anyhow!(error.to_string())); + let _ = result.send(send_result); + if failed { + break (LiveSessionEndReason::TransportFailed, error); + } + } + Some(ActorCommand::Send { result, .. }) => { + let _ = result.send(Err(anyhow!("live session is closing"))); + } + Some(ActorCommand::Close { result }) => { + close_waiters.push(result); + if !closing { + closing = true; + if let Some(command) = protocol.close_command() { + let close_result = match protocol.encode(command) { + Ok(message) => send_transport(&transport, message).await, + Err(error) => { + break (LiveSessionEndReason::ProtocolFailed, Some(error)); + } + }; + if let Err(error) = close_result { + break (LiveSessionEndReason::TransportFailed, Some(error)); + } + close_timeout.as_mut().reset( + tokio::time::Instant::now() + CLOSE_ACKNOWLEDGEMENT_TIMEOUT, + ); + } else { + break (LiveSessionEndReason::Closed, None); + } + } + } + None => break (LiveSessionEndReason::Closed, None), + }, + incoming = transport.receive() => match incoming { + Ok(Some(message)) => match protocol.decode(message) { + Ok(event) => { + let acknowledged = protocol.is_close_acknowledgement(&event); + let _ = events.send(LiveSessionEvent::Message(event)); + if acknowledged { + break (LiveSessionEndReason::Closed, None); + } + } + Err(error) => break (LiveSessionEndReason::DecodeFailed, Some(error)), + }, + Ok(None) => break (LiveSessionEndReason::TransportClosed, None), + Err(error) => break (LiveSessionEndReason::TransportFailed, Some(error)), + }, + _ = &mut close_timeout, if closing => { + break ( + LiveSessionEndReason::CloseTimedOut, + Some(anyhow!("live session close acknowledgement timed out")), + ); + }, + } + }; + + let close_result = timeout(TRANSPORT_CLOSE_TIMEOUT, transport.close()).await; + let close_error = match close_result { + Ok(Ok(())) => None, + Ok(Err(error)) => Some(error), + Err(_) => Some(anyhow!("live transport close timed out")), + }; + let final_error = error.or(close_error); + let outcome = LiveSessionOutcome { + reason, + error: final_error + .as_ref() + .map(|error| Arc::new(anyhow!(error.to_string()))), + }; + ended.send_replace(Some(outcome.clone())); + let _ = events.send(LiveSessionEvent::ended( + reason, + final_error.as_ref().map(|error| anyhow!(error.to_string())), + )); + for waiter in close_waiters { + let _ = waiter.send(outcome.result()); + } +} + +async fn send_transport(transport: &Arc, message: Value) -> Result<()> { + timeout(TRANSPORT_SEND_TIMEOUT, transport.send(message)) + .await + .map_err(|_| anyhow!("live transport send timed out"))? +} diff --git a/crates/goose-providers/src/live_transport_websocket.rs b/crates/goose-providers/src/live_transport_websocket.rs new file mode 100644 index 000000000..47d405c45 --- /dev/null +++ b/crates/goose-providers/src/live_transport_websocket.rs @@ -0,0 +1,86 @@ +//! Native WebSocket transport for OpenAI Live sessions. + +use crate::{live::LiveTransport, openai_live::OpenAiLiveWebSocketRequest}; +use anyhow::{Context, Result}; +use async_trait::async_trait; +use futures::{stream::SplitSink, stream::SplitStream, SinkExt, StreamExt}; +use serde_json::Value; +use tokio::{ + sync::Mutex, + time::{timeout, Duration}, +}; +use tokio_tungstenite::{ + connect_async, + tungstenite::{client::IntoClientRequest, Message}, + MaybeTlsStream, WebSocketStream, +}; + +const CONNECT_TIMEOUT: Duration = Duration::from_secs(10); + +type Socket = WebSocketStream>; +type SocketSink = SplitSink; +type SocketStream = SplitStream; + +pub struct WebSocketLiveTransport { + sink: Mutex, + stream: Mutex, +} + +impl WebSocketLiveTransport { + pub async fn connect(request: OpenAiLiveWebSocketRequest) -> Result { + let mut websocket_request = request.endpoint.into_client_request()?; + for (name, value) in request.headers { + websocket_request.headers_mut().insert( + http::header::HeaderName::try_from(name)?, + http::header::HeaderValue::try_from(value)?, + ); + } + let (socket, _) = timeout(CONNECT_TIMEOUT, connect_async(websocket_request)) + .await + .context("live WebSocket connection timed out")? + .context("live WebSocket connection failed")?; + let (mut sink, stream) = socket.split(); + timeout(CONNECT_TIMEOUT, async { + for message in request.initial_messages { + sink.send(Message::Text(message.to_string().into())).await?; + } + Result::<()>::Ok(()) + }) + .await + .context("live WebSocket initialization timed out")??; + Ok(Self { + sink: Mutex::new(sink), + stream: Mutex::new(stream), + }) + } +} + +#[async_trait] +impl LiveTransport for WebSocketLiveTransport { + async fn send(&self, message: Value) -> Result<()> { + self.sink + .lock() + .await + .send(Message::Text(message.to_string().into())) + .await?; + Ok(()) + } + + async fn receive(&self) -> Result> { + let stream = &mut *self.stream.lock().await; + while let Some(message) = stream.next().await { + match message? { + Message::Text(text) => return Ok(Some(serde_json::from_str(&text)?)), + Message::Binary(bytes) => return Ok(Some(serde_json::from_slice(&bytes)?)), + Message::Close(_) => return Ok(None), + _ => {} + } + } + Ok(None) + } + + async fn close(&self) -> Result<()> { + self.sink.lock().await.close().await?; + Ok(()) + } +} diff --git a/crates/goose-providers/src/live_voice_provider.rs b/crates/goose-providers/src/live_voice_provider.rs new file mode 100644 index 000000000..0d3f0940d --- /dev/null +++ b/crates/goose-providers/src/live_voice_provider.rs @@ -0,0 +1,225 @@ +//! The application-facing boundary for live voice providers. + +use anyhow::Result; +use async_trait::async_trait; + +const MAX_SDP_BYTES: usize = 256 * 1024; + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct WebRtcOffer(String); + +impl WebRtcOffer { + pub fn new(sdp: String) -> Option { + valid_sdp(&sdp).then_some(Self(sdp)) + } + + pub fn into_sdp(self) -> String { + self.0 + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct WebRtcAnswer(String); + +impl WebRtcAnswer { + pub fn new(sdp: String) -> Option { + valid_sdp(&sdp).then_some(Self(sdp)) + } + + pub fn into_sdp(self) -> String { + self.0 + } +} + +fn valid_sdp(sdp: &str) -> bool { + !sdp.is_empty() && sdp.len() <= MAX_SDP_BYTES +} + +#[async_trait] +pub trait ProviderConnection: Send { + async fn next_event(&mut self) -> ProviderConnectionEvent; + async fn stop(&mut self) -> Result<()>; +} + +#[derive(Debug, PartialEq)] +pub enum ProviderConnectionEvent { + TranscriptDelta { + event_id: String, + role: rmcp::model::Role, + text: String, + }, + ReceiverLagged, + Closed, + Failed, +} + +#[derive(Clone, Debug, PartialEq)] +pub struct LiveVoiceInputMessage { + pub role: rmcp::model::Role, + pub text: String, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum LiveVoiceProviderAvailability { + Ready, + Disabled, + Unavailable, +} + +#[async_trait] +pub trait LiveVoiceProvider: Send + Sync { + fn availability(&self) -> LiveVoiceProviderAvailability; + + async fn start( + &self, + offer: WebRtcOffer, + input_messages: Vec, + ) -> Result<(WebRtcAnswer, Box)>; +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn sdp_values_must_be_present_and_bounded() { + assert!(WebRtcOffer::new(String::new()).is_none()); + assert!(WebRtcOffer::new("x".repeat(MAX_SDP_BYTES + 1)).is_none()); + assert!(WebRtcOffer::new("offer".into()).is_some()); + assert!(WebRtcAnswer::new("answer".into()).is_some()); + } +} + +#[cfg(any(test, feature = "test-utils"))] +pub mod fake { + use super::*; + use tokio::sync::{mpsc, oneshot}; + + pub fn provider_channel() -> ( + std::sync::Arc, + mpsc::UnboundedReceiver, + ) { + provider_channel_with_availability(LiveVoiceProviderAvailability::Ready) + } + + pub fn provider_channel_with_availability( + availability: LiveVoiceProviderAvailability, + ) -> ( + std::sync::Arc, + mpsc::UnboundedReceiver, + ) { + let (start_tx, start_rx) = mpsc::unbounded_channel(); + ( + std::sync::Arc::new(FakeLiveVoiceProvider { + availability, + start_tx, + }), + start_rx, + ) + } + + pub struct FakeLiveVoiceProvider { + availability: LiveVoiceProviderAvailability, + start_tx: mpsc::UnboundedSender, + } + + #[async_trait] + impl LiveVoiceProvider for FakeLiveVoiceProvider { + fn availability(&self) -> LiveVoiceProviderAvailability { + self.availability + } + + async fn start( + &self, + offer: WebRtcOffer, + input_messages: Vec, + ) -> Result<(WebRtcAnswer, Box)> { + let (response_tx, response_rx) = oneshot::channel(); + self.start_tx + .send(FakeStartRequest { + offer, + input_messages, + response_tx, + }) + .map_err(|_| anyhow::anyhow!("fake provider driver dropped"))?; + response_rx + .await + .map_err(|_| anyhow::anyhow!("fake provider start response dropped"))? + } + } + + pub struct FakeStartRequest { + pub offer: WebRtcOffer, + pub input_messages: Vec, + response_tx: oneshot::Sender)>>, + } + + impl FakeStartRequest { + pub fn accept(self, answer: WebRtcAnswer) -> Result { + let (stop_request_tx, stop_request_rx) = mpsc::unbounded_channel(); + let (event_tx, event_rx) = mpsc::unbounded_channel(); + self.response_tx + .send(Ok(( + answer, + Box::new(FakeProviderConnection { + stop_request_tx, + event_rx, + }), + ))) + .map_err(|_| anyhow::anyhow!("fake provider start caller dropped"))?; + Ok(FakeConnectionDriver { + stop_request_rx, + event_tx, + }) + } + + pub fn reject(self, message: impl Into) -> Result<()> { + self.response_tx + .send(Err(anyhow::anyhow!(message.into()))) + .map_err(|_| anyhow::anyhow!("fake provider start caller dropped")) + } + } + + pub struct FakeConnectionDriver { + stop_request_rx: mpsc::UnboundedReceiver>>, + event_tx: mpsc::UnboundedSender, + } + + impl FakeConnectionDriver { + pub async fn next_stop_request(&mut self) -> Option>> { + self.stop_request_rx.recv().await + } + + pub fn send_event(&self, event: ProviderConnectionEvent) -> Result<()> { + self.event_tx + .send(event) + .map_err(|_| anyhow::anyhow!("fake provider event receiver dropped")) + } + } + + struct FakeProviderConnection { + stop_request_tx: mpsc::UnboundedSender>>, + event_rx: mpsc::UnboundedReceiver, + } + + #[async_trait] + impl ProviderConnection for FakeProviderConnection { + async fn next_event(&mut self) -> ProviderConnectionEvent { + self.event_rx + .recv() + .await + .unwrap_or(ProviderConnectionEvent::Failed) + } + + async fn stop(&mut self) -> Result<()> { + let (response_tx, response_rx) = oneshot::channel(); + self.stop_request_tx + .send(response_tx) + .map_err(|_| anyhow::anyhow!("fake provider driver dropped"))?; + response_rx + .await + .map_err(|_| anyhow::anyhow!("fake provider stop response dropped"))? + .map_err(anyhow::Error::msg) + } + } +} diff --git a/crates/goose-providers/src/openai_live.rs b/crates/goose-providers/src/openai_live.rs new file mode 100644 index 000000000..de6edeba1 --- /dev/null +++ b/crates/goose-providers/src/openai_live.rs @@ -0,0 +1,1265 @@ +//! OpenAI GPT-Live API. +//! +//! The client owns OpenAI configuration and protocol semantics. WebSocket and +//! WebRTC connectors own their distinct connection establishment flows. + +use crate::{ + http_status::handle_response, + live::{ + LiveProtocol, LiveSession, LiveSessionEvent, LiveTransport, LIVE_EVENT_CHANNEL_CAPACITY, + }, +}; +use anyhow::{bail, Context, Result}; +use base64::{engine::general_purpose::STANDARD as BASE64, Engine}; +use rmcp::model::Role; +use serde::{Deserialize, Serialize}; +use serde_json::{json, Value}; +use std::{collections::BTreeMap, sync::Arc}; +use tokio::{ + sync::{broadcast, broadcast::error::RecvError}, + time::{timeout, Duration}, +}; +use uuid::Uuid; + +pub const DEFAULT_OPENAI_LIVE_HTTP_URL: &str = "https://api.openai.com/v1/live/sessions"; +pub const DEFAULT_OPENAI_LIVE_WEBSOCKET_URL: &str = "wss://api.openai.com/v1/live/sessions"; +const SESSION_START_TIMEOUT: Duration = Duration::from_secs(10); + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct OpenAiLiveSessionConfig { + pub model: String, + pub instructions: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub voice: Option, + #[serde(default)] + pub input_messages: Vec, + #[serde(default)] + pub extra_session_fields: BTreeMap, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct OpenAiLiveMessage { + pub role: OpenAiLiveMessageRole, + pub text: String, +} + +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum OpenAiLiveMessageRole { + User, + Assistant, + Developer, +} + +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum OpenAiLiveContextChannel { + Instructions, + Thinking, + Commentary, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct OpenAiLiveContext { + pub text: String, + pub channel: OpenAiLiveContextChannel, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(transparent)] +pub struct OpenAiLiveSessionId(pub String); + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(transparent)] +pub struct OpenAiLiveDelegationId(pub String); + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum OpenAiLiveDelegationTarget { + Client, + Responses, + Other(String), +} + +impl From for OpenAiLiveDelegationId { + fn from(value: String) -> Self { + Self(value) + } +} + +impl From<&str> for OpenAiLiveDelegationId { + fn from(value: &str) -> Self { + Self(value.to_owned()) + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct OpenAiLiveDelegation { + pub id: OpenAiLiveDelegationId, + pub target: OpenAiLiveDelegationTarget, + pub offset_ms: u64, +} + +pub enum OpenAiLiveCommand { + AppendContext { + event_id: String, + delegation_id: Option, + context: OpenAiLiveContext, + }, + AppendAudio(Vec), + MuteInput { + event_id: String, + }, + UnmuteInput { + event_id: String, + }, + Close, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct OpenAiLiveEvent { + pub kind: OpenAiLiveEventKind, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub raw: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(tag = "type", rename_all = "snake_case")] +pub enum OpenAiLiveEventKind { + SessionStarted { + event_id: String, + session_id: OpenAiLiveSessionId, + }, + TranscriptDelta { + event_id: String, + client_event_id: Option, + role: Role, + delta: String, + start_ms: u64, + end_ms: u64, + }, + OutputAudioDelta { + audio: Vec, + start_ms: Option, + end_ms: Option, + }, + DelegationCreated { + event_id: String, + client_event_id: Option, + delegation: OpenAiLiveDelegation, + }, + ContextAppended { + event_id: String, + channel: OpenAiLiveContextChannel, + client_event_id: Option, + start_ms: u64, + end_ms: u64, + }, + Usage { + event_id: String, + usage: Value, + }, + Error { + event_id: String, + error_type: String, + code: String, + message: String, + parameter: Option, + client_event_id: Option, + }, + Info { + event_id: String, + code: String, + message: String, + client_event_id: Option, + }, + InputMuted { + event_id: String, + client_event_id: Option, + }, + InputUnmuted { + event_id: String, + client_event_id: Option, + }, + SessionClosed { + event_id: String, + client_event_id: Option, + reason: String, + session: Value, + usage: Value, + }, + Other { + event_type: String, + }, +} + +#[derive(Clone)] +pub struct OpenAiLiveClient { + api_key: String, + http_endpoint: String, + websocket_endpoint: String, +} + +impl OpenAiLiveClient { + pub fn new(api_key: impl Into) -> Self { + Self { + api_key: api_key.into(), + http_endpoint: DEFAULT_OPENAI_LIVE_HTTP_URL.into(), + websocket_endpoint: DEFAULT_OPENAI_LIVE_WEBSOCKET_URL.into(), + } + } + + pub fn from_env() -> Result { + let key = std::env::var("OPENAI_API_KEY").context("OPENAI_API_KEY is not set")?; + if key.trim().is_empty() { + bail!("OPENAI_API_KEY is empty"); + } + Ok(Self::new(key)) + } + + pub fn with_http_endpoint(mut self, endpoint: impl Into) -> Self { + self.http_endpoint = endpoint.into(); + self + } + + pub fn with_websocket_endpoint(mut self, endpoint: impl Into) -> Self { + self.websocket_endpoint = endpoint.into(); + self + } + + pub fn websocket(&self, config: OpenAiLiveSessionConfig) -> OpenAiLiveWebSocketConnector { + OpenAiLiveWebSocketConnector { + client: self.clone(), + config, + } + } + + pub fn existing_session( + &self, + session_id: OpenAiLiveSessionId, + ) -> OpenAiLiveExistingSessionConnector { + OpenAiLiveExistingSessionConnector { + client: self.clone(), + session_id, + } + } + + pub fn webrtc(&self, config: OpenAiLiveSessionConfig) -> OpenAiLiveWebRtcConnector { + OpenAiLiveWebRtcConnector { + client: self.clone(), + config, + } + } + + fn connect_transport( + &self, + transport: Arc, + connection_kind: OpenAiLiveConnectionKind, + ) -> StartingOpenAiLiveSession { + let (session, events) = LiveSession::connect(Arc::new(OpenAiLiveProtocol), transport); + StartingOpenAiLiveSession { + session, + events, + pending_events: Default::default(), + connection_kind, + } + } + + fn headers(&self) -> Vec<(String, String)> { + vec![("Authorization".into(), format!("Bearer {}", self.api_key))] + } + + fn session_json(config: &OpenAiLiveSessionConfig, websocket_audio: bool) -> Result { + const RESERVED: &[&str] = &["model", "instructions", "input", "audio", "delegation"]; + if let Some(field) = config + .extra_session_fields + .keys() + .find(|field| RESERVED.contains(&field.as_str())) + { + bail!("extra session field `{field}` conflicts with typed configuration"); + } + let input_messages = config.input_messages.iter().map(|message| { + let role = match message.role { + OpenAiLiveMessageRole::User => "user", + OpenAiLiveMessageRole::Assistant => "assistant", + OpenAiLiveMessageRole::Developer => "developer", + }; + let content_type = if matches!(message.role, OpenAiLiveMessageRole::Assistant) { "output_text" } else { "input_text" }; + json!({ "type": "message", "role": role, "content": [{ "type": content_type, "text": message.text }] }) + }).collect::>(); + let mut session = json!({ + "model": config.model, + "instructions": config.instructions, + "input": input_messages, + "delegation": { "type": "client" }, + }); + if websocket_audio || config.voice.is_some() { + let mut audio = json!({}); + if websocket_audio { + audio["format"] = json!({ "type": "audio/pcm", "rate": 24_000 }); + } + if let Some(voice) = &config.voice { + audio["output"] = json!({ "voice": voice }); + } + session["audio"] = audio; + } + session + .as_object_mut() + .unwrap() + .extend(config.extra_session_fields.clone()); + Ok(session) + } +} + +pub struct OpenAiLiveExistingSessionConnector { + client: OpenAiLiveClient, + session_id: OpenAiLiveSessionId, +} + +impl OpenAiLiveExistingSessionConnector { + pub fn request(self) -> Result { + if self.session_id.0.trim().is_empty() { + bail!("OpenAI Live session ID is empty"); + } + Ok(OpenAiLiveWebSocketRequest { + endpoint: format!( + "{}/{}/attach", + self.client.websocket_endpoint.trim_end_matches('/'), + urlencoding::encode(&self.session_id.0) + ), + headers: self.client.headers(), + initial_messages: Vec::new(), + }) + } + + #[cfg(feature = "live-websocket")] + pub async fn connect(self) -> Result { + let client = self.client.clone(); + let session_id = self.session_id.clone(); + let transport = Arc::new( + crate::live_transport_websocket::WebSocketLiveTransport::connect(self.request()?) + .await?, + ); + Ok(client + .connect_transport(transport, OpenAiLiveConnectionKind::MediaControl) + .connected(session_id)) + } +} + +pub struct OpenAiLiveWebSocketRequest { + pub endpoint: String, + pub headers: Vec<(String, String)>, + pub initial_messages: Vec, +} + +pub struct OpenAiLiveWebSocketConnector { + client: OpenAiLiveClient, + config: OpenAiLiveSessionConfig, +} + +impl OpenAiLiveWebSocketConnector { + pub fn request(self) -> Result { + Ok(OpenAiLiveWebSocketRequest { + endpoint: self.client.websocket_endpoint.clone(), + headers: self.client.headers(), + initial_messages: vec![json!({ + "type": "session.start", + "event_id": event_id(), + "session": OpenAiLiveClient::session_json(&self.config, true)?, + })], + }) + } + + #[cfg(feature = "live-websocket")] + pub async fn connect(self) -> Result { + let client = self.client.clone(); + let transport = Arc::new( + crate::live_transport_websocket::WebSocketLiveTransport::connect(self.request()?) + .await?, + ); + client + .connect_transport(transport, OpenAiLiveConnectionKind::PrimaryWebSocket) + .ready(None) + .await + } +} + +pub struct OpenAiLiveWebRtcConnector { + client: OpenAiLiveClient, + config: OpenAiLiveSessionConfig, +} + +pub struct OpenAiLiveWebRtcRequest { + pub endpoint: String, + pub headers: Vec<(String, String)>, + pub offer_sdp: String, + pub session: Value, +} + +pub struct OpenAiLiveWebRtcNegotiation { + pub answer_sdp: String, + pub session_id: OpenAiLiveSessionId, + client: OpenAiLiveClient, +} + +impl OpenAiLiveWebRtcNegotiation { + pub async fn bind( + self, + transport: Arc, + ) -> Result { + self.client + .connect_transport(transport, OpenAiLiveConnectionKind::MediaControl) + .ready(Some(self.session_id)) + .await + } +} + +impl OpenAiLiveWebRtcConnector { + pub fn request(self, offer_sdp: impl Into) -> Result { + let offer_sdp = offer_sdp.into(); + if offer_sdp.trim().is_empty() { + bail!("WebRTC SDP offer is empty"); + } + Ok(OpenAiLiveWebRtcRequest { + endpoint: self.client.http_endpoint.clone(), + headers: self.client.headers(), + offer_sdp, + session: OpenAiLiveClient::session_json(&self.config, false)?, + }) + } + + pub async fn negotiate( + self, + offer_sdp: impl Into, + ) -> Result { + let client = self.client.clone(); + let request = self.request(offer_sdp)?; + let mut http_request = reqwest::Client::new().post(request.endpoint).json(&json!({ + "session": request.session, + "transport": { "type": "webrtc", "sdp": request.offer_sdp }, + })); + for (name, value) in request.headers { + http_request = http_request.header(name, value); + } + let result: Value = timeout(SESSION_START_TIMEOUT, async { + let response = http_request.send().await?; + handle_response(response).await + }) + .await + .context("OpenAI Live signaling timed out")??; + let session_id = OpenAiLiveSessionId(required_nonempty_string( + result.pointer("/session/id"), + "session.id", + )?); + let answer_sdp = + required_nonempty_string(result.pointer("/transport/sdp"), "transport.sdp")?; + Ok(OpenAiLiveWebRtcNegotiation { + answer_sdp, + session_id, + client, + }) + } +} + +pub type OpenAiLiveSession = LiveSession; +pub type OpenAiLiveSessionEvent = LiveSessionEvent; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +enum OpenAiLiveConnectionKind { + PrimaryWebSocket, + MediaControl, +} + +struct StartingOpenAiLiveSession { + session: OpenAiLiveSession, + events: broadcast::Receiver, + pending_events: std::collections::VecDeque, + connection_kind: OpenAiLiveConnectionKind, +} + +impl StartingOpenAiLiveSession { + async fn ready( + mut self, + expected_session_id: Option, + ) -> Result { + timeout(SESSION_START_TIMEOUT, async { + loop { + match self.events.recv().await { + Ok(LiveSessionEvent::Message(OpenAiLiveEvent { + kind: OpenAiLiveEventKind::SessionStarted { session_id, .. }, + .. + })) => { + if expected_session_id + .as_ref() + .is_some_and(|expected| expected != &session_id) + { + bail!("OpenAI Live startup identity does not match creation identity"); + } + return Ok(self.connected(session_id)); + } + Ok(LiveSessionEvent::Message(event)) + if matches!(event.kind, OpenAiLiveEventKind::Error { .. }) => + { + if let OpenAiLiveEventKind::Error { message, .. } = event.kind { + bail!("OpenAI Live startup failed: {message}"); + } + } + Ok(LiveSessionEvent::Ended { error, .. }) => { + if let Some(error) = error { + return Err(anyhow::anyhow!(error.to_string())); + } + bail!("OpenAI Live session ended before startup"); + } + Ok(event @ LiveSessionEvent::Message(_)) => { + if self.pending_events.len() >= LIVE_EVENT_CHANNEL_CAPACITY { + bail!("too many events received before OpenAI Live session startup"); + } + self.pending_events.push_back(event); + } + Err(RecvError::Lagged(count)) => { + bail!("OpenAI Live authoritative event receiver lagged by {count} events") + } + Err(RecvError::Closed) => { + bail!("OpenAI Live authoritative event stream closed") + } + } + } + }) + .await + .map_err(|_| anyhow::anyhow!("OpenAI Live session startup timed out"))? + } + + fn connected(self, session_id: OpenAiLiveSessionId) -> ConnectedOpenAiLiveSession { + ConnectedOpenAiLiveSession { + session: self.session, + events: self.events, + pending_events: self.pending_events, + connection_kind: self.connection_kind, + session_id, + } + } +} + +pub struct ConnectedOpenAiLiveSession { + session: OpenAiLiveSession, + events: broadcast::Receiver, + pending_events: std::collections::VecDeque, + connection_kind: OpenAiLiveConnectionKind, + session_id: OpenAiLiveSessionId, +} + +impl ConnectedOpenAiLiveSession { + pub async fn recv(&mut self) -> std::result::Result { + if let Some(event) = self.pending_events.pop_front() { + return Ok(event); + } + self.events.recv().await + } + + pub fn session_id(&self) -> &OpenAiLiveSessionId { + &self.session_id + } + + pub async fn send(&self, command: OpenAiLiveCommand) -> Result<()> { + if self.connection_kind != OpenAiLiveConnectionKind::PrimaryWebSocket + && matches!(&command, OpenAiLiveCommand::AppendAudio(_)) + { + bail!("audio input is only permitted on an OpenAI Live primary WebSocket"); + } + self.session.send(command).await + } + + pub async fn close(&self) -> Result<()> { + self.session.close().await + } +} + +pub struct OpenAiLiveProtocol; + +impl LiveProtocol for OpenAiLiveProtocol { + type Command = OpenAiLiveCommand; + type Event = OpenAiLiveEvent; + + fn encode(&self, command: Self::Command) -> Result { + match command { + OpenAiLiveCommand::AppendContext { + event_id, + delegation_id, + context, + } => text_event(event_id, delegation_id, context), + OpenAiLiveCommand::AppendAudio(audio) => { + if audio.is_empty() { + bail!("audio payload is empty"); + } + Ok(json!({ + "type": "session.input_audio.append", + "event_id": event_id(), + "audio": BASE64.encode(audio), + })) + } + OpenAiLiveCommand::MuteInput { event_id } => { + Ok(json!({ "type": "session.input_audio.mute", "event_id": event_id })) + } + OpenAiLiveCommand::UnmuteInput { event_id } => { + Ok(json!({ "type": "session.input_audio.unmute", "event_id": event_id })) + } + OpenAiLiveCommand::Close => { + Ok(json!({ "type": "session.close", "event_id": event_id() })) + } + } + } + + fn decode(&self, event: Value) -> Result { + let event_type = event + .get("type") + .and_then(Value::as_str) + .context("OpenAI Live event is missing type")?; + let kind = match event_type { + "session.started" => OpenAiLiveEventKind::SessionStarted { + event_id: required_string(event.get("event_id"), "event_id")?, + session_id: OpenAiLiveSessionId(required_nonempty_string( + event.pointer("/session/id"), + "session.id", + )?), + }, + "session.input_transcript.delta" => transcript_delta(&event, Role::User)?, + "session.output_transcript.delta" => transcript_delta(&event, Role::Assistant)?, + "session.output_audio.delta" => OpenAiLiveEventKind::OutputAudioDelta { + audio: BASE64.decode( + event + .get("delta") + .and_then(Value::as_str) + .context("session.output_audio.delta is missing delta")?, + )?, + start_ms: optional_u64(event.get("start_ms"), "start_ms")?, + end_ms: optional_u64(event.get("end_ms"), "end_ms")?, + }, + "session.delegation.created" => { + let delegation = event + .get("delegation") + .context("session.delegation.created is missing delegation")?; + OpenAiLiveEventKind::DelegationCreated { + event_id: required_string(event.get("event_id"), "event_id")?, + client_event_id: optional_string( + event.get("client_event_id"), + "client_event_id", + )?, + delegation: OpenAiLiveDelegation { + id: delegation + .get("id") + .and_then(Value::as_str) + .context("delegation is missing id")? + .to_owned() + .into(), + target: delegation_target(delegation)?, + offset_ms: required_u64(event.get("offset_ms"), "offset_ms")?, + }, + } + } + "session.instructions.appended" => { + context_appended(&event, OpenAiLiveContextChannel::Instructions)? + } + "session.thinking.appended" => { + context_appended(&event, OpenAiLiveContextChannel::Thinking)? + } + "session.commentary.appended" => { + context_appended(&event, OpenAiLiveContextChannel::Commentary)? + } + "session.usage.updated" => OpenAiLiveEventKind::Usage { + event_id: required_string(event.get("event_id"), "event_id")?, + usage: required_object(event.get("usage"), "usage")?, + }, + "session.input_audio.muted" => OpenAiLiveEventKind::InputMuted { + event_id: required_string(event.get("event_id"), "event_id")?, + client_event_id: optional_string(event.get("client_event_id"), "client_event_id")?, + }, + "session.input_audio.unmuted" => OpenAiLiveEventKind::InputUnmuted { + event_id: required_string(event.get("event_id"), "event_id")?, + client_event_id: optional_string(event.get("client_event_id"), "client_event_id")?, + }, + "session.closed" => OpenAiLiveEventKind::SessionClosed { + event_id: required_string(event.get("event_id"), "event_id")?, + client_event_id: optional_string(event.get("client_event_id"), "client_event_id")?, + reason: required_string(event.get("reason"), "reason")?, + session: required_object(event.get("session"), "session")?, + usage: required_object(event.get("usage"), "usage")?, + }, + "error" => live_error(&event, "/error")?, + "info" => OpenAiLiveEventKind::Info { + event_id: required_string(event.get("event_id"), "event_id")?, + code: required_string(event.get("code"), "code")?, + message: required_string(event.get("message"), "message")?, + client_event_id: optional_string(event.get("client_event_id"), "client_event_id")?, + }, + _ => OpenAiLiveEventKind::Other { + event_type: event_type.into(), + }, + }; + Ok(OpenAiLiveEvent { + kind, + raw: Some(event), + }) + } + + fn close_command(&self) -> Option { + Some(OpenAiLiveCommand::Close) + } + + fn is_close_acknowledgement(&self, event: &Self::Event) -> bool { + matches!(event.kind, OpenAiLiveEventKind::SessionClosed { .. }) + } +} + +fn transcript_delta(event: &Value, role: Role) -> Result { + Ok(OpenAiLiveEventKind::TranscriptDelta { + event_id: required_string(event.get("event_id"), "event_id")?, + client_event_id: optional_string(event.get("client_event_id"), "client_event_id")?, + role, + delta: required_string(event.get("delta"), "delta")?, + start_ms: required_u64(event.get("start_ms"), "start_ms")?, + end_ms: required_u64(event.get("end_ms"), "end_ms")?, + }) +} + +fn context_appended( + event: &Value, + channel: OpenAiLiveContextChannel, +) -> Result { + Ok(OpenAiLiveEventKind::ContextAppended { + event_id: required_string(event.get("event_id"), "event_id")?, + channel, + client_event_id: optional_string(event.get("client_event_id"), "client_event_id")?, + start_ms: required_u64(event.get("start_ms"), "start_ms")?, + end_ms: required_u64(event.get("end_ms"), "end_ms")?, + }) +} + +fn delegation_target(item: &Value) -> Result { + match item + .get("target") + .and_then(Value::as_str) + .context("delegation is missing target")? + { + "client" => Ok(OpenAiLiveDelegationTarget::Client), + "responses" => Ok(OpenAiLiveDelegationTarget::Responses), + target => Ok(OpenAiLiveDelegationTarget::Other(target.to_owned())), + } +} + +fn required_object(value: Option<&Value>, field: &str) -> Result { + match value { + Some(value) if value.is_object() => Ok(value.clone()), + Some(_) => bail!("OpenAI Live event field {field} is not an object"), + None => bail!("OpenAI Live event is missing {field}"), + } +} + +fn live_error(event: &Value, pointer: &str) -> Result { + let error = event + .pointer(pointer) + .with_context(|| format!("OpenAI Live error is missing {pointer}"))?; + Ok(OpenAiLiveEventKind::Error { + event_id: required_string(event.get("event_id"), "event_id")?, + error_type: required_string(error.get("type"), "error.type")?, + code: required_string(error.get("code"), "error.code")?, + message: required_string(error.get("message"), "error.message")?, + parameter: optional_string(error.get("param"), "error.param")?, + client_event_id: optional_string(error.get("client_event_id"), "error.client_event_id")?, + }) +} + +fn required_string(value: Option<&Value>, field: &str) -> Result { + value + .and_then(Value::as_str) + .with_context(|| format!("OpenAI Live event is missing {field}")) + .map(str::to_owned) +} + +fn required_nonempty_string(value: Option<&Value>, field: &str) -> Result { + let value = required_string(value, field)?; + if value.trim().is_empty() { + bail!("OpenAI Live field {field} is empty"); + } + Ok(value) +} + +fn optional_string(value: Option<&Value>, field: &str) -> Result> { + match value { + None | Some(Value::Null) => Ok(None), + Some(Value::String(value)) => Ok(Some(value.to_owned())), + Some(_) => bail!("OpenAI Live event field {field} is not a string"), + } +} + +fn required_u64(value: Option<&Value>, field: &str) -> Result { + value + .and_then(Value::as_u64) + .with_context(|| format!("OpenAI Live event is missing {field}")) +} + +fn optional_u64(value: Option<&Value>, field: &str) -> Result> { + match value { + None | Some(Value::Null) => Ok(None), + Some(value) => value + .as_u64() + .with_context(|| format!("OpenAI Live event field {field} is not an unsigned integer")) + .map(Some), + } +} + +fn event_id() -> String { + format!("event_{}", Uuid::new_v4()) +} + +fn text_event( + event_id: String, + delegation_id: Option, + context: OpenAiLiveContext, +) -> Result { + let kind = match context.channel { + OpenAiLiveContextChannel::Instructions => "session.instructions.append", + OpenAiLiveContextChannel::Thinking => "session.thinking.append", + OpenAiLiveContextChannel::Commentary => "session.commentary.append", + }; + if event_id.trim().is_empty() { + bail!("event ID is empty"); + } + if delegation_id + .as_ref() + .is_some_and(|delegation_id| delegation_id.0.trim().is_empty()) + { + bail!("delegation ID is empty"); + } + Ok(json!({ + "type": kind, + "event_id": event_id, + "delegation_id": delegation_id.map(|delegation_id| delegation_id.0), + "content": context.text, + })) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::browser_live_transport::BrowserLiveTransport; + use wiremock::{ + matchers::{body_json, header, method, path}, + Mock, MockServer, ResponseTemplate, + }; + + fn config() -> OpenAiLiveSessionConfig { + OpenAiLiveSessionConfig { + model: "gpt-live-1".into(), + instructions: "help".into(), + voice: None, + input_messages: vec![], + extra_session_fields: Default::default(), + } + } + + fn decode(event: Value) -> OpenAiLiveEventKind { + OpenAiLiveProtocol.decode(event).unwrap().kind + } + + #[test] + fn existing_session_sideband_is_authenticated_without_primary_bootstrap() { + let request = OpenAiLiveClient::new("test-key") + .existing_session(OpenAiLiveSessionId("session/a".into())) + .request() + .unwrap(); + assert!(request.endpoint.ends_with("/session%2Fa/attach")); + assert!(request + .headers + .iter() + .any(|(name, value)| name == "Authorization" && value == "Bearer test-key")); + assert!(request.initial_messages.is_empty()); + } + + #[test] + fn primary_websocket_bootstraps_with_session_start_and_pcm_audio() { + let request = OpenAiLiveClient::new("test") + .websocket(config()) + .request() + .unwrap(); + assert_eq!(request.endpoint, DEFAULT_OPENAI_LIVE_WEBSOCKET_URL); + assert_eq!(request.initial_messages[0]["type"], "session.start"); + assert_eq!( + request.initial_messages[0]["session"]["audio"]["format"], + json!({ "type": "audio/pcm", "rate": 24_000 }) + ); + } + + #[test] + fn initial_message_roles_use_valid_content_types() { + let roles = [ + (OpenAiLiveMessageRole::Developer, "developer", "input_text"), + (OpenAiLiveMessageRole::User, "user", "input_text"), + (OpenAiLiveMessageRole::Assistant, "assistant", "output_text"), + ]; + for (role, expected_role, expected_content_type) in roles { + let mut config = config(); + config.input_messages.push(OpenAiLiveMessage { + role, + text: "hello".into(), + }); + let session = OpenAiLiveClient::session_json(&config, false).unwrap(); + assert_eq!(session["input"][0]["role"], expected_role); + assert_eq!( + session["input"][0]["content"][0]["type"], + expected_content_type + ); + } + } + + #[tokio::test] + async fn webrtc_negotiation_uses_ga_request_and_response_shapes() { + let server = MockServer::start().await; + Mock::given(method("POST")) + .and(path("/v1/live/sessions")) + .and(header("authorization", "Bearer test-key")) + .and(body_json(json!({ + "session": { + "model": "gpt-live-1", + "instructions": "help", + "input": [], + "delegation": { "type": "client" } + }, + "transport": { "type": "webrtc", "sdp": "offer-sdp" } + }))) + .respond_with(ResponseTemplate::new(201).set_body_json(json!({ + "session": { "id": "session_1" }, + "transport": { "type": "webrtc", "sdp": "answer-sdp" } + }))) + .mount(&server) + .await; + + let negotiation = OpenAiLiveClient::new("test-key") + .with_http_endpoint(format!("{}/v1/live/sessions", server.uri())) + .webrtc(config()) + .negotiate("offer-sdp") + .await + .unwrap(); + + assert_eq!(negotiation.session_id.0, "session_1"); + assert_eq!(negotiation.answer_sdp, "answer-sdp"); + } + + #[test] + fn session_identity_must_not_be_empty() { + let error = OpenAiLiveProtocol + .decode(json!({ + "type": "session.started", + "event_id": "event_started_1", + "session": { "id": " " } + })) + .unwrap_err(); + + assert!(error.to_string().contains("session.id is empty")); + } + + #[tokio::test] + async fn ready_buffers_events_before_session_started() { + let transport = Arc::new(BrowserLiveTransport::new()); + let connected = OpenAiLiveClient::new("test").connect_transport( + transport.clone(), + OpenAiLiveConnectionKind::PrimaryWebSocket, + ); + transport + .push_incoming(json!({ + "type": "session.usage.updated", + "event_id": "event_usage_1", + "usage": {} + })) + .await + .unwrap(); + transport + .push_incoming(json!({ + "type": "session.started", + "event_id": "event_started_1", + "session": { "id": "session_1" } + })) + .await + .unwrap(); + + let mut connected = connected.ready(None).await.unwrap(); + assert_eq!(connected.session_id().0, "session_1"); + assert!(matches!( + connected.recv().await.unwrap(), + LiveSessionEvent::Message(OpenAiLiveEvent { + kind: OpenAiLiveEventKind::Usage { .. }, + .. + }) + )); + } + + #[tokio::test] + async fn ready_rejects_a_different_creation_identity() { + let transport = Arc::new(BrowserLiveTransport::new()); + let starting = OpenAiLiveClient::new("test") + .connect_transport(transport.clone(), OpenAiLiveConnectionKind::MediaControl); + transport + .push_incoming(json!({ + "type": "session.started", + "event_id": "event_started_1", + "session": { "id": "session_2" } + })) + .await + .unwrap(); + + let Err(error) = starting + .ready(Some(OpenAiLiveSessionId("session_1".into()))) + .await + else { + panic!("expected a mismatched session identity"); + }; + + assert!(error.to_string().contains("creation identity")); + } + + #[tokio::test] + async fn authoritative_receiver_reports_lag() { + let transport = Arc::new(BrowserLiveTransport::new()); + let mut connected = OpenAiLiveClient::new("test") + .connect_transport( + transport.clone(), + OpenAiLiveConnectionKind::PrimaryWebSocket, + ) + .connected(OpenAiLiveSessionId("session_1".into())); + + for sequence in 0..600 { + transport + .push_incoming(json!({ "type": "future.event", "sequence": sequence })) + .await + .unwrap(); + } + + assert!(matches!(connected.recv().await, Err(RecvError::Lagged(_)))); + } + + #[test] + fn transcript_deltas_keep_role_and_timing() { + let output = json!({ + "type": "session.output_transcript.delta", + "event_id": "event_output_1", + "delta": " It's five", + "start_ms": 3200, + "end_ms": 3400 + }); + let OpenAiLiveEventKind::TranscriptDelta { + role, + delta, + start_ms, + end_ms, + .. + } = decode(output) + else { + panic!("expected transcript delta"); + }; + assert_eq!(role, Role::Assistant); + assert_eq!(delta, " It's five"); + assert_eq!((start_ms, end_ms), (3200, 3400)); + + let input = json!({ + "type": "session.input_transcript.delta", + "event_id": "event_input_1", + "delta": "What", + "start_ms": 400, + "end_ms": 600 + }); + assert!( + matches!(decode(input), OpenAiLiveEventKind::TranscriptDelta { role, .. } + if role == Role::User) + ); + } + + #[test] + fn delegation_keeps_identity_target_and_offset() { + let delegation = json!({ + "type": "session.delegation.created", + "event_id": "event_delegation_1", + "offset_ms": 800, + "delegation": { "id": "delegation_1", "type": "delegation", "target": "client" } + }); + let OpenAiLiveEventKind::DelegationCreated { delegation, .. } = decode(delegation) else { + panic!("expected delegation"); + }; + assert_eq!(delegation.id.0, "delegation_1"); + assert_eq!(delegation.target, OpenAiLiveDelegationTarget::Client); + assert_eq!(delegation.offset_ms, 800); + + let unsupported = json!({ + "type": "session.delegation.created", + "event_id": "event_delegation_2", + "offset_ms": 900, + "delegation": { "id": "delegation_2", "target": "future_target" } + }); + let OpenAiLiveEventKind::DelegationCreated { delegation, .. } = decode(unsupported) else { + panic!("expected delegation"); + }; + assert!( + matches!(delegation.target, OpenAiLiveDelegationTarget::Other(target) + if target == "future_target") + ); + } + + #[test] + fn context_acknowledgements_and_errors_preserve_correlation() { + let accepted = json!({ "type": "session.commentary.appended", "event_id": "event_accepted_1", + "client_event_id": "client_event_1", "start_ms": 800, "end_ms": 1200 }); + let rejected = json!({ "type": "error", "event_id": "event_error_1", "error": { "type": "invalid_request_error", + "code": "empty_array", "message": "content cannot be empty", "param": "content", + "client_event_id": "client_event_2" } }); + + let OpenAiLiveEventKind::ContextAppended { + channel, + client_event_id, + start_ms, + end_ms, + .. + } = decode(accepted) + else { + panic!("expected context acknowledgement"); + }; + assert!(matches!(channel, OpenAiLiveContextChannel::Commentary)); + assert_eq!(client_event_id.as_deref(), Some("client_event_1")); + assert_eq!(start_ms, 800); + assert_eq!(end_ms, 1200); + + let OpenAiLiveEventKind::Error { + error_type, + code, + message, + parameter, + client_event_id, + .. + } = decode(rejected) + else { + panic!("expected error"); + }; + assert_eq!(error_type, "invalid_request_error"); + assert_eq!(code, "empty_array"); + assert_eq!(message, "content cannot be empty"); + assert_eq!(parameter.as_deref(), Some("content")); + assert_eq!(client_event_id.as_deref(), Some("client_event_2")); + } + + #[test] + fn close_mute_and_unknown_events_preserve_semantics() { + let closed = json!({ "type": "session.closed", "event_id": "event_closed_1", + "client_event_id": "client_close_1", "reason": "close_requested", + "session": { "id": "session_1" }, "usage": { "seconds": 8 } }); + + let OpenAiLiveEventKind::SessionClosed { reason, usage, .. } = decode(closed) else { + panic!("expected session close"); + }; + assert_eq!(reason, "close_requested"); + assert_eq!(usage["seconds"], 8); + assert!(usage.get("total_tokens").is_none()); + assert!(matches!( + decode(json!({ "type": "session.input_audio.muted", "event_id": "event_muted_1" })), + OpenAiLiveEventKind::InputMuted { + client_event_id: None, + .. + } + )); + assert!(matches!( + decode(json!({ "type": "session.input_audio.unmuted", "event_id": "event_unmuted_1" })), + OpenAiLiveEventKind::InputUnmuted { + client_event_id: None, + .. + } + )); + assert!(matches!( + decode(json!({ "type": "future.event" })), + OpenAiLiveEventKind::Other { event_type } if event_type == "future.event" + )); + assert_eq!( + OpenAiLiveProtocol.encode(OpenAiLiveCommand::Close).unwrap()["type"], + "session.close" + ); + } + + #[test] + fn malformed_supported_event_is_rejected() { + let error = OpenAiLiveProtocol + .decode(json!({ + "type": "session.input_transcript.delta", + "event_id": "event_transcript_1", + "start_ms": 0, + "end_ms": 100 + })) + .unwrap_err(); + assert!(error.to_string().contains("delta")); + } + + #[test] + fn output_audio_preserves_sideband_timing() { + let event = json!({ + "type": "session.output_audio.delta", + "delta": BASE64.encode([0_u8, 1, 2]), + "start_ms": 100, + "end_ms": 200 + }); + let OpenAiLiveEventKind::OutputAudioDelta { + audio, + start_ms, + end_ms, + } = decode(event) + else { + panic!("expected output audio"); + }; + assert_eq!(audio, vec![0, 1, 2]); + assert_eq!(start_ms, Some(100)); + assert_eq!(end_ms, Some(200)); + } + + #[tokio::test] + async fn media_control_connection_rejects_primary_audio_commands() { + let transport = Arc::new(BrowserLiveTransport::new()); + let connected = OpenAiLiveClient::new("test") + .connect_transport(transport, OpenAiLiveConnectionKind::MediaControl) + .connected(OpenAiLiveSessionId("session_1".into())); + + let error = connected + .send(OpenAiLiveCommand::AppendAudio(vec![1])) + .await + .unwrap_err(); + + assert!(error.to_string().contains("only permitted")); + } + + #[test] + fn encodes_context_with_optional_delegation() { + let cases = [ + ( + OpenAiLiveContextChannel::Commentary, + Some(OpenAiLiveDelegationId("delegation_1".into())), + "session.commentary.append", + json!("delegation_1"), + ), + ( + OpenAiLiveContextChannel::Instructions, + None, + "session.instructions.append", + Value::Null, + ), + ]; + + for (channel, delegation_id, expected_type, expected_delegation_id) in cases { + let encoded = OpenAiLiveProtocol + .encode(OpenAiLiveCommand::AppendContext { + event_id: "client_event_1".into(), + delegation_id, + context: OpenAiLiveContext { + text: "context".into(), + channel, + }, + }) + .unwrap(); + assert_eq!(encoded["type"], expected_type); + assert_eq!(encoded["delegation_id"], expected_delegation_id); + assert_eq!(encoded["event_id"], "client_event_1"); + assert_eq!(encoded["content"], "context"); + } + } +} diff --git a/crates/goose-providers/src/openai_live_voice_provider.rs b/crates/goose-providers/src/openai_live_voice_provider.rs new file mode 100644 index 000000000..a500aa34e --- /dev/null +++ b/crates/goose-providers/src/openai_live_voice_provider.rs @@ -0,0 +1,308 @@ +//! OpenAI implementation of the live voice provider boundary. + +use crate::{ + live::{LiveSessionEndReason, LiveSessionEvent}, + live_voice_provider::{ + LiveVoiceInputMessage, LiveVoiceProvider, LiveVoiceProviderAvailability, + ProviderConnection, ProviderConnectionEvent, WebRtcAnswer, WebRtcOffer, + }, + openai_live::{ + ConnectedOpenAiLiveSession, OpenAiLiveClient, OpenAiLiveEvent, OpenAiLiveEventKind, + OpenAiLiveMessage, OpenAiLiveMessageRole, OpenAiLiveSessionConfig, OpenAiLiveSessionId, + }, +}; +use anyhow::{bail, Result}; +use async_trait::async_trait; +use std::time::Duration; +use tokio::{ + sync::broadcast::error::RecvError, + time::{sleep_until, timeout, timeout_at, Instant}, +}; + +pub const OPENAI_LIVE_VOICE_GATE_ENV: &str = "GOOSE_LIVE_VOICE_ENABLED"; +pub const OPENAI_LIVE_MODEL_ENV: &str = "GOOSE_LIVE_VOICE_MODEL"; +pub const OPENAI_LIVE_VOICE_ENV: &str = "GOOSE_LIVE_VOICE"; +pub const OPENAI_LIVE_API_KEY_ENV: &str = "OPENAI_API_KEY"; +pub const DEFAULT_OPENAI_LIVE_MODEL: &str = "gpt-live-1"; +pub const DEFAULT_OPENAI_LIVE_VOICE: &str = "marin"; + +const HTTP_SETUP_TIMEOUT: Duration = Duration::from_secs(15); +const SIDEBAND_ATTACH_TIMEOUT: Duration = Duration::from_secs(10); + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct OpenAiLiveVoiceConfig { + pub enabled: bool, + pub model: String, + pub voice: String, +} + +impl OpenAiLiveVoiceConfig { + pub fn from_env() -> Self { + Self { + enabled: std::env::var(OPENAI_LIVE_VOICE_GATE_ENV) + .is_ok_and(|value| value.eq_ignore_ascii_case("true") || value == "1"), + model: std::env::var(OPENAI_LIVE_MODEL_ENV) + .unwrap_or_else(|_| DEFAULT_OPENAI_LIVE_MODEL.into()), + voice: std::env::var(OPENAI_LIVE_VOICE_ENV) + .unwrap_or_else(|_| DEFAULT_OPENAI_LIVE_VOICE.into()), + } + } +} + +pub struct OpenAiLiveVoiceProvider { + client: Option, + config: OpenAiLiveVoiceConfig, +} + +impl OpenAiLiveVoiceProvider { + pub fn from_env() -> Self { + let config = OpenAiLiveVoiceConfig::from_env(); + let client = std::env::var(OPENAI_LIVE_API_KEY_ENV) + .ok() + .filter(|key| !key.trim().is_empty()) + .map(OpenAiLiveClient::new); + Self { client, config } + } + + pub fn new(api_key: impl Into, config: OpenAiLiveVoiceConfig) -> Result { + let api_key = api_key.into(); + if api_key.trim().is_empty() { + bail!("OpenAI API key is empty"); + } + Ok(Self { + client: Some(OpenAiLiveClient::new(api_key)), + config, + }) + } +} + +#[async_trait] +impl LiveVoiceProvider for OpenAiLiveVoiceProvider { + fn availability(&self) -> LiveVoiceProviderAvailability { + if !self.config.enabled { + LiveVoiceProviderAvailability::Disabled + } else if self.client.is_none() { + LiveVoiceProviderAvailability::Unavailable + } else { + LiveVoiceProviderAvailability::Ready + } + } + + async fn start( + &self, + offer: WebRtcOffer, + input_messages: Vec, + ) -> Result<(WebRtcAnswer, Box)> { + if !self.config.enabled { + bail!("OpenAI Live voice is disabled"); + } + let client = self + .client + .as_ref() + .ok_or_else(|| anyhow::anyhow!("OpenAI Live credentials are unavailable"))? + .clone(); + let config = OpenAiLiveSessionConfig { + model: self.config.model.clone(), + instructions: String::new(), + voice: Some(self.config.voice.clone()), + input_messages: input_messages + .into_iter() + .map(|message| OpenAiLiveMessage { + role: match message.role { + rmcp::model::Role::User => OpenAiLiveMessageRole::User, + rmcp::model::Role::Assistant => OpenAiLiveMessageRole::Assistant, + }, + text: message.text, + }) + .collect(), + extra_session_fields: Default::default(), + }; + let negotiation = timeout( + HTTP_SETUP_TIMEOUT, + client.webrtc(config).negotiate(offer.into_sdp()), + ) + .await + .map_err(|_| anyhow::anyhow!("OpenAI Live HTTP setup timed out"))??; + let session_id = negotiation.session_id; + let answer = WebRtcAnswer::new(negotiation.answer_sdp) + .ok_or_else(|| anyhow::anyhow!("OpenAI Live returned an invalid WebRTC answer"))?; + let sideband = connect_sideband(&client, session_id).await?; + Ok((answer, Box::new(OpenAiProviderConnection { sideband }))) + } +} + +struct OpenAiProviderConnection { + sideband: ConnectedOpenAiLiveSession, +} + +#[async_trait] +impl ProviderConnection for OpenAiProviderConnection { + async fn next_event(&mut self) -> ProviderConnectionEvent { + loop { + if let Some(event) = provider_connection_event(self.sideband.recv().await) { + return event; + } + } + } + + async fn stop(&mut self) -> Result<()> { + self.sideband.close().await + } +} + +fn provider_connection_event( + event: std::result::Result, RecvError>, +) -> Option { + match event { + Ok(LiveSessionEvent::Message(event)) => match event.kind { + OpenAiLiveEventKind::TranscriptDelta { + event_id, + role, + delta, + .. + } => Some(ProviderConnectionEvent::TranscriptDelta { + event_id, + role, + text: delta, + }), + OpenAiLiveEventKind::SessionClosed { .. } => Some(ProviderConnectionEvent::Closed), + _ => None, + }, + Ok(LiveSessionEvent::Ended { + reason: LiveSessionEndReason::Closed, + error: None, + }) => Some(ProviderConnectionEvent::Closed), + Err(RecvError::Lagged(_)) => Some(ProviderConnectionEvent::ReceiverLagged), + Ok(LiveSessionEvent::Ended { .. }) | Err(RecvError::Closed) => { + Some(ProviderConnectionEvent::Failed) + } + } +} + +async fn connect_sideband( + client: &OpenAiLiveClient, + session_id: OpenAiLiveSessionId, +) -> Result { + let deadline = Instant::now() + SIDEBAND_ATTACH_TIMEOUT; + loop { + match timeout_at( + deadline, + client.existing_session(session_id.clone()).connect(), + ) + .await + { + Ok(Ok(sideband)) => return Ok(sideband), + Ok(Err(error)) => { + let retry_at = Instant::now() + Duration::from_millis(200); + if retry_at >= deadline { + return Err(error); + } + sleep_until(retry_at).await; + } + Err(_) => bail!("OpenAI Live sideband attachment timed out"), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn configuration_is_gated() { + let provider = OpenAiLiveVoiceProvider::new( + "key", + OpenAiLiveVoiceConfig { + enabled: false, + model: DEFAULT_OPENAI_LIVE_MODEL.into(), + voice: DEFAULT_OPENAI_LIVE_VOICE.into(), + }, + ) + .unwrap(); + assert_eq!( + provider.availability(), + LiveVoiceProviderAvailability::Disabled + ); + } + + #[test] + fn maps_live_voice_observations() { + let message = |kind| { + Ok(LiveSessionEvent::Message(OpenAiLiveEvent { + kind, + raw: None, + })) + }; + let cases = [ + ( + message(OpenAiLiveEventKind::TranscriptDelta { + event_id: "event_transcript_1".into(), + client_event_id: None, + role: rmcp::model::Role::Assistant, + delta: "hello".into(), + start_ms: 10, + end_ms: 20, + }), + Some(ProviderConnectionEvent::TranscriptDelta { + event_id: "event_transcript_1".into(), + role: rmcp::model::Role::Assistant, + text: "hello".into(), + }), + ), + ( + message(OpenAiLiveEventKind::SessionClosed { + event_id: "event_closed_1".into(), + client_event_id: Some("client_close_1".into()), + reason: "close_requested".into(), + session: serde_json::json!({ "id": "session_1" }), + usage: serde_json::json!({ "seconds": 1 }), + }), + Some(ProviderConnectionEvent::Closed), + ), + ( + message(OpenAiLiveEventKind::Error { + event_id: "event_error_1".into(), + error_type: "server_error".into(), + code: "provider_failed".into(), + message: "provider failed".into(), + parameter: None, + client_event_id: None, + }), + None, + ), + ( + Ok(LiveSessionEvent::Ended { + reason: LiveSessionEndReason::Closed, + error: None, + }), + Some(ProviderConnectionEvent::Closed), + ), + ( + Ok(LiveSessionEvent::Ended { + reason: LiveSessionEndReason::TransportFailed, + error: None, + }), + Some(ProviderConnectionEvent::Failed), + ), + ( + Err(RecvError::Lagged(1)), + Some(ProviderConnectionEvent::ReceiverLagged), + ), + ( + Err(RecvError::Closed), + Some(ProviderConnectionEvent::Failed), + ), + ( + message(OpenAiLiveEventKind::InputMuted { + event_id: "event_muted_1".into(), + client_event_id: None, + }), + None, + ), + ]; + + for (event, expected) in cases { + assert_eq!(provider_connection_event(event), expected); + } + } +} diff --git a/crates/goose-providers/tests/live_session.rs b/crates/goose-providers/tests/live_session.rs new file mode 100644 index 000000000..c5d0f0666 --- /dev/null +++ b/crates/goose-providers/tests/live_session.rs @@ -0,0 +1,396 @@ +use anyhow::{anyhow, Result}; +use async_trait::async_trait; +use goose_providers::live::{ + LiveProtocol, LiveSession, LiveSessionEndReason, LiveSessionEvent, LiveTransport, +}; +use serde_json::{json, Value}; +use std::sync::{ + atomic::{AtomicUsize, Ordering}, + Arc, +}; +use tokio::sync::{mpsc, Mutex}; + +#[derive(Clone, Debug, PartialEq, Eq)] +enum TestEvent { + Message(String), + Closed, +} + +struct TestProtocol { + graceful: bool, +} + +impl LiveProtocol for TestProtocol { + type Command = String; + type Event = TestEvent; + + fn encode(&self, command: Self::Command) -> Result { + if command == "invalid" { + return Err(anyhow!("invalid command")); + } + Ok(json!({ "text": command })) + } + + fn decode(&self, message: Value) -> Result { + let text = message + .get("text") + .and_then(Value::as_str) + .ok_or_else(|| anyhow!("missing text"))?; + Ok(if text == "closed" { + TestEvent::Closed + } else { + TestEvent::Message(text.to_owned()) + }) + } + + fn close_command(&self) -> Option { + self.graceful.then(|| "close".to_string()) + } + + fn is_close_acknowledgement(&self, event: &Self::Event) -> bool { + matches!(event, TestEvent::Closed) + } +} + +struct TestTransport { + incoming: Mutex>>>, + sent: mpsc::UnboundedSender, + closes: Arc, + stall_sends: bool, +} + +/// Test-side handles for driving and observing a `TestTransport`. +struct Controls { + incoming: mpsc::Sender>>, + sent: mpsc::UnboundedReceiver, + closes: Arc, +} + +impl Controls { + fn close_count(&self) -> usize { + self.closes.load(Ordering::SeqCst) + } +} + +impl TestTransport { + fn new() -> (Arc, Controls) { + Self::with_stalled_sends(false) + } + + fn with_stalled_sends(stall_sends: bool) -> (Arc, Controls) { + let (incoming_tx, incoming_rx) = mpsc::channel(16); + let (sent_tx, sent_rx) = mpsc::unbounded_channel(); + let closes = Arc::new(AtomicUsize::new(0)); + let transport = Arc::new(Self { + incoming: Mutex::new(incoming_rx), + sent: sent_tx, + closes: closes.clone(), + stall_sends, + }); + let controls = Controls { + incoming: incoming_tx, + sent: sent_rx, + closes, + }; + (transport, controls) + } +} + +#[async_trait] +impl LiveTransport for TestTransport { + async fn send(&self, message: Value) -> Result<()> { + if self.stall_sends { + return std::future::pending().await; + } + self.sent.send(message)?; + Ok(()) + } + + async fn receive(&self) -> Result> { + match self.incoming.lock().await.recv().await { + Some(result) => result, + None => Ok(None), + } + } + + async fn close(&self) -> Result<()> { + self.closes.fetch_add(1, Ordering::SeqCst); + Ok(()) + } +} + +fn session(graceful: bool) -> (LiveSession, Controls) { + let (transport, controls) = TestTransport::new(); + let (session, _events) = LiveSession::connect(Arc::new(TestProtocol { graceful }), transport); + (session, controls) +} + +#[tokio::test] +async fn transport_failure_is_reported_not_swallowed() { + let (session, controls) = session(true); + let mut events = session.subscribe(); + + controls + .incoming + .send(Err(anyhow!("socket exploded"))) + .await + .unwrap(); + + match events.recv().await.unwrap() { + LiveSessionEvent::Ended { reason, error } => { + assert_eq!(reason, LiveSessionEndReason::TransportFailed); + assert_eq!(error.unwrap().to_string(), "socket exploded"); + } + other => panic!("expected Ended, got {other:?}"), + } + assert_eq!( + session.end_reason(), + Some(LiveSessionEndReason::TransportFailed) + ); +} + +#[tokio::test] +async fn decode_failure_is_reported_not_swallowed() { + let (session, controls) = session(true); + let mut events = session.subscribe(); + + controls + .incoming + .send(Ok(Some(json!({ "nope": 1 })))) + .await + .unwrap(); + + match events.recv().await.unwrap() { + LiveSessionEvent::Ended { reason, error } => { + assert_eq!(reason, LiveSessionEndReason::DecodeFailed); + assert!(error.is_some()); + } + other => panic!("expected Ended, got {other:?}"), + } +} + +#[tokio::test] +async fn clean_transport_shutdown_is_not_a_graceful_acknowledgement() { + let (session, mut controls) = session(true); + let mut events = session.subscribe(); + + let close = session.close(); + let disconnect = async { + controls.sent.recv().await.unwrap(); + controls.incoming.send(Ok(None)).await.unwrap(); + }; + let (result, ()) = tokio::join!(close, disconnect); + assert!(result.is_err()); + + match events.recv().await.unwrap() { + LiveSessionEvent::Ended { reason, error } => { + assert_eq!(reason, LiveSessionEndReason::TransportClosed); + assert!(error.is_none()); + } + other => panic!("expected Ended, got {other:?}"), + } +} + +#[tokio::test] +async fn close_sends_protocol_close_command_then_closes_transport() { + let (session, mut controls) = session(true); + let mut events = session.subscribe(); + + let close = tokio::spawn({ + let session = session.clone(); + async move { session.close().await } + }); + + assert_eq!( + controls.sent.recv().await.unwrap(), + json!({ "text": "close" }) + ); + controls + .incoming + .send(Ok(Some(json!({ "text": "final message" })))) + .await + .unwrap(); + controls + .incoming + .send(Ok(Some(json!({ "text": "closed" })))) + .await + .unwrap(); + + close.await.unwrap().unwrap(); + + assert!(matches!( + events.recv().await.unwrap(), + LiveSessionEvent::Message(TestEvent::Message(message)) if message == "final message" + )); + assert!(matches!( + events.recv().await.unwrap(), + LiveSessionEvent::Message(TestEvent::Closed) + )); + assert_eq!(controls.close_count(), 1); + assert_eq!(session.end_reason(), Some(LiveSessionEndReason::Closed)); +} + +#[tokio::test] +async fn close_without_protocol_command_only_closes_transport() { + let (session, mut controls) = session(false); + + session.close().await.unwrap(); + + assert!(controls.sent.try_recv().is_err()); + assert_eq!(controls.close_count(), 1); +} + +#[tokio::test] +async fn close_is_idempotent() { + let (session, controls) = session(false); + + session.close().await.unwrap(); + session.close().await.unwrap(); + + assert_eq!(controls.close_count(), 1); + assert_eq!(session.end_reason(), Some(LiveSessionEndReason::Closed)); +} + +#[tokio::test] +async fn concurrent_close_has_one_owner() { + let (session, mut controls) = session(true); + let first = tokio::spawn({ + let session = session.clone(); + async move { session.close().await } + }); + + assert_eq!( + controls.sent.recv().await.unwrap(), + json!({ "text": "close" }) + ); + + let second = tokio::spawn({ + let session = session.clone(); + async move { session.close().await } + }); + tokio::task::yield_now().await; + assert!(controls.sent.try_recv().is_err()); + + controls + .incoming + .send(Ok(Some(json!({ "text": "closed" })))) + .await + .unwrap(); + + tokio::time::timeout(std::time::Duration::from_secs(2), first) + .await + .expect("owner timed out") + .unwrap() + .unwrap(); + tokio::time::timeout(std::time::Duration::from_secs(2), second) + .await + .expect("waiter timed out") + .unwrap() + .unwrap(); + assert_eq!(controls.close_count(), 1); +} + +#[tokio::test] +async fn send_after_end_fails() { + let (session, controls) = session(true); + let mut events = session.subscribe(); + + controls.incoming.send(Ok(None)).await.unwrap(); + events.recv().await.unwrap(); + + assert!(session.send("hello".into()).await.is_err()); +} + +#[tokio::test] +async fn invalid_command_does_not_end_a_healthy_session() { + let (session, mut controls) = session(false); + + let error = session.send("invalid".into()).await.unwrap_err(); + assert_eq!(error.to_string(), "invalid command"); + assert_eq!(session.end_reason(), None); + + session.send("valid".into()).await.unwrap(); + assert_eq!( + controls.sent.recv().await.unwrap(), + json!({ "text": "valid" }) + ); + session.close().await.unwrap(); +} + +#[tokio::test(start_paused = true)] +async fn stalled_send_times_out_and_releases_transport() { + let (transport, controls) = TestTransport::with_stalled_sends(true); + let (session, mut events) = + LiveSession::connect(Arc::new(TestProtocol { graceful: true }), transport); + + let error = session.send("blocked".into()).await.unwrap_err(); + assert_eq!(error.to_string(), "live transport send timed out"); + + match events.recv().await.unwrap() { + LiveSessionEvent::Ended { reason, error } => { + assert_eq!(reason, LiveSessionEndReason::TransportFailed); + assert_eq!(error.unwrap().to_string(), "live transport send timed out"); + } + other => panic!("expected Ended, got {other:?}"), + } + assert_eq!(controls.close_count(), 1); +} + +#[tokio::test(start_paused = true)] +async fn missing_close_acknowledgement_is_reported_as_timeout() { + let (session, mut controls) = session(true); + + let close = tokio::spawn({ + let session = session.clone(); + async move { session.close().await } + }); + assert_eq!( + controls.sent.recv().await.unwrap(), + json!({ "text": "close" }) + ); + + let error = close.await.unwrap().unwrap_err(); + assert_eq!( + error.to_string(), + "live session close acknowledgement timed out" + ); + assert_eq!( + session.end_reason(), + Some(LiveSessionEndReason::CloseTimedOut) + ); + assert_eq!(controls.close_count(), 1); +} + +#[tokio::test] +async fn messages_are_delivered_before_end() { + let (session, controls) = session(true); + let mut events = session.subscribe(); + + controls + .incoming + .send(Ok(Some(json!({ "text": "hi" })))) + .await + .unwrap(); + controls.incoming.send(Ok(None)).await.unwrap(); + + assert!(matches!( + events.recv().await.unwrap(), + LiveSessionEvent::Message(TestEvent::Message(text)) if text == "hi" + )); + assert!(matches!( + events.recv().await.unwrap(), + LiveSessionEvent::Ended { .. } + )); +} + +#[tokio::test] +async fn dropping_session_stops_actor() { + let (transport, controls) = TestTransport::new(); + let (session, events) = + LiveSession::connect(Arc::new(TestProtocol { graceful: true }), transport); + drop(session); + drop(events); + + tokio::time::sleep(std::time::Duration::from_millis(50)).await; + assert!(controls.close_count() >= 1); +} diff --git a/crates/goose-providers/tests/live_websocket.rs b/crates/goose-providers/tests/live_websocket.rs new file mode 100644 index 000000000..b4dfb74cf --- /dev/null +++ b/crates/goose-providers/tests/live_websocket.rs @@ -0,0 +1,58 @@ +#![cfg(feature = "live-websocket")] + +use anyhow::Result; +use futures::{SinkExt, StreamExt}; +use goose_providers::openai_live::{OpenAiLiveClient, OpenAiLiveSessionConfig}; +use serde_json::{json, Value}; +use tokio::net::TcpListener; +use tokio_tungstenite::{accept_hdr_async, tungstenite::Message}; + +#[tokio::test] +#[allow(clippy::result_large_err)] +async fn websocket_connect_performs_handshake_and_waits_until_ready() -> Result<()> { + let listener = TcpListener::bind("127.0.0.1:0").await?; + let address = listener.local_addr()?; + let server = tokio::spawn(async move { + let (stream, _) = listener.accept().await.unwrap(); + let mut socket = accept_hdr_async(stream, |request: &http::Request<()>, response| { + assert_eq!(request.headers()["authorization"], "Bearer test-key"); + Ok(response) + }) + .await + .unwrap(); + let message = socket.next().await.unwrap().unwrap(); + let Message::Text(text) = message else { + panic!("expected initial text message"); + }; + let session_start: Value = serde_json::from_str(&text).unwrap(); + assert_eq!(session_start["type"], "session.start"); + socket + .send(Message::Text( + json!({ + "type": "session.started", + "event_id": "event_started_1", + "session": { "id": "session_1" } + }) + .to_string() + .into(), + )) + .await + .unwrap(); + }); + + let connected = OpenAiLiveClient::new("test-key") + .with_websocket_endpoint(format!("ws://{address}/v1/live/sessions")) + .websocket(OpenAiLiveSessionConfig { + model: "gpt-live-test".into(), + instructions: "test".into(), + voice: None, + input_messages: vec![], + extra_session_fields: Default::default(), + }) + .connect() + .await?; + + let _connected = connected; + server.await?; + Ok(()) +} diff --git a/crates/goose/Cargo.toml b/crates/goose/Cargo.toml index ebeb2e89b..04b043bb4 100644 --- a/crates/goose/Cargo.toml +++ b/crates/goose/Cargo.toml @@ -155,14 +155,14 @@ sqlx = { version = "0.9.0", default-features = false, features = [ ] } # For Bedrock provider (optional, behind "aws-providers" feature) -aws-config = { version = "1.8", default-features = false, features = ["credentials-process", "rt-tokio", "sso", "behavior-version-latest"], optional = true } -aws-smithy-types = { version = "1.3.4", default-features = false, features = ["rt-tokio"], optional = true } -aws-sdk-bedrockruntime = { version = "1.132", default-features = false, features = ["rt-tokio"], optional = true } -aws-smithy-runtime-api = { version = "1.13", default-features = false, features = ["client"], optional = true } +aws-config = { version = "=1.12.0", default-features = false, features = ["credentials-process", "rt-tokio", "sso", "behavior-version-latest"], optional = true } +aws-smithy-types = { version = "=1.6.3", default-features = false, features = ["rt-tokio"], optional = true } +aws-sdk-bedrockruntime = { version = "=1.143.0", default-features = false, features = ["rt-tokio"], optional = true } +aws-smithy-runtime-api = { version = "=1.16.0", default-features = false, features = ["client"], optional = true } smithy-transport-reqwest = { version = "0.1", default-features = false, features = ["http2", "system-proxy"], optional = true } # For SageMaker TGI provider (optional, behind "aws-providers" feature) -aws-sdk-sagemakerruntime = { version = "1.104", default-features = false, features = ["rt-tokio"], optional = true } +aws-sdk-sagemakerruntime = { version = "=1.113.0", default-features = false, features = ["rt-tokio"], optional = true } # For GCP Vertex AI provider auth jsonwebtoken = { version = "11.0", default-features = false, features = ["use_pem"] }