feat(chat-history): import Codex and Claude conversations - #332
Draft
FlowerRealm wants to merge 12 commits into
Draft
feat(chat-history): import Codex and Claude conversations#332FlowerRealm wants to merge 12 commits into
FlowerRealm wants to merge 12 commits into
Conversation
Add a settings entry "Conversations" that scans ~/.codex/sessions and imports Codex conversations that are not already present in LiveAgent, exposing chat_history_import_codex to the frontend. - Backend: new codex_import module wiring an import command - Frontend: ConversationsSection + nav entry + i18n (zh/en) - Tests: cover the Codex import path
Split the one-shot chat_history_import_codex command into a read-only scan (chat_history_scan_codex) returning per-session alreadyImported flags, and an import command that accepts the selected session ids. Add a two-pane CodexImportDialog (workspaces left, sessions right). New sessions are selected by default; already-imported sessions are greyed out and unchecked. Sessions under ~/Documents/Codex already collapse into the default-project workspace via codex_import_cwd.
The ~/Documents/Codex remapping was platform-dependent and fragile. Sessions are already read from the stable ~/.codex/sessions path; the cwd field inside each session now passes through unmodified.
Replace forEach callbacks returning values with for...of loops to fix useIterableCallbackReturn errors. Biome auto-formatting.
Map Codex temporary Documents directories to LiveAgent's default project so imported conversations do not retain invalid working directories.
FlowerRealm
marked this pull request as draft
July 30, 2026 00:03
The codex/claude_code/claude_official importers mirrored each other: three
copies of the Conversation/ImportResult/ImportPreview structs, three copies of
the DB-write boilerplate (sequence messages, build the single segment, open Tx,
upsert header, sync segments, verify, commit), and three near-identical tauri
command shells. The only real per-provider variation is how to locate + parse
the source, plus three scalars (provider_id, id prefix, selectedModelJson).
Extract the shared struct + the single write path + the JSON helpers into a
new `import` module, and turn the three importers into real submodules instead
of `include!` fragments — so they get explicit module boundaries rather than
flat-namespace naked names with codex_/claude_code_ prefixes.
- Remove the triplicated structs and `import_*_conversation` boilderplate;
one `import_conversation` + one `async run_import` serve all three.
- Drop the codex_/claude_code_ string/timestamp aliases in favor of shared
`import_string`/`import_timestamp`/`import_text_blocks`.
- Hoist `claude_code_assistant` into `import` so the official parser no longer
borrows from the code parser across module lines.
- Pull `codex_remap_cwd` into a pure function taking codex_temp_root +
default_project; the temp-dir test was platform-coupled to `dirs` and only
passed on a /Users/tester home. Now deterministic.
- Fix the two codex tests that wouldn't compile on the prior branch (they
initialized `CodexConversation` without the message_count/already_imported
fields the struct gained).
- lib.rs: point generate_handler! at the new submodule paths; the frontend
`invoke("chat_history_scan_codex")` contract is unchanged.
cargo build --lib + --bin liveagent: clean, 0 warnings.
cargo test --lib: 673 passed.
clippy on the touched files: 0 new findings.
Drop the official Claude data ZIP importer and its frontend wiring. Existing imported records (provider_id=claude_official) remain readable. - Delete claude_official_import.rs - Remove claude_official provider config from import.rs - Unregister official scan/import Tauri commands - Remove official source from ImportSource, ImportDialog, ConversationsSection - Remove related i18n keys and update generic Claude description
…versations # Conflicts: # crates/agent-gui/src/pages/SettingsPage.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
cargo fmt --checkcargo check -p liveagentpnpm --dir crates/agent-gui buildgit diff --check origin/main...HEADReplaces #300, whose Codex-only implementation is included here alongside the Claude import paths.