diff --git a/.github/scripts/archive-release-symbols-and-strip-binaries.sh b/.github/scripts/archive-release-symbols-and-strip-binaries.sh new file mode 100755 index 0000000000..3e5894bb99 --- /dev/null +++ b/.github/scripts/archive-release-symbols-and-strip-binaries.sh @@ -0,0 +1,119 @@ +#!/usr/bin/env bash +set -euo pipefail + +usage() { + cat <<'EOF' +Usage: archive-release-symbols-and-strip-binaries.sh \ + --target \ + --artifact-name \ + --release-dir \ + --archive-dir \ + --binaries "" +EOF +} + +target="" +artifact_name="" +release_dir="" +archive_dir="" +binaries="" + +while [[ $# -gt 0 ]]; do + case "$1" in + --target) + target="${2:?--target requires a value}" + shift 2 + ;; + --artifact-name) + artifact_name="${2:?--artifact-name requires a value}" + shift 2 + ;; + --release-dir) + release_dir="${2:?--release-dir requires a value}" + shift 2 + ;; + --archive-dir) + archive_dir="${2:?--archive-dir requires a value}" + shift 2 + ;; + --binaries) + binaries="${2:?--binaries requires a value}" + shift 2 + ;; + -h|--help) + usage + exit 0 + ;; + *) + echo "Unexpected argument: $1" >&2 + usage >&2 + exit 1 + ;; + esac +done + +if [[ -z "$target" || -z "$artifact_name" || -z "$release_dir" || -z "$archive_dir" || -z "$binaries" ]]; then + usage >&2 + exit 1 +fi + +symbols_root="${RUNNER_TEMP:-/tmp}/codex-symbols-${artifact_name}" +symbols_dir="${symbols_root}/codex-symbols-${artifact_name}" +archive_path="${archive_dir%/}/codex-symbols-${artifact_name}.tar.gz" +rm -rf "$symbols_root" +mkdir -p "$symbols_dir" "$archive_dir" +read -r -a binary_names <<< "$binaries" + +case "$target" in + *apple-darwin) + for binary in "${binary_names[@]}"; do + binary_path="${release_dir%/}/${binary}" + dsym_path="${binary_path}.dSYM" + if [[ ! -f "$binary_path" ]]; then + echo "Binary $binary_path not found" >&2 + exit 1 + fi + if [[ ! -d "$dsym_path" ]]; then + echo "dSYM $dsym_path not found" >&2 + exit 1 + fi + + cp -RL "$dsym_path" "${symbols_dir}/${binary}.dSYM" + strip -S -x "$binary_path" + done + ;; + *linux*) + objcopy_bin="${OBJCOPY:-objcopy}" + strip_bin="${STRIP:-strip}" + for binary in "${binary_names[@]}"; do + binary_path="${release_dir%/}/${binary}" + debug_path="${symbols_dir}/${binary}.debug" + if [[ ! -f "$binary_path" ]]; then + echo "Binary $binary_path not found" >&2 + exit 1 + fi + + "$objcopy_bin" --only-keep-debug "$binary_path" "$debug_path" + "$strip_bin" --strip-debug --strip-unneeded "$binary_path" + "$objcopy_bin" --add-gnu-debuglink="$debug_path" "$binary_path" + done + ;; + *windows*) + for binary in "${binary_names[@]}"; do + pdb_path="${release_dir%/}/${binary}.pdb" + if [[ ! -f "$pdb_path" ]]; then + echo "PDB $pdb_path not found" >&2 + exit 1 + fi + + cp "$pdb_path" "${symbols_dir}/${binary}.pdb" + done + ;; + *) + echo "No symbols packaging support for target: $target" >&2 + exit 1 + ;; +esac + +rm -f "$archive_path" +tar -C "$symbols_root" -czf "$archive_path" "codex-symbols-${artifact_name}" diff --git a/.github/workflows/rust-release-windows.yml b/.github/workflows/rust-release-windows.yml index 3b4d3cfebf..91887cbe0b 100644 --- a/.github/workflows/rust-release-windows.yml +++ b/.github/workflows/rust-release-windows.yml @@ -34,6 +34,8 @@ jobs: working-directory: codex-rs env: CARGO_PROFILE_RELEASE_LTO: ${{ inputs.release-lto }} + CARGO_PROFILE_RELEASE_DEBUG: full + CARGO_PROFILE_RELEASE_STRIP: "false" strategy: fail-fast: false @@ -131,6 +133,7 @@ jobs: mkdir -p "$output_dir" for binary in ${{ matrix.binaries }}; do cp "target/${{ matrix.target }}/release/${binary}.exe" "$output_dir/${binary}.exe" + cp "target/${{ matrix.target }}/release/${binary}.pdb" "$output_dir/${binary}.pdb" done - name: Upload Windows binaries @@ -213,6 +216,23 @@ jobs: account-name: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }} certificate-profile-name: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }} + - name: Build symbols archive + shell: bash + run: | + bash "${GITHUB_WORKSPACE}/.github/scripts/archive-release-symbols-and-strip-binaries.sh" \ + --target "${{ matrix.target }}" \ + --artifact-name "${{ matrix.target }}" \ + --release-dir "target/${{ matrix.target }}/release" \ + --archive-dir "symbols-dist/${{ matrix.target }}" \ + --binaries "${WINDOWS_BINARIES}" + + - name: Upload symbols archive + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: ${{ matrix.target }}-symbols + path: codex-rs/symbols-dist/${{ matrix.target }}/* + if-no-files-found: error + - name: Stage artifacts shell: bash run: | diff --git a/.github/workflows/rust-release.yml b/.github/workflows/rust-release.yml index db72ab830f..364fe78902 100644 --- a/.github/workflows/rust-release.yml +++ b/.github/workflows/rust-release.yml @@ -149,6 +149,9 @@ jobs: # 2026-03-04: temporarily change releases to use thin LTO because # Ubuntu ARM is timing out at 60 minutes. CARGO_PROFILE_RELEASE_LTO: ${{ contains(github.ref_name, '-alpha') && 'thin' || 'thin' }} + CARGO_PROFILE_RELEASE_DEBUG: full + CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO: ${{ contains(matrix.target, 'apple-darwin') && 'packed' || 'off' }} + CARGO_PROFILE_RELEASE_STRIP: "false" # Use the git CLI instead of Cargo's libgit2 path for git dependencies. # macOS release runners have intermittently failed to fetch nested # submodules through SecureTransport/libgit2, especially libwebrtc's @@ -249,7 +252,7 @@ jobs: run: | set -euo pipefail sudo apt-get update -y - sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends pkg-config libcap-dev + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends binutils pkg-config libcap-dev - uses: dtolnay/rust-toolchain@e081816240890017053eacbb1bdf337761dc5582 # 1.95.0 with: targets: ${{ matrix.target }} @@ -308,6 +311,10 @@ jobs: exit 1 fi + # Codex embeds this digest at build time and verifies the bundled + # bwrap resource before use. Strip bwrap before hashing so the digest + # covers the exact bytes that the release packages. + strip --strip-debug --strip-unneeded "$bwrap_path" digest="$(sha256sum "$bwrap_path" | awk '{print $1}')" echo "CODEX_BWRAP_SHA256=${digest}" >> "$GITHUB_ENV" echo "Built bwrap ${bwrap_path} with sha256:${digest}" @@ -321,6 +328,11 @@ jobs: fi build_args=() for binary in ${{ matrix.binaries }}; do + # bwrap was built, finalized, and hashed before this build so + # Codex can embed the digest of the bytes that will be packaged. + if [[ "$binary" == "bwrap" ]]; then + continue + fi build_args+=(--bin "$binary") done echo "CARGO_PROFILE_RELEASE_LTO: ${CARGO_PROFILE_RELEASE_LTO}" @@ -333,6 +345,32 @@ jobs: path: codex-rs/target/**/cargo-timings/cargo-timing.html if-no-files-found: warn + - name: Build symbols archive and strip binaries + shell: bash + run: | + binaries=() + for binary in ${{ matrix.binaries }}; do + # bwrap is already stripped before hashing. Its symbols are not + # useful enough to justify a separate pre-Codex symbols pass. + if [[ "$binary" == "bwrap" ]]; then + continue + fi + binaries+=("$binary") + done + bash "${GITHUB_WORKSPACE}/.github/scripts/archive-release-symbols-and-strip-binaries.sh" \ + --target "${{ matrix.target }}" \ + --artifact-name "${{ matrix.artifact_name }}" \ + --release-dir "target/${{ matrix.target }}/release" \ + --archive-dir "symbols-dist/${{ matrix.artifact_name }}" \ + --binaries "${binaries[*]}" + + - name: Upload symbols archive + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: ${{ matrix.artifact_name }}-symbols + path: codex-rs/symbols-dist/${{ matrix.artifact_name }}/* + if-no-files-found: error + - if: ${{ runner.os == 'macOS' && env.SIGN_MACOS != 'true' }} name: Stage unsigned macOS artifacts shell: bash @@ -1031,6 +1069,7 @@ jobs: run: | find dist -mindepth 1 -maxdepth 1 -type d \ ! -name '*-apple-darwin*-unsigned' \ + ! -name '*-symbols' \ ! -name 'aarch64-unknown-linux-musl' \ ! -name 'aarch64-unknown-linux-musl-app-server' \ ! -name 'x86_64-unknown-linux-musl' \ diff --git a/codex-rs/core/src/config/config_tests.rs b/codex-rs/core/src/config/config_tests.rs index 70719843ba..eecb784093 100644 --- a/codex-rs/core/src/config/config_tests.rs +++ b/codex-rs/core/src/config/config_tests.rs @@ -2356,7 +2356,13 @@ async fn default_permissions_profile_can_extend_builtin_workspace() -> std::io:: description: None, extends: Some(BUILT_IN_PERMISSION_PROFILE_WORKSPACE.to_string()), workspace_roots: None, - filesystem: None, + filesystem: Some(FilesystemPermissionsToml { + glob_scan_max_depth: None, + entries: BTreeMap::from([( + ":tmpdir".to_string(), + FilesystemPermissionToml::Access(FileSystemAccessMode::Read), + )]), + }), network: Some(NetworkToml { enabled: Some(true), ..Default::default() @@ -2383,6 +2389,30 @@ async fn default_permissions_profile_can_extend_builtin_workspace() -> std::io:: !policy.can_write_path_with_cwd(&cwd.path().join(".git"), cwd.path()), "expected profile extending :workspace to keep metadata carveouts, policy: {policy:?}" ); + assert!( + policy.entries.iter().any(|entry| matches!( + entry, + FileSystemSandboxEntry { + path: FileSystemPath::Special { + value: FileSystemSpecialPath::Tmpdir, + }, + access: FileSystemAccessMode::Read, + } + )), + "expected child :tmpdir read entry to replace the inherited write entry, policy: {policy:?}" + ); + assert!( + !policy.entries.iter().any(|entry| matches!( + entry, + FileSystemSandboxEntry { + path: FileSystemPath::Special { + value: FileSystemSpecialPath::Tmpdir, + }, + access: FileSystemAccessMode::Write, + } + )), + "expected inherited :tmpdir write entry to be removed, policy: {policy:?}" + ); assert_eq!( config.permissions.network_sandbox_policy(), NetworkSandboxPolicy::Enabled diff --git a/codex-rs/core/src/config/permissions.rs b/codex-rs/core/src/config/permissions.rs index a8546858f1..12aebf16d9 100644 --- a/codex-rs/core/src/config/permissions.rs +++ b/codex-rs/core/src/config/permissions.rs @@ -1,4 +1,5 @@ use std::borrow::Cow; +use std::collections::BTreeMap; use std::io; use std::path::Component; use std::path::Path; @@ -196,25 +197,59 @@ pub(crate) fn resolve_permission_profile( profile_name: &str, ) -> io::Result { permissions - .resolve_profile(profile_name, extensible_builtin_parent_profile_marker) + .resolve_profile(profile_name, extensible_builtin_parent_profile) .map_err(|err| io::Error::new(io::ErrorKind::InvalidInput, err.to_string())) } -/// Built-in parents provide their runtime permissions below. Resolution only -/// needs an empty profile marker so inheritance can terminate while preserving -/// the built-in parent id in `inherited_profile_names`. -fn extensible_builtin_parent_profile_marker(profile_name: &str) -> Option { - matches!( - profile_name, - BUILT_IN_READ_ONLY_PROFILE | BUILT_IN_WORKSPACE_PROFILE - ) - .then_some(PermissionProfileToml { - description: None, - extends: None, - workspace_roots: None, - filesystem: None, - network: None, - }) +fn extensible_builtin_parent_profile(profile_name: &str) -> Option { + match profile_name { + BUILT_IN_READ_ONLY_PROFILE => Some(PermissionProfileToml { + description: None, + extends: None, + workspace_roots: None, + filesystem: Some(FilesystemPermissionsToml { + glob_scan_max_depth: None, + entries: BTreeMap::from([( + ":root".to_string(), + FilesystemPermissionToml::Access(FileSystemAccessMode::Read), + )]), + }), + network: None, + }), + BUILT_IN_WORKSPACE_PROFILE => Some(PermissionProfileToml { + description: None, + extends: None, + workspace_roots: None, + filesystem: Some(FilesystemPermissionsToml { + glob_scan_max_depth: None, + entries: BTreeMap::from([ + ( + ":root".to_string(), + FilesystemPermissionToml::Access(FileSystemAccessMode::Read), + ), + ( + ":workspace_roots".to_string(), + FilesystemPermissionToml::Scoped(BTreeMap::from([ + (".".to_string(), FileSystemAccessMode::Write), + (".git".to_string(), FileSystemAccessMode::Read), + (".agents".to_string(), FileSystemAccessMode::Read), + (".codex".to_string(), FileSystemAccessMode::Read), + ])), + ), + ( + ":slash_tmp".to_string(), + FilesystemPermissionToml::Access(FileSystemAccessMode::Write), + ), + ( + ":tmpdir".to_string(), + FilesystemPermissionToml::Access(FileSystemAccessMode::Write), + ), + ]), + }), + network: None, + }), + _ => None, + } } pub(crate) fn network_proxy_config_for_profile_selection( @@ -244,25 +279,10 @@ pub(crate) fn compile_permission_profile( policy_cwd: &Path, startup_warnings: &mut Vec, ) -> io::Result<(FileSystemSandboxPolicy, NetworkSandboxPolicy)> { - let ResolvedPermissionProfileToml { - profile, - inherited_profile_names, - } = resolve_permission_profile(permissions, profile_name)?; - let base_permissions = inherited_profile_names.iter().find_map(|name| { - match name.as_str() { - BUILT_IN_READ_ONLY_PROFILE => Some(PermissionProfile::read_only()), - BUILT_IN_WORKSPACE_PROFILE => Some(PermissionProfile::workspace_write()), - _ => None, - } - .map(|profile| profile.to_runtime_permissions()) - }); - let (mut file_system_sandbox_policy, base_network_sandbox_policy) = base_permissions - .unwrap_or_else(|| { - ( - FileSystemSandboxPolicy::restricted(Vec::new()), - NetworkSandboxPolicy::Restricted, - ) - }); + let ResolvedPermissionProfileToml { profile, .. } = + resolve_permission_profile(permissions, profile_name)?; + let mut file_system_sandbox_policy = FileSystemSandboxPolicy::restricted(Vec::new()); + let base_network_sandbox_policy = NetworkSandboxPolicy::Restricted; if let Some(filesystem) = profile.filesystem.as_ref() { if filesystem.is_empty() && file_system_sandbox_policy.entries.is_empty() { push_warning( @@ -693,6 +713,7 @@ fn parse_special_path(path: &str) -> Option { ":minimal" => Some(FileSystemSpecialPath::Minimal), ":workspace_roots" => Some(FileSystemSpecialPath::project_roots(/*subpath*/ None)), ":tmpdir" => Some(FileSystemSpecialPath::Tmpdir), + ":slash_tmp" => Some(FileSystemSpecialPath::SlashTmp), _ if path.starts_with(':') => { Some(FileSystemSpecialPath::unknown(path, /*subpath*/ None)) } diff --git a/codex-rs/core/src/tools/handlers/dynamic.rs b/codex-rs/core/src/tools/handlers/dynamic.rs index e5e0d10534..a74f44fd6d 100644 --- a/codex-rs/core/src/tools/handlers/dynamic.rs +++ b/codex-rs/core/src/tools/handlers/dynamic.rs @@ -9,7 +9,6 @@ use crate::tools::handlers::parse_arguments; use crate::tools::registry::CoreToolRuntime; use crate::tools::registry::ToolExecutor; use crate::tools::registry::ToolExposure; -use crate::tools::tool_search_entry::ToolSearchInfo; use crate::turn_timing::now_unix_timestamp_ms; use codex_protocol::dynamic_tools::DynamicToolCallRequest; use codex_protocol::dynamic_tools::DynamicToolResponse; @@ -20,6 +19,7 @@ use codex_protocol::protocol::EventMsg; use codex_tools::ResponsesApiNamespace; use codex_tools::ResponsesApiNamespaceTool; use codex_tools::ToolName; +use codex_tools::ToolSearchInfo; use codex_tools::ToolSearchSourceInfo; use codex_tools::ToolSpec; use codex_tools::default_namespace_description; @@ -75,6 +75,17 @@ impl ToolExecutor for DynamicToolHandler { self.exposure } + fn search_info(&self) -> Option { + ToolSearchInfo::from_spec( + self.search_text.clone(), + self.spec(), + Some(ToolSearchSourceInfo { + name: "Dynamic tools".to_string(), + description: Some("Tools provided by the current Codex thread.".to_string()), + }), + ) + } + async fn handle( &self, invocation: ToolInvocation, @@ -126,18 +137,7 @@ impl ToolExecutor for DynamicToolHandler { } } -impl CoreToolRuntime for DynamicToolHandler { - fn search_info(&self) -> Option { - ToolSearchInfo::from_spec( - self.search_text.clone(), - self.spec(), - Some(ToolSearchSourceInfo { - name: "Dynamic tools".to_string(), - description: Some("Tools provided by the current Codex thread.".to_string()), - }), - ) - } -} +impl CoreToolRuntime for DynamicToolHandler {} #[expect( clippy::await_holding_invalid_type, diff --git a/codex-rs/core/src/tools/handlers/extension_tools.rs b/codex-rs/core/src/tools/handlers/extension_tools.rs index 95b272bbf6..4ad88ac5bb 100644 --- a/codex-rs/core/src/tools/handlers/extension_tools.rs +++ b/codex-rs/core/src/tools/handlers/extension_tools.rs @@ -7,6 +7,7 @@ use codex_tools::ExtensionTurnItem; use codex_tools::ImageGenerationCompletionFuture; use codex_tools::ToolCall as ExtensionToolCall; use codex_tools::ToolName; +use codex_tools::ToolSearchInfo; use codex_tools::ToolSpec; use codex_tools::TurnItemEmissionFuture; use codex_tools::TurnItemEmitter; @@ -49,6 +50,10 @@ impl ToolExecutor for ExtensionToolAdapter { self.0.supports_parallel_tool_calls() } + fn search_info(&self) -> Option { + self.0.search_info() + } + async fn handle( &self, invocation: ToolInvocation, diff --git a/codex-rs/core/src/tools/handlers/mcp.rs b/codex-rs/core/src/tools/handlers/mcp.rs index 8f18d5b55e..77ff3c14a3 100644 --- a/codex-rs/core/src/tools/handlers/mcp.rs +++ b/codex-rs/core/src/tools/handlers/mcp.rs @@ -15,11 +15,11 @@ use crate::tools::registry::PostToolUsePayload; use crate::tools::registry::PreToolUsePayload; use crate::tools::registry::ToolExecutor; use crate::tools::registry::ToolTelemetryTags; -use crate::tools::tool_search_entry::ToolSearchInfo; use codex_mcp::ToolInfo; use codex_tools::ResponsesApiNamespace; use codex_tools::ResponsesApiNamespaceTool; use codex_tools::ToolName; +use codex_tools::ToolSearchInfo; use codex_tools::ToolSearchSourceInfo; use codex_tools::ToolSpec; use codex_tools::mcp_tool_to_responses_api_tool; @@ -87,6 +87,32 @@ impl ToolExecutor for McpHandler { .unwrap_or(false) } + fn search_info(&self) -> Option { + let source_name = self + .tool_info + .connector_name + .as_deref() + .map(str::trim) + .filter(|connector_name| !connector_name.is_empty()) + .unwrap_or_else(|| self.tool_info.server_name.trim()); + let source_info = (!source_name.is_empty()).then(|| ToolSearchSourceInfo { + name: source_name.to_string(), + description: self + .tool_info + .namespace_description + .as_deref() + .map(str::trim) + .filter(|description| !description.is_empty()) + .map(str::to_string), + }); + + ToolSearchInfo::from_spec( + build_mcp_search_text(&self.tool_info), + self.spec(), + source_info, + ) + } + async fn handle( &self, invocation: ToolInvocation, @@ -131,32 +157,6 @@ impl ToolExecutor for McpHandler { } impl CoreToolRuntime for McpHandler { - fn search_info(&self) -> Option { - let source_name = self - .tool_info - .connector_name - .as_deref() - .map(str::trim) - .filter(|connector_name| !connector_name.is_empty()) - .unwrap_or_else(|| self.tool_info.server_name.trim()); - let source_info = (!source_name.is_empty()).then(|| ToolSearchSourceInfo { - name: source_name.to_string(), - description: self - .tool_info - .namespace_description - .as_deref() - .map(str::trim) - .filter(|description| !description.is_empty()) - .map(str::to_string), - }); - - ToolSearchInfo::from_spec( - build_mcp_search_text(&self.tool_info), - self.spec(), - source_info, - ) - } - fn telemetry_tags<'a>( &'a self, _invocation: &'a ToolInvocation, diff --git a/codex-rs/core/src/tools/handlers/multi_agents.rs b/codex-rs/core/src/tools/handlers/multi_agents.rs index 00176572e0..8bc96d19c2 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents.rs @@ -19,7 +19,6 @@ use crate::tools::handlers::multi_agents_spec::MULTI_AGENT_V1_NAMESPACE; use crate::tools::handlers::parse_arguments; use crate::tools::registry::CoreToolRuntime; use crate::tools::registry::ToolExecutor; -use crate::tools::tool_search_entry::ToolSearchInfo; use codex_protocol::ThreadId; use codex_protocol::models::ResponseInputItem; use codex_protocol::openai_models::ReasoningEffort; @@ -36,6 +35,7 @@ use codex_protocol::protocol::CollabWaitingBeginEvent; use codex_protocol::protocol::CollabWaitingEndEvent; use codex_protocol::user_input::UserInput; use codex_tools::ToolName; +use codex_tools::ToolSearchInfo; use codex_tools::ToolSearchSourceInfo; use serde::Deserialize; use serde::Serialize; diff --git a/codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs b/codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs index bcfa5231b9..2007e3df7d 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/close_agent.rs @@ -16,6 +16,13 @@ impl ToolExecutor for Handler { create_close_agent_tool_v1() } + fn search_info(&self) -> Option { + multi_agent_tool_search_info( + "close_agent close shutdown stop agent subagent thread status target", + self.spec(), + ) + } + async fn handle( &self, invocation: ToolInvocation, @@ -109,13 +116,6 @@ async fn handle_close_agent( } impl CoreToolRuntime for Handler { - fn search_info(&self) -> Option { - multi_agent_tool_search_info( - "close_agent close shutdown stop agent subagent thread status target", - self.spec(), - ) - } - fn matches_kind(&self, payload: &ToolPayload) -> bool { matches!(payload, ToolPayload::Function { .. }) } diff --git a/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs b/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs index a536c8d704..ebe3678eb9 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/resume_agent.rs @@ -17,6 +17,13 @@ impl ToolExecutor for Handler { create_resume_agent_tool() } + fn search_info(&self) -> Option { + multi_agent_tool_search_info( + "resume_agent resume reopen closed agent subagent thread id target", + self.spec(), + ) + } + async fn handle( &self, invocation: ToolInvocation, @@ -135,13 +142,6 @@ async fn handle_resume_agent( } impl CoreToolRuntime for Handler { - fn search_info(&self) -> Option { - multi_agent_tool_search_info( - "resume_agent resume reopen closed agent subagent thread id target", - self.spec(), - ) - } - fn matches_kind(&self, payload: &ToolPayload) -> bool { matches!(payload, ToolPayload::Function { .. }) } diff --git a/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs b/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs index 8499bac52c..d7f316ba3e 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs @@ -16,6 +16,13 @@ impl ToolExecutor for Handler { create_send_input_tool_v1() } + fn search_info(&self) -> Option { + multi_agent_tool_search_info( + "send_input send message existing agent subagent follow up interrupt redirect queue target", + self.spec(), + ) + } + async fn handle( &self, invocation: ToolInvocation, @@ -91,13 +98,6 @@ impl ToolExecutor for Handler { } impl CoreToolRuntime for Handler { - fn search_info(&self) -> Option { - multi_agent_tool_search_info( - "send_input send message existing agent subagent follow up interrupt redirect queue target", - self.spec(), - ) - } - fn matches_kind(&self, payload: &ToolPayload) -> bool { matches!(payload, ToolPayload::Function { .. }) } diff --git a/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs b/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs index c4120dd5af..56707fb0ca 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/spawn.rs @@ -32,6 +32,13 @@ impl ToolExecutor for Handler { create_spawn_agent_tool_v1(self.options.clone()) } + fn search_info(&self) -> Option { + multi_agent_tool_search_info( + "spawn_agent spawn agent subagent sub-agent delegate delegation parallel work worker explorer no-apps fork model reasoning", + self.spec(), + ) + } + async fn handle( &self, invocation: ToolInvocation, @@ -204,13 +211,6 @@ async fn handle_spawn_agent( } impl CoreToolRuntime for Handler { - fn search_info(&self) -> Option { - multi_agent_tool_search_info( - "spawn_agent spawn agent subagent sub-agent delegate delegation parallel work worker explorer no-apps fork model reasoning", - self.spec(), - ) - } - fn matches_kind(&self, payload: &ToolPayload) -> bool { matches!(payload, ToolPayload::Function { .. }) } diff --git a/codex-rs/core/src/tools/handlers/multi_agents/wait.rs b/codex-rs/core/src/tools/handlers/multi_agents/wait.rs index 2e4fb6100a..063b064578 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents/wait.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents/wait.rs @@ -37,6 +37,13 @@ impl ToolExecutor for Handler { create_wait_agent_tool_v1(self.options) } + fn search_info(&self) -> Option { + multi_agent_tool_search_info( + "wait_agent wait agent subagent status final result complete timeout targets", + self.spec(), + ) + } + async fn handle( &self, invocation: ToolInvocation, @@ -203,13 +210,6 @@ impl ToolExecutor for Handler { } impl CoreToolRuntime for Handler { - fn search_info(&self) -> Option { - multi_agent_tool_search_info( - "wait_agent wait agent subagent status final result complete timeout targets", - self.spec(), - ) - } - fn matches_kind(&self, payload: &ToolPayload) -> bool { matches!(payload, ToolPayload::Function { .. }) } diff --git a/codex-rs/core/src/tools/handlers/tool_search.rs b/codex-rs/core/src/tools/handlers/tool_search.rs index 442d77ce8d..2de1e20dd4 100644 --- a/codex-rs/core/src/tools/handlers/tool_search.rs +++ b/codex-rs/core/src/tools/handlers/tool_search.rs @@ -6,8 +6,6 @@ use crate::tools::context::boxed_tool_output; use crate::tools::handlers::tool_search_spec::create_tool_search_tool; use crate::tools::registry::CoreToolRuntime; use crate::tools::registry::ToolExecutor; -use crate::tools::tool_search_entry::ToolSearchEntry; -use crate::tools::tool_search_entry::ToolSearchInfo; use bm25::Document; use bm25::Language; use bm25::SearchEngine; @@ -16,6 +14,8 @@ use codex_tools::LoadableToolSpec; use codex_tools::TOOL_SEARCH_DEFAULT_LIMIT; use codex_tools::TOOL_SEARCH_TOOL_NAME; use codex_tools::ToolName; +use codex_tools::ToolSearchEntry; +use codex_tools::ToolSearchInfo; use codex_tools::ToolSearchSourceInfo; use codex_tools::ToolSpec; use codex_tools::coalesce_loadable_tool_specs; diff --git a/codex-rs/core/src/tools/mod.rs b/codex-rs/core/src/tools/mod.rs index 5b7a17f428..cd10d246db 100644 --- a/codex-rs/core/src/tools/mod.rs +++ b/codex-rs/core/src/tools/mod.rs @@ -14,7 +14,6 @@ pub(crate) mod runtimes; pub(crate) mod sandboxing; pub(crate) mod spec_plan; pub(crate) mod tool_dispatch_trace; -pub(crate) mod tool_search_entry; use std::borrow::Cow; diff --git a/codex-rs/core/src/tools/registry.rs b/codex-rs/core/src/tools/registry.rs index f0fdf424a9..b2a0b7704a 100644 --- a/codex-rs/core/src/tools/registry.rs +++ b/codex-rs/core/src/tools/registry.rs @@ -24,13 +24,13 @@ use crate::tools::hook_names::HookToolName; use crate::tools::lifecycle::notify_tool_finish; use crate::tools::lifecycle::notify_tool_start; use crate::tools::tool_dispatch_trace::ToolDispatchTrace; -use crate::tools::tool_search_entry::ToolSearchInfo; use crate::util::error_or_panic; use codex_extension_api::ToolCallOutcome; use codex_protocol::models::FunctionCallOutputPayload; use codex_protocol::models::ResponseInputItem; use codex_protocol::protocol::EventMsg; use codex_tools::ToolName; +use codex_tools::ToolSearchInfo; use codex_tools::ToolSpec; use futures::future::BoxFuture; use serde_json::Value; @@ -46,10 +46,6 @@ pub use codex_tools::ToolExposure; /// Implementers provide the shared `ToolExecutor` behavior plus optional /// core-owned metadata for hooks, telemetry, tool search, and argument diffs. pub(crate) trait CoreToolRuntime: ToolExecutor { - fn search_info(&self) -> Option { - None - } - fn matches_kind(&self, payload: &ToolPayload) -> bool { matches!( payload, @@ -273,6 +269,10 @@ impl ToolExecutor for ExposureOverride { self.exposure != ToolExposure::Hidden && self.handler.supports_parallel_tool_calls() } + fn search_info(&self) -> Option { + self.handler.search_info() + } + async fn handle( &self, invocation: ToolInvocation, @@ -282,10 +282,6 @@ impl ToolExecutor for ExposureOverride { } impl CoreToolRuntime for ExposureOverride { - fn search_info(&self) -> Option { - self.handler.search_info() - } - fn matches_kind(&self, payload: &ToolPayload) -> bool { self.handler.matches_kind(payload) } diff --git a/codex-rs/core/src/tools/spec_plan.rs b/codex-rs/core/src/tools/spec_plan.rs index c7d9ae5aeb..56d3714074 100644 --- a/codex-rs/core/src/tools/spec_plan.rs +++ b/codex-rs/core/src/tools/spec_plan.rs @@ -72,6 +72,7 @@ use codex_tools::ToolEnvironmentMode; use codex_tools::ToolExecutor; use codex_tools::ToolName; use codex_tools::ToolOutput; +use codex_tools::ToolSearchInfo; use codex_tools::ToolSpec; use codex_tools::UnifiedExecShellMode; use codex_tools::can_request_original_image_detail; @@ -937,6 +938,10 @@ impl ToolExecutor for MultiAgentV2NamespaceOverride { self.handler.supports_parallel_tool_calls() } + fn search_info(&self) -> Option { + self.handler.search_info() + } + async fn handle( &self, invocation: ToolInvocation, @@ -950,10 +955,6 @@ impl CoreToolRuntime for MultiAgentV2NamespaceOverride { self.handler.matches_kind(payload) } - fn search_info(&self) -> Option { - self.handler.search_info() - } - fn create_diff_consumer( &self, ) -> Option> { diff --git a/codex-rs/core/src/tools/spec_plan_tests.rs b/codex-rs/core/src/tools/spec_plan_tests.rs index e129e4ddaa..b75e6d2ed2 100644 --- a/codex-rs/core/src/tools/spec_plan_tests.rs +++ b/codex-rs/core/src/tools/spec_plan_tests.rs @@ -313,6 +313,44 @@ impl ToolExecutor for WebRunExtensionTool { } } +struct DeferredExtensionTool; + +#[async_trait::async_trait] +impl ToolExecutor for DeferredExtensionTool { + fn tool_name(&self) -> ToolName { + ToolName::plain("extension_echo") + } + + fn spec(&self) -> ToolSpec { + ToolSpec::Function(ResponsesApiTool { + name: "extension_echo".to_string(), + description: "Echoes arguments through an extension tool.".to_string(), + strict: true, + defer_loading: None, + parameters: codex_tools::JsonSchema::object( + BTreeMap::from([( + "message".to_string(), + codex_tools::JsonSchema::string(/*description*/ None), + )]), + Some(vec!["message".to_string()]), + Some(false.into()), + ), + output_schema: None, + }) + } + + fn exposure(&self) -> ToolExposure { + ToolExposure::Deferred + } + + async fn handle( + &self, + _call: ExtensionToolCall, + ) -> Result, codex_tools::FunctionCallError> { + panic!("spec planning should not execute extension tools") + } +} + fn duplicate_primary_environment(turn: &mut TurnContext) { let mut second_environment = turn.environments.turn_environments[0].clone(); second_environment.environment_id = "secondary".to_string(); @@ -702,6 +740,25 @@ async fn mcp_and_tool_search_follow_direct_and_deferred_tool_exposure() { ]); } +#[tokio::test] +async fn deferred_extension_tools_are_discoverable_with_tool_search() { + let plan = probe_with( + |turn| { + turn.model_info.supports_search_tool = true; + }, + ToolPlanInputs { + extension_tool_executors: vec![Arc::new(DeferredExtensionTool)], + ..ToolPlanInputs::default() + }, + ) + .await; + + plan.assert_visible_contains(&["tool_search"]); + plan.assert_visible_lacks(&["extension_echo"]); + plan.assert_registered_contains(&["extension_echo"]); + assert_eq!(plan.exposure("extension_echo"), ToolExposure::Deferred); +} + #[tokio::test] async fn invalid_mcp_tools_are_not_registered() { let plan = probe_with( diff --git a/codex-rs/core/src/tools/tool_search_entry.rs b/codex-rs/core/src/tools/tool_search_entry.rs deleted file mode 100644 index 8e37cdcfff..0000000000 --- a/codex-rs/core/src/tools/tool_search_entry.rs +++ /dev/null @@ -1,56 +0,0 @@ -use codex_tools::LoadableToolSpec; -use codex_tools::ResponsesApiNamespaceTool; -use codex_tools::ToolSearchSourceInfo; -use codex_tools::ToolSpec; -use codex_tools::default_namespace_description; - -#[derive(Clone)] -pub(crate) struct ToolSearchEntry { - pub(crate) search_text: String, - pub(crate) output: LoadableToolSpec, -} - -#[derive(Clone)] -pub(crate) struct ToolSearchInfo { - pub(crate) entry: ToolSearchEntry, - pub(crate) source_info: Option, -} - -impl ToolSearchInfo { - pub(crate) fn from_spec( - search_text: String, - spec: ToolSpec, - source_info: Option, - ) -> Option { - let output = match spec { - ToolSpec::Function(mut tool) => { - tool.defer_loading = Some(true); - tool.output_schema = None; - LoadableToolSpec::Function(tool) - } - ToolSpec::Namespace(mut namespace) => { - if namespace.description.trim().is_empty() { - namespace.description = default_namespace_description(&namespace.name); - } - for tool in &mut namespace.tools { - let ResponsesApiNamespaceTool::Function(tool) = tool; - tool.defer_loading = Some(true); - tool.output_schema = None; - } - LoadableToolSpec::Namespace(namespace) - } - ToolSpec::ToolSearch { .. } - | ToolSpec::ImageGeneration { .. } - | ToolSpec::WebSearch { .. } - | ToolSpec::Freeform(_) => return None, - }; - - Some(Self { - entry: ToolSearchEntry { - search_text, - output, - }, - source_info, - }) - } -} diff --git a/codex-rs/tools/src/lib.rs b/codex-rs/tools/src/lib.rs index 3adae5923a..28c4f93bba 100644 --- a/codex-rs/tools/src/lib.rs +++ b/codex-rs/tools/src/lib.rs @@ -17,6 +17,7 @@ mod tool_discovery; mod tool_executor; mod tool_output; mod tool_payload; +mod tool_search; mod tool_spec; pub use code_mode::augment_tool_spec_for_code_mode; @@ -97,6 +98,9 @@ pub use tool_executor::ToolExposure; pub use tool_output::JsonToolOutput; pub use tool_output::ToolOutput; pub use tool_payload::ToolPayload; +pub use tool_search::ToolSearchEntry; +pub use tool_search::ToolSearchInfo; +pub use tool_search::default_tool_search_text; pub use tool_spec::ResponsesApiWebSearchFilters; pub use tool_spec::ResponsesApiWebSearchUserLocation; pub use tool_spec::ToolSpec; diff --git a/codex-rs/tools/src/tool_executor.rs b/codex-rs/tools/src/tool_executor.rs index 1e5a94ee48..541d2443e0 100644 --- a/codex-rs/tools/src/tool_executor.rs +++ b/codex-rs/tools/src/tool_executor.rs @@ -1,6 +1,7 @@ use crate::FunctionCallError; use crate::ToolName; use crate::ToolOutput; +use crate::ToolSearchInfo; use crate::ToolSpec; /// Controls where a tool is exposed to the model. @@ -13,7 +14,9 @@ pub enum ToolExposure { Direct, /// Register this tool for later discovery, but omit it from the initial - /// model-visible tool list. + /// model-visible tool list. Deferred tools must provide search metadata via + /// [`ToolExecutor::search_info`]. The default implementation derives + /// metadata from function and namespace specs. Deferred, /// Include this tool in the initial model-visible tool list only. @@ -48,6 +51,11 @@ pub trait ToolExecutor: Send + Sync { ToolExposure::Direct } + fn search_info(&self) -> Option { + let spec = self.spec(); + ToolSearchInfo::from_tool_spec(&self.tool_name(), spec, /*source_info*/ None) + } + fn supports_parallel_tool_calls(&self) -> bool { false } diff --git a/codex-rs/tools/src/tool_search.rs b/codex-rs/tools/src/tool_search.rs new file mode 100644 index 0000000000..ecb5504d4f --- /dev/null +++ b/codex-rs/tools/src/tool_search.rs @@ -0,0 +1,139 @@ +use crate::JsonSchema; +use crate::LoadableToolSpec; +use crate::ResponsesApiNamespaceTool; +use crate::ResponsesApiTool; +use crate::ToolName; +use crate::ToolSearchSourceInfo; +use crate::ToolSpec; +use crate::default_namespace_description; + +#[derive(Clone)] +pub struct ToolSearchEntry { + pub search_text: String, + pub output: LoadableToolSpec, +} + +#[derive(Clone)] +pub struct ToolSearchInfo { + pub entry: ToolSearchEntry, + pub source_info: Option, +} + +impl ToolSearchInfo { + pub fn from_tool_spec( + tool_name: &ToolName, + spec: ToolSpec, + source_info: Option, + ) -> Option { + let search_text = default_tool_search_text(tool_name, &spec); + Self::from_spec(search_text, spec, source_info) + } + + pub fn from_spec( + search_text: String, + spec: ToolSpec, + source_info: Option, + ) -> Option { + let output = match spec { + ToolSpec::Function(mut tool) => { + tool.defer_loading = Some(true); + tool.output_schema = None; + LoadableToolSpec::Function(tool) + } + ToolSpec::Namespace(mut namespace) => { + if namespace.description.trim().is_empty() { + namespace.description = default_namespace_description(&namespace.name); + } + for tool in &mut namespace.tools { + let ResponsesApiNamespaceTool::Function(tool) = tool; + tool.defer_loading = Some(true); + tool.output_schema = None; + } + LoadableToolSpec::Namespace(namespace) + } + ToolSpec::ToolSearch { .. } + | ToolSpec::ImageGeneration { .. } + | ToolSpec::WebSearch { .. } + | ToolSpec::Freeform(_) => return None, + }; + + Some(Self { + entry: ToolSearchEntry { + search_text, + output, + }, + source_info, + }) + } +} + +pub fn default_tool_search_text(tool_name: &ToolName, spec: &ToolSpec) -> String { + let mut parts = Vec::new(); + push_search_part(&mut parts, tool_name.to_string()); + push_search_part(&mut parts, tool_name.name.replace('_', " ")); + if let Some(namespace) = &tool_name.namespace { + push_search_part(&mut parts, namespace.clone()); + } + + match spec { + ToolSpec::Function(tool) => append_function_search_text(tool, &mut parts), + ToolSpec::Namespace(namespace) => { + push_search_part(&mut parts, namespace.name.clone()); + push_search_part(&mut parts, namespace.description.clone()); + for tool in &namespace.tools { + let ResponsesApiNamespaceTool::Function(tool) = tool; + append_function_search_text(tool, &mut parts); + } + } + ToolSpec::ToolSearch { description, .. } => { + push_search_part(&mut parts, description.clone()); + } + ToolSpec::ImageGeneration { .. } => { + push_search_part(&mut parts, "image generation".to_string()); + } + ToolSpec::WebSearch { .. } => { + push_search_part(&mut parts, "web search".to_string()); + } + ToolSpec::Freeform(tool) => { + push_search_part(&mut parts, tool.name.clone()); + push_search_part(&mut parts, tool.description.clone()); + push_search_part(&mut parts, tool.format.syntax.clone()); + } + } + + parts.join(" ") +} + +fn append_function_search_text(tool: &ResponsesApiTool, parts: &mut Vec) { + push_search_part(parts, tool.name.clone()); + push_search_part(parts, tool.name.replace('_', " ")); + push_search_part(parts, tool.description.clone()); + append_schema_search_text(&tool.parameters, parts); +} + +fn append_schema_search_text(schema: &JsonSchema, parts: &mut Vec) { + if let Some(description) = &schema.description { + push_search_part(parts, description.clone()); + } + if let Some(properties) = &schema.properties { + for (name, schema) in properties { + push_search_part(parts, name.clone()); + append_schema_search_text(schema, parts); + } + } + if let Some(items) = &schema.items { + append_schema_search_text(items, parts); + } + if let Some(variants) = &schema.any_of { + for variant in variants { + append_schema_search_text(variant, parts); + } + } +} + +fn push_search_part(parts: &mut Vec, part: String) { + let part = part.trim(); + if !part.is_empty() { + parts.push(part.to_string()); + } +} diff --git a/codex-rs/tui/src/bottom_pane/chat_composer.rs b/codex-rs/tui/src/bottom_pane/chat_composer.rs index ec3284866d..5a39b53aa9 100644 --- a/codex-rs/tui/src/bottom_pane/chat_composer.rs +++ b/codex-rs/tui/src/bottom_pane/chat_composer.rs @@ -3410,6 +3410,7 @@ impl ChatComposer { esc_backtrack_hint: self.footer.esc_backtrack_hint, use_shift_enter_hint: self.footer.use_shift_enter_hint, is_task_running: self.is_task_running, + queue_submissions: self.queue_submissions, quit_shortcut_key: self.footer.quit_shortcut_key, collaboration_modes_enabled: self.collaboration_modes_enabled, is_wsl, @@ -4691,6 +4692,16 @@ mod tests { }, ); + snapshot_composer_state( + "footer_mode_shortcut_overlay_queue_submissions", + /*enhanced_keys_supported*/ true, + |composer| { + composer.set_queue_submissions(/*queue_submissions*/ true); + let _ = composer + .handle_key_event(KeyEvent::new(KeyCode::Char('?'), KeyModifiers::NONE)); + }, + ); + snapshot_composer_state( "footer_mode_ctrl_c_quit", /*enhanced_keys_supported*/ true, diff --git a/codex-rs/tui/src/bottom_pane/footer.rs b/codex-rs/tui/src/bottom_pane/footer.rs index 8035881e8e..e11534ac82 100644 --- a/codex-rs/tui/src/bottom_pane/footer.rs +++ b/codex-rs/tui/src/bottom_pane/footer.rs @@ -68,6 +68,7 @@ pub(crate) struct FooterProps { pub(crate) esc_backtrack_hint: bool, pub(crate) use_shift_enter_hint: bool, pub(crate) is_task_running: bool, + pub(crate) queue_submissions: bool, pub(crate) collaboration_modes_enabled: bool, pub(crate) is_wsl: bool, /// Which key the user must press again to quit. @@ -742,6 +743,8 @@ fn footer_from_props_lines( let state = ShortcutsState { use_shift_enter_hint: props.use_shift_enter_hint, esc_backtrack_hint: props.esc_backtrack_hint, + is_task_running: props.is_task_running, + queue_submissions: props.queue_submissions, is_wsl: props.is_wsl, collaboration_modes_enabled: props.collaboration_modes_enabled, key_hints, @@ -864,6 +867,8 @@ fn footer_hint_items_line(items: &[(String, String)]) -> Line<'static> { struct ShortcutsState { use_shift_enter_hint: bool, esc_backtrack_hint: bool, + is_task_running: bool, + queue_submissions: bool, is_wsl: bool, collaboration_modes_enabled: bool, key_hints: FooterKeyHints, @@ -1096,6 +1101,13 @@ impl ShortcutDescriptor { }?; let mut line = Line::from(vec![self.prefix.into(), key.into()]); match self.id { + ShortcutId::QueueMessageTab => { + if state.is_task_running || state.queue_submissions { + line.push_span(" to queue message"); + } else { + line.push_span(" to submit message"); + } + } ShortcutId::EditPrevious => { if state.esc_backtrack_hint { line.push_span(" again to edit previous message"); @@ -1107,6 +1119,13 @@ impl ShortcutDescriptor { ]); } } + ShortcutId::Quit => { + if state.is_task_running { + line.push_span(" to interrupt"); + } else { + line.push_span(" to exit"); + } + } _ => line.push_span(self.label), }; Some(line) @@ -1542,6 +1561,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1559,6 +1579,7 @@ mod tests { esc_backtrack_hint: true, use_shift_enter_hint: true, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1579,6 +1600,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: true, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1589,6 +1611,24 @@ mod tests { }, ); + snapshot_footer( + "footer_shortcuts_running", + FooterProps { + mode: FooterMode::ShortcutOverlay, + esc_backtrack_hint: false, + use_shift_enter_hint: false, + is_task_running: true, + queue_submissions: false, + collaboration_modes_enabled: false, + is_wsl: false, + quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), + status_line_value: None, + status_line_enabled: false, + key_hints: FooterKeyHints::default_bindings(), + active_agent_label: None, + }, + ); + snapshot_footer( "footer_ctrl_c_quit_idle", FooterProps { @@ -1596,6 +1636,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1613,6 +1654,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: true, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1630,6 +1672,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1647,6 +1690,7 @@ mod tests { esc_backtrack_hint: true, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1664,6 +1708,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: true, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1683,6 +1728,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1702,6 +1748,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: true, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1717,6 +1764,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: true, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1745,6 +1793,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: true, + queue_submissions: false, collaboration_modes_enabled: true, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1766,6 +1815,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1782,6 +1832,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: true, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1798,6 +1849,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1814,6 +1866,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: true, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1844,6 +1897,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: true, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1866,6 +1920,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1889,6 +1944,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: true, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1913,6 +1969,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1929,6 +1986,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: false, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -1948,6 +2006,7 @@ mod tests { esc_backtrack_hint: false, use_shift_enter_hint: false, is_task_running: false, + queue_submissions: false, collaboration_modes_enabled: true, is_wsl: false, quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), @@ -2009,6 +2068,8 @@ mod tests { .binding_for(ShortcutsState { use_shift_enter_hint: false, esc_backtrack_hint: false, + is_task_running: false, + queue_submissions: false, is_wsl, collaboration_modes_enabled: false, key_hints: FooterKeyHints::default_bindings(), diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__footer_mode_shortcut_overlay.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__footer_mode_shortcut_overlay.snap index b5508114fe..5239a34bd2 100644 --- a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__footer_mode_shortcut_overlay.snap +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__footer_mode_shortcut_overlay.snap @@ -11,7 +11,7 @@ expression: terminal.backend() " " " " " / for commands ! for shell commands " -" shift + enter for newline tab to queue message " +" shift + enter for newline tab to submit message " " @ for file paths ctrl + v to paste images " " ctrl + g to edit in external editor esc again to edit previous message " " ctrl + r search history ctrl + c to exit " diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__footer_mode_shortcut_overlay_queue_submissions.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__footer_mode_shortcut_overlay_queue_submissions.snap new file mode 100644 index 0000000000..582724eea7 --- /dev/null +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__footer_mode_shortcut_overlay_queue_submissions.snap @@ -0,0 +1,21 @@ +--- +source: tui/src/bottom_pane/chat_composer.rs +expression: terminal.backend() +--- +" " +"› Ask Codex to do anything " +" " +" " +" " +" " +" " +" " +" / for commands ! for shell commands " +" shift + enter for newline tab to queue message " +" @ for file paths ctrl + v to paste images " +" ctrl + g to edit in external editor esc esc to edit previous message " +" ctrl + r search history ctrl + c to exit " +" ⌥ + , reasoning down ⌥ + . reasoning up " +" ctrl + t to view transcript " +" " +" customize shortcuts with /keymap " diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_shortcuts_collaboration_modes_enabled.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_shortcuts_collaboration_modes_enabled.snap index dc2f896096..3b67a90683 100644 --- a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_shortcuts_collaboration_modes_enabled.snap +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_shortcuts_collaboration_modes_enabled.snap @@ -3,7 +3,7 @@ source: tui/src/bottom_pane/footer.rs expression: terminal.backend() --- " / for commands ! for shell commands " -" ctrl + j for newline tab to queue message " +" ctrl + j for newline tab to submit message " " @ for file paths ctrl + v to paste images " " ctrl + g to edit in external editor esc esc to edit previous message " " ctrl + r search history ctrl + c to exit " diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_shortcuts_running.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_shortcuts_running.snap new file mode 100644 index 0000000000..7c733bd13b --- /dev/null +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_shortcuts_running.snap @@ -0,0 +1,13 @@ +--- +source: tui/src/bottom_pane/footer.rs +expression: terminal.backend() +--- +" / for commands ! for shell commands " +" ctrl + j for newline tab to queue message " +" @ for file paths ctrl + v to paste images " +" ctrl + g to edit in external editor esc esc to edit previous message " +" ctrl + r search history ctrl + c to interrupt " +" ⌥ + , reasoning down ⌥ + . reasoning up " +" ctrl + t to view transcript " +" " +" customize shortcuts with /keymap " diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_shortcuts_shift_and_esc.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_shortcuts_shift_and_esc.snap index 52c26826e9..07e9706283 100644 --- a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_shortcuts_shift_and_esc.snap +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_shortcuts_shift_and_esc.snap @@ -3,7 +3,7 @@ source: tui/src/bottom_pane/footer.rs expression: terminal.backend() --- " / for commands ! for shell commands " -" shift + enter for newline tab to queue message " +" shift + enter for newline tab to submit message " " @ for file paths ctrl + v to paste images " " ctrl + g to edit in external editor esc again to edit previous message " " ctrl + r search history ctrl + c to exit "