Repository navigation
refactor(server): move the shared conversation types into server/conversation-shared.ts - #1763
Conversation
…ersation-shared.ts Move the transcript window constant, the conversation error classes, RecognizedConversation, ConversationPage, StreamSource, PROCESS_VERSION and answerVersion verbatim into the new leaf. StreamSource gains an export; conversation.ts imports what it uses and re-exports the previously exported names, so every importer stays unchanged. hermes.ts imports the leaf, which removes the hermes.ts/conversation.ts import cycle. Plan: .omo/plans/agent-modules-split.md C2.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
|
Merge pass: move-only PR (per-agent split, wave C2), merged on its checks without waiting for a CodeRabbit review, as AGENTS.md allows.
All required checks are green and no review thread is open. |
…nto their own modules (#1765) Wave C3 of the per-agent module split. The plan is `.omo/plans/agent-modules-split.md` in the maintainer's workspace, and plan-reviewer approved it. It follows C2 (#1763), which this wave builds on: `StreamSource` and `ConversationUnavailable` now come from `server/conversation-shared.ts`. This wave moves two state-free clusters out of `server/conversation.ts` into new leaf modules. `conversation.ts` keeps every cache, `paneReads` (including Devin's per-pane reads), the paging core and the transcript resolvers. The three functions tests spy on (`paneTranscript`, `readCommandTranscript`, `paneProcessRoots`) stay. ## What changes - **`server/transcript-turns.ts`:** the turn-boundary cluster, verbatim with its doc comments: - `ClaudeBranch`, `claudeForks`, `answeredBetween`, `claudeCommandEchoRecord`, `CLAUDE_CHAIN_LINE_BYTES`, `followClaudeBranch`; - `PEER_MARK`, `TURN_MARK`, `opensTurn`; - `PromptChain`, `turnStarts`. `followClaudeBranch` calls `opensTurn`, which `turnStarts` also needs, so the cluster moves as one module. `export` is added to the five names `conversation.ts` still uses: `turnStarts`, `followClaudeBranch`, `claudeForks`, and the types `ClaudeBranch` and `PromptChain`. - **`server/devin-session.ts`:** `isDevinProcess` and `devinSessionForPane`, verbatim. Both were already exported. `conversation.ts` re-exports them for `server/session-history.ts` and `server/conversation.test.ts`, so no importer changes. - **`conversation.ts` imports:** the imports from `./transcript-records.ts` and `./claude-transcript.ts` drop the names only the moved code used. - **Not in this wave:** `rememberPaneDevin` and `DevinPaneRead` stay, because they are fields of `paneReads`, which `forgetPaneTranscriptState` owns. `server/conversation.ts` goes from 1,732 to 1,532 lines. ## Checks - **`--color-moved`:** `git diff --color-moved=plain --color-moved-ws=allow-indentation-change origin/main...HEAD` shows 394 lines as moved. The other 23 lines are: - the two new files' imports; - `conversation.ts`'s narrowed and new imports and its one re-export line; - the five declarations whose only change is the added `export`, each shown as removed and added. - **No import cycles:** `bun <plan>/no-path.ts <new file> server/conversation.ts server/prompt.ts` prints "no path to server/conversation.ts, server/prompt.ts" for both new files. They import only `conversation-shared.ts`, `transcript-records.ts`, `claude-transcript.ts` and `shared/protocol.ts`. - **No new herdr calls:** neither new file calls `herdrRpc`. - **Typecheck:** `bun run typecheck` passes. - **Unit tests:** **305 pass, 0 fail across 10 files**, from: `HERDR_TEST_MODE=unit bun test server/claude-turn-boundaries.test.ts server/native-incremental.test.ts server/chat-history.test.ts server/pi.test.ts server/pi-tree.test.ts server/pi-large-history.test.ts server/grok.test.ts server/cmd.test.ts server/conversation.test.ts server/devin.test.ts` - `bun run check fast`: passes (unit 6253 pass, 0 fail, 13 skip in 443 files, 8 at a time, 58.7s) - **Integration lane:** runs in CI. ## Outside PRs that touch the same files No other maintainer PR touches these files. Three outside contributors' PRs touch `server/conversation.ts`: #1706, #1652 and #1442. - **Status:** each already conflicts with main there, so it needs a rebase either way. - **What the rebase carries:** #1706, #1652 and #1442 edit `TURN_MARK`, `opensTurn` or `followClaudeBranch`. Those edits move to `server/transcript-turns.ts` in the rebase. Move-only: moved declarations plus imports, five added `export`s and one re-export line. No changelog fragment: users see no change.
Wave C2 of the per-agent module split. The plan is
.omo/plans/agent-modules-split.mdin the maintainer's workspace, and plan-reviewer approved it. It follows C1 (#1760) and P1b (#1761).This wave moves the conversation types and constants that agent modules share out of
server/conversation.tsinto a new leaf module,server/conversation-shared.ts. Later waves (Devin's session lookup, then the Claude and omp sessions) can then throwConversationUnavailablewithout importingconversation.ts.What changes
TRANSCRIPT_WINDOW_BYTES;ConversationUnavailable,ConversationNotStartedandHistoryChanged;RecognizedConversation,StreamSourceandConversationPage;PROCESS_VERSIONandanswerVersion.PROCESS_VERSIONholds onerandomUUID(), set once and never changed. It moves with its only user,answerVersion, so it still has a single owner.export: onlyStreamSourcegains one, becauseconversation.tsimports it back.conversation.tsre-exports every name that was exported before, so no other importer changes.server/hermes.tsnow imports the same names from./conversation-shared.tsinstead of./conversation.ts. That removes the runtime import cycle betweenhermes.tsandconversation.ts.Checks
--color-moved:git diff --color-moved=plain --color-moved-ws=allow-indentation-change origin/main...HEADshows 138 lines as moved. The other 8 lines are:StreamSourcewith its addedexport, shown as removed and added;conversation.ts's import and re-export lines;hermes.ts's changed module path.bun <plan>/no-path.ts.server/conversation-shared.ts server/conversation.ts server/prompt.ts, it prints "no path to server/conversation.ts, server/prompt.ts".server/hermes.ts server/conversation.ts, it prints "no path to server/conversation.ts". The cycle is gone.bun run typecheckpasses.HERDR_TEST_MODE=unit bun test server/hermes.test.ts server/conversation.test.ts server/chat-history.test.ts: 177 pass, 0 fail.bun run check fast: passes (unit 6253 pass, 0 fail, 13 skip in 443 files, 8 at a time, 66.5s)Outside PRs that touch the same files
No other maintainer PR touches these files. Three outside contributors' PRs touch
server/conversation.ts. Each adds a member toRecognizedConversation'ssourceunion, which now lives inserver/conversation-shared.ts, so a rebase carries that one line into the new file. I checked each withgit merge-tree:server/conversation.ts.server/conversation.ts, and needs a rebase either way.server/conversation.ts, and needs a rebase either way.Move-only: moved declarations plus imports, one re-export line, one added
export, and thehermes.tsmodule path. No changelog fragment: users see no change.