@squidcloud/backend 1.0.496 → 1.0.498
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/src/langgraph/index.d.ts +39 -0
- package/dist/backend/src/langgraph/langgraph-runner.d.ts +1 -0
- package/dist/backend/src/langgraph/squid-checkpointer.d.ts +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/langgraph.js +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/langgraph.js +1 -0
- package/dist/internal-common/src/public-types-backend/bundle-api.public-types.d.ts +1 -1
- package/dist/internal-common/src/public-types-backend/bundle-data.public-types.d.ts +1 -1
- package/dist/node_modules/@langchain/protocol/protocol.d.ts +760 -0
- package/package.json +24 -2
|
@@ -0,0 +1,760 @@
|
|
|
1
|
+
export type JsInt = number;
|
|
2
|
+
export type JsUint = number;
|
|
3
|
+
export type Namespace = string[];
|
|
4
|
+
export type Extensible = Record<string, any>;
|
|
5
|
+
export type Timestamp = number;
|
|
6
|
+
export type MetadataScalar = null | boolean | number | number | string;
|
|
7
|
+
export type MessageRole = "ai" | "human" | "system";
|
|
8
|
+
export interface MessageMetadata {
|
|
9
|
+
provider?: string;
|
|
10
|
+
model?: string;
|
|
11
|
+
model_type?: string;
|
|
12
|
+
run_id?: string;
|
|
13
|
+
thread_id?: string;
|
|
14
|
+
system_fingerprint?: string;
|
|
15
|
+
service_tier?: string;
|
|
16
|
+
[key: string]: MetadataScalar | undefined;
|
|
17
|
+
}
|
|
18
|
+
export type ContentBlock = TextContentBlock | InvalidToolCall | ReasoningContentBlock | NonStandardContentBlock | DataContentBlock | ToolContentBlock;
|
|
19
|
+
export type DataContentBlock = ImageContentBlock | VideoContentBlock | AudioContentBlock | FileContentBlock;
|
|
20
|
+
export type ToolContentBlock = ToolCall | ToolCallChunk | ServerToolCall | ServerToolCallChunk | ServerToolResult;
|
|
21
|
+
export type FinalizedContentBlock = TextContentBlock | ReasoningContentBlock | ToolCall | InvalidToolCall | ServerToolCall | ServerToolResult | DataContentBlock | NonStandardContentBlock;
|
|
22
|
+
export type BlockIndex = JsInt | string;
|
|
23
|
+
export type TextContentBlock = Extensible & {
|
|
24
|
+
type: string;
|
|
25
|
+
text: string;
|
|
26
|
+
id?: string;
|
|
27
|
+
index?: BlockIndex;
|
|
28
|
+
annotations?: Annotation[];
|
|
29
|
+
};
|
|
30
|
+
export type Annotation = Citation | NonStandardAnnotation;
|
|
31
|
+
export type Citation = Extensible & {
|
|
32
|
+
type: "citation";
|
|
33
|
+
id?: string;
|
|
34
|
+
url?: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
start_index?: number;
|
|
37
|
+
end_index?: number;
|
|
38
|
+
cited_text?: string;
|
|
39
|
+
};
|
|
40
|
+
export type NonStandardAnnotation = Extensible & {
|
|
41
|
+
type: "non_standard_annotation";
|
|
42
|
+
id?: string;
|
|
43
|
+
value: Record<string, any>;
|
|
44
|
+
};
|
|
45
|
+
export type ReasoningContentBlock = Extensible & {
|
|
46
|
+
type: "reasoning";
|
|
47
|
+
reasoning?: string;
|
|
48
|
+
id?: string;
|
|
49
|
+
index?: BlockIndex;
|
|
50
|
+
};
|
|
51
|
+
export type ToolCall = Extensible & {
|
|
52
|
+
type: "tool_call";
|
|
53
|
+
id: string | null;
|
|
54
|
+
name: string;
|
|
55
|
+
args: Record<string, any>;
|
|
56
|
+
index?: BlockIndex;
|
|
57
|
+
};
|
|
58
|
+
export type ToolCallChunk = Extensible & {
|
|
59
|
+
type: "tool_call_chunk";
|
|
60
|
+
id: string | null;
|
|
61
|
+
name: string | null;
|
|
62
|
+
/**
|
|
63
|
+
* Partial JSON string
|
|
64
|
+
*/
|
|
65
|
+
args: string | null;
|
|
66
|
+
index?: BlockIndex;
|
|
67
|
+
};
|
|
68
|
+
export type InvalidToolCall = Extensible & {
|
|
69
|
+
type: "invalid_tool_call";
|
|
70
|
+
id: string | null;
|
|
71
|
+
name: string | null;
|
|
72
|
+
args: string | null;
|
|
73
|
+
error: string | null;
|
|
74
|
+
index?: BlockIndex;
|
|
75
|
+
};
|
|
76
|
+
export type ServerToolCall = Extensible & {
|
|
77
|
+
type: "server_tool_call";
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
args: Record<string, any>;
|
|
81
|
+
index?: BlockIndex;
|
|
82
|
+
};
|
|
83
|
+
export type ServerToolCallChunk = Extensible & {
|
|
84
|
+
type: "server_tool_call_chunk";
|
|
85
|
+
id?: string;
|
|
86
|
+
name?: string;
|
|
87
|
+
args?: string;
|
|
88
|
+
index?: BlockIndex;
|
|
89
|
+
};
|
|
90
|
+
export type ServerToolResult = Extensible & {
|
|
91
|
+
type: "server_tool_result";
|
|
92
|
+
tool_call_id: string;
|
|
93
|
+
status: "success" | "error";
|
|
94
|
+
id?: string;
|
|
95
|
+
output?: any;
|
|
96
|
+
index?: BlockIndex;
|
|
97
|
+
};
|
|
98
|
+
export type ImageContentBlock = Extensible & {
|
|
99
|
+
type: "image";
|
|
100
|
+
id?: string;
|
|
101
|
+
file_id?: string;
|
|
102
|
+
url?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Base64-encoded image data
|
|
105
|
+
*/
|
|
106
|
+
base64?: string;
|
|
107
|
+
mime_type?: string;
|
|
108
|
+
index?: BlockIndex;
|
|
109
|
+
};
|
|
110
|
+
export type AudioContentBlock = Extensible & {
|
|
111
|
+
type: "audio";
|
|
112
|
+
id?: string;
|
|
113
|
+
file_id?: string;
|
|
114
|
+
url?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Base64-encoded audio data
|
|
117
|
+
*/
|
|
118
|
+
base64?: string;
|
|
119
|
+
mime_type?: string;
|
|
120
|
+
index?: BlockIndex;
|
|
121
|
+
};
|
|
122
|
+
export type VideoContentBlock = Extensible & {
|
|
123
|
+
type: "video";
|
|
124
|
+
id?: string;
|
|
125
|
+
file_id?: string;
|
|
126
|
+
url?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Base64-encoded video data
|
|
129
|
+
*/
|
|
130
|
+
base64?: string;
|
|
131
|
+
mime_type?: string;
|
|
132
|
+
index?: BlockIndex;
|
|
133
|
+
};
|
|
134
|
+
export type FileContentBlock = Extensible & {
|
|
135
|
+
type: "file";
|
|
136
|
+
id?: string;
|
|
137
|
+
file_id?: string;
|
|
138
|
+
url?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Base64-encoded file data
|
|
141
|
+
*/
|
|
142
|
+
base64?: string;
|
|
143
|
+
mime_type?: string;
|
|
144
|
+
index?: BlockIndex;
|
|
145
|
+
};
|
|
146
|
+
export type NonStandardContentBlock = Extensible & {
|
|
147
|
+
type: "non_standard";
|
|
148
|
+
value: Record<string, any>;
|
|
149
|
+
id?: string;
|
|
150
|
+
index?: BlockIndex;
|
|
151
|
+
};
|
|
152
|
+
export type TextDelta = Extensible & {
|
|
153
|
+
type: "text-delta";
|
|
154
|
+
text: string;
|
|
155
|
+
};
|
|
156
|
+
export type ReasoningDelta = Extensible & {
|
|
157
|
+
type: "reasoning-delta";
|
|
158
|
+
reasoning: string;
|
|
159
|
+
};
|
|
160
|
+
export type DataDelta = Extensible & {
|
|
161
|
+
type: "data-delta";
|
|
162
|
+
/**
|
|
163
|
+
* Encoded data chunk to append
|
|
164
|
+
*/
|
|
165
|
+
data: string;
|
|
166
|
+
/**
|
|
167
|
+
* Defaults to base64 when absent
|
|
168
|
+
*/
|
|
169
|
+
encoding?: "base64";
|
|
170
|
+
};
|
|
171
|
+
export interface BlockDeltaFields {
|
|
172
|
+
type: string;
|
|
173
|
+
[key: string]: any | undefined;
|
|
174
|
+
}
|
|
175
|
+
export type BlockDelta = Extensible & {
|
|
176
|
+
type: "block-delta";
|
|
177
|
+
fields: BlockDeltaFields;
|
|
178
|
+
};
|
|
179
|
+
export type ContentBlockDelta = TextDelta | ReasoningDelta | DataDelta | BlockDelta;
|
|
180
|
+
export type Command = CommandData & Extensible & {
|
|
181
|
+
id: JsUint;
|
|
182
|
+
};
|
|
183
|
+
export type CommandData = RunCommand | SubscriptionCommand | AgentCommand | InputCommand | StateCommand;
|
|
184
|
+
export type Message = CommandResponse | ErrorResponse | Event;
|
|
185
|
+
export type CommandResponse = Extensible & {
|
|
186
|
+
type: "success";
|
|
187
|
+
id: JsUint;
|
|
188
|
+
result: ResultData;
|
|
189
|
+
meta?: ResponseMeta;
|
|
190
|
+
};
|
|
191
|
+
export type ErrorResponse = Extensible & {
|
|
192
|
+
type: "error";
|
|
193
|
+
id: JsUint | null;
|
|
194
|
+
error: ErrorCode;
|
|
195
|
+
message: string;
|
|
196
|
+
stacktrace?: string;
|
|
197
|
+
meta?: ResponseMeta;
|
|
198
|
+
};
|
|
199
|
+
export type Event = EventData & Extensible & {
|
|
200
|
+
type: "event";
|
|
201
|
+
/**
|
|
202
|
+
* Unique ID for reconnection (maps to SSE id:)
|
|
203
|
+
*/
|
|
204
|
+
event_id?: string;
|
|
205
|
+
/**
|
|
206
|
+
* Monotonic sequence number for ordering
|
|
207
|
+
*/
|
|
208
|
+
seq?: JsUint;
|
|
209
|
+
};
|
|
210
|
+
export type ResultData = RunResult | SubscriptionResult | AgentResult | InputResult | StateResult | EmptyResult;
|
|
211
|
+
export type EmptyResult = Extensible;
|
|
212
|
+
export type ErrorCode = "invalid_argument" | "unknown_command" | "unknown_error" | "no_such_run" | "no_such_subscription" | "no_such_namespace" | "no_such_interrupt" | "no_such_checkpoint" | "permission_denied" | "not_supported";
|
|
213
|
+
export type ResponseMeta = Extensible & {
|
|
214
|
+
applied_through_seq?: JsUint;
|
|
215
|
+
};
|
|
216
|
+
export type RunCommand = RunStart;
|
|
217
|
+
export interface RunStart {
|
|
218
|
+
method: "run.start";
|
|
219
|
+
params: RunStartParams;
|
|
220
|
+
}
|
|
221
|
+
export interface LangSmithTracer {
|
|
222
|
+
/**
|
|
223
|
+
* Additional LangSmith project receiving the trace
|
|
224
|
+
*/
|
|
225
|
+
project_name?: string;
|
|
226
|
+
/**
|
|
227
|
+
* LangSmith dataset example associated with the trace
|
|
228
|
+
*/
|
|
229
|
+
example_id?: string;
|
|
230
|
+
}
|
|
231
|
+
export interface RunStartParams {
|
|
232
|
+
/**
|
|
233
|
+
* Deployed graph/agent to run
|
|
234
|
+
*/
|
|
235
|
+
assistant_id: string;
|
|
236
|
+
/**
|
|
237
|
+
* Graph input, resume value, or injected message
|
|
238
|
+
*/
|
|
239
|
+
input: any;
|
|
240
|
+
/**
|
|
241
|
+
* Per-run config overrides
|
|
242
|
+
*/
|
|
243
|
+
config?: Record<string, any>;
|
|
244
|
+
/**
|
|
245
|
+
* Per-run metadata
|
|
246
|
+
*/
|
|
247
|
+
metadata?: Record<string, any>;
|
|
248
|
+
/**
|
|
249
|
+
* Optional additional LangSmith trace destination
|
|
250
|
+
*/
|
|
251
|
+
langsmith_tracer?: LangSmithTracer;
|
|
252
|
+
}
|
|
253
|
+
export interface RunResult {
|
|
254
|
+
/**
|
|
255
|
+
* ID of the started or resumed run
|
|
256
|
+
*/
|
|
257
|
+
run_id?: string;
|
|
258
|
+
}
|
|
259
|
+
export type Channel = "values" | "updates" | "messages" | "tools" | "lifecycle" | "input" | "checkpoints" | "tasks" | "custom" | `custom:${string}`;
|
|
260
|
+
export type EventStreamRequest = Extensible & {
|
|
261
|
+
channels: Channel[];
|
|
262
|
+
/**
|
|
263
|
+
* Prefix-match these namespace paths
|
|
264
|
+
*/
|
|
265
|
+
namespaces?: Namespace[];
|
|
266
|
+
/**
|
|
267
|
+
* Max depth below namespace prefix
|
|
268
|
+
*/
|
|
269
|
+
depth?: number;
|
|
270
|
+
/**
|
|
271
|
+
* Replay events after this seq number
|
|
272
|
+
*/
|
|
273
|
+
since?: JsUint;
|
|
274
|
+
};
|
|
275
|
+
export type SubscriptionCommand = SubscriptionSubscribe | SubscriptionUnsubscribe | SubscriptionReconnect;
|
|
276
|
+
export interface SubscriptionSubscribe {
|
|
277
|
+
method: "subscription.subscribe";
|
|
278
|
+
params: SubscribeParams;
|
|
279
|
+
}
|
|
280
|
+
export type SubscribeParams = Extensible & {
|
|
281
|
+
channels: Channel[];
|
|
282
|
+
/**
|
|
283
|
+
* Prefix-match these namespace paths
|
|
284
|
+
*/
|
|
285
|
+
namespaces?: Namespace[];
|
|
286
|
+
/**
|
|
287
|
+
* Max depth below namespace prefix
|
|
288
|
+
*/
|
|
289
|
+
depth?: number;
|
|
290
|
+
};
|
|
291
|
+
export type SubscribeResult = Extensible & {
|
|
292
|
+
subscription_id: string;
|
|
293
|
+
/**
|
|
294
|
+
* Events replayed from buffer
|
|
295
|
+
*/
|
|
296
|
+
replayed_events?: number;
|
|
297
|
+
};
|
|
298
|
+
export interface SubscriptionUnsubscribe {
|
|
299
|
+
method: "subscription.unsubscribe";
|
|
300
|
+
params: UnsubscribeParams;
|
|
301
|
+
}
|
|
302
|
+
export type UnsubscribeParams = Extensible & {
|
|
303
|
+
subscription_id: string;
|
|
304
|
+
};
|
|
305
|
+
export interface SubscriptionReconnect {
|
|
306
|
+
method: "subscription.reconnect";
|
|
307
|
+
params: ReconnectParams;
|
|
308
|
+
}
|
|
309
|
+
export type ReconnectParams = Extensible & {
|
|
310
|
+
run_id: string;
|
|
311
|
+
/**
|
|
312
|
+
* Last event the client processed
|
|
313
|
+
*/
|
|
314
|
+
last_event_id?: string;
|
|
315
|
+
/**
|
|
316
|
+
* Subscription IDs to restore
|
|
317
|
+
*/
|
|
318
|
+
subscriptions?: string[];
|
|
319
|
+
};
|
|
320
|
+
export type ReconnectResult = Extensible & {
|
|
321
|
+
restored: boolean;
|
|
322
|
+
missed_events?: number;
|
|
323
|
+
current_namespaces?: AgentStatusEntry[];
|
|
324
|
+
};
|
|
325
|
+
export type AgentStatusEntry = Extensible & {
|
|
326
|
+
namespace: Namespace;
|
|
327
|
+
status: AgentStatus;
|
|
328
|
+
};
|
|
329
|
+
export type SubscriptionResult = SubscribeResult | ReconnectResult | EmptyResult;
|
|
330
|
+
export type AgentCommand = AgentGetTree;
|
|
331
|
+
export interface AgentGetTree {
|
|
332
|
+
method: "agent.getTree";
|
|
333
|
+
params: AgentGetTreeParams;
|
|
334
|
+
}
|
|
335
|
+
export interface AgentGetTreeParams {
|
|
336
|
+
run_id?: string;
|
|
337
|
+
}
|
|
338
|
+
export interface AgentTreeNode {
|
|
339
|
+
namespace: Namespace;
|
|
340
|
+
status: AgentStatus;
|
|
341
|
+
graph_name: string;
|
|
342
|
+
children?: AgentTreeNode[];
|
|
343
|
+
metadata?: Record<string, any>;
|
|
344
|
+
}
|
|
345
|
+
export interface AgentResult {
|
|
346
|
+
tree: AgentTreeNode;
|
|
347
|
+
}
|
|
348
|
+
export type AgentStatus = "started" | "running" | "completed" | "failed" | "interrupted";
|
|
349
|
+
export type EventData = LifecycleEvent | MessagesEvent | ToolsEvent | InputEvent | ValuesEvent | UpdatesEvent | CheckpointsEvent | CustomEvent | TasksEvent;
|
|
350
|
+
export interface LifecycleEvent {
|
|
351
|
+
method: "lifecycle";
|
|
352
|
+
params: {
|
|
353
|
+
namespace: Namespace;
|
|
354
|
+
timestamp: Timestamp;
|
|
355
|
+
data: LifecycleData;
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
export type LifecycleCause = LifecycleCauseToolCall | LifecycleCauseSend | LifecycleCauseEdge;
|
|
359
|
+
export interface LifecycleCauseToolCall {
|
|
360
|
+
/**
|
|
361
|
+
* The `tool_call_id` from the originating `tool-started` event
|
|
362
|
+
*/
|
|
363
|
+
type: "toolCall";
|
|
364
|
+
/**
|
|
365
|
+
* on the parent namespace. Matches the `id` field of the
|
|
366
|
+
* originating `tool_call` content block in the parent AI message.
|
|
367
|
+
*/
|
|
368
|
+
tool_call_id: string;
|
|
369
|
+
}
|
|
370
|
+
export interface LifecycleCauseSend {
|
|
371
|
+
/**
|
|
372
|
+
* Name of the parent node that issued the `Send`. Multiple Sends
|
|
373
|
+
*/
|
|
374
|
+
type: "send";
|
|
375
|
+
/**
|
|
376
|
+
* from the same node in the same superstep share this value;
|
|
377
|
+
* future protocol versions may add a disambiguating `sendIndex`
|
|
378
|
+
* if per-Send identity is needed on the wire.
|
|
379
|
+
*/
|
|
380
|
+
from_node: string;
|
|
381
|
+
}
|
|
382
|
+
export interface LifecycleCauseEdge {
|
|
383
|
+
/**
|
|
384
|
+
* Name of the parent node the edge originated from.
|
|
385
|
+
*/
|
|
386
|
+
type: "edge";
|
|
387
|
+
from_node: string;
|
|
388
|
+
}
|
|
389
|
+
export interface LifecycleData {
|
|
390
|
+
event: AgentStatus;
|
|
391
|
+
graph_name?: string;
|
|
392
|
+
/**
|
|
393
|
+
* Causation edge (see LifecycleCause)
|
|
394
|
+
*/
|
|
395
|
+
cause?: LifecycleCause;
|
|
396
|
+
error?: string;
|
|
397
|
+
/**
|
|
398
|
+
* Checkpoint reference for time-travel
|
|
399
|
+
*/
|
|
400
|
+
checkpoint?: CheckpointRef;
|
|
401
|
+
}
|
|
402
|
+
export interface MessagesEvent {
|
|
403
|
+
method: "messages";
|
|
404
|
+
params: {
|
|
405
|
+
namespace: Namespace;
|
|
406
|
+
timestamp: Timestamp;
|
|
407
|
+
/**
|
|
408
|
+
* Graph node that produced this event
|
|
409
|
+
*/
|
|
410
|
+
node?: string;
|
|
411
|
+
data: MessagesData;
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
export type MessagesData = MessageStartData | ContentBlockStartData | ContentBlockDeltaData | ContentBlockFinishData | MessageFinishData | MessageErrorData;
|
|
415
|
+
export type MessageStartData = Extensible & {
|
|
416
|
+
event: "message-start";
|
|
417
|
+
/**
|
|
418
|
+
* Author role for this message
|
|
419
|
+
*/
|
|
420
|
+
role: MessageRole;
|
|
421
|
+
/**
|
|
422
|
+
* Unique ID for this message
|
|
423
|
+
*/
|
|
424
|
+
id: string;
|
|
425
|
+
/**
|
|
426
|
+
* Concise provider/model metadata for AI messages
|
|
427
|
+
*/
|
|
428
|
+
metadata?: MessageMetadata;
|
|
429
|
+
};
|
|
430
|
+
export type ContentBlockStartData = Extensible & {
|
|
431
|
+
event: "content-block-start";
|
|
432
|
+
/**
|
|
433
|
+
* Positional index within the message
|
|
434
|
+
*/
|
|
435
|
+
index: number;
|
|
436
|
+
content: ContentBlock;
|
|
437
|
+
};
|
|
438
|
+
export type ContentBlockDeltaData = Extensible & {
|
|
439
|
+
event: "content-block-delta";
|
|
440
|
+
index: number;
|
|
441
|
+
delta: ContentBlockDelta;
|
|
442
|
+
};
|
|
443
|
+
export type ContentBlockFinishData = Extensible & {
|
|
444
|
+
event: "content-block-finish";
|
|
445
|
+
index: number;
|
|
446
|
+
content: FinalizedContentBlock;
|
|
447
|
+
};
|
|
448
|
+
export type MessageFinishData = Extensible & {
|
|
449
|
+
event: "message-finish";
|
|
450
|
+
/**
|
|
451
|
+
* Token usage for AI-authored messages
|
|
452
|
+
*/
|
|
453
|
+
usage?: UsageInfo;
|
|
454
|
+
};
|
|
455
|
+
export type InputTokenDetails = Extensible & {
|
|
456
|
+
audio?: number;
|
|
457
|
+
cache_creation?: number;
|
|
458
|
+
cache_read?: number;
|
|
459
|
+
};
|
|
460
|
+
export type OutputTokenDetails = Extensible & {
|
|
461
|
+
audio?: number;
|
|
462
|
+
reasoning?: number;
|
|
463
|
+
};
|
|
464
|
+
export type UsageInfo = Extensible & {
|
|
465
|
+
input_tokens?: number;
|
|
466
|
+
output_tokens?: number;
|
|
467
|
+
total_tokens?: number;
|
|
468
|
+
input_token_details?: InputTokenDetails;
|
|
469
|
+
output_token_details?: OutputTokenDetails;
|
|
470
|
+
};
|
|
471
|
+
export type MessageErrorData = Extensible & {
|
|
472
|
+
event: "error";
|
|
473
|
+
message: string;
|
|
474
|
+
code?: string;
|
|
475
|
+
};
|
|
476
|
+
export interface ToolsEvent {
|
|
477
|
+
method: "tools";
|
|
478
|
+
params: {
|
|
479
|
+
namespace: Namespace;
|
|
480
|
+
timestamp: Timestamp;
|
|
481
|
+
/**
|
|
482
|
+
* Graph node executing the tool
|
|
483
|
+
*/
|
|
484
|
+
node?: string;
|
|
485
|
+
data: ToolsData;
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
export type ToolsData = ToolStartedData | ToolOutputDeltaData | ToolFinishedData | ToolErrorData;
|
|
489
|
+
export type ToolStartedData = Extensible & {
|
|
490
|
+
event: "tool-started";
|
|
491
|
+
tool_call_id: string;
|
|
492
|
+
tool_name: string;
|
|
493
|
+
/**
|
|
494
|
+
* Tool input arguments
|
|
495
|
+
*/
|
|
496
|
+
input?: any;
|
|
497
|
+
};
|
|
498
|
+
export type ToolOutputDeltaData = Extensible & {
|
|
499
|
+
event: "tool-output-delta";
|
|
500
|
+
tool_call_id: string;
|
|
501
|
+
delta: string;
|
|
502
|
+
};
|
|
503
|
+
export type ToolFinishedData = Extensible & {
|
|
504
|
+
event: "tool-finished";
|
|
505
|
+
tool_call_id: string;
|
|
506
|
+
output: any;
|
|
507
|
+
};
|
|
508
|
+
export type ToolErrorData = Extensible & {
|
|
509
|
+
event: "tool-error";
|
|
510
|
+
tool_call_id: string;
|
|
511
|
+
message: string;
|
|
512
|
+
code?: string;
|
|
513
|
+
};
|
|
514
|
+
export type InputCommand = InputRespond | InputInject;
|
|
515
|
+
export interface InputRespond {
|
|
516
|
+
method: "input.respond";
|
|
517
|
+
params: InputRespondParams;
|
|
518
|
+
}
|
|
519
|
+
export type InputRespondParams = InputRespondOne | InputRespondMany;
|
|
520
|
+
export interface RunSend {
|
|
521
|
+
/**
|
|
522
|
+
* Target graph node
|
|
523
|
+
*/
|
|
524
|
+
node: string;
|
|
525
|
+
/**
|
|
526
|
+
* Per-send input passed to the node
|
|
527
|
+
*/
|
|
528
|
+
input?: any;
|
|
529
|
+
}
|
|
530
|
+
export type Goto = string | RunSend | (string | RunSend)[];
|
|
531
|
+
export interface InputRespondOne {
|
|
532
|
+
namespace: Namespace;
|
|
533
|
+
interrupt_id: string;
|
|
534
|
+
response: any;
|
|
535
|
+
/**
|
|
536
|
+
* State update applied in the same superstep as the resume (LangGraph Command(update=...))
|
|
537
|
+
*/
|
|
538
|
+
update?: Record<string, any>;
|
|
539
|
+
/**
|
|
540
|
+
* Directed jump applied in the same superstep as the resume (LangGraph Command(goto=...))
|
|
541
|
+
*/
|
|
542
|
+
goto?: Goto;
|
|
543
|
+
/**
|
|
544
|
+
* Per-run config overrides
|
|
545
|
+
*/
|
|
546
|
+
config?: Record<string, any>;
|
|
547
|
+
/**
|
|
548
|
+
* Per-run metadata
|
|
549
|
+
*/
|
|
550
|
+
metadata?: Record<string, any>;
|
|
551
|
+
}
|
|
552
|
+
export interface InputRespondMany {
|
|
553
|
+
responses: InputRespondEntry[];
|
|
554
|
+
/**
|
|
555
|
+
* State update applied in the same superstep as the resume (LangGraph Command(update=...))
|
|
556
|
+
*/
|
|
557
|
+
update?: Record<string, any>;
|
|
558
|
+
/**
|
|
559
|
+
* Directed jump applied in the same superstep as the resume (LangGraph Command(goto=...))
|
|
560
|
+
*/
|
|
561
|
+
goto?: Goto;
|
|
562
|
+
/**
|
|
563
|
+
* Per-run config overrides
|
|
564
|
+
*/
|
|
565
|
+
config?: Record<string, any>;
|
|
566
|
+
/**
|
|
567
|
+
* Per-run metadata
|
|
568
|
+
*/
|
|
569
|
+
metadata?: Record<string, any>;
|
|
570
|
+
}
|
|
571
|
+
export interface InputRespondEntry {
|
|
572
|
+
namespace: Namespace;
|
|
573
|
+
interrupt_id: string;
|
|
574
|
+
response: any;
|
|
575
|
+
}
|
|
576
|
+
export interface InputInject {
|
|
577
|
+
method: "input.inject";
|
|
578
|
+
params: InputInjectParams;
|
|
579
|
+
}
|
|
580
|
+
export interface InputInjectParams {
|
|
581
|
+
namespace: Namespace;
|
|
582
|
+
message: InputMessage;
|
|
583
|
+
}
|
|
584
|
+
export type InputMessage = Extensible & {
|
|
585
|
+
role: "user" | "system";
|
|
586
|
+
content: string;
|
|
587
|
+
name?: string;
|
|
588
|
+
};
|
|
589
|
+
export type InputResult = EmptyResult;
|
|
590
|
+
export interface InputEvent {
|
|
591
|
+
method: "input.requested";
|
|
592
|
+
params: {
|
|
593
|
+
namespace: Namespace;
|
|
594
|
+
timestamp: Timestamp;
|
|
595
|
+
data: InputRequestedData;
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
export type InputRequestedData = Extensible & {
|
|
599
|
+
/**
|
|
600
|
+
* Correlates this request with input.respond
|
|
601
|
+
*/
|
|
602
|
+
interrupt_id: string;
|
|
603
|
+
/**
|
|
604
|
+
* Opaque interrupt value from runtime; application-defined shape
|
|
605
|
+
*/
|
|
606
|
+
payload: any;
|
|
607
|
+
};
|
|
608
|
+
export type StateCommand = StateGet | StateListCheckpoints | StateFork;
|
|
609
|
+
export interface StateGet {
|
|
610
|
+
method: "state.get";
|
|
611
|
+
params: StateGetParams;
|
|
612
|
+
}
|
|
613
|
+
export interface StateGetParams {
|
|
614
|
+
namespace: Namespace;
|
|
615
|
+
/**
|
|
616
|
+
* Specific state keys, or omit for all
|
|
617
|
+
*/
|
|
618
|
+
keys?: string[];
|
|
619
|
+
}
|
|
620
|
+
export interface StateGetResult {
|
|
621
|
+
values: Record<string, any>;
|
|
622
|
+
checkpoint?: CheckpointRef;
|
|
623
|
+
}
|
|
624
|
+
export interface StateListCheckpoints {
|
|
625
|
+
method: "state.listCheckpoints";
|
|
626
|
+
params: ListCheckpointsParams;
|
|
627
|
+
}
|
|
628
|
+
export interface ListCheckpointsParams {
|
|
629
|
+
namespace?: Namespace;
|
|
630
|
+
limit?: number;
|
|
631
|
+
/**
|
|
632
|
+
* Cursor for pagination
|
|
633
|
+
*/
|
|
634
|
+
before?: string;
|
|
635
|
+
}
|
|
636
|
+
export interface ListCheckpointsResult {
|
|
637
|
+
checkpoints: CheckpointSummary[];
|
|
638
|
+
}
|
|
639
|
+
export interface CheckpointSummary {
|
|
640
|
+
id: string;
|
|
641
|
+
/**
|
|
642
|
+
* ISO 8601
|
|
643
|
+
*/
|
|
644
|
+
timestamp: string;
|
|
645
|
+
step: number;
|
|
646
|
+
/**
|
|
647
|
+
* Node that produced this checkpoint
|
|
648
|
+
*/
|
|
649
|
+
node_name?: string;
|
|
650
|
+
metadata?: Record<string, any>;
|
|
651
|
+
}
|
|
652
|
+
export interface CheckpointRef {
|
|
653
|
+
id: string;
|
|
654
|
+
ns?: string;
|
|
655
|
+
}
|
|
656
|
+
export interface StateFork {
|
|
657
|
+
method: "state.fork";
|
|
658
|
+
params: StateForkParams;
|
|
659
|
+
}
|
|
660
|
+
export interface StateForkParams {
|
|
661
|
+
checkpoint_id: string;
|
|
662
|
+
/**
|
|
663
|
+
* Input for the forked run
|
|
664
|
+
*/
|
|
665
|
+
input?: any;
|
|
666
|
+
/**
|
|
667
|
+
* Config overrides
|
|
668
|
+
*/
|
|
669
|
+
config?: Record<string, any>;
|
|
670
|
+
}
|
|
671
|
+
export interface StateForkResult {
|
|
672
|
+
run_id: string;
|
|
673
|
+
thread_id: string;
|
|
674
|
+
}
|
|
675
|
+
export type StateResult = StateGetResult | ListCheckpointsResult | StateForkResult | EmptyResult;
|
|
676
|
+
export interface ValuesEvent {
|
|
677
|
+
method: "values";
|
|
678
|
+
params: {
|
|
679
|
+
namespace: Namespace;
|
|
680
|
+
timestamp: Timestamp;
|
|
681
|
+
/**
|
|
682
|
+
* Full graph state after step
|
|
683
|
+
*/
|
|
684
|
+
data: any;
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
export interface CheckpointsEvent {
|
|
688
|
+
method: "checkpoints";
|
|
689
|
+
params: {
|
|
690
|
+
namespace: Namespace;
|
|
691
|
+
timestamp: Timestamp;
|
|
692
|
+
data: Checkpoint;
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
export type Checkpoint = Extensible & {
|
|
696
|
+
/**
|
|
697
|
+
* Fork target: pass to state.fork / configurable.checkpoint_id
|
|
698
|
+
*/
|
|
699
|
+
id: string;
|
|
700
|
+
/**
|
|
701
|
+
* Parent checkpoint id for tree linkage
|
|
702
|
+
*/
|
|
703
|
+
parent_id?: string;
|
|
704
|
+
/**
|
|
705
|
+
* Superstep number (-1 for first input, 0 for first loop step, ...)
|
|
706
|
+
*/
|
|
707
|
+
step: number;
|
|
708
|
+
/**
|
|
709
|
+
* Origin of the checkpoint
|
|
710
|
+
*/
|
|
711
|
+
source: CheckpointSource;
|
|
712
|
+
};
|
|
713
|
+
export type CheckpointSource = "input" | "loop" | "update" | "fork";
|
|
714
|
+
export interface UpdatesEvent {
|
|
715
|
+
method: "updates";
|
|
716
|
+
params: {
|
|
717
|
+
namespace: Namespace;
|
|
718
|
+
timestamp: Timestamp;
|
|
719
|
+
data: UpdatesData;
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
export type UpdatesData = Extensible & {
|
|
723
|
+
/**
|
|
724
|
+
* Graph node that produced this update
|
|
725
|
+
*/
|
|
726
|
+
node?: string;
|
|
727
|
+
/**
|
|
728
|
+
* State delta
|
|
729
|
+
*/
|
|
730
|
+
values: Record<string, any>;
|
|
731
|
+
};
|
|
732
|
+
export interface CustomEvent {
|
|
733
|
+
method: "custom";
|
|
734
|
+
params: {
|
|
735
|
+
namespace: Namespace;
|
|
736
|
+
timestamp: Timestamp;
|
|
737
|
+
data: CustomData;
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
export type CustomData = Extensible & {
|
|
741
|
+
/**
|
|
742
|
+
* Custom event name for dispatch
|
|
743
|
+
*/
|
|
744
|
+
name?: string;
|
|
745
|
+
/**
|
|
746
|
+
* User-defined payload
|
|
747
|
+
*/
|
|
748
|
+
payload: any;
|
|
749
|
+
};
|
|
750
|
+
export interface TasksEvent {
|
|
751
|
+
method: "tasks";
|
|
752
|
+
params: {
|
|
753
|
+
namespace: Namespace;
|
|
754
|
+
timestamp: Timestamp;
|
|
755
|
+
/**
|
|
756
|
+
* Task creation or result
|
|
757
|
+
*/
|
|
758
|
+
data: any;
|
|
759
|
+
};
|
|
760
|
+
}
|