Skip to content

feat(chat-history): import Codex and Claude conversations - #332

Draft
FlowerRealm wants to merge 12 commits into
Stack-Cairn:mainfrom
FlowerRealm:feat/import-other-conversations
Draft

feat(chat-history): import Codex and Claude conversations#332
FlowerRealm wants to merge 12 commits into
Stack-Cairn:mainfrom
FlowerRealm:feat/import-other-conversations

Conversation

@FlowerRealm

Copy link
Copy Markdown

Summary

  • import locally stored Codex conversations with workspace/session selection
  • import local Claude Code conversations
  • import Claude official data-export ZIP conversations
  • retain source-specific session identifiers and selection state to avoid duplicate imports

Validation

  • cargo fmt --check
  • cargo check -p liveagent
  • pnpm --dir crates/agent-gui build
  • git diff --check origin/main...HEAD

Replaces #300, whose Codex-only implementation is included here alongside the Claude import paths.

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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant