@langchain/protocol
Advanced tools
+1
-1
| { | ||
| "name": "@langchain/protocol", | ||
| "version": "0.0.9", | ||
| "version": "0.0.10", | ||
| "description": "TypeScript bindings for the LangChain agent streaming protocol", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
+47
-35
@@ -375,3 +375,3 @@ // ========================================================================== | ||
| // The server responds with `Content-Type: text/event-stream`. | ||
| export type Channel = "values" | "updates" | "messages" | "tools" | "lifecycle" | "input" | "debug" | "checkpoints" | "tasks" | "custom" | `custom:${string}`; | ||
| export type Channel = "values" | "updates" | "messages" | "tools" | "lifecycle" | "input" | "tasks" | "custom" | `custom:${string}`; | ||
@@ -521,3 +521,3 @@ // --- WebSocket-only subscription commands --- | ||
| // product-specific knowledge. | ||
| export type EventData = LifecycleEvent | MessagesEvent | ToolsEvent | InputEvent | ValuesEvent | UpdatesEvent | CustomEvent | DebugEvent | CheckpointsEvent | TasksEvent; | ||
| export type EventData = LifecycleEvent | MessagesEvent | ToolsEvent | InputEvent | ValuesEvent | UpdatesEvent | CustomEvent | TasksEvent; | ||
@@ -875,9 +875,21 @@ export interface LifecycleEvent { | ||
| // apply subsequent deltas against. | ||
| // The `values` channel also carries an optional lightweight checkpoint | ||
| // envelope that identifies which checkpoint captures the emitted state. | ||
| // Clients reconstruct a branching/time-travel history from this metadata | ||
| // without needing to stream full checkpoint snapshots: the envelope | ||
| // provides the fork target (`id`), tree linkage (`parentId`), timeline | ||
| // sort/label (`step`, `source`), and the client recovers full channel | ||
| // state on demand via `state.get` or bulk via `state.listCheckpoints`. | ||
| // ========================================================================== | ||
| // --- values (channel: "values") --- | ||
| // Full graph state after each step or initial snapshot. | ||
| // The optional `checkpoint` envelope identifies which checkpoint captures | ||
| // the emitted state. It is present for events that correspond to a newly | ||
| // persisted checkpoint; it is omitted for synthetic events such as | ||
| // interrupt-signalling emissions that are not tied to a new checkpoint. | ||
| export type StateResult = StateGetResult | ListCheckpointsResult | StateForkResult | EmptyResult; | ||
| // --- updates (channel: "updates") --- | ||
| // Per-node state deltas. | ||
| // Lightweight checkpoint envelope carried on `values` events. Supplies | ||
| // just enough metadata for clients to build a branching/time-travel UI | ||
| // and to target `state.fork` without streaming full channel snapshots. | ||
| export interface ValuesEvent { | ||
@@ -892,5 +904,34 @@ method: "values"; | ||
| data: any; | ||
| /** | ||
| * Checkpoint envelope for branching/time-travel | ||
| */ | ||
| checkpoint?: ValuesCheckpoint; | ||
| }; | ||
| } | ||
| // Origin tag matching LangGraph's CheckpointMetadata.source. | ||
| export type ValuesCheckpoint = Extensible & { | ||
| /** | ||
| * Fork target: pass to state.fork / configurable.checkpoint_id | ||
| */ | ||
| id: string; | ||
| /** | ||
| * Parent checkpoint id for tree linkage | ||
| */ | ||
| parent_id?: string; | ||
| /** | ||
| * Superstep number (-1 for first input, 0 for first loop step, ...) | ||
| */ | ||
| step: number; | ||
| /** | ||
| * Origin of the checkpoint | ||
| */ | ||
| source: CheckpointSource; | ||
| }; | ||
| // Created as a copy of another checkpoint | ||
| // --- updates (channel: "updates") --- | ||
| // Per-node state deltas. | ||
| export type CheckpointSource = "input" | "loop" | "update" | "fork"; | ||
| export interface UpdatesEvent { | ||
@@ -927,4 +968,4 @@ method: "updates"; | ||
| // --- debug (channel: "debug") --- | ||
| // Verbose execution traces for development. | ||
| // --- tasks (channel: "tasks") --- | ||
| // Pregel task creation or result events from the graph runtime. | ||
| export type CustomData = Extensible & { | ||
@@ -941,31 +982,2 @@ /** | ||
| // --- checkpoints (channel: "checkpoints") --- | ||
| // Checkpoint metadata emitted after each graph step. | ||
| export interface DebugEvent { | ||
| method: "debug"; | ||
| params: { | ||
| namespace: Namespace; | ||
| timestamp: Timestamp; | ||
| data: { | ||
| step: number; | ||
| type: "checkpoint" | "task" | "task_result"; | ||
| payload?: any; | ||
| }; | ||
| }; | ||
| } | ||
| // --- tasks (channel: "tasks") --- | ||
| // Pregel task creation or result events from the graph runtime. | ||
| export interface CheckpointsEvent { | ||
| method: "checkpoints"; | ||
| params: { | ||
| namespace: Namespace; | ||
| timestamp: Timestamp; | ||
| /** | ||
| * Checkpoint metadata | ||
| */ | ||
| data: any; | ||
| }; | ||
| } | ||
| export interface TasksEvent { | ||
@@ -972,0 +984,0 @@ method: "tasks"; |
33670
3.1%879
1.38%