10xgraph-client 0.6.0 → 1.0.0-rc.2

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.
Files changed (149) hide show
  1. package/CHANGELOG.md +207 -0
  2. package/README.md +11 -5
  3. package/dist/agent.d.ts +17 -5
  4. package/dist/agent.d.ts.map +1 -1
  5. package/dist/cjs/agent.d.ts +33 -0
  6. package/dist/cjs/client.d.ts +533 -0
  7. package/dist/cjs/compat.d.ts +27 -0
  8. package/dist/cjs/endpoints/addThreadMessages.d.ts +25 -0
  9. package/dist/cjs/endpoints/clearThreadState.d.ts +14 -0
  10. package/dist/cjs/endpoints/deleteFile.d.ts +13 -0
  11. package/dist/cjs/endpoints/deleteMemory.d.ts +18 -0
  12. package/dist/cjs/endpoints/deleteThread.d.ts +18 -0
  13. package/dist/cjs/endpoints/deleteThreadMessage.d.ts +19 -0
  14. package/dist/cjs/endpoints/files.d.ts +115 -0
  15. package/dist/cjs/endpoints/fixGraph.d.ts +33 -0
  16. package/dist/cjs/endpoints/forgetMemories.d.ts +21 -0
  17. package/dist/cjs/endpoints/getMemory.d.ts +18 -0
  18. package/dist/cjs/endpoints/graph.d.ts +50 -0
  19. package/dist/cjs/endpoints/graphTools.d.ts +31 -0
  20. package/dist/cjs/endpoints/invoke.d.ts +66 -0
  21. package/dist/cjs/endpoints/listMemories.d.ts +24 -0
  22. package/dist/cjs/endpoints/metadata.d.ts +5 -0
  23. package/dist/cjs/endpoints/observability.d.ts +111 -0
  24. package/dist/cjs/endpoints/ping.d.ts +9 -0
  25. package/dist/cjs/endpoints/realtime.d.ts +154 -0
  26. package/dist/cjs/endpoints/searchMemory.d.ts +56 -0
  27. package/dist/cjs/endpoints/stateSchema.d.ts +49 -0
  28. package/dist/cjs/endpoints/stopGraph.d.ts +35 -0
  29. package/dist/cjs/endpoints/storeMemory.d.ts +32 -0
  30. package/dist/cjs/endpoints/stream.d.ts +67 -0
  31. package/dist/cjs/endpoints/threadDetails.d.ts +18 -0
  32. package/dist/cjs/endpoints/threadMessage.d.ts +16 -0
  33. package/dist/cjs/endpoints/threadMessages.d.ts +28 -0
  34. package/dist/cjs/endpoints/threadState.d.ts +13 -0
  35. package/dist/cjs/endpoints/threads.d.ts +35 -0
  36. package/dist/cjs/endpoints/updateMemory.d.ts +20 -0
  37. package/dist/cjs/endpoints/updateThreadMessageFeedback.d.ts +19 -0
  38. package/dist/cjs/endpoints/updateThreadState.d.ts +22 -0
  39. package/dist/cjs/endpoints/wsStream.d.ts +34 -0
  40. package/dist/cjs/errors.d.ts +212 -0
  41. package/dist/cjs/index.d.ts +41 -0
  42. package/dist/cjs/interrupt.d.ts +45 -0
  43. package/dist/cjs/message.d.ts +173 -0
  44. package/dist/cjs/package.json +1 -0
  45. package/dist/cjs/request.d.ts +60 -0
  46. package/dist/cjs/tools.d.ts +80 -0
  47. package/dist/cjs/ws.d.ts +47 -0
  48. package/dist/client.d.ts +95 -40
  49. package/dist/client.d.ts.map +1 -1
  50. package/dist/endpoints/addThreadMessages.d.ts +4 -0
  51. package/dist/endpoints/addThreadMessages.d.ts.map +1 -1
  52. package/dist/endpoints/clearThreadState.d.ts.map +1 -1
  53. package/dist/endpoints/deleteFile.d.ts +14 -0
  54. package/dist/endpoints/deleteFile.d.ts.map +1 -0
  55. package/dist/endpoints/deleteMemory.d.ts.map +1 -1
  56. package/dist/endpoints/deleteThread.d.ts.map +1 -1
  57. package/dist/endpoints/deleteThreadMessage.d.ts.map +1 -1
  58. package/dist/endpoints/files.d.ts +33 -0
  59. package/dist/endpoints/files.d.ts.map +1 -1
  60. package/dist/endpoints/fixGraph.d.ts +8 -3
  61. package/dist/endpoints/fixGraph.d.ts.map +1 -1
  62. package/dist/endpoints/forgetMemories.d.ts.map +1 -1
  63. package/dist/endpoints/getMemory.d.ts.map +1 -1
  64. package/dist/endpoints/graph.d.ts +20 -8
  65. package/dist/endpoints/graph.d.ts.map +1 -1
  66. package/dist/endpoints/graphTools.d.ts.map +1 -1
  67. package/dist/endpoints/invoke.d.ts +8 -0
  68. package/dist/endpoints/invoke.d.ts.map +1 -1
  69. package/dist/endpoints/listMemories.d.ts +6 -0
  70. package/dist/endpoints/listMemories.d.ts.map +1 -1
  71. package/dist/endpoints/observability.d.ts +54 -0
  72. package/dist/endpoints/observability.d.ts.map +1 -1
  73. package/dist/endpoints/ping.d.ts.map +1 -1
  74. package/dist/endpoints/realtime.d.ts +25 -4
  75. package/dist/endpoints/realtime.d.ts.map +1 -1
  76. package/dist/endpoints/searchMemory.d.ts.map +1 -1
  77. package/dist/endpoints/stateSchema.d.ts.map +1 -1
  78. package/dist/endpoints/stopGraph.d.ts +13 -3
  79. package/dist/endpoints/stopGraph.d.ts.map +1 -1
  80. package/dist/endpoints/storeMemory.d.ts.map +1 -1
  81. package/dist/endpoints/stream.d.ts +8 -0
  82. package/dist/endpoints/stream.d.ts.map +1 -1
  83. package/dist/endpoints/threadDetails.d.ts.map +1 -1
  84. package/dist/endpoints/threadMessage.d.ts.map +1 -1
  85. package/dist/endpoints/threadMessages.d.ts +6 -0
  86. package/dist/endpoints/threadMessages.d.ts.map +1 -1
  87. package/dist/endpoints/threadState.d.ts.map +1 -1
  88. package/dist/endpoints/threads.d.ts +6 -0
  89. package/dist/endpoints/threads.d.ts.map +1 -1
  90. package/dist/endpoints/updateMemory.d.ts.map +1 -1
  91. package/dist/endpoints/updateThreadMessageFeedback.d.ts +20 -0
  92. package/dist/endpoints/updateThreadMessageFeedback.d.ts.map +1 -0
  93. package/dist/endpoints/updateThreadState.d.ts +6 -1
  94. package/dist/endpoints/updateThreadState.d.ts.map +1 -1
  95. package/dist/endpoints/wsStream.d.ts +2 -0
  96. package/dist/endpoints/wsStream.d.ts.map +1 -1
  97. package/dist/errors.d.ts +60 -2
  98. package/dist/errors.d.ts.map +1 -1
  99. package/dist/index.cjs +3 -3
  100. package/dist/index.cjs.map +1 -1
  101. package/dist/index.d.ts +3 -0
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +1742 -1217
  104. package/dist/index.js.map +1 -1
  105. package/dist/interrupt.d.ts +46 -0
  106. package/dist/interrupt.d.ts.map +1 -0
  107. package/dist/request.d.ts +28 -0
  108. package/dist/request.d.ts.map +1 -1
  109. package/dist/tools.d.ts +14 -0
  110. package/dist/tools.d.ts.map +1 -1
  111. package/package.json +11 -6
  112. package/src/agent.ts +17 -4
  113. package/src/client.ts +248 -128
  114. package/src/endpoints/addThreadMessages.ts +15 -10
  115. package/src/endpoints/clearThreadState.ts +19 -20
  116. package/src/endpoints/deleteFile.ts +65 -0
  117. package/src/endpoints/deleteMemory.ts +9 -13
  118. package/src/endpoints/deleteThread.ts +9 -13
  119. package/src/endpoints/deleteThreadMessage.ts +9 -13
  120. package/src/endpoints/files.ts +164 -131
  121. package/src/endpoints/fixGraph.ts +15 -16
  122. package/src/endpoints/forgetMemories.ts +44 -60
  123. package/src/endpoints/getMemory.ts +9 -9
  124. package/src/endpoints/graph.ts +28 -21
  125. package/src/endpoints/graphTools.ts +7 -13
  126. package/src/endpoints/invoke.ts +105 -84
  127. package/src/endpoints/listMemories.ts +18 -13
  128. package/src/endpoints/observability.ts +77 -34
  129. package/src/endpoints/ping.ts +7 -13
  130. package/src/endpoints/realtime.ts +101 -39
  131. package/src/endpoints/searchMemory.ts +19 -13
  132. package/src/endpoints/stateSchema.ts +7 -13
  133. package/src/endpoints/stopGraph.ts +20 -16
  134. package/src/endpoints/storeMemory.ts +7 -8
  135. package/src/endpoints/stream.ts +179 -61
  136. package/src/endpoints/threadDetails.ts +9 -14
  137. package/src/endpoints/threadMessage.ts +9 -9
  138. package/src/endpoints/threadMessages.ts +15 -9
  139. package/src/endpoints/threadState.ts +19 -20
  140. package/src/endpoints/threads.ts +13 -12
  141. package/src/endpoints/updateMemory.ts +9 -9
  142. package/src/endpoints/updateThreadMessageFeedback.ts +80 -0
  143. package/src/endpoints/updateThreadState.ts +28 -22
  144. package/src/endpoints/wsStream.ts +167 -42
  145. package/src/errors.ts +332 -93
  146. package/src/index.ts +9 -0
  147. package/src/interrupt.ts +60 -0
  148. package/src/request.ts +134 -0
  149. package/src/tools.ts +95 -0
@@ -0,0 +1,533 @@
1
+ import { ToolHandler, ToolRegistration } from './tools.js';
2
+ import { Message } from './message.js';
3
+ import { PingResponse } from './endpoints/ping.js';
4
+ import { GraphResponse } from './endpoints/graph.js';
5
+ import { GraphToolsResponse } from './endpoints/graphTools.js';
6
+ import { ObservabilityResponse } from './endpoints/observability.js';
7
+ import { StateSchemaResponse } from './endpoints/stateSchema.js';
8
+ import { ThreadStateResponse } from './endpoints/threadState.js';
9
+ import { UpdateThreadStateResponse } from './endpoints/updateThreadState.js';
10
+ import { ClearThreadStateResponse } from './endpoints/clearThreadState.js';
11
+ import { ThreadMessagesRequest, ThreadMessagesResponse } from './endpoints/threadMessages.js';
12
+ import { AddThreadMessagesResponse } from './endpoints/addThreadMessages.js';
13
+ import { ThreadMessageResponse } from './endpoints/threadMessage.js';
14
+ import { ThreadDetailsResponse } from './endpoints/threadDetails.js';
15
+ import { DeleteThreadMessageResponse } from './endpoints/deleteThreadMessage.js';
16
+ import { UpdateThreadMessageFeedbackResponse } from './endpoints/updateThreadMessageFeedback.js';
17
+ import { DeleteThreadResponse } from './endpoints/deleteThread.js';
18
+ import { ThreadsRequest, ThreadsResponse } from './endpoints/threads.js';
19
+ import { InvokeResult, InvokeCallback } from './endpoints/invoke.js';
20
+ import { StreamChunk } from './endpoints/stream.js';
21
+ import { RealtimeSession, RealtimeInit, RealtimeOptions } from './endpoints/realtime.js';
22
+ import type { WebSocketImpl } from './ws.js';
23
+ import { StoreMemoryRequest, StoreMemoryResponse } from './endpoints/storeMemory.js';
24
+ import { SearchMemoryRequest, SearchMemoryResponse } from './endpoints/searchMemory.js';
25
+ import { GetMemoryResponse } from './endpoints/getMemory.js';
26
+ import { UpdateMemoryResponse } from './endpoints/updateMemory.js';
27
+ import { DeleteMemoryResponse } from './endpoints/deleteMemory.js';
28
+ import { ListMemoriesResponse } from './endpoints/listMemories.js';
29
+ import { ForgetMemoriesResponse } from './endpoints/forgetMemories.js';
30
+ import { StopGraphResponse } from './endpoints/stopGraph.js';
31
+ import { FixGraphResponse } from './endpoints/fixGraph.js';
32
+ import { ListFilesRequest, ListFilesResponse, FileUploadResponse, FileAccessUrlResponse, FileInfoResponse, MultimodalConfigResponse } from './endpoints/files.js';
33
+ import { DeleteFileResponse } from './endpoints/deleteFile.js';
34
+ import { TenxGraphAuth, RequestOptions } from './request.js';
35
+ export interface TenxGraphConfig {
36
+ baseUrl: string;
37
+ /**
38
+ * Bearer token, or a function returning one. A function is called before every request,
39
+ * so a short-lived JWT can be refreshed without rebuilding the client.
40
+ */
41
+ authToken?: string | null | (() => string | null | undefined);
42
+ auth?: TenxGraphAuth | null;
43
+ headers?: HeadersInit;
44
+ credentials?: RequestCredentials;
45
+ timeout?: number;
46
+ debug?: boolean;
47
+ webSocketImpl?: WebSocketImpl;
48
+ }
49
+ export declare class TenxGraphClient {
50
+ private baseUrl;
51
+ private authToken?;
52
+ private auth?;
53
+ private headers?;
54
+ private credentials?;
55
+ private timeout;
56
+ private debug;
57
+ private webSocketImpl?;
58
+ private toolExecutor;
59
+ constructor(config: TenxGraphConfig);
60
+ /**
61
+ * Replace the bearer token used for later requests (for example after a refresh).
62
+ * Does not touch an open stream or socket.
63
+ */
64
+ setAuthToken(token: string | null | (() => string | null | undefined)): void;
65
+ /** Drop the bearer token and any `auth` credentials. Later requests are sent without them. */
66
+ clearAuth(): void;
67
+ private createContext;
68
+ /**
69
+ * Register a tool for remote execution
70
+ */
71
+ registerTool(registration: ToolRegistration): void;
72
+ /**
73
+ * Register only the client-side implementation of a remote tool.
74
+ * The trusted schema must be declared in the server's 10xgraph.json.
75
+ */
76
+ registerToolHandler(name: string, handler: ToolHandler): void;
77
+ /**
78
+ * Ping the server to check connectivity
79
+ */
80
+ ping(options?: RequestOptions): Promise<PingResponse>;
81
+ /**
82
+ * Fetch the agent graph
83
+ */
84
+ graph(options?: RequestOptions): Promise<GraphResponse>;
85
+ /**
86
+ * Fetch the tools exposed by the graph's tool nodes, grouped by node.
87
+ * Each tool is tagged with its source (local / mcp / remote).
88
+ */
89
+ graphTools(options?: RequestOptions): Promise<GraphToolsResponse>;
90
+ /**
91
+ * Fetch the reconstructed observability trace (spans, events, cost) for a
92
+ * thread. Returns the latest run by default, or a specific run when given.
93
+ */
94
+ observability(threadId: string, runId?: string, options?: RequestOptions): Promise<ObservabilityResponse>;
95
+ /**
96
+ * Stop a running graph execution for a specific thread
97
+ * @param threadId - The ID of the thread to stop execution for
98
+ * @param config - Optional configuration for the stop operation
99
+ * @returns StopGraphResponse with the stop operation result
100
+ */
101
+ stopGraph(threadId: string, config?: Record<string, any>, options?: RequestOptions): Promise<StopGraphResponse>;
102
+ /**
103
+ * Repair a thread whose run stopped after the model asked for tools but before
104
+ * the results were saved. The server removes assistant messages with unanswered
105
+ * tool calls (matched by tool call id) and tool results whose call no longer
106
+ * exists. Unanswered calls of the latest assistant message are kept while the
107
+ * thread is paused (interrupt, client tool call or human approval). When nothing
108
+ * needs fixing, removed_count is 0 and the state is not written.
109
+ *
110
+ * @param threadId - The ID of the thread to fix state for
111
+ * @param config - Optional configuration for the fix operation
112
+ * @returns FixGraphResponse with the fix operation result including removed_count
113
+ */
114
+ fixGraph(threadId: string, config?: Record<string, any>, options?: RequestOptions): Promise<FixGraphResponse>;
115
+ /**
116
+ *
117
+
118
+ /**
119
+ * Fetch the state schema of the agent
120
+ */
121
+ graphStateSchema(options?: RequestOptions): Promise<StateSchemaResponse>;
122
+ /**
123
+ * ***************** ALL THREAD APIS *****************
124
+ */
125
+ /**
126
+ * Fetch the state of a specific thread
127
+ * @param threadId - The ID of the thread to fetch state for
128
+ * @returns ThreadStateResponse containing the thread's current state
129
+ */
130
+ threadState(threadId: string | number, options?: RequestOptions): Promise<ThreadStateResponse>;
131
+ /**
132
+ * Update the state of a specific thread (checkpoint)
133
+ * @param threadId - The ID of the thread to update
134
+ * @param config - Configuration map for the thread
135
+ * @param state - New AgentState for the thread
136
+ * @returns UpdateThreadStateResponse with the updated state
137
+ */
138
+ updateThreadState(threadId: string | number, config: Record<string, any>, state: any, // AgentState
139
+ options?: RequestOptions): Promise<UpdateThreadStateResponse>;
140
+ /**
141
+ * Clear the state of a specific thread (delete checkpoint)
142
+ * @param threadId - The ID of the thread to clear state for
143
+ * @returns ClearThreadStateResponse with the clear operation result
144
+ */
145
+ clearThreadState(threadId: string | number, options?: RequestOptions): Promise<ClearThreadStateResponse>;
146
+ /**
147
+ * Fetch details for a specific thread
148
+ * @param threadId - The ID of the thread to fetch
149
+ * @returns ThreadDetailsResponse containing thread details
150
+ */
151
+ threadDetails(threadId: string | number, options?: RequestOptions): Promise<ThreadDetailsResponse>;
152
+ /**
153
+ * Fetch list of threads with optional search and pagination
154
+ * @param search - Optional search term to filter threads
155
+ * @param offset - Optional offset for pagination (default 0)
156
+ * @param limit - Optional limit for pagination (default no limit)
157
+ * @returns ThreadsResponse containing the list of threads and metadata
158
+ */
159
+ threads(): Promise<ThreadsResponse>;
160
+ threads(request: ThreadsRequest, options?: RequestOptions): Promise<ThreadsResponse>;
161
+ /**
162
+ * Fetch messages from a specific thread with optional search and pagination
163
+ * @param threadId - The ID of the thread to fetch messages from
164
+ * @param search - Optional search term to filter messages
165
+ * @param offset - Optional offset for pagination (default 0)
166
+ * @param limit - Optional limit for pagination (default no limit)
167
+ * @returns ThreadMessagesResponse containing the messages and metadata
168
+ */
169
+ threadMessages(threadId: string | number, request: Omit<ThreadMessagesRequest, 'threadId'>, options?: RequestOptions): Promise<ThreadMessagesResponse>;
170
+ /**
171
+ * Add messages to a specific thread checkpoint
172
+ *
173
+ * @deprecated Requires the `checkpointer:import` scope (admin only) in 10xgraph-api releases after 0.9.0.
174
+ * Use `updateThreadMessageFeedback` to attach feedback to a message.
175
+ *
176
+ * @param threadId - The ID of the thread to add messages to
177
+ * @param messages - Array of messages to add to the checkpoint
178
+ * @param config - Configuration map for the checkpoint
179
+ * @param metadata - Optional metadata for the checkpoint
180
+ * @returns AddCheckpointMessagesResponse containing the operation result
181
+ */
182
+ addThreadMessages(threadId: string | number, messages: Message[], config?: Record<string, any>, metadata?: Record<string, any>, options?: RequestOptions): Promise<AddThreadMessagesResponse>;
183
+ /**
184
+ * Fetch a specific message from a thread by message ID
185
+ * @param threadId - The ID of the thread
186
+ * @param messageId - The ID of the message to fetch
187
+ * @returns ThreadMessageResponse containing the message and metadata
188
+ */
189
+ singleMessage(threadId: string | number, messageId: string, options?: RequestOptions): Promise<ThreadMessageResponse>;
190
+ /**
191
+ * Delete a specific message from a thread
192
+ * @param threadId - The ID of the thread
193
+ * @param messageId - The ID of the message to delete
194
+ * @param config - Optional configuration map to send with the request body
195
+ * @returns DeleteThreadMessageResponse containing the deletion result
196
+ */
197
+ deleteMessage(threadId: string | number, messageId: string, config?: Record<string, any>, options?: RequestOptions): Promise<DeleteThreadMessageResponse>;
198
+ /**
199
+ * Replace the feedback attached to a message (`message.metadata.feedback`).
200
+ * Nothing else on the message changes.
201
+ * @param threadId - The ID of the thread
202
+ * @param messageId - The ID of the message to attach feedback to
203
+ * @param feedback - Any JSON object, at most 8192 serialized bytes and nesting depth 10
204
+ * @returns UpdateThreadMessageFeedbackResponse containing the updated message
205
+ */
206
+ updateThreadMessageFeedback(threadId: string | number, messageId: string, feedback: Record<string, unknown>, options?: RequestOptions): Promise<UpdateThreadMessageFeedbackResponse>;
207
+ /**
208
+ * Delete a specific thread
209
+ * @param threadId - The ID of the thread to delete
210
+ * @param config - Optional configuration map to send with the request body
211
+ * @returns DeleteThreadResponse containing the deletion result
212
+ */
213
+ deleteThread(threadId: string | number, config?: Record<string, any>, options?: RequestOptions): Promise<DeleteThreadResponse>;
214
+ /**
215
+ * Invoke the agent graph with automatic tool execution loop
216
+ * @param messages - Array of messages to send
217
+ * @param options - Invoke options
218
+ * @returns InvokeResult with all messages and intermediate steps
219
+ */
220
+ invoke(messages: Message[], options?: {
221
+ initial_state?: Record<string, any>;
222
+ config?: Record<string, any>;
223
+ recursion_limit?: number;
224
+ on_busy?: 'wait' | 'cancel';
225
+ resume?: unknown;
226
+ interrupt_id?: string;
227
+ response_granularity?: 'full' | 'partial' | 'low';
228
+ /** Abort to cancel the request (and the open stream or socket). */
229
+ signal?: AbortSignal;
230
+ onPartialResult?: InvokeCallback;
231
+ }): Promise<InvokeResult>;
232
+ /**
233
+ * Stream invoke to the agent graph
234
+ * Returns an async iterable that yields stream chunks as they arrive
235
+ *
236
+ * @param messages - Array of messages to send
237
+ * @param options - Stream options
238
+ * @returns AsyncGenerator of StreamChunk objects
239
+ *
240
+ * @example
241
+ * ```ts
242
+ * const stream = client.streamInvoke([userMessage], {
243
+ * initial_state: {},
244
+ * response_granularity: 'low'
245
+ * });
246
+ *
247
+ * for await (const chunk of stream) {
248
+ * if (chunk.event === 'message') {
249
+ * console.log('Message:', chunk.message?.content);
250
+ * } else if (chunk.event === 'updates') {
251
+ * console.log('State updated:', chunk.state);
252
+ * }
253
+ * }
254
+ * ```
255
+ */
256
+ stream(messages: Message[], options?: {
257
+ initial_state?: Record<string, any>;
258
+ config?: Record<string, any>;
259
+ recursion_limit?: number;
260
+ on_busy?: 'wait' | 'cancel';
261
+ resume?: unknown;
262
+ interrupt_id?: string;
263
+ response_granularity?: 'full' | 'partial' | 'low';
264
+ /** Abort to cancel the request (and the open stream or socket). */
265
+ signal?: AbortSignal;
266
+ }): AsyncGenerator<StreamChunk, void, unknown>;
267
+ /**
268
+ * Stream invoke via a persistent WebSocket connection.
269
+ *
270
+ * Identical API to ``stream()`` — same message types, same chunk format,
271
+ * same tool-execution loop — but uses a single WebSocket instead of one
272
+ * HTTP request per tool-call iteration. Switch from ``stream()`` to
273
+ * ``wsStream()`` by changing one method name; everything else stays the
274
+ * same.
275
+ *
276
+ * The WebSocket stays open for the full lifecycle of the call (fresh run +
277
+ * any resume runs triggered by remote tool calls). The server sends a
278
+ * ``{ event:"updates", data:{ status:"done" } }`` chunk after each run so
279
+ * the client knows when to send the next resume request.
280
+ *
281
+ * Auth: the bearer token is sent via the ``10xgraph-bearer`` WebSocket
282
+ * subprotocol (browser-safe; never placed in the URL), with the Authorization
283
+ * header also set on Node runtimes.
284
+ *
285
+ * @param messages - Array of messages to send
286
+ * @param options - Same options as ``stream()``
287
+ * @returns AsyncGenerator of StreamChunk objects
288
+ *
289
+ * @example
290
+ * ```ts
291
+ * const stream = client.wsStream([userMessage], {
292
+ * config: { thread_id: 'my-thread' },
293
+ * response_granularity: 'low',
294
+ * });
295
+ *
296
+ * for await (const chunk of stream) {
297
+ * if (chunk.event === 'message') {
298
+ * console.log('Message:', chunk.message?.content);
299
+ * }
300
+ * }
301
+ * ```
302
+ */
303
+ wsStream(messages: Message[], options?: {
304
+ initial_state?: Record<string, any>;
305
+ config?: Record<string, any>;
306
+ recursion_limit?: number;
307
+ on_busy?: 'wait' | 'cancel';
308
+ resume?: unknown;
309
+ interrupt_id?: string;
310
+ response_granularity?: 'full' | 'partial' | 'low';
311
+ /** Abort to cancel the request (and the open stream or socket). */
312
+ signal?: AbortSignal;
313
+ }): AsyncGenerator<StreamChunk, void, unknown>;
314
+ /**
315
+ * Open a realtime (audio-to-audio) session over ``/v1/graph/live``.
316
+ *
317
+ * Transport-only: send PCM16 input via ``session.sendAudio(...)`` and receive
318
+ * PCM16 output via ``session.on('audio', ...)``. Mic capture and audio playback
319
+ * are the caller's responsibility. The session auto-reconnects (with backoff)
320
+ * on an unexpected drop and resumes the same ``thread_id``.
321
+ *
322
+ * @example
323
+ * ```ts
324
+ * const session = client.realtime({ model: 'gemini-3.8-live' });
325
+ * session.on('audio', (pcm) => speaker.write(pcm));
326
+ * session.on('output_transcript', (e) => console.log(e.text));
327
+ * await session.ready;
328
+ * session.sendAudio(micChunk);
329
+ * ```
330
+ */
331
+ realtime(init: RealtimeInit, options?: RealtimeOptions): RealtimeSession;
332
+ /**
333
+ * Store a memory in the agent's memory system
334
+ *
335
+ * @param request - Memory storage request parameters
336
+ * @returns Promise<StoreMemoryResponse> containing the memory_id
337
+ *
338
+ * @example
339
+ * ```ts
340
+ * const result = await client.storeMemory({
341
+ * content: "User prefers dark mode",
342
+ * memory_type: MemoryType.SEMANTIC,
343
+ * category: "preferences",
344
+ * metadata: { source: "user_settings" }
345
+ * });
346
+ * console.log('Memory stored with ID:', result.data.memory_id);
347
+ * ```
348
+ */
349
+ storeMemory(request: StoreMemoryRequest, options?: RequestOptions): Promise<StoreMemoryResponse>;
350
+ /**
351
+ * Search for memories in the agent's memory system
352
+ *
353
+ * @param request - Memory search request parameters
354
+ * @returns Promise<SearchMemoryResponse> containing matching memories
355
+ *
356
+ * @example
357
+ * ```ts
358
+ * const results = await client.searchMemory({
359
+ * query: "dark mode preferences",
360
+ * memory_type: MemoryType.SEMANTIC,
361
+ * limit: 5,
362
+ * retrieval_strategy: RetrievalStrategy.SIMILARITY
363
+ * });
364
+ * results.data.results.forEach(result => {
365
+ * console.log('Memory:', result.content, 'Score:', result.score);
366
+ * });
367
+ * ```
368
+ */
369
+ searchMemory(request: SearchMemoryRequest, options?: RequestOptions): Promise<SearchMemoryResponse>;
370
+ /**
371
+ * Get a specific memory by ID
372
+ *
373
+ * @param memoryId - The ID of the memory to retrieve
374
+ * @param options - Optional config and options
375
+ * @returns Promise<GetMemoryResponse> containing the memory details
376
+ *
377
+ * @example
378
+ * ```ts
379
+ * const memory = await client.getMemory('mem-12345', {
380
+ * config: { include_vector: true }
381
+ * });
382
+ * console.log('Memory:', memory.data.memory.content);
383
+ * console.log('Score:', memory.data.memory.score);
384
+ * ```
385
+ */
386
+ getMemory(memoryId: string, options?: {
387
+ config?: Record<string, any>;
388
+ options?: Record<string, any>;
389
+ signal?: AbortSignal;
390
+ }): Promise<GetMemoryResponse>;
391
+ /**
392
+ * Update an existing memory by ID
393
+ *
394
+ * @param memoryId - The ID of the memory to update
395
+ * @param content - The updated content for the memory
396
+ * @param options - Optional config, options, and metadata
397
+ * @returns Promise<UpdateMemoryResponse> containing success status and updated data
398
+ *
399
+ * @example
400
+ * ```ts
401
+ * const result = await client.updateMemory('mem-12345', 'Updated content', {
402
+ * metadata: { tags: ['important', 'updated'] }
403
+ * });
404
+ * console.log('Update success:', result.data.success);
405
+ * ```
406
+ */
407
+ updateMemory(memoryId: string, content: string, options?: {
408
+ config?: Record<string, any>;
409
+ options?: Record<string, any>;
410
+ metadata?: Record<string, any>;
411
+ signal?: AbortSignal;
412
+ }): Promise<UpdateMemoryResponse>;
413
+ /**
414
+ * Delete a memory by ID
415
+ *
416
+ * @param memoryId - The ID of the memory to delete
417
+ * @param options - Optional config and options
418
+ * @returns Promise<DeleteMemoryResponse> containing success status and deletion confirmation
419
+ *
420
+ * @example
421
+ * ```ts
422
+ * const result = await client.deleteMemory('mem-12345', {
423
+ * config: { soft_delete: true }
424
+ * });
425
+ * console.log('Delete success:', result.data.success);
426
+ * console.log('Deleted:', result.data.data);
427
+ * ```
428
+ */
429
+ deleteMemory(memoryId: string, options?: {
430
+ config?: Record<string, any>;
431
+ options?: Record<string, any>;
432
+ signal?: AbortSignal;
433
+ }): Promise<DeleteMemoryResponse>;
434
+ /**
435
+ * List all memories with optional pagination
436
+ *
437
+ * @param options - Optional config, options, and limit
438
+ * @returns Promise<ListMemoriesResponse> containing array of memories
439
+ *
440
+ * @example
441
+ * ```ts
442
+ * const result = await client.listMemories({
443
+ * limit: 50,
444
+ * config: { include_vectors: false }
445
+ * });
446
+ * console.log('Found memories:', result.data.memories.length);
447
+ * result.data.memories.forEach(memory => {
448
+ * console.log('Memory:', memory.content, 'Type:', memory.memory_type);
449
+ * });
450
+ * ```
451
+ */
452
+ listMemories(options?: {
453
+ config?: Record<string, any>;
454
+ options?: Record<string, any>;
455
+ limit?: number;
456
+ offset?: number;
457
+ signal?: AbortSignal;
458
+ }): Promise<ListMemoriesResponse>;
459
+ /**
460
+ * Forget (delete) memories based on filters and criteria
461
+ *
462
+ * @param options - Optional config, options, memory type, category, and filters
463
+ * @returns Promise<ForgetMemoriesResponse> containing success status
464
+ *
465
+ * @example
466
+ * ```ts
467
+ * // Forget all episodic memories in a category
468
+ * const result = await client.forgetMemories({
469
+ * memory_type: MemoryType.EPISODIC,
470
+ * category: 'temporary',
471
+ * filters: { tag: 'delete-me' }
472
+ * });
473
+ * console.log('Forget success:', result.data.success);
474
+ * ```
475
+ */
476
+ forgetMemories(options?: {
477
+ config?: Record<string, any>;
478
+ options?: Record<string, any>;
479
+ memory_type?: any;
480
+ category?: string;
481
+ filters?: Record<string, any>;
482
+ signal?: AbortSignal;
483
+ }): Promise<ForgetMemoriesResponse>;
484
+ /**
485
+ * Upload a file (image, audio, document) to the server.
486
+ * Returns file metadata including file_id for use in multimodal messages.
487
+ *
488
+ * @param file - A File, Blob, or { data: Blob; filename: string } object
489
+ * @returns FileUploadResponse with file_id and metadata
490
+ *
491
+ * @example
492
+ * ```ts
493
+ * const result = await client.uploadFile(file);
494
+ * const msg = Message.withImage('Describe this', result.data.url);
495
+ * ```
496
+ */
497
+ uploadFile(file: File | Blob | {
498
+ data: Blob;
499
+ filename: string;
500
+ }, options?: RequestOptions): Promise<FileUploadResponse>;
501
+ /**
502
+ * Download a file by its file_id. Returns raw Blob.
503
+ */
504
+ getFile(fileId: string, options?: RequestOptions): Promise<Blob>;
505
+ /**
506
+ * List the caller's uploaded files (GET /v1/files).
507
+ * Throws a TenxGraphError with status 501 when the media store cannot enumerate files.
508
+ */
509
+ listFiles(params?: ListFilesRequest, options?: RequestOptions): Promise<ListFilesResponse>;
510
+ /**
511
+ * Get metadata about a stored file.
512
+ */
513
+ getFileInfo(fileId: string, options?: RequestOptions): Promise<FileInfoResponse>;
514
+ /**
515
+ * Get the best access URL for a stored file.
516
+ * For cloud-backed media this will typically be a signed URL.
517
+ * For local or memory-backed media this may fall back to the API file route.
518
+ */
519
+ getFileAccessUrl(fileId: string, options?: RequestOptions): Promise<FileAccessUrlResponse>;
520
+ /**
521
+ * Delete a stored file. Only the file's owner can delete it.
522
+ * Requires the `files:delete` permission; the server returns 404 when the file
523
+ * does not exist or belongs to someone else.
524
+ *
525
+ * @param fileId - The file_id returned by `uploadFile`
526
+ * @returns DeleteFileResponse with `data.file_id` and `data.deleted`
527
+ */
528
+ deleteFile(fileId: string, options?: RequestOptions): Promise<DeleteFileResponse>;
529
+ /**
530
+ * Get the current multimodal configuration from the server.
531
+ */
532
+ getMultimodalConfig(options?: RequestOptions): Promise<MultimodalConfigResponse>;
533
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Deprecated names from `@10xscale/agentflow-client`, kept so code written against the old
3
+ * package keeps compiling after switching the import to `10xgraph-client`.
4
+ * Each alias is the same class or type as its new name, so `instanceof` checks still work.
5
+ * All of them will be removed in 2.0.
6
+ */
7
+ import { TenxGraphClient, TenxGraphConfig } from './client.js';
8
+ import { TenxGraphError } from './errors.js';
9
+ import { TenxGraphAuth, TenxGraphBasicAuth, TenxGraphBearerAuth, TenxGraphHeaderAuth } from './request.js';
10
+ /** @deprecated Use `TenxGraphClient`. Removed in 2.0. */
11
+ export declare const AgentFlowClient: typeof TenxGraphClient;
12
+ /** @deprecated Use `TenxGraphClient`. Removed in 2.0. */
13
+ export type AgentFlowClient = TenxGraphClient;
14
+ /** @deprecated Use `TenxGraphError`. Removed in 2.0. */
15
+ export declare const AgentFlowError: typeof TenxGraphError;
16
+ /** @deprecated Use `TenxGraphError`. Removed in 2.0. */
17
+ export type AgentFlowError = TenxGraphError;
18
+ /** @deprecated Use `TenxGraphConfig`. Removed in 2.0. */
19
+ export type AgentFlowConfig = TenxGraphConfig;
20
+ /** @deprecated Use `TenxGraphAuth`. Removed in 2.0. */
21
+ export type AgentFlowAuth = TenxGraphAuth;
22
+ /** @deprecated Use `TenxGraphBearerAuth`. Removed in 2.0. */
23
+ export type AgentFlowBearerAuth = TenxGraphBearerAuth;
24
+ /** @deprecated Use `TenxGraphBasicAuth`. Removed in 2.0. */
25
+ export type AgentFlowBasicAuth = TenxGraphBasicAuth;
26
+ /** @deprecated Use `TenxGraphHeaderAuth`. Removed in 2.0. */
27
+ export type AgentFlowHeaderAuth = TenxGraphHeaderAuth;
@@ -0,0 +1,25 @@
1
+ import { ResponseMetadata } from './metadata.js';
2
+ import { Message } from '../message.js';
3
+ import { RequestContext } from '../request.js';
4
+ export interface AddThreadMessagesContext extends RequestContext {
5
+ }
6
+ export interface AddThreadMessagesRequest {
7
+ threadId: string | number;
8
+ config: Record<string, any>;
9
+ messages: Message[];
10
+ metadata?: Record<string, any>;
11
+ }
12
+ export interface AddThreadMessagesData {
13
+ success: boolean;
14
+ message: string;
15
+ data: Record<string, any>;
16
+ }
17
+ export interface AddThreadMessagesResponse {
18
+ data: AddThreadMessagesData;
19
+ metadata: ResponseMetadata;
20
+ }
21
+ /**
22
+ * @deprecated Requires the `checkpointer:import` scope (admin only) in 10xgraph-api releases after 0.9.0.
23
+ * Use `updateThreadMessageFeedback` to attach feedback to a message.
24
+ */
25
+ export declare function addThreadMessages(context: AddThreadMessagesContext, request: AddThreadMessagesRequest): Promise<AddThreadMessagesResponse>;
@@ -0,0 +1,14 @@
1
+ import { ResponseMetadata } from './metadata.js';
2
+ import { RequestContext } from '../request.js';
3
+ export interface ClearThreadStateContext extends RequestContext {
4
+ }
5
+ export interface ClearThreadStateData {
6
+ success: boolean;
7
+ message: string;
8
+ data: boolean;
9
+ }
10
+ export interface ClearThreadStateResponse {
11
+ data: ClearThreadStateData;
12
+ metadata: ResponseMetadata;
13
+ }
14
+ export declare function clearThreadState(context: ClearThreadStateContext, threadId: string | number): Promise<ClearThreadStateResponse>;
@@ -0,0 +1,13 @@
1
+ import { ResponseMetadata } from './metadata.js';
2
+ import { RequestContext } from '../request.js';
3
+ export interface DeleteFileContext extends RequestContext {
4
+ }
5
+ export interface DeleteFileData {
6
+ file_id: string;
7
+ deleted: boolean;
8
+ }
9
+ export interface DeleteFileResponse {
10
+ data: DeleteFileData;
11
+ metadata: ResponseMetadata;
12
+ }
13
+ export declare function deleteFile(context: DeleteFileContext, fileId: string): Promise<DeleteFileResponse>;
@@ -0,0 +1,18 @@
1
+ import { ResponseMetadata } from './metadata.js';
2
+ import { RequestContext } from '../request.js';
3
+ export interface DeleteMemoryContext extends RequestContext {
4
+ }
5
+ export interface DeleteMemoryRequest {
6
+ memoryId: string;
7
+ config?: Record<string, any>;
8
+ options?: Record<string, any>;
9
+ }
10
+ export interface DeleteMemoryData {
11
+ success: boolean;
12
+ data: string;
13
+ }
14
+ export interface DeleteMemoryResponse {
15
+ data: DeleteMemoryData;
16
+ metadata: ResponseMetadata;
17
+ }
18
+ export declare function deleteMemory(context: DeleteMemoryContext, request: DeleteMemoryRequest): Promise<DeleteMemoryResponse>;
@@ -0,0 +1,18 @@
1
+ import { ResponseMetadata } from './metadata.js';
2
+ import { RequestContext } from '../request.js';
3
+ export interface DeleteThreadContext extends RequestContext {
4
+ }
5
+ export interface DeleteThreadRequest {
6
+ threadId: string | number;
7
+ config?: Record<string, any>;
8
+ }
9
+ export interface DeleteThreadData {
10
+ success: boolean;
11
+ message: string;
12
+ data: boolean;
13
+ }
14
+ export interface DeleteThreadResponse {
15
+ data: DeleteThreadData;
16
+ metadata: ResponseMetadata;
17
+ }
18
+ export declare function deleteThread(context: DeleteThreadContext, request: DeleteThreadRequest): Promise<DeleteThreadResponse>;
@@ -0,0 +1,19 @@
1
+ import { ResponseMetadata } from './metadata.js';
2
+ import { RequestContext } from '../request.js';
3
+ export interface DeleteThreadMessageContext extends RequestContext {
4
+ }
5
+ export interface DeleteThreadMessageRequest {
6
+ threadId: string | number;
7
+ messageId: string;
8
+ config?: Record<string, any>;
9
+ }
10
+ export interface DeleteThreadMessageData {
11
+ success: boolean;
12
+ message: string;
13
+ data: Record<string, any>;
14
+ }
15
+ export interface DeleteThreadMessageResponse {
16
+ data: DeleteThreadMessageData;
17
+ metadata: ResponseMetadata;
18
+ }
19
+ export declare function deleteThreadMessage(context: DeleteThreadMessageContext, request: DeleteThreadMessageRequest): Promise<DeleteThreadMessageResponse>;