Files
orca/src/main/foreign-sqlite-readers/foreign-sqlite-reader-dispatch.ts
T
OrcaWinandOrcaWin 4687e90a16 [comment audit] Continue main-process comment cleanup (#32946)
* [comment audit] Shorten daemon, hook, and emulator comments [skip ci]

* [comment audit] Shorten VM, conversation, SQLite, and theme-import comments [skip ci]

* [comment audit] Tighten Git execution and source-control comment contracts [skip ci]

* [comment audit] Clarify repository probes and maintenance comments [skip ci]

* [comment audit] Shorten status, diff-cache, and checkout comments [skip ci]

* [comment audit] Clarify worktree lifecycle and WSL routing comments [skip ci]

* [comment audit] Shorten forge identity and review-refresh comments [skip ci]

* [comment audit] Tighten hosted-review client comment contracts [skip ci]

* [comment audit] Clarify GitLab compatibility and review comments [skip ci]

* [comment audit] Tighten hook ownership and watchdog rationale [skip ci]

* [comment audit] Condense host and integration compatibility comments [skip ci]

* [comment audit] Clarify IPC authority and remote-routing rationale [skip ci]

* [comment audit] Finalize file-import and containment comment cleanup

* [comment audit] Fix stale Jira type imports blocking full CI

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
2026-10-23 16:27:37 -07:00

31 lines
1.2 KiB
TypeScript

import type {
ForeignSqliteReaderRequest,
ForeignSqliteReaderResponse
} from './foreign-sqlite-reader-protocol'
import { readCursorProfile } from './readers/cursor-profile'
import { readOpenCodeBinderSessions } from './readers/opencode-binder-sessions'
/** Structured-clone requests may carry unknown kinds despite the static type. */
export function handleForeignSqliteReaderRequest(
request: ForeignSqliteReaderRequest
): ForeignSqliteReaderResponse {
// Destructuring here preserves request narrowing through kind and exhaustiveness at never.
const { id, kind } = request
try {
switch (kind) {
case 'cursorProfile':
return { id, ok: true, value: readCursorProfile(request.dbPath) }
case 'openCodeBinderSessions':
return { id, ok: true, value: readOpenCodeBinderSessions(request.dbPath, request.cursor) }
}
return unknownKind(id, kind)
} catch (err) {
return { id, ok: false, error: err instanceof Error ? err.message : String(err) }
}
}
// never makes new unhandled request kinds a compile error.
function unknownKind(id: number, kind: never): ForeignSqliteReaderResponse {
return { id, ok: false, error: `Unknown foreign SQLite reader kind: ${String(kind)}` }
}