@langchain/protocol
Advanced tools
+1
-1
| { | ||
| "name": "@langchain/protocol", | ||
| "version": "0.0.11", | ||
| "version": "0.0.12", | ||
| "description": "TypeScript bindings for the LangChain agent streaming protocol", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
+62
-35
@@ -439,3 +439,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" | "checkpoints" | "tasks" | "custom" | `custom:${string}`; | ||
@@ -567,3 +567,3 @@ // --- WebSocket-only subscription commands --- | ||
| // without 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 | CheckpointsEvent | CustomEvent | TasksEvent; | ||
@@ -991,2 +991,13 @@ // Causation edge for a subgraph's `started` lifecycle event. | ||
| // apply subsequent deltas against. | ||
| // The `checkpoints` channel carries a lightweight envelope (id, | ||
| // parentId, step, source) emitted once per persisted checkpoint. | ||
| // Clients reconstruct a branching/time-travel history from this | ||
| // metadata alone — the envelope provides the fork target (`id`), | ||
| // tree linkage (`parentId`), and timeline sort/label (`step`, | ||
| // `source`). Full channel state is retrieved lazily via `state.get` | ||
| // or bulk via `state.listCheckpoints`, only for the checkpoints the | ||
| // client actually inspects. Clients that want state snapshots | ||
| // alongside the timeline subscribe to both `values` and | ||
| // `checkpoints`; clients that only need timeline metadata pay only | ||
| // the envelope cost. | ||
| // ========================================================================== | ||
@@ -997,4 +1008,12 @@ // --- values (channel: "values") --- | ||
| // --- updates (channel: "updates") --- | ||
| // Per-node state deltas. | ||
| // --- checkpoints (channel: "checkpoints") --- | ||
| // Lightweight checkpoint metadata emitted once per persisted | ||
| // checkpoint. Carries only the envelope needed to build a | ||
| // branching/time-travel UI and to target `state.fork`; full | ||
| // channel state is retrieved on demand via `state.get` / | ||
| // `state.listCheckpoints`. | ||
| // A `checkpoints` event is emitted on the same superstep as the | ||
| // corresponding `values` event; clients that subscribe to both can | ||
| // correlate the pair by (namespace, step) or by adjacent `seq` | ||
| // numbers on the outer event envelope. | ||
| export interface ValuesEvent { | ||
@@ -1012,2 +1031,39 @@ method: "values"; | ||
| // Lightweight checkpoint envelope. Supplies just enough metadata | ||
| // for clients to build a branching/time-travel UI without streaming | ||
| // full channel snapshots. | ||
| export interface CheckpointsEvent { | ||
| method: "checkpoints"; | ||
| params: { | ||
| namespace: Namespace; | ||
| timestamp: Timestamp; | ||
| data: Checkpoint; | ||
| }; | ||
| } | ||
| // Origin tag matching LangGraph's CheckpointMetadata.source. | ||
| export type Checkpoint = 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 { | ||
@@ -1044,4 +1100,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 & { | ||
@@ -1058,31 +1114,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 { | ||
@@ -1089,0 +1116,0 @@ method: "tasks"; |
38278
4%1004
2.66%