mirror of
https://github.com/openai/codex.git
synced 2026-11-16 22:00:36 +00:00
rebase
This commit is contained in:
@@ -13,9 +13,66 @@ pub enum PlanType {
|
||||
Plus,
|
||||
Pro,
|
||||
Team,
|
||||
#[serde(rename = "self_serve_business_usage_based")]
|
||||
#[ts(rename = "self_serve_business_usage_based")]
|
||||
SelfServeBusinessUsageBased,
|
||||
Business,
|
||||
#[serde(rename = "enterprise_cbp_usage_based")]
|
||||
#[ts(rename = "enterprise_cbp_usage_based")]
|
||||
EnterpriseCbpUsageBased,
|
||||
Enterprise,
|
||||
Edu,
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
impl PlanType {
|
||||
pub fn is_team_like(self) -> bool {
|
||||
matches!(self, Self::Team | Self::SelfServeBusinessUsageBased)
|
||||
}
|
||||
|
||||
pub fn is_business_like(self) -> bool {
|
||||
matches!(self, Self::Business | Self::EnterpriseCbpUsageBased)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::PlanType;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn usage_based_plan_types_use_expected_wire_names() {
|
||||
assert_eq!(
|
||||
serde_json::to_string(&PlanType::SelfServeBusinessUsageBased)
|
||||
.expect("self-serve business usage based should serialize"),
|
||||
"\"self_serve_business_usage_based\""
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::to_string(&PlanType::EnterpriseCbpUsageBased)
|
||||
.expect("enterprise cbp usage based should serialize"),
|
||||
"\"enterprise_cbp_usage_based\""
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::from_str::<PlanType>("\"self_serve_business_usage_based\"")
|
||||
.expect("self-serve business usage based should deserialize"),
|
||||
PlanType::SelfServeBusinessUsageBased
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::from_str::<PlanType>("\"enterprise_cbp_usage_based\"")
|
||||
.expect("enterprise cbp usage based should deserialize"),
|
||||
PlanType::EnterpriseCbpUsageBased
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plan_family_helpers_group_usage_based_variants_with_existing_plans() {
|
||||
assert_eq!(PlanType::Team.is_team_like(), true);
|
||||
assert_eq!(PlanType::SelfServeBusinessUsageBased.is_team_like(), true);
|
||||
assert_eq!(PlanType::Business.is_team_like(), false);
|
||||
|
||||
assert_eq!(PlanType::Business.is_business_like(), true);
|
||||
assert_eq!(PlanType::EnterpriseCbpUsageBased.is_business_like(), true);
|
||||
assert_eq!(PlanType::Team.is_business_like(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use std::num::NonZeroU64;
|
||||
use std::time::Duration;
|
||||
use strum_macros::Display;
|
||||
use strum_macros::EnumIter;
|
||||
use ts_rs::TS;
|
||||
@@ -261,6 +264,81 @@ pub enum ForcedLoginMethod {
|
||||
Api,
|
||||
}
|
||||
|
||||
const DEFAULT_PROVIDER_AUTH_TIMEOUT_MS: u64 = 5_000;
|
||||
const DEFAULT_PROVIDER_AUTH_REFRESH_INTERVAL_MS: u64 = 300_000;
|
||||
|
||||
/// Configuration for obtaining a provider bearer token from a command.
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema)]
|
||||
#[schemars(deny_unknown_fields)]
|
||||
pub struct ModelProviderAuthInfo {
|
||||
/// Command to execute. Bare names are resolved via `PATH`; paths are resolved against `cwd`.
|
||||
pub command: String,
|
||||
|
||||
/// Command arguments.
|
||||
#[serde(default)]
|
||||
pub args: Vec<String>,
|
||||
|
||||
/// Maximum time to wait for the token command to exit successfully.
|
||||
#[serde(default = "default_provider_auth_timeout_ms")]
|
||||
pub timeout_ms: NonZeroU64,
|
||||
|
||||
/// Maximum age for the cached token before rerunning the command.
|
||||
#[serde(default = "default_provider_auth_refresh_interval_ms")]
|
||||
pub refresh_interval_ms: NonZeroU64,
|
||||
|
||||
/// Working directory used when running the token command.
|
||||
#[serde(default = "default_provider_auth_cwd")]
|
||||
#[schemars(skip_serializing_if = "is_default_provider_auth_cwd")]
|
||||
pub cwd: AbsolutePathBuf,
|
||||
}
|
||||
|
||||
impl ModelProviderAuthInfo {
|
||||
pub fn timeout(&self) -> Duration {
|
||||
Duration::from_millis(self.timeout_ms.get())
|
||||
}
|
||||
|
||||
pub fn refresh_interval(&self) -> Duration {
|
||||
Duration::from_millis(self.refresh_interval_ms.get())
|
||||
}
|
||||
}
|
||||
|
||||
fn default_provider_auth_timeout_ms() -> NonZeroU64 {
|
||||
non_zero_u64(
|
||||
DEFAULT_PROVIDER_AUTH_TIMEOUT_MS,
|
||||
"model_providers.<id>.auth.timeout_ms",
|
||||
)
|
||||
}
|
||||
|
||||
fn default_provider_auth_refresh_interval_ms() -> NonZeroU64 {
|
||||
non_zero_u64(
|
||||
DEFAULT_PROVIDER_AUTH_REFRESH_INTERVAL_MS,
|
||||
"model_providers.<id>.auth.refresh_interval_ms",
|
||||
)
|
||||
}
|
||||
|
||||
fn non_zero_u64(value: u64, field_name: &str) -> NonZeroU64 {
|
||||
match NonZeroU64::new(value) {
|
||||
Some(value) => value,
|
||||
None => panic!("{field_name} must be non-zero"),
|
||||
}
|
||||
}
|
||||
|
||||
fn default_provider_auth_cwd() -> AbsolutePathBuf {
|
||||
let deserializer = serde::de::value::StrDeserializer::<serde::de::value::Error>::new(".");
|
||||
if let Ok(cwd) = AbsolutePathBuf::deserialize(deserializer) {
|
||||
return cwd;
|
||||
}
|
||||
|
||||
match AbsolutePathBuf::current_dir() {
|
||||
Ok(cwd) => cwd,
|
||||
Err(err) => panic!("provider auth cwd must resolve: {err}"),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_default_provider_auth_cwd(path: &AbsolutePathBuf) -> bool {
|
||||
path == &default_provider_auth_cwd()
|
||||
}
|
||||
|
||||
/// Represents the trust level for a project directory.
|
||||
/// This determines the approval policy and sandbox mode applied.
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Display, JsonSchema, TS)]
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use std::path::PathBuf;
|
||||
use ts_rs::TS;
|
||||
|
||||
/// Base namespace for custom prompt slash commands (without trailing colon).
|
||||
/// Example usage forms constructed in code:
|
||||
/// - Command token after '/': `"{PROMPTS_CMD_PREFIX}:name"`
|
||||
/// - Full slash prefix: `"/{PROMPTS_CMD_PREFIX}:"`
|
||||
pub const PROMPTS_CMD_PREFIX: &str = "prompts";
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema, TS)]
|
||||
pub struct CustomPrompt {
|
||||
pub name: String,
|
||||
pub path: PathBuf,
|
||||
pub content: String,
|
||||
pub description: Option<String>,
|
||||
pub argument_hint: Option<String>,
|
||||
}
|
||||
@@ -426,7 +426,7 @@ mod tests {
|
||||
panic!("expected hook prompt message");
|
||||
};
|
||||
|
||||
let parsed = parse_hook_prompt_message(None, &content).expect("parsed hook prompt");
|
||||
let parsed = parse_hook_prompt_message(/*id*/ None, &content).expect("parsed hook prompt");
|
||||
assert_eq!(parsed.fragments, original);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ pub use agent_path::AgentPath;
|
||||
pub use thread_id::ThreadId;
|
||||
pub mod approvals;
|
||||
pub mod config_types;
|
||||
pub mod custom_prompts;
|
||||
pub mod dynamic_tools;
|
||||
pub mod items;
|
||||
pub mod mcp;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use codex_utils_image::PromptImageMode;
|
||||
use codex_utils_image::load_for_prompt_bytes;
|
||||
use codex_utils_template::Template;
|
||||
use serde::Deserialize;
|
||||
use serde::Deserializer;
|
||||
use serde::Serialize;
|
||||
@@ -30,6 +32,19 @@ use schemars::JsonSchema;
|
||||
|
||||
use crate::mcp::CallToolResult;
|
||||
|
||||
static SANDBOX_MODE_DANGER_FULL_ACCESS_TEMPLATE: LazyLock<Template> = LazyLock::new(|| {
|
||||
Template::parse(SANDBOX_MODE_DANGER_FULL_ACCESS.trim_end())
|
||||
.unwrap_or_else(|err| panic!("danger-full-access sandbox template must parse: {err}"))
|
||||
});
|
||||
static SANDBOX_MODE_WORKSPACE_WRITE_TEMPLATE: LazyLock<Template> = LazyLock::new(|| {
|
||||
Template::parse(SANDBOX_MODE_WORKSPACE_WRITE.trim_end())
|
||||
.unwrap_or_else(|err| panic!("workspace-write sandbox template must parse: {err}"))
|
||||
});
|
||||
static SANDBOX_MODE_READ_ONLY_TEMPLATE: LazyLock<Template> = LazyLock::new(|| {
|
||||
Template::parse(SANDBOX_MODE_READ_ONLY.trim_end())
|
||||
.unwrap_or_else(|err| panic!("read-only sandbox template must parse: {err}"))
|
||||
});
|
||||
|
||||
/// Controls the per-command sandbox override requested by a shell-like tool call.
|
||||
#[derive(
|
||||
Debug, Clone, Copy, Default, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, TS,
|
||||
@@ -583,11 +598,14 @@ impl DeveloperInstructions {
|
||||
|
||||
fn sandbox_text(mode: SandboxMode, network_access: NetworkAccess) -> DeveloperInstructions {
|
||||
let template = match mode {
|
||||
SandboxMode::DangerFullAccess => SANDBOX_MODE_DANGER_FULL_ACCESS.trim_end(),
|
||||
SandboxMode::WorkspaceWrite => SANDBOX_MODE_WORKSPACE_WRITE.trim_end(),
|
||||
SandboxMode::ReadOnly => SANDBOX_MODE_READ_ONLY.trim_end(),
|
||||
SandboxMode::DangerFullAccess => &*SANDBOX_MODE_DANGER_FULL_ACCESS_TEMPLATE,
|
||||
SandboxMode::WorkspaceWrite => &*SANDBOX_MODE_WORKSPACE_WRITE_TEMPLATE,
|
||||
SandboxMode::ReadOnly => &*SANDBOX_MODE_READ_ONLY_TEMPLATE,
|
||||
};
|
||||
let text = template.replace("{network_access}", &network_access.to_string());
|
||||
let network_access = network_access.to_string();
|
||||
let text = template
|
||||
.render([("network_access", network_access.as_str())])
|
||||
.unwrap_or_else(|err| panic!("sandbox template must render: {err}"));
|
||||
|
||||
DeveloperInstructions::new(text)
|
||||
}
|
||||
@@ -1654,6 +1672,14 @@ mod tests {
|
||||
"Filesystem sandboxing defines which files can be read or written. `sandbox_mode` is `read-only`: The sandbox only permits reading files. Network access is restricted."
|
||||
)
|
||||
);
|
||||
|
||||
let danger_full_access: DeveloperInstructions = SandboxMode::DangerFullAccess.into();
|
||||
assert_eq!(
|
||||
danger_full_access,
|
||||
DeveloperInstructions::new(
|
||||
"Filesystem sandboxing defines which files can be read or written. `sandbox_mode` is `danger-full-access`: No filesystem sandboxing - all commands are permitted. Network access is enabled."
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1668,7 +1694,7 @@ mod tests {
|
||||
exec_permission_approvals_enabled: false,
|
||||
request_permissions_tool_enabled: false,
|
||||
},
|
||||
None,
|
||||
/*writable_roots*/ None,
|
||||
);
|
||||
|
||||
let text = instructions.into_text();
|
||||
@@ -1698,8 +1724,8 @@ mod tests {
|
||||
ApprovalsReviewer::User,
|
||||
&Policy::empty(),
|
||||
&PathBuf::from("/tmp"),
|
||||
false,
|
||||
false,
|
||||
/*exec_permission_approvals_enabled*/ false,
|
||||
/*request_permissions_tool_enabled*/ false,
|
||||
);
|
||||
let text = instructions.into_text();
|
||||
assert!(text.contains("Network access is enabled."));
|
||||
@@ -1725,7 +1751,7 @@ mod tests {
|
||||
exec_permission_approvals_enabled: false,
|
||||
request_permissions_tool_enabled: false,
|
||||
},
|
||||
None,
|
||||
/*writable_roots*/ None,
|
||||
);
|
||||
|
||||
let text = instructions.into_text();
|
||||
@@ -1746,7 +1772,7 @@ mod tests {
|
||||
exec_permission_approvals_enabled: false,
|
||||
request_permissions_tool_enabled: true,
|
||||
},
|
||||
None,
|
||||
/*writable_roots*/ None,
|
||||
);
|
||||
|
||||
let text = instructions.into_text();
|
||||
@@ -1766,7 +1792,7 @@ mod tests {
|
||||
exec_permission_approvals_enabled: false,
|
||||
request_permissions_tool_enabled: true,
|
||||
},
|
||||
None,
|
||||
/*writable_roots*/ None,
|
||||
);
|
||||
|
||||
let text = instructions.into_text();
|
||||
@@ -1786,7 +1812,7 @@ mod tests {
|
||||
exec_permission_approvals_enabled: true,
|
||||
request_permissions_tool_enabled: false,
|
||||
},
|
||||
None,
|
||||
/*writable_roots*/ None,
|
||||
);
|
||||
|
||||
let text = instructions.into_text();
|
||||
@@ -1806,7 +1832,7 @@ mod tests {
|
||||
exec_permission_approvals_enabled: false,
|
||||
request_permissions_tool_enabled: true,
|
||||
},
|
||||
None,
|
||||
/*writable_roots*/ None,
|
||||
);
|
||||
|
||||
let text = instructions.into_text();
|
||||
@@ -1828,7 +1854,7 @@ mod tests {
|
||||
exec_permission_approvals_enabled: true,
|
||||
request_permissions_tool_enabled: true,
|
||||
},
|
||||
None,
|
||||
/*writable_roots*/ None,
|
||||
);
|
||||
|
||||
let text = instructions.into_text();
|
||||
@@ -1842,8 +1868,8 @@ mod tests {
|
||||
AskForApproval::OnRequest,
|
||||
ApprovalsReviewer::GuardianSubagent,
|
||||
&Policy::empty(),
|
||||
false,
|
||||
false,
|
||||
/*exec_permission_approvals_enabled*/ false,
|
||||
/*request_permissions_tool_enabled*/ false,
|
||||
)
|
||||
.into_text();
|
||||
|
||||
@@ -1857,8 +1883,8 @@ mod tests {
|
||||
AskForApproval::Never,
|
||||
ApprovalsReviewer::GuardianSubagent,
|
||||
&Policy::empty(),
|
||||
false,
|
||||
false,
|
||||
/*exec_permission_approvals_enabled*/ false,
|
||||
/*request_permissions_tool_enabled*/ false,
|
||||
)
|
||||
.into_text();
|
||||
|
||||
@@ -1909,8 +1935,8 @@ mod tests {
|
||||
}),
|
||||
ApprovalsReviewer::User,
|
||||
&Policy::empty(),
|
||||
true,
|
||||
false,
|
||||
/*exec_permission_approvals_enabled*/ true,
|
||||
/*request_permissions_tool_enabled*/ false,
|
||||
)
|
||||
.into_text();
|
||||
|
||||
@@ -1943,8 +1969,8 @@ mod tests {
|
||||
}),
|
||||
ApprovalsReviewer::User,
|
||||
&Policy::empty(),
|
||||
true,
|
||||
false,
|
||||
/*exec_permission_approvals_enabled*/ true,
|
||||
/*request_permissions_tool_enabled*/ false,
|
||||
)
|
||||
.into_text();
|
||||
|
||||
@@ -1958,8 +1984,8 @@ mod tests {
|
||||
"- `mcp_elicitations`",
|
||||
],
|
||||
&[],
|
||||
true,
|
||||
false,
|
||||
/*include_shell_permission_request_instructions*/ true,
|
||||
/*include_request_permissions_tool_section*/ false,
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1976,8 +2002,8 @@ mod tests {
|
||||
}),
|
||||
ApprovalsReviewer::User,
|
||||
&Policy::empty(),
|
||||
false,
|
||||
false,
|
||||
/*exec_permission_approvals_enabled*/ false,
|
||||
/*request_permissions_tool_enabled*/ false,
|
||||
)
|
||||
.into_text();
|
||||
|
||||
@@ -1991,8 +2017,8 @@ mod tests {
|
||||
"- `mcp_elicitations`",
|
||||
],
|
||||
&[],
|
||||
false,
|
||||
false,
|
||||
/*include_shell_permission_request_instructions*/ false,
|
||||
/*include_request_permissions_tool_section*/ false,
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -2009,8 +2035,8 @@ mod tests {
|
||||
}),
|
||||
ApprovalsReviewer::User,
|
||||
&Policy::empty(),
|
||||
true,
|
||||
true,
|
||||
/*exec_permission_approvals_enabled*/ true,
|
||||
/*request_permissions_tool_enabled*/ true,
|
||||
)
|
||||
.into_text();
|
||||
assert!(allowed.contains("# request_permissions Tool"));
|
||||
@@ -2025,8 +2051,8 @@ mod tests {
|
||||
}),
|
||||
ApprovalsReviewer::User,
|
||||
&Policy::empty(),
|
||||
true,
|
||||
true,
|
||||
/*exec_permission_approvals_enabled*/ true,
|
||||
/*request_permissions_tool_enabled*/ true,
|
||||
)
|
||||
.into_text();
|
||||
assert!(!rejected.contains("# request_permissions Tool"));
|
||||
@@ -2045,8 +2071,8 @@ mod tests {
|
||||
}),
|
||||
ApprovalsReviewer::User,
|
||||
&Policy::empty(),
|
||||
true,
|
||||
false,
|
||||
/*exec_permission_approvals_enabled*/ true,
|
||||
/*request_permissions_tool_enabled*/ false,
|
||||
)
|
||||
.into_text();
|
||||
|
||||
@@ -2626,7 +2652,7 @@ mod tests {
|
||||
assert_eq!(
|
||||
content.get(3),
|
||||
Some(&ContentItem::InputText {
|
||||
text: local_image_open_tag_text(2),
|
||||
text: local_image_open_tag_text(/*label_number*/ 2),
|
||||
})
|
||||
);
|
||||
assert!(matches!(
|
||||
|
||||
@@ -537,7 +537,7 @@ mod tests {
|
||||
default_verbosity: None,
|
||||
apply_patch_tool_type: None,
|
||||
web_search_tool_type: WebSearchToolType::Text,
|
||||
truncation_policy: TruncationPolicyConfig::bytes(10_000),
|
||||
truncation_policy: TruncationPolicyConfig::bytes(/*limit*/ 10_000),
|
||||
supports_parallel_tool_calls: false,
|
||||
supports_image_detail_original: false,
|
||||
context_window: None,
|
||||
@@ -606,7 +606,10 @@ mod tests {
|
||||
model.get_model_instructions(Some(Personality::None)),
|
||||
"Hello\n"
|
||||
);
|
||||
assert_eq!(model.get_model_instructions(None), "Hello\n");
|
||||
assert_eq!(
|
||||
model.get_model_instructions(/*personality*/ None),
|
||||
"Hello\n"
|
||||
);
|
||||
|
||||
let model_no_personality = test_model(Some(ModelMessages {
|
||||
instructions_template: Some("Hello\n{{ personality }}".to_string()),
|
||||
@@ -628,7 +631,10 @@ mod tests {
|
||||
model_no_personality.get_model_instructions(Some(Personality::None)),
|
||||
"Hello\n"
|
||||
);
|
||||
assert_eq!(model_no_personality.get_model_instructions(None), "Hello\n");
|
||||
assert_eq!(
|
||||
model_no_personality.get_model_instructions(/*personality*/ None),
|
||||
"Hello\n"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -651,7 +657,7 @@ mod tests {
|
||||
fn get_personality_message_returns_default_when_personality_is_none() {
|
||||
let personality_template = personality_variables();
|
||||
assert_eq!(
|
||||
personality_template.get_personality_message(None),
|
||||
personality_template.get_personality_message(/*personality*/ None),
|
||||
Some("default".to_string())
|
||||
);
|
||||
}
|
||||
@@ -672,7 +678,7 @@ mod tests {
|
||||
Some(String::new())
|
||||
);
|
||||
assert_eq!(
|
||||
personality_variables.get_personality_message(None),
|
||||
personality_variables.get_personality_message(/*personality*/ None),
|
||||
Some("default".to_string())
|
||||
);
|
||||
|
||||
@@ -694,7 +700,7 @@ mod tests {
|
||||
Some(String::new())
|
||||
);
|
||||
assert_eq!(
|
||||
personality_variables.get_personality_message(None),
|
||||
personality_variables.get_personality_message(/*personality*/ None),
|
||||
Some("default".to_string())
|
||||
);
|
||||
|
||||
@@ -715,7 +721,10 @@ mod tests {
|
||||
personality_variables.get_personality_message(Some(Personality::None)),
|
||||
Some(String::new())
|
||||
);
|
||||
assert_eq!(personality_variables.get_personality_message(None), None);
|
||||
assert_eq!(
|
||||
personality_variables.get_personality_message(/*personality*/ None),
|
||||
None
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -763,7 +772,7 @@ mod tests {
|
||||
availability_nux: Some(ModelAvailabilityNux {
|
||||
message: "Try Spark.".to_string(),
|
||||
}),
|
||||
..test_model(None)
|
||||
..test_model(/*spec*/ None)
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
|
||||
@@ -1268,7 +1268,10 @@ mod tests {
|
||||
fn unknown_special_paths_are_ignored_by_legacy_bridge() -> std::io::Result<()> {
|
||||
let policy = FileSystemSandboxPolicy::restricted(vec![FileSystemSandboxEntry {
|
||||
path: FileSystemPath::Special {
|
||||
value: FileSystemSpecialPath::unknown(":future_special_path", None),
|
||||
value: FileSystemSpecialPath::unknown(
|
||||
":future_special_path",
|
||||
/*subpath*/ None,
|
||||
),
|
||||
},
|
||||
access: FileSystemAccessMode::Write,
|
||||
}]);
|
||||
|
||||
@@ -1 +1 @@
|
||||
Filesystem sandboxing defines which files can be read or written. `sandbox_mode` is `danger-full-access`: No filesystem sandboxing - all commands are permitted. Network access is {network_access}.
|
||||
Filesystem sandboxing defines which files can be read or written. `sandbox_mode` is `danger-full-access`: No filesystem sandboxing - all commands are permitted. Network access is {{network_access}}.
|
||||
|
||||
@@ -1 +1 @@
|
||||
Filesystem sandboxing defines which files can be read or written. `sandbox_mode` is `read-only`: The sandbox only permits reading files. Network access is {network_access}.
|
||||
Filesystem sandboxing defines which files can be read or written. `sandbox_mode` is `read-only`: The sandbox only permits reading files. Network access is {{network_access}}.
|
||||
|
||||
@@ -1 +1 @@
|
||||
Filesystem sandboxing defines which files can be read or written. `sandbox_mode` is `workspace-write`: The sandbox permits reading files, and editing files in `cwd` and `writable_roots`. Editing files in other directories requires approval. Network access is {network_access}.
|
||||
Filesystem sandboxing defines which files can be read or written. `sandbox_mode` is `workspace-write`: The sandbox permits reading files, and editing files in `cwd` and `writable_roots`. Editing files in other directories requires approval. Network access is {{network_access}}.
|
||||
|
||||
@@ -23,7 +23,6 @@ use crate::config_types::Personality;
|
||||
use crate::config_types::ReasoningSummary as ReasoningSummaryConfig;
|
||||
use crate::config_types::ServiceTier;
|
||||
use crate::config_types::WindowsSandboxLevel;
|
||||
use crate::custom_prompts::CustomPrompt;
|
||||
use crate::dynamic_tools::DynamicToolCallOutputContentItem;
|
||||
use crate::dynamic_tools::DynamicToolCallRequest;
|
||||
use crate::dynamic_tools::DynamicToolResponse;
|
||||
@@ -451,9 +450,6 @@ pub enum Op {
|
||||
/// enable/disable state) without restarting the thread.
|
||||
ReloadUserConfig,
|
||||
|
||||
/// Request the list of available custom prompts.
|
||||
ListCustomPrompts,
|
||||
|
||||
/// Request the list of skills for the provided `cwd` values or the session default.
|
||||
ListSkills {
|
||||
/// Working directories to scope repo skills discovery.
|
||||
@@ -512,6 +508,15 @@ pub enum Op {
|
||||
ListModels,
|
||||
}
|
||||
|
||||
impl From<Vec<UserInput>> for Op {
|
||||
fn from(value: Vec<UserInput>) -> Self {
|
||||
Op::UserInput {
|
||||
items: value,
|
||||
final_output_json_schema: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, JsonSchema, TS)]
|
||||
pub struct InterAgentCommunication {
|
||||
pub author: AgentPath,
|
||||
@@ -586,7 +591,6 @@ impl Op {
|
||||
Self::ListMcpTools => "list_mcp_tools",
|
||||
Self::RefreshMcpServers { .. } => "refresh_mcp_servers",
|
||||
Self::ReloadUserConfig => "reload_user_config",
|
||||
Self::ListCustomPrompts => "list_custom_prompts",
|
||||
Self::ListSkills { .. } => "list_skills",
|
||||
Self::Compact => "compact",
|
||||
Self::DropMemories => "drop_memories",
|
||||
@@ -1361,9 +1365,6 @@ pub enum EventMsg {
|
||||
/// List of MCP tools available to the agent.
|
||||
McpListToolsResponse(McpListToolsResponseEvent),
|
||||
|
||||
/// List of custom prompts available to the agent.
|
||||
ListCustomPromptsResponse(ListCustomPromptsResponseEvent),
|
||||
|
||||
/// List of skills available to the agent.
|
||||
ListSkillsResponse(ListSkillsResponseEvent),
|
||||
|
||||
@@ -3101,12 +3102,6 @@ impl fmt::Display for McpAuthStatus {
|
||||
}
|
||||
}
|
||||
|
||||
/// Response payload for `Op::ListCustomPrompts`.
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct ListCustomPromptsResponseEvent {
|
||||
pub custom_prompts: Vec<CustomPrompt>,
|
||||
}
|
||||
|
||||
/// Response payload for `Op::ListSkills`.
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct ListSkillsResponseEvent {
|
||||
@@ -4290,7 +4285,7 @@ mod tests {
|
||||
}),
|
||||
};
|
||||
|
||||
let legacy_events = event.as_legacy_events(false);
|
||||
let legacy_events = event.as_legacy_events(/*show_raw_agent_reasoning*/ false);
|
||||
assert_eq!(legacy_events.len(), 1);
|
||||
match &legacy_events[0] {
|
||||
EventMsg::WebSearchBegin(event) => assert_eq!(event.call_id, "search-1"),
|
||||
@@ -4306,7 +4301,11 @@ mod tests {
|
||||
item: TurnItem::UserMessage(UserMessageItem::new(&[])),
|
||||
};
|
||||
|
||||
assert!(event.as_legacy_events(false).is_empty());
|
||||
assert!(
|
||||
event
|
||||
.as_legacy_events(/*show_raw_agent_reasoning*/ false)
|
||||
.is_empty()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -4323,7 +4322,7 @@ mod tests {
|
||||
}),
|
||||
};
|
||||
|
||||
let legacy_events = event.as_legacy_events(false);
|
||||
let legacy_events = event.as_legacy_events(/*show_raw_agent_reasoning*/ false);
|
||||
assert_eq!(legacy_events.len(), 1);
|
||||
match &legacy_events[0] {
|
||||
EventMsg::ImageGenerationBegin(event) => assert_eq!(event.call_id, "ig-1"),
|
||||
@@ -4345,7 +4344,7 @@ mod tests {
|
||||
}),
|
||||
};
|
||||
|
||||
let legacy_events = event.as_legacy_events(false);
|
||||
let legacy_events = event.as_legacy_events(/*show_raw_agent_reasoning*/ false);
|
||||
assert_eq!(legacy_events.len(), 1);
|
||||
match &legacy_events[0] {
|
||||
EventMsg::ImageGenerationEnd(event) => {
|
||||
@@ -4760,8 +4759,9 @@ mod tests {
|
||||
total_tokens: 10,
|
||||
});
|
||||
|
||||
let info = TokenUsageInfo::new_or_append(&initial, &last, None)
|
||||
.expect("new_or_append should return info");
|
||||
let info =
|
||||
TokenUsageInfo::new_or_append(&initial, &last, /*model_context_window*/ None)
|
||||
.expect("new_or_append should return info");
|
||||
|
||||
assert_eq!(info.model_context_window, Some(258_400));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user