mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-05-16 01:12:46 +00:00
feat: add jsonlPath to session data and database schema
This commit is contained in:
@@ -45,6 +45,7 @@ export async function processClaudeSessions() {
|
||||
result.sessionName,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
file,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ export async function processCodexSessions() {
|
||||
result.sessionName,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
file,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,6 +174,7 @@ export async function processCursorSessions() {
|
||||
result.sessionName,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
file,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ export async function processGeminiSessions() {
|
||||
result.sessionName,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
file,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ const onUpdate = async (
|
||||
sessionName,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
filePath,
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -56,6 +56,7 @@ export const runMigrations = (db: Database) => {
|
||||
const sessionColumnNames = sessionsTableInfo.map((col) => col.name);
|
||||
addColumnToTableIfNotExists(db, "sessions", sessionColumnNames, "created_at", "DATETIME");
|
||||
addColumnToTableIfNotExists(db, "sessions", sessionColumnNames, "updated_at", "DATETIME");
|
||||
addColumnToTableIfNotExists(db, "sessions", sessionColumnNames, "jsonl_path", "TEXT");
|
||||
db.exec("UPDATE sessions SET created_at = COALESCE(created_at, CURRENT_TIMESTAMP)");
|
||||
db.exec("UPDATE sessions SET updated_at = COALESCE(updated_at, CURRENT_TIMESTAMP)");
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ type SessionNameLookupRow = {
|
||||
|
||||
type SessionMetadataLookupRow = Pick<
|
||||
SessionsRow,
|
||||
'session_id' | 'provider' | 'workspace_path' | 'created_at' | 'updated_at'
|
||||
'session_id' | 'provider' | 'workspace_path' | 'jsonl_path' | 'created_at' | 'updated_at'
|
||||
>;
|
||||
|
||||
function normalizeTimestamp(value?: string): string | null {
|
||||
@@ -65,6 +65,7 @@ export const sessionsDb = {
|
||||
customName?: string,
|
||||
createdAt?: string,
|
||||
updatedAt?: string,
|
||||
jsonlPath?: string | null,
|
||||
): void {
|
||||
const db = getConnection();
|
||||
const createdAtValue = normalizeTimestamp(createdAt);
|
||||
@@ -76,13 +77,22 @@ export const sessionsDb = {
|
||||
workspaceOriginalPathsDb.createWorkspacePath(normalizedWorkspacePath);
|
||||
|
||||
db.prepare(
|
||||
`INSERT INTO sessions (session_id, provider, custom_name, workspace_path, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, COALESCE(?, CURRENT_TIMESTAMP), COALESCE(?, CURRENT_TIMESTAMP))
|
||||
`INSERT INTO sessions (session_id, provider, custom_name, workspace_path, jsonl_path, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, COALESCE(?, CURRENT_TIMESTAMP), COALESCE(?, CURRENT_TIMESTAMP))
|
||||
ON CONFLICT(session_id) DO UPDATE SET
|
||||
updated_at = excluded.updated_at,
|
||||
workspace_path = excluded.workspace_path
|
||||
workspace_path = excluded.workspace_path,
|
||||
jsonl_path = excluded.jsonl_path
|
||||
WHERE sessions.provider = excluded.provider`
|
||||
).run(session_id, provider, customName, normalizedWorkspacePath, createdAtValue, updatedAtValue);
|
||||
).run(
|
||||
session_id,
|
||||
provider,
|
||||
customName,
|
||||
normalizedWorkspacePath,
|
||||
jsonlPath ?? null,
|
||||
createdAtValue,
|
||||
updatedAtValue,
|
||||
);
|
||||
},
|
||||
|
||||
/** Updates a custom session name by session id, regardless of provider. */
|
||||
@@ -109,7 +119,7 @@ export const sessionsDb = {
|
||||
const db = getConnection();
|
||||
const row = db
|
||||
.prepare(
|
||||
`SELECT session_id, provider, workspace_path, created_at, updated_at
|
||||
`SELECT session_id, provider, workspace_path, jsonl_path, created_at, updated_at
|
||||
FROM sessions
|
||||
WHERE session_id = ?`
|
||||
)
|
||||
@@ -122,7 +132,7 @@ export const sessionsDb = {
|
||||
const db = getConnection();
|
||||
return db
|
||||
.prepare(
|
||||
`SELECT session_id, provider, workspace_path, custom_name, created_at, updated_at
|
||||
`SELECT session_id, provider, workspace_path, jsonl_path, custom_name, created_at, updated_at
|
||||
FROM sessions`
|
||||
)
|
||||
.all() as SessionsRow[];
|
||||
@@ -132,7 +142,7 @@ export const sessionsDb = {
|
||||
const db = getConnection();
|
||||
return db
|
||||
.prepare(
|
||||
`SELECT session_id, provider, workspace_path, custom_name, created_at, updated_at
|
||||
`SELECT session_id, provider, workspace_path, jsonl_path, custom_name, created_at, updated_at
|
||||
FROM sessions
|
||||
WHERE workspace_path = ?`
|
||||
)
|
||||
|
||||
@@ -75,6 +75,7 @@ CREATE TABLE IF NOT EXISTS sessions (
|
||||
provider TEXT NOT NULL,
|
||||
custom_name TEXT,
|
||||
workspace_path TEXT NOT NULL,
|
||||
jsonl_path TEXT,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (workspace_path) REFERENCES workspace_original_paths(workspace_path)
|
||||
|
||||
@@ -100,6 +100,7 @@ export type SessionsRow = {
|
||||
session_id: string;
|
||||
provider: LLMProvider;
|
||||
workspace_path: string;
|
||||
jsonl_path: string | null;
|
||||
custom_name: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
|
||||
@@ -2,4 +2,5 @@ export type SessionData = {
|
||||
sessionId: string;
|
||||
workspacePath: string;
|
||||
sessionName?: string;
|
||||
jsonlPath?: string | null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user