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.
- package/CHANGELOG.md +207 -0
- package/README.md +11 -5
- package/dist/agent.d.ts +17 -5
- package/dist/agent.d.ts.map +1 -1
- package/dist/cjs/agent.d.ts +33 -0
- package/dist/cjs/client.d.ts +533 -0
- package/dist/cjs/compat.d.ts +27 -0
- package/dist/cjs/endpoints/addThreadMessages.d.ts +25 -0
- package/dist/cjs/endpoints/clearThreadState.d.ts +14 -0
- package/dist/cjs/endpoints/deleteFile.d.ts +13 -0
- package/dist/cjs/endpoints/deleteMemory.d.ts +18 -0
- package/dist/cjs/endpoints/deleteThread.d.ts +18 -0
- package/dist/cjs/endpoints/deleteThreadMessage.d.ts +19 -0
- package/dist/cjs/endpoints/files.d.ts +115 -0
- package/dist/cjs/endpoints/fixGraph.d.ts +33 -0
- package/dist/cjs/endpoints/forgetMemories.d.ts +21 -0
- package/dist/cjs/endpoints/getMemory.d.ts +18 -0
- package/dist/cjs/endpoints/graph.d.ts +50 -0
- package/dist/cjs/endpoints/graphTools.d.ts +31 -0
- package/dist/cjs/endpoints/invoke.d.ts +66 -0
- package/dist/cjs/endpoints/listMemories.d.ts +24 -0
- package/dist/cjs/endpoints/metadata.d.ts +5 -0
- package/dist/cjs/endpoints/observability.d.ts +111 -0
- package/dist/cjs/endpoints/ping.d.ts +9 -0
- package/dist/cjs/endpoints/realtime.d.ts +154 -0
- package/dist/cjs/endpoints/searchMemory.d.ts +56 -0
- package/dist/cjs/endpoints/stateSchema.d.ts +49 -0
- package/dist/cjs/endpoints/stopGraph.d.ts +35 -0
- package/dist/cjs/endpoints/storeMemory.d.ts +32 -0
- package/dist/cjs/endpoints/stream.d.ts +67 -0
- package/dist/cjs/endpoints/threadDetails.d.ts +18 -0
- package/dist/cjs/endpoints/threadMessage.d.ts +16 -0
- package/dist/cjs/endpoints/threadMessages.d.ts +28 -0
- package/dist/cjs/endpoints/threadState.d.ts +13 -0
- package/dist/cjs/endpoints/threads.d.ts +35 -0
- package/dist/cjs/endpoints/updateMemory.d.ts +20 -0
- package/dist/cjs/endpoints/updateThreadMessageFeedback.d.ts +19 -0
- package/dist/cjs/endpoints/updateThreadState.d.ts +22 -0
- package/dist/cjs/endpoints/wsStream.d.ts +34 -0
- package/dist/cjs/errors.d.ts +212 -0
- package/dist/cjs/index.d.ts +41 -0
- package/dist/cjs/interrupt.d.ts +45 -0
- package/dist/cjs/message.d.ts +173 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/request.d.ts +60 -0
- package/dist/cjs/tools.d.ts +80 -0
- package/dist/cjs/ws.d.ts +47 -0
- package/dist/client.d.ts +95 -40
- package/dist/client.d.ts.map +1 -1
- package/dist/endpoints/addThreadMessages.d.ts +4 -0
- package/dist/endpoints/addThreadMessages.d.ts.map +1 -1
- package/dist/endpoints/clearThreadState.d.ts.map +1 -1
- package/dist/endpoints/deleteFile.d.ts +14 -0
- package/dist/endpoints/deleteFile.d.ts.map +1 -0
- package/dist/endpoints/deleteMemory.d.ts.map +1 -1
- package/dist/endpoints/deleteThread.d.ts.map +1 -1
- package/dist/endpoints/deleteThreadMessage.d.ts.map +1 -1
- package/dist/endpoints/files.d.ts +33 -0
- package/dist/endpoints/files.d.ts.map +1 -1
- package/dist/endpoints/fixGraph.d.ts +8 -3
- package/dist/endpoints/fixGraph.d.ts.map +1 -1
- package/dist/endpoints/forgetMemories.d.ts.map +1 -1
- package/dist/endpoints/getMemory.d.ts.map +1 -1
- package/dist/endpoints/graph.d.ts +20 -8
- package/dist/endpoints/graph.d.ts.map +1 -1
- package/dist/endpoints/graphTools.d.ts.map +1 -1
- package/dist/endpoints/invoke.d.ts +8 -0
- package/dist/endpoints/invoke.d.ts.map +1 -1
- package/dist/endpoints/listMemories.d.ts +6 -0
- package/dist/endpoints/listMemories.d.ts.map +1 -1
- package/dist/endpoints/observability.d.ts +54 -0
- package/dist/endpoints/observability.d.ts.map +1 -1
- package/dist/endpoints/ping.d.ts.map +1 -1
- package/dist/endpoints/realtime.d.ts +25 -4
- package/dist/endpoints/realtime.d.ts.map +1 -1
- package/dist/endpoints/searchMemory.d.ts.map +1 -1
- package/dist/endpoints/stateSchema.d.ts.map +1 -1
- package/dist/endpoints/stopGraph.d.ts +13 -3
- package/dist/endpoints/stopGraph.d.ts.map +1 -1
- package/dist/endpoints/storeMemory.d.ts.map +1 -1
- package/dist/endpoints/stream.d.ts +8 -0
- package/dist/endpoints/stream.d.ts.map +1 -1
- package/dist/endpoints/threadDetails.d.ts.map +1 -1
- package/dist/endpoints/threadMessage.d.ts.map +1 -1
- package/dist/endpoints/threadMessages.d.ts +6 -0
- package/dist/endpoints/threadMessages.d.ts.map +1 -1
- package/dist/endpoints/threadState.d.ts.map +1 -1
- package/dist/endpoints/threads.d.ts +6 -0
- package/dist/endpoints/threads.d.ts.map +1 -1
- package/dist/endpoints/updateMemory.d.ts.map +1 -1
- package/dist/endpoints/updateThreadMessageFeedback.d.ts +20 -0
- package/dist/endpoints/updateThreadMessageFeedback.d.ts.map +1 -0
- package/dist/endpoints/updateThreadState.d.ts +6 -1
- package/dist/endpoints/updateThreadState.d.ts.map +1 -1
- package/dist/endpoints/wsStream.d.ts +2 -0
- package/dist/endpoints/wsStream.d.ts.map +1 -1
- package/dist/errors.d.ts +60 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1742 -1217
- package/dist/index.js.map +1 -1
- package/dist/interrupt.d.ts +46 -0
- package/dist/interrupt.d.ts.map +1 -0
- package/dist/request.d.ts +28 -0
- package/dist/request.d.ts.map +1 -1
- package/dist/tools.d.ts +14 -0
- package/dist/tools.d.ts.map +1 -1
- package/package.json +11 -6
- package/src/agent.ts +17 -4
- package/src/client.ts +248 -128
- package/src/endpoints/addThreadMessages.ts +15 -10
- package/src/endpoints/clearThreadState.ts +19 -20
- package/src/endpoints/deleteFile.ts +65 -0
- package/src/endpoints/deleteMemory.ts +9 -13
- package/src/endpoints/deleteThread.ts +9 -13
- package/src/endpoints/deleteThreadMessage.ts +9 -13
- package/src/endpoints/files.ts +164 -131
- package/src/endpoints/fixGraph.ts +15 -16
- package/src/endpoints/forgetMemories.ts +44 -60
- package/src/endpoints/getMemory.ts +9 -9
- package/src/endpoints/graph.ts +28 -21
- package/src/endpoints/graphTools.ts +7 -13
- package/src/endpoints/invoke.ts +105 -84
- package/src/endpoints/listMemories.ts +18 -13
- package/src/endpoints/observability.ts +77 -34
- package/src/endpoints/ping.ts +7 -13
- package/src/endpoints/realtime.ts +101 -39
- package/src/endpoints/searchMemory.ts +19 -13
- package/src/endpoints/stateSchema.ts +7 -13
- package/src/endpoints/stopGraph.ts +20 -16
- package/src/endpoints/storeMemory.ts +7 -8
- package/src/endpoints/stream.ts +179 -61
- package/src/endpoints/threadDetails.ts +9 -14
- package/src/endpoints/threadMessage.ts +9 -9
- package/src/endpoints/threadMessages.ts +15 -9
- package/src/endpoints/threadState.ts +19 -20
- package/src/endpoints/threads.ts +13 -12
- package/src/endpoints/updateMemory.ts +9 -9
- package/src/endpoints/updateThreadMessageFeedback.ts +80 -0
- package/src/endpoints/updateThreadState.ts +28 -22
- package/src/endpoints/wsStream.ts +167 -42
- package/src/errors.ts +332 -93
- package/src/index.ts +9 -0
- package/src/interrupt.ts +60 -0
- package/src/request.ts +134 -0
- package/src/tools.ts +95 -0
package/CHANGELOG.md
CHANGED
|
@@ -16,6 +16,211 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
16
16
|
- **Breaking changes are documented under a `### Breaking` heading**, with migration steps.
|
|
17
17
|
- The package entry points (`main`, `module`, `types`, `exports`) are part of the contract.
|
|
18
18
|
Changing them is a breaking change.
|
|
19
|
+
- **From 1.0, `major.minor` is identical across `10xgraph`, `10xgraph-api` and
|
|
20
|
+
`10xgraph-client`.** Use the client with a `10xgraph-api` of the same `major.minor`.
|
|
21
|
+
- **Patch numbers move independently.** A patch release contains only bug or security fixes.
|
|
22
|
+
- **Any new feature means all three packages release the next `X.Y.0` together.** A package with
|
|
23
|
+
no changes in that release ships a "version alignment, no changes" entry.
|
|
24
|
+
- **Breaking changes need a new major version** (2.0), after a deprecation that lasted at least
|
|
25
|
+
one minor release. The deprecated `AgentFlow*` aliases in `src/compat.ts` are removed in 2.0.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## [1.0.0-rc.2] - 2026-10-30
|
|
30
|
+
|
|
31
|
+
The second release candidate of `10xgraph-client` 1.0, aligned with `10xgraph` and `10xgraph-api`
|
|
32
|
+
1.0.0rc2. It is `1.0.0-rc.1` below plus the changes here. Use it with `10xgraph-api` 1.0.0rc2. New
|
|
33
|
+
response fields are typed optional, so the client still works against older servers. The client
|
|
34
|
+
API is source compatible with 0.6.0; the one hard requirement change is Node.js 20.
|
|
35
|
+
|
|
36
|
+
### Breaking
|
|
37
|
+
|
|
38
|
+
- **Node.js 18 is no longer supported.** `engines` is `node >= 20.0.0` and Node 18 is removed
|
|
39
|
+
from CI (CI runs Node 20 and 22). Node 18 is past end of life.
|
|
40
|
+
|
|
41
|
+
### Upgrade notes
|
|
42
|
+
|
|
43
|
+
- With `10xgraph-api` 1.0 a client that invents a thread id for a new conversation gets HTTP 403. Omit `thread_id` on the first request and reuse the id the server returns (see
|
|
44
|
+
`1.0.0-rc.1` below).
|
|
45
|
+
- Behaviour you may notice, none of it a signature change:
|
|
46
|
+
- `stream()` and `wsStream()` now throw (`StreamError`, `WebSocketError`) when a stream is cut
|
|
47
|
+
or the server closes the socket mid-run. Before, they ended as if the run had succeeded.
|
|
48
|
+
- The `timeout` option is an idle timeout on `stream()` and `wsStream()`: it limits how long the
|
|
49
|
+
client waits on the network, not how long the whole run takes.
|
|
50
|
+
- A `baseUrl` with a trailing slash is accepted; the slashes are stripped.
|
|
51
|
+
- Errors from timeouts and network failures are `RequestTimeoutError` and `NetworkError`, not
|
|
52
|
+
plain `Error`. Code that matched on message text should check the class.
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
|
|
56
|
+
- `Interrupt` type, `getInterrupt(chunk)`, `approveInterrupt(interrupt, value?)` and
|
|
57
|
+
`rejectInterrupt(interrupt)`. `getInterrupt` reads the pending interrupt from an `updates`
|
|
58
|
+
chunk; the helpers return `{ resume, interrupt_id }` to spread into the options of
|
|
59
|
+
`invoke()`, `stream()` or `wsStream()`.
|
|
60
|
+
- `authToken` accepts a function `() => string | null | undefined`, called on every request and
|
|
61
|
+
on every realtime reconnect, so short-lived tokens refresh without rebuilding the client.
|
|
62
|
+
`setAuthToken(token)` replaces it, and `clearAuth()` drops the bearer token and `auth`
|
|
63
|
+
credentials.
|
|
64
|
+
- Every method that makes a request takes a `signal` option (`RequestOptions`), not only
|
|
65
|
+
`invoke()`, `stream()` and `wsStream()`.
|
|
66
|
+
- New error classes and fields: `RequestTimeoutError`, `NetworkError`, `WebSocketError`,
|
|
67
|
+
`StreamError` and `RateLimitError`. `RateLimitError` carries `retryAfterSeconds` from the
|
|
68
|
+
`Retry-After` header or the body. Errors carry `cause`, `endpoint` and `method`, and
|
|
69
|
+
`requestId` reads the `x-request-id` header.
|
|
70
|
+
- Remote tool registrations take `validate(args)` (throw or return `false` to refuse the call)
|
|
71
|
+
and `maxArgsBytes` (default 1 MiB). The declared `parameters` are checked against the
|
|
72
|
+
server-sent arguments before the handler runs, and a repeated call id is rejected.
|
|
73
|
+
- `listMemories` takes `offset`, and its response has `has_more` and `next_offset`, so a user with
|
|
74
|
+
many memories can page. Needs `10xgraph-api` 1.0.
|
|
75
|
+
- CommonJS consumers get their own type declarations (`dist/cjs/index.d.ts`) through the
|
|
76
|
+
`exports` map, so `require` works with `nodenext` type checking.
|
|
77
|
+
- `signal?: AbortSignal` option on `invoke()`, `stream()` and `wsStream()`. Aborting it cancels the
|
|
78
|
+
in-flight request (and the open stream body or WebSocket). The call rejects with the abort error
|
|
79
|
+
(`name === 'AbortError'`), not the "Request timeout" error. A signal that is already aborted
|
|
80
|
+
rejects before any request is sent.
|
|
81
|
+
- `listFiles(params?)` for `GET /v1/files` (`{ limit?, offset? }`), with `ListFilesRequest`,
|
|
82
|
+
`ListFilesResponse`, `FileListItem`. A media store that cannot enumerate files answers 501,
|
|
83
|
+
thrown as a `TenxGraphError`.
|
|
84
|
+
- `has_more`, `offset` and `limit` on the `threads()` and `threadMessages()` response data.
|
|
85
|
+
- Observability types for the run trace: per-span `status`, `error`, `inputs`, `outputs`, `step`,
|
|
86
|
+
`visit`, `total_tokens`, `reasoning_tokens`, `tool_name`, `tool_call_id`; run-level `error`,
|
|
87
|
+
`model`, `models`, `notes`; payload-level `enabled` and `reason` (`ObsEmptyReason`), so a UI can
|
|
88
|
+
tell "tracing is off" from "no runs yet". New `ObsMessageSummary` type.
|
|
89
|
+
- `GraphInfo.realtime_options` (`GraphRealtimeOptions`): the Live init options the server honors, null
|
|
90
|
+
for non-realtime graphs.
|
|
91
|
+
- Eval report types for the extended report: case `error` and `error` status, rubric
|
|
92
|
+
`kind`, `passed`, `threshold`, `details`, `error`, case `expected_detail`, run `counts`, and
|
|
93
|
+
`errors` on run summaries.
|
|
94
|
+
|
|
95
|
+
### Changed
|
|
96
|
+
|
|
97
|
+
- Live sessions without a `thread_id` now use the server-created id. The client no longer invents one: it sends none, reads the id from the new `session_started` event (`{ type: 'session_started', thread_id }`, the first server event) into `session.threadId` (`string | null`, set once the event arrives), and sends it back on reconnect so the same thread continues. A caller-supplied `thread_id` works as before. Needs `10xgraph-api` 1.0, where an invented id gets 403.
|
|
98
|
+
- **Typed change:** `RealtimeSession.threadId` is `string | null`. It is `null` until the
|
|
99
|
+
`session_started` event arrives when you passed no `thread_id`, so code that read it as a
|
|
100
|
+
`string` right after `realtime()` must handle `null` (or wait for `session_started`).
|
|
101
|
+
`session.ready` still resolves when the socket opens, not on `session_started`, and the event is
|
|
102
|
+
part of the `RealtimeEvent` union.
|
|
103
|
+
- The `timeout` is an idle timeout on `stream()` and `wsStream()`: it runs while the client waits
|
|
104
|
+
for headers or the next piece of data and is paused while your code handles a chunk.
|
|
105
|
+
- `invoke()` and the other REST methods apply the timeout and your `signal` to the response body
|
|
106
|
+
as well, not only to the response headers.
|
|
107
|
+
- Realtime reconnects use jittered backoff, restore the attempt budget only after a connection
|
|
108
|
+
stayed open for 10 s, go straight to the longest delay on close code 1013, and stop with a fatal
|
|
109
|
+
`policy_violation` error on close code 1008 (an expired or rejected token).
|
|
110
|
+
- Path ids (thread, message, memory) are percent-encoded in every endpoint.
|
|
111
|
+
- Header-type credentials other than `Authorization` (for example `X-API-Key`) are not forwarded
|
|
112
|
+
on a cross-origin redirect; the call fails instead.
|
|
113
|
+
- The HTTP error mapping covers every JSON error body, including the real server's 409
|
|
114
|
+
`state_conflict` body, and maps the server's codes (`RECURSION_001`, `STORAGE_TRANSIENT_000`,
|
|
115
|
+
`STORAGE_SCHEMA_000`, `STORAGE_SERIALIZATION_000`) to `GraphRecursionError`,
|
|
116
|
+
`TransientStorageError`, `SchemaVersionError` and `SerializationError`.
|
|
117
|
+
- Response and request types match what the server sends: fields the server never sends were
|
|
118
|
+
removed from `AgentState` and `StopGraphResponse`, nullable fields are typed nullable, and
|
|
119
|
+
`updateThreadState` no longer accepts keys the server rejects.
|
|
120
|
+
- `stream()` and `wsStream()` stop a client-tool loop at `recursion_limit`; `recursion_limit: 0`
|
|
121
|
+
is honoured and not turned into 25.
|
|
122
|
+
|
|
123
|
+
### Fixed
|
|
124
|
+
|
|
125
|
+
- Leaving a `for await` loop over `stream()` early (`break`, `return` or a throw) cancels the
|
|
126
|
+
request. Before, the connection and the server run stayed open and the thread answered 409.
|
|
127
|
+
- `wsStream()` no longer hangs when the server answers a frame with an error chunk, and it
|
|
128
|
+
throws when the server closes the socket before the run finishes (1012, 1008, 1011).
|
|
129
|
+
- A truncated or unparseable stream line throws `StreamError` and a reset connection throws a
|
|
130
|
+
`StreamError` with code `STREAM_INTERRUPTED`, not a raw `TypeError: terminated`.
|
|
131
|
+
- A conflict (HTTP 409) throws `ConflictError` against the real server. It used to throw a
|
|
132
|
+
`TypeError`.
|
|
133
|
+
- `client.realtime()` no longer crashes the Node process with an unhandled rejection when the
|
|
134
|
+
connection fails and `session.ready` was not awaited.
|
|
135
|
+
- Realtime: `close()` during a pending reconnect no longer reopens the session, `send*` before
|
|
136
|
+
the socket is open is dropped and does not throw, and a failing reconnect does not end the
|
|
137
|
+
process.
|
|
138
|
+
- Failed requests no longer leave the timeout timer running, so a script that catches a
|
|
139
|
+
`ping()` error exits at once instead of after the timeout.
|
|
140
|
+
- Empty arrays are no longer stripped from messages and tool results, so a tool result with
|
|
141
|
+
`output: []` reaches the model as an empty list.
|
|
142
|
+
- `recursion_limit_reached` is true only when the limit stopped the run, and a limit stop is
|
|
143
|
+
reported to the caller instead of ending silently.
|
|
144
|
+
- Endpoint calls that time out throw `RequestTimeoutError`, not a raw `AbortError`, and
|
|
145
|
+
`forgetMemories()` throws a typed error, not a plain `Error`.
|
|
146
|
+
- `searchMemory()` no longer sends `memory_type: 'episodic'`, `category: ''` and
|
|
147
|
+
`score_threshold: 0` when you leave them unset. They are omitted so the server applies no filter,
|
|
148
|
+
and a search without a type now covers all memory types. Pass `memory_type` explicitly to keep
|
|
149
|
+
the old episodic-only behavior.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## [1.0.0-rc.1] - 2026-10-28
|
|
154
|
+
|
|
155
|
+
Release candidate for 1.0. The version is aligned with `10xgraph` and `10xgraph-api` 1.0, which
|
|
156
|
+
ship as `1.0.0rc1` on PyPI; this package ships as `1.0.0-rc.1` on npm under the `next` tag, so
|
|
157
|
+
`npm install 10xgraph-client` still installs 0.6.0 until 1.0.0 is released. The client itself has
|
|
158
|
+
no breaking change in this release: the public API is the one listed under Added and Deprecated
|
|
159
|
+
below, on top of 0.6.0.
|
|
160
|
+
|
|
161
|
+
### Upgrading alongside 10xgraph-api 1.0
|
|
162
|
+
|
|
163
|
+
`10xgraph-api` 1.0 defaults `runs.thread_ids` to `"server"`. The server now assigns thread ids,
|
|
164
|
+
and a client that invents an id for a new thread gets HTTP 403 on `invoke()`, `stream()` and
|
|
165
|
+
`wsStream()`. No client code change is needed if you already let the server choose:
|
|
166
|
+
|
|
167
|
+
- On the first request of a conversation, omit `thread_id` from `config` (do not pass
|
|
168
|
+
`config: { thread_id: ... }`).
|
|
169
|
+
- Read the id the server returns and reuse it in `config.thread_id` on every later request. For
|
|
170
|
+
`invoke()` it is `result.meta.thread_id` (`meta.is_new_thread` tells you it was just created).
|
|
171
|
+
For `stream()` it is `chunk.thread_id` or `chunk.metadata.thread_id` on the chunks. Over
|
|
172
|
+
`wsStream()` the client sends no id on the first request (logged as `thread_id=new`), tracks
|
|
173
|
+
the returned id itself and reuses it for its own resume requests; you still need to keep it
|
|
174
|
+
for your next `wsStream()` call.
|
|
175
|
+
- Operators who want the old behavior set `"runs": {"thread_ids": "client"}` in `10xgraph.json`.
|
|
176
|
+
|
|
177
|
+
Use the client with `10xgraph-api` of the same `major.minor` (see the README compatibility
|
|
178
|
+
table).
|
|
179
|
+
|
|
180
|
+
### Added
|
|
181
|
+
|
|
182
|
+
- `on_busy?: 'wait' | 'cancel'` option on `invoke()`, `stream()` and `wsStream()`, sent as a
|
|
183
|
+
top-level request field (in the WebSocket input object next to `recursion_limit`). It tells
|
|
184
|
+
the server what to do when another run is active on the same thread: wait up to 30 s
|
|
185
|
+
(server default) or cancel the running run. Needs a `10xgraph-api` version that supports it.
|
|
186
|
+
- `resume?: unknown` and `interrupt_id?: string` options on `invoke()`, `stream()` and
|
|
187
|
+
`wsStream()`. `interrupt_id` must be the id of the interrupt being answered. The client does
|
|
188
|
+
not track interrupt ids itself, so pass the id you got from the server. On `invoke()` and
|
|
189
|
+
`stream()` they are sent on the first request of a call only.
|
|
190
|
+
- `ConflictError` (HTTP 409, `errorCode` `'CONFLICT'`), exported from the package root. The
|
|
191
|
+
server answers 409 when the thread stays busy or when `interrupt_id` does not match the
|
|
192
|
+
open interrupt. The client never retries it. Error bodies of the form `{"detail": "..."}`
|
|
193
|
+
(no envelope) now produce a typed error with that message instead of throwing a `TypeError`.
|
|
194
|
+
- `deleteFile(fileId)` wraps the new `DELETE /v1/files/{file_id}` route (permission
|
|
195
|
+
`files:delete`, owner only). It resolves to `{ data: { file_id, deleted: true }, metadata }`.
|
|
196
|
+
The server returns 404 "File not found" when the file does not exist or belongs to someone
|
|
197
|
+
else. Types: `DeleteFileResponse`, `DeleteFileData`, `DeleteFileContext`.
|
|
198
|
+
- `updateThreadMessageFeedback(threadId, messageId, feedback)` wraps the new
|
|
199
|
+
`PUT /v1/threads/{thread_id}/messages/{message_id}` route. It replaces
|
|
200
|
+
`message.metadata.feedback` with the given JSON object and changes nothing else on the
|
|
201
|
+
message. The server rejects feedback over 8192 serialized bytes or nested deeper than 10
|
|
202
|
+
levels (HTTP 422), returns 404 if the message is not in the thread and 501 if its core
|
|
203
|
+
library is too old. It returns the updated message in the same shape as `singleMessage`.
|
|
204
|
+
Types: `UpdateThreadMessageFeedbackRequest`, `UpdateThreadMessageFeedbackResponse`,
|
|
205
|
+
`UpdateThreadMessageFeedbackContext`.
|
|
206
|
+
|
|
207
|
+
### Deprecated
|
|
208
|
+
|
|
209
|
+
- `addThreadMessages` (`POST /v1/threads/{thread_id}/messages`) requires the
|
|
210
|
+
`checkpointer:import` scope (admin only) in 10xgraph-api releases after 0.9.0, so a normal user gets
|
|
211
|
+
403, and the server now rejects assistant and system role messages on normal client
|
|
212
|
+
paths. Use `updateThreadMessageFeedback` to attach feedback to a message. The method is
|
|
213
|
+
kept and still works for admin tokens.
|
|
214
|
+
|
|
215
|
+
### Fixed
|
|
216
|
+
|
|
217
|
+
- Client-side tool loop on `invoke()` and `stream()` lost a server-assigned thread id. When you
|
|
218
|
+
omitted `config.thread_id` on the first request, the requests that send tool results also
|
|
219
|
+
omitted it, so `10xgraph-api` 1.0 treated each one as a new thread and the tool round-trip
|
|
220
|
+
broke or the conversation split. The client now reuses the id the server returns
|
|
221
|
+
(`meta.thread_id` on `invoke()`; `thread_id` or `metadata.thread_id` on `stream()` chunks) for
|
|
222
|
+
the following requests of the same call. A `thread_id` you pass is never replaced, and your
|
|
223
|
+
`config` object is not modified.
|
|
19
224
|
|
|
20
225
|
---
|
|
21
226
|
|
|
@@ -269,6 +474,8 @@ Initial entry in this changelog. Releases before `0.2.0` were not tracked here.
|
|
|
269
474
|
- Added the realtime audio client (`client.realtime(...)` returning `RealtimeSession`).
|
|
270
475
|
- Added dual ESM/CJS exports.
|
|
271
476
|
|
|
477
|
+
[Unreleased]: https://github.com/10xGraph/10xgraph-client/compare/v1.0.0-rc.1...HEAD
|
|
478
|
+
[1.0.0-rc.1]: https://github.com/10xGraph/10xgraph-client/compare/v0.6.0...v1.0.0-rc.1
|
|
272
479
|
[0.6.0]: https://github.com/10xGraph/10xgraph-client/compare/v0.5.0...v0.6.0
|
|
273
480
|
[0.5.0]: https://github.com/10xHub/agentflow-client/compare/v0.4.0...v0.5.0
|
|
274
481
|
[0.4.0]: https://github.com/10xHub/agentflow-client/compare/v0.3.0...v0.4.0
|
package/README.md
CHANGED
|
@@ -34,16 +34,18 @@ pnpm add 10xgraph-client
|
|
|
34
34
|
|
|
35
35
|
### Version compatibility
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
From 1.0, match `major.minor` across `10xgraph`, `10xgraph-api` and `10xgraph-client`; patch
|
|
38
|
+
versions are independent (a patch is only a bug or security fix). Before 1.0, pick versions by
|
|
39
|
+
this table:
|
|
39
40
|
|
|
40
41
|
| `10xgraph-client` (npm) | API server | Core framework |
|
|
41
42
|
| -------------------------------------- | ------------------------------------------------- | ------------------------------ |
|
|
43
|
+
| 1.0.x | `10xgraph-api` 1.0.x | `10xgraph` 1.0.x |
|
|
42
44
|
| 0.6.x | `10xgraph-api` >= 0.7.0 | `10xgraph` >= 0.10.0 |
|
|
43
45
|
| `@10xscale/agentflow-client` 0.5.x | `10xscale-agentflow-cli` >= 0.6.0, `10xgraph-api` | `10xscale-agentflow` >= 0.10.0 |
|
|
44
46
|
| `@10xscale/agentflow-client` 0.3-0.4.x | `10xscale-agentflow-cli` >= 0.5.0 | `10xscale-agentflow` >= 0.9.0 |
|
|
45
47
|
|
|
46
|
-
The client tracks the **API server**, which is what it talks to. Client 0.6.x
|
|
48
|
+
The client tracks the **API server**, which is what it talks to. Client 0.6.x and later authenticate
|
|
47
49
|
WebSockets with the `10xgraph-bearer` subprotocol, which `10xgraph-api` 0.7.0 introduced. Against
|
|
48
50
|
an older `10xscale-agentflow-cli` server, HTTP endpoints still work, but `wsStream()` and
|
|
49
51
|
`realtime()` with bearer auth do not; stay on `@10xscale/agentflow-client@0.5.0` until the server
|
|
@@ -117,7 +119,7 @@ import { TenxGraphClient } from '10xgraph-client';
|
|
|
117
119
|
const client = new TenxGraphClient({ baseUrl: 'http://localhost:8000', authToken });
|
|
118
120
|
|
|
119
121
|
const session = client.realtime(
|
|
120
|
-
{ model: 'gemini-
|
|
122
|
+
{ model: 'gemini-3.8-live', modalities: 'AUDIO' },
|
|
121
123
|
{ reconnect: { maxAttempts: 5 } }
|
|
122
124
|
);
|
|
123
125
|
|
|
@@ -226,6 +228,10 @@ const result = await client.invoke(messages, {
|
|
|
226
228
|
});
|
|
227
229
|
```
|
|
228
230
|
|
|
231
|
+
Optional: `on_busy: 'wait' | 'cancel'` controls what happens when the thread already has an active
|
|
232
|
+
run, and `resume` with `interrupt_id` answers an open interrupt. A 409 throws `ConflictError`
|
|
233
|
+
(not retried automatically).
|
|
234
|
+
|
|
229
235
|
### `stream()`: real-time streaming
|
|
230
236
|
|
|
231
237
|
```typescript
|
|
@@ -377,7 +383,7 @@ Your first pull request can be small. These are real, self-contained, and useful
|
|
|
377
383
|
- **Sharpen a type or a doc comment.** If your editor's autocomplete misled you once, it will mislead the next person too.
|
|
378
384
|
- **Turn a bug into a failing test.** Open it as a draft pull request; the fix can come later.
|
|
379
385
|
|
|
380
|
-
From clone to a passing check (Node
|
|
386
|
+
From clone to a passing check (Node 20 or newer):
|
|
381
387
|
|
|
382
388
|
```bash
|
|
383
389
|
git clone https://github.com/10xGraph/10xgraph-client.git
|
package/dist/agent.d.ts
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import { Message } from './message.js';
|
|
2
|
-
interface ExecutionMeta {
|
|
2
|
+
export interface ExecutionMeta {
|
|
3
3
|
current_node: string;
|
|
4
4
|
step: number;
|
|
5
|
+
/** Server execution status, e.g. 'running', 'interrupted_before', 'completed'. */
|
|
6
|
+
status?: string;
|
|
7
|
+
interrupted_node?: string | null;
|
|
8
|
+
interrupt_reason?: string | null;
|
|
9
|
+
interrupt_data?: Record<string, any> | null;
|
|
10
|
+
thread_id?: string | null;
|
|
11
|
+
run_id?: string | null;
|
|
12
|
+
stop_current_execution?: string;
|
|
13
|
+
internal_data?: Record<string, any>;
|
|
14
|
+
/** @deprecated The server never sends this field. Read `status` / `interrupted_node`. */
|
|
5
15
|
interrupt?: {
|
|
6
16
|
node: string;
|
|
7
17
|
reason: string;
|
|
8
18
|
status: string;
|
|
9
19
|
data?: Record<string, any>;
|
|
10
20
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
/** @deprecated The server never sends this field. Read `status`. */
|
|
22
|
+
is_running?: boolean;
|
|
23
|
+
/** @deprecated The server never sends this field. Read `status`. */
|
|
24
|
+
is_interrupted?: boolean;
|
|
25
|
+
/** @deprecated The server never sends this field. Read `stop_current_execution`. */
|
|
26
|
+
is_stopped_requested?: boolean;
|
|
14
27
|
}
|
|
15
28
|
export declare class AgentState {
|
|
16
29
|
context: Message[];
|
|
@@ -18,5 +31,4 @@ export declare class AgentState {
|
|
|
18
31
|
execution_meta: ExecutionMeta;
|
|
19
32
|
constructor(initialData?: Partial<Record<string, any>>);
|
|
20
33
|
}
|
|
21
|
-
export {};
|
|
22
34
|
//# sourceMappingURL=agent.d.ts.map
|
package/dist/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,yFAAyF;IACzF,SAAS,CAAC,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC5B,CAAC;IACF,oEAAoE;IACpE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oEAAoE;IACpE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,oFAAoF;IACpF,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAmBD,qBAAa,UAAU;IACrB,OAAO,EAAE,OAAO,EAAE,CAAM;IACxB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAQ;IACtC,cAAc,EAAE,aAAa,CAA8B;gBAE/C,WAAW,GAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;CAG3D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Message } from './message.js';
|
|
2
|
+
export interface ExecutionMeta {
|
|
3
|
+
current_node: string;
|
|
4
|
+
step: number;
|
|
5
|
+
/** Server execution status, e.g. 'running', 'interrupted_before', 'completed'. */
|
|
6
|
+
status?: string;
|
|
7
|
+
interrupted_node?: string | null;
|
|
8
|
+
interrupt_reason?: string | null;
|
|
9
|
+
interrupt_data?: Record<string, any> | null;
|
|
10
|
+
thread_id?: string | null;
|
|
11
|
+
run_id?: string | null;
|
|
12
|
+
stop_current_execution?: string;
|
|
13
|
+
internal_data?: Record<string, any>;
|
|
14
|
+
/** @deprecated The server never sends this field. Read `status` / `interrupted_node`. */
|
|
15
|
+
interrupt?: {
|
|
16
|
+
node: string;
|
|
17
|
+
reason: string;
|
|
18
|
+
status: string;
|
|
19
|
+
data?: Record<string, any>;
|
|
20
|
+
};
|
|
21
|
+
/** @deprecated The server never sends this field. Read `status`. */
|
|
22
|
+
is_running?: boolean;
|
|
23
|
+
/** @deprecated The server never sends this field. Read `status`. */
|
|
24
|
+
is_interrupted?: boolean;
|
|
25
|
+
/** @deprecated The server never sends this field. Read `stop_current_execution`. */
|
|
26
|
+
is_stopped_requested?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare class AgentState {
|
|
29
|
+
context: Message[];
|
|
30
|
+
context_summary: string | null;
|
|
31
|
+
execution_meta: ExecutionMeta;
|
|
32
|
+
constructor(initialData?: Partial<Record<string, any>>);
|
|
33
|
+
}
|