Skip to content

Commit feef9fc

Browse files
committed
Revert "feat(server): add transcript path groundwork"
This reverts commit 29ee011.
1 parent 35916a5 commit feef9fc

12 files changed

Lines changed: 35 additions & 143 deletions

File tree

packages/core/src/domain/types.test.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { describe, expect, expectTypeOf, it } from "vitest";
2-
import type { ProviderDefinition } from "../provider/definition";
3-
import type { Session, SessionState } from "./types";
2+
import type { SessionState } from "./types";
43
import { deriveSessionTitle, SESSION_TITLE_MAX_LENGTH } from "./types";
54

65
describe("deriveSessionTitle", () => {
@@ -43,30 +42,3 @@ describe("SessionState", () => {
4342
>();
4443
});
4544
});
46-
47-
describe("notify-hook groundwork types", () => {
48-
it("allows sessions to carry an optional transcript path", () => {
49-
expectTypeOf<Session>().toMatchTypeOf<{
50-
transcriptPath?: string;
51-
}>();
52-
});
53-
54-
it("allows provider definitions to opt into future resume and transcript helpers", () => {
55-
expectTypeOf<ProviderDefinition>().toMatchTypeOf<{
56-
buildResumeCommand?: (
57-
config: unknown,
58-
ctx: { sessionId: string; workspacePath: string; bridgeScriptPath?: string },
59-
resumeId: string
60-
) => {
61-
argv: string[];
62-
env: Record<string, string>;
63-
cwd: string;
64-
};
65-
resolveTranscriptPath?: (session: {
66-
id: string;
67-
transcriptPath?: string;
68-
providerSessionId?: string;
69-
}) => Promise<string | undefined> | string | undefined;
70-
}>();
71-
});
72-
});

packages/core/src/domain/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ export interface Session {
6666
endedAt?: number;
6767
completionPercent?: number;
6868
errorReason?: string;
69-
transcriptPath?: string;
7069
/**
7170
* Human-friendly title derived from the user's first submitted instruction
7271
* (trimmed/truncated to SESSION_TITLE_MAX_LENGTH). Assigned once on first

packages/core/src/provider/definition.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,6 @@ export interface ProviderDefinition {
4949
cwd: string;
5050
};
5151

52-
buildResumeCommand?(
53-
config: ProviderConfig,
54-
ctx: LaunchContext,
55-
resumeId: string
56-
): {
57-
argv: string[];
58-
env: Record<string, string>;
59-
cwd: string;
60-
};
61-
6252
buildSupervisorEvalCommand?(
6353
config: ProviderConfig,
6454
req: SupervisorEvalCommandRequest
@@ -76,18 +66,11 @@ export interface ProviderDefinition {
7666
// Runtime requirements
7767
requiredCommands: string[];
7868

79-
resolveTranscriptPath?(session: {
80-
id: string;
81-
transcriptPath?: string;
82-
providerSessionId?: string;
83-
}): Promise<string | undefined> | string | undefined;
84-
8569
/** PTY-output-based idle detection used by the session manager. */
8670
idleHeuristics?: IdleHeuristics;
8771
}
8872

8973
export interface LaunchContext {
9074
sessionId: string;
9175
workspacePath: string;
92-
bridgeScriptPath?: string;
9376
}

packages/server/src/__tests__/session-integration.test.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -934,32 +934,6 @@ describe("Session Integration", () => {
934934
);
935935
});
936936

937-
it("preserves persisted transcript path when hydrating a stale session", async () => {
938-
sessionDb.listHydratable = vi.fn().mockReturnValue([
939-
{
940-
id: "sess-hydrate-transcript",
941-
workspaceId: "ws-1",
942-
terminalId: "term-stale",
943-
providerId: "claude",
944-
state: "running",
945-
capability: "full",
946-
startedAt: 100,
947-
lastActiveAt: 200,
948-
transcriptPath: "/tmp/transcripts/sess-hydrate-transcript.jsonl",
949-
},
950-
]);
951-
952-
await sessionMgr.hydrate();
953-
954-
expect(sessionMgr.get("sess-hydrate-transcript")).toEqual(
955-
expect.objectContaining({
956-
id: "sess-hydrate-transcript",
957-
state: "ended",
958-
transcriptPath: "/tmp/transcripts/sess-hydrate-transcript.jsonl",
959-
})
960-
);
961-
});
962-
963937
it("marks persisted non-resumable sessions as ended when hydrating without a live terminal", async () => {
964938
sessionDb.listHydratable = vi.fn().mockReturnValue([
965939
{

packages/server/src/__tests__/session-repo.test.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,24 +100,6 @@ describe("SessionRepo", () => {
100100

101101
expect(result.completionPercent).toBe(50);
102102
});
103-
104-
it("should persist and read transcript path", () => {
105-
const newSession: NewSession = {
106-
id: "s-transcript",
107-
workspaceId: "ws-1",
108-
terminalId: "t-1",
109-
providerId: "claude-cli",
110-
state: "running",
111-
capability: "full",
112-
startedAt: Date.now(),
113-
lastActiveAt: Date.now(),
114-
transcriptPath: "/tmp/transcripts/s-transcript.jsonl",
115-
};
116-
117-
const result = repo.create(newSession);
118-
119-
expect(result.transcriptPath).toBe("/tmp/transcripts/s-transcript.jsonl");
120-
});
121103
});
122104

123105
describe("listByWorkspace", () => {

packages/server/src/server.ts

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -296,21 +296,8 @@ function createSessionDatabase(db: Database) {
296296
return {
297297
insert: (session: SessionRow) => {
298298
db.prepare(`
299-
INSERT INTO sessions (
300-
id,
301-
workspace_id,
302-
terminal_id,
303-
provider_id,
304-
state,
305-
capability,
306-
started_at,
307-
last_active_at,
308-
completion_percent,
309-
error_reason,
310-
transcript_path,
311-
title
312-
)
313-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
299+
INSERT INTO sessions (id, workspace_id, terminal_id, provider_id, state, capability, started_at, last_active_at)
300+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
314301
`).run(
315302
session.id,
316303
session.workspace_id,
@@ -319,11 +306,7 @@ function createSessionDatabase(db: Database) {
319306
session.state,
320307
session.capability,
321308
session.started_at,
322-
session.last_active_at,
323-
session.completion_percent,
324-
session.error_reason,
325-
session.transcript_path,
326-
session.title
309+
session.last_active_at
327310
);
328311
},
329312
update: (id: string, patch: Record<string, unknown>) => {
@@ -337,7 +320,6 @@ function createSessionDatabase(db: Database) {
337320
"ended_at",
338321
"completion_percent",
339322
"error_reason",
340-
"transcript_path",
341323
"last_active_at",
342324
"title",
343325
]);

packages/server/src/session/manager.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ export class SessionManager {
190190
endedAt: session.endedAt,
191191
completionPercent: session.completionPercent,
192192
errorReason: session.errorReason,
193-
transcriptPath: session.transcriptPath,
194193
});
195194

196195
this.sessions.set(session.id, hydrated);
@@ -669,7 +668,6 @@ class ActiveSession {
669668
endedAt?: number;
670669
completionPercent?: number;
671670
errorReason?: string;
672-
transcriptPath?: string;
673671
exitCode?: number;
674672
draft?: string;
675673
title?: string;
@@ -691,7 +689,6 @@ class ActiveSession {
691689
endedAt?: number;
692690
completionPercent?: number;
693691
errorReason?: string;
694-
transcriptPath?: string;
695692
}) {
696693
this.id = data.id;
697694
this.workspaceId = data.workspaceId;
@@ -706,7 +703,6 @@ class ActiveSession {
706703
this.endedAt = data.endedAt;
707704
this.completionPercent = data.completionPercent;
708705
this.errorReason = data.errorReason;
709-
this.transcriptPath = data.transcriptPath;
710706
}
711707

712708
toDTO(): Session {
@@ -722,7 +718,6 @@ class ActiveSession {
722718
endedAt: this.endedAt,
723719
completionPercent: this.completionPercent,
724720
errorReason: this.errorReason,
725-
transcriptPath: this.transcriptPath,
726721
title: this.title,
727722
};
728723
}

packages/server/src/session/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export interface SessionUpdatePatch {
1515
endedAt?: number;
1616
completionPercent?: number;
1717
errorReason?: string;
18-
transcriptPath?: string;
1918
lastActiveAt?: number;
2019
title?: string;
2120
}

packages/server/src/storage/db.test.ts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe("database schema baseline", () => {
4949
name: string;
5050
}>;
5151
expect(sessionColumns.find((column) => column.name === "resume_id")).toBeUndefined();
52-
expect(sessionColumns.find((column) => column.name === "transcript_path")).toBeDefined();
52+
expect(sessionColumns.find((column) => column.name === "transcript_path")).toBeUndefined();
5353
expect(sessionColumns.find((column) => column.name === "title")).toBeDefined();
5454

5555
const indexNames = (
@@ -120,6 +120,32 @@ describe("database schema baseline", () => {
120120
expect(() => openDatabase(dbPath)).toThrow(/Legacy database schema detected/);
121121
});
122122

123+
it("rejects a legacy database schema that still contains transcript_path", async () => {
124+
const { openDatabase } = await import("./db");
125+
126+
const db = new DatabaseSync(dbPath);
127+
db.exec(`
128+
CREATE TABLE sessions (
129+
id TEXT PRIMARY KEY,
130+
workspace_id TEXT NOT NULL,
131+
terminal_id TEXT NOT NULL,
132+
provider_id TEXT NOT NULL,
133+
capability TEXT NOT NULL,
134+
state TEXT NOT NULL,
135+
started_at INTEGER NOT NULL,
136+
ended_at INTEGER,
137+
last_active_at INTEGER NOT NULL,
138+
completion_percent INTEGER,
139+
error_reason TEXT,
140+
archived BOOLEAN DEFAULT 0,
141+
transcript_path TEXT
142+
);
143+
`);
144+
db.close();
145+
146+
expect(() => openDatabase(dbPath)).toThrow(/Legacy database schema detected/);
147+
});
148+
123149
it("rejects a legacy database schema that still contains _migrations", async () => {
124150
const { openDatabase } = await import("./db");
125151

@@ -181,7 +207,6 @@ describe("database schema baseline", () => {
181207
last_active_at INTEGER NOT NULL,
182208
completion_percent INTEGER,
183209
error_reason TEXT,
184-
transcript_path TEXT,
185210
archived BOOLEAN DEFAULT 0
186211
);
187212
@@ -264,7 +289,6 @@ describe("database schema baseline", () => {
264289
last_active_at INTEGER NOT NULL,
265290
completion_percent INTEGER,
266291
error_reason TEXT,
267-
transcript_path TEXT,
268292
archived BOOLEAN DEFAULT 0
269293
);
270294
`);

packages/server/src/storage/db.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const SCHEMA_PATH = join(import.meta.dirname, "migrations", "001_init.sql");
3333
const SCHEMA_SQL = readFileSync(SCHEMA_PATH, "utf-8");
3434

3535
const LEGACY_TABLES = ["hook_registrations", "_migrations"] as const;
36-
const LEGACY_SESSION_COLUMNS = ["resume_id"] as const;
36+
const LEGACY_SESSION_COLUMNS = ["resume_id", "transcript_path"] as const;
3737

3838
function normalizeSql(sql: string | null): string {
3939
return (sql ?? "").replace(/\s+/g, " ").trim();

0 commit comments

Comments
 (0)