feat: expand api snapshots and schema tooling

This commit is contained in:
Nathan Flurry 2026-01-26 00:13:17 -08:00
parent ee014b0838
commit 011ca27287
72 changed files with 29480 additions and 1081 deletions

View file

@ -0,0 +1,12 @@
[package]
name = "sandbox-agent-universal-schema-gen"
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
build = "build.rs"
[build-dependencies]
sandbox-agent-universal-agent-schema.workspace = true
schemars.workspace = true
serde_json.workspace = true

View file

@ -0,0 +1,26 @@
use std::{fs, path::Path};
fn main() {
println!("cargo:rerun-if-changed=../universal-agent-schema/src/lib.rs");
let schema = schemars::schema_for!(sandbox_agent_universal_agent_schema::UniversalEvent);
let workspace_root = std::env::var("CARGO_MANIFEST_DIR")
.map(|dir| {
Path::new(&dir)
.parent()
.unwrap()
.parent()
.unwrap()
.parent()
.unwrap()
.to_path_buf()
})
.unwrap();
let out_dir = workspace_root.join("spec");
fs::create_dir_all(&out_dir).unwrap();
let json = serde_json::to_string_pretty(&schema).expect("Failed to serialize JSON schema");
fs::write(out_dir.join("universal-schema.json"), json)
.expect("Failed to write universal-schema.json");
}

View file

@ -0,0 +1,2 @@
// This crate exists only to trigger the build.rs script
// which generates the universal JSON schema at build time.