fix(web): take the Session's elapsed time from Trace timestamps, so a reload stops restarting it (#124)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -71,7 +71,7 @@ import type {
|
||||
VersionResponse,
|
||||
WorkspaceFilesResponse,
|
||||
} from "@prismshadow/penguin-server/api";
|
||||
import { apiFetch } from "./client";
|
||||
import { apiFetch, apiFetchWithMeta } from "./client";
|
||||
|
||||
// Auth & user -----------------------------------------------------------------
|
||||
|
||||
@@ -246,8 +246,17 @@ export const patchSession = (sessionId: string, body: SessionPatchRequest) =>
|
||||
export const deleteSession = (sessionId: string) =>
|
||||
apiFetch<void>(`/api/sessions/${encodeURIComponent(sessionId)}`, { method: "DELETE" });
|
||||
|
||||
/**
|
||||
* History rebuild. Carries the server's clock at read time (see ApiFetchMeta.serverNowMs)
|
||||
* alongside the messages: a Task still running has no Trace entry for the event currently in
|
||||
* flight, so its elapsed can only be measured by differencing this against the Task's first
|
||||
* message timestamp — both server-side values, so no client clock offset enters the result
|
||||
* (see pushMessages).
|
||||
*/
|
||||
export const getMessages = (sessionId: string) =>
|
||||
apiFetch<MessagesResponse>(`/api/sessions/${encodeURIComponent(sessionId)}/messages`);
|
||||
apiFetchWithMeta<MessagesResponse>(
|
||||
`/api/sessions/${encodeURIComponent(sessionId)}/messages`,
|
||||
).then(({ data, serverNowMs }) => ({ ...data, serverNowMs }));
|
||||
|
||||
// Task execution, approval, abort, compaction ------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user