10xgraph-client 0.0.0-stage → 1.0.0-rc.1

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 (131) hide show
  1. package/CHANGELOG.md +363 -0
  2. package/LICENSE +21 -0
  3. package/README.md +406 -2
  4. package/dist/agent.d.ts +22 -0
  5. package/dist/agent.d.ts.map +1 -0
  6. package/dist/client.d.ts +515 -0
  7. package/dist/client.d.ts.map +1 -0
  8. package/dist/compat.d.ts +28 -0
  9. package/dist/compat.d.ts.map +1 -0
  10. package/dist/endpoints/addThreadMessages.d.ts +26 -0
  11. package/dist/endpoints/addThreadMessages.d.ts.map +1 -0
  12. package/dist/endpoints/clearThreadState.d.ts +15 -0
  13. package/dist/endpoints/clearThreadState.d.ts.map +1 -0
  14. package/dist/endpoints/deleteFile.d.ts +14 -0
  15. package/dist/endpoints/deleteFile.d.ts.map +1 -0
  16. package/dist/endpoints/deleteMemory.d.ts +19 -0
  17. package/dist/endpoints/deleteMemory.d.ts.map +1 -0
  18. package/dist/endpoints/deleteThread.d.ts +19 -0
  19. package/dist/endpoints/deleteThread.d.ts.map +1 -0
  20. package/dist/endpoints/deleteThreadMessage.d.ts +20 -0
  21. package/dist/endpoints/deleteThreadMessage.d.ts.map +1 -0
  22. package/dist/endpoints/files.d.ts +83 -0
  23. package/dist/endpoints/files.d.ts.map +1 -0
  24. package/dist/endpoints/fixGraph.d.ts +34 -0
  25. package/dist/endpoints/fixGraph.d.ts.map +1 -0
  26. package/dist/endpoints/forgetMemories.d.ts +22 -0
  27. package/dist/endpoints/forgetMemories.d.ts.map +1 -0
  28. package/dist/endpoints/getMemory.d.ts +19 -0
  29. package/dist/endpoints/getMemory.d.ts.map +1 -0
  30. package/dist/endpoints/graph.d.ts +39 -0
  31. package/dist/endpoints/graph.d.ts.map +1 -0
  32. package/dist/endpoints/graphTools.d.ts +32 -0
  33. package/dist/endpoints/graphTools.d.ts.map +1 -0
  34. package/dist/endpoints/invoke.d.ts +65 -0
  35. package/dist/endpoints/invoke.d.ts.map +1 -0
  36. package/dist/endpoints/listMemories.d.ts +19 -0
  37. package/dist/endpoints/listMemories.d.ts.map +1 -0
  38. package/dist/endpoints/metadata.d.ts +6 -0
  39. package/dist/endpoints/metadata.d.ts.map +1 -0
  40. package/dist/endpoints/observability.d.ts +58 -0
  41. package/dist/endpoints/observability.d.ts.map +1 -0
  42. package/dist/endpoints/ping.d.ts +10 -0
  43. package/dist/endpoints/ping.d.ts.map +1 -0
  44. package/dist/endpoints/realtime.d.ts +134 -0
  45. package/dist/endpoints/realtime.d.ts.map +1 -0
  46. package/dist/endpoints/searchMemory.d.ts +57 -0
  47. package/dist/endpoints/searchMemory.d.ts.map +1 -0
  48. package/dist/endpoints/stateSchema.d.ts +50 -0
  49. package/dist/endpoints/stateSchema.d.ts.map +1 -0
  50. package/dist/endpoints/stopGraph.d.ts +26 -0
  51. package/dist/endpoints/stopGraph.d.ts.map +1 -0
  52. package/dist/endpoints/storeMemory.d.ts +33 -0
  53. package/dist/endpoints/storeMemory.d.ts.map +1 -0
  54. package/dist/endpoints/stream.d.ts +66 -0
  55. package/dist/endpoints/stream.d.ts.map +1 -0
  56. package/dist/endpoints/threadDetails.d.ts +19 -0
  57. package/dist/endpoints/threadDetails.d.ts.map +1 -0
  58. package/dist/endpoints/threadMessage.d.ts +17 -0
  59. package/dist/endpoints/threadMessage.d.ts.map +1 -0
  60. package/dist/endpoints/threadMessages.d.ts +23 -0
  61. package/dist/endpoints/threadMessages.d.ts.map +1 -0
  62. package/dist/endpoints/threadState.d.ts +14 -0
  63. package/dist/endpoints/threadState.d.ts.map +1 -0
  64. package/dist/endpoints/threads.d.ts +30 -0
  65. package/dist/endpoints/threads.d.ts.map +1 -0
  66. package/dist/endpoints/updateMemory.d.ts +21 -0
  67. package/dist/endpoints/updateMemory.d.ts.map +1 -0
  68. package/dist/endpoints/updateThreadMessageFeedback.d.ts +20 -0
  69. package/dist/endpoints/updateThreadMessageFeedback.d.ts.map +1 -0
  70. package/dist/endpoints/updateThreadState.d.ts +18 -0
  71. package/dist/endpoints/updateThreadState.d.ts.map +1 -0
  72. package/dist/endpoints/wsStream.d.ts +33 -0
  73. package/dist/endpoints/wsStream.d.ts.map +1 -0
  74. package/dist/errors.d.ts +163 -0
  75. package/dist/errors.d.ts.map +1 -0
  76. package/dist/index.cjs +6 -0
  77. package/dist/index.cjs.map +1 -0
  78. package/dist/index.d.ts +41 -0
  79. package/dist/index.d.ts.map +1 -0
  80. package/dist/index.js +2808 -0
  81. package/dist/index.js.map +1 -0
  82. package/dist/message.d.ts +174 -0
  83. package/dist/message.d.ts.map +1 -0
  84. package/dist/request.d.ts +33 -0
  85. package/dist/request.d.ts.map +1 -0
  86. package/dist/tools.d.ts +67 -0
  87. package/dist/tools.d.ts.map +1 -0
  88. package/dist/ws.d.ts +48 -0
  89. package/dist/ws.d.ts.map +1 -0
  90. package/package.json +99 -4
  91. package/src/agent.ts +43 -0
  92. package/src/client.ts +1117 -0
  93. package/src/compat.ts +35 -0
  94. package/src/endpoints/addThreadMessages.ts +87 -0
  95. package/src/endpoints/clearThreadState.ts +75 -0
  96. package/src/endpoints/deleteFile.ts +70 -0
  97. package/src/endpoints/deleteMemory.ts +91 -0
  98. package/src/endpoints/deleteThread.ts +78 -0
  99. package/src/endpoints/deleteThreadMessage.ts +83 -0
  100. package/src/endpoints/files.ts +274 -0
  101. package/src/endpoints/fixGraph.ts +96 -0
  102. package/src/endpoints/forgetMemories.ts +95 -0
  103. package/src/endpoints/getMemory.ts +82 -0
  104. package/src/endpoints/graph.ts +97 -0
  105. package/src/endpoints/graphTools.ts +90 -0
  106. package/src/endpoints/invoke.ts +338 -0
  107. package/src/endpoints/listMemories.ts +97 -0
  108. package/src/endpoints/metadata.ts +6 -0
  109. package/src/endpoints/observability.ts +107 -0
  110. package/src/endpoints/ping.ts +58 -0
  111. package/src/endpoints/realtime.ts +326 -0
  112. package/src/endpoints/searchMemory.ts +132 -0
  113. package/src/endpoints/stateSchema.ts +106 -0
  114. package/src/endpoints/stopGraph.ts +85 -0
  115. package/src/endpoints/storeMemory.ts +98 -0
  116. package/src/endpoints/stream.ts +460 -0
  117. package/src/endpoints/threadDetails.ts +78 -0
  118. package/src/endpoints/threadMessage.ts +76 -0
  119. package/src/endpoints/threadMessages.ts +97 -0
  120. package/src/endpoints/threadState.ts +74 -0
  121. package/src/endpoints/threads.ts +112 -0
  122. package/src/endpoints/updateMemory.ts +90 -0
  123. package/src/endpoints/updateThreadMessageFeedback.ts +86 -0
  124. package/src/endpoints/updateThreadState.ts +82 -0
  125. package/src/endpoints/wsStream.ts +258 -0
  126. package/src/errors.ts +578 -0
  127. package/src/index.ts +112 -0
  128. package/src/message.ts +436 -0
  129. package/src/request.ts +168 -0
  130. package/src/tools.ts +225 -0
  131. package/src/ws.ts +100 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,363 @@
1
+ # Changelog
2
+
3
+ All notable changes to `10xgraph-client` (formerly `@10xscale/agentflow-client`) are
4
+ documented here.
5
+
6
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this
7
+ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
+
9
+ ## Compatibility policy
10
+
11
+ - **Nothing public is removed without a deprecation cycle.** Anything exported from
12
+ `src/index.ts` is public API. A public export is first marked deprecated with a
13
+ `@deprecated` JSDoc tag, kept working for at least one subsequent minor release, and
14
+ only then removed in a major release.
15
+ - **Moved modules keep a re-export shim** at the old path for at least one minor release.
16
+ - **Breaking changes are documented under a `### Breaking` heading**, with migration steps.
17
+ - The package entry points (`main`, `module`, `types`, `exports`) are part of the contract.
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
+ ## [Unreleased]
30
+
31
+ ---
32
+
33
+ ## [1.0.0-rc.1] - 2026-10-28
34
+
35
+ Release candidate for 1.0. The version is aligned with `10xgraph` and `10xgraph-api` 1.0, which
36
+ ship as `1.0.0rc1` on PyPI; this package ships as `1.0.0-rc.1` on npm under the `next` tag, so
37
+ `npm install 10xgraph-client` still installs 0.6.0 until 1.0.0 is released. The client itself has
38
+ no breaking change in this release: the public API is the one listed under Added and Deprecated
39
+ below, on top of 0.6.0.
40
+
41
+ ### Upgrading alongside 10xgraph-api 1.0
42
+
43
+ `10xgraph-api` 1.0 defaults `runs.thread_ids` to `"server"`. The server now assigns thread ids,
44
+ and a client that invents an id for a new thread gets HTTP 403 on `invoke()`, `stream()` and
45
+ `wsStream()`. No client code change is needed if you already let the server choose:
46
+
47
+ - On the first request of a conversation, omit `thread_id` from `config` (do not pass
48
+ `config: { thread_id: ... }`).
49
+ - Read the id the server returns and reuse it in `config.thread_id` on every later request. For
50
+ `invoke()` it is `result.meta.thread_id` (`meta.is_new_thread` tells you it was just created).
51
+ For `stream()` it is `chunk.thread_id` or `chunk.metadata.thread_id` on the chunks. Over
52
+ `wsStream()` the client sends no id on the first request (logged as `thread_id=new`), tracks
53
+ the returned id itself and reuses it for its own resume requests; you still need to keep it
54
+ for your next `wsStream()` call.
55
+ - Operators who want the old behavior set `"runs": {"thread_ids": "client"}` in `10xgraph.json`.
56
+
57
+ Use the client with `10xgraph-api` of the same `major.minor` (see the README compatibility
58
+ table).
59
+
60
+ ### Added
61
+
62
+ - `on_busy?: 'wait' | 'cancel'` option on `invoke()`, `stream()` and `wsStream()`, sent as a
63
+ top-level request field (in the WebSocket input object next to `recursion_limit`). It tells
64
+ the server what to do when another run is active on the same thread: wait up to 30 s
65
+ (server default) or cancel the running run. Needs a `10xgraph-api` version that supports it.
66
+ - `resume?: unknown` and `interrupt_id?: string` options on `invoke()`, `stream()` and
67
+ `wsStream()`. `interrupt_id` must be the id of the interrupt being answered. The client does
68
+ not track interrupt ids itself, so pass the id you got from the server. On `invoke()` and
69
+ `stream()` they are sent on the first request of a call only.
70
+ - `ConflictError` (HTTP 409, `errorCode` `'CONFLICT'`), exported from the package root. The
71
+ server answers 409 when the thread stays busy or when `interrupt_id` does not match the
72
+ open interrupt. The client never retries it. Error bodies of the form `{"detail": "..."}`
73
+ (no envelope) now produce a typed error with that message instead of throwing a `TypeError`.
74
+ - `deleteFile(fileId)` wraps the new `DELETE /v1/files/{file_id}` route (permission
75
+ `files:delete`, owner only). It resolves to `{ data: { file_id, deleted: true }, metadata }`.
76
+ The server returns 404 "File not found" when the file does not exist or belongs to someone
77
+ else. Types: `DeleteFileResponse`, `DeleteFileData`, `DeleteFileContext`.
78
+ - `updateThreadMessageFeedback(threadId, messageId, feedback)` wraps the new
79
+ `PUT /v1/threads/{thread_id}/messages/{message_id}` route. It replaces
80
+ `message.metadata.feedback` with the given JSON object and changes nothing else on the
81
+ message. The server rejects feedback over 8192 serialized bytes or nested deeper than 10
82
+ levels (HTTP 422), returns 404 if the message is not in the thread and 501 if its core
83
+ library is too old. It returns the updated message in the same shape as `singleMessage`.
84
+ Types: `UpdateThreadMessageFeedbackRequest`, `UpdateThreadMessageFeedbackResponse`,
85
+ `UpdateThreadMessageFeedbackContext`.
86
+
87
+ ### Deprecated
88
+
89
+ - `addThreadMessages` (`POST /v1/threads/{thread_id}/messages`) requires the
90
+ `checkpointer:import` scope (admin only) in 10xgraph-api releases after 0.9.0, so a normal user gets
91
+ 403, and the server now rejects assistant and system role messages on normal client
92
+ paths. Use `updateThreadMessageFeedback` to attach feedback to a message. The method is
93
+ kept and still works for admin tokens.
94
+
95
+ ### Fixed
96
+
97
+ - Client-side tool loop on `invoke()` and `stream()` lost a server-assigned thread id. When you
98
+ omitted `config.thread_id` on the first request, the requests that send tool results also
99
+ omitted it, so `10xgraph-api` 1.0 treated each one as a new thread and the tool round-trip
100
+ broke or the conversation split. The client now reuses the id the server returns
101
+ (`meta.thread_id` on `invoke()`; `thread_id` or `metadata.thread_id` on `stream()` chunks) for
102
+ the following requests of the same call. A `thread_id` you pass is never replaced, and your
103
+ `config` object is not modified.
104
+
105
+ ---
106
+
107
+ ## [0.6.0] - 2026-10-10
108
+
109
+ **First release as `10xgraph-client`.** The package formerly published as
110
+ `@10xscale/agentflow-client` (last version 0.5.0) is renamed along with the project:
111
+ Agentflow is now 10xGraph ([10xgraph.com](https://10xgraph.com),
112
+ [github.com/10xGraph/10xgraph-client](https://github.com/10xGraph/10xgraph-client)).
113
+
114
+ ### Breaking
115
+
116
+ - **WebSocket bearer auth uses the `10xgraph-bearer` subprotocol** (`WS_BEARER_SUBPROTOCOL`),
117
+ replacing `agentflow-bearer`. `10xgraph-api` 0.7.0 accepts both; an older
118
+ `10xscale-agentflow-cli` server only knows the old name, so `wsStream()` and `realtime()`
119
+ with bearer auth fail against it.
120
+
121
+ **Migration:** upgrade the server to `10xgraph-api` >= 0.7.0. HTTP endpoints are unaffected.
122
+
123
+ - **`TenxGraphError.name` is `'TenxGraphError'`** (was `'AgentFlowError'`). Code that compares
124
+ `error.name` should use `instanceof` instead.
125
+
126
+ ### Changed
127
+
128
+ - npm package renamed: `npm install 10xgraph-client`, `import { ... } from '10xgraph-client'`.
129
+ - Exported names renamed: `TenxGraphClient`, `TenxGraphConfig`, `TenxGraphError`,
130
+ `TenxGraphAuth`, `TenxGraphBearerAuth`, `TenxGraphBasicAuth`, `TenxGraphHeaderAuth`.
131
+ - Debug log prefix is `TenxGraphClient:`.
132
+ - Docs, examples and package metadata point at [10xgraph.com/docs](https://10xgraph.com/docs/client),
133
+ the server's `10xgraph.json`, and the `10xGraph/10xgraph-client` repository.
134
+
135
+ ### Deprecated
136
+
137
+ - `AgentFlowClient`, `AgentFlowConfig`, `AgentFlowError`, `AgentFlowAuth`,
138
+ `AgentFlowBearerAuth`, `AgentFlowBasicAuth`, `AgentFlowHeaderAuth`. Each is exported from
139
+ `src/compat.ts` as an alias of the same class or type, so existing code and `instanceof`
140
+ checks keep working. Removed in 2.0.
141
+
142
+ ### Compatibility
143
+
144
+ Requires `10xgraph-api` >= 0.7.0 for WebSocket bearer auth; verified against its current route
145
+ table (every endpoint the client calls exists with the same method, path and body).
146
+
147
+ ---
148
+
149
+ ## [0.5.0] - 2026-10-08
150
+
151
+ **Final release of `@10xscale/agentflow-client`.** Agentflow is now 10xGraph
152
+ ([10xgraph.com](https://10xgraph.com), [github.com/10xGraph](https://github.com/10xGraph)).
153
+ No further versions will be published under this name; the TypeScript client continues
154
+ under the 10xGraph name. Installed copies keep working, and
155
+ `@10xscale/agentflow-client@0.5.0` can be pinned.
156
+
157
+ ### Breaking
158
+
159
+ - **`client.setup()` is removed**, together with the `setupGraph` endpoint module and its
160
+ exported types (`SetupGraphContext`, `SetupGraphRequest`, `SetupGraphResponse`,
161
+ `RemoteTool`). The server removed `POST /v1/graph/setup` in `10xscale-agentflow-cli`
162
+ 0.6.0, so the call could no longer succeed against a current server. Clients can no longer
163
+ define the schema the model sees.
164
+
165
+ **Migration:** declare each client-executed tool (node, name, description, parameters)
166
+ under `remote_tools` in the server's `agentflow.json`, and register only its handler on the
167
+ client with `client.registerToolHandler(name, handler)`. Delete any `await client.setup()`
168
+ call.
169
+
170
+ ### Added
171
+
172
+ - `client.registerToolHandler(name, handler)` registers the client-side implementation of a
173
+ remote tool whose schema is declared on the server.
174
+
175
+ ### Changed
176
+
177
+ - `ToolRegistration.node` is optional. `registerTool()` still works; its `description` and
178
+ `parameters` are no longer sent anywhere.
179
+ - `RealtimeInit.model` is optional. The server honours it only when the model is listed in
180
+ `websocket.realtime_models`, and otherwise uses the agent's own model. `tools_tags` can only
181
+ narrow the agent's own tag filter.
182
+ - `MultimodalConfigResponse.data` no longer declares `media_storage_path`; the server does not
183
+ return it.
184
+ - Package metadata points at the client's own repository
185
+ ([10xHub/agentflow-client](https://github.com/10xHub/agentflow-client)) and at
186
+ [10xgraph.com](https://10xgraph.com).
187
+
188
+ ### Compatibility
189
+
190
+ Requires `10xscale-agentflow-cli` >= 0.6.0, the first server release with `remote_tools` in
191
+ `agentflow.json`. It also works with the renamed server `10xgraph-api`, which still accepts the
192
+ `agentflow-bearer` WebSocket subprotocol this client sends.
193
+
194
+ ---
195
+
196
+ ## [0.4.0] - 2026-07-27
197
+
198
+ ### Breaking
199
+
200
+ - **WebSocket auth: `auth` now takes precedence over `authToken`.** `resolveBearerToken()`
201
+ previously checked `authToken` first and only fell back to `auth`. It now resolves `auth`
202
+ first, matching `buildHeaders()` on the HTTP path, and returns `null` when `auth` is set to
203
+ a non-bearer scheme instead of falling back to `authToken`. This affects `wsStream()` and
204
+ `realtime()`.
205
+
206
+ You are affected only if you set **both** `auth` and `authToken` on the client - a single
207
+ credential behaves exactly as before. Two cases change:
208
+
209
+ | Config | Before | After |
210
+ | ---------------------------------------------------------- | ------- | ------ |
211
+ | `auth: {type:'bearer', token:'b'}` + `authToken: 'tok'` | `'tok'` | `'b'` |
212
+ | `auth: {type:'basic'\|'header', ...}` + `authToken: 'tok'` | `'tok'` | `null` |
213
+
214
+ The rationale for the first case is consistency: `buildHeaders()` has always resolved `auth`
215
+ before `authToken`, so the socket and the HTTP path now agree on which credential wins.
216
+
217
+ The second case is the one to check before upgrading, because what still reaches the server
218
+ depends on your runtime. `openWebSocket()` forwards only the `Authorization` header, and only
219
+ to implementations that accept a third options argument:
220
+
221
+ - **Basic auth on Node** (`ws`, or a passed `webSocketImpl`) - unaffected in practice. The
222
+ `Authorization: Basic ...` header is still sent; you simply no longer also get an unrelated
223
+ bearer subprotocol alongside it.
224
+ - **Basic auth in a browser** - the socket now carries no credential. Browsers cannot set
225
+ headers on a WebSocket, so the basic header is dropped and the bearer fallback is gone.
226
+ - **Header auth (`{ type: 'header' }`) in any runtime** - the socket now carries no
227
+ credential. A custom header name is never forwarded by `openWebSocket()`, in Node or the
228
+ browser, and the bearer fallback is gone.
229
+
230
+ **Migration:** if you hit one of the last two, pass the socket credential as bearer -
231
+ `auth: { type: 'bearer', token }`, or drop `auth` and keep `authToken` - so the credential
232
+ travels by the one mechanism the WebSocket endpoints accept in every runtime.
233
+
234
+ ### Fixed
235
+
236
+ - **`ToolParameter.required` was mandatory, so all-optional tools did not typecheck**
237
+ ([#12](https://github.com/10xHub/agentflow-client/issues/12)). In JSON Schema `required` is
238
+ an optional keyword, but the interface declared it as `required: string[]`, so registering a
239
+ tool whose arguments are all optional failed with `TS2741: Property 'required' is missing`
240
+ unless the caller wrote `required: []` by hand. This hit exactly the read-only tools an agent
241
+ calls most (`list_files`, `read_problems`, `read_terminal`, `read_diff`). `required` and
242
+ `properties` are now both optional, so `parameters: { type: 'object' }` is valid for a tool
243
+ that takes no arguments. `ToolParameter` also accepts arbitrary JSON Schema keywords
244
+ (`additionalProperties`, `$defs`, ...) instead of rejecting them as excess properties.
245
+
246
+ The change is backwards compatible - existing declarations that pass `required` keep working,
247
+ and the wire format is unchanged: `client.setup()` and `ToolExecutor.all_tools()` now fill in
248
+ the omitted keywords via the new exported `normalizeToolParameters()` helper, so the server
249
+ still receives a complete `{ type, properties, required }` schema. Registrations with no
250
+ `parameters` at all now serialize to `{ type: 'object', properties: {}, required: [] }`
251
+ instead of a bare `{}`, which is a valid function schema for every provider.
252
+
253
+ - **`agent.ts` broke type resolution under `moduleResolution: nodenext`.** Its `./message`
254
+ import was the only extensionless relative import in `src/`, so consumers on `node16`/
255
+ `nodenext` - the recommended setting for modern Node projects - got `TS2834` from inside
256
+ `dist/agent.d.ts`. Now imports `./message.js`, matching every other module.
257
+
258
+ - **The three thread-state endpoints rejected string thread IDs.** `threadState()`,
259
+ `updateThreadState()`, and `clearThreadState()` typed `threadId` as `number`, while every
260
+ other thread method (`threadDetails`, `threadMessages`, `addThreadMessages`, `singleMessage`,
261
+ `deleteMessage`, `deleteThread`) already accepted `string | number`. The server types
262
+ `thread_id` as a string in its request schemas, so the three outliers could not be passed a
263
+ thread ID straight from a response without a cast. All three now take `string | number`,
264
+ matching the rest of the surface.
265
+
266
+ This widens a parameter type, so existing calls passing a `number` keep compiling.
267
+
268
+ ### Added
269
+
270
+ - `normalizeToolParameters(parameters?)`, exported from `tools.ts` - applies the JSON Schema
271
+ defaults (`type: 'object'`, `properties: {}`, `required: []`) to a partial tool schema.
272
+ - README: a version-compatibility table mapping client versions to `10xscale-agentflow-cli`
273
+ (API server) and `10xscale-agentflow` (core) versions, since the three packages version
274
+ independently and their numbers do not line up.
275
+
276
+ ---
277
+
278
+ ## [0.3.0] - 2026-07-21
279
+
280
+ ### Fixed
281
+
282
+ - **`uploadFile()` threw on Node 18.** `File` only became a global in Node 20, and the
283
+ upload path did an unguarded `file instanceof File`, so on Node 18 every call failed with
284
+ `ReferenceError: File is not defined` - including calls passing a plain `Blob`, which
285
+ never needed the global at all. The package declares `engines.node >= 18`, so this broke
286
+ file upload for supported runtimes. The check is now guarded before it touches the
287
+ global, and a regression test runs the upload path with `File` removed.
288
+ - **`npm publish` would have failed.** `@10xscale/agentflow-client` is a scoped package,
289
+ and scoped packages default to `restricted`. Without `publishConfig.access: "public"`
290
+ the publish is rejected. Added, along with `provenance: true`.
291
+ - **The build was not cross-platform.** `npm run build` ended in `cp -r dist-types/* dist/`,
292
+ which does not exist on Windows, so Windows contributors could not build the package at
293
+ all. `tsc` now emits declarations straight into `dist/` via `tsconfig.build.json`, and
294
+ the `cp` step is gone.
295
+ - **Shipped sourcemaps did not resolve.** The tarball contained 41 `.map` files but no
296
+ sources, so every map pointed at files the consumer did not have. `src/` is now included
297
+ in `files`.
298
+ - **`NodeJS.Timeout` leaked into the public types.** `forgetMemories` annotated its timer
299
+ with the `NodeJS` namespace, which forced every consumer - including browser-only ones -
300
+ to install `@types/node`. Now uses the portable `ReturnType<typeof setTimeout>`.
301
+ - `Error.captureStackTrace` is now accessed structurally, so the build no longer depends
302
+ on ambient Node typings.
303
+
304
+ ### Added
305
+
306
+ - `client.graphTools()` - lists the tools exposed by the graph's tool nodes, grouped by
307
+ node, each tagged with its source (`local` / `mcp` / `remote`). Types are exported from
308
+ `endpoints/graphTools.ts`.
309
+ - `client.observability(threadId, runId?)` - returns the reconstructed trace (spans,
310
+ events, cost) for a thread, defaulting to the latest run. Types are exported from
311
+ `endpoints/observability.ts`.
312
+ - ESLint 9 (flat config) and Prettier, with `lint`, `format`, `typecheck`, and an
313
+ aggregate `check` script.
314
+ - `tsconfig.build.json` for declaration emit, separate from the type-check config.
315
+ - CI workflow: lint + Prettier + `tsc --noEmit`, tests on Node 18/20/22, and a `package`
316
+ job that verifies every declared entry point exists inside the actual tarball and smoke
317
+ tests both the CJS and ESM entry points from a clean install.
318
+ - Release workflow gated on CI, with a tag-vs-`package.json` version check.
319
+ - CodeQL scanning and Dependabot.
320
+ - `CONTRIBUTING.md`, `SECURITY.md`, `CODE_OF_CONDUCT.md`, `RELEASE_NOTES.md`, issue forms,
321
+ and a pull request template.
322
+
323
+ ### Changed
324
+
325
+ - **Upgraded vitest 1.x to 3.x and vite 5.x to 7.x**, clearing all 11 reported
326
+ vulnerabilities (3 critical, 5 high). `npm audit` now reports zero.
327
+ - Coverage thresholds raised and pinned to the measured numbers as a ratchet
328
+ (72% lines/statements, 82% branches, 76% functions). Note that vitest 3 remaps v8
329
+ coverage more accurately than vitest 1 did, so these read lower than the previous
330
+ config claimed without any real change in what the tests exercise.
331
+ - `tsconfig.json` now type-checks `tests/` as well as `src/`; it previously covered only
332
+ `src/`, so six type errors in the test suite had gone unnoticed. All are fixed.
333
+ - Twelve `@ts-ignore` comments became `@ts-expect-error`, which revealed that every one of
334
+ them was suppressing nothing. All removed.
335
+
336
+ ### Removed
337
+
338
+ - `check.ts` - an unreferenced scratch script at the repo root that imported from a
339
+ non-existent `./dist/index.d.js`.
340
+ - `.npmignore` - dead configuration. `files` in `package.json` takes precedence, so this
341
+ file had no effect and only invited confusion.
342
+ - Dead code in `src`: `makeSingleStreamCall` (`endpoints/stream.ts`),
343
+ `isRemoteToolCallChunk` and `REMOTE_TOOL_CALL_REASON` (`endpoints/wsStream.ts`). All were
344
+ unexported and unreferenced. Three unused imports in `client.ts` were also dropped; the
345
+ types remain publicly exported from their own modules, so this is not an API change.
346
+
347
+ ---
348
+
349
+ ## [0.2.0]
350
+
351
+ Initial entry in this changelog. Releases before `0.2.0` were not tracked here.
352
+
353
+ - a2a, a2ui, and the React surface were removed.
354
+ - Added the realtime audio client (`client.realtime(...)` returning `RealtimeSession`).
355
+ - Added dual ESM/CJS exports.
356
+
357
+ [Unreleased]: https://github.com/10xGraph/10xgraph-client/compare/v1.0.0-rc.1...HEAD
358
+ [1.0.0-rc.1]: https://github.com/10xGraph/10xgraph-client/compare/v0.6.0...v1.0.0-rc.1
359
+ [0.6.0]: https://github.com/10xGraph/10xgraph-client/compare/v0.5.0...v0.6.0
360
+ [0.5.0]: https://github.com/10xHub/agentflow-client/compare/v0.4.0...v0.5.0
361
+ [0.4.0]: https://github.com/10xHub/agentflow-client/compare/v0.3.0...v0.4.0
362
+ [0.3.0]: https://github.com/10xHub/agentflow-client/compare/v-0.2.0...v0.3.0
363
+ [0.2.0]: https://github.com/10xHub/agentflow-client/releases/tag/v-0.2.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 10xScale
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.