Skip to content

The agent that grows with you

refactor(desktop): one isRowId; the resume comment names the module that exists

Tekniumf6896ba1c815
diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/interrupted-reply.ts b/apps/desktop/src/app/session/hooks/use-message-stream/interrupted-reply.ts
index d2a54e35e25..e535a73a73a 100644
--- a/apps/desktop/src/app/session/hooks/use-message-stream/interrupted-reply.ts
+++ b/apps/desktop/src/app/session/hooks/use-message-stream/interrupted-reply.ts
@@ -10,7 +10,7 @@ import {
} from '@/lib/chat-messages'
import { generatedImageEchoSources, stripGeneratedImageEchoes } from '@/lib/generated-images'
-import { bindReceiptUserRows } from './receipt-user-rows'
+import { bindReceiptUserRows, isRowId } from './receipt-user-rows'
const flat = (text: string) => text.replace(/\s+/g, ' ').trim()
@@ -70,9 +70,6 @@ export function extendInterruptedReply(messages: ChatMessage[], rawText: string,
]
}
-const isRowId = (value: unknown): value is number =>
- typeof value === 'number' && Number.isSafeInteger(value) && value > 0
-
/**
* Stop settles the turn on screen before the backend's interrupted completion
* arrives, so a refresh can merge the newest page in between. That page already
diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/receipt-user-rows.ts b/apps/desktop/src/app/session/hooks/use-message-stream/receipt-user-rows.ts
index aa5a03888ce..b68ddcf56dd 100644
--- a/apps/desktop/src/app/session/hooks/use-message-stream/receipt-user-rows.ts
+++ b/apps/desktop/src/app/session/hooks/use-message-stream/receipt-user-rows.ts
@@ -3,7 +3,8 @@ import type { PersistedTurn } from '@hermes/shared'
import { transcriptRowIds } from '@/app/session/hooks/use-session-actions/pending-turn-identity'
import type { ChatMessage } from '@/lib/chat-messages'
-const isRowId = (value: unknown): value is number =>
+/** A stored transcript row id (SQLite rowid: a positive safe integer). */
+export const isRowId = (value: unknown): value is number =>
typeof value === 'number' && Number.isSafeInteger(value) && value > 0
/** The receipt's stored user rows in turn order (prompt first, then each steer/redirect row). */
diff --git a/apps/desktop/src/app/session/hooks/use-session-actions/index.ts b/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
index cc6dace9853..5f4525234d5 100644
--- a/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
+++ b/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
@@ -2100,7 +2100,7 @@ export function useSessionActions({
const hasLiveProjection = Boolean(resumed.inflight || resumed.queued)
const preferredMessages = (() => {
- // A reply the live stream settled during the RPC is newer than this snapshot (resume-settled-turn.ts).
+ // A reply the live stream settled during the RPC is newer than this snapshot (resume-reconcile.ts).
if (
(options?.authoritativeSnapshot && resumed.messages.length === 0 && !hasLiveProjection) ||
liveTurnSettledDuringResume(resumed, resumeStartedAt, resumedSameSelectedSession)