mirror of
https://github.com/openai/codex.git
synced 2026-10-29 19:08:43 +00:00
## What changed Add `otel.log_sse_deltas`, enabled by default. Setting it to `false` suppresses successful SSE event logs whose kind ends in `.delta` while preserving errors, completion events, and metrics. Apply the setting to session and memory telemetry, support managed requirements, and expose it in the app-server configuration requirements API and generated schemas and bindings. ## Testing Add coverage for delta log suppression with errors, completion logs, event counts, and duration metrics preserved. Extend configuration and app-server tests to cover defaults, overrides, and managed requirements. GitOrigin-RevId: 751c7f357c41f51848b025c838246a733eb92e2f
1253 lines
44 KiB
Rust
1253 lines
44 KiB
Rust
use super::ApplicationRequirements;
|
|
use super::ApprovalsReviewer;
|
|
use super::AskForApproval;
|
|
use super::BrowserUseConfig;
|
|
use super::ComputerUseConfig;
|
|
use super::SandboxMode;
|
|
use super::WindowsSandboxImplementation;
|
|
use super::shared::default_enabled;
|
|
use crate::JsonSchema;
|
|
use crate::TS;
|
|
use codex_experimental_api_macros::ExperimentalApi;
|
|
use codex_protocol::config_types::AutoCompactTokenLimitScope;
|
|
use codex_protocol::config_types::ForcedLoginMethod;
|
|
use codex_protocol::config_types::ReasoningSummary;
|
|
use codex_protocol::config_types::ToolExposureSurface;
|
|
use codex_protocol::config_types::Verbosity;
|
|
use codex_protocol::config_types::WebSearchMode;
|
|
use codex_protocol::config_types::WebSearchToolConfig;
|
|
use codex_protocol::openai_models::ReasoningEffort;
|
|
use codex_utils_absolute_path::AbsolutePathBuf;
|
|
use codex_utils_path_uri::PathUri;
|
|
pub use codex_utils_redacted_string::SerdeRedactedString;
|
|
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
use serde_json::Value as JsonValue;
|
|
use std::collections::BTreeMap;
|
|
use std::collections::HashMap;
|
|
use std::path::PathBuf;
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(tag = "type", rename_all = "camelCase")]
|
|
#[ts(tag = "type")]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum ConfigLayerSource {
|
|
/// Default configuration supplied with the installed Codex package.
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(rename_all = "camelCase")]
|
|
PackagedDefaults {
|
|
/// Path to the packaged default configuration file.
|
|
file: AbsolutePathBuf,
|
|
},
|
|
|
|
/// Managed preferences layer delivered by MDM (macOS only).
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(rename_all = "camelCase")]
|
|
Mdm {
|
|
domain: String,
|
|
key: String,
|
|
},
|
|
|
|
/// Managed config layer from a file (usually `managed_config.toml`).
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(rename_all = "camelCase")]
|
|
System {
|
|
/// This is the path to the system config.toml file, though it is not
|
|
/// guaranteed to exist.
|
|
file: AbsolutePathBuf,
|
|
},
|
|
|
|
/// Enterprise-managed config layer delivered by the cloud config bundle.
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(rename_all = "camelCase")]
|
|
EnterpriseManaged {
|
|
/// Stable identifier for the delivered layer.
|
|
id: String,
|
|
|
|
/// Admin-facing name for the delivered layer. This is surfaced in
|
|
/// diagnostics so users know which cloud layer needs administrator
|
|
/// attention.
|
|
name: String,
|
|
},
|
|
|
|
/// User config layer from $CODEX_HOME/config.toml. This layer is special
|
|
/// in that it is expected to be:
|
|
/// - writable by the user
|
|
/// - generally outside the workspace directory
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(rename_all = "camelCase")]
|
|
User {
|
|
/// This is the path to the user's config.toml file, though it is not
|
|
/// guaranteed to exist.
|
|
file: AbsolutePathBuf,
|
|
|
|
/// Name of the selected profile-v2 config layered on top of the base
|
|
/// user config, when this layer represents one.
|
|
profile: Option<String>,
|
|
},
|
|
|
|
/// Path to a .codex/ folder within a project. There could be multiple of
|
|
/// these between `cwd` and the project/repo root.
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(rename_all = "camelCase")]
|
|
Project {
|
|
dot_codex_folder: AbsolutePathBuf,
|
|
},
|
|
|
|
/// Session-layer overrides supplied via `-c`/`--config`.
|
|
SessionFlags,
|
|
|
|
/// `managed_config.toml` was designed to be a config that was loaded
|
|
/// as the last layer on top of everything else. This scheme did not quite
|
|
/// work out as intended, but we keep this variant as a "best effort" while
|
|
/// we phase out `managed_config.toml` in favor of `requirements.toml`.
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(rename_all = "camelCase")]
|
|
LegacyManagedConfigTomlFromFile {
|
|
file: AbsolutePathBuf,
|
|
},
|
|
|
|
LegacyManagedConfigTomlFromMdm,
|
|
}
|
|
|
|
impl ConfigLayerSource {
|
|
/// A settings from a layer with a higher precedence will override a setting
|
|
/// from a layer with a lower precedence.
|
|
pub fn precedence(&self) -> i16 {
|
|
match self {
|
|
ConfigLayerSource::PackagedDefaults { .. } => -10,
|
|
ConfigLayerSource::Mdm { .. } => 0,
|
|
ConfigLayerSource::System { .. } => 10,
|
|
ConfigLayerSource::EnterpriseManaged { .. } => 15,
|
|
ConfigLayerSource::User { profile, .. } => {
|
|
if profile.is_some() {
|
|
21
|
|
} else {
|
|
20
|
|
}
|
|
}
|
|
ConfigLayerSource::Project { .. } => 25,
|
|
ConfigLayerSource::SessionFlags => 30,
|
|
ConfigLayerSource::LegacyManagedConfigTomlFromFile { .. } => 40,
|
|
ConfigLayerSource::LegacyManagedConfigTomlFromMdm => 50,
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Compares [ConfigLayerSource] by precedence, so `A < B` means settings from
|
|
/// layer `A` will be overridden by settings from layer `B`.
|
|
impl PartialOrd for ConfigLayerSource {
|
|
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
|
Some(self.precedence().cmp(&other.precedence()))
|
|
}
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default, JsonSchema, TS)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct SandboxWorkspaceWrite {
|
|
#[serde(default)]
|
|
pub writable_roots: Vec<PathBuf>,
|
|
#[serde(default)]
|
|
pub network_access: bool,
|
|
#[serde(default)]
|
|
pub exclude_tmpdir_env_var: bool,
|
|
#[serde(default)]
|
|
pub exclude_slash_tmp: bool,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ToolsV2 {
|
|
pub web_search: Option<WebSearchToolConfig>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct AnalyticsConfig {
|
|
pub enabled: Option<bool>,
|
|
#[serde(default, flatten)]
|
|
pub additional: HashMap<String, JsonValue>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum AppToolApproval {
|
|
Auto,
|
|
Prompt,
|
|
Writes,
|
|
Approve,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct AppsDefaultConfig {
|
|
#[serde(default = "default_enabled")]
|
|
pub enabled: bool,
|
|
pub approvals_reviewer: Option<ApprovalsReviewer>,
|
|
#[serde(default = "default_enabled")]
|
|
pub destructive_enabled: bool,
|
|
#[serde(default = "default_enabled")]
|
|
pub open_world_enabled: bool,
|
|
pub default_tools_approval_mode: Option<AppToolApproval>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct AppToolConfig {
|
|
pub enabled: Option<bool>,
|
|
pub approval_mode: Option<AppToolApproval>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct AppToolsConfig {
|
|
#[serde(default, flatten)]
|
|
pub tools: HashMap<String, AppToolConfig>,
|
|
}
|
|
|
|
/// Approval settings for a connected account within an app.
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct AppLinkConfig {
|
|
pub approvals_reviewer: Option<ApprovalsReviewer>,
|
|
pub default_tools_approval_mode: Option<AppToolApproval>,
|
|
}
|
|
|
|
/// Account settings for a single app.
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct AppLinksConfig {
|
|
#[serde(default, flatten)]
|
|
pub links: HashMap<String, AppLinkConfig>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct AppConfig {
|
|
#[serde(default = "default_enabled")]
|
|
pub enabled: bool,
|
|
/// Additional model-facing surfaces omitted for this connector's tools.
|
|
pub omit_tools_from: Option<Vec<ToolExposureSurface>>,
|
|
pub approvals_reviewer: Option<ApprovalsReviewer>,
|
|
pub destructive_enabled: Option<bool>,
|
|
pub open_world_enabled: Option<bool>,
|
|
pub default_tools_approval_mode: Option<AppToolApproval>,
|
|
pub default_tools_enabled: Option<bool>,
|
|
pub tools: Option<AppToolsConfig>,
|
|
/// Per-account approval settings keyed by link ID.
|
|
pub links: Option<AppLinksConfig>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct AppsConfig {
|
|
#[serde(default, rename = "_default")]
|
|
pub default: Option<AppsDefaultConfig>,
|
|
#[serde(default, flatten)]
|
|
pub apps: HashMap<String, AppConfig>,
|
|
}
|
|
|
|
/// Backward-compatible API shape for ChatGPT workspace login restrictions.
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(untagged)]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum ForcedChatgptWorkspaceIds {
|
|
Single(String),
|
|
Multiple(Vec<String>),
|
|
}
|
|
|
|
impl ForcedChatgptWorkspaceIds {
|
|
pub fn into_vec(self) -> Vec<String> {
|
|
match self {
|
|
Self::Single(value) => vec![value],
|
|
Self::Multiple(values) => values,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct Config {
|
|
pub model: Option<String>,
|
|
pub review_model: Option<String>,
|
|
pub model_context_window: Option<i64>,
|
|
pub model_auto_compact_token_limit: Option<i64>,
|
|
pub model_auto_compact_token_limit_scope: Option<AutoCompactTokenLimitScope>,
|
|
pub model_provider: Option<String>,
|
|
#[experimental(nested)]
|
|
pub approval_policy: Option<AskForApproval>,
|
|
/// [UNSTABLE] Optional default for where approval requests are routed for
|
|
/// review.
|
|
#[experimental("config/read.approvalsReviewer")]
|
|
pub approvals_reviewer: Option<ApprovalsReviewer>,
|
|
pub sandbox_mode: Option<SandboxMode>,
|
|
pub sandbox_workspace_write: Option<SandboxWorkspaceWrite>,
|
|
pub forced_chatgpt_workspace_id: Option<ForcedChatgptWorkspaceIds>,
|
|
pub forced_login_method: Option<ForcedLoginMethod>,
|
|
pub web_search: Option<WebSearchMode>,
|
|
pub tools: Option<ToolsV2>,
|
|
pub instructions: Option<String>,
|
|
pub developer_instructions: Option<String>,
|
|
pub compact_prompt: Option<String>,
|
|
pub model_reasoning_effort: Option<ReasoningEffort>,
|
|
pub model_reasoning_summary: Option<ReasoningSummary>,
|
|
pub model_verbosity: Option<Verbosity>,
|
|
pub service_tier: Option<String>,
|
|
pub analytics: Option<AnalyticsConfig>,
|
|
#[experimental("config/read.apps")]
|
|
#[serde(default)]
|
|
pub apps: Option<AppsConfig>,
|
|
pub browser_use: Option<BrowserUseConfig>,
|
|
pub computer_use: Option<ComputerUseConfig>,
|
|
pub desktop: Option<HashMap<String, JsonValue>>,
|
|
#[serde(default, flatten)]
|
|
pub additional: HashMap<String, JsonValue>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ConfigLayerMetadata {
|
|
pub name: ConfigLayerSource,
|
|
pub version: String,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ConfigLayer {
|
|
pub name: ConfigLayerSource,
|
|
pub version: String,
|
|
pub config: JsonValue,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub disabled_reason: Option<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum MergeStrategy {
|
|
Replace,
|
|
Upsert,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum WriteStatus {
|
|
Ok,
|
|
OkOverridden,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct OverriddenMetadata {
|
|
pub message: String,
|
|
pub overriding_layer: ConfigLayerMetadata,
|
|
pub effective_value: JsonValue,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ConfigWriteResponse {
|
|
pub status: WriteStatus,
|
|
pub version: String,
|
|
/// Canonical path to the config file that was written.
|
|
pub file_path: AbsolutePathBuf,
|
|
pub overridden_metadata: Option<OverriddenMetadata>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum ConfigWriteErrorCode {
|
|
ConfigLayerReadonly,
|
|
ConfigRequirementReadonly,
|
|
ConfigVersionConflict,
|
|
ConfigValidationError,
|
|
ConfigPathNotFound,
|
|
ConfigSchemaUnknownKey,
|
|
UserLayerNotFound,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ConfigReadParams {
|
|
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
|
pub include_layers: bool,
|
|
/// Optional working directory to resolve project config layers. If specified,
|
|
/// return the effective config as seen from that directory (i.e., including any
|
|
/// project layers between `cwd` and the project/repo root).
|
|
#[ts(optional = nullable)]
|
|
pub cwd: Option<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ConfigReadResponse {
|
|
#[experimental(nested)]
|
|
pub config: Config,
|
|
pub origins: HashMap<String, ConfigLayerMetadata>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub layers: Option<Vec<ConfigLayer>>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ConfigRequirements {
|
|
/// Exact provider selection required by managed policy.
|
|
pub model_provider: Option<String>,
|
|
/// Complete required provider definitions, using config.toml field names.
|
|
pub model_providers: Option<HashMap<String, JsonValue>>,
|
|
/// Effective login methods after managed, forced-login, and workspace restrictions.
|
|
/// An empty list permits no login method. Older servers may omit this field.
|
|
pub allowed_login_methods: Option<Vec<ForcedLoginMethod>>,
|
|
pub cli_auth_credentials_store: Option<CliAuthCredentialsStoreMode>,
|
|
pub chatgpt_base_url: Option<String>,
|
|
pub additional_developer_instructions: Option<String>,
|
|
#[experimental(nested)]
|
|
pub allowed_approval_policies: Option<Vec<AskForApproval>>,
|
|
#[experimental("configRequirements/read.allowedApprovalsReviewers")]
|
|
pub allowed_approvals_reviewers: Option<Vec<ApprovalsReviewer>>,
|
|
pub allowed_sandbox_modes: Option<Vec<SandboxMode>>,
|
|
pub allowed_windows_sandbox_implementations: Option<Vec<WindowsSandboxImplementation>>,
|
|
pub allowed_permission_profiles: Option<BTreeMap<String, bool>>,
|
|
pub default_permissions: Option<String>,
|
|
pub allowed_web_search_modes: Option<Vec<WebSearchMode>>,
|
|
pub allow_managed_hooks_only: Option<bool>,
|
|
pub allow_browser_and_computer_use: Option<bool>,
|
|
pub allow_appshots: Option<bool>,
|
|
pub allow_remote_control: Option<bool>,
|
|
pub computer_use: Option<ComputerUseRequirements>,
|
|
pub browser_use: Option<BrowserUseRequirements>,
|
|
pub in_app_browser: Option<InAppBrowserRequirements>,
|
|
pub feature_requirements: Option<BTreeMap<String, bool>>,
|
|
#[experimental("configRequirements/read.hooks")]
|
|
pub hooks: Option<Box<ManagedHooksRequirements>>,
|
|
pub enforce_residency: Option<ResidencyRequirement>,
|
|
#[experimental("configRequirements/read.network")]
|
|
pub network: Option<NetworkRequirements>,
|
|
#[experimental("configRequirements/read.application")]
|
|
pub application: Option<ApplicationRequirements>,
|
|
pub auto_review: Option<AutoReviewRequirements>,
|
|
pub models: Option<ModelsRequirements>,
|
|
#[schemars(with = "Option<String>")]
|
|
pub sqlite_home: Option<PathUri>,
|
|
#[schemars(with = "Option<String>")]
|
|
pub log_dir: Option<PathUri>,
|
|
#[schemars(with = "Option<String>")]
|
|
pub model_catalog_json: Option<PathUri>,
|
|
pub check_for_update_on_startup: Option<bool>,
|
|
pub allow_login_shell: Option<bool>,
|
|
pub feedback: Option<FeedbackRequirements>,
|
|
pub otel: Option<OtelRequirements>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/", rename_all = "camelCase")]
|
|
pub enum CliAuthCredentialsStoreMode {
|
|
File,
|
|
Keyring,
|
|
Auto,
|
|
Ephemeral,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct AutoReviewRequirements {
|
|
pub required_on_models: Option<Vec<String>>,
|
|
pub ignore_rules: Option<Vec<String>>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ModelsRequirements {
|
|
pub new_thread: Option<NewThreadModelDefaults>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct NewThreadModelDefaults {
|
|
pub model: Option<String>,
|
|
pub model_reasoning_effort: Option<ReasoningEffort>,
|
|
pub service_tier: Option<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct FeedbackRequirements {
|
|
pub enabled: Option<bool>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct OtelRequirements {
|
|
pub tool_result: Option<OtelToolResultLogConfig>,
|
|
pub log_sse_deltas: Option<bool>,
|
|
pub log_user_prompt: Option<bool>,
|
|
pub log_agent_responses: Option<bool>,
|
|
pub log_guardian_assessments: Option<bool>,
|
|
pub environment: Option<String>,
|
|
pub exporter: Option<OtelExporter>,
|
|
pub trace_exporter: Option<OtelExporter>,
|
|
pub metrics_exporter: Option<OtelExporter>,
|
|
pub span_attributes: Option<HashMap<String, String>>,
|
|
pub tracestate: Option<BTreeMap<String, BTreeMap<String, String>>>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct OtelToolResultLogConfig {
|
|
pub max_bytes: usize,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "kebab-case")]
|
|
#[ts(export_to = "v2/", rename_all = "kebab-case")]
|
|
pub enum OtelExporter {
|
|
None,
|
|
Statsig,
|
|
OtlpHttp {
|
|
endpoint: String,
|
|
/// Header names are retained; values are redacted by the server.
|
|
#[schemars(with = "HashMap<String, String>")]
|
|
#[ts(as = "HashMap<String, String>")]
|
|
headers: HashMap<String, SerdeRedactedString>,
|
|
protocol: OtelHttpProtocol,
|
|
tls: Option<OtelTlsConfig>,
|
|
},
|
|
OtlpGrpc {
|
|
endpoint: String,
|
|
/// Header names are retained; values are redacted by the server.
|
|
#[schemars(with = "HashMap<String, String>")]
|
|
#[ts(as = "HashMap<String, String>")]
|
|
headers: HashMap<String, SerdeRedactedString>,
|
|
tls: Option<OtelTlsConfig>,
|
|
},
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "kebab-case")]
|
|
#[ts(export_to = "v2/", rename_all = "kebab-case")]
|
|
pub enum OtelHttpProtocol {
|
|
Binary,
|
|
Json,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "kebab-case")]
|
|
#[ts(export_to = "v2/", rename_all = "kebab-case")]
|
|
pub struct OtelTlsConfig {
|
|
pub ca_certificate: Option<PathBuf>,
|
|
pub client_certificate: Option<PathBuf>,
|
|
pub client_private_key: Option<PathBuf>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ComputerUseRequirements {
|
|
pub allow_locked_computer_use: Option<bool>,
|
|
pub allow_persistent_approval: Option<bool>,
|
|
pub default_app_access: Option<AllowDenyRequirement>,
|
|
pub macos: Option<ComputerUseMacosRequirements>,
|
|
pub windows: Option<ComputerUseWindowsRequirements>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct BrowserUseRequirements {
|
|
pub extension: Option<BrowserUseExtensionRequirements>,
|
|
pub allow_webmcp: Option<bool>,
|
|
pub allow_history_access: Option<bool>,
|
|
pub disable_auto_review: Option<bool>,
|
|
pub allow_global_persistent_approval: Option<bool>,
|
|
pub default_origin_policy: Option<BrowserUseOriginPolicy>,
|
|
pub origins: Option<BTreeMap<String, BrowserUseOriginPolicy>>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct BrowserUseExtensionRequirements {
|
|
pub request_headers: Option<Vec<RequestHeader>>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct RequestHeader {
|
|
pub name: String,
|
|
pub value: String,
|
|
}
|
|
|
|
impl std::fmt::Debug for RequestHeader {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
f.debug_struct("RequestHeader")
|
|
.field("name", &self.name)
|
|
.field("value", &"[REDACTED]")
|
|
.finish()
|
|
}
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct BrowserUseOriginPolicy {
|
|
pub access: Option<AllowDenyRequirement>,
|
|
pub downloads: Option<AllowDenyRequirement>,
|
|
pub uploads: Option<AllowDenyRequirement>,
|
|
pub full_cdp_access: Option<AllowDenyRequirement>,
|
|
pub auto_review: Option<AllowDenyRequirement>,
|
|
pub persistent_approval: Option<bool>,
|
|
pub access_approval_lifetime: Option<BrowserUseAccessApprovalLifetime>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "lowercase")]
|
|
#[ts(rename_all = "lowercase", export_to = "v2/")]
|
|
pub enum AllowDenyRequirement {
|
|
Allow,
|
|
Deny,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "lowercase")]
|
|
#[ts(rename_all = "lowercase", export_to = "v2/")]
|
|
pub enum BrowserUseAccessApprovalLifetime {
|
|
Turn,
|
|
Thread,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ComputerUseMacosRequirements {
|
|
pub bundle_ids: Option<BTreeMap<String, AllowDenyRequirement>>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ComputerUseWindowsRequirements {
|
|
pub aumids: Option<BTreeMap<String, AllowDenyRequirement>>,
|
|
pub exes: Option<Vec<ComputerUseWindowsExeRequirement>>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ComputerUseWindowsExeRequirement {
|
|
pub publisher_name: String,
|
|
pub product_name: String,
|
|
pub binary_name: Option<String>,
|
|
pub access: AllowDenyRequirement,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct InAppBrowserRequirements {
|
|
pub allow_external_browser_settings_import: Option<bool>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ManagedHooksRequirements {
|
|
#[serde(rename = "PreModelRequest", default)]
|
|
#[ts(rename = "PreModelRequest")]
|
|
pub pre_model_request: Vec<ConfiguredHookMatcherGroup>,
|
|
#[serde(rename = "PostModelRequest", default)]
|
|
#[ts(rename = "PostModelRequest")]
|
|
pub post_model_request: Vec<ConfiguredHookMatcherGroup>,
|
|
pub managed_dir: Option<PathBuf>,
|
|
pub windows_managed_dir: Option<PathBuf>,
|
|
#[serde(rename = "PreToolUse")]
|
|
#[ts(rename = "PreToolUse")]
|
|
pub pre_tool_use: Vec<ConfiguredHookMatcherGroup>,
|
|
#[serde(rename = "PermissionRequest")]
|
|
#[ts(rename = "PermissionRequest")]
|
|
pub permission_request: Vec<ConfiguredHookMatcherGroup>,
|
|
#[serde(rename = "PostToolUse")]
|
|
#[ts(rename = "PostToolUse")]
|
|
pub post_tool_use: Vec<ConfiguredHookMatcherGroup>,
|
|
#[serde(rename = "PreCompact")]
|
|
#[ts(rename = "PreCompact")]
|
|
pub pre_compact: Vec<ConfiguredHookMatcherGroup>,
|
|
#[serde(rename = "PostCompact")]
|
|
#[ts(rename = "PostCompact")]
|
|
pub post_compact: Vec<ConfiguredHookMatcherGroup>,
|
|
#[serde(rename = "SessionStart")]
|
|
#[ts(rename = "SessionStart")]
|
|
pub session_start: Vec<ConfiguredHookMatcherGroup>,
|
|
#[serde(rename = "SessionEnd", default)]
|
|
#[ts(rename = "SessionEnd")]
|
|
pub session_end: Vec<ConfiguredHookMatcherGroup>,
|
|
#[serde(rename = "UserPromptSubmit")]
|
|
#[ts(rename = "UserPromptSubmit")]
|
|
pub user_prompt_submit: Vec<ConfiguredHookMatcherGroup>,
|
|
#[serde(rename = "SubagentStart")]
|
|
#[ts(rename = "SubagentStart")]
|
|
pub subagent_start: Vec<ConfiguredHookMatcherGroup>,
|
|
#[serde(rename = "SubagentStop")]
|
|
#[ts(rename = "SubagentStop")]
|
|
pub subagent_stop: Vec<ConfiguredHookMatcherGroup>,
|
|
#[serde(rename = "Stop")]
|
|
#[ts(rename = "Stop")]
|
|
pub stop: Vec<ConfiguredHookMatcherGroup>,
|
|
#[serde(rename = "Interrupt", default)]
|
|
#[ts(rename = "Interrupt")]
|
|
pub interrupt: Vec<ConfiguredHookMatcherGroup>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ConfiguredHookMatcherGroup {
|
|
pub matcher: Option<String>,
|
|
pub hooks: Vec<ConfiguredHookHandler>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(tag = "type")]
|
|
#[ts(tag = "type", export_to = "v2/")]
|
|
pub enum ConfiguredHookHandler {
|
|
#[serde(rename = "command")]
|
|
#[ts(rename = "command")]
|
|
Command {
|
|
command: String,
|
|
#[serde(rename = "commandWindows")]
|
|
#[ts(rename = "commandWindows")]
|
|
command_windows: Option<String>,
|
|
#[serde(rename = "timeoutSec")]
|
|
#[ts(rename = "timeoutSec")]
|
|
timeout_sec: Option<u64>,
|
|
r#async: bool,
|
|
#[serde(rename = "statusMessage")]
|
|
#[ts(rename = "statusMessage")]
|
|
status_message: Option<String>,
|
|
/// Approximate token threshold for spilling this hook's `additionalContext` to disk.
|
|
/// `null` uses 2,500 tokens; `0` disables spilling for this hook. The threshold is
|
|
/// evaluated against the original context; a spilled preview also includes recovery
|
|
/// metadata.
|
|
#[serde(rename = "additionalContextLimit")]
|
|
#[ts(rename = "additionalContextLimit")]
|
|
additional_context_limit: Option<usize>,
|
|
},
|
|
#[serde(rename = "mcp_tool")]
|
|
#[ts(rename = "mcp_tool")]
|
|
McpTool {
|
|
server: String,
|
|
tool: String,
|
|
input: serde_json::Map<String, serde_json::Value>,
|
|
#[serde(rename = "timeoutSec")]
|
|
#[ts(rename = "timeoutSec")]
|
|
timeout_sec: Option<u64>,
|
|
#[serde(rename = "statusMessage")]
|
|
#[ts(rename = "statusMessage")]
|
|
status_message: Option<String>,
|
|
},
|
|
#[serde(rename = "prompt")]
|
|
#[ts(rename = "prompt")]
|
|
Prompt {},
|
|
#[serde(rename = "agent")]
|
|
#[ts(rename = "agent")]
|
|
Agent {},
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct NetworkRequirements {
|
|
pub enabled: Option<bool>,
|
|
pub http_port: Option<u16>,
|
|
pub socks_port: Option<u16>,
|
|
pub allow_upstream_proxy: Option<bool>,
|
|
pub dangerously_allow_non_loopback_proxy: Option<bool>,
|
|
pub dangerously_allow_all_unix_sockets: Option<bool>,
|
|
/// Canonical managed network permission map.
|
|
pub domains: Option<BTreeMap<String, NetworkDomainPermission>>,
|
|
/// Host patterns routed to network approval before ordinary allow rules.
|
|
pub review_domains: Option<Vec<String>>,
|
|
/// When true, only managed allowlist entries are respected while managed
|
|
/// network enforcement is active.
|
|
pub managed_allowed_domains_only: Option<bool>,
|
|
/// Legacy compatibility view derived from `domains`.
|
|
pub allowed_domains: Option<Vec<String>>,
|
|
/// Legacy compatibility view derived from `domains`.
|
|
pub denied_domains: Option<Vec<String>>,
|
|
/// Canonical managed unix socket permission map.
|
|
pub unix_sockets: Option<BTreeMap<String, NetworkUnixSocketPermission>>,
|
|
/// Legacy compatibility view derived from `unix_sockets`.
|
|
pub allow_unix_sockets: Option<Vec<String>>,
|
|
pub allow_local_binding: Option<bool>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "lowercase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum NetworkDomainPermission {
|
|
Allow,
|
|
Deny,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "lowercase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum NetworkUnixSocketPermission {
|
|
Allow,
|
|
Deny,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum ResidencyRequirement {
|
|
Us,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ConfigRequirementsReadResponse {
|
|
/// Whether Fast and Ultra Fast requirements are enforced independently.
|
|
/// Older servers omit this field and use Fast mode as a shared speed gate.
|
|
#[serde(default)]
|
|
pub supports_independent_speed_modes: Option<bool>,
|
|
/// Null if no requirements are configured (e.g. no requirements.toml/MDM entries).
|
|
#[experimental(nested)]
|
|
pub requirements: Option<ConfigRequirements>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, Hash, JsonSchema, TS)]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum ExternalAgentConfigMigrationItemType {
|
|
#[serde(rename = "AGENTS_MD")]
|
|
#[ts(rename = "AGENTS_MD")]
|
|
AgentsMd,
|
|
#[serde(rename = "CONFIG")]
|
|
#[ts(rename = "CONFIG")]
|
|
Config,
|
|
#[serde(rename = "SKILLS")]
|
|
#[ts(rename = "SKILLS")]
|
|
Skills,
|
|
#[serde(rename = "PLUGINS")]
|
|
#[ts(rename = "PLUGINS")]
|
|
Plugins,
|
|
#[serde(rename = "MCP_SERVER_CONFIG")]
|
|
#[ts(rename = "MCP_SERVER_CONFIG")]
|
|
McpServerConfig,
|
|
#[serde(rename = "SUBAGENTS")]
|
|
#[ts(rename = "SUBAGENTS")]
|
|
Subagents,
|
|
#[serde(rename = "HOOKS")]
|
|
#[ts(rename = "HOOKS")]
|
|
Hooks,
|
|
#[serde(rename = "COMMANDS")]
|
|
#[ts(rename = "COMMANDS")]
|
|
Commands,
|
|
#[serde(rename = "MEMORY")]
|
|
#[ts(rename = "MEMORY")]
|
|
Memory,
|
|
#[serde(rename = "SESSIONS")]
|
|
#[ts(rename = "SESSIONS")]
|
|
Sessions,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct PluginsMigration {
|
|
#[serde(rename = "marketplaceName")]
|
|
#[ts(rename = "marketplaceName")]
|
|
pub marketplace_name: String,
|
|
#[serde(rename = "pluginNames")]
|
|
#[ts(rename = "pluginNames")]
|
|
pub plugin_names: Vec<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct SkillMigration {
|
|
pub name: String,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct SessionMigration {
|
|
pub path: PathBuf,
|
|
pub cwd: PathBuf,
|
|
pub title: Option<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct McpServerMigration {
|
|
pub name: String,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct HookMigration {
|
|
pub name: String,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct SubagentMigration {
|
|
pub name: String,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct CommandMigration {
|
|
pub name: String,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct MigrationDetails {
|
|
#[serde(default)]
|
|
pub plugins: Vec<PluginsMigration>,
|
|
#[serde(default)]
|
|
pub skills: Vec<SkillMigration>,
|
|
#[serde(default)]
|
|
pub sessions: Vec<SessionMigration>,
|
|
#[serde(default)]
|
|
pub mcp_servers: Vec<McpServerMigration>,
|
|
#[serde(default)]
|
|
pub hooks: Vec<HookMigration>,
|
|
#[serde(default)]
|
|
pub subagents: Vec<SubagentMigration>,
|
|
#[serde(default)]
|
|
pub commands: Vec<CommandMigration>,
|
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
|
pub memory: Vec<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigMigrationItem {
|
|
pub item_type: ExternalAgentConfigMigrationItemType,
|
|
pub description: String,
|
|
/// Null or empty means home-scoped migration; non-empty means repo-scoped migration.
|
|
pub cwd: Option<PathBuf>,
|
|
pub details: Option<MigrationDetails>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigDetectResponse {
|
|
pub items: Vec<ExternalAgentConfigMigrationItem>,
|
|
#[serde(default)]
|
|
pub connectors: Vec<ExternalAgentDetectedConnectorCandidate>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigDetectParams {
|
|
/// If true, include detection under the user's home directory.
|
|
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
|
pub include_home: bool,
|
|
/// Zero or more working directories to include for repo-scoped detection.
|
|
#[ts(optional = nullable)]
|
|
pub cwds: Option<Vec<PathBuf>>,
|
|
/// Maximum age in days for detected sessions. Missing values use the default limit.
|
|
#[ts(optional = nullable)]
|
|
pub max_session_age_days: Option<u32>,
|
|
/// Maximum number of sessions to detect. Missing values use the default limit.
|
|
#[ts(optional = nullable)]
|
|
pub max_sessions: Option<u32>,
|
|
/// Deprecated field retained for compatibility. This field is ignored; use `migrationSource`
|
|
/// to select the migration source.
|
|
#[ts(optional = nullable)]
|
|
pub source: Option<String>,
|
|
/// Optional migration-source selector. Missing or unrecognized values use the default source.
|
|
#[ts(optional = nullable)]
|
|
pub migration_source: Option<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigImportParams {
|
|
pub migration_items: Vec<ExternalAgentConfigMigrationItem>,
|
|
/// Optional identifier for the product that initiated the import.
|
|
#[ts(optional = nullable)]
|
|
pub source: Option<String>,
|
|
/// Opaque provider identifier supplied by the caller for analytics attribution and import
|
|
/// history display. This does not select the migration source.
|
|
#[ts(optional = nullable)]
|
|
pub provider_id: Option<String>,
|
|
/// Migration-source selector used to produce the migration items. Pass the same value to
|
|
/// detection and import; missing or unrecognized values use the default source.
|
|
#[ts(optional = nullable)]
|
|
pub migration_source: Option<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigImportResponse {
|
|
pub import_id: String,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigImportItemTypeFailure {
|
|
pub item_type: ExternalAgentConfigMigrationItemType,
|
|
pub error_type: Option<String>,
|
|
pub sub_error_type: Option<String>,
|
|
pub failure_stage: String,
|
|
pub message: String,
|
|
pub cwd: Option<PathBuf>,
|
|
pub source: Option<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigImportItemTypeSuccess {
|
|
pub item_type: ExternalAgentConfigMigrationItemType,
|
|
pub cwd: Option<PathBuf>,
|
|
pub source: Option<String>,
|
|
pub target: Option<String>,
|
|
/// Original title for an imported session; null for other item types.
|
|
#[serde(default)]
|
|
pub title: Option<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigImportTypeResult {
|
|
pub item_type: ExternalAgentConfigMigrationItemType,
|
|
pub successes: Vec<ExternalAgentConfigImportItemTypeSuccess>,
|
|
pub failures: Vec<ExternalAgentConfigImportItemTypeFailure>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigImportHistoryRecordSuccessParams {
|
|
pub item_type: ExternalAgentConfigMigrationItemType,
|
|
pub cwd: Option<PathBuf>,
|
|
pub source: Option<String>,
|
|
pub target: Option<String>,
|
|
/// Original title for an imported session, when available.
|
|
#[serde(default)]
|
|
#[ts(optional = nullable)]
|
|
pub title: Option<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigImportHistoryRecordTypeResultParams {
|
|
pub item_type: ExternalAgentConfigMigrationItemType,
|
|
pub successes: Vec<ExternalAgentConfigImportHistoryRecordSuccessParams>,
|
|
pub failures: Vec<ExternalAgentConfigImportItemTypeFailure>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigImportHistoryRecordParams {
|
|
/// Opaque provider identifier for the externally completed import.
|
|
pub provider_id: String,
|
|
/// Completed results grouped by imported item type.
|
|
pub item_type_results: Vec<ExternalAgentConfigImportHistoryRecordTypeResultParams>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigImportHistoryRecordResponse {
|
|
pub import_id: String,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigImportHistory {
|
|
pub import_id: String,
|
|
pub provider_id: Option<String>,
|
|
pub completed_at_ms: i64,
|
|
pub successes: Vec<ExternalAgentConfigImportItemTypeSuccess>,
|
|
pub failures: Vec<ExternalAgentConfigImportItemTypeFailure>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigImportHistoriesReadResponse {
|
|
pub data: Vec<ExternalAgentConfigImportHistory>,
|
|
pub connectors: Vec<ExternalAgentImportedConnectorCandidate>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum ExternalAgentImportedConnectorSource {
|
|
RemoteMcpServersConfig,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentImportedConnectorCandidate {
|
|
pub name: String,
|
|
pub session_count: u32,
|
|
pub source: ExternalAgentImportedConnectorSource,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum ExternalAgentDetectedConnectorSource {
|
|
RemoteMcpServersConfig,
|
|
SessionToolUse,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentDetectedConnectorCandidate {
|
|
pub name: String,
|
|
pub session_count: u32,
|
|
pub source: ExternalAgentDetectedConnectorSource,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigImportProgressNotification {
|
|
pub import_id: String,
|
|
pub item_type_results: Vec<ExternalAgentConfigImportTypeResult>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ExternalAgentConfigImportCompletedNotification {
|
|
pub import_id: String,
|
|
pub item_type_results: Vec<ExternalAgentConfigImportTypeResult>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ConfigValueWriteParams {
|
|
pub key_path: String,
|
|
pub value: JsonValue,
|
|
pub merge_strategy: MergeStrategy,
|
|
/// Path to the config file to write; defaults to the user's `config.toml` when omitted.
|
|
#[ts(optional = nullable)]
|
|
pub file_path: Option<String>,
|
|
#[ts(optional = nullable)]
|
|
pub expected_version: Option<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ConfigBatchWriteParams {
|
|
pub edits: Vec<ConfigEdit>,
|
|
/// Path to the config file to write; defaults to the user's `config.toml` when omitted.
|
|
#[ts(optional = nullable)]
|
|
pub file_path: Option<String>,
|
|
#[ts(optional = nullable)]
|
|
pub expected_version: Option<String>,
|
|
/// When true, hot-reload updated runtime settings into loaded threads after writing.
|
|
/// Session-static model, reasoning-effort, Plan-mode reasoning-effort, and service-tier
|
|
/// defaults are not reloaded. The deprecated personality setting is also not reloaded.
|
|
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
|
pub reload_user_config: bool,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ConfigEdit {
|
|
pub key_path: String,
|
|
pub value: JsonValue,
|
|
pub merge_strategy: MergeStrategy,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct TextPosition {
|
|
/// 1-based line number.
|
|
pub line: usize,
|
|
/// 1-based column number (in Unicode scalar values).
|
|
pub column: usize,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct TextRange {
|
|
pub start: TextPosition,
|
|
pub end: TextPosition,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct ConfigWarningNotification {
|
|
/// Concise summary of the warning.
|
|
pub summary: String,
|
|
/// Optional extra guidance or error details.
|
|
pub details: Option<String>,
|
|
/// Optional path to the config file that triggered the warning.
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
#[ts(optional)]
|
|
pub path: Option<String>,
|
|
/// Optional range for the error location inside the config file.
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
#[ts(optional)]
|
|
pub range: Option<TextRange>,
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "config_tests.rs"]
|
|
mod tests;
|