Initial public release of Warp.

Repo-Sync-Origin: warpdotdev/warp-internal@12af1d983b
This commit is contained in:
David Stern
2026-04-28 08:43:33 -05:00
commit 0dbd3d567a
4982 changed files with 1431549 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
//! This module contains all code relevant to Voice within Warp.
//!
//! Voice is used for voice input within Warp.
pub(crate) mod transcribe;
+6
View File
@@ -0,0 +1,6 @@
//! This module contains all auxiliary code for hitting the Transcribe endpoint in
//! warp-server that serves Voice.
mod api;
pub use api::*;
+12
View File
@@ -0,0 +1,12 @@
//! This module contains Rust types for the Transcribe endpoint in warp-server for voice transcription.
//!
//! These types are manually transposed from the API schema defined in go
//! (warp-server/model/types/transcribe/(request.go|response.go|common.go)).
//!
//! Documentation on the types here is directly borrowed from the documentation on the go schema;
//! see the go schema for the source-of-truth.
mod request;
mod response;
pub use request::*;
pub use response::*;
+120
View File
@@ -0,0 +1,120 @@
//! Rust version of `TranscribeRequest` and its fields.
//!
//! These types correspond to the warp-go types defined in
//! warp-server/model/types/transcribe/request.go.
//!
//! Documentation on the types here is directly borrowed from the documentation on the go schema;
//! see the go schema for the source-of-truth.
use serde::{Deserialize, Serialize, Serializer};
#[derive(Debug, Clone, Deserialize, PartialEq, Default)]
pub enum Provider {
/// Corresponds to "openai" string input.
OpenAI,
/// Corresponds to "wispr" string input.
#[default]
Wispr,
}
impl Provider {
fn as_str(&self) -> &'static str {
match self {
Provider::OpenAI => "openai",
Provider::Wispr => "wispr",
}
}
}
impl Serialize for Provider {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_str(self.as_str())
}
}
/// Top-level request type for the unified transcription endpoint.
/// Corresponds to `TranscribeRequest` in Go.
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
pub struct TranscribeRequest {
/// Provider specifies which transcription service to use (e.g., "openai", "wispr").
/// Note we purposefully define this as an enum on the Rust-side (Go doesn't have enums, the REST
/// API uses strings).
pub provider: Provider,
/// Language is the ISO-639-1 code of the audio language (e.g., "en").
/// Optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub language: Option<String>,
/// Format is the desired response format (e.g., "json", "text", "srt").
/// Optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
/// Prompt is an optional text prompt to guide the transcription style or continue context.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// Audio is the base64-encoded audio data (primarily used for Wispr).
#[serde(skip_serializing_if = "Option::is_none")]
pub audio: Option<String>,
/// Additional configuration fields specific to the OpenAI Whisper API.
#[serde(skip_serializing_if = "Option::is_none")]
pub openai_properties: Option<OpenAIProperties>,
/// Additional configuration fields specific to the Wispr API.
#[serde(skip_serializing_if = "Option::is_none")]
pub wispr_properties: Option<WisprProperties>,
}
/// Optional configuration fields for the OpenAI Whisper API.
/// Corresponds to `OpenAIProperties` in Go.
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
pub struct OpenAIProperties {
/// Temperature controls the sampling randomness.
/// Optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub temperature: Option<f64>,
/// Whisper output format (e.g., "json", "text", "srt", "verbose_json", "vtt").
#[serde(skip_serializing_if = "Option::is_none")]
pub response_format: Option<String>,
/// Whisper model to use. Currently, only "whisper-1" is supported.
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<String>,
/// Timestamp resolution for verbose_json format (e.g., ["segment", "word"]).
#[serde(skip_serializing_if = "Option::is_none")]
pub timestamp_granularities: Option<Vec<String>>,
}
/// Additional optional configuration for Wispr requests.
/// Corresponds to `WisprProperties` in Go.
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
pub struct WisprProperties {
/// Context for the transcription (e.g., "other").
#[serde(skip_serializing_if = "Option::is_none")]
pub app_type: Option<String>,
/// Custom dictionary to help improve transcription accuracy.
#[serde(skip_serializing_if = "Option::is_none")]
pub dictionary: Option<String>,
/// Context text appearing after the main transcription.
#[serde(skip_serializing_if = "Option::is_none")]
pub after_text: Option<String>,
/// Context text appearing before the main transcription.
#[serde(skip_serializing_if = "Option::is_none")]
pub before_text: Option<String>,
/// Specific substring that might be highlighted or focused on.
#[serde(skip_serializing_if = "Option::is_none")]
pub selected_text: Option<String>,
}
@@ -0,0 +1,17 @@
//! Rust version of `TranscribeResponse` and its fields.
//!
//! These types correspond to the warp-go types defined in
//! warp-server/model/types/transcribe/response.go.
//!
//! Documentation on the types here is directly borrowed from the documentation on the go schema;
//! see the go schema for the source-of-truth.
use serde::{Deserialize, Serialize};
/// Top-level response type for the transcription API endpoint.
/// Corresponds to `TranscribeResponse` in Go.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct TranscribeResponse {
/// The transcribed text.
pub text: String,
}