|
1 | | -import fs from "node:fs/promises"; |
2 | 1 | import type { |
3 | 2 | SessionTranscriptRuntimeScope, |
4 | 3 | SessionTranscriptRuntimeTarget, |
5 | 4 | } from "../../config/sessions/session-accessor.js"; |
6 | 5 | import { resolveSessionTranscriptRuntimeReadTarget } from "../../config/sessions/session-accessor.js"; |
7 | 6 | import { |
8 | 7 | persistTranscriptStateMutation, |
9 | | -readTranscriptFileState, |
10 | 8 | type TranscriptFileState, |
11 | 9 | type TranscriptPersistedEntry, |
12 | 10 | } from "./transcript-file-state.js"; |
13 | 11 | |
14 | 12 | export type RuntimeTranscriptScope = SessionTranscriptRuntimeScope; |
15 | 13 | type RuntimeTranscriptTarget = SessionTranscriptRuntimeTarget; |
16 | 14 | |
17 | | -type RuntimeTranscriptState = { |
18 | | -state: TranscriptFileState; |
19 | | -target: RuntimeTranscriptTarget; |
20 | | -}; |
21 | | - |
22 | 15 | /** |
23 | 16 | * Resolves the runtime transcript target for read/probe operations without |
24 | 17 | * linking missing file-backed metadata into the session store. |
@@ -29,19 +22,6 @@ export async function resolveRuntimeTranscriptReadTarget(
|
29 | 22 | return await resolveSessionTranscriptRuntimeReadTarget(scope); |
30 | 23 | } |
31 | 24 | |
32 | | -/** |
33 | | - * Reads transcript state through the runtime transcript identity contract. |
34 | | - */ |
35 | | -export async function readRuntimeTranscriptState( |
36 | | -scope: RuntimeTranscriptScope, |
37 | | -): Promise<RuntimeTranscriptState> { |
38 | | -const target = await resolveRuntimeTranscriptReadTarget(scope); |
39 | | -return { |
40 | | -state: await readTranscriptFileState(target.sessionFile), |
41 | | - target, |
42 | | -}; |
43 | | -} |
44 | | - |
45 | 25 | /** |
46 | 26 | * Persists an append or migration rewrite for a resolved runtime transcript. |
47 | 27 | */ |
@@ -56,34 +36,3 @@ export async function persistRuntimeTranscriptStateMutation(params: {
|
56 | 36 | appendedEntries: params.appendedEntries, |
57 | 37 | }); |
58 | 38 | } |
59 | | - |
60 | | -/** |
61 | | - * Checks existence of the current runtime transcript without exposing path |
62 | | - * identity to callers. |
63 | | - */ |
64 | | -export async function runtimeTranscriptExists(scope: RuntimeTranscriptScope): Promise<boolean> { |
65 | | -const target = await resolveRuntimeTranscriptReadTarget(scope); |
66 | | -try { |
67 | | -const stat = await fs.stat(target.sessionFile); |
68 | | -return stat.isFile(); |
69 | | -} catch { |
70 | | -return false; |
71 | | -} |
72 | | -} |
73 | | - |
74 | | -/** |
75 | | - * Deletes the current runtime transcript. This remains file-backed until the |
76 | | - * SQLite implementation owns transcript deletion in 3.2. |
77 | | - */ |
78 | | -export async function deleteRuntimeTranscript(scope: RuntimeTranscriptScope): Promise<boolean> { |
79 | | -const target = await resolveRuntimeTranscriptReadTarget(scope); |
80 | | -try { |
81 | | -await fs.unlink(target.sessionFile); |
82 | | -return true; |
83 | | -} catch (err) { |
84 | | -if ((err as NodeJS.ErrnoException).code === "ENOENT") { |
85 | | -return false; |
86 | | -} |
87 | | -throw err; |
88 | | -} |
89 | | -} |