diff --git a/core/Cargo.lock b/core/Cargo.lock index 5ef0dcd..5874107 100644 --- a/core/Cargo.lock +++ b/core/Cargo.lock @@ -47,7 +47,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -58,7 +58,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -73,6 +73,12 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + [[package]] name = "bitflags" version = "2.13.2" @@ -94,6 +100,12 @@ version = "3.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" +[[package]] +name = "bytes" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c" + [[package]] name = "cc" version = "1.10.0" @@ -188,7 +200,7 @@ checksum = "e0b1fab2ae45819af2d0731d60f2afe17227ebb1a1538a236da84c93e9a60162" dependencies = [ "dispatch2", "nix", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -226,10 +238,12 @@ dependencies = [ "humantime", "libc", "schemars", + "semver", "serde", "serde_json", "serde_yaml", "tempfile", + "ureq", "uuid", "which", ] @@ -247,7 +261,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -286,6 +300,17 @@ dependencies = [ "slab", ] +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "getrandom" version = "0.4.3" @@ -309,6 +334,22 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + [[package]] name = "humantime" version = "2.4.0" @@ -444,6 +485,12 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + [[package]] name = "pin-project-lite" version = "0.2.17" @@ -494,6 +541,20 @@ dependencies = [ "syn 3.0.9", ] +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rustix" version = "1.1.6" @@ -504,7 +565,42 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "102f35f7de7b06d8c61f1cff6592f5253e0dea431c74867aad5dfd70f44663fb" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a0760a887c14823fca5a1c970b01d47c328c696c0c64829d1df50e8f853fd5" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] @@ -545,6 +641,12 @@ dependencies = [ "syn 3.0.9", ] +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + [[package]] name = "serde" version = "1.0.229" @@ -630,6 +732,12 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.119" @@ -659,10 +767,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom", + "getrandom 0.4.3", "once_cell", "rustix", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -677,6 +785,46 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "ureq" +version = "3.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ac5cecf619ca81f66a96482db09687c9f7465af65f4300a8c30cca05bd5a59d" +dependencies = [ + "base64", + "log", + "percent-encoding", + "rustls", + "rustls-pki-types", + "ureq-proto", + "utf8-zero", + "webpki-roots", +] + +[[package]] +name = "ureq-proto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622dce33c252115466d83f63e9744a18f12b4406aae51a01c15ad8fcf1185eb3" +dependencies = [ + "base64", + "http", + "httparse", + "log", +] + +[[package]] +name = "utf8-zero" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" + [[package]] name = "utf8parse" version = "0.2.2" @@ -689,11 +837,17 @@ version = "1.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514" dependencies = [ - "getrandom", + "getrandom 0.4.3", "js-sys", "wasm-bindgen", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasm-bindgen" version = "0.2.130" @@ -738,6 +892,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "webpki-roots" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7265c9301c16a8711c992c2d8da90ee77ef54b1ed51482d6dfeb00dc756b1297" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "which" version = "8.0.6" @@ -806,6 +969,15 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-sys" version = "0.61.2" @@ -815,6 +987,76 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "zeroize" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa" + [[package]] name = "zmij" version = "1.0.23" diff --git a/core/Cargo.toml b/core/Cargo.toml index 3678832..bc4d6aa 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -22,9 +22,12 @@ dotenvy = { git = "https://github.com/allan2/dotenvy", rev = "cf125ddeb263c234ad humantime = "2" libc = "0.2" schemars = { version = "1", features = ["chrono04"] } +semver = "1" serde = { version = "1", features = ["derive"] } serde_json = "1" serde_yaml = "0.9" tempfile = "3" +# For the notice when a newer release is out. +ureq = { version = "3", default-features = false, features = ["rustls"] } uuid = { version = "1", features = ["v4"] } which = "8" diff --git a/core/PROTOCOL.md b/core/PROTOCOL.md index ba4cc6a..28ad559 100644 --- a/core/PROTOCOL.md +++ b/core/PROTOCOL.md @@ -20,12 +20,12 @@ eac writes requests to the process's **fd 3** and reads responses from its **fd **Ready line.** -The first line a process writes to fd 4 is its ready line, which says which protocol version it speaks. After that, every line is the response to the request eac just sent, carrying that request's `id`. eac stops with an error on any other line. +The first line a process writes to fd 4 is its ready line, which says which protocol version it speaks. It can also give the SDK's language and version, so eac can say when a newer release is out. After that, every line is the response to the request eac just sent, carrying that request's `id`. eac stops with an error on any other line. ```jsonc -{"protocol": 1} // ready line -{"id": 1, "method": "discover", "params": {...}} // request -{"id": 1, "result": {...}} // response +{"protocol": 1, "sdk": {"language": "Python", "version": "0.0.1"}} // ready line +{"id": 1, "method": "discover", "params": {...}} // request +{"id": 1, "result": {...}} // response {"id": 1, "error": {"message": "...", "traceback": "..."}} ``` diff --git a/core/src/main.rs b/core/src/main.rs index 6bbb3b8..8167ed5 100644 --- a/core/src/main.rs +++ b/core/src/main.rs @@ -5,6 +5,7 @@ mod cli; mod commands; mod eac; mod schema; +mod update; mod worker; use std::process::ExitCode; @@ -15,7 +16,21 @@ use cli::Cli; use commands::FailedRun; fn main() -> ExitCode { - let args = Cli::parse(); + let update = update::start(); + let code = run(); + update::finish(update); + code +} + +fn run() -> ExitCode { + let args = match Cli::try_parse() { + Ok(args) => args, + // --help, --version or a usage error. + Err(e) => { + let _ = e.print(); + return ExitCode::from(e.exit_code() as u8); + } + }; let _ = ctrlc::set_handler(worker::interrupt); match cli::dispatch(args.command) { Ok(()) => ExitCode::SUCCESS, diff --git a/core/src/schema/framing.rs b/core/src/schema/framing.rs index 76ca166..8642c96 100644 --- a/core/src/schema/framing.rs +++ b/core/src/schema/framing.rs @@ -52,4 +52,14 @@ impl std::error::Error for Error {} pub struct Ready { #[schemars(extend("const" = VERSION))] pub protocol: i64, + #[serde(default)] + pub sdk: Option, +} + +/// The SDK package a worker runs on. +#[derive(Deserialize, JsonSchema)] +pub struct Sdk { + /// As shown to users, e.g. "Python". + pub language: String, + pub version: String, } diff --git a/core/src/schema/protocol.schema.json b/core/src/schema/protocol.schema.json index e6e65ed..b5fc597 100644 --- a/core/src/schema/protocol.schema.json +++ b/core/src/schema/protocol.schema.json @@ -528,6 +528,16 @@ "properties": { "protocol": { "const": 1 + }, + "sdk": { + "anyOf": [ + { + "$ref": "#/$defs/Sdk" + }, + { + "type": "null" + } + ] } }, "required": [ @@ -623,6 +633,23 @@ ], "type": "object" }, + "Sdk": { + "description": "The SDK package a worker runs on.", + "properties": { + "language": { + "description": "As shown to users, e.g. \"Python\".", + "type": "string" + }, + "version": { + "type": "string" + } + }, + "required": [ + "language", + "version" + ], + "type": "object" + }, "Seed": { "description": "A fixture. Seeds with the same `key`, a content hash, are set up once and shared.", "properties": { diff --git a/core/src/update.rs b/core/src/update.rs new file mode 100644 index 0000000..853938d --- /dev/null +++ b/core/src/update.rs @@ -0,0 +1,104 @@ +//! Says when a newer eac release is out than the CLI or an SDK a worker ran +//! on. The latest release is looked up on a thread while the command runs, and +//! only reported if the lookup finished by the end. Skipped in CI, when stderr +//! isn't a terminal, or with EAC_NO_UPDATE_CHECK set. + +use std::collections::BTreeMap; +use std::io::IsTerminal; +use std::sync::mpsc::{self, Receiver}; +use std::sync::Mutex; +use std::thread; + +use semver::Version; + +use crate::schema::Sdk; + +/// Redirects to the latest release's page, /releases/tag/. +const LATEST: &str = "https://github.com/getsentry/eac/releases/latest"; + +/// Each SDK version workers reported, by language. +static SDKS: Mutex> = Mutex::new(BTreeMap::new()); + +/// Notes the SDK a worker runs on, from its ready line. +pub fn saw_sdk(sdk: &Sdk) { + let mut sdks = SDKS.lock().unwrap_or_else(|e| e.into_inner()); + sdks.insert(sdk.language.clone(), sdk.version.clone()); +} + +/// Starts looking up the latest release's version. +pub fn start() -> Option> { + let set = |name| std::env::var_os(name).is_some_and(|v| !v.is_empty()); + if set("EAC_NO_UPDATE_CHECK") || set("CI") || !std::io::stderr().is_terminal() { + return None; + } + let (tx, rx) = mpsc::channel(); + thread::spawn(move || { + if let Some(version) = latest() { + let _ = tx.send(version); + } + }); + Some(rx) +} + +/// Prints what's older than the latest release, if the lookup has finished. +pub fn finish(latest: Option>) { + let Some(latest) = latest.and_then(|rx| rx.try_recv().ok()) else { return }; + let sdks = SDKS.lock().unwrap_or_else(|e| e.into_inner()).clone(); + let outdated = outdated(&latest, env!("CARGO_PKG_VERSION"), &sdks); + if outdated.is_empty() { + return; + } + eprintln!(); + warning!("There's a new version of eac:"); + for line in outdated { + warning!(" {line}"); + } + detail!("{LATEST}"); +} + +fn latest() -> Option { + let agent: ureq::Agent = ureq::Agent::config_builder().max_redirects(0).build().into(); + let response = agent.head(LATEST).call().ok()?; + let location = response.headers().get("location")?.to_str().ok()?; + let (_, tag) = location.rsplit_once("/tag/")?; + Version::parse(tag.trim_start_matches('v')).ok() +} + +/// A line for the CLI and each SDK older than latest. +fn outdated(latest: &Version, cli: &str, sdks: &BTreeMap) -> Vec { + let older = |version: &str| Version::parse(version).is_ok_and(|v| v < *latest); + let mut lines = Vec::new(); + if older(cli) { + lines.push(format!("CLI {latest} is out, you are using {cli}")); + } + for (language, version) in sdks { + if older(version) { + lines.push(format!("{language} SDK {latest} is out, you are using {version}")); + } + } + lines +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn a_line_for_whatever_is_older() { + let latest = Version::new(0, 2, 0); + let sdks = BTreeMap::from([("Python".to_string(), "0.1.0".to_string())]); + assert_eq!( + outdated(&latest, "0.1.0", &sdks), + [ + "CLI 0.2.0 is out, you are using 0.1.0", + "Python SDK 0.2.0 is out, you are using 0.1.0", + ] + ); + // Up to date, or a build from main ahead of the release. + assert_eq!( + outdated(&latest, "0.2.0", &sdks), + ["Python SDK 0.2.0 is out, you are using 0.1.0"] + ); + assert!(outdated(&latest, "0.3.0", &BTreeMap::new()).is_empty()); + } +} diff --git a/core/src/worker/process.rs b/core/src/worker/process.rs index 3d744cf..dc5a11d 100644 --- a/core/src/worker/process.rs +++ b/core/src/worker/process.rs @@ -61,7 +61,7 @@ impl Worker { Ok(worker) } - /// Waits for the ready line and checks its protocol version. + /// Waits for the ready line, checks its protocol version and notes its SDK. fn ready(&self) -> Result<()> { let ready = match self.responses.next_line() { Ok(line) => line.and_then(|l| serde_json::from_str::(&l).ok()), @@ -71,6 +71,11 @@ impl Worker { let Some(ready) = ready else { bail!("{} exited before it was ready; see its output above", self.label); }; + // Before the protocol check, since an SDK on another protocol most + // needs the notice that a newer release is out. + if let Some(sdk) = &ready.sdk { + crate::update::saw_sdk(sdk); + } if ready.protocol != VERSION { bail!( "{} speaks protocol v{}, CLI speaks v{VERSION}: upgrade it", diff --git a/docs/app/cli/page.mdx b/docs/app/cli/page.mdx index 026ece2..4477502 100644 --- a/docs/app/cli/page.mdx +++ b/docs/app/cli/page.mdx @@ -48,3 +48,7 @@ Run `eac --help` any time for the full list. ## Exit codes `0` means no case failed or errored, `1` means one did, and `2` means eac itself hit a problem. `eac --version` prints the version. + +## Updates + +When a newer eac release is out than your CLI or the SDK your evals run on, eac says so after a command's output. It looks up the latest [GitHub release](https://github.com/getsentry/eac/releases). `EAC_NO_UPDATE_CHECK=1` turns this check off. diff --git a/docs/app/protocol/page.mdx b/docs/app/protocol/page.mdx index 4a2b0fc..e9c4192 100644 --- a/docs/app/protocol/page.mdx +++ b/docs/app/protocol/page.mdx @@ -9,7 +9,7 @@ You only need this page if you're adding support for a new language. If you just eac starts a worker process for your language and talks to it with JSON, one message per line: - Requests come in on **fd 3** and responses go out on **fd 4**, so stdout and stderr stay free for logs. -- The worker's first line says which protocol it speaks: `{"protocol": 1}`. +- The worker's first line says which protocol it speaks, and optionally its SDK's language and version, so eac can tell users when it's out of date: `{"protocol": 1, "sdk": {"language": "Python", "version": "0.0.1"}}`. - eac sends one request at a time and waits for the answer. - When eac closes fd 3, the worker should exit. diff --git a/sdks/python/eac/protocol.py b/sdks/python/eac/protocol.py index b165056..c91978d 100644 --- a/sdks/python/eac/protocol.py +++ b/sdks/python/eac/protocol.py @@ -211,6 +211,7 @@ class Ready(TypedDict): """The first line a worker sends.""" protocol: Literal[1] + sdk: NotRequired[Sdk | None] class Request(TypedDict): @@ -237,6 +238,14 @@ class Score(TypedDict): score: NotRequired[float | None] +class Sdk(TypedDict): + """The SDK package a worker runs on.""" + + #: As shown to users, e.g. "Python". + language: str + version: str + + class Seed(TypedDict): """A fixture. Seeds with the same `key`, a content hash, are set up once and shared. """ diff --git a/sdks/python/eac/worker.py b/sdks/python/eac/worker.py index 2975c25..4bee89d 100644 --- a/sdks/python/eac/worker.py +++ b/sdks/python/eac/worker.py @@ -22,6 +22,7 @@ from typing import Any, BinaryIO, Callable, Iterable, Sequence, cast from eac import protocol as wire +from eac._version import __version__ from eac.credential import Credential from eac.judge import Judge from eac.models import AgentRun, AgentTrace, Case, LLMMetrics, Score, Window, stable_hash @@ -46,7 +47,7 @@ def __init__(self, requests: BinaryIO, out: BinaryIO): self._datasets: dict[str, LoadedDataset] = {} def serve(self) -> None: - self._send({"protocol": wire.PROTOCOL_VERSION}) + self._send({"protocol": wire.PROTOCOL_VERSION, "sdk": {"language": "Python", "version": __version__}}) for line in self._requests: self._respond(line)