Commit Graph
8422 Commits
Author SHA1 Message Date
Michael Bolin 86022f097e feat: read model_provider and model_providers from config.toml (#853)
This is the first step in supporting other model providers in the Rust
CLI. Specifically, this PR adds support for the new entries in `Config`
and `ConfigOverrides` to specify a `ModelProviderInfo`, which is the
basic config needed for an LLM provider. This PR does not get us all the
way there yet because `client.rs` still categorically appends
`/responses` to the URL and expects the endpoint to support the OpenAI
Responses API. Will fix that next!
2025-05-07 17:38:28 -07:00
Michael Bolin 5cae49f08c merge commit for archive created by Sapling 2025-05-07 17:09:45 -07:00
Michael Bolin 403e88cacf feat: support map of alternative providers like in TypeScript CLI 2025-05-07 17:09:07 -07:00
Michael Bolin 4511a668f3 Merge 7c21aa3e16 into sapling-pr-archive-bolinfest 2025-05-07 16:59:19 -07:00
Michael Bolin 7c21aa3e16 feat: support map of alternative providers like in TypeScript CLI 2025-05-07 16:59:11 -07:00
Michael Bolin 955584c4ab merge commit for archive created by Sapling 2025-05-07 16:58:29 -07:00
Michael Bolin 60b522f4ee feat: support map of alternative providers like in TypeScript CLI 2025-05-07 16:58:21 -07:00
Michael Bolin 86ff8a1714 merge commit for archive created by Sapling 2025-05-07 16:44:46 -07:00
Michael Bolin d13b807980 feat: support map of alternative providers like in TypeScript CLI 2025-05-07 16:44:31 -07:00
Michael Bolin cfe50c7107 fix: creating an instance of Codex requires a Config (#859)
I discovered that I accidentally introduced a change in
https://github.com/openai/codex/pull/829 where we load a fresh `Config`
in the middle of `codex.rs`:


https://github.com/openai/codex/blob/c3e10e180a341e719f61014ea508f6d9dbffe05b/codex-rs/core/src/codex.rs#L515-L522

This is not good because the `Config` could differ from the one that has
the user's overrides specified from the CLI. Also, in unit tests, it
means the `Config` was picking up my personal settings as opposed to
using a vanilla config, which was problematic.

This PR cleans things up by moving the common case where
`Op::ConfigureSession` is derived from `Config` (originally done in
`codex_wrapper.rs`) and making it the standard way to initialize `Codex`
by putting it in `Codex::spawn()`. Note this also eliminates quite a bit
of boilerplate from the tests and relieves the caller of the
responsibility of minting out unique IDs when invoking `submit()`.
2025-05-07 16:33:28 -07:00
Michael Bolin 3a019d4220 merge commit for archive created by Sapling 2025-05-07 16:16:23 -07:00
Michael Bolin 0b42a4aef0 fix: creating an instance of Codex requires a Config 2025-05-07 16:16:17 -07:00
Michael Bolin c6c05788e2 merge commit for archive created by Sapling 2025-05-07 16:12:14 -07:00
Michael Bolin 6783203c20 fix: creating an instance of Codex requires a Config 2025-05-07 16:11:58 -07:00
Michael Bolin c3e10e180a fix: remove CodexBuilder and Recorder (#858)
These abstractions were originally created exclusively for the REPL,
which was removed in https://github.com/openai/codex/pull/754.
Currently, the create some unnecessary Tokio tasks, so we are better off
without them. (We can always bring this back if we have a new use case.)
2025-05-07 16:11:42 -07:00
Michael Bolin 1b7b2183e4 Merge 37683450dd into sapling-pr-archive-bolinfest 2025-05-07 15:58:33 -07:00
Michael Bolin 37683450dd fix: remove CodexBuilder and Recorder 2025-05-07 15:58:26 -07:00
Michael Bolin a04d707d4a merge commit for archive created by Sapling 2025-05-07 14:41:03 -07:00
Michael Bolin e2a5c000a0 feat: support map of alternative providers like in TypeScript CLI 2025-05-07 14:40:50 -07:00
Michael Bolin 42617f8726 feat: save session transcripts when using Rust CLI (#845)
This adds support for saving transcripts when using the Rust CLI. Like
the TypeScript CLI, it saves the transcript to `~/.codex/sessions`,
though it uses JSONL for the file format (and `.jsonl` for the file
extension) so that even if Codex crashes, what was written to the
`.jsonl` file should generally still be valid JSONL content.
2025-05-07 13:49:15 -07:00
Michael Bolin ac451d13bf merge commit for archive created by Sapling 2025-05-07 12:58:09 -07:00
Michael Bolin 5b87df89b4 fix: make McpConnectionManager tolerant of MCPs that fail to start 2025-05-07 12:57:59 -07:00
Michael Bolin 9da6ebef3f fix: add optional timeout to McpClient::send_request() (#852)
We now impose a 10s timeout on the initial `tools/list` request to an
MCP server. We do not apply a timeout for other types of requests yet,
but we should start enforcing those, as well.
2025-05-07 12:56:38 -07:00
Michael Bolin 4170c74be5 Merge 8111a04d3e into sapling-pr-archive-bolinfest 2025-05-07 12:55:36 -07:00
Michael Bolin 8111a04d3e feat: save rollouts in Rust CLI 2025-05-07 12:55:31 -07:00
Michael Bolin 7499042ed3 merge commit for archive created by Sapling 2025-05-07 12:55:01 -07:00
Michael Bolin 5743c170e5 feat: support map of alternative providers like in TypeScript CLI 2025-05-07 12:54:56 -07:00
Michael Bolin e74f213cc9 Merge ea13757d3f into sapling-pr-archive-bolinfest 2025-05-07 12:52:58 -07:00
Michael Bolin ea13757d3f fix: add optional timeout to McpClient::send_request() 2025-05-07 12:52:11 -07:00
Michael Bolin 17c3ebbd12 merge commit for archive created by Sapling 2025-05-07 12:51:15 -07:00
Michael Bolin 8ec2dffc7a feat: support map of alternative providers like in TypeScript CLI 2025-05-07 12:51:05 -07:00
Michael Bolin c131d26f07 merge commit for archive created by Sapling 2025-05-07 12:46:13 -07:00
Michael Bolin be73b208cd fix: add optional timeout to McpClient::send_request() 2025-05-07 12:46:04 -07:00
Michael Bolin 0360b4d0d7 feat: introduce the use of tui-markdown (#851)
This introduces the use of the `tui-markdown` crate to parse an
assistant message as Markdown and style it using ANSI for a better user
experience. As shown in the screenshot below, it has support for syntax
highlighting for _tagged_ fenced code blocks:

<img width="907" alt="image"
src="https://github.com/user-attachments/assets/900dc229-80bb-46e8-b1bb-efee4c70ba3c"
/>

That said, `tui-markdown` is not as configurable (or stylish!) as
https://www.npmjs.com/package/marked-terminal, which is what we use in
the TypeScript CLI. In particular:

* The styles are hardcoded and `tui_markdown::from_str()` does not take
any options whatsoever. It uses "bold white" for inline code style which
does not stand out as much as the yellow used by `marked-terminal`:


https://github.com/joshka/tui-markdown/blob/65402cbda70325f34e7ddf6fe1ec629bcd9459cf/tui-markdown/src/lib.rs#L464

I asked Codex to take a first pass at this and it came up with:

https://github.com/joshka/tui-markdown/pull/80

* If a fenced code block is not tagged, then it does not get
highlighted. I would rather add some logic here:


https://github.com/joshka/tui-markdown/blob/65402cbda70325f34e7ddf6fe1ec629bcd9459cf/tui-markdown/src/lib.rs#L262

that uses something like https://pypi.org/project/guesslang/ to examine
the value of `text` and try to use the appropriate syntax highlighter.

* When we have a fenced code block, we do not want to show the opening
and closing triple backticks in the output.

To unblock ourselves, we might want to bundle our own fork of
`tui-markdown` temporarily until we figure out what the shape of the API
should be and then try to upstream it.
2025-05-07 10:46:32 -07:00
Michael Bolin 0e32859c90 merge commit for archive created by Sapling 2025-05-07 10:18:54 -07:00
Michael Bolin d289a825df feat: introduce the use of tui_markdown 2025-05-07 10:18:46 -07:00
Michael Bolin b2177f86dd Merge b13eaa7c12 into sapling-pr-archive-bolinfest 2025-05-07 10:10:33 -07:00
Michael Bolin b13eaa7c12 feat: save rollouts in Rust CLI 2025-05-07 10:10:05 -07:00
Michael Bolin 5c6c9839ff merge commit for archive created by Sapling 2025-05-07 10:09:35 -07:00
Michael Bolin 7235e057fe feat: introduce the use of tui_markdown 2025-05-07 10:09:00 -07:00
jcoens-openai a080d7b0fd Update submodules version to come from the workspace (#850)
Tie the version of submodules to the workspace version.
2025-05-07 10:08:06 -07:00
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
jcoens-openai 8a89d3aeda Update cargo to 2024 edition (#842)
Some effects of this change:
- New formatting changes across many files. No functionality changes
should occur from that.
- Calls to `set_env` are considered unsafe, since this only happens in
tests we wrap them in `unsafe` blocks
2025-05-07 08:37:48 -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