Read metadata recorded for a specific message id — today exposes
parentCheckpointId, the checkpoint the message was first seen on.
Designed for fork / edit flows:
const { parentCheckpointId } = useMessageMetadata(stream, msg.id) ?? {};
if (parentCheckpointId) {
await stream.submit(input, { forkFrom: { checkpointId: parentCheckpointId } });
}
Returns undefined when the id isn't known yet (e.g. the server
hasn't emitted parent_checkpoint for that message, or the message
arrived via messages-channel deltas only and no values snapshot
has landed for it yet).
useMessageMetadata(stream: AnyStream, messageId: string | undefined): MessageMetadata | undefined| Name | Type | Description |
|---|---|---|
stream* | AnyStream | |
messageId* | string | undefined |