@tanstack/ai-devtools-core 0.5.30 → 1.0.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.
package/README.md CHANGED
@@ -19,17 +19,17 @@
19
19
  <br />
20
20
 
21
21
  <div align="center">
22
- <a href="https://npmjs.com/package/@tanstack/ai" target="_parent">
23
- <img alt="NPM downloads" src="https://img.shields.io/npm/dm/@tanstack/ai.svg" />
22
+ <a href="https://npmjs.com/package/@tanstack/ai-devtools-core" target="_parent">
23
+ <img alt="NPM downloads" src="https://img.shields.io/npm/dm/@tanstack/ai-devtools-core.svg" />
24
24
  </a>
25
25
  <a href="https://github.com/TanStack/ai" target="_parent">
26
26
  <img alt="GitHub stars" src="https://img.shields.io/github/stars/TanStack/ai.svg?style=social&label=Star" />
27
27
  </a>
28
- <a href="https://github.com/TanStack/ai/releases" target="_parent">
29
- <img alt="Release" src="https://img.shields.io/github/v/release/tanstack/ai" />
28
+ <a href="https://www.npmjs.com/package/@tanstack/ai-devtools-core" target="_parent">
29
+ <img alt="npm version" src="https://img.shields.io/npm/v/@tanstack/ai-devtools-core.svg" />
30
30
  </a>
31
- <a href="https://bundlephobia.com/result?p=@tanstack/ai@latest" target="_parent">
32
- <img alt="Bundle size" src="https://badgen.net/bundlephobia/minzip/@tanstack/ai@latest" />
31
+ <a href="https://bundlejs.com/?q=%40tanstack%2Fai-devtools-core" target="_parent">
32
+ <img alt="Bundle size" src="https://deno.bundlejs.com/?q=%40tanstack%2Fai-devtools-core&badge" />
33
33
  </a>
34
34
  <a href="https://twitter.com/tan_stack">
35
35
  <img alt="Follow @TanStack" src="https://img.shields.io/twitter/follow/tan_stack.svg?style=social" />
@@ -146,6 +146,7 @@ export async function POST(request: Request) {
146
146
  const stream = chat({
147
147
  adapter: openaiText('gpt-5.2'),
148
148
  messages: body.messages,
149
+ threadId: body.threadId,
149
150
  })
150
151
 
151
152
  return toServerSentEventsResponse(stream)
@@ -203,6 +204,7 @@ const Person = z.object({
203
204
  const person = await chat({
204
205
  adapter: openaiText('gpt-5.2'),
205
206
  messages: [{ role: 'user', content: 'Ada Lovelace, 36' }],
207
+ threadId: 'thread-1',
206
208
  outputSchema: Person,
207
209
  })
208
210
  ```
@@ -242,6 +244,7 @@ Official adapters include:
242
244
  | [`@tanstack/ai-reactor`](https://tanstack.com/ai/latest/docs/adapters/reactor) | Reactor live world and video generation (Orbis, Happy Oyster, LingBot, Helios, FastH3) |
243
245
  | [`@tanstack/ai-worldlabs`](https://tanstack.com/ai/latest/docs/adapters/worldlabs) | World Labs Marble persistent 3D world generation |
244
246
  | [`@tanstack/ai-cloudflare`](https://tanstack.com/ai/latest/docs/adapters/cloudflare) | Cloudflare Workers AI chat, embeddings, image, speech, transcription, and AI Gateway |
247
+ | [`@tanstack/ai-neon`](https://tanstack.com/ai/latest/docs/adapters/neon) | Neon AI Gateway chat and embeddings for Claude, GPT, Gemini, and open models |
245
248
 
246
249
  The adapter system is tree-shakeable by activity. Import `openaiText` for chat,
247
250
  `openaiImage` for images, `falVideo` for video, `geminiSpeech` for TTS, and so
@@ -249,15 +252,15 @@ on.
249
252
 
250
253
  ## Framework Packages
251
254
 
252
- | Package | What it provides |
253
- | ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
254
- | [`@tanstack/ai-client`](https://tanstack.com/ai/latest/docs/api/ai-client) | Headless chat, realtime, and generation clients |
255
- | [`@tanstack/ai-react`](https://tanstack.com/ai/latest/docs/api/ai-react) | React hooks including `useChat`, `useRealtimeChat`, and generation hooks |
256
- | [`@tanstack/ai-solid`](https://tanstack.com/ai/latest/docs/api/ai-solid) | Solid hooks for chat and generations |
257
- | [`@tanstack/ai-vue`](https://tanstack.com/ai/latest/docs/api/ai-vue) | Vue composables for chat and generations |
258
- | [`@tanstack/ai-svelte`](https://tanstack.com/ai/latest/docs/api/ai-svelte) | Svelte 5 factories for chat and generations |
259
- | [`@tanstack/ai-preact`](https://tanstack.com/ai/latest/docs/api/ai-preact) | Preact hooks for chat |
260
- | `@tanstack/ai-react/ui`, `@tanstack/ai-solid/ui`, `@tanstack/ai-vue/ui`, `@tanstack/ai-svelte/ui` | Headless UI components for chat interfaces. `@tanstack/ai-react-ui`, `@tanstack/ai-solid-ui`, and `@tanstack/ai-vue-ui` are deprecated. |
255
+ | Package | What it provides |
256
+ | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
257
+ | [`@tanstack/ai-client`](https://tanstack.com/ai/latest/docs/api/ai-client) | Headless chat, realtime, and generation clients |
258
+ | [`@tanstack/ai-react`](https://tanstack.com/ai/latest/docs/api/ai-react) | React hooks including `useChat`, `useRealtimeChat`, and generation hooks |
259
+ | [`@tanstack/ai-solid`](https://tanstack.com/ai/latest/docs/api/ai-solid) | Solid hooks for chat and generations |
260
+ | [`@tanstack/ai-vue`](https://tanstack.com/ai/latest/docs/api/ai-vue) | Vue composables for chat and generations |
261
+ | [`@tanstack/ai-svelte`](https://tanstack.com/ai/latest/docs/api/ai-svelte) | Svelte 5 factories for chat and generations |
262
+ | [`@tanstack/ai-preact`](https://tanstack.com/ai/latest/docs/api/ai-preact) | Preact hooks for chat |
263
+ | `@tanstack/ai-react/ui`, `@tanstack/ai-solid/ui`, `@tanstack/ai-vue/ui`, `@tanstack/ai-svelte/ui` | Headless UI components for chat interfaces. |
261
264
 
262
265
  ## Advanced Docs
263
266
 
@@ -295,9 +298,9 @@ on.
295
298
  <td>
296
299
  <a href="https://www.coderabbit.ai/?via=tanstack&dub_id=aCcEEdAOqqutX6OS">
297
300
  <picture>
298
- <source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/coderabbit-dark-D643Zkrv.svg" />
299
- <source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/coderabbit-light-CIzGLYU_.svg" />
300
- <img src="https://tanstack.com/assets/coderabbit-light-CIzGLYU_.svg" height="40" alt="CodeRabbit" />
301
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/TanStack/tanstack.com/main/src/images/coderabbit-dark.svg" />
302
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/TanStack/tanstack.com/main/src/images/coderabbit-light.svg" />
303
+ <img src="https://raw.githubusercontent.com/TanStack/tanstack.com/main/src/images/coderabbit-light.svg" height="40" alt="CodeRabbit" />
301
304
  </picture>
302
305
  </a>
303
306
  </td>
@@ -306,7 +309,7 @@ on.
306
309
  <picture>
307
310
  <source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/cloudflare-white-Co-Tyjbl.svg" />
308
311
  <source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/cloudflare-black-6Ojsn8yh.svg" />
309
- <img src="https://tanstack.com/assets/cloudflare-white-Co-Tyjbl.svg" height="60" alt="Cloudflare" />
312
+ <img src="https://tanstack.com/assets/cloudflare-black-6Ojsn8yh.svg" height="60" alt="Cloudflare" />
310
313
  </picture>
311
314
  </a>
312
315
  </td>
@@ -5749,53 +5749,6 @@ var AIProvider = (props) => {
5749
5749
  }
5750
5750
  addChunkToMessage(clientId, chunk);
5751
5751
  }));
5752
- cleanupFns.push(aiEventClient.on("tools:approval:responded", (e) => {
5753
- const {
5754
- clientId,
5755
- threadId,
5756
- streamId,
5757
- toolCallId,
5758
- approvalId,
5759
- approved,
5760
- timestamp
5761
- } = e.payload;
5762
- const conversationIds = getToolEventConversationIds({
5763
- clientId,
5764
- threadId,
5765
- streamId,
5766
- toolCallId,
5767
- approvalId
5768
- });
5769
- for (const conversationId of conversationIds) {
5770
- const conv = state.conversations[conversationId];
5771
- if (!conv) continue;
5772
- const location = findToolCallLocation(conversationId, {
5773
- toolCallId,
5774
- approvalId
5775
- });
5776
- if (!location) continue;
5777
- updateToolCall(conversationId, location.messageIndex, location.toolCallIndex, {
5778
- state: approved ? "approved" : "denied",
5779
- approvalRequired: false,
5780
- approvalId,
5781
- approvalApproved: approved
5782
- });
5783
- const message = conv.messages[location.messageIndex];
5784
- const chunk = {
5785
- id: `chunk-${Date.now()}-${Math.random()}`,
5786
- type: "approval",
5787
- ...message?.id ? {
5788
- messageId: message.id
5789
- } : {},
5790
- toolCallId,
5791
- approvalId,
5792
- approved,
5793
- timestamp,
5794
- chunkCount: 1
5795
- };
5796
- addChunkToMessage(conversationId, chunk);
5797
- }
5798
- }));
5799
5752
  cleanupFns.push(aiEventClient.on("tools:call:updated", (e) => {
5800
5753
  const {
5801
5754
  clientId,
@@ -5728,53 +5728,6 @@ var AIProvider = (props) => {
5728
5728
  }
5729
5729
  addChunkToMessage(clientId, chunk);
5730
5730
  }));
5731
- cleanupFns.push(aiEventClient.on("tools:approval:responded", (e) => {
5732
- const {
5733
- clientId,
5734
- threadId,
5735
- streamId,
5736
- toolCallId,
5737
- approvalId,
5738
- approved,
5739
- timestamp
5740
- } = e.payload;
5741
- const conversationIds = getToolEventConversationIds({
5742
- clientId,
5743
- threadId,
5744
- streamId,
5745
- toolCallId,
5746
- approvalId
5747
- });
5748
- for (const conversationId of conversationIds) {
5749
- const conv = state.conversations[conversationId];
5750
- if (!conv) continue;
5751
- const location = findToolCallLocation(conversationId, {
5752
- toolCallId,
5753
- approvalId
5754
- });
5755
- if (!location) continue;
5756
- updateToolCall(conversationId, location.messageIndex, location.toolCallIndex, {
5757
- state: approved ? "approved" : "denied",
5758
- approvalRequired: false,
5759
- approvalId,
5760
- approvalApproved: approved
5761
- });
5762
- const message = conv.messages[location.messageIndex];
5763
- const chunk = {
5764
- id: `chunk-${Date.now()}-${Math.random()}`,
5765
- type: "approval",
5766
- ...message?.id ? {
5767
- messageId: message.id
5768
- } : {},
5769
- toolCallId,
5770
- approvalId,
5771
- approved,
5772
- timestamp,
5773
- chunkCount: 1
5774
- };
5775
- addChunkToMessage(conversationId, chunk);
5776
- }
5777
- }));
5778
5731
  cleanupFns.push(aiEventClient.on("tools:call:updated", (e) => {
5779
5732
  const {
5780
5733
  clientId,
@@ -5766,53 +5766,6 @@ var AIProvider = (props) => {
5766
5766
  }
5767
5767
  addChunkToMessage(clientId, chunk);
5768
5768
  }));
5769
- cleanupFns.push(aiEventClient.on("tools:approval:responded", (e) => {
5770
- const {
5771
- clientId,
5772
- threadId,
5773
- streamId,
5774
- toolCallId,
5775
- approvalId,
5776
- approved,
5777
- timestamp
5778
- } = e.payload;
5779
- const conversationIds = getToolEventConversationIds({
5780
- clientId,
5781
- threadId,
5782
- streamId,
5783
- toolCallId,
5784
- approvalId
5785
- });
5786
- for (const conversationId of conversationIds) {
5787
- const conv = state.conversations[conversationId];
5788
- if (!conv) continue;
5789
- const location = findToolCallLocation(conversationId, {
5790
- toolCallId,
5791
- approvalId
5792
- });
5793
- if (!location) continue;
5794
- updateToolCall(conversationId, location.messageIndex, location.toolCallIndex, {
5795
- state: approved ? "approved" : "denied",
5796
- approvalRequired: false,
5797
- approvalId,
5798
- approvalApproved: approved
5799
- });
5800
- const message = conv.messages[location.messageIndex];
5801
- const chunk = {
5802
- id: `chunk-${Date.now()}-${Math.random()}`,
5803
- type: "approval",
5804
- ...message?.id ? {
5805
- messageId: message.id
5806
- } : {},
5807
- toolCallId,
5808
- approvalId,
5809
- approved,
5810
- timestamp,
5811
- chunkCount: 1
5812
- };
5813
- addChunkToMessage(conversationId, chunk);
5814
- }
5815
- }));
5816
5769
  cleanupFns.push(aiEventClient.on("tools:call:updated", (e) => {
5817
5770
  const {
5818
5771
  clientId,
package/dist/dev.js CHANGED
@@ -2,7 +2,7 @@ import { constructCoreClass } from '@tanstack/devtools-utils/solid/class';
2
2
 
3
3
  // src/core.ts
4
4
  var [AiDevtoolsCore, AiDevtoolsCoreNoOp] = constructCoreClass(
5
- () => import('./Shell/Z7BWPTSB.js')
5
+ () => import('./Shell/UIPYEUHK.js')
6
6
  );
7
7
 
8
8
  // src/index.ts
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { constructCoreClass } from '@tanstack/devtools-utils/solid/class';
2
2
 
3
3
  // src/core.ts
4
4
  var [AiDevtoolsCore, AiDevtoolsCoreNoOp] = constructCoreClass(
5
- () => import('./Shell/FX355YGU.js')
5
+ () => import('./Shell/6QCPTVG7.js')
6
6
  );
7
7
 
8
8
  // src/index.ts
@@ -5749,53 +5749,6 @@ var AIProvider = (props) => {
5749
5749
  }
5750
5750
  addChunkToMessage(clientId, chunk);
5751
5751
  }));
5752
- cleanupFns.push(aiEventClient.on("tools:approval:responded", (e) => {
5753
- const {
5754
- clientId,
5755
- threadId,
5756
- streamId,
5757
- toolCallId,
5758
- approvalId,
5759
- approved,
5760
- timestamp
5761
- } = e.payload;
5762
- const conversationIds = getToolEventConversationIds({
5763
- clientId,
5764
- threadId,
5765
- streamId,
5766
- toolCallId,
5767
- approvalId
5768
- });
5769
- for (const conversationId of conversationIds) {
5770
- const conv = state.conversations[conversationId];
5771
- if (!conv) continue;
5772
- const location = findToolCallLocation(conversationId, {
5773
- toolCallId,
5774
- approvalId
5775
- });
5776
- if (!location) continue;
5777
- updateToolCall(conversationId, location.messageIndex, location.toolCallIndex, {
5778
- state: approved ? "approved" : "denied",
5779
- approvalRequired: false,
5780
- approvalId,
5781
- approvalApproved: approved
5782
- });
5783
- const message = conv.messages[location.messageIndex];
5784
- const chunk = {
5785
- id: `chunk-${Date.now()}-${Math.random()}`,
5786
- type: "approval",
5787
- ...message?.id ? {
5788
- messageId: message.id
5789
- } : {},
5790
- toolCallId,
5791
- approvalId,
5792
- approved,
5793
- timestamp,
5794
- chunkCount: 1
5795
- };
5796
- addChunkToMessage(conversationId, chunk);
5797
- }
5798
- }));
5799
5752
  cleanupFns.push(aiEventClient.on("tools:call:updated", (e) => {
5800
5753
  const {
5801
5754
  clientId,
@@ -5728,53 +5728,6 @@ var AIProvider = (props) => {
5728
5728
  }
5729
5729
  addChunkToMessage(clientId, chunk);
5730
5730
  }));
5731
- cleanupFns.push(aiEventClient.on("tools:approval:responded", (e) => {
5732
- const {
5733
- clientId,
5734
- threadId,
5735
- streamId,
5736
- toolCallId,
5737
- approvalId,
5738
- approved,
5739
- timestamp
5740
- } = e.payload;
5741
- const conversationIds = getToolEventConversationIds({
5742
- clientId,
5743
- threadId,
5744
- streamId,
5745
- toolCallId,
5746
- approvalId
5747
- });
5748
- for (const conversationId of conversationIds) {
5749
- const conv = state.conversations[conversationId];
5750
- if (!conv) continue;
5751
- const location = findToolCallLocation(conversationId, {
5752
- toolCallId,
5753
- approvalId
5754
- });
5755
- if (!location) continue;
5756
- updateToolCall(conversationId, location.messageIndex, location.toolCallIndex, {
5757
- state: approved ? "approved" : "denied",
5758
- approvalRequired: false,
5759
- approvalId,
5760
- approvalApproved: approved
5761
- });
5762
- const message = conv.messages[location.messageIndex];
5763
- const chunk = {
5764
- id: `chunk-${Date.now()}-${Math.random()}`,
5765
- type: "approval",
5766
- ...message?.id ? {
5767
- messageId: message.id
5768
- } : {},
5769
- toolCallId,
5770
- approvalId,
5771
- approved,
5772
- timestamp,
5773
- chunkCount: 1
5774
- };
5775
- addChunkToMessage(conversationId, chunk);
5776
- }
5777
- }));
5778
5731
  cleanupFns.push(aiEventClient.on("tools:call:updated", (e) => {
5779
5732
  const {
5780
5733
  clientId,
@@ -5766,53 +5766,6 @@ var AIProvider = (props) => {
5766
5766
  }
5767
5767
  addChunkToMessage(clientId, chunk);
5768
5768
  }));
5769
- cleanupFns.push(aiEventClient.on("tools:approval:responded", (e) => {
5770
- const {
5771
- clientId,
5772
- threadId,
5773
- streamId,
5774
- toolCallId,
5775
- approvalId,
5776
- approved,
5777
- timestamp
5778
- } = e.payload;
5779
- const conversationIds = getToolEventConversationIds({
5780
- clientId,
5781
- threadId,
5782
- streamId,
5783
- toolCallId,
5784
- approvalId
5785
- });
5786
- for (const conversationId of conversationIds) {
5787
- const conv = state.conversations[conversationId];
5788
- if (!conv) continue;
5789
- const location = findToolCallLocation(conversationId, {
5790
- toolCallId,
5791
- approvalId
5792
- });
5793
- if (!location) continue;
5794
- updateToolCall(conversationId, location.messageIndex, location.toolCallIndex, {
5795
- state: approved ? "approved" : "denied",
5796
- approvalRequired: false,
5797
- approvalId,
5798
- approvalApproved: approved
5799
- });
5800
- const message = conv.messages[location.messageIndex];
5801
- const chunk = {
5802
- id: `chunk-${Date.now()}-${Math.random()}`,
5803
- type: "approval",
5804
- ...message?.id ? {
5805
- messageId: message.id
5806
- } : {},
5807
- toolCallId,
5808
- approvalId,
5809
- approved,
5810
- timestamp,
5811
- chunkCount: 1
5812
- };
5813
- addChunkToMessage(conversationId, chunk);
5814
- }
5815
- }));
5816
5769
  cleanupFns.push(aiEventClient.on("tools:call:updated", (e) => {
5817
5770
  const {
5818
5771
  clientId,
@@ -2,7 +2,7 @@ import { constructCoreClass } from '@tanstack/devtools-utils/solid/class';
2
2
 
3
3
  // src/core.ts
4
4
  var [AiDevtoolsCore, AiDevtoolsCoreNoOp] = constructCoreClass(
5
- () => import('./Shell/Z7BWPTSB.js')
5
+ () => import('./Shell/UIPYEUHK.js')
6
6
  );
7
7
 
8
8
  export { AiDevtoolsCore };
@@ -2,7 +2,7 @@ import { constructCoreClass } from '@tanstack/devtools-utils/solid/class';
2
2
 
3
3
  // src/core.ts
4
4
  var [AiDevtoolsCore, AiDevtoolsCoreNoOp] = constructCoreClass(
5
- () => import('./Shell/FX355YGU.js')
5
+ () => import('./Shell/6QCPTVG7.js')
6
6
  );
7
7
 
8
8
  export { AiDevtoolsCore };
@@ -2,7 +2,7 @@ import { constructCoreClass } from '@tanstack/devtools-utils/solid/class';
2
2
 
3
3
  // src/core.ts
4
4
  var [AiDevtoolsCore, AiDevtoolsCoreNoOp] = constructCoreClass(
5
- () => import('./Shell/E43JXE77.js')
5
+ () => import('./Shell/SBYXDNZ3.js')
6
6
  );
7
7
 
8
8
  export { AiDevtoolsCore };
package/dist/server.js CHANGED
@@ -2,7 +2,7 @@ import { constructCoreClass } from '@tanstack/devtools-utils/solid/class';
2
2
 
3
3
  // src/core.ts
4
4
  var [AiDevtoolsCore, AiDevtoolsCoreNoOp] = constructCoreClass(
5
- () => import('./Shell/E43JXE77.js')
5
+ () => import('./Shell/SBYXDNZ3.js')
6
6
  );
7
7
 
8
8
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/ai-devtools-core",
3
- "version": "0.5.30",
3
+ "version": "1.0.1",
4
4
  "description": "Core TanStack AI Devtools plugin for inspecting chat messages, tool calls, streams, and errors.",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -84,8 +84,8 @@
84
84
  "@tanstack/devtools-utils": "^0.7.0",
85
85
  "goober": "^2.1.18",
86
86
  "solid-js": "^1.9.10",
87
- "@tanstack/ai": "^0.71.0",
88
- "@tanstack/ai-event-client": "^0.13.1"
87
+ "@tanstack/ai": "^1.0.1",
88
+ "@tanstack/ai-event-client": "^1.0.0"
89
89
  },
90
90
  "devDependencies": {
91
91
  "@vitest/coverage-v8": "4.1.10",
@@ -64,11 +64,10 @@ export function getHookDisplayName(hook: HookRecord): string {
64
64
  /**
65
65
  * Stable identity string shown under the hook title.
66
66
  *
67
- * Prefer `threadId` when present — for generation hooks that is the single
68
- * app-chosen scope (and, after the client prefers `threadId` over deprecated
69
- * `id`, often equals the registry key too). Fall back to the registry `id`
70
- * (devtools hook id / legacy client id) for ephemeral hooks that never named
71
- * a thread.
67
+ * Prefer `threadId` when present. For generation hooks it is the single
68
+ * scope that the app chooses, and it is often the registry key too. Fall back
69
+ * to the registry `id` (the devtools hook id) for short-lived hooks that do
70
+ * not name a thread.
72
71
  */
73
72
  export function getHookIdentityLabel(hook: HookRecord): string {
74
73
  return hook.threadId ?? hook.id
@@ -1737,65 +1737,6 @@ export const AIProvider: ParentComponent = (props) => {
1737
1737
  }),
1738
1738
  )
1739
1739
 
1740
- cleanupFns.push(
1741
- aiEventClient.on('tools:approval:responded', (e) => {
1742
- const {
1743
- clientId,
1744
- threadId,
1745
- streamId,
1746
- toolCallId,
1747
- approvalId,
1748
- approved,
1749
- timestamp,
1750
- } = e.payload
1751
-
1752
- const conversationIds = getToolEventConversationIds({
1753
- clientId,
1754
- threadId,
1755
- streamId,
1756
- toolCallId,
1757
- approvalId,
1758
- })
1759
-
1760
- for (const conversationId of conversationIds) {
1761
- const conv = state.conversations[conversationId]
1762
- if (!conv) continue
1763
-
1764
- const location = findToolCallLocation(conversationId, {
1765
- toolCallId,
1766
- approvalId,
1767
- })
1768
- if (!location) continue
1769
-
1770
- updateToolCall(
1771
- conversationId,
1772
- location.messageIndex,
1773
- location.toolCallIndex,
1774
- {
1775
- state: approved ? 'approved' : 'denied',
1776
- approvalRequired: false,
1777
- approvalId,
1778
- approvalApproved: approved,
1779
- },
1780
- )
1781
-
1782
- const message = conv.messages[location.messageIndex]
1783
- const chunk: Chunk = {
1784
- id: `chunk-${Date.now()}-${Math.random()}`,
1785
- type: 'approval',
1786
- ...(message?.id ? { messageId: message.id } : {}),
1787
- toolCallId,
1788
- approvalId,
1789
- approved,
1790
- timestamp,
1791
- chunkCount: 1,
1792
- }
1793
-
1794
- addChunkToMessage(conversationId, chunk)
1795
- }
1796
- }),
1797
- )
1798
-
1799
1740
  cleanupFns.push(
1800
1741
  aiEventClient.on('tools:call:updated', (e) => {
1801
1742
  const {