Download codex-rs/app-server-protocol/src/protocol/v2/config.rs from SaylorTwift/codex: direct link, hf CLI and curl.
- Browser
- Download file 41.3 kB
-
https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/v2/config.rs
- Command line
-
hf download hf://SaylorTwift/codex/codex-rs/app-server-protocol/src/protocol/v2/config.rs
-
curl -L -o config.rs https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/v2/config.rs
41.3 kB
| 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::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; | |
| use serde::Deserialize; | |
| use serde::Serialize; | |
| use serde_json::Value as JsonValue; | |
| use std::collections::BTreeMap; | |
| use std::collections::HashMap; | |
| use std::path::PathBuf; | |
| pub enum ConfigLayerSource { | |
| /// Default configuration supplied with the installed Codex package. | |
| PackagedDefaults { | |
| /// Path to the packaged default configuration file. | |
| file: AbsolutePathBuf, | |
| }, | |
| /// Managed preferences layer delivered by MDM (macOS only). | |
| Mdm { | |
| domain: String, | |
| key: String, | |
| }, | |
| /// Managed config layer from a file (usually `managed_config.toml`). | |
| 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. | |
| 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 | |
| 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. | |
| 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`. | |
| 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())) | |
| } | |
| } | |
| pub struct SandboxWorkspaceWrite { | |
| pub writable_roots: Vec<PathBuf>, | |
| pub network_access: bool, | |
| pub exclude_tmpdir_env_var: bool, | |
| pub exclude_slash_tmp: bool, | |
| } | |
| pub struct ToolsV2 { | |
| pub web_search: Option<WebSearchToolConfig>, | |
| } | |
| pub struct AnalyticsConfig { | |
| pub enabled: Option<bool>, | |
| pub additional: HashMap<String, JsonValue>, | |
| } | |
| pub enum AppToolApproval { | |
| Auto, | |
| Prompt, | |
| Writes, | |
| Approve, | |
| } | |
| pub struct AppsDefaultConfig { | |
| pub enabled: bool, | |
| pub approvals_reviewer: Option<ApprovalsReviewer>, | |
| pub destructive_enabled: bool, | |
| pub open_world_enabled: bool, | |
| pub default_tools_approval_mode: Option<AppToolApproval>, | |
| } | |
| pub struct AppToolConfig { | |
| pub enabled: Option<bool>, | |
| pub approval_mode: Option<AppToolApproval>, | |
| } | |
| pub struct AppToolsConfig { | |
| pub tools: HashMap<String, AppToolConfig>, | |
| } | |
| /// Approval settings for a connected account within an app. | |
| pub struct AppLinkConfig { | |
| pub approvals_reviewer: Option<ApprovalsReviewer>, | |
| pub default_tools_approval_mode: Option<AppToolApproval>, | |
| } | |
| /// Account settings for a single app. | |
| pub struct AppLinksConfig { | |
| pub links: HashMap<String, AppLinkConfig>, | |
| } | |
| pub struct AppConfig { | |
| pub enabled: bool, | |
| 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>, | |
| } | |
| pub struct AppsConfig { | |
| pub default: Option<AppsDefaultConfig>, | |
| pub apps: HashMap<String, AppConfig>, | |
| } | |
| /// Backward-compatible API shape for ChatGPT workspace login restrictions. | |
| 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, | |
| } | |
| } | |
| } | |
| 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>, | |
| pub approval_policy: Option<AskForApproval>, | |
| /// [UNSTABLE] Optional default for where approval requests are routed for | |
| /// review. | |
| 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>, | |
| pub apps: Option<AppsConfig>, | |
| pub browser_use: Option<BrowserUseConfig>, | |
| pub computer_use: Option<ComputerUseConfig>, | |
| pub desktop: Option<HashMap<String, JsonValue>>, | |
| pub additional: HashMap<String, JsonValue>, | |
| } | |
| pub struct ConfigLayerMetadata { | |
| pub name: ConfigLayerSource, | |
| pub version: String, | |
| } | |
| pub struct ConfigLayer { | |
| pub name: ConfigLayerSource, | |
| pub version: String, | |
| pub config: JsonValue, | |
| pub disabled_reason: Option<String>, | |
| } | |
| pub enum MergeStrategy { | |
| Replace, | |
| Upsert, | |
| } | |
| pub enum WriteStatus { | |
| Ok, | |
| OkOverridden, | |
| } | |
| pub struct OverriddenMetadata { | |
| pub message: String, | |
| pub overriding_layer: ConfigLayerMetadata, | |
| pub effective_value: JsonValue, | |
| } | |
| 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>, | |
| } | |
| pub enum ConfigWriteErrorCode { | |
| ConfigLayerReadonly, | |
| ConfigRequirementReadonly, | |
| ConfigVersionConflict, | |
| ConfigValidationError, | |
| ConfigPathNotFound, | |
| ConfigSchemaUnknownKey, | |
| UserLayerNotFound, | |
| } | |
| pub struct ConfigReadParams { | |
| 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). | |
| pub cwd: Option<String>, | |
| } | |
| pub struct ConfigReadResponse { | |
| pub config: Config, | |
| pub origins: HashMap<String, ConfigLayerMetadata>, | |
| pub layers: Option<Vec<ConfigLayer>>, | |
| } | |
| 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>, | |
| pub allowed_approval_policies: Option<Vec<AskForApproval>>, | |
| 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>>, | |
| pub hooks: Option<ManagedHooksRequirements>, | |
| pub enforce_residency: Option<ResidencyRequirement>, | |
| pub network: Option<NetworkRequirements>, | |
| pub application: Option<ApplicationRequirements>, | |
| pub auto_review: Option<AutoReviewRequirements>, | |
| pub models: Option<ModelsRequirements>, | |
| pub sqlite_home: Option<PathUri>, | |
| pub log_dir: Option<PathUri>, | |
| 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 windows_sandbox_private_desktop: Option<bool>, | |
| } | |
| pub enum CliAuthCredentialsStoreMode { | |
| File, | |
| Keyring, | |
| Auto, | |
| Ephemeral, | |
| } | |
| pub struct AutoReviewRequirements { | |
| pub required_on_models: Option<Vec<String>>, | |
| pub ignore_rules: Option<Vec<String>>, | |
| } | |
| pub struct ModelsRequirements { | |
| pub new_thread: Option<NewThreadModelDefaults>, | |
| } | |
| pub struct NewThreadModelDefaults { | |
| pub model: Option<String>, | |
| pub model_reasoning_effort: Option<ReasoningEffort>, | |
| pub service_tier: Option<String>, | |
| } | |
| pub struct FeedbackRequirements { | |
| pub enabled: Option<bool>, | |
| } | |
| 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>, | |
| } | |
| pub struct BrowserUseRequirements { | |
| 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>>, | |
| } | |
| 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>, | |
| } | |
| pub enum AllowDenyRequirement { | |
| Allow, | |
| Deny, | |
| } | |
| pub enum BrowserUseAccessApprovalLifetime { | |
| Turn, | |
| Thread, | |
| } | |
| pub struct ComputerUseMacosRequirements { | |
| pub bundle_ids: Option<BTreeMap<String, AllowDenyRequirement>>, | |
| } | |
| pub struct ComputerUseWindowsRequirements { | |
| pub aumids: Option<BTreeMap<String, AllowDenyRequirement>>, | |
| pub exes: Option<Vec<ComputerUseWindowsExeRequirement>>, | |
| } | |
| pub struct ComputerUseWindowsExeRequirement { | |
| pub publisher_name: String, | |
| pub product_name: String, | |
| pub binary_name: Option<String>, | |
| pub access: AllowDenyRequirement, | |
| } | |
| pub struct InAppBrowserRequirements { | |
| pub allow_external_browser_settings_import: Option<bool>, | |
| } | |
| pub struct ManagedHooksRequirements { | |
| pub managed_dir: Option<PathBuf>, | |
| pub windows_managed_dir: Option<PathBuf>, | |
| pub pre_tool_use: Vec<ConfiguredHookMatcherGroup>, | |
| pub permission_request: Vec<ConfiguredHookMatcherGroup>, | |
| pub post_tool_use: Vec<ConfiguredHookMatcherGroup>, | |
| pub pre_compact: Vec<ConfiguredHookMatcherGroup>, | |
| pub post_compact: Vec<ConfiguredHookMatcherGroup>, | |
| pub session_start: Vec<ConfiguredHookMatcherGroup>, | |
| pub session_end: Vec<ConfiguredHookMatcherGroup>, | |
| pub user_prompt_submit: Vec<ConfiguredHookMatcherGroup>, | |
| pub subagent_start: Vec<ConfiguredHookMatcherGroup>, | |
| pub subagent_stop: Vec<ConfiguredHookMatcherGroup>, | |
| pub stop: Vec<ConfiguredHookMatcherGroup>, | |
| pub interrupt: Vec<ConfiguredHookMatcherGroup>, | |
| } | |
| pub struct ConfiguredHookMatcherGroup { | |
| pub matcher: Option<String>, | |
| pub hooks: Vec<ConfiguredHookHandler>, | |
| } | |
| pub enum ConfiguredHookHandler { | |
| Command { | |
| command: String, | |
| command_windows: Option<String>, | |
| timeout_sec: Option<u64>, | |
| r#async: bool, | |
| 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. | |
| additional_context_limit: Option<usize>, | |
| }, | |
| McpTool { | |
| server: String, | |
| tool: String, | |
| input: serde_json::Map<String, serde_json::Value>, | |
| timeout_sec: Option<u64>, | |
| status_message: Option<String>, | |
| }, | |
| Prompt {}, | |
| Agent {}, | |
| } | |
| 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 network permission map for `experimental_network`. | |
| pub domains: Option<BTreeMap<String, NetworkDomainPermission>>, | |
| /// 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 unix socket permission map for `experimental_network`. | |
| 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>, | |
| } | |
| pub enum NetworkDomainPermission { | |
| Allow, | |
| Deny, | |
| } | |
| pub enum NetworkUnixSocketPermission { | |
| Allow, | |
| Deny, | |
| } | |
| pub enum ResidencyRequirement { | |
| Us, | |
| } | |
| pub struct ConfigRequirementsReadResponse { | |
| /// Null if no requirements are configured (e.g. no requirements.toml/MDM entries). | |
| pub requirements: Option<ConfigRequirements>, | |
| } | |
| pub enum ExternalAgentConfigMigrationItemType { | |
| AgentsMd, | |
| Config, | |
| Skills, | |
| Plugins, | |
| McpServerConfig, | |
| Subagents, | |
| Hooks, | |
| Commands, | |
| Memory, | |
| Sessions, | |
| } | |
| pub struct PluginsMigration { | |
| pub marketplace_name: String, | |
| pub plugin_names: Vec<String>, | |
| } | |
| pub struct SkillMigration { | |
| pub name: String, | |
| } | |
| pub struct SessionMigration { | |
| pub path: PathBuf, | |
| pub cwd: PathBuf, | |
| pub title: Option<String>, | |
| } | |
| pub struct McpServerMigration { | |
| pub name: String, | |
| } | |
| pub struct HookMigration { | |
| pub name: String, | |
| } | |
| pub struct SubagentMigration { | |
| pub name: String, | |
| } | |
| pub struct CommandMigration { | |
| pub name: String, | |
| } | |
| pub struct MigrationDetails { | |
| pub plugins: Vec<PluginsMigration>, | |
| pub skills: Vec<SkillMigration>, | |
| pub sessions: Vec<SessionMigration>, | |
| pub mcp_servers: Vec<McpServerMigration>, | |
| pub hooks: Vec<HookMigration>, | |
| pub subagents: Vec<SubagentMigration>, | |
| pub commands: Vec<CommandMigration>, | |
| pub memory: Vec<String>, | |
| } | |
| 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>, | |
| } | |
| pub struct ExternalAgentConfigDetectResponse { | |
| pub items: Vec<ExternalAgentConfigMigrationItem>, | |
| pub connectors: Vec<ExternalAgentDetectedConnectorCandidate>, | |
| } | |
| pub struct ExternalAgentConfigDetectParams { | |
| /// If true, include detection under the user's home directory. | |
| pub include_home: bool, | |
| /// Zero or more working directories to include for repo-scoped detection. | |
| pub cwds: Option<Vec<PathBuf>>, | |
| /// Maximum age in days for detected sessions. Missing values use the default limit. | |
| pub max_session_age_days: Option<u32>, | |
| /// Maximum number of sessions to detect. Missing values use the default limit. | |
| pub max_sessions: Option<u32>, | |
| /// Deprecated field retained for compatibility. This field is ignored; use `migrationSource` | |
| /// to select the migration source. | |
| pub source: Option<String>, | |
| /// Optional migration-source selector. Missing or unrecognized values use the default source. | |
| pub migration_source: Option<String>, | |
| } | |
| pub struct ExternalAgentConfigImportParams { | |
| pub migration_items: Vec<ExternalAgentConfigMigrationItem>, | |
| /// Optional identifier for the product that initiated the import. | |
| 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. | |
| 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. | |
| pub migration_source: Option<String>, | |
| } | |
| pub struct ExternalAgentConfigImportResponse { | |
| pub import_id: String, | |
| } | |
| 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>, | |
| } | |
| 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. | |
| pub title: Option<String>, | |
| } | |
| pub struct ExternalAgentConfigImportTypeResult { | |
| pub item_type: ExternalAgentConfigMigrationItemType, | |
| pub successes: Vec<ExternalAgentConfigImportItemTypeSuccess>, | |
| pub failures: Vec<ExternalAgentConfigImportItemTypeFailure>, | |
| } | |
| 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. | |
| pub title: Option<String>, | |
| } | |
| pub struct ExternalAgentConfigImportHistoryRecordTypeResultParams { | |
| pub item_type: ExternalAgentConfigMigrationItemType, | |
| pub successes: Vec<ExternalAgentConfigImportHistoryRecordSuccessParams>, | |
| pub failures: Vec<ExternalAgentConfigImportItemTypeFailure>, | |
| } | |
| 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>, | |
| } | |
| pub struct ExternalAgentConfigImportHistoryRecordResponse { | |
| pub import_id: String, | |
| } | |
| 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>, | |
| } | |
| pub struct ExternalAgentConfigImportHistoriesReadResponse { | |
| pub data: Vec<ExternalAgentConfigImportHistory>, | |
| pub connectors: Vec<ExternalAgentImportedConnectorCandidate>, | |
| } | |
| pub enum ExternalAgentImportedConnectorSource { | |
| RemoteMcpServersConfig, | |
| } | |
| pub struct ExternalAgentImportedConnectorCandidate { | |
| pub name: String, | |
| pub session_count: u32, | |
| pub source: ExternalAgentImportedConnectorSource, | |
| } | |
| pub enum ExternalAgentDetectedConnectorSource { | |
| RemoteMcpServersConfig, | |
| SessionToolUse, | |
| } | |
| pub struct ExternalAgentDetectedConnectorCandidate { | |
| pub name: String, | |
| pub session_count: u32, | |
| pub source: ExternalAgentDetectedConnectorSource, | |
| } | |
| pub struct ExternalAgentConfigImportProgressNotification { | |
| pub import_id: String, | |
| pub item_type_results: Vec<ExternalAgentConfigImportTypeResult>, | |
| } | |
| pub struct ExternalAgentConfigImportCompletedNotification { | |
| pub import_id: String, | |
| pub item_type_results: Vec<ExternalAgentConfigImportTypeResult>, | |
| } | |
| 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. | |
| pub file_path: Option<String>, | |
| pub expected_version: Option<String>, | |
| } | |
| pub struct ConfigBatchWriteParams { | |
| pub edits: Vec<ConfigEdit>, | |
| /// Path to the config file to write; defaults to the user's `config.toml` when omitted. | |
| pub file_path: Option<String>, | |
| 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. | |
| pub reload_user_config: bool, | |
| } | |
| pub struct ConfigEdit { | |
| pub key_path: String, | |
| pub value: JsonValue, | |
| pub merge_strategy: MergeStrategy, | |
| } | |
| pub struct TextPosition { | |
| /// 1-based line number. | |
| pub line: usize, | |
| /// 1-based column number (in Unicode scalar values). | |
| pub column: usize, | |
| } | |
| pub struct TextRange { | |
| pub start: TextPosition, | |
| pub end: TextPosition, | |
| } | |
| 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. | |
| pub path: Option<String>, | |
| /// Optional range for the error location inside the config file. | |
| pub range: Option<TextRange>, | |
| } | |