Precompute app-server protocol exports (#36212)

## Why

Normal app-server protocol builds do not need the `ts-rs` and `schemars`
implementations used to generate schema exports.

## What changed

- Embed compressed stable and experimental TypeScript and JSON schema exports,
  and serve the existing export APIs from those artifacts.
- Use no-op schema derives in non-test builds while keeping the real generators
  available for fixture regeneration and tests.
- Move schema fixture regeneration behind a Python helper and update
  `just write-app-server-schema --experimental` to refresh the experimental
  embedded exports.

## Testing

- Verify embedded exports match freshly generated stable and experimental
  schemas.
- Verify export options and on-disk output remain compatible.

GitOrigin-RevId: e8536338b457e6eec34bdf29ec0684144bd13734
This commit is contained in:
Michael Bolin authored and copyberry committed 2026-07-30 19:47:30 +00:00
1 parent 0042b00986
commit acd540f158
50 files changed
+720 -181

No files matched your search

+30 -9
View File
@@ -1,17 +1,26 @@
mod experimental_api;
#[cfg(test)]
mod export;
mod precomputed_exports;
#[cfg(test)]
#[path = "precomputed_exports_tests.rs"]
mod precomputed_exports_tests;
mod protocol;
pub mod rpc;
#[cfg(test)]
mod schema_fixtures;
#[cfg(test)]
#[path = "schema_fixtures_tests.rs"]
mod schema_fixtures_tests;
pub use experimental_api::*;
pub use export::GenerateTsOptions;
pub use export::generate_internal_json_schema;
pub use export::generate_json;
pub use export::generate_json_with_experimental;
pub use export::generate_ts;
pub use export::generate_ts_with_options;
pub use export::generate_types;
pub use precomputed_exports::GenerateTsOptions;
pub use precomputed_exports::generate_internal_json_schema;
pub use precomputed_exports::generate_json;
pub use precomputed_exports::generate_json_with_experimental;
pub use precomputed_exports::generate_ts;
pub use precomputed_exports::generate_ts_with_options;
pub use precomputed_exports::generate_types;
pub use protocol::common::*;
pub use protocol::event_mapping::*;
pub use protocol::item_builders::*;
@@ -41,10 +50,22 @@ pub use protocol::v1::Tools;
pub use protocol::v1::UserSavedConfig;
pub use protocol::v2::*;
pub use rpc::*;
#[cfg(test)]
pub use schema_fixtures::SchemaFixtureOptions;
#[doc(hidden)]
pub use schema_fixtures::generate_typescript_schema_fixture_subtree_for_tests;
#[cfg(test)]
pub use schema_fixtures::read_schema_fixture_subtree;
#[cfg(test)]
pub use schema_fixtures::read_schema_fixture_tree;
#[cfg(test)]
pub use schema_fixtures::write_schema_fixtures;
#[cfg(test)]
pub use schema_fixtures::write_schema_fixtures_with_options;
#[cfg(not(test))]
pub(crate) use codex_app_server_protocol_noop_macros::JsonSchema;
#[cfg(not(test))]
pub(crate) use codex_app_server_protocol_noop_macros::TS;
#[cfg(test)]
pub(crate) use schemars::JsonSchema;
#[cfg(test)]
pub(crate) use ts_rs::TS;