瀏覽代碼

fix(session): remove unreachable listing branch

_Kerman 1 月之前
父節點
當前提交
95ed302c9c

+ 1 - 1
packages/session/session-persistence-jsonl/src/format.ts

@@ -397,7 +397,7 @@ export function scanLog(buffer: Buffer): SessionLogScan {
  * @param firstLine - first JSONL record without its newline.
  * @returns normalized logical header JSON, or `undefined` for invalid framing.
  */
-export function parseStoredHeaderMeta(firstLine: string): unknown {
+export function parseStoredHeaderMeta(firstLine: string): Record<string, unknown> | undefined {
   let parsed: unknown
   try {
     parsed = JSON.parse(firstLine)

+ 1 - 3
packages/session/session-persistence-jsonl/src/index.ts

@@ -605,9 +605,7 @@ export class JsonlSessionPersistence extends SessionPersistence implements Persi
         if (first === undefined) continue // empty/half-written file
         const rawMeta = parseStoredHeaderMeta(first)
         if (rawMeta === undefined) continue // not a session header
-        const rawId = typeof rawMeta === 'object' && rawMeta !== null
-          ? (rawMeta as Record<string, unknown>)['id']
-          : undefined
+        const rawId = rawMeta['id']
         const expectedId = typeof rawId === 'string'
           ? SessionId(rawId)
           : SessionId('')