Navigate to snapshots from the transcript
This commit is contained in:
Vendored
+9
@@ -8,6 +8,7 @@ export const state = {
|
||||
selectedTaskId: undefined,
|
||||
transcript: [],
|
||||
lastTranscriptSeq: 0,
|
||||
pinned: undefined,
|
||||
connected: false,
|
||||
};
|
||||
const listeners = new Map();
|
||||
@@ -48,6 +49,13 @@ export function findTask(id) {
|
||||
export function currentSession(taskId) {
|
||||
return state.sessions.get(taskId)?.findLast((s) => s.state !== "completed") ?? state.sessions.get(taskId)?.at(-1);
|
||||
}
|
||||
export function snapshots() {
|
||||
return state.transcript.filter((e) => e.kind === "snapshot.created").map((e) => e.payload);
|
||||
}
|
||||
export function pinSnapshot(n) {
|
||||
state.pinned = n;
|
||||
notify("pin");
|
||||
}
|
||||
export async function loadMe() {
|
||||
state.me = await get("/api/me");
|
||||
notify("me");
|
||||
@@ -95,6 +103,7 @@ export function selectTask(taskId) {
|
||||
state.selectedTaskId = taskId;
|
||||
state.transcript = [];
|
||||
state.lastTranscriptSeq = 0;
|
||||
state.pinned = undefined;
|
||||
notify("selection");
|
||||
if (!taskId) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user