Files
zk-data-agent/frontend/app/lib/claw-session-replay.tsx
T
2026-05-06 16:18:32 +08:00

27 lines
668 B
TypeScript

"use client";
import type { ExportedMessageRepository } from "@assistant-ui/core";
import { createContext, useContext } from "react";
type ClawSessionReplayContextValue = {
replaySession: (
sessionId: string,
repository: ExportedMessageRepository,
) => void;
};
const ClawSessionReplayContext =
createContext<ClawSessionReplayContextValue | null>(null);
export const ClawSessionReplayProvider = ClawSessionReplayContext.Provider;
export function useClawSessionReplay() {
const value = useContext(ClawSessionReplayContext);
if (!value) {
throw new Error(
"useClawSessionReplay must be used within ClawSessionReplayProvider",
);
}
return value;
}