Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T03:59:09.667Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

predict_edits_v3.rs

75 lines · 2.4 KB · rust
1use serde::{Deserialize, Serialize};
2use std::borrow::Cow;
3use std::ops::Range;
4use strum::{AsRefStr, EnumString};
5
6pub const PREDICT_EDITS_MODE_HEADER_NAME: &str = "X-Zed-Predict-Edits-Mode";
7pub const PREDICT_EDITS_REQUEST_ID_HEADER_NAME: &str = "X-Zed-Predict-Edits-Request-Id";
8pub const PREDICT_EDITS_TRIGGER_HEADER_NAME: &str = "X-Zed-Predict-Edits-Trigger";
9
10#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, AsRefStr, EnumString)]
11#[serde(rename_all = "snake_case")]
12#[strum(serialize_all = "snake_case")]
13pub enum PredictEditsMode {
14    Eager,
15    Subtle,
16}
17
18#[derive(Debug, Deserialize, Serialize)]
19pub struct RawCompletionRequest {
20    pub model: String,
21    pub prompt: String,
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub max_tokens: Option<u32>,
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub temperature: Option<f32>,
26    pub stop: Vec<Cow<'static, str>>,
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub environment: Option<String>,
29}
30
31#[derive(Debug, Serialize, Deserialize)]
32pub struct PredictEditsV3Request {
33    #[serde(flatten)]
34    pub input: zeta_prompt::Zeta2PromptInput,
35}
36
37#[derive(Debug, Deserialize, Serialize)]
38pub struct PredictEditsV3Response {
39    pub request_id: String,
40    pub output: String,
41    /// The editable region byte range within `cursor_excerpt` that the
42    /// server used for this request. When present, the client should use
43    /// this range to extract the old text from its local excerpt for
44    /// diffing, rather than relying on its own format-derived range.
45    pub editable_range: Range<usize>,
46    #[serde(default, skip_serializing_if = "Option::is_none")]
47    pub model_version: Option<String>,
48    /// Predicted cursor offset within `output`.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub cursor_offset: Option<usize>,
51}
52
53#[derive(Debug, Deserialize, Serialize)]
54pub struct RawCompletionResponse {
55    pub id: String,
56    pub object: String,
57    pub created: u64,
58    pub model: String,
59    pub choices: Vec<RawCompletionChoice>,
60    pub usage: RawCompletionUsage,
61}
62
63#[derive(Debug, Deserialize, Serialize)]
64pub struct RawCompletionChoice {
65    pub text: String,
66    pub finish_reason: Option<String>,
67}
68
69#[derive(Debug, Serialize, Deserialize)]
70pub struct RawCompletionUsage {
71    pub prompt_tokens: u32,
72    pub completion_tokens: u32,
73    pub total_tokens: u32,
74}
75
Served at tenant.openagents/omega Member data and write actions are omitted.