@assistant-ui/react 0.11.30 → 0.11.32
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/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.js +28 -15
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.js.map +1 -1
- package/dist/tests/setup.js +8 -8
- package/dist/tests/setup.js.map +1 -1
- package/package.json +9 -9
- package/src/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.ts +30 -16
- package/src/model-context/frame/SPEC_AssistantFrame.md +2 -2
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"conversational-ui",
|
|
29
29
|
"conversational-ai"
|
|
30
30
|
],
|
|
31
|
-
"version": "0.11.
|
|
31
|
+
"version": "0.11.32",
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"type": "module",
|
|
34
34
|
"exports": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
],
|
|
49
49
|
"sideEffects": false,
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"assistant-cloud": "^0.1.
|
|
52
|
-
"@assistant-ui/tap": "^0.1.
|
|
51
|
+
"assistant-cloud": "^0.1.4",
|
|
52
|
+
"@assistant-ui/tap": "^0.1.3",
|
|
53
53
|
"@radix-ui/primitive": "^1.1.3",
|
|
54
54
|
"@radix-ui/react-compose-refs": "^1.1.2",
|
|
55
55
|
"@radix-ui/react-context": "^1.1.2",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"@radix-ui/react-use-callback-ref": "^1.1.1",
|
|
60
60
|
"@radix-ui/react-use-escape-keydown": "^1.1.1",
|
|
61
61
|
"@standard-schema/spec": "^1.0.0",
|
|
62
|
-
"assistant-stream": "^0.2.
|
|
62
|
+
"assistant-stream": "^0.2.36",
|
|
63
63
|
"json-schema": "^0.4.0",
|
|
64
64
|
"nanoid": "5.1.6",
|
|
65
65
|
"react-textarea-autosize": "^8.5.9",
|
|
66
|
-
"zod": "^4.1.
|
|
66
|
+
"zod": "^4.1.12",
|
|
67
67
|
"zustand": "^5.0.8"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -81,12 +81,12 @@
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@stryker-mutator/core": "^9.
|
|
85
|
-
"@stryker-mutator/vitest-runner": "^9.
|
|
84
|
+
"@stryker-mutator/core": "^9.2.0",
|
|
85
|
+
"@stryker-mutator/vitest-runner": "^9.2.0",
|
|
86
86
|
"@types/json-schema": "^7.0.15",
|
|
87
|
-
"@types/node": "^24.
|
|
87
|
+
"@types/node": "^24.8.1",
|
|
88
88
|
"eslint": "^9",
|
|
89
|
-
"eslint-config-next": "15.5.
|
|
89
|
+
"eslint-config-next": "15.5.6",
|
|
90
90
|
"tsx": "^4.20.6",
|
|
91
91
|
"vitest": "^3.2.4",
|
|
92
92
|
"@assistant-ui/x-buildutils": "0.0.1"
|
|
@@ -53,6 +53,7 @@ export function useToolInvocations({
|
|
|
53
53
|
{
|
|
54
54
|
argsText: string;
|
|
55
55
|
hasResult: boolean;
|
|
56
|
+
argsComplete: boolean;
|
|
56
57
|
controller: ToolCallStreamController;
|
|
57
58
|
}
|
|
58
59
|
>
|
|
@@ -154,32 +155,44 @@ export function useToolInvocations({
|
|
|
154
155
|
lastState = {
|
|
155
156
|
argsText: "",
|
|
156
157
|
hasResult: false,
|
|
158
|
+
argsComplete: false,
|
|
157
159
|
controller: toolCallController,
|
|
158
160
|
};
|
|
159
161
|
lastToolStates.current[content.toolCallId] = lastState;
|
|
160
162
|
}
|
|
161
163
|
|
|
162
164
|
if (content.argsText !== lastState.argsText) {
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
if (lastState.argsComplete) {
|
|
166
|
+
if (process.env["NODE_ENV"] !== "production") {
|
|
167
|
+
console.warn(
|
|
168
|
+
"argsText updated after controller was closed:",
|
|
169
|
+
{ previous: lastState.argsText, next: content.argsText },
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
if (!content.argsText.startsWith(lastState.argsText)) {
|
|
174
|
+
throw new Error(
|
|
175
|
+
`Tool call argsText can only be appended, not updated: ${content.argsText} does not start with ${lastState.argsText}`,
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const argsTextDelta = content.argsText.slice(
|
|
180
|
+
lastState.argsText.length,
|
|
166
181
|
);
|
|
167
|
-
|
|
182
|
+
lastState.controller.argsText.append(argsTextDelta);
|
|
168
183
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
184
|
+
const shouldClose = isArgsTextComplete(content.argsText);
|
|
185
|
+
if (shouldClose) {
|
|
186
|
+
lastState.controller.argsText.close();
|
|
187
|
+
}
|
|
173
188
|
|
|
174
|
-
|
|
175
|
-
|
|
189
|
+
lastToolStates.current[content.toolCallId] = {
|
|
190
|
+
argsText: content.argsText,
|
|
191
|
+
hasResult: lastState.hasResult,
|
|
192
|
+
argsComplete: shouldClose,
|
|
193
|
+
controller: lastState.controller,
|
|
194
|
+
};
|
|
176
195
|
}
|
|
177
|
-
|
|
178
|
-
lastToolStates.current[content.toolCallId] = {
|
|
179
|
-
argsText: content.argsText,
|
|
180
|
-
hasResult: lastState.hasResult,
|
|
181
|
-
controller: lastState.controller,
|
|
182
|
-
};
|
|
183
196
|
}
|
|
184
197
|
|
|
185
198
|
if (content.result !== undefined && !lastState.hasResult) {
|
|
@@ -194,6 +207,7 @@ export function useToolInvocations({
|
|
|
194
207
|
|
|
195
208
|
lastToolStates.current[content.toolCallId] = {
|
|
196
209
|
hasResult: true,
|
|
210
|
+
argsComplete: true,
|
|
197
211
|
argsText: lastState.argsText,
|
|
198
212
|
controller: lastState.controller,
|
|
199
213
|
};
|
|
@@ -12,7 +12,7 @@ Supported features are:
|
|
|
12
12
|
|
|
13
13
|
Out of scope for now:
|
|
14
14
|
|
|
15
|
-
- model configuration (
|
|
15
|
+
- model configuration (temperature, etc.)
|
|
16
16
|
- ToolCallReader API (incremental reading support)
|
|
17
17
|
|
|
18
18
|
### API design
|
|
@@ -57,7 +57,7 @@ The communication between `AssistantFrameProvider` (iframe) and `AssistantFrameH
|
|
|
57
57
|
|
|
58
58
|
#### ModelContextProvider API
|
|
59
59
|
|
|
60
|
-
AssistantFrameHost implements the ModelContextProvider API. It immediately subscribes to the iframe for updates. This is
|
|
60
|
+
AssistantFrameHost implements the ModelContextProvider API. It immediately subscribes to the iframe for updates. This is necessary because ModelContextProvider.getModelContext() is synchronous.
|
|
61
61
|
|
|
62
62
|
#### Message Channel
|
|
63
63
|
|