diff --git a/.cargo/config.toml b/.cargo/config.toml index d458b29b0..ad7b31042 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,6 @@ -# ts-rs export target: generate TypeScript bindings directly into the Node -# binding's types directory (single source of truth = Rust types, no copy step). +# ts-rs export target for the Node bindings (source of truth = Rust types). +# Plain cargo test no longer exports: both crates gate exports behind ts-export. +# Only scripts/gen_ts_types.py enables the feature and writes the types. # Overrides ts-rs's default `./bindings` (per-crate), which used to produce a # second, drift-prone copy in aimux-core/bindings/. # No `force = true`: scripts/gen_ts_types.py overrides this with a temporary diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd6d1f6b1..f6ed615c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,9 @@ jobs: # - Documentation only (top-level Markdown, docs/, rfc/, assets/): nothing. # docs/api/providers.md is generated and checked, so it counts as code. # - Only inside bindings//: that binding's jobs. The Rust workspace - # does not read the bindings, so nothing else can break. + # does not read the bindings, so nothing else can break. bindings/node/ + # also runs the web console typecheck: the generated types it imports + # live there. # - aimux-ffi/: the Rust jobs and every binding that links the C ABI. Node # and Python link the Rust crates directly, not the C ABI. Go is tested # inside ffi-build, Java and Kotlin share one job. @@ -145,6 +147,7 @@ jobs: $(job flutter-binding aimux-ffi bindings/flutter) $(job flutter-example-build aimux-ffi bindings/flutter) $(job swift-contract-tests aimux-ffi bindings/swift) + $(job web-typecheck bindings/node) \"contract-tests\": $code}" run=$(jq -c . <<< "$run") printf 'code=%s\nshared=%s\nplatforms=%s\nrun=%s\n' \ @@ -684,6 +687,26 @@ jobs: run: | swift test -Xlinker -L${{ github.workspace }}/target/release + # ── Web console typecheck: every @aimux/types import must still resolve ── + # The console imports the ts-rs types from bindings/node/src/types. The + # generator check above only compares files; this type-checks every import, + # so a renamed or removed Rust type fails here (RFC-0036 §13.1 A4). + web-typecheck: + name: Web console typecheck + runs-on: ubuntu-latest + needs: changes + if: fromJSON(needs.changes.outputs.run)['web-typecheck'] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Type-check the web console (vue-tsc --noEmit) + working-directory: tools/aimux-web/web + run: | + npm ci + npm run typecheck + # The one check to require in branch protection. It runs whatever happened # above: a job may be skipped only because "changes" decided it is not # needed; any other skip, failure or cancellation fails it. A new job goes @@ -703,6 +726,7 @@ jobs: - flutter-example-build - contract-tests - swift-contract-tests + - web-typecheck runs-on: ubuntu-latest steps: - env: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8157ad3a5..86cff87a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 and the AI SDK has no counterpart. `tokio` is now a dev-dependency only and the unused direct `serde` dependency is dropped. +### Fixed + +- Gated aimux-core's ts-rs exports behind `ts-export`, so plain `cargo test` + no longer rewrites tracked TypeScript types. `scripts/gen_ts_types.py` + enables exports and rejects ungated export attributes with `--check`. + ## [0.5.0] - 2026-09-27 **Breaking release.** 13 PRs since 0.3.0: the cross-language error model diff --git a/aimux-core/Cargo.toml b/aimux-core/Cargo.toml index e41db186f..a919ab825 100644 --- a/aimux-core/Cargo.toml +++ b/aimux-core/Cargo.toml @@ -8,6 +8,11 @@ keywords = ["llm", "ai", "openai", "anthropic", "provider"] categories = ["api-bindings", "asynchronous"] documentation = "https://docs.rs/aimux-core" +[features] +# Emit the wire types' ts-rs export tests. Enabled only by +# scripts/gen_ts_types.py, which points TS_RS_EXPORT_DIR at a temp directory. +ts-export = [] + [dependencies] serde = { workspace = true } serde_json = { workspace = true } diff --git a/aimux-core/src/content.rs b/aimux-core/src/content.rs index e6dfe464a..22940a5ab 100644 --- a/aimux-core/src/content.rs +++ b/aimux-core/src/content.rs @@ -9,7 +9,7 @@ use ts_rs::TS; /// Shared between `ModelMessage` (user-facing) and `LanguageModelPrompt` (provider-facing). #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] #[serde(tag = "type", rename_all = "snake_case")] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum ContentPart { /// A text segment. Text { diff --git a/aimux-core/src/decision_model.rs b/aimux-core/src/decision_model.rs index 29a27278f..51c940c88 100644 --- a/aimux-core/src/decision_model.rs +++ b/aimux-core/src/decision_model.rs @@ -16,7 +16,7 @@ pub type DecisionState = serde_json::Value; /// An inline image shared by all questions, placed before the textual state. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct DecisionImage { pub data: crate::shared::FileBytes, pub media_type: String, @@ -28,7 +28,7 @@ pub struct DecisionImage { /// A native choice value, distinct from the canonical option label used as a key. #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, TS)] #[serde(untagged)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum DecisionValue { Text(String), Boolean(bool), @@ -37,7 +37,7 @@ pub enum DecisionValue { /// Native question text or structured guidance, serialized without coercion. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] #[serde(untagged)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum DecisionDescription { Text(String), Object(#[ts(type = "Record")] serde_json::Map), @@ -60,7 +60,7 @@ impl From<&str> for DecisionDescription { /// Convert into `DecisionDescription` to use it in `DecisionQuestion::Score`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] #[serde(deny_unknown_fields)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct DecisionScoreLevel { pub label: String, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -90,7 +90,7 @@ impl DecisionDescription { #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] #[serde(deny_unknown_fields)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct DecisionBooleanCriteria { #[serde(rename = "true", default, skip_serializing_if = "Option::is_none")] pub true_description: Option, @@ -99,7 +99,7 @@ pub struct DecisionBooleanCriteria { } #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct DecisionOption { pub label: String, /// Native value; when omitted, the label is sent as the value. @@ -111,7 +111,7 @@ pub struct DecisionOption { #[derive(Debug, Clone, Serialize, Deserialize, TS)] #[serde(tag = "type", rename_all = "snake_case")] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum DecisionQuestion { Boolean { id: String, @@ -151,7 +151,7 @@ impl DecisionQuestion { } #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct DecisionCallOptions { #[serde(skip)] #[ts(skip)] @@ -267,7 +267,7 @@ impl DecisionCallOptions { /// calibration guarantee. Raw provider metadata retains calibration details. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)] #[serde(rename_all = "snake_case")] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum DecisionProbabilitySource { Native, LogitScoring, @@ -291,7 +291,7 @@ impl std::str::FromStr for DecisionProbabilitySource { #[derive(Debug, Clone, Serialize, Deserialize, TS)] #[serde(tag = "type", rename_all = "snake_case")] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum DecisionAnswer { /// The provider declined this question; other answers remain usable. Refusal, @@ -317,7 +317,7 @@ pub enum DecisionAnswer { } #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct DecisionCapabilities { #[serde(default)] pub supports_images: bool, @@ -341,7 +341,7 @@ pub struct DecisionCapabilities { /// Declared decimal rounding precision. None means only floating-point noise /// is tolerated, not decimal rounding. Providers must report their actual rule. #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct DecisionRounding { pub probability_decimals: Option, pub score_decimals: Option, @@ -361,14 +361,14 @@ impl DecisionRounding { } #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct DecisionResponse { pub headers: Option, pub body: Option, } #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct DecisionResult { #[serde(default)] pub rounding: DecisionRounding, diff --git a/aimux-core/src/embedding_model.rs b/aimux-core/src/embedding_model.rs index 7f1807048..a00620efa 100644 --- a/aimux-core/src/embedding_model.rs +++ b/aimux-core/src/embedding_model.rs @@ -25,7 +25,7 @@ pub type Embedding = Vec; /// /// Aligned with V4 `EmbeddingModelV4CallOptions`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct EmbeddingCallOptions { /// List of text values to generate embeddings for. pub values: Vec, @@ -64,7 +64,7 @@ impl EmbeddingCallOptions { /// Token usage for an embedding call. Embeddings only report input tokens. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct EmbeddingUsage { /// Number of input tokens consumed. pub tokens: u32, @@ -74,7 +74,7 @@ pub struct EmbeddingUsage { /// /// Aligned with V4 `EmbeddingModelV4Result`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct EmbeddingResult { /// Generated embeddings, in the same order as the input `values`. pub embeddings: Vec, @@ -94,7 +94,7 @@ pub struct EmbeddingResult { /// Debugging response info specific to embedding calls. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct EmbeddingResponse { /// Response headers. pub headers: Option, diff --git a/aimux-core/src/error.rs b/aimux-core/src/error.rs index 789ca4846..8891a2389 100644 --- a/aimux-core/src/error.rs +++ b/aimux-core/src/error.rs @@ -29,7 +29,7 @@ use ts_rs::TS; /// This keeps transport and response failures self-contained and matches the /// AI SDK's `APICallError` contract. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ApiCallError { /// Sanitized request URL. Required for every API-derived failure. pub url: String, @@ -93,7 +93,7 @@ impl ApiCallError { /// Why the retry wrapper stopped retrying. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)] #[serde(rename_all = "camelCase")] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum RetryErrorReason { /// Every permitted retry attempt failed with a retryable error. MaxRetriesExceeded, @@ -103,7 +103,7 @@ pub enum RetryErrorReason { /// Complete error history for a retried model operation. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct RetryError { pub reason: RetryErrorReason, pub errors: Vec, @@ -164,7 +164,7 @@ impl std::fmt::Display for ApiCallError { /// failure came from. `ApiCallError` is boxed only to keep the Rust enum /// compact; serde and every binding still observe the same object shape. #[derive(Debug, Clone, Serialize, Deserialize, TS, Error)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum AiMuxError { #[error("API call error: {0}")] ApiCall(Box), diff --git a/aimux-core/src/files_model.rs b/aimux-core/src/files_model.rs index d2fcb1120..10c041ae6 100644 --- a/aimux-core/src/files_model.rs +++ b/aimux-core/src/files_model.rs @@ -22,7 +22,7 @@ use crate::shared::{ /// `SharedV4FileData` (URLs and provider references are not valid uploads), so /// this is a dedicated two-variant enum rather than the full [`crate::shared::FileData`]. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum UploadFileData { /// Raw bytes (`Uint8Array`) or a base64-encoded string. Data { data: FileBytes }, @@ -34,7 +34,7 @@ pub enum UploadFileData { /// /// Aligned with V4 `FilesV4UploadFileCallOptions`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct UploadFileCallOptions { /// The file data (raw bytes/base64 or inline text). pub data: UploadFileData, @@ -71,7 +71,7 @@ impl UploadFileCallOptions { /// /// Aligned with V4 `FilesV4UploadFileResult`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct UploadFileResult { /// A provider reference mapping provider names to provider-specific file /// identifiers. diff --git a/aimux-core/src/generate.rs b/aimux-core/src/generate.rs index 274939bb7..84befa921 100644 --- a/aimux-core/src/generate.rs +++ b/aimux-core/src/generate.rs @@ -52,7 +52,7 @@ fn is_output_chunk(part: &StreamPart) -> bool { /// Unlike `CallOptions` (provider-facing), this does not include `prompt` /// (passed separately) and defaults are more ergonomic. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct GenerateTextOptions { pub max_output_tokens: Option, pub temperature: Option, @@ -141,7 +141,7 @@ impl GenerateTextOptions { /// Result of `generate_text` (user-facing). #[derive(Debug, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct GenerateTextResult { /// The generated text (concatenated from all text content parts). pub text: String, @@ -193,7 +193,7 @@ pub struct GenerateTextResult { /// Result of `generate_object` (user-facing, M12). The parsed JSON object plus /// convenience fields from the underlying `generate_text` call. #[derive(Debug, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct GenerateObjectResult { /// The parsed JSON object returned by the model. pub object: Value, diff --git a/aimux-core/src/image_model.rs b/aimux-core/src/image_model.rs index 2a1ae9418..13cd7628d 100644 --- a/aimux-core/src/image_model.rs +++ b/aimux-core/src/image_model.rs @@ -17,7 +17,7 @@ use crate::{AbortSignal, retry, timeout}; /// /// Aligned with V4 `ImageModelV4File`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum ImageFile { /// Inline file data (base64 or binary) with an explicit media type. File { @@ -35,7 +35,7 @@ pub enum ImageFile { /// File payload for an [`ImageFile::File`]: base64 string or raw bytes. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum ImageFileData { /// Base64-encoded string. Base64(String), @@ -51,7 +51,7 @@ pub enum ImageFileData { /// upstream API returns base64, return [`ImageOutputs::Base64`]; if binary, /// return [`ImageOutputs::Binary`]. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum ImageOutputs { /// Images as base64-encoded strings. Base64(Vec), @@ -63,7 +63,7 @@ pub enum ImageOutputs { /// /// Aligned with V4 `ImageModelV4Usage`. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ImageUsage { /// Number of input (prompt) tokens used. pub input_tokens: Option, @@ -77,7 +77,7 @@ pub struct ImageUsage { /// /// Aligned with V4 `ImageModelV4CallOptions`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ImageCallOptions { /// Prompt for the image generation. `None` for operations (e.g. upscaling) /// that do not require a prompt. @@ -146,7 +146,7 @@ impl ImageCallOptions { /// /// Aligned with V4 `ImageModelV4Result`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ImageResult { /// Generated images (base64 strings or binary data). pub images: ImageOutputs, @@ -166,7 +166,7 @@ pub struct ImageResult { /// Response information for an image generation call. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ImageResponse { /// Timestamp for the start of the generated response (ISO 8601 string). pub timestamp: Option, diff --git a/aimux-core/src/language_model_message.rs b/aimux-core/src/language_model_message.rs index 3f9500c6e..dc9078598 100644 --- a/aimux-core/src/language_model_message.rs +++ b/aimux-core/src/language_model_message.rs @@ -15,7 +15,7 @@ use ts_rs::TS; /// Unlike `ModelMessage` (which can have string content), this always has /// `content: Vec` — strings are normalized to `ContentPart::Text`. #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct LanguageModelPromptMessage { pub role: Role, pub content: Vec, diff --git a/aimux-core/src/message.rs b/aimux-core/src/message.rs index 00ee5622c..a128ddf26 100644 --- a/aimux-core/src/message.rs +++ b/aimux-core/src/message.rs @@ -12,7 +12,7 @@ use crate::content::ContentPart; /// Who sent the message. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default, TS)] #[serde(rename_all = "lowercase")] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum Role { System, /// The default role (a bare `Role::default()` yields `User`, matching the @@ -26,7 +26,7 @@ pub enum Role { /// Message body: either a simple string or multi-part content. #[derive(Debug, Clone, Serialize, Deserialize, TS)] #[serde(untagged)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum MessageContent { Text(String), Parts(Vec), @@ -34,7 +34,7 @@ pub enum MessageContent { /// A single user-facing chat message. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ModelMessage { pub role: Role, pub content: MessageContent, @@ -79,7 +79,7 @@ impl ModelMessage { /// Can be a simple string (converted to a single user message) or a list of messages. #[derive(Debug, Clone, Serialize, Deserialize, TS)] #[serde(untagged)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum ModelPrompt { /// A plain string prompt — equivalent to a single user message. Text(String), diff --git a/aimux-core/src/model_catalogue.rs b/aimux-core/src/model_catalogue.rs index fc045ed32..4412080a9 100644 --- a/aimux-core/src/model_catalogue.rs +++ b/aimux-core/src/model_catalogue.rs @@ -24,7 +24,7 @@ use ts_rs::TS; /// comes from [`ModelSpec`] (community knowledge); the host merges the two as /// needed (RFC-0027). aimux itself does not combine them. #[derive(Debug, Clone, Serialize, Deserialize, TS, PartialEq)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct RuntimeModel { /// Model identifier, e.g. `"gpt-4o"`. pub id: String, @@ -43,7 +43,7 @@ pub struct RuntimeModel { /// Where a [`ModelSpec`] came from. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, PartialEq, Eq)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum CatalogueSource { /// `models.anya2a.com` (DeepChat PublicProviderConf, aggregates models.dev). #[default] @@ -56,7 +56,7 @@ pub enum CatalogueSource { /// Coarse model category, used to route to the right modality surface. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, PartialEq, Eq)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum ModelType { #[default] Chat, @@ -76,7 +76,7 @@ pub enum ModelType { /// A single input or output modality. #[derive(Debug, Clone, Serialize, Deserialize, TS, PartialEq, Eq)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum Modality { Text, Image, @@ -93,7 +93,7 @@ pub enum Modality { /// Token / request limits for a model. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, PartialEq)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ModelLimits { /// Maximum total context window (input + output), in tokens. #[serde(default, skip_serializing_if = "Option::is_none")] @@ -111,7 +111,7 @@ pub struct ModelLimits { /// Input/output modality sets. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, PartialEq)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ModelModalities { #[serde(default, skip_serializing_if = "Vec::is_empty")] pub input: Vec, @@ -121,7 +121,7 @@ pub struct ModelModalities { /// Model-level capability flags (more precise than provider-level `supports_*`). #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, PartialEq)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ModelCapabilities { /// Supports function/tool calling. #[serde(default)] @@ -139,7 +139,7 @@ pub struct ModelCapabilities { /// How reasoning / thinking is controlled for a model. #[derive(Debug, Clone, Serialize, Deserialize, TS, PartialEq, Eq)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum ReasoningMode { /// Token-budget control (e.g. Anthropic `budget_tokens`). Budget, @@ -159,7 +159,7 @@ pub enum ReasoningMode { /// Visibility of reasoning output to the caller. #[derive(Debug, Clone, Serialize, Deserialize, TS, PartialEq, Eq)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum ReasoningVisibility { Hidden, Summary, @@ -172,7 +172,7 @@ pub enum ReasoningVisibility { /// Reasoning / thinking portrait for a model (advisory). #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, PartialEq)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ReasoningSpec { /// Whether the model family supports reasoning at all. #[serde(default)] @@ -204,7 +204,7 @@ pub struct ReasoningSpec { /// Pricing (advisory, read-only metadata). Units follow the source catalog /// (anya2a uses USD per 1M tokens). #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, PartialEq)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ModelCost { #[serde(default, skip_serializing_if = "Option::is_none")] pub input: Option, @@ -222,7 +222,7 @@ pub struct ModelCost { /// The caller reads them to decide how to configure `GenerateTextOptions` / /// `bodyOverrides`. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, PartialEq)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ModelSpec { #[serde(default, skip_serializing_if = "Option::is_none")] pub display_name: Option, diff --git a/aimux-core/src/model_id.rs b/aimux-core/src/model_id.rs index a319c1635..1a8f6ae73 100644 --- a/aimux-core/src/model_id.rs +++ b/aimux-core/src/model_id.rs @@ -6,7 +6,7 @@ use ts_rs::TS; /// A model identifier in `"provider/model-name"` format, e.g. `"openai/gpt-4o"`. #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ModelId { provider: String, model: String, diff --git a/aimux-core/src/openai_output.rs b/aimux-core/src/openai_output.rs index 1eb531e1f..73c1c34eb 100644 --- a/aimux-core/src/openai_output.rs +++ b/aimux-core/src/openai_output.rs @@ -49,7 +49,7 @@ use crate::types::{FinishReason, FinishReasonUnified, Usage}; /// /// Mirrors the OpenAI `chat.completion` object. #[derive(Debug, Clone, Serialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ChatCompletion { pub id: String, pub object: String, @@ -62,7 +62,7 @@ pub struct ChatCompletion { } #[derive(Debug, Clone, Serialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ChatCompletionChoice { pub index: u32, pub message: ChatCompletionMessage, @@ -72,7 +72,7 @@ pub struct ChatCompletionChoice { } #[derive(Debug, Clone, Serialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ChatCompletionMessage { pub role: String, pub content: Option, @@ -85,7 +85,7 @@ pub struct ChatCompletionMessage { } #[derive(Debug, Clone, Serialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ChatCompletionToolCall { pub id: String, #[serde(rename = "type")] @@ -94,7 +94,7 @@ pub struct ChatCompletionToolCall { } #[derive(Debug, Clone, Serialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ChatCompletionFunction { pub name: String, pub arguments: String, @@ -108,7 +108,7 @@ pub struct ChatCompletionFunction { /// /// Mirrors the OpenAI `chat.completion.chunk` object. #[derive(Debug, Clone, Serialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ChatCompletionChunk { pub id: String, pub object: String, @@ -120,7 +120,7 @@ pub struct ChatCompletionChunk { } #[derive(Debug, Clone, Serialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ChatCompletionChunkChoice { pub index: u32, pub delta: ChatCompletionDelta, @@ -130,7 +130,7 @@ pub struct ChatCompletionChunkChoice { } #[derive(Debug, Clone, Default, Serialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ChatCompletionDelta { #[serde(skip_serializing_if = "Option::is_none")] pub role: Option, @@ -143,7 +143,7 @@ pub struct ChatCompletionDelta { } #[derive(Debug, Clone, Serialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ChatCompletionChunkToolCall { pub index: u32, #[serde(skip_serializing_if = "Option::is_none")] @@ -154,7 +154,7 @@ pub struct ChatCompletionChunkToolCall { } #[derive(Debug, Clone, Default, Serialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ChatCompletionChunkFunction { #[serde(skip_serializing_if = "Option::is_none")] pub name: Option, @@ -167,7 +167,7 @@ pub struct ChatCompletionChunkFunction { // ───────────────────────────────────────────────────────────────────────────── #[derive(Debug, Clone, Default, Serialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ChatCompletionUsage { pub prompt_tokens: u32, pub completion_tokens: u32, @@ -179,7 +179,7 @@ pub struct ChatCompletionUsage { } #[derive(Debug, Clone, Default, Serialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct PromptTokensDetails { pub cached_tokens: u32, #[serde(skip_serializing_if = "Option::is_none")] @@ -187,7 +187,7 @@ pub struct PromptTokensDetails { } #[derive(Debug, Clone, Default, Serialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct CompletionTokensDetails { #[serde(skip_serializing_if = "Option::is_none")] pub reasoning_tokens: Option, diff --git a/aimux-core/src/options.rs b/aimux-core/src/options.rs index 3d2891396..cee771913 100644 --- a/aimux-core/src/options.rs +++ b/aimux-core/src/options.rs @@ -15,7 +15,7 @@ use crate::types::ReasoningEffort; /// How the model should format its response. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum ResponseFormat { /// Plain text (default). Text, @@ -34,7 +34,7 @@ pub enum ResponseFormat { /// corresponding limit. A `total` timeout also covers retry backoff and the /// whole streamed response. #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct TimeoutConfiguration { /// Overall timeout for the entire call (including retries and, for /// streaming, the whole stream), in milliseconds. @@ -65,7 +65,7 @@ pub struct TimeoutConfiguration { /// `GenerateTextOptions` (user-facing) which is converted to `CallOptions` /// by the `generate_text` / `stream_text` functions. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct CallOptions { /// The standardized prompt (message array). Required. pub prompt: LanguageModelPrompt, diff --git a/aimux-core/src/parse_tool_call.rs b/aimux-core/src/parse_tool_call.rs index 16a4ca6d8..33d4f2d07 100644 --- a/aimux-core/src/parse_tool_call.rs +++ b/aimux-core/src/parse_tool_call.rs @@ -22,7 +22,7 @@ use crate::types::ProviderMetadata; /// The wire shape matches [`ToolCall`] field for field, except that `input` /// is the provider's raw argument *text* rather than a parsed value. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct RawToolCall { pub tool_call_id: String, pub tool_name: String, @@ -357,7 +357,7 @@ fn invalid_tool_call(tool_call: RawToolCall, error: AiMuxError) -> ToolCall { /// `{"type":"failed","message":"…"}`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] #[serde(tag = "type", rename_all = "snake_case", deny_unknown_fields)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum ToolCallRepairReply { /// Re-validate this replacement call, exactly as the closure path does /// for a returned `Some(call)`. diff --git a/aimux-core/src/recording.rs b/aimux-core/src/recording.rs index 79d7ddf25..4db067dd9 100644 --- a/aimux-core/src/recording.rs +++ b/aimux-core/src/recording.rs @@ -34,7 +34,7 @@ pub const RECORDING_SCHEMA: u32 = 2; /// Operation stored in a unified recording. Older recordings are language calls. #[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize, TS)] #[serde(rename_all = "snake_case")] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum RecordingOperation { #[default] LanguageModel, @@ -49,7 +49,7 @@ impl RecordingOperation { /// 一次完整调用的录制记录(三层 + call_id 关联)。 #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct Recording { /// 格式版本。 pub schema: u32, @@ -132,7 +132,7 @@ impl Recording { /// ① 输入侧:完整调用参数,足以重建 generate_text 调用。 #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct InputRecord { #[serde(default, skip_serializing_if = "RecordingOperation::is_language_model")] pub operation: RecordingOperation, @@ -167,7 +167,7 @@ impl InputRecord { /// ② 配置侧:provider 身份(请求回放重建用)。 #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ProviderRecord { /// `model.provider()`,如 "openai"。 pub provider: String, @@ -200,7 +200,7 @@ impl ProviderRecord { /// ③ HTTP 侧:单次 attempt 的 wire 交换。 #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct HttpExchange { /// Composite step this exchange belongs to (e.g. `router[0]:openai/gpt-4o` /// or `moa.ref[1]:...`). `None` for a plain, non-composite operation. @@ -228,7 +228,7 @@ fn default_finalized() -> bool { } #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct HttpRecord { pub method: String, pub url: String, @@ -239,7 +239,7 @@ pub struct HttpRecord { } #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ResponseRecord { pub status: u16, pub headers: Vec<(String, String)>, @@ -253,7 +253,7 @@ pub struct ResponseRecord { } #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct TimingRecord { /// ms 级延迟,TS 用 number(远小于 2^53,避免 bigint)。 #[ts(type = "number")] @@ -265,7 +265,7 @@ pub struct TimingRecord { /// 调用终结状态。 #[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize, TS)] #[serde(rename_all = "snake_case")] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum OutcomeStatus { /// 未到(内部哨兵,不作为最终输出)。 #[default] @@ -281,7 +281,7 @@ pub enum OutcomeStatus { /// 最终结果摘要。 #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct OutcomeRecord { /// Normalized decision result, independent of a provider's wire format. #[serde(default, skip_serializing_if = "Option::is_none")] diff --git a/aimux-core/src/reranking_model.rs b/aimux-core/src/reranking_model.rs index a07c20514..95c62e3a4 100644 --- a/aimux-core/src/reranking_model.rs +++ b/aimux-core/src/reranking_model.rs @@ -15,7 +15,7 @@ use crate::{AbortSignal, retry, timeout}; /// /// Aligned with V4 `RerankingModelV4CallOptions.documents`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum RerankingDocuments { /// A list of plain-text documents. Text { values: Vec }, @@ -27,7 +27,7 @@ pub enum RerankingDocuments { /// /// Aligned with V4 `RerankingModelV4CallOptions`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct RerankingCallOptions { /// Documents to rerank. pub documents: RerankingDocuments, @@ -74,7 +74,7 @@ impl RerankingCallOptions { /// A single reranked entry: the original index and its relevance score. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct RerankingRank { /// The index of the document in the original list (before reranking). pub index: u32, @@ -86,7 +86,7 @@ pub struct RerankingRank { /// /// Aligned with V4 `RerankingModelV4Result`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct RerankingResult { /// Ordered list of reranked documents, sorted by descending relevance /// score. Each entry's `index` refers to the position in the original @@ -105,7 +105,7 @@ pub struct RerankingResult { /// Optional response information for a reranking call. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct RerankingResponse { /// ID for the generated response, if the provider sends one. pub id: Option, diff --git a/aimux-core/src/result.rs b/aimux-core/src/result.rs index c9d451aa0..638e37c4c 100644 --- a/aimux-core/src/result.rs +++ b/aimux-core/src/result.rs @@ -36,7 +36,7 @@ where /// A content item in the generation result. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum GenerateContent { /// Generated text. Text { @@ -133,7 +133,7 @@ pub enum GenerateContent { /// A reasoning / thinking segment, extracted to the top level (M7). #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ReasoningPart { /// The reasoning text. pub text: String, @@ -141,7 +141,7 @@ pub struct ReasoningPart { /// A source / citation, extracted to the top level (M7). #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct SourcePart { pub id: String, pub source_type: String, @@ -153,7 +153,7 @@ pub struct SourcePart { /// A file generated by the model, extracted to the top level (M7). #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct FilePart { pub data: FileData, pub media_type: String, @@ -163,7 +163,7 @@ pub struct FilePart { /// `GenerateTextResult`'s user-facing fields (without `raw`, since streaming /// has no `GenerateResult` equivalent). #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct StreamTextResultAggregated { /// The generated text (concatenated `TextDelta`). pub text: String, @@ -210,7 +210,7 @@ pub struct StreamTextResultAggregated { /// Result of `LanguageModel::do_generate` (non-streaming). #[derive(Debug, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct GenerateResult { /// Generated content items (text, tool calls, etc.). pub content: Vec, diff --git a/aimux-core/src/search_model.rs b/aimux-core/src/search_model.rs index cd03f7b10..e812031fb 100644 --- a/aimux-core/src/search_model.rs +++ b/aimux-core/src/search_model.rs @@ -16,7 +16,7 @@ use crate::{AbortSignal, retry, timeout}; /// Options passed to [`SearchModel::do_search`]. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct SearchCallOptions { /// The search query string. pub query: String, @@ -79,7 +79,7 @@ impl SearchCallOptions { /// A single search result item. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct SearchResultItem { /// The title of the result (e.g. page title). pub title: Option, @@ -103,7 +103,7 @@ pub struct SearchResultItem { /// The result of [`SearchModel::do_search`]. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct SearchResult { /// Ordered list of search results. pub results: Vec, @@ -124,7 +124,7 @@ pub struct SearchResult { /// Optional response information for a search call. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct SearchResponse { /// Response headers. pub headers: Option, diff --git a/aimux-core/src/session.rs b/aimux-core/src/session.rs index ead68fb6f..7ae937173 100644 --- a/aimux-core/src/session.rs +++ b/aimux-core/src/session.rs @@ -33,7 +33,7 @@ use crate::language_model_message::LanguageModelPrompt; /// Where a session id came from. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum SessionSource { /// Passed explicitly via `CallOptions.session_id` / `GenerateTextOptions.session_id`. Explicit, @@ -44,7 +44,7 @@ pub enum SessionSource { /// A single call within a session (an index entry only — call content lives /// in Recording (RFC-0023) / TraceRecord (RFC-0015)). #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct SessionCall { /// Call-level unique id. This is the association key for the future /// Recording / TraceRecord `call_id` (RFC-0015/0023): once those land, @@ -58,7 +58,7 @@ pub struct SessionCall { /// Aggregated view of one session (session_id → ordered calls). #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct SessionView { pub session_id: String, /// Where the session id came from (first call's source). diff --git a/aimux-core/src/shared.rs b/aimux-core/src/shared.rs index 705f3c945..00f9ff2c3 100644 --- a/aimux-core/src/shared.rs +++ b/aimux-core/src/shared.rs @@ -56,7 +56,7 @@ pub type SharedProviderReference = HashMap; /// the upstream API returns base64, return [`FileBytes::Base64`]; if it /// returns binary, return [`FileBytes::Binary`]. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum FileBytes { /// Raw binary bytes. Binary(Vec), @@ -68,7 +68,7 @@ pub enum FileBytes { /// /// Aligned with V4 `SharedV4FileData`. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum FileData { /// Raw bytes (`Uint8Array`) or a base64-encoded string. Data { data: FileBytes }, @@ -86,7 +86,7 @@ pub enum FileData { /// `resolution` options. Aligned with the TS template-literal type /// `` `${number}x${number}` ``. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct Size { width: u32, height: u32, @@ -150,7 +150,7 @@ impl std::str::FromStr for Size { /// `aspectRatio` options. Aligned with the TS template-literal type /// `` `${number}:${number}` ``. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct AspectRatio { width: u32, height: u32, @@ -225,7 +225,7 @@ fn parse_pair(s: &str, sep: char) -> Option<(u32, u32)> { /// `ResponseInfo` directly, while those that mark it optional use /// `Option`. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ResponseInfo { /// Timestamp for the start of the generated response (ISO 8601 string). pub timestamp: Option, @@ -241,7 +241,7 @@ pub struct ResponseInfo { /// /// Aligned with the `request?` object that appears on some V4 model results. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct RequestInfo { /// The request body that was sent (opaque JSON). pub body: Option, diff --git a/aimux-core/src/speech_model.rs b/aimux-core/src/speech_model.rs index 5add06e97..3cc2ac0c7 100644 --- a/aimux-core/src/speech_model.rs +++ b/aimux-core/src/speech_model.rs @@ -16,7 +16,7 @@ use crate::{AbortSignal, retry, timeout}; /// The TS result type is `string | Uint8Array`. Providers should return data /// without unnecessary conversion. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum AudioData { /// Audio as a base64-encoded string. Base64(String), @@ -28,7 +28,7 @@ pub enum AudioData { /// /// Aligned with V4 `SpeechModelV4CallOptions`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct SpeechCallOptions { /// Text to convert to speech. pub text: String, @@ -92,7 +92,7 @@ impl SpeechCallOptions { /// /// Aligned with V4 `SpeechModelV4Result`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct SpeechResult { /// Generated audio (base64 string or binary data). pub audio: AudioData, @@ -112,7 +112,7 @@ pub struct SpeechResult { /// Optional request information for a speech call. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct SpeechRequest { /// Response body (HTTP providers only). pub body: Option, @@ -120,7 +120,7 @@ pub struct SpeechRequest { /// Response information for a speech call. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct SpeechResponse { /// Timestamp for the start of the generated response (ISO 8601 string). pub timestamp: Option, diff --git a/aimux-core/src/stream_part.rs b/aimux-core/src/stream_part.rs index 6a083920c..3d222b01d 100644 --- a/aimux-core/src/stream_part.rs +++ b/aimux-core/src/stream_part.rs @@ -13,7 +13,7 @@ use crate::types::{FinishReason, ProviderMetadata, Usage, Warning}; /// A single chunk in the stream returned by `do_stream`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum StreamPart { // ── P0: text ── /// Start of a text segment. diff --git a/aimux-core/src/tool.rs b/aimux-core/src/tool.rs index 7c1176da1..bf08bbb64 100644 --- a/aimux-core/src/tool.rs +++ b/aimux-core/src/tool.rs @@ -11,7 +11,7 @@ use crate::types::ProviderMetadata; /// A tool definition passed to the model in `CallOptions.tools`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct FunctionTool { /// Unique tool name. pub name: String, @@ -71,7 +71,7 @@ impl FunctionTool { /// schemas are defined by the provider, and some are executed on the provider's /// servers (e.g. web search, code execution). #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ProviderTool { /// The ID of the tool, following the format `.`. pub id: String, @@ -87,7 +87,7 @@ pub struct ProviderTool { /// `Array`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] #[serde(tag = "type", rename_all = "snake_case")] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum Tool { /// A user-defined function tool. Function(FunctionTool), @@ -103,7 +103,7 @@ impl From for Tool { /// A tool call requested by the model. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ToolCall { /// Provider-assigned call id. pub tool_call_id: String, @@ -138,7 +138,7 @@ pub struct ToolCall { /// The result of executing a tool call, to be sent back to the model. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ToolResult { /// Must match the corresponding `ToolCall::tool_call_id`. pub tool_call_id: String, @@ -159,10 +159,8 @@ pub struct ToolResult { /// This is a mixed tagged/untagged shape (unit variants as bare strings, /// `Tool` variant as a tagged object), so serde is implemented by hand. #[derive(Debug, Clone, Default, PartialEq, TS)] -#[ts( - export, - type = "\"auto\" | \"none\" | \"required\" | { type: \"tool\"; toolName: string }" -)] +#[ts(type = "\"auto\" | \"none\" | \"required\" | { type: \"tool\"; toolName: string }")] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum ToolChoice { /// Model decides whether to call a tool (default). #[default] diff --git a/aimux-core/src/trace/fingerprint.rs b/aimux-core/src/trace/fingerprint.rs index 516fc511f..26f139812 100644 --- a/aimux-core/src/trace/fingerprint.rs +++ b/aimux-core/src/trace/fingerprint.rs @@ -126,7 +126,7 @@ fn denoise_at(value: &Value, depth: usize) -> Value { /// Serialized-wire fingerprint stored in a `TraceRecord` (hex strings — /// `u128` is not JSON-serializable). #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct Fingerprint { /// 128-bit hash of the whole denoised body (hex). pub body_hash: String, diff --git a/aimux-core/src/trace/record.rs b/aimux-core/src/trace/record.rs index a41834d3e..4505ae543 100644 --- a/aimux-core/src/trace/record.rs +++ b/aimux-core/src/trace/record.rs @@ -13,7 +13,7 @@ use super::verdict::Verdict; /// Token usage snapshot (7 flat fields + raw passthrough). #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct UsageSnapshot { pub input_total: Option, pub input_no_cache: Option, @@ -30,7 +30,7 @@ pub struct UsageSnapshot { /// Request-side cache hints (best-effort, e.g. Anthropic `cache_control`). #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct RequestCacheHints { /// Whether any message requested `cache_control` (write) this call. pub requested_write: bool, @@ -38,7 +38,7 @@ pub struct RequestCacheHints { /// One probed call. Plaintext never persists — fingerprints only. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct TraceRecord { pub provider: String, pub model: String, diff --git a/aimux-core/src/trace/store.rs b/aimux-core/src/trace/store.rs index 09685cd73..33756fb4a 100644 --- a/aimux-core/src/trace/store.rs +++ b/aimux-core/src/trace/store.rs @@ -280,7 +280,7 @@ impl TraceStore { /// Query filter (RFC-0015 §5.3). #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct TraceFilter { pub provider: Option, pub model: Option, @@ -291,7 +291,7 @@ pub struct TraceFilter { /// Aggregated statistics (RFC-0015 §5.2 — the two hit rates are reported /// side by side, never merged into a single number). #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct TraceStats { pub provider: String, pub model: String, @@ -309,7 +309,7 @@ pub struct TraceStats { /// Session chain view (append-only order + prefix stability, RFC-0015 §5.3). #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct SessionChainView { pub session_id: String, pub record_ids: Vec, @@ -319,7 +319,7 @@ pub struct SessionChainView { /// One step of a session's cache-hit trajectory (RFC-0024 §4.3). #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct SessionStepStat { /// Step within the session (0-based, session order). pub step: u32, @@ -339,7 +339,7 @@ pub struct SessionStepStat { /// A prefix break between two consecutive records of a session. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct PrefixBreak { pub at_record_id: String, pub prev_record_id: String, @@ -349,7 +349,7 @@ pub struct PrefixBreak { } #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum BreakKind { SystemChanged, ToolsChanged, diff --git a/aimux-core/src/trace/verdict.rs b/aimux-core/src/trace/verdict.rs index abca26a15..7e2eea1ee 100644 --- a/aimux-core/src/trace/verdict.rs +++ b/aimux-core/src/trace/verdict.rs @@ -7,7 +7,7 @@ use ts_rs::TS; /// Verdict kinds (RFC-0015 §4.1). #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum VerdictKind { Trusted, SuspectOverclaim, @@ -17,7 +17,7 @@ pub enum VerdictKind { /// Confidence level. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum VerdictConfidence { High, Medium, @@ -26,7 +26,7 @@ pub enum VerdictConfidence { /// A verdict for one call. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct Verdict { pub kind: VerdictKind, pub confidence: VerdictConfidence, @@ -59,7 +59,7 @@ impl Verdict { /// Provider audit parameters (RFC-0015 §7 matrix — the part that lives in /// core; display logic belongs to the CLI). #[derive(Debug, Clone, Copy, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ProviderAuditSpec { /// Provider family for family-specific invariants. pub family: ProviderFamily, @@ -80,7 +80,7 @@ pub struct ProviderAuditSpec { /// Provider family (only families with distinct invariants need dispatch; /// gran/threshold/ttl live in `ProviderAuditSpec`). #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum ProviderFamily { OpenAi, DeepSeek, diff --git a/aimux-core/src/transcription_model.rs b/aimux-core/src/transcription_model.rs index efeb2c75b..06221a4c2 100644 --- a/aimux-core/src/transcription_model.rs +++ b/aimux-core/src/transcription_model.rs @@ -22,7 +22,7 @@ use crate::{AbortSignal, retry, timeout}; /// Audio input: raw bytes or a base64-encoded string. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum AudioInput { /// Raw binary bytes. Binary(Vec), @@ -32,7 +32,7 @@ pub enum AudioInput { /// A chunk of audio in a streaming transcription request. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum AudioChunk { /// Raw binary bytes. Binary(Vec), @@ -42,7 +42,7 @@ pub enum AudioChunk { /// A transcript segment with timing information. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct TranscriptionSegment { /// The text content of this segment. pub text: String, @@ -56,7 +56,7 @@ pub struct TranscriptionSegment { /// /// Aligned with V4 `TranscriptionModelV4CallOptions`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct TranscriptionCallOptions { /// Audio data to transcribe (raw bytes or a base64-encoded string). pub audio: AudioInput, @@ -101,7 +101,7 @@ impl TranscriptionCallOptions { /// /// Aligned with V4 `TranscriptionModelV4Result`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct TranscriptionResult { /// The complete transcribed text from the audio. pub text: String, @@ -130,7 +130,7 @@ pub struct TranscriptionResult { /// Optional request information for a transcription call. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct TranscriptionRequest { /// Raw request HTTP body that was sent (JSON stringified). pub body: Option, @@ -138,7 +138,7 @@ pub struct TranscriptionRequest { /// Response information for a transcription call. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct TranscriptionResponse { /// Timestamp for the start of the generated response (ISO 8601 string). pub timestamp: Option, @@ -152,7 +152,7 @@ pub struct TranscriptionResponse { /// The input audio format for a streaming transcription request. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct InputAudioFormat { /// Audio format type, e.g. `"audio/pcm"`, `"audio/pcmu"`, `"audio/pcma"`. pub format_type: String, @@ -208,7 +208,7 @@ impl std::fmt::Debug for TranscriptionStreamOptions { /// /// Aligned with V4 `TranscriptionModelV4StreamPart`. #[derive(Debug, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum TranscriptionStreamPart { /// Stream start event, carrying warnings. StreamStart { warnings: Vec }, diff --git a/aimux-core/src/types.rs b/aimux-core/src/types.rs index 5ed3ce700..4750a456b 100644 --- a/aimux-core/src/types.rs +++ b/aimux-core/src/types.rs @@ -6,7 +6,7 @@ use ts_rs::TS; /// Unified finish reason (why the model stopped generating). #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct FinishReason { /// The unified reason. pub unified: FinishReasonUnified, @@ -17,7 +17,7 @@ pub struct FinishReason { /// Unified finish reason enum (aligned with V4 `LanguageModelV4FinishReason`). #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)] #[serde(rename_all = "kebab-case")] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum FinishReasonUnified { Stop, Length, @@ -29,7 +29,7 @@ pub enum FinishReasonUnified { /// Token usage statistics. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct Usage { pub input_tokens: TokenUsage, pub output_tokens: TokenUsage, @@ -40,7 +40,7 @@ pub struct Usage { /// Token usage detail (with cache breakdown). #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct TokenUsage { /// Total tokens. pub total: Option, @@ -68,7 +68,7 @@ pub struct TokenUsage { #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)] #[serde(rename_all = "kebab-case")] #[derive(Default)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum ReasoningEffort { /// Provider default — no explicit reasoning config sent. #[default] @@ -131,7 +131,7 @@ impl std::str::FromStr for ReasoningEffort { /// A warning issued by the provider (e.g. unsupported parameter). #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum Warning { /// A feature is not supported by this provider. Unsupported { @@ -151,7 +151,7 @@ pub enum Warning { /// Metadata about the API response. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct ResponseMetadata { pub id: Option, pub timestamp: Option, diff --git a/aimux-core/src/video_model.rs b/aimux-core/src/video_model.rs index 8833c4eed..c54652065 100644 --- a/aimux-core/src/video_model.rs +++ b/aimux-core/src/video_model.rs @@ -19,7 +19,7 @@ use crate::{AbortSignal, retry, timeout}; /// /// Aligned with V4 `VideoModelV4File`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum VideoFile { /// Inline file data (base64 or binary) with an explicit media type. File { @@ -39,7 +39,7 @@ pub enum VideoFile { /// File payload for a [`VideoFile::File`]: base64 string or raw bytes. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum VideoFileData { /// Base64-encoded string. Base64(String), @@ -51,7 +51,7 @@ pub enum VideoFileData { /// /// Aligned with V4 `VideoModelV4FrameType`. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum VideoFrameType { /// The starting frame the model animates from. FirstFrame, @@ -63,7 +63,7 @@ pub enum VideoFrameType { /// /// Aligned with V4 `VideoModelV4FrameImage`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct VideoFrameImage { /// The image file used for this frame. pub image: VideoFile, @@ -76,7 +76,7 @@ pub struct VideoFrameImage { /// Aligned with V4 `VideoModelV4VideoData`. Most providers return URLs due to /// large file sizes. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub enum VideoData { /// Video available as a URL (most common). Url { url: String, media_type: String }, @@ -90,7 +90,7 @@ pub enum VideoData { /// /// Aligned with V4 `VideoModelV4CallOptions`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct VideoCallOptions { /// Text prompt for the video generation. `None` when not required. pub prompt: Option, @@ -184,7 +184,7 @@ impl VideoCallOptions { /// Per-call poll pacing for video generation (AI SDK `generateVideo` `poll`). #[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct VideoPollOptions { /// Delay between consecutive status checks, in milliseconds. // `number`, not the `bigint` ts-rs infers from u64: the JS bindings pass @@ -200,7 +200,7 @@ pub struct VideoPollOptions { /// /// Aligned with V4 `VideoModelV4Result`. #[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct VideoResult { /// Generated videos as URLs, base64 strings, or binary data. pub videos: Vec, @@ -217,7 +217,7 @@ pub struct VideoResult { /// Response information for a video generation call. #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct VideoResponse { /// Timestamp for the start of the generated response (ISO 8601 string). pub timestamp: Option, diff --git a/rfc/0029-web-console.md b/rfc/0029-web-console.md index 362ea817d..35ad4e5e8 100644 --- a/rfc/0029-web-console.md +++ b/rfc/0029-web-console.md @@ -476,6 +476,8 @@ Replay 页对同一 `Recording` 重发真实 API 后,新旧两条 `Recording` ** 生成的 d.ts 输出到 `tools/aimux-web/web/src/types/`(复用 `bindings/node` 的 ts-rs 导出管线方式,`TS_RS_EXPORT_DIR` 指向 web 目录)。 +> **后续变更**: 2026-10-15(#247)core 类型不再拷贝到 `tools/aimux-web/web/src/types/`:web 经 `@aimux/types/*` 直接导入 `bindings/node/src/types/` 的唯一生成输出;只有 web 自己的 wire 类型(`tools/aimux-web/src/wire.rs`,`ts-export` feature 门控)生成到 `tools/aimux-web/web/src/types/generated/`。两处都由 `python3 scripts/gen_ts_types.py` 先导出到临时目录再同步,`--check` 只比较不写;`TS_RS_EXPORT_DIR` 不再指向 web 目录。CI 的 web 类型检查(`npm run typecheck`)保证每条 import 都能解析。 + ### 9.2 复用的 core 能力(不改 core) | 能力 | 复用点 | diff --git a/scripts/gen_ts_types.py b/scripts/gen_ts_types.py index 2babf2928..c296ac736 100755 --- a/scripts/gen_ts_types.py +++ b/scripts/gen_ts_types.py @@ -1,12 +1,17 @@ #!/usr/bin/env python3 -"""Regenerate ts-rs TypeScript bindings from Rust core types. - -The Rust types in aimux-core carry #[derive(TS)] + #[ts(export)]; running the -export tests (cargo test -p aimux-core --lib export) writes the generated .ts -files to TS_RS_EXPORT_DIR. This script always exports into a temporary -directory first — the repo is never written by cargo directly — then either -syncs that output into bindings/node/src/types/ (default) or compares the two -trees and fails on any difference (--check). Comparing full file sets means a +"""Regenerate ts-rs TypeScript bindings from Rust types. + +Two crates carry #[derive(TS)] and gate their exports behind ts-export: + +- aimux-core -> bindings/node/src/types/ (+ the types.ts aggregate) +- aimux-web -> tools/aimux-web/web/src/types/generated/ (the console's wire + schema; kept out of the node bindings because it belongs to the frontend) + +Running a crate's export tests writes the generated .ts files to +TS_RS_EXPORT_DIR. This script always exports into a temporary directory +first — the repo is never written by cargo directly — then either syncs that +output into the target directory (default) or compares the two trees and +fails on any difference (--check). Comparing full file sets means a deleted Rust type shows up as a stale .ts, and a forgotten `git add` of a new type shows up as a missing one; a failed cargo run leaves the repo untouched. @@ -18,7 +23,10 @@ python3 scripts/gen_ts_types.py --check # fail if committed output differs # (CI; read-only, repo untouched) """ +from __future__ import annotations + import os +import re import subprocess import sys import tempfile @@ -27,6 +35,42 @@ ROOT = Path(__file__).resolve().parent.parent TYPES_DIR = ROOT / "bindings" / "node" / "src" / "types" TYPES_TS = ROOT / "bindings" / "node" / "src" / "types.ts" +WEB_TYPES_DIR = ROOT / "tools" / "aimux-web" / "web" / "src" / "types" / "generated" + +# (cargo test args selecting the crate's export tests, output directory, +# aggregate re-export file or None, crate source directory) +TARGETS = [ + ( + ["-p", "aimux-core", "--lib", "--features", "ts-export", "export"], + TYPES_DIR, + TYPES_TS, + ROOT / "aimux-core" / "src", + ), + ( + ["-p", "aimux-web", "--bins", "--features", "ts-export", "export"], + WEB_TYPES_DIR, + None, + ROOT / "tools" / "aimux-web" / "src", + ), +] + + +def check_export_gates() -> bool: + """Reject export attributes without the ts-export feature gate.""" + ok = True + for _, _, _, source_dir in TARGETS: + for path in sorted(source_dir.rglob("*.rs")): + content = path.read_text(encoding="utf-8") + ungated = content.replace('cfg_attr(feature = "ts-export", ts(export', "") + for match in re.finditer(r"ts\(\s*export\b", ungated): + number = ungated.count("\n", 0, match.start()) + 1 + print( + f"UNGATED: {path.relative_to(ROOT)}:{number}: " + "ts-rs export requires the ts-export feature gate", + file=sys.stderr, + ) + ok = False + return ok def normalize_generated(content: str) -> str: @@ -34,8 +78,8 @@ def normalize_generated(content: str) -> str: return "\n".join(line.rstrip() for line in content.splitlines()) + "\n" -def regenerate(export_dir: Path) -> None: - """Run the ts-rs export tests, writing the .ts files into export_dir. +def regenerate(test_args: list[str], export_dir: Path) -> None: + """Run a crate's ts-rs export tests, writing the .ts files into export_dir. The external TS_RS_EXPORT_DIR overrides the repo-relative default in .cargo/config.toml ([env] without force = true). Do not add force = true @@ -44,19 +88,18 @@ def regenerate(export_dir: Path) -> None: """ env = {**os.environ, "TS_RS_EXPORT_DIR": str(export_dir)} subprocess.run( - ["cargo", "test", "-p", "aimux-core", "--lib", "export"], + ["cargo", "test", *test_args], cwd=ROOT, env=env, check=True, ) -def manifest(root: Path, exclude: set[str] = frozenset()) -> dict[str, str]: +def manifest(root: Path) -> dict[str, str]: """Map POSIX-style relative path -> content for every .ts under root.""" return { p.relative_to(root).as_posix(): normalize_generated(p.read_text(encoding="utf-8")) for p in root.rglob("*.ts") - if p.name not in exclude } @@ -73,67 +116,90 @@ def aggregate(files: dict[str, str]) -> str: return "\n".join(lines) + "\n" -def sync(expected: dict[str, str]) -> None: - """Make TYPES_DIR match expected exactly.""" - for rel in manifest(TYPES_DIR).keys() - expected.keys(): - (TYPES_DIR / rel).unlink() +def sync(types_dir: Path, expected: dict[str, str]) -> None: + """Make types_dir match expected exactly.""" + if types_dir.is_dir(): + for rel in manifest(types_dir).keys() - expected.keys(): + (types_dir / rel).unlink() for rel, content in expected.items(): - path = TYPES_DIR / rel + path = types_dir / rel path.parent.mkdir(parents=True, exist_ok=True) - # `content` is canonicalized by manifest(); compare the raw file so a - # normal regeneration also removes ts-rs's incidental EOL spaces. - if not path.exists() or path.read_text(encoding="utf-8") != content: + # `content` is canonicalized by manifest(); compare against the + # canonicalized file too, so committed ts-rs output that only differs + # by incidental EOL spaces is left alone (no whitespace-only churn). + if not path.exists() or normalize_generated(path.read_text(encoding="utf-8")) != content: path.write_text(content, encoding="utf-8") -def main() -> int: - check = "--check" in sys.argv[1:] - +def export(test_args: list[str]) -> dict[str, str]: + """Run one crate's export tests into a temp dir and return its manifest.""" with tempfile.TemporaryDirectory(prefix="ts-rs-export-") as tmp: - regenerate(Path(tmp)) + regenerate(test_args, Path(tmp)) expected = manifest(Path(tmp)) - if not expected: - print( - "ERROR: the export tests wrote nothing to the temporary " - "TS_RS_EXPORT_DIR — is it overridden with force = true in " - ".cargo/config.toml?", - file=sys.stderr, - ) - return 2 - - if not check: - sync(expected) - TYPES_TS.write_text(aggregate(expected), encoding="utf-8") - print(f"{len(expected)} files written to {TYPES_DIR.relative_to(ROOT)}") - return 0 - - actual = manifest(TYPES_DIR) if TYPES_DIR.is_dir() else {} + if not expected: + print( + "ERROR: the export tests wrote nothing to the temporary " + "TS_RS_EXPORT_DIR — is it overridden with force = true in " + ".cargo/config.toml?", + file=sys.stderr, + ) + sys.exit(2) + return expected + + +def check_target( + expected: dict[str, str], types_dir: Path, types_ts: Path | None +) -> bool: + actual = manifest(types_dir) if types_dir.is_dir() else {} missing = sorted(expected.keys() - actual.keys()) stale = sorted(actual.keys() - expected.keys()) changed = sorted(k for k in expected.keys() & actual.keys() if expected[k] != actual[k]) - try: - aggregate_ok = TYPES_TS.read_text(encoding="utf-8") == aggregate(expected) - except FileNotFoundError: - aggregate_ok = False - + aggregate_ok = True + if types_ts is not None: + try: + aggregate_ok = types_ts.read_text(encoding="utf-8") == aggregate(expected) + except FileNotFoundError: + aggregate_ok = False + + rel = types_dir.relative_to(ROOT) if missing or stale or changed or not aggregate_ok: - rel = TYPES_DIR.relative_to(ROOT) for f in missing: print(f"MISSING: {rel}/{f} (generated, but not committed)", file=sys.stderr) for f in stale: print(f"STALE: {rel}/{f} (committed, but no longer generated)", file=sys.stderr) for f in changed: print(f"CHANGED: {rel}/{f}", file=sys.stderr) - if not aggregate_ok: - print(f"CHANGED: {TYPES_TS.relative_to(ROOT)}", file=sys.stderr) + if not aggregate_ok and types_ts is not None: + print(f"CHANGED: {types_ts.relative_to(ROOT)}", file=sys.stderr) + return False + + print(f"{rel}: {len(expected)} files up to date") + return True + + +def main() -> int: + check = "--check" in sys.argv[1:] + if check and not check_export_gates(): + return 1 + ok = True + + for test_args, types_dir, types_ts, _ in TARGETS: + expected = export(test_args) + if not check: + sync(types_dir, expected) + if types_ts is not None: + types_ts.write_text(aggregate(expected), encoding="utf-8") + print(f"{len(expected)} files written to {types_dir.relative_to(ROOT)}") + else: + ok = check_target(expected, types_dir, types_ts) and ok + + if not ok: print( "generated ts-rs types are out of sync — " "run scripts/gen_ts_types.py and commit the result", file=sys.stderr, ) return 1 - - print(f"{len(expected)} files up to date") return 0 diff --git a/tools/aimux-web/Cargo.toml b/tools/aimux-web/Cargo.toml index 361ce8832..cf9411e19 100644 --- a/tools/aimux-web/Cargo.toml +++ b/tools/aimux-web/Cargo.toml @@ -18,6 +18,9 @@ path = "src/main.rs" # `web/dist` to exist at compile time (run `npm run build` first). Dev builds # (default) keep serving from disk so the frontend can hot-reload. embed-frontend = ["dep:rust-embed"] +# Emit the wire types' ts-rs export tests. Enabled only by +# scripts/gen_ts_types.py, which points TS_RS_EXPORT_DIR at a temp directory. +ts-export = [] [dependencies] aimux-core = { workspace = true } @@ -25,6 +28,7 @@ aimux-providers = { workspace = true } tokio = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } +ts-rs = { workspace = true } anyhow = { workspace = true } futures = { workspace = true } async-stream = { workspace = true } diff --git a/tools/aimux-web/README.md b/tools/aimux-web/README.md index a14bdba6a..afd90e759 100644 --- a/tools/aimux-web/README.md +++ b/tools/aimux-web/README.md @@ -132,15 +132,21 @@ tools/aimux-web/ └── web/ Vue 3 + shadcn 风格 + Tailwind + markstream-vue ├── src/agent/engine.ts 前端 agent loop 引擎 ├── src/api/client.ts SSE/端点封装 - └── src/types/ d.ts(core 类型来自 ts-rs,见下) + └── src/types/generated/ wire 类型(ts-rs 生成,勿手改) ``` ## 前端类型来源 - **core 类型**(`Recording`/`StreamPart`/`TraceRecord`/`SessionView` 等):ts-rs 从 `aimux-core` 生成到 `bindings/node/src/types/`(`scripts/gen_ts_types.py` 管线), - **拷贝**到 `web/src/types/` 供前端使用。改 core 类型后:跑 `scripts/gen_ts_types.py` - 并同步拷贝。 -- **wire 类型**(`Wire*.ts`):是 aimux-web 的 API 契约,**手动维护**在 - `web/src/types/`(不 ts-rs 导出,避免污染 node bindings 的导出目录)。 - 改 `src/wire.rs` 时同步更新对应的 `web/src/types/Wire*.ts`。 + 前端通过 `tsconfig.json` 的 `@aimux/types/*` 别名(`import type { Recording } from '@aimux/types/Recording'`) + 直接使用该受 CI 漂移检查保护的生成目录,不拷贝。别名只服务类型导入(构建时擦除), + 不要用它做值导入。改 core 类型后只需运行 `scripts/gen_ts_types.py`。 +- **wire 类型**(`Wire*.ts`):aimux-web 的 API 契约,由 ts-rs 从 `src/wire.rs` 生成到 + `web/src/types/generated/`(同样由 `scripts/gen_ts_types.py` 生成、CI `--check` 防漂移)。 + 不导出到 `bindings/node`,因为它们属于前端而非 node 绑定。改 `src/wire.rs` 后运行 + `scripts/gen_ts_types.py` 并一起提交,**不要手改** `generated/` 下的文件。 +- **类型导出**:`aimux-core` 和 `aimux-web` 都通过 `ts-export` feature 门控导出测试, + 普通 `cargo test` 不写入类型文件。`scripts/gen_ts_types.py` 是唯一写入入口, + 由它启用 feature,先在临时目录导出再同步到受跟踪目录;CI 用 `--check` 检查漂移和 + 未门控的导出属性。 diff --git a/tools/aimux-web/src/wire.rs b/tools/aimux-web/src/wire.rs index 9c81503f4..91382960b 100644 --- a/tools/aimux-web/src/wire.rs +++ b/tools/aimux-web/src/wire.rs @@ -6,6 +6,7 @@ use std::collections::HashMap; use serde::{Deserialize, Serialize}; use serde_json::Value; +use ts_rs::TS; use aimux_core::content::ContentPart; use aimux_core::error::AiMuxError; @@ -16,15 +17,19 @@ use aimux_core::tool::{FunctionTool, Tool}; // ───────────────────────────────────────────────────────────────────────────── // Wire request types — the console's API surface. // -// The corresponding TypeScript declarations live in `web/src/types/Wire*.ts` -// (committed). They are NOT ts-rs `#[ts(export)]`ed here: the repo's global -// `TS_RS_EXPORT_DIR` points at `bindings/node/src/types`, and these types -// belong to the web frontend, not the node bindings. Keep the committed -// `web/src/types/Wire*.ts` in sync when changing these structs. +// The corresponding TypeScript declarations are generated by ts-rs into +// `web/src/types/generated/` by `scripts/gen_ts_types.py` (CI runs `--check`). +// They are exported to that directory, not `bindings/node/src/types`, because +// these types belong to the web frontend, not the node bindings. The export +// tests are gated behind the `ts-export` feature so a plain `cargo test` (which +// would write to the workspace-wide `TS_RS_EXPORT_DIR`, i.e. the node bindings) +// never emits them; only the generator enables it. Never edit the generated +// files by hand. // ───────────────────────────────────────────────────────────────────────────── /// One model call from the console (RFC-0029 §5.3). -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct WireCallRequest { /// Registry name or native protocol name ("openai", "deepseek", …). pub provider: String, @@ -59,7 +64,8 @@ fn default_true() -> bool { true } -#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct WireOptions { #[serde(default, skip_serializing_if = "Option::is_none")] pub temperature: Option, @@ -85,7 +91,8 @@ pub struct WireOptions { } /// A function tool definition (JSON Schema parameters). -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct WireTool { pub name: String, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -95,7 +102,8 @@ pub struct WireTool { } /// A chat message in the wire format. -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct WireMessage { /// "system" | "user" | "assistant" | "tool". pub role: String, @@ -103,7 +111,8 @@ pub struct WireMessage { } /// A content part in the wire format. -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[cfg_attr(feature = "ts-export", ts(export))] #[serde(tag = "type", rename_all = "snake_case")] pub enum WireContentPart { Text { @@ -125,7 +134,8 @@ pub enum WireContentPart { } /// Response for non-streaming calls. -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct WireCallResponse { pub text: String, pub finish_reason: Value, @@ -137,7 +147,8 @@ pub struct WireCallResponse { } /// SSE `meta` event payload — the frontend trace anchor (RFC-0029 §5.2). -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[cfg_attr(feature = "ts-export", ts(export))] pub struct WireMeta { pub call_id: String, #[serde(default, skip_serializing_if = "Option::is_none")] diff --git a/tools/aimux-web/web/src/agent/engine.ts b/tools/aimux-web/web/src/agent/engine.ts index 3065e8d45..41f7170c0 100644 --- a/tools/aimux-web/web/src/agent/engine.ts +++ b/tools/aimux-web/web/src/agent/engine.ts @@ -7,8 +7,8 @@ // so the Traces page groups the whole run into a waterfall. import { api, callStream, parseStreamPart } from '../api/client' -import type { WireCallRequest } from '../types/WireCallRequest' -import type { StreamPart } from '../types/StreamPart' +import type { WireCallRequest } from '@/types/generated/WireCallRequest' +import type { StreamPart } from '@aimux/types/StreamPart' /** A chat message as sent to the backend (loose typing: the backend wire * schema's `JsonValue` is a recursive union that trips TS2589 inside diff --git a/tools/aimux-web/web/src/api/client.ts b/tools/aimux-web/web/src/api/client.ts index dba199ea3..97bc7a2ca 100644 --- a/tools/aimux-web/web/src/api/client.ts +++ b/tools/aimux-web/web/src/api/client.ts @@ -1,11 +1,11 @@ // API client — typed wrappers for the console endpoints (RFC-0029 §5). -import type { WireCallRequest } from '../types/WireCallRequest' -import type { WireCallResponse } from '../types/WireCallResponse' -import type { Recording } from '../types/Recording' -import type { TraceRecord } from '../types/TraceRecord' -import type { SessionView } from '../types/SessionView' -import type { StreamPart } from '../types/StreamPart' +import type { WireCallRequest } from '@/types/generated/WireCallRequest' +import type { WireCallResponse } from '@/types/generated/WireCallResponse' +import type { Recording } from '@aimux/types/Recording' +import type { TraceRecord } from '@aimux/types/TraceRecord' +import type { SessionView } from '@aimux/types/SessionView' +import type { StreamPart } from '@aimux/types/StreamPart' const API = '/api' diff --git a/tools/aimux-web/web/src/types/AiMuxError.ts b/tools/aimux-web/web/src/types/AiMuxError.ts deleted file mode 100644 index 72b4c339d..000000000 --- a/tools/aimux-web/web/src/types/AiMuxError.ts +++ /dev/null @@ -1,27 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ApiCallError } from "./ApiCallError"; - -/** - * Unified error type for all aimux operations. - * - * Variants are cut by *what the caller does about it*, not by where the - * failure came from. `ApiCall` carries the [`ApiCallError`] detail inline - * (unboxed, like async-openai's `ApiError(ApiError)`); the size guard in - * `error_value_golden_test` keeps the enum under clippy's - * `result_large_err` threshold. - * - * Constructed as a named struct literal everywhere - * (`ApiCallError { status_code: .., ..Default::default() }`), the same - * shape as the AI SDK's named-options constructor. - */ -export type AiMuxError = { "ApiCall": ApiCallError } | { "JsonParse": string } | { "InvalidResponseData": string } | { "NoSuchTool": { tool_name: string, available_tools?: Array | null, -/** - * Original argument text, when supplied by the provider. Absent in - * older serialized errors and errors constructed without a call. - */ -tool_input?: string | null, } } | { "InvalidToolInput": { tool_name: string, tool_input: string, cause: string, } } | { "ToolCallRepair": { original_error: AiMuxError, cause: AiMuxError, } } | { "InvalidArgument": string } | { "InvalidPrompt": string } | { "TokenExpired": string } | { "UnsupportedFunctionality": string } | { "NoSuchModel": { model_id: string, -/** - * What kind of model was requested (`"languageModel"`, - * `"imageModel"`, …), the AI SDK's `modelType`. - */ -model_type: string, } } | { "NoSuchProvider": { provider_id: string, } } | { "Timeout": string } | "Aborted" | { "Other": string }; diff --git a/tools/aimux-web/web/src/types/ApiCallError.ts b/tools/aimux-web/web/src/types/ApiCallError.ts deleted file mode 100644 index dfb248300..000000000 --- a/tools/aimux-web/web/src/types/ApiCallError.ts +++ /dev/null @@ -1,66 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * What a failed API call observed — the field set of the AI SDK's - * `APICallError` (`statusCode` / `responseBody`), which this project's error - * taxonomy mirrors (docs/internal/vercel-research/07-kernel-infrastructure.md). - * - * Carried by [`AiMuxError::ApiCall`] alone. There are no per-status - * variants: a 401, 404 or 429 is an `ApiCall` error whose classification is - * read from `status_code`, exactly as the AI SDK reads - * `APICallError.statusCode`. Transport failures (connection reset, DNS, - * body read) are `ApiCall` errors too — no response arrived, so - * `status_code` is `None` and `is_retryable` is `true`, exactly as the AI - * SDK's `handleFetchError` builds an `APICallError` with no `statusCode` - * and `isRetryable: true`. `message` holds the provider's text **only** — - * the status is a field, never baked into the string; `Display` composes - * the human-readable form from the fields at print time, so nothing - * downstream has to parse it back out. - * - * `APICallError` fields not carried in this round: `url` / - * `requestBodyValues` / `responseHeaders` (the request context is not - * available at the error-construction sites today; all fields are - * `#[serde(default)]`, so adding them later is not a breaking change). - */ -export type ApiCallError = { -/** - * HTTP status of the response, when it came from one - * (`APICallError.statusCode`). Always the *observed* status: the HTTP - * layer fills it for every response-derived error; errors built without - * an HTTP exchange leave it `None`. - */ -status_code: number | null, -/** - * Provider's machine-readable code (OpenAI's `code`/`type`, - * e.g. `"rate_limit_exceeded"` vs `"insufficient_quota"`). Never an HTTP - * status. Our normalized take on `APICallError.data`. - */ -provider_code: string | null, -/** - * The provider's message, verbatim. No status prefix. - */ -message: string, -/** - * The raw response body, verbatim (`APICallError.responseBody`) — the - * lossless evidence when `message`/`provider_code` are extractions. - * `None` when the error did not come from a response body. - */ -response_body: string | null, -/** - * Provider-assigned request id, from the `x-request-id` / `request-id` - * response header when one was sent. Filled by the shared HTTP layer. - */ -request_id: string | null, -/** - * Retry hint in milliseconds, distilled from the `retry-after-ms` / - * `retry-after` response headers on a 429. The classification lives in - * `status_code`; this is the matching action input. - */ -retry_after_ms: number | null, -/** - * Whether retrying can help (`APICallError.isRetryable`) — stored at - * construction, exactly like the AI SDK: the response path computes it - * from the status (408/409/429 or 5xx), and the transport path (no response, so - * no status to compute from) sets it to `true` explicitly. - */ -is_retryable: boolean, }; diff --git a/tools/aimux-web/web/src/types/AspectRatio.ts b/tools/aimux-web/web/src/types/AspectRatio.ts deleted file mode 100644 index c466b9b65..000000000 --- a/tools/aimux-web/web/src/types/AspectRatio.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Aspect ratio in `{width}:{height}` format (e.g. `"16:9"`). - * - * Newtype that enforces the `W:H` format used by V4 image and video - * `aspectRatio` options. Aligned with the TS template-literal type - * `` `${number}:${number}` ``. - */ -export type AspectRatio = { width: number, height: number, }; diff --git a/tools/aimux-web/web/src/types/AudioChunk.ts b/tools/aimux-web/web/src/types/AudioChunk.ts deleted file mode 100644 index 062104028..000000000 --- a/tools/aimux-web/web/src/types/AudioChunk.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A chunk of audio in a streaming transcription request. - */ -export type AudioChunk = { "Binary": Array } | { "Base64": string }; diff --git a/tools/aimux-web/web/src/types/AudioData.ts b/tools/aimux-web/web/src/types/AudioData.ts deleted file mode 100644 index b2ae98665..000000000 --- a/tools/aimux-web/web/src/types/AudioData.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Generated audio: a base64-encoded string or raw binary bytes. - * - * The TS result type is `string | Uint8Array`. Providers should return data - * without unnecessary conversion. - */ -export type AudioData = { "Base64": string } | { "Binary": Array }; diff --git a/tools/aimux-web/web/src/types/AudioInput.ts b/tools/aimux-web/web/src/types/AudioInput.ts deleted file mode 100644 index e513ffda3..000000000 --- a/tools/aimux-web/web/src/types/AudioInput.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Audio input: raw bytes or a base64-encoded string. - */ -export type AudioInput = { "Binary": Array } | { "Base64": string }; diff --git a/tools/aimux-web/web/src/types/BreakKind.ts b/tools/aimux-web/web/src/types/BreakKind.ts deleted file mode 100644 index 43aad850d..000000000 --- a/tools/aimux-web/web/src/types/BreakKind.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type BreakKind = "SystemChanged" | "ToolsChanged" | "ConversationReset" | "Unknown"; diff --git a/tools/aimux-web/web/src/types/CallOptions.ts b/tools/aimux-web/web/src/types/CallOptions.ts deleted file mode 100644 index 5e9056a60..000000000 --- a/tools/aimux-web/web/src/types/CallOptions.ts +++ /dev/null @@ -1,114 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { LanguageModelPromptMessage } from "./LanguageModelPromptMessage"; -import type { ReasoningEffort } from "./ReasoningEffort"; -import type { ResponseFormat } from "./ResponseFormat"; -import type { TimeoutConfiguration } from "./TimeoutConfiguration"; -import type { Tool } from "./Tool"; -import type { ToolChoice } from "./ToolChoice"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Options passed to `LanguageModel::do_generate` / `do_stream`. - * - * This is the **provider-facing** options struct. Users interact with - * `GenerateTextOptions` (user-facing) which is converted to `CallOptions` - * by the `generate_text` / `stream_text` functions. - */ -export type CallOptions = { -/** - * The standardized prompt (message array). Required. - */ -prompt: Array, -/** - * Maximum tokens to generate. - */ -max_output_tokens: number | null, -/** - * Sampling temperature. - */ -temperature: number | null, -/** - * Stop sequences. - */ -stop_sequences: Array | null, -/** - * Nucleus sampling `top_p`. - */ -top_p: number | null, -/** - * Top-k sampling. - */ -top_k: number | null, -/** - * Presence penalty. - */ -presence_penalty: number | null, -/** - * Frequency penalty. - */ -frequency_penalty: number | null, -/** - * Response format (text or JSON). - */ -response_format: ResponseFormat | null, -/** - * Seed for reproducibility. - */ -seed: number | null, -/** - * Tools available to the model (function tools and/or provider-defined tools). - */ -tools: Array | null, -/** - * How the model should choose tools. - */ -tool_choice: ToolChoice, -/** - * Extra HTTP headers. - */ -headers: { [key in string]: string } | null, -/** - * Provider-specific options (keyed by provider name). - */ -provider_options: { [key in string]: JsonValue } | null, -/** - * Top-level reasoning effort. Maps to OpenAI `reasoning_effort` and - * Anthropic `thinking` config. - */ -reasoning: ReasoningEffort | null, -/** - * Per-call request body overrides. Deep-merged into the provider-built - * request body (after any built-in vendor override) before sending. - * `null` values delete the corresponding key. See RFC-0017. - */ -body_overrides: JsonValue | null, -/** - * Per-call retry count override. `None` uses the provider's configured - * `RetryConfig.max_retries`. `Some(0)` disables retries. - */ -max_retries: number | null, -/** - * Per-call timeout configuration (total / first-chunk / chunk idle). - * `None` = no timeouts (provider defaults still apply at the HTTP layer). - */ -timeout: TimeoutConfiguration | null, -/** - * Session identifier, for grouping consecutive calls into a session - * (observability, see RFC-0024). Explicit values take precedence; when - * `None` and the optional session inferer is enabled, one may be inferred. - * Orthogonal to RFC-0019 session-affinity headers: this field is for - * local grouping, while session headers in `headers` are for upstream - * routing — both may share an id value but travel different paths. - */ -session_id: string | null, -/** - * Emit raw provider stream chunks as `StreamPart::Raw` (debugging aid). - * When `Some(true)`, streaming providers yield one `Raw` part per JSON - * SSE event, carrying the **parsed JSON payload** of the event, emitted - * before the parsed parts. Excludes the `[DONE]` sentinel; unparsable - * chunks emit only `Error`. `null`/`Some(false)` = off. - * Currently honored by the OpenAI-compatible family (openai / azure / - * openai-compatible registry providers); other provider families ignore - * it for now (RFC-0016 M2). - */ -include_raw_chunks: boolean | null, }; diff --git a/tools/aimux-web/web/src/types/CatalogueSource.ts b/tools/aimux-web/web/src/types/CatalogueSource.ts deleted file mode 100644 index 5fa0754bc..000000000 --- a/tools/aimux-web/web/src/types/CatalogueSource.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Where a [`ModelSpec`] came from. - */ -export type CatalogueSource = "Anya2a" | "ModelsDev" | "Manual"; diff --git a/tools/aimux-web/web/src/types/ChatCompletion.ts b/tools/aimux-web/web/src/types/ChatCompletion.ts deleted file mode 100644 index 62b7f7f97..000000000 --- a/tools/aimux-web/web/src/types/ChatCompletion.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ChatCompletionChoice } from "./ChatCompletionChoice"; -import type { ChatCompletionUsage } from "./ChatCompletionUsage"; - -/** - * A complete Chat Completion response (non-streaming). - * - * Mirrors the OpenAI `chat.completion` object. - */ -export type ChatCompletion = { id: string, object: string, created: bigint, model: string, choices: Array, usage: ChatCompletionUsage, system_fingerprint: string | null, }; diff --git a/tools/aimux-web/web/src/types/ChatCompletionChoice.ts b/tools/aimux-web/web/src/types/ChatCompletionChoice.ts deleted file mode 100644 index c9f24fde1..000000000 --- a/tools/aimux-web/web/src/types/ChatCompletionChoice.ts +++ /dev/null @@ -1,5 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ChatCompletionMessage } from "./ChatCompletionMessage"; -import type { JsonValue } from "./serde_json/JsonValue"; - -export type ChatCompletionChoice = { index: number, message: ChatCompletionMessage, finish_reason: string | null, logprobs: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/ChatCompletionChunk.ts b/tools/aimux-web/web/src/types/ChatCompletionChunk.ts deleted file mode 100644 index 97bd66a31..000000000 --- a/tools/aimux-web/web/src/types/ChatCompletionChunk.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ChatCompletionChunkChoice } from "./ChatCompletionChunkChoice"; -import type { ChatCompletionUsage } from "./ChatCompletionUsage"; - -/** - * A single Chat Completion chunk (streaming). - * - * Mirrors the OpenAI `chat.completion.chunk` object. - */ -export type ChatCompletionChunk = { id: string, object: string, created: bigint, model: string, choices: Array, usage: ChatCompletionUsage | null, }; diff --git a/tools/aimux-web/web/src/types/ChatCompletionChunkChoice.ts b/tools/aimux-web/web/src/types/ChatCompletionChunkChoice.ts deleted file mode 100644 index e56df7c79..000000000 --- a/tools/aimux-web/web/src/types/ChatCompletionChunkChoice.ts +++ /dev/null @@ -1,5 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ChatCompletionDelta } from "./ChatCompletionDelta"; -import type { JsonValue } from "./serde_json/JsonValue"; - -export type ChatCompletionChunkChoice = { index: number, delta: ChatCompletionDelta, finish_reason: string | null, logprobs: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/ChatCompletionChunkFunction.ts b/tools/aimux-web/web/src/types/ChatCompletionChunkFunction.ts deleted file mode 100644 index b42f91a3d..000000000 --- a/tools/aimux-web/web/src/types/ChatCompletionChunkFunction.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ChatCompletionChunkFunction = { name: string | null, arguments: string | null, }; diff --git a/tools/aimux-web/web/src/types/ChatCompletionChunkToolCall.ts b/tools/aimux-web/web/src/types/ChatCompletionChunkToolCall.ts deleted file mode 100644 index d54deb19f..000000000 --- a/tools/aimux-web/web/src/types/ChatCompletionChunkToolCall.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ChatCompletionChunkFunction } from "./ChatCompletionChunkFunction"; - -export type ChatCompletionChunkToolCall = { index: number, id: string | null, type: string | null, function: ChatCompletionChunkFunction, }; diff --git a/tools/aimux-web/web/src/types/ChatCompletionDelta.ts b/tools/aimux-web/web/src/types/ChatCompletionDelta.ts deleted file mode 100644 index b668adba8..000000000 --- a/tools/aimux-web/web/src/types/ChatCompletionDelta.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ChatCompletionChunkToolCall } from "./ChatCompletionChunkToolCall"; - -export type ChatCompletionDelta = { role: string | null, content: string | null, reasoning_content: string | null, tool_calls: Array | null, }; diff --git a/tools/aimux-web/web/src/types/ChatCompletionFunction.ts b/tools/aimux-web/web/src/types/ChatCompletionFunction.ts deleted file mode 100644 index 58a9fd050..000000000 --- a/tools/aimux-web/web/src/types/ChatCompletionFunction.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ChatCompletionFunction = { name: string, arguments: string, }; diff --git a/tools/aimux-web/web/src/types/ChatCompletionMessage.ts b/tools/aimux-web/web/src/types/ChatCompletionMessage.ts deleted file mode 100644 index f9e728dc4..000000000 --- a/tools/aimux-web/web/src/types/ChatCompletionMessage.ts +++ /dev/null @@ -1,5 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ChatCompletionToolCall } from "./ChatCompletionToolCall"; -import type { JsonValue } from "./serde_json/JsonValue"; - -export type ChatCompletionMessage = { role: string, content: string | null, reasoning_content: string | null, tool_calls: Array | null, annotations: Array | null, }; diff --git a/tools/aimux-web/web/src/types/ChatCompletionToolCall.ts b/tools/aimux-web/web/src/types/ChatCompletionToolCall.ts deleted file mode 100644 index e91f0aab5..000000000 --- a/tools/aimux-web/web/src/types/ChatCompletionToolCall.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ChatCompletionFunction } from "./ChatCompletionFunction"; - -export type ChatCompletionToolCall = { id: string, type: string, function: ChatCompletionFunction, }; diff --git a/tools/aimux-web/web/src/types/ChatCompletionUsage.ts b/tools/aimux-web/web/src/types/ChatCompletionUsage.ts deleted file mode 100644 index 3306f7cfd..000000000 --- a/tools/aimux-web/web/src/types/ChatCompletionUsage.ts +++ /dev/null @@ -1,5 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CompletionTokensDetails } from "./CompletionTokensDetails"; -import type { PromptTokensDetails } from "./PromptTokensDetails"; - -export type ChatCompletionUsage = { prompt_tokens: number, completion_tokens: number, total_tokens: number, prompt_tokens_details: PromptTokensDetails | null, completion_tokens_details: CompletionTokensDetails | null, }; diff --git a/tools/aimux-web/web/src/types/CompletionTokensDetails.ts b/tools/aimux-web/web/src/types/CompletionTokensDetails.ts deleted file mode 100644 index 4b25482aa..000000000 --- a/tools/aimux-web/web/src/types/CompletionTokensDetails.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type CompletionTokensDetails = { reasoning_tokens: number | null, }; diff --git a/tools/aimux-web/web/src/types/ContentPart.ts b/tools/aimux-web/web/src/types/ContentPart.ts deleted file mode 100644 index 56108da87..000000000 --- a/tools/aimux-web/web/src/types/ContentPart.ts +++ /dev/null @@ -1,72 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * A part of a multi-part message. - * - * Shared between `ModelMessage` (user-facing) and `LanguageModelPrompt` (provider-facing). - */ -export type ContentPart = { "type": "text", text: string, -/** - * Provider-specific options for this part (e.g. `openai.promptCacheBreakpoint`). - */ -provider_options?: JsonValue | null, } | { "type": "image", image: Array, media_type: string, provider_options?: JsonValue | null, } | { "type": "file", data: Array, media_type: string, filename?: string | null, provider_options?: JsonValue | null, } | { "type": "file_base64", data: string, media_type: string, filename?: string | null, provider_options?: JsonValue | null, } | { "type": "file_url", url: string, media_type: string, provider_options?: JsonValue | null, } | { "type": "file_reference", media_type: string, reference: JsonValue, filename?: string | null, provider_options?: JsonValue | null, } | { "type": "reasoning", text: string, signature: string | null, -/** - * Provider-specific options for this part (e.g. - * `anthropic.signature`, `anthropic.redactedData`, - * `anthropic.cacheControl`). - */ -provider_options?: JsonValue | null, } | { "type": "tool_call", tool_call_id: string, tool_name: string, -/** - * Arguments as a JSON value (usually an object). - */ -input: JsonValue, -/** - * Whether the tool call is executed by the provider rather than by - * the client. This is part of the prompt contract because providers - * need it to replay server tool calls on a later turn. - */ -provider_executed?: boolean | null, -/** - * Provider-assigned thought signature (e.g. Google Gemini - * `thoughtSignature`). Must be echoed back verbatim on the follow-up - * turn when the tool result is sent. - */ -thought_signature?: string | null, -/** - * Provider-specific options for this part (e.g. - * `anthropic.cacheControl`). - */ -provider_options?: JsonValue | null, } | { "type": "tool_result", tool_call_id: string, -/** - * The tool's output (usually a JSON value or plain text). - * - * Accepts the legacy `output` field name (used by the Vercel AI SDK - * and the 0.1.0 TypeScript bindings) as an alias during deserialization, - * so multi-part tool messages constructed either way round-trip - * correctly. Serialization always emits `result`. - */ -result: JsonValue, -/** - * The name of the tool that produced this result (optional on the - * user-input side; providers that need it can look it up from the - * preceding tool call). - */ -tool_name?: string | null, -/** - * Whether the result is an error or error message. - */ -is_error?: boolean | null, -/** - * Whether the result is preliminary (replaces prior, e.g. image previews). - */ -preliminary?: boolean | null, -/** - * Whether the tool is dynamic (defined at runtime, e.g. MCP tools). - */ -dynamic?: boolean | null, -/** - * Provider-specific options for this part (e.g. - * `anthropic.cacheControl`). - */ -provider_options?: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/EmbeddingCallOptions.ts b/tools/aimux-web/web/src/types/EmbeddingCallOptions.ts deleted file mode 100644 index c78a34769..000000000 --- a/tools/aimux-web/web/src/types/EmbeddingCallOptions.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Options passed to [`EmbeddingModel::do_embed`]. - * - * Aligned with V4 `EmbeddingModelV4CallOptions`. - */ -export type EmbeddingCallOptions = { -/** - * List of text values to generate embeddings for. - */ -values: Array, -/** - * Additional provider-specific options, keyed by provider name. - */ -provider_options: { [key in string]: JsonValue } | null, -/** - * Additional HTTP headers to send with the request. - */ -headers: { [key in string]: string } | null, }; diff --git a/tools/aimux-web/web/src/types/EmbeddingResponse.ts b/tools/aimux-web/web/src/types/EmbeddingResponse.ts deleted file mode 100644 index c758f7b32..000000000 --- a/tools/aimux-web/web/src/types/EmbeddingResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Debugging response info specific to embedding calls. - */ -export type EmbeddingResponse = { -/** - * Response headers. - */ -headers: { [key in string]: string } | null, -/** - * The response body (opaque JSON). - */ -body: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/EmbeddingResult.ts b/tools/aimux-web/web/src/types/EmbeddingResult.ts deleted file mode 100644 index 81b741d23..000000000 --- a/tools/aimux-web/web/src/types/EmbeddingResult.ts +++ /dev/null @@ -1,32 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { EmbeddingResponse } from "./EmbeddingResponse"; -import type { EmbeddingUsage } from "./EmbeddingUsage"; -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * The result of [`EmbeddingModel::do_embed`]. - * - * Aligned with V4 `EmbeddingModelV4Result`. - */ -export type EmbeddingResult = { -/** - * Generated embeddings, in the same order as the input `values`. - */ -embeddings: Array>, -/** - * Token usage (input tokens only). - */ -usage: EmbeddingUsage | null, -/** - * Additional provider-specific metadata. - */ -provider_metadata: { [key in string]: JsonValue } | null, -/** - * Optional response information for debugging. - */ -response: EmbeddingResponse | null, -/** - * Warnings for the call, e.g. unsupported settings. - */ -warnings: Array, }; diff --git a/tools/aimux-web/web/src/types/EmbeddingUsage.ts b/tools/aimux-web/web/src/types/EmbeddingUsage.ts deleted file mode 100644 index 08a49377b..000000000 --- a/tools/aimux-web/web/src/types/EmbeddingUsage.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Token usage for an embedding call. Embeddings only report input tokens. - */ -export type EmbeddingUsage = { -/** - * Number of input tokens consumed. - */ -tokens: number, }; diff --git a/tools/aimux-web/web/src/types/FileBytes.ts b/tools/aimux-web/web/src/types/FileBytes.ts deleted file mode 100644 index b06229434..000000000 --- a/tools/aimux-web/web/src/types/FileBytes.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Either raw bytes or a base64-encoded string. - * - * Providers should pass file data through without unnecessary conversion: if - * the upstream API returns base64, return [`FileBytes::Base64`]; if it - * returns binary, return [`FileBytes::Binary`]. - */ -export type FileBytes = { "Binary": Array } | { "Base64": string }; diff --git a/tools/aimux-web/web/src/types/FileData.ts b/tools/aimux-web/web/src/types/FileData.ts deleted file mode 100644 index 1fdfc2444..000000000 --- a/tools/aimux-web/web/src/types/FileData.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FileBytes } from "./FileBytes"; - -/** - * File data as a tagged discriminated union. - * - * Aligned with V4 `SharedV4FileData`. - */ -export type FileData = { "Data": { data: FileBytes, } } | { "Url": { url: string, } } | { "Reference": { reference: { [key in string]: string }, } } | { "Text": { text: string, } }; diff --git a/tools/aimux-web/web/src/types/FilePart.ts b/tools/aimux-web/web/src/types/FilePart.ts deleted file mode 100644 index b4676404e..000000000 --- a/tools/aimux-web/web/src/types/FilePart.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FileData } from "./FileData"; - -/** - * A file generated by the model, extracted to the top level (M7). - */ -export type FilePart = { data: FileData, media_type: string, }; diff --git a/tools/aimux-web/web/src/types/Fingerprint.ts b/tools/aimux-web/web/src/types/Fingerprint.ts deleted file mode 100644 index 0849548a0..000000000 --- a/tools/aimux-web/web/src/types/Fingerprint.ts +++ /dev/null @@ -1,20 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Serialized-wire fingerprint stored in a `TraceRecord` (hex strings — - * `u128` is not JSON-serializable). - */ -export type Fingerprint = { -/** - * 128-bit hash of the whole denoised body (hex). - */ -body_hash: string, len_bytes: bigint, block_size: bigint, -/** - * Block-hash chain (hex), one entry per block. - */ -block_hashes: Array, -/** - * Token estimate — byte proxy `len_bytes / 4` when no tokenizer is - * attached (RFC-0015 §4.1: W capped at one block in this mode). - */ -token_estimate: bigint, }; diff --git a/tools/aimux-web/web/src/types/FinishReason.ts b/tools/aimux-web/web/src/types/FinishReason.ts deleted file mode 100644 index 3e557eb11..000000000 --- a/tools/aimux-web/web/src/types/FinishReason.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FinishReasonUnified } from "./FinishReasonUnified"; - -/** - * Unified finish reason (why the model stopped generating). - */ -export type FinishReason = { -/** - * The unified reason. - */ -unified: FinishReasonUnified, -/** - * The raw provider-specific reason string. - */ -raw: string | null, }; diff --git a/tools/aimux-web/web/src/types/FinishReasonUnified.ts b/tools/aimux-web/web/src/types/FinishReasonUnified.ts deleted file mode 100644 index cf09e862d..000000000 --- a/tools/aimux-web/web/src/types/FinishReasonUnified.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Unified finish reason enum (aligned with V4 `LanguageModelV4FinishReason`). - */ -export type FinishReasonUnified = "stop" | "length" | "content-filter" | "tool-calls" | "error" | "other"; diff --git a/tools/aimux-web/web/src/types/FunctionTool.ts b/tools/aimux-web/web/src/types/FunctionTool.ts deleted file mode 100644 index a79887e0c..000000000 --- a/tools/aimux-web/web/src/types/FunctionTool.ts +++ /dev/null @@ -1,34 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * A tool definition passed to the model in `CallOptions.tools`. - */ -export type FunctionTool = { -/** - * Unique tool name. - */ -name: string, -/** - * Human-readable description. - */ -description: string | null, -/** - * JSON Schema describing the tool's parameters. - */ -input_schema: JsonValue, -/** - * Whether the tool supports strict schema enforcement (OpenAI strict mode). - */ -strict: boolean | null, -/** - * Provider-specific options, keyed by provider name - * (e.g. `{"anthropic": {"eagerInputStreaming": true}}`). Aligned with the - * V4 `providerOptions` field on function tools. - */ -provider_options?: { [key in string]: JsonValue } | null, -/** - * Example inputs for the tool (V4 `inputExamples`), used by some providers - * to emit `input_examples` in the request body. - */ -input_examples?: Array | null, }; diff --git a/tools/aimux-web/web/src/types/GenerateContent.ts b/tools/aimux-web/web/src/types/GenerateContent.ts deleted file mode 100644 index a64676c52..000000000 --- a/tools/aimux-web/web/src/types/GenerateContent.ts +++ /dev/null @@ -1,43 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FileData } from "./FileData"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * A content item in the generation result. - */ -export type GenerateContent = { "Text": { text: string, provider_metadata?: JsonValue | null, } } | { "ToolCall": { tool_call_id: string, tool_name: string, input: JsonValue, -/** - * Whether the tool call will be executed by the provider. - * If false/unset, the tool call is executed by the client. - */ -provider_executed?: boolean | null, -/** - * Whether the tool is dynamic (defined at runtime, e.g. MCP tools). - */ -dynamic?: boolean | null, -/** - * Provider-assigned thought signature (e.g. Google Gemini - * `thoughtSignature`). Must be echoed back verbatim on the follow-up - * turn when the tool result is sent. - */ -thought_signature?: string | null, -/** - * Additional provider-specific metadata for the tool call. - */ -provider_metadata?: JsonValue | null, } } | { "Source": { id: string, source_type: string, url: string | null, title: string | null, provider_metadata?: JsonValue | null, } } | { "Reasoning": { text: string, provider_metadata: JsonValue | null, } } | { "File": { data: FileData, media_type: string, provider_metadata?: JsonValue | null, } } | { "ToolResult": { tool_call_id: string, tool_name: string, result: JsonValue, -/** - * Whether the result is an error or error message. - */ -is_error?: boolean | null, -/** - * Whether the result is preliminary (replaces prior, e.g. image previews). - */ -preliminary?: boolean | null, -/** - * Whether the tool is dynamic (defined at runtime, e.g. MCP tools). - */ -dynamic?: boolean | null, -/** - * Additional provider-specific metadata for the tool result. - */ -provider_metadata?: JsonValue | null, } }; diff --git a/tools/aimux-web/web/src/types/GenerateObjectResult.ts b/tools/aimux-web/web/src/types/GenerateObjectResult.ts deleted file mode 100644 index 8c46e3e1a..000000000 --- a/tools/aimux-web/web/src/types/GenerateObjectResult.ts +++ /dev/null @@ -1,49 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FinishReason } from "./FinishReason"; -import type { GenerateTextResult } from "./GenerateTextResult"; -import type { ResponseMetadata } from "./ResponseMetadata"; -import type { Usage } from "./Usage"; -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Result of `generate_object` (user-facing, M12). The parsed JSON object plus - * convenience fields from the underlying `generate_text` call. - */ -export type GenerateObjectResult = { -/** - * The parsed JSON object returned by the model. - */ -object: JsonValue, -/** - * Why generation stopped. - */ -finish_reason: FinishReason, -/** - * Raw provider-specific finish reason string. - */ -raw_finish_reason: string | null, -/** - * Token usage. - */ -usage: Usage, -/** - * Warnings from the provider. - */ -warnings: Array, -/** - * Concatenated reasoning text (if the model produced reasoning/thinking). - */ -reasoning: string | null, -/** - * Provider-specific metadata (e.g. Anthropic cache info). - */ -provider_metadata: JsonValue | null, -/** - * Response metadata (id, timestamp, model_id). - */ -response: ResponseMetadata, -/** - * The full `generate_text` result (for advanced use). - */ -raw: GenerateTextResult, }; diff --git a/tools/aimux-web/web/src/types/GenerateResult.ts b/tools/aimux-web/web/src/types/GenerateResult.ts deleted file mode 100644 index 4667bfc23..000000000 --- a/tools/aimux-web/web/src/types/GenerateResult.ts +++ /dev/null @@ -1,44 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FinishReason } from "./FinishReason"; -import type { GenerateContent } from "./GenerateContent"; -import type { ResponseMetadata } from "./ResponseMetadata"; -import type { Usage } from "./Usage"; -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Result of `LanguageModel::do_generate` (non-streaming). - */ -export type GenerateResult = { -/** - * Generated content items (text, tool calls, etc.). - */ -content: Array, -/** - * Why generation stopped. - */ -finish_reason: FinishReason, -/** - * Token usage. - */ -usage: Usage, -/** - * Warnings issued by the provider. - */ -warnings: Array, -/** - * Provider-specific metadata. - */ -provider_metadata: JsonValue | null, -/** - * Response metadata (id, timestamp, model_id). - */ -response: ResponseMetadata, -/** - * The request body that was sent (for debugging). - */ -request_body: JsonValue | null, -/** - * Response headers. - */ -response_headers: { [key in string]: string } | null, }; diff --git a/tools/aimux-web/web/src/types/GenerateTextOptions.ts b/tools/aimux-web/web/src/types/GenerateTextOptions.ts deleted file mode 100644 index 00b49da24..000000000 --- a/tools/aimux-web/web/src/types/GenerateTextOptions.ts +++ /dev/null @@ -1,46 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ReasoningEffort } from "./ReasoningEffort"; -import type { ResponseFormat } from "./ResponseFormat"; -import type { TimeoutConfiguration } from "./TimeoutConfiguration"; -import type { Tool } from "./Tool"; -import type { ToolChoice } from "./ToolChoice"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * User-facing options for `generate_text` and `stream_text`. - * - * Unlike `CallOptions` (provider-facing), this does not include `prompt` - * (passed separately) and defaults are more ergonomic. - */ -export type GenerateTextOptions = { max_output_tokens: number | null, temperature: number | null, stop_sequences: Array | null, top_p: number | null, top_k: number | null, presence_penalty: number | null, frequency_penalty: number | null, response_format: ResponseFormat | null, seed: number | null, tools: Array | null, tool_choice: ToolChoice | null, headers: { [key in string]: string } | null, provider_options: { [key in string]: JsonValue } | null, -/** - * Top-level reasoning effort. - */ -reasoning: ReasoningEffort | null, -/** - * System instructions prepended to the prompt. - */ -instructions: string | null, -/** - * Per-call request body overrides (deep-merged). See RFC-0017. - */ -body_overrides: JsonValue | null, -/** - * Per-call retry count override. `None` = provider default, `Some(0)` = disable. - */ -max_retries: number | null, -/** - * Per-call timeout configuration (total / first-chunk / chunk idle). - */ -timeout: TimeoutConfiguration | null, -/** - * Session identifier, for grouping consecutive calls into a session - * (observability, see RFC-0024). Orthogonal to RFC-0019 session-affinity - * headers. When `None` and the optional session inferer is enabled, one - * may be inferred from prompt-prefix continuation. - */ -session_id: string | null, -/** - * Emit raw provider stream chunks as `StreamPart::Raw` (debugging aid). - */ -include_raw_chunks: boolean | null, }; diff --git a/tools/aimux-web/web/src/types/GenerateTextResult.ts b/tools/aimux-web/web/src/types/GenerateTextResult.ts deleted file mode 100644 index a677b7004..000000000 --- a/tools/aimux-web/web/src/types/GenerateTextResult.ts +++ /dev/null @@ -1,82 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FilePart } from "./FilePart"; -import type { FinishReason } from "./FinishReason"; -import type { GenerateResult } from "./GenerateResult"; -import type { ModelMessage } from "./ModelMessage"; -import type { ReasoningPart } from "./ReasoningPart"; -import type { ResponseMetadata } from "./ResponseMetadata"; -import type { SourcePart } from "./SourcePart"; -import type { ToolCall } from "./ToolCall"; -import type { Usage } from "./Usage"; -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Result of `generate_text` (user-facing). - */ -export type GenerateTextResult = { -/** - * The generated text (concatenated from all text content parts). - */ -text: string, -/** - * Tool calls requested by the model. - */ -tool_calls: Array, -/** - * Why generation stopped. - */ -finish_reason: FinishReason, -/** - * Token usage. - */ -usage: Usage, -/** - * Warnings from the provider. - */ -warnings: Array, -/** - * Raw provider result (for advanced use). - */ -raw: GenerateResult, -/** - * Reasoning / thinking segments from the model. - */ -reasoning: Array, -/** - * Concatenated reasoning text (convenience for `reasoning.iter().map(text).join("")`). - */ -reasoning_text: string, -/** - * Sources / citations (search-preview models). - */ -sources: Array, -/** - * Files generated by the model. - */ -files: Array, -/** - * Assistant messages ready to append to the prompt for the next turn - * (solves the multi-turn "manually build assistant message" footgun). - */ -response_messages: Array, -/** - * The raw provider-specific finish reason string (e.g. "stop", - * "end_turn", "safety"). Useful when `finish_reason.unified` is `Other`. - */ -raw_finish_reason: string | null, -/** - * Provider-specific metadata (e.g. Anthropic cache info). Mirrored from - * `raw.provider_metadata` for top-level convenience. - */ -provider_metadata: JsonValue | null, -/** - * Response metadata (id, timestamp, model_id). Mirrored from - * `raw.response` for top-level convenience. - */ -response: ResponseMetadata, -/** - * Total token usage across all steps. In single-step mode (aimux's - * default), `total_usage` equals `usage`. Provided for AI SDK parity. - */ -total_usage: Usage, }; diff --git a/tools/aimux-web/web/src/types/HttpExchange.ts b/tools/aimux-web/web/src/types/HttpExchange.ts deleted file mode 100644 index 2d87f56c0..000000000 --- a/tools/aimux-web/web/src/types/HttpExchange.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { HttpRecord } from "./HttpRecord"; -import type { ResponseRecord } from "./ResponseRecord"; -import type { TimingRecord } from "./TimingRecord"; - -/** - * ③ HTTP 侧:单次 attempt 的 wire 交换。 - */ -export type HttpExchange = { -/** - * 第几次重试(0=首次);per-attempt 递增。 - */ -attempt: number, request: HttpRecord, -/** - * None = 请求失败未获响应。 - */ -response: ResponseRecord | null, timing: TimingRecord, error: string | null, -/** - * 流式:该 exchange 是否已终结(收到 response 补全)。非流式恒 true。 - */ -finalized: boolean, }; diff --git a/tools/aimux-web/web/src/types/HttpRecord.ts b/tools/aimux-web/web/src/types/HttpRecord.ts deleted file mode 100644 index 71c348207..000000000 --- a/tools/aimux-web/web/src/types/HttpRecord.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type HttpRecord = { method: string, url: string, -/** - * 敏感头(authorization/cookie/含 api-key/key/x-amz-security-token 等)已脱敏为 "[REDACTED]"。 - */ -headers: Array<[string, string]>, -/** - * 明文(脱敏后);None = 无 body。 - */ -body: string | null, }; diff --git a/tools/aimux-web/web/src/types/ImageCallOptions.ts b/tools/aimux-web/web/src/types/ImageCallOptions.ts deleted file mode 100644 index d32de9957..000000000 --- a/tools/aimux-web/web/src/types/ImageCallOptions.ts +++ /dev/null @@ -1,51 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AspectRatio } from "./AspectRatio"; -import type { ImageFile } from "./ImageFile"; -import type { Size } from "./Size"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Options passed to [`ImageModel::do_generate`]. - * - * Aligned with V4 `ImageModelV4CallOptions`. - */ -export type ImageCallOptions = { -/** - * Prompt for the image generation. `None` for operations (e.g. upscaling) - * that do not require a prompt. - */ -prompt: string | null, -/** - * Number of images to generate. - */ -n: number, -/** - * Size of the images, in `{width}x{height}` format. - * `None` uses the provider's default size. - */ -size: Size | null, -/** - * Aspect ratio of the images, in `{width}:{height}` format. - * `None` uses the provider's default aspect ratio. - */ -aspect_ratio: AspectRatio | null, -/** - * Seed for deterministic generation. `None` uses the provider's default. - */ -seed: number | null, -/** - * Images for image editing or variation generation. - */ -files: Array | null, -/** - * Mask image for inpainting operations. - */ -mask: ImageFile | null, -/** - * Additional provider-specific options, keyed by provider name. - */ -provider_options: { [key in string]: JsonValue }, -/** - * Additional HTTP headers to send with the request. - */ -headers: { [key in string]: string } | null, }; diff --git a/tools/aimux-web/web/src/types/ImageFile.ts b/tools/aimux-web/web/src/types/ImageFile.ts deleted file mode 100644 index 545e7cef5..000000000 --- a/tools/aimux-web/web/src/types/ImageFile.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ImageFileData } from "./ImageFileData"; - -/** - * An image file used for image editing or variation generation. - * - * Aligned with V4 `ImageModelV4File`. - */ -export type ImageFile = { "File": { -/** - * IANA media type, e.g. `"image/png"`. - */ -media_type: string, -/** - * File data as base64 string or binary bytes. - */ -data: ImageFileData, } } | { "Url": { -/** - * The URL of the image file. - */ -url: string, } }; diff --git a/tools/aimux-web/web/src/types/ImageFileData.ts b/tools/aimux-web/web/src/types/ImageFileData.ts deleted file mode 100644 index 96be9636f..000000000 --- a/tools/aimux-web/web/src/types/ImageFileData.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * File payload for an [`ImageFile::File`]: base64 string or raw bytes. - */ -export type ImageFileData = { "Base64": string } | { "Binary": Array }; diff --git a/tools/aimux-web/web/src/types/ImageOutputs.ts b/tools/aimux-web/web/src/types/ImageOutputs.ts deleted file mode 100644 index 38be2705b..000000000 --- a/tools/aimux-web/web/src/types/ImageOutputs.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * The generated images, returned as a homogeneous collection. - * - * The TS result type is `Array | Array` — i.e. either all - * base64 strings or all binary blobs, never mixed. This enum models that - * union. Providers should return data without unnecessary conversion: if the - * upstream API returns base64, return [`ImageOutputs::Base64`]; if binary, - * return [`ImageOutputs::Binary`]. - */ -export type ImageOutputs = { "Base64": Array } | { "Binary": Array> }; diff --git a/tools/aimux-web/web/src/types/ImageResponse.ts b/tools/aimux-web/web/src/types/ImageResponse.ts deleted file mode 100644 index 0f5f33dd0..000000000 --- a/tools/aimux-web/web/src/types/ImageResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Response information for an image generation call. - */ -export type ImageResponse = { -/** - * Timestamp for the start of the generated response (ISO 8601 string). - */ -timestamp: string | null, -/** - * The ID of the model that was used to generate the response. - */ -model_id: string | null, -/** - * Response headers. - */ -headers: { [key in string]: string } | null, }; diff --git a/tools/aimux-web/web/src/types/ImageResult.ts b/tools/aimux-web/web/src/types/ImageResult.ts deleted file mode 100644 index fbf5cbdec..000000000 --- a/tools/aimux-web/web/src/types/ImageResult.ts +++ /dev/null @@ -1,33 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ImageOutputs } from "./ImageOutputs"; -import type { ImageResponse } from "./ImageResponse"; -import type { ImageUsage } from "./ImageUsage"; -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * The result of [`ImageModel::do_generate`]. - * - * Aligned with V4 `ImageModelV4Result`. - */ -export type ImageResult = { -/** - * Generated images (base64 strings or binary data). - */ -images: ImageOutputs, -/** - * Warnings for the call, e.g. unsupported features. - */ -warnings: Array, -/** - * Additional provider-specific metadata, keyed by provider name. - */ -provider_metadata: { [key in string]: JsonValue } | null, -/** - * Response information for telemetry and debugging. - */ -response: ImageResponse, -/** - * Optional token usage for the call (if the provider reports it). - */ -usage: ImageUsage | null, }; diff --git a/tools/aimux-web/web/src/types/ImageUsage.ts b/tools/aimux-web/web/src/types/ImageUsage.ts deleted file mode 100644 index 86fb55df9..000000000 --- a/tools/aimux-web/web/src/types/ImageUsage.ts +++ /dev/null @@ -1,20 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Token usage for an image generation call (if the provider reports it). - * - * Aligned with V4 `ImageModelV4Usage`. - */ -export type ImageUsage = { -/** - * Number of input (prompt) tokens used. - */ -input_tokens: number | null, -/** - * Number of output tokens used, if reported. - */ -output_tokens: number | null, -/** - * Total tokens as reported by the provider. - */ -total_tokens: number | null, }; diff --git a/tools/aimux-web/web/src/types/InputAudioFormat.ts b/tools/aimux-web/web/src/types/InputAudioFormat.ts deleted file mode 100644 index c45946104..000000000 --- a/tools/aimux-web/web/src/types/InputAudioFormat.ts +++ /dev/null @@ -1,14 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * The input audio format for a streaming transcription request. - */ -export type InputAudioFormat = { -/** - * Audio format type, e.g. `"audio/pcm"`, `"audio/pcmu"`, `"audio/pcma"`. - */ -format_type: string, -/** - * Sample rate in Hz. Only applicable for formats that require a rate. - */ -rate: number | null, }; diff --git a/tools/aimux-web/web/src/types/InputRecord.ts b/tools/aimux-web/web/src/types/InputRecord.ts deleted file mode 100644 index fb203c0ba..000000000 --- a/tools/aimux-web/web/src/types/InputRecord.ts +++ /dev/null @@ -1,17 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { LanguageModelPromptMessage } from "./LanguageModelPromptMessage"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * ① 输入侧:完整调用参数,足以重建 generate_text 调用。 - */ -export type InputRecord = { -/** - * 完整 prompt(消息数组,含 ContentPart::Image 等多模态)。 - */ -prompt: Array, -/** - * 序列化的 CallOptions(abort_signal/call_id 已 serde skip); - * headers/provider_options/body_overrides 已递归脱敏。 - */ -options: JsonValue, }; diff --git a/tools/aimux-web/web/src/types/LanguageModelPromptMessage.ts b/tools/aimux-web/web/src/types/LanguageModelPromptMessage.ts deleted file mode 100644 index b2e3efa50..000000000 --- a/tools/aimux-web/web/src/types/LanguageModelPromptMessage.ts +++ /dev/null @@ -1,19 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ContentPart } from "./ContentPart"; -import type { Role } from "./Role"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * A single provider-facing message. - * - * Unlike `ModelMessage` (which can have string content), this always has - * `content: Vec` — strings are normalized to `ContentPart::Text`. - */ -export type LanguageModelPromptMessage = { role: Role, content: Array, -/** - * Message-level provider-specific options (e.g. - * `anthropic.cacheControl`), applied to the last part of the message when - * converting to a provider prompt. Mirrors the Vercel AI SDK - * `LanguageModelV4Message.providerOptions`. - */ -provider_options: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/MessageContent.ts b/tools/aimux-web/web/src/types/MessageContent.ts deleted file mode 100644 index 93a4c9512..000000000 --- a/tools/aimux-web/web/src/types/MessageContent.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ContentPart } from "./ContentPart"; - -/** - * Message body: either a simple string or multi-part content. - */ -export type MessageContent = string | Array; diff --git a/tools/aimux-web/web/src/types/Modality.ts b/tools/aimux-web/web/src/types/Modality.ts deleted file mode 100644 index babed00ac..000000000 --- a/tools/aimux-web/web/src/types/Modality.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A single input or output modality. - */ -export type Modality = "Text" | "Image" | "Audio" | "Video" | "Pdf" | "Embedding" | "Score" | "Other"; diff --git a/tools/aimux-web/web/src/types/ModelCapabilities.ts b/tools/aimux-web/web/src/types/ModelCapabilities.ts deleted file mode 100644 index e38d3622b..000000000 --- a/tools/aimux-web/web/src/types/ModelCapabilities.ts +++ /dev/null @@ -1,22 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Model-level capability flags (more precise than provider-level `supports_*`). - */ -export type ModelCapabilities = { -/** - * Supports function/tool calling. - */ -tool_call: boolean, -/** - * Supports structured / JSON-schema output. - */ -structured_output: boolean, -/** - * Accepts a `temperature` parameter. - */ -temperature: boolean, -/** - * Accepts multimodal attachments (image/audio/pdf input). - */ -attachment: boolean, }; diff --git a/tools/aimux-web/web/src/types/ModelCost.ts b/tools/aimux-web/web/src/types/ModelCost.ts deleted file mode 100644 index 39e510c55..000000000 --- a/tools/aimux-web/web/src/types/ModelCost.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Pricing (advisory, read-only metadata). Units follow the source catalog - * (anya2a uses USD per 1M tokens). - */ -export type ModelCost = { input?: number | null, output?: number | null, cache_read?: number | null, cache_write?: number | null, }; diff --git a/tools/aimux-web/web/src/types/ModelId.ts b/tools/aimux-web/web/src/types/ModelId.ts deleted file mode 100644 index 3456afef4..000000000 --- a/tools/aimux-web/web/src/types/ModelId.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A model identifier in `"provider/model-name"` format, e.g. `"openai/gpt-4o"`. - */ -export type ModelId = { provider: string, model: string, }; diff --git a/tools/aimux-web/web/src/types/ModelLimits.ts b/tools/aimux-web/web/src/types/ModelLimits.ts deleted file mode 100644 index 8835a50e6..000000000 --- a/tools/aimux-web/web/src/types/ModelLimits.ts +++ /dev/null @@ -1,18 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Token / request limits for a model. - */ -export type ModelLimits = { -/** - * Maximum total context window (input + output), in tokens. - */ -context?: number | null, -/** - * Maximum output tokens. - */ -output?: number | null, -/** - * Maximum input tokens (when distinct from `context`). - */ -input?: number | null, }; diff --git a/tools/aimux-web/web/src/types/ModelMessage.ts b/tools/aimux-web/web/src/types/ModelMessage.ts deleted file mode 100644 index e971ba523..000000000 --- a/tools/aimux-web/web/src/types/ModelMessage.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { MessageContent } from "./MessageContent"; -import type { Role } from "./Role"; - -/** - * A single user-facing chat message. - */ -export type ModelMessage = { role: Role, content: MessageContent, }; diff --git a/tools/aimux-web/web/src/types/ModelModalities.ts b/tools/aimux-web/web/src/types/ModelModalities.ts deleted file mode 100644 index 6196f1f1d..000000000 --- a/tools/aimux-web/web/src/types/ModelModalities.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Modality } from "./Modality"; - -/** - * Input/output modality sets. - */ -export type ModelModalities = { input?: Array, output?: Array, }; diff --git a/tools/aimux-web/web/src/types/ModelPrompt.ts b/tools/aimux-web/web/src/types/ModelPrompt.ts deleted file mode 100644 index 1b7668d01..000000000 --- a/tools/aimux-web/web/src/types/ModelPrompt.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ModelMessage } from "./ModelMessage"; - -/** - * What the user passes as `prompt` to `generate_text` / `stream_text`. - * - * Can be a simple string (converted to a single user message) or a list of messages. - */ -export type ModelPrompt = string | Array; diff --git a/tools/aimux-web/web/src/types/ModelSpec.ts b/tools/aimux-web/web/src/types/ModelSpec.ts deleted file mode 100644 index 58eb9bd31..000000000 --- a/tools/aimux-web/web/src/types/ModelSpec.ts +++ /dev/null @@ -1,26 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CatalogueSource } from "./CatalogueSource"; -import type { ModelCapabilities } from "./ModelCapabilities"; -import type { ModelCost } from "./ModelCost"; -import type { ModelLimits } from "./ModelLimits"; -import type { ModelModalities } from "./ModelModalities"; -import type { ModelType } from "./ModelType"; -import type { ReasoningSpec } from "./ReasoningSpec"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * The full static portrait for a model, supplemented from community knowledge. - * - * All fields are advisory — aimux never auto-applies them in the request path. - * The caller reads them to decide how to configure `GenerateTextOptions` / - * `bodyOverrides`. - */ -export type ModelSpec = { display_name?: string | null, type: ModelType, limits: ModelLimits, modalities: ModelModalities, capabilities: ModelCapabilities, reasoning?: ReasoningSpec | null, cost?: ModelCost | null, source: CatalogueSource, -/** - * Provider name (normalized to aimux registry spelling). - */ -provider?: string | null, -/** - * Verbatim source entry, preserved for forward compatibility / debugging. - */ -raw?: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/ModelType.ts b/tools/aimux-web/web/src/types/ModelType.ts deleted file mode 100644 index 00c3284ae..000000000 --- a/tools/aimux-web/web/src/types/ModelType.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Coarse model category, used to route to the right modality surface. - */ -export type ModelType = "Chat" | "Completion" | "Embedding" | "Rerank" | "ImageGen" | "ImageEdit" | "Video" | "Audio" | "Other"; diff --git a/tools/aimux-web/web/src/types/OutcomeRecord.ts b/tools/aimux-web/web/src/types/OutcomeRecord.ts deleted file mode 100644 index f76f2ac96..000000000 --- a/tools/aimux-web/web/src/types/OutcomeRecord.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { OutcomeStatus } from "./OutcomeStatus"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * 最终结果摘要。 - */ -export type OutcomeRecord = { status: OutcomeStatus, finish_reason: string | null, error: string | null, -/** - * 序列化的 Usage。 - */ -usage: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/OutcomeStatus.ts b/tools/aimux-web/web/src/types/OutcomeStatus.ts deleted file mode 100644 index ea12e44c2..000000000 --- a/tools/aimux-web/web/src/types/OutcomeStatus.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * 调用终结状态。 - */ -export type OutcomeStatus = "pending" | "success" | "error" | "incomplete" | "cancelled"; diff --git a/tools/aimux-web/web/src/types/PrefixBreak.ts b/tools/aimux-web/web/src/types/PrefixBreak.ts deleted file mode 100644 index 78aa70bdb..000000000 --- a/tools/aimux-web/web/src/types/PrefixBreak.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { BreakKind } from "./BreakKind"; - -/** - * A prefix break between two consecutive records of a session. - */ -export type PrefixBreak = { at_record_id: string, prev_record_id: string, lcp_bytes: bigint, expected_break: boolean, kind: BreakKind, }; diff --git a/tools/aimux-web/web/src/types/PromptTokensDetails.ts b/tools/aimux-web/web/src/types/PromptTokensDetails.ts deleted file mode 100644 index 1f93cdbc4..000000000 --- a/tools/aimux-web/web/src/types/PromptTokensDetails.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type PromptTokensDetails = { cached_tokens: number, cache_write_tokens: number | null, }; diff --git a/tools/aimux-web/web/src/types/ProviderAuditSpec.ts b/tools/aimux-web/web/src/types/ProviderAuditSpec.ts deleted file mode 100644 index 6f60f4e92..000000000 --- a/tools/aimux-web/web/src/types/ProviderAuditSpec.ts +++ /dev/null @@ -1,34 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ProviderFamily } from "./ProviderFamily"; - -/** - * Provider audit parameters (RFC-0015 §7 matrix — the part that lives in - * core; display logic belongs to the CLI). - */ -export type ProviderAuditSpec = { -/** - * Provider family for family-specific invariants. - */ -family: ProviderFamily, -/** - * Token quantization granularity; `None` = no quantization. - */ -gran: bigint | null, -/** - * Minimum cache threshold (tokens): below it `claimed` must be 0. - */ -threshold: bigint, -/** - * TTL_idle (ms), conservative upper bound. - */ -ttl_ms: bigint, -/** - * gpt-5.6+ semantics (no quantization, implicit-breakpoint whitelist, - * write/read equality). - */ -model56plus: boolean, -/** - * Claimed-hit ceiling: above this multiple of the client upper bound - * the verdict is overclaim (W) even in shared mode. `None` = use U+τ. - */ -shared_ceiling_mult: number | null, }; diff --git a/tools/aimux-web/web/src/types/ProviderFamily.ts b/tools/aimux-web/web/src/types/ProviderFamily.ts deleted file mode 100644 index 8f0a8815d..000000000 --- a/tools/aimux-web/web/src/types/ProviderFamily.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Provider family (only families with distinct invariants need dispatch; - * gran/threshold/ttl live in `ProviderAuditSpec`). - */ -export type ProviderFamily = "OpenAi" | "DeepSeek" | "Anthropic" | "Bedrock" | "Gemini" | "Vllm" | "Generic"; diff --git a/tools/aimux-web/web/src/types/ProviderRecord.ts b/tools/aimux-web/web/src/types/ProviderRecord.ts deleted file mode 100644 index 4af13e674..000000000 --- a/tools/aimux-web/web/src/types/ProviderRecord.ts +++ /dev/null @@ -1,31 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * ② 配置侧:provider 身份(请求回放重建用)。 - */ -export type ProviderRecord = { -/** - * `model.provider()`,如 "openai"。 - */ -provider: string, -/** - * `model.model_id()`,如 "gpt-4o"。 - */ -model_id: string, -/** - * provider 的 base_url。 - */ -base_url: string | null, -/** - * api_key 来源(不存明文):"env:OPENAI_API_KEY" / "explicit" / "none" / "unknown"。 - */ -api_key_source: string, -/** - * OpenAICompatProfile(能力差异)。 - */ -profile: JsonValue | null, -/** - * ProviderOptions(headers/org/project/...;已脱敏)。 - */ -provider_options: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/ProviderTool.ts b/tools/aimux-web/web/src/types/ProviderTool.ts deleted file mode 100644 index c7770fef8..000000000 --- a/tools/aimux-web/web/src/types/ProviderTool.ts +++ /dev/null @@ -1,25 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * A provider-defined tool (e.g. `anthropic.web_search_20250305`, - * `google.googleSearch`). Mirrors the V4 `LanguageModelV4ProviderTool`. - * - * Provider tools are specific to a certain provider. The input and output - * schemas are defined by the provider, and some are executed on the provider's - * servers (e.g. web search, code execution). - */ -export type ProviderTool = { -/** - * The ID of the tool, following the format `.`. - */ -id: string, -/** - * The name of the tool, unique within this model call. - */ -name: string, -/** - * The arguments for configuring the tool. Must match the expected - * arguments defined by the provider for this tool. - */ -args: JsonValue, }; diff --git a/tools/aimux-web/web/src/types/ReasoningEffort.ts b/tools/aimux-web/web/src/types/ReasoningEffort.ts deleted file mode 100644 index b1beb7b01..000000000 --- a/tools/aimux-web/web/src/types/ReasoningEffort.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Reasoning effort level (aligned with V4 `reasoning` option). - * - * Controls how much reasoning/thinking the model performs. Maps to - * OpenAI `reasoning_effort` and Anthropic `thinking` config. - */ -export type ReasoningEffort = "provider-default" | "none" | "minimal" | "low" | "medium" | "high" | "xhigh"; diff --git a/tools/aimux-web/web/src/types/ReasoningMode.ts b/tools/aimux-web/web/src/types/ReasoningMode.ts deleted file mode 100644 index b694e49cb..000000000 --- a/tools/aimux-web/web/src/types/ReasoningMode.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * How reasoning / thinking is controlled for a model. - */ -export type ReasoningMode = "Budget" | "Effort" | "Level" | "Fixed" | "Mixed" | "Toggle" | "Other"; diff --git a/tools/aimux-web/web/src/types/ReasoningPart.ts b/tools/aimux-web/web/src/types/ReasoningPart.ts deleted file mode 100644 index 83feed56b..000000000 --- a/tools/aimux-web/web/src/types/ReasoningPart.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A reasoning / thinking segment, extracted to the top level (M7). - */ -export type ReasoningPart = { -/** - * The reasoning text. - */ -text: string, }; diff --git a/tools/aimux-web/web/src/types/ReasoningSpec.ts b/tools/aimux-web/web/src/types/ReasoningSpec.ts deleted file mode 100644 index 2ce4266a0..000000000 --- a/tools/aimux-web/web/src/types/ReasoningSpec.ts +++ /dev/null @@ -1,40 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ReasoningMode } from "./ReasoningMode"; -import type { ReasoningVisibility } from "./ReasoningVisibility"; - -/** - * Reasoning / thinking portrait for a model (advisory). - */ -export type ReasoningSpec = { -/** - * Whether the model family supports reasoning at all. - */ -supported: boolean, -/** - * Whether reasoning should be on by default. - */ -default_enabled: boolean, -/** - * Primary control mode. - */ -mode: ReasoningMode | null, -/** - * Default effort level (when `mode` is Effort/Mixed). - */ -effort_default?: string | null, -/** - * Supported effort levels. - */ -effort_options?: Array, -/** - * Minimum token budget (when `mode` is Budget/Mixed). - */ -budget_min?: number | null, -/** - * Interleaved reasoning (thinking blocks between tool calls). - */ -interleaved: boolean, -/** - * Output visibility. - */ -visibility: ReasoningVisibility | null, }; diff --git a/tools/aimux-web/web/src/types/ReasoningVisibility.ts b/tools/aimux-web/web/src/types/ReasoningVisibility.ts deleted file mode 100644 index 9738c8a80..000000000 --- a/tools/aimux-web/web/src/types/ReasoningVisibility.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Visibility of reasoning output to the caller. - */ -export type ReasoningVisibility = "Hidden" | "Summary" | "Full" | "Mixed" | "Omitted" | "Other"; diff --git a/tools/aimux-web/web/src/types/Recording.ts b/tools/aimux-web/web/src/types/Recording.ts deleted file mode 100644 index 3bd5bc35c..000000000 --- a/tools/aimux-web/web/src/types/Recording.ts +++ /dev/null @@ -1,57 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { HttpExchange } from "./HttpExchange"; -import type { InputRecord } from "./InputRecord"; -import type { OutcomeRecord } from "./OutcomeRecord"; -import type { ProviderRecord } from "./ProviderRecord"; - -/** - * 一次完整调用的录制记录(三层 + call_id 关联)。 - */ -export type Recording = { -/** - * 格式版本。 - */ -schema: number, -/** - * 暴露逻辑调用 ID,关联三层。 - */ -call_id: string, -/** - * ISO 8601 时间戳。 - */ -recorded_at: string, -/** - * ① 输入侧:调用参数(prompt + options)。 - */ -input: InputRecord, -/** - * ② 配置侧:provider 身份与配置。 - */ -provider: ProviderRecord, -/** - * ③ HTTP 侧:实际 wire 交换(per-attempt 一条)。 - */ -exchanges: Array, -/** - * 最终结果摘要(状态 + finish_reason + usage)。 - */ -outcome: OutcomeRecord, -/** - * wire 是否完整(流式 body 未补全时为 false;由 writer 标记)。 - */ -complete: boolean, -/** - * 传输层封闭信号:层 B 声明"不再有 exchange"(P1:层 A 收尾自动发; - * P2:由层 B 发送)。false = 仍可能来 exchange(记录暂不可定稿)。 - */ -transport_closed: boolean, -/** - * 会话归组(RFC-0024 P3):所在会话 id。None = 未归组(无 session_id 且 - * 推断关闭)。由 `Recorder::record_session` 填充,写入 InputRecord 之前 - * 或之后均可(writer 端按 call_id 合并)。 - */ -session_id?: string | null, -/** - * 会话内步号(0 起,由 SessionStore 分配)。与 `session_id` 同生命周期。 - */ -step?: number | null, }; diff --git a/tools/aimux-web/web/src/types/RequestCacheHints.ts b/tools/aimux-web/web/src/types/RequestCacheHints.ts deleted file mode 100644 index 9e3ff369d..000000000 --- a/tools/aimux-web/web/src/types/RequestCacheHints.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Request-side cache hints (best-effort, e.g. Anthropic `cache_control`). - */ -export type RequestCacheHints = { -/** - * Whether any message requested `cache_control` (write) this call. - */ -requested_write: boolean, }; diff --git a/tools/aimux-web/web/src/types/RequestInfo.ts b/tools/aimux-web/web/src/types/RequestInfo.ts deleted file mode 100644 index 098d3be65..000000000 --- a/tools/aimux-web/web/src/types/RequestInfo.ts +++ /dev/null @@ -1,13 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Optional request information for telemetry and debugging. - * - * Aligned with the `request?` object that appears on some V4 model results. - */ -export type RequestInfo = { -/** - * The request body that was sent (opaque JSON). - */ -body: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/RerankingCallOptions.ts b/tools/aimux-web/web/src/types/RerankingCallOptions.ts deleted file mode 100644 index 3de78c9a5..000000000 --- a/tools/aimux-web/web/src/types/RerankingCallOptions.ts +++ /dev/null @@ -1,30 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { RerankingDocuments } from "./RerankingDocuments"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Options passed to [`RerankingModel::do_rerank`]. - * - * Aligned with V4 `RerankingModelV4CallOptions`. - */ -export type RerankingCallOptions = { -/** - * Documents to rerank. - */ -documents: RerankingDocuments, -/** - * The query to rerank the documents against. - */ -query: string, -/** - * Optional limit: return only the top `n` documents. - */ -top_n: number | null, -/** - * Additional provider-specific options, keyed by provider name. - */ -provider_options: { [key in string]: JsonValue } | null, -/** - * Additional HTTP headers to send with the request. - */ -headers: { [key in string]: string } | null, }; diff --git a/tools/aimux-web/web/src/types/RerankingDocuments.ts b/tools/aimux-web/web/src/types/RerankingDocuments.ts deleted file mode 100644 index 2fd5f51f2..000000000 --- a/tools/aimux-web/web/src/types/RerankingDocuments.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Documents to rerank: either a list of texts or a list of JSON objects. - * - * Aligned with V4 `RerankingModelV4CallOptions.documents`. - */ -export type RerankingDocuments = { "Text": { values: Array, } } | { "Object": { values: Array, } }; diff --git a/tools/aimux-web/web/src/types/RerankingRank.ts b/tools/aimux-web/web/src/types/RerankingRank.ts deleted file mode 100644 index 986d3b2e0..000000000 --- a/tools/aimux-web/web/src/types/RerankingRank.ts +++ /dev/null @@ -1,14 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A single reranked entry: the original index and its relevance score. - */ -export type RerankingRank = { -/** - * The index of the document in the original list (before reranking). - */ -index: number, -/** - * The relevance score of the document after reranking. - */ -relevance_score: number, }; diff --git a/tools/aimux-web/web/src/types/RerankingResponse.ts b/tools/aimux-web/web/src/types/RerankingResponse.ts deleted file mode 100644 index 83a869529..000000000 --- a/tools/aimux-web/web/src/types/RerankingResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Optional response information for a reranking call. - */ -export type RerankingResponse = { -/** - * ID for the generated response, if the provider sends one. - */ -id: string | null, -/** - * Timestamp for the start of the generated response (ISO 8601 string). - */ -timestamp: string | null, -/** - * The ID of the model that was used to generate the response. - */ -model_id: string | null, -/** - * Response headers. - */ -headers: { [key in string]: string } | null, -/** - * Response body (opaque JSON). - */ -body: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/RerankingResult.ts b/tools/aimux-web/web/src/types/RerankingResult.ts deleted file mode 100644 index d72face95..000000000 --- a/tools/aimux-web/web/src/types/RerankingResult.ts +++ /dev/null @@ -1,30 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { RerankingRank } from "./RerankingRank"; -import type { RerankingResponse } from "./RerankingResponse"; -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * The result of [`RerankingModel::do_rerank`]. - * - * Aligned with V4 `RerankingModelV4Result`. - */ -export type RerankingResult = { -/** - * Ordered list of reranked documents, sorted by descending relevance - * score. Each entry's `index` refers to the position in the original - * `documents` list. - */ -ranking: Array, -/** - * Additional provider-specific metadata, keyed by provider name. - */ -provider_metadata: { [key in string]: JsonValue } | null, -/** - * Warnings for the call, e.g. unsupported settings. - */ -warnings: Array | null, -/** - * Optional response information for debugging. - */ -response: RerankingResponse | null, }; diff --git a/tools/aimux-web/web/src/types/ResponseFormat.ts b/tools/aimux-web/web/src/types/ResponseFormat.ts deleted file mode 100644 index 88f2405e1..000000000 --- a/tools/aimux-web/web/src/types/ResponseFormat.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * How the model should format its response. - */ -export type ResponseFormat = "Text" | { "Json": { schema: JsonValue | null, name: string | null, description: string | null, } }; diff --git a/tools/aimux-web/web/src/types/ResponseInfo.ts b/tools/aimux-web/web/src/types/ResponseInfo.ts deleted file mode 100644 index 44514337c..000000000 --- a/tools/aimux-web/web/src/types/ResponseInfo.ts +++ /dev/null @@ -1,29 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Response information for telemetry and debugging. - * - * Aligned with the `response` object that appears on most V4 model results. - * All fields are optional because different providers populate different - * subsets; traits whose TS spec marks `response` as required use - * `ResponseInfo` directly, while those that mark it optional use - * `Option`. - */ -export type ResponseInfo = { -/** - * Timestamp for the start of the generated response (ISO 8601 string). - */ -timestamp: string | null, -/** - * The ID of the model that was used to generate the response. - */ -model_id: string | null, -/** - * Response headers. - */ -headers: { [key in string]: string } | null, -/** - * The response body (opaque JSON). - */ -body: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/ResponseMetadata.ts b/tools/aimux-web/web/src/types/ResponseMetadata.ts deleted file mode 100644 index 4c2084e8c..000000000 --- a/tools/aimux-web/web/src/types/ResponseMetadata.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Metadata about the API response. - */ -export type ResponseMetadata = { id: string | null, timestamp: string | null, model_id: string | null, }; diff --git a/tools/aimux-web/web/src/types/ResponseRecord.ts b/tools/aimux-web/web/src/types/ResponseRecord.ts deleted file mode 100644 index 28abf8d33..000000000 --- a/tools/aimux-web/web/src/types/ResponseRecord.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ResponseRecord = { status: number, headers: Array<[string, string]>, -/** - * 非流式:完整 JSON;流式:原始 SSE 拼接文本(上限截断)。 - */ -body: string | null, stream_chunks: number | null, -/** - * 首字节延迟(流式)。 - */ -ttfb_ms?: number | null, }; diff --git a/tools/aimux-web/web/src/types/Role.ts b/tools/aimux-web/web/src/types/Role.ts deleted file mode 100644 index c118faae1..000000000 --- a/tools/aimux-web/web/src/types/Role.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Who sent the message. - */ -export type Role = "system" | "user" | "assistant" | "tool"; diff --git a/tools/aimux-web/web/src/types/RuntimeModel.ts b/tools/aimux-web/web/src/types/RuntimeModel.ts deleted file mode 100644 index f12ea8802..000000000 --- a/tools/aimux-web/web/src/types/RuntimeModel.ts +++ /dev/null @@ -1,23 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A model entry returned by a provider's `/models` endpoint (the sparse, - * account-level truth of "what this key can call"). - * - * Carries only what the provider returns — typically just `id`. Configuration - * comes from [`ModelSpec`] (community knowledge); the host merges the two as - * needed (RFC-0027). aimux itself does not combine them. - */ -export type RuntimeModel = { -/** - * Model identifier, e.g. `"gpt-4o"`. - */ -id: string, -/** - * `owned_by` field from OpenAI-compatible `/models` responses. - */ -owned_by?: string | null, -/** - * `created` unix timestamp from OpenAI-compatible `/models` responses. - */ -created?: number | null, }; diff --git a/tools/aimux-web/web/src/types/SearchCallOptions.ts b/tools/aimux-web/web/src/types/SearchCallOptions.ts deleted file mode 100644 index e11420fef..000000000 --- a/tools/aimux-web/web/src/types/SearchCallOptions.ts +++ /dev/null @@ -1,43 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Options passed to [`SearchModel::do_search`]. - */ -export type SearchCallOptions = { -/** - * The search query string. - */ -query: string, -/** - * Maximum number of results to return. - */ -max_results: number | null, -/** - * Whether to include raw page content in results. - * - * Provider support varies; providers that cannot honor this should - * issue a warning rather than erroring. - */ -include_raw_content: boolean | null, -/** - * Optional time range filter (e.g. `"day"`, `"week"`, `"month"`, - * `"year"`). Provider support varies. - */ -time_range: string | null, -/** - * Optional list of domains to include in results. - */ -include_domains: Array | null, -/** - * Optional list of domains to exclude from results. - */ -exclude_domains: Array | null, -/** - * Additional provider-specific options, keyed by provider name. - */ -provider_options: { [key in string]: JsonValue } | null, -/** - * Additional HTTP headers to send with the request. - */ -headers: { [key in string]: string } | null, }; diff --git a/tools/aimux-web/web/src/types/SearchResponse.ts b/tools/aimux-web/web/src/types/SearchResponse.ts deleted file mode 100644 index 287e4d97b..000000000 --- a/tools/aimux-web/web/src/types/SearchResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Optional response information for a search call. - */ -export type SearchResponse = { -/** - * Response headers. - */ -headers: { [key in string]: string } | null, -/** - * The response body (opaque JSON). - */ -body: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/SearchResult.ts b/tools/aimux-web/web/src/types/SearchResult.ts deleted file mode 100644 index d1e49ac60..000000000 --- a/tools/aimux-web/web/src/types/SearchResult.ts +++ /dev/null @@ -1,31 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { SearchResponse } from "./SearchResponse"; -import type { SearchResultItem } from "./SearchResultItem"; -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * The result of [`SearchModel::do_search`]. - */ -export type SearchResult = { -/** - * Ordered list of search results. - */ -results: Array, -/** - * An optional direct answer / summary (some providers return - * an AI-generated answer alongside results). - */ -answer: string | null, -/** - * Additional provider-specific metadata. - */ -provider_metadata: { [key in string]: JsonValue } | null, -/** - * Warnings for the call. - */ -warnings: Array, -/** - * Optional response information for debugging. - */ -response: SearchResponse | null, }; diff --git a/tools/aimux-web/web/src/types/SearchResultItem.ts b/tools/aimux-web/web/src/types/SearchResultItem.ts deleted file mode 100644 index 5d5c81218..000000000 --- a/tools/aimux-web/web/src/types/SearchResultItem.ts +++ /dev/null @@ -1,32 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * A single search result item. - */ -export type SearchResultItem = { -/** - * The title of the result (e.g. page title). - */ -title: string | null, -/** - * The URL of the result. - */ -url: string | null, -/** - * A snippet/summary of the result content. - */ -content: string | null, -/** - * Raw page content (when `include_raw_content` is requested and - * supported by the provider). - */ -raw_content: string | null, -/** - * A relevance score (0.0–1.0) if the provider returns one. - */ -score: number | null, -/** - * Provider-specific metadata for this result. - */ -provider_metadata: { [key in string]: JsonValue } | null, }; diff --git a/tools/aimux-web/web/src/types/SessionCall.ts b/tools/aimux-web/web/src/types/SessionCall.ts deleted file mode 100644 index 695d5a603..000000000 --- a/tools/aimux-web/web/src/types/SessionCall.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A single call within a session (an index entry only — call content lives - * in Recording (RFC-0023) / TraceRecord (RFC-0015)). - */ -export type SessionCall = { -/** - * Call-level unique id. This is the association key for the future - * Recording / TraceRecord `call_id` (RFC-0015/0023): once those land, - * this field carries their value. - */ -call_id: string, -/** - * Step within the session (0-based). - */ -step: number, -/** - * When the call was recorded (RFC 3339 UTC, millisecond precision). - */ -recorded_at: string, }; diff --git a/tools/aimux-web/web/src/types/SessionChainView.ts b/tools/aimux-web/web/src/types/SessionChainView.ts deleted file mode 100644 index 3212b456a..000000000 --- a/tools/aimux-web/web/src/types/SessionChainView.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PrefixBreak } from "./PrefixBreak"; - -/** - * Session chain view (append-only order + prefix stability, RFC-0015 §5.3). - */ -export type SessionChainView = { session_id: string, record_ids: Array, prefix_stability: number, breaks: Array, }; diff --git a/tools/aimux-web/web/src/types/SessionSource.ts b/tools/aimux-web/web/src/types/SessionSource.ts deleted file mode 100644 index cf55dca73..000000000 --- a/tools/aimux-web/web/src/types/SessionSource.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Where a session id came from. - */ -export type SessionSource = "Explicit" | "Inferred"; diff --git a/tools/aimux-web/web/src/types/SessionStepStat.ts b/tools/aimux-web/web/src/types/SessionStepStat.ts deleted file mode 100644 index 1eeb3bf02..000000000 --- a/tools/aimux-web/web/src/types/SessionStepStat.ts +++ /dev/null @@ -1,28 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Verdict } from "./Verdict"; - -/** - * One step of a session's cache-hit trajectory (RFC-0024 §4.3). - */ -export type SessionStepStat = { -/** - * Step within the session (0-based, session order). - */ -step: number, -/** - * The call's id (association key into Recording / replay, RFC-0023). - */ -call_id: string, -/** - * Reported hit rate for this step (`cache_read / input_total`); `None` - * when the call carried no input/cache-read usage. - */ -hit_rate?: number | null, -/** - * Audit verdict (present only when an auditor is attached). - */ -verdict?: Verdict | null, -/** - * Error string for failed calls (failures are part of the session). - */ -error?: string | null, }; diff --git a/tools/aimux-web/web/src/types/SessionView.ts b/tools/aimux-web/web/src/types/SessionView.ts deleted file mode 100644 index 60a153778..000000000 --- a/tools/aimux-web/web/src/types/SessionView.ts +++ /dev/null @@ -1,16 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { SessionCall } from "./SessionCall"; -import type { SessionSource } from "./SessionSource"; - -/** - * Aggregated view of one session (session_id → ordered calls). - */ -export type SessionView = { session_id: string, -/** - * Where the session id came from (first call's source). - */ -source: SessionSource, -/** - * Ordered calls (by step). - */ -calls: Array, }; diff --git a/tools/aimux-web/web/src/types/Size.ts b/tools/aimux-web/web/src/types/Size.ts deleted file mode 100644 index 960627114..000000000 --- a/tools/aimux-web/web/src/types/Size.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Image/video size in `{width}x{height}` format (e.g. `"1024x1024"`). - * - * Newtype that enforces the `WxH` format used by V4 image `size` and video - * `resolution` options. Aligned with the TS template-literal type - * `` `${number}x${number}` ``. - */ -export type Size = { width: number, height: number, }; diff --git a/tools/aimux-web/web/src/types/SourcePart.ts b/tools/aimux-web/web/src/types/SourcePart.ts deleted file mode 100644 index 050ce8115..000000000 --- a/tools/aimux-web/web/src/types/SourcePart.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A source / citation, extracted to the top level (M7). - */ -export type SourcePart = { id: string, source_type: string, url?: string | null, title?: string | null, }; diff --git a/tools/aimux-web/web/src/types/SpeechCallOptions.ts b/tools/aimux-web/web/src/types/SpeechCallOptions.ts deleted file mode 100644 index 39cae2f43..000000000 --- a/tools/aimux-web/web/src/types/SpeechCallOptions.ts +++ /dev/null @@ -1,44 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Options passed to [`SpeechModel::do_generate`]. - * - * Aligned with V4 `SpeechModelV4CallOptions`. - */ -export type SpeechCallOptions = { -/** - * Text to convert to speech. - */ -text: string, -/** - * The voice to use (provider-specific voice ID, name, or other - * identifier). - */ -voice: string | null, -/** - * The desired output format for the audio, e.g. `"mp3"`, `"wav"`. - */ -output_format: string | null, -/** - * Instructions for the speech generation, e.g. - * `"Speak in a slow and steady tone"`. - */ -instructions: string | null, -/** - * The speed of the speech generation. - */ -speed: number | null, -/** - * The language for speech generation (ISO 639-1 code, e.g. `"en"`, or - * `"auto"` for automatic detection). Provider support varies. - */ -language: string | null, -/** - * Additional provider-specific options, keyed by provider name. - */ -provider_options: { [key in string]: JsonValue } | null, -/** - * Additional HTTP headers to send with the request. - */ -headers: { [key in string]: string } | null, }; diff --git a/tools/aimux-web/web/src/types/SpeechRequest.ts b/tools/aimux-web/web/src/types/SpeechRequest.ts deleted file mode 100644 index 1d5fbe382..000000000 --- a/tools/aimux-web/web/src/types/SpeechRequest.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Optional request information for a speech call. - */ -export type SpeechRequest = { -/** - * Response body (HTTP providers only). - */ -body: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/SpeechResponse.ts b/tools/aimux-web/web/src/types/SpeechResponse.ts deleted file mode 100644 index 9d83fe59d..000000000 --- a/tools/aimux-web/web/src/types/SpeechResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Response information for a speech call. - */ -export type SpeechResponse = { -/** - * Timestamp for the start of the generated response (ISO 8601 string). - */ -timestamp: string | null, -/** - * The ID of the model that was used to generate the response. - */ -model_id: string | null, -/** - * Response headers. - */ -headers: { [key in string]: string } | null, -/** - * Response body (opaque JSON). - */ -body: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/SpeechResult.ts b/tools/aimux-web/web/src/types/SpeechResult.ts deleted file mode 100644 index ab9b5304f..000000000 --- a/tools/aimux-web/web/src/types/SpeechResult.ts +++ /dev/null @@ -1,33 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AudioData } from "./AudioData"; -import type { SpeechRequest } from "./SpeechRequest"; -import type { SpeechResponse } from "./SpeechResponse"; -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * The result of [`SpeechModel::do_generate`]. - * - * Aligned with V4 `SpeechModelV4Result`. - */ -export type SpeechResult = { -/** - * Generated audio (base64 string or binary data). - */ -audio: AudioData, -/** - * Warnings for the call, e.g. unsupported settings. - */ -warnings: Array, -/** - * Optional request information for telemetry and debugging. - */ -request: SpeechRequest | null, -/** - * Response information for telemetry and debugging. - */ -response: SpeechResponse, -/** - * Additional provider-specific metadata, keyed by provider name. - */ -provider_metadata: { [key in string]: JsonValue } | null, }; diff --git a/tools/aimux-web/web/src/types/StreamPart.ts b/tools/aimux-web/web/src/types/StreamPart.ts deleted file mode 100644 index 8402cfa65..000000000 --- a/tools/aimux-web/web/src/types/StreamPart.ts +++ /dev/null @@ -1,66 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AiMuxError } from "./AiMuxError"; -import type { FileData } from "./FileData"; -import type { FinishReason } from "./FinishReason"; -import type { Usage } from "./Usage"; -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * A single chunk in the stream returned by `do_stream`. - */ -export type StreamPart = { "TextStart": { id: string, provider_metadata?: JsonValue | null, } } | { "TextDelta": { id: string, delta: string, provider_metadata?: JsonValue | null, } } | { "TextEnd": { id: string, provider_metadata?: JsonValue | null, } } | { "StreamStart": { warnings: Array, } } | { "Finish": { finish_reason: FinishReason, usage: Usage, provider_metadata: JsonValue | null, } } | { "Error": { error: AiMuxError, } } | { "ToolInputStart": { id: string, tool_name: string, -/** - * Whether the tool call will be executed by the provider. - */ -provider_executed?: boolean | null, -/** - * Whether the tool is dynamic (defined at runtime, e.g. MCP tools). - */ -dynamic?: boolean | null, -/** - * Optional title for the tool call. - */ -title?: string | null, provider_metadata?: JsonValue | null, } } | { "ToolInputDelta": { id: string, delta: string, provider_metadata?: JsonValue | null, } } | { "ToolInputEnd": { id: string, provider_metadata?: JsonValue | null, } } | { "ToolCall": { tool_call_id: string, tool_name: string, input: JsonValue, -/** - * Whether the tool call will be executed by the provider. - */ -provider_executed?: boolean | null, -/** - * Whether the tool is dynamic (defined at runtime, e.g. MCP tools). - */ -dynamic?: boolean | null, -/** - * Provider-assigned thought signature (e.g. Google Gemini - * `thoughtSignature`). Must be echoed back verbatim on the follow-up - * turn when the tool result is sent. - */ -thought_signature?: string | null, provider_metadata?: JsonValue | null, } } | { "ToolResult": { tool_call_id: string, tool_name: string, result: JsonValue, -/** - * Whether the result is an error or error message. - */ -is_error?: boolean | null, -/** - * Whether the result is preliminary (replaces prior, e.g. image previews). - */ -preliminary?: boolean | null, -/** - * Whether the tool is dynamic (defined at runtime, e.g. MCP tools). - */ -dynamic?: boolean | null, -/** - * Additional provider-specific metadata for the tool result. - */ -provider_metadata?: JsonValue | null, } } | { "File": { data: FileData, media_type: string, provider_metadata?: JsonValue | null, } } | { "ReasoningStart": { id: string, -/** - * Provider-specific metadata (e.g. xAI `itemId`). - */ -provider_metadata: JsonValue | null, } } | { "ReasoningDelta": { id: string, delta: string, -/** - * Provider-specific metadata (e.g. xAI `itemId`). - */ -provider_metadata: JsonValue | null, } } | { "ReasoningEnd": { id: string, -/** - * Provider-specific metadata (e.g. xAI `itemId`, `reasoningEncryptedContent`). - */ -provider_metadata: JsonValue | null, } } | { "ResponseMetadata": { id: string | null, timestamp: string | null, model_id: string | null, } } | { "Source": { id: string, source_type: string, url: string | null, title: string | null, provider_metadata?: JsonValue | null, } } | { "Raw": { raw_value: JsonValue, } }; diff --git a/tools/aimux-web/web/src/types/StreamTextResultAggregated.ts b/tools/aimux-web/web/src/types/StreamTextResultAggregated.ts deleted file mode 100644 index ae61b42bc..000000000 --- a/tools/aimux-web/web/src/types/StreamTextResultAggregated.ts +++ /dev/null @@ -1,75 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FilePart } from "./FilePart"; -import type { FinishReason } from "./FinishReason"; -import type { ModelMessage } from "./ModelMessage"; -import type { ReasoningPart } from "./ReasoningPart"; -import type { ResponseMetadata } from "./ResponseMetadata"; -import type { SourcePart } from "./SourcePart"; -import type { ToolCall } from "./ToolCall"; -import type { Usage } from "./Usage"; -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Aggregated result of `stream_text().consume()` (M11). Mirrors - * `GenerateTextResult`'s user-facing fields (without `raw`, since streaming - * has no `GenerateResult` equivalent). - */ -export type StreamTextResultAggregated = { -/** - * The generated text (concatenated `TextDelta`). - */ -text: string, -/** - * Reasoning / thinking segments. - */ -reasoning: Array, -/** - * Concatenated reasoning text. - */ -reasoning_text: string, -/** - * Tool calls requested by the model. - */ -tool_calls: Array, -/** - * Sources / citations. - */ -sources: Array, -/** - * Files generated by the model. - */ -files: Array, -/** - * Why generation stopped. - */ -finish_reason: FinishReason, -/** - * Raw provider-specific finish reason string. - */ -raw_finish_reason: string | null, -/** - * Token usage. - */ -usage: Usage, -/** - * Total token usage across all steps. In single-step mode (aimux's - * default), `total_usage` equals `usage`. Provided for AI SDK parity. - */ -total_usage: Usage, -/** - * Warnings from the provider. - */ -warnings: Array, -/** - * Provider-specific metadata from the Finish chunk. - */ -provider_metadata: JsonValue | null, -/** - * Response metadata (id, timestamp, model_id) if emitted by the stream. - */ -response: ResponseMetadata | null, -/** - * Assistant messages ready to append for the next turn. - */ -response_messages: Array, }; diff --git a/tools/aimux-web/web/src/types/TimeoutConfiguration.ts b/tools/aimux-web/web/src/types/TimeoutConfiguration.ts deleted file mode 100644 index 8e3a34444..000000000 --- a/tools/aimux-web/web/src/types/TimeoutConfiguration.ts +++ /dev/null @@ -1,24 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Per-call timeout configuration. - * - * Aligned with V4 `LanguageModelV4CallOptions.timeout` - * (`TimeoutConfiguration`). All values are milliseconds; `None` disables the - * corresponding limit. A `total` timeout also covers retry backoff and the - * whole streamed response. - */ -export type TimeoutConfiguration = { -/** - * Overall timeout for the entire call (including retries and, for - * streaming, the whole stream), in milliseconds. - */ -total_ms: number | null, -/** - * Timeout waiting for the first stream chunk (streaming only). - */ -first_chunk_ms: number | null, -/** - * Maximum idle time between consecutive stream chunks (streaming only). - */ -chunk_ms: number | null, }; diff --git a/tools/aimux-web/web/src/types/TimingRecord.ts b/tools/aimux-web/web/src/types/TimingRecord.ts deleted file mode 100644 index b24ae6478..000000000 --- a/tools/aimux-web/web/src/types/TimingRecord.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type TimingRecord = { -/** - * ms 级延迟,TS 用 number(远小于 2^53,避免 bigint)。 - */ -latency_ms: number, ttfb_ms: number | null, }; diff --git a/tools/aimux-web/web/src/types/TokenUsage.ts b/tools/aimux-web/web/src/types/TokenUsage.ts deleted file mode 100644 index ddab251a8..000000000 --- a/tools/aimux-web/web/src/types/TokenUsage.ts +++ /dev/null @@ -1,30 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Token usage detail (with cache breakdown). - */ -export type TokenUsage = { -/** - * Total tokens. - */ -total: number | null, -/** - * Tokens that were not served from cache. - */ -no_cache: number | null, -/** - * Tokens served from cache (read). - */ -cache_read: number | null, -/** - * Tokens written to cache. - */ -cache_write: number | null, -/** - * Text (non-reasoning) tokens (output side). - */ -text: number | null, -/** - * Reasoning tokens (output side). - */ -reasoning: number | null, }; diff --git a/tools/aimux-web/web/src/types/Tool.ts b/tools/aimux-web/web/src/types/Tool.ts deleted file mode 100644 index 5cfcaa975..000000000 --- a/tools/aimux-web/web/src/types/Tool.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FunctionTool } from "./FunctionTool"; -import type { ProviderTool } from "./ProviderTool"; - -/** - * A tool that can be either a user-defined function tool or a - * provider-defined tool. Mirrors the V4 - * `Array`. - */ -export type Tool = { "type": "function" } & FunctionTool | { "type": "provider" } & ProviderTool; diff --git a/tools/aimux-web/web/src/types/ToolCall.ts b/tools/aimux-web/web/src/types/ToolCall.ts deleted file mode 100644 index d16cbbc4d..000000000 --- a/tools/aimux-web/web/src/types/ToolCall.ts +++ /dev/null @@ -1,34 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * A tool call requested by the model. - */ -export type ToolCall = { -/** - * Provider-assigned call id. - */ -tool_call_id: string, -/** - * Tool name. - */ -tool_name: string, -/** - * Arguments as a JSON value (usually an object). - */ -input: JsonValue, -/** - * Whether the tool call will be executed by the provider. - */ -provider_executed?: boolean | null, -/** - * Whether the tool is dynamic (defined at runtime, e.g. MCP tools). - */ -dynamic?: boolean | null, -/** - * Provider-assigned thought signature (e.g. Google Gemini - * `thoughtSignature`). Must be echoed back verbatim on the follow-up turn - * when the tool result is sent; thinking models reject the request - * otherwise. - */ -thought_signature?: string | null, }; diff --git a/tools/aimux-web/web/src/types/ToolChoice.ts b/tools/aimux-web/web/src/types/ToolChoice.ts deleted file mode 100644 index b8f658f4a..000000000 --- a/tools/aimux-web/web/src/types/ToolChoice.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * How the model should choose tools. - * - * Wire format aligns with Vercel AI SDK `toolChoice`: - * `"auto" | "none" | "required" | { "type": "tool", "toolName": "..." }`. - * This is a mixed tagged/untagged shape (unit variants as bare strings, - * `Tool` variant as a tagged object), so serde is implemented by hand. - */ -export type ToolChoice = "auto" | "none" | "required" | { type: "tool"; toolName: string }; diff --git a/tools/aimux-web/web/src/types/ToolResult.ts b/tools/aimux-web/web/src/types/ToolResult.ts deleted file mode 100644 index 1398d1a46..000000000 --- a/tools/aimux-web/web/src/types/ToolResult.ts +++ /dev/null @@ -1,23 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * The result of executing a tool call, to be sent back to the model. - */ -export type ToolResult = { -/** - * Must match the corresponding `ToolCall::tool_call_id`. - */ -tool_call_id: string, -/** - * The tool's output (usually a JSON-serializable value or plain text). - */ -result: JsonValue, -/** - * Whether the result is an error or error message. - */ -is_error?: boolean | null, -/** - * Whether the result is preliminary (replaces prior, e.g. image previews). - */ -preliminary?: boolean | null, }; diff --git a/tools/aimux-web/web/src/types/TraceFilter.ts b/tools/aimux-web/web/src/types/TraceFilter.ts deleted file mode 100644 index 314c21083..000000000 --- a/tools/aimux-web/web/src/types/TraceFilter.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Query filter (RFC-0015 §5.3). - */ -export type TraceFilter = { provider: string | null, model: string | null, session_id: string | null, since_unix_ms: bigint | null, }; diff --git a/tools/aimux-web/web/src/types/TraceRecord.ts b/tools/aimux-web/web/src/types/TraceRecord.ts deleted file mode 100644 index fe903fb3f..000000000 --- a/tools/aimux-web/web/src/types/TraceRecord.ts +++ /dev/null @@ -1,47 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Fingerprint } from "./Fingerprint"; -import type { RequestCacheHints } from "./RequestCacheHints"; -import type { UsageSnapshot } from "./UsageSnapshot"; -import type { Verdict } from "./Verdict"; - -/** - * One probed call. Plaintext never persists — fingerprints only. - */ -export type TraceRecord = { provider: string, model: string, request_id: string | null, -/** - * From `CallOptions.session_id` (RFC-0024) — explicit first, inference - * fallback; may also be the layer's default session. - */ -session_id: string | null, -/** - * Call-level unique id (association key for Recording / replay, - * RFC-0023). - */ -call_id: string, -/** - * When the call was sent (epoch ms). - */ -sent_at_unix_ms: number, -/** - * Client-side LCP token upper bound (block upper bound, byte-proxy - * len/4). `None` when no history matched. Consumed by `TraceStats` - * aggregation. - */ -lcp_token_upper?: bigint | null, -/** - * Time to first streamed token (ms). Non-streaming: `None`. - */ -ttft_ms: number | null, fingerprint: Fingerprint, usage: UsageSnapshot, -/** - * Response-side cache headers (e.g. `x-openrouter-cache-status`). - */ -response_cache_headers?: { [key in string]: string } | null, request_cache_hints?: RequestCacheHints | null, -/** - * Audit verdict (`None` when no auditor is attached — the default). - */ -verdict?: Verdict | null, -/** - * Error string when the call failed (still recorded: failures are part - * of the session). - */ -error?: string | null, }; diff --git a/tools/aimux-web/web/src/types/TraceStats.ts b/tools/aimux-web/web/src/types/TraceStats.ts deleted file mode 100644 index 2f836deac..000000000 --- a/tools/aimux-web/web/src/types/TraceStats.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Aggregated statistics (RFC-0015 §5.2 — the two hit rates are reported - * side by side, never merged into a single number). - */ -export type TraceStats = { provider: string, model: string, requests: bigint, input_tokens_total: bigint, claimed_cache_read_total: bigint, claimed_cache_write_total: bigint, reported_hit_rate: number | null, client_upper_bound_hit_rate: number | null, verdict_counts: { [key in string]: bigint }, ttft_p50_ms: bigint | null, ttft_p95_ms: bigint | null, errors: bigint, }; diff --git a/tools/aimux-web/web/src/types/TranscriptionCallOptions.ts b/tools/aimux-web/web/src/types/TranscriptionCallOptions.ts deleted file mode 100644 index 79acc81ee..000000000 --- a/tools/aimux-web/web/src/types/TranscriptionCallOptions.ts +++ /dev/null @@ -1,26 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AudioInput } from "./AudioInput"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Options passed to [`TranscriptionModel::do_generate`]. - * - * Aligned with V4 `TranscriptionModelV4CallOptions`. - */ -export type TranscriptionCallOptions = { -/** - * Audio data to transcribe (raw bytes or a base64-encoded string). - */ -audio: AudioInput, -/** - * The IANA media type of the audio data, e.g. `"audio/mp3"`. - */ -media_type: string, -/** - * Additional provider-specific options, keyed by provider name. - */ -provider_options: { [key in string]: JsonValue } | null, -/** - * Additional HTTP headers to send with the request. - */ -headers: { [key in string]: string } | null, }; diff --git a/tools/aimux-web/web/src/types/TranscriptionRequest.ts b/tools/aimux-web/web/src/types/TranscriptionRequest.ts deleted file mode 100644 index d1dac6010..000000000 --- a/tools/aimux-web/web/src/types/TranscriptionRequest.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Optional request information for a transcription call. - */ -export type TranscriptionRequest = { -/** - * Raw request HTTP body that was sent (JSON stringified). - */ -body: string | null, }; diff --git a/tools/aimux-web/web/src/types/TranscriptionResponse.ts b/tools/aimux-web/web/src/types/TranscriptionResponse.ts deleted file mode 100644 index cdf3331b2..000000000 --- a/tools/aimux-web/web/src/types/TranscriptionResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Response information for a transcription call. - */ -export type TranscriptionResponse = { -/** - * Timestamp for the start of the generated response (ISO 8601 string). - */ -timestamp: string | null, -/** - * The ID of the model that was used to generate the response. - */ -model_id: string | null, -/** - * Response headers. - */ -headers: { [key in string]: string } | null, -/** - * Response body (opaque JSON). - */ -body: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/TranscriptionResult.ts b/tools/aimux-web/web/src/types/TranscriptionResult.ts deleted file mode 100644 index ee229f7c2..000000000 --- a/tools/aimux-web/web/src/types/TranscriptionResult.ts +++ /dev/null @@ -1,45 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { TranscriptionRequest } from "./TranscriptionRequest"; -import type { TranscriptionResponse } from "./TranscriptionResponse"; -import type { TranscriptionSegment } from "./TranscriptionSegment"; -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * The result of [`TranscriptionModel::do_generate`]. - * - * Aligned with V4 `TranscriptionModelV4Result`. - */ -export type TranscriptionResult = { -/** - * The complete transcribed text from the audio. - */ -text: string, -/** - * Transcript segments with timing information. - */ -segments: Array, -/** - * The detected language (ISO 639-1 code, e.g. `"en"`), if detected. - */ -language: string | null, -/** - * The total duration of the audio in seconds, if determined. - */ -duration_in_seconds: number | null, -/** - * Warnings for the call, e.g. unsupported settings. - */ -warnings: Array, -/** - * Optional request information for telemetry and debugging. - */ -request: TranscriptionRequest | null, -/** - * Response information for telemetry and debugging. - */ -response: TranscriptionResponse, -/** - * Additional provider-specific metadata, keyed by provider name. - */ -provider_metadata: { [key in string]: JsonValue } | null, }; diff --git a/tools/aimux-web/web/src/types/TranscriptionSegment.ts b/tools/aimux-web/web/src/types/TranscriptionSegment.ts deleted file mode 100644 index dcb5e02a2..000000000 --- a/tools/aimux-web/web/src/types/TranscriptionSegment.ts +++ /dev/null @@ -1,18 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A transcript segment with timing information. - */ -export type TranscriptionSegment = { -/** - * The text content of this segment. - */ -text: string, -/** - * The start time of this segment in seconds. - */ -start_second: number, -/** - * The end time of this segment in seconds. - */ -end_second: number, }; diff --git a/tools/aimux-web/web/src/types/TranscriptionStreamPart.ts b/tools/aimux-web/web/src/types/TranscriptionStreamPart.ts deleted file mode 100644 index 45228feec..000000000 --- a/tools/aimux-web/web/src/types/TranscriptionStreamPart.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { TranscriptionSegment } from "./TranscriptionSegment"; -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * A single chunk in the stream returned by `do_stream`. - * - * Aligned with V4 `TranscriptionModelV4StreamPart`. - */ -export type TranscriptionStreamPart = { "StreamStart": { warnings: Array, } } | { "TranscriptDelta": { id: string | null, delta: string, provider_metadata: { [key in string]: JsonValue } | null, } } | { "TranscriptPartial": { id: string | null, text: string, start_second: number | null, duration_in_seconds: number | null, channel_index: number | null, provider_metadata: { [key in string]: JsonValue } | null, } } | { "TranscriptFinal": { id: string | null, text: string, start_second: number | null, end_second: number | null, channel_index: number | null, provider_metadata: { [key in string]: JsonValue } | null, } } | { "ResponseMetadata": { timestamp: string | null, model_id: string | null, headers: { [key in string]: string } | null, body: JsonValue | null, } } | { "Finish": { text: string, segments: Array, language: string | null, duration_in_seconds: number | null, provider_metadata: { [key in string]: JsonValue } | null, } } | { "Raw": { raw_value: JsonValue, } } | { "Error": { error: JsonValue, } }; diff --git a/tools/aimux-web/web/src/types/UploadFileCallOptions.ts b/tools/aimux-web/web/src/types/UploadFileCallOptions.ts deleted file mode 100644 index 027e634aa..000000000 --- a/tools/aimux-web/web/src/types/UploadFileCallOptions.ts +++ /dev/null @@ -1,26 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { UploadFileData } from "./UploadFileData"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Options passed to [`Files::upload_file`]. - * - * Aligned with V4 `FilesV4UploadFileCallOptions`. - */ -export type UploadFileCallOptions = { -/** - * The file data (raw bytes/base64 or inline text). - */ -data: UploadFileData, -/** - * The IANA media type of the file, e.g. `"application/pdf"`. - */ -media_type: string, -/** - * The filename of the file. - */ -filename: string | null, -/** - * Additional provider-specific options, keyed by provider name. - */ -provider_options: { [key in string]: JsonValue } | null, }; diff --git a/tools/aimux-web/web/src/types/UploadFileData.ts b/tools/aimux-web/web/src/types/UploadFileData.ts deleted file mode 100644 index 6b50bff3d..000000000 --- a/tools/aimux-web/web/src/types/UploadFileData.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { FileBytes } from "./FileBytes"; - -/** - * File data accepted by [`Files::upload_file`]. - * - * The V4 spec restricts upload input to the `data` and `text` variants of - * `SharedV4FileData` (URLs and provider references are not valid uploads), so - * this is a dedicated two-variant enum rather than the full [`crate::shared::FileData`]. - */ -export type UploadFileData = { "Data": { data: FileBytes, } } | { "Text": { text: string, } }; diff --git a/tools/aimux-web/web/src/types/UploadFileResult.ts b/tools/aimux-web/web/src/types/UploadFileResult.ts deleted file mode 100644 index dc9c7412e..000000000 --- a/tools/aimux-web/web/src/types/UploadFileResult.ts +++ /dev/null @@ -1,32 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Result of [`Files::upload_file`]. - * - * Aligned with V4 `FilesV4UploadFileResult`. - */ -export type UploadFileResult = { -/** - * A provider reference mapping provider names to provider-specific file - * identifiers. - */ -provider_reference: { [key in string]: string }, -/** - * The IANA media type of the uploaded file, if available from the - * provider. - */ -media_type: string | null, -/** - * The filename of the uploaded file, if available from the provider. - */ -filename: string | null, -/** - * Additional provider-specific metadata, keyed by provider name. - */ -provider_metadata: { [key in string]: JsonValue } | null, -/** - * Warnings from the provider. - */ -warnings: Array, }; diff --git a/tools/aimux-web/web/src/types/Usage.ts b/tools/aimux-web/web/src/types/Usage.ts deleted file mode 100644 index 76961cf7e..000000000 --- a/tools/aimux-web/web/src/types/Usage.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { TokenUsage } from "./TokenUsage"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Token usage statistics. - */ -export type Usage = { input_tokens: TokenUsage, output_tokens: TokenUsage, -/** - * Raw usage information from the provider (opaque, provider-specific). - */ -raw?: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/UsageSnapshot.ts b/tools/aimux-web/web/src/types/UsageSnapshot.ts deleted file mode 100644 index 2db90e806..000000000 --- a/tools/aimux-web/web/src/types/UsageSnapshot.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Token usage snapshot (7 flat fields + raw passthrough). - */ -export type UsageSnapshot = { input_total: bigint | null, input_no_cache: bigint | null, cache_read: bigint | null, cache_write: bigint | null, output_total: bigint | null, output_text: bigint | null, output_reasoning: bigint | null, -/** - * Raw provider usage payload (opaque passthrough; numbers only — no - * prompt text). - */ -raw?: JsonValue | null, }; diff --git a/tools/aimux-web/web/src/types/Verdict.ts b/tools/aimux-web/web/src/types/Verdict.ts deleted file mode 100644 index 14b282efa..000000000 --- a/tools/aimux-web/web/src/types/Verdict.ts +++ /dev/null @@ -1,20 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { VerdictConfidence } from "./VerdictConfidence"; -import type { VerdictKind } from "./VerdictKind"; - -/** - * A verdict for one call. - */ -export type Verdict = { kind: VerdictKind, confidence: VerdictConfidence, -/** - * Violated rule ids (R-1.1 / R-1.2 / …). - */ -violated: Array, -/** - * Expected upper bound U (tokens). - */ -expected_max: bigint, claimed: bigint, -/** - * Client-side LCP (bytes). - */ -lcp_bytes: bigint, notes: Array, }; diff --git a/tools/aimux-web/web/src/types/VerdictConfidence.ts b/tools/aimux-web/web/src/types/VerdictConfidence.ts deleted file mode 100644 index 0340dba07..000000000 --- a/tools/aimux-web/web/src/types/VerdictConfidence.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Confidence level. - */ -export type VerdictConfidence = "High" | "Medium" | "Low"; diff --git a/tools/aimux-web/web/src/types/VerdictKind.ts b/tools/aimux-web/web/src/types/VerdictKind.ts deleted file mode 100644 index 9d8c9f985..000000000 --- a/tools/aimux-web/web/src/types/VerdictKind.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Verdict kinds (RFC-0015 §4.1). - */ -export type VerdictKind = "Trusted" | "SuspectOverclaim" | "SuspectUnderclaim" | "Unknown"; diff --git a/tools/aimux-web/web/src/types/VideoCallOptions.ts b/tools/aimux-web/web/src/types/VideoCallOptions.ts deleted file mode 100644 index ecdc9f265..000000000 --- a/tools/aimux-web/web/src/types/VideoCallOptions.ts +++ /dev/null @@ -1,66 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { AspectRatio } from "./AspectRatio"; -import type { Size } from "./Size"; -import type { VideoFile } from "./VideoFile"; -import type { VideoFrameImage } from "./VideoFrameImage"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * Options passed to [`VideoModel::do_generate`]. - * - * Aligned with V4 `VideoModelV4CallOptions`. - */ -export type VideoCallOptions = { -/** - * Text prompt for the video generation. `None` when not required. - */ -prompt: string | null, -/** - * Number of videos to generate. Default `1`; most models only support - * `n = 1` due to computational cost. - */ -n: number, -/** - * Aspect ratio, in `{width}:{height}` format (e.g. `"16:9"`). - */ -aspect_ratio: AspectRatio | null, -/** - * Resolution, in `{width}x{height}` format (e.g. `"1280x720"`). - */ -resolution: Size | null, -/** - * Duration of the video in seconds. Typically 3–10 seconds. - */ -duration: number | null, -/** - * Frames per second. Common values: 24, 30, 60. - */ -fps: number | null, -/** - * Seed for deterministic generation. `None` uses a random seed. - */ -seed: number | null, -/** - * Input image for image-to-video generation (the starting frame). - */ -image: VideoFile | null, -/** - * Role-tagged image inputs for first-last-frame generation. - */ -frame_images: Array | null, -/** - * Reference inputs for reference-to-video generation (images or videos). - */ -input_references: Array | null, -/** - * Whether the model should generate audio alongside the video. - */ -generate_audio: boolean | null, -/** - * Additional provider-specific options, keyed by provider name. - */ -provider_options: { [key in string]: JsonValue }, -/** - * Additional HTTP headers to send with the request. - */ -headers: { [key in string]: string } | null, }; diff --git a/tools/aimux-web/web/src/types/VideoData.ts b/tools/aimux-web/web/src/types/VideoData.ts deleted file mode 100644 index 443d5449b..000000000 --- a/tools/aimux-web/web/src/types/VideoData.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Generated video data: a URL, base64-encoded string, or binary data. - * - * Aligned with V4 `VideoModelV4VideoData`. Most providers return URLs due to - * large file sizes. - */ -export type VideoData = { "Url": { url: string, media_type: string, } } | { "Base64": { data: string, media_type: string, } } | { "Binary": { data: Array, media_type: string, } }; diff --git a/tools/aimux-web/web/src/types/VideoFile.ts b/tools/aimux-web/web/src/types/VideoFile.ts deleted file mode 100644 index 9d32e3648..000000000 --- a/tools/aimux-web/web/src/types/VideoFile.ts +++ /dev/null @@ -1,25 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { VideoFileData } from "./VideoFileData"; - -/** - * A video or image file used for video editing or image-to-video generation. - * - * Aligned with V4 `VideoModelV4File`. - */ -export type VideoFile = { "File": { -/** - * IANA media type, e.g. `"video/mp4"` or `"image/png"`. - */ -media_type: string, -/** - * File data as a base64 string or binary bytes. - */ -data: VideoFileData, } } | { "Url": { -/** - * The URL of the video or image file. - */ -url: string, -/** - * The media type of the referenced file, when known. - */ -media_type: string | null, } }; diff --git a/tools/aimux-web/web/src/types/VideoFileData.ts b/tools/aimux-web/web/src/types/VideoFileData.ts deleted file mode 100644 index d7b1d6a6b..000000000 --- a/tools/aimux-web/web/src/types/VideoFileData.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * File payload for a [`VideoFile::File`]: base64 string or raw bytes. - */ -export type VideoFileData = { "Base64": string } | { "Binary": Array }; diff --git a/tools/aimux-web/web/src/types/VideoFrameImage.ts b/tools/aimux-web/web/src/types/VideoFrameImage.ts deleted file mode 100644 index de49fcb3d..000000000 --- a/tools/aimux-web/web/src/types/VideoFrameImage.ts +++ /dev/null @@ -1,18 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { VideoFile } from "./VideoFile"; -import type { VideoFrameType } from "./VideoFrameType"; - -/** - * A role-tagged image input for image-to-video and first-last-frame generation. - * - * Aligned with V4 `VideoModelV4FrameImage`. - */ -export type VideoFrameImage = { -/** - * The image file used for this frame. - */ -image: VideoFile, -/** - * Which frame this image represents. - */ -frame_type: VideoFrameType, }; diff --git a/tools/aimux-web/web/src/types/VideoFrameType.ts b/tools/aimux-web/web/src/types/VideoFrameType.ts deleted file mode 100644 index 4279f6dfe..000000000 --- a/tools/aimux-web/web/src/types/VideoFrameType.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * The role a frame image plays in video generation. - * - * Aligned with V4 `VideoModelV4FrameType`. - */ -export type VideoFrameType = "FirstFrame" | "LastFrame"; diff --git a/tools/aimux-web/web/src/types/VideoResponse.ts b/tools/aimux-web/web/src/types/VideoResponse.ts deleted file mode 100644 index 9e7fff9cb..000000000 --- a/tools/aimux-web/web/src/types/VideoResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Response information for a video generation call. - */ -export type VideoResponse = { -/** - * Timestamp for the start of the generated response (ISO 8601 string). - */ -timestamp: string | null, -/** - * The ID of the model that was used to generate the response. - */ -model_id: string | null, -/** - * Response headers. - */ -headers: { [key in string]: string } | null, }; diff --git a/tools/aimux-web/web/src/types/VideoResult.ts b/tools/aimux-web/web/src/types/VideoResult.ts deleted file mode 100644 index 9bda831ef..000000000 --- a/tools/aimux-web/web/src/types/VideoResult.ts +++ /dev/null @@ -1,28 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { VideoData } from "./VideoData"; -import type { VideoResponse } from "./VideoResponse"; -import type { Warning } from "./Warning"; -import type { JsonValue } from "./serde_json/JsonValue"; - -/** - * The result of [`VideoModel::do_generate`]. - * - * Aligned with V4 `VideoModelV4Result`. - */ -export type VideoResult = { -/** - * Generated videos as URLs, base64 strings, or binary data. - */ -videos: Array, -/** - * Warnings for the call, e.g. unsupported features. - */ -warnings: Array, -/** - * Additional provider-specific metadata, keyed by provider name. - */ -provider_metadata: { [key in string]: JsonValue } | null, -/** - * Response information for telemetry and debugging. - */ -response: VideoResponse, }; diff --git a/tools/aimux-web/web/src/types/Warning.ts b/tools/aimux-web/web/src/types/Warning.ts deleted file mode 100644 index 14edc447c..000000000 --- a/tools/aimux-web/web/src/types/Warning.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * A warning issued by the provider (e.g. unsupported parameter). - */ -export type Warning = { "Unsupported": { feature: string, details: string | null, } } | { "Compatibility": { feature: string, details: string | null, } } | { "Deprecated": { setting: string, message: string, } } | { "Other": { message: string, } }; diff --git a/tools/aimux-web/web/src/types/WireCallRequest.ts b/tools/aimux-web/web/src/types/generated/WireCallRequest.ts similarity index 67% rename from tools/aimux-web/web/src/types/WireCallRequest.ts rename to tools/aimux-web/web/src/types/generated/WireCallRequest.ts index caa2c08d3..9298e85c1 100644 --- a/tools/aimux-web/web/src/types/WireCallRequest.ts +++ b/tools/aimux-web/web/src/types/generated/WireCallRequest.ts @@ -5,36 +5,37 @@ import type { WireOptions } from "./WireOptions"; /** * One model call from the console (RFC-0029 §5.3). */ -export type WireCallRequest = { +export type WireCallRequest = { /** * Registry name or native protocol name ("openai", "deepseek", …). */ -provider: string, +provider: string, /** * Model id (free text, e.g. "gpt-4o"). */ -model: string, +model: string, /** - * API key: `None` (provider reads its registered env var), or - * `Some("env:VAR")`. Plaintext keys are rejected (RFC-0029 §9). + * API key: `None` (Settings-saved key or the provider's registered env + * var), `Some("env:VAR")`, or a plaintext literal — the latter only + * while the console is loopback-bound (RFC-0029 §5.5). */ -api_key?: string | null, +api_key?: string | null, /** * Base URL override (proxies / local endpoints). */ -base_url?: string | null, +base_url?: string | null, /** * Stream the response as SSE (`StreamPart` events). Default true. */ -stream: boolean, +stream: boolean, /** * Route through the loaded mock model (offline mode, RFC-0023 P3). */ -mock: boolean, options: WireOptions, +mock: boolean, options: WireOptions, /** * Session grouping id (RFC-0024). The console reuses one id per agent run. */ -session_id?: string | null, +session_id?: string | null, /** * Informational step marker (the backend assigns the authoritative step). */ diff --git a/tools/aimux-web/web/src/types/WireCallResponse.ts b/tools/aimux-web/web/src/types/generated/WireCallResponse.ts similarity index 100% rename from tools/aimux-web/web/src/types/WireCallResponse.ts rename to tools/aimux-web/web/src/types/generated/WireCallResponse.ts diff --git a/tools/aimux-web/web/src/types/WireContentPart.ts b/tools/aimux-web/web/src/types/generated/WireContentPart.ts similarity index 68% rename from tools/aimux-web/web/src/types/WireContentPart.ts rename to tools/aimux-web/web/src/types/generated/WireContentPart.ts index ce96d1265..c3a3fd32d 100644 --- a/tools/aimux-web/web/src/types/WireContentPart.ts +++ b/tools/aimux-web/web/src/types/generated/WireContentPart.ts @@ -4,4 +4,4 @@ import type { JsonValue } from "./serde_json/JsonValue"; /** * A content part in the wire format. */ -export type WireContentPart = { "type": "text", text: string, } | { "type": "tool_call", tool_call_id: string, tool_name: string, input: JsonValue, } | { "type": "tool_result", tool_call_id: string, result: JsonValue, is_error?: boolean | null, }; +export type WireContentPart = { "type": "text", text: string, } | { "type": "tool_call", tool_call_id: string, tool_name: string, input: JsonValue, provider_executed?: boolean | null, } | { "type": "tool_result", tool_call_id: string, result: JsonValue, is_error?: boolean | null, }; diff --git a/tools/aimux-web/web/src/types/WireMessage.ts b/tools/aimux-web/web/src/types/generated/WireMessage.ts similarity index 91% rename from tools/aimux-web/web/src/types/WireMessage.ts rename to tools/aimux-web/web/src/types/generated/WireMessage.ts index a7d8f0739..9830f1e49 100644 --- a/tools/aimux-web/web/src/types/WireMessage.ts +++ b/tools/aimux-web/web/src/types/generated/WireMessage.ts @@ -4,7 +4,7 @@ import type { WireContentPart } from "./WireContentPart"; /** * A chat message in the wire format. */ -export type WireMessage = { +export type WireMessage = { /** * "system" | "user" | "assistant" | "tool". */ diff --git a/tools/aimux-web/web/src/types/WireMeta.ts b/tools/aimux-web/web/src/types/generated/WireMeta.ts similarity index 100% rename from tools/aimux-web/web/src/types/WireMeta.ts rename to tools/aimux-web/web/src/types/generated/WireMeta.ts diff --git a/tools/aimux-web/web/src/types/WireOptions.ts b/tools/aimux-web/web/src/types/generated/WireOptions.ts similarity index 91% rename from tools/aimux-web/web/src/types/WireOptions.ts rename to tools/aimux-web/web/src/types/generated/WireOptions.ts index c4ec07581..3100d9b47 100644 --- a/tools/aimux-web/web/src/types/WireOptions.ts +++ b/tools/aimux-web/web/src/types/generated/WireOptions.ts @@ -2,7 +2,7 @@ import type { WireTool } from "./WireTool"; import type { JsonValue } from "./serde_json/JsonValue"; -export type WireOptions = { temperature?: number | null, max_output_tokens?: number | null, top_p?: number | null, stop_sequences?: Array | null, tools?: Array | null, +export type WireOptions = { temperature?: number | null, max_output_tokens?: number | null, top_p?: number | null, stop_sequences?: Array | null, tools?: Array | null, /** * `"text"` or `{"json": …}` — passed through as `ResponseFormat`. */ diff --git a/tools/aimux-web/web/src/types/WireTool.ts b/tools/aimux-web/web/src/types/generated/WireTool.ts similarity index 98% rename from tools/aimux-web/web/src/types/WireTool.ts rename to tools/aimux-web/web/src/types/generated/WireTool.ts index 713cb2ddf..966a8679e 100644 --- a/tools/aimux-web/web/src/types/WireTool.ts +++ b/tools/aimux-web/web/src/types/generated/WireTool.ts @@ -4,7 +4,7 @@ import type { JsonValue } from "./serde_json/JsonValue"; /** * A function tool definition (JSON Schema parameters). */ -export type WireTool = { name: string, description?: string | null, +export type WireTool = { name: string, description?: string | null, /** * JSON Schema describing the parameters. */ diff --git a/tools/aimux-web/web/src/types/serde_json/JsonValue.ts b/tools/aimux-web/web/src/types/generated/serde_json/JsonValue.ts similarity index 100% rename from tools/aimux-web/web/src/types/serde_json/JsonValue.ts rename to tools/aimux-web/web/src/types/generated/serde_json/JsonValue.ts diff --git a/tools/aimux-web/web/src/views/Playground.vue b/tools/aimux-web/web/src/views/Playground.vue index 9380a48d3..c60e4b0d5 100644 --- a/tools/aimux-web/web/src/views/Playground.vue +++ b/tools/aimux-web/web/src/views/Playground.vue @@ -3,9 +3,9 @@ import { computed, ref } from 'vue' import { RouterLink, useRouter } from 'vue-router' import { useAppStore } from '../stores/app' import { api, callStream, parseStreamPart } from '../api/client' -import type { WireMessage } from '../types/WireMessage' -import type { WireContentPart } from '../types/WireContentPart' -import type { WireCallRequest } from '../types/WireCallRequest' +import type { WireMessage } from '@/types/generated/WireMessage' +import type { WireContentPart } from '@/types/generated/WireContentPart' +import type { WireCallRequest } from '@/types/generated/WireCallRequest' import Button from '../components/ui/Button.vue' import Input from '../components/ui/Input.vue' import Textarea from '../components/ui/Textarea.vue' diff --git a/tools/aimux-web/web/src/views/Replay.vue b/tools/aimux-web/web/src/views/Replay.vue index 54dae6622..43d1f21f0 100644 --- a/tools/aimux-web/web/src/views/Replay.vue +++ b/tools/aimux-web/web/src/views/Replay.vue @@ -1,7 +1,7 @@