Commit Graph

830 Commits

Author SHA1 Message Date
Michael Bolin
a044f30f38 Merge bd910aad64 into sapling-pr-archive-bolinfest 2025-05-07 09:55:09 -07:00
Michael Bolin
bd910aad64 feat: introduce the use of tui_markdown 2025-05-07 09:54:56 -07:00
Michael Bolin
c48246f143 merge commit for archive created by Sapling 2025-05-06 22:53:49 -07:00
Michael Bolin
27b6fd3524 feat: save rollouts in Rust CLI 2025-05-06 22:53:42 -07:00
Michael Bolin
c7ee7b2579 merge commit for archive created by Sapling 2025-05-06 22:48:52 -07:00
Michael Bolin
0f52b17cde feat: save rollouts in Rust CLI 2025-05-06 22:48:48 -07:00
Michael Bolin
6d99328428 merge commit for archive created by Sapling 2025-05-06 22:46:33 -07:00
Michael Bolin
3f1d34bdd7 feat: save rollouts in Rust CLI 2025-05-06 22:46:26 -07:00
Michael Bolin
96cec49cf5 Merge 0b46df2677 into sapling-pr-archive-bolinfest 2025-05-06 22:04:03 -07:00
Michael Bolin
0b46df2677 feat: save rollouts in Rust CLI 2025-05-06 22:03:57 -07:00
Michael Bolin
e9ddb55fb8 merge commit for archive created by Sapling 2025-05-06 18:57:45 -07:00
Michael Bolin
f11b4bc909 chore: introduce new --native flag to Node module release process 2025-05-06 18:57:37 -07:00
Michael Bolin
c135d8c45a merge commit for archive created by Sapling 2025-05-06 18:53:38 -07:00
Michael Bolin
1db64b94d3 chore: introduce new --native flag to Node module release process 2025-05-06 18:53:11 -07:00
Michael Bolin
b113bde210 Merge 6995f5273e into sapling-pr-archive-bolinfest 2025-05-06 18:26:10 -07:00
Michael Bolin
6995f5273e chore: introduce new --native flag to Node module release process 2025-05-06 18:26:03 -07:00
Michael Bolin
c577e94b67 chore: introduce codex-common crate (#843)
I started this PR because I wanted to share the `format_duration()`
utility function in `codex-rs/exec/src/event_processor.rs` with the TUI.
The question was: where to put it?

`core` should have as few dependencies as possible, so moving it there
would introduce a dependency on `chrono`, which seemed undesirable.
`core` already had this `cli` feature to deal with a similar situation
around sharing common utility functions, so I decided to:

* make `core` feature-free
* introduce `common`
* `common` can have as many "special interest" features as it needs,
each of which can declare their own deps
* the first two features of common are `cli` and `elapsed`

In practice, this meant updating a number of `Cargo.toml` files,
replacing this line:

```toml
codex-core = { path = "../core", features = ["cli"] }
```

with these:

```toml
codex-core = { path = "../core" }
codex-common = { path = "../common", features = ["cli"] }
```

Moving `format_duration()` into its own file gave it some "breathing
room" to add a unit test, so I had Codex generate some tests and new
support for durations over 1 minute.
codex-rs-132146b6d4e133d014f763a0d8dabd853f3fc0c0-1-rust-v0.0.2505061740
2025-05-06 17:38:56 -07:00
Michael Bolin
a03be77956 Merge 413e5370aa into sapling-pr-archive-bolinfest 2025-05-06 17:33:52 -07:00
Michael Bolin
413e5370aa chore: introduce codex-common crate 2025-05-06 17:33:49 -07:00
Michael Bolin
e426018866 Merge 51facd79bf into sapling-pr-archive-bolinfest 2025-05-06 17:33:14 -07:00
Michael Bolin
51facd79bf chore: introduce codex-common crate 2025-05-06 17:33:11 -07:00
Michael Bolin
5f83da6046 merge commit for archive created by Sapling 2025-05-06 17:32:32 -07:00
Michael Bolin
6da5631a7c chore: introduce codex-common crate 2025-05-06 17:32:28 -07:00
Michael Bolin
a0a7e0a7f0 merge commit for archive created by Sapling 2025-05-06 17:28:34 -07:00
Michael Bolin
d82a893b35 chore: introduce codex-common crate 2025-05-06 17:28:28 -07:00
Michael Bolin
98168f0cae merge commit for archive created by Sapling 2025-05-06 17:16:36 -07:00
Michael Bolin
a648355cae chore: introduce codex-common crate 2025-05-06 17:16:28 -07:00
Michael Bolin
15d8356af4 merge commit for archive created by Sapling 2025-05-06 17:09:56 -07:00
Michael Bolin
bf30f991b0 chore: introduce codex-common crate 2025-05-06 17:07:33 -07:00
Michael Bolin
7d8b38b37b feat: show MCP tool calls in codex exec subcommand (#841)
This is analogous to the change for the TUI in
https://github.com/openai/codex/pull/836, but for `codex exec`.

To test, I ran:

```
cargo run --bin codex-exec -- 'what is the weather in wellesley ma tomorrow'
```

and saw:


![image](https://github.com/user-attachments/assets/5714e07f-88c7-4dd9-aa0d-be54c1670533)
2025-05-06 16:52:43 -07:00
Michael Bolin
9945874de7 Merge 81fc840604 into sapling-pr-archive-bolinfest 2025-05-06 16:40:52 -07:00
Michael Bolin
81fc840604 feat: show MCP tool calls in codex exec subcommand 2025-05-06 16:40:49 -07:00
Michael Bolin
932498589d Merge c714c40710 into sapling-pr-archive-bolinfest 2025-05-06 16:37:36 -07:00
Michael Bolin
c714c40710 feat: show MCP tool calls in codex exec subcommand 2025-05-06 16:36:34 -07:00
Michael Bolin
6f87f4c69f feat: drop support for q in the Rust TUI since we already support ctrl+d (#799)
Out of the box, we will make `/` the only official "escape sequence" for
commands in the Rust TUI. We will look to support `q` (or any string you
want to use as a "macro") via a plugin, but not make it part of the
default experience.

Existing `q` users will have to get by with `ctrl+d` for now.
2025-05-06 16:34:17 -07:00
Michael Bolin
aa36a15f9f fix: make all fields of Session struct private again (#840)
https://github.com/openai/codex/pull/829 noted it introduced a circular
dep between `codex.rs` and `mcp_tool_call.rs`. This attempts to clean
things up: the circular dep still exists, but at least all the fields of
`Session` are private again.
2025-05-06 16:21:35 -07:00
Michael Bolin
aad3f6b1ac Merge 22d4a97349 into sapling-pr-archive-bolinfest 2025-05-06 16:12:59 -07:00
Michael Bolin
22d4a97349 fix: make all fields of Session struct private again 2025-05-06 16:12:49 -07:00
Michael Bolin
88e7ca5f2b feat: show MCP tool calls in TUI (#836)
Adds logic for the `McpToolCallBegin` and `McpToolCallEnd` events in
`codex-rs/tui/src/chatwidget.rs` so they get entries in the conversation
history in the TUI.

Building on top of https://github.com/openai/codex/pull/829, here is the
result of running:

```
cargo run --bin codex -- 'what is the weather in san francisco tomorrow'
```


![image](https://github.com/user-attachments/assets/db4a79bb-4988-46cb-acb2-446d5ba9e058)
2025-05-06 16:12:15 -07:00
Michael Bolin
0b0d618680 Merge a8b5dd88f7 into sapling-pr-archive-bolinfest 2025-05-06 15:58:27 -07:00
Michael Bolin
a8b5dd88f7 feat: show MCP tool calls in TUI 2025-05-06 15:58:24 -07:00
Michael Bolin
9bd8921af4 merge commit for archive created by Sapling 2025-05-06 15:55:31 -07:00
Michael Bolin
d97cc8ec8c feat: show MCP tool calls in TUI 2025-05-06 15:54:59 -07:00
Michael Bolin
147a940449 feat: support mcp_servers in config.toml (#829)
This adds initial support for MCP servers in the style of Claude Desktop
and Cursor. Note this PR is the bare minimum to get things working end
to end: all configured MCP servers are launched every time Codex is run,
there is no recovery for MCP servers that crash, etc.

(Also, I took some shortcuts to change some fields of `Session` to be
`pub(crate)`, which also means there are circular deps between
`codex.rs` and `mcp_tool_call.rs`, but I will clean that up in a
subsequent PR.)

`codex-rs/README.md` is updated as part of this PR to explain how to use
this feature. There is a bit of plumbing to route the new settings from
`Config` to the business logic in `codex.rs`. The most significant
chunks for new code are in `mcp_connection_manager.rs` (which defines
the `McpConnectionManager` struct) and `mcp_tool_call.rs`, which is
responsible for tool calls.

This PR also introduces new `McpToolCallBegin` and `McpToolCallEnd`
event types to the protocol, but does not add any handlers for them.
(See https://github.com/openai/codex/pull/836 for initial usage.)

To test, I added the following to my `~/.codex/config.toml`:

```toml
# Local build of https://github.com/hideya/mcp-server-weather-js
[mcp_servers.weather]
command = "/Users/mbolin/code/mcp-server-weather-js/dist/index.js"
args = []
```

And then I ran the following:

```
codex-rs$ cargo run --bin codex exec 'what is the weather in san francisco'
[2025-05-06T22:40:05] Task started: 1
[2025-05-06T22:40:18] Agent message: Here’s the latest National Weather Service forecast for San Francisco (downtown, near 37.77° N, 122.42° W):

This Afternoon (Tue):
• Sunny, high near 69 °F
• West-southwest wind around 12 mph

Tonight:
• Partly cloudy, low around 52 °F
• SW wind 7–10 mph
...
```

Note that Codex itself is not able to make network calls, so it would
not normally be able to get live weather information like this. However,
the weather MCP is [currently] not run under the Codex sandbox, so it is
able to hit `api.weather.gov` and fetch current weather information.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/829).
* #836
* __->__ #829
2025-05-06 15:47:59 -07:00
Michael Bolin
e6af355312 merge commit for archive created by Sapling 2025-05-06 15:38:56 -07:00
Michael Bolin
e9b4217ea1 feat: show MCP tool calls in TUI 2025-05-06 15:38:51 -07:00
Michael Bolin
54e382e2a9 feat: support mcp_servers in config.toml 2025-05-06 15:38:51 -07:00
Michael Bolin
00dd6fe2e1 merge commit for archive created by Sapling 2025-05-06 15:37:28 -07:00
Michael Bolin
8ed9aff351 feat: show MCP tool calls in TUI 2025-05-06 15:37:23 -07:00
Michael Bolin
007c0a3984 feat: support mcp_servers in config.toml 2025-05-06 15:37:23 -07:00