From 6a71c2ad2f52b7902fb472c47848d0e5d1f8db0c Mon Sep 17 00:00:00 2001 From: echobt Date: Sun, 1 Feb 2026 20:47:14 +0000 Subject: [PATCH] refactor: remove external product references from codebase - Remove OpenCode and Codex references from TUI components - Update engine comments to remove competitor mentions - Remove codex model alias and related presets - Rename .codex sandbox references to .cortex - Update function names to avoid external product confusion - Clean up SubagentsDialog component descriptions --- Cargo.toml | 4 ++-- src/cortex-agents/src/control.rs | 2 +- src/cortex-cli/src/run_cmd/mod.rs | 2 +- src/cortex-collab/src/lib.rs | 2 +- src/cortex-common/src/model_presets/aliases.rs | 5 ----- src/cortex-common/src/model_presets/presets.rs | 9 --------- src/cortex-core/src/widgets/brain.rs | 6 +++--- src/cortex-engine/src/agent/orchestrator.rs | 6 +++--- src/cortex-engine/src/config/loader.rs | 4 ++-- src/cortex-engine/src/config/types.rs | 4 ++-- src/cortex-engine/src/git_snapshot.rs | 1 - src/cortex-engine/src/mcp/oauth.rs | 2 +- src/cortex-engine/src/sandbox/landlock.rs | 2 +- src/cortex-engine/src/sandbox/policy.rs | 9 ++++----- src/cortex-engine/src/sandbox/seatbelt.rs | 2 +- .../src/tools/handlers/edit_strategies/mod.rs | 6 +++--- .../src/tools/handlers/subagent/executor.rs | 10 +++++----- .../src/tools/handlers/subagent/types.rs | 6 +++--- src/cortex-engine/src/tools/unified_executor.rs | 2 +- src/cortex-gui/src/components/SearchEditor.tsx | 4 ++-- .../src/components/ai/SubagentsDialog.tsx | 2 +- src/cortex-linux-sandbox/src/mounts.rs | 2 +- src/cortex-linux-sandbox/src/run_main.rs | 1 - src/cortex-network-proxy/src/lib.rs | 2 +- src/cortex-protocol/src/protocol/message_parts.rs | 2 +- src/cortex-sandbox/src/landlock.rs | 14 +++++++------- src/cortex-tui/src/backtrack.rs | 1 - src/cortex-tui/src/collaboration_modes.rs | 2 -- src/cortex-tui/src/question.rs | 2 +- src/cortex-tui/src/runner/event_loop/subagent.rs | 2 +- src/cortex-tui/src/session/manager.rs | 2 +- src/cortex-tui/src/session/mod.rs | 2 +- src/cortex-tui/src/ui/colors.rs | 2 +- src/cortex-tui/src/ui/shimmer.rs | 3 +-- src/cortex-tui/src/views/minimal_session/mod.rs | 2 +- src/cortex-tui/src/views/question_prompt.rs | 2 +- src/cortex-tui/src/widgets/approval_overlay.rs | 5 ++--- src/cortex-tui/src/widgets/autocomplete.rs | 2 +- src/cortex-tui/src/widgets/selection_list.rs | 2 +- src/cortex-tui/src/widgets/status_indicator.rs | 2 +- 40 files changed, 60 insertions(+), 82 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 59acc547..3dbe73cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,7 +69,7 @@ members = [ "src/cortex-skills", "src/cortex-prompt-harness", - # CLI - Features (Phase 3 - Codex-inspired) + # CLI - Features (Phase 3) "src/cortex-collab", "src/cortex-network-proxy", "src/cortex-shell-snapshot", @@ -228,7 +228,7 @@ cortex-ollama = { path = "src/cortex-ollama" } cortex-skills = { path = "src/cortex-skills" } cortex-prompt-harness = { path = "src/cortex-prompt-harness" } -# Phase 3 - Codex-inspired crates +# Phase 3 crates cortex-collab = { path = "src/cortex-collab" } cortex-network-proxy = { path = "src/cortex-network-proxy" } cortex-shell-snapshot = { path = "src/cortex-shell-snapshot" } diff --git a/src/cortex-agents/src/control.rs b/src/cortex-agents/src/control.rs index ecbe0961..f1516077 100644 --- a/src/cortex-agents/src/control.rs +++ b/src/cortex-agents/src/control.rs @@ -1,7 +1,7 @@ //! Agent control for multi-agent operations. //! //! Provides a control-plane interface for managing agent threads, -//! inspired by OpenAI Codex's AgentControl system. +//! handling spawning, lifecycle, and inter-agent communication. use crate::AgentInfo; use std::collections::HashMap; diff --git a/src/cortex-cli/src/run_cmd/mod.rs b/src/cortex-cli/src/run_cmd/mod.rs index bb7970d1..03ec11ea 100644 --- a/src/cortex-cli/src/run_cmd/mod.rs +++ b/src/cortex-cli/src/run_cmd/mod.rs @@ -1,6 +1,6 @@ //! Run command for non-interactive Cortex CLI execution. //! -//! Provides a comprehensive run command similar to OpenCode's run functionality: +//! Provides a comprehensive run command for batch execution: //! - `cortex run [message..]` - Execute with a message prompt //! - `--command` - Execute a predefined command //! - `--continue/-c` - Continue the last session diff --git a/src/cortex-collab/src/lib.rs b/src/cortex-collab/src/lib.rs index 2eb071f3..3bb3d6b4 100644 --- a/src/cortex-collab/src/lib.rs +++ b/src/cortex-collab/src/lib.rs @@ -1,6 +1,6 @@ //! Multi-agent collaboration system for Cortex CLI. //! -//! This crate implements multi-agent collaboration features inspired by OpenAI Codex: +//! This crate implements multi-agent collaboration features: //! - Agent spawning and lifecycle management //! - Inter-agent communication //! - Wait/sync mechanisms with timeout diff --git a/src/cortex-common/src/model_presets/aliases.rs b/src/cortex-common/src/model_presets/aliases.rs index 087101d4..80320cc4 100644 --- a/src/cortex-common/src/model_presets/aliases.rs +++ b/src/cortex-common/src/model_presets/aliases.rs @@ -38,10 +38,6 @@ pub const MODEL_ALIASES: &[ModelAlias] = &[ alias: "o3", model: "openai/o3", }, - ModelAlias { - alias: "codex", - model: "openai/gpt-5.2-codex", - }, // Google models ModelAlias { alias: "gemini", @@ -103,7 +99,6 @@ mod tests { assert_eq!(resolve_model_alias("opus"), "anthropic/claude-opus-4.5"); assert_eq!(resolve_model_alias("gpt4"), "openai/gpt-4o"); assert_eq!(resolve_model_alias("haiku"), "anthropic/claude-haiku-4.5"); - assert_eq!(resolve_model_alias("codex"), "openai/gpt-5.2-codex"); assert_eq!(resolve_model_alias("r1"), "deepseek/deepseek-r1"); } diff --git a/src/cortex-common/src/model_presets/presets.rs b/src/cortex-common/src/model_presets/presets.rs index c0ab5061..7ba3ff7a 100644 --- a/src/cortex-common/src/model_presets/presets.rs +++ b/src/cortex-common/src/model_presets/presets.rs @@ -633,15 +633,6 @@ pub const MODEL_PRESETS: &[ModelPreset] = &[ supports_tools: true, supports_reasoning: false, }, - ModelPreset { - id: "openai/gpt-5.2-codex", - name: "GPT-5.2 Codex (via Cortex) - DEFAULT", - provider: "cortex", - context_window: 256_000, - supports_vision: true, - supports_tools: true, - supports_reasoning: true, - }, // Other Cortex models ModelPreset { id: "openai/gpt-4o", diff --git a/src/cortex-core/src/widgets/brain.rs b/src/cortex-core/src/widgets/brain.rs index 84881895..5ed01a31 100644 --- a/src/cortex-core/src/widgets/brain.rs +++ b/src/cortex-core/src/widgets/brain.rs @@ -7,7 +7,7 @@ //! Uses sine wave radial expansion from center: //! - Wave expands outward from brain center //! - 2-second cycle (slow, hypnotic) -//! - Green gradient (#00FFA3 Codex accent) +//! - Green gradient (#00FFA3) //! //! # Example //! ``` @@ -62,7 +62,7 @@ const WAVE_SPEED: f32 = std::f32::consts::PI * 2.0; /// Wave scale: controls the "wavelength" of radial rings const WAVE_SCALE: f32 = 6.0; -/// Codex accent green color +/// Accent green color const ACCENT_GREEN: (u8, u8, u8) = (0x00, 0xFF, 0xA3); /// Dark green base color @@ -194,7 +194,7 @@ impl Brain { /// Gets the style for a character based on wave intensity. /// - /// Creates a gradient from dark green to bright Codex green (#00FFA3). + /// Creates a gradient from dark green to bright green (#00FFA3). fn get_wave_style(&self, base_density: f32, wave: f32) -> Style { // Combine base density with wave for final brightness let brightness = base_density * (0.4 + wave * 0.6 * self.intensity); diff --git a/src/cortex-engine/src/agent/orchestrator.rs b/src/cortex-engine/src/agent/orchestrator.rs index 92001685..39618f99 100644 --- a/src/cortex-engine/src/agent/orchestrator.rs +++ b/src/cortex-engine/src/agent/orchestrator.rs @@ -267,7 +267,7 @@ impl Orchestrator { // If no tool calls, check if we need to request a summary if tool_calls.is_empty() { - // OpenCode pattern: If the model finished with no text after doing tool work, + // If the model finished with no text after doing tool work, // add a synthetic message asking for a summary and call the model one more time. // This ensures we get a meaningful response instead of empty output. let has_no_text = text.as_ref().map(|t| t.trim().is_empty()).unwrap_or(true); @@ -277,7 +277,7 @@ impl Orchestrator { // Mark that we've requested a summary to avoid infinite loop ctx.summary_requested = true; - // Add synthetic user message asking for summary (OpenCode pattern) + // Add synthetic user message asking for summary let _ = self .context .add_message(Message::user( @@ -310,7 +310,7 @@ impl Orchestrator { } // Use the last text segment as the primary response for subagents - // This follows OpenCode's pattern of using findLast() for text parts + // Uses findLast() logic for text parts to get the final segment // If there's meaningful last_text_segment, prefer it; otherwise use full response let effective_response = if !last_text_segment.trim().is_empty() { // The last segment has content - use it as the response diff --git a/src/cortex-engine/src/config/loader.rs b/src/cortex-engine/src/config/loader.rs index 558f4f62..e8a5775c 100644 --- a/src/cortex-engine/src/config/loader.rs +++ b/src/cortex-engine/src/config/loader.rs @@ -2,7 +2,7 @@ //! //! Supports multiple configuration formats: //! - TOML (`.toml`) - Primary format -//! - JSON with comments (`.json`, `.jsonc`) - OpenCode-compatible format +//! - JSON with comments (`.json`, `.jsonc`) - JSONC format use std::path::{Path, PathBuf}; @@ -694,7 +694,7 @@ model = "sync-model" #[test] fn test_parse_json_config() { let json_content = r#"{ - // OpenCode-style config with comments + // JSON with comments (JSONC) config "model": "claude-3-opus", "model_provider": "anthropic" }"#; diff --git a/src/cortex-engine/src/config/types.rs b/src/cortex-engine/src/config/types.rs index 1cde8d4f..0d2e9076 100644 --- a/src/cortex-engine/src/config/types.rs +++ b/src/cortex-engine/src/config/types.rs @@ -10,7 +10,7 @@ use crate::custom_command::CustomCommandConfig; use crate::plugin::{PluginConfigEntry, PluginSettings}; /// Permission level for granular permission control. -/// Follows OpenCode-style permission configuration. +/// Supports three-tier allow/ask/deny permission model. #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum PermissionLevel { @@ -34,7 +34,7 @@ impl std::fmt::Display for PermissionLevel { } /// Permission configuration structure. -/// Supports OpenCode-style granular permission control. +/// Supports granular permission control per operation type. #[derive(Debug, Clone, Default, PartialEq, Deserialize)] pub struct PermissionConfig { /// Default permission level for edit operations. diff --git a/src/cortex-engine/src/git_snapshot.rs b/src/cortex-engine/src/git_snapshot.rs index 9542b9ca..e401d3e4 100644 --- a/src/cortex-engine/src/git_snapshot.rs +++ b/src/cortex-engine/src/git_snapshot.rs @@ -1,7 +1,6 @@ //! Git-based snapshot for fast undo/redo tracking. //! //! Uses git's plumbing commands (write-tree, read-tree) for instant snapshots. -//! Inspired by OpenCode's snapshot implementation. use std::path::{Path, PathBuf}; use std::process::Command; diff --git a/src/cortex-engine/src/mcp/oauth.rs b/src/cortex-engine/src/mcp/oauth.rs index 587ff4da..c09f384d 100644 --- a/src/cortex-engine/src/mcp/oauth.rs +++ b/src/cortex-engine/src/mcp/oauth.rs @@ -16,7 +16,7 @@ use tracing::{debug, info, warn}; use crate::error::{CortexError, Result}; use cortex_common::create_default_client; -/// OAuth callback port - matches OpenCode's port for consistency. +/// OAuth callback port for local redirect URI. pub const OAUTH_CALLBACK_PORT: u16 = 19876; /// OAuth callback path. diff --git a/src/cortex-engine/src/sandbox/landlock.rs b/src/cortex-engine/src/sandbox/landlock.rs index a58c1a92..144ec402 100644 --- a/src/cortex-engine/src/sandbox/landlock.rs +++ b/src/cortex-engine/src/sandbox/landlock.rs @@ -3,7 +3,7 @@ //! Uses the cortex-linux-sandbox wrapper binary to apply: //! - Landlock filesystem restrictions //! - Seccomp network filtering -//! - Mount namespace for read-only .git/.codex protection +//! - Mount namespace for read-only .git/.cortex protection use std::path::PathBuf; diff --git a/src/cortex-engine/src/sandbox/policy.rs b/src/cortex-engine/src/sandbox/policy.rs index dfbc5966..6c67c7f1 100644 --- a/src/cortex-engine/src/sandbox/policy.rs +++ b/src/cortex-engine/src/sandbox/policy.rs @@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize}; pub struct WritableRoot { /// The writable root path. pub root: PathBuf, - /// Subpaths that should remain read-only (e.g., .git, .codex). + /// Subpaths that should remain read-only (e.g., .git, .cortex). pub read_only_subpaths: Vec, } @@ -24,9 +24,9 @@ impl WritableRoot { } } - /// Create a writable root with standard protected subpaths (.git, .codex, .cortex). + /// Create a writable root with standard protected subpaths (.git, .cortex). pub fn with_standard_protections(root: PathBuf) -> Self { - let read_only_subpaths = vec![root.join(".git"), root.join(".codex"), root.join(".cortex")]; + let read_only_subpaths = vec![root.join(".git"), root.join(".cortex")]; Self { root, read_only_subpaths, @@ -212,7 +212,6 @@ impl ProtectedPaths { Self { read_only: vec![ workspace.join(".git"), - workspace.join(".codex"), workspace.join(".cortex"), ], denied: vec![ @@ -253,7 +252,7 @@ mod tests { assert!(root.is_path_writable(Path::new("/workspace/src/main.rs"))); assert!(!root.is_path_writable(Path::new("/workspace/.git/config"))); - assert!(!root.is_path_writable(Path::new("/workspace/.codex/state"))); + assert!(!root.is_path_writable(Path::new("/workspace/.cortex/state"))); assert!(!root.is_path_writable(Path::new("/other/file.txt"))); } diff --git a/src/cortex-engine/src/sandbox/seatbelt.rs b/src/cortex-engine/src/sandbox/seatbelt.rs index 7f69e4a1..a6fc4afb 100644 --- a/src/cortex-engine/src/sandbox/seatbelt.rs +++ b/src/cortex-engine/src/sandbox/seatbelt.rs @@ -2,7 +2,7 @@ //! //! Uses sandbox-exec with dynamically generated SBPL policies to provide: //! - Filesystem isolation with writable workspace -//! - .git/.codex protection via require-not clauses +//! - .git/.cortex protection via require-not clauses //! - Optional network blocking use std::path::PathBuf; diff --git a/src/cortex-engine/src/tools/handlers/edit_strategies/mod.rs b/src/cortex-engine/src/tools/handlers/edit_strategies/mod.rs index c5ce2564..633b90b8 100644 --- a/src/cortex-engine/src/tools/handlers/edit_strategies/mod.rs +++ b/src/cortex-engine/src/tools/handlers/edit_strategies/mod.rs @@ -1,8 +1,8 @@ //! Edit replacement strategies for robust code editing. //! -//! This module implements 8 cascading replacement strategies inspired by OpenCode's -//! edit tool implementation. Each strategy tries progressively more flexible matching -//! approaches to find and replace text in source code. +//! This module implements 8 cascading replacement strategies for flexible text matching. +//! Each strategy tries progressively more flexible matching approaches to find and +//! replace text in source code. //! //! Strategies (in cascade order): //! 1. SimpleReplacer - Exact string match diff --git a/src/cortex-engine/src/tools/handlers/subagent/executor.rs b/src/cortex-engine/src/tools/handlers/subagent/executor.rs index e5bacc51..daaf20c7 100644 --- a/src/cortex-engine/src/tools/handlers/subagent/executor.rs +++ b/src/cortex-engine/src/tools/handlers/subagent/executor.rs @@ -248,7 +248,7 @@ impl SubagentExecutor { }; // Build system prompt - use base prompt WITHOUT task details - // Task details will be sent as user message (OpenCode pattern) + // Task details will be sent as user message let system_prompt = if let Some(ref agent) = custom_agent { // Use the custom agent's base system prompt agent.system_prompt.clone() @@ -257,7 +257,7 @@ impl SubagentExecutor { }; // Build user message containing the task - // This follows OpenCode's pattern where the task is a conversation, not system config + // Tasks are conversational - sent as user messages rather than system config let user_task_message = if let Some(ref _agent) = custom_agent { // For custom agents, format task with context let mut message = format!( @@ -425,7 +425,7 @@ impl SubagentExecutor { config.working_dir.clone(), ); - // Execute with optional timeout (like OpenCode, no timeout by default) + // Execute with optional timeout (no timeout by default) let mut turn_result = if let Some(timeout_duration) = config.effective_timeout() { // With timeout match timeout(timeout_duration, orchestrator.process_turn(&mut turn_ctx)).await { @@ -437,7 +437,7 @@ impl SubagentExecutor { } } } else { - // No timeout - run until completion (like OpenCode) + // No timeout - run until completion orchestrator.process_turn(&mut turn_ctx).await }; @@ -708,7 +708,7 @@ pub struct SubagentTypeInfo { /// Extract file path from tool output. /// Prompt used to request an explicit summary from a subagent when none was provided. -/// This follows the Codex pattern of ensuring structured output from agents. +/// Ensures structured output from agents for orchestrator consumption. const SUMMARY_REQUEST_PROMPT: &str = r#"You have completed your work but did not provide a summary. Please provide a final summary NOW using EXACTLY this format: ## Summary for Orchestrator diff --git a/src/cortex-engine/src/tools/handlers/subagent/types.rs b/src/cortex-engine/src/tools/handlers/subagent/types.rs index 1b87bc9d..94cc6986 100644 --- a/src/cortex-engine/src/tools/handlers/subagent/types.rs +++ b/src/cortex-engine/src/tools/handlers/subagent/types.rs @@ -81,7 +81,7 @@ impl SubagentType { /// Get the base system prompt for this subagent type (without task details). /// The task details should be sent as a user message, not in the system prompt. - /// This follows OpenCode's pattern where the task is a conversation, not configuration. + /// Tasks are conversational - passed as user messages rather than system configuration. pub fn base_system_prompt(&self) -> String { // Common planning instructions that all subagents must follow let planning_instructions = r#" @@ -393,7 +393,7 @@ impl SubagentConfig { } /// Get effective timeout. - /// Returns None if no timeout is set (subagent runs until completion, like OpenCode). + /// Returns None if no timeout is set (subagent runs until completion). pub fn effective_timeout(&self) -> Option { self.timeout } @@ -420,7 +420,7 @@ impl SubagentConfig { } /// Build the user message containing the task. - /// This follows OpenCode's pattern of sending tasks as user messages. + /// Tasks are sent as user messages for conversational interaction. pub fn build_user_message(&self) -> String { let mut message = format!( "## Task\n{}\n\n## Instructions\n{}", diff --git a/src/cortex-engine/src/tools/unified_executor.rs b/src/cortex-engine/src/tools/unified_executor.rs index 5c53048f..985fefbe 100644 --- a/src/cortex-engine/src/tools/unified_executor.rs +++ b/src/cortex-engine/src/tools/unified_executor.rs @@ -520,7 +520,7 @@ impl BatchToolExecutor for UnifiedBatchExecutor { ) -> Result { // Prevent recursive batch calls (already handled by BatchToolHandler validation) // Also prevent Task from being called in batch for safety - // (Task is allowed in OpenCode but we're being more conservative here) + // (being conservative to avoid complex nesting scenarios) self.registry .execute_with_context(name, arguments, context.clone()) diff --git a/src/cortex-gui/src/components/SearchEditor.tsx b/src/cortex-gui/src/components/SearchEditor.tsx index 7d352bc5..6b72b2bb 100755 --- a/src/cortex-gui/src/components/SearchEditor.tsx +++ b/src/cortex-gui/src/components/SearchEditor.tsx @@ -1804,7 +1804,7 @@ export function useSearchEditor() { setIsOpen(true); }; - const openCodeSearchFile = (filePath: string) => { + const openSearchFile = (filePath: string) => { setInitialQuery(""); setInitialResults([]); setCodeSearchFilePath(filePath); @@ -1832,7 +1832,7 @@ export function useSearchEditor() { initialResults, codeSearchFilePath, openSearchEditor, - openCodeSearchFile, + openSearchFile, closeSearchEditor, SearchEditorComponent: () => ( ! { root: args.sandbox_policy_cwd.clone(), read_only_subpaths: vec![ args.sandbox_policy_cwd.join(".git"), - args.sandbox_policy_cwd.join(".codex"), args.sandbox_policy_cwd.join(".cortex"), ], }] diff --git a/src/cortex-network-proxy/src/lib.rs b/src/cortex-network-proxy/src/lib.rs index 06afee83..3d9282e1 100644 --- a/src/cortex-network-proxy/src/lib.rs +++ b/src/cortex-network-proxy/src/lib.rs @@ -1,6 +1,6 @@ //! Network proxy with domain filtering and SSRF protection for Cortex CLI. //! -//! This crate implements a network proxy inspired by OpenAI Codex: +//! This crate implements a network proxy with: //! - Domain allowlist/denylist with wildcard patterns //! - SSRF protection (blocks private/local IPs) //! - Network mode control (Full/Limited/Disabled) diff --git a/src/cortex-protocol/src/protocol/message_parts.rs b/src/cortex-protocol/src/protocol/message_parts.rs index 20e8b8c9..67d238f0 100644 --- a/src/cortex-protocol/src/protocol/message_parts.rs +++ b/src/cortex-protocol/src/protocol/message_parts.rs @@ -16,7 +16,7 @@ use super::tokens::TokenUsage; // ============================================================ /// Rich message part types supporting various content kinds. -/// Based on OpenCode's message part system for comprehensive message representation. +/// Provides comprehensive message representation for structured content. #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] #[serde(tag = "type", rename_all = "snake_case")] pub enum MessagePart { diff --git a/src/cortex-sandbox/src/landlock.rs b/src/cortex-sandbox/src/landlock.rs index 541edfd5..e8c9e94f 100644 --- a/src/cortex-sandbox/src/landlock.rs +++ b/src/cortex-sandbox/src/landlock.rs @@ -41,7 +41,7 @@ impl LandlockSandbox { } /// Apply Landlock rules for sandbox. - /// MATCHES CODEX install_filesystem_landlock_rules_on_current_thread() EXACTLY + /// Installs filesystem isolation rules on the current thread. pub fn apply( &self, writable_roots: &[&Path], @@ -51,7 +51,7 @@ impl LandlockSandbox { let access_rw = AccessFs::from_all(abi); let access_ro = AccessFs::from_read(abi); - // EXACT CODEX PATTERN + // Create ruleset with read-only root and writable /dev/null let mut ruleset = Ruleset::default() .set_compatibility(CompatLevel::BestEffort) .handle_access(access_rw)? @@ -75,8 +75,8 @@ impl LandlockSandbox { } /// Apply sandbox with network filtering. - /// MATCHES CODEX apply_sandbox_policy_to_current_thread() EXACTLY: - /// - Applies seccomp FIRST (if network disabled) + /// Applies sandbox policy to the current thread: + /// - Applies seccomp first (if network disabled) /// - Then applies Landlock pub fn apply_with_network_filter( &self, @@ -84,7 +84,7 @@ impl LandlockSandbox { _read_only_roots: &[&Path], allow_network: bool, ) -> Result<(), Box> { - // CODEX ORDER: seccomp first, then Landlock + // Apply seccomp first, then Landlock (order matters for security) if !allow_network { apply_seccomp_network_filter()?; } @@ -113,7 +113,7 @@ impl SandboxBackend for LandlockSandbox { /// Installs a seccomp filter that blocks outbound network access except for /// AF_UNIX domain sockets. -/// MATCHES CODEX install_network_seccomp_filter_on_current_thread() EXACTLY +/// Blocks network-related syscalls to prevent unauthorized network access. fn apply_seccomp_network_filter() -> Result<(), Box> { use seccompiler::{ BpfProgram, SeccompAction, SeccompCmpArgLen, SeccompCmpOp, SeccompCondition, SeccompFilter, @@ -127,7 +127,7 @@ fn apply_seccomp_network_filter() -> Result<(), Box Vec { self.messages .iter() diff --git a/src/cortex-tui/src/session/mod.rs b/src/cortex-tui/src/session/mod.rs index 540c1af4..4d5a99eb 100644 --- a/src/cortex-tui/src/session/mod.rs +++ b/src/cortex-tui/src/session/mod.rs @@ -1,6 +1,6 @@ //! Session management for Cortex TUI. //! -//! This module provides local session storage and management, similar to OpenCode. +//! This module provides local session storage and management. //! Sessions are stored in `~/.config/cortex/sessions/` with the following structure: //! //! ```text diff --git a/src/cortex-tui/src/ui/colors.rs b/src/cortex-tui/src/ui/colors.rs index 01bf0990..ebb5764c 100644 --- a/src/cortex-tui/src/ui/colors.rs +++ b/src/cortex-tui/src/ui/colors.rs @@ -1,4 +1,4 @@ -//! Adaptive colors system inspired by Codex +//! Adaptive colors system //! //! Automatically detects terminal background and adjusts colors for optimal contrast. diff --git a/src/cortex-tui/src/ui/shimmer.rs b/src/cortex-tui/src/ui/shimmer.rs index b2cf6d67..76fb6388 100644 --- a/src/cortex-tui/src/ui/shimmer.rs +++ b/src/cortex-tui/src/ui/shimmer.rs @@ -1,8 +1,7 @@ //! Shimmer text effect for loading animations //! //! Creates a "shimmering" effect where a bright band moves across the text, -//! similar to a loading skeleton or highlight sweep animation. Inspired by -//! the Codex TUI shimmer implementation. +//! similar to a loading skeleton or highlight sweep animation. use std::sync::OnceLock; use std::time::{Duration, Instant}; diff --git a/src/cortex-tui/src/views/minimal_session/mod.rs b/src/cortex-tui/src/views/minimal_session/mod.rs index 61fc109c..4c8de4d1 100644 --- a/src/cortex-tui/src/views/minimal_session/mod.rs +++ b/src/cortex-tui/src/views/minimal_session/mod.rs @@ -1,6 +1,6 @@ //! Minimalist Session View //! -//! A terminal-style chat interface inspired by Codex CLI. +//! A terminal-style chat interface for conversations. //! This view provides a clean, minimal UI with: //! - Chat history as simple terminal scrollback //! - Status indicator with shimmer animation diff --git a/src/cortex-tui/src/views/question_prompt.rs b/src/cortex-tui/src/views/question_prompt.rs index b20369e4..e62172ec 100644 --- a/src/cortex-tui/src/views/question_prompt.rs +++ b/src/cortex-tui/src/views/question_prompt.rs @@ -1,6 +1,6 @@ //! Question Prompt View //! -//! An OpenCode-style TUI for asking users questions with: +//! A TUI for asking users questions with: //! - Tabs for multiple questions //! - Mouse hover and click support //! - Keyboard navigation (↑↓, 1-9, Enter, Esc) diff --git a/src/cortex-tui/src/widgets/approval_overlay.rs b/src/cortex-tui/src/widgets/approval_overlay.rs index 0fae7dd5..c328e77c 100644 --- a/src/cortex-tui/src/widgets/approval_overlay.rs +++ b/src/cortex-tui/src/widgets/approval_overlay.rs @@ -1,8 +1,7 @@ //! Approval Overlay Widget //! -//! A modal overlay widget that requests user approval for agent actions, -//! inspired by Codex's approval overlay. Replaces the input area when -//! approval is needed. +//! A modal overlay widget that requests user approval for agent actions. +//! Replaces the input area when approval is needed. //! //! ## Usage //! diff --git a/src/cortex-tui/src/widgets/autocomplete.rs b/src/cortex-tui/src/widgets/autocomplete.rs index 799e17c4..77ecce39 100644 --- a/src/cortex-tui/src/widgets/autocomplete.rs +++ b/src/cortex-tui/src/widgets/autocomplete.rs @@ -296,7 +296,7 @@ impl Widget for AutocompletePopup<'_> { // MENTION TYPES // ============================================================ -/// Standard mention types like OpenCode. +/// Standard mention types for context references. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum MentionType { /// @file - Add a file to context diff --git a/src/cortex-tui/src/widgets/selection_list.rs b/src/cortex-tui/src/widgets/selection_list.rs index 7a4d9dba..162be958 100644 --- a/src/cortex-tui/src/widgets/selection_list.rs +++ b/src/cortex-tui/src/widgets/selection_list.rs @@ -1,6 +1,6 @@ //! Selection List Widget //! -//! A reusable generic selection list component inspired by Codex's list_selection_view. +//! A reusable generic selection list component. //! Supports navigation, shortcuts, search filtering, and various display modes. //! //! ## Usage diff --git a/src/cortex-tui/src/widgets/status_indicator.rs b/src/cortex-tui/src/widgets/status_indicator.rs index 7b77f97c..da524be9 100644 --- a/src/cortex-tui/src/widgets/status_indicator.rs +++ b/src/cortex-tui/src/widgets/status_indicator.rs @@ -1,4 +1,4 @@ -//! Minimalist status indicator widget inspired by Codex +//! Minimalist status indicator widget //! //! Shows a spinner, animated header text with shimmer effect, elapsed time, //! and optional details. Used during long-running operations to provide