@tanstack/ai-devtools-core 0.5.29 → 1.0.0
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 +11 -9
- package/dist/{production/Shell/FX355YGU.js → Shell/6QCPTVG7.js} +0 -47
- package/dist/Shell/{E43JXE77.js → SBYXDNZ3.js} +0 -47
- package/dist/Shell/{Z7BWPTSB.js → UIPYEUHK.js} +0 -47
- package/dist/dev.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{Shell/FX355YGU.js → production/Shell/6QCPTVG7.js} +0 -47
- package/dist/production/Shell/{E43JXE77.js → SBYXDNZ3.js} +0 -47
- package/dist/production/Shell/{Z7BWPTSB.js → UIPYEUHK.js} +0 -47
- package/dist/production/dev.js +1 -1
- package/dist/production/index.js +1 -1
- package/dist/production/server.js +1 -1
- package/dist/server.js +1 -1
- package/package.json +3 -3
- package/src/components/hooks/hook-dashboard-model.ts +4 -5
- package/src/store/ai-context.tsx +0 -59
package/README.md
CHANGED
|
@@ -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
|
```
|
|
@@ -249,15 +251,15 @@ on.
|
|
|
249
251
|
|
|
250
252
|
## Framework Packages
|
|
251
253
|
|
|
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.
|
|
254
|
+
| Package | What it provides |
|
|
255
|
+
| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
|
|
256
|
+
| [`@tanstack/ai-client`](https://tanstack.com/ai/latest/docs/api/ai-client) | Headless chat, realtime, and generation clients |
|
|
257
|
+
| [`@tanstack/ai-react`](https://tanstack.com/ai/latest/docs/api/ai-react) | React hooks including `useChat`, `useRealtimeChat`, and generation hooks |
|
|
258
|
+
| [`@tanstack/ai-solid`](https://tanstack.com/ai/latest/docs/api/ai-solid) | Solid hooks for chat and generations |
|
|
259
|
+
| [`@tanstack/ai-vue`](https://tanstack.com/ai/latest/docs/api/ai-vue) | Vue composables for chat and generations |
|
|
260
|
+
| [`@tanstack/ai-svelte`](https://tanstack.com/ai/latest/docs/api/ai-svelte) | Svelte 5 factories for chat and generations |
|
|
261
|
+
| [`@tanstack/ai-preact`](https://tanstack.com/ai/latest/docs/api/ai-preact) | Preact hooks for chat |
|
|
262
|
+
| `@tanstack/ai-react/ui`, `@tanstack/ai-solid/ui`, `@tanstack/ai-vue/ui`, `@tanstack/ai-svelte/ui` | Headless UI components for chat interfaces. |
|
|
261
263
|
|
|
262
264
|
## Advanced Docs
|
|
263
265
|
|
|
@@ -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
package/dist/index.js
CHANGED
|
@@ -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/production/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/
|
|
5
|
+
() => import('./Shell/UIPYEUHK.js')
|
|
6
6
|
);
|
|
7
7
|
|
|
8
8
|
export { AiDevtoolsCore };
|
package/dist/production/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/
|
|
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/
|
|
5
|
+
() => import('./Shell/SBYXDNZ3.js')
|
|
6
6
|
);
|
|
7
7
|
|
|
8
8
|
export { AiDevtoolsCore };
|
package/dist/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/ai-devtools-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
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.
|
|
88
|
-
"@tanstack/ai-event-client": "^0.
|
|
87
|
+
"@tanstack/ai": "^1.0.0",
|
|
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
|
|
68
|
-
* app
|
|
69
|
-
* `id
|
|
70
|
-
*
|
|
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
|
package/src/store/ai-context.tsx
CHANGED
|
@@ -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 {
|