mirror of
https://github.com/openai/codex.git
synced 2026-02-02 06:57:03 +00:00
Compare commits
1 Commits
remove/doc
...
gpeal/100-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6fda4c039 |
@@ -1,6 +1,7 @@
|
||||
[advisories]
|
||||
ignore = [
|
||||
"RUSTSEC-2024-0388", # derivative 2.2.0 via starlark; upstream crate is unmaintained
|
||||
# .cargo/audit.toml
|
||||
"RUSTSEC-2025-0057", # fxhash 0.2.1 via starlark_map; upstream crate is unmaintained
|
||||
"RUSTSEC-2024-0436", # paste 1.0.15 via starlark/ratatui; upstream crate is unmaintained
|
||||
]
|
||||
|
||||
1
codex-rs/.gitignore
vendored
1
codex-rs/.gitignore
vendored
@@ -2,6 +2,7 @@
|
||||
/target-*/
|
||||
|
||||
# Recommended value of CARGO_TARGET_DIR when using Docker as explained in .devcontainer/README.md.
|
||||
# .gitignore
|
||||
/target-amd64/
|
||||
|
||||
# Value of CARGO_TARGET_DIR when using .devcontainer/devcontainer.json.
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
# BUILD.bazel
|
||||
|
||||
|
||||
@@ -1223,6 +1223,7 @@ async fn maybe_emit_raw_response_item_completed(
|
||||
}
|
||||
|
||||
async fn find_and_remove_turn_summary(
|
||||
// app-server/src/bespoke_event_handling.rs
|
||||
conversation_id: ThreadId,
|
||||
turn_summary_store: &TurnSummaryStore,
|
||||
) -> TurnSummary {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Single integration test binary that aggregates all test modules.
|
||||
// app-server/tests/all.rs
|
||||
// The submodules live in `tests/suite/`.
|
||||
mod suite;
|
||||
|
||||
@@ -65,6 +65,7 @@ impl ChatGptAuthFixture {
|
||||
}
|
||||
}
|
||||
|
||||
// app-server/tests/common/auth_fixtures.rs
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct ChatGptIdTokenClaims {
|
||||
pub email: Option<String>,
|
||||
|
||||
@@ -45,6 +45,7 @@ async fn archive_conversation_moves_rollout_into_archived_directory() -> Result<
|
||||
"expected rollout path {} to exist",
|
||||
rollout_path.display()
|
||||
);
|
||||
// app-server/tests/suite/archive_thread.rs
|
||||
|
||||
let archive_request_id = mcp
|
||||
.send_archive_conversation_request(ArchiveConversationParams {
|
||||
|
||||
@@ -113,6 +113,7 @@ async fn get_auth_status_no_auth() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// app-server/tests/suite/auth.rs
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn get_auth_status_with_api_key() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
|
||||
@@ -244,6 +244,7 @@ async fn login_account_chatgpt_rejected_when_forced_api() -> Result<()> {
|
||||
async fn login_account_chatgpt_start_can_be_cancelled() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
create_config_toml(codex_home.path(), CreateConfigTomlParams::default())?;
|
||||
// app-server/tests/suite/v2/account.rs
|
||||
|
||||
let mut mcp = McpProcess::new(codex_home.path()).await?;
|
||||
timeout(DEFAULT_READ_TIMEOUT, mcp.initialize()).await??;
|
||||
|
||||
@@ -31,6 +31,7 @@ async fn app_server_default_analytics_disabled_without_flag() -> Result<()> {
|
||||
&config,
|
||||
SERVICE_VERSION,
|
||||
Some("codex_app_server"),
|
||||
// app-server/tests/suite/v2/analytics.rs
|
||||
false,
|
||||
)
|
||||
.map_err(|err| anyhow::anyhow!(err.to_string()))?;
|
||||
|
||||
@@ -35,6 +35,7 @@ For instructions on [context_before] and [context_after]:
|
||||
[3 lines of pre-context]
|
||||
- [old_code]
|
||||
+ [new_code]
|
||||
<!-- apply-patch/apply_patch_tool_instructions.md -->
|
||||
[3 lines of post-context]
|
||||
|
||||
The full grammar definition is below:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Single integration test binary that aggregates all test modules.
|
||||
// apply-patch/tests/all.rs
|
||||
// The submodules live in `tests/suite/`.
|
||||
mod suite;
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
# apply-patch/tests/fixtures/scenarios/.gitattributes
|
||||
** text eol=lf
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
<!-- apply-patch/tests/fixtures/scenarios/001_add_file/expected/bar.md -->
|
||||
This is a new file
|
||||
|
||||
@@ -37,6 +37,7 @@ pub async fn run_apply_command(
|
||||
apply_diff_from_task(task_response, cwd).await
|
||||
}
|
||||
|
||||
// chatgpt/src/apply_command.rs
|
||||
pub async fn apply_diff_from_task(
|
||||
task_response: GetTaskResponse,
|
||||
cwd: Option<PathBuf>,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Single integration test binary that aggregates all test modules.
|
||||
// chatgpt/tests/all.rs
|
||||
// The submodules live in `tests/suite/`.
|
||||
mod suite;
|
||||
|
||||
@@ -92,6 +92,7 @@ async fn test_apply_command_creates_fibonacci_file() {
|
||||
// Assert that fibonacci.js was created in scripts/ directory
|
||||
let fibonacci_path = repo_path.join("scripts/fibonacci.js");
|
||||
assert!(fibonacci_path.exists(), "fibonacci.js was not created");
|
||||
// chatgpt/tests/suite/apply_command_e2e.rs
|
||||
|
||||
// Verify the file contents match expected
|
||||
let contents = std::fs::read_to_string(&fibonacci_path).expect("Failed to read fibonacci.js");
|
||||
|
||||
@@ -83,6 +83,7 @@ pub struct ApplyOutcome {
|
||||
pub applied: bool,
|
||||
pub status: ApplyStatus,
|
||||
pub message: String,
|
||||
// cloud-tasks-client/src/api.rs
|
||||
#[serde(default)]
|
||||
pub skipped_paths: Vec<String>,
|
||||
#[serde(default)]
|
||||
|
||||
@@ -254,6 +254,7 @@ impl DiffOverlay {
|
||||
let (diff_lines, text_lines, prompt) = if let Some(attempt) = self.current_attempt() {
|
||||
(
|
||||
attempt.diff_lines.clone(),
|
||||
// cloud-tasks/src/app.rs
|
||||
attempt.text_lines.clone(),
|
||||
attempt.prompt.clone(),
|
||||
)
|
||||
|
||||
@@ -11,6 +11,7 @@ pub trait AuthProvider: Send + Sync {
|
||||
None
|
||||
}
|
||||
}
|
||||
// codex-api/src/auth.rs
|
||||
|
||||
pub(crate) fn add_auth_headers<A: AuthProvider>(auth: &A, mut req: Request) -> Request {
|
||||
if let Some(token) = auth.bearer_token()
|
||||
|
||||
@@ -17,6 +17,7 @@ pub enum ApprovalModeCliArg {
|
||||
/// Only asks for approval if a command fails to execute, in which case it
|
||||
/// will escalate to the user to ask for un-sandboxed execution.
|
||||
OnFailure,
|
||||
// common/src/approval_mode_cli_arg.rs
|
||||
|
||||
/// The model decides when to ask the user for approval.
|
||||
OnRequest,
|
||||
|
||||
@@ -21,6 +21,7 @@ pub struct ApprovalPreset {
|
||||
/// Keep this UI-agnostic so it can be reused by both TUI and MCP server.
|
||||
pub fn builtin_approval_presets() -> Vec<ApprovalPreset> {
|
||||
vec![
|
||||
// common/src/approval_presets.rs
|
||||
ApprovalPreset {
|
||||
id: "read-only",
|
||||
label: "Read Only",
|
||||
|
||||
@@ -81,6 +81,7 @@ pub(crate) fn map_api_error(err: ApiError) -> CodexErr {
|
||||
}
|
||||
TransportError::RetryLimit => CodexErr::RetryLimit(RetryLimitReachedError {
|
||||
status: http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||
// core/src/api_bridge.rs
|
||||
request_id: None,
|
||||
}),
|
||||
TransportError::Timeout => CodexErr::Timeout,
|
||||
|
||||
@@ -61,6 +61,7 @@ pub(crate) async fn apply_patch(
|
||||
InternalApplyPatchInvocation::DelegateToExec(ApplyPatchExec {
|
||||
action,
|
||||
auto_approved: false,
|
||||
// core/src/apply_patch.rs
|
||||
exec_approval_requirement: ExecApprovalRequirement::NeedsApproval {
|
||||
reason: None,
|
||||
proposed_execpolicy_amendment: None,
|
||||
|
||||
@@ -640,6 +640,7 @@ impl UnauthorizedRecovery {
|
||||
pub struct AuthManager {
|
||||
codex_home: PathBuf,
|
||||
inner: RwLock<CachedAuth>,
|
||||
// core/src/auth.rs
|
||||
enable_codex_api_key_env: bool,
|
||||
auth_credentials_store_mode: AuthCredentialsStoreMode,
|
||||
}
|
||||
|
||||
@@ -170,6 +170,7 @@ fn parse_plain_command_from_node(cmd: tree_sitter::Node, src: &str) -> Option<Ve
|
||||
.push_str(part.utf8_text(src.as_bytes()).ok()?.to_owned().as_str());
|
||||
}
|
||||
"string" => {
|
||||
// core/src/bash.rs
|
||||
if part.child_count() == 3
|
||||
&& part.child(0)?.kind() == "\""
|
||||
&& part.child(1)?.kind() == "string_content"
|
||||
|
||||
@@ -34,6 +34,7 @@ where
|
||||
McpAuthStatus::Unsupported
|
||||
}
|
||||
};
|
||||
// core/src/mcp/auth.rs
|
||||
let entry = McpAuthStatusEntry {
|
||||
config,
|
||||
auth_status,
|
||||
|
||||
@@ -197,6 +197,7 @@ pub(crate) async fn intercept_apply_patch(
|
||||
codex_apply_patch::MaybeApplyPatchVerified::Body(changes) => {
|
||||
session
|
||||
.record_model_warning(
|
||||
// core/src/tools/handlers/apply_patch.rs
|
||||
format!("apply_patch was requested via {tool_name}. Use the apply_patch tool instead of exec_command."),
|
||||
turn,
|
||||
)
|
||||
|
||||
@@ -78,6 +78,7 @@ impl ApplyPatchRuntime {
|
||||
|
||||
impl Sandboxable for ApplyPatchRuntime {
|
||||
fn sandbox_preference(&self) -> SandboxablePreference {
|
||||
// core/src/tools/runtimes/apply_patch.rs
|
||||
SandboxablePreference::Auto
|
||||
}
|
||||
fn escalate_on_failure(&self) -> bool {
|
||||
|
||||
@@ -143,6 +143,7 @@ async fn process_chunk(
|
||||
pending: &mut Vec<u8>,
|
||||
transcript: &Arc<Mutex<HeadTailBuffer>>,
|
||||
call_id: &str,
|
||||
// core/src/unified_exec/async_watcher.rs
|
||||
session_ref: &Arc<Session>,
|
||||
turn_ref: &Arc<TurnContext>,
|
||||
emitted_deltas: &mut usize,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Single integration test binary that aggregates all test modules.
|
||||
// core/tests/all.rs
|
||||
// The submodules live in `tests/all/`.
|
||||
mod suite;
|
||||
|
||||
@@ -118,6 +118,7 @@ async fn interrupt_tool_records_history_entries() {
|
||||
|
||||
codex
|
||||
.submit(Op::UserInput {
|
||||
// core/tests/suite/abort_tasks.rs
|
||||
items: vec![UserInput::Text {
|
||||
text: "follow up".into(),
|
||||
text_elements: Vec::new(),
|
||||
|
||||
@@ -32,6 +32,7 @@ async fn websocket_test_codex_shell_chain() -> Result<()> {
|
||||
let mut builder = test_codex();
|
||||
|
||||
let test = builder.build_with_websocket_server(&server).await?;
|
||||
// core/tests/suite/agent_websocket.rs
|
||||
test.submit_turn("run the echo command").await?;
|
||||
|
||||
let connection = server.single_connection();
|
||||
|
||||
@@ -698,6 +698,7 @@ async fn apply_patch_shell_command_heredoc_with_cd_updates_relative_workdir() ->
|
||||
|
||||
// Prepare a file inside a subdir; update it via cd && apply_patch heredoc form.
|
||||
let sub = harness.path("sub");
|
||||
// core/tests/suite/apply_patch_cli.rs
|
||||
fs::create_dir_all(&sub)?;
|
||||
let target = sub.join("in_sub.txt");
|
||||
fs::write(&target, "before\n")?;
|
||||
|
||||
@@ -918,6 +918,7 @@ fn scenarios() -> Vec<ScenarioSpec> {
|
||||
sandbox_permissions: SandboxPermissions::UseDefault,
|
||||
features: vec![],
|
||||
model_override: None,
|
||||
// core/tests/suite/approvals.rs
|
||||
outcome: Outcome::Auto,
|
||||
expectation: Expectation::NetworkFailure { expect_tag: "ERR:" },
|
||||
},
|
||||
|
||||
@@ -306,6 +306,7 @@ async fn unauthorized_recovery_reloads_then_refreshes_tokens() -> Result<()> {
|
||||
"access_token": "recovered-access-token",
|
||||
"refresh_token": "recovered-refresh-token"
|
||||
})))
|
||||
// core/tests/suite/auth_refresh.rs
|
||||
.expect(1)
|
||||
.mount(&server)
|
||||
.await;
|
||||
|
||||
@@ -24,6 +24,7 @@ As of 1/9/2026, this setup is still experimental as we stabilize it.
|
||||
|
||||
When you add or change Rust dependencies, update the Cargo.toml/Cargo.lock as normal.
|
||||
The Bazel build should automatically pick things up without any manual action needed.
|
||||
<!-- docs/bazel.md -->
|
||||
|
||||
In some cases, an upstream crate may need a patch or a `crate.annotation` in `../MODULE.bzl`
|
||||
to have it build in Bazel's sandbox or make it cross-compilation-friendly. If you see issues,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Single integration test binary that aggregates all test modules.
|
||||
// exec-server/tests/all.rs
|
||||
// The submodules live in `tests/suite/`.
|
||||
mod suite;
|
||||
|
||||
@@ -93,6 +93,7 @@ prefix_rule(
|
||||
|
||||
// Call the shell tool and verify that an elicitation was created and
|
||||
// auto-approved.
|
||||
// exec-server/tests/suite/accept_elicitation.rs
|
||||
let CallToolResult {
|
||||
content, is_error, ..
|
||||
} = service
|
||||
|
||||
1
codex-rs/exec-server/tests/suite/bash
Executable file → Normal file
1
codex-rs/exec-server/tests/suite/bash
Executable file → Normal file
@@ -35,6 +35,7 @@
|
||||
// Note the `musl` parts of the Linux paths are misleading: the Bash
|
||||
// binaries are actually linked against `glibc`, but the
|
||||
// `codex-execve-wrapper` that invokes them is linked against `musl`.
|
||||
# exec-server/tests/suite/bash
|
||||
"linux-x86_64": {
|
||||
"size": 37003612,
|
||||
"hash": "blake3",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Single integration test binary that aggregates all test modules.
|
||||
// The submodules live in `tests/suite/`.
|
||||
// exec/tests/all.rs
|
||||
mod suite;
|
||||
|
||||
mod event_processor_with_json_output;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class BaseClass:
|
||||
def method():
|
||||
# exec/tests/fixtures/apply_patch_freeform_final.txt
|
||||
|
||||
return True
|
||||
|
||||
@@ -34,6 +34,7 @@ async fn accepts_add_dir_flag() -> anyhow::Result<()> {
|
||||
.assert()
|
||||
.code(0);
|
||||
|
||||
// exec/tests/suite/add_dir.rs
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ async fn test_apply_patch_tool() -> anyhow::Result<()> {
|
||||
sse(vec![
|
||||
ev_apply_patch_function_call("request_1", update_patch),
|
||||
ev_completed("request_1"),
|
||||
// exec/tests/suite/apply_patch.rs
|
||||
]),
|
||||
sse(vec![ev_completed("request_2")]),
|
||||
];
|
||||
|
||||
@@ -14,6 +14,7 @@ async fn exec_uses_codex_api_key_env_var() -> anyhow::Result<()> {
|
||||
let repo_root = find_resource!(".")?;
|
||||
|
||||
mount_sse_once_match(
|
||||
// exec/tests/suite/auth_env.rs
|
||||
&server,
|
||||
header("Authorization", "Bearer dummy"),
|
||||
sse(vec![ev_completed("request_0")]),
|
||||
|
||||
@@ -57,6 +57,7 @@ impl ArgMatcher {
|
||||
| ArgMatcher::PositiveInteger
|
||||
| ArgMatcher::SedCommand => ArgMatcherCardinality::One,
|
||||
ArgMatcher::ReadableFiles => ArgMatcherCardinality::AtLeastOne,
|
||||
// execpolicy-legacy/src/arg_matcher.rs
|
||||
ArgMatcher::ReadableFilesOrCwd | ArgMatcher::UnverifiedVarargs => {
|
||||
ArgMatcherCardinality::ZeroOrMore
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ pub fn resolve_observed_args_with_patterns(
|
||||
}
|
||||
}
|
||||
}
|
||||
// execpolicy-legacy/src/arg_resolver.rs
|
||||
ArgMatcherCardinality::ZeroOrMore => {
|
||||
for positional_arg in vararg {
|
||||
let matched_arg = MatchedArg::new(
|
||||
|
||||
@@ -41,6 +41,7 @@ impl ArgType {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
// execpolicy-legacy/src/arg_type.rs
|
||||
ArgType::ReadableFile => {
|
||||
if value.is_empty() {
|
||||
Err(Error::EmptyFileName {})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Single integration test binary that aggregates all test modules.
|
||||
// execpolicy-legacy/tests/all.rs
|
||||
// The submodules live in `tests/suite/`.
|
||||
mod suite;
|
||||
|
||||
@@ -2,6 +2,7 @@ use codex_execpolicy_legacy::NegativeExamplePassedCheck;
|
||||
use codex_execpolicy_legacy::get_default_policy;
|
||||
|
||||
#[test]
|
||||
// execpolicy-legacy/tests/suite/bad.rs
|
||||
fn verify_everything_in_bad_list_is_rejected() {
|
||||
let policy = get_default_policy().expect("failed to load default policy");
|
||||
let violations = policy.check_each_bad_list_individually();
|
||||
|
||||
@@ -110,6 +110,7 @@ fn append_locked_line(policy_path: &Path, line: &str) -> Result<(), AmendError>
|
||||
.map_err(|source| AmendError::PolicyMetadata {
|
||||
path: policy_path.to_path_buf(),
|
||||
source,
|
||||
// execpolicy/src/amend.rs
|
||||
})?
|
||||
.len();
|
||||
|
||||
|
||||
@@ -274,6 +274,7 @@ prefix_rule(
|
||||
|
||||
#[test]
|
||||
fn only_first_token_alias_expands_to_multiple_rules() -> Result<()> {
|
||||
// execpolicy/tests/basic.rs
|
||||
let policy_src = r#"
|
||||
prefix_rule(
|
||||
pattern = [["bash", "sh"], ["-c", "-l"]],
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Single integration test binary that aggregates all test modules.
|
||||
// linux-sandbox/tests/all.rs
|
||||
// The submodules live in `tests/suite/`.
|
||||
mod suite;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Single integration test binary that aggregates all test modules.
|
||||
// login/tests/all.rs
|
||||
// The submodules live in `tests/suite/`.
|
||||
mod suite;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Single integration test binary that aggregates all test modules.
|
||||
// mcp-server/tests/all.rs
|
||||
// The submodules live in `tests/suite/`.
|
||||
mod suite;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Single integration test binary that aggregates all test modules.
|
||||
// mcp-types/tests/all.rs
|
||||
// The submodules live in `tests/suite/`.
|
||||
mod suite;
|
||||
|
||||
@@ -8,6 +8,7 @@ use ts_rs::TS;
|
||||
#[ts(rename_all = "lowercase")]
|
||||
pub enum PlanType {
|
||||
#[default]
|
||||
// protocol/src/account.rs
|
||||
Free,
|
||||
Plus,
|
||||
Pro,
|
||||
|
||||
@@ -45,6 +45,7 @@ pub struct ExecApprovalRequestEvent {
|
||||
/// Uses `#[serde(default)]` for backwards compatibility.
|
||||
#[serde(default)]
|
||||
pub turn_id: String,
|
||||
// protocol/src/approvals.rs
|
||||
/// The command to be executed.
|
||||
pub command: Vec<String>,
|
||||
/// The command's working directory.
|
||||
|
||||
@@ -68,6 +68,7 @@ async fn supports_oauth_login_with_headers(url: &str, default_headers: &HeaderMa
|
||||
for candidate_path in discovery_paths(base_url.path()) {
|
||||
let mut discovery_url = base_url.clone();
|
||||
discovery_url.set_path(&candidate_path);
|
||||
// rmcp-client/src/auth_status.rs
|
||||
|
||||
let response = match client
|
||||
.get(discovery_url.clone())
|
||||
|
||||
@@ -39,6 +39,7 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::path::PathBuf;
|
||||
|
||||
// tui/src/additional_dirs.rs
|
||||
#[test]
|
||||
fn returns_none_for_workspace_write() {
|
||||
let sandbox = SandboxPolicy::new_workspace_write_policy();
|
||||
|
||||
@@ -1088,6 +1088,7 @@ impl App {
|
||||
"failed to run elevated Windows sandbox setup"
|
||||
);
|
||||
AppEvent::OpenWindowsSandboxFallbackPrompt {
|
||||
// tui/src/app.rs
|
||||
preset,
|
||||
reason: WindowsSandboxFallbackReason::ElevationFailed,
|
||||
}
|
||||
|
||||
@@ -325,6 +325,7 @@ impl App {
|
||||
if let Some(Overlay::Transcript(t)) = &mut self.overlay {
|
||||
t.set_highlight_cell(Some(cell_idx));
|
||||
}
|
||||
// tui/src/app_backtrack.rs
|
||||
} else {
|
||||
self.backtrack.nth_user_message = usize::MAX;
|
||||
if let Some(Overlay::Transcript(t)) = &mut self.overlay {
|
||||
|
||||
@@ -130,6 +130,7 @@ pub(crate) enum AppEvent {
|
||||
/// Open the Windows world-writable directories warning.
|
||||
/// If `preset` is `Some`, the confirmation will apply the provided
|
||||
/// approval/sandbox configuration on Continue; if `None`, it performs no
|
||||
// tui/src/app_event.rs
|
||||
/// policy change and only acknowledges/dismisses the warning.
|
||||
#[cfg_attr(not(target_os = "windows"), allow(dead_code))]
|
||||
OpenWorldWritableWarningConfirmation {
|
||||
|
||||
@@ -12,6 +12,7 @@ impl AppEventSender {
|
||||
pub(crate) fn new(app_event_tx: UnboundedSender<AppEvent>) -> Self {
|
||||
Self { app_event_tx }
|
||||
}
|
||||
// tui/src/app_event_sender.rs
|
||||
|
||||
/// Send an event to the app event channel. If it fails, we swallow the
|
||||
/// error and log it.
|
||||
|
||||
@@ -53,6 +53,7 @@ impl AsciiAnimation {
|
||||
tick_ms
|
||||
} else {
|
||||
tick_ms - rem_ms
|
||||
// tui/src/ascii_animation.rs
|
||||
};
|
||||
if let Ok(delay_ms_u64) = u64::try_from(delay_ms) {
|
||||
self.request_frame
|
||||
|
||||
@@ -5,6 +5,7 @@ When changing the paste-burst or chat-composer state machines in this folder, ke
|
||||
- Update the relevant module docs (`chat_composer.rs` and/or `paste_burst.rs`) so they remain a
|
||||
readable, top-down explanation of the current behavior.
|
||||
- Update the narrative doc `docs/tui-chat-composer.md` whenever behavior/assumptions change (Enter
|
||||
<!-- tui/src/bottom_pane/AGENTS.md -->
|
||||
handling, retro-capture, flush/clear rules, `disable_paste_burst`, non-ASCII/IME handling).
|
||||
- Keep `codex-rs/tui` and `codex-rs/tui2` implementations/docstrings aligned unless the divergence
|
||||
is intentional and documented.
|
||||
|
||||
@@ -361,6 +361,7 @@ impl From<ApprovalRequest> for ApprovalRequestState {
|
||||
command,
|
||||
proposed_execpolicy_amendment,
|
||||
},
|
||||
// tui/src/bottom_pane/approval_overlay.rs
|
||||
header: Box::new(Paragraph::new(header).wrap(Wrap { trim: false })),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ pub(crate) trait BottomPaneView: Renderable {
|
||||
}
|
||||
|
||||
/// Handle Ctrl-C while this view is active.
|
||||
// tui/src/bottom_pane/bottom_pane_view.rs
|
||||
fn on_ctrl_c(&mut self) -> CancellationEvent {
|
||||
CancellationEvent::NotHandled
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ pub(crate) fn spawn_agent(
|
||||
};
|
||||
app_event_tx_clone.send(AppEvent::CodexEvent(ev));
|
||||
|
||||
// tui/src/chatwidget/agent.rs
|
||||
let thread_clone = thread.clone();
|
||||
tokio::spawn(async move {
|
||||
while let Some(op) = codex_op_rx.recv().await {
|
||||
|
||||
@@ -420,6 +420,7 @@ impl AuthModeWidget {
|
||||
" Press Enter to continue".fg(Color::Cyan).into(),
|
||||
];
|
||||
|
||||
// tui/src/onboarding/auth.rs
|
||||
Paragraph::new(lines)
|
||||
.wrap(Wrap { trim: false })
|
||||
.render(area, buf);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
pub(crate) enum StatusAccountDisplay {
|
||||
ChatGpt {
|
||||
email: Option<String>,
|
||||
// tui/src/status/account.rs
|
||||
plan: Option<String>,
|
||||
},
|
||||
ApiKey,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// The submodules live in `tests/suite/`.
|
||||
#[cfg(feature = "vt100-tests")]
|
||||
mod test_backend;
|
||||
// tui/tests/all.rs
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use codex_cli as _; // Keep dev-dep for cargo-shear; tests spawn the codex binary.
|
||||
|
||||
@@ -39,6 +39,7 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::path::PathBuf;
|
||||
|
||||
// tui2/src/additional_dirs.rs
|
||||
#[test]
|
||||
fn returns_none_for_workspace_write() {
|
||||
let sandbox = SandboxPolicy::new_workspace_write_policy();
|
||||
|
||||
@@ -1555,6 +1555,7 @@ impl App {
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
// tui2/src/app.rs
|
||||
let path_display = path.display();
|
||||
self.chat_widget.add_error_message(format!(
|
||||
"Failed to resume session from {path_display}: {err}"
|
||||
|
||||
@@ -336,6 +336,7 @@ impl App {
|
||||
}
|
||||
|
||||
let last_index = count.saturating_sub(1);
|
||||
// tui2/src/app_backtrack.rs
|
||||
let next_selection = if self.backtrack.nth_user_message == usize::MAX {
|
||||
last_index
|
||||
} else {
|
||||
|
||||
@@ -126,6 +126,7 @@ pub(crate) enum AppEvent {
|
||||
/// If `preset` is `Some`, the confirmation will apply the provided
|
||||
/// approval/sandbox configuration on Continue; if `None`, it performs no
|
||||
/// policy change and only acknowledges/dismisses the warning.
|
||||
// tui2/src/app_event.rs
|
||||
#[cfg_attr(not(target_os = "windows"), allow(dead_code))]
|
||||
OpenWorldWritableWarningConfirmation {
|
||||
preset: Option<ApprovalPreset>,
|
||||
|
||||
@@ -12,6 +12,7 @@ impl AppEventSender {
|
||||
pub(crate) fn new(app_event_tx: UnboundedSender<AppEvent>) -> Self {
|
||||
Self { app_event_tx }
|
||||
}
|
||||
// tui2/src/app_event_sender.rs
|
||||
|
||||
/// Send an event to the app event channel. If it fails, we swallow the
|
||||
/// error and log it.
|
||||
|
||||
@@ -53,6 +53,7 @@ impl AsciiAnimation {
|
||||
tick_ms
|
||||
} else {
|
||||
tick_ms - rem_ms
|
||||
// tui2/src/ascii_animation.rs
|
||||
};
|
||||
if let Ok(delay_ms_u64) = u64::try_from(delay_ms) {
|
||||
self.request_frame
|
||||
|
||||
@@ -5,6 +5,7 @@ When changing the paste-burst or chat-composer state machines in this folder, ke
|
||||
- Update the relevant module docs (`chat_composer.rs` and/or `paste_burst.rs`) so they remain a
|
||||
readable, top-down explanation of the current behavior.
|
||||
- Update the narrative doc `docs/tui-chat-composer.md` whenever behavior/assumptions change (Enter
|
||||
<!-- tui2/src/bottom_pane/AGENTS.md -->
|
||||
handling, retro-capture, flush/clear rules, `disable_paste_burst`, non-ASCII/IME handling).
|
||||
- Keep `codex-rs/tui` and `codex-rs/tui2` implementations/docstrings aligned unless the divergence
|
||||
is intentional and documented.
|
||||
|
||||
@@ -361,6 +361,7 @@ impl From<ApprovalRequest> for ApprovalRequestState {
|
||||
command,
|
||||
proposed_execpolicy_amendment,
|
||||
},
|
||||
// tui2/src/bottom_pane/approval_overlay.rs
|
||||
header: Box::new(Paragraph::new(header).wrap(Wrap { trim: false })),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ pub(crate) trait BottomPaneView: Renderable {
|
||||
}
|
||||
|
||||
/// Handle Ctrl-C while this view is active.
|
||||
// tui2/src/bottom_pane/bottom_pane_view.rs
|
||||
fn on_ctrl_c(&mut self) -> CancellationEvent {
|
||||
CancellationEvent::NotHandled
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ pub(crate) fn spawn_agent(
|
||||
};
|
||||
app_event_tx_clone.send(AppEvent::CodexEvent(ev));
|
||||
|
||||
// tui2/src/chatwidget/agent.rs
|
||||
let thread_clone = thread.clone();
|
||||
tokio::spawn(async move {
|
||||
while let Some(op) = codex_op_rx.recv().await {
|
||||
|
||||
@@ -420,6 +420,7 @@ impl AuthModeWidget {
|
||||
" Press Enter to continue".fg(Color::Cyan).into(),
|
||||
];
|
||||
|
||||
// tui2/src/onboarding/auth.rs
|
||||
Paragraph::new(lines)
|
||||
.wrap(Wrap { trim: false })
|
||||
.render(area, buf);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
pub(crate) enum StatusAccountDisplay {
|
||||
ChatGpt {
|
||||
email: Option<String>,
|
||||
// tui2/src/status/account.rs
|
||||
plan: Option<String>,
|
||||
},
|
||||
ApiKey,
|
||||
|
||||
@@ -38,6 +38,7 @@ impl AltScreenNesting {
|
||||
/// Record a leave-alt-screen request.
|
||||
///
|
||||
/// Returns `true` when the caller should actually leave the alternate screen.
|
||||
// tui2/src/tui/alt_screen_nesting.rs
|
||||
pub(crate) fn leave(&mut self) -> bool {
|
||||
match self.depth {
|
||||
0 => false,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// The submodules live in `tests/suite/`.
|
||||
#[cfg(feature = "vt100-tests")]
|
||||
mod test_backend;
|
||||
// tui2/tests/all.rs
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use codex_cli as _; // Keep dev-dep for cargo-shear; tests spawn the codex binary.
|
||||
|
||||
@@ -421,6 +421,7 @@ pub fn parse_git_apply_output(
|
||||
});
|
||||
static BINARY_DOES_NOT_APPLY: Lazy<Regex> = Lazy::new(|| {
|
||||
regex_ci("^error:\\s+binary patch does not apply to\\s+['\\\"]?(?P<path>.+?)['\\\"]?$")
|
||||
// utils/git/src/apply.rs
|
||||
});
|
||||
static BINARY_INCORRECT_RESULT: Lazy<Regex> = Lazy::new(|| {
|
||||
regex_ci(
|
||||
|
||||
@@ -126,6 +126,7 @@ mod tests {
|
||||
use tempfile::tempdir;
|
||||
|
||||
fn run_git_in(repo_path: &Path, args: &[&str]) {
|
||||
// utils/git/src/branch.rs
|
||||
let status = Command::new("git")
|
||||
.current_dir(repo_path)
|
||||
.args(args)
|
||||
|
||||
@@ -312,6 +312,7 @@ unsafe fn ensure_allow_mask_aces_with_inheritance_impl(
|
||||
added = true;
|
||||
if !p_new_dacl.is_null() {
|
||||
LocalFree(p_new_dacl as HLOCAL);
|
||||
// windows-sandbox-rs/src/acl.rs
|
||||
}
|
||||
} else {
|
||||
if !p_new_dacl.is_null() {
|
||||
|
||||
@@ -110,6 +110,7 @@ mod tests {
|
||||
writable_roots: vec![AbsolutePathBuf::try_from(extra_root.as_path()).unwrap()],
|
||||
network_access: false,
|
||||
exclude_tmpdir_env_var: false,
|
||||
// windows-sandbox-rs/src/allow.rs
|
||||
exclude_slash_tmp: false,
|
||||
};
|
||||
|
||||
|
||||
@@ -167,6 +167,7 @@ pub fn audit_everyone_writable(
|
||||
let ft = match ent.file_type() {
|
||||
Ok(ft) => ft,
|
||||
Err(_) => continue,
|
||||
// windows-sandbox-rs/src/audit.rs
|
||||
};
|
||||
if ft.is_symlink() {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user