@threadplane/coreFunctionv0.3.7

onAgentStateUpdate

Follows the render-store updates a session's runs emit, for a generated-UI render store. Built on onCustomEvent: the listener receives the data of each state_update event. Returns an idempotent release, and an inert one for a session without onCustomEvent. Like every custom event, an update is not state: nothing replays the ones sent before the listener was added.

import { onAgentStateUpdate } from '@threadplane/core';

Declaration · overload 1

export declare function onAgentStateUpdate(session: {
    onCustomEvent?(listener: (event: AgentSessionCustomEvent) => void): () => void;
}, listener: (update: Readonly<Record<string, PlainValue>>) => void): () => void;

Parameters

session · required
{ onCustomEvent?(listener: (event: AgentSessionCustomEvent) => void): () => void; }
listener · required
(update: Readonly<Record<string, PlainValue>>) => void

Returns

() => void